summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Mao <[email protected]>2023-01-13 00:49:41 -0800
committerGitHub <[email protected]>2023-01-13 00:49:41 -0800
commit8ff2c86adcfbe50187d2aeb38a842095b137b7e4 (patch)
treef43c7381070bb50726d9b191add2209eb4a83f24
parent92042ea4305ded0b44ae538b9fe31d56a4bb80e2 (diff)
parent948b220e8bd0819d5b340c06c969c497556da950 (diff)
[UMDF v1] Remove General, USB, serial
-rw-r--r--general/echo/umdf/Comsup.cpp344
-rw-r--r--general/echo/umdf/Comsup.h215
-rw-r--r--general/echo/umdf/Device.cpp415
-rw-r--r--general/echo/umdf/Device.h217
-rw-r--r--general/echo/umdf/Driver.cpp220
-rw-r--r--general/echo/umdf/Driver.h149
-rw-r--r--general/echo/umdf/Echo.rc21
-rw-r--r--general/echo/umdf/Queue.cpp545
-rw-r--r--general/echo/umdf/Queue.h213
-rw-r--r--general/echo/umdf/README.md120
-rw-r--r--general/echo/umdf/WUDFEchoDriver.inxbin4412 -> 0 bytes
-rw-r--r--general/echo/umdf/WUDFEchoDriver.vcxproj262
-rw-r--r--general/echo/umdf/WUDFEchoDriver.vcxproj.Filters46
-rw-r--r--general/echo/umdf/dllsup.cpp176
-rw-r--r--general/echo/umdf/echo.sln28
-rw-r--r--general/echo/umdf/echodriver.ctl1
-rw-r--r--general/echo/umdf/exports.def10
-rw-r--r--general/echo/umdf/internal.h114
-rw-r--r--general/echo/umdfSocketEcho/Driver/Connection.cpp263
-rw-r--r--general/echo/umdfSocketEcho/Driver/FileContext.h30
-rw-r--r--general/echo/umdfSocketEcho/Driver/Queue.cpp580
-rw-r--r--general/echo/umdfSocketEcho/Driver/Queue.h83
-rw-r--r--general/echo/umdfSocketEcho/Driver/SocketEcho.inxbin4280 -> 0 bytes
-rw-r--r--general/echo/umdfSocketEcho/Driver/SocketEcho.rc21
-rw-r--r--general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj251
-rw-r--r--general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj.Filters46
-rw-r--r--general/echo/umdfSocketEcho/Driver/connection.h32
-rw-r--r--general/echo/umdfSocketEcho/Driver/device.cpp469
-rw-r--r--general/echo/umdfSocketEcho/Driver/device.h70
-rw-r--r--general/echo/umdfSocketEcho/Driver/devicecontext.h32
-rw-r--r--general/echo/umdfSocketEcho/Driver/dllsup.cpp111
-rw-r--r--general/echo/umdfSocketEcho/Driver/driver.cpp174
-rw-r--r--general/echo/umdfSocketEcho/Driver/driver.h53
-rw-r--r--general/echo/umdfSocketEcho/Driver/exports.def6
-rw-r--r--general/echo/umdfSocketEcho/Driver/internal.h117
-rw-r--r--general/echo/umdfSocketEcho/Exe/internal.h18
-rw-r--r--general/echo/umdfSocketEcho/Exe/socketechoserver.cpp512
-rw-r--r--general/echo/umdfSocketEcho/Exe/socketechoserver.h48
-rw-r--r--general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj190
-rw-r--r--general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj.Filters22
-rw-r--r--general/echo/umdfSocketEcho/README.md146
-rw-r--r--general/echo/umdfSocketEcho/umdfsocketecho.sln46
-rw-r--r--general/toaster/toastDrv/Package/package.VcxProj6
-rw-r--r--general/toaster/toastDrv/README.md88
-rw-r--r--general/toaster/toastDrv/toaster.sln30
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/Device.cpp318
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/Device.h162
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/Driver.cpp207
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/Driver.h146
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.cpp538
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.h228
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/ToastMon.rc21
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inxbin4034 -> 0 bytes
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj285
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj.Filters46
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/comsup.cpp344
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/comsup.h215
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/dllsup.cpp174
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/exports.def4
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/internal.h109
-rw-r--r--general/toaster/toastDrv/umdf/Toastmon/list.h77
-rw-r--r--general/toaster/toastDrv/umdf/func/Device.cpp228
-rw-r--r--general/toaster/toastDrv/umdf/func/Device.h78
-rw-r--r--general/toaster/toastDrv/umdf/func/Driver.cpp205
-rw-r--r--general/toaster/toastDrv/umdf/func/Driver.h59
-rw-r--r--general/toaster/toastDrv/umdf/func/Queue.cpp283
-rw-r--r--general/toaster/toastDrv/umdf/func/Queue.h96
-rw-r--r--general/toaster/toastDrv/umdf/func/WUDFToaster.cpp88
-rw-r--r--general/toaster/toastDrv/umdf/func/WUDFToaster.ctl2
-rw-r--r--general/toaster/toastDrv/umdf/func/WUDFToaster.def6
-rw-r--r--general/toaster/toastDrv/umdf/func/WUDFToaster.idl40
-rw-r--r--general/toaster/toastDrv/umdf/func/WUDFToaster.inxbin4510 -> 0 bytes
-rw-r--r--general/toaster/toastDrv/umdf/func/WUDFToaster.rc22
-rw-r--r--general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj338
-rw-r--r--general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj.Filters55
-rw-r--r--general/toaster/toastDrv/umdf/func/internal.h114
-rw-r--r--general/toaster/toastDrv/umdf/func/resource.h13
-rw-r--r--general/toaster/toastDrv/umdf/func/stdAfxsrc.cpp1
-rw-r--r--general/toaster/toastDrv/umdf/func/stdafx.cpp27
-rw-r--r--general/toaster/toastDrv/umdf/func/stdafx.h47
-rw-r--r--general/umdfSkeleton/README.md15
-rw-r--r--general/umdfSkeleton/Skeleton.rc21
-rw-r--r--general/umdfSkeleton/UMDFSkeleton.vcxproj265
-rw-r--r--general/umdfSkeleton/UMDFSkeleton.vcxproj.Filters43
-rw-r--r--general/umdfSkeleton/UMDFSkeleton_OSR.inxbin5646 -> 0 bytes
-rw-r--r--general/umdfSkeleton/UMDFSkeleton_Root.inxbin3798 -> 0 bytes
-rw-r--r--general/umdfSkeleton/comsup.cpp344
-rw-r--r--general/umdfSkeleton/comsup.h215
-rw-r--r--general/umdfSkeleton/device.cpp238
-rw-r--r--general/umdfSkeleton/device.h115
-rw-r--r--general/umdfSkeleton/dllsup.cpp177
-rw-r--r--general/umdfSkeleton/driver.cpp220
-rw-r--r--general/umdfSkeleton/driver.h149
-rw-r--r--general/umdfSkeleton/exports.def10
-rw-r--r--general/umdfSkeleton/internal.h90
-rw-r--r--general/umdfSkeleton/umdfSkeleton.sln28
-rw-r--r--serial/VirtualSerial/ComPort/exports.def6
-rw-r--r--serial/VirtualSerial/ComPort/virtualserial.inxbin4228 -> 0 bytes
-rw-r--r--serial/VirtualSerial/ComPort/virtualserial.rc17
-rw-r--r--serial/VirtualSerial/ComPort/virtualserial.vcxproj250
-rw-r--r--serial/VirtualSerial/ComPort/virtualserial.vcxproj.Filters49
-rw-r--r--serial/VirtualSerial/FakeModem/exports.def6
-rw-r--r--serial/VirtualSerial/FakeModem/fakemodem.inxbin16888 -> 0 bytes
-rw-r--r--serial/VirtualSerial/FakeModem/fakemodem.rc17
-rw-r--r--serial/VirtualSerial/FakeModem/fakemodem.vcxproj250
-rw-r--r--serial/VirtualSerial/FakeModem/fakemodem.vcxproj.Filters49
-rw-r--r--serial/VirtualSerial/README.md63
-rw-r--r--serial/VirtualSerial/VirtualSerial.sln46
-rw-r--r--serial/VirtualSerial/comsup.cpp344
-rw-r--r--serial/VirtualSerial/comsup.h215
-rw-r--r--serial/VirtualSerial/device.cpp674
-rw-r--r--serial/VirtualSerial/device.h261
-rw-r--r--serial/VirtualSerial/dllsup.cpp177
-rw-r--r--serial/VirtualSerial/driver.cpp220
-rw-r--r--serial/VirtualSerial/driver.h149
-rw-r--r--serial/VirtualSerial/internal.h133
-rw-r--r--serial/VirtualSerial/queue.cpp1188
-rw-r--r--serial/VirtualSerial/queue.h206
-rw-r--r--serial/VirtualSerial/ringbuffer.cpp258
-rw-r--r--serial/VirtualSerial/ringbuffer.h223
-rw-r--r--serial/VirtualSerial/serial.h48
-rw-r--r--usb/umdf_filter_kmdf/Package/package.VcxProj90
-rw-r--r--usb/umdf_filter_kmdf/Package/package.VcxProj.Filters21
-rw-r--r--usb/umdf_filter_kmdf/README.md82
-rw-r--r--usb/umdf_filter_kmdf/inc/WUDFOsrUsbPublic.h32
-rw-r--r--usb/umdf_filter_kmdf/inc/list.h77
-rw-r--r--usb/umdf_filter_kmdf/inc/public.h217
-rw-r--r--usb/umdf_filter_kmdf/inc/usb_hw.h233
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/Device.c1051
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/bulkrwr.c436
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/driver.c301
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/interrupt.c184
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/ioctl.c1063
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.h335
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.man309
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.rc18
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj256
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj.Filters46
-rw-r--r--usb/umdf_filter_kmdf/kmdf_driver/trace.h115
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/OsrUsbFilter.rc17
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilter.vcxproj293
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilter.vcxproj.Filters46
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inxbin6574 -> 0 bytes
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/comsup.cpp352
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/comsup.h216
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/device.cpp243
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/device.h114
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/dllsup.cpp184
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/driver.cpp207
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/driver.h145
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/exports.def4
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/internal.h111
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/queue.cpp538
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter/queue.h253
-rw-r--r--usb/umdf_filter_kmdf/umdf_filter_kmdf.sln59
-rw-r--r--usb/umdf_filter_umdf/Package/package.VcxProj90
-rw-r--r--usb/umdf_filter_umdf/Package/package.VcxProj.Filters21
-rw-r--r--usb/umdf_filter_umdf/README.md56
-rw-r--r--usb/umdf_filter_umdf/inc/WUDFOsrUsbPublic.h32
-rw-r--r--usb/umdf_filter_umdf/inc/list.h77
-rw-r--r--usb/umdf_filter_umdf/inc/public.h217
-rw-r--r--usb/umdf_filter_umdf/inc/usb_hw.h233
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/ControlQueue.cpp564
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/ControlQueue.h101
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/Device.cpp2091
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/Device.h604
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/Driver.cpp220
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/Driver.h149
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/OsrUsbFx2.ctl1
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/OsrUsbFx2.rc21
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/ReadWriteQueue.cpp425
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/ReadWriteQueue.h163
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/WUDFOsrUsbFx2.vcxproj281
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/WUDFOsrUsbFx2.vcxproj.Filters52
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/comsup.cpp345
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/comsup.h216
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/dllsup.cpp204
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/exports.def4
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/internal.h170
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/queue.cpp147
-rw-r--r--usb/umdf_filter_umdf/umdf_driver/queue.h93
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/OsrUsbFilter.rc17
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilter.vcxproj293
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilter.vcxproj.Filters46
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inxbin6906 -> 0 bytes
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/comsup.cpp352
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/comsup.h216
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/device.cpp243
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/device.h114
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/dllsup.cpp184
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/driver.cpp207
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/driver.h145
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/exports.def4
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/internal.h111
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/queue.cpp538
-rw-r--r--usb/umdf_filter_umdf/umdf_filter/queue.h253
-rw-r--r--usb/umdf_filter_umdf/umdf_filter_umdf.sln59
-rw-r--r--usb/umdf_fx2/README.md373
-rw-r--r--usb/umdf_fx2/deviceMetadata/B4D697F5-1C56-4807-ACCD-B28C09D37FF0.devicemetadata-msbin105893 -> 0 bytes
-rw-r--r--usb/umdf_fx2/driver/ControlQueue.cpp564
-rw-r--r--usb/umdf_fx2/driver/ControlQueue.h101
-rw-r--r--usb/umdf_fx2/driver/Device.cpp2091
-rw-r--r--usb/umdf_fx2/driver/Device.h604
-rw-r--r--usb/umdf_fx2/driver/Driver.cpp220
-rw-r--r--usb/umdf_fx2/driver/Driver.h149
-rw-r--r--usb/umdf_fx2/driver/OsrUsbFx2.ctl1
-rw-r--r--usb/umdf_fx2/driver/OsrUsbFx2.rc21
-rw-r--r--usb/umdf_fx2/driver/ReadWriteQueue.cpp425
-rw-r--r--usb/umdf_fx2/driver/ReadWriteQueue.h163
-rw-r--r--usb/umdf_fx2/driver/WUDFOsrUsbFx2.inxbin6916 -> 0 bytes
-rw-r--r--usb/umdf_fx2/driver/WUDFOsrUsbFx2.vcxproj281
-rw-r--r--usb/umdf_fx2/driver/WUDFOsrUsbFx2.vcxproj.Filters52
-rw-r--r--usb/umdf_fx2/driver/comsup.cpp345
-rw-r--r--usb/umdf_fx2/driver/comsup.h216
-rw-r--r--usb/umdf_fx2/driver/dllsup.cpp204
-rw-r--r--usb/umdf_fx2/driver/exports.def4
-rw-r--r--usb/umdf_fx2/driver/internal.h170
-rw-r--r--usb/umdf_fx2/driver/queue.cpp147
-rw-r--r--usb/umdf_fx2/driver/queue.h93
-rw-r--r--usb/umdf_fx2/exe/WudfOsrUsbFx2Test.vcxproj223
-rw-r--r--usb/umdf_fx2/exe/WudfOsrUsbFx2Test.vcxproj.Filters30
-rw-r--r--usb/umdf_fx2/exe/dump.c444
-rw-r--r--usb/umdf_fx2/exe/testapp.c1368
-rw-r--r--usb/umdf_fx2/exe/testapp.rc13
-rw-r--r--usb/umdf_fx2/inc/WUDFOsrUsbPublic.h32
-rw-r--r--usb/umdf_fx2/inc/list.h77
-rw-r--r--usb/umdf_fx2/inc/public.h217
-rw-r--r--usb/umdf_fx2/inc/usb_hw.h233
-rw-r--r--usb/umdf_fx2/umdf_fx2.sln46
-rw-r--r--usb/wdf_osrfx2_lab/README.md7
-rw-r--r--usb/wdf_osrfx2_lab/umdf/exe/WudfOsrUsbFx2Test.vcxproj223
-rw-r--r--usb/wdf_osrfx2_lab/umdf/exe/WudfOsrUsbFx2Test.vcxproj.Filters30
-rw-r--r--usb/wdf_osrfx2_lab/umdf/exe/dump.c444
-rw-r--r--usb/wdf_osrfx2_lab/umdf/exe/testapp.c1367
-rw-r--r--usb/wdf_osrfx2_lab/umdf/exe/testapp.rc13
-rw-r--r--usb/wdf_osrfx2_lab/umdf/inc/WUDFOsrUsbPublic.h32
-rw-r--r--usb/wdf_osrfx2_lab/umdf/inc/list.h77
-rw-r--r--usb/wdf_osrfx2_lab/umdf/inc/public.h217
-rw-r--r--usb/wdf_osrfx2_lab/umdf/inc/usb_hw.h233
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/Device.cpp235
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/Device.h128
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/Driver.cpp220
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/Driver.h149
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/OsrUsbFx2.ctl1
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/OsrUsbFx2.rc21
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inxbin5920 -> 0 bytes
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.vcxproj279
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.vcxproj.Filters43
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/comsup.cpp344
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/comsup.h215
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/dllsup.cpp204
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/exports.def4
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step1/internal.h150
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/Device.cpp483
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/Device.h180
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/Driver.cpp220
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/Driver.h149
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/OsrUsbFx2.ctl1
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/OsrUsbFx2.rc21
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inxbin5920 -> 0 bytes
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.vcxproj279
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.vcxproj.Filters43
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/comsup.cpp344
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/comsup.h215
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/dllsup.cpp204
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/exports.def4
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step2/internal.h150
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/ControlQueue.cpp246
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/ControlQueue.h101
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/Device.cpp644
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/Device.h203
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/Driver.cpp220
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/Driver.h149
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/OsrUsbFx2.ctl1
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/OsrUsbFx2.rc21
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/Queue.cpp147
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/Queue.h93
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inxbin5920 -> 0 bytes
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.vcxproj279
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.vcxproj.Filters49
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/comsup.cpp344
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/comsup.h215
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/dllsup.cpp204
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/exports.def4
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step3/internal.h152
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/ControlQueue.cpp246
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/ControlQueue.h101
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/Device.cpp812
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/Device.h256
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/Driver.cpp220
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/Driver.h149
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/OsrUsbFx2.ctl1
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/OsrUsbFx2.rc21
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/ReadWriteQueue.cpp423
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/ReadWriteQueue.h163
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inxbin5920 -> 0 bytes
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.vcxproj279
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.vcxproj.Filters52
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/comsup.cpp344
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/comsup.h215
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/dllsup.cpp204
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/exports.def4
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/internal.h154
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/queue.cpp147
-rw-r--r--usb/wdf_osrfx2_lab/umdf/step4/queue.h93
-rw-r--r--usb/wdf_osrfx2_lab/wdf_osrfx2_lab.sln72
306 files changed, 8 insertions, 57758 deletions
diff --git a/general/echo/umdf/Comsup.cpp b/general/echo/umdf/Comsup.cpp
deleted file mode 100644
index fd298470..00000000
--- a/general/echo/umdf/Comsup.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/general/echo/umdf/Comsup.h b/general/echo/umdf/Comsup.h
deleted file mode 100644
index b96fd982..00000000
--- a/general/echo/umdf/Comsup.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/general/echo/umdf/Device.cpp b/general/echo/umdf/Device.cpp
deleted file mode 100644
index 77110e8e..00000000
--- a/general/echo/umdf/Device.cpp
+++ /dev/null
@@ -1,415 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the sample driver's
- device callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "initguid.h"
-
-#include "device.tmh"
-
-DEFINE_GUID (GUID_DEVINTERFACE_ECHO,
- 0xcdc35b6e, 0xbe4, 0x4936, 0xbf, 0x5f, 0x55, 0x37, 0x38, 0xa, 0x7c, 0x1a);
-// {CDC35B6E-0BE4-4936-BF5F-5537380A7C1A}
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice = NULL;
- IWDFDeviceInitialize2 *fxDeviceInit2;
- HRESULT hr;
-
- //
- // Configure things like the locking model before we go to create our
- // partner device.
- //
-
- //
- // Set no locking unless you need an automatic callbacks synchronization
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // TODO: If you're writing a filter driver then indicate that here.
- //
- // FxDeviceInit->SetFilter();
- //
-
- //
- // TODO: Any per-device initialization which must be done before
- // creating the partner object.
- //
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // Set retrieval mode to direct I/O. This needs to be done before the call
- // to CreateDevice.
- //
- hr = FxDeviceInit->QueryInterface(IID_PPV_ARGS(&fxDeviceInit2));
-
- if (SUCCEEDED(hr))
- {
- //
- // WdfDeviceIoBufferedOrDirect for read/write and ioctrl operations.
- // UMDF defaults to direct-I/O when the device is not running in a shared
- // wudfhost process, and it defaults to buffered-I/O otherwise. Direct I/O
- // is not allowed when the device is pooled.
- //
- //
- fxDeviceInit2->SetIoTypePreference(WdfDeviceIoBufferRetrievalDeferred,
- WdfDeviceIoBufferedOrDirect,
- WdfDeviceIoBufferedOrDirect);
-
- SAFE_RELEASE(fxDeviceInit2);
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- PCMyQueue defaultQueue;
-
- HRESULT hr;
-
- hr = CMyQueue::CreateInstance(m_FxDevice, &defaultQueue);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- hr = defaultQueue->Configure();
-
- if (SUCCEEDED(hr))
- {
- //
- // In case of success store defaultQueue in our member
- // The reference is transferred to m_DefaultQueue
- //
-
- m_Queue = defaultQueue;
- }
- else
- {
- //
- // In case of failure release the reference
- //
-
- defaultQueue->Release();
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_ECHO,
- NULL);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Since the sample driver doesn't support any of the device events, this
- method simply calls the base class's BaseQueryInterface.
-
- If the sample is extended to include device event interfaces then this
- method must be changed to check the IID and return pointers to them as
- appropriate.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
- if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackSelfManagedIo))) {
- *Object = QueryIPnpCallbackSelfManagedIo();
- hr = S_OK;
- } else {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnSelfManagedIoInit(
- _In_ IWDFDevice * pWdfDevice
- )
-/*++
-
- Routine Description:
-
- This method is called to allow driver to initialize any resources
- that driver might need to process I/O.
-
- Echo driver needs a thread to process completions. We initialize
- this thread here
-
- Arguments:
-
- pWdfDevice - framework device object for which to initialze resources
-
- Return Value:
-
- S_OK in case of success
- HRESULT correponding to error returned by CreateThread, in case of failure
-
---*/
-{
- HRESULT hr = S_OK;
-
- UNREFERENCED_PARAMETER(pWdfDevice);
-
-
- m_ThreadHandle = CreateThread( NULL, // Default Security Attrib.
- 0, // Initial Stack Size,
- CMyQueue::CompletionThread, // Thread Func
- (LPVOID)m_Queue, // Arg to Thread Func is Queue
- 0, // Creation Flags
- NULL ); // Don't need the Thread Id.
-
- if (m_ThreadHandle == NULL) {
- hr = HRESULT_FROM_WIN32(GetLastError());
- }
-
- return hr;
-}
-
-void
-CMyDevice::OnSelfManagedIoCleanup(
- _In_ IWDFDevice * pWdfDevice
- )
-/*++
-
- Routine Description:
-
- This method is called to allow driver to cleanup any resources
- that driver allocated to process I/O.
-
- It is critical that, in this routine driver wait for all of the
- threads which it created to exit. Otherwise those threads could
- continue to execute when framework unloads the driver which
- would lead to a crash.
-
- Echo driver created a thread to handle completions. We wait for
- that thread to exit in this routine
-
- Arguments:
-
- pWdfDevice - framework device object for which to cleanup resources
-
- Return Value:
-
- None
-
---*/
-{
- //
- // Kill the thread and
- // wait for the thread to die.
- //
-
- UNREFERENCED_PARAMETER(pWdfDevice);
-
- if (m_ThreadHandle) {
-
- //
- // Ask queue to set terminate flag which will make
- // the thread exit
- //
- m_Queue->SetExitThread();
-
- //
- // Wait for the thread to exit
- //
-
- WaitForSingleObject(m_ThreadHandle, INFINITE);
-
- //
- // Close the thread handle
- //
-
- CloseHandle(m_ThreadHandle);
- m_ThreadHandle = NULL;
- }
-
- //
- // Release the reference we took on the queue callback object
- // to keep it alive until the thread exits
- //
-
- SAFE_RELEASE(m_Queue);
-}
-
diff --git a/general/echo/umdf/Device.h b/general/echo/umdf/Device.h
deleted file mode 100644
index 70147c11..00000000
--- a/general/echo/umdf/Device.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Echo sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#include "queue.h"
-
-//
-// Class for the iotrace driver.
-//
-
-class CMyDevice :
- public CUnknown,
- public IPnpCallbackSelfManagedIo
-{
-
-//
-// Private data members.
-//
-private:
-
- IWDFDevice *m_FxDevice;
-
- //
- // Completion Thread handle used by queue callback object
- //
- HANDLE m_ThreadHandle;
-
- //
- // Our queue callback object
- // Strong reference - since we pass it to the thread we create
- //
- CMyQueue *m_Queue;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- )
- {
- m_FxDevice = NULL;
- }
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- IPnpCallbackSelfManagedIo *
- QueryIPnpCallbackSelfManagedIo(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallbackSelfManagedIo *>(this);
- }
-
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- HRESULT
- Configure(
- VOID
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IPnpCallbackSelfManagedIo methods
- //
-
- //
- // We implement this interface to create and tear down
- // our completion thread
- //
- // It is critical that we wait for all the threads we create
- // to exit during OnSelfManagedIoCleanup, otherwise thread
- // may continue to execute when framework unloads the driver,
- // leading to a crash
- //
- // We don't manage any I/O separate from the queue, so apart
- // from OnSelfManagedIoInit and OnSelfManagedIoCleanup, other
- // methods have token implementations
- //
-
- virtual
- void
- STDMETHODCALLTYPE
- OnSelfManagedIoCleanup(
- _In_ IWDFDevice * pWdfDevice
- );
-
- virtual
- void
- STDMETHODCALLTYPE
- OnSelfManagedIoFlush(
- _In_ IWDFDevice * pWdfDevice
- )
- {
- UNREFERENCED_PARAMETER( pWdfDevice );
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoInit(
- _In_ IWDFDevice * pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoSuspend(
- _In_ IWDFDevice * pWdfDevice
- )
- {
- UNREFERENCED_PARAMETER( pWdfDevice );
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoRestart(
- _In_ IWDFDevice * pWdfDevice
- )
- {
- UNREFERENCED_PARAMETER( pWdfDevice );
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoStop(
- _In_ IWDFDevice * pWdfDevice
- )
- {
- UNREFERENCED_PARAMETER( pWdfDevice );
-
- return S_OK;
- }
-};
diff --git a/general/echo/umdf/Driver.cpp b/general/echo/umdf/Driver.cpp
deleted file mode 100644
index 1428a08a..00000000
--- a/general/echo/umdf/Driver.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Sample's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // TODO: Do any per-device initialization (reading settings from the
- // registry for example) that's necessary before creating your
- // device callback object here. Otherwise you can leave such
- // initialization to the initialization of the device event
- // handler.
- //
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // TODO: Change any per-device settings that the object exposes before
- // calling Configure to let it complete its initialization.
- //
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/general/echo/umdf/Driver.h b/general/echo/umdf/Driver.h
deleted file mode 100644
index 643ea5a5..00000000
--- a/general/echo/umdf/Driver.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER( FxWdfDriver );
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER( FxWdfDriver );
-
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
diff --git a/general/echo/umdf/Echo.rc b/general/echo/umdf/Echo.rc
deleted file mode 100644
index 2a26d85c..00000000
--- a/general/echo/umdf/Echo.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// Echo.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF Echo User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "UMDFEcho"
-#define VER_ORIGINALFILENAME_STR "UMDFEcho.dll"
-
-#include "common.ver"
diff --git a/general/echo/umdf/Queue.cpp b/general/echo/umdf/Queue.cpp
deleted file mode 100644
index f366fe31..00000000
--- a/general/echo/umdf/Queue.cpp
+++ /dev/null
@@ -1,545 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-
-#include "internal.h"
-
-//
-// IUnknown implementation
-//
-
-//
-// Queue destructor.
-// Free up the buffer, wait for thread to terminate and
-// delete critical section.
-//
-
-
-CMyQueue::~CMyQueue(
- VOID
- )
-/*++
-
-Routine Description:
-
-
- IUnknown implementation of Release
-
-Arguments:
-
-
-Return Value:
-
- ULONG (reference count after Release)
-
---*/
-{
- if (m_Buffer) {
- delete [] m_Buffer;
- }
-
- if (m_InitCritSec) {
- ::DeleteCriticalSection(&m_Crit);
- }
-}
-
-
-//
-// Initialize
-HRESULT
-CMyQueue::CreateInstance(
- _In_ IWDFDevice *FxDevice,
- _Out_ PCMyQueue *Queue
- )
-/*++
-
-Routine Description:
-
-
- CreateInstance creates an instance of the queue object.
-
-Arguments:
-
- ppUkwn - OUT parameter is an IUnknown interface to the queue object
-
-Return Value:
-
- HRESULT indicating success or failure
-
---*/
-{
- CMyQueue *pMyQueue = new CMyQueue;
- HRESULT hr;
-
- if (pMyQueue == NULL) {
- return E_OUTOFMEMORY;
- }
-
- hr = pMyQueue->Initialize(FxDevice);
-
- if (SUCCEEDED(hr))
- {
- *Queue = pMyQueue;
- }
- else
- {
- pMyQueue->Release();
- }
- return hr;
-}
-
-HRESULT
-CMyQueue::Initialize(
- _In_ IWDFDevice *FxDevice
- )
-{
- IWDFIoQueue *fxQueue;
- HRESULT hr;
-
- //
- // Initialize the critical section before we continue
- //
-
- if (!InitializeCriticalSectionAndSpinCount(&m_Crit,0x80000400))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit;
- }
- m_InitCritSec = TRUE;
-
- //
- // Create the framework queue
- //
-
- {
- IUnknown *unknown = QueryIUnknown();
- hr = FxDevice->CreateIoQueue(unknown,
- TRUE,
- WdfIoQueueDispatchSequential,
- TRUE,
- FALSE,
- &fxQueue);
- unknown->Release();
- }
-
- if (FAILED(hr))
- {
- goto Exit;
- }
-
- m_FxQueue = fxQueue;
-
- fxQueue->Release();
-
-Exit:
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CMyQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Arguments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicating success or failure
-
---*/
-{
- HRESULT hr;
-
-
- if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackWrite))) {
- *Object = QueryIQueueCallbackWrite();
- hr = S_OK;
- } else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackRead))) {
- *Object = QueryIQueueCallbackRead();
- hr = S_OK;
- } else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackDeviceIoControl))) {
- *Object = QueryIQueueCallbackDeviceIoControl();
- hr = S_OK;
- } else {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyQueue::OnDeviceIoControl(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- DeviceIoControl dispatch routine
-
-Arguments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- ControlCode - IO Control Code
- InputBufferSizeInBytes - Length of input buffer
- OutputBufferSizeInBytes - Length of output buffer
-
- Always succeeds DeviceIoIoctl
-Return Value:
-
- VOID
-
---*/
-{
-
- UNREFERENCED_PARAMETER(pWdfQueue);
- UNREFERENCED_PARAMETER(ControlCode);
- UNREFERENCED_PARAMETER(InputBufferSizeInBytes);
- UNREFERENCED_PARAMETER(OutputBufferSizeInBytes);
-
- pWdfRequest->Complete(S_OK);
- return;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyQueue::OnWrite(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToWrite
- )
-/*++
-
-Routine Description:
-
-
- Write dispatch routine
- IQueueCallbackWrite
-
-Arguments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToWrite - Length of bytes in the write buffer
-
- Allocate and copy data to local buffer
-Return Value:
-
- VOID
-
---*/
-{
-
- HRESULT hr;
- IWDFMemory* pRequestMemory = NULL;
- IWDFIoRequest2 * pWdfRequest2 = NULL;
-
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- //
- // Handle Zero length writes.
- //
-
- if (!BytesToWrite) {
- pWdfRequest->CompleteWithInformation(S_OK, 0);
- return;
- }
-
- if( BytesToWrite > MAX_WRITE_LENGTH ) {
-
- pWdfRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_MORE_DATA), 0);
- return;
- }
-
- // Release previous buffer if set
-
- if( m_Buffer != NULL ) {
- delete [] m_Buffer;
- m_Buffer = NULL;
- m_Length = 0L;
- }
-
- // Allocate Buffer
-
- m_Buffer = new UCHAR[BytesToWrite];
- if (m_Buffer == NULL) {
- pWdfRequest->Complete(E_OUTOFMEMORY);
- m_Length = 0L;
- return;
- }
-
- // Get memory object
- hr = pWdfRequest->QueryInterface(IID_PPV_ARGS(&pWdfRequest2));
-
- if (FAILED(hr)) {
- goto Exit;
- }
-
- hr = pWdfRequest2->RetrieveInputMemory(&pRequestMemory);
-
- if (FAILED(hr)) {
- goto Exit;
- }
-
- // Copy from memory object to our buffer
-
- hr = pRequestMemory->CopyToBuffer(0, m_Buffer, BytesToWrite);
-
- if (FAILED(hr)) {
- goto Exit;
- }
-
- //
- // Release memory object.
- //
- SAFE_RELEASE(pRequestMemory);
-
- //
- // Save the information so that we can use it
- // to complete the request later.
- //
-
- Lock();
-
- m_Length = (ULONG) BytesToWrite;
- m_XferredBytes = m_Length;
- m_CurrentRequest = pWdfRequest2;
-
- Unlock();
-
-Exit:
-
- if (FAILED(hr)) {
- if (pWdfRequest2) {
- pWdfRequest2->CompleteWithInformation(hr, 0);
- }
- delete [] m_Buffer;
- m_Buffer = NULL;
- SAFE_RELEASE(pRequestMemory);
- }
-
- //
- // This is an early release. pWdfRequest2 will be released, when the request is completed
- //
- SAFE_RELEASE(pWdfRequest2);
-
- return;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyQueue::OnRead(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T SizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- Read dispatch routine
- IQueueCallbackRead
-
-Arguments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- SizeInBytes - Length of bytes in the read buffer
-
- Copy available data into the read buffer
-Return Value:
-
- VOID
-
---*/
-{
- IWDFMemory* pRequestMemory = NULL;
- IWDFIoRequest2 * pWdfRequest2 = NULL;
- HRESULT hr;
-
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- //
- // Handle Zero length reads.
- //
-
- if (!SizeInBytes) {
- pWdfRequest->CompleteWithInformation(S_OK, 0);
- return;
- }
-
- if (m_Buffer == NULL) {
- pWdfRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), SizeInBytes);
- return;
- }
-
- if (m_Length < SizeInBytes) {
- SizeInBytes = m_Length;
- }
-
- //
- // Get memory object
- //
-
- hr = pWdfRequest->QueryInterface(IID_PPV_ARGS(&pWdfRequest2));
-
- if (FAILED(hr)) {
- goto Exit;
- }
-
- hr = pWdfRequest2->RetrieveOutputMemory(&pRequestMemory );
-
- if (FAILED(hr)) {
- goto Exit;
- }
-
- // Copy from buffer to memory object
-
- hr = pRequestMemory->CopyFromBuffer(0, m_Buffer, SizeInBytes);
-
- if (FAILED(hr)) {
- goto Exit;
- }
-
- //
- // Release memory object.
- //
-
- SAFE_RELEASE(pRequestMemory);
-
- //
- // Save the information so that we can use it
- // to complete the request later.
- //
-
- Lock();
-
- m_CurrentRequest = pWdfRequest2;
- m_XferredBytes = SizeInBytes;
-
- Unlock();
-
-Exit:
-
- if (FAILED(hr)) {
- if (pWdfRequest2) {
- pWdfRequest2->CompleteWithInformation(hr, 0);
- }
- SAFE_RELEASE(pRequestMemory);
- }
-
- //
- // This is an early release. pWdfRequest2 will be released, when the request is completed
- //
- SAFE_RELEASE(pWdfRequest2);
-
- return;
-}
-
-DWORD
-CMyQueue::CompletionThread(
- PVOID ThreadParameter
- )
-/*++
-
-Routine Description:
-
-
- This routine is called from the thread started to complete
- I/O requests. It sleeps for TIMER_PERIOD and then completes
- the current request. Note that it has to release the lock
- before it calls the request complete method.
-
-Arguments:
-
- ThreadParameter - This is a pointer to the Queue object.
-
-Return Value:
-
- VOID
-
---*/
-{
- CMyQueue *pQueue = (CMyQueue *)ThreadParameter;
- IWDFIoRequest2 *request;
- SIZE_T bytesXferred = 0;
-
- for (;;) {
-
- //
- // Block for a fixed time and then complete the request.
- //
-
- Sleep(TIMER_PERIOD);
-
- pQueue->Lock();
-
- //
- // Process the current request.
- //
-
- request = pQueue->m_CurrentRequest;
-
- if (request) {
- bytesXferred = pQueue->m_XferredBytes;
- }
-
- //
- // Reset values.
- //
-
- pQueue->m_CurrentRequest = NULL;
- pQueue->m_XferredBytes = 0;
-
-
- pQueue->Unlock();
-
- if (request) {
- request->CompleteWithInformation(S_OK, bytesXferred);
- }
-
- //
- // If thread needs to be terminated
- //
-
- if (pQueue->m_ExitThread) {
- ExitThread(0);
- }
-
- }
-
-}
diff --git a/general/echo/umdf/Queue.h b/general/echo/umdf/Queue.h
deleted file mode 100644
index c4b28c97..00000000
--- a/general/echo/umdf/Queue.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-// Set max write length for testing
-#define MAX_WRITE_LENGTH (40*1024)
-
-// Set timer period in ms
-#define TIMER_PERIOD 100
-
-//
-// Queue Callback Object.
-//
-
-class CMyQueue :
- public IQueueCallbackDeviceIoControl,
- public IQueueCallbackRead,
- public IQueueCallbackWrite,
- public CUnknown
-{
- PVOID m_Buffer; // Current buffer
- ULONG m_Length; // Length of the buffer
- SIZE_T m_XferredBytes; // Amount of bytes transferred for the current request
- IWDFIoRequest2 *m_CurrentRequest; // Current request
- CRITICAL_SECTION m_Crit; // Lock to protect updates to CMyQueue fields
- BOOLEAN m_ExitThread; // If TRUE Terminate thread.
- BOOLEAN m_InitCritSec; // If TRUE lock initialized
-
- IWDFIoQueue *m_FxQueue;
-
- CMyQueue() :
- m_Buffer(NULL),
- m_Length (0),
- m_CurrentRequest(NULL),
- m_XferredBytes(0),
- m_ExitThread(FALSE),
- m_InitCritSec(FALSE),
- m_FxQueue(NULL)
- {
- }
-
- virtual ~CMyQueue();
-
- _Acquires_lock_(this->m_Crit)
- __inline
- void
- Lock(
- )
- {
- ::EnterCriticalSection(&m_Crit);
- }
-
- _Releases_lock_(this->m_Crit)
- __inline
- void
- Unlock(
- )
- {
- ::LeaveCriticalSection(&m_Crit);
- }
-
- HRESULT
- Initialize(
- _In_ IWDFDevice *FxDevice
- );
-
-public:
-
- //
- // Completion thread routine.
- //
-
- static DWORD CompletionThread( PVOID ThreadParameter);
-
- //
- // Sets the flag to make thread exit
- //
-
- void
- SetExitThread()
- {
- m_ExitThread = TRUE;
- }
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDevice *FxDevice,
- _Out_ PCMyQueue *Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return S_OK;
- }
-
-
- IQueueCallbackDeviceIoControl *
- QueryIQueueCallbackDeviceIoControl(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackDeviceIoControl *>(this);
- }
-
- IQueueCallbackRead *
- QueryIQueueCallbackRead(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackRead *>(this);
- }
-
- IQueueCallbackWrite *
- QueryIQueueCallbackWrite(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackWrite *>(this);
- }
-
- //
- // IUnknown
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- ) {
- return CUnknown::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- ) {
- return CUnknown::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // Wdf Callbacks
- //
-
- // IQueueCallbackDeviceIoControl
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeviceIoControl(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- );
-
- // IQueueCallbackWrite
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnWrite(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToWrite
- );
-
- // IQueueCallbackRead
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnRead(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToRead
- );
-};
diff --git a/general/echo/umdf/README.md b/general/echo/umdf/README.md
deleted file mode 100644
index 241e633d..00000000
--- a/general/echo/umdf/README.md
+++ /dev/null
@@ -1,120 +0,0 @@
----
-page_type: sample
-description: "Demonstrates how to use UMDF version 1 to write a driver and demonstrates best practices."
-languages:
-- cpp
-products:
-- windows
-- windows-wdk
----
-
-# Echo Sample (UMDF Version 1)
-
-This sample demonstrates how to use User-Mode Driver Framework (UMDF) version 1 to write a driver and demonstrates best practices.
-
-It also demonstrates the use of a default Serial Dispatch I/O Queue, its request start events, cancellation event, and synchronizing with another thread. The preferred I/O retrieval mode is set to Direct I/O. So, whenever a request is received by the framework, UMDF looks at the size of the buffer and determines, whether it should copy the buffer (if the length is less than 2 full pages) or map it (if the length is greater or equal to 2 full pages).
-
-This sample driver is a minimal driver meant to demonstrate the usage of the User-Mode Driver Framework. It is not intended for use in a production environment.
-
-## Related technologies
-
-[User-Mode Driver Framework](https://docs.microsoft.com/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2)
-
-## Testing
-
-To test the Echo driver, you can run echoapp.exe which is built from \\echo\\exe.
-
-First install the device as described above. Then run echoapp.exe.
-
-```cmd
-D:\>echoapp /?
-Usage:
-Echoapp.exe --- Send single write and read request synchronously
-Echoapp.exe -Async --- Send 100 reads and writes asynchronously
-Exit the app anytime by pressing Ctrl-C
-
-D:\>echoapp
-DevicePath: \\?\root#sample#0000#{cdc35b6e-0be4-4936-bf5f-5537380a7c1a}
-Opened device successfully
-512 Pattern Bytes Written successfully
-512 Pattern Bytes Read successfully
-Pattern Verified successfully
-
-D:\>echoapp -Async
-DevicePath: \\?\root#sample#0000#{cdc35b6e-0be4-4936-bf5f-5537380a7c1a}
-Opened device successfully
-Starting AsyncIo
-Number of bytes written by request number 0 is 1024
-Number of bytes read by request number 0 is 1024
-Number of bytes read by request number 1 is 1024
-Number of bytes written by request number 2 is 1024
-Number of bytes read by request number 2 is 1024
-Number of bytes written by request number 3 is 1024
-Number of bytes read by request number 3 is 1024
-Number of bytes written by request number 4 is 1024
-Number of bytes read by request number 4 is 1024
-Number of bytes written by request number 5 is 1024
-Number of bytes read by request number 5 is 1024
-Number of bytes written by request number 6 is 1024
-Number of bytes read by request number 6 is 1024
-Number of bytes written by request number 7 is 1024
-Number of bytes read by request number 7 is 1024
-Number of bytes written by request number 8 is 1024
-Number of bytes read by request number 8 is 1024
-Number of bytes written by request number 9 is 1024
-Number of bytes read by request number 9 is 1024
-Number of bytes written by request number 10 is 1024
-Number of bytes read by request number 10 is 1024
-Number of bytes written by request number 11 is 1024
-...
-```
-
-Note that the reads and writes are performed by independent threads in the echo test application. As a result the order of the output may not exactly match what you see above.
-
-## File Manifest
-
-comsup.cpp and comsup.h
-
-- COM Support code - specifically base classes which provide implementations for the standard COM interfaces IUnknown and IClassFactory which are used throughout this sample.
-
-- The implementation of IClassFactory is designed to create instances of the CMyDriver class. If you should change the name of your base driver class, you would also need to modify this file.
-
-dllsup.cpp
-
-- DLL Support code - provides the DLL's entry point as well as the single required export (DllGetClassObject).
-
-- These depend on comsup.cpp to perform the necessary class creation.
-
-exports.def
-
-- This file lists the functions that the driver DLL exports.
-
-internal.h
-
-- This is the main header file for this driver.
-
-Driver.cpp and Driver.h
-
-- DriverEntry and events on the driver object.
-
-Device.cpp and Device.h
-
-- The Events on the device object.
-
-Queue.cpp and Queue.h
-
-- Contains Events on the I/O Queue Objects.
-
-Echo.rc
-
-- Resource file for the driver.
-
-WUDFEchoDriver.inx
-
-- File that describes the installation of this driver. The build process converts this into an INF file.
-
-echodriver.ctl
-
-- This file lists the WPP trace control GUID(s) for the sample driver. This file can be used with the tracelog command's -guid flag to enable the collection of these trace events within an established trace session.
-
-- These GUIDs must remain in sync with the trace control GUIDs defined in internal.h.
diff --git a/general/echo/umdf/WUDFEchoDriver.inx b/general/echo/umdf/WUDFEchoDriver.inx
deleted file mode 100644
index ad6e9bf4..00000000
--- a/general/echo/umdf/WUDFEchoDriver.inx
+++ /dev/null
Binary files differ
diff --git a/general/echo/umdf/WUDFEchoDriver.vcxproj b/general/echo/umdf/WUDFEchoDriver.vcxproj
deleted file mode 100644
index 1de35ce7..00000000
--- a/general/echo/umdf/WUDFEchoDriver.vcxproj
+++ /dev/null
@@ -1,262 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{13CC3E04-E27E-4E44-90DE-CFBED92D7130}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{9838DCDC-C817-4EA5-B7E8-B3F97F2B138A}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp; queue.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="Echo.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFEchoDriver</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFEchoDriver</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFEchoDriver</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFEchoDriver</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="Echo.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/general/echo/umdf/WUDFEchoDriver.vcxproj.Filters b/general/echo/umdf/WUDFEchoDriver.vcxproj.Filters
deleted file mode 100644
index 8a23705a..00000000
--- a/general/echo/umdf/WUDFEchoDriver.vcxproj.Filters
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{CF73CF52-2BA2-434D-8E38-8F730D54F150}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{6D44B960-AD87-4EA1-80E4-D63DF6914D51}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{9542D238-C8CE-44BC-9307-50CEDCCA5F25}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{D77C3549-2C94-49EB-909E-54EB79474A98}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="Echo.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/general/echo/umdf/dllsup.cpp b/general/echo/umdf/dllsup.cpp
deleted file mode 100644
index e7200a28..00000000
--- a/general/echo/umdf/dllsup.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Echo Sample
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the echo driver uses
- L"Microsoft\\UMDF\\Echo"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
-
- UNREFERENCED_PARAMETER(ModuleHandle);
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- _In_ REFCLSID ClassId,
- _In_ REFIID InterfaceId,
- _Outptr_ LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/general/echo/umdf/echo.sln b/general/echo/umdf/echo.sln
deleted file mode 100644
index cc459eea..00000000
--- a/general/echo/umdf/echo.sln
+++ /dev/null
@@ -1,28 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0
-MinimumVisualStudioVersion = 12.0
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFEchoDriver", "WUDFEchoDriver.vcxproj", "{13CC3E04-E27E-4E44-90DE-CFBED92D7130}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- Debug|x64 = Debug|x64
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Debug|Win32.ActiveCfg = Debug|Win32
- {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Debug|Win32.Build.0 = Debug|Win32
- {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Release|Win32.ActiveCfg = Release|Win32
- {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Release|Win32.Build.0 = Release|Win32
- {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Debug|x64.ActiveCfg = Debug|x64
- {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Debug|x64.Build.0 = Debug|x64
- {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Release|x64.ActiveCfg = Release|x64
- {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/general/echo/umdf/echodriver.ctl b/general/echo/umdf/echodriver.ctl
deleted file mode 100644
index a0ce2089..00000000
--- a/general/echo/umdf/echodriver.ctl
+++ /dev/null
@@ -1 +0,0 @@
-d93fb470-afb1-4af8-860e-75f726c66f6b WudfEchoDriverTraceGuid
diff --git a/general/echo/umdf/exports.def b/general/echo/umdf/exports.def
deleted file mode 100644
index ec564639..00000000
--- a/general/echo/umdf/exports.def
+++ /dev/null
@@ -1,10 +0,0 @@
-; Echo.def : Declares the module parameters.
-
-;
-; TODO: Change the library name here to match your binary name.
-;
-
-LIBRARY "WUDFEchoDriver.DLL"
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/general/echo/umdf/internal.h b/general/echo/umdf/internal.h
deleted file mode 100644
index 8e5c2d60..00000000
--- a/general/echo/umdf/internal.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF Echo
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF DDI
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- MyDriverTraceControl, (d93fb470,afb1,4af8,860e,75f726c66f6b), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\Echo"
-#define MYDRIVER_CLASS_ID {0x7ab7dcf5, 0xd1d4, 0x4085, {0x95, 0x47, 0x1d, 0xb9, 0x68, 0xcc, 0xa7, 0x20}}
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "queue.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_TEST_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
diff --git a/general/echo/umdfSocketEcho/Driver/Connection.cpp b/general/echo/umdfSocketEcho/Driver/Connection.cpp
deleted file mode 100644
index e28d0c56..00000000
--- a/general/echo/umdfSocketEcho/Driver/Connection.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- Connection.cpp
-
-Abstract:
-
- Module for the socket connection specfic routines in the driver.
- Makes Connection to the server given server host and port address.
-
-Environment:
-
- User mode only
-
-
---*/
-
-#include "internal.h"
-#include "connection.tmh"
-
-
-CConnection::CConnection()
-/*++
-
-Routine Description:
-
- Constructor for connection object
-
-Arguments:
-
- None
-
-Return Value:
-
- VOID
-
---*/
-{
-
- // Initialize the socket member as Invalid
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
- m_socket = INVALID_SOCKET;
-}
-
-HRESULT
-CConnection::Connect(
- IN IWDFDevice *pDevice
- )
-/*++
-
-Routine Description:
-
- This routine is for the initialization of the connection object associated with
- the File Object . It is invoked from the dispatch OnCreateFile on the default
- queue callback of the driver. It socket connection to the client.
-
-Arguments:
-
- pDevice = Wdf Device Object
-
-Return Value:
-
- S_OK if success , error HRESULT otherwise
-
---*/
-{
-
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- HRESULT hr = S_OK;
-
- addrinfoW* info = NULL ;
-
- PWSTR hostStr = NULL;
-
- PWSTR portStr = NULL;
-
- //
- // Reads the host and port strings stored in the device context.
- //
-
- DeviceContext *pContext = NULL;
-
- hr = pDevice->RetrieveContext((void**)&pContext);
-
- if ( FAILED(hr) )
- {
-
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: unable to retrieve context from wdf device object %!hresult!",
- hr
- );
- goto Clean0;
-
- }
-
- hostStr = pContext->hostStr;
-
- portStr = pContext->portStr;
-
- //
- // lookup hostname with addrinfo hints;
- //
-
- addrinfoW hints;
-
- ZeroMemory(&hints,sizeof(hints));
-
- hints.ai_family = AF_INET;
-
- hints.ai_socktype = SOCK_STREAM;
-
- hints.ai_protocol = IPPROTO_TCP;
-
- int n = GetAddrInfoW(hostStr, portStr, &hints, &info);
-
- if (n != 0)
- {
- DWORD err = WSAGetLastError();
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Unable to find address/port of host %!winerr!",
- err
- );
- hr = HRESULT_FROM_WIN32(err);
- goto Clean0;
- }
-
- //
- // Create a socket with this infomation recvd in getaddrinfo
- //
- m_socket = socket(info->ai_family,info->ai_socktype,info->ai_protocol);
-
- if (m_socket == INVALID_SOCKET)
- {
- DWORD err = WSAGetLastError();
-
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Unable to create socket %!winerr!",
- err
- );
-
- hr = HRESULT_FROM_WIN32(err);
-
- goto Clean0;
- }
-
- //
- // If that succeeds , proceed to connect to the socket
- //
-
-
- ATLASSERT(info->ai_addrlen <= 0x7fffffff);
-
- int nret = connect(m_socket,info->ai_addr,(int)info->ai_addrlen);
-
- if (nret == SOCKET_ERROR)
- {
- DWORD err = WSAGetLastError();
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Unable to connect to host %!winerr!",
- err
- );
- hr = HRESULT_FROM_WIN32(err);
-
- goto Clean0;
- }
-
-
-Clean0:
-
- if (info != NULL)
- {
- FreeAddrInfoW(info);
-
- }
-
- if (FAILED(hr) && m_socket != INVALID_SOCKET)
- {
- closesocket(m_socket);
- m_socket = INVALID_SOCKET;
- }
-
- return hr;
-
-}
-
-HANDLE
-CConnection::GetSocketHandle(
- )
-/*++
-
-Routine Description:
-
- Function returns the socket handle associated with this connection object
-
-Arguments:
-
- None
-
-Return Value:
-
- Socket handle if valid socket
- INVALID_HANDLE_VALUE otherwise
-
---*/
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
- if ( INVALID_SOCKET != m_socket )
- {
- return (HANDLE)m_socket ;
- }
- else
- {
- return INVALID_HANDLE_VALUE;
- }
-
-}
-
-
-VOID
-CConnection::Close()
-/*++
-
-Routine Description:
-
- Closes the socket connection to the server associated with this connection object
-
-Arguments:
-
- None
-
-Return Value:
-
- None
---*/
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
- if (m_socket != INVALID_SOCKET)
- {
- closesocket(m_socket);
- m_socket = INVALID_SOCKET;
- }
-
-}
diff --git a/general/echo/umdfSocketEcho/Driver/FileContext.h b/general/echo/umdfSocketEcho/Driver/FileContext.h
deleted file mode 100644
index dbdda2e4..00000000
--- a/general/echo/umdfSocketEcho/Driver/FileContext.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- filecontext.h
-
-Abstract:
-
- This header file defines the structure type for file context associated with the file object
-
-Environment:
-
- user mode only
-
-Revision History:
-
---*/
-
-
-#pragma once
-
-typedef struct _FileContext
-{
- CConnection *pConnection ;
-
- CComPtr<IWDFIoTarget> pFileTarget;
-
-}FileContext;
diff --git a/general/echo/umdfSocketEcho/Driver/Queue.cpp b/general/echo/umdfSocketEcho/Driver/Queue.cpp
deleted file mode 100644
index 242925d4..00000000
--- a/general/echo/umdfSocketEcho/Driver/Queue.cpp
+++ /dev/null
@@ -1,580 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- user mode only
-
-Revision History:
-
---*/
-
-#include "internal.h"
-
-#include "queue.tmh"
-
-CMyQueue::CMyQueue(
- ) :
- m_FxQueue(NULL),
- m_Device(NULL)
-{
-}
-
-//
-// Queue destructor.
-//
-
-CMyQueue::~CMyQueue(
- VOID
- )
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyQueue::Initialize(
- _In_ CMyDevice * Device
- )
-/*++
-
-Routine Description:
-
- Queue Initialize helper routine.
- This routine will Create a default parallel queue associated with the Fx device object
- and pass the IUnknown for this queue
-
-Aruments:
- Device - Device object pointer
-
-Return Value:
-
- S_OK if Initialize succeeds
-
---*/
-{
-
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- CComPtr<IWDFIoQueue> fxQueue;
-
- HRESULT hr;
-
- m_Device = Device;
-
- //
- // Create the I/O Queue object.
- //
-
- {
- CComPtr<IUnknown> pUnk;
-
- HRESULT hrQI = this->QueryInterface(__uuidof(IUnknown),(void**)&pUnk);
-
- WUDF_SAMPLE_DRIVER_ASSERT(SUCCEEDED(hrQI));
-
- hr = m_Device->GetFxDevice()->CreateIoQueue(
- pUnk,
- TRUE,
- WdfIoQueueDispatchParallel,
- TRUE,
- FALSE,
- &fxQueue
- );
- }
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- "Failed to initialize driver queue %!hresult!",
- hr
- );
- goto Exit;
- }
-
- m_FxQueue = fxQueue;
-
-
-Exit:
-
- return hr;
-}
-
-HRESULT
-CMyQueue::Configure(
- VOID
- )
-/*++
-
-Routine Description:
-
- Queue configuration function .
- It is called after queue object has been succesfully initialized.
-
-Aruments:
-
- NONE
-
- Return Value:
-
- S_OK if succeeds.
-
---*/
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- HRESULT hr = S_OK;
-
- return hr;
-}
-
-
-STDMETHODIMP_(void)
-CMyQueue::OnCreateFile(
- _In_ IWDFIoQueue* pWdfQueue,
- _In_ IWDFIoRequest* pWdfRequest,
- _In_ IWDFFile* pWdfFileObject
- )
-
-/*++
-
-Routine Description:
-
- Create callback from the framework for this default parallel queue
-
- The create request will create a socket connection , create a file i/o target associated
- with the socket handle for this connection and store in the file object context.
-
-Aruments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- pWdfFileObject - WDF file object for this create
-
- Return Value:
-
- VOID
-
---*/
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- HRESULT hr = S_OK;
-
- CComPtr<IWDFFileHandleTargetFactory> spFileHandleTargetFactory;
-
- CComPtr<IWDFIoTarget> pFileTarget;
-
- CComPtr<IWDFDevice> pDevice;
-
- HANDLE SocketHandle = NULL;
-
- pWdfQueue->GetDevice(&pDevice);
-
- FileContext *pContext = NULL;
-
- //
- // Create new connection object
- //
-
- CConnection *pConnection = new CConnection();
-
- if (NULL == pConnection )
- {
- hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Could not create connection object %!hresult!",
- hr
- );
- goto Exit;
- }
-
- //
- // Connect to the socket server
- //
-
- hr = pConnection->Connect(pDevice);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Could not connect %!hresult!",
- hr
- );
-
- goto Exit;
-
- }
-
- //
- // If that succeeds, get socket handle for the connection
- //
-
- if ( NULL == (SocketHandle = pConnection->GetSocketHandle()) )
- {
- hr = E_FAIL;
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Unable to obtain valid Socket Handle %!hresult!",
- hr
- );
- goto Exit;
- }
-
- //
- // Create file context for this file object
- //
-
- pContext = new FileContext;
-
- if (NULL == pContext)
- {
- hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Could not create file context %!hresult!",
- hr
- );
- goto Exit;
-
- }
-
- //
- // QI for IWDFFileHandleTargetFactory from the framework device object.
- // Note UmdfDispatcher in Wdf Section in the Inf
- //
-
- hr = pDevice->QueryInterface(IID_PPV_ARGS(&spFileHandleTargetFactory));
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Unable to obtain target factory for creating FileHandle based I/O target %!hresult!",
- hr
- );
- goto Exit;
- }
-
- //
- // If that succeeds, Create a File Handle I/O Target and associate the socket handle with this target
- //
-
- hr = spFileHandleTargetFactory->CreateFileHandleTarget(SocketHandle ,&pFileTarget);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Unable to create framework I/O target %!hresult!",
- hr
- );
- goto Exit;
- }
-
-
- pContext->pFileTarget = pFileTarget;
-
- pContext->pConnection = pConnection;
-
- hr = pWdfFileObject->AssignContext(NULL,(void*)pContext);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Unable to Assign Context to this File Object %!hresult!",
- hr
- );
- goto Exit;
- }
-
-
-
-Exit:
-
- if (FAILED(hr))
- {
-
- if ( pFileTarget )
- {
- pFileTarget->DeleteWdfObject();
- }
-
- if (pConnection != NULL)
- {
- delete pConnection;
- pConnection = NULL;
- }
-
- if (pContext != NULL)
- {
- delete pContext;
- pContext = NULL;
- }
-
- }
-
- pWdfRequest->Complete(hr);
-
-}
-
-
-STDMETHODIMP_ (void)
-CMyQueue::OnWrite(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToWrite
- )
-/*++
-
-Routine Description:
-
- Write callback from the framework for this default parallel queue
-
- The write request needs to be sent to the file handle i/o target associated with this fileobject
-
-Aruments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToWrite - Lenth of bytes in the write buffer
-
- Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
- UNREFERENCED_PARAMETER(BytesToWrite);
-
- // Call helper function to send request to i/o target
-
- SendRequestToFileTarget(pWdfRequest);
-
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- return;
-}
-
-STDMETHODIMP_ (void)
-CMyQueue::OnRead(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToRead
- )
-/*++
-
-Routine Description:
-
- Read callback from the framework for this default parallel queue
-
- The read request needs to be sent to the file handle i/o target associated with this fileobject
-
-Aruments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToRead - Lenth of bytes in the read buffer
-
-
-Return Value:
-
- VOID
-
---*/
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- UNREFERENCED_PARAMETER(pWdfQueue);
- UNREFERENCED_PARAMETER(BytesToRead);
-
- //
- // Call helper function to send request to i/o target
- //
-
- SendRequestToFileTarget(pWdfRequest);
-
- return;
-}
-
-STDMETHODIMP_(void)
-CMyQueue::OnCompletion(
- _In_ IWDFIoRequest* pWdfRequest,
- _In_ IWDFIoTarget* pTarget,
- _In_ IWDFRequestCompletionParams* pCompletionParams,
- _In_ void* pContext
-)
-/*++
-
-Routine Description:
-
- This routine is invoked when the request is completed by the lower stack location,
- in this case the win32 i/o target associated with the file object of this request
-
-
- Arguments:
-
- pWdfRequest - wdf request
- pTarget - wdf target to which request was earlier sent
- pCompletionParams - wdf request completion parameters
- pContext - Context information , if any
-
-
-Return Value:
-
- None
---*/
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- UNREFERENCED_PARAMETER(pTarget);
- UNREFERENCED_PARAMETER(pContext);
-
- // Complete request from the driver
- pWdfRequest->CompleteWithInformation(
- pCompletionParams->GetCompletionStatus(),
- pCompletionParams->GetInformation());
-}
-
-VOID
-CMyQueue::SendRequestToFileTarget(
- _In_ IWDFIoRequest* pWdfRequest
-)
-/*++
-
-Routine Description:
-
- This is a helper functiom to send R/W requests to the win32 file i/o target
- associated with the socket connection for this request.
- First, filecontext is retrieved which has the file i/o target where this request needs to be sent.
-
-
-Arguments:
-
- pWdfRequest - wdf request
-
-Return Value:
-
- None
-
---*/
-{
-
- HRESULT hr;
-
- FileContext *pContext = NULL;
- CComPtr<IWDFFile> pWdfFile = NULL;
-
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- //
- // Get the file object for this request
- //
-
- pWdfRequest->GetFileObject(&pWdfFile);
-
- //
- // Retrieve Context from file object
- //
-
- hr = pWdfFile->RetrieveContext((void**)&pContext);
-
- if (pContext == NULL)
- {
- if ( SUCCEEDED(hr) )
- {
- hr = E_FAIL;
- Trace(TRACE_LEVEL_ERROR,
- " No Context associated with this file object %!hresult!",
- hr);
- }
- goto Exit;
- }
-
- //
- // If that succeeds, set completion callback for the request
- //
- pWdfRequest->SetCompletionCallback(CComQIPtr<IRequestCallbackRequestCompletion>(this),
- NULL);
-
- //
- // Do not modify the request, format using current type
- //
-
- pWdfRequest->FormatUsingCurrentType();
-
- //
- // Send the request to the win32 i/o target . This was created in OnCreateFile
- //
-
- hr = pWdfRequest->Send(pContext->pFileTarget,
- 0,
- 0);
-Exit:
-
- if (FAILED(hr))
- {
- Trace(TRACE_LEVEL_ERROR,
- "Could not send request to i/o target %!hresult!",
- hr);
- pWdfRequest->Complete(hr);
- }
-
- return ;
-}
-
-STDMETHODIMP_(void)
-CMyQueue::OnCleanup(
- _In_ IWDFObject* /*pWdfObject*/
- )
-{
- //
- // CMyQueue has a reference to framework device object via m_FxQueue.
- // Framework queue object has a reference to CMyQueue object via the callbacks.
- // This leads to circular reference and both the objects can't be destroyed until this circular reference is broken.
- // To break the circular reference we release the reference to the framework queue object here in OnCleanup.
- //
- m_FxQueue = NULL;
-}
diff --git a/general/echo/umdfSocketEcho/Driver/Queue.h b/general/echo/umdfSocketEcho/Driver/Queue.h
deleted file mode 100644
index 952e1e0d..00000000
--- a/general/echo/umdfSocketEcho/Driver/Queue.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- user mode only
-
-Revision History:
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class ATL_NO_VTABLE CMyQueue :
- public CComObjectRootEx<CComMultiThreadModel>,
- public IQueueCallbackCreate,
- public IQueueCallbackRead,
- public IQueueCallbackWrite,
- public IRequestCallbackRequestCompletion,
- public IObjectCleanup
-{
-public:
-
-DECLARE_NOT_AGGREGATABLE(CMyQueue)
-
-BEGIN_COM_MAP(CMyQueue)
- COM_INTERFACE_ENTRY(IQueueCallbackCreate)
- COM_INTERFACE_ENTRY(IQueueCallbackRead)
- COM_INTERFACE_ENTRY(IQueueCallbackWrite)
- COM_INTERFACE_ENTRY(IRequestCallbackRequestCompletion)
- COM_INTERFACE_ENTRY(IObjectCleanup)
-END_COM_MAP()
-
-public:
- //IQueueCallbackRead
- STDMETHOD_(void,OnRead)(_In_ IWDFIoQueue* pWdfQueue,_In_ IWDFIoRequest* pWdfRequest,_In_ SIZE_T NumOfBytesToRead);
-
- //IQueueCallbackWrite
- STDMETHOD_(void,OnWrite)(_In_ IWDFIoQueue* pWdfQueue,_In_ IWDFIoRequest* pWdfRequest,_In_ SIZE_T NumOfBytesToWrite);
-
- //IQueueCallbackCreate
- STDMETHOD_(void,OnCreateFile)(_In_ IWDFIoQueue* pWdfQueue,_In_ IWDFIoRequest* pWDFRequest,_In_ IWDFFile* pWdfFileObject);
-
- // IRequestCallbackRequestCompletion
- STDMETHOD_(void,OnCompletion)(_In_ IWDFIoRequest* pWdfRequest,_In_ IWDFIoTarget* pTarget,_In_ IWDFRequestCompletionParams* pCompletionParams,_In_ void* pContext);
-
- //IObjectCleanup
- STDMETHOD_(void,OnCleanup)(_In_ IWDFObject* pWdfObject);
-
-public:
- CMyQueue();
- ~CMyQueue();
-
- STDMETHOD(Initialize)(_In_ CMyDevice * Device);
-
- HRESULT
- Configure(
- );
-
-private:
- CComPtr<IWDFIoQueue> m_FxQueue;
-
- //
- // Unreferenced pointer to the parent device.
- //
-
- CMyDevice * m_Device;
-
- VOID SendRequestToFileTarget( _In_ IWDFIoRequest* pWdfRequest);
-};
diff --git a/general/echo/umdfSocketEcho/Driver/SocketEcho.inx b/general/echo/umdfSocketEcho/Driver/SocketEcho.inx
deleted file mode 100644
index b660186b..00000000
--- a/general/echo/umdfSocketEcho/Driver/SocketEcho.inx
+++ /dev/null
Binary files differ
diff --git a/general/echo/umdfSocketEcho/Driver/SocketEcho.rc b/general/echo/umdfSocketEcho/Driver/SocketEcho.rc
deleted file mode 100644
index cc27b15f..00000000
--- a/general/echo/umdfSocketEcho/Driver/SocketEcho.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// Skeleton.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF Sample WUDF SocketEcho Driver"
-#define VER_INTERNALNAME_STR "SocketEcho"
-#define VER_ORIGINALFILENAME_STR "SocketEcho.dll"
-
-#include "common.ver"
diff --git a/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj b/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj
deleted file mode 100644
index 652dd875..00000000
--- a/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj
+++ /dev/null
@@ -1,251 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{353E2F22-BD87-47F3-A211-90DE8D583D26}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{CE6B3D79-4604-4FAC-8A53-20B7000101FD}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; driver.cpp; device.cpp; queue.cpp; connection.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="SocketEcho.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>SocketEcho</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>SocketEcho</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>SocketEcho</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>SocketEcho</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\shlwapi.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\shlwapi.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\shlwapi.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\shlwapi.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="SocketEcho.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj.Filters b/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj.Filters
deleted file mode 100644
index 1c5cadc5..00000000
--- a/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj.Filters
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{76642063-E1CB-43C5-8493-5F651D92F60C}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{4AB44AAB-2BDE-4DA4-A128-40382366A9F5}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{005AFEBA-780E-49DC-BCB8-4163463DE6D5}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{FDF16DEE-FA54-49E3-BC76-FCFD47F8BF37}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="connection.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="SocketEcho.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/general/echo/umdfSocketEcho/Driver/connection.h b/general/echo/umdfSocketEcho/Driver/connection.h
deleted file mode 100644
index 2b7e23c6..00000000
--- a/general/echo/umdfSocketEcho/Driver/connection.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- Connection.h
-
-Abstract:
-
- Header file for the socketecho connection class
-
-Environment:
-
- User mode only
-
-
---*/
-#pragma once
-
-class CConnection
-{
-public:
- CConnection();
- HRESULT Connect(IN IWDFDevice *pDevice);
- VOID Close();
- HANDLE GetSocketHandle( );
-
-private:
- SOCKET m_socket;
-};
-
diff --git a/general/echo/umdfSocketEcho/Driver/device.cpp b/general/echo/umdfSocketEcho/Driver/device.cpp
deleted file mode 100644
index 9c3e4db1..00000000
--- a/general/echo/umdfSocketEcho/Driver/device.cpp
+++ /dev/null
@@ -1,469 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF socketecho sample
- driver's device callback object.
-
- It does not implement either of the PNP interfaces so once the device
- is setup, it won't ever get any callbacks until the device is removed.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "device.tmh"
-
-const GUID GUID_DEVINTERFACE_SOCKETECHO =
- {0xcdc35b6e, 0xbe4, 0x4936, { 0xbf, 0x5f, 0x55, 0x37, 0x38, 0xa, 0x7c, 0x1a }};
-
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver* FxDriver,
- _In_ IWDFDeviceInitialize* FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
- FxDriver - IWDF Driver for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!");
-
- CComPtr<IWDFDevice> fxDevice;
- HRESULT hr;
- BOOL bFilter = FALSE;
-
- //
- // Configure things like the locking model before we go to create our
- // partner device.
- //
-
- //
- // Set the locking model
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // Mark filter if we are a filter
- //
-
- if (bFilter)
- {
- FxDeviceInit->SetFilter();
- }
-
- //
- // TODO: Any per-device initialization which must be done before
- // creating the partner object.
- //
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- CComPtr<IUnknown> pUnk;
- HRESULT hrQI = this->QueryInterface(__uuidof(IUnknown),(void**)&pUnk);
- WUDF_SAMPLE_DRIVER_ASSERT(SUCCEEDED(hrQI));
-
- hr = FxDriver->CreateDevice(FxDeviceInit, pUnk, &fxDevice);
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- None
-
- Return Value:
-
- status
-
---*/
-{
- Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!");
-
- HRESULT hr;
- CComObject<CMyQueue> * defaultQueue = NULL;
-
- //
- // Create a new instance of our queue callback object
- //
- hr = CComObject<CMyQueue>::CreateInstance(&defaultQueue);
-
- if (SUCCEEDED(hr))
- {
- defaultQueue->AddRef();
- hr = defaultQueue->Initialize(this);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = defaultQueue->Configure();
- }
-
- //
- // Create and Enable Device Interface for this device.
- //
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_SOCKETECHO,
- NULL);
- }
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->AssignDeviceInterfaceState(&GUID_DEVINTERFACE_SOCKETECHO,
- NULL,
- TRUE);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = ReadAndAssignPropertyStoreValue();
- }
-
- //
- // Release the reference we took on the queue callback object.
- // The framework took its own references on the object's callback interfaces
- // when we called m_FxDevice->CreateIoQueue, and will manage the object's lifetime.
- //
- SAFE_RELEASE(defaultQueue);
-
- return hr;
-}
-
-STDMETHODIMP_(void)
-CMyDevice::OnCloseFile(
- _In_ IWDFFile* pWdfFileObject
- )
-/*++
-
- Routine Description:
-
- This method is called when an app closes the file handle to this device.
- This will free the context memory associated with this file object, close
- the connection object associated with this file object and delete the file
- handle i/o target object associated with this file object.
-
- Arguments:
-
- pWdfFileObject - the framework file object for which close is handled.
-
- Return Value:
-
- None
-
---*/
-{
- Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!");
-
- HRESULT hr = S_OK ;
- FileContext *pContext = NULL;
-
- hr = pWdfFileObject->RetrieveContext((void**)&pContext);
-
- if (SUCCEEDED(hr) && (pContext != NULL ) )
- {
- pContext->pConnection->Close();
- pContext->pFileTarget->DeleteWdfObject();
-
- delete pContext->pConnection;
- delete pContext;
- }
-
- return ;
-}
-
-
-STDMETHODIMP_(void)
-CMyDevice::OnCleanupFile(
- _In_ IWDFFile* pWdfFileObject
- )
-/*++
-
- Routine Description:
-
- This method is when app with open handle device terminates.
-
- Arguments:
-
- pWdfFileObject - the framework file object for which close is handled.
-
- Return Value:
-
- None
-
---*/
-{
- UNREFERENCED_PARAMETER(pWdfFileObject);
-}
-
-STDMETHODIMP_(void)
-CMyDevice::OnCleanup(
- _In_ IWDFObject* pWdfObject
- )
-/*++
-
- Routine Description:
-
- This device callback method is invoked by the framework when the WdfObject
- is about to be released by the framework. This will free the context memory
- associated with the device object.
-
- Arguments:
-
- pWdfObject - the framework device object for which OnCleanup.
-
- Return Value:
-
- None
-
---*/
-{
- Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!");
-
- HRESULT hr ;
- DeviceContext *pContext = NULL;
-
- WUDF_SAMPLE_DRIVER_ASSERT(pWdfObject == m_FxDevice);
-
- hr = pWdfObject->RetrieveContext((void**)&pContext);
-
- if (SUCCEEDED(hr) && (pContext != NULL))
- {
- // hostStr is allocated through StrDup, and thus need be freed through LocalFree
- //
- if (pContext->hostStr != NULL)
- {
- LocalFree( pContext->hostStr );
- }
-
- if (pContext->portStr != NULL)
- {
- LocalFree( pContext->portStr );
- }
-
- delete pContext;
- }
-//
-//CMyDevice has a reference to framework device object via m_Device.
-//Framework device object has a reference to CMyDevice object via the callbacks.
-//This leads to circular reference and both the objects can't be destroyed until this circular reference is broken.
-//To break the circular reference we release the reference to the framework device object here in OnCleanup.
-
- m_FxDevice = NULL;
-}
-
-HRESULT
-CMyDevice::ReadAndAssignPropertyStoreValue(
- VOID
- )
-/*++
-
- Routine Description:
- Helper function for reading property store values and storing them in the
- device level context.
-
- Arguments:
-
- pWdfFileObject - the framework file object for which close is handled.
-
- Return Value:
-
- None
-
---*/
-{
- Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!");
-
- CComPtr<IWDFNamedPropertyStore> pPropStore;
- WDF_PROPERTY_STORE_DISPOSITION disposition;
- PROPVARIANT val;
- HRESULT hr ;
-
- PropVariantInit(&val);
-
- DeviceContext *pContext = new DeviceContext;
- if (pContext == NULL)
- {
- hr = E_OUTOFMEMORY;
- Trace(TRACE_LEVEL_ERROR,
- L"ERROR: Could not create device context object %!hresult!",
- hr);
-
- goto CleanUp;
- }
-
- pContext->hostStr = NULL;
- pContext->portStr = NULL;
-
- //
- // Retreive property store for reading drivers custom settings as specified
- // in the INF
- //
- hr = m_FxDevice->RetrieveDevicePropertyStore(L"SocketEcho",
- WdfPropertyStoreNormal,
- &pPropStore,
- &disposition);
- if (FAILED(hr))
- {
- Trace(TRACE_LEVEL_ERROR,
- "Failed to retrieve device property store for reading custom "
- "settings as specified in the INF %!hresult!",
- hr);
-
- goto CleanUp;
- }
-
- //
- // Get the key for this device with Named value "host"
- //
- hr = pPropStore->GetNamedValue(L"Host", &val);
- if (FAILED(hr))
- {
- Trace(TRACE_LEVEL_ERROR,
- "Failed to get \"Host\" key value %!hresult!",
- hr);
-
- goto CleanUp;
- }
-
- if (val.vt != VT_LPWSTR)
- {
- hr = HRESULT_FROM_WIN32(ERROR_BAD_CONFIGURATION);
- Trace(TRACE_LEVEL_ERROR,
- "Unexpected string format for value in \"Host\" key %!hresult!",
- hr);
-
- goto CleanUp;
- }
-
- pContext->hostStr = StrDup(val.pwszVal);
-
- //
- // Clear property variant for reading next key
- //
- PropVariantClear(&val);
-
- //
- // Get the key for this device with Named value "Port"
- //
- hr = pPropStore->GetNamedValue(L"Port", &val);
- if (FAILED(hr))
- {
- Trace(TRACE_LEVEL_ERROR,
- "Failed to get \"Port\" key value %!hresult!",
- hr);
-
- goto CleanUp;
- }
-
- if (val.vt != VT_LPWSTR)
- {
- hr = HRESULT_FROM_WIN32(ERROR_BAD_CONFIGURATION);
- Trace(TRACE_LEVEL_ERROR,
- "Unexpected string format for value in \"Port\" key %!hresult!",
- hr);
-
- goto CleanUp;
- }
-
- pContext->portStr = StrDup(val.pwszVal);
-
- hr = m_FxDevice->AssignContext(NULL, (void*)pContext);
- if (FAILED(hr))
- {
- Trace(TRACE_LEVEL_ERROR,
- "Failed to assign property store value to device %!hresult!",
- hr);
-
- //
- // Fall through to clean up and exit ...
- //
- }
-
-CleanUp:
-
- PropVariantClear(&val);
-
- if (FAILED(hr))
- {
- if (pContext != NULL)
- {
- // hostStr is allocated through StrDup, and thus need be freed through LocalFree
- //
- if (pContext->hostStr != NULL)
- {
- LocalFree( pContext->hostStr );
- }
-
- if (pContext->portStr != NULL)
- {
- LocalFree( pContext->portStr );
- }
-
- delete pContext;
- }
- }
-
- return hr;
-}
-
diff --git a/general/echo/umdfSocketEcho/Driver/device.h b/general/echo/umdfSocketEcho/Driver/device.h
deleted file mode 100644
index 176f10e6..00000000
--- a/general/echo/umdfSocketEcho/Driver/device.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Class for the iotrace driver.
-//
-
-class ATL_NO_VTABLE CMyDevice :
- public CComObjectRootEx<CComMultiThreadModel>,
- public IFileCallbackCleanup,
- public IFileCallbackClose,
- public IObjectCleanup
-{
-public:
-
-DECLARE_NOT_AGGREGATABLE(CMyDevice)
-
-BEGIN_COM_MAP(CMyDevice)
- COM_INTERFACE_ENTRY(IFileCallbackCleanup)
- COM_INTERFACE_ENTRY(IFileCallbackClose)
- COM_INTERFACE_ENTRY(IObjectCleanup)
-END_COM_MAP()
-
-public:
-
- //IFileCallbackCleanup
- STDMETHOD_(void,OnCleanupFile)(_In_ IWDFFile* pWdfFileObject);
- //IFileCallbackClose
- STDMETHOD_(void,OnCloseFile)(_In_ IWDFFile* pWdfFileObject);
- //IObjectCleanup
- STDMETHOD_(void,OnCleanup)(_In_ IWDFObject* pWdfObject);
-
-public:
-
- STDMETHOD(Initialize)(_In_ IWDFDriver* pWdfDriver, _In_ IWDFDeviceInitialize* pWdfDeviceInit);
-
- HRESULT
- Configure(
- );
-
- IWDFDevice *
- GetFxDevice(
- )
- {
- return m_FxDevice;
- }
-
-private:
- CComPtr<IWDFDevice> m_FxDevice;
- HRESULT ReadAndAssignPropertyStoreValue();
-
-};
diff --git a/general/echo/umdfSocketEcho/Driver/devicecontext.h b/general/echo/umdfSocketEcho/Driver/devicecontext.h
deleted file mode 100644
index 2bf10d2e..00000000
--- a/general/echo/umdfSocketEcho/Driver/devicecontext.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- devicecontext.h
-
-Abstract:
-
- This header file defines the structure type for device context associated with the device object
-
-Environment:
-
- user mode only
-
-Revision History:
-
---*/
-
-
-#pragma once
-
-
-typedef struct _DeviceContext
-{
- PWSTR hostStr;
-
- PWSTR portStr;
-
-}DeviceContext;
-
diff --git a/general/echo/umdfSocketEcho/Driver/dllsup.cpp b/general/echo/umdfSocketEcho/Driver/dllsup.cpp
deleted file mode 100644
index 5ec3eb33..00000000
--- a/general/echo/umdfSocketEcho/Driver/dllsup.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Socktecho Sample
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the socktecho uses
- L"Microsoft\\UMDF\\Socketecho"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-class CSocketEchoModule : public CAtlDllModuleT< CSocketEchoModule >
-{
-};
-
-
-OBJECT_ENTRY_AUTO(CLSID_MyDriverCoClass, CMyDriver)
-
-
-CSocketEchoModule _AtlModule;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID Reserved
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
-
- UNREFERENCED_PARAMETER( ModuleHandle );
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
-
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return _AtlModule.DllMain(Reason, Reserved);
-;
-}
-
-_Check_return_
-STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv)
-{
- return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
-}
diff --git a/general/echo/umdfSocketEcho/Driver/driver.cpp b/general/echo/umdfSocketEcho/Driver/driver.cpp
deleted file mode 100644
index 4f93691c..00000000
--- a/general/echo/umdfSocketEcho/Driver/driver.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Socketecho Sample's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-STDMETHODIMP
-CMyDriver::OnInitialize(
- _In_ IWDFDriver* pWdfDriver
- )
-
-
-/*++
-
- Routine Description:
-
- This routine is invoked by the framework at driver load .
- This method will invoke the Winsock Library for using
- Winsock API in this driver.
-
- Arguments:
-
- pWdfDriver - Framework driver object
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
- UNREFERENCED_PARAMETER(pWdfDriver);
-
- WORD sockVersion;
- WSADATA wsaData;
-
- sockVersion = MAKEWORD(2, 0);
-
- int result = WSAStartup(sockVersion, &wsaData);
-
- if (result != 0)
- {
- DWORD err = WSAGetLastError();
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Failed to initialize Winsock 2.0 %!winerr!",
- err
- );
- return HRESULT_FROM_WIN32(err);
- }
-
- return S_OK;
-}
-
-STDMETHODIMP_(void)
-CMyDriver::OnDeinitialize(
- _In_ IWDFDriver* pWdfDriver
- )
-
-/*++
- Routine Description:
-
- The FX invokes this method when it unloads the driver.
- This routine will Cleanup Winsock library
-
- Arguments:
-
- pWdfDriver - the Fx driver object.
-
- Return Value:
-
- None
-
-
- --*/
-
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- UNREFERENCED_PARAMETER(pWdfDriver);
-
- WSACleanup();
-}
-
-STDMETHODIMP
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- Trace(
- TRACE_LEVEL_INFORMATION,
- "%!FUNC!"
- );
-
- HRESULT hr;
-
- CComObject<CMyDevice> * device = NULL;
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CComObject<CMyDevice>::CreateInstance(&device);
-
- if (SUCCEEDED(hr))
- {
- device->AddRef();
- hr = device->Initialize(FxWdfDriver, FxDeviceInit);
- }
-
- //
- // If that succeeded then call the device's configure method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference we took on the device callback object.
- // The framework took its own references on the object's callback interfaces
- // when we called FxWdfDriver->CreateDevice, and will manage the object's lifetime.
- //
- SAFE_RELEASE(device);
-
- return hr;
-}
diff --git a/general/echo/umdfSocketEcho/Driver/driver.h b/general/echo/umdfSocketEcho/Driver/driver.h
deleted file mode 100644
index 6affa20f..00000000
--- a/general/echo/umdfSocketEcho/Driver/driver.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Socketecho sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the socktecho sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-extern const GUID CLSID_MyDriverCoClass;
-
-class ATL_NO_VTABLE CMyDriver :
- public CComObjectRootEx<CComMultiThreadModel>,
- public CComCoClass<CMyDriver, &CLSID_MyDriverCoClass>,
- public IDriverEntry
-{
-public:
-
-DECLARE_NOT_AGGREGATABLE(CMyDriver)
-
-DECLARE_CLASSFACTORY();
-
-DECLARE_NO_REGISTRY();
-
-BEGIN_COM_MAP(CMyDriver)
- COM_INTERFACE_ENTRY(IDriverEntry)
-END_COM_MAP()
-
-public:
- // IDriverEntry
- STDMETHOD(OnInitialize)(_In_ IWDFDriver* pWdfDriver);
- STDMETHOD(OnDeviceAdd)(_In_ IWDFDriver* pWdfDriver, _In_ IWDFDeviceInitialize* pWdfDeviceInit);
- STDMETHOD_(void,OnDeinitialize)(_In_ IWDFDriver* pWdfDriver);
-};
-
diff --git a/general/echo/umdfSocketEcho/Driver/exports.def b/general/echo/umdfSocketEcho/Driver/exports.def
deleted file mode 100644
index 2c0b7d49..00000000
--- a/general/echo/umdfSocketEcho/Driver/exports.def
+++ /dev/null
@@ -1,6 +0,0 @@
-; Socketecho.def : Declares the module parameters.
-
-LIBRARY "SocketEcho"
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/general/echo/umdfSocketEcho/Driver/internal.h b/general/echo/umdfSocketEcho/Driver/internal.h
deleted file mode 100644
index a7875468..00000000
--- a/general/echo/umdfSocketEcho/Driver/internal.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF Socketecho sample
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the winsock headers before any other windows headers.
-//
-#include <winsock2.h>
-#include <ws2tcpip.h>
-
-//
-// Include the WUDF DDI
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Define the tracing flags.
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- MyDriverTraceControl, (64316518,DFE2,42B6,8786,4995E5EC435), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\SocketEcho"
-#define MYDRIVER_CLASS_ID { 0x83B87D35, 0x76B8, 0x4920, {0xB4, 0x3C, 0x3B, 0xDE, 0x6B, 0x0E, 0xC5, 0xB8} }
-
-#ifndef SAFE_RELEASE
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
-#endif
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_SAMPLE_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-//
-// Include the type specific headers.
-//
-#include <atlbase.h>
-#include <atlcom.h>
-
-#include "connection.h"
-#include "filecontext.h"
-#include "devicecontext.h"
-#include "driver.h"
-#include "device.h"
-#include "queue.h"
-
-_Analysis_mode_(_Analysis_operator_new_null_)
-
diff --git a/general/echo/umdfSocketEcho/Exe/internal.h b/general/echo/umdfSocketEcho/Exe/internal.h
deleted file mode 100644
index ff1cd863..00000000
--- a/general/echo/umdfSocketEcho/Exe/internal.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// internal.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#pragma once
-
-#include <driverspecs.h>
-_Analysis_mode_(_Analysis_code_type_user_code_);
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strsafe.h>
-#include <setupapi.h>
-
-#include "socketechoserver.h"
diff --git a/general/echo/umdfSocketEcho/Exe/socketechoserver.cpp b/general/echo/umdfSocketEcho/Exe/socketechoserver.cpp
deleted file mode 100644
index bfe5f546..00000000
--- a/general/echo/umdfSocketEcho/Exe/socketechoserver.cpp
+++ /dev/null
@@ -1,512 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- socketserver.cpp
-
-Abstract:
-
- A simple socket server application that listens on a specified port and echoes back data
- received.
-
-Environment:
-
- User Mode
-
---*/
-
-#include "internal.h"
-
-
-DWORD
-Run(
- LPVOID lpThreadParameter
- )
- /*++
-
-Routine Description:
-
- This routine is invoked for each thread created for a new connection accepted by the server.
- The rcv and send to socket happen in this thread routine.
-
-
-Arguments:
-
- lpThreadParameter , The Thread parameter which contains socket information
-
-Return Value:
-
- Thread Exit Code
-
-
---*/
-{
- #define DeleteBufferExitThread(dwExitCode) \
- delete[] buffer; \
- buffer = NULL; \
- ExitThread(dwExitCode);
-
- #define DeleteBufferReturn(dwExitCode) \
- delete[] buffer; \
- buffer = NULL; \
- return dwExitCode;
-
- int count =0;
-
- char *buffer = new char[DATA_LENGTH];
- if (NULL == buffer)
- {
- ExitThread(1);
- }
-
- DWORD Event;
-
- //
- // Look at socket information from thread arg.
- //
-
-
- CEchoServer *pThreadData = (CEchoServer*)lpThreadParameter;
- if (pThreadData==NULL)
- {
- DeleteBufferExitThread(1);
- }
-
- SOCKET sClient = pThreadData->m_socket;
- HANDLE NetworkEvent = pThreadData->m_NetworkEvent;
- WSANETWORKEVENTS NetworkEvents;
- printf("Client Start: 0x%Ix\n", sClient);
- int actual = 0;
- for(;;)
- {
- if ((Event = WSAWaitForMultipleEvents(
- 1,
- &NetworkEvent,
- FALSE,
- WSA_INFINITE,
- FALSE)) == WSA_WAIT_FAILED)
- {
- printf("WSAWaitForMultipleEvents failed with error %d\n", WSAGetLastError());
- DeleteBufferReturn(0);
- }
-
- if (WSAEnumNetworkEvents(sClient ,NetworkEvent, &NetworkEvents) == SOCKET_ERROR)
- {
- printf("WSAEnumNetworkEvents failed with error %d\n", WSAGetLastError());
- DeleteBufferReturn(0);
- }
-
- if (NetworkEvents.lNetworkEvents & FD_READ)
- {
- if (NetworkEvents.lNetworkEvents & FD_READ && NetworkEvents.iErrorCode[FD_READ_BIT] != 0)
- {
- printf("FD_READ failed with error %d\n", NetworkEvents.iErrorCode[FD_READ_BIT]);
- }
- else
- {
-
- actual = recv(sClient,buffer,DATA_LENGTH*sizeof(char),0);
- //
- // socket connection has been reset ,so bail out .
- //
- if (actual == 0 || actual == WSAECONNRESET )
- {
- printf(" Could not get data , Error : 0x%lx \n",WSAGetLastError());
- break; // socket shut-down
-
- }
- printf("FD_READ read buffer on client 0x%Ix with length %d \n",sClient,actual);
- count = send(sClient, (const char*)buffer,actual,0);
- if ( count == SOCKET_ERROR )
- {
- if ( WSAGetLastError()== WSAEWOULDBLOCK )
- {
- printf(" Could not send data as resource is unavaliable , do not retry until next Write event \n");
- }
- else
- {
- printf(" Could not send data , Error : 0x%lx \n",WSAGetLastError());
- break;
- }
- }
- else
- {
- printf("FD_WRITE write buffer on client 0x%Ix with length %d \n",sClient,count);
- }
- }
- }
- //
- // if there is a write network event and there is data to write , write that
- //
- if (NetworkEvents.lNetworkEvents & FD_WRITE)
- {
- if (NetworkEvents.lNetworkEvents & FD_WRITE && NetworkEvents.iErrorCode[FD_WRITE_BIT] != 0)
- {
- printf("FD_WRITE failed with error %d\n", NetworkEvents.iErrorCode[FD_WRITE_BIT]);
- }
- else
- {
- count = send(sClient, (const char*)buffer,actual,0);
- if ( count == SOCKET_ERROR )
- {
- if ( WSAGetLastError()== WSAEWOULDBLOCK )
- {
- printf(" Could not send data as resource is unavaliable , do not retry until next Write event ");
- }
- else
- {
- printf(" Could not send data , Error : 0x%lx \n",WSAGetLastError());
- break;
- }
- }
- else
- {
- printf("FD_WRITE write buffer on client 0x%Ix with length %d \n",sClient,count);
- }
- actual = 0;
- }
- }
- if (NetworkEvents.lNetworkEvents & FD_CLOSE)
- {
- shutdown(sClient,FD_READ|FD_WRITE);
- printf(" recived a close from client : 0x%Ix \n",sClient);
- closesocket(sClient);
- DeleteBufferExitThread(0);
- }
- }
-
- DeleteBufferReturn(1);
-
-}
-
-CEchoServer::CEchoServer(
- SOCKET socketclient
- )
-/*++
-
-Routine Description:
-
- This is the constructor routine for CEchoServer class. This is called for each instance of new
- connection accepted by the server .
-
-Arguments:
-
- Socket received from the accept
-
-Return Value:
-
- None .
-
---*/
-{
- m_socket = socketclient;
- m_NetworkEvent = WSACreateEvent();
- printf("socket created : 0x%Ix \n", m_socket);
-
-}
-
-void
-CEchoServer::Start()
-/*++
-
-Routine Description:
-
- This routine is to Start the thread which will rcv and send the data recieved on this instance of socket connection.
-
-
-Arguments:
-
- None.
-
-Return Value:
-
- None.
---*/
-{
-
-
- if(WSAEventSelect(
- m_socket,
- m_NetworkEvent,
- FD_READ|FD_WRITE|FD_CLOSE)== SOCKET_ERROR)
- {
- printf("Error in Event Select,Cannot start Server thread for this socket \n");
- closesocket(m_socket);
- goto Exit;
- }
-//
-// Create thread to read/write data to this socket
-//
-
- HANDLE hRunThread = CreateThread(
- NULL, // Default Security Attrib.
- 0, // Initial Stack Size,
- (LPTHREAD_START_ROUTINE) Run, // Thread Func
- this, // Arg to Thread Func.
- 0, // Creation Flags
- NULL // Don't need the Thread Id.
- );
- if (NULL == hRunThread)
- {
- printf(" Could not create socket server run thread : 0x%lx \n", GetLastError());
- closesocket(m_socket);
- goto Exit;
- }
-
-Exit:
-
- return ;
- }
-
-void
-SocketServerMain(
- _In_ unsigned short uPort
- )
-/*++
-
-Routine Description:
-
- This routine is the main entry for the app when the app is configured to
- be a socket server.
- It creates a a listening socket for incoming conenctions.
-
-
-Arguments:
-
- uPort - Port Number that the socket server binds to
-
-Return Value:
-
- None.
---*/
-{
-
-
- SOCKET ListenSocket;
- int iResult;
- #pragma warning( suppress: 24002 ) // suppress warning for IPv6 ,currently IPv4 specific
- sockaddr_in service ;
-
- // Initialize Winsock 2.2
- WSADATA wsaData;
- iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
- if ( NO_ERROR != iResult )
- {
- printf("Error at WSAStartup() \n");
- goto Exit;
- }
- //
- // Create a SOCKET for listening for incoming connection requests.
- //
- ListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if ( INVALID_SOCKET == ListenSocket)
- {
- printf("Error at socket(): %ld\n ", WSAGetLastError());
- goto Cleanup;
- }
- // The sockaddr_in structure specifies the address family,
- // IP address, and port for the socket that is being bound.
- service.sin_family = AF_INET;
- //
- // Suppress overflow warning.
- // inet_pton is annotated to write sizeof(IN6_ADDR) bytes to pAddrBuf,
- // but it only writes sizeof(IN_ADDR) bytes when Family is AF_INET (IPv4).
- // https://msdn.microsoft.com/en-us/library/windows/desktop/cc805844(v=vs.85).aspx
- //
- #pragma warning( suppress: 26000 )
- iResult = inet_pton(AF_INET, "127.0.0.1", &service.sin_addr);
- if (iResult != 1)
- {
- printf("Error at inet_pton(): %ld\n ", WSAGetLastError());
- closesocket(ListenSocket);
- goto Cleanup;
- }
- service.sin_port = htons(uPort);
- if (SOCKET_ERROR == bind(
- ListenSocket,
- (SOCKADDR*) &service,
- sizeof(service) ) )
- {
- printf("bind() failed. \n");
- closesocket(ListenSocket);
- goto Cleanup;
- }
-
- //
- // Listen for incoming connection requests
- // on the created socket upto MAX_CONNECTIONS
- //
- if ( SOCKET_ERROR == listen(
- ListenSocket,
- MAX_CONNECTIONS ) )
- {
- printf("Error listening on socket.\n");
- }
- printf("Listening on socket...\n");
-
- //
- // Set Socket RCVBUF and SNDBUF size to DATA_LENGTH , so large requests are not fragmented .
- //
- int iOptVal;
- int iOptLen = sizeof(int);
-
- if (getsockopt(ListenSocket, SOL_SOCKET, SO_RCVBUF, (char*)&iOptVal, &iOptLen) != SOCKET_ERROR)
- {
- printf("SO_RCVBUF value: %ld\n", iOptVal);
- }
- iOptVal = DATA_LENGTH;
- iOptLen = sizeof(int);
- if (setsockopt(ListenSocket, SOL_SOCKET, SO_RCVBUF, (char*)&iOptVal, iOptLen) != SOCKET_ERROR)
- {
- printf("Set SO_RCVBUF: ON\n");
- }
- iOptLen = sizeof(int);
- if (getsockopt(ListenSocket, SOL_SOCKET, SO_RCVBUF, (char*)&iOptVal, &iOptLen) != SOCKET_ERROR)
- {
- printf("SO_RCVBUF Value: %ld\n", iOptVal);
- }
- iOptLen = sizeof(int);
- if (getsockopt(ListenSocket, SOL_SOCKET, SO_SNDBUF, (char*)&iOptVal, &iOptLen) != SOCKET_ERROR)
- {
- printf("SO_SNDBUF value: %ld\n", iOptVal);
- }
- iOptVal = DATA_LENGTH;
- iOptLen = sizeof(int);
- if (setsockopt(ListenSocket, SOL_SOCKET, SO_SNDBUF, (char*)&iOptVal, iOptLen) != SOCKET_ERROR)
- {
- printf("Set SO_SNDBUF: ON\n");
- }
- iOptLen = sizeof(int);
- if (getsockopt(ListenSocket, SOL_SOCKET, SO_SNDBUF, (char*)&iOptVal, &iOptLen) != SOCKET_ERROR)
- {
- printf("SO_SNDBUF Value: %ld\n", iOptVal);
- }
-
-//
-// Loop the server to start accepting connections from clients on this socket
-//
-
- for(;;)
- {
- CEchoServer *client = new CEchoServer(accept(ListenSocket,NULL,NULL));
-
- if (client)
- {
- printf("Client connected.\n");
- client->Start(); // Start receiving/sending data on the socket
- }
- }
-
-Cleanup:
- //
- // Invoke Winsock Cleanup
- //
-
- WSACleanup();
-
- Exit:
- return;
-
-}
-void
-Usage()
-
-/*++
-
-Routine Description:
-
- This routine is invoked to display the usage of this application
-
-Arguments:
-
- None.
-
-Return Value:
-
- None .
---*/
-
-{
- printf("\n\n Usage: \n");
- printf(" ------ \n\n");
- printf(" socketechoapp Display Usage \n");
- printf(" socketechoapp -h Display Usage\n");
- printf(" socketechoapp -p Start the app as server listening on default port\n");
- printf(" socketechoapp -p [port#] Start the app as server listening on this port \n");
-
-
-
-}
-
-
-/* */
-void __cdecl
-main(
- _In_ int argc,
- _In_reads_(argc) char* argv[]
- )
-
-/*++
-
-Routine Description:
-
-
-
-Arguments:
-
- None.
-
-Return Value:
-
- None.
---*/
-{
- unsigned short argIndex = 1 ;
- unsigned short uPort = DEFAULT_PORT_ADDRESS ;
-
-
- if (argc < 2)
- {
- Usage();
- goto Exit;
- }
-
-//
-// look at second arg and check for either -h which indicates user asked for help in Usage
-// of this commandline
-//
-
- if (!strcmp(*(argv+argIndex),"-h"))
- {
- Usage();
- goto Exit;
- }
-//
-// check if its -p and proceed with otherwise show usage
-//
- else if (!strcmp(*(argv+argIndex),"-p"))
- {
- //
- // look at third arg, which should be the port#
- //
- if ( ++argIndex < argc )
- {
- uPort = (unsigned short)atoi(*(argv+(argIndex)));
- }
- SocketServerMain(uPort);
-
- }
- else
- {
- Usage();
- goto Exit;
- }
-
-Exit:
- return;
-
-}
-
-
diff --git a/general/echo/umdfSocketEcho/Exe/socketechoserver.h b/general/echo/umdfSocketEcho/Exe/socketechoserver.h
deleted file mode 100644
index f71bc48b..00000000
--- a/general/echo/umdfSocketEcho/Exe/socketechoserver.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- sockechoserver.h
-
-Abstract:
-
- Header file for the socket server module of the socketecho application
-
-Environment:
-
- User mode only
-
---*/
-
-#pragma once
-
-
-#define MAX_CONNECTIONS 5
-#define DEFAULT_PORT_ADDRESS 6000
-#define DATA_LENGTH 1024*40
-
-void
-SocketServerMain(
- _In_ unsigned short uPort
- );
-
- //
- // Class definition for CEchoServer Class
- //
-class CEchoServer
-{
-
- public:
-
- SOCKET m_socket;
- HANDLE m_NetworkEvent;
-
-
-
- CEchoServer(SOCKET socketclient);
- void Start();
-
-};
-
diff --git a/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj b/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj
deleted file mode 100644
index e226bb5c..00000000
--- a/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj
+++ /dev/null
@@ -1,190 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{70A0F94B-0D04-4AB4-A653-733AC0210EBC}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{0C41C62B-B1D0-4A46-B431-6DA1A153FDC0}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>socketechoserver</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>socketechoserver</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>socketechoserver</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>socketechoserver</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);user32.lib;Ws2_32.lib</AdditionalDependencies>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);user32.lib;Ws2_32.lib</AdditionalDependencies>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);user32.lib;Ws2_32.lib</AdditionalDependencies>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);user32.lib;Ws2_32.lib</AdditionalDependencies>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="socketechoserver.cpp" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inf" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj.Filters b/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj.Filters
deleted file mode 100644
index daed19de..00000000
--- a/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj.Filters
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{6F82EFE8-0818-4BAE-A52F-C72D9E63CAD6}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{448C5D48-4FD2-4DA5-964C-3EF201A3ED31}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{439980EC-B0F0-45A7-AF18-E832E564F57D}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="socketechoserver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/general/echo/umdfSocketEcho/README.md b/general/echo/umdfSocketEcho/README.md
deleted file mode 100644
index d4a6077f..00000000
--- a/general/echo/umdfSocketEcho/README.md
+++ /dev/null
@@ -1,146 +0,0 @@
----
-page_type: sample
-description: "Demonstrates how to use UMDF version 1 to write a driver and demonstrates best practices."
-languages:
-- cpp
-products:
-- windows
-- windows-wdk
----
-
-# UMDF SocketEcho Sample (UMDF Version 1)
-
-The UMDF SocketEcho sample demonstrates how to use the User-Mode Driver Framework (UMDF) to write a driver and demonstrates best practices.
-
-This sample also demonstrates how to use a default parallel dispatch I/O queue, use a Microsoft Win32 dispatcher, and handle a socket handle by using a Win32 file I/O target.
-
-## Related technologies
-
-[User-Mode Driver Framework](https://docs.microsoft.com/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2)
-
-## Code Tour
-
-This sample driver is a minimal driver that is intended to demonstrate how to use UMDF. It is not intended for use in a production environment.
-
-- **CMyDriver::OnInitialize** in **driver.cpp** is called by the framework when the driver loads. This method initiates use of the Winsock Library.
-
-- **CMyDriver::OnDeviceAdd** in **driver.cpp** is called by the framework to install the driver on a device stack. OnDeviceAdd creates a device callback object, and then calls IWDFDriver::CreateDevice to create an framework device object and to associate the device callback object with the framework device object.
-
-- **CMyQueue::OnCreateFile** in **queue.cpp** is called by the framework to create a socket connection, create a file i/o target that is associated with the socket handle for this connection, and store the socket handle in the file object context.
-
-## Installation
-
-In Visual Studio, you can press F5 to build the sample and then deploy it to a target machine. For more information, see [Deploying a Driver to a Test Computer](https://docs.microsoft.com/windows-hardware/drivers/develop/deploying-a-driver-to-a-test-computer). Alternatively, you can install the sample from the command line.
-
-To test this sample, you must have a test computer. This test computer can be a second computer or, if necessary, your development computer.
-
-To install the UMDF Echo sample driver from the command line, do the following:
-
-1. Copy the driver binary and the socketecho.inf file to a directory on your test computer (for example, C:\\ socketechoSample.)
-
-1. Copy the UMDF coinstaller, WUDFUpdate\_*MMmmmm*.dll, from the \\redist\\wdf\\\<architecture\> directory to the same directory (for example, C:\\socketechoSample).
-
- > [!NOTE]
- > You can obtain redistributable framework updates by downloading the *wdfcoinstaller.msi* package from [WDK 8 Redistributable Components](https://go.microsoft.com/fwlink/p/?LinkID=253170). This package performs a silent install into the directory of your Windows Driver Kit (WDK) installation. You will see no confirmation that the installation has completed. You can verify that the redistributables have been installed on top of the WDK by ensuring there is a redist\\wdf directory under the root directory of the WDK, %ProgramFiles(x86)%\\Windows Kits\\8.0.
-
-1. Navigate to the directory that contains the INF file and binaries (for example, cd /d c:\\socketechoSample), and run DevCon.exe as follows:
-
- `devcon.exe install socketecho.inf WUDF\\socketecho`
-
- You can find DevCon.exe in the \\tools directory of the WDK (for example, \\tools\\devcon\\i386\\devcon.exe).
-
-To update the socketecho driver after you make any changes, do the following:
-
-1. Increment the version number in the INF file. This change is not necessary, but it will help ensure that Plug and Play (PnP) selects your new driver as a better match for the device.
-
-1. Copy the updated driver binary and the socketecho.inf file to a directory on your test computer (for example, C:\\ socketechoSample.)
-
-1. Navigate to the directory that contains the INF file and binaries (for example, cd /d c:\\ socketechoSample), and run devcon.exe as follows:
-
- `devcon.exe update socketecho.inf WUDF\\socketecho`
-
-To test this sample drivers on a checked operating system that you have installed (in contrast to the standard retail installations), you must modify the INF file to use the checked version of the UMDF co-installer. That is, you must do the following:
-
-1. In the INX file, replace all occurrences of WudfUpdate\_*MMmmmm*.dll with WudfUpdate\_*MMmmmm*\_chk.dll.
-
-1. Copy the WudfUpdate\_*MMmmmm*\_chk.dll file from the \\redist\\wdf\\\<architecture\> directory to your driver package instead of WudfUpdate\_*MMmmmm*.dll.
-
-1. If WdfCoinstaller*MMmmmm*.dll or WinUsbCoinstaller.dll is included in your driver package, repeat step 1 and step 2 for them.
-
-## Testing
-
-To test the SocketEcho driver, you can run socketechoserver.exe, which is built from the \\echo\\umdfSocketEcho\\Exe directory, and echoapp.exe, which is built from the Kernel-Mode Driver Framework (KMDF) samples in the \\echo\\kmdf directory.
-
-First, you must install the device as described earlier. Then, run socketechoserver.exe from a Command Prompt window.
-
-`D:\\\>socketechoserver -h`
-
-## Usage
-
-socketechoserver usage
-
-```cmd
-D:\>socketechoserver -h
-
-socketechoserver -p Start the app as server listening on default port
-socketechoserver -p [port\#] Start the app as server listening on this port
-
-D:\>socketechoserver -p
-
-Listening on socket...
-```
-
-In another Command Prompt window, run echoapp.exe.
-
-```cmd
-D:\>echoapp
-
-DevicePath: \\\\?\\root\#sample\#0000\#{ e5e65b0c-82c8-4689-96d4-f77837971990}
-
-Opened device successfully
-
-512 Pattern Bytes Written successfully
-512 Pattern Bytes Read successfully
-
-Pattern Verified successfully
-
-D:\>echoapp -Async
-
-DevicePath: \\?\root\#sample\#0000\#{cdc35b6e-0be4-4936-bf5f-5537380a7c1a}
-
-Opened device successfully
-
-Starting AsyncIo
-
-Number of bytes written by request number 0 is 1024
-Number of bytes read by request number 0 is 1024
-Number of bytes written by request number 1 is 1024
-Number of bytes read by request number 1 is 1024
-Number of bytes written by request number 2 is 1024
-Number of bytes read by request number 2 is 1024
-Number of bytes written by request number 3 is 1024
-Number of bytes read by request number 3 is 1024
-Number of bytes written by request number 4 is 1024
-Number of bytes read by request number 4 is 1024
-Number of bytes written by request number 5 is 1024
-Number of bytes read by request number 5 is 1024
-Number of bytes written by request number 6 is 1024
-Number of bytes read by request number 6 is 1024
-Number of bytes written by request number 7 is 1024
-Number of bytes read by request number 7 is 1024
-Number of bytes written by request number 8 is 1024
-Number of bytes read by request number 8 is 1024
-Number of bytes written by request number 9 is 1024
-Number of bytes read by request number 9 is 1024
-Number of bytes written by request number 10 is 1024
-Number of bytes read by request number 10 is 1024
-Number of bytes written by request number 11 is 1024
-...
-```
-
-> [!NOTE]
-> Independent threads perform the reads and writes in the echo test application. As a result, the order of the output might not exactly match what you see in the preceding output example.
-
-## File Manifest
-
-**Dllsup.cpp**: The DLL support code that provides the DLL's entry point and the single required export (DllGetClassObject).
diff --git a/general/echo/umdfSocketEcho/umdfsocketecho.sln b/general/echo/umdfSocketEcho/umdfsocketecho.sln
deleted file mode 100644
index 775550f5..00000000
--- a/general/echo/umdfSocketEcho/umdfsocketecho.sln
+++ /dev/null
@@ -1,46 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0
-MinimumVisualStudioVersion = 12.0
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Driver", "Driver", "{5926AA26-ED89-4B86-ADD3-6415A17996DF}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Exe", "Exe", "{17E8DD65-7DC7-4D59-96A0-52A20C036403}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SocketEcho", "Driver\SocketEcho.vcxproj", "{353E2F22-BD87-47F3-A211-90DE8D583D26}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "socketechoserver", "Exe\socketechoserver.vcxproj", "{70A0F94B-0D04-4AB4-A653-733AC0210EBC}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- Debug|x64 = Debug|x64
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {353E2F22-BD87-47F3-A211-90DE8D583D26}.Debug|Win32.ActiveCfg = Debug|Win32
- {353E2F22-BD87-47F3-A211-90DE8D583D26}.Debug|Win32.Build.0 = Debug|Win32
- {353E2F22-BD87-47F3-A211-90DE8D583D26}.Release|Win32.ActiveCfg = Release|Win32
- {353E2F22-BD87-47F3-A211-90DE8D583D26}.Release|Win32.Build.0 = Release|Win32
- {353E2F22-BD87-47F3-A211-90DE8D583D26}.Debug|x64.ActiveCfg = Debug|x64
- {353E2F22-BD87-47F3-A211-90DE8D583D26}.Debug|x64.Build.0 = Debug|x64
- {353E2F22-BD87-47F3-A211-90DE8D583D26}.Release|x64.ActiveCfg = Release|x64
- {353E2F22-BD87-47F3-A211-90DE8D583D26}.Release|x64.Build.0 = Release|x64
- {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Debug|Win32.ActiveCfg = Debug|Win32
- {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Debug|Win32.Build.0 = Debug|Win32
- {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Release|Win32.ActiveCfg = Release|Win32
- {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Release|Win32.Build.0 = Release|Win32
- {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Debug|x64.ActiveCfg = Debug|x64
- {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Debug|x64.Build.0 = Debug|x64
- {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Release|x64.ActiveCfg = Release|x64
- {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {353E2F22-BD87-47F3-A211-90DE8D583D26} = {5926AA26-ED89-4B86-ADD3-6415A17996DF}
- {70A0F94B-0D04-4AB4-A653-733AC0210EBC} = {17E8DD65-7DC7-4D59-96A0-52A20C036403}
- EndGlobalSection
-EndGlobal
diff --git a/general/toaster/toastDrv/Package/package.VcxProj b/general/toaster/toastDrv/Package/package.VcxProj
index 572e08b5..85af0a9a 100644
--- a/general/toaster/toastDrv/Package/package.VcxProj
+++ b/general/toaster/toastDrv/Package/package.VcxProj
@@ -40,12 +40,6 @@
<ProjectReference Include="..\kmdf\toastmon\wdftoastmon.vcxproj">
<Project>{D15FD911-F2DA-4644-8142-6D22756AD287}</Project>
</ProjectReference>
- <ProjectReference Include="..\umdf\func\WUDFToaster.vcxproj">
- <Project>{3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}</Project>
- </ProjectReference>
- <ProjectReference Include="..\umdf\Toastmon\WUDFToastMon.vcxproj">
- <Project>{F575419D-099B-4DA0-B80C-88D766DD7542}</Project>
- </ProjectReference>
</ItemGroup>
<PropertyGroup Label="PropertySheets">
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
diff --git a/general/toaster/toastDrv/README.md b/general/toaster/toastDrv/README.md
index fc84c39d..4c5b52bc 100644
--- a/general/toaster/toastDrv/README.md
+++ b/general/toaster/toastDrv/README.md
@@ -10,7 +10,7 @@ products:
# Toaster Sample Driver
-The Toaster collection is an iterative series of samples that demonstrate fundamental aspects of Windows driver development for both Kernel-Mode Driver Framework (KMDF) and User-Mode Driver Framework (UMDF) version 1.
+The Toaster collection is an iterative series of samples that demonstrate fundamental aspects of Windows driver development for both Kernel-Mode Driver Framework (KMDF).
All the samples work with a hypothetical toaster bus, over which toaster devices can be connected to a PC.
@@ -76,89 +76,3 @@ As an alternative to building the Toaster sample in Visual Studio, you can build
For more information about using MSBuild to build a driver package, see [Building a Driver with Visual Studio and the WDK](https://docs.microsoft.com/windows-hardware/drivers/develop/building-a-driver).
-## UMDF Toaster File Manifest
-
-### WUDFToaster.idl
-
-Component Interface file
-
-### WUDFToaster.cpp
-
-DLL Support code - provides the DLL's entry point as well as the DllGetClassObject export.
-
-### WUDFToaster.def
-
-This file lists the functions that the driver DLL exports.
-
-### stdafx.h
-
-This is the main header file for the sample driver.
-
-### driver.cpp and driver.h (WUDFToaster)
-
-Definition and implementation of the IDriverEntry callbacks in CDriver class.
-
-### device.cpp and device.h (WUDFToaster)
-
-Definition and implementation of various interfaces and their callbacks in CDevice class. Add your PnP and Power interfaces specific for your hardware.
-
-### queue.cpp and queue.h
-
-Definition and implementation of the base queue callback class (CQueue). IQueueCallbackDevicekIoControl, IQueueCallbackRead and IQueueCallBackWrite callbacks are implemented to handle I/O control requests.
-
-### WUDFToaster.rc
-
-This file defines resource information for the WUDF Toaster sample driver.
-
-### WUDFToaster.inf
-
-Sample INF for installing the sample WUDF Toaster driver under the Toaster class of devices.
-
-### WUDFtoaster.ctl, internal.h
-
-This file lists the WPP trace control GUID(s) for the sample driver. This file can be used with the tracelog command's -guid flag to enable the collection of these trace events within an established trace session.
-These GUIDs must remain in sync with the trace control guids defined in internal.h.
-
-## Toastmon File Manifest
-
-### comsup.cpp and comsup.h
-
-Boilerplate COM Support code - specifically base classes which provide implementations for the standard COM interfaces IUnknown and IClassFactory which are used throughout the sample.
-The implementation of IClassFactory is designed to create instances of the CMyDriver class. If you should change the name of your base driver class, you would also need to modify this file.
-
-### dllsup.cpp
-
-Boilerplate DLL Support code - provides the DLL's entry point as well as the single required export (DllGetClassObject).
-These depend on comsup.cpp to perform the necessary class creation.
-
-### exports.def
-
-This file lists the functions that the driver DLL exports.
-
-### internal.h
-
-This is the main header file for the ToastMon driver
-
-### driver.cpp and driver.h (Toastmon)
-
-Definition and implementation of the driver callback class for the ToastMon sample.
-
-### device.cpp and device.h (Toastmon)
-
-Definition and implementation of the device callback class for the ToastMon sample. This is mostly boilerplate, but also registers for RemoteInterface Arrival notifications. When a RemoteInterface arrival callback occurs, it calls CreateRemoteInterface and creates a CMyRemoteTarget callback object to handle I/O on that RemoteInterface.
-
-### RemoteTarget.cpp and RemoteTarget.h
-
-Definition and implementation of the remote target callback class for the ToastMon sample.
-
-### list.h
-
-Doubly-linked-list code
-
-### ToastMon.rc
-
-This file defines resource information for the ToastMon sample driver.
-
-### UMDFToastMon.inf
-
-Sample INF for installing the Skeleton driver to control a root enumerated device with a hardware ID of UMDFSamples\\ToastMon
diff --git a/general/toaster/toastDrv/toaster.sln b/general/toaster/toastDrv/toaster.sln
index 0d1c2e6c..551f7a75 100644
--- a/general/toaster/toastDrv/toaster.sln
+++ b/general/toaster/toastDrv/toaster.sln
@@ -37,12 +37,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Bus", "Bus", "{320825A6-82C
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dynamic", "Dynamic", "{4A994F2B-05BD-4CED-9157-45B29777740D}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Toastmon", "Toastmon", "{16ECEF20-C217-4477-8C88-E8A231CC23B8}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umdf", "Umdf", "{82276D55-C8B4-4C84-98FE-83F10C898FA0}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Func", "Func", "{9BEE50D5-9D78-4CA3-A535-75904B21C448}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "package", "Package\package.VcxProj", "{30FFB863-CECC-4E27-85F1-8DAC2256FC2F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WmiToast", "exe\wmi\WmiToast.vcxproj", "{869C08D1-A32F-49C7-9831-2ADB52F241B6}"
@@ -67,10 +61,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StatBus", "kmdf\bus\static\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynambus", "kmdf\bus\dynamic\dynambus.vcxproj", "{E5E1F492-05BB-45A3-B09F-F643DC1C6B03}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFToastMon", "umdf\Toastmon\WUDFToastMon.vcxproj", "{F575419D-099B-4DA0-B80C-88D766DD7542}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFToaster", "umdf\func\WUDFToaster.vcxproj", "{3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -175,22 +165,6 @@ Global
{E5E1F492-05BB-45A3-B09F-F643DC1C6B03}.Debug|x64.Build.0 = Debug|x64
{E5E1F492-05BB-45A3-B09F-F643DC1C6B03}.Release|x64.ActiveCfg = Release|x64
{E5E1F492-05BB-45A3-B09F-F643DC1C6B03}.Release|x64.Build.0 = Release|x64
- {F575419D-099B-4DA0-B80C-88D766DD7542}.Debug|Win32.ActiveCfg = Debug|Win32
- {F575419D-099B-4DA0-B80C-88D766DD7542}.Debug|Win32.Build.0 = Debug|Win32
- {F575419D-099B-4DA0-B80C-88D766DD7542}.Release|Win32.ActiveCfg = Release|Win32
- {F575419D-099B-4DA0-B80C-88D766DD7542}.Release|Win32.Build.0 = Release|Win32
- {F575419D-099B-4DA0-B80C-88D766DD7542}.Debug|x64.ActiveCfg = Debug|x64
- {F575419D-099B-4DA0-B80C-88D766DD7542}.Debug|x64.Build.0 = Debug|x64
- {F575419D-099B-4DA0-B80C-88D766DD7542}.Release|x64.ActiveCfg = Release|x64
- {F575419D-099B-4DA0-B80C-88D766DD7542}.Release|x64.Build.0 = Release|x64
- {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Debug|Win32.ActiveCfg = Debug|Win32
- {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Debug|Win32.Build.0 = Debug|Win32
- {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Release|Win32.ActiveCfg = Release|Win32
- {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Release|Win32.Build.0 = Release|Win32
- {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Debug|x64.ActiveCfg = Debug|x64
- {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Debug|x64.Build.0 = Debug|x64
- {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Release|x64.ActiveCfg = Release|x64
- {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -208,8 +182,6 @@ Global
{B39F6628-73BA-4AC3-863A-EA20892F1EFD} = {9577224D-E994-4E6E-BE11-FF456B8A4D46}
{6C6E0C23-5B37-4BBB-8909-435078D49364} = {A69FDC71-8327-494A-9840-CF684E74965C}
{E5E1F492-05BB-45A3-B09F-F643DC1C6B03} = {4A994F2B-05BD-4CED-9157-45B29777740D}
- {F575419D-099B-4DA0-B80C-88D766DD7542} = {16ECEF20-C217-4477-8C88-E8A231CC23B8}
- {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F} = {9BEE50D5-9D78-4CA3-A535-75904B21C448}
{C1205C19-4601-4DF6-A222-91CC30C12284} = {B1177A9B-61C5-4747-B40A-9F36D83CE9A0}
{26B8AB05-2BE2-4266-AB19-BA912C0ACFA1} = {B1177A9B-61C5-4747-B40A-9F36D83CE9A0}
{D2F3C374-F164-4E08-A5FE-F902972C57F9} = {B1177A9B-61C5-4747-B40A-9F36D83CE9A0}
@@ -224,7 +196,5 @@ Global
{A69FDC71-8327-494A-9840-CF684E74965C} = {320825A6-82C4-42DE-91A3-EE5994B74EC3}
{320825A6-82C4-42DE-91A3-EE5994B74EC3} = {57D2095B-0A01-4F4C-A5D8-50F40DC155D0}
{4A994F2B-05BD-4CED-9157-45B29777740D} = {320825A6-82C4-42DE-91A3-EE5994B74EC3}
- {16ECEF20-C217-4477-8C88-E8A231CC23B8} = {82276D55-C8B4-4C84-98FE-83F10C898FA0}
- {9BEE50D5-9D78-4CA3-A535-75904B21C448} = {82276D55-C8B4-4C84-98FE-83F10C898FA0}
EndGlobalSection
EndGlobal
diff --git a/general/toaster/toastDrv/umdf/Toastmon/Device.cpp b/general/toaster/toastDrv/umdf/Toastmon/Device.cpp
deleted file mode 100644
index 5b2bde41..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/Device.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF sample driver's
- device callback object.
-
- This sample demonstrates how to register for PnP event notification
- for an interface class, and how to handle arrival events.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "device.tmh"
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice * MyDevice
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- MyDevice - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice myDevice;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- myDevice = new CMyDevice();
-
- if (NULL == myDevice)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = myDevice->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *MyDevice = myDevice;
- }
- else
- {
- myDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- Then it registers for toaster device notifications.
-
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- CComPtr<IWDFDevice> fxDevice;
- HRESULT hr;
-
- //
- // Save a weak reference to the Fx driver object. We'll need it to create
- // CMyRemoteTarget objects.
- //
-
- m_FxDriver = FxDriver;
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- CComPtr<IWDFDevice2> fxDevice2;
- if (SUCCEEDED(hr))
- {
- //
- // Q.I. for the latest version of this interface.
- //
- hr = fxDevice->QueryInterface(IID_PPV_ARGS(&fxDevice2));
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a weak reference to the IWDFDevice2 interface. Since this object
- // is partnered with the framework object they have the same lifespan -
- // there is no need for an additional reference.
- //
-
- m_FxDevice = fxDevice2;
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr = S_OK;
-
- //
- // Register for TOASTER device interface change notification.
- // We will get OnRemoteInterfaceArrival() calls when a remote toaster
- // device is started.
- //
- // Arrival notification will be sent for all existing and future toaster
- // devices.
- //
- // The framework will take care of unregistration when the device unloads.
- //
- hr = m_FxDevice->RegisterRemoteInterfaceNotification(&GUID_DEVINTERFACE_TOASTER,
- true);
-
- return hr;
-}
-
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
- if(IsEqualIID(InterfaceId, __uuidof(IPnpCallbackRemoteInterfaceNotification)))
- {
- *Object = QueryIPnpCallbackRemoteInterfaceNotification();
- hr = S_OK;
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-//
-// IPnpCallbackRemoteInterfaceNotification
-//
-
-void
-STDMETHODCALLTYPE
-CMyDevice::OnRemoteInterfaceArrival(
- _In_ IWDFRemoteInterfaceInitialize * FxRemoteInterfaceInit
- )
-/*++
-
- Routine Description:
-
- This method is called by the framework when a new remote interface has come
- online. These calls will only occur one at a time.
-
- Arguments:
-
- FxRemoteInterfaceInit - An identifier for the remote interface.
-
---*/
-{
- HRESULT hr = S_OK;
-
-
- //
- // Create a new FX remote interface object and assign a NULL callback
- // object since we don't care to handle any remote interface level events
- // that occur.
- //
-
- CComPtr<IWDFRemoteInterface> fxRemoteInterface;
-
- hr = m_FxDevice->CreateRemoteInterface(FxRemoteInterfaceInit,
- NULL,
- &fxRemoteInterface);
-
- //
- // Create an instance of CMyRemoteTarget which will open the remote device
- // and post I/O requests to it.
- //
-
- PCMyRemoteTarget myRemoteTarget = NULL;
- if (SUCCEEDED(hr))
- {
- hr = CMyRemoteTarget::CreateInstance(this,
- m_FxDriver,
- m_FxDevice,
- fxRemoteInterface,
- &myRemoteTarget);
- }
-
- if (SUCCEEDED(hr))
- {
- if (myRemoteTarget != NULL)
- {
- //
- // Add to our list
- //
- InsertHeadList(&m_MyRemoteTargets, &myRemoteTarget->m_Entry);
-
- //
- // Release, since framework will keep a reference
- //
- myRemoteTarget->Release();
- }
- }
-
- if (FAILED(hr))
- {
- if (fxRemoteInterface != NULL)
- {
- //
- // We failed to create the CMyRemoteTarget, delete the
- // RemoteInterface object
- //
- fxRemoteInterface->DeleteWdfObject();
- }
- }
-}
-
diff --git a/general/toaster/toastDrv/umdf/Toastmon/Device.h b/general/toaster/toastDrv/umdf/Toastmon/Device.h
deleted file mode 100644
index c457a8da..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/Device.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "initguid.h"
-
-
-//{781EF630-72B2-11d2-B852-00C04FAD5171}
-DEFINE_GUID(GUID_DEVINTERFACE_TOASTER, 0x781EF630, 0x72B2, 0x11d2, 0xB8, 0x52, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71);
-
-
-//
-// Class for the sample device.
-//
-
-class CMyDevice : public CUnknown,
- public IPnpCallbackRemoteInterfaceNotification
-{
- //
- // Private data members.
- //
-private:
-
- //
- // Weak reference to the WDF device object.
- //
-
- IWDFDevice2 *m_FxDevice;
-
- //
- // Weak reference to the WDF driver object
- //
-
- IWDFDriver *m_FxDriver;
-
- //
- // Head of remote target list
- //
-
- LIST_ENTRY m_MyRemoteTargets;
-
- //
- // Private methods.
- //
-private:
-
- //
- // Protected methods
- //
-protected:
- CMyDevice(
- VOID
- ) :
- m_FxDevice(NULL),
- m_FxDriver(NULL)
- {
- InitializeListHead(&m_MyRemoteTargets);
- }
-
- HRESULT
- Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- );
-
- //
- // Public methods
- //
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice * MyDevice
- );
-
- HRESULT
- Configure(
- VOID
- );
-
- ~CMyDevice(
- VOID
- )
- {
- ATLASSERT(IsListEmpty(&m_MyRemoteTargets));
- }
-
- //
- // COM methods
- //
-public:
-
- //
- // IUnknown methods.
- //
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IPnpCallbackRemoteInterfaceNotification
- //
- void
- STDMETHODCALLTYPE
- OnRemoteInterfaceArrival(
- _In_ IWDFRemoteInterfaceInitialize * FxRemoteInterfaceInit
- );
- IPnpCallbackRemoteInterfaceNotification *
- QueryIPnpCallbackRemoteInterfaceNotification(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallbackRemoteInterfaceNotification*>(this);
- }
-
-};
diff --git a/general/toaster/toastDrv/umdf/Toastmon/Driver.cpp b/general/toaster/toastDrv/umdf/Toastmon/Driver.cpp
deleted file mode 100644
index adf74dc0..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/Driver.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Sample's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver * MyDriver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- MyDriver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver myDriver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- myDriver = new CMyDriver();
-
- if (NULL == myDriver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = myDriver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *MyDriver = myDriver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- myDriver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object.
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- PCMyDevice myDevice = NULL;
-
- HRESULT hr;
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxDriver, FxDeviceInit, &myDevice);
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = myDevice->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != myDevice)
- {
- myDevice->Release();
- }
-
- return hr;
-}
diff --git a/general/toaster/toastDrv/umdf/Toastmon/Driver.h b/general/toaster/toastDrv/umdf/Toastmon/Driver.h
deleted file mode 100644
index aecb9765..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/Driver.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-//
-// This class handles driver events for the sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown,
- public IDriverEntry
-{
- //
- // Private data members.
- //
-private:
-
- //
- // Private methods.
- //
-private:
-
- //
- // Returns a referenced pointer to the IDriverEntry interface.
- //
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver * MyDriver
- );
-
- //
- // COM methods
- //
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver * /* FxDriver */
- )
- {
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver * /* FxDriver */
- )
- {
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class because of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
diff --git a/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.cpp b/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.cpp
deleted file mode 100644
index 88ea7f8a..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- RemoteTarget.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF sample driver's
- remote interface and remote target callback object.
-
- This sample demonstrates how to open the remote target and register
- and respond to device change notification.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "remotetarget.tmh"
-
-
-DWORD WINAPI _ThreadProc(
- _In_ LPVOID lpParameter
- )
-{
- CMyRemoteTarget *MyRemoteTarget = (CMyRemoteTarget*)lpParameter;
-
- return MyRemoteTarget->ThreadProc();
-}
-
-HRESULT
-CMyRemoteTarget::CreateInstance(
- _In_ CMyDevice * MyDevice,
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDevice2 * FxDevice,
- _In_ IWDFRemoteInterface * FxRemoteInterface,
- _Out_ PCMyRemoteTarget * MyRemoteTarget
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the driver's
- remote target callback object.
-
- Arguments:
-
- FxRemoteInterfaceInit - An identifier that specifies the remote toaster device.
-
- MyDevice - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyRemoteTarget myRemoteTarget;
- HRESULT hr;
-
- //
- // Allocate a new instance of the remote target class.
- //
-
- myRemoteTarget = new CMyRemoteTarget();
-
- if (NULL == myRemoteTarget)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = myRemoteTarget->Initialize(MyDevice,
- FxDriver,
- FxDevice,
- FxRemoteInterface);
-
- if (SUCCEEDED(hr))
- {
- *MyRemoteTarget = myRemoteTarget;
- }
- else
- {
- myRemoteTarget->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyRemoteTarget::Initialize(
- _In_ CMyDevice * MyDevice,
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDevice2 * FxDevice,
- _In_ IWDFRemoteInterface * FxRemoteInterface
- )
-/*++
-
- Routine Description:
-
- This method initializes the remote target callback object and creates
- the partner remote target object.
-
- Arguments:
-
- FxRemoteInterface - the identifier for the remote toaster device.
-
- Return Value:
-
- status.
-
---*/
-{
- HRESULT hr;
-
- CComPtr<IWDFIoRequest> fxWriteRequest;
- CComPtr<IWDFIoRequest> fxReadRequest;
-
- //
- // Save a weak reference to the class that created us
- // so we can notify it when we get removed
- //
-
- m_MyDevice = MyDevice;
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the CMyRemoteTarget). We pass that
- // to the various Create* calls, which take their own reference if
- // everything works.
- //
-
- IUnknown * unknown = this->QueryIUnknown();
-
-
- //
- // Create a new FX remote target object and assign the new callback
- // object to handle any remote target level events that occur.
- //
- hr = FxDevice->CreateRemoteTarget(unknown,
- FxRemoteInterface,
- &m_FxTarget);
-
- if (SUCCEEDED(hr))
- {
- //
- // Open and start the remote target. Note that this sample doesn't
- // perform any impersonation, so we're running as "Local Service"
- // since that is what UMDF driver runs as.
- //
- // Make sure that your Toaster devices all have security ACLs that
- // permit "Local Service" to access the device. The Win7 toaster
- // sample driver INFs have been updated for this. However, if you
- // had previously installed pre-Win7 versions of the Toaster sample
- // driver, the security settings will not be updated by a new driver
- // install, unless the Toaster device class key is deleted.
- //
-
- hr = m_FxTarget->OpenRemoteInterface(FxRemoteInterface,
- NULL,
- GENERIC_READ | GENERIC_WRITE,
- NULL);
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // Create a new FX request object and assign the new callback
- // object to handle any request level events that occur.
- //
- hr = FxDevice->CreateRequest(unknown,
- FxRemoteInterface,
- &fxWriteRequest);
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // We want to save the newer IWDFIoRequest2 interface instead.
- //
- hr = fxWriteRequest->QueryInterface(IID_PPV_ARGS(&m_FxWriteRequest));
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // Create a buffer for the write request
- //
- hr = FxDriver->CreateWdfMemory(WRITE_BUF_SIZE,
- NULL,
- FxRemoteInterface,
- &m_FxWriteMemory);
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // Create a new FX remote target object and assign the new callback
- // object to handle any remote target level events that occur.
- //
- hr = FxDevice->CreateRequest(unknown,
- FxRemoteInterface,
- &fxReadRequest);
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // We want to save the newer IWDFIoRequest2 interface instead.
- //
- hr = fxReadRequest->QueryInterface(IID_PPV_ARGS(&m_FxReadRequest));
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // Create a buffer for the read request
- //
- hr = FxDriver->CreateWdfMemory(READ_BUF_SIZE,
- NULL,
- FxRemoteInterface,
- &m_FxReadMemory);
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // Create/Start the thread which will post I/O requests to the remote
- // target.
- //
- // NOTE: This would not be a typical driver pattern. Normally, your
- // driver would receive some I/O from another caller and you'd
- // use this I/O as a trigger to post I/O to the remote target.
- // You may choose to forward the request directly with no changes,
- // modify the request before sending, or create an entirely
- // separate request.
- //
- m_hThread = CreateThread(NULL,
- 0,
- _ThreadProc,
- this,
- 0,
- NULL);
-
- if (m_hThread == NULL)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- }
- }
-
- unknown->Release();
-
- return hr;
-}
-
-DWORD WINAPI CMyRemoteTarget::ThreadProc(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is the main loop for a thread that posts I/O requests to
- the remote target. The main loop continues until the remote target
- is deleted, which happens in the Dispose() method.
-
---*/
-{
- BOOL bContinue = TRUE;
-
- while(bContinue)
- {
- Sleep(100);
-
- switch(m_FxTarget->GetState())
- {
- case WdfIoTargetStarted:
- PostIoRequests();
- break;
-
- case WdfIoTargetClosedForQueryRemove:
- break;
-
- case WdfIoTargetClosed:
- case WdfIoTargetDeleted:
- default:
- bContinue = false;
- break;
- }
- }
-
- return 0;
-}
-
-void
-CMyRemoteTarget::PostIoRequests(
- VOID
- )
-{
- HRESULT hr;
-
- if (!m_WriteInProgress)
- {
- //
- // Mark that the request has been sent, so we don't try to send
- // again before the completion routine runs.
- //
- m_WriteInProgress = true;
-
- hr = m_FxTarget->FormatRequestForWrite(m_FxWriteRequest,
- NULL,
- m_FxWriteMemory,
- 0,
- 0);
-
- if (SUCCEEDED(hr))
- {
- m_FxWriteRequest->SetCompletionCallback(this, NULL);
-
- hr = m_FxWriteRequest->Send(m_FxTarget, 0, 0);
- }
-
- if (FAILED(hr))
- {
- m_WriteInProgress = false;
- }
- }
-
- if (!m_ReadInProgress)
- {
- //
- // Mark that the request has been sent, so we don't try to send
- // again before the completion routine runs.
- //
- m_ReadInProgress = true;
-
- hr = m_FxTarget->FormatRequestForRead(m_FxReadRequest,
- NULL,
- m_FxReadMemory,
- 0,
- 0);
-
- if (SUCCEEDED(hr))
- {
- m_FxReadRequest->SetCompletionCallback(this, NULL);
-
- hr = m_FxReadRequest->Send(m_FxTarget, 0, 0);
- }
-
- if (FAILED(hr))
- {
- m_ReadInProgress = true;
- }
- }
-}
-
-HRESULT
-CMyRemoteTarget::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID * Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
- if(IsEqualIID(InterfaceId, __uuidof(IRequestCallbackRequestCompletion)))
- {
- *Object = QueryIRequestCallbackRequestCompletion();
- hr = S_OK;
- }
- else if(IsEqualIID(InterfaceId, __uuidof(IRemoteTargetCallbackRemoval)))
- {
- *Object = QueryIRemoteTargetCallbackRemoval();
- hr = S_OK;
- }
- else if(IsEqualIID(InterfaceId, __uuidof(IObjectCleanup)))
- {
- *Object = QueryIObjectCleanup();
- hr = S_OK;
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-//
-// IRequestCallbackRequestCompletion
-//
-void
-STDMETHODCALLTYPE
-CMyRemoteTarget::OnCompletion(
- _In_ IWDFIoRequest * FxRequest,
- _In_ IWDFIoTarget * /* FxTarget */,
- _In_ IWDFRequestCompletionParams * /* Params */,
- _In_ void* /* Context */
- )
-{
- IWDFRequestCompletionParams * CompletionParams;
-
- FxRequest->GetCompletionParams(&CompletionParams);
-
- if (CompletionParams->GetCompletedRequestType() == WdfRequestRead)
- {
- m_FxReadRequest->Reuse(E_FAIL);
- m_ReadInProgress = false;
- }
- if (CompletionParams->GetCompletedRequestType() == WdfRequestWrite)
- {
- m_FxWriteRequest->Reuse(E_FAIL);
- m_WriteInProgress = false;
- }
-
- CompletionParams->Release();
-}
-
-//
-// IRemoteTargetCallbackRemoval
-//
-BOOL
-STDMETHODCALLTYPE
-CMyRemoteTarget::OnRemoteTargetQueryRemove(
- _In_ IWDFRemoteTarget * /* FxTarget */
- )
-{
- m_FxTarget->CloseForQueryRemove();
-
- //
- // Return FALSE if you want to VETO the Query
- //
-
- return TRUE;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyRemoteTarget::OnRemoteTargetRemoveCanceled(
- _In_ IWDFRemoteTarget * /* FxTarget */
- )
-{
- if (FAILED(m_FxTarget->Reopen()))
- {
- m_FxTarget->Close();
- }
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyRemoteTarget::OnRemoteTargetRemoveComplete(
- _In_ IWDFRemoteTarget * /* FxTarget */
- )
-{
- //
- // The remote device has been removed, so we close the target for good.
- // The rest of cleanup will occur when the framework handles the removal
- // of the RemoteInterface
- //
-
- m_FxTarget->Close();
-}
-
-
-//
-// IObjectCleanup
-//
-
-void
-STDMETHODCALLTYPE
-CMyRemoteTarget::OnCleanup(
- _In_ IWDFObject * /* FxObject */
- )
-{
- if (m_hThread != NULL)
- {
- if (m_FxTarget->GetState() != WdfIoTargetClosed)
- {
- //
- // Close the target if it's still open.
- //
- // If the target has already gone through RemoveComplete, it should
- // already be closed.
- //
- // If the Target interface is disabled without the device being
- // removed, the target will still be open until now.
- //
- // If the ToastMon device itself is removed while a target is
- // still active, we'll now close it.
- //
- m_FxTarget->Close();
- }
-
- //
- // Wait for the Thread to complete
- //
- WaitForSingleObject(m_hThread, INFINITE);
-
- CloseHandle(m_hThread);
-
- m_hThread = NULL;
-
- //
- // Remove ourselves from the list of Remote Targets
- //
- RemoveEntryList(&m_Entry);
- }
-
- m_FxTarget = NULL;
- m_FxWriteRequest = NULL;
- m_FxReadRequest = NULL;
-}
-
diff --git a/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.h b/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.h
deleted file mode 100644
index 15d91dad..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- RemoteTarget.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF sample
- driver's remote target callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-#define READ_BUF_SIZE 100
-#define WRITE_BUF_SIZE 120
-
-
-class CMyRemoteTarget : public CUnknown,
- public IRequestCallbackRequestCompletion,
- public IRemoteTargetCallbackRemoval,
- public IObjectCleanup
-{
- //
- // Public data members.
- //
-public:
-
- //
- // This is the Entry for the list of Remote Targets.
- // The List head is held by CMyDevice.
- //
- LIST_ENTRY m_Entry;
-
-
- //
- // Private data members.
- //
-private:
-
- CMyDevice * m_MyDevice; // Weak reference
-
- //
- // The handle for a thread to post I/O requests to the remote target
- //
- HANDLE m_hThread;
-
- CComPtr<IWDFRemoteTarget> m_FxTarget;
-
- bool m_WriteInProgress;
- CComPtr<IWDFIoRequest2> m_FxWriteRequest;
- CComPtr<IWDFMemory> m_FxWriteMemory;
-
- bool m_ReadInProgress;
- CComPtr<IWDFIoRequest2> m_FxReadRequest;
- CComPtr<IWDFMemory> m_FxReadMemory;
-
- //
- // Private methods.
- //
-private:
-
- void
- PostIoRequests(
- VOID
- );
-
- //
- // Protected methods
- //
-protected:
-
- CMyRemoteTarget(
- VOID
- ) :
- m_MyDevice(NULL),
- m_hThread(NULL),
- m_WriteInProgress(false),
- m_ReadInProgress(false)
-
- {
- }
-
- HRESULT
- Initialize(
- _In_ CMyDevice * MyDevice,
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDevice2 * FxDevice,
- _In_ IWDFRemoteInterface * FxRemoteInterface
- );
-
- //
- // Public methods
- //
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
- static
- HRESULT
- CreateInstance(
- _In_ CMyDevice * MyDevice,
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDevice2 * FxDevice,
- _In_ IWDFRemoteInterface * FxRemoteInterface,
- _Out_ PCMyRemoteTarget * MyRemoteTarget
- );
-
- ~CMyRemoteTarget(
- VOID
- )
- {
- }
-
- DWORD WINAPI
- ThreadProc(
- VOID
- );
-
- //
- // COM methods
- //
-public:
-
- //
- // IUnknown methods.
- //
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID * Object
- );
-
- //
- // IRequestCallbackRequestCompletion
- //
- void
- STDMETHODCALLTYPE
- OnCompletion(
- _In_ IWDFIoRequest * FxRequest,
- _In_ IWDFIoTarget * /* FxTarget */,
- _In_ IWDFRequestCompletionParams * /* Params */,
- _In_ void* /* Context */
- );
- IRequestCallbackRequestCompletion *
- QueryIRequestCallbackRequestCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IRequestCallbackRequestCompletion*>(this);
- }
-
- //
- // IRemoteTargetCallbackRemoval
- //
- BOOL
- STDMETHODCALLTYPE
- OnRemoteTargetQueryRemove(
- _In_ IWDFRemoteTarget * /* FxTarget */
- );
- VOID
- STDMETHODCALLTYPE
- OnRemoteTargetRemoveCanceled(
- _In_ IWDFRemoteTarget * /* FxTarget */
- );
- VOID
- STDMETHODCALLTYPE
- OnRemoteTargetRemoveComplete(
- _In_ IWDFRemoteTarget * /* FxTarget */
- );
- IRemoteTargetCallbackRemoval *
- QueryIRemoteTargetCallbackRemoval(
- VOID
- )
- {
- AddRef();
- return static_cast<IRemoteTargetCallbackRemoval*>(this);
- }
-
- //
- // IObjectCleanup
- //
- void
- STDMETHODCALLTYPE
- OnCleanup(
- _In_ IWDFObject* /* FxObject */
- );
- IObjectCleanup *
- QueryIObjectCleanup(
- VOID
- )
- {
- AddRef();
- return static_cast<IObjectCleanup*>(this);
- }
-
-};
diff --git a/general/toaster/toastDrv/umdf/Toastmon/ToastMon.rc b/general/toaster/toastDrv/umdf/Toastmon/ToastMon.rc
deleted file mode 100644
index 57983bbc..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/ToastMon.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// ToastMon.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF ToastMon User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "ToastMon"
-#define VER_ORIGINALFILENAME_STR "ToastMon.dll"
-
-#include "common.ver"
diff --git a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx b/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx
deleted file mode 100644
index eba3c794..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx
+++ /dev/null
Binary files differ
diff --git a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj b/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj
deleted file mode 100644
index 3648d85f..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj
+++ /dev/null
@@ -1,285 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{F575419D-099B-4DA0-B80C-88D766DD7542}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <SupportsPackaging>false</SupportsPackaging>
- <RequiresPackageProject>true</RequiresPackageProject>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{439EDE87-12DD-4F6D-8C22-A8AC9DAEF4B2}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="comsup.cpp; dllsup.cpp; driver.cpp; device.cpp; remotetarget.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <Inf Include="WUDFToastMon.inx">
- <Architecture>$(InfArch)</Architecture>
- <SpecifyArchitecture>true</SpecifyArchitecture>
- <CopyOutput>.\$(IntDir)\WUDFToastMon.inf</CopyOutput>
- </Inf>
- <OtherWpp Include="ToastMon.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFToastMon</TargetName>
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFToastMon</TargetName>
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFToastMon</TargetName>
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFToastMon</TargetName>
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\oleaut32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\oleaut32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\oleaut32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\oleaut32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="ToastMon.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inf" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj.Filters b/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj.Filters
deleted file mode 100644
index 890e83d6..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj.Filters
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{FDA736D6-A855-4CED-9C9E-B6FF707C26E1}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{03AC1F65-1B83-4D8E-9D06-DF35B5085EA7}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{E8FFB961-9B2B-4A4A-8F75-5F933AF32C60}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{C6C8B61F-CD41-4ACB-AC13-2E7A02CC94A0}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="remotetarget.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="ToastMon.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/general/toaster/toastDrv/umdf/Toastmon/comsup.cpp b/general/toaster/toastDrv/umdf/Toastmon/comsup.cpp
deleted file mode 100644
index fd298470..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/comsup.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/general/toaster/toastDrv/umdf/Toastmon/comsup.h b/general/toaster/toastDrv/umdf/Toastmon/comsup.h
deleted file mode 100644
index b96fd982..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/comsup.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/general/toaster/toastDrv/umdf/Toastmon/dllsup.cpp b/general/toaster/toastDrv/umdf/Toastmon/dllsup.cpp
deleted file mode 100644
index 8b4b5426..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/dllsup.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Sample
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. See internal.h for definition.
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
-
- DisableThreadLibraryCalls(ModuleHandle);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- _In_ REFCLSID ClassId,
- _In_ REFIID InterfaceId,
- _Outptr_ LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/general/toaster/toastDrv/umdf/Toastmon/exports.def b/general/toaster/toastDrv/umdf/Toastmon/exports.def
deleted file mode 100644
index f8ac59f6..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/exports.def
+++ /dev/null
@@ -1,4 +0,0 @@
-; Exports.def : Declares the module parameters.
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/general/toaster/toastDrv/umdf/Toastmon/internal.h b/general/toaster/toastDrv/umdf/Toastmon/internal.h
deleted file mode 100644
index 5a8fc9e2..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/internal.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF DDI
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Include ATL to provide basic COM support.
-//
-
-#define _ATL_FREE_THREADED
-#define _ATL_NO_AUTOMATIC_NAMESPACE
-
-#include <atlbase.h>
-#include <atlcom.h>
-
-using namespace ATL;
-
-extern CComModule _Module;
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyRemoteTarget *PCMyRemoteTarget;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- MyDriverTraceControl, (dee2c67c,6328,48d9,876b,64682c4e9e9b), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\ToastMon"
-#define MYDRIVER_CLASS_ID { 0x8d4ec202, 0x1076, 0x4895, {0xa0, 0x72, 0x29, 0x7d, 0xa8, 0x8e, 0x60, 0x05} }
-
-//
-// Include simple doubly-linked list macros
-//
-#include "list.h"
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "remotetarget.h"
-#include "device.h"
diff --git a/general/toaster/toastDrv/umdf/Toastmon/list.h b/general/toaster/toastDrv/umdf/Toastmon/list.h
deleted file mode 100644
index 38d0b1e9..00000000
--- a/general/toaster/toastDrv/umdf/Toastmon/list.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- list.h
-
-Abstract:
-
- This module contains doubly linked list macros
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-FORCEINLINE
-VOID
-InitializeListHead(
- IN PLIST_ENTRY ListHead
- )
-{
- ListHead->Flink = ListHead->Blink = ListHead;
-}
-
-FORCEINLINE
-BOOLEAN
-RemoveEntryList(
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
- PLIST_ENTRY Flink;
-
- Flink = Entry->Flink;
- Blink = Entry->Blink;
- Blink->Flink = Flink;
- Flink->Blink = Blink;
- return (BOOLEAN)(Flink == Blink);
-}
-
-FORCEINLINE
-VOID
-InsertHeadList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Flink;
-
- Flink = ListHead->Flink;
- Entry->Flink = Flink;
- Entry->Blink = ListHead;
- Flink->Blink = Entry;
- ListHead->Flink = Entry;
-}
-
-FORCEINLINE
-VOID
-InsertTailList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
-
- Blink = ListHead->Blink;
- Entry->Flink = ListHead;
- Entry->Blink = Blink;
- Blink->Flink = Entry;
- ListHead->Blink = Entry;
-}
diff --git a/general/toaster/toastDrv/umdf/func/Device.cpp b/general/toaster/toastDrv/umdf/func/Device.cpp
deleted file mode 100644
index eaf0a545..00000000
--- a/general/toaster/toastDrv/umdf/func/Device.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- Device.cpp
-
- Abstract:
-
- This file contains the device callback object implementation.
-
- Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-#include "stdafx.h"
-#include "Device.h"
-
-#include "internal.h"
-#include "device.tmh"
-
-HRESULT
-CDevice::QueryInterface(
- _In_ REFIID riid,
- _Out_ LPVOID* ppvObject
- )
-/*++
-
-Routine Description:
-
- The framework calls this function to determine which callback
- interfaces we support.
-
-Arguments:
-
- riid - GUID for a given callback interface.
- ppvObject - We set this pointer to our object if we support the
- interface indicated by riid.
-
-Return Value:
-
- HRESULT S_OK - Interface is supported.
-
---*/
-{
- if (ppvObject == NULL)
- {
- return E_INVALIDARG;
- }
-
- *ppvObject = NULL;
-
- if ( riid == _uuidof(IUnknown) )
- {
- *ppvObject = static_cast<IPnpCallbackHardware*>(this);
- }
- else if ( riid == _uuidof(IPnpCallbackHardware) )
- {
- *ppvObject = static_cast<IPnpCallbackHardware *>(this);
- }
- else
- {
- return E_NOINTERFACE;
- }
-
- this->AddRef();
-
- return S_OK;
-}
-
-
-ULONG CDevice::AddRef()
-/*++
-
-Routine Description:
-
- Increments the ref count on this object.
-
-Arguments:
-
- None.
-
-Return Value:
-
- ULONG - new ref count.
-
---*/
-{
- LONG cRefs = InterlockedIncrement( &m_cRefs );
-
- return cRefs;
-}
-
-
-_At_(this, __drv_freesMem(object))
-ULONG CDevice::Release()
-/*++
-
-Routine Description:
-
- Decrements the ref count on this object.
-
-Arguments:
-
- None.
-
-Return Value:
-
- ULONG - new ref count.
-
---*/
-{
- LONG cRefs;
-
- cRefs = InterlockedDecrement( &m_cRefs );
-
- if( 0 == cRefs )
- {
- delete this;
- }
-
- return cRefs;
-}
-
-
-HRESULT
-CDevice::OnPrepareHardware(
- _In_ IWDFDevice* pDevice)
-/*++
-
-Routine Description:
-
- The framework calls this function after IDriverEntry::OnDeviceAdd
- returns and before the device enters the working power state.
- This callback prepares the device and the driver to enter the working
- state after enumeration.
-
-Arguments:
-
- pWdfDevice - A pointer to the IWDFDevice interface for the device
- object of the device to make accessible.
-
-Return Value:
-
- S_OK in case of success
- HRESULT correponding to one of the error codes that are defined in Winerror.h.
-
---*/
-{
- PWSTR deviceName = NULL;
- DWORD deviceNameCch = 0;
-
- HRESULT hr;
-
- Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!");
-
- //
- // Get the device name.
- // Get the length to allocate first
- //
-
- hr = pDevice->RetrieveDeviceName(NULL, &deviceNameCch);
-
- //
- // Allocate the buffer
- //
-
- if (SUCCEEDED(hr))
- {
- deviceName = new WCHAR[deviceNameCch];
-
- if (deviceName == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- }
-
- //
- // Get the actual name
- //
-
- if (SUCCEEDED(hr))
- {
- hr = pDevice->RetrieveDeviceName(deviceName, &deviceNameCch);
-
- }
-
- //
- // Do your hardware operations here
- //
-
- delete[] deviceName;
-
- return hr;
-}
-
-HRESULT
-CDevice::OnReleaseHardware(
- _In_ IWDFDevice* /*pDevice*/)
-/*++
-
-Routine Description:
-
- This routine is invoked when the device is being removed or stopped
- It releases all resources allocated for this device. The framework
- calls this callback after the device exits from the working power
- state but before its queues are purged.
-
-
-Arguments:
-
- pWdfDevice - A pointer to the IWDFDevice interface for the device object
- of the device that is no longer accessible.
-
-
-Return Value:
- HRESULT - Always succeeds.
---*/
-{
- Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!");
-
- return S_OK;
-}
-
-
-
diff --git a/general/toaster/toastDrv/umdf/func/Device.h b/general/toaster/toastDrv/umdf/func/Device.h
deleted file mode 100644
index 4bb68dc7..00000000
--- a/general/toaster/toastDrv/umdf/func/Device.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- Device.h
-
- Abstract:
-
- This file contains the class definition for device callback object.
-
- Environment:
-
- Windows User-Mode Driver Framework (UMDF)
-
---*/
-
-#pragma once
-#include "resource.h"
-#include "WUDFToaster.h"
-
-//
-// To inform the framework about the callbacks we are interested in, we
-// simply derive from the desired set of interfaces.
-//
-class CDevice : public IPnpCallbackHardware
-{
-public:
- CDevice() : m_cRefs(0)
- {
- }
-
-
-public:
-
- //
- // Static method that creates a device callback object.
- //
- static HRESULT CreateInstance(_Out_ IUnknown ** ppUnkwn)
- {
- *ppUnkwn = NULL;
-
-#pragma warning( suppress : 6014 )// PFD ISSUE: counted memory locks
- CDevice *pMyDevice = new CDevice();
-
- if (NULL == pMyDevice)
- {
- return E_OUTOFMEMORY;
- }
-
- return (pMyDevice->QueryInterface( __uuidof(IUnknown), (void **) ppUnkwn ));
- }
-
- //
- // IUnknown
- //
- virtual HRESULT __stdcall QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObject);
- virtual ULONG __stdcall AddRef();
- _At_(this, __drv_freesMem(object))
- virtual ULONG __stdcall Release();
-
-
- // IPnpCallbackHardware
- //
- virtual HRESULT __stdcall OnPrepareHardware(_In_ IWDFDevice* pDevice);
- virtual HRESULT __stdcall OnReleaseHardware(_In_ IWDFDevice* pDevice);
-
- //
- // TODO: Add your interfaces here
- //
-
-private:
-
- LONG m_cRefs;
-
-};
-
diff --git a/general/toaster/toastDrv/umdf/func/Driver.cpp b/general/toaster/toastDrv/umdf/func/Driver.cpp
deleted file mode 100644
index 053217b9..00000000
--- a/general/toaster/toastDrv/umdf/func/Driver.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- Driver.cpp
-
- Abstract:
-
- This file contains the implementation for the driver object.
-
- Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "stdafx.h"
-#include "Driver.h"
-#include "Device.h"
-#include "Queue.h"
-
-#include "internal.h"
-#include "driver.tmh"
-
-//Idle setting for the Toaster device
-#define IDLEWAKE_TIMEOUT_MSEC 6000
-
-
-HRESULT
-CDriver::OnDeviceAdd(
- _In_ IWDFDriver* pDriver,
- _In_ IWDFDeviceInitialize* pDeviceInit
- )
-/*++
-
-Routine Description:
-
- The framework calls this function when a device is being added to
- the driver stack.
-
-Arguments:
-
- IWDFDriver - Framework interface. The driver uses this
- interface to create device objects.
- IWDFDeviceInitialize - Framework interface. The driver uses this
- interface to set device parameters before
- creating the device obeject.
-
-Return Value:
-
- HRESULT S_OK - Device added successfully
-
---*/
-{
- IUnknown *pDeviceCallback = NULL;
- IWDFDevice *pIWDFDevice = NULL;
- IWDFDevice2 *pIWDFDevice2 = NULL;
- IUnknown *pIUnkQueue = NULL;
-
- //
- // UMDF Toaster is a function driver so set is as the power policy owner (PPO)
- //
- pDeviceInit->SetPowerPolicyOwnership(TRUE);
-
- //
- // Create our device callback object.
- //
- HRESULT hr = CDevice::CreateInstance(&pDeviceCallback);
-
- //
- // Ask the framework to create a device object for us.
- // We pass in the callback object and device init object
- // as creation parameters.
- //
- if (SUCCEEDED(hr))
- {
- hr = pDriver->CreateDevice(pDeviceInit,
- pDeviceCallback,
- &pIWDFDevice);
- }
-
- //
- // Create the queue callback object.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CQueue::CreateInstance(&pIUnkQueue);
- }
-
- //
- // Configure the default queue. We pass in our queue callback
- // object to inform the framework about the callbacks we want.
- //
-
- if (SUCCEEDED(hr))
- {
- IWDFIoQueue * pDefaultQueue = NULL;
- hr = pIWDFDevice->CreateIoQueue(
- pIUnkQueue,
- TRUE, // bDefaultQueue
- WdfIoQueueDispatchParallel,
- TRUE, // bPowerManaged
- FALSE, // bAllowZeroLengthRequests
- &pDefaultQueue);
- SAFE_RELEASE(pDefaultQueue);
- }
-
- //
- // Enable the device interface.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = pIWDFDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_TOASTER,
- NULL);
- }
-
- //
- // IWDFDevice2 interface is an extension of IWDFDevice interface that enables
- // Idle and Wake support.
- //
-
- //
- // Get a pointer to IWDFDevice2 interface
- //
-
- if (SUCCEEDED(hr))
- {
- hr = pIWDFDevice->QueryInterface(__uuidof(IWDFDevice2), (void**) &pIWDFDevice2);
- }
-
- //
- // Since this is a virtual device we tell the framework that we cannot wake
- // ourself if we sleep in S0. Only way the device can be brought to D0 is if
- // the device recieves an I/O from the system.
- //
-
- if (SUCCEEDED(hr))
- {
-
- hr = pIWDFDevice2->AssignS0IdleSettings(
- IdleCannotWakeFromS0,
- PowerDeviceD3, //the lowest-powered device sleeping state
- IDLEWAKE_TIMEOUT_MSEC, //idle timeout
- IdleAllowUserControl, //user can control the device's idle behavior.
- WdfTrue);
-
- }
-
- //
- // TODO: Add the Idle and Wake suupport specific for your hardware
- //
-
- SAFE_RELEASE(pDeviceCallback);
- SAFE_RELEASE(pIWDFDevice);
- SAFE_RELEASE(pIWDFDevice2);
- SAFE_RELEASE(pIUnkQueue);
-
- return hr;
-}
-
-VOID
-CDriver::OnDeinitialize(
- _In_ IWDFDriver * /* pDriver */
- )
-/*++
-
-Routine Description:
-
- The framework calls this function just before de-initializing itself. All
- WDF framework resources should be released by driver before returning from this call.
-
-Arguments:
-
-Return Value:
-
---*/
-{
- return ;
-}
-
-HRESULT
-CDriver::OnInitialize(
- _In_ IWDFDriver * /* pDriver */
- )
-/*++
-
-Routine Description:
-
- The framework calls this function just after loading the driver. The driver can
- perform any global, device independent intialization in this routine.
-
-Arguments:
-
-Return Value:
-
---*/
-{
- return S_OK;
-}
-
-
diff --git a/general/toaster/toastDrv/umdf/func/Driver.h b/general/toaster/toastDrv/umdf/func/Driver.h
deleted file mode 100644
index b60cffb5..00000000
--- a/general/toaster/toastDrv/umdf/func/Driver.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- Driver.h
-
- Abstract:
-
- This file contains the class definition for the driver object.
-
- Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "resource.h"
-#include "WUDFToaster.h"
-
-class ATL_NO_VTABLE CDriver :
- public CComObjectRootEx<CComMultiThreadModel>,
- public CComCoClass<CDriver, &CLSID_WUDFToaster>,
- public IDriverEntry
-{
-public:
- CDriver()
- {
- }
-
- DECLARE_REGISTRY_RESOURCEID(IDR_TOASTERDRIVER)
- DECLARE_NOT_AGGREGATABLE(CDriver)
-
- //
- // The driver object suppports the IDriverEntry interface.
- //
- BEGIN_COM_MAP(CDriver)
- COM_INTERFACE_ENTRY(IDriverEntry)
- END_COM_MAP()
-
-public:
- //
- // IDriverEntry
- //
- STDMETHOD (OnDeviceAdd)(
- _In_ IWDFDriver *pDriver,
- _In_ IWDFDeviceInitialize *pDeviceInit
- );
- STDMETHOD (OnInitialize)(
- _In_ IWDFDriver* pDriver
- );
- STDMETHOD_ (void, OnDeinitialize)(
- _In_ IWDFDriver* pDriver
- );
-};
-
-OBJECT_ENTRY_AUTO(__uuidof(WUDFToaster), CDriver)
diff --git a/general/toaster/toastDrv/umdf/func/Queue.cpp b/general/toaster/toastDrv/umdf/func/Queue.cpp
deleted file mode 100644
index dec296a0..00000000
--- a/general/toaster/toastDrv/umdf/func/Queue.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- Queue.cpp
-
- Abstract:
-
- This file contains the queue callback object implementation.
-
- Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "stdafx.h"
-#include "Queue.h"
-#include <devioctl.h>
-#include <public.h>
-
-
-#include "internal.h"
-#include "queue.tmh"
-
-HRESULT
-CQueue::QueryInterface(
- _In_ REFIID riid,
- _Out_ LPVOID* ppvObject
- )
-/*++
-
-Routine Description:
-
- The framework calls this function to determine which callback
- interfaces we support.
-
-Arguments:
-
- riid - GUID for a given callback interface.
- ppvObject - We set this pointer to our object if we support the
- interface indicated by riid.
-
-Return Value:
-
- HRESULT S_OK - Interface is supported.
-
---*/
-{
- if (ppvObject == NULL)
- {
- return E_INVALIDARG;
- }
- *ppvObject = NULL;
-
- if ( riid == _uuidof(IUnknown) )
- {
- *ppvObject = static_cast<IQueueCallbackDeviceIoControl *> (this);
- }
- else if ( riid == _uuidof(IQueueCallbackDeviceIoControl) )
- {
- *ppvObject = static_cast<IQueueCallbackDeviceIoControl *>(this);
- }
- else if ( riid == _uuidof(IQueueCallbackRead) )
- {
- *ppvObject = static_cast<IQueueCallbackRead *>(this);
- }
- else if ( riid == _uuidof(IQueueCallbackWrite) )
- {
- *ppvObject = static_cast<IQueueCallbackWrite *>(this);
- }
- else
- {
- return E_NOINTERFACE;
- }
-
- this->AddRef();
-
- return S_OK;
-}
-
-
-
-ULONG CQueue::AddRef()
-/*++
-
-Routine Description:
-
- Increments the ref count on this object.
-
-Arguments:
-
- None.
-
-Return Value:
-
- ULONG - new ref count.
-
---*/
-{
- LONG cRefs = InterlockedIncrement( &m_cRefs );
- return cRefs;
-}
-
-_At_(this, __drv_freesMem(object))
-ULONG CQueue::Release()
-/*++
-
-Routine Description:
-
- Decrements the ref count on this object.
-
-Arguments:
-
- None.
-
-Return Value:
-
- ULONG - new ref count.
-
---*/
-{
- LONG cRefs;
-
- cRefs = InterlockedDecrement( &m_cRefs );
-
- if( 0 == cRefs )
- {
- delete this;
- }
-
- return cRefs;
-}
-
-
-void
-CQueue::OnDeviceIoControl(
- _In_ IWDFIoQueue* pQueue,
- _In_ IWDFIoRequest* pRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T /*InputBufferSizeInBytes*/,
- _In_ SIZE_T /*OutputBufferSizeInBytes*/
- )
-/*++
-
-Routine Description:
-
- The framework calls this function when somone has called
- DeviceIoControl on the device.
-
-Arguments:
-
-Return Value:
- None
-
---*/
-{
- HRESULT hr = S_OK;
- IWDFDevice *pDevice = NULL;
-
- Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!");
-
- //
- // Retrieve the queue's parent device object
- //
- pQueue->GetDevice(&pDevice);
-
- WUDF_TEST_DRIVER_ASSERT(pDevice);
-
- switch (ControlCode)
- {
- case IOCTL_TOASTER_DONT_DISPLAY_IN_UI_DEVICE:
-
- //
- // This is just an example on how to hide your device in the
- // device manager. Please remove your code when you adapt this
- // sample for your hardware.
- //
- pDevice->SetPnpState(WdfPnpStateDontDisplayInUI, WdfTrue);
- pDevice->CommitPnpState();
-
- break;
-
- default:
- hr = E_FAIL; //invalid request
-
- Trace(TRACE_LEVEL_ERROR,"%!FUNC! Invalid IOCTL %!hresult!",hr);
- }
- pRequest->Complete(hr);
-
- return;
-}
-
-void
-CQueue::OnRead(
- _In_ IWDFIoQueue* /* pQueue */,
- _In_ IWDFIoRequest* pRequest,
- _In_ SIZE_T SizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- Read dispatch routine
- IQueueCallbackRead
-
-Arguments:
-
- pQueue - Framework Queue instance
- pRequest - Framework Request instance
- SizeInBytes - Length of bytes in the read buffer
-
- Copy available data into the read buffer
-
-Return Value:
- None.
-
---*/
-{
- Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!");
-
- //
- // No need to check for zero-length reads.
- //
- // The framework queue is created with the flag bAllowZeroLengthRequests = FALSE.
- // FALSE indicates that the framework completes zero-length I/O requests instead
- // of putting them in the I/O queue.
- //
-
- //
- // TODO: Put your Read request processing here
- //
-
- pRequest->CompleteWithInformation(S_OK, SizeInBytes);
-
- return;
-
-}
-
-void
-CQueue::OnWrite(
- _In_ IWDFIoQueue * /* pQueue */,
- _In_ IWDFIoRequest * pRequest,
- _In_ SIZE_T BytesToWrite
- )
-/*++
-
-Routine Description:
-
- Write dispatch routine
- IQueueCallbackWrite
-
-Arguments:
-
- pQueue - Framework Queue instance
- pRequest - Framework Request instance
- BytesToWrite - Length of bytes in the write buffer
-
- Allocate and copy data to local buffer
-
-Return Value:
- None.
-
---*/
-{
- Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!");
-
- //
- // No need to check for zero-length writes.
- //
-
- //
- // TODO: Put your Write request processing here
- //
-
- pRequest->CompleteWithInformation(S_OK, BytesToWrite);
-
- return;
-}
-
diff --git a/general/toaster/toastDrv/umdf/func/Queue.h b/general/toaster/toastDrv/umdf/func/Queue.h
deleted file mode 100644
index 6668ac35..00000000
--- a/general/toaster/toastDrv/umdf/func/Queue.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- Queue.h
-
- Abstract:
-
- This file contains the class definition for the queue
- callback object.
-
- Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "WUDFToaster.h"
-
-class CQueue :
- public IQueueCallbackDeviceIoControl,
- public IQueueCallbackRead,
- public IQueueCallbackWrite
-{
- public:
-
- CQueue() : m_cRefs(0)
- {
- }
-
- public:
-
- //
- // Static method that creates a queue callback object.
- //
- static HRESULT CreateInstance(_Out_ IUnknown **ppUkwn)
- {
- *ppUkwn = NULL;
-
-#pragma warning( suppress : 6014 )// PFD ISSUE: counted memory locks
- CQueue *pMyQueue = new CQueue();
-
- if (NULL == pMyQueue)
- {
- return E_OUTOFMEMORY;
- }
- return (pMyQueue->QueryInterface(__uuidof(IUnknown), (void **)ppUkwn ));
- }
-
- //
- // IUnknown
- //
- virtual HRESULT __stdcall QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObject);
- virtual ULONG __stdcall AddRef();
- _At_(this, __drv_freesMem(object))
- virtual ULONG __stdcall Release();
-
- //
- // IQueueCallbackDeviceIoControl
- //
- virtual void __stdcall OnDeviceIoControl(
- _In_ IWDFIoQueue* pQueue,
- _In_ IWDFIoRequest* pRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- );
-
- //
- // IQueueCallbackRead
- //
- virtual void __stdcall OnRead(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToRead
- );
-
- //
- // IQueueCallbackWrite
- //
- virtual void __stdcall OnWrite(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToWrite
- );
-
- //
- // TODO: Add your interfaces here
- //
-
- private:
- LONG m_cRefs;
-};
diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.cpp b/general/toaster/toastDrv/umdf/func/WUDFToaster.cpp
deleted file mode 100644
index fd66163d..00000000
--- a/general/toaster/toastDrv/umdf/func/WUDFToaster.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- WUDFToaster.cpp
-
- Abstract:
-
- Implementation of DLL Exports.
-
- Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "stdafx.h"
-#include "resource.h"
-
-#include "WUDFToaster.h"
-
-#include "internal.h"
-#include "WUDFToaster.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-class CToasterDriverModule : public CAtlDllModuleT< CToasterDriverModule >
-{
-public :
- DECLARE_LIBID(LIBID_WUDFToasterLib)
-};
-
-CToasterDriverModule _AtlModule;
-
-// DLL Entry Point
-extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
-{
- hInstance;
-
- if(dwReason == DLL_PROCESS_ATTACH)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if(dwReason == DLL_PROCESS_DETACH)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return _AtlModule.DllMain(dwReason, lpReserved);
-}
-
-// Returns a class factory to create an object of the requested type
-_Check_return_
-STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv)
-{
- return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
-}
-
-// Used to determine whether the DLL can be unloaded by OLE
-STDAPI DllCanUnloadNow(void)
-{
- return _AtlModule.DllCanUnloadNow();
-}
-
-// DllRegisterServer - Adds entries to the system registry
-STDAPI DllRegisterServer(void)
-{
- // registers object, typelib and all interfaces in typelib
- HRESULT hr = _AtlModule.DllRegisterServer();
- return hr;
-}
-
-// DllUnregisterServer - Removes entries from the system registry
-STDAPI DllUnregisterServer(void)
-{
- HRESULT hr = _AtlModule.DllUnregisterServer();
- return hr;
-}
diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.ctl b/general/toaster/toastDrv/umdf/func/WUDFToaster.ctl
deleted file mode 100644
index cfcbb866..00000000
--- a/general/toaster/toastDrv/umdf/func/WUDFToaster.ctl
+++ /dev/null
@@ -1,2 +0,0 @@
-9B6DE419-5658-46c9-A358-54FDEBB6B89D WudfToasterTraceGuid
-
diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.def b/general/toaster/toastDrv/umdf/func/WUDFToaster.def
deleted file mode 100644
index 4aa746ad..00000000
--- a/general/toaster/toastDrv/umdf/func/WUDFToaster.def
+++ /dev/null
@@ -1,6 +0,0 @@
-; WUDFToaster.def : Declares the module parameters.
-
-LIBRARY "WUDFToaster.DLL"
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.idl b/general/toaster/toastDrv/umdf/func/WUDFToaster.idl
deleted file mode 100644
index da21b41e..00000000
--- a/general/toaster/toastDrv/umdf/func/WUDFToaster.idl
+++ /dev/null
@@ -1,40 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- WUDFToaster.idl
-
- Abstract:
-
- Definition of the WUDF Toaster sample's COM class
-
- Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-import "oaidl.idl";
-import "ocidl.idl";
-import "wudfddi.idl";
-
-[
- uuid(04170C5A-388E-410f-9BAA-E7724196AD17),
- version(1.0),
- helpstring("WUDF Toaster Driver 1.0 Type Library")
-]
-library WUDFToasterLib
-{
- importlib("stdole2.tlb");
- [
- uuid(5ED5997F-FAED-4a35-BA74-FCF7B43AEBA7),
- helpstring("WudfToaster Class")
- ]
- coclass WUDFToaster
- {
- [default] interface IDriverEntry;
- };
-};
-
diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.inx b/general/toaster/toastDrv/umdf/func/WUDFToaster.inx
deleted file mode 100644
index 9874becf..00000000
--- a/general/toaster/toastDrv/umdf/func/WUDFToaster.inx
+++ /dev/null
Binary files differ
diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.rc b/general/toaster/toastDrv/umdf/func/WUDFToaster.rc
deleted file mode 100644
index 74453a02..00000000
--- a/general/toaster/toastDrv/umdf/func/WUDFToaster.rc
+++ /dev/null
@@ -1,22 +0,0 @@
-//---------------------------------------------------------------------------
-// Skeleton.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-#include "resource.h"
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF User-Mode Toaster Driver Sample"
-#define VER_INTERNALNAME_STR "WUDFToaster"
-#define VER_ORIGINALFILENAME_STR "WUDFToaster.dll"
-
-#include "common.ver"
diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj b/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj
deleted file mode 100644
index e9c01e32..00000000
--- a/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj
+++ /dev/null
@@ -1,338 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <SupportsPackaging>false</SupportsPackaging>
- <RequiresPackageProject>true</RequiresPackageProject>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{8FD6D25D-F593-45DB-AF96-6F358E01587B}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include=".\$(IntDir)\WUDFToaster_i.c">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <ClCompile Include="WUDFToaster.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Use</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <ClCompile Include="stdafx.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Use</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <ClCompile Include="Driver.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Use</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <ClCompile Include="Device.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Use</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <ClCompile Include="Queue.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Use</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <Inf Include="WUDFToaster.inx">
- <Architecture>$(InfArch)</Architecture>
- <SpecifyArchitecture>true</SpecifyArchitecture>
- <Verbose>true</Verbose>
- <CopyOutput>.\$(IntDir)\WUDFToaster.inf</CopyOutput>
- </Inf>
- <OtherWpp Include="WUDFToaster.rc; WUDFTOaster.idl">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFToaster</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFToaster</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFToaster</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFToaster</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\uuid.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>WUDFToaster.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\uuid.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>WUDFToaster.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\uuid.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>WUDFToaster.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\uuid.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>WUDFToaster.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="stdAfxsrc.cpp">
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Create</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <Midl Include="WUDFTOaster.idl" />
- <ResourceCompile Include="WUDFToaster.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inf" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj.Filters b/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj.Filters
deleted file mode 100644
index b64202cf..00000000
--- a/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj.Filters
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{9ACEB224-90E2-40F2-838C-9F279873D314}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{150AE92E-5F8C-4B90-B7BE-352ECA0434CD}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{BBE5A5E9-E1F7-47E7-91B7-111A3D0BAE2A}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{CCF62242-AF1C-424F-942F-E11D79A0EF79}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include=".\Debug\\WUDFToaster_i.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="stdafx.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="stdAfxsrc.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="WUDFToaster.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <Midl Include="WUDFTOaster.idl">
- <Filter>Source Files</Filter>
- </Midl>
- <None Include="WUDFToaster.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="WUDFToaster.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/general/toaster/toastDrv/umdf/func/internal.h b/general/toaster/toastDrv/umdf/func/internal.h
deleted file mode 100644
index 1a098a19..00000000
--- a/general/toaster/toastDrv/umdf/func/internal.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF Toaster
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF DDI
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CDriver *PCDriver;
-typedef class CDevice *PCDevice;
-typedef class CQueue *PCQueue;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- MyDriverTraceControl, (9B6DE419,5658,46c9,A358,54FDEBB6B89D), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\WUDF\\Toaster"
-#define MYDRIVER_CLASS_ID {0x7ab7dcf5, 0xd1d4, 0x4085, {0x95, 0x47, 0x1d, 0xb9, 0x68, 0xcc, 0xa7, 0x20}}
-
-//
-// Include the type specific headers.
-//
-
-#include "driver.h"
-#include "device.h"
-#include "queue.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_TEST_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-
-
diff --git a/general/toaster/toastDrv/umdf/func/resource.h b/general/toaster/toastDrv/umdf/func/resource.h
deleted file mode 100644
index 800c5a81..00000000
--- a/general/toaster/toastDrv/umdf/func/resource.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#define IDS_PROJNAME 100
-#define IDR_TOASTERDRIVER 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 201
-#define _APS_NEXT_COMMAND_VALUE 32768
-#define _APS_NEXT_CONTROL_VALUE 201
-#define _APS_NEXT_SYMED_VALUE 105
-#endif
-#endif
diff --git a/general/toaster/toastDrv/umdf/func/stdAfxsrc.cpp b/general/toaster/toastDrv/umdf/func/stdAfxsrc.cpp
deleted file mode 100644
index 15f34744..00000000
--- a/general/toaster/toastDrv/umdf/func/stdAfxsrc.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "stdAfx.h" \ No newline at end of file
diff --git a/general/toaster/toastDrv/umdf/func/stdafx.cpp b/general/toaster/toastDrv/umdf/func/stdafx.cpp
deleted file mode 100644
index 16521f2a..00000000
--- a/general/toaster/toastDrv/umdf/func/stdafx.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- stdafx.cpp
-
- Abstract:
-
- This is used to build the precompiled header.
-
- Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-
-#include "stdafx.h"
-
-#include "initguid.h"
-
-DEFINE_GUID (GUID_DEVINTERFACE_TOASTER,
- 0x781EF630, 0x72B2, 0x11d2, 0xB8, 0x52, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71);
-//{781EF630-72B2-11d2-B852-00C04FAD5171}
-
diff --git a/general/toaster/toastDrv/umdf/func/stdafx.h b/general/toaster/toastDrv/umdf/func/stdafx.h
deleted file mode 100644
index 7e432496..00000000
--- a/general/toaster/toastDrv/umdf/func/stdafx.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*++
-
- Copyright (c) Microsoft Corporation, All Rights Reserved
-
- Module Name:
-
- stdafx.h
-
- Abstract:
-
- Include file for standard system include filesor project specific
- include files that are used frequently, but are changed infrequently
-
- Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-
-#pragma once
-
-#ifndef STRICT
-#define STRICT
-#endif
-
-
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501 // Windows XP and newer.
-#endif
-
-#define _ATL_FREE_THREADED
-#define _ATL_NO_AUTOMATIC_NAMESPACE
-
-// turns off ATL's hiding of some common and often safely ignored warning messages
-#define _ATL_ALL_WARNINGS
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
-
-#include "resource.h"
-#include <atlbase.h>
-#include <atlcom.h>
-
-extern const GUID GUID_DEVINTERFACE_TOASTER;
-
-using namespace ATL;
-
diff --git a/general/umdfSkeleton/README.md b/general/umdfSkeleton/README.md
deleted file mode 100644
index 59a5f25b..00000000
--- a/general/umdfSkeleton/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-page_type: sample
-description: "Demonstrates how to use UDMF to write a minimal driver."
-languages:
-- cpp
-products:
-- windows
-- windows-wdk
----
-
-# UMDF Driver Skeleton Sample (UMDF Version 1)
-
-This sample demonstrates how to use version 1 of the User-Mode Driver Framework to write a minimal driver.
-
-The Skeleton driver will successfully load on a device (either root enumerated or a real hardware device) but does not support any I/O operations.
diff --git a/general/umdfSkeleton/Skeleton.rc b/general/umdfSkeleton/Skeleton.rc
deleted file mode 100644
index b6ecda7f..00000000
--- a/general/umdfSkeleton/Skeleton.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// Skeleton.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF Skeleton User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "UMDFSkeleton"
-#define VER_ORIGINALFILENAME_STR "UMDFSkeleton.dll"
-
-#include "common.ver"
diff --git a/general/umdfSkeleton/UMDFSkeleton.vcxproj b/general/umdfSkeleton/UMDFSkeleton.vcxproj
deleted file mode 100644
index 86f13834..00000000
--- a/general/umdfSkeleton/UMDFSkeleton.vcxproj
+++ /dev/null
@@ -1,265 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{6C720AF2-E419-4BA6-927C-607BE3E771F1}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <UMDF_VERSION_MINOR>9</UMDF_VERSION_MINOR>
- <KMDF_VERSION_MINOR>9</KMDF_VERSION_MINOR>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{B7203DC7-2002-4983-AB0B-E567DC6BD66C}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="Skeleton.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>UMDFSkeleton</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>UMDFSkeleton</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>UMDFSkeleton</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>UMDFSkeleton</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="Skeleton.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/general/umdfSkeleton/UMDFSkeleton.vcxproj.Filters b/general/umdfSkeleton/UMDFSkeleton.vcxproj.Filters
deleted file mode 100644
index 7da6c076..00000000
--- a/general/umdfSkeleton/UMDFSkeleton.vcxproj.Filters
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{B6F807E5-006F-4FBD-BB35-CC706D5CB468}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{66714BFC-1D46-4D92-A154-1C6DFF39E4D4}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{B398CF71-A6A3-49C5-A7EC-47876A953477}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{1A124126-5375-4543-880D-28113FEF151C}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="Skeleton.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/general/umdfSkeleton/UMDFSkeleton_OSR.inx b/general/umdfSkeleton/UMDFSkeleton_OSR.inx
deleted file mode 100644
index 3da01ae6..00000000
--- a/general/umdfSkeleton/UMDFSkeleton_OSR.inx
+++ /dev/null
Binary files differ
diff --git a/general/umdfSkeleton/UMDFSkeleton_Root.inx b/general/umdfSkeleton/UMDFSkeleton_Root.inx
deleted file mode 100644
index 63d9f94c..00000000
--- a/general/umdfSkeleton/UMDFSkeleton_Root.inx
+++ /dev/null
Binary files differ
diff --git a/general/umdfSkeleton/comsup.cpp b/general/umdfSkeleton/comsup.cpp
deleted file mode 100644
index fd298470..00000000
--- a/general/umdfSkeleton/comsup.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/general/umdfSkeleton/comsup.h b/general/umdfSkeleton/comsup.h
deleted file mode 100644
index 5472338c..00000000
--- a/general/umdfSkeleton/comsup.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/general/umdfSkeleton/device.cpp b/general/umdfSkeleton/device.cpp
deleted file mode 100644
index 677f39e6..00000000
--- a/general/umdfSkeleton/device.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton sample driver's
- device callback object.
-
- The skeleton sample device does very little. It does not implement either
- of the PNP interfaces so once the device is setup, it won't ever get any
- callbacks until the device is removed.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "device.tmh"
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the skeleton driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice;
- HRESULT hr;
-
- //
- // Configure things like the locking model before we go to create our
- // partner device.
- //
-
- //
- // Set no locking unless you need an automatic callbacks synchronization
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // TODO: If you're writing a filter driver then indicate that here.
- //
- // FxDeviceInit->SetFilter();
- //
-
- //
- // TODO: Any per-device initialization which must be done before
- // creating the partner object.
- //
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- //
- // TODO: Setup your device queues and I/O forwarding.
- //
-
- return S_OK;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Since the skeleton driver doesn't support any of the device events, this
- method simply calls the base class's BaseQueryInterface.
-
- If the skeleton is extended to include device event interfaces then this
- method must be changed to check the IID and return pointers to them as
- appropriate.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- return CUnknown::QueryInterface(InterfaceId, Object);
-}
diff --git a/general/umdfSkeleton/device.h b/general/umdfSkeleton/device.h
deleted file mode 100644
index d5e1baa6..00000000
--- a/general/umdfSkeleton/device.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Class for the iotrace driver.
-//
-
-class CMyDevice : public CUnknown
-{
-
-//
-// Private data members.
-//
-private:
-
- IWDFDevice *m_FxDevice;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- )
- {
- m_FxDevice = NULL;
- }
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- HRESULT
- Configure(
- VOID
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
-};
diff --git a/general/umdfSkeleton/dllsup.cpp b/general/umdfSkeleton/dllsup.cpp
deleted file mode 100644
index 3a59f303..00000000
--- a/general/umdfSkeleton/dllsup.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the skeleton uses
- L"Microsoft\\UMDF\\Skeleton"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
-
- UNREFERENCED_PARAMETER( ModuleHandle );
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
-
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- _In_ REFCLSID ClassId,
- _In_ REFIID InterfaceId,
- _Outptr_ LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/general/umdfSkeleton/driver.cpp b/general/umdfSkeleton/driver.cpp
deleted file mode 100644
index 2061ec2d..00000000
--- a/general/umdfSkeleton/driver.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // TODO: Do any per-device initialization (reading settings from the
- // registry for example) that's necessary before creating your
- // device callback object here. Otherwise you can leave such
- // initialization to the initialization of the device event
- // handler.
- //
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // TODO: Change any per-device settings that the object exposes before
- // calling Configure to let it complete its initialization.
- //
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/general/umdfSkeleton/driver.h b/general/umdfSkeleton/driver.h
deleted file mode 100644
index c5664ac0..00000000
--- a/general/umdfSkeleton/driver.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the skeleton sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER( FxWdfDriver );
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER( FxWdfDriver );
-
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
diff --git a/general/umdfSkeleton/exports.def b/general/umdfSkeleton/exports.def
deleted file mode 100644
index a1ab223c..00000000
--- a/general/umdfSkeleton/exports.def
+++ /dev/null
@@ -1,10 +0,0 @@
-; Skeleton.def : Declares the module parameters.
-
-;
-; TODO: Change the library name here to match your binary name.
-;
-
-LIBRARY "UMDFSkeleton.DLL"
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/general/umdfSkeleton/internal.h b/general/umdfSkeleton/internal.h
deleted file mode 100644
index bd8c3c6d..00000000
--- a/general/umdfSkeleton/internal.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF Skeleton
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF DDI
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- MyDriverTraceControl, (e7541cdd,30e8,4b50,aeb0,51927330ae64), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\Skeleton"
-#define MYDRIVER_CLASS_ID { 0xd4112073, 0xd09b, 0x458f, { 0xa5, 0xaa, 0x35, 0xef, 0x21, 0xee, 0xf5, 0xde } }
-
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
diff --git a/general/umdfSkeleton/umdfSkeleton.sln b/general/umdfSkeleton/umdfSkeleton.sln
deleted file mode 100644
index c8432e90..00000000
--- a/general/umdfSkeleton/umdfSkeleton.sln
+++ /dev/null
@@ -1,28 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0
-MinimumVisualStudioVersion = 12.0
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UMDFSkeleton", "UMDFSkeleton.vcxproj", "{6C720AF2-E419-4BA6-927C-607BE3E771F1}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- Debug|x64 = Debug|x64
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Debug|Win32.ActiveCfg = Debug|Win32
- {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Debug|Win32.Build.0 = Debug|Win32
- {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Release|Win32.ActiveCfg = Release|Win32
- {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Release|Win32.Build.0 = Release|Win32
- {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Debug|x64.ActiveCfg = Debug|x64
- {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Debug|x64.Build.0 = Debug|x64
- {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Release|x64.ActiveCfg = Release|x64
- {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/serial/VirtualSerial/ComPort/exports.def b/serial/VirtualSerial/ComPort/exports.def
deleted file mode 100644
index 5d92ff03..00000000
--- a/serial/VirtualSerial/ComPort/exports.def
+++ /dev/null
@@ -1,6 +0,0 @@
-; exports.def : Declares the module parameters.
-
-LIBRARY "Virtualserial.DLL"
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/serial/VirtualSerial/ComPort/virtualserial.inx b/serial/VirtualSerial/ComPort/virtualserial.inx
deleted file mode 100644
index d7c8f01c..00000000
--- a/serial/VirtualSerial/ComPort/virtualserial.inx
+++ /dev/null
Binary files differ
diff --git a/serial/VirtualSerial/ComPort/virtualserial.rc b/serial/VirtualSerial/ComPort/virtualserial.rc
deleted file mode 100644
index eeda38a7..00000000
--- a/serial/VirtualSerial/ComPort/virtualserial.rc
+++ /dev/null
@@ -1,17 +0,0 @@
-//---------------------------------------------------------------------------
-// Virtualserial.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF VirtualSerial User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "VirtualSerial"
-#define VER_ORIGINALFILENAME_STR "Virtualserial.dll"
-
-#include "common.ver"
diff --git a/serial/VirtualSerial/ComPort/virtualserial.vcxproj b/serial/VirtualSerial/ComPort/virtualserial.vcxproj
deleted file mode 100644
index 4adeded9..00000000
--- a/serial/VirtualSerial/ComPort/virtualserial.vcxproj
+++ /dev/null
@@ -1,250 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{A88B1CA4-202D-4915-94D1-94E8D74FCFF5}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="..\dllsup.cpp; ..\comsup.cpp; ..\driver.cpp; ..\device.cpp; ..\queue.cpp; ..\ringbuffer.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>..\internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="virtualserial.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>..\internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>virtualserial</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>virtualserial</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>virtualserial</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>virtualserial</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\ntdll.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ole32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\ntdll.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ole32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\ntdll.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ole32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\ntdll.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ole32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="virtualserial.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/serial/VirtualSerial/ComPort/virtualserial.vcxproj.Filters b/serial/VirtualSerial/ComPort/virtualserial.vcxproj.Filters
deleted file mode 100644
index d8da803f..00000000
--- a/serial/VirtualSerial/ComPort/virtualserial.vcxproj.Filters
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{FD27BABE-0C58-4B98-AF81-08289AA3B68B}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{F310CB18-6DEC-47F7-8CA0-21A1439D1363}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{52CDBF35-D541-4FFF-A0C5-8C8189885A23}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{51F65D19-3BDF-4759-9AD1-DDA85ACA2524}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\ringbuffer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="virtualserial.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/serial/VirtualSerial/FakeModem/exports.def b/serial/VirtualSerial/FakeModem/exports.def
deleted file mode 100644
index 48845d0c..00000000
--- a/serial/VirtualSerial/FakeModem/exports.def
+++ /dev/null
@@ -1,6 +0,0 @@
-; exports.def : Declares the module parameters.
-
-LIBRARY "FakeModem.DLL"
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/serial/VirtualSerial/FakeModem/fakemodem.inx b/serial/VirtualSerial/FakeModem/fakemodem.inx
deleted file mode 100644
index 54cf099d..00000000
--- a/serial/VirtualSerial/FakeModem/fakemodem.inx
+++ /dev/null
Binary files differ
diff --git a/serial/VirtualSerial/FakeModem/fakemodem.rc b/serial/VirtualSerial/FakeModem/fakemodem.rc
deleted file mode 100644
index 6bb6ed96..00000000
--- a/serial/VirtualSerial/FakeModem/fakemodem.rc
+++ /dev/null
@@ -1,17 +0,0 @@
-//---------------------------------------------------------------------------
-// FakeModem.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF Fake Modem User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "FakeModem"
-#define VER_ORIGINALFILENAME_STR "FakeModem.dll"
-
-#include "common.ver"
diff --git a/serial/VirtualSerial/FakeModem/fakemodem.vcxproj b/serial/VirtualSerial/FakeModem/fakemodem.vcxproj
deleted file mode 100644
index fb0caada..00000000
--- a/serial/VirtualSerial/FakeModem/fakemodem.vcxproj
+++ /dev/null
@@ -1,250 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{ACC7F2B5-F886-4169-84C0-32E44847E2B3}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{632318C9-FA2B-44A3-BB8C-3ADC5F2E2A86}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="..\dllsup.cpp; ..\comsup.cpp; ..\driver.cpp; ..\device.cpp; ..\queue.cpp; ..\ringbuffer.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>..\internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="fakemodem.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>..\internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>fakemodem</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>fakemodem</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>fakemodem</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>fakemodem</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_FAKE_MODEM=1;_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\ntdll.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ole32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\ntdll.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ole32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\ntdll.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ole32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\ntdll.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ole32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="fakemodem.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/serial/VirtualSerial/FakeModem/fakemodem.vcxproj.Filters b/serial/VirtualSerial/FakeModem/fakemodem.vcxproj.Filters
deleted file mode 100644
index 52ccc10a..00000000
--- a/serial/VirtualSerial/FakeModem/fakemodem.vcxproj.Filters
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{1F2A9E59-0673-4608-95E9-CF60343773E6}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{10F80ED7-1AD5-4B8B-B840-DE4146B936E1}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{AA21B933-B73E-406C-AD32-1EC06E712F89}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{842CBD81-76BE-44AA-80B7-0BE49BE0DE56}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\ringbuffer.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="fakemodem.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/serial/VirtualSerial/README.md b/serial/VirtualSerial/README.md
deleted file mode 100644
index 3eeb9764..00000000
--- a/serial/VirtualSerial/README.md
+++ /dev/null
@@ -1,63 +0,0 @@
----
-page_type: sample
-description: "Demonstrates a simple virtual serial driver (ComPort) and a controller-less modem driver (FakeModem)."
-languages:
-- cpp
-products:
-- windows
-- windows-wdk
----
-
-# Virtual serial driver sample
-
-This sample demonstrates these two serial drivers:
-
-- A simple virtual serial driver (ComPort)
-
-- A controller-less modem driver (FakeModem).This driver supports sending and receiving AT commands using the ReadFile and WriteFile calls or via a TAPI interface using an application such as, HyperTerminal.
-
-This sample driver is a minimal driver meant to demonstrate the usage of the User-Mode Driver Framework. It is not intended for use in a production environment.
-
-For more information, see the [Serial Controller Driver Design Guide](https://docs.microsoft.com/windows-hardware/drivers/serports/).
-
-## Code tour
-
-### comsup.cpp and comsup.h
-
-- COM Support code - specifically base classes which provide implementations for the standard COM interfaces **IUnknown** and **IClassFactory** which are used throughout the sample.
-
-- The implementation of **IClassFactory** is designed to create instances of the CMyDriver class. If you should change the name of your base driver class, you would also need to modify this file.
-
-### dllsup.cpp
-
-- DLL Support code - provides the DLL's entry point as well as the single required export (**DllGetClassObject**).
-
-- These depend on comsup.cpp to perform the necessary class creation.
-
-### exports.def
-
-- This file lists the functions that the driver DLL exports.
-
-### internal.h
-
-- This is the main header file for the sample driver.
-
-### driver.cpp and driver.h
-
-- Definition and implementation of the driver callback class (CMyDriver) for the sample. This includes **DriverEntry** and events on the framework driver object.
-
-### device.cpp and driver.h
-
-- Definition and implementation of the device callback class (CMyDriver) for the sample. This includes events on the framework device object.
-
-### queue.cpp and queue.h
-
-- Definition and implementation of the base queue callback class (CMyQueue). This includes events on the framework I/O queue object.
-
-### VirtualSerial.rc /FakeModem.rc
-
-- This file defines resource information for the sample driver.
-
-### VirtualSerial.inf / FakeModem.inf
-
-- INF file that contains installation information for this driver.
diff --git a/serial/VirtualSerial/VirtualSerial.sln b/serial/VirtualSerial/VirtualSerial.sln
deleted file mode 100644
index 8ca42edb..00000000
--- a/serial/VirtualSerial/VirtualSerial.sln
+++ /dev/null
@@ -1,46 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0
-MinimumVisualStudioVersion = 12.0
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComPort", "ComPort", "{56318356-CB41-44F9-9830-F051C326B8C2}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FakeModem", "FakeModem", "{209B0D63-1DB3-4114-9531-FCBDE7CE1B5C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtualserial", "ComPort\virtualserial.vcxproj", "{CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fakemodem", "FakeModem\fakemodem.vcxproj", "{ACC7F2B5-F886-4169-84C0-32E44847E2B3}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- Debug|x64 = Debug|x64
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}.Debug|Win32.ActiveCfg = Debug|Win32
- {CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}.Debug|Win32.Build.0 = Debug|Win32
- {CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}.Release|Win32.ActiveCfg = Release|Win32
- {CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}.Release|Win32.Build.0 = Release|Win32
- {CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}.Debug|x64.ActiveCfg = Debug|x64
- {CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}.Debug|x64.Build.0 = Debug|x64
- {CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}.Release|x64.ActiveCfg = Release|x64
- {CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184}.Release|x64.Build.0 = Release|x64
- {ACC7F2B5-F886-4169-84C0-32E44847E2B3}.Debug|Win32.ActiveCfg = Debug|Win32
- {ACC7F2B5-F886-4169-84C0-32E44847E2B3}.Debug|Win32.Build.0 = Debug|Win32
- {ACC7F2B5-F886-4169-84C0-32E44847E2B3}.Release|Win32.ActiveCfg = Release|Win32
- {ACC7F2B5-F886-4169-84C0-32E44847E2B3}.Release|Win32.Build.0 = Release|Win32
- {ACC7F2B5-F886-4169-84C0-32E44847E2B3}.Debug|x64.ActiveCfg = Debug|x64
- {ACC7F2B5-F886-4169-84C0-32E44847E2B3}.Debug|x64.Build.0 = Debug|x64
- {ACC7F2B5-F886-4169-84C0-32E44847E2B3}.Release|x64.ActiveCfg = Release|x64
- {ACC7F2B5-F886-4169-84C0-32E44847E2B3}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {CF30C8F0-084B-4E2D-A9C3-E76B4E9D0184} = {56318356-CB41-44F9-9830-F051C326B8C2}
- {ACC7F2B5-F886-4169-84C0-32E44847E2B3} = {209B0D63-1DB3-4114-9531-FCBDE7CE1B5C}
- EndGlobalSection
-EndGlobal
diff --git a/serial/VirtualSerial/comsup.cpp b/serial/VirtualSerial/comsup.cpp
deleted file mode 100644
index fd298470..00000000
--- a/serial/VirtualSerial/comsup.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/serial/VirtualSerial/comsup.h b/serial/VirtualSerial/comsup.h
deleted file mode 100644
index a73938b6..00000000
--- a/serial/VirtualSerial/comsup.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/serial/VirtualSerial/device.cpp b/serial/VirtualSerial/device.cpp
deleted file mode 100644
index 11d47775..00000000
--- a/serial/VirtualSerial/device.cpp
+++ /dev/null
@@ -1,674 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF VirtualSerial sample
- driver's device callback object.
-
- The VirtualSerial sample device does very little. It does not implement
- either of the PNP interfaces so once the device is setup, it won't ever get
- any callbacks until the device is removed.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "device.tmh"
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the VirtualSerial driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice;
- HRESULT hr;
-
- //
- // Configure things like the locking model before we go to create our
- // partner device.
- //
- FxDeviceInit->SetLockingConstraint(WdfDeviceLevel);
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- IWDFPropertyStoreFactory *pPropertyStoreFactory = NULL;
- IWDFNamedPropertyStore2 * pHardwarePropertyStore = NULL;
- IWDFNamedPropertyStore2 * pLegacyHardwarePropertyStore = NULL;
- WDF_PROPERTY_STORE_ROOT RootSpecifier;
- PROPVARIANT comPortPV;
- WCHAR portName[] = L"PortName";
- size_t comPortSuffixCch = 0;
- WCHAR *comPortFullName = NULL;
- size_t comPortFullNameCch = 0;
- WCHAR *pdoName = NULL;
- PCMyQueue defaultQueue;
-
-#ifdef _FAKE_MODEM
- //
- // Compiled as fake modem
- //
- LPGUID pGuid = (LPGUID) &GUID_DEVINTERFACE_MODEM;
-#else
- //
- // Compiled as virtual serial port
- //
- LPGUID pGuid = (LPGUID) &GUID_DEVINTERFACE_COMPORT;
-#endif
-
- HRESULT hr;
-
- PropVariantInit(&comPortPV);
-
- //
- // Create device interface
- //
- hr = m_FxDevice->CreateDeviceInterface(pGuid,
- NULL);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Cannot create device interface (%!GUID!)",
- pGuid
- );
-
- goto Exit;
- }
-
- hr = m_FxDevice->AssignDeviceInterfaceState(pGuid,
- NULL,
- TRUE);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Cannot enable device interface (%!GUID!)",
- pGuid
- );
-
- goto Exit;
- }
-
- //
- // Create Symbolic Link
- //
-
- //
- // First we need to read the COM number from the registry
- //
-
- hr = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pPropertyStoreFactory));
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: QI for IWDFPropertyStoreFactory failed"
- );
-
- goto Exit;
- }
-
- RootSpecifier.LengthCb = sizeof(WDF_PROPERTY_STORE_ROOT);
- RootSpecifier.RootClass = WdfPropertyStoreRootClassHardwareKey;
- RootSpecifier.Qualifier.HardwareKey.ServiceName =
- WDF_PROPERTY_STORE_HARDWARE_KEY_ROOT;
-
- hr = pPropertyStoreFactory->RetrieveDevicePropertyStore(
- &RootSpecifier,
- WdfPropertyStoreNormal,
- KEY_QUERY_VALUE,
- NULL,
- &pHardwarePropertyStore,
- NULL
- );
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Failed to retrieve device hardware key root"
- );
- goto Exit;
- }
-
- hr = pHardwarePropertyStore->GetNamedValue(portName, &comPortPV);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Failed to read value %ws",
- portName
- );
- goto Exit;
- }
-
- //
- // Then we need to construct the COM port name
- //
- hr = StringCchLength(comPortPV.pwszVal,
- STRSAFE_MAX_CCH,
- &comPortSuffixCch);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Overflow while calculating COM port suffix length"
- );
- goto Exit;
- }
-
- hr = SizeTAdd(ARRAYSIZE(SYMBOLIC_LINK_NAME_PREFIX),
- comPortSuffixCch,
- &comPortFullNameCch);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Overflow while calculating symbolic link length"
- );
- goto Exit;
- }
-
- comPortFullName = (WCHAR*) new WCHAR[comPortFullNameCch];
-
- if (NULL == comPortFullName)
- {
- hr = E_OUTOFMEMORY;
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Unable to allocate memory for full port name"
- );
- goto Exit;
- }
-
- hr = StringCchPrintf(comPortFullName,
- comPortFullNameCch,
- L"%ws%ws",
- SYMBOLIC_LINK_NAME_PREFIX,
- comPortPV.pwszVal);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Cannot create full name for COM port"
- );
- goto Exit;
- }
-
- //
- // Finally we create the symbolic link
- //
- hr = m_FxDevice->CreateSymbolicLink(comPortFullName);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Cannot create symbolic link %ws",
- comPortFullName
- );
- goto Exit;
- }
-
- //
- // Write the com name to the legacy hardware key
- //
- hr = GetPdoName(&pdoName);
-
- if (FAILED(hr) || (pdoName == NULL))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Cannot retrieve PDO name"
- );
- goto Exit;
- }
-
- //
- // Write the name to the legacy hardware key
- //
- RootSpecifier.LengthCb = sizeof(WDF_PROPERTY_STORE_ROOT);
- RootSpecifier.RootClass = WdfPropertyStoreRootClassLegacyHardwareKey;
- RootSpecifier.Qualifier.LegacyHardwareKey.LegacyMapName = L"SERIALCOMM";
-
- hr = pPropertyStoreFactory->RetrieveDevicePropertyStore(
- &RootSpecifier,
- WdfPropertyStoreCreateVolatile,
- KEY_SET_VALUE,
- NULL,
- &pLegacyHardwarePropertyStore,
- NULL
- );
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Failed to retrieve device legacy hardware key"
- );
- goto Exit;
- }
-
- hr = pLegacyHardwarePropertyStore->SetNamedValue(pdoName,
- &comPortPV);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Failed to write device name to legacy hardware key"
- );
- goto Exit;
- }
-
- m_CreatedLegacyHardwareKey = TRUE;
- m_LegacyHardwarePropertyStore = pLegacyHardwarePropertyStore;
- m_PdoName = pdoName;
-
- //
- // Create and configure the queues
- //
- hr = CMyQueue::CreateInstance(this, m_FxDevice, &defaultQueue);
-
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Failed to create default queue"
- );
- goto Exit;
- }
-
- defaultQueue->Release();
-
-
-Exit:
-
- if (m_CreatedLegacyHardwareKey == FALSE)
- {
- //
- // If the legacy hardware key has been written, then the cleanup
- // will happen, when the device is unloaded
- //
- SAFE_RELEASE(pLegacyHardwarePropertyStore);
- if (pdoName != NULL)
- {
- delete[] pdoName;
- }
- }
-
- SAFE_RELEASE(pHardwarePropertyStore);
- SAFE_RELEASE(pPropertyStoreFactory);
-
- PropVariantClear(&comPortPV);
-
- if (comPortFullName != NULL)
- {
- delete[] comPortFullName;
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
- if(IsEqualIID(InterfaceId, __uuidof(IObjectCleanup)))
- {
- *Object = QueryIObjectCleanup();
- hr = S_OK;
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-VOID
-CMyDevice::OnCleanup(
- IWDFObject* pWdfObject
-)
-{
- UNREFERENCED_PARAMETER(pWdfObject);
-
- if ((m_CreatedLegacyHardwareKey == TRUE) &&
- (m_LegacyHardwarePropertyStore != NULL))
- {
- m_LegacyHardwarePropertyStore->DeleteNamedValue(m_PdoName);
- SAFE_RELEASE(m_LegacyHardwarePropertyStore);
- delete[] m_PdoName;
- }
-}
-
-HRESULT
-CMyDevice::GetPdoName(
- _Out_ LPWSTR *PdoName
- )
-{
- HRESULT hr = S_OK;
- WCHAR *devInstId = NULL;
- ULONG devInstIdLen;
- HDEVINFO hDevInfoSet = INVALID_HANDLE_VALUE;
- SP_DEVINFO_DATA devInfoData;
- WCHAR *pdoName = NULL;
- DWORD pdoNameCb = 0;
-
- WUDF_TEST_DRIVER_ASSERT(m_FxDevice);
-
- //
- // First let's get the device instance ID
- //
- devInstIdLen = 0;
- hr = m_FxDevice->RetrieveDeviceInstanceId(NULL, &devInstIdLen);
- if (SUCCEEDED(hr))
- {
- devInstId = (WCHAR*) new WCHAR[devInstIdLen];
- if (NULL == devInstId)
- {
- hr = E_OUTOFMEMORY;
- }
- }
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->RetrieveDeviceInstanceId(devInstId, &devInstIdLen);
- }
-
- //
- // Now use the SetupDiXxx functions to get a handle to the device's
- // hardware key
- //
- if (SUCCEEDED(hr))
- {
- //
- // Create a new device information set
- //
- hDevInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL);
- if (INVALID_HANDLE_VALUE == hDevInfoSet)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- }
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // Add our device to this device information set
- //
- ZeroMemory(&devInfoData, sizeof(devInfoData));
- devInfoData.cbSize = sizeof(devInfoData);
- if (!SetupDiOpenDeviceInfo(hDevInfoSet,
- devInstId,
- NULL,
- 0,
- &devInfoData))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- }
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // Get the length of the PDO name
- //
- if (!SetupDiGetDeviceRegistryProperty(hDevInfoSet,
- &devInfoData,
- SPDRP_PHYSICAL_DEVICE_OBJECT_NAME,
- NULL,
- (PBYTE)pdoName,
- 0,
- &pdoNameCb))
- {
- //
- // The only reason for this call is to get the length of the
- // buffer. The only non acceptable reason for failure is, if we
- // asked for invalid data.
- //
- if (GetLastError() == ERROR_INVALID_DATA)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- }
- }
- }
-
- //
- // Get the PDO name
- //
- if (SUCCEEDED(hr))
- {
- pdoName = (WCHAR *)new BYTE[pdoNameCb];
-
- if (pdoName == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- }
-
- if (SUCCEEDED(hr))
- {
- if (!SetupDiGetDeviceRegistryProperty(hDevInfoSet,
- &devInfoData,
- SPDRP_PHYSICAL_DEVICE_OBJECT_NAME,
- NULL,
- (PBYTE)pdoName,
- pdoNameCb,
- NULL))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- }
-
- }
-
- if (SUCCEEDED(hr))
- {
- *PdoName = pdoName;
- }
-
- //
- // clean up to be done regardless of success or failure
- //
- if (NULL != devInstId)
- {
- delete[] devInstId;
- }
-
- if (INVALID_HANDLE_VALUE != hDevInfoSet)
- {
- SetupDiDestroyDeviceInfoList(hDevInfoSet);
- }
-
- //
- // clean up to be done in case of failure only
- //
- if (FAILED(hr))
- {
- if (NULL != pdoName)
- {
- delete[] pdoName;
- pdoName = NULL;
- }
- }
-
- return hr;
-}
diff --git a/serial/VirtualSerial/device.h b/serial/VirtualSerial/device.h
deleted file mode 100644
index 1fc54aeb..00000000
--- a/serial/VirtualSerial/device.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF VirtualSerial sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "initguid.h"
-#include "serial.h"
-
-DEFINE_GUID(GUID_DEVINTERFACE_MODEM, 0x2c7089aa, 0x2e0e, 0x11d1, 0xb1, 0x14, 0x00, 0xc0, 0x4f, 0xc2, 0xaa, 0xe4);
-DEFINE_GUID(GUID_DEVINTERFACE_COMPORT, 0x86e0d1e0L, 0x8089, 0x11d0, 0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73);
-
-#define SYMBOLIC_LINK_NAME_PREFIX L"\\DosDevices\\Global\\"
-
-//
-// Class for the VirtualSerial driver.
-//
-
-class CMyDevice :
- public CUnknown,
- public IObjectCleanup
-{
-
-//
-// Private data members.
-//
-private:
-
- IWDFDevice *m_FxDevice;
-
- //
- // Baud rate
- //
- ULONG m_BaudRate;
-
- //
- // Modem control register
- //
- ULONG m_MCR;
-
- //
- // FIFO control register
- //
- ULONG m_FCR;
-
- //
- // Line control register
- //
- ULONG m_LCR;
-
- //
- // Valid data mask
- //
- UCHAR m_ValidDataMask;
-
- //
- // Timeouts
- //
- SERIAL_TIMEOUTS m_Timeouts;
-
- //
- // Legacy hardware key property store
- //
- BOOL m_CreatedLegacyHardwareKey;
-
- IWDFNamedPropertyStore2 * m_LegacyHardwarePropertyStore;
-
- PWCHAR m_PdoName;
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- ) :
- m_FxDevice(NULL),
- m_BaudRate(0),
- m_MCR(0),
- m_FCR(0),
- m_LCR(0),
- m_ValidDataMask(0),
- m_CreatedLegacyHardwareKey(FALSE),
- m_LegacyHardwarePropertyStore(NULL),
- m_PdoName(NULL)
- {
- ZeroMemory(&m_Timeouts, sizeof(SERIAL_TIMEOUTS));
- }
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- HRESULT
- CMyDevice::GetPdoName(
- _Out_ LPWSTR *PdoName
- );
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- HRESULT
- Configure(
- VOID
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IObjectCleanup
- //
- IObjectCleanup *
- QueryIObjectCleanup(
- VOID
- )
- {
- AddRef();
- return static_cast<IObjectCleanup *>(this);
- }
-
- virtual
- void
- STDMETHODCALLTYPE
- OnCleanup(
- IWDFObject* pWdfObject
- );
-
-
- ULONG
- GetBaudRate(
- VOID
- )
- {
- return m_BaudRate;
- }
-
- void
- SetBaudRate(
- _In_ ULONG BaudRate
- )
- {
- m_BaudRate = BaudRate;
-
- return;
- }
-
- ULONG *
- GetModemControlRegisterPtr(
- VOID
- )
- {
- return &m_MCR;
- }
-
- ULONG *
- GetFifoControlRegisterPtr(
- VOID
- )
- {
- return &m_FCR;
- }
-
- ULONG *
- GetLineControlRegisterPtr(
- VOID
- )
- {
- return &m_LCR;
- }
-
- VOID
- SetValidDataMask(
- _In_ UCHAR Mask
- )
- {
- m_ValidDataMask = Mask;
- }
-
- VOID
- SetTimeouts(
- _In_ SERIAL_TIMEOUTS Timeouts
- )
- {
- m_Timeouts = Timeouts;
- }
-
- VOID
- GetTimeouts(
- _Out_ SERIAL_TIMEOUTS *Timeouts
- )
- {
- *Timeouts = m_Timeouts;;
- }
-
-};
diff --git a/serial/VirtualSerial/dllsup.cpp b/serial/VirtualSerial/dllsup.cpp
deleted file mode 100644
index 6c254085..00000000
--- a/serial/VirtualSerial/dllsup.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF VirtualSerial Sample
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example, VirtualSerial uses
- L"Microsoft\\UMDF\\VirtualSerial"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
-
- UNREFERENCED_PARAMETER( ModuleHandle );
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
-
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- _In_ REFCLSID ClassId,
- _In_ REFIID InterfaceId,
- _Outptr_ LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/serial/VirtualSerial/driver.cpp b/serial/VirtualSerial/driver.cpp
deleted file mode 100644
index 0ec28ec5..00000000
--- a/serial/VirtualSerial/driver.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF VirtualSerial Sample's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // TODO: Do any per-device initialization (reading settings from the
- // registry for example) that's necessary before creating your
- // device callback object here. Otherwise you can leave such
- // initialization to the initialization of the device event
- // handler.
- //
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // TODO: Change any per-device settings that the object exposes before
- // calling Configure to let it complete its initialization.
- //
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/serial/VirtualSerial/driver.h b/serial/VirtualSerial/driver.h
deleted file mode 100644
index 5be609b1..00000000
--- a/serial/VirtualSerial/driver.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF VirtualSerial sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the VirtualSerial sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER( FxWdfDriver );
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER( FxWdfDriver );
-
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
diff --git a/serial/VirtualSerial/internal.h b/serial/VirtualSerial/internal.h
deleted file mode 100644
index dd89de21..00000000
--- a/serial/VirtualSerial/internal.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF VirtualSerial
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#include <windows.h>
-#include <devioctl.h>
-#include <ntddser.h>
-#include <setupapi.h>
-#include <strsafe.h>
-#include <intsafe.h>
-
-//
-// Include the WUDF DDI
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-typedef class CRingBuffer *PCMyRingBuffer;
-
-//
-// Define useful macros
-//
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
-
-//
-// Define the tracing flags.
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- MyDriverTraceControl, (C31877A2,C8C8,4c58,B5B8,7D6311D5E343), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\VirtualSerial"
-#define MYDRIVER_CLASS_ID { 0xc8ecc087, 0x6b79, 0x4de5, { 0x8f, 0xb4, 0xc0, 0x33, 0x58, 0xa2, 0x96, 0x17 } }
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_TEST_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define MAXULONG 0xffffffff
-
-//
-// Device states
-//
-#define COMMAND_MATCH_STATE_IDLE 0
-#define COMMAND_MATCH_STATE_GOT_A 1
-#define COMMAND_MATCH_STATE_GOT_T 2
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "ringbuffer.h"
-#include "queue.h"
-#include "serial.h"
diff --git a/serial/VirtualSerial/queue.cpp b/serial/VirtualSerial/queue.cpp
deleted file mode 100644
index 5a7b5bad..00000000
--- a/serial/VirtualSerial/queue.cpp
+++ /dev/null
@@ -1,1188 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-
-#include "internal.h"
-
-//
-// IUnknown implementation
-//
-
-//
-// Queue destructor.
-// Free up the buffer, wait for thread to terminate and
-// delete critical section.
-//
-
-
-CMyQueue::~CMyQueue(
- VOID
- )
-/*++
-
-Routine Description:
-
-
- IUnknown implementation of Release
-
-Arguments:
-
-
-Return Value:
-
---*/
-{
- WUDF_TEST_DRIVER_ASSERT(m_Device);
-
- m_Device->Release();
-}
-
-
-//
-// Initialize
-HRESULT
-CMyQueue::CreateInstance(
- _In_ CMyDevice *pDevice,
- _In_ IWDFDevice *FxDevice,
- _Out_ PCMyQueue *Queue
- )
-/*++
-
-Routine Description:
-
-
- CreateInstance creates an instance of the queue object.
-
-Arguments:
-
- ppUkwn - OUT parameter is an IUnknown interface to the queue object
-
-Return Value:
-
- HRESULT indicating success or failure
-
---*/
-{
- CMyQueue *pMyQueue = new CMyQueue(pDevice);
- HRESULT hr;
-
- if (pMyQueue == NULL) {
- return E_OUTOFMEMORY;
- }
-
- hr = pMyQueue->Initialize(FxDevice);
-
- if (SUCCEEDED(hr))
- {
- *Queue = pMyQueue;
- }
- else
- {
- pMyQueue->Release();
- }
- return hr;
-}
-
-HRESULT
-CMyQueue::Initialize(
- _In_ IWDFDevice *FxDevice
- )
-{
- IWDFIoQueue *fxQueue;
- IUnknown *unknown = NULL;
- HRESULT hr;
-
- //
- // Initialize ring buffer
- //
-
- hr = m_RingBuffer.Initialize(DATA_BUFFER_SIZE);
-
- if (FAILED(hr))
- {
- goto Exit;
- }
-
- unknown = QueryIUnknown();
-
- //
- // Create the default queue
- //
-
- {
- hr = FxDevice->CreateIoQueue(unknown,
- TRUE,
- WdfIoQueueDispatchParallel,
- TRUE,
- FALSE,
- &fxQueue);
- }
-
- if (FAILED(hr))
- {
- goto Exit;
- }
-
- m_FxQueue = fxQueue;
-
- fxQueue->Release();
-
- //
- // Create a manual queue to hold pending read requests. By keeping
- // them in the queue, framework takes care of cancelling them if the app
- // exits
- //
-
- {
- hr = FxDevice->CreateIoQueue(NULL,
- FALSE,
- WdfIoQueueDispatchManual,
- TRUE,
- FALSE,
- &fxQueue);
- }
-
- if (FAILED(hr))
- {
- goto Exit;
- }
-
- m_FxReadQueue = fxQueue;
-
- fxQueue->Release();
-
- //
- // Create a manual queue to hold pending ioctl wait-on-mask requests.
- //
-
- {
- hr = FxDevice->CreateIoQueue(NULL,
- FALSE,
- WdfIoQueueDispatchManual,
- TRUE,
- FALSE,
- &fxQueue);
- }
-
- if (FAILED(hr))
- {
- goto Exit;
- }
-
- m_FxWaitMaskQueue = fxQueue;
-
- fxQueue->Release();
-
-Exit:
- SAFE_RELEASE(unknown);
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CMyQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Arguments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicating success or failure
-
---*/
-{
- HRESULT hr;
-
-
- if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackWrite))) {
- *Object = QueryIQueueCallbackWrite();
- hr = S_OK;
- } else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackRead))) {
- *Object = QueryIQueueCallbackRead();
- hr = S_OK;
- } else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackDeviceIoControl))) {
- *Object = QueryIQueueCallbackDeviceIoControl();
- hr = S_OK;
- } else {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyQueue::OnDeviceIoControl(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- DeviceIoControl dispatch routine
-
-Arguments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- ControlCode - IO Control Code
- InputBufferSizeInBytes - Length of input buffer
- OutputBufferSizeInBytes - Length of output buffer
-
- Always succeeds DeviceIoIoctl
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(OutputBufferSizeInBytes);
- UNREFERENCED_PARAMETER(InputBufferSizeInBytes);
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- HRESULT hr = S_OK;
- SIZE_T reqCompletionInfo = 0;
- IWDFMemory *inputMemory = NULL;
- IWDFMemory *outputMemory = NULL;
- UINT i;
-
- WUDF_TEST_DRIVER_ASSERT(pWdfRequest);
- WUDF_TEST_DRIVER_ASSERT(m_Device);
-
- switch (ControlCode)
- {
- case IOCTL_SERIAL_SET_BAUD_RATE:
- {
- //
- // This is a driver for a virtual serial port. Since there is no
- // actual hardware, we just store the baud rate and don't do
- // anything with it.
- //
- SERIAL_BAUD_RATE baudRateBuffer = {0};
-
- pWdfRequest->GetInputMemory(&inputMemory);
- if (NULL == inputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = inputMemory->CopyToBuffer(0,
- (void*) &baudRateBuffer,
- sizeof(SERIAL_BAUD_RATE));
- }
-
- if (SUCCEEDED(hr))
- {
- m_Device->SetBaudRate(baudRateBuffer.BaudRate);
- }
-
- break;
- }
- case IOCTL_SERIAL_GET_BAUD_RATE:
- {
- SERIAL_BAUD_RATE baudRateBuffer = {0};
-
- baudRateBuffer.BaudRate = m_Device->GetBaudRate();
-
- pWdfRequest->GetOutputMemory(&outputMemory);
- if (NULL == outputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = outputMemory->CopyFromBuffer(0,
- (void*) &baudRateBuffer,
- sizeof(SERIAL_BAUD_RATE));
- }
-
- if (SUCCEEDED(hr))
- {
- reqCompletionInfo = sizeof(SERIAL_BAUD_RATE);
- }
-
- break;
- }
- case IOCTL_SERIAL_SET_MODEM_CONTROL:
- {
- //
- // This is a driver for a virtual serial port. Since there is no
- // actual hardware, we just store the modem control register
- // configuration and don't do anything with it.
- //
- ULONG *pModemControlRegister = NULL;
-
- pWdfRequest->GetInputMemory(&inputMemory);
- if (NULL == inputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- pModemControlRegister = m_Device->GetModemControlRegisterPtr();
- WUDF_TEST_DRIVER_ASSERT(pModemControlRegister);
-
- hr = inputMemory->CopyToBuffer(0,
- (void*) pModemControlRegister,
- sizeof(ULONG));
- }
-
- break;
- }
- case IOCTL_SERIAL_GET_MODEM_CONTROL:
- {
- ULONG *pModemControlRegister = NULL;
-
- pWdfRequest->GetOutputMemory(&outputMemory);
- if (NULL == outputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- pModemControlRegister = m_Device->GetModemControlRegisterPtr();
- WUDF_TEST_DRIVER_ASSERT(pModemControlRegister);
-
- hr = outputMemory->CopyFromBuffer(0,
- (void*) pModemControlRegister,
- sizeof(ULONG));
- }
-
- if (SUCCEEDED(hr))
- {
- reqCompletionInfo = sizeof(ULONG);
- }
-
- break;
- }
- case IOCTL_SERIAL_SET_FIFO_CONTROL:
- {
- //
- // This is a driver for a virtual serial port. Since there is no
- // actual hardware, we just store the FIFO control register
- // configuration and don't do anything with it.
- //
- ULONG *pFifoControlRegister = NULL;
-
- pWdfRequest->GetInputMemory(&inputMemory);
- if (NULL == inputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- pFifoControlRegister = m_Device->GetFifoControlRegisterPtr();
-
- hr = inputMemory->CopyToBuffer(0,
- (void*) pFifoControlRegister,
- sizeof(ULONG));
- }
-
- break;
- }
- case IOCTL_SERIAL_GET_LINE_CONTROL:
- {
- ULONG *pLineControlRegister = NULL;
- SERIAL_LINE_CONTROL lineControl = {0};
- ULONG lineControlSnapshot;
-
- pLineControlRegister = m_Device->GetLineControlRegisterPtr();
- WUDF_TEST_DRIVER_ASSERT(pLineControlRegister);
-
- //
- // Take a snapshot of the line control register variable
- //
- lineControlSnapshot = *pLineControlRegister;
-
- //
- // Decode the word length
- //
- if ((lineControlSnapshot & SERIAL_DATA_MASK) == SERIAL_5_DATA)
- {
- lineControl.WordLength = 5;
- }
- else if ((lineControlSnapshot & SERIAL_DATA_MASK) == SERIAL_6_DATA)
- {
- lineControl.WordLength = 6;
- }
- else if ((lineControlSnapshot & SERIAL_DATA_MASK) == SERIAL_7_DATA)
- {
- lineControl.WordLength = 7;
- }
- else if ((lineControlSnapshot & SERIAL_DATA_MASK) == SERIAL_8_DATA)
- {
- lineControl.WordLength = 8;
- }
-
- //
- // Decode the parity
- //
- if ((lineControlSnapshot & SERIAL_PARITY_MASK) == SERIAL_NONE_PARITY)
- {
- lineControl.Parity = NO_PARITY;
- }
- else if ((lineControlSnapshot & SERIAL_PARITY_MASK) == SERIAL_ODD_PARITY)
- {
- lineControl.Parity = ODD_PARITY;
- }
- else if ((lineControlSnapshot & SERIAL_PARITY_MASK) == SERIAL_EVEN_PARITY)
- {
- lineControl.Parity = EVEN_PARITY;
- }
- else if ((lineControlSnapshot & SERIAL_PARITY_MASK) == SERIAL_MARK_PARITY)
- {
- lineControl.Parity = MARK_PARITY;
- }
- else if ((lineControlSnapshot & SERIAL_PARITY_MASK) == SERIAL_SPACE_PARITY)
- {
- lineControl.Parity = SPACE_PARITY;
- }
-
- //
- // Decode the length of the stop bit
- //
- if (lineControlSnapshot & SERIAL_2_STOP)
- {
- if (lineControl.WordLength == 5)
- {
- lineControl.StopBits = STOP_BITS_1_5;
- }
- else
- {
- lineControl.StopBits = STOP_BITS_2;
- }
- }
- else
- {
- lineControl.StopBits = STOP_BIT_1;
- }
-
- //
- // Copy the information that was decoded to the caller's buffer
- //
- pWdfRequest->GetOutputMemory(&outputMemory);
- if (NULL == outputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = outputMemory->CopyFromBuffer(0,
- (void*) &lineControl,
- sizeof(SERIAL_LINE_CONTROL));
- }
-
- if (SUCCEEDED(hr))
- {
- reqCompletionInfo = sizeof(SERIAL_LINE_CONTROL);
- }
-
- break;
- }
- case IOCTL_SERIAL_SET_LINE_CONTROL:
- {
- ULONG *pLineControlRegister = NULL;
- SERIAL_LINE_CONTROL lineControl = {0};
- UCHAR lineControlData = 0;
- UCHAR lineControlStop = 0;
- UCHAR lineControlParity = 0;
- ULONG lineControlSnapshot;
- ULONG lineControlNew;
- ULONG lineControlPrevious;
-
- pLineControlRegister = m_Device->GetLineControlRegisterPtr();
- WUDF_TEST_DRIVER_ASSERT(pLineControlRegister);
-
- //
- // This is a driver for a virtual serial port. Since there is no
- // actual hardware, we just store the line control register
- // configuration and don't do anything with it.
- //
- pWdfRequest->GetInputMemory(&inputMemory);
- if (NULL == inputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = inputMemory->CopyToBuffer(0,
- (void*) &lineControl,
- sizeof(SERIAL_LINE_CONTROL));
- }
-
- //
- // Bits 0 and 1 of the line control register
- //
- if (SUCCEEDED(hr))
- {
- switch (lineControl.WordLength)
- {
- case 5:
- lineControlData = SERIAL_5_DATA;
- m_Device->SetValidDataMask(0x1f);
- break;
-
- case 6:
- lineControlData = SERIAL_6_DATA;
- m_Device->SetValidDataMask(0x3f);
- break;
-
- case 7:
- lineControlData = SERIAL_7_DATA;
- m_Device->SetValidDataMask(0x7f);
- break;
-
- case 8:
- lineControlData = SERIAL_8_DATA;
- m_Device->SetValidDataMask(0xff);
- break;
-
- default:
- hr = E_INVALIDARG;
- }
- }
-
- //
- // Bit 2 of the line control register
- //
- if (SUCCEEDED(hr))
- {
- switch (lineControl.StopBits)
- {
- case STOP_BIT_1:
- lineControlStop = SERIAL_1_STOP;
- break;
-
- case STOP_BITS_1_5:
- if (lineControlData != SERIAL_5_DATA)
- {
- hr = E_INVALIDARG;
- break;
- }
- lineControlStop = SERIAL_1_5_STOP;
- break;
-
- case STOP_BITS_2:
- if (lineControlData == SERIAL_5_DATA)
- {
- hr = E_INVALIDARG;
- break;
- }
- lineControlStop = SERIAL_2_STOP;
- break;
-
- default:
- hr = E_INVALIDARG;
- }
- }
-
- //
- // Bits 3, 4 and 5 of the line control register
- //
- if (SUCCEEDED(hr))
- {
- switch (lineControl.Parity)
- {
- case NO_PARITY:
- lineControlParity = SERIAL_NONE_PARITY;
- break;
-
- case EVEN_PARITY:
- lineControlParity = SERIAL_EVEN_PARITY;
- break;
-
- case ODD_PARITY:
- lineControlParity = SERIAL_ODD_PARITY;
- break;
-
- case SPACE_PARITY:
- lineControlParity = SERIAL_SPACE_PARITY;
- break;
-
- case MARK_PARITY:
- lineControlParity = SERIAL_MARK_PARITY;
- break;
-
- default:
- hr = E_INVALIDARG;
- }
- }
-
- //
- // Update our line control register variable atomically
- //
- i=0;
- do
- {
- i++;
- if ((i & 0xf) == 0)
- {
- //
- // We've been spinning in a loop for a while trying to
- // update the line control register variable atomically.
- // Yield the CPU for other threads for a while.
- //
- SwitchToThread();
- }
-
- lineControlSnapshot = *pLineControlRegister;
-
- lineControlNew = (lineControlSnapshot & SERIAL_LCR_BREAK) |
- (lineControlData |
- lineControlParity |
- lineControlStop);
-
- lineControlPrevious = InterlockedCompareExchange((LONG *) pLineControlRegister,
- lineControlNew,
- lineControlSnapshot);
-
- } while (lineControlPrevious != lineControlSnapshot);
-
- break;
- }
- case IOCTL_SERIAL_GET_TIMEOUTS:
- {
- SERIAL_TIMEOUTS timeoutValues = {0};
-
- pWdfRequest->GetOutputMemory(&outputMemory);
- if (NULL == outputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- m_Device->GetTimeouts(&timeoutValues);
-
- hr = outputMemory->CopyFromBuffer(0,
- (void*) &timeoutValues,
- sizeof(timeoutValues));
- }
-
- if (SUCCEEDED(hr))
- {
- reqCompletionInfo = sizeof(SERIAL_TIMEOUTS);
- }
-
- break;
- }
- case IOCTL_SERIAL_SET_TIMEOUTS:
- {
- SERIAL_TIMEOUTS timeoutValues = {0};
-
- pWdfRequest->GetInputMemory(&inputMemory);
- if (NULL == inputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = inputMemory->CopyToBuffer(0,
- (void*) &timeoutValues,
- sizeof(timeoutValues));
- }
-
- if (SUCCEEDED(hr))
- {
- if ((timeoutValues.ReadIntervalTimeout == MAXULONG) &&
- (timeoutValues.ReadTotalTimeoutMultiplier == MAXULONG) &&
- (timeoutValues.ReadTotalTimeoutConstant == MAXULONG))
- {
- hr = E_INVALIDARG;
- }
- }
-
- if (SUCCEEDED(hr))
- {
- m_Device->SetTimeouts(timeoutValues);
- }
-
- break;
- }
- case IOCTL_SERIAL_WAIT_ON_MASK:
- {
- //
- // NOTE: the contract is that this ioctl should be marked pending
- // and not to be completed until some wait event happens. Therefore
- // it is incorrect for the driver to complete the ioctl right away,
- // no matter whether success or failure is returned. In either case
- // most likely the app will send down another iocl of wait-on-mask
- // in a tight loop, and that gets completed again, and again.
- // The end result will be high CPU utilization in task manager.
- //
- // The correct way would be to mark the ioctl as pending, or as in
- // WDF world, keep it in a manual queue. Since this is a driver for
- // a virtual serial port and there is no actual hardware, there will
- // be no wait event happening. The ioctl stays in the queue until
- // the calling app decides to no longer wait for it by means of
- // sending down a set-wait-mask request.
- //
-
- //
- // At most one pending wait-on-mask request is expected
- //
- IWDFIoRequest *pSavedRequest;
- hr = m_FxWaitMaskQueue->RetrieveNextRequest(&pSavedRequest);
- if (SUCCEEDED(hr))
- {
- pSavedRequest->Complete(E_FAIL);
-
- //
- // RetrieveNextRequest from a manual queue increments the reference
- // counter by 1. We need to decrement it, otherwise the request will
- // not be released and there will be an object leak.
- //
- SAFE_RELEASE(pSavedRequest);
- }
-
- //
- // Keep the request in a manual queue and the framework will take
- // care of cancelling them when the app exits.
- //
- pWdfRequest->ForwardToIoQueue(m_FxWaitMaskQueue);
-
- //
- // Instead of "break" out of the switch statement and complete the
- // request at the end of this function, use "return" directly.
- //
- return;
- }
- case IOCTL_SERIAL_SET_WAIT_MASK:
- {
- //
- // NOTE: the contract says a set-wait-mask will cause any pending
- // wait-on-mask to complete with STATUS_SUCCESS and the output wait
- // event mask is set to zero. This is also the way for app to break
- // out of the loop of sending down wait-on-mask
- //
-
- IWDFIoRequest *pSavedRequest;
- hr = m_FxWaitMaskQueue->RetrieveNextRequest(&pSavedRequest);
- if (SUCCEEDED(hr))
- {
- pSavedRequest->GetOutputMemory(&outputMemory);
- if (NULL == outputMemory)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
- }
-
- if (SUCCEEDED(hr))
- {
- ULONG eventMask = 0;
-
- hr = outputMemory->CopyFromBuffer(0,
- (void*) &eventMask,
- sizeof(eventMask));
-
- pSavedRequest->CompleteWithInformation(hr, sizeof(eventMask));
- }
- else
- {
- pSavedRequest->Complete(hr);
- }
-
- SAFE_RELEASE(pSavedRequest);
-
- //
- // outputMemory will be released at the end of the function
- //
- }
-
- //
- // NOTE: The application expects STATUS_SUCCESS for these IOCTLs.
- //
- hr = S_OK;
-
- break;
- }
- case IOCTL_SERIAL_SET_QUEUE_SIZE:
- case IOCTL_SERIAL_SET_DTR:
- case IOCTL_SERIAL_SET_RTS:
- case IOCTL_SERIAL_CLR_RTS:
- case IOCTL_SERIAL_SET_XON:
- case IOCTL_SERIAL_SET_XOFF:
- case IOCTL_SERIAL_SET_CHARS:
- case IOCTL_SERIAL_GET_CHARS:
- case IOCTL_SERIAL_GET_HANDFLOW:
- case IOCTL_SERIAL_SET_HANDFLOW:
- case IOCTL_SERIAL_RESET_DEVICE:
- {
- //
- // NOTE: The application expects STATUS_SUCCESS for these IOCTLs.
- // so don't merge this with default.
- //
- break;
- }
-
- default:
- {
- hr = E_INVALIDARG;
- }
- }
-
- //
- // clean up
- //
- if (inputMemory)
- {
- inputMemory->Release();
- }
-
- if (outputMemory)
- {
- outputMemory->Release();
- }
-
- //
- // complete the request
- //
- pWdfRequest->CompleteWithInformation(hr, reqCompletionInfo);
-
- return;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyQueue::OnWrite(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToWrite
- )
-/*++
-
-Routine Description:
-
-
- Write dispatch routine
- IQueueCallbackWrite
-
-Arguments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToWrite - Length of bytes in the write buffer
-
- Allocate and copy data to local buffer
-Return Value:
-
- VOID
-
---*/
-{
- IWDFMemory* pRequestMemory = NULL;
- IWDFIoRequest* pSavedRequest = NULL;
- SIZE_T availableData = 0;
- SIZE_T savedRequestBufferSize = 0;
- HRESULT hr = S_OK;
-
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- //
- // Get memory object
- //
-
- pWdfRequest->GetInputMemory(&pRequestMemory);
-
- //
- // Process input
- //
-
- ProcessWriteBytes((PUCHAR)pRequestMemory->GetDataBuffer(NULL), BytesToWrite);
-
- //
- // Release memory object and complete request
- //
- SAFE_RELEASE(pRequestMemory);
- pWdfRequest->CompleteWithInformation(hr, BytesToWrite);
-
- //
- // Get the amount of data available in the ring buffer
- //
- m_RingBuffer.GetAvailableData(&availableData);
-
- if (availableData > 0)
- {
- //
- // Continue with the next request, if there is one pending
- //
- hr = m_FxReadQueue->RetrieveNextRequest(&pSavedRequest);
- if ((pSavedRequest == NULL) || (FAILED(hr)))
- {
- goto Exit;
- }
-
- pSavedRequest->GetReadParameters(&savedRequestBufferSize, NULL, NULL);
-
- OnRead(m_FxQueue,
- pSavedRequest,
- savedRequestBufferSize);
-
- //
- // RetrieveNextRequest from a manual queue increments the reference
- // counter by 1. We need to decrement it, otherwise the request will
- // not be released and there will be an object leak.
- //
- SAFE_RELEASE(pSavedRequest);
- }
-
-Exit:
- return;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyQueue::OnRead(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T SizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- Read dispatch routine
- IQueueCallbackRead
-
-Arguments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- SizeInBytes - Length of bytes in the read buffer
-
- Copy available data into the read buffer
-Return Value:
-
- VOID
-
---*/
-{
- IWDFMemory* pRequestMemory = NULL;
- SIZE_T BytesCopied = 0;
- HRESULT hr;
-
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- //
- // Get memory object
- //
- pWdfRequest->GetOutputMemory(&pRequestMemory);
-
- hr = m_RingBuffer.Read((PBYTE)pRequestMemory->GetDataBuffer(NULL),
- SizeInBytes,
- &BytesCopied);
-
- //
- // Release memory object.
- //
- SAFE_RELEASE(pRequestMemory);
-
- if (FAILED(hr))
- {
- //
- // Error reading buffer
- //
- pWdfRequest->Complete(hr);
- goto Exit;
- }
-
- if (BytesCopied > 0)
- {
- //
- // Data was read from buffer succesfully
- //
- pWdfRequest->CompleteWithInformation(hr, BytesCopied);
- }
- else
- {
- //
- // No data to read. Queue the request for later processing.
- //
- pWdfRequest->ForwardToIoQueue(m_FxReadQueue);
- }
-
-Exit:
- return;
-}
-
-VOID
-CMyQueue::ProcessWriteBytes(
- _In_reads_bytes_(Length) PUCHAR Characters,
- _In_ SIZE_T Length
- )
-/*++
-Routine Description:
-
- This function is called when the framework receives IRP_MJ_WRITE
- requests from the system. The write event handler(FmEvtIoWrite) calls ProcessWriteBytes.
- It parses the Characters passed in and looks for the for sequences "AT" -ok ,
- "ATA" --CONNECT, ATD<number> -- CONNECT and sets the state of the device appropriately.
- These bytes are placed in the read Buffer to be processed later since this device
- works in a loopback fashion.
-
-
-Arguments:
-
- Characters - Pointer to the write IRP's system buffer.
-
- Length - Length of the IO operation
- The default property of the queue is to not dispatch
- zero lenght read & write requests to the driver and
- complete is with status success. So we will never get
- a zero length request.
-
-Return Value:
-
- VOID
-
---*/
-
-{
-
- UCHAR currentCharacter;
- UCHAR connectString[] = "\r\nCONNECT\r\n";
- UCHAR connectStringCch = ARRAY_SIZE(connectString) - 1;
- UCHAR okString[] = "\r\nOK\r\n";
- UCHAR okStringCch = ARRAY_SIZE(okString) - 1;
-
- while (Length != 0) {
-
- currentCharacter = *(Characters++);
- Length--;
-
- if(currentCharacter == '\0')
- {
- continue;
- }
-
- m_RingBuffer.Write(&currentCharacter, sizeof(currentCharacter));
-
- switch (m_CommandMatchState) {
- case COMMAND_MATCH_STATE_IDLE:
- if ((currentCharacter == 'a') || (currentCharacter == 'A'))
- {
- //
- // got an A
- //
- m_CommandMatchState=COMMAND_MATCH_STATE_GOT_A;
- m_ConnectCommand=FALSE;
- m_IgnoreNextChar=FALSE;
- }
-
- break;
-
- case COMMAND_MATCH_STATE_GOT_A:
- if ((currentCharacter == 't') || (currentCharacter == 'T'))
- {
- //
- // got a T
- //
- m_CommandMatchState=COMMAND_MATCH_STATE_GOT_T;
- }
- else
- {
- m_CommandMatchState=COMMAND_MATCH_STATE_IDLE;
- }
-
- break;
-
- case COMMAND_MATCH_STATE_GOT_T:
-
- if (!m_IgnoreNextChar)
- {
- //
- // the last char was not a special char
- // check for CONNECT command
- //
- if ((currentCharacter == 'A') || (currentCharacter == 'a'))
- {
-
- m_ConnectCommand=TRUE;
- }
-
- if ((currentCharacter == 'D') || (currentCharacter == 'd'))
- {
-
- m_ConnectCommand=TRUE;
- }
- }
-
- m_IgnoreNextChar=TRUE;
-
- if (currentCharacter == '\r')
- {
- //
- // got a CR, send a response to the command
- //
- m_CommandMatchState = COMMAND_MATCH_STATE_IDLE;
-
- if (m_ConnectCommand)
- {
- //
- // place <cr><lf>CONNECT<cr><lf> in the buffer
- //
- m_RingBuffer.Write(connectString, connectStringCch);
-
- //
- // connected now raise CD
- //
- m_CurrentlyConnected = TRUE;
- m_ConnectionStateChanged = TRUE;
-
- }
- else
- {
- //
- // place <cr><lf>OK<cr><lf> in the buffer
- //
- m_RingBuffer.Write(okString, okStringCch);
- }
- }
-
- break;
- default:
- break;
- }
- }
- return;
-}
diff --git a/serial/VirtualSerial/queue.h b/serial/VirtualSerial/queue.h
deleted file mode 100644
index 445ee48e..00000000
--- a/serial/VirtualSerial/queue.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#include "internal.h"
-
-// Set ring buffer size
-#define DATA_BUFFER_SIZE 1024
-
-//
-// Macro definition for defining IOCTL and FSCTL function control codes. Note
-// that function codes 0-2047 are reserved for Microsoft Corporation, and
-// 2048-4095 are reserved for customers.
-//
-
-#define CTL_CODE( DeviceType, Function, Method, Access ) ( \
- ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
-)
-
-
-//
-// Queue Callback Object.
-//
-
-class CMyQueue :
- public IQueueCallbackDeviceIoControl,
- public IQueueCallbackRead,
- public IQueueCallbackWrite,
- public CUnknown
-{
- UCHAR m_CommandMatchState; // Device state
- BOOL m_ConnectCommand;
- BOOL m_IgnoreNextChar;
- BOOL m_ConnectionStateChanged;
- BOOL m_CurrentlyConnected;
-
- IWDFIoQueue *m_FxQueue; // Default parallel queue
- IWDFIoQueue *m_FxReadQueue; // Manual queue for pending reads
- IWDFIoQueue *m_FxWaitMaskQueue; // Manual queue for pending ioctl wait-on-mask
-
- CRingBuffer m_RingBuffer; // Ring buffer for pending data
-
- PCMyDevice m_Device;
-
- CMyQueue(
- CMyDevice *pDevice
- ) :
- m_CommandMatchState(COMMAND_MATCH_STATE_IDLE),
- m_ConnectCommand(FALSE),
- m_IgnoreNextChar(FALSE),
- m_ConnectionStateChanged(FALSE),
- m_CurrentlyConnected(FALSE),
- m_FxQueue(NULL),
- m_FxReadQueue(NULL)
- {
- WUDF_TEST_DRIVER_ASSERT(pDevice);
-
- pDevice->AddRef();
- m_Device = pDevice;
- }
-
- virtual ~CMyQueue();
-
- HRESULT
- Initialize(
- _In_ IWDFDevice *FxDevice
- );
-
- VOID
- CMyQueue::ProcessWriteBytes(
- _In_reads_bytes_(Length) PUCHAR Characters,
- _In_ SIZE_T Length
- );
-
-public:
-
- static
- HRESULT
- CreateInstance(
- _In_ CMyDevice *pDevice,
- _In_ IWDFDevice *FxDevice,
- _Out_ PCMyQueue *Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return S_OK;
- }
-
-
- IQueueCallbackDeviceIoControl *
- QueryIQueueCallbackDeviceIoControl(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackDeviceIoControl *>(this);
- }
-
- IQueueCallbackRead *
- QueryIQueueCallbackRead(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackRead *>(this);
- }
-
- IQueueCallbackWrite *
- QueryIQueueCallbackWrite(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackWrite *>(this);
- }
-
- //
- // IUnknown
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- ) {
- return CUnknown::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- ) {
- return CUnknown::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // Wdf Callbacks
- //
-
- // IQueueCallbackDeviceIoControl
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeviceIoControl(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- );
-
- // IQueueCallbackWrite
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnWrite(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToWrite
- );
-
- // IQueueCallbackRead
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnRead(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToRead
- );
-};
diff --git a/serial/VirtualSerial/ringbuffer.cpp b/serial/VirtualSerial/ringbuffer.cpp
deleted file mode 100644
index fbbbd6b8..00000000
--- a/serial/VirtualSerial/ringbuffer.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-#include "internal.h"
-
-CRingBuffer::CRingBuffer(
- VOID
- ) : m_Size(0),
- m_Base(NULL),
- m_End(NULL),
- m_Head(NULL),
- m_Tail(NULL)
-{
- return;
-}
-
-CRingBuffer::~CRingBuffer(
- VOID
- )
-{
- if (m_Base)
- {
- delete[] m_Base;
- }
-}
-
-HRESULT
-CRingBuffer::Initialize(
- _In_ SIZE_T BufferSize
- )
-{
- HRESULT hr = S_OK;
- PBYTE buffer = NULL;
-
- if (0 == BufferSize)
- {
- hr = E_INVALIDARG;
- }
-
- //
- // Allocate the buffer.
- //
- if (SUCCEEDED(hr))
- {
- buffer = new BYTE[BufferSize];
- if (buffer == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- }
-
- //
- // Initialize the ring buffer pointers.
- //
- if (SUCCEEDED(hr))
- {
- m_Size = BufferSize;
- m_Base = buffer;
- m_End = buffer + BufferSize;
- m_Head = buffer;
- m_Tail = buffer;
- }
-
- if (FAILED(hr))
- {
- if (buffer)
- {
- delete[] buffer;
- m_Base = NULL;
- }
- }
-
- return hr;
-}
-
-HRESULT
-CRingBuffer::Write(
- _In_reads_bytes_(DataSize) PBYTE Data,
- _In_ SIZE_T DataSize
- )
-{
- SIZE_T availableSpace;
- SIZE_T bytesToCopy;
- SIZE_T spaceFromCurrToEnd;
-
- WUDF_TEST_DRIVER_ASSERT(Data && (0 != DataSize));
-
- if (m_Tail >= m_End)
- {
- return E_UNEXPECTED;
- }
-
- //
- // Get the amount of space available in the buffer
- //
- GetAvailableSpace(&availableSpace);
-
- //
- // If there is not enough space to fit in all the data passed in by the
- // caller then copy as much as possible and throw away the rest
- //
- if (availableSpace < DataSize)
- {
- bytesToCopy = availableSpace;
- }
- else
- {
- bytesToCopy = DataSize;
- }
-
- if (bytesToCopy)
- {
- //
- // The buffer has some space at least
- //
- if ((m_Tail+bytesToCopy) > m_End)
- {
- //
- // The data being written will wrap around the end of the buffer.
- // So the copy has to be done in two steps -
- // * X bytes from current position to end of the buffer
- // * the remaining (bytesToCopy - X) from the start of the buffer
- //
-
- //
- // The first step of the copy ...
- //
- spaceFromCurrToEnd = m_End - m_Tail;
- CopyMemory(m_Tail, Data, spaceFromCurrToEnd);
- Data += spaceFromCurrToEnd;
- bytesToCopy -= spaceFromCurrToEnd;
-
- //
- // The second step of the copy ...
- //
- CopyMemory(m_Base, Data, bytesToCopy);
-
- //
- // Advance the tail pointer
- //
- m_Tail = m_Base + bytesToCopy;
- }
- else
- {
- //
- // Data does NOT wrap around the end of the buffer. Just copy it
- // over in a single step
- //
- CopyMemory(m_Tail, Data, bytesToCopy);
-
- //
- // Advance the tail pointer
- //
- m_Tail += bytesToCopy;
- if (m_Tail == m_End)
- {
- //
- // We have exactly reached the end of the buffer. The next
- // write should wrap around and start from the beginning.
- //
- m_Tail = m_Base;
- }
- }
-
- WUDF_TEST_DRIVER_ASSERT(m_Tail < m_End);
- }
-
- return S_OK;
-}
-
-HRESULT
-CRingBuffer::Read(
- _Out_writes_bytes_to_(DataSize, *BytesCopied) PBYTE Data,
- _In_ SIZE_T DataSize,
- _Out_ SIZE_T *BytesCopied
- )
-{
- SIZE_T availableData;
- SIZE_T dataFromCurrToEnd;
-
- WUDF_TEST_DRIVER_ASSERT(Data && (DataSize != 0));
-
- if (m_Head >= m_End)
- {
- return E_UNEXPECTED;
- }
-
- //
- // Get the amount of data available in the buffer
- //
- GetAvailableData(&availableData);
-
- if (availableData == 0)
- {
- *BytesCopied = 0;
- return S_OK;
- }
-
- if (DataSize > availableData)
- {
- DataSize = availableData;
- }
-
- *BytesCopied = DataSize;
-
- if ((m_Head + DataSize) > m_End)
- {
- //
- // The data requested by the caller is wrapped around the end of the
- // buffer. So we'll do the copy in two steps -
- // * Copy X bytes from the current position to the end buffer into
- // the caller's buffer
- // * Copy (DataSize - X) bytes from the beginning to the buffer into
- // the caller's buffer
- //
-
- //
- // The first step of the copy ...
- //
- dataFromCurrToEnd = m_End - m_Head;
- CopyMemory(Data, m_Head, dataFromCurrToEnd);
- Data += dataFromCurrToEnd;
- DataSize -= dataFromCurrToEnd;
-
- //
- // The second step of the copy ...
- //
- CopyMemory(Data, m_Base, DataSize);
-
- //
- // Advance the head pointer
- //
- m_Head = m_Base + DataSize;
- }
- else
- {
- //
- // The data in the buffer is NOT wrapped around the end of the buffer.
- // Simply copy the data over to the caller's buffer in a single step.
- //
- CopyMemory(Data, m_Head, DataSize);
-
- //
- // Advance the head pointer
- //
- m_Head += DataSize;
- if (m_Head == m_End)
- {
- //
- // We have exactly reached the end of the buffer. The next
- // read should wrap around and start from the beginning.
- //
- m_Head = m_Base;
- }
- }
-
- WUDF_TEST_DRIVER_ASSERT(m_Head < m_End);
-
- return S_OK;
-}
-
diff --git a/serial/VirtualSerial/ringbuffer.h b/serial/VirtualSerial/ringbuffer.h
deleted file mode 100644
index 130055d9..00000000
--- a/serial/VirtualSerial/ringbuffer.h
+++ /dev/null
@@ -1,223 +0,0 @@
-#pragma once
-
-#include "internal.h"
-
-class CRingBuffer
-{
-private:
-
- //
- // Private local variables.
- //
-
- //
- // The size in bytes of the ring buffer.
- //
- SIZE_T m_Size;
-
- //
- // A pointer to the base of the ring buffer.
- //
- PBYTE m_Base;
-
- //
- // A pointer to the byte beyond the end of the ring buffer. Used for
- // quick comparisons when determining if we need to wrap.
- //
- PBYTE m_End;
-
- //
- // A pointer to the current read point in the ring buffer.
- //
- // Updates to this are not protected by any lock. This is different from
- // the write pointer, which is protected by the "pending read pointer"
- // lock. The reason for this difference is that in this driver, we do not
- // keep write requests pending. If there is not enough space to write all
- // the data that was requested, we write as much as we can and drop the
- // rest (lossy data transfer).
- //
- // If we had multiple threads modifying this pointer, then that would
- // provide yet another reason for protecting updates to the pointer using a
- // lock. However, in this driver, at any given time we have only one thread
- // that modifies this pointer (the thread that runs the read callback).
- // This is true because we use a sequential queue for read requests. If we
- // were to change our read queue to be a parallel queue, this would no
- // longer be true.
- //
- //
- PBYTE m_Head;
-
- //
- // A pointer to the current write point in the ring buffer.
- //
- // Updates to this pointer are protected by the "pending read pointer
- // lock", because we do not want a consumer thread to mark a read request
- // as pending while we are in the process of writing data to the buffer.
- // The reason is that the write that we are currently performing might
- // actually supply enough data to satisfy the read request, in which case
- // it should not be marked pending at all.
- // If the read request were to be marked pending in the situation described
- // above, then we would need some trigger to later retrieve the request and
- // complete it. In our driver, arrival of data is the only event that can
- // trigger this. So if no more data arrives, the request will remain
- // pending forever, even though there is enough data in the buffer to
- // complete it. Hence we do not keep a read request pending in situations
- // where the read buffer contains enough data to satisfy it.
- //
- // If we had multiple threads modifying this pointer, then that would
- // provide yet another reason for protecting updates to the pointer using a
- // lock. However, in this driver, at any given time we have only one thread
- // that modifies this pointer (the thread that runs the write callback).
- // This is true because we use a sequential queue for write requests. If we
- // were to change our write queue to be a parallel queue, this would no
- // longer be true.
- //
- PBYTE m_Tail;
-
-private:
-
- //
- // Private Internal Methods.
- //
- void
- GetAvailableSpace(
- _Out_ SIZE_T *AvailableSpace
- )
- {
- WUDF_TEST_DRIVER_ASSERT(AvailableSpace);
-
- PBYTE headSnapshot = NULL;
- PBYTE tailSnapshot = NULL;
- PBYTE tailPlusOne = NULL;
-
- //
- // Take a snapshot of the head and tail pointers. We will compute the
- // available space based on this snapshot. This is safe to do in a
- // single-producer, single-consumer model, because -
- // * A producer will call GetAvailableSpace() to determine whether
- // there is enough space to write the data it is trying to write.
- // The only other thread that could modify the amount of space
- // available is the consumer thread, which can only increase the
- // amount of space available. Hence it is safe for the producer
- // to write based on this snapshot.
- // * A consumer thread will call GetAvailableSpace() to determine
- // whether there is enough data in the buffer for it to read.
- // (Available data = Buffer size - Available space). The only
- // other thread that could modify the amount of space available
- // is the producer thread, which can only decrease the amount of
- // space available (thereby increasing the amount of data
- // available. Hence it is safe for the consumer to read based on
- // this snapshot.
- //
- headSnapshot = m_Head;
- tailSnapshot = m_Tail;
-
- //
- // In order to distinguish between a full buffer and an empty buffer,
- // we always leave the last byte of the buffer unused. So, an empty
- // buffer is denoted by -
- // tail == head
- // ... and a full buffer is denoted by -
- // (tail+1) == head
- //
- tailPlusOne = ((tailSnapshot+1) == m_End) ? m_Base : (tailSnapshot+1);
-
- if (tailPlusOne == headSnapshot)
- {
- //
- // Buffer full
- //
- *AvailableSpace = 0;
- }
- else if (tailSnapshot == headSnapshot)
- {
- //
- // Buffer empty
- // The -1 in the computation below is to account for the fact that
- // we always leave the last byte of the ring buffer unused in order
- // to distinguish between an empty buffer and a full buffer.
- //
- *AvailableSpace = m_Size - 1;
- }
- else
- {
- if (tailSnapshot > headSnapshot)
- {
- //
- // Data has not wrapped around the end of the buffer
- // The -1 in the computation below is to account for the fact
- // that we always leave the last byte of the ring buffer unused
- // in order to distinguish between an empty buffer and a full
- // buffer.
- //
- *AvailableSpace = m_Size - (tailSnapshot - headSnapshot) - 1;
- }
- else
- {
- //
- // Data has wrapped around the end of the buffer
- // The -1 in the computation below is to account for the fact
- // that we always leave the last byte of the ring buffer unused
- // in order to distinguish between an empty buffer and a full
- // buffer.
- //
- *AvailableSpace = (headSnapshot - tailSnapshot) - 1;
- }
- }
-
- return;
- }
-
-public:
-
- //
- // Public Internal methods.
- //
-
- CRingBuffer(
- VOID
- );
-
- ~CRingBuffer(
- VOID
- );
-
- HRESULT
- Initialize(
- _In_ SIZE_T BufferSize
- );
-
- HRESULT
- Write(
- _In_reads_bytes_(DataSize) PBYTE Data,
- _In_ SIZE_T DataSize
- );
-
- HRESULT
- Read(
- _Out_writes_bytes_to_(DataSize, *BytesCopied) PBYTE Data,
- _In_ SIZE_T DataSize,
- _Out_ SIZE_T *BytesCopied
- );
-
- void
- GetAvailableData(
- _Out_ SIZE_T *AvailableData
- )
- {
- SIZE_T availableSpace;
-
- WUDF_TEST_DRIVER_ASSERT(AvailableData);
-
- GetAvailableSpace(&availableSpace);
-
- //
- // The -1 in the arithmetic below accounts for the fact that we always
- // keep 1 byte of the ring buffer unused in order to distinguish
- // between a full buffer and an empty buffer.
- //
- *AvailableData = m_Size - availableSpace - 1;
-
- return;
- }
-};
diff --git a/serial/VirtualSerial/serial.h b/serial/VirtualSerial/serial.h
deleted file mode 100644
index 0ae91186..00000000
--- a/serial/VirtualSerial/serial.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*++
-
-Module Name :
-
- serial.h
-
-Abstract:
-
- Type definitions and data for the serial port driver
-
-Author:
-
-
---*/
-
-#pragma once
-
-#define SYMBOLIC_NAME_LENGTH 32
-#define SYMBOLIC_LINK_NAME_PREFIX L"\\DosDevices\\Global\\"
-
-//
-// This defines the bit used to control whether the device is sending
-// a break. When this bit is set the device is sending a space (logic 0).
-//
-// Most protocols will assume that this is a hangup.
-//
-#define SERIAL_LCR_BREAK 0x40
-
-//
-// These defines are used to set the line control register.
-//
-#define SERIAL_5_DATA ((UCHAR)0x00)
-#define SERIAL_6_DATA ((UCHAR)0x01)
-#define SERIAL_7_DATA ((UCHAR)0x02)
-#define SERIAL_8_DATA ((UCHAR)0x03)
-#define SERIAL_DATA_MASK ((UCHAR)0x03)
-
-#define SERIAL_1_STOP ((UCHAR)0x00)
-#define SERIAL_1_5_STOP ((UCHAR)0x04) // Only valid for 5 data bits
-#define SERIAL_2_STOP ((UCHAR)0x04) // Not valid for 5 data bits
-#define SERIAL_STOP_MASK ((UCHAR)0x04)
-
-#define SERIAL_NONE_PARITY ((UCHAR)0x00)
-#define SERIAL_ODD_PARITY ((UCHAR)0x08)
-#define SERIAL_EVEN_PARITY ((UCHAR)0x18)
-#define SERIAL_MARK_PARITY ((UCHAR)0x28)
-#define SERIAL_SPACE_PARITY ((UCHAR)0x38)
-#define SERIAL_PARITY_MASK ((UCHAR)0x38)
diff --git a/usb/umdf_filter_kmdf/Package/package.VcxProj b/usb/umdf_filter_kmdf/Package/package.VcxProj
deleted file mode 100644
index 128c8ff6..00000000
--- a/usb/umdf_filter_kmdf/Package/package.VcxProj
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\kmdf_driver\osrusbfx2.vcxproj">
- <Project>{837F98CF-D3A4-472C-BACC-47950340E57B}</Project>
- </ProjectReference>
- <ProjectReference Include="..\umdf_filter\WUDFOsrUsbFilter.vcxproj">
- <Project>{ADCCB27A-E522-4367-86B9-9C9DF2636B93}</Project>
- </ProjectReference>
- </ItemGroup>
- <PropertyGroup Label="PropertySheets">
- <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
- <ConfigurationType>Utility</ConfigurationType>
- <DriverType>Package</DriverType>
- <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
- <Configuration>Debug</Configuration>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Globals">
- <ProjectGuid>{10E372EF-AE85-4528-919C-A261253EDDAE}</ProjectGuid>
- <SampleGuid>{4535F3DF-5A13-4953-9565-74B05B8FA4C6}</SampleGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup />
- <PropertyGroup>
- <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
- <ImportToStore>False</ImportToStore>
- <InstallMode>None</InstallMode>
- <HardwareIdString />
- <CommandLine />
- <ScriptPath />
- <DeployFiles />
- <ScriptName />
- <ScriptDeviceQuery>%PathToInf%</ScriptDeviceQuery>
- <EnableVerifier>False</EnableVerifier>
- <AllDrivers>False</AllDrivers>
- <VerifyProjectOutput>True</VerifyProjectOutput>
- <VerifyDrivers />
- <VerifyFlags>133563</VerifyFlags>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_kmdf/Package/package.VcxProj.Filters b/usb/umdf_filter_kmdf/Package/package.VcxProj.Filters
deleted file mode 100644
index fde842eb..00000000
--- a/usb/umdf_filter_kmdf/Package/package.VcxProj.Filters
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{0ED5A10B-EA82-464B-939C-FD3665A42A97}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{8283F5F0-093B-48C9-A2FC-EA7455F9A36D}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{0B52CF91-796F-49F5-9C6E-23FC9C521570}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{7C0D1D60-5B24-411C-BA58-9FED667338B0}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_kmdf/README.md b/usb/umdf_filter_kmdf/README.md
deleted file mode 100644
index 4f7d0e41..00000000
--- a/usb/umdf_filter_kmdf/README.md
+++ /dev/null
@@ -1,82 +0,0 @@
----
-page_type: sample
-description: "Demonstrates how to load a UMDF filter driver as an upper filter driver above the kmdf_fx2 sample driver."
-languages:
-- cpp
-products:
-- windows
-- windows-wdk
----
-
-# Sample UMDF Filter above KMDF Function Driver for OSR USB-FX2 (UMDF Version 1)
-
-The umdf\_filter\_kmdf sample demonstrates how to load a UMDF filter driver as an upper filter driver above the kmdf\_fx2 sample driver.
-
-The sample includes Event Tracing for Windows (ETW) tracing support, and is written for the [OSR USB-FX2 Learning Kit](https://www.osronline.com/hardware/OSRFX2_32.pdf0.
-
-## Build the sample
-
-The default Solution build configuration is **Debug** and **Win32**.
-
-1. Open the driver project or solution in Visual Studio (find *filtername*.sln or *filtername*.vcxproj).
-
-1. Right-click the solution in the **Solutions Explorer** and select **Configuration Manager**.
-
-1. From the **Configuration Manager**, select the **Active Solution Configuration** (for example, Debug or Release) and the **Active Solution Platform** (for example, Win32) that correspond to the type of build you are interested in.
-
-1. From the **Build** menu, click **Build Solution** (Ctrl+Shift+B).
-
-## Overview
-
-- The device is based on the development board supplied with the Cypress EZ-USB FX2 Development Kit (CY3681).
-
-- It contains 1 interface and 3 endpoints (Interrupt IN, Bulk Out, Bulk IN).
-
-- Firmware supports vendor commands to query or set LED Bar graph display and 7-segment LED display, and to query toggle switch states.
-
-- Interrupt Endpoint:
-
- - Sends an 8-bit value that represents the state of the switches.
-
- - Sent on startup, resume from suspend, and whenever the switch pack setting changes.
-
- - Firmware does not de-bounce the switch pack.
-
- - One switch change can result in multiple bytes being sent.
-
- - Bits are in the reverse order of the labels on the pack (for example, bit 0x80 is labeled 1 on the pack).
-
-- Bulk Endpoints are configured for loopback:
-
- - The device moves data from IN endpoint to OUT endpoint.
-
- - The device does not change the values of the data it receives nor does it internally create any data.
-
- - Endpoints are always double buffered.
-
- - Maximum packet size depends on speed (64 full speed, 512 high speed).
-
-- ETW events:
-
- - Included osrusbfx2.man, which describes events added.
-
- - Three events are targeted to the event log:
-
- - Failure during the add device routine.
-
- - Failure to start the OSR device on a USB 1.1 controller.
-
- - Invocation of the "re-enumerate device" IOCTL.
-
- - Read/write start/stop events can be used to measure the time taken.
-
-## Testing the driver
-
-You can test this sample either by using the [Custom driver access](https://go.microsoft.com/fwlink/p/?linkid=2114373) sample application, or by using the osrusbfx2.exe test application. For information on how to build and use the osrusbfx2.exe application, see the test instructions for the [kmdf\_fx2](https://docs.microsoft.com/samples/microsoft/windows-driver-samples/sample-kmdf-function-driver-for-osr-usb-fx2/) sample.
-
-## Code tour
-
-| Folder | Description |
-| --- | --- |
-| usb\umdf_filter_kmdf\kmdf_driver | This directory contains source code for the kmdf_fx2 sample driver. |
-| usb\umdf_filter_kmdf\umdf_filter | This directory contains the UMDF filter driver. |
diff --git a/usb/umdf_filter_kmdf/inc/WUDFOsrUsbPublic.h b/usb/umdf_filter_kmdf/inc/WUDFOsrUsbPublic.h
deleted file mode 100644
index 6681fa14..00000000
--- a/usb/umdf_filter_kmdf/inc/WUDFOsrUsbPublic.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- WUDFOsrUsbPublic.h
-
-Abstract:
-
- This module contains the common declarations shared by driver
- and user applications for the UMDF OSR device sample.
-
- Note that this driver does NOT use the same device interface GUID
- as the KMDF OSR USB sample.
-
-Environment:
-
- user and kernel
-
---*/
-
-#pragma once
-
-//
-// Define an Interface Guid so that app can find the device and talk to it.
-//
-
-// {573E8C73-0CB4-4471-A1BF-FAB26C31D384}
-DEFINE_GUID(GUID_DEVINTERFACE_OSRUSBFX2,
- 0x573e8c73, 0xcb4, 0x4471, 0xa1, 0xbf, 0xfa, 0xb2, 0x6c, 0x31, 0xd3, 0x84);
-
diff --git a/usb/umdf_filter_kmdf/inc/list.h b/usb/umdf_filter_kmdf/inc/list.h
deleted file mode 100644
index 38d0b1e9..00000000
--- a/usb/umdf_filter_kmdf/inc/list.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- list.h
-
-Abstract:
-
- This module contains doubly linked list macros
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-FORCEINLINE
-VOID
-InitializeListHead(
- IN PLIST_ENTRY ListHead
- )
-{
- ListHead->Flink = ListHead->Blink = ListHead;
-}
-
-FORCEINLINE
-BOOLEAN
-RemoveEntryList(
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
- PLIST_ENTRY Flink;
-
- Flink = Entry->Flink;
- Blink = Entry->Blink;
- Blink->Flink = Flink;
- Flink->Blink = Blink;
- return (BOOLEAN)(Flink == Blink);
-}
-
-FORCEINLINE
-VOID
-InsertHeadList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Flink;
-
- Flink = ListHead->Flink;
- Entry->Flink = Flink;
- Entry->Blink = ListHead;
- Flink->Blink = Entry;
- ListHead->Flink = Entry;
-}
-
-FORCEINLINE
-VOID
-InsertTailList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
-
- Blink = ListHead->Blink;
- Entry->Flink = ListHead;
- Entry->Blink = Blink;
- Blink->Flink = Entry;
- ListHead->Blink = Entry;
-}
diff --git a/usb/umdf_filter_kmdf/inc/public.h b/usb/umdf_filter_kmdf/inc/public.h
deleted file mode 100644
index 2c3f6805..00000000
--- a/usb/umdf_filter_kmdf/inc/public.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- public.h
-
-Abstract:
-
- Public definitions for the OSR_FX2 device operations.
-
-Environment:
-
- User & Kernel mode
-
---*/
-
-#ifndef _PUBLIC_H
-#define _PUBLIC_H
-
-#include <initguid.h>
-
-#include "WudfOsrUsbPublic.h"
-
-
-//
-// Define the structures that will be used by the IOCTL
-// interface to the driver
-//
-
-//
-// BAR_GRAPH_STATE
-//
-// BAR_GRAPH_STATE is a bit field structure with each
-// bit corresponding to one of the bar graph on the
-// OSRFX2 Development Board
-//
-#include <pshpack1.h>
-
-#pragma warning( push )
-#pragma warning( disable : 4201 ) // nameless struct/union
-#pragma warning( disable : 4214 ) // bit-field type other than int
-
-typedef struct _BAR_GRAPH_STATE {
-
- union {
-
- struct {
- //
- // Individual bars starting from the
- // top of the stack of bars
- //
- // NOTE: There are actually 10 bars,
- // but the very top two do not light
- // and are not counted here
- //
- UCHAR Bar1 : 1;
- UCHAR Bar2 : 1;
- UCHAR Bar3 : 1;
- UCHAR Bar4 : 1;
- UCHAR Bar5 : 1;
- UCHAR Bar6 : 1;
- UCHAR Bar7 : 1;
- UCHAR Bar8 : 1;
- };
-
- //
- // The state of all the bar graph as a single
- // UCHAR
- //
- UCHAR BarsAsUChar;
-
- };
-
-}BAR_GRAPH_STATE, *PBAR_GRAPH_STATE;
-
-//
-// SWITCH_STATE
-//
-// SWITCH_STATE is a bit field structure with each
-// bit corresponding to one of the switches on the
-// OSRFX2 Development Board
-//
-typedef struct _SWITCH_STATE {
-
- union {
- struct {
- //
- // Individual switches starting from the
- // left of the set of switches
- //
- UCHAR Switch1 : 1;
- UCHAR Switch2 : 1;
- UCHAR Switch3 : 1;
- UCHAR Switch4 : 1;
- UCHAR Switch5 : 1;
- UCHAR Switch6 : 1;
- UCHAR Switch7 : 1;
- UCHAR Switch8 : 1;
- };
-
- //
- // The state of all the switches as a single
- // UCHAR
- //
- UCHAR SwitchesAsUChar;
-
- };
-
-
-}SWITCH_STATE, *PSWITCH_STATE;
-
-//
-// Seven segment display bit values.
-//
-
-//
-// Undefine conflicting MFC constant
-//
-#undef SS_CENTER
-#undef SS_LEFT
-#undef SS_RIGHT
-
-#define SS_TOP 0x01
-#define SS_TOP_LEFT 0x40
-#define SS_TOP_RIGHT 0x02
-#define SS_CENTER 0x20
-#define SS_BOTTOM_LEFT 0x10
-#define SS_BOTTOM_RIGHT 0x04
-#define SS_BOTTOM 0x80
-#define SS_DOT 0x08
-
-//
-// FILE_PLAYBACK
-//
-// FILE_PLAYBACK structure contains the parameters for the PLAY_FILE I/O Control.
-//
-
-typedef struct _FILE_PLAYBACK
-{
- //
- // The delay between changes in the display, in milliseconds.
- //
-
- USHORT Delay;
-
- //
- // The data file path.
- //
-
- WCHAR Path[1];
-} FILE_PLAYBACK, *PFILE_PLAYBACK;
-
-#include <poppack.h>
-
-#define IOCTL_INDEX 0x800
-#define FILE_DEVICE_OSRUSBFX2 65500U
-
-#define IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-#define IOCTL_OSRUSBFX2_RESET_DEVICE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 1, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_REENUMERATE_DEVICE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 3, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 4, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 5, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_READ_SWITCHES CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 6, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 7, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 8, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 9, \
- METHOD_OUT_DIRECT, \
- FILE_READ_ACCESS)
-
-#define IOCTL_OSRUSBFX2_PLAY_FILE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 10, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#pragma warning(pop)
-
-#endif
-
diff --git a/usb/umdf_filter_kmdf/inc/usb_hw.h b/usb/umdf_filter_kmdf/inc/usb_hw.h
deleted file mode 100644
index d6e983f1..00000000
--- a/usb/umdf_filter_kmdf/inc/usb_hw.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- Usb.h
-
-Abstract:
-
- Contains prototypes for interfacing with a USB connected device. These
- are copied from the KMDF WDFUSB.H header file (but with the WDF specific
- portions removed)
-
-Environment:
-
- kernel mode only
-
---*/
-
-#pragma once
-
-typedef enum _WINUSB_BMREQUEST_DIRECTION {
- BmRequestHostToDevice = BMREQUEST_HOST_TO_DEVICE,
- BmRequestDeviceToHost = BMREQUEST_DEVICE_TO_HOST,
-} WINUSB_BMREQUEST_DIRECTION;
-
-typedef enum _WINUSB_BMREQUEST_TYPE {
- BmRequestStandard = BMREQUEST_STANDARD,
- BmRequestClass = BMREQUEST_CLASS,
- BmRequestVendor = BMREQUEST_VENDOR,
-} WINUSB_BMREQUEST_TYPE;
-
-typedef enum _WINUSB_BMREQUEST_RECIPIENT {
- BmRequestToDevice = BMREQUEST_TO_DEVICE,
- BmRequestToInterface = BMREQUEST_TO_INTERFACE,
- BmRequestToEndpoint = BMREQUEST_TO_ENDPOINT,
- BmRequestToOther = BMREQUEST_TO_OTHER,
-} WINUSB_BMREQUEST_RECIPIENT;
-
-typedef enum _WINUSB_DEVICE_TRAITS {
- WINUSB_DEVICE_TRAIT_SELF_POWERED = 0x00000001,
- WINUSB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE = 0x00000002,
- WINUSB_DEVICE_TRAIT_AT_HIGH_SPEED = 0x00000004,
-} WINUSB_DEVICE_TRAITS;
-
-typedef enum _WdfUsbTargetDeviceSelectInterfaceType {
- WdfUsbTargetDeviceSelectInterfaceTypeInterface = 0x10,
- WdfUsbTargetDeviceSelectInterfaceTypeUrb = 0x11,
-} WdfUsbTargetDeviceSelectInterfaceType;
-
-
-
-typedef union _WINUSB_CONTROL_SETUP_PACKET {
- struct {
- union {
- #pragma warning(disable:4214) // bit field types other than int
- struct {
- //
- // Valid values are BMREQUEST_TO_DEVICE, BMREQUEST_TO_INTERFACE,
- // BMREQUEST_TO_ENDPOINT, BMREQUEST_TO_OTHER
- //
- BYTE Recipient:2;
-
- BYTE Reserved:3;
-
- //
- // Valid values are BMREQUEST_STANDARD, BMREQUEST_CLASS,
- // BMREQUEST_VENDOR
- //
- BYTE Type:2;
-
- //
- // Valid values are BMREQUEST_HOST_TO_DEVICE,
- // BMREQUEST_DEVICE_TO_HOST
- //
- BYTE Dir:1;
- } Request;
- #pragma warning(default:4214) // bit field types other than int
- BYTE Byte;
- } bm;
-
- BYTE bRequest;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wValue;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wIndex;
-
- USHORT wLength;
- } Packet;
-
- struct {
- BYTE Bytes[8];
- } Generic;
-
- WINUSB_SETUP_PACKET WinUsb;
-
-} WINUSB_CONTROL_SETUP_PACKET, *PWINUSB_CONTROL_SETUP_PACKET;
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_CLASS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestClass;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_VENDOR(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestVendor;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_FEATURE(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT FeatureSelector,
- USHORT Index,
- BOOLEAN SetFeature
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestHostToDevice;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- if (SetFeature) {
- Packet->Packet.bRequest = USB_REQUEST_SET_FEATURE;
- }
- else {
- Packet->Packet.bRequest = USB_REQUEST_CLEAR_FEATURE;
- }
-
- Packet->Packet.wValue.Value = FeatureSelector;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_GET_STATUS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestDeviceToHost;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- Packet->Packet.bRequest = USB_REQUEST_GET_STATUS;
- Packet->Packet.wIndex.Value = Index;
- Packet->Packet.wValue.Value = 0;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/Device.c b/usb/umdf_filter_kmdf/kmdf_driver/Device.c
deleted file mode 100644
index 8516ef09..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/Device.c
+++ /dev/null
@@ -1,1051 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- Device.c
-
-Abstract:
-
- USB device driver for OSR USB-FX2 Learning Kit
-
-Environment:
-
- Kernel mode only
-
-
---*/
-
-#include <osrusbfx2.h>
-#include <devpkey.h>
-
-#if defined(EVENT_TRACING)
-#include "device.tmh"
-#endif
-
-#ifdef ALLOC_PRAGMA
-#pragma alloc_text(PAGE, OsrFxEvtDeviceAdd)
-#pragma alloc_text(PAGE, OsrFxEvtDevicePrepareHardware)
-#pragma alloc_text(PAGE, OsrFxEvtDeviceD0Exit)
-#pragma alloc_text(PAGE, SelectInterfaces)
-#pragma alloc_text(PAGE, OsrFxSetPowerPolicy)
-#pragma alloc_text(PAGE, OsrFxReadFdoRegistryKeyValue)
-#pragma alloc_text(PAGE, GetDeviceEventLoggingNames)
-#pragma alloc_text(PAGE, OsrFxValidateConfigurationDescriptor)
-#endif
-
-
-NTSTATUS
-OsrFxEvtDeviceAdd(
- WDFDRIVER Driver,
- PWDFDEVICE_INIT DeviceInit
- )
-/*++
-Routine Description:
-
- EvtDeviceAdd is called by the framework in response to AddDevice
- call from the PnP manager. We create and initialize a device object to
- represent a new instance of the device. All the software resources
- should be allocated in this callback.
-
-Arguments:
-
- Driver - Handle to a framework driver object created in DriverEntry
-
- DeviceInit - Pointer to a framework-allocated WDFDEVICE_INIT structure.
-
-Return Value:
-
- NTSTATUS
-
---*/
-{
- WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks;
- WDF_OBJECT_ATTRIBUTES attributes;
- NTSTATUS status;
- WDFDEVICE device;
- WDF_DEVICE_PNP_CAPABILITIES pnpCaps;
- WDF_IO_QUEUE_CONFIG ioQueueConfig;
- PDEVICE_CONTEXT pDevContext;
- WDFQUEUE queue;
- GUID activity;
- UNICODE_STRING symbolicLinkName;
- WDFSTRING symbolicLinkString;
- DEVPROP_BOOLEAN isRestricted;
-
- UNREFERENCED_PARAMETER(Driver);
-
- PAGED_CODE();
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,"--> OsrFxEvtDeviceAdd routine\n");
-
- //
- // Initialize the pnpPowerCallbacks structure. Callback events for PNP
- // and Power are specified here. If you don't supply any callbacks,
- // the Framework will take appropriate default actions based on whether
- // DeviceInit is initialized to be an FDO, a PDO or a filter device
- // object.
- //
-
- WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);
- //
- // For usb devices, PrepareHardware callback is the to place select the
- // interface and configure the device.
- //
- pnpPowerCallbacks.EvtDevicePrepareHardware = OsrFxEvtDevicePrepareHardware;
-
- //
- // These two callbacks start and stop the wdfusb pipe continuous reader
- // as we go in and out of the D0-working state.
- //
-
- pnpPowerCallbacks.EvtDeviceD0Entry = OsrFxEvtDeviceD0Entry;
- pnpPowerCallbacks.EvtDeviceD0Exit = OsrFxEvtDeviceD0Exit;
- pnpPowerCallbacks.EvtDeviceSelfManagedIoFlush = OsrFxEvtDeviceSelfManagedIoFlush;
-
- WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks);
-
- WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered);
-
- //
- // Now specify the size of device extension where we track per device
- // context.DeviceInit is completely initialized. So call the framework
- // to create the device and attach it to the lower stack.
- //
- WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, DEVICE_CONTEXT);
-
- status = WdfDeviceCreate(&DeviceInit, &attributes, &device);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfDeviceCreate failed with Status code %!STATUS!\n", status);
- return status;
- }
-
- //
- // Setup the activity ID so that we can log events using it.
- //
-
- activity = DeviceToActivityId(device);
-
- //
- // Get the DeviceObject context by using accessor function specified in
- // the WDF_DECLARE_CONTEXT_TYPE_WITH_NAME macro for DEVICE_CONTEXT.
- //
- pDevContext = GetDeviceContext(device);
-
- //
- // Get the device's friendly name and location so that we can use it in
- // error logging. If this fails then it will setup dummy strings.
- //
-
- GetDeviceEventLoggingNames(device);
-
- //
- // Tell the framework to set the SurpriseRemovalOK in the DeviceCaps so
- // that you don't get the popup in usermode when you surprise remove the device.
- //
- WDF_DEVICE_PNP_CAPABILITIES_INIT(&pnpCaps);
- pnpCaps.SurpriseRemovalOK = WdfTrue;
-
- WdfDeviceSetPnpCapabilities(device, &pnpCaps);
-
- //
- // Create a parallel default queue and register an event callback to
- // receive ioctl requests. We will create separate queues for
- // handling read and write requests. All other requests will be
- // completed with error status automatically by the framework.
- //
- WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig,
- WdfIoQueueDispatchParallel);
-
- ioQueueConfig.EvtIoDeviceControl = OsrFxEvtIoDeviceControl;
-
- //
- // By default, Static Driver Verifier (SDV) displays a warning if it
- // doesn't find the EvtIoStop callback on a power-managed queue.
- // The 'assume' below causes SDV to suppress this warning. If the driver
- // has not explicitly set PowerManaged to WdfFalse, the framework creates
- // power-managed queues when the device is not a filter driver. Normally
- // the EvtIoStop is required for power-managed queues, but for this driver
- // it is not needed b/c the driver doesn't hold on to the requests for
- // long time or forward them to other drivers.
- // If the EvtIoStop callback is not implemented, the framework waits for
- // all driver-owned requests to be done before moving in the Dx/sleep
- // states or before removing the device, which is the correct behavior
- // for this type of driver. If the requests were taking an indeterminate
- // amount of time to complete, or if the driver forwarded the requests
- // to a lower driver/another stack, the queue should have an
- // EvtIoStop/EvtIoResume.
- //
- __analysis_assume(ioQueueConfig.EvtIoStop != 0);
- status = WdfIoQueueCreate(device,
- &ioQueueConfig,
- WDF_NO_OBJECT_ATTRIBUTES,
- &queue);// pointer to default queue
- __analysis_assume(ioQueueConfig.EvtIoStop == 0);
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfIoQueueCreate failed %!STATUS!\n", status);
- goto Error;
- }
-
- //
- // We will create a separate sequential queue and configure it
- // to receive read requests. We also need to register a EvtIoStop
- // handler so that we can acknowledge requests that are pending
- // at the target driver.
- //
- WDF_IO_QUEUE_CONFIG_INIT(&ioQueueConfig, WdfIoQueueDispatchSequential);
-
- ioQueueConfig.EvtIoRead = OsrFxEvtIoRead;
- ioQueueConfig.EvtIoStop = OsrFxEvtIoStop;
-
- status = WdfIoQueueCreate(
- device,
- &ioQueueConfig,
- WDF_NO_OBJECT_ATTRIBUTES,
- &queue // queue handle
- );
-
- if (!NT_SUCCESS (status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfIoQueueCreate failed 0x%x\n", status);
- goto Error;
- }
-
- status = WdfDeviceConfigureRequestDispatching(
- device,
- queue,
- WdfRequestTypeRead);
-
- if(!NT_SUCCESS (status)){
- NT_ASSERT(NT_SUCCESS(status));
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfDeviceConfigureRequestDispatching failed 0x%x\n", status);
- goto Error;
- }
-
-
- //
- // We will create another sequential queue and configure it
- // to receive write requests.
- //
- WDF_IO_QUEUE_CONFIG_INIT(&ioQueueConfig, WdfIoQueueDispatchSequential);
-
- ioQueueConfig.EvtIoWrite = OsrFxEvtIoWrite;
- ioQueueConfig.EvtIoStop = OsrFxEvtIoStop;
-
- status = WdfIoQueueCreate(
- device,
- &ioQueueConfig,
- WDF_NO_OBJECT_ATTRIBUTES,
- &queue // queue handle
- );
-
- if (!NT_SUCCESS (status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfIoQueueCreate failed 0x%x\n", status);
- goto Error;
- }
-
- status = WdfDeviceConfigureRequestDispatching(
- device,
- queue,
- WdfRequestTypeWrite);
-
- if(!NT_SUCCESS (status)){
- NT_ASSERT(NT_SUCCESS(status));
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfDeviceConfigureRequestDispatching failed 0x%x\n", status);
- goto Error;
- }
-
- //
- // Register a manual I/O queue for handling Interrupt Message Read Requests.
- // This queue will be used for storing Requests that need to wait for an
- // interrupt to occur before they can be completed.
- //
- WDF_IO_QUEUE_CONFIG_INIT(&ioQueueConfig, WdfIoQueueDispatchManual);
-
- //
- // This queue is used for requests that dont directly access the device. The
- // requests in this queue are serviced only when the device is in a fully
- // powered state and sends an interrupt. So we can use a non-power managed
- // queue to park the requests since we dont care whether the device is idle
- // or fully powered up.
- //
- ioQueueConfig.PowerManaged = WdfFalse;
-
- status = WdfIoQueueCreate(device,
- &ioQueueConfig,
- WDF_NO_OBJECT_ATTRIBUTES,
- &pDevContext->InterruptMsgQueue
- );
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfIoQueueCreate failed 0x%x\n", status);
- goto Error;
- }
-
- //
- // Register a device interface so that app can find our device and talk to it.
- //
- status = WdfDeviceCreateDeviceInterface(device,
- (LPGUID) &GUID_DEVINTERFACE_OSRUSBFX2,
- NULL); // Reference String
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfDeviceCreateDeviceInterface failed %!STATUS!\n", status);
- goto Error;
- }
-
- //
- // Create the lock that we use to serialize calls to ResetDevice(). As an
- // alternative to using a WDFWAITLOCK to serialize the calls, a sequential
- // WDFQUEUE can be created and reset IOCTLs would be forwarded to it.
- //
- WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
- attributes.ParentObject = device;
-
- status = WdfWaitLockCreate(&attributes, &pDevContext->ResetDeviceWaitLock);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfWaitLockCreate failed %!STATUS!\n", status);
- goto Error;
- }
-
- //
- // Get the string for the device interface and set the restricted
- // property on it to allow applications bound with device metadata
- // to access the interface.
- //
- if (g_pIoSetDeviceInterfacePropertyData != NULL) {
-
- status = WdfStringCreate(NULL,
- WDF_NO_OBJECT_ATTRIBUTES,
- &symbolicLinkString);
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfStringCreate failed %!STATUS!\n", status);
- goto Error;
- }
-
- status = WdfDeviceRetrieveDeviceInterfaceString(device,
- (LPGUID) &GUID_DEVINTERFACE_OSRUSBFX2,
- NULL,
- symbolicLinkString);
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfDeviceRetrieveDeviceInterfaceString failed %!STATUS!\n", status);
- goto Error;
- }
-
- WdfStringGetUnicodeString(symbolicLinkString, &symbolicLinkName);
-
- isRestricted = DEVPROP_TRUE;
-
- status = g_pIoSetDeviceInterfacePropertyData(&symbolicLinkName,
- &DEVPKEY_DeviceInterface_Restricted,
- 0,
- 0,
- DEVPROP_TYPE_BOOLEAN,
- sizeof(isRestricted),
- &isRestricted );
-
- WdfObjectDelete(symbolicLinkString);
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "IoSetDeviceInterfacePropertyData failed %!STATUS!\n", status);
- goto Error;
- }
- }
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- OsrFxEvtDeviceAdd\n");
-
- return status;
-
-Error:
-
- //
- // Log fail to add device to the event log
- //
- EventWriteFailAddDevice(&activity,
- pDevContext->DeviceName,
- pDevContext->Location,
- status);
-
- return status;
-}
-
-NTSTATUS
-OsrFxEvtDevicePrepareHardware(
- WDFDEVICE Device,
- WDFCMRESLIST ResourceList,
- WDFCMRESLIST ResourceListTranslated
- )
-/*++
-
-Routine Description:
-
- In this callback, the driver does whatever is necessary to make the
- hardware ready to use. In the case of a USB device, this involves
- reading and selecting descriptors.
-
-Arguments:
-
- Device - handle to a device
-
- ResourceList - handle to a resource-list object that identifies the
- raw hardware resources that the PnP manager assigned
- to the device
-
- ResourceListTranslated - handle to a resource-list object that
- identifies the translated hardware resources
- that the PnP manager assigned to the device
-
-Return Value:
-
- NT status value
-
---*/
-{
- NTSTATUS status;
- PDEVICE_CONTEXT pDeviceContext;
- WDF_USB_DEVICE_INFORMATION deviceInfo;
- ULONG waitWakeEnable;
-
- UNREFERENCED_PARAMETER(ResourceList);
- UNREFERENCED_PARAMETER(ResourceListTranslated);
- waitWakeEnable = FALSE;
- PAGED_CODE();
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "--> EvtDevicePrepareHardware\n");
-
- pDeviceContext = GetDeviceContext(Device);
-
- //
- // Create a USB device handle so that we can communicate with the
- // underlying USB stack. The WDFUSBDEVICE handle is used to query,
- // configure, and manage all aspects of the USB device.
- // These aspects include device properties, bus properties,
- // and I/O creation and synchronization. We only create device the first
- // the PrepareHardware is called. If the device is restarted by pnp manager
- // for resource rebalance, we will use the same device handle but then select
- // the interfaces again because the USB stack could reconfigure the device on
- // restart.
- //
- if (pDeviceContext->UsbDevice == NULL) {
- WDF_USB_DEVICE_CREATE_CONFIG config;
-
- WDF_USB_DEVICE_CREATE_CONFIG_INIT(&config,
- USBD_CLIENT_CONTRACT_VERSION_602);
-
- status = WdfUsbTargetDeviceCreateWithParameters(Device,
- &config,
- WDF_NO_OBJECT_ATTRIBUTES,
- &pDeviceContext->UsbDevice);
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfUsbTargetDeviceCreateWithParameters failed with Status code %!STATUS!\n", status);
- return status;
- }
-
- //
- // TODO: If you are fetching configuration descriptor from device for
- // selecting a configuration or to parse other descriptors, call OsrFxValidateConfigurationDescriptor
- // to do basic validation on the descriptors before you access them .
- //
- }
-
- //
- // Retrieve USBD version information, port driver capabilites and device
- // capabilites such as speed, power, etc.
- //
- WDF_USB_DEVICE_INFORMATION_INIT(&deviceInfo);
-
- status = WdfUsbTargetDeviceRetrieveInformation(
- pDeviceContext->UsbDevice,
- &deviceInfo);
- if (NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "IsDeviceHighSpeed: %s\n",
- (deviceInfo.Traits & WDF_USB_DEVICE_TRAIT_AT_HIGH_SPEED) ? "TRUE" : "FALSE");
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
- "IsDeviceSelfPowered: %s\n",
- (deviceInfo.Traits & WDF_USB_DEVICE_TRAIT_SELF_POWERED) ? "TRUE" : "FALSE");
-
- waitWakeEnable = deviceInfo.Traits &
- WDF_USB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE;
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
- "IsDeviceRemoteWakeable: %s\n",
- waitWakeEnable ? "TRUE" : "FALSE");
- //
- // Save these for use later.
- //
- pDeviceContext->UsbDeviceTraits = deviceInfo.Traits;
- }
- else {
- pDeviceContext->UsbDeviceTraits = 0;
- }
-
- status = SelectInterfaces(Device);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "SelectInterfaces failed 0x%x\n", status);
- return status;
- }
-
- //
- // Enable wait-wake and idle timeout if the device supports it
- //
- if (waitWakeEnable) {
- status = OsrFxSetPowerPolicy(Device);
- if (!NT_SUCCESS (status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "OsrFxSetPowerPolicy failed %!STATUS!\n", status);
- return status;
- }
- }
-
- status = OsrFxConfigContReaderForInterruptEndPoint(pDeviceContext);
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- EvtDevicePrepareHardware\n");
-
- return status;
-}
-
-
-NTSTATUS
-OsrFxEvtDeviceD0Entry(
- WDFDEVICE Device,
- WDF_POWER_DEVICE_STATE PreviousState
- )
-/*++
-
-Routine Description:
-
- EvtDeviceD0Entry event callback must perform any operations that are
- necessary before the specified device is used. It will be called every
- time the hardware needs to be (re-)initialized.
-
- This function is not marked pageable because this function is in the
- device power up path. When a function is marked pagable and the code
- section is paged out, it will generate a page fault which could impact
- the fast resume behavior because the client driver will have to wait
- until the system drivers can service this page fault.
-
- This function runs at PASSIVE_LEVEL, even though it is not paged. A
- driver can optionally make this function pageable if DO_POWER_PAGABLE
- is set. Even if DO_POWER_PAGABLE isn't set, this function still runs
- at PASSIVE_LEVEL. In this case, though, the function absolutely must
- not do anything that will cause a page fault.
-
-Arguments:
-
- Device - Handle to a framework device object.
-
- PreviousState - Device power state which the device was in most recently.
- If the device is being newly started, this will be
- PowerDeviceUnspecified.
-
-Return Value:
-
- NTSTATUS
-
---*/
-{
- PDEVICE_CONTEXT pDeviceContext;
- NTSTATUS status;
- BOOLEAN isTargetStarted;
-
- pDeviceContext = GetDeviceContext(Device);
- isTargetStarted = FALSE;
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER,
- "-->OsrFxEvtEvtDeviceD0Entry - coming from %s\n",
- DbgDevicePowerString(PreviousState));
-
- //
- // Since continuous reader is configured for this interrupt-pipe, we must explicitly start
- // the I/O target to get the framework to post read requests.
- //
- status = WdfIoTargetStart(WdfUsbTargetPipeGetIoTarget(pDeviceContext->InterruptPipe));
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_POWER, "Failed to start interrupt pipe %!STATUS!\n", status);
- goto End;
- }
-
- isTargetStarted = TRUE;
-
-End:
-
- if (!NT_SUCCESS(status)) {
- //
- // Failure in D0Entry will lead to device being removed. So let us stop the continuous
- // reader in preparation for the ensuing remove.
- //
- if (isTargetStarted) {
- WdfIoTargetStop(WdfUsbTargetPipeGetIoTarget(pDeviceContext->InterruptPipe), WdfIoTargetCancelSentIo);
- }
- }
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "<--OsrFxEvtEvtDeviceD0Entry\n");
-
- return status;
-}
-
-
-NTSTATUS
-OsrFxEvtDeviceD0Exit(
- WDFDEVICE Device,
- WDF_POWER_DEVICE_STATE TargetState
- )
-/*++
-
-Routine Description:
-
- This routine undoes anything done in EvtDeviceD0Entry. It is called
- whenever the device leaves the D0 state, which happens when the device is
- stopped, when it is removed, and when it is powered off.
-
- The device is still in D0 when this callback is invoked, which means that
- the driver can still touch hardware in this routine.
-
-
- EvtDeviceD0Exit event callback must perform any operations that are
- necessary before the specified device is moved out of the D0 state. If the
- driver needs to save hardware state before the device is powered down, then
- that should be done here.
-
- This function runs at PASSIVE_LEVEL, though it is generally not paged. A
- driver can optionally make this function pageable if DO_POWER_PAGABLE is set.
-
- Even if DO_POWER_PAGABLE isn't set, this function still runs at
- PASSIVE_LEVEL. In this case, though, the function absolutely must not do
- anything that will cause a page fault.
-
-Arguments:
-
- Device - Handle to a framework device object.
-
- TargetState - Device power state which the device will be put in once this
- callback is complete.
-
-Return Value:
-
- Success implies that the device can be used. Failure will result in the
- device stack being torn down.
-
---*/
-{
- PDEVICE_CONTEXT pDeviceContext;
-
- PAGED_CODE();
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER,
- "-->OsrFxEvtDeviceD0Exit - moving to %s\n",
- DbgDevicePowerString(TargetState));
-
- pDeviceContext = GetDeviceContext(Device);
-
- WdfIoTargetStop(WdfUsbTargetPipeGetIoTarget(pDeviceContext->InterruptPipe), WdfIoTargetCancelSentIo);
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_POWER, "<--OsrFxEvtDeviceD0Exit\n");
-
- return STATUS_SUCCESS;
-}
-
-VOID
-OsrFxEvtDeviceSelfManagedIoFlush(
- _In_ WDFDEVICE Device
- )
-/*++
-
-Routine Description:
-
- This routine handles flush activity for the device's
- self-managed I/O operations.
-
-Arguments:
-
- Device - Handle to a framework device object.
-
-Return Value:
-
- None
-
---*/
-{
- // Service the interrupt message queue to drain any outstanding
- // requests
- OsrUsbIoctlGetInterruptMessage(Device, STATUS_DEVICE_REMOVED);
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-USBD_STATUS
-OsrFxValidateConfigurationDescriptor(
- _In_reads_bytes_(BufferLength) PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc,
- _In_ ULONG BufferLength,
- _Inout_ PUCHAR *Offset
- )
-/*++
-
-Routine Description:
-
- Validates a USB Configuration Descriptor
-
-Parameters:
-
- ConfigDesc: Pointer to the entire USB Configuration descriptor returned by the device
-
- BufferLength: Known size of buffer pointed to by ConfigDesc (Not wTotalLength)
-
- Offset: if the USBD_STATUS returned is not USBD_STATUS_SUCCESS, offet will
- be set to the address within the ConfigDesc buffer where the failure occured.
-
-Return Value:
-
- USBD_STATUS
- Success implies the configuration descriptor is valid.
-
---*/
-{
-
-
- USBD_STATUS status = USBD_STATUS_SUCCESS;
- USHORT ValidationLevel = 3;
-
- PAGED_CODE();
-
- //
- // Call USBD_ValidateConfigurationDescriptor to validate the descriptors which are present in this supplied configuration descriptor.
- // USBD_ValidateConfigurationDescriptor validates that all descriptors are completely contained within the configuration descriptor buffer.
- // It also checks for interface numbers, number of endpoints in an interface etc.
- // Please refer to msdn documentation for this function for more information.
- //
-
- status = USBD_ValidateConfigurationDescriptor( ConfigDesc, BufferLength , ValidationLevel , Offset , POOL_TAG );
- if (!(NT_SUCCESS (status)) ){
- return status;
- }
-
- //
- // TODO: You should validate the correctness of other descriptors which are not taken care by USBD_ValidateConfigurationDescriptor
- // Check that all such descriptors have size >= sizeof(the descriptor they point to)
- // Check for any association between them if required
- //
-
- return status;
-}
-
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-OsrFxSetPowerPolicy(
- _In_ WDFDEVICE Device
- )
-{
- WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS idleSettings;
- WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS wakeSettings;
- NTSTATUS status = STATUS_SUCCESS;
-
- PAGED_CODE();
-
- //
- // Init the idle policy structure.
- //
- WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT(&idleSettings, IdleUsbSelectiveSuspend);
- idleSettings.IdleTimeout = 10000; // 10-sec
-
- status = WdfDeviceAssignS0IdleSettings(Device, &idleSettings);
- if ( !NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfDeviceSetPowerPolicyS0IdlePolicy failed %x\n", status);
- return status;
- }
-
- //
- // Init wait-wake policy structure.
- //
- WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT(&wakeSettings);
-
- status = WdfDeviceAssignSxWakeSettings(Device, &wakeSettings);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfDeviceAssignSxWakeSettings failed %x\n", status);
- return status;
- }
-
- return status;
-}
-
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-SelectInterfaces(
- _In_ WDFDEVICE Device
- )
-/*++
-
-Routine Description:
-
- This helper routine selects the configuration, interface and
- creates a context for every pipe (end point) in that interface.
-
-Arguments:
-
- Device - Handle to a framework device
-
-Return Value:
-
- NT status value
-
---*/
-{
- WDF_USB_DEVICE_SELECT_CONFIG_PARAMS configParams;
- NTSTATUS status = STATUS_SUCCESS;
- PDEVICE_CONTEXT pDeviceContext;
- WDFUSBPIPE pipe;
- WDF_USB_PIPE_INFORMATION pipeInfo;
- UCHAR index;
- UCHAR numberConfiguredPipes;
-
- PAGED_CODE();
-
- pDeviceContext = GetDeviceContext(Device);
-
- WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE( &configParams);
-
- status = WdfUsbTargetDeviceSelectConfig(pDeviceContext->UsbDevice,
- WDF_NO_OBJECT_ATTRIBUTES,
- &configParams);
- if(!NT_SUCCESS(status)) {
-
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "WdfUsbTargetDeviceSelectConfig failed %!STATUS! \n",
- status);
-
- //
- // Since the Osr USB fx2 device is capable of working at high speed, the only reason
- // the device would not be working at high speed is if the port doesn't
- // support it. If the port doesn't support high speed it is a 1.1 port
- //
- if ((pDeviceContext->UsbDeviceTraits & WDF_USB_DEVICE_TRAIT_AT_HIGH_SPEED) == 0) {
- GUID activity = DeviceToActivityId(Device);
-
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- " On a 1.1 USB port on Windows Vista"
- " this is expected as the OSR USB Fx2 board's Interrupt EndPoint descriptor"
- " doesn't conform to the USB specification. Windows Vista detects this and"
- " returns an error. \n"
- );
- EventWriteSelectConfigFailure(
- &activity,
- pDeviceContext->DeviceName,
- pDeviceContext->Location,
- status
- );
- }
-
- return status;
- }
-
- pDeviceContext->UsbInterface =
- configParams.Types.SingleInterface.ConfiguredUsbInterface;
-
- numberConfiguredPipes = configParams.Types.SingleInterface.NumberConfiguredPipes;
-
- //
- // Get pipe handles
- //
- for(index=0; index < numberConfiguredPipes; index++) {
-
- WDF_USB_PIPE_INFORMATION_INIT(&pipeInfo);
-
- pipe = WdfUsbInterfaceGetConfiguredPipe(
- pDeviceContext->UsbInterface,
- index, //PipeIndex,
- &pipeInfo
- );
- //
- // Tell the framework that it's okay to read less than
- // MaximumPacketSize
- //
- WdfUsbTargetPipeSetNoMaximumPacketSizeCheck(pipe);
-
- if(WdfUsbPipeTypeInterrupt == pipeInfo.PipeType) {
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL,
- "Interrupt Pipe is 0x%p\n", pipe);
- pDeviceContext->InterruptPipe = pipe;
- }
-
- if(WdfUsbPipeTypeBulk == pipeInfo.PipeType &&
- WdfUsbTargetPipeIsInEndpoint(pipe)) {
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL,
- "BulkInput Pipe is 0x%p\n", pipe);
- pDeviceContext->BulkReadPipe = pipe;
- }
-
- if(WdfUsbPipeTypeBulk == pipeInfo.PipeType &&
- WdfUsbTargetPipeIsOutEndpoint(pipe)) {
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL,
- "BulkOutput Pipe is 0x%p\n", pipe);
- pDeviceContext->BulkWritePipe = pipe;
- }
-
- }
-
- //
- // If we didn't find all the 3 pipes, fail the start.
- //
- if(!(pDeviceContext->BulkWritePipe
- && pDeviceContext->BulkReadPipe && pDeviceContext->InterruptPipe)) {
- status = STATUS_INVALID_DEVICE_STATE;
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "Device is not configured properly %!STATUS!\n",
- status);
-
- return status;
- }
-
- return status;
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-VOID
-GetDeviceEventLoggingNames(
- _In_ WDFDEVICE Device
- )
-/*++
-
-Routine Description:
-
- Retrieve the friendly name and the location string into WDFMEMORY objects
- and store them in the device context.
-
-Arguments:
-
-Return Value:
-
- None
-
---*/
-{
- PDEVICE_CONTEXT pDevContext = GetDeviceContext(Device);
-
- WDF_OBJECT_ATTRIBUTES objectAttributes;
-
- WDFMEMORY deviceNameMemory = NULL;
- WDFMEMORY locationMemory = NULL;
-
- NTSTATUS status;
-
- PAGED_CODE();
-
- //
- // We want both memory objects to be children of the device so they will
- // be deleted automatically when the device is removed.
- //
-
- WDF_OBJECT_ATTRIBUTES_INIT(&objectAttributes);
- objectAttributes.ParentObject = Device;
-
- //
- // First get the length of the string. If the FriendlyName
- // is not there then get the lenght of device description.
- //
-
- status = WdfDeviceAllocAndQueryProperty(Device,
- DevicePropertyFriendlyName,
- NonPagedPoolNx,
- &objectAttributes,
- &deviceNameMemory);
-
- if (!NT_SUCCESS(status))
- {
- status = WdfDeviceAllocAndQueryProperty(Device,
- DevicePropertyDeviceDescription,
- NonPagedPoolNx,
- &objectAttributes,
- &deviceNameMemory);
- }
-
- if (NT_SUCCESS(status))
- {
- pDevContext->DeviceNameMemory = deviceNameMemory;
- pDevContext->DeviceName = WdfMemoryGetBuffer(deviceNameMemory, NULL);
- }
- else
- {
- pDevContext->DeviceNameMemory = NULL;
- pDevContext->DeviceName = L"(error retrieving name)";
- }
-
- //
- // Retrieve the device location string.
- //
-
- status = WdfDeviceAllocAndQueryProperty(Device,
- DevicePropertyLocationInformation,
- NonPagedPoolNx,
- WDF_NO_OBJECT_ATTRIBUTES,
- &locationMemory);
-
- if (NT_SUCCESS(status))
- {
- pDevContext->LocationMemory = locationMemory;
- pDevContext->Location = WdfMemoryGetBuffer(locationMemory, NULL);
- }
- else
- {
- pDevContext->LocationMemory = NULL;
- pDevContext->Location = L"(error retrieving location)";
- }
-
- return;
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-PCHAR
-DbgDevicePowerString(
- _In_ WDF_POWER_DEVICE_STATE Type
- )
-{
- switch (Type)
- {
- case WdfPowerDeviceInvalid:
- return "WdfPowerDeviceInvalid";
- case WdfPowerDeviceD0:
- return "WdfPowerDeviceD0";
- case WdfPowerDeviceD1:
- return "WdfPowerDeviceD1";
- case WdfPowerDeviceD2:
- return "WdfPowerDeviceD2";
- case WdfPowerDeviceD3:
- return "WdfPowerDeviceD3";
- case WdfPowerDeviceD3Final:
- return "WdfPowerDeviceD3Final";
- case WdfPowerDevicePrepareForHibernation:
- return "WdfPowerDevicePrepareForHibernation";
- case WdfPowerDeviceMaximum:
- return "WdfPowerDeviceMaximum";
- default:
- return "UnKnown Device Power State";
- }
-}
-
-
-
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/bulkrwr.c b/usb/umdf_filter_kmdf/kmdf_driver/bulkrwr.c
deleted file mode 100644
index eabda192..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/bulkrwr.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- bulkrwr.c
-
-Abstract:
-
- This file has routines to perform reads and writes.
- The read and writes are targeted bulk to endpoints.
-
-Environment:
-
- Kernel mode
-
---*/
-
-#include <osrusbfx2.h>
-
-
-#if defined(EVENT_TRACING)
-#include "bulkrwr.tmh"
-#endif
-
-#pragma warning(disable:4267)
-
-VOID
-OsrFxEvtIoRead(
- _In_ WDFQUEUE Queue,
- _In_ WDFREQUEST Request,
- _In_ size_t Length
- )
-/*++
-
-Routine Description:
-
- Called by the framework when it receives Read or Write requests.
-
-Arguments:
-
- Queue - Default queue handle
- Request - Handle to the read/write request
- Lenght - Length of the data buffer associated with the request.
- The default property of the queue is to not dispatch
- zero lenght read & write requests to the driver and
- complete is with status success. So we will never get
- a zero length request.
-
-Return Value:
-
-
---*/
-{
- WDFUSBPIPE pipe;
- NTSTATUS status;
- WDFMEMORY reqMemory;
- PDEVICE_CONTEXT pDeviceContext;
- GUID activity = RequestToActivityId(Request);
-
- UNREFERENCED_PARAMETER(Queue);
-
- //
- // Log read start event, using IRP activity ID if available or request
- // handle otherwise.
- //
-
- EventWriteReadStart(&activity, WdfIoQueueGetDevice(Queue), (ULONG)Length);
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_READ, "-->OsrFxEvtIoRead\n");
-
- //
- // First validate input parameters.
- //
- if (Length > TEST_BOARD_TRANSFER_BUFFER_SIZE) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_READ, "Transfer exceeds %d\n",
- TEST_BOARD_TRANSFER_BUFFER_SIZE);
- status = STATUS_INVALID_PARAMETER;
- goto Exit;
- }
-
- pDeviceContext = GetDeviceContext(WdfIoQueueGetDevice(Queue));
-
- pipe = pDeviceContext->BulkReadPipe;
-
- status = WdfRequestRetrieveOutputMemory(Request, &reqMemory);
- if(!NT_SUCCESS(status)){
- TraceEvents(TRACE_LEVEL_ERROR, DBG_READ,
- "WdfRequestRetrieveOutputMemory failed %!STATUS!\n", status);
- goto Exit;
- }
-
- //
- // The format call validates to make sure that you are reading or
- // writing to the right pipe type, sets the appropriate transfer flags,
- // creates an URB and initializes the request.
- //
- status = WdfUsbTargetPipeFormatRequestForRead(pipe,
- Request,
- reqMemory,
- NULL // Offsets
- );
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_READ,
- "WdfUsbTargetPipeFormatRequestForRead failed 0x%x\n", status);
- goto Exit;
- }
-
- WdfRequestSetCompletionRoutine(
- Request,
- EvtRequestReadCompletionRoutine,
- pipe);
- //
- // Send the request asynchronously.
- //
- if (WdfRequestSend(Request, WdfUsbTargetPipeGetIoTarget(pipe), WDF_NO_SEND_OPTIONS) == FALSE) {
- //
- // Framework couldn't send the request for some reason.
- //
- TraceEvents(TRACE_LEVEL_ERROR, DBG_READ, "WdfRequestSend failed\n");
- status = WdfRequestGetStatus(Request);
- goto Exit;
- }
-
-
-Exit:
- if (!NT_SUCCESS(status)) {
- //
- // log event read failed
- //
- EventWriteReadFail(&activity, WdfIoQueueGetDevice(Queue), status);
- WdfRequestCompleteWithInformation(Request, status, 0);
- }
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_READ, "<-- OsrFxEvtIoRead\n");
-
- return;
-}
-
-VOID
-EvtRequestReadCompletionRoutine(
- _In_ WDFREQUEST Request,
- _In_ WDFIOTARGET Target,
- _In_ PWDF_REQUEST_COMPLETION_PARAMS CompletionParams,
- _In_ WDFCONTEXT Context
- )
-/*++
-
-Routine Description:
-
- This is the completion routine for reads
- If the irp completes with success, we check if we
- need to recirculate this irp for another stage of
- transfer.
-
-Arguments:
-
- Context - Driver supplied context
- Device - Device handle
- Request - Request handle
- Params - request completion params
-
-Return Value:
- None
-
---*/
-{
- NTSTATUS status;
- size_t bytesRead = 0;
- GUID activity = RequestToActivityId(Request);
- PWDF_USB_REQUEST_COMPLETION_PARAMS usbCompletionParams;
-
- UNREFERENCED_PARAMETER(Target);
- UNREFERENCED_PARAMETER(Context);
-
- status = CompletionParams->IoStatus.Status;
-
- usbCompletionParams = CompletionParams->Parameters.Usb.Completion;
-
- bytesRead = usbCompletionParams->Parameters.PipeRead.Length;
-
- if (NT_SUCCESS(status)){
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_READ,
- "Number of bytes read: %I64d\n", (INT64)bytesRead);
- } else {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_READ,
- "Read failed - request status 0x%x UsbdStatus 0x%x\n",
- status, usbCompletionParams->UsbdStatus);
-
- }
-
- //
- // Log read stop event, using IRP activity ID if available or request
- // handle otherwise.
- //
-
- EventWriteReadStop(&activity,
- WdfIoQueueGetDevice(WdfRequestGetIoQueue(Request)),
- bytesRead,
- status,
- usbCompletionParams->UsbdStatus);
-
- WdfRequestCompleteWithInformation(Request, status, bytesRead);
-
- return;
-}
-
-VOID
-OsrFxEvtIoWrite(
- _In_ WDFQUEUE Queue,
- _In_ WDFREQUEST Request,
- _In_ size_t Length
- )
-/*++
-
-Routine Description:
-
- Called by the framework when it receives Read or Write requests.
-
-Arguments:
-
- Queue - Default queue handle
- Request - Handle to the read/write request
- Lenght - Length of the data buffer associated with the request.
- The default property of the queue is to not dispatch
- zero lenght read & write requests to the driver and
- complete is with status success. So we will never get
- a zero length request.
-
-Return Value:
-
-
---*/
-{
- NTSTATUS status;
- WDFUSBPIPE pipe;
- WDFMEMORY reqMemory;
- PDEVICE_CONTEXT pDeviceContext;
- GUID activity = RequestToActivityId(Request);
-
- UNREFERENCED_PARAMETER(Queue);
-
-
- //
- // Log write start event, using IRP activity ID if available or request
- // handle otherwise.
- //
- EventWriteWriteStart(&activity, WdfIoQueueGetDevice(Queue), (ULONG)Length);
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE, "-->OsrFxEvtIoWrite\n");
-
- //
- // First validate input parameters.
- //
- if (Length > TEST_BOARD_TRANSFER_BUFFER_SIZE) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_READ, "Transfer exceeds %d\n",
- TEST_BOARD_TRANSFER_BUFFER_SIZE);
- status = STATUS_INVALID_PARAMETER;
- goto Exit;
- }
-
- pDeviceContext = GetDeviceContext(WdfIoQueueGetDevice(Queue));
-
- pipe = pDeviceContext->BulkWritePipe;
-
- status = WdfRequestRetrieveInputMemory(Request, &reqMemory);
- if(!NT_SUCCESS(status)){
- TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE, "WdfRequestRetrieveInputBuffer failed\n");
- goto Exit;
- }
-
- status = WdfUsbTargetPipeFormatRequestForWrite(pipe,
- Request,
- reqMemory,
- NULL); // Offset
-
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
- "WdfUsbTargetPipeFormatRequestForWrite failed 0x%x\n", status);
- goto Exit;
- }
-
- WdfRequestSetCompletionRoutine(
- Request,
- EvtRequestWriteCompletionRoutine,
- pipe);
-
- //
- // Send the request asynchronously.
- //
- if (WdfRequestSend(Request, WdfUsbTargetPipeGetIoTarget(pipe), WDF_NO_SEND_OPTIONS) == FALSE) {
- //
- // Framework couldn't send the request for some reason.
- //
- TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE, "WdfRequestSend failed\n");
- status = WdfRequestGetStatus(Request);
- goto Exit;
- }
-
-Exit:
-
- if (!NT_SUCCESS(status)) {
- //
- // log event write failed
- //
- EventWriteWriteFail(&activity, WdfIoQueueGetDevice(Queue), status);
-
- WdfRequestCompleteWithInformation(Request, status, 0);
- }
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE, "<-- OsrFxEvtIoWrite\n");
-
- return;
-}
-
-VOID
-EvtRequestWriteCompletionRoutine(
- _In_ WDFREQUEST Request,
- _In_ WDFIOTARGET Target,
- _In_ PWDF_REQUEST_COMPLETION_PARAMS CompletionParams,
- _In_ WDFCONTEXT Context
- )
-/*++
-
-Routine Description:
-
- This is the completion routine for writes
- If the irp completes with success, we check if we
- need to recirculate this irp for another stage of
- transfer.
-
-Arguments:
-
- Context - Driver supplied context
- Device - Device handle
- Request - Request handle
- Params - request completion params
-
-Return Value:
- None
-
---*/
-{
- NTSTATUS status;
- size_t bytesWritten = 0;
- GUID activity = RequestToActivityId(Request);
- PWDF_USB_REQUEST_COMPLETION_PARAMS usbCompletionParams;
-
- UNREFERENCED_PARAMETER(Target);
- UNREFERENCED_PARAMETER(Context);
-
- status = CompletionParams->IoStatus.Status;
-
- //
- // For usb devices, we should look at the Usb.Completion param.
- //
- usbCompletionParams = CompletionParams->Parameters.Usb.Completion;
-
- bytesWritten = usbCompletionParams->Parameters.PipeWrite.Length;
-
- if (NT_SUCCESS(status)){
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_WRITE,
- "Number of bytes written: %I64d\n", (INT64)bytesWritten);
- } else {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
- "Write failed: request Status 0x%x UsbdStatus 0x%x\n",
- status, usbCompletionParams->UsbdStatus);
- }
-
- //
- // Log write stop event, using IRP activtiy ID if available or request
- // handle otherwise
- //
- EventWriteWriteStop(&activity,
- WdfIoQueueGetDevice(WdfRequestGetIoQueue(Request)),
- bytesWritten,
- status,
- usbCompletionParams->UsbdStatus);
-
-
- WdfRequestCompleteWithInformation(Request, status, bytesWritten);
-
- return;
-}
-
-
-VOID
-OsrFxEvtIoStop(
- _In_ WDFQUEUE Queue,
- _In_ WDFREQUEST Request,
- _In_ ULONG ActionFlags
- )
-/*++
-
-Routine Description:
-
- This callback is invoked on every inflight request when the device
- is suspended or removed. Since our inflight read and write requests
- are actually pending in the target device, we will just acknowledge
- its presence. Until we acknowledge, complete, or requeue the requests
- framework will wait before allowing the device suspend or remove to
- proceeed. When the underlying USB stack gets the request to suspend or
- remove, it will fail all the pending requests.
-
-Arguments:
-
- Queue - handle to queue object that is associated with the I/O request
-
- Request - handle to a request object
-
- ActionFlags - bitwise OR of one or more WDF_REQUEST_STOP_ACTION_FLAGS flags
-
-Return Value:
- None
-
---*/
-{
- UNREFERENCED_PARAMETER(Queue);
- UNREFERENCED_PARAMETER(ActionFlags);
-
- if (ActionFlags & WdfRequestStopActionSuspend ) {
- WdfRequestStopAcknowledge(Request, FALSE); // Don't requeue
- } else if(ActionFlags & WdfRequestStopActionPurge) {
- WdfRequestCancelSentRequest(Request);
- }
- return;
-}
-
-
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/driver.c b/usb/umdf_filter_kmdf/kmdf_driver/driver.c
deleted file mode 100644
index 25be851e..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/driver.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- Driver.c
-
-Abstract:
-
- Main module.
-
- This driver is for Open System Resources USB-FX2 Learning Kit designed
- and built by OSR specifically for use in teaching software developers how to write
- drivers for USB devices.
-
- The board supports a single configuration. The board automatically
- detects the speed of the host controller, and supplies either the
- high or full speed configuration based on the host controller's speed.
-
- The firmware supports 3 endpoints:
-
- Endpoint number 1 is used to indicate the state of the 8-switch
- switch-pack on the OSR USB-FX2 board. A single byte representing
- the switch state is sent (a) when the board is first started,
- (b) when the board resumes after selective-suspend,
- (c) whenever the state of the switches is changed.
-
- Endpoints 6 and 8 perform an internal loop-back function.
- Data that is sent to the board at EP6 is returned to the host on EP8.
-
- For further information on the endpoints, please refer to the spec
- http://www.osronline.com/hardware/OSRFX2_32.pdf.
-
- Vendor ID of the device is 0x4705 and Product ID is 0x210.
-
-Environment:
-
- Kernel mode only
-
---*/
-
-#include <osrusbfx2.h>
-
-#if defined(EVENT_TRACING)
-//
-// The trace message header (.tmh) file must be included in a source file
-// before any WPP macro calls and after defining a WPP_CONTROL_GUIDS
-// macro (defined in trace.h). During the compilation, WPP scans the source
-// files for DoTraceMessage() calls and builds a .tmh file which stores a unique
-// data GUID for each message, the text resource string for each message,
-// and the data types of the variables passed in for each message. This file
-// is automatically generated and used during post-processing.
-//
-#include "driver.tmh"
-#else
-ULONG DebugLevel = TRACE_LEVEL_INFORMATION;
-ULONG DebugFlag = 0xff;
-#endif
-
-PFN_IO_GET_ACTIVITY_ID_IRP g_pIoGetActivityIdIrp;
-PFN_IO_SET_DEVICE_INTERFACE_PROPERTY_DATA g_pIoSetDeviceInterfacePropertyData;
-
-#ifdef ALLOC_PRAGMA
-#pragma alloc_text(INIT, DriverEntry)
-#pragma alloc_text(PAGE, OsrFxEvtDriverContextCleanup)
-#endif
-
-NTSTATUS
-DriverEntry(
- PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath
- )
-/*++
-
-Routine Description:
- DriverEntry initializes the driver and is the first routine called by the
- system after the driver is loaded.
-
-Parameters Description:
-
- DriverObject - represents the instance of the function driver that is loaded
- into memory. DriverEntry must initialize members of DriverObject before it
- returns to the caller. DriverObject is allocated by the system before the
- driver is loaded, and it is released by the system after the system unloads
- the function driver from memory.
-
- RegistryPath - represents the driver specific path in the Registry.
- The function driver can use the path to store driver related data between
- reboots. The path does not store hardware instance specific data.
-
-Return Value:
-
- STATUS_SUCCESS if successful,
- STATUS_UNSUCCESSFUL or another NTSTATUS error code otherwise.
-
---*/
-{
- WDF_DRIVER_CONFIG config;
- NTSTATUS status;
- WDF_OBJECT_ATTRIBUTES attributes;
- UNICODE_STRING funcName;
-
- //
- // Initialize WPP Tracing
- //
- WPP_INIT_TRACING( DriverObject, RegistryPath );
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
- "OSRUSBFX2 Driver Sample - Driver Framework Edition.\n");
-
- //
- // IRP activity ID functions are available on some versions, save them into
- // globals (or NULL if not available)
- //
- RtlInitUnicodeString(&funcName, L"IoGetActivityIdIrp");
- g_pIoGetActivityIdIrp = (PFN_IO_GET_ACTIVITY_ID_IRP) (ULONG_PTR)
- MmGetSystemRoutineAddress(&funcName);
-
- //
- // The Device interface property set is available on some version, save it
- // into globals (or NULL if not available)
- //
- RtlInitUnicodeString(&funcName, L"IoSetDeviceInterfacePropertyData");
- g_pIoSetDeviceInterfacePropertyData = (PFN_IO_SET_DEVICE_INTERFACE_PROPERTY_DATA) (ULONG_PTR)
- MmGetSystemRoutineAddress(&funcName);
-
- //
- // Register with ETW (unified tracing)
- //
- EventRegisterOSRUSBFX2();
-
- //
- // Initialize driver config to control the attributes that
- // are global to the driver. Note that framework by default
- // provides a driver unload routine. If you create any resources
- // in the DriverEntry and want to be cleaned in driver unload,
- // you can override that by manually setting the EvtDriverUnload in the
- // config structure. In general xxx_CONFIG_INIT macros are provided to
- // initialize most commonly used members.
- //
-
- WDF_DRIVER_CONFIG_INIT(
- &config,
- OsrFxEvtDeviceAdd
- );
-
- //
- // Register a cleanup callback so that we can call WPP_CLEANUP when
- // the framework driver object is deleted during driver unload.
- //
- WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
- attributes.EvtCleanupCallback = OsrFxEvtDriverContextCleanup;
-
- //
- // Create a framework driver object to represent our driver.
- //
- status = WdfDriverCreate(
- DriverObject,
- RegistryPath,
- &attributes, // Driver Object Attributes
- &config, // Driver Config Info
- WDF_NO_HANDLE // hDriver
- );
-
- if (!NT_SUCCESS(status)) {
-
- TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
- "WdfDriverCreate failed with status 0x%x\n", status);
- //
- // Cleanup tracing here because DriverContextCleanup will not be called
- // as we have failed to create WDFDRIVER object itself.
- // Please note that if your return failure from DriverEntry after the
- // WDFDRIVER object is created successfully, you don't have to
- // call WPP cleanup because in those cases DriverContextCleanup
- // will be executed when the framework deletes the DriverObject.
- //
- WPP_CLEANUP(DriverObject);
- EventUnregisterOSRUSBFX2();
- }
-
- return status;
-}
-
-VOID
-OsrFxEvtDriverContextCleanup(
- WDFOBJECT Driver
- )
-/*++
-Routine Description:
-
- Free resources allocated in DriverEntry that are not automatically
- cleaned up by the framework.
-
-Arguments:
-
- Driver - handle to a WDF Driver object.
-
-Return Value:
-
- VOID.
-
---*/
-{
- //
- // EvtCleanupCallback for WDFDRIVER is always called at PASSIVE_LEVEL
- //
- _IRQL_limited_to_(PASSIVE_LEVEL);
-
- PAGED_CODE ();
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
- "--> OsrFxEvtDriverContextCleanup\n");
-
- WPP_CLEANUP( WdfDriverWdmGetDriverObject( (WDFDRIVER)Driver ));
-
- UNREFERENCED_PARAMETER(Driver); // For the case when WPP is not being used.
-
- EventUnregisterOSRUSBFX2();
-}
-
-#if !defined(EVENT_TRACING)
-
-VOID
-TraceEvents (
- _In_ ULONG DebugPrintLevel,
- _In_ ULONG DebugPrintFlag,
- _Printf_format_string_
- _In_ PCSTR DebugMessage,
- ...
- )
-
-/*++
-
-Routine Description:
-
- Debug print for the sample driver.
-
-Arguments:
-
- DebugPrintLevel - print level between 0 and 3, with 3 the most verbose
- DebugPrintFlag - message mask
- DebugMessage - format string of the message to print
- ... - values used by the format string
-
-Return Value:
-
- None.
-
- --*/
- {
-#if DBG
-#define TEMP_BUFFER_SIZE 1024
- va_list list;
- CHAR debugMessageBuffer[TEMP_BUFFER_SIZE];
- NTSTATUS status;
-
- va_start(list, DebugMessage);
-
- if (DebugMessage) {
-
- //
- // Using new safe string functions instead of _vsnprintf.
- // This function takes care of NULL terminating if the message
- // is longer than the buffer.
- //
- status = RtlStringCbVPrintfA( debugMessageBuffer,
- sizeof(debugMessageBuffer),
- DebugMessage,
- list );
- if(!NT_SUCCESS(status)) {
-
- DbgPrint (_DRIVER_NAME_": RtlStringCbVPrintfA failed 0x%x\n", status);
- return;
- }
- if (DebugPrintLevel <= TRACE_LEVEL_ERROR ||
- (DebugPrintLevel <= DebugLevel &&
- ((DebugPrintFlag & DebugFlag) == DebugPrintFlag))) {
- DbgPrint("%s %s", _DRIVER_NAME_, debugMessageBuffer);
- }
- }
- va_end(list);
-
- return;
-#else
- UNREFERENCED_PARAMETER(DebugPrintLevel);
- UNREFERENCED_PARAMETER(DebugPrintFlag);
- UNREFERENCED_PARAMETER(DebugMessage);
-#endif
-}
-
-#endif
-
-
-
-
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/interrupt.c b/usb/umdf_filter_kmdf/kmdf_driver/interrupt.c
deleted file mode 100644
index 00ea3550..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/interrupt.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- Interrupt.c
-
-Abstract:
-
- This modules has routines configure a continuous reader on an
- interrupt pipe to asynchronously read toggle switch states.
-
-Environment:
-
- Kernel mode
-
---*/
-
-#include <osrusbfx2.h>
-
-#if defined(EVENT_TRACING)
-#include "interrupt.tmh"
-#endif
-
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-OsrFxConfigContReaderForInterruptEndPoint(
- _In_ PDEVICE_CONTEXT DeviceContext
- )
-/*++
-
-Routine Description:
-
- This routine configures a continuous reader on the
- interrupt endpoint. It's called from the PrepareHarware event.
-
-Arguments:
-
-
-Return Value:
-
- NT status value
-
---*/
-{
- WDF_USB_CONTINUOUS_READER_CONFIG contReaderConfig;
- NTSTATUS status;
-
- WDF_USB_CONTINUOUS_READER_CONFIG_INIT(&contReaderConfig,
- OsrFxEvtUsbInterruptPipeReadComplete,
- DeviceContext, // Context
- sizeof(UCHAR)); // TransferLength
-
- contReaderConfig.EvtUsbTargetPipeReadersFailed = OsrFxEvtUsbInterruptReadersFailed;
-
- //
- // Reader requests are not posted to the target automatically.
- // Driver must explictly call WdfIoTargetStart to kick start the
- // reader. In this sample, it's done in D0Entry.
- // By defaut, framework queues two requests to the target
- // endpoint. Driver can configure up to 10 requests with CONFIG macro.
- //
- status = WdfUsbTargetPipeConfigContinuousReader(DeviceContext->InterruptPipe,
- &contReaderConfig);
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
- "OsrFxConfigContReaderForInterruptEndPoint failed %x\n",
- status);
- return status;
- }
-
- return status;
-}
-
-VOID
-OsrFxEvtUsbInterruptPipeReadComplete(
- WDFUSBPIPE Pipe,
- WDFMEMORY Buffer,
- size_t NumBytesTransferred,
- WDFCONTEXT Context
- )
-/*++
-
-Routine Description:
-
- This the completion routine of the continour reader. This can
- called concurrently on multiprocessor system if there are
- more than one readers configured. So make sure to protect
- access to global resources.
-
-Arguments:
-
- Buffer - This buffer is freed when this call returns.
- If the driver wants to delay processing of the buffer, it
- can take an additional referrence.
-
- Context - Provided in the WDF_USB_CONTINUOUS_READER_CONFIG_INIT macro
-
-Return Value:
-
- NT status value
-
---*/
-{
- PUCHAR switchState = NULL;
- WDFDEVICE device;
- PDEVICE_CONTEXT pDeviceContext = Context;
-
- UNREFERENCED_PARAMETER(Pipe);
-
- device = WdfObjectContextGetObject(pDeviceContext);
-
- //
- // Make sure that there is data in the read packet. Depending on the device
- // specification, it is possible for it to return a 0 length read in
- // certain conditions.
- //
-
- if (NumBytesTransferred == 0) {
- TraceEvents(TRACE_LEVEL_WARNING, DBG_INIT,
- "OsrFxEvtUsbInterruptPipeReadComplete Zero length read "
- "occured on the Interrupt Pipe's Continuous Reader\n"
- );
- return;
- }
-
-
- NT_ASSERT(NumBytesTransferred == sizeof(UCHAR));
-
- switchState = WdfMemoryGetBuffer(Buffer, NULL);
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
- "OsrFxEvtUsbInterruptPipeReadComplete SwitchState %x\n",
- *switchState);
-
- pDeviceContext->CurrentSwitchState = *switchState;
-
- //
- // Handle any pending Interrupt Message IOCTLs. Note that the OSR USB device
- // will generate an interrupt message when the the device resumes from a low
- // power state. So if the Interrupt Message IOCTL was sent after the device
- // has gone to a low power state, the pending Interrupt Message IOCTL will
- // get completed in the function call below, before the user twiddles the
- // dip switches on the OSR USB device. If this is not the desired behavior
- // for your driver, then you could handle this condition by maintaining a
- // state variable on D0Entry to track interrupt messages caused by power up.
- //
- OsrUsbIoctlGetInterruptMessage(device, STATUS_SUCCESS);
-
-}
-
-BOOLEAN
-OsrFxEvtUsbInterruptReadersFailed(
- _In_ WDFUSBPIPE Pipe,
- _In_ NTSTATUS Status,
- _In_ USBD_STATUS UsbdStatus
- )
-{
- WDFDEVICE device = WdfIoTargetGetDevice(WdfUsbTargetPipeGetIoTarget(Pipe));
- PDEVICE_CONTEXT pDeviceContext = GetDeviceContext(device);
-
- UNREFERENCED_PARAMETER(UsbdStatus);
-
- //
- // Clear the current switch state.
- //
- pDeviceContext->CurrentSwitchState = 0;
-
- //
- // Service the pending interrupt switch change request
- //
- OsrUsbIoctlGetInterruptMessage(device, Status);
-
- return TRUE;
-}
-
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/ioctl.c b/usb/umdf_filter_kmdf/kmdf_driver/ioctl.c
deleted file mode 100644
index e36bcef1..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/ioctl.c
+++ /dev/null
@@ -1,1063 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- Ioctl.c
-
-Abstract:
-
- USB device driver for OSR USB-FX2 Learning Kit
-
-Environment:
-
- Kernel mode only
-
---*/
-
-#include <osrusbfx2.h>
-
-#if defined(EVENT_TRACING)
-#include "ioctl.tmh"
-#endif
-
-#pragma alloc_text(PAGE, OsrFxEvtIoDeviceControl)
-#pragma alloc_text(PAGE, ResetPipe)
-#pragma alloc_text(PAGE, ResetDevice)
-#pragma alloc_text(PAGE, ReenumerateDevice)
-#pragma alloc_text(PAGE, GetBarGraphState)
-#pragma alloc_text(PAGE, SetBarGraphState)
-#pragma alloc_text(PAGE, GetSevenSegmentState)
-#pragma alloc_text(PAGE, SetSevenSegmentState)
-#pragma alloc_text(PAGE, GetSwitchState)
-
-VOID
-OsrFxEvtIoDeviceControl(
- _In_ WDFQUEUE Queue,
- _In_ WDFREQUEST Request,
- _In_ size_t OutputBufferLength,
- _In_ size_t InputBufferLength,
- _In_ ULONG IoControlCode
- )
-/*++
-
-Routine Description:
-
- This event is called when the framework receives IRP_MJ_DEVICE_CONTROL
- requests from the system.
-
-Arguments:
-
- Queue - Handle to the framework queue object that is associated
- with the I/O request.
- Request - Handle to a framework request object.
-
- OutputBufferLength - length of the request's output buffer,
- if an output buffer is available.
- InputBufferLength - length of the request's input buffer,
- if an input buffer is available.
-
- IoControlCode - the driver-defined or system-defined I/O control code
- (IOCTL) that is associated with the request.
-Return Value:
-
- VOID
-
---*/
-{
- WDFDEVICE device;
- PDEVICE_CONTEXT pDevContext;
- size_t bytesReturned = 0;
- PBAR_GRAPH_STATE barGraphState = NULL;
- PSWITCH_STATE switchState = NULL;
- PUCHAR sevenSegment = NULL;
- BOOLEAN requestPending = FALSE;
- NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST;
-
- UNREFERENCED_PARAMETER(InputBufferLength);
- UNREFERENCED_PARAMETER(OutputBufferLength);
-
- //
- // If your driver is at the top of its driver stack, EvtIoDeviceControl is called
- // at IRQL = PASSIVE_LEVEL.
- //
- _IRQL_limited_to_(PASSIVE_LEVEL);
-
- PAGED_CODE();
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL, "--> OsrFxEvtIoDeviceControl\n");
- //
- // initialize variables
- //
- device = WdfIoQueueGetDevice(Queue);
- pDevContext = GetDeviceContext(device);
-
- switch(IoControlCode) {
-
- case IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR: {
-
- PUSB_CONFIGURATION_DESCRIPTOR configurationDescriptor = NULL;
- USHORT requiredSize = 0;
-
- //
- // First get the size of the config descriptor
- //
- status = WdfUsbTargetDeviceRetrieveConfigDescriptor(
- pDevContext->UsbDevice,
- NULL,
- &requiredSize);
-
- if (status != STATUS_BUFFER_TOO_SMALL) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "WdfUsbTargetDeviceRetrieveConfigDescriptor failed 0x%x\n", status);
- break;
- }
-
- //
- // Get the buffer - make sure the buffer is big enough
- //
- status = WdfRequestRetrieveOutputBuffer(Request,
- (size_t)requiredSize, // MinimumRequired
- &configurationDescriptor,
- NULL);
- if(!NT_SUCCESS(status)){
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "WdfRequestRetrieveOutputBuffer failed 0x%x\n", status);
- break;
- }
-
- status = WdfUsbTargetDeviceRetrieveConfigDescriptor(
- pDevContext->UsbDevice,
- configurationDescriptor,
- &requiredSize);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "WdfUsbTargetDeviceRetrieveConfigDescriptor failed 0x%x\n", status);
- break;
- }
-
- bytesReturned = requiredSize;
-
- }
- break;
-
- case IOCTL_OSRUSBFX2_RESET_DEVICE:
-
- status = ResetDevice(device);
- break;
-
- case IOCTL_OSRUSBFX2_REENUMERATE_DEVICE:
-
- //
- // Otherwise, call our function to reenumerate the
- // device
- //
- status = ReenumerateDevice(pDevContext);
-
- bytesReturned = 0;
- break;
-
- case IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY:
-
- //
- // Make sure the caller's output buffer is large enough
- // to hold the state of the bar graph
- //
- status = WdfRequestRetrieveOutputBuffer(Request,
- sizeof(BAR_GRAPH_STATE),
- &barGraphState,
- NULL);
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "User's output buffer is too small for this IOCTL, expecting an BAR_GRAPH_STATE\n");
- break;
- }
- //
- // Call our function to get the bar graph state
- //
- status = GetBarGraphState(pDevContext, barGraphState);
-
- //
- // If we succeeded return the user their data
- //
- if (NT_SUCCESS(status)) {
-
- bytesReturned = sizeof(BAR_GRAPH_STATE);
-
- } else {
-
- bytesReturned = 0;
-
- }
- break;
-
- case IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY:
-
- status = WdfRequestRetrieveInputBuffer(Request,
- sizeof(BAR_GRAPH_STATE),
- &barGraphState,
- NULL);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "User's input buffer is too small for this IOCTL, expecting an BAR_GRAPH_STATE\n");
- break;
- }
-
- //
- // Call our routine to set the bar graph state
- //
- status = SetBarGraphState(pDevContext, barGraphState);
-
- //
- // There's no data returned for this call
- //
- bytesReturned = 0;
- break;
-
- case IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY:
-
- status = WdfRequestRetrieveOutputBuffer(Request,
- sizeof(UCHAR),
- &sevenSegment,
- NULL);
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "User's output buffer is too small for this IOCTL, expecting an UCHAR\n");
- break;
- }
-
- //
- // Call our function to get the 7 segment state
- //
- status = GetSevenSegmentState(pDevContext, sevenSegment);
-
- //
- // If we succeeded return the user their data
- //
- if (NT_SUCCESS(status)) {
-
- bytesReturned = sizeof(UCHAR);
-
- } else {
-
- bytesReturned = 0;
-
- }
- break;
-
- case IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY:
-
- status = WdfRequestRetrieveInputBuffer(Request,
- sizeof(UCHAR),
- &sevenSegment,
- NULL);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "User's input buffer is too small for this IOCTL, expecting an UCHAR\n");
- bytesReturned = sizeof(UCHAR);
- break;
- }
-
- //
- // Call our routine to set the 7 segment state
- //
- status = SetSevenSegmentState(pDevContext, sevenSegment);
-
- //
- // There's no data returned for this call
- //
- bytesReturned = 0;
- break;
-
- case IOCTL_OSRUSBFX2_READ_SWITCHES:
-
- status = WdfRequestRetrieveOutputBuffer(Request,
- sizeof(SWITCH_STATE),
- &switchState,
- NULL);// BufferLength
-
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "User's output buffer is too small for this IOCTL, expecting a SWITCH_STATE\n");
- bytesReturned = sizeof(SWITCH_STATE);
- break;
-
- }
-
- //
- // Call our routine to get the state of the switches
- //
- status = GetSwitchState(pDevContext, switchState);
-
- //
- // If successful, return the user their data
- //
- if (NT_SUCCESS(status)) {
-
- bytesReturned = sizeof(SWITCH_STATE);
-
- } else {
- //
- // Don't return any data
- //
- bytesReturned = 0;
- }
- break;
-
- case IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE:
-
- //
- // Forward the request to an interrupt message queue and dont complete
- // the request until an interrupt from the USB device occurs.
- //
- status = WdfRequestForwardToIoQueue(Request, pDevContext->InterruptMsgQueue);
- if (NT_SUCCESS(status)) {
- requestPending = TRUE;
- }
-
- break;
-
- default :
- status = STATUS_INVALID_DEVICE_REQUEST;
- break;
- }
-
- if (requestPending == FALSE) {
- WdfRequestCompleteWithInformation(Request, status, bytesReturned);
- }
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL, "<-- OsrFxEvtIoDeviceControl\n");
-
- return;
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-ResetPipe(
- _In_ WDFUSBPIPE Pipe
- )
-/*++
-
-Routine Description:
-
- This routine resets the pipe.
-
-Arguments:
-
- Pipe - framework pipe handle
-
-Return Value:
-
- NT status value
-
---*/
-{
- NTSTATUS status;
-
- PAGED_CODE();
-
- //
- // This routine synchronously submits a URB_FUNCTION_RESET_PIPE
- // request down the stack.
- //
- status = WdfUsbTargetPipeResetSynchronously(Pipe,
- WDF_NO_HANDLE, // WDFREQUEST
- NULL // PWDF_REQUEST_SEND_OPTIONS
- );
-
- if (NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL, "ResetPipe - success\n");
- status = STATUS_SUCCESS;
- }
- else {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "ResetPipe - failed\n");
- }
-
- return status;
-}
-
-VOID
-StopAllPipes(
- IN PDEVICE_CONTEXT DeviceContext
- )
-{
- WdfIoTargetStop(WdfUsbTargetPipeGetIoTarget(DeviceContext->InterruptPipe),
- WdfIoTargetCancelSentIo);
- WdfIoTargetStop(WdfUsbTargetPipeGetIoTarget(DeviceContext->BulkReadPipe),
- WdfIoTargetCancelSentIo);
- WdfIoTargetStop(WdfUsbTargetPipeGetIoTarget(DeviceContext->BulkWritePipe),
- WdfIoTargetCancelSentIo);
-}
-
-NTSTATUS
-StartAllPipes(
- IN PDEVICE_CONTEXT DeviceContext
- )
-{
- NTSTATUS status;
-
- status = WdfIoTargetStart(WdfUsbTargetPipeGetIoTarget(DeviceContext->InterruptPipe));
- if (!NT_SUCCESS(status)) {
- return status;
- }
-
- status = WdfIoTargetStart(WdfUsbTargetPipeGetIoTarget(DeviceContext->BulkReadPipe));
- if (!NT_SUCCESS(status)) {
- return status;
- }
-
- status = WdfIoTargetStart(WdfUsbTargetPipeGetIoTarget(DeviceContext->BulkWritePipe));
- if (!NT_SUCCESS(status)) {
- return status;
- }
-
- return status;
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-ResetDevice(
- _In_ WDFDEVICE Device
- )
-/*++
-
-Routine Description:
-
- This routine calls WdfUsbTargetDeviceResetPortSynchronously to reset the device if it's still
- connected.
-
-Arguments:
-
- Device - Handle to a framework device
-
-Return Value:
-
- NT status value
-
---*/
-{
- PDEVICE_CONTEXT pDeviceContext;
- NTSTATUS status;
-
- PAGED_CODE();
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL, "--> ResetDevice\n");
-
- pDeviceContext = GetDeviceContext(Device);
-
- //
- // A NULL timeout indicates an infinite wake
- //
- status = WdfWaitLockAcquire(pDeviceContext->ResetDeviceWaitLock, NULL);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "ResetDevice - could not acquire lock\n");
- return status;
- }
-
- StopAllPipes(pDeviceContext);
-
- status = WdfUsbTargetDeviceResetPortSynchronously(pDeviceContext->UsbDevice);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "ResetDevice failed - 0x%x\n", status);
- }
-
- status = StartAllPipes(pDeviceContext);
- if (!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "Failed to start all pipes - 0x%x\n", status);
- }
-
- WdfWaitLockRelease(pDeviceContext->ResetDeviceWaitLock);
-
- TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL, "<-- ResetDevice\n");
- return status;
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-ReenumerateDevice(
- _In_ PDEVICE_CONTEXT DevContext
- )
-/*++
-
-Routine Description
-
- This routine re-enumerates the USB device.
-
-Arguments:
-
- pDevContext - One of our device extensions
-
-Return Value:
-
- NT status value
-
---*/
-{
- NTSTATUS status;
- WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket;
- WDF_REQUEST_SEND_OPTIONS sendOptions;
- GUID activity;
-
- PAGED_CODE();
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL,"--> ReenumerateDevice\n");
-
- WDF_REQUEST_SEND_OPTIONS_INIT(
- &sendOptions,
- WDF_REQUEST_SEND_OPTION_TIMEOUT
- );
-
- WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
- &sendOptions,
- DEFAULT_CONTROL_TRANSFER_TIMEOUT
- );
-
- WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&controlSetupPacket,
- BmRequestHostToDevice,
- BmRequestToDevice,
- USBFX2LK_REENUMERATE, // Request
- 0, // Value
- 0); // Index
-
-
- status = WdfUsbTargetDeviceSendControlTransferSynchronously(
- DevContext->UsbDevice,
- WDF_NO_HANDLE, // Optional WDFREQUEST
- &sendOptions,
- &controlSetupPacket,
- NULL, // MemoryDescriptor
- NULL); // BytesTransferred
-
- if(!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "ReenumerateDevice: Failed to Reenumerate - 0x%x \n", status);
- }
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL,"<-- ReenumerateDevice\n");
-
- //
- // Send event to eventlog
- //
-
- activity = DeviceToActivityId(WdfObjectContextGetObject(DevContext));
- EventWriteDeviceReenumerated(&activity,
- DevContext->DeviceName,
- DevContext->Location,
- status);
-
- return status;
-
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-GetBarGraphState(
- _In_ PDEVICE_CONTEXT DevContext,
- _Out_ PBAR_GRAPH_STATE BarGraphState
- )
-/*++
-
-Routine Description
-
- This routine gets the state of the bar graph on the board
-
-Arguments:
-
- DevContext - One of our device extensions
-
- BarGraphState - Struct that receives the bar graph's state
-
-Return Value:
-
- NT status value
-
---*/
-{
- NTSTATUS status;
- WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket;
- WDF_REQUEST_SEND_OPTIONS sendOptions;
- WDF_MEMORY_DESCRIPTOR memDesc;
- ULONG bytesTransferred;
-
- PAGED_CODE();
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "--> GetBarGraphState\n");
-
- WDF_REQUEST_SEND_OPTIONS_INIT(
- &sendOptions,
- WDF_REQUEST_SEND_OPTION_TIMEOUT
- );
-
- WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
- &sendOptions,
- DEFAULT_CONTROL_TRANSFER_TIMEOUT
- );
-
- WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&controlSetupPacket,
- BmRequestDeviceToHost,
- BmRequestToDevice,
- USBFX2LK_READ_BARGRAPH_DISPLAY, // Request
- 0, // Value
- 0); // Index
-
- //
- // Set the buffer to 0, the board will OR in everything that is set
- //
- BarGraphState->BarsAsUChar = 0;
-
-
- WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&memDesc,
- BarGraphState,
- sizeof(BAR_GRAPH_STATE));
-
- status = WdfUsbTargetDeviceSendControlTransferSynchronously(
- DevContext->UsbDevice,
- WDF_NO_HANDLE, // Optional WDFREQUEST
- &sendOptions,
- &controlSetupPacket,
- &memDesc,
- &bytesTransferred);
-
- if(!NT_SUCCESS(status)) {
-
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "GetBarGraphState: Failed to GetBarGraphState - 0x%x \n", status);
-
- } else {
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL,
- "GetBarGraphState: LED mask is 0x%x\n", BarGraphState->BarsAsUChar);
- }
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "<-- GetBarGraphState\n");
-
- return status;
-
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-SetBarGraphState(
- _In_ PDEVICE_CONTEXT DevContext,
- _In_ PBAR_GRAPH_STATE BarGraphState
- )
-/*++
-
-Routine Description
-
- This routine sets the state of the bar graph on the board
-
-Arguments:
-
- DevContext - One of our device extensions
-
- BarGraphState - Struct that describes the bar graph's desired state
-
-Return Value:
-
- NT status value
-
---*/
-{
- NTSTATUS status;
- WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket;
- WDF_REQUEST_SEND_OPTIONS sendOptions;
- WDF_MEMORY_DESCRIPTOR memDesc;
- ULONG bytesTransferred;
-
- PAGED_CODE();
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "--> SetBarGraphState\n");
-
- WDF_REQUEST_SEND_OPTIONS_INIT(
- &sendOptions,
- WDF_REQUEST_SEND_OPTION_TIMEOUT
- );
-
- WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
- &sendOptions,
- DEFAULT_CONTROL_TRANSFER_TIMEOUT
- );
-
- WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&controlSetupPacket,
- BmRequestHostToDevice,
- BmRequestToDevice,
- USBFX2LK_SET_BARGRAPH_DISPLAY, // Request
- 0, // Value
- 0); // Index
-
- WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&memDesc,
- BarGraphState,
- sizeof(BAR_GRAPH_STATE));
-
- status = WdfUsbTargetDeviceSendControlTransferSynchronously(
- DevContext->UsbDevice,
- NULL, // Optional WDFREQUEST
- &sendOptions,
- &controlSetupPacket,
- &memDesc,
- &bytesTransferred);
-
- if(!NT_SUCCESS(status)) {
-
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "SetBarGraphState: Failed - 0x%x \n", status);
-
- } else {
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL,
- "SetBarGraphState: LED mask is 0x%x\n", BarGraphState->BarsAsUChar);
- }
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "<-- SetBarGraphState\n");
-
- return status;
-
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-GetSevenSegmentState(
- _In_ PDEVICE_CONTEXT DevContext,
- _Out_ PUCHAR SevenSegment
- )
-/*++
-
-Routine Description
-
- This routine gets the state of the 7 segment display on the board
- by sending a synchronous control command.
-
- NOTE: It's not a good practice to send a synchronous request in the
- context of the user thread because if the transfer takes long
- time to complete, you end up holding the user thread.
-
- I'm choosing to do synchronous transfer because a) I know this one
- completes immediately b) and for demonstration.
-
-Arguments:
-
- DevContext - One of our device extensions
-
- SevenSegment - receives the state of the 7 segment display
-
-Return Value:
-
- NT status value
-
---*/
-{
- NTSTATUS status;
- WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket;
- WDF_REQUEST_SEND_OPTIONS sendOptions;
-
- WDF_MEMORY_DESCRIPTOR memDesc;
- ULONG bytesTransferred;
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "GetSetSevenSegmentState: Enter\n");
-
- PAGED_CODE();
-
- WDF_REQUEST_SEND_OPTIONS_INIT(
- &sendOptions,
- WDF_REQUEST_SEND_OPTION_TIMEOUT
- );
-
- WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
- &sendOptions,
- DEFAULT_CONTROL_TRANSFER_TIMEOUT
- );
-
- WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&controlSetupPacket,
- BmRequestDeviceToHost,
- BmRequestToDevice,
- USBFX2LK_READ_7SEGMENT_DISPLAY, // Request
- 0, // Value
- 0); // Index
-
- //
- // Set the buffer to 0, the board will OR in everything that is set
- //
- *SevenSegment = 0;
-
- WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&memDesc,
- SevenSegment,
- sizeof(UCHAR));
-
- status = WdfUsbTargetDeviceSendControlTransferSynchronously(
- DevContext->UsbDevice,
- NULL, // Optional WDFREQUEST
- &sendOptions,
- &controlSetupPacket,
- &memDesc,
- &bytesTransferred);
-
- if(!NT_SUCCESS(status)) {
-
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "GetSevenSegmentState: Failed to get 7 Segment state - 0x%x \n", status);
- } else {
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL,
- "GetSevenSegmentState: 7 Segment mask is 0x%x\n", *SevenSegment);
- }
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "GetSetSevenSegmentState: Exit\n");
-
- return status;
-
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-SetSevenSegmentState(
- _In_ PDEVICE_CONTEXT DevContext,
- _In_ PUCHAR SevenSegment
- )
-/*++
-
-Routine Description
-
- This routine sets the state of the 7 segment display on the board
-
-Arguments:
-
- DevContext - One of our device extensions
-
- SevenSegment - desired state of the 7 segment display
-
-Return Value:
-
- NT status value
-
---*/
-{
- NTSTATUS status;
- WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket;
- WDF_REQUEST_SEND_OPTIONS sendOptions;
- WDF_MEMORY_DESCRIPTOR memDesc;
- ULONG bytesTransferred;
-
- PAGED_CODE();
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "--> SetSevenSegmentState\n");
-
- WDF_REQUEST_SEND_OPTIONS_INIT(
- &sendOptions,
- WDF_REQUEST_SEND_OPTION_TIMEOUT
- );
-
- WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
- &sendOptions,
- DEFAULT_CONTROL_TRANSFER_TIMEOUT
- );
-
- WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&controlSetupPacket,
- BmRequestHostToDevice,
- BmRequestToDevice,
- USBFX2LK_SET_7SEGMENT_DISPLAY, // Request
- 0, // Value
- 0); // Index
-
- WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&memDesc,
- SevenSegment,
- sizeof(UCHAR));
-
- status = WdfUsbTargetDeviceSendControlTransferSynchronously(
- DevContext->UsbDevice,
- NULL, // Optional WDFREQUEST
- &sendOptions,
- &controlSetupPacket,
- &memDesc,
- &bytesTransferred);
-
- if(!NT_SUCCESS(status)) {
-
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "SetSevenSegmentState: Failed to set 7 Segment state - 0x%x \n", status);
-
- } else {
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL,
- "SetSevenSegmentState: 7 Segment mask is 0x%x\n", *SevenSegment);
-
- }
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "<-- SetSevenSegmentState\n");
-
- return status;
-
-}
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-GetSwitchState(
- _In_ PDEVICE_CONTEXT DevContext,
- _In_ PSWITCH_STATE SwitchState
- )
-/*++
-
-Routine Description
-
- This routine gets the state of the switches on the board
-
-Arguments:
-
- DevContext - One of our device extensions
-
-Return Value:
-
- NT status value
-
---*/
-{
- NTSTATUS status;
- WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket;
- WDF_REQUEST_SEND_OPTIONS sendOptions;
- WDF_MEMORY_DESCRIPTOR memDesc;
- ULONG bytesTransferred;
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "--> GetSwitchState\n");
-
- PAGED_CODE();
-
- WDF_REQUEST_SEND_OPTIONS_INIT(
- &sendOptions,
- WDF_REQUEST_SEND_OPTION_TIMEOUT
- );
-
- WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(
- &sendOptions,
- DEFAULT_CONTROL_TRANSFER_TIMEOUT
- );
-
- WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&controlSetupPacket,
- BmRequestDeviceToHost,
- BmRequestToDevice,
- USBFX2LK_READ_SWITCHES, // Request
- 0, // Value
- 0); // Index
-
- SwitchState->SwitchesAsUChar = 0;
-
- WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&memDesc,
- SwitchState,
- sizeof(SWITCH_STATE));
-
- status = WdfUsbTargetDeviceSendControlTransferSynchronously(
- DevContext->UsbDevice,
- NULL, // Optional WDFREQUEST
- &sendOptions,
- &controlSetupPacket,
- &memDesc,
- &bytesTransferred);
-
- if(!NT_SUCCESS(status)) {
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "GetSwitchState: Failed to Get switches - 0x%x \n", status);
-
- } else {
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL,
- "GetSwitchState: Switch mask is 0x%x\n", SwitchState->SwitchesAsUChar);
- }
-
- TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "<-- GetSwitchState\n");
-
- return status;
-
-}
-
-
-VOID
-OsrUsbIoctlGetInterruptMessage(
- _In_ WDFDEVICE Device,
- _In_ NTSTATUS ReaderStatus
- )
-/*++
-
-Routine Description
-
- This method handles the completion of the pended request for the IOCTL
- IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE.
-
-Arguments:
-
- Device - Handle to a framework device.
-
-Return Value:
-
- None.
-
---*/
-{
- NTSTATUS status;
- WDFREQUEST request;
- PDEVICE_CONTEXT pDevContext;
- size_t bytesReturned = 0;
- PSWITCH_STATE switchState = NULL;
-
- pDevContext = GetDeviceContext(Device);
-
- do {
-
- //
- // Check if there are any pending requests in the Interrupt Message Queue.
- // If a request is found then complete the pending request.
- //
- status = WdfIoQueueRetrieveNextRequest(pDevContext->InterruptMsgQueue, &request);
-
- if (NT_SUCCESS(status)) {
- status = WdfRequestRetrieveOutputBuffer(request,
- sizeof(SWITCH_STATE),
- &switchState,
- NULL);// BufferLength
-
- if (!NT_SUCCESS(status)) {
-
- TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
- "User's output buffer is too small for this IOCTL, expecting a SWITCH_STATE\n");
- bytesReturned = sizeof(SWITCH_STATE);
-
- } else {
-
- //
- // Copy the state information saved by the continuous reader.
- //
- if (NT_SUCCESS(ReaderStatus)) {
- switchState->SwitchesAsUChar = pDevContext->CurrentSwitchState;
- bytesReturned = sizeof(SWITCH_STATE);
- } else {
- bytesReturned = 0;
- }
- }
-
- //
- // Complete the request. If we failed to get the output buffer then
- // complete with that status. Otherwise complete with the status from the reader.
- //
- WdfRequestCompleteWithInformation(request,
- NT_SUCCESS(status) ? ReaderStatus : status,
- bytesReturned);
- status = STATUS_SUCCESS;
-
- } else if (status != STATUS_NO_MORE_ENTRIES) {
- KdPrint(("WdfIoQueueRetrieveNextRequest status %08x\n", status));
- }
-
- request = NULL;
-
- } while (status == STATUS_SUCCESS);
-
- return;
-
-}
-
-
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.h b/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.h
deleted file mode 100644
index 909e347d..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.h
+++ /dev/null
@@ -1,335 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- private.h
-
-Abstract:
-
- Contains structure definitions and function prototypes private to
- the driver.
-
-Environment:
-
- Kernel mode
-
---*/
-
-#include <initguid.h>
-#include <ntddk.h>
-#include "usbdi.h"
-#include "usbdlib.h"
-#include "public.h"
-#include "driverspecs.h"
-#include <wdf.h>
-#include <wdfusb.h>
-#define NTSTRSAFE_LIB
-#include <ntstrsafe.h>
-
-#include "trace.h"
-
-//
-// Include auto-generated ETW event functions (created by MC.EXE from
-// osrusbfx2.man)
-//
-#include "fx2Events.h"
-
-#ifndef _PRIVATE_H
-#define _PRIVATE_H
-
-#define POOL_TAG (ULONG) 'FRSO'
-#define _DRIVER_NAME_ "OSRUSBFX2"
-
-#define TEST_BOARD_TRANSFER_BUFFER_SIZE (64*1024)
-#define DEVICE_DESC_LENGTH 256
-
-extern const __declspec(selectany) LONGLONG DEFAULT_CONTROL_TRANSFER_TIMEOUT = 5 * -1 * WDF_TIMEOUT_TO_SEC;
-
-//
-// Define the vendor commands supported by our device
-//
-#define USBFX2LK_READ_7SEGMENT_DISPLAY 0xD4
-#define USBFX2LK_READ_SWITCHES 0xD6
-#define USBFX2LK_READ_BARGRAPH_DISPLAY 0xD7
-#define USBFX2LK_SET_BARGRAPH_DISPLAY 0xD8
-#define USBFX2LK_IS_HIGH_SPEED 0xD9
-#define USBFX2LK_REENUMERATE 0xDA
-#define USBFX2LK_SET_7SEGMENT_DISPLAY 0xDB
-
-//
-// Define the features that we can clear
-// and set on our device
-//
-#define USBFX2LK_FEATURE_EPSTALL 0x00
-#define USBFX2LK_FEATURE_WAKE 0x01
-
-//
-// Order of endpoints in the interface descriptor
-//
-#define INTERRUPT_IN_ENDPOINT_INDEX 0
-#define BULK_OUT_ENDPOINT_INDEX 1
-#define BULK_IN_ENDPOINT_INDEX 2
-
-//
-// A structure representing the instance information associated with
-// this particular device.
-//
-
-typedef struct _DEVICE_CONTEXT {
-
- WDFUSBDEVICE UsbDevice;
-
- WDFUSBINTERFACE UsbInterface;
-
- WDFUSBPIPE BulkReadPipe;
-
- WDFUSBPIPE BulkWritePipe;
-
- WDFUSBPIPE InterruptPipe;
-
- WDFWAITLOCK ResetDeviceWaitLock;
-
- UCHAR CurrentSwitchState;
-
- WDFQUEUE InterruptMsgQueue;
-
- ULONG UsbDeviceTraits;
-
- //
- // The following fields are used during event logging to
- // report the events relative to this specific instance
- // of the device.
- //
-
- WDFMEMORY DeviceNameMemory;
- PCWSTR DeviceName;
-
- WDFMEMORY LocationMemory;
- PCWSTR Location;
-
-} DEVICE_CONTEXT, *PDEVICE_CONTEXT;
-
-WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, GetDeviceContext)
-
-extern ULONG DebugLevel;
-
-typedef
-NTSTATUS
-(*PFN_IO_GET_ACTIVITY_ID_IRP) (
- _In_ PIRP Irp,
- _Out_ LPGUID Guid
- );
-
-typedef
-NTSTATUS
-(*PFN_IO_SET_DEVICE_INTERFACE_PROPERTY_DATA) (
- _In_ PUNICODE_STRING SymbolicLinkName,
- _In_ CONST DEVPROPKEY *PropertyKey,
- _In_ LCID Lcid,
- _In_ ULONG Flags,
- _In_ DEVPROPTYPE Type,
- _In_ ULONG Size,
- _In_opt_ PVOID Data
- );
-
-//
-// Global function pointer set in DriverEntry
-// Check for NULL before using
-//
-extern PFN_IO_GET_ACTIVITY_ID_IRP g_pIoGetActivityIdIrp;
-
-extern PFN_IO_SET_DEVICE_INTERFACE_PROPERTY_DATA g_pIoSetDeviceInterfacePropertyData;
-
-DRIVER_INITIALIZE DriverEntry;
-
-EVT_WDF_OBJECT_CONTEXT_CLEANUP OsrFxEvtDriverContextCleanup;
-
-EVT_WDF_DRIVER_DEVICE_ADD OsrFxEvtDeviceAdd;
-
-EVT_WDF_DEVICE_PREPARE_HARDWARE OsrFxEvtDevicePrepareHardware;
-
-EVT_WDF_IO_QUEUE_IO_READ OsrFxEvtIoRead;
-
-EVT_WDF_IO_QUEUE_IO_WRITE OsrFxEvtIoWrite;
-
-EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL OsrFxEvtIoDeviceControl;
-
-EVT_WDF_REQUEST_COMPLETION_ROUTINE EvtRequestReadCompletionRoutine;
-
-EVT_WDF_REQUEST_COMPLETION_ROUTINE EvtRequestWriteCompletionRoutine;
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-ResetPipe(
- _In_ WDFUSBPIPE Pipe
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-ResetDevice(
- _In_ WDFDEVICE Device
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-SelectInterfaces(
- _In_ WDFDEVICE Device
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-ReenumerateDevice(
- _In_ PDEVICE_CONTEXT DevContext
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-GetBarGraphState(
- _In_ PDEVICE_CONTEXT DevContext,
- _Out_ PBAR_GRAPH_STATE BarGraphState
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-SetBarGraphState(
- _In_ PDEVICE_CONTEXT DevContext,
- _In_ PBAR_GRAPH_STATE BarGraphState
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-GetSevenSegmentState(
- _In_ PDEVICE_CONTEXT DevContext,
- _Out_ PUCHAR SevenSegment
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-SetSevenSegmentState(
- _In_ PDEVICE_CONTEXT DevContext,
- _In_ PUCHAR SevenSegment
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-GetSwitchState(
- _In_ PDEVICE_CONTEXT DevContext,
- _In_ PSWITCH_STATE SwitchState
- );
-
-VOID
-OsrUsbIoctlGetInterruptMessage(
- _In_ WDFDEVICE Device,
- _In_ NTSTATUS ReaderStatus
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-OsrFxSetPowerPolicy(
- _In_ WDFDEVICE Device
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-NTSTATUS
-OsrFxConfigContReaderForInterruptEndPoint(
- _In_ PDEVICE_CONTEXT DeviceContext
- );
-
-EVT_WDF_USB_READER_COMPLETION_ROUTINE OsrFxEvtUsbInterruptPipeReadComplete;
-
-EVT_WDF_USB_READERS_FAILED OsrFxEvtUsbInterruptReadersFailed;
-
-EVT_WDF_IO_QUEUE_IO_STOP OsrFxEvtIoStop;
-
-EVT_WDF_DEVICE_D0_ENTRY OsrFxEvtDeviceD0Entry;
-
-EVT_WDF_DEVICE_D0_EXIT OsrFxEvtDeviceD0Exit;
-
-EVT_WDF_DEVICE_SELF_MANAGED_IO_FLUSH OsrFxEvtDeviceSelfManagedIoFlush;
-
-_IRQL_requires_(PASSIVE_LEVEL)
-BOOLEAN
-OsrFxReadFdoRegistryKeyValue(
- _In_ PWDFDEVICE_INIT DeviceInit,
- _In_ PWCHAR Name,
- _Out_ PULONG Value
- );
-
-_IRQL_requires_max_(DISPATCH_LEVEL)
-VOID
-OsrFxEnumerateChildren(
- _In_ WDFDEVICE Device
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-VOID
-GetDeviceEventLoggingNames(
- _In_ WDFDEVICE Device
- );
-
-_IRQL_requires_(PASSIVE_LEVEL)
-PCHAR
-DbgDevicePowerString(
- _In_ WDF_POWER_DEVICE_STATE Type
- );
-
-
-_IRQL_requires_(PASSIVE_LEVEL)
-USBD_STATUS
-OsrFxValidateConfigurationDescriptor(
- _In_reads_bytes_(BufferLength) PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc,
- _In_ ULONG BufferLength,
- _Inout_ PUCHAR *Offset
- );
-
-FORCEINLINE
-GUID
-RequestToActivityId(
- _In_ WDFREQUEST Request
- )
-{
- GUID activity = {0};
- NTSTATUS status = STATUS_SUCCESS;
-
- if (g_pIoGetActivityIdIrp != NULL) {
-
- //
- // Use activity ID generated by application (or IO manager)
- //
- status = g_pIoGetActivityIdIrp(WdfRequestWdmGetIrp(Request), &activity);
- }
-
- if (g_pIoGetActivityIdIrp == NULL || !NT_SUCCESS(status)) {
-
- //
- // Fall back to using the WDFREQUEST handle as the activity ID
- //
- RtlCopyMemory(&activity, &Request, sizeof(WDFREQUEST));
- }
-
-
- return activity;
-}
-
-FORCEINLINE
-GUID
-DeviceToActivityId(
- _In_ WDFDEVICE Device
- )
-{
- GUID activity = {0};
- RtlCopyMemory(&activity, &Device, sizeof(WDFDEVICE));
- return activity;
-}
-
-
-#endif
-
-
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.man b/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.man
deleted file mode 100644
index 176dfc89..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.man
+++ /dev/null
@@ -1,309 +0,0 @@
-<?xml version='1.0' encoding='utf-8' standalone='yes'?>
-<instrumentationManifest
- xmlns="http://schemas.microsoft.com/win/2004/08/events"
- xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd"
- >
- <instrumentation>
- <events>
- <provider
- guid="{69cd60e3-430f-4da4-b1b3-e3bdaf945875}"
- messageFileName="%Systemroot%\System32\drivers\osrusbfx2.SYS"
- name="OSRUSBFX2"
- resourceFileName="%SystemRoot%\System32\drivers\osrusbfx2.SYS"
- symbol="OSRUSBFX2_PROVIDER"
- >
- <channels>
- <channel
- chid="Analytic"
- enabled="false"
- name="OsrUsbfx2/Analytic"
- symbol="OSRUSBFX2_ANALYTIC"
- type="Analytic"
- />
- <channel
- chid="operational"
- enabled="true"
- isolation="System"
- message="$(string.OSRUSBFX2_OPERATIONAL.Name)"
- name="OsrUsbFx2/Operational"
- symbol="OSRUSBFX2_OPERATIONAL"
- type="Operational"
- />
- </channels>
- <keywords>
- <keyword
- mask="0x0000000000000010"
- message="$(string.OSRUSBFX2_DEVICE_INFO_KEYWORD.message)"
- name="deviceinfo"
- symbol="OSRUSBFX2_DEVICE_INFO_KEYWORD"
- />
- <keyword
- mask="0x0000000000000040"
- message="$(string.OSRUSBFX2_READ_WRITE_KEYWORD.message)"
- name="readwrite"
- symbol="OSRUSBFX2_READ_WRITE_KEYWORD"
- />
- </keywords>
- <opcodes>
- <!-- Defining our own custom opcode instead of using standard opcodes defined by winmeta.xml -->
- <opcode
- name="add"
- symbol="OSRUSBFX2_DEVICE_ADD"
- value="10"
- />
- <opcode
- name="fail"
- symbol="OSRUSBFX2_FAIL"
- value="11"
- />
- </opcodes>
- <tasks>
- <!-- Support for XP and W2K3 : MC.exe will create a MOF file -->
- <!-- Requires an associated eventGUID attribute for each task that is defined -->
- <!-- For the MOF file : -->
- <!-- Semantically, the event GUID represents a set of logical events that are logged by the provider. -->
- <task
- eventGUID="{872c3c43-6899-4f1d-89b8-51a82f6db657}"
- name="deviceInit"
- symbol="OSRUSBFX2_DEVICE_INIT"
- value="1"
- />
- <task
- eventGUID="{872c3c45-6899-4f1d-89b8-51a82f6db657}"
- name="read"
- symbol="OSRUSBFX2_READ"
- value="2"
- />
- <task
- eventGUID="{872c3c46-6899-4f1d-89b8-51a82f6db657}"
- name="write"
- symbol="OSRUSBFX2_WRITE"
- value="3"
- />
- </tasks>
- <templates>
- <template tid="tid_DeviceStatus">
- <data
- inType="win:UnicodeString"
- name="FriendlyName"
- outType="xs:string"
- />
- <data
- inType="win:UnicodeString"
- name="Location"
- outType="xs:string"
- />
- <data
- inType="win:UInt32"
- name="NTStatus"
- outType="xs:HexInt32"
- />
- </template>
- <template tid="tid_ReadWrite">
- <data
- inType="win:Pointer"
- name="Device"
- outType="win:HexInt64"
- />
- <data
- inType="win:UInt32"
- name="Length"
- outType="xs:unsignedInt"
- />
- </template>
- <template tid="tid_ReadWriteFail">
- <data
- inType="win:Pointer"
- name="Device"
- outType="win:HexInt64"
- />
- <data
- inType="win:UInt32"
- name="NTStatus"
- outType="xs:HexInt32"
- />
- </template>
- <template tid="tid_ReadWriteCompletion">
- <data
- inType="win:Pointer"
- name="Device"
- outType="win:HexInt64"
- />
- <data
- inType="win:UInt32"
- name="Length"
- outType="xs:unsignedInt"
- />
- <data
- inType="win:UInt32"
- name="NTStatus"
- outType="xs:HexInt32"
- />
- <data
- inType="win:UInt32"
- name="UsbdStatus"
- outType="xs:unsignedInt"
- />
- </template>
- </templates>
- <events>
- <event
- channel="Analytic"
- keywords="readwrite"
- message="$(string.ReadStart.EventMessage)"
- level="win:Informational"
- opcode="win:Start"
- symbol="ReadStart"
- task="read"
- template="tid_ReadWrite"
- value="1"
- />
- <event
- channel="Analytic"
- keywords="readwrite"
- message="$(string.ReadStop.EventMessage)"
- level="win:Informational"
- opcode="win:Stop"
- symbol="ReadStop"
- task="read"
- template="tid_ReadWriteCompletion"
- value="2"
- />
- <event
- channel="Analytic"
- keywords="readwrite"
- message="$(string.ReadFail.EventMessage)"
- level="win:Error"
- opcode="fail"
- symbol="ReadFail"
- task="read"
- template="tid_ReadWriteFail"
- value="3"
- />
- <event
- channel="Analytic"
- keywords="readwrite"
- message="$(string.WriteStart.EventMessage)"
- level="win:Informational"
- opcode="win:Start"
- symbol="WriteStart"
- task="write"
- template="tid_ReadWrite"
- value="4"
- />
- <event
- channel="Analytic"
- keywords="readwrite"
- message="$(string.WriteStop.EventMessage)"
- level="win:Informational"
- opcode="win:Stop"
- symbol="WriteStop"
- task="write"
- template="tid_ReadWriteCompletion"
- value="5"
- />
- <event
- channel="Analytic"
- keywords="readwrite"
- message="$(string.WriteFail.EventMessage)"
- level="win:Error"
- opcode="fail"
- symbol="WriteFail"
- task="write"
- template="tid_ReadWriteFail"
- value="6"
- />
- <event
- channel="operational"
- keywords="deviceinfo"
- level="win:Error"
- message="$(string.DeviceFailAdd.EventMessage)"
- opcode="add"
- symbol="FailAddDevice"
- task="deviceInit"
- template="tid_DeviceStatus"
- value="100"
- />
- <event
- channel="operational"
- keywords="deviceinfo"
- message="$(string.DeviceReenumerated.EventMessage)"
- opcode="win:Start"
- symbol="DeviceReenumerated"
- task="deviceInit"
- template="tid_DeviceStatus"
- value="101"
- />
- <event
- channel="operational"
- keywords="deviceinfo"
- level="win:Error"
- message="$(string.SelectConfigFailure.Message)"
- opcode="fail"
- symbol="SelectConfigFailure"
- task="deviceInit"
- template="tid_DeviceStatus"
- value="102"
- />
- </events>
- </provider>
- </events>
- </instrumentation>
- <localization xmlns="http://schemas.microsoft.com/win/2004/08/events">
- <resources culture="en-US">
- <stringTable>
- <string
- id="OSRUSBFX2_DEVICE_INFO_KEYWORD.message"
- value="Device events: fail to load, reenumerate"
- />
- <string
- id="OSRUSBFX2_READ_WRITE_KEYWORD.message"
- value="Read, Write events"
- />
- <string
- id="OSRUSBFX2_OPERATIONAL.Name"
- value="Operational channel eventlog"
- />
- <string
- id="ReadStart.EventMessage"
- value="Read. Device = %1, Length = %2"
- />
- <string
- id="ReadStop.EventMessage"
- value="Read complete. Device = %1, Length = %2, Status = %3, UsbStatus = %4"
- />
- <string
- id="ReadFail.EventMessage"
- value="Read error. Device = %1, Status = %2"
- />
- <string
- id="WriteStart.EventMessage"
- value="Write. Device = %1, Length = %2"
- />
- <string
- id="WriteStop.EventMessage"
- value="Write complete. Device = %1, Length = %2, Status = %3, UsbStatus = %4"
- />
- <string
- id="WriteFail.EventMessage"
- value="Write error. Device = %1, Status = %2"
- />
- <string
- id="DeviceReenumerated.EventMessage"
- value="Device %1 (location %2) was reenumerated"
- />
- <string
- id="DeviceFailAdd.EventMessage"
- value="Fail to add device %1 (location %2), status %3"
- />
- <string
- id="SelectConfigFailure.Message"
- value="This error occurs when an OSR USB Fx2 board is attached to a USB 1.1 port on a machine running Windows Vista. This error occurs because the OSR USB Fx2 board's Interrupt end-point descriptor does not conform to the USB specification. Windows Vista detects this and returns an error. You should plug the device into a USB 2.0 (or higher) port."
- />
- </stringTable>
- </resources>
- </localization>
-</instrumentationManifest>
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.rc b/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.rc
deleted file mode 100644
index 092ec195..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.rc
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <windows.h>
-
-#include <ntverp.h>
-
-#define VER_FILETYPE VFT_DRV
-#define VER_FILESUBTYPE VFT2_DRV_SYSTEM
-#define VER_FILEDESCRIPTION_STR "WDF Sample Driver for OSR USB-FX2 Learning Kit"
-#define VER_INTERNALNAME_STR "osrusbfx2.sys"
-#define VER_ORIGINALFILENAME_STR "osrusbfx2.sys"
-
-#include "common.ver"
-
-//
-// Include auto-generated string resources (created by MC.EXE from
-// osrusbfx2.man)
-//
-
-#include "fx2Events.rc"
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj b/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj
deleted file mode 100644
index bbceb79b..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj
+++ /dev/null
@@ -1,256 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{837F98CF-D3A4-472C-BACC-47950340E57B}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <SupportsPackaging>false</SupportsPackaging>
- <RequiresPackageProject>true</RequiresPackageProject>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{3EBA8CBF-2E65-4819-9EEA-E10825BB0705}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>KMDF</DriverType>
- <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
- <ConfigurationType>Driver</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>KMDF</DriverType>
- <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
- <ConfigurationType>Driver</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>KMDF</DriverType>
- <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
- <ConfigurationType>Driver</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>KMDF</DriverType>
- <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
- <ConfigurationType>Driver</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="driver.c; device.c; ioctl.c; bulkrwr.c; Interrupt.c">
- <WppEnabled>true</WppEnabled>
- <WppKernelMode>true</WppKernelMode>
- <WppTraceFunction>TraceEvents(LEVEL,FLAGS,MSG,...)</WppTraceFunction>
- <WppGenerateUsingTemplateFile>{km-WdfDefault.tpl}*.tmh</WppGenerateUsingTemplateFile>
- </ClCompile>
- <MessageCompile Include="osrusbfx2.man">
- <GenerateKernelModeLoggingMacros>true</GenerateKernelModeLoggingMacros>
- <GenerateMofFile>true</GenerateMofFile>
- <HeaderFilePath>.\$(IntDir)</HeaderFilePath>
- <GeneratedHeaderPath>true</GeneratedHeaderPath>
- <RCFilePath>.\$(IntDir)</RCFilePath>
- <GeneratedRCAndMessagesPath>true</GeneratedRCAndMessagesPath>
- <GeneratedFilesBaseName>fx2Events</GeneratedFilesBaseName>
- <UseBaseNameOfInput>true</UseBaseNameOfInput>
- </MessageCompile>
- <OtherWpp Include="osrusbfx2.rc">
- <WppEnabled>true</WppEnabled>
- <WppKernelMode>true</WppKernelMode>
- <WppTraceFunction>TraceEvents(LEVEL,FLAGS,MSG,...)</WppTraceFunction>
- <WppGenerateUsingTemplateFile>{km-WdfDefault.tpl}*.tmh</WppGenerateUsingTemplateFile>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>osrusbfx2</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>osrusbfx2</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>osrusbfx2</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>osrusbfx2</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(DDK_LIB_PATH)\ntstrsafe.lib;$(DDK_LIB_PATH)\usbd.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(DDK_LIB_PATH)\ntstrsafe.lib;$(DDK_LIB_PATH)\usbd.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(DDK_LIB_PATH)\ntstrsafe.lib;$(DDK_LIB_PATH)\usbd.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;.</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);EVENT_TRACING</PreprocessorDefinitions>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(DDK_LIB_PATH)\ntstrsafe.lib;$(DDK_LIB_PATH)\usbd.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ALLOW_DATE_TIME>1</ALLOW_DATE_TIME>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="osrusbfx2.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inf" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project>
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj.Filters b/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj.Filters
deleted file mode 100644
index baf7ab2e..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj.Filters
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{F859293F-10B7-4E6D-99E2-120A09448FF9}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{3DCE0FEA-C37D-448E-B9E4-B69865E71B5F}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{A1BB449A-54EF-4B2B-BD68-2254963FF387}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{A03D3DFA-E9BD-48A3-BEDE-E8AAED283D03}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="bulkrwr.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Interrupt.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ioctl.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <MessageCompile Include="osrusbfx2.man">
- <Filter>Resource Files</Filter>
- </MessageCompile>
- <ResourceCompile Include="osrusbfx2.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_kmdf/kmdf_driver/trace.h b/usb/umdf_filter_kmdf/kmdf_driver/trace.h
deleted file mode 100644
index 518ff5f1..00000000
--- a/usb/umdf_filter_kmdf/kmdf_driver/trace.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- TRACE.h
-
-Abstract:
-
- Header file for the debug tracing related function defintions and macros.
-
-Environment:
-
- Kernel mode
-
---*/
-
-#include <evntrace.h> // For TRACE_LEVEL definitions
-
-#if !defined(EVENT_TRACING)
-
-//
-// TODO: These defines are missing in evntrace.h
-// in some DDK build environments (XP).
-//
-#if !defined(TRACE_LEVEL_NONE)
- #define TRACE_LEVEL_NONE 0
- #define TRACE_LEVEL_CRITICAL 1
- #define TRACE_LEVEL_FATAL 1
- #define TRACE_LEVEL_ERROR 2
- #define TRACE_LEVEL_WARNING 3
- #define TRACE_LEVEL_INFORMATION 4
- #define TRACE_LEVEL_VERBOSE 5
- #define TRACE_LEVEL_RESERVED6 6
- #define TRACE_LEVEL_RESERVED7 7
- #define TRACE_LEVEL_RESERVED8 8
- #define TRACE_LEVEL_RESERVED9 9
-#endif
-
-
-//
-// Define Debug Flags
-//
-#define DBG_INIT 0x00000001
-#define DBG_PNP 0x00000002
-#define DBG_POWER 0x00000004
-#define DBG_WMI 0x00000008
-#define DBG_CREATE_CLOSE 0x00000010
-#define DBG_IOCTL 0x00000020
-#define DBG_WRITE 0x00000040
-#define DBG_READ 0x00000080
-
-
-VOID
-TraceEvents (
- _In_ ULONG DebugPrintLevel,
- _In_ ULONG DebugPrintFlag,
- _Printf_format_string_
- _In_ PCSTR DebugMessage,
- ...
- );
-
-#define WPP_INIT_TRACING(DriverObject, RegistryPath)
-#define WPP_CLEANUP(DriverObject)
-
-#else
-//
-// If software tracing is defined in the sources file..
-// WPP_DEFINE_CONTROL_GUID specifies the GUID used for this driver.
-// *** REPLACE THE GUID WITH YOUR OWN UNIQUE ID ***
-// WPP_DEFINE_BIT allows setting debug bit masks to selectively print.
-// The names defined in the WPP_DEFINE_BIT call define the actual names
-// that are used to control the level of tracing for the control guid
-// specified.
-//
-// NOTE: If you are adopting this sample for your driver, please generate
-// a new guid, using tools\other\i386\guidgen.exe present in the
-// DDK.
-//
-// Name of the logger is OSRUSBFX2 and the guid is
-// {D23A0C5A-D307-4f0e-AE8E-E2A355AD5DAB}
-// (0xd23a0c5a, 0xd307, 0x4f0e, 0xae, 0x8e, 0xe2, 0xa3, 0x55, 0xad, 0x5d, 0xab);
-//
-
-#define WPP_CHECK_FOR_NULL_STRING //to prevent exceptions due to NULL strings
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID(OsrUsbFxTraceGuid,(d23a0c5a,d307,4f0e,ae8e,E2A355AD5DAB), \
- WPP_DEFINE_BIT(DBG_INIT) /* bit 0 = 0x00000001 */ \
- WPP_DEFINE_BIT(DBG_PNP) /* bit 1 = 0x00000002 */ \
- WPP_DEFINE_BIT(DBG_POWER) /* bit 2 = 0x00000004 */ \
- WPP_DEFINE_BIT(DBG_WMI) /* bit 3 = 0x00000008 */ \
- WPP_DEFINE_BIT(DBG_CREATE_CLOSE) /* bit 4 = 0x00000010 */ \
- WPP_DEFINE_BIT(DBG_IOCTL) /* bit 5 = 0x00000020 */ \
- WPP_DEFINE_BIT(DBG_WRITE) /* bit 6 = 0x00000040 */ \
- WPP_DEFINE_BIT(DBG_READ) /* bit 7 = 0x00000080 */ \
- /* You can have up to 32 defines. If you want more than that,\
- you have to provide another trace control GUID */\
- )
-
-
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
-
-
-#endif
-
-
-
diff --git a/usb/umdf_filter_kmdf/umdf_filter/OsrUsbFilter.rc b/usb/umdf_filter_kmdf/umdf_filter/OsrUsbFilter.rc
deleted file mode 100644
index cec032d9..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/OsrUsbFilter.rc
+++ /dev/null
@@ -1,17 +0,0 @@
-//---------------------------------------------------------------------------
-// OsrUsbFilter.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF OsrUsbFilter User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "OsrUsbFilter"
-#define VER_ORIGINALFILENAME_STR "OsrUsbFilter.dll"
-
-#include "common.ver"
diff --git a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilter.vcxproj b/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilter.vcxproj
deleted file mode 100644
index 38798dfe..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilter.vcxproj
+++ /dev/null
@@ -1,293 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{502F5F25-02A2-4047-8DD1-EB3DF0CC7127}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <SupportsPackaging>false</SupportsPackaging>
- <RequiresPackageProject>true</RequiresPackageProject>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{45297D7C-3015-4F09-B0E7-469440EB9458}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp; queue.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="OsrUsbFilter.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFOsrUsbFilter</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFOsrUsbFilter</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFOsrUsbFilter</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFOsrUsbFilter</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFilter.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilter.vcxproj.Filters b/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilter.vcxproj.Filters
deleted file mode 100644
index 7a4a8f8d..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilter.vcxproj.Filters
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{3CE4C3CE-9C1D-4790-B2EF-784C3412310A}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{4A9BD78B-5831-48AA-8C22-28BEBBC8A7AB}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{ACD57755-0E18-4D24-A740-0D944929A053}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{2084F476-D6F1-485F-B9A6-581DD86D24F1}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFilter.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx b/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx
deleted file mode 100644
index 6153e18b..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/WUDFOsrUsbFilterOnKmDriver.inx
+++ /dev/null
Binary files differ
diff --git a/usb/umdf_filter_kmdf/umdf_filter/comsup.cpp b/usb/umdf_filter_kmdf/umdf_filter/comsup.cpp
deleted file mode 100644
index 76a4b940..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/comsup.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// This is the number of characters in a GUID string including the trailing
-// NULL.
-//
-
-#define GUID_STRING_CCH (sizeof("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"))
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-_Use_decl_annotations_
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/usb/umdf_filter_kmdf/umdf_filter/comsup.h b/usb/umdf_filter_kmdf/umdf_filter/comsup.h
deleted file mode 100644
index 890b576a..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/comsup.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/usb/umdf_filter_kmdf/umdf_filter/device.cpp b/usb/umdf_filter_kmdf/umdf_filter/device.cpp
deleted file mode 100644
index 126637ce..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/device.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR USB Sample Filter driver's
- device callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "device.tmh"
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the OSR USB Sample Filter driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice;
- HRESULT hr;
-
- //
- // Configure things like the locking model before we go to create our
- // partner device.
- //
-
- //
- // We don't need device level locking since we do not keep any state
- // across the requests
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // Mark ourselves as a filter
- //
-
- FxDeviceInit->SetFilter();
-
-
- //
- // We are a filter; we don't want to be the power policy owner
- //
-
- FxDeviceInit->SetPowerPolicyOwnership(FALSE);
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- PCMyQueue defaultQueue;
-
- HRESULT hr;
-
- hr = CMyQueue::CreateInstance(m_FxDevice, &defaultQueue);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- hr = defaultQueue->Configure();
-
- defaultQueue->Release();
-
- return hr;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Since the OSR USB Sample Filter driver doesn't support any of the device events, this
- method simply calls the base class's BaseQueryInterface.
-
- If OSR USB Sample Filter is extended to include device event interfaces then this
- method must be changed to check the IID and return pointers to them as
- appropriate.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- return CUnknown::QueryInterface(InterfaceId, Object);
-}
diff --git a/usb/umdf_filter_kmdf/umdf_filter/device.h b/usb/umdf_filter_kmdf/umdf_filter/device.h
deleted file mode 100644
index f7a50b1d..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/device.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF OSR USB Sample Filter
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Class for the iotrace driver.
-//
-
-class CMyDevice : public CUnknown
-{
-
-//
-// Private data members.
-//
-private:
-
- IWDFDevice *m_FxDevice;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- )
- {
- m_FxDevice = NULL;
- }
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- HRESULT
- Configure(
- VOID
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
diff --git a/usb/umdf_filter_kmdf/umdf_filter/dllsup.cpp b/usb/umdf_filter_kmdf/umdf_filter/dllsup.cpp
deleted file mode 100644
index d71d5fe8..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/dllsup.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the OSR USB Sample Filter
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the skeleton uses
- L"Microsoft\\UMDF\\Skeleton"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the OSR USB Sample Filter sample. If
- you choose to use a different primary include file, you should ensure
- they are defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-//
-// Global variable to hold the module handle for this DLL. Initialized during
-// DllMain and never cleared. This is used when registering and unregistering
-// the driver's COM information.
-//
-
-HINSTANCE g_ModuleHandle = NULL;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE /* ModuleHandle */,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- REFCLSID ClassId,
- REFIID InterfaceId,
- LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the OSR USB Sample
- Filter driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
-
diff --git a/usb/umdf_filter_kmdf/umdf_filter/driver.cpp b/usb/umdf_filter_kmdf/umdf_filter/driver.cpp
deleted file mode 100644
index c5910c05..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/driver.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR USB Sample Filter
- driver's core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/usb/umdf_filter_kmdf/umdf_filter/driver.h b/usb/umdf_filter_kmdf/umdf_filter/driver.h
deleted file mode 100644
index 08f36a71..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/driver.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF OSR USB Sample Filter
- driver's callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the OSR USB Sample Filter driver. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver* /*FxWdfDriver*/
- )
- {
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver * /*FxWdfDriver*/
- )
- {
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
diff --git a/usb/umdf_filter_kmdf/umdf_filter/exports.def b/usb/umdf_filter_kmdf/umdf_filter/exports.def
deleted file mode 100644
index 0fc42817..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/exports.def
+++ /dev/null
@@ -1,4 +0,0 @@
-; Skeleton.def : Declares the module parameters.
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/usb/umdf_filter_kmdf/umdf_filter/internal.h b/usb/umdf_filter_kmdf/umdf_filter/internal.h
deleted file mode 100644
index 516f6d7f..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/internal.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF OSR USB Sample Filter
- driver.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF headers
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-
-//
-// Define the tracing flags.
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- MyDriverTraceControl, (73cdcaa5,ce52,43f2,aa2d,5f5a84e22213), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\OsrUsbFilter"
-#define MYDRIVER_COM_DESCRIPTION L"UMDF OSR USB Sample Filter Driver"
-#define MYDRIVER_CLASS_ID {0x422d8dbc, 0x520d, 0x4d7e, {0x8f, 0x53, 0x92, 0x0e, 0x5c, 0x86, 0x7e, 0x6c}}
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "queue.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_SAMPLE_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
diff --git a/usb/umdf_filter_kmdf/umdf_filter/queue.cpp b/usb/umdf_filter_kmdf/umdf_filter/queue.cpp
deleted file mode 100644
index 5642ec74..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/queue.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Queue.cpp
-
-Abstract:
-
- This module contains the implementation of the OSR USB Filter Sample driver's
- queue callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "queue.h"
-
-#include "queue.tmh"
-
-HRESULT
-CMyQueue::CreateInstance(
- _In_ IWDFDevice * FxDevice,
- _Out_ CMyQueue **Queue
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the OSR USB Filter Sample driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- CMyQueue *queue;
-
- HRESULT hr = S_OK;
-
- //
- // Allocate a new instance of the device class.
- //
-
- queue = new CMyQueue();
-
- if (NULL == queue)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = queue->Initialize(FxDevice);
- }
-
- if (SUCCEEDED(hr))
- {
- queue->AddRef();
- *Queue = queue;
- }
-
- if (NULL != queue)
- {
- queue->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
-
- if(IsEqualIID(InterfaceId, __uuidof(IQueueCallbackDefaultIoHandler)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackDefaultIoHandler();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackWrite)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackWrite();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IRequestCallbackRequestCompletion)))
- {
- hr = S_OK;
- *Object = QueryIRequestCallbackRequestCompletion();
-
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-HRESULT
-CMyQueue::Initialize(
- _In_ IWDFDevice *FxDevice
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object. Any operations which
- need to be performed before the caller can use the callback object, but
- which couldn't be done in the constructor becuase they could fail would
- be placed here.
-
- Arguments:
-
- FxDevice - the device which this Queue is for.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFIoQueue *fxQueue;
- HRESULT hr;
-
- //
- // Create the framework queue
- //
-
- IUnknown *unknown = QueryIUnknown();
- hr = FxDevice->CreateIoQueue(
- unknown,
- TRUE, // bDefaultQueue
- WdfIoQueueDispatchParallel,
- FALSE, // bPowerManaged
- TRUE, // bAllowZeroLengthRequests
- &fxQueue
- );
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- "%!FUNC!: Could not create default I/O queue, %!hresult!",
- hr
- );
- }
-
- unknown->Release();
-
- if (SUCCEEDED(hr))
- {
- m_FxQueue = fxQueue;
-
- //
- // m_FxQueue is kept as a Weak reference to framework Queue object to avoid
- // circular reference. This object's lifetime is contained within
- // framework Queue object's lifetime
- //
-
- fxQueue->Release();
- }
-
- if (SUCCEEDED(hr))
- {
- FxDevice->GetDefaultIoTarget(&m_FxIoTarget);
- }
-
- return hr;
-}
-
-void
-CMyQueue::InvertBits(
- _Inout_ IWDFMemory* FxMemory,
- _In_ SIZE_T NumBytes
- )
-/*++
-
- Routine Description:
-
- This helper method inverts bits in the buffer of an FxMemory object
-
- Arguments:
-
- FxMemory - Framework memory object whose buffer's bits are to be inverted
-
- NumBytes - Number of bytes for which bits are to be inverted
-
- Return Value:
-
- None
-
---*/
-{
- PBYTE Buffer = (PBYTE)
- FxMemory->GetDataBuffer(NULL);
-
- for (SIZE_T i = 0; i < NumBytes; i++)
- {
- memset(Buffer + i, ~(Buffer[i]), sizeof(*Buffer));
- }
-}
-
-void
-CMyQueue::OnWrite(
- _In_ IWDFIoQueue* FxQueue,
- _In_ IWDFIoRequest* FxRequest,
- _In_ SIZE_T NumOfBytesToWrite
- )
-/*++
-
- Routine Description:
-
- This method is called by Framework Queue object to deliver the Write request
- This method inverts the bits in write buffer and forwards the request down the device stack
- In case of any failure prior to ForwardRequest, it completets the request with failure
-
- Arguments:
-
- pWdfQueue - Framework Queue which is delivering the request
-
- pWdfRequest - Framework Request
-
- Return Value:
-
- None
-
---*/
-{
- UNREFERENCED_PARAMETER(FxQueue);
-
- IWDFMemory * FxInputMemory = NULL;
-
- FxRequest->GetInputMemory(&FxInputMemory);
-
- //
- // Invert bits of the buffer to be written to device
- //
-
- InvertBits(FxInputMemory, NumOfBytesToWrite);
-
- //
- // Forward request down the stack
- // When the device below completes the request we will get notified in OnComplete
- // and then we will complete the request
- //
-
- ForwardRequest(FxRequest);
-
- FxInputMemory->Release();
-}
-
-//
-// IQueueCallbackDefaultIoHandler method
-//
-
-void
-CMyQueue::OnDefaultIoHandler(
- _In_ IWDFIoQueue* FxQueue,
- _In_ IWDFIoRequest* FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is called by Framework Queue object to deliver all the I/O
- Requests for which we do not have a specific handler
- (In our case anything other than Write)
-
- Arguments:
-
- pWdfQueue - Framework Queue which is delivering the request
-
- pWdfRequest - Framework Request
-
- Return Value:
-
- None
-
---*/
-{
- UNREFERENCED_PARAMETER(FxQueue);
-
- //
- // We just forward the request down the stack
- // When the device below completes the request we will get notified in OnComplete
- // and then we will complete the request
- //
-
- ForwardRequest(FxRequest);
-}
-
-void
-CMyQueue::ForwardRequest(
- _In_ IWDFIoRequest* FxRequest
- )
-/*++
-
- Routine Description:
-
- This helper method forwards the request down the stack
-
- Arguments:
-
- pWdfRequest - Request to be forwarded
-
- Return Value:
-
- None
-
- Remarks:
-
- The request gets forwarded to the next device in the stack which can be:
- 1. Next device in user-mode stack
- 2. Top device in kernel-mode stack (Redirector's Down Device)
-
- In this routine we:
- 1. Set a completion callback
- 2. Copy request parameters to next stack location
- 3. Asynchronously send the request without any timeout
-
- When the lower request gets completed we will be notified via the
- completion callback, where we will complete our request
-
- In case of failure this routine completes the request
-
---*/
-{
- //
- //First set the completion callback
- //
-
- IRequestCallbackRequestCompletion *completionCallback =
- QueryIRequestCallbackRequestCompletion();
-
- FxRequest->SetCompletionCallback(
- completionCallback,
- NULL //pContext
- );
-
- completionCallback->Release();
-
- //
- //Copy current i/o stack locations parameters to the next stack location
- //
-
- FxRequest->FormatUsingCurrentType(
- );
-
- //
- //Send down the request
- //
- HRESULT hrSend = S_OK;
-
- hrSend = FxRequest->Send(
- m_FxIoTarget,
- 0, //No flag
- 0 //No timeout
- );
-
- if (FAILED(hrSend))
- {
- //
- //If send failed we need to complete the request with failure
- //
- FxRequest->CompleteWithInformation(hrSend, 0);
- }
-
- return;
-}
-
-void
-CMyQueue::HandleReadRequestCompletion(
- IWDFIoRequest* FxRequest,
- IWDFIoRequestCompletionParams* CompletionParams
- )
-/*++
-
- Routine Description:
-
- This helper method is called by OnCompletion method to complete Read request
- We invert the bits in the read buffer
- This is so that the client reads back the data it wrote since
- we inverted bits during write to device
-
- Arguments:
-
- FxRequest - Request object of our layer
-
- CompletionParams - Parameters with which the lower Request got completed
-
- Return Value:
-
- None
-
- Remarks:
-
- This method always completes the request since no one else would get a chance to
- complete the request
- In case of failure it completes the request with failure
-
---*/
-{
- HRESULT hrCompletion = CompletionParams->GetCompletionStatus();
- ULONG_PTR BytesRead = CompletionParams->GetInformation();
-
- //
- // Check
- // 1. whether the lower device succeeded the Request (otherwise we will just complete
- // the Request with failure
- // 2. If data read is of non-zero length, for us to bother to invert its bits
- //
-
- if (SUCCEEDED(hrCompletion) &&
- (0 != BytesRead)
- )
- {
- IWDFMemory *FxOutputMemory;
-
- FxRequest->GetOutputMemory(&FxOutputMemory );
-
- InvertBits(FxOutputMemory, BytesRead);
-
- FxOutputMemory->Release();
- }
-
- //
- // Complete the request
- //
-
- FxRequest->CompleteWithInformation(
- hrCompletion,
- BytesRead
- );
-}
-
-
-void
-CMyQueue::OnCompletion(
- IWDFIoRequest* FxRequest,
- IWDFIoTarget* FxIoTarget,
- IWDFRequestCompletionParams* CompletionParams,
- PVOID Context
- )
-/*++
-
- Routine Description:
-
- This method is called by Framework I/O Target object when
- the lower device completets the Request
-
- Arguments:
-
- pWdfRequest - Request object of our layer
-
- pIoTarget - I/O Target object invoking this callback
-
- pParams - Parameters with which the lower Request got completed
-
- Return Value:
-
- None
-
---*/
-{
- UNREFERENCED_PARAMETER(FxIoTarget);
- UNREFERENCED_PARAMETER(Context);
-
- //
- // If it is a read request, we invert the bits read since we inverted them during write
- // so that application would read the same data as it wrote
- //
-
- if (WdfRequestRead == FxRequest->GetType())
- {
- IWDFIoRequestCompletionParams * IoCompletionParams = NULL;
- HRESULT hrQI = CompletionParams->QueryInterface(IID_PPV_ARGS(&IoCompletionParams));
- WUDF_SAMPLE_DRIVER_ASSERT(SUCCEEDED(hrQI));
-
- HandleReadRequestCompletion(
- FxRequest,
- IoCompletionParams
- );
-
- SAFE_RELEASE(IoCompletionParams);
- }
- else
- {
-
- //
- // Otherwise we just complete our Request object with the same parameters
- // with which the lower Request got completed
- //
-
- FxRequest->CompleteWithInformation(
- CompletionParams->GetCompletionStatus(),
- CompletionParams->GetInformation()
- );
- }
-}
-
diff --git a/usb/umdf_filter_kmdf/umdf_filter/queue.h b/usb/umdf_filter_kmdf/umdf_filter/queue.h
deleted file mode 100644
index 216264e9..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter/queue.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Queue.h
-
-Abstract:
-
- This module contains the type definitions for the OSR USB Filter Sample
- driver's queue callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Class for the queue callbacks.
-// It implements
-// IQueueCallbackDeviceIoControl
-// IRequestCallbackRequestCompletion
-// Queue callbacks
-//
-// This class also implements IRequestCallbackRequestCompletion callback
-// to get the request completion notification when request is sent down the
-// stack. This callback can be implemented on a separate object as well.
-// This callback is implemented here only for conenience.
-//
-class CMyQueue :
- public CUnknown,
- public IQueueCallbackWrite,
- public IQueueCallbackDefaultIoHandler,
- public IRequestCallbackRequestCompletion
-{
-
-//
-// Private data members.
-//
-private:
-
- //
- // Weak reference to framework Queue object which this object implements callbacks for
- // This is kept as a weak reference to avoid circular reference
- // This object's lifetime is contained within framework Queue object's lifetime
- //
-
- IWDFIoQueue *m_FxQueue;
-
- //
- // I/O Target to which we forward requests. Represents next device in the
- // device stack
- //
-
- IWDFIoTarget *m_FxIoTarget;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyQueue() :
- m_FxQueue(NULL),
- m_FxIoTarget(NULL)
- {
- }
-
- virtual ~CMyQueue()
- {
- if (NULL != m_FxIoTarget)
- {
- m_FxIoTarget->Release();
- }
- }
-
- //
- // QueryInterface helpers
- //
-
- IRequestCallbackRequestCompletion *
- QueryIRequestCallbackRequestCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IRequestCallbackRequestCompletion*>(this);
- }
-
- IQueueCallbackWrite *
- QueryIQueueCallbackWrite(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackWrite *>(this);
- }
-
- IQueueCallbackDefaultIoHandler *
- QueryIQueueCallbackDefaultIoHandler(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackDefaultIoHandler *>(this);
- }
-
- //
- // Initialize
- //
-
- HRESULT
- Initialize(
- _In_ IWDFDevice *FxDevice
- );
-
- //
- // Helper method to forward request down the stack
- //
-
- void
- ForwardRequest(
- _In_ IWDFIoRequest *pWdfRequest
- );
-
- //
- // Helper method to inverts bits in the buffer of a framework Memory object
- //
-
- void
- InvertBits(
- _Inout_ IWDFMemory* FxMemory,
- _In_ SIZE_T NumBytes
- );
-
- //
- // Helper method to handle Read request completion
- //
-
- void
- HandleReadRequestCompletion(
- IWDFIoRequest* FxRequest,
- IWDFIoRequestCompletionParams* CompletionParams
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this class
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDevice *FxDevice,
- _Out_ CMyQueue **Queue
- );
-
-
- HRESULT
- Configure(
- VOID
- )
- {
- return S_OK;
- }
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IQueueCallbackWrite method
- //
-
- virtual
- void
- STDMETHODCALLTYPE
- OnWrite(
- _In_ IWDFIoQueue* FxQueue,
- _In_ IWDFIoRequest* FxRequest,
- _In_ SIZE_T NumOfBytesToWrite
- );
-
-
- //
- // IQueueCallbackDefaultIoHandler method
- //
-
- virtual
- void
- STDMETHODCALLTYPE
- OnDefaultIoHandler(
- _In_ IWDFIoQueue* FxQueue,
- _In_ IWDFIoRequest* FxRequest
- );
-
- //
- //IRequestCallbackRequestCompletion
- //
-
- virtual
- void
- STDMETHODCALLTYPE
- OnCompletion(
- IWDFIoRequest* FxRequest,
- IWDFIoTarget* FxIoTarget,
- IWDFRequestCompletionParams* CompletionParams,
- PVOID Context
- );
-};
-
diff --git a/usb/umdf_filter_kmdf/umdf_filter_kmdf.sln b/usb/umdf_filter_kmdf/umdf_filter_kmdf.sln
deleted file mode 100644
index 5a39a03d..00000000
--- a/usb/umdf_filter_kmdf/umdf_filter_kmdf.sln
+++ /dev/null
@@ -1,59 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0
-MinimumVisualStudioVersion = 12.0
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Package", "Package", "{0C11CE20-E0CC-403B-B957-FB72E3AD659A}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umdf_filter", "Umdf_filter", "{FD04F724-4BA6-4E88-B269-53F28C44E2F2}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Kmdf_driver", "Kmdf_driver", "{8FED241E-8771-423B-8ED2-EF4873FAED48}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "package", "Package\package.VcxProj", "{10E372EF-AE85-4528-919C-A261253EDDAE}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFOsrUsbFilter", "umdf_filter\WUDFOsrUsbFilter.vcxproj", "{ADCCB27A-E522-4367-86B9-9C9DF2636B93}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrusbfx2", "kmdf_driver\osrusbfx2.vcxproj", "{837F98CF-D3A4-472C-BACC-47950340E57B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- Debug|x64 = Debug|x64
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {10E372EF-AE85-4528-919C-A261253EDDAE}.Debug|Win32.ActiveCfg = Debug|Win32
- {10E372EF-AE85-4528-919C-A261253EDDAE}.Debug|Win32.Build.0 = Debug|Win32
- {10E372EF-AE85-4528-919C-A261253EDDAE}.Release|Win32.ActiveCfg = Release|Win32
- {10E372EF-AE85-4528-919C-A261253EDDAE}.Release|Win32.Build.0 = Release|Win32
- {10E372EF-AE85-4528-919C-A261253EDDAE}.Debug|x64.ActiveCfg = Debug|x64
- {10E372EF-AE85-4528-919C-A261253EDDAE}.Debug|x64.Build.0 = Debug|x64
- {10E372EF-AE85-4528-919C-A261253EDDAE}.Release|x64.ActiveCfg = Release|x64
- {10E372EF-AE85-4528-919C-A261253EDDAE}.Release|x64.Build.0 = Release|x64
- {ADCCB27A-E522-4367-86B9-9C9DF2636B93}.Debug|Win32.ActiveCfg = Debug|Win32
- {ADCCB27A-E522-4367-86B9-9C9DF2636B93}.Debug|Win32.Build.0 = Debug|Win32
- {ADCCB27A-E522-4367-86B9-9C9DF2636B93}.Release|Win32.ActiveCfg = Release|Win32
- {ADCCB27A-E522-4367-86B9-9C9DF2636B93}.Release|Win32.Build.0 = Release|Win32
- {ADCCB27A-E522-4367-86B9-9C9DF2636B93}.Debug|x64.ActiveCfg = Debug|x64
- {ADCCB27A-E522-4367-86B9-9C9DF2636B93}.Debug|x64.Build.0 = Debug|x64
- {ADCCB27A-E522-4367-86B9-9C9DF2636B93}.Release|x64.ActiveCfg = Release|x64
- {ADCCB27A-E522-4367-86B9-9C9DF2636B93}.Release|x64.Build.0 = Release|x64
- {837F98CF-D3A4-472C-BACC-47950340E57B}.Debug|Win32.ActiveCfg = Debug|Win32
- {837F98CF-D3A4-472C-BACC-47950340E57B}.Debug|Win32.Build.0 = Debug|Win32
- {837F98CF-D3A4-472C-BACC-47950340E57B}.Release|Win32.ActiveCfg = Release|Win32
- {837F98CF-D3A4-472C-BACC-47950340E57B}.Release|Win32.Build.0 = Release|Win32
- {837F98CF-D3A4-472C-BACC-47950340E57B}.Debug|x64.ActiveCfg = Debug|x64
- {837F98CF-D3A4-472C-BACC-47950340E57B}.Debug|x64.Build.0 = Debug|x64
- {837F98CF-D3A4-472C-BACC-47950340E57B}.Release|x64.ActiveCfg = Release|x64
- {837F98CF-D3A4-472C-BACC-47950340E57B}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {10E372EF-AE85-4528-919C-A261253EDDAE} = {0C11CE20-E0CC-403B-B957-FB72E3AD659A}
- {ADCCB27A-E522-4367-86B9-9C9DF2636B93} = {FD04F724-4BA6-4E88-B269-53F28C44E2F2}
- {837F98CF-D3A4-472C-BACC-47950340E57B} = {8FED241E-8771-423B-8ED2-EF4873FAED48}
- EndGlobalSection
-EndGlobal
diff --git a/usb/umdf_filter_umdf/Package/package.VcxProj b/usb/umdf_filter_umdf/Package/package.VcxProj
deleted file mode 100644
index e659f6f2..00000000
--- a/usb/umdf_filter_umdf/Package/package.VcxProj
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\umdf_driver\WUDFOsrUsbFx2.vcxproj">
- <Project>{6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}</Project>
- </ProjectReference>
- <ProjectReference Include="..\umdf_filter\WUDFOsrUsbFilter.vcxproj">
- <Project>{502F5F25-02A2-4047-8DD1-EB3DF0CC7127}</Project>
- </ProjectReference>
- </ItemGroup>
- <PropertyGroup Label="PropertySheets">
- <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
- <ConfigurationType>Utility</ConfigurationType>
- <DriverType>Package</DriverType>
- <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
- <Configuration>Debug</Configuration>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Globals">
- <ProjectGuid>{A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}</ProjectGuid>
- <SampleGuid>{46304089-31EE-4493-8063-28C9498B0AA5}</SampleGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>false</UseDebugLibraries>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup />
- <PropertyGroup>
- <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor>
- <ImportToStore>False</ImportToStore>
- <InstallMode>None</InstallMode>
- <HardwareIdString />
- <CommandLine />
- <ScriptPath />
- <DeployFiles />
- <ScriptName />
- <ScriptDeviceQuery>%PathToInf%</ScriptDeviceQuery>
- <EnableVerifier>False</EnableVerifier>
- <AllDrivers>False</AllDrivers>
- <VerifyProjectOutput>True</VerifyProjectOutput>
- <VerifyDrivers />
- <VerifyFlags>133563</VerifyFlags>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_umdf/Package/package.VcxProj.Filters b/usb/umdf_filter_umdf/Package/package.VcxProj.Filters
deleted file mode 100644
index c76e39bb..00000000
--- a/usb/umdf_filter_umdf/Package/package.VcxProj.Filters
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{C029FC84-457F-450E-ADA9-6D80AE7CD763}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{7D823922-0DAE-4B96-8DB9-0746C3D33ACA}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{C9031396-E1B6-4B90-94EC-0D504E07410E}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{3B2590BD-4AA9-4039-8CA3-4C189ACEF76A}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_umdf/README.md b/usb/umdf_filter_umdf/README.md
deleted file mode 100644
index b16d8686..00000000
--- a/usb/umdf_filter_umdf/README.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-page_type: sample
-description: "Demonstrates how to load a UMDF filter driver as an upper filter driver above the umdf_fx2 sample driver."
-languages:
-- cpp
-products:
-- windows
-- windows-wdk
----
-
-# Sample UMDF Filter above UMDF Function Driver for OSR USB-FX2 (UMDF Version 1)
-
-The umdf\_filter\_umdf sample demonstrates how to load a User-Mode Driver Framework (UMDF) filter driver as an upper filter driver above the umdf\_fx2 sample driver.
-
-This sample is written for the [OSR USB-FX2 Learning Kit](https://www.osronline.com/hardware/OSRFX2_32.pdf).
-
-## Overview
-
-- The device is based on the development board supplied with the Cypress EZ-USB FX2 Development Kit (CY3681).
-
-- It contains 1 interface and 3 endpoints (Interrupt IN, Bulk Out, Bulk IN).
-
-- Firmware supports vendor commands to query or set LED Bar graph display and 7-segment LED display, and to query toggle switch states.
-
-- Interrupt Endpoint:
-
- - Sends an 8-bit value that represents the state of the switches.
-
- - Sent on startup, resume from suspend, and whenever the switch pack setting changes.
-
- - Firmware does not de-bounce the switch pack.
-
- - One switch change can result in multiple bytes being sent.
-
- - Bits are in the reverse order of the labels on the pack (for example, bit 0x80 is labeled 1 on the pack).
-
-- Bulk Endpoints are configured for loopback:
-
- - The device moves data from IN endpoint to OUT endpoint.
-
- - The device does not change the values of the data it receives nor does it internally create any data.
-
- - Endpoints are always double buffered.
-
- - Maximum packet size depends on speed (64 full speed, 512 high speed).
-
-## Testing the driver
-
-You can test this sample either by using the [Custom driver access](https://go.microsoft.com/fwlink/p/?linkid=2114373) sample application, or by using the osrusbfx2.exe test application. For information on how to build and use the osrusbfx2.exe application, see the test instructions for the [umdf\_fx2](https://docs.microsoft.com/samples/microsoft/windows-driver-samples/sample-umdf-filter-above-umdf-function-driver-for-osr-usb-fx2-umdf-version-1/) sample.
-
-## Sample Contents
-
-| Folder | Description |
-| --- | --- |
-| usb\umdf_filter_umdf\umdf_driver | This directory contains source code for the umdf_fx2 sample driver. |
-| usb\umdf_filter_umdf\umdf_filter | This directory contains the UMDF filter driver. |
diff --git a/usb/umdf_filter_umdf/inc/WUDFOsrUsbPublic.h b/usb/umdf_filter_umdf/inc/WUDFOsrUsbPublic.h
deleted file mode 100644
index 6681fa14..00000000
--- a/usb/umdf_filter_umdf/inc/WUDFOsrUsbPublic.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- WUDFOsrUsbPublic.h
-
-Abstract:
-
- This module contains the common declarations shared by driver
- and user applications for the UMDF OSR device sample.
-
- Note that this driver does NOT use the same device interface GUID
- as the KMDF OSR USB sample.
-
-Environment:
-
- user and kernel
-
---*/
-
-#pragma once
-
-//
-// Define an Interface Guid so that app can find the device and talk to it.
-//
-
-// {573E8C73-0CB4-4471-A1BF-FAB26C31D384}
-DEFINE_GUID(GUID_DEVINTERFACE_OSRUSBFX2,
- 0x573e8c73, 0xcb4, 0x4471, 0xa1, 0xbf, 0xfa, 0xb2, 0x6c, 0x31, 0xd3, 0x84);
-
diff --git a/usb/umdf_filter_umdf/inc/list.h b/usb/umdf_filter_umdf/inc/list.h
deleted file mode 100644
index 38d0b1e9..00000000
--- a/usb/umdf_filter_umdf/inc/list.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- list.h
-
-Abstract:
-
- This module contains doubly linked list macros
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-FORCEINLINE
-VOID
-InitializeListHead(
- IN PLIST_ENTRY ListHead
- )
-{
- ListHead->Flink = ListHead->Blink = ListHead;
-}
-
-FORCEINLINE
-BOOLEAN
-RemoveEntryList(
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
- PLIST_ENTRY Flink;
-
- Flink = Entry->Flink;
- Blink = Entry->Blink;
- Blink->Flink = Flink;
- Flink->Blink = Blink;
- return (BOOLEAN)(Flink == Blink);
-}
-
-FORCEINLINE
-VOID
-InsertHeadList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Flink;
-
- Flink = ListHead->Flink;
- Entry->Flink = Flink;
- Entry->Blink = ListHead;
- Flink->Blink = Entry;
- ListHead->Flink = Entry;
-}
-
-FORCEINLINE
-VOID
-InsertTailList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
-
- Blink = ListHead->Blink;
- Entry->Flink = ListHead;
- Entry->Blink = Blink;
- Blink->Flink = Entry;
- ListHead->Blink = Entry;
-}
diff --git a/usb/umdf_filter_umdf/inc/public.h b/usb/umdf_filter_umdf/inc/public.h
deleted file mode 100644
index 2c3f6805..00000000
--- a/usb/umdf_filter_umdf/inc/public.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- public.h
-
-Abstract:
-
- Public definitions for the OSR_FX2 device operations.
-
-Environment:
-
- User & Kernel mode
-
---*/
-
-#ifndef _PUBLIC_H
-#define _PUBLIC_H
-
-#include <initguid.h>
-
-#include "WudfOsrUsbPublic.h"
-
-
-//
-// Define the structures that will be used by the IOCTL
-// interface to the driver
-//
-
-//
-// BAR_GRAPH_STATE
-//
-// BAR_GRAPH_STATE is a bit field structure with each
-// bit corresponding to one of the bar graph on the
-// OSRFX2 Development Board
-//
-#include <pshpack1.h>
-
-#pragma warning( push )
-#pragma warning( disable : 4201 ) // nameless struct/union
-#pragma warning( disable : 4214 ) // bit-field type other than int
-
-typedef struct _BAR_GRAPH_STATE {
-
- union {
-
- struct {
- //
- // Individual bars starting from the
- // top of the stack of bars
- //
- // NOTE: There are actually 10 bars,
- // but the very top two do not light
- // and are not counted here
- //
- UCHAR Bar1 : 1;
- UCHAR Bar2 : 1;
- UCHAR Bar3 : 1;
- UCHAR Bar4 : 1;
- UCHAR Bar5 : 1;
- UCHAR Bar6 : 1;
- UCHAR Bar7 : 1;
- UCHAR Bar8 : 1;
- };
-
- //
- // The state of all the bar graph as a single
- // UCHAR
- //
- UCHAR BarsAsUChar;
-
- };
-
-}BAR_GRAPH_STATE, *PBAR_GRAPH_STATE;
-
-//
-// SWITCH_STATE
-//
-// SWITCH_STATE is a bit field structure with each
-// bit corresponding to one of the switches on the
-// OSRFX2 Development Board
-//
-typedef struct _SWITCH_STATE {
-
- union {
- struct {
- //
- // Individual switches starting from the
- // left of the set of switches
- //
- UCHAR Switch1 : 1;
- UCHAR Switch2 : 1;
- UCHAR Switch3 : 1;
- UCHAR Switch4 : 1;
- UCHAR Switch5 : 1;
- UCHAR Switch6 : 1;
- UCHAR Switch7 : 1;
- UCHAR Switch8 : 1;
- };
-
- //
- // The state of all the switches as a single
- // UCHAR
- //
- UCHAR SwitchesAsUChar;
-
- };
-
-
-}SWITCH_STATE, *PSWITCH_STATE;
-
-//
-// Seven segment display bit values.
-//
-
-//
-// Undefine conflicting MFC constant
-//
-#undef SS_CENTER
-#undef SS_LEFT
-#undef SS_RIGHT
-
-#define SS_TOP 0x01
-#define SS_TOP_LEFT 0x40
-#define SS_TOP_RIGHT 0x02
-#define SS_CENTER 0x20
-#define SS_BOTTOM_LEFT 0x10
-#define SS_BOTTOM_RIGHT 0x04
-#define SS_BOTTOM 0x80
-#define SS_DOT 0x08
-
-//
-// FILE_PLAYBACK
-//
-// FILE_PLAYBACK structure contains the parameters for the PLAY_FILE I/O Control.
-//
-
-typedef struct _FILE_PLAYBACK
-{
- //
- // The delay between changes in the display, in milliseconds.
- //
-
- USHORT Delay;
-
- //
- // The data file path.
- //
-
- WCHAR Path[1];
-} FILE_PLAYBACK, *PFILE_PLAYBACK;
-
-#include <poppack.h>
-
-#define IOCTL_INDEX 0x800
-#define FILE_DEVICE_OSRUSBFX2 65500U
-
-#define IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-#define IOCTL_OSRUSBFX2_RESET_DEVICE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 1, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_REENUMERATE_DEVICE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 3, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 4, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 5, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_READ_SWITCHES CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 6, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 7, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 8, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 9, \
- METHOD_OUT_DIRECT, \
- FILE_READ_ACCESS)
-
-#define IOCTL_OSRUSBFX2_PLAY_FILE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 10, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#pragma warning(pop)
-
-#endif
-
diff --git a/usb/umdf_filter_umdf/inc/usb_hw.h b/usb/umdf_filter_umdf/inc/usb_hw.h
deleted file mode 100644
index d6e983f1..00000000
--- a/usb/umdf_filter_umdf/inc/usb_hw.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- Usb.h
-
-Abstract:
-
- Contains prototypes for interfacing with a USB connected device. These
- are copied from the KMDF WDFUSB.H header file (but with the WDF specific
- portions removed)
-
-Environment:
-
- kernel mode only
-
---*/
-
-#pragma once
-
-typedef enum _WINUSB_BMREQUEST_DIRECTION {
- BmRequestHostToDevice = BMREQUEST_HOST_TO_DEVICE,
- BmRequestDeviceToHost = BMREQUEST_DEVICE_TO_HOST,
-} WINUSB_BMREQUEST_DIRECTION;
-
-typedef enum _WINUSB_BMREQUEST_TYPE {
- BmRequestStandard = BMREQUEST_STANDARD,
- BmRequestClass = BMREQUEST_CLASS,
- BmRequestVendor = BMREQUEST_VENDOR,
-} WINUSB_BMREQUEST_TYPE;
-
-typedef enum _WINUSB_BMREQUEST_RECIPIENT {
- BmRequestToDevice = BMREQUEST_TO_DEVICE,
- BmRequestToInterface = BMREQUEST_TO_INTERFACE,
- BmRequestToEndpoint = BMREQUEST_TO_ENDPOINT,
- BmRequestToOther = BMREQUEST_TO_OTHER,
-} WINUSB_BMREQUEST_RECIPIENT;
-
-typedef enum _WINUSB_DEVICE_TRAITS {
- WINUSB_DEVICE_TRAIT_SELF_POWERED = 0x00000001,
- WINUSB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE = 0x00000002,
- WINUSB_DEVICE_TRAIT_AT_HIGH_SPEED = 0x00000004,
-} WINUSB_DEVICE_TRAITS;
-
-typedef enum _WdfUsbTargetDeviceSelectInterfaceType {
- WdfUsbTargetDeviceSelectInterfaceTypeInterface = 0x10,
- WdfUsbTargetDeviceSelectInterfaceTypeUrb = 0x11,
-} WdfUsbTargetDeviceSelectInterfaceType;
-
-
-
-typedef union _WINUSB_CONTROL_SETUP_PACKET {
- struct {
- union {
- #pragma warning(disable:4214) // bit field types other than int
- struct {
- //
- // Valid values are BMREQUEST_TO_DEVICE, BMREQUEST_TO_INTERFACE,
- // BMREQUEST_TO_ENDPOINT, BMREQUEST_TO_OTHER
- //
- BYTE Recipient:2;
-
- BYTE Reserved:3;
-
- //
- // Valid values are BMREQUEST_STANDARD, BMREQUEST_CLASS,
- // BMREQUEST_VENDOR
- //
- BYTE Type:2;
-
- //
- // Valid values are BMREQUEST_HOST_TO_DEVICE,
- // BMREQUEST_DEVICE_TO_HOST
- //
- BYTE Dir:1;
- } Request;
- #pragma warning(default:4214) // bit field types other than int
- BYTE Byte;
- } bm;
-
- BYTE bRequest;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wValue;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wIndex;
-
- USHORT wLength;
- } Packet;
-
- struct {
- BYTE Bytes[8];
- } Generic;
-
- WINUSB_SETUP_PACKET WinUsb;
-
-} WINUSB_CONTROL_SETUP_PACKET, *PWINUSB_CONTROL_SETUP_PACKET;
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_CLASS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestClass;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_VENDOR(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestVendor;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_FEATURE(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT FeatureSelector,
- USHORT Index,
- BOOLEAN SetFeature
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestHostToDevice;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- if (SetFeature) {
- Packet->Packet.bRequest = USB_REQUEST_SET_FEATURE;
- }
- else {
- Packet->Packet.bRequest = USB_REQUEST_CLEAR_FEATURE;
- }
-
- Packet->Packet.wValue.Value = FeatureSelector;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_GET_STATUS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestDeviceToHost;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- Packet->Packet.bRequest = USB_REQUEST_GET_STATUS;
- Packet->Packet.wIndex.Value = Index;
- Packet->Packet.wValue.Value = 0;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
diff --git a/usb/umdf_filter_umdf/umdf_driver/ControlQueue.cpp b/usb/umdf_filter_umdf/umdf_driver/ControlQueue.cpp
deleted file mode 100644
index f4058941..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/ControlQueue.cpp
+++ /dev/null
@@ -1,564 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ControlQueue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "winioctl.h"
-
-#include "ControlQueue.tmh"
-
-CMyControlQueue::CMyControlQueue(
- _In_ PCMyDevice Device
- ) : CMyQueue(Device)
-{
-
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CMyControlQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
-
- if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackDeviceIoControl)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackDeviceIoControl();
-
- }
- else
- {
- hr = CMyQueue::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyControlQueue::CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyControlQueue *Queue
- )
-/*++
-
-Routine Description:
-
-
- CreateInstance creates an instance of the queue object.
-
-Aruments:
-
- ppUkwn - OUT parameter is an IUnknown interface to the queue object
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- PCMyControlQueue queue = NULL;
- HRESULT hr = S_OK;
-
- queue = new CMyControlQueue(Device);
-
- if (NULL == queue)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Call the queue callback object to initialize itself. This will create
- // its partner queue framework object.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = queue->Initialize();
- }
-
- if (SUCCEEDED(hr))
- {
- *Queue = queue;
- }
- else
- {
- SAFE_RELEASE(queue);
- }
-
- return hr;
-}
-
-HRESULT
-CMyControlQueue::Initialize(
- VOID
- )
-{
- HRESULT hr;
-
- //
- // First initialize the base class. This will create the partner FxIoQueue
- // object and setup automatic forwarding of I/O controls.
- //
-
- //
- // The framework (UMDF) will not deliver a
- // request to the driver that arrives on a power-managed queue, unless
- // the device is in a powered-up state. If you receive a request on a
- // power-managed queue after the device has idled out,
- // the framework will not be able to power-up and present the request
- // to the driver unless it is the power policy owner (PPO).
- // Since this driver is the PPO it can use power managed queues
- //
-
- hr = __super::Initialize(WdfIoQueueDispatchSequential,
- false,
- true /* use power managed queue */);
-
- //
- // return the status.
- //
-
- return hr;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyControlQueue::OnDeviceIoControl(
- _In_ IWDFIoQueue *FxQueue,
- _In_ IWDFIoRequest *FxRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- DeviceIoControl dispatch routine
-
-Aruments:
-
- FxQueue - Framework Queue instance
- FxRequest - Framework Request instance
- ControlCode - IO Control Code
- InputBufferSizeInBytes - Lenth of input buffer
- OutputBufferSizeInBytes - Lenth of output buffer
-
- Always succeeds DeviceIoIoctl
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(FxQueue);
-
- IWDFMemory *memory = NULL;
- PVOID buffer;
-
- SIZE_T bigBufferCb;
-
- ULONG information = 0;
-
- bool completeRequest = true;
-
- HRESULT hr = S_OK;
-
- switch (ControlCode)
- {
- case IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR:
- {
- //
- // Get the output buffer.
- //
-
- FxRequest->GetOutputMemory(&memory );
-
- //
- // request the descriptor.
- //
-
- ULONG bufferCb;
-
- //
- // Get the buffer address then release the memory object.
- // The memory object remains valid until the request is
- // completed.
- //
-
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- if (bigBufferCb > ULONG_MAX)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- break;
- }
- else
- {
- bufferCb = (ULONG) bigBufferCb;
- }
-
- hr = m_Device->GetUsbTargetDevice()->RetrieveDescriptor(
- USB_CONFIGURATION_DESCRIPTOR_TYPE,
- 0,
- 0,
- &bufferCb,
- (PUCHAR) buffer
- );
-
- if (SUCCEEDED(hr))
- {
- information = bufferCb;
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the result of the
- // control transfer.
- //
-
- if (OutputBufferSizeInBytes < sizeof(BAR_GRAPH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetOutputMemory(&memory );
- }
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->GetBarGraphDisplay((PBAR_GRAPH_STATE) buffer);
- }
-
- //
- // If that worked then record how many bytes of data we're
- // returning.
- //
-
- if (SUCCEEDED(hr))
- {
- information = sizeof(BAR_GRAPH_STATE);
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the input for the
- // control transfer.
- //
-
- if (InputBufferSizeInBytes < sizeof(BAR_GRAPH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetInputMemory(&memory);
- }
-
- //
- // Get the data buffer and use it to set the bar graph on the
- // device.
- //
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->SetBarGraphDisplay((PBAR_GRAPH_STATE) buffer);
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the result of the
- // control transfer.
- //
-
- if (OutputBufferSizeInBytes < sizeof(SEVEN_SEGMENT))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetOutputMemory(&memory );
- }
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
- hr = m_Device->GetSevenSegmentDisplay((PSEVEN_SEGMENT) buffer);
- }
-
- //
- // If that worked then record how many bytes of data we're
- // returning.
- //
-
- if (SUCCEEDED(hr))
- {
- information = sizeof(SEVEN_SEGMENT);
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the input for the
- // control transfer.
- //
-
- if (InputBufferSizeInBytes < sizeof(SEVEN_SEGMENT))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetInputMemory(&memory );
- }
-
- //
- // Get the data buffer and use it to set the bar graph on the
- // device.
- //
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->SetSevenSegmentDisplay((PSEVEN_SEGMENT) buffer);
- }
- break;
- }
-
- case IOCTL_OSRUSBFX2_READ_SWITCHES:
- {
- //
- // Make sure the buffer is big enough to hold the input for the
- // control transfer.
- //
-
- if (OutputBufferSizeInBytes < sizeof(SWITCH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetOutputMemory(&memory );
- }
-
- //
- // Get the data buffer and use it to set the bar graph on the
- // device.
- //
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->ReadSwitchState((PSWITCH_STATE) buffer);
- }
-
- if (SUCCEEDED(hr))
- {
- information = sizeof(SWITCH_STATE);
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE:
- {
- //
- // Make sure the buffer is big enough to hold the switch
- // state.
- //
-
- if (OutputBufferSizeInBytes < sizeof(SWITCH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- //
- // Forward the request to the switch state change queue.
- //
-
- hr = FxRequest->ForwardToIoQueue(
- m_Device->GetSwitchChangeQueue()
- );
-
- if (SUCCEEDED(hr))
- {
- completeRequest = false;
- }
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_RESET_DEVICE:
- case IOCTL_OSRUSBFX2_REENUMERATE_DEVICE:
- {
- //
- // WinUSB does not allow us to reset or re-enumerate the device.
- // Return not-supported for the error in both of these cases.
- //
-
- hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
- break;
- }
-
- case IOCTL_OSRUSBFX2_PLAY_FILE:
- {
- //
- // This IOCTL demonstrates how to use impersonation to access
- // resources using the credentials provided by the client. Note
- // that for impersonation to work it has to be enabled in the device
- // INF and the client must allow impersonation when they open the
- // device.
- //
- // This IOCTL opens a file using the path provided by the client
- // and then plays the characters in that file out to the seven segment
- // display in a worker thread.
- //
-
- PFILE_PLAYBACK playback;
- SIZE_T playbackCb;
- size_t realPlaybackCb;
-
- FxRequest->GetInputMemory(&memory);
-
- if (memory == NULL)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
- break;
- }
-
- //
- // Get the playback structure from the input buffer.
- //
-
- playback = (PFILE_PLAYBACK) memory->GetDataBuffer(&playbackCb);
-
- memory->Release();
-
- //
- // Make sure the length is at least as big as the fixed portion
- // of the input structure.
- //
-
- if (playbackCb < (FIELD_OFFSET(FILE_PLAYBACK, Path)))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
- break;
- }
-
- //
- // Make sure the file name is at least one character long.
- //
-
- playbackCb -= FIELD_OFFSET(FILE_PLAYBACK, Path);
-
- if (playbackCb < sizeof(WCHAR))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
- break;
- }
-
- //
- // Verify that the string provided is valid.
- //
-
- hr = StringCbLength(playback->Path,
- min(playbackCb, (STRSAFE_MAX_CCH * sizeof(WCHAR))),
- &realPlaybackCb);
-
- if (FAILED(hr))
- {
- break;
- }
-
- hr = m_Device->PlaybackFile(playback, FxRequest);
-
- break;
- }
-
-
-
- default:
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION);
- break;
- }
- }
-
- if (completeRequest)
- {
- FxRequest->CompleteWithInformation(hr, information);
- }
-
- return;
-}
diff --git a/usb/umdf_filter_umdf/umdf_driver/ControlQueue.h b/usb/umdf_filter_umdf/umdf_driver/ControlQueue.h
deleted file mode 100644
index 251521e1..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/ControlQueue.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ControlQueue.h
-
-Abstract:
-
- This file defines the queue callback object for handling device I/O
- control requests. This is a serialized queue.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class CMyControlQueue : public IQueueCallbackDeviceIoControl,
- public CMyQueue
-{
- HRESULT
- Initialize(
- VOID
- );
-
-public:
-
- CMyControlQueue(
- _In_ PCMyDevice Device
- );
-
- virtual
- ~CMyControlQueue(
- VOID
- )
- {
- return;
- }
-
- static
- HRESULT
- CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyControlQueue *Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return S_OK;
- }
-
- IQueueCallbackDeviceIoControl *
- QueryIQueueCallbackDeviceIoControl(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackDeviceIoControl *>(this);
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // Wdf Callbacks
- //
-
- //
- // IQueueCallbackDeviceIoControl
- //
- STDMETHOD_ (void, OnDeviceIoControl)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- );
-};
-
diff --git a/usb/umdf_filter_umdf/umdf_driver/Device.cpp b/usb/umdf_filter_umdf/umdf_driver/Device.cpp
deleted file mode 100644
index 101b3b79..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/Device.cpp
+++ /dev/null
@@ -1,2091 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR Fx2 driver's
- device callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-#include "internal.h"
-#include "initguid.h"
-#include "usb_hw.h"
-#include <devpkey.h>
-
-#include "device.tmh"
-#define CONCURRENT_READS 2
-
-CMyDevice::~CMyDevice(
- )
-{
- SAFE_RELEASE(m_pIoTargetInterruptPipeStateMgmt);
-}
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the OSR Fx2 driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice2 *fxDevice = NULL;
-
- HRESULT hr = S_OK;
-
- //
- // TODO: Any per-device initialization which must be done before
- // creating the partner object.
- //
-
- //
- // Set no locking unless you need an automatic callbacks synchronization
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // TODO: If you're writing a filter driver then indicate that here.
- // And then don't claim power policy ownership below
- //
- // FxDeviceInit->SetFilter();
- //
-
- //
- // Set the Fx2 driver as the power policy owner.
- //
-
- FxDeviceInit->SetPowerPolicyOwnership(TRUE);
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- if (SUCCEEDED(hr))
- {
- IUnknown *unknown = this->QueryIUnknown();
- IWDFDevice* device1;
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &device1);
-
- //
- // Convert the interface to version 2
- //
-
- if (SUCCEEDED(hr)) {
- device1->QueryInterface(IID_PPV_ARGS(&fxDevice));
- _Analysis_assume_(fxDevice != NULL);
- device1->Release();
- }
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr = S_OK;
-
- //
- // Get the bus type GUID for the device and confirm that we're attached to
- // USB.
- //
- // NOTE: Since this device only supports USB we'd normally trust our INF
- // to ensure this.
- //
- // But if the device also supported 1394 then we could
- // use this to determine which type of bus we were attached to.
- //
-
- hr = GetBusTypeGuid();
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- //
- // Create the read-write queue.
- //
-
- hr = CMyReadWriteQueue::CreateInstance(this, &m_ReadWriteQueue);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- //
- // We use default queue for read/write
- //
-
- hr = m_ReadWriteQueue->Configure();
-
- m_ReadWriteQueue->Release();
-
- //
- // Create the control queue and configure forwarding for IOCTL requests.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CMyControlQueue::CreateInstance(this, &m_ControlQueue);
-
- if (SUCCEEDED(hr))
- {
- hr = m_ControlQueue->Configure();
- if (SUCCEEDED(hr))
- {
- m_FxDevice->ConfigureRequestDispatching(
- m_ControlQueue->GetFxQueue(),
- WdfRequestDeviceIoControl,
- true
- );
- }
- m_ControlQueue->Release();
- }
- }
-
- //
- // Create a manual I/O queue to hold requests for notification when
- // the switch state changes.
- //
-
- hr = m_FxDevice->CreateIoQueue(NULL,
- FALSE,
- WdfIoQueueDispatchManual,
- FALSE,
- FALSE,
- &m_SwitchChangeQueue);
-
-
- //
- // Release creation reference as object tree will keep a reference
- //
-
- m_SwitchChangeQueue->Release();
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_OSRUSBFX2,
- NULL);
- }
-
- //
- // Mark the interface as restricted to allow access to applications bound
- // using device metadata. Failures here are not fatal so we log them but
- // ignore them otherwise.
- //
- if (SUCCEEDED(hr))
- {
- WDF_PROPERTY_STORE_ROOT RootSpecifier;
- IWDFUnifiedPropertyStoreFactory * pUnifiedPropertyStoreFactory = NULL;
- IWDFUnifiedPropertyStore * pUnifiedPropertyStore = NULL;
- DEVPROP_BOOLEAN isRestricted = DEVPROP_TRUE;
- HRESULT hrSetProp;
-
- hrSetProp = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pUnifiedPropertyStoreFactory));
-
- WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrSetProp));
-
- RootSpecifier.LengthCb = sizeof(RootSpecifier);
- RootSpecifier.RootClass = WdfPropertyStoreRootClassDeviceInterfaceKey;
- RootSpecifier.Qualifier.DeviceInterfaceKey.InterfaceGUID = &GUID_DEVINTERFACE_OSRUSBFX2;
- RootSpecifier.Qualifier.DeviceInterfaceKey.ReferenceString = NULL;
-
- hrSetProp = pUnifiedPropertyStoreFactory->RetrieveUnifiedDevicePropertyStore(&RootSpecifier,
- &pUnifiedPropertyStore);
-
- if (SUCCEEDED(hrSetProp))
- {
- hrSetProp = pUnifiedPropertyStore->SetPropertyData(&DEVPKEY_DeviceInterface_Restricted,
- 0, // Lcid
- 0, // Flags
- DEVPROP_TYPE_BOOLEAN,
- sizeof(isRestricted),
- &isRestricted);
- }
-
- if (FAILED(hrSetProp))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Could not set restricted property %!HRESULT!",
- hrSetProp
- );
- }
-
- SAFE_RELEASE(pUnifiedPropertyStoreFactory);
- SAFE_RELEASE(pUnifiedPropertyStore);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
- if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackHardware)))
- {
- *Object = QueryIPnpCallbackHardware();
- hr = S_OK;
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IPnpCallback)))
- {
- *Object = QueryIPnpCallback();
- hr = S_OK;
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackSelfManagedIo)))
- {
- *Object = QueryIPnpCallbackSelfManagedIo();
- hr = S_OK;
- }
- else if(IsEqualIID(InterfaceId, __uuidof(IUsbTargetPipeContinuousReaderCallbackReadersFailed)))
- {
- *Object = QueryContinousReaderFailureCompletion();
- hr = S_OK;
- }
- else if(IsEqualIID(InterfaceId, __uuidof(IUsbTargetPipeContinuousReaderCallbackReadComplete)))
- {
- *Object = QueryContinousReaderCompletion();
- hr = S_OK;
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnPrepareHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked to ready the driver
- to talk to hardware. It opens the handle to the
- device and talks to it using the WINUSB interface.
- It invokes WINUSB to discver the interfaces and stores
- the information related to bulk endpoints.
-
-Arguments:
-
- FxDevice : Pointer to the WDF device interface
-
-Return Value:
-
- HRESULT
-
---*/
-{
- PWSTR deviceName = NULL;
- DWORD deviceNameCch = 0;
-
- HRESULT hr;
-
- //
- // Get the device name.
- // Get the length to allocate first
- //
-
- hr = m_FxDevice->RetrieveDeviceName(NULL, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!HRESULT!",
- hr
- );
- }
-
- //
- // Allocate the buffer
- //
-
- if (SUCCEEDED(hr))
- {
- deviceName = new WCHAR[deviceNameCch];
-
- if (deviceName == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- }
-
- //
- // Get the actual name
- //
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->RetrieveDeviceName(deviceName, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Device name %S",
- deviceName
- );
- }
-
- //
- // Create USB I/O Targets and configure them
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CreateUsbIoTargets();
- }
-
- if (SUCCEEDED(hr))
- {
- ULONG length = sizeof(m_Speed);
-
- hr = m_pIUsbTargetDevice->RetrieveDeviceInformation(DEVICE_SPEED,
- &length,
- &m_Speed);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb device speed information %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Speed - %x\n",
- m_Speed
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = ConfigureUsbPipes();
- }
-
- // Setup power-management settings on the device.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = SetPowerManagement();
- }
-
- //
- //
- // Clear the seven segement display to indicate that we're done with
- // prepare hardware.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = IndicateDeviceReady();
- }
-
- if (SUCCEEDED(hr))
- {
- hr = ConfigContReaderForInterruptEndPoint();
- }
-
- delete[] deviceName;
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnReleaseHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked when the device is being removed or stopped
- It releases all resources allocated for this device.
-
-Arguments:
-
- FxDevice - Pointer to the Device object.
-
-Return Value:
-
- HRESULT - Always succeeds.
-
---*/
-{
- //
- // Delete USB Target Device WDF Object, this will in turn
- // delete all the children - interface and the pipe objects
- //
- // This makes sure that
- // 1. We drain the the pending read which does not come from an I/O queue
- // 2. We remove USB target objects from object tree (and thereby free them)
- // before any potential subsequent OnPrepareHardware creates new ones
- //
- // m_pIUsbTargetDevice could be NULL if OnPrepareHardware failed so we need
- // to guard against that
- //
-
- if (m_pIUsbTargetDevice)
- {
- m_pIUsbTargetDevice->DeleteWdfObject();
- }
-
- return S_OK;
-}
-
-HRESULT
-CMyDevice::CreateUsbIoTargets(
- )
-/*++
-
-Routine Description:
-
- This routine creates Usb device, interface and pipe objects
-
-Arguments:
-
- None
-
-Return Value:
-
- HRESULT
---*/
-{
- HRESULT hr;
- UCHAR NumEndPoints = 0;
- IWDFUsbTargetFactory * pIUsbTargetFactory = NULL;
- IWDFUsbTargetDevice * pIUsbTargetDevice = NULL;
- IWDFUsbInterface * pIUsbInterface = NULL;
- IWDFUsbTargetPipe * pIUsbPipe = NULL;
-
- hr = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pIUsbTargetFactory));
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb target factory %!HRESULT!",
- hr
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pIUsbTargetFactory->CreateUsbTargetDevice(
- &pIUsbTargetDevice);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to create USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- else
- {
- m_pIUsbTargetDevice = pIUsbTargetDevice;
-
- //
- // Release the creation reference as object tree will maintain a reference
- //
-
- pIUsbTargetDevice->Release();
- }
- }
-
- if (SUCCEEDED(hr))
- {
- UCHAR NumInterfaces = pIUsbTargetDevice->GetNumInterfaces();
-
- WUDF_TEST_DRIVER_ASSERT(1 == NumInterfaces);
-
- hr = pIUsbTargetDevice->RetrieveUsbInterface(0, &pIUsbInterface);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to retrieve USB interface from USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- else
- {
- m_pIUsbInterface = pIUsbInterface;
-
- pIUsbInterface->Release(); //release creation reference
- }
- }
-
- if (SUCCEEDED(hr))
- {
- NumEndPoints = pIUsbInterface->GetNumEndPoints();
-
- if (NumEndPoints != NUM_OSRUSB_ENDPOINTS) {
- hr = E_UNEXPECTED;
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Has %d endpoints, expected %d, returning %!HRESULT! ",
- NumEndPoints,
- NUM_OSRUSB_ENDPOINTS,
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- for (UCHAR PipeIndex = 0; PipeIndex < NumEndPoints; PipeIndex++)
- {
- hr = pIUsbInterface->RetrieveUsbPipeObject(PipeIndex,
- &pIUsbPipe);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to retrieve USB Pipe for PipeIndex %d, %!HRESULT!",
- PipeIndex,
- hr
- );
- }
- else
- {
- if ( pIUsbPipe->IsInEndPoint() )
- {
- if ( UsbdPipeTypeInterrupt == pIUsbPipe->GetType() )
- {
- m_pIUsbInterruptPipe = pIUsbPipe;
-
- WUDF_TEST_DRIVER_ASSERT (m_pIoTargetInterruptPipeStateMgmt == NULL);
-
- hr = m_pIUsbInterruptPipe->QueryInterface(__uuidof(
- IWDFIoTargetStateManagement),
- reinterpret_cast<void**>(&m_pIoTargetInterruptPipeStateMgmt)
- );
- if (FAILED(hr))
- {
- m_pIoTargetInterruptPipeStateMgmt = NULL;
- }
- }
- else if ( UsbdPipeTypeBulk == pIUsbPipe->GetType() )
- {
- m_pIUsbInputPipe = pIUsbPipe;
- }
- else
- {
- pIUsbPipe->DeleteWdfObject();
- }
- }
- else if ( pIUsbPipe->IsOutEndPoint() && (UsbdPipeTypeBulk == pIUsbPipe->GetType()) )
- {
- m_pIUsbOutputPipe = pIUsbPipe;
- }
- else
- {
- pIUsbPipe->DeleteWdfObject();
- }
-
- SAFE_RELEASE(pIUsbPipe); //release creation reference
- }
- }
-
- if (NULL == m_pIUsbInputPipe || NULL == m_pIUsbOutputPipe)
- {
- hr = E_UNEXPECTED;
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Input or output pipe not found, returning %!HRESULT!",
- hr
- );
- }
- }
-
- SAFE_RELEASE(pIUsbTargetFactory);
-
- return hr;
-}
-
-HRESULT
-CMyDevice::ConfigureUsbPipes(
- )
-/*++
-
-Routine Description:
-
- This routine retrieves the IDs for the bulk end points of the USB device.
-
-Arguments:
-
- None
-
-Return Value:
-
- HRESULT
---*/
-{
- HRESULT hr = S_OK;
- LONG timeout;
-
- //
- // Set timeout policies for input/output pipes
- //
-
- if (SUCCEEDED(hr))
- {
- timeout = ENDPOINT_TIMEOUT;
-
- hr = m_pIUsbInputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT,
- sizeof(timeout),
- &timeout);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to set timeout policy for input pipe %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- timeout = ENDPOINT_TIMEOUT;
-
- hr = m_pIUsbOutputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT,
- sizeof(timeout),
- &timeout);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to set timeout policy for output pipe %!HRESULT!",
- hr
- );
- }
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::IndicateDeviceReady(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method lights the period on the device's seven-segment display to
- indicate that the driver's PrepareHardware method has completed.
-
- Arguments:
-
- None
-
- Return Value:
-
- Status
-
---*/
-{
- SEVEN_SEGMENT display = {0};
-
- HRESULT hr;
-
- //
- // First read the contents of the seven segment display.
- //
-
- hr = GetSevenSegmentDisplay(&display);
-
- if (SUCCEEDED(hr))
- {
- display.Segments |= 0x08;
-
- hr = SetSevenSegmentDisplay(&display);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::GetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- )
-/*++
-
- Routine Description:
-
- This method synchronously retrieves the bar graph display information
- from the OSR USB-FX2 device. It uses the buffers in the FxRequest
- to hold the data it retrieves.
-
- Arguments:
-
- FxRequest - the request for the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesReturned;
-
- HRESULT hr = S_OK;
-
- //
- // Zero the contents of the buffer - the controller OR's in every
- // light that's set.
- //
-
- BarGraphState->BarsAsUChar = 0;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestDeviceToHost,
- BmRequestToDevice,
- USBFX2LK_READ_BARGRAPH_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) BarGraphState,
- sizeof(BAR_GRAPH_STATE),
- &bytesReturned
- );
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- )
-/*++
-
- Routine Description:
-
- This method synchronously sets the bar graph display on the OSR USB-FX2
- device using the buffers in the FxRequest as input.
-
- Arguments:
-
- FxRequest - the request to set the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesTransferred;
-
- HRESULT hr = S_OK;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestHostToDevice,
- BmRequestToDevice,
- USBFX2LK_SET_BARGRAPH_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) BarGraphState,
- sizeof(BAR_GRAPH_STATE),
- &bytesTransferred
- );
-
-
- return hr;
-}
-
-HRESULT
-CMyDevice::GetSevenSegmentDisplay(
- _In_ PSEVEN_SEGMENT SevenSegment
- )
-/*++
-
- Routine Description:
-
- This method synchronously retrieves the bar graph display information
- from the OSR USB-FX2 device. It uses the buffers in the FxRequest
- to hold the data it retrieves.
-
- Arguments:
-
- FxRequest - the request for the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesReturned;
-
- HRESULT hr = S_OK;
-
- //
- // Zero the output buffer - the device will or in the bits for
- // the lights that are set.
- //
-
- SevenSegment->Segments = 0;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestDeviceToHost,
- BmRequestToDevice,
- USBFX2LK_READ_7SEGMENT_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) SevenSegment,
- sizeof(SEVEN_SEGMENT),
- &bytesReturned
- );
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SetSevenSegmentDisplay(
- _In_ PSEVEN_SEGMENT SevenSegment
- )
-/*++
-
- Routine Description:
-
- This method synchronously sets the bar graph display on the OSR USB-FX2
- device using the buffers in the FxRequest as input.
-
- Arguments:
-
- FxRequest - the request to set the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesTransferred;
-
- HRESULT hr = S_OK;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestHostToDevice,
- BmRequestToDevice,
- USBFX2LK_SET_7SEGMENT_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) SevenSegment,
- sizeof(SEVEN_SEGMENT),
- &bytesTransferred
- );
-
- return hr;
-}
-
-HRESULT
-CMyDevice::ReadSwitchState(
- _In_ PSWITCH_STATE SwitchState
- )
-/*++
-
- Routine Description:
-
- This method synchronously retrieves the bar graph display information
- from the OSR USB-FX2 device. It uses the buffers in the FxRequest
- to hold the data it retrieves.
-
- Arguments:
-
- FxRequest - the request for the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesReturned;
-
- HRESULT hr = S_OK;
-
- //
- // Zero the output buffer - the device will or in the bits for
- // the lights that are set.
- //
-
- SwitchState->SwitchesAsUChar = 0;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestDeviceToHost,
- BmRequestToDevice,
- USBFX2LK_READ_SWITCHES,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) SwitchState,
- sizeof(SWITCH_STATE),
- &bytesReturned
- );
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- )
-{
- HRESULT hr = S_OK;
- HRESULT hrRequest = S_OK;
- IWDFIoRequest *pWdfRequest = NULL;
- IWDFDriver * FxDriver = NULL;
- IWDFMemory * FxMemory = NULL;
- IWDFRequestCompletionParams * FxComplParams = NULL;
- IWDFUsbRequestCompletionParams * FxUsbComplParams = NULL;
-
- *LengthTransferred = 0;
-
- hr = m_FxDevice->CreateRequest( NULL, //pCallbackInterface
- NULL, //pParentObject
- &pWdfRequest);
- hrRequest = hr;
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice->GetDriver(&FxDriver);
-
- hr = FxDriver->CreatePreallocatedWdfMemory( Buffer,
- BufferLength,
- NULL, //pCallbackInterface
- pWdfRequest, //pParetObject
- &FxMemory );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_pIUsbTargetDevice->FormatRequestForControlTransfer( pWdfRequest,
- SetupPacket,
- FxMemory,
- NULL); //TransferOffset
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pWdfRequest->Send( m_pIUsbTargetDevice,
- WDF_REQUEST_SEND_OPTION_SYNCHRONOUS,
- 0); //Timeout
- }
-
- if (SUCCEEDED(hr))
- {
- pWdfRequest->GetCompletionParams(&FxComplParams);
-
- hr = FxComplParams->GetCompletionStatus();
- }
-
- if (SUCCEEDED(hr))
- {
- HRESULT hrQI = FxComplParams->QueryInterface(IID_PPV_ARGS(&FxUsbComplParams));
- WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrQI));
-
- WUDF_TEST_DRIVER_ASSERT( WdfUsbRequestTypeDeviceControlTransfer ==
- FxUsbComplParams->GetCompletedUsbRequestType() );
-
- FxUsbComplParams->GetDeviceControlTransferParameters( NULL,
- LengthTransferred,
- NULL,
- NULL );
- }
-
- SAFE_RELEASE(FxUsbComplParams);
- SAFE_RELEASE(FxComplParams);
- SAFE_RELEASE(FxMemory);
-
- if (SUCCEEDED(hrRequest))
- {
- pWdfRequest->DeleteWdfObject();
- }
- SAFE_RELEASE(pWdfRequest);
-
- SAFE_RELEASE(FxDriver);
-
- return hr;
-}
-
-WDF_IO_TARGET_STATE
-CMyDevice::GetTargetState(
- IWDFIoTarget * pTarget
- )
-{
- IWDFIoTargetStateManagement * pStateMgmt = NULL;
- WDF_IO_TARGET_STATE state;
-
- HRESULT hrQI = pTarget->QueryInterface(IID_PPV_ARGS(&pStateMgmt));
- WUDF_TEST_DRIVER_ASSERT((SUCCEEDED(hrQI) && pStateMgmt));
-
- state = pStateMgmt->GetState();
-
- SAFE_RELEASE(pStateMgmt);
-
- return state;
-}
-
-VOID
-CMyDevice::ServiceSwitchChangeQueue(
- _In_ SWITCH_STATE NewState,
- _In_ HRESULT CompletionStatus,
- _In_opt_ IWDFFile *SpecificFile
- )
-/*++
-
- Routine Description:
-
- This method processes switch-state change notification requests as
- part of reading the OSR device's interrupt pipe. As each read completes
- this pulls all pending I/O off the switch change queue and completes
- each request with the current switch state.
-
- Arguments:
-
- NewState - the state of the switches
-
- CompletionStatus - all pending operations are completed with this status.
-
- SpecificFile - if provided only requests for this file object will get
- completed.
-
- Return Value:
-
- None
-
---*/
-{
- IWDFIoRequest *fxRequest;
-
- HRESULT enumHr = S_OK;
-
- do
- {
- HRESULT hr;
-
- //
- // Get the next request.
- //
-
- if (NULL != SpecificFile)
- {
- enumHr = m_SwitchChangeQueue->RetrieveNextRequestByFileObject(
- SpecificFile,
- &fxRequest
- );
- }
- else
- {
- enumHr = m_SwitchChangeQueue->RetrieveNextRequest(&fxRequest);
- }
-
- //
- // if we got one then complete it.
- //
-
- if (SUCCEEDED(enumHr))
- {
- if (SUCCEEDED(CompletionStatus))
- {
- IWDFMemory *fxMemory;
-
- //
- // First copy the result to the request buffer.
- //
-
- fxRequest->GetOutputMemory(&fxMemory );
-
- hr = fxMemory->CopyFromBuffer(0,
- &NewState,
- sizeof(SWITCH_STATE));
- fxMemory->Release();
- }
- else
- {
- hr = CompletionStatus;
- }
-
- //
- // Complete the request with the status of the copy (or the completion
- // status if that was an error).
- //
-
- if (SUCCEEDED(hr))
- {
- fxRequest->CompleteWithInformation(hr, sizeof(SWITCH_STATE));
- }
- else
- {
- fxRequest->Complete(hr);
- }
-
- fxRequest->Release();
- }
- }
- while (SUCCEEDED(enumHr));
-}
-
-HRESULT
-CMyDevice::SetPowerManagement(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method enables the idle and wake functionality
- using UMDF. UMDF has been set as the power policy
- owner (PPO) for the device stack and we are using power
- managed queues.
-
- Arguments:
-
- None
-
- Return Value:
-
- Status
-
---*/
-{
- HRESULT hr;
-
- //
- // Enable USB selective suspend on the device.
- //
-
- hr = m_FxDevice->AssignS0IdleSettings( IdleUsbSelectiveSuspend,
- PowerDeviceMaximum,
- IDLE_TIMEOUT_IN_MSEC,
- IdleAllowUserControl,
- WdfUseDefault);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to assign S0 idle settings for the device %!HRESULT!",
- hr
- );
- }
-
- //
- // Enable Sx wake settings
- //
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->AssignSxWakeSettings( PowerDeviceMaximum,
- WakeAllowUserControl,
- WdfUseDefault);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to set Sx Wake Settings for the device %!HRESULT!",
- hr
- );
- }
-
- }
-
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnD0Entry(
- _In_ IWDFDevice* pWdfDevice,
- _In_ WDF_POWER_DEVICE_STATE previousState
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- UNREFERENCED_PARAMETER(previousState);
-
- //
- // Start/Stop the I/O target if you support a continuous reader.
- // The rest of the I/O is fed through power managed queues. The queue
- // itself will stop feeding I/O to targets (and will wait for any pending
- // I/O to complete before going into low power state), hence targets
- // don�t need to be stopped/started. The continuous reader I/O is outside
- // of power managed queues so we need to Stop the I/O target on D0Exit and
- // start it on D0Entry. Please note that bulk pipe target doesn't need to
- // be stopped/started because I/O submitted to this pipe comes from power
- // managed I/O queue, which delivers I/O only in power on state.
- //
-
- m_pIoTargetInterruptPipeStateMgmt->Start();
-
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnD0Exit(
- _In_ IWDFDevice* pWdfDevice,
- _In_ WDF_POWER_DEVICE_STATE previousState
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- UNREFERENCED_PARAMETER(previousState);
-
- //
- // Stop the I/O target always succeedes.
- //
- m_pIoTargetInterruptPipeStateMgmt->Stop(WdfIoTargetCancelSentIo);
- return S_OK;
-}
-
-void
-CMyDevice::OnSurpriseRemoval(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return;
-}
-
-HRESULT
-CMyDevice::OnQueryRemove(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnQueryStop(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-//
-// Self Managed Io Callbacks
-//
-
-VOID
-CMyDevice::OnSelfManagedIoCleanup(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return;
-}
-
-VOID
-CMyDevice::OnSelfManagedIoFlush(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
-
- //
- // Complete every switch change operation with an error.
- //
- ServiceSwitchChangeQueue(m_SwitchState,
- HRESULT_FROM_WIN32(ERROR_DEVICE_REMOVED),
- NULL);
-
- return;
-}
-
-HRESULT
-CMyDevice::OnSelfManagedIoInit(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnSelfManagedIoRestart(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnSelfManagedIoStop(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnSelfManagedIoSuspend(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-
-
-HRESULT
-CMyDevice::ConfigContReaderForInterruptEndPoint(
- VOID
- )
-/*++
-
-Routine Description:
-
- This routine configures a continuous reader on the
- interrupt endpoint. It's called from the PrepareHarware event.
-
-Arguments:
-
-
-Return Value:
-
- HRESULT value
-
---*/
-{
- HRESULT hr, hrQI;
- IUsbTargetPipeContinuousReaderCallbackReadComplete *pOnCompletionCallback = NULL;
- IUsbTargetPipeContinuousReaderCallbackReadersFailed *pOnFailureCallback= NULL;
- IWDFUsbTargetPipe2 * pIUsbInterruptPipe2;
-
- hrQI = this->QueryInterface(IID_PPV_ARGS(&pOnCompletionCallback));
- WUDF_TEST_DRIVER_ASSERT((SUCCEEDED(hrQI) && pOnCompletionCallback));
-
- hrQI = this->QueryInterface(IID_PPV_ARGS(&pOnFailureCallback));
- WUDF_TEST_DRIVER_ASSERT((SUCCEEDED(hrQI) && pOnFailureCallback));
-
- hrQI = m_pIUsbInterruptPipe->QueryInterface(IID_PPV_ARGS(&pIUsbInterruptPipe2));
- WUDF_TEST_DRIVER_ASSERT((SUCCEEDED(hrQI) && pIUsbInterruptPipe2));
-
- //
- // Reader requests are not posted to the target automatically.
- // Driver must explictly call WdfIoTargetStart to kick start the
- // reader. In this sample, it's done in D0Entry.
- // By defaut, framework queues two requests to the target
- // endpoint. Driver can configure up to 10 requests with the
- // parameter CONCURRENT_READS
- //
- hr = pIUsbInterruptPipe2->ConfigureContinuousReader( sizeof(m_SwitchStateBuffer),
- 0,//header
- 0,//trailer
- CONCURRENT_READS,
- NULL,
- pOnCompletionCallback,
- m_pIUsbInterruptPipe,
- pOnFailureCallback
- );
-
- if (FAILED(hr)) {
- TraceEvents(TRACE_LEVEL_ERROR, TEST_TRACE_DEVICE,
- "OsrFxConfigContReaderForInterruptEndPoint failed %!HRESULT!",
- hr);
- }
-
- SAFE_RELEASE(pOnCompletionCallback);
- SAFE_RELEASE(pOnFailureCallback);
- SAFE_RELEASE(pIUsbInterruptPipe2);
-
- return hr;
-}
-
-
-BOOL
-CMyDevice::OnReaderFailure(
- IWDFUsbTargetPipe * pPipe,
- HRESULT hrCompletion
- )
-{
- UNREFERENCED_PARAMETER(pPipe);
-
- m_InterruptReadProblem = hrCompletion;
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Failure completed with %!HRESULT!",
- hrCompletion
- );
-
- ServiceSwitchChangeQueue(m_SwitchState,
- hrCompletion,
- NULL);
-
- return TRUE;
-}
-
-VOID
-CMyDevice::OnReaderCompletion(
- IWDFUsbTargetPipe * pPipe,
- IWDFMemory * pMemory,
- SIZE_T NumBytesTransferred,
- PVOID Context
- )
-{
- WUDF_TEST_DRIVER_ASSERT(pPipe == (IWDFUsbTargetPipe *)Context);
-
- //
- // Make sure that there is data in the read packet. Depending on the device
- // specification, it is possible for it to return a 0 length read in
- // certain conditions.
- //
-
- if (NumBytesTransferred == 0) {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Zero length read occured on the Interrupt Pipe's "
- "Continuous Reader\n"
- );
- return;
- }
-
- WUDF_TEST_DRIVER_ASSERT(NumBytesTransferred == sizeof(m_SwitchState));
-
- //
- // Get the switch state
- //
-
- PVOID pBuff = pMemory->GetDataBuffer(NULL);
-
- CopyMemory(&m_SwitchState, pBuff, sizeof(m_SwitchState));
-
-
- //
- // Satisfy application request for switch change notification
- //
-
- ServiceSwitchChangeQueue(m_SwitchState,
- S_OK,
- NULL);
-
- //
- // Make sure that the request that got completed is the one that we reuse
- // Don't Delete the request because it gets reused
- //
-}
-
-
-HRESULT
-CMyDevice::GetBusTypeGuid(
- VOID
- )
-/*++
-
- Routine Description:
-
- This routine gets the device instance ID then invokes SetupDi to
- retrieve the bus type guid for the device. The bus type guid is
- stored in object.
-
- Arguments:
-
- None
-
- Return Value:
-
- Status
-
---*/
-{
- ULONG instanceIdCch = 0;
- PWSTR instanceId = NULL;
-
- HDEVINFO deviceInfoSet = NULL;
- SP_DEVINFO_DATA deviceInfo = {sizeof(SP_DEVINFO_DATA)};
-
- HRESULT hr;
-
- //
- // Retrieve the device instance ID.
- //
-
- hr = m_FxDevice->RetrieveDeviceInstanceId(NULL, &instanceIdCch);
-
- if (FAILED(hr))
- {
- goto Exit;
- }
-
- instanceId = new WCHAR[instanceIdCch];
-
- if (instanceId == NULL)
- {
- hr = E_OUTOFMEMORY;
- goto Exit;
- }
-
- hr = m_FxDevice->RetrieveDeviceInstanceId(instanceId, &instanceIdCch);
-
- if (FAILED(hr))
- {
- goto Exit2;
- }
-
- //
- // Call SetupDI to open the device info.
- //
-
- deviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL);
-
- if (deviceInfoSet == INVALID_HANDLE_VALUE)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit2;
- }
-
- if (SetupDiOpenDeviceInfo(deviceInfoSet,
- instanceId,
- NULL,
- 0,
- &deviceInfo) == FALSE)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit3;
- }
-
- if (SetupDiGetDeviceRegistryProperty(deviceInfoSet,
- &deviceInfo,
- SPDRP_BUSTYPEGUID,
- NULL,
- (PBYTE) &m_BusTypeGuid,
- sizeof(m_BusTypeGuid),
- NULL) == FALSE)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit3;
- }
-
-Exit3:
- SetupDiDestroyDeviceInfoList(deviceInfoSet);
-
-Exit2:
-
- delete[] instanceId;
-
-Exit:
-
- return hr;
-}
-
-HRESULT
-CMyDevice::PlaybackFile(
- _In_ PFILE_PLAYBACK PlayInfo,
- _In_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method impersonates the caller, opens the file and prints each
- character to the seven segement display.
-
- Arguments:
-
- PlayInfo - the playback info from the request.
-
- FxRequest - the request (used for impersonation)
-
- Return Value:
-
- Status
-
---*/
-
-{
- PLAYBACK_IMPERSONATION_CONTEXT context = {PlayInfo, NULL, S_OK};
- IWDFIoRequest2* fxRequest2;
-
- HRESULT hr;
-
- // Convert FxRequest to FxRequest2. No error can occur here.
- FxRequest->QueryInterface(IID_PPV_ARGS(&fxRequest2));
- _Analysis_assume_(fxRequest2 != NULL);
-
- //
- // Impersonate and open the playback file.
- //
-
- hr = FxRequest->Impersonate(
- SecurityImpersonation,
- this->QueryIImpersonateCallback(),
- &context
- );
- if (FAILED(hr))
- {
- goto exit;
- }
-
- //
- // Release the reference that was added in QueryIImpersonateCallback()
- //
- this->Release();
-
- hr = context.Hr;
-
- if (FAILED(hr))
- {
- goto exit;
- }
-
- //
- // The impersonation callback succeeded - tell code analysis that the
- // file handle is non-null
- //
-
- _Analysis_assume_(context.FileHandle != NULL);
-
- //
- // Read from the file one character at a time until we hit
- // EOF or the request is cancelled.
- //
-
- do
- {
- UCHAR c;
- ULONG bytesRead;
-
- //
- // Check for cancellation.
- //
-
- if (fxRequest2->IsCanceled())
- {
- hr = HRESULT_FROM_WIN32(ERROR_CANCELLED);
- }
- else
- {
- BOOL result;
-
- //
- // Read a character from the file and see if we can
- // encode it on the display.
- //
-
- result = ReadFile(context.FileHandle,
- &c,
- sizeof(c),
- &bytesRead,
- NULL);
-
- if (result)
- {
- SEVEN_SEGMENT segment;
- BAR_GRAPH_STATE barGraph;
-
- if (bytesRead > 0)
- {
- #pragma prefast(suppress:__WARNING_USING_UNINIT_VAR,"Above this->Release() method does not actually free 'this'")
- if(EncodeSegmentValue(c, &segment) == true)
- {
- barGraph.BarsAsUChar = c;
-
- SetSevenSegmentDisplay(&segment);
- SetBarGraphDisplay(&barGraph);
- }
-
- Sleep(PlayInfo->Delay);
- }
- else
- {
- hr = S_OK;
- break;
- }
- }
- else
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- }
- }
-
- } while(SUCCEEDED(hr));
-
- CloseHandle(context.FileHandle);
-
-exit:
-
- fxRequest2->Release();
- return hr;
-}
-
-VOID
-CMyDevice::OnImpersonate(
- _In_ PVOID Context
- )
-/*++
-
- Routine Description:
-
- This routine handles the impersonation for the PLAY FILE I/O control.
-
- Arguments:
-
- Context - pointer to the impersonation context
-
- Return Value:
-
- None
-
---*/
-{
- PPLAYBACK_IMPERSONATION_CONTEXT context;
-
- context = (PPLAYBACK_IMPERSONATION_CONTEXT) Context;
-
- context->FileHandle = CreateFile(context->PlaybackInfo->Path,
- GENERIC_READ,
- FILE_SHARE_READ,
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
-
- if (context->FileHandle == INVALID_HANDLE_VALUE)
- {
- DWORD error = GetLastError();
- context->Hr = HRESULT_FROM_WIN32(error);
- }
- else
- {
- context->Hr = S_OK;
- }
-
- return;
-}
-
-#define SS_LEFT (SS_TOP_LEFT | SS_BOTTOM_LEFT)
-#define SS_RIGHT (SS_TOP_RIGHT | SS_BOTTOM_RIGHT)
-
-bool
-CMyDevice::EncodeSegmentValue(
- _In_ UCHAR Character,
- _Out_ SEVEN_SEGMENT *SevenSegment
- )
-{
- UCHAR letterMap[] = {
- (SS_TOP | SS_BOTTOM_LEFT | SS_RIGHT | SS_CENTER | SS_BOTTOM), // a
- (SS_LEFT | SS_CENTER | SS_BOTTOM | SS_BOTTOM_RIGHT), // b
- (SS_CENTER | SS_BOTTOM_LEFT | SS_BOTTOM), // c
- (SS_BOTTOM_LEFT | SS_CENTER | SS_BOTTOM | SS_RIGHT), // d
- (SS_LEFT | SS_TOP | SS_CENTER | SS_BOTTOM), // e
- (SS_LEFT | SS_TOP | SS_CENTER), // f
- (SS_TOP | SS_TOP_LEFT | SS_CENTER | SS_BOTTOM | SS_RIGHT), // g
- (SS_LEFT | SS_RIGHT | SS_CENTER), // h
- (SS_BOTTOM_LEFT), // i
- (SS_BOTTOM | SS_RIGHT), // j
- (SS_LEFT | SS_CENTER | SS_BOTTOM), // k
- (SS_LEFT | SS_BOTTOM), // l
- (SS_LEFT | SS_TOP | SS_RIGHT), // m
- (SS_BOTTOM_LEFT | SS_CENTER | SS_BOTTOM_RIGHT), // n
- (SS_BOTTOM_LEFT | SS_BOTTOM_RIGHT | SS_CENTER | SS_BOTTOM), // o
- (SS_LEFT | SS_TOP | SS_CENTER | SS_TOP_RIGHT), // p
- (SS_TOP_LEFT | SS_TOP | SS_CENTER | SS_RIGHT), // q
- (SS_BOTTOM_LEFT | SS_CENTER), // r
- (SS_TOP_LEFT |
- SS_TOP | SS_CENTER | SS_BOTTOM |
- SS_BOTTOM_RIGHT), // s
- (SS_TOP | SS_RIGHT), // t
- (SS_LEFT | SS_RIGHT | SS_BOTTOM), // u
- (SS_BOTTOM_LEFT | SS_BOTTOM | SS_BOTTOM_RIGHT), // v
- (SS_LEFT | SS_BOTTOM | SS_BOTTOM_RIGHT), // w
- (SS_LEFT | SS_CENTER | SS_RIGHT), // x
- (SS_TOP_LEFT | SS_CENTER | SS_RIGHT), // y
- (SS_TOP_RIGHT |
- SS_TOP | SS_CENTER | SS_BOTTOM |
- SS_BOTTOM_LEFT), // z
- };
-
- UCHAR numberMap[] = {
- (SS_LEFT | SS_TOP | SS_BOTTOM | SS_RIGHT | SS_DOT), // 0
- (SS_RIGHT | SS_DOT), // 1
- (SS_TOP |
- SS_TOP_RIGHT | SS_CENTER | SS_BOTTOM_LEFT |
- SS_BOTTOM | SS_DOT), // 2
- (SS_TOP | SS_CENTER | SS_BOTTOM | SS_RIGHT | SS_DOT), // 3
- (SS_TOP_LEFT | SS_CENTER | SS_RIGHT | SS_DOT), // 4
- (SS_TOP_LEFT |
- SS_TOP | SS_CENTER | SS_BOTTOM |
- SS_BOTTOM_RIGHT | SS_DOT), // 5
- (SS_TOP | SS_CENTER | SS_BOTTOM |
- SS_LEFT | SS_BOTTOM_RIGHT | SS_DOT), // 6
- (SS_TOP | SS_RIGHT | SS_DOT), // 7
- (SS_TOP | SS_BOTTOM | SS_CENTER |
- SS_LEFT | SS_RIGHT | SS_DOT), // 8
- (SS_TOP_LEFT | SS_TOP | SS_CENTER | SS_RIGHT | SS_DOT), // 9
- };
-
- if ((Character >= 'a') && (Character <= 'z'))
- {
- SevenSegment->Segments = letterMap[Character - 'a'];
- return true;
- }
- else if ((Character >= 'A') && (Character <= 'Z'))
- {
- SevenSegment->Segments = letterMap[Character - 'A'];
- return true;
- }
- else if ((Character >= '0') && (Character <= '9'))
- {
- SevenSegment->Segments = numberMap[Character - '0'];
- return true;
- }
- else
- {
- SevenSegment->Segments = 0;
- return false;
- }
-}
-
diff --git a/usb/umdf_filter_umdf/umdf_driver/Device.h b/usb/umdf_filter_umdf/umdf_driver/Device.h
deleted file mode 100644
index 641a04de..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/Device.h
+++ /dev/null
@@ -1,604 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF OSR Fx2 sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "internal.h"
-
-#define ENDPOINT_TIMEOUT 10000
-#define NUM_OSRUSB_ENDPOINTS 3
-
-//
-// Define the vendor commands supported by our device
-//
-#define USBFX2LK_READ_7SEGMENT_DISPLAY 0xD4
-#define USBFX2LK_READ_SWITCHES 0xD6
-#define USBFX2LK_READ_BARGRAPH_DISPLAY 0xD7
-#define USBFX2LK_SET_BARGRAPH_DISPLAY 0xD8
-#define USBFX2LK_IS_HIGH_SPEED 0xD9
-#define USBFX2LK_REENUMERATE 0xDA
-#define USBFX2LK_SET_7SEGMENT_DISPLAY 0xDB
-
-typedef struct {
- UCHAR Segments;
-} SEVEN_SEGMENT, *PSEVEN_SEGMENT;
-
-//
-// Context for the impersonation callback.
-//
-
-typedef struct
-{
- PFILE_PLAYBACK PlaybackInfo;
-
- HANDLE FileHandle;
-
- HRESULT Hr;
-} PLAYBACK_IMPERSONATION_CONTEXT, *PPLAYBACK_IMPERSONATION_CONTEXT;
-
-//
-// Class for the driver.
-//
-
-class CMyDevice :
- public CUnknown,
- public IPnpCallbackHardware,
- public IPnpCallback,
- public IPnpCallbackSelfManagedIo,
- public IUsbTargetPipeContinuousReaderCallbackReadersFailed,
- public IUsbTargetPipeContinuousReaderCallbackReadComplete,
- public IImpersonateCallback
-{
-//
-// Private data members.
-//
-private:
- //
- // Weak reference to framework device
- // Use IWDFDevice2 so we can set power policy settings
- //
- IWDFDevice2 *m_FxDevice;
-
- //
- // Weak reference to the control queue
- //
- PCMyReadWriteQueue m_ReadWriteQueue;
-
- //
- // Weak reference to the control queue
- //
- PCMyControlQueue m_ControlQueue;
-
- //
- // The bus type for this device (used here for
- // illustrative purposes only)
- //
-
- GUID m_BusTypeGuid;
-
- //
- // USB Device I/O Target
- //
- IWDFUsbTargetDevice * m_pIUsbTargetDevice;
-
- //
- // USB Interface
- //
- IWDFUsbInterface * m_pIUsbInterface;
-
- //
- // USB Input pipe for Reads
- //
- IWDFUsbTargetPipe * m_pIUsbInputPipe;
-
- //
- // USB Output pipe for writes
- //
- IWDFUsbTargetPipe * m_pIUsbOutputPipe;
-
- //
- // USB interrupt pipe
- //
- IWDFUsbTargetPipe * m_pIUsbInterruptPipe;
-
- //
- // Use I/O target state management interfaces if you are going to
- // support a continuous reader.
- //
-
- //
- // USB interrupt pipe state management
- //
- IWDFIoTargetStateManagement * m_pIoTargetInterruptPipeStateMgmt;
-
- //
- // Device Speed (Low, Full, High)
- //
- UCHAR m_Speed;
-
- //
- // Current switch state
- //
- SWITCH_STATE m_SwitchState;
-
- //
- // Request to be used for pending reads from interrupt pipe
- // (to get switch state change notifications)
- //
-
- IWDFIoRequest * m_RequestForPendingRead;
-
- //
- // If reads stopped because of a transient problem, the error status
- // is stored here.
- //
-
- HRESULT m_InterruptReadProblem;
-
- //
- // Switch state buffer - this might hold the transient value
- // m_SwitchState holds stable value of the switch state
- //
- SWITCH_STATE m_SwitchStateBuffer;
-
- //
- // A manual queue to hold requests for changes in the I/O switch state.
- //
-
- IWDFIoQueue * m_SwitchChangeQueue;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- ) :
- m_FxDevice(NULL),
- m_ControlQueue(NULL),
- m_ReadWriteQueue(NULL),
- m_SwitchChangeQueue(NULL),
- m_pIUsbTargetDevice(NULL),
- m_pIUsbInterface(NULL),
- m_pIUsbInputPipe(NULL),
- m_pIUsbOutputPipe(NULL),
- m_pIUsbInterruptPipe(NULL),
- m_Speed(0),
- m_InterruptReadProblem(S_OK),
- m_RequestForPendingRead(NULL),
- m_pIoTargetInterruptPipeStateMgmt(NULL)
- {
- ZeroMemory(&m_BusTypeGuid, sizeof(m_BusTypeGuid));
- }
-
- ~CMyDevice(
- );
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- //
- // Helper methods
- //
-
- HRESULT
- GetBusTypeGuid(
- VOID
- );
-
- HRESULT
- CreateUsbIoTargets(
- VOID
- );
-
-
- HRESULT
- ConfigureUsbPipes(
- );
-
- HRESULT
- SetPowerManagement(
- VOID
- );
-
- HRESULT
- IndicateDeviceReady(
- VOID
- );
-
- //
- // Helper functions
- //
-
- HRESULT
- SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- );
-
- static
- WDF_IO_TARGET_STATE
- GetTargetState(
- IWDFIoTarget * pTarget
- );
-
- VOID
- ServiceSwitchChangeQueue(
- _In_ SWITCH_STATE NewState,
- _In_ HRESULT CompletionStatus,
- _In_opt_ IWDFFile *SpecificFile
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- IWDFDevice *
- GetFxDevice(
- VOID
- )
- {
- return m_FxDevice;
- }
-
- HRESULT
- Configure(
- VOID
- );
-
- IPnpCallback *
- QueryIPnpCallback(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallback *>(this);
- }
-
- IPnpCallbackHardware *
- QueryIPnpCallbackHardware(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallbackHardware *>(this);
- }
-
- IPnpCallbackSelfManagedIo *
- QueryIPnpCallbackSelfManagedIo(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallbackSelfManagedIo *>(this);
- }
-
-
- IUsbTargetPipeContinuousReaderCallbackReadersFailed *
- QueryContinousReaderFailureCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IUsbTargetPipeContinuousReaderCallbackReadersFailed *>(this);
- }
-
- IUsbTargetPipeContinuousReaderCallbackReadComplete *
- QueryContinousReaderCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IUsbTargetPipeContinuousReaderCallbackReadComplete *>(this);
- }
-
- IImpersonateCallback *
- QueryIImpersonateCallback(
- VOID
- )
- {
- AddRef();
- return static_cast<IImpersonateCallback *>(this);
- }
-
- HRESULT
- GetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- );
-
- HRESULT
- SetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- );
-
- HRESULT
- GetSevenSegmentDisplay(
- _In_ PSEVEN_SEGMENT SevenSegment
- );
-
- HRESULT
- SetSevenSegmentDisplay(
- _In_ PSEVEN_SEGMENT SevenSegment
- );
-
- HRESULT
- ReadSwitchState(
- _In_ PSWITCH_STATE SwitchState
- );
-
- bool
- EncodeSegmentValue(
- _In_ UCHAR Character,
- _Out_ SEVEN_SEGMENT *SevenSegment
- );
-
- HRESULT
- PlaybackFile(
- _In_ PFILE_PLAYBACK PlaybackInfo,
- _In_ IWDFIoRequest *FxRequest
- );
-
- //
- //returns a weak reference to the target USB device
- //DO NOT release it
- //
- IWDFUsbTargetDevice *
- GetUsbTargetDevice(
- )
- {
- return m_pIUsbTargetDevice;
- }
-
- //
- //returns a weak reference to input pipe
- //DO NOT release it
- //
- IWDFUsbTargetPipe *
- GetInputPipe(
- )
- {
- return m_pIUsbInputPipe;
- }
-
- //
- //returns a weak reference to output pipe
- //DO NOT release it
- //
- IWDFUsbTargetPipe *
- GetOutputPipe(
- )
- {
- return m_pIUsbOutputPipe;
- }
-
- IWDFIoQueue *
- GetSwitchChangeQueue(
- VOID
- )
- {
- return m_SwitchChangeQueue;
- }
-
- PSWITCH_STATE
- GetCurrentSwitchState(
- VOID
- )
- {
- return &m_SwitchState;
- }
-
-
- HRESULT
- ConfigContReaderForInterruptEndPoint(
- VOID
- );
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IPnpCallbackHardware
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnPrepareHardware(
- _In_ IWDFDevice *FxDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnReleaseHardware(
- _In_ IWDFDevice *FxDevice
- );
-
-
- //
- // IPnpCallback
- //
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnD0Entry(
- _In_ IWDFDevice* pWdfDevice,
- _In_ WDF_POWER_DEVICE_STATE previousState
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnD0Exit(
- _In_ IWDFDevice* pWdfDevice,
- _In_ WDF_POWER_DEVICE_STATE previousState
- );
-
- virtual
- void
- STDMETHODCALLTYPE
- OnSurpriseRemoval(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnQueryRemove(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnQueryStop(
- _In_ IWDFDevice* pWdfDevice
- );
-
- //
- // IPnpCallbackSelfManagedIo
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnSelfManagedIoCleanup(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnSelfManagedIoFlush(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoInit(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoRestart(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoStop(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoSuspend(
- _In_ IWDFDevice* pWdfDevice
- );
-
- //
- // IUsbTargetPipeContinuousReaderCallbackReadersFailed
- //
- virtual
- BOOL
- STDMETHODCALLTYPE
- OnReaderFailure(
- IWDFUsbTargetPipe * pPipe,
- HRESULT hrCompletion
- );
-
- //
- // IUsbTargetPipeContinuousReaderCallbackReadComplete
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnReaderCompletion(
- IWDFUsbTargetPipe * pPipe,
- IWDFMemory * pMemory,
- SIZE_T NumBytesTransferred,
- PVOID Context
- );
-
- // IImpersonateCallback
- virtual
- VOID
- STDMETHODCALLTYPE
- OnImpersonate(
- _In_ PVOID Context
- );
-};
-
diff --git a/usb/umdf_filter_umdf/umdf_driver/Driver.cpp b/usb/umdf_filter_umdf/umdf_driver/Driver.cpp
deleted file mode 100644
index d6635242..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/Driver.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR Fx2 driver's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // TODO: Do any per-device initialization (reading settings from the
- // registry for example) that's necessary before creating your
- // device callback object here. Otherwise you can leave such
- // initialization to the initialization of the device event
- // handler.
- //
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // TODO: Change any per-device settings that the object exposes before
- // calling Configure to let it complete its initialization.
- //
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/usb/umdf_filter_umdf/umdf_driver/Driver.h b/usb/umdf_filter_umdf/umdf_driver/Driver.h
deleted file mode 100644
index d9cafb4e..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/Driver.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF OSR Fx2 sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the OSR Fx2 sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/umdf_filter_umdf/umdf_driver/OsrUsbFx2.ctl b/usb/umdf_filter_umdf/umdf_driver/OsrUsbFx2.ctl
deleted file mode 100644
index 4dab56ae..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/OsrUsbFx2.ctl
+++ /dev/null
@@ -1 +0,0 @@
-da5fbdfd-1eae-4ecf-b426-a3818f325ddb WudfOsrUsbFx2TraceGuid
diff --git a/usb/umdf_filter_umdf/umdf_driver/OsrUsbFx2.rc b/usb/umdf_filter_umdf/umdf_driver/OsrUsbFx2.rc
deleted file mode 100644
index 36f10ea9..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/OsrUsbFx2.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// OsrUsbDevice.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF OSR USB Fx2 User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "WUDFOsrUsbFx2"
-#define VER_ORIGINALFILENAME_STR "WUDFOsrUsbFx2.dll"
-
-#include "common.ver"
diff --git a/usb/umdf_filter_umdf/umdf_driver/ReadWriteQueue.cpp b/usb/umdf_filter_umdf/umdf_driver/ReadWriteQueue.cpp
deleted file mode 100644
index 46144829..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/ReadWriteQueue.cpp
+++ /dev/null
@@ -1,425 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "ReadWriteQueue.tmh"
-
-VOID
-CMyReadWriteQueue::OnCompletion(
- _In_ IWDFIoRequest* pWdfRequest,
- _In_ IWDFIoTarget* pIoTarget,
- _In_ IWDFRequestCompletionParams* pParams,
- _In_ PVOID pContext
- )
-{
- UNREFERENCED_PARAMETER(pIoTarget);
- UNREFERENCED_PARAMETER(pContext);
-
- pWdfRequest->CompleteWithInformation(
- pParams->GetCompletionStatus(),
- pParams->GetInformation()
- );
-}
-
-void
-CMyReadWriteQueue::ForwardFormattedRequest(
- _In_ IWDFIoRequest* pRequest,
- _In_ IWDFIoTarget* pIoTarget
- )
-{
- //
- //First set the completion callback
- //
-
- IRequestCallbackRequestCompletion * pCompletionCallback = NULL;
- HRESULT hrQI = this->QueryInterface(IID_PPV_ARGS(&pCompletionCallback));
- WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrQI) && (NULL != pCompletionCallback));
-
- pRequest->SetCompletionCallback(
- pCompletionCallback,
- NULL
- );
-
- pCompletionCallback->Release();
- pCompletionCallback = NULL;
-
- //
- //Send down the request
- //
-
- HRESULT hrSend = S_OK;
- hrSend = pRequest->Send(pIoTarget,
- 0, //flags
- 0); //timeout
-
- if (FAILED(hrSend))
- {
- pRequest->CompleteWithInformation(hrSend, 0);
- }
-
- return;
-}
-
-
-CMyReadWriteQueue::CMyReadWriteQueue(
- _In_ PCMyDevice Device
- ) :
- CMyQueue(Device)
-{
-}
-
-//
-// Queue destructor.
-// Free up the buffer, wait for thread to terminate and
-//
-
-CMyReadWriteQueue::~CMyReadWriteQueue(
- VOID
- )
-/*++
-
-Routine Description:
-
-
- IUnknown implementation of Release
-
-Aruments:
-
-
-Return Value:
-
- ULONG (reference count after Release)
-
---*/
-{
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC! Entry"
- );
-
-}
-
-
-HRESULT
-STDMETHODCALLTYPE
-CMyReadWriteQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
-
- if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackWrite)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackWrite();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackRead)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackRead();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IRequestCallbackRequestCompletion)))
- {
- hr = S_OK;
- *Object = QueryIRequestCallbackRequestCompletion();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackIoStop)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackIoStop();
- }
- else
- {
- hr = CMyQueue::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyReadWriteQueue::CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyReadWriteQueue *Queue
- )
-/*++
-
-Routine Description:
-
-
- CreateInstance creates an instance of the queue object.
-
-Aruments:
-
- ppUkwn - OUT parameter is an IUnknown interface to the queue object
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- PCMyReadWriteQueue queue;
- HRESULT hr = S_OK;
-
- queue = new CMyReadWriteQueue(Device);
-
- if (NULL == queue)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Call the queue callback object to initialize itself. This will create
- // its partner queue framework object.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = queue->Initialize();
- }
-
- if (SUCCEEDED(hr))
- {
- *Queue = queue;
- }
- else
- {
- SAFE_RELEASE(queue);
- }
-
- return hr;
-}
-
-HRESULT
-CMyReadWriteQueue::Initialize(
- )
-{
- HRESULT hr;
-
- //
- // First initialize the base class. This will create the partner FxIoQueue
- // object and setup automatic forwarding of I/O controls.
- //
-
- hr = __super::Initialize(WdfIoQueueDispatchParallel,
- true,
- true);
-
- //
- // return the status.
- //
-
- return hr;
-}
-
-STDMETHODIMP_ (void)
-CMyReadWriteQueue::OnWrite(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToWrite
- )
-/*++
-
-Routine Description:
-
-
- Write dispatch routine
- IQueueCallbackWrite
-
-Aruments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToWrite - Lenth of bytes in the write buffer
-
- Allocate and copy data to local buffer
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC!: Queue %p Request %p BytesToTransfer %d\n",
- this,
- pWdfRequest,
- (ULONG)(ULONG_PTR)BytesToWrite
- );
-
- HRESULT hr = S_OK;
- IWDFMemory * pInputMemory = NULL;
- IWDFUsbTargetPipe * pOutputPipe = m_Device->GetOutputPipe();
-
- pWdfRequest->GetInputMemory(&pInputMemory);
-
- hr = pOutputPipe->FormatRequestForWrite(
- pWdfRequest,
- NULL, //pFile
- pInputMemory,
- NULL, //Memory offset
- NULL //DeviceOffset
- );
-
- if (FAILED(hr))
- {
- pWdfRequest->Complete(hr);
- }
- else
- {
- ForwardFormattedRequest(pWdfRequest, pOutputPipe);
- }
-
- SAFE_RELEASE(pInputMemory);
-
- return;
-}
-
-STDMETHODIMP_ (void)
-CMyReadWriteQueue::OnRead(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToRead
- )
-/*++
-
-Routine Description:
-
-
- Read dispatch routine
- IQueueCallbackRead
-
-Aruments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToRead - Lenth of bytes in the read buffer
-
- Copy available data into the read buffer
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC!: Queue %p Request %p BytesToTransfer %d\n",
- this,
- pWdfRequest,
- (ULONG)(ULONG_PTR)BytesToRead
- );
-
- HRESULT hr = S_OK;
- IWDFMemory * pOutputMemory = NULL;
-
- pWdfRequest->GetOutputMemory(&pOutputMemory);
-
- hr = m_Device->GetInputPipe()->FormatRequestForRead(
- pWdfRequest,
- NULL, //pFile
- pOutputMemory,
- NULL, //Memory offset
- NULL //DeviceOffset
- );
-
- if (FAILED(hr))
- {
- pWdfRequest->Complete(hr);
- }
- else
- {
- ForwardFormattedRequest(pWdfRequest, m_Device->GetInputPipe());
- }
-
- SAFE_RELEASE(pOutputMemory);
-
- return;
-}
-
-STDMETHODIMP_ (void)
-CMyReadWriteQueue::OnIoStop(
- _In_ IWDFIoQueue * pWdfQueue,
- _In_ IWDFIoRequest * pWdfRequest,
- _In_ ULONG ActionFlags
- )
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
-
-
- //
- // The driver owns the request and no locking constraint is safe for
- // the queue callbacks
- //
- if (ActionFlags == WdfRequestStopActionSuspend )
- {
- IWDFIoRequest2 * request2 = NULL;
- HRESULT hr;
-
- hr = pWdfRequest->QueryInterface(IID_PPV_ARGS(&request2));
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC!: Failed to QI for IWDFIoRequest2: %!hresult!",
- hr);
- return;
- }
-
- request2->StopAcknowledge(FALSE); //don't requeue
- SAFE_RELEASE(request2);
- }
- else if(ActionFlags == WdfRequestStopActionPurge)
- {
- //
- // Cancel the sent request since we are asked to purge the request
- //
-
- pWdfRequest->CancelSentRequest();
- }
-
- return;
-}
-
diff --git a/usb/umdf_filter_umdf/umdf_driver/ReadWriteQueue.h b/usb/umdf_filter_umdf/umdf_driver/ReadWriteQueue.h
deleted file mode 100644
index 4f1a98c1..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/ReadWriteQueue.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-#define MAX_TRANSFER_SIZE(x) 64*1024*1024
-
-//
-// Queue Callback Object.
-//
-
-class CMyReadWriteQueue :
- public IQueueCallbackRead,
- public IQueueCallbackWrite,
- public IRequestCallbackRequestCompletion,
- public IQueueCallbackIoStop,
- public CMyQueue
-{
-protected:
- HRESULT
- Initialize(
- );
-
- void
- ForwardFormattedRequest(
- _In_ IWDFIoRequest* pRequest,
- _In_ IWDFIoTarget* pIoTarget
- );
-
-public:
-
- CMyReadWriteQueue(
- _In_ PCMyDevice Device
- );
-
- virtual ~CMyReadWriteQueue();
-
- static
- HRESULT
- CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyReadWriteQueue *Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return CMyQueue::Configure();
- }
-
- IQueueCallbackWrite *
- QueryIQueueCallbackWrite(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackWrite *>(this);
- }
-
- IQueueCallbackRead *
- QueryIQueueCallbackRead(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackRead *>(this);
- }
-
- IRequestCallbackRequestCompletion *
- QueryIRequestCallbackRequestCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IRequestCallbackRequestCompletion *>(this);
- }
-
- IQueueCallbackIoStop*
- QueryIQueueCallbackIoStop(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackIoStop *>(this);
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
-
- //
- // Wdf Callbacks
- //
-
- //
- // IQueueCallbackWrite
- //
- STDMETHOD_ (void, OnWrite)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToWrite
- );
-
- //
- // IQueueCallbackRead
- //
- STDMETHOD_ (void, OnRead)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToRead
- );
-
- //
- //IRequestCallbackRequestCompletion
- //
-
- STDMETHOD_ (void, OnCompletion)(
- _In_ IWDFIoRequest* pWdfRequest,
- _In_ IWDFIoTarget* pIoTarget,
- _In_ IWDFRequestCompletionParams* pParams,
- _In_ PVOID pContext
- );
-
- //
- //IQueueCallbackIoStop
- //
-
- STDMETHOD_ (void, OnIoStop)(
- _In_ IWDFIoQueue * pWdfQueue,
- _In_ IWDFIoRequest * pWdfRequest,
- _In_ ULONG ActionFlags
- );
-
-};
diff --git a/usb/umdf_filter_umdf/umdf_driver/WUDFOsrUsbFx2.vcxproj b/usb/umdf_filter_umdf/umdf_driver/WUDFOsrUsbFx2.vcxproj
deleted file mode 100644
index d9258176..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/WUDFOsrUsbFx2.vcxproj
+++ /dev/null
@@ -1,281 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <SupportsPackaging>false</SupportsPackaging>
- <RequiresPackageProject>true</RequiresPackageProject>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{87BFB278-0771-439F-893D-89376B83F7F0}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp; queue.cpp; ControlQueue.cpp; ReadWriteQueue.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="OsrUsbFx2.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFOsrUsbFx2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFOsrUsbFx2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFOsrUsbFx2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFOsrUsbFx2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inf" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_umdf/umdf_driver/WUDFOsrUsbFx2.vcxproj.Filters b/usb/umdf_filter_umdf/umdf_driver/WUDFOsrUsbFx2.vcxproj.Filters
deleted file mode 100644
index 372badf0..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/WUDFOsrUsbFx2.vcxproj.Filters
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{F8E1CCD2-AADC-44B5-B631-5C6E6D74CFCD}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{0E050956-9FA9-495C-9F9F-D663EFA3A344}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{49CD21A6-260A-471B-B532-9E9E23F6195F}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{A942026F-83A0-4223-881A-29732777F22C}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ControlQueue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ReadWriteQueue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_umdf/umdf_driver/comsup.cpp b/usb/umdf_filter_umdf/umdf_driver/comsup.cpp
deleted file mode 100644
index 2f14f588..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/comsup.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-_Use_decl_annotations_
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/usb/umdf_filter_umdf/umdf_driver/comsup.h b/usb/umdf_filter_umdf/umdf_driver/comsup.h
deleted file mode 100644
index 167b21ff..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/comsup.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/usb/umdf_filter_umdf/umdf_driver/dllsup.cpp b/usb/umdf_filter_umdf/umdf_driver/dllsup.cpp
deleted file mode 100644
index 7fda91e4..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/dllsup.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR Fx2
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the driver uses
- L"Microsoft\\UMDF\\OsrUsb"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for this sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing, and saves the module handle away in a
- global variable so that it can be referenced should the COM registration
- code (Dll[Un]RegisterServer) be called.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
- UNREFERENCED_PARAMETER(ModuleHandle);
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllCanUnloadNow(
- VOID
- )
-/*++
-
- Routine Description:
-
- Called by the COM runtime when determining whether or not this module
- can be unloaded. Our answer is always "no".
-
- Arguments:
-
- None
-
- Return Value:
-
- S_FALSE
-
---*/
-{
- return S_FALSE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- REFCLSID ClassId,
- REFIID InterfaceId,
- LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- OSR Fx2 driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/usb/umdf_filter_umdf/umdf_driver/exports.def b/usb/umdf_filter_umdf/umdf_driver/exports.def
deleted file mode 100644
index 15f923d3..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/exports.def
+++ /dev/null
@@ -1,4 +0,0 @@
-; WudfOsrUsbDriver.def : Declares the module parameters.
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/usb/umdf_filter_umdf/umdf_driver/internal.h b/usb/umdf_filter_umdf/umdf_driver/internal.h
deleted file mode 100644
index 2d57793d..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/internal.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF OSR Fx2
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF Headers
-//
-
-#include "wudfddi.h"
-
-//
-// Include SetupDi functions.
-//
-
-#include "setupapi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Include the safestring functions.
-//
-
-#include "strsafe.h"
-
-//
-// Get limits on common data types (ULONG_MAX for example)
-//
-
-#include "limits.h"
-
-//
-// We need usb I/O targets to talk to the OSR device.
-//
-
-#include "wudfusb.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "public.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "WUDFOsrUsbPublic.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-
-typedef class CMyControlQueue *PCMyControlQueue;
-typedef class CMyReadWriteQueue *PCMyReadWriteQueue;
-
-typedef class CCancelCallback *PCCancelCallback;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- WudfOsrUsbFx2TraceGuid, (da5fbdfd,1eae,4ecf,b426,a3818f325ddb), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- WPP_DEFINE_BIT(TEST_TRACE_DRIVER) \
- WPP_DEFINE_BIT(TEST_TRACE_DEVICE) \
- WPP_DEFINE_BIT(TEST_TRACE_QUEUE) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
- WPP_LEVEL_LOGGER(flags)
-
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
- (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\OsrUsb"
-#define MYDRIVER_CLASS_ID {0x0865b2b0, 0x6b73, 0x428f, {0xa3, 0xea, 0x21, 0x72, 0x83, 0x2d, 0x6b, 0xfc}}
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "queue.h"
-#include "ControlQueue.h"
-#include "ReadWriteQueue.h"
-#include "list.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_TEST_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
-
-#define IDLE_TIMEOUT_IN_MSEC 10*1000
diff --git a/usb/umdf_filter_umdf/umdf_driver/queue.cpp b/usb/umdf_filter_umdf/umdf_driver/queue.cpp
deleted file mode 100644
index c56b38bb..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/queue.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "queue.tmh"
-
-CMyQueue::CMyQueue(
- _In_ PCMyDevice Device
- ) :
- m_FxQueue(NULL),
- m_Device(Device)
-{
-}
-
-//
-// Queue destructor.
-// Free up the buffer, wait for thread to terminate and
-//
-
-CMyQueue::~CMyQueue(
- VOID
- )
-/*++
-
-Routine Description:
-
-
- IUnknown implementation of Release
-
-Aruments:
-
-
-Return Value:
-
- ULONG (reference count after Release)
-
---*/
-{
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC! Entry"
- );
-
-}
-
-
-HRESULT
-STDMETHODCALLTYPE
-CMyQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
- hr = CUnknown::QueryInterface(InterfaceId, Object);
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyQueue::Initialize(
- _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType,
- _In_ bool Default,
- _In_ bool PowerManaged
- )
-{
- IWDFIoQueue *fxQueue;
- HRESULT hr;
-
- //
- // Create the I/O Queue object.
- //
-
- {
- IUnknown *callback = QueryIUnknown();
-
- hr = m_Device->GetFxDevice()->CreateIoQueue(
- callback,
- Default,
- DispatchType,
- PowerManaged,
- FALSE,
- &fxQueue
- );
- callback->Release();
- }
-
- if (SUCCEEDED(hr))
- {
- m_FxQueue = fxQueue;
-
- //
- // Release the creation reference on the queue. This object will be
- // destroyed before the queue so we don't need to have a reference out
- // on it.
- //
-
- fxQueue->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyQueue::Configure(
- VOID
- )
-{
- return S_OK;
-}
diff --git a/usb/umdf_filter_umdf/umdf_driver/queue.h b/usb/umdf_filter_umdf/umdf_driver/queue.h
deleted file mode 100644
index 5659224b..00000000
--- a/usb/umdf_filter_umdf/umdf_driver/queue.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class CMyQueue :
- public CUnknown
-{
-protected:
- //
- // Unreferenced pointer to the partner Fx device.
- //
-
- IWDFIoQueue *m_FxQueue;
-
- //
- // Unreferenced pointer to the parent device.
- //
-
- PCMyDevice m_Device;
-
- HRESULT
- Initialize(
- _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType,
- _In_ bool Default,
- _In_ bool PowerManaged
- );
-
-protected:
-
- CMyQueue(
- _In_ PCMyDevice Device
- );
-
- virtual ~CMyQueue();
-
- HRESULT
- Configure(
- VOID
- );
-
-public:
-
- IWDFIoQueue *
- GetFxQueue(
- VOID
- )
- {
- return m_FxQueue;
- }
-
-
- PCMyDevice
- GetDevice(
- VOID
- )
- {
- return m_Device;
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/umdf_filter_umdf/umdf_filter/OsrUsbFilter.rc b/usb/umdf_filter_umdf/umdf_filter/OsrUsbFilter.rc
deleted file mode 100644
index cec032d9..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/OsrUsbFilter.rc
+++ /dev/null
@@ -1,17 +0,0 @@
-//---------------------------------------------------------------------------
-// OsrUsbFilter.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF OsrUsbFilter User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "OsrUsbFilter"
-#define VER_ORIGINALFILENAME_STR "OsrUsbFilter.dll"
-
-#include "common.ver"
diff --git a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilter.vcxproj b/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilter.vcxproj
deleted file mode 100644
index 38798dfe..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilter.vcxproj
+++ /dev/null
@@ -1,293 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{502F5F25-02A2-4047-8DD1-EB3DF0CC7127}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <SupportsPackaging>false</SupportsPackaging>
- <RequiresPackageProject>true</RequiresPackageProject>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{45297D7C-3015-4F09-B0E7-469440EB9458}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp; queue.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="OsrUsbFilter.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFOsrUsbFilter</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFOsrUsbFilter</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFOsrUsbFilter</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFOsrUsbFilter</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- </ItemDefinitionGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFilter.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilter.vcxproj.Filters b/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilter.vcxproj.Filters
deleted file mode 100644
index 7a4a8f8d..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilter.vcxproj.Filters
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{3CE4C3CE-9C1D-4790-B2EF-784C3412310A}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{4A9BD78B-5831-48AA-8C22-28BEBBC8A7AB}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{ACD57755-0E18-4D24-A740-0D944929A053}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{2084F476-D6F1-485F-B9A6-581DD86D24F1}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFilter.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx b/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx
deleted file mode 100644
index 4d716e83..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/WUDFOsrUsbFilterOnUmFx2Driver.inx
+++ /dev/null
Binary files differ
diff --git a/usb/umdf_filter_umdf/umdf_filter/comsup.cpp b/usb/umdf_filter_umdf/umdf_filter/comsup.cpp
deleted file mode 100644
index 76a4b940..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/comsup.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// This is the number of characters in a GUID string including the trailing
-// NULL.
-//
-
-#define GUID_STRING_CCH (sizeof("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"))
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-_Use_decl_annotations_
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/usb/umdf_filter_umdf/umdf_filter/comsup.h b/usb/umdf_filter_umdf/umdf_filter/comsup.h
deleted file mode 100644
index 890b576a..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/comsup.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/usb/umdf_filter_umdf/umdf_filter/device.cpp b/usb/umdf_filter_umdf/umdf_filter/device.cpp
deleted file mode 100644
index 126637ce..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/device.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR USB Sample Filter driver's
- device callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "device.tmh"
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the OSR USB Sample Filter driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice;
- HRESULT hr;
-
- //
- // Configure things like the locking model before we go to create our
- // partner device.
- //
-
- //
- // We don't need device level locking since we do not keep any state
- // across the requests
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // Mark ourselves as a filter
- //
-
- FxDeviceInit->SetFilter();
-
-
- //
- // We are a filter; we don't want to be the power policy owner
- //
-
- FxDeviceInit->SetPowerPolicyOwnership(FALSE);
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- PCMyQueue defaultQueue;
-
- HRESULT hr;
-
- hr = CMyQueue::CreateInstance(m_FxDevice, &defaultQueue);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- hr = defaultQueue->Configure();
-
- defaultQueue->Release();
-
- return hr;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Since the OSR USB Sample Filter driver doesn't support any of the device events, this
- method simply calls the base class's BaseQueryInterface.
-
- If OSR USB Sample Filter is extended to include device event interfaces then this
- method must be changed to check the IID and return pointers to them as
- appropriate.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- return CUnknown::QueryInterface(InterfaceId, Object);
-}
diff --git a/usb/umdf_filter_umdf/umdf_filter/device.h b/usb/umdf_filter_umdf/umdf_filter/device.h
deleted file mode 100644
index f7a50b1d..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/device.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF OSR USB Sample Filter
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Class for the iotrace driver.
-//
-
-class CMyDevice : public CUnknown
-{
-
-//
-// Private data members.
-//
-private:
-
- IWDFDevice *m_FxDevice;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- )
- {
- m_FxDevice = NULL;
- }
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- HRESULT
- Configure(
- VOID
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
diff --git a/usb/umdf_filter_umdf/umdf_filter/dllsup.cpp b/usb/umdf_filter_umdf/umdf_filter/dllsup.cpp
deleted file mode 100644
index d71d5fe8..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/dllsup.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the OSR USB Sample Filter
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the skeleton uses
- L"Microsoft\\UMDF\\Skeleton"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the OSR USB Sample Filter sample. If
- you choose to use a different primary include file, you should ensure
- they are defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-//
-// Global variable to hold the module handle for this DLL. Initialized during
-// DllMain and never cleared. This is used when registering and unregistering
-// the driver's COM information.
-//
-
-HINSTANCE g_ModuleHandle = NULL;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE /* ModuleHandle */,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- REFCLSID ClassId,
- REFIID InterfaceId,
- LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the OSR USB Sample
- Filter driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
-
diff --git a/usb/umdf_filter_umdf/umdf_filter/driver.cpp b/usb/umdf_filter_umdf/umdf_filter/driver.cpp
deleted file mode 100644
index c5910c05..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/driver.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR USB Sample Filter
- driver's core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/usb/umdf_filter_umdf/umdf_filter/driver.h b/usb/umdf_filter_umdf/umdf_filter/driver.h
deleted file mode 100644
index 08f36a71..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/driver.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF OSR USB Sample Filter
- driver's callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the OSR USB Sample Filter driver. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver* /*FxWdfDriver*/
- )
- {
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver * /*FxWdfDriver*/
- )
- {
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-};
diff --git a/usb/umdf_filter_umdf/umdf_filter/exports.def b/usb/umdf_filter_umdf/umdf_filter/exports.def
deleted file mode 100644
index 0fc42817..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/exports.def
+++ /dev/null
@@ -1,4 +0,0 @@
-; Skeleton.def : Declares the module parameters.
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/usb/umdf_filter_umdf/umdf_filter/internal.h b/usb/umdf_filter_umdf/umdf_filter/internal.h
deleted file mode 100644
index 516f6d7f..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/internal.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF OSR USB Sample Filter
- driver.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF headers
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-
-//
-// Define the tracing flags.
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- MyDriverTraceControl, (73cdcaa5,ce52,43f2,aa2d,5f5a84e22213), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\OsrUsbFilter"
-#define MYDRIVER_COM_DESCRIPTION L"UMDF OSR USB Sample Filter Driver"
-#define MYDRIVER_CLASS_ID {0x422d8dbc, 0x520d, 0x4d7e, {0x8f, 0x53, 0x92, 0x0e, 0x5c, 0x86, 0x7e, 0x6c}}
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "queue.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_SAMPLE_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
diff --git a/usb/umdf_filter_umdf/umdf_filter/queue.cpp b/usb/umdf_filter_umdf/umdf_filter/queue.cpp
deleted file mode 100644
index 5642ec74..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/queue.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Queue.cpp
-
-Abstract:
-
- This module contains the implementation of the OSR USB Filter Sample driver's
- queue callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "queue.h"
-
-#include "queue.tmh"
-
-HRESULT
-CMyQueue::CreateInstance(
- _In_ IWDFDevice * FxDevice,
- _Out_ CMyQueue **Queue
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the OSR USB Filter Sample driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- CMyQueue *queue;
-
- HRESULT hr = S_OK;
-
- //
- // Allocate a new instance of the device class.
- //
-
- queue = new CMyQueue();
-
- if (NULL == queue)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = queue->Initialize(FxDevice);
- }
-
- if (SUCCEEDED(hr))
- {
- queue->AddRef();
- *Queue = queue;
- }
-
- if (NULL != queue)
- {
- queue->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
-
- if(IsEqualIID(InterfaceId, __uuidof(IQueueCallbackDefaultIoHandler)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackDefaultIoHandler();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackWrite)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackWrite();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IRequestCallbackRequestCompletion)))
- {
- hr = S_OK;
- *Object = QueryIRequestCallbackRequestCompletion();
-
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-HRESULT
-CMyQueue::Initialize(
- _In_ IWDFDevice *FxDevice
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object. Any operations which
- need to be performed before the caller can use the callback object, but
- which couldn't be done in the constructor becuase they could fail would
- be placed here.
-
- Arguments:
-
- FxDevice - the device which this Queue is for.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFIoQueue *fxQueue;
- HRESULT hr;
-
- //
- // Create the framework queue
- //
-
- IUnknown *unknown = QueryIUnknown();
- hr = FxDevice->CreateIoQueue(
- unknown,
- TRUE, // bDefaultQueue
- WdfIoQueueDispatchParallel,
- FALSE, // bPowerManaged
- TRUE, // bAllowZeroLengthRequests
- &fxQueue
- );
- if (FAILED(hr))
- {
- Trace(
- TRACE_LEVEL_ERROR,
- "%!FUNC!: Could not create default I/O queue, %!hresult!",
- hr
- );
- }
-
- unknown->Release();
-
- if (SUCCEEDED(hr))
- {
- m_FxQueue = fxQueue;
-
- //
- // m_FxQueue is kept as a Weak reference to framework Queue object to avoid
- // circular reference. This object's lifetime is contained within
- // framework Queue object's lifetime
- //
-
- fxQueue->Release();
- }
-
- if (SUCCEEDED(hr))
- {
- FxDevice->GetDefaultIoTarget(&m_FxIoTarget);
- }
-
- return hr;
-}
-
-void
-CMyQueue::InvertBits(
- _Inout_ IWDFMemory* FxMemory,
- _In_ SIZE_T NumBytes
- )
-/*++
-
- Routine Description:
-
- This helper method inverts bits in the buffer of an FxMemory object
-
- Arguments:
-
- FxMemory - Framework memory object whose buffer's bits are to be inverted
-
- NumBytes - Number of bytes for which bits are to be inverted
-
- Return Value:
-
- None
-
---*/
-{
- PBYTE Buffer = (PBYTE)
- FxMemory->GetDataBuffer(NULL);
-
- for (SIZE_T i = 0; i < NumBytes; i++)
- {
- memset(Buffer + i, ~(Buffer[i]), sizeof(*Buffer));
- }
-}
-
-void
-CMyQueue::OnWrite(
- _In_ IWDFIoQueue* FxQueue,
- _In_ IWDFIoRequest* FxRequest,
- _In_ SIZE_T NumOfBytesToWrite
- )
-/*++
-
- Routine Description:
-
- This method is called by Framework Queue object to deliver the Write request
- This method inverts the bits in write buffer and forwards the request down the device stack
- In case of any failure prior to ForwardRequest, it completets the request with failure
-
- Arguments:
-
- pWdfQueue - Framework Queue which is delivering the request
-
- pWdfRequest - Framework Request
-
- Return Value:
-
- None
-
---*/
-{
- UNREFERENCED_PARAMETER(FxQueue);
-
- IWDFMemory * FxInputMemory = NULL;
-
- FxRequest->GetInputMemory(&FxInputMemory);
-
- //
- // Invert bits of the buffer to be written to device
- //
-
- InvertBits(FxInputMemory, NumOfBytesToWrite);
-
- //
- // Forward request down the stack
- // When the device below completes the request we will get notified in OnComplete
- // and then we will complete the request
- //
-
- ForwardRequest(FxRequest);
-
- FxInputMemory->Release();
-}
-
-//
-// IQueueCallbackDefaultIoHandler method
-//
-
-void
-CMyQueue::OnDefaultIoHandler(
- _In_ IWDFIoQueue* FxQueue,
- _In_ IWDFIoRequest* FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is called by Framework Queue object to deliver all the I/O
- Requests for which we do not have a specific handler
- (In our case anything other than Write)
-
- Arguments:
-
- pWdfQueue - Framework Queue which is delivering the request
-
- pWdfRequest - Framework Request
-
- Return Value:
-
- None
-
---*/
-{
- UNREFERENCED_PARAMETER(FxQueue);
-
- //
- // We just forward the request down the stack
- // When the device below completes the request we will get notified in OnComplete
- // and then we will complete the request
- //
-
- ForwardRequest(FxRequest);
-}
-
-void
-CMyQueue::ForwardRequest(
- _In_ IWDFIoRequest* FxRequest
- )
-/*++
-
- Routine Description:
-
- This helper method forwards the request down the stack
-
- Arguments:
-
- pWdfRequest - Request to be forwarded
-
- Return Value:
-
- None
-
- Remarks:
-
- The request gets forwarded to the next device in the stack which can be:
- 1. Next device in user-mode stack
- 2. Top device in kernel-mode stack (Redirector's Down Device)
-
- In this routine we:
- 1. Set a completion callback
- 2. Copy request parameters to next stack location
- 3. Asynchronously send the request without any timeout
-
- When the lower request gets completed we will be notified via the
- completion callback, where we will complete our request
-
- In case of failure this routine completes the request
-
---*/
-{
- //
- //First set the completion callback
- //
-
- IRequestCallbackRequestCompletion *completionCallback =
- QueryIRequestCallbackRequestCompletion();
-
- FxRequest->SetCompletionCallback(
- completionCallback,
- NULL //pContext
- );
-
- completionCallback->Release();
-
- //
- //Copy current i/o stack locations parameters to the next stack location
- //
-
- FxRequest->FormatUsingCurrentType(
- );
-
- //
- //Send down the request
- //
- HRESULT hrSend = S_OK;
-
- hrSend = FxRequest->Send(
- m_FxIoTarget,
- 0, //No flag
- 0 //No timeout
- );
-
- if (FAILED(hrSend))
- {
- //
- //If send failed we need to complete the request with failure
- //
- FxRequest->CompleteWithInformation(hrSend, 0);
- }
-
- return;
-}
-
-void
-CMyQueue::HandleReadRequestCompletion(
- IWDFIoRequest* FxRequest,
- IWDFIoRequestCompletionParams* CompletionParams
- )
-/*++
-
- Routine Description:
-
- This helper method is called by OnCompletion method to complete Read request
- We invert the bits in the read buffer
- This is so that the client reads back the data it wrote since
- we inverted bits during write to device
-
- Arguments:
-
- FxRequest - Request object of our layer
-
- CompletionParams - Parameters with which the lower Request got completed
-
- Return Value:
-
- None
-
- Remarks:
-
- This method always completes the request since no one else would get a chance to
- complete the request
- In case of failure it completes the request with failure
-
---*/
-{
- HRESULT hrCompletion = CompletionParams->GetCompletionStatus();
- ULONG_PTR BytesRead = CompletionParams->GetInformation();
-
- //
- // Check
- // 1. whether the lower device succeeded the Request (otherwise we will just complete
- // the Request with failure
- // 2. If data read is of non-zero length, for us to bother to invert its bits
- //
-
- if (SUCCEEDED(hrCompletion) &&
- (0 != BytesRead)
- )
- {
- IWDFMemory *FxOutputMemory;
-
- FxRequest->GetOutputMemory(&FxOutputMemory );
-
- InvertBits(FxOutputMemory, BytesRead);
-
- FxOutputMemory->Release();
- }
-
- //
- // Complete the request
- //
-
- FxRequest->CompleteWithInformation(
- hrCompletion,
- BytesRead
- );
-}
-
-
-void
-CMyQueue::OnCompletion(
- IWDFIoRequest* FxRequest,
- IWDFIoTarget* FxIoTarget,
- IWDFRequestCompletionParams* CompletionParams,
- PVOID Context
- )
-/*++
-
- Routine Description:
-
- This method is called by Framework I/O Target object when
- the lower device completets the Request
-
- Arguments:
-
- pWdfRequest - Request object of our layer
-
- pIoTarget - I/O Target object invoking this callback
-
- pParams - Parameters with which the lower Request got completed
-
- Return Value:
-
- None
-
---*/
-{
- UNREFERENCED_PARAMETER(FxIoTarget);
- UNREFERENCED_PARAMETER(Context);
-
- //
- // If it is a read request, we invert the bits read since we inverted them during write
- // so that application would read the same data as it wrote
- //
-
- if (WdfRequestRead == FxRequest->GetType())
- {
- IWDFIoRequestCompletionParams * IoCompletionParams = NULL;
- HRESULT hrQI = CompletionParams->QueryInterface(IID_PPV_ARGS(&IoCompletionParams));
- WUDF_SAMPLE_DRIVER_ASSERT(SUCCEEDED(hrQI));
-
- HandleReadRequestCompletion(
- FxRequest,
- IoCompletionParams
- );
-
- SAFE_RELEASE(IoCompletionParams);
- }
- else
- {
-
- //
- // Otherwise we just complete our Request object with the same parameters
- // with which the lower Request got completed
- //
-
- FxRequest->CompleteWithInformation(
- CompletionParams->GetCompletionStatus(),
- CompletionParams->GetInformation()
- );
- }
-}
-
diff --git a/usb/umdf_filter_umdf/umdf_filter/queue.h b/usb/umdf_filter_umdf/umdf_filter/queue.h
deleted file mode 100644
index 216264e9..00000000
--- a/usb/umdf_filter_umdf/umdf_filter/queue.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Queue.h
-
-Abstract:
-
- This module contains the type definitions for the OSR USB Filter Sample
- driver's queue callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Class for the queue callbacks.
-// It implements
-// IQueueCallbackDeviceIoControl
-// IRequestCallbackRequestCompletion
-// Queue callbacks
-//
-// This class also implements IRequestCallbackRequestCompletion callback
-// to get the request completion notification when request is sent down the
-// stack. This callback can be implemented on a separate object as well.
-// This callback is implemented here only for conenience.
-//
-class CMyQueue :
- public CUnknown,
- public IQueueCallbackWrite,
- public IQueueCallbackDefaultIoHandler,
- public IRequestCallbackRequestCompletion
-{
-
-//
-// Private data members.
-//
-private:
-
- //
- // Weak reference to framework Queue object which this object implements callbacks for
- // This is kept as a weak reference to avoid circular reference
- // This object's lifetime is contained within framework Queue object's lifetime
- //
-
- IWDFIoQueue *m_FxQueue;
-
- //
- // I/O Target to which we forward requests. Represents next device in the
- // device stack
- //
-
- IWDFIoTarget *m_FxIoTarget;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyQueue() :
- m_FxQueue(NULL),
- m_FxIoTarget(NULL)
- {
- }
-
- virtual ~CMyQueue()
- {
- if (NULL != m_FxIoTarget)
- {
- m_FxIoTarget->Release();
- }
- }
-
- //
- // QueryInterface helpers
- //
-
- IRequestCallbackRequestCompletion *
- QueryIRequestCallbackRequestCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IRequestCallbackRequestCompletion*>(this);
- }
-
- IQueueCallbackWrite *
- QueryIQueueCallbackWrite(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackWrite *>(this);
- }
-
- IQueueCallbackDefaultIoHandler *
- QueryIQueueCallbackDefaultIoHandler(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackDefaultIoHandler *>(this);
- }
-
- //
- // Initialize
- //
-
- HRESULT
- Initialize(
- _In_ IWDFDevice *FxDevice
- );
-
- //
- // Helper method to forward request down the stack
- //
-
- void
- ForwardRequest(
- _In_ IWDFIoRequest *pWdfRequest
- );
-
- //
- // Helper method to inverts bits in the buffer of a framework Memory object
- //
-
- void
- InvertBits(
- _Inout_ IWDFMemory* FxMemory,
- _In_ SIZE_T NumBytes
- );
-
- //
- // Helper method to handle Read request completion
- //
-
- void
- HandleReadRequestCompletion(
- IWDFIoRequest* FxRequest,
- IWDFIoRequestCompletionParams* CompletionParams
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this class
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDevice *FxDevice,
- _Out_ CMyQueue **Queue
- );
-
-
- HRESULT
- Configure(
- VOID
- )
- {
- return S_OK;
- }
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // IQueueCallbackWrite method
- //
-
- virtual
- void
- STDMETHODCALLTYPE
- OnWrite(
- _In_ IWDFIoQueue* FxQueue,
- _In_ IWDFIoRequest* FxRequest,
- _In_ SIZE_T NumOfBytesToWrite
- );
-
-
- //
- // IQueueCallbackDefaultIoHandler method
- //
-
- virtual
- void
- STDMETHODCALLTYPE
- OnDefaultIoHandler(
- _In_ IWDFIoQueue* FxQueue,
- _In_ IWDFIoRequest* FxRequest
- );
-
- //
- //IRequestCallbackRequestCompletion
- //
-
- virtual
- void
- STDMETHODCALLTYPE
- OnCompletion(
- IWDFIoRequest* FxRequest,
- IWDFIoTarget* FxIoTarget,
- IWDFRequestCompletionParams* CompletionParams,
- PVOID Context
- );
-};
-
diff --git a/usb/umdf_filter_umdf/umdf_filter_umdf.sln b/usb/umdf_filter_umdf/umdf_filter_umdf.sln
deleted file mode 100644
index 32dc6d8b..00000000
--- a/usb/umdf_filter_umdf/umdf_filter_umdf.sln
+++ /dev/null
@@ -1,59 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0
-MinimumVisualStudioVersion = 12.0
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Package", "Package", "{23CDA216-49BA-49D6-98E9-6692D1E6D363}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umdf_filter", "Umdf_filter", "{EF4F817D-931F-4D72-B5A5-0E0FB30F1CE0}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umdf_driver", "Umdf_driver", "{B3DCEF35-5C54-4506-981B-31B0611116E3}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "package", "Package\package.VcxProj", "{A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFOsrUsbFilter", "umdf_filter\WUDFOsrUsbFilter.vcxproj", "{502F5F25-02A2-4047-8DD1-EB3DF0CC7127}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFOsrUsbFx2", "umdf_driver\WUDFOsrUsbFx2.vcxproj", "{6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- Debug|x64 = Debug|x64
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}.Debug|Win32.ActiveCfg = Debug|Win32
- {A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}.Debug|Win32.Build.0 = Debug|Win32
- {A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}.Release|Win32.ActiveCfg = Release|Win32
- {A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}.Release|Win32.Build.0 = Release|Win32
- {A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}.Debug|x64.ActiveCfg = Debug|x64
- {A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}.Debug|x64.Build.0 = Debug|x64
- {A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}.Release|x64.ActiveCfg = Release|x64
- {A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7}.Release|x64.Build.0 = Release|x64
- {502F5F25-02A2-4047-8DD1-EB3DF0CC7127}.Debug|Win32.ActiveCfg = Debug|Win32
- {502F5F25-02A2-4047-8DD1-EB3DF0CC7127}.Debug|Win32.Build.0 = Debug|Win32
- {502F5F25-02A2-4047-8DD1-EB3DF0CC7127}.Release|Win32.ActiveCfg = Release|Win32
- {502F5F25-02A2-4047-8DD1-EB3DF0CC7127}.Release|Win32.Build.0 = Release|Win32
- {502F5F25-02A2-4047-8DD1-EB3DF0CC7127}.Debug|x64.ActiveCfg = Debug|x64
- {502F5F25-02A2-4047-8DD1-EB3DF0CC7127}.Debug|x64.Build.0 = Debug|x64
- {502F5F25-02A2-4047-8DD1-EB3DF0CC7127}.Release|x64.ActiveCfg = Release|x64
- {502F5F25-02A2-4047-8DD1-EB3DF0CC7127}.Release|x64.Build.0 = Release|x64
- {6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}.Debug|Win32.ActiveCfg = Debug|Win32
- {6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}.Debug|Win32.Build.0 = Debug|Win32
- {6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}.Release|Win32.ActiveCfg = Release|Win32
- {6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}.Release|Win32.Build.0 = Release|Win32
- {6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}.Debug|x64.ActiveCfg = Debug|x64
- {6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}.Debug|x64.Build.0 = Debug|x64
- {6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}.Release|x64.ActiveCfg = Release|x64
- {6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {A217E49A-2A5E-4E51-BA9E-D87D62F6E2F7} = {23CDA216-49BA-49D6-98E9-6692D1E6D363}
- {502F5F25-02A2-4047-8DD1-EB3DF0CC7127} = {EF4F817D-931F-4D72-B5A5-0E0FB30F1CE0}
- {6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98} = {B3DCEF35-5C54-4506-981B-31B0611116E3}
- EndGlobalSection
-EndGlobal
diff --git a/usb/umdf_fx2/README.md b/usb/umdf_fx2/README.md
deleted file mode 100644
index f95374f2..00000000
--- a/usb/umdf_fx2/README.md
+++ /dev/null
@@ -1,373 +0,0 @@
----
-page_type: sample
-description: "A UMDF driver for the OSR USB-FX2 device that includes a test application, sample device metadata, and supports impersonation and idle power down."
-languages:
-- cpp
-products:
-- windows
-- windows-wdk
----
-
-# Sample UMDF Function Driver for OSR USB-FX2 (UMDF Version 1)
-
-The umdf\_fx2 sample is a User-Mode Driver Framework (UMDF) driver for the OSR USB-FX2 device. It includes a test app and sample device metadata, and supports impersonation and idle power down.
-
-The sample can also be used with the CustomDeviceAccess SDK sample. The sample demonstrates how to perform bulk and interrupt data transfers to an USB device. For more information, see the specification for the [OSR USB FX-2 Learning Kit](https://www.osronline.com/hardware/OSRFX2_32.pdf). The driver and sample device metadata also work with the [Custom driver access](https://go.microsoft.com/fwlink/p/?linkid=2114373) sample.
-
-The osrusbfx2 sample is divided into three samples:
-
-- **WDF Sample Driver Learning Lab for OSR USB-FX2**: This sample is a series of iterative drivers that demonstrate how to write a "Hello World" driver and adds additional features in each step.
-
-- **kmdf\_fx2**: This sample is the final version of kernel-mode **wdf\_osrfx2** driver. The sample demonstrates KMDF methods.
-
-- **umdf\_fx2**: This sample is the final version of the user-mode driver **wdf\_osrfx2**. The sample demonstrates UMDF methods.
-
-## Build the sample
-
-The default Solution build configuration is Debug and Win32.
-
-1. Open the driver project or solution in Visual Studio 2015 (find *filtername*.sln or *filtername*.vcxproj).
-
-1. Right-click the solution in the **Solutions Explorer** and select **Configuration Manager**.
-
-1. From the **Configuration Manager**, select the **Active Solution Configuration** and the **Active Solution Platform** (for example, Win32) that correspond to the type of build you are interested in.
-
-1. From the **Build** menu, click **Build Solution** (Ctrl+Shift+B).
-
-## Overview
-
-- The device is based on the development board supplied with the Cypress EZ-USB FX2 Development Kit (CY3681).
-
-- It contains 1 interface and 3 endpoints (Interrupt IN, Bulk Out, Bulk IN).
-
-- Firmware supports vendor commands to query or set LED Bar graph display and 7-segment LED display, and to query toggle switch states.
-
-- Interrupt Endpoint:
-
- - Sends an 8-bit value that represents the state of the switches.
-
- - Sent on startup, resume from suspend, and whenever the switch pack setting changes.
-
- - Firmware does not de-bounce the switch pack.
-
- - One switch change can result in multiple bytes being sent.
-
- - Bits are in the reverse order of the labels on the pack (for example, bit 0x80 is labeled 1 on the pack).
-
-- Bulk Endpoints are configured for loopback:
-
- - The device moves data from IN endpoint to OUT endpoint.
-
- - The device does not change the values of the data it receives nor does it internally create any data.
-
- - Endpoints are always double buffered.
-
- - Maximum packet size depends on speed (64 full speed, 512 high speed).
-
-## Testing the driver
-
-You can use the [Custom driver access](https://go.microsoft.com/fwlink/p/?linkid=2114373) sample to test the umdf\_fx2 sample.
-
-This sample also includes a test application, osrusbfx2.exe, that you can use to test the device. This console application enumerates the interface registered by the driver and opens the device to send read, write, or IOCTL requests based on the command line options.
-
-Usage for Read/Write test:
-
-- -r [*n*], where *n* is number of bytes to read.
-
-- -w [*n*], where *n* is number of bytes to write.
-
-- -c [*n*], where *n* is number of iterations (default = 1).
-
-- -v, shows verbose read data.
-
-- -p, plays with Bar Display, Dip Switch, 7-Segment Display.
-
-- -a, performs asynchronous I/O operation.
-
-- -u, dumps USB configuration and pipe information.
-
-- -f \<*filename*\> [*interval-seconds*], where *interval-seconds* is a delay in milliseconds, to send a text file to the seven-segment display (UMDF only)
-
-### Playing with the 7 segment display, toggle switches, and bar graph display
-
-Use the command `osrusbfx2.exe -p` with options 1 through 9 to set and clear bar graph display, set and get 7 segment state, and read the toggle switch states. The following shows the function options:
-
-```cmd
-1. Light Bar
-2. Clear Bar
-3. Light entire Bar graph
-4. Clear entire Bar graph
-5. Get bar graph state
-6. Get Switch state
-7. Get Switch Interrupt Message
-8. Get 7 segment state
-9. Set 7 segment state
-10. Reset the device
-11. Re-enumerate the device
-
-0. Exit
-
-Selection:
-```
-
-### Reset and re-enumerate the device
-
-Use the command `osrusbfx2.exe -p` with options 10 and 11 to either reset the device or re-enumerate the device.
-
-### Read and write to bulk endpoints
-
-The following commands send read and write requests to the device's bulk endpoint.
-
-- `osrusbfx2.exe -r 64`
-
- The preceding command reads 64 bytes to the bulk IN endpoint.
-
-- `osrusbfx2.exe -w 64`
-
- The preceding command writes 64 bytes to the bulk OUT endpoint.
-
-- `osrusbfx2.exe -r 64 -w 64 -c 100 -v`
-
- The preceding command first writes 64 bytes of data to bulk OUT endpoint (Pipe 1), then reads 64 bytes from bulk IN endpoint (Pipe 2), and then compares the read buffer with write buffer to see if they match. If the buffer contents match, it repeats this operation 100 times.
-
-- `osrusbfx2.exe -a`
-
- The preceding command reads and writes to the device asynchronously in an infinite loop.
-
-The bulk endpoints are double buffered. Depending on the operational speed (full or high), the buffer size is either 64 bytes or 512 bytes, respectively. A request to read data does not complete if the buffers are empty. If the buffers are full, a request to write data does not complete until the buffers are emptied. When you are doing a synchronous read, make sure the endpoint buffer has data (for example, when you send 512 bytes write request to the device operating in full speed mode). Because the endpoints are double buffered, the total buffer capacity is 256 bytes. The first 256 bytes fills the buffer and the write request waits in the USB stack until the buffers are emptied. If you run another instance of the application to read 512 bytes of data, both write and read requests complete successfully.
-
-### Displaying descriptors
-
-The following command displays all the descriptors and endpoint information.
-
-`osrusbfx2.exe -u`
-
-If the device is operating in high speed mode, you get the following information:
-
-```cmd
-===================
-
-USB_CONFIGURATION_DESCRIPTOR
-
-bLength = 0x9, decimal 9
-
-bDescriptorType = 0x2 ( USB_CONFIGURATION_DESCRIPTOR_TYPE )
-
-wTotalLength = 0x27, decimal 39
-
-bNumInterfaces = 0x1, decimal 1
-
-bConfigurationValue = 0x1, decimal 1
-
-iConfiguration = 0x4, decimal 4
-
-bmAttributes = 0xa0 ( USB_CONFIG_BUS_POWERED )
-
-MaxPower = 0x32, decimal 50
-
------------------------------
-
-USB_INTERFACE_DESCRIPTOR #0
-
-bLength = 0x9
-
-bDescriptorType = 0x4 ( USB_INTERFACE_DESCRIPTOR_TYPE )
-
-bInterfaceNumber = 0x0
-
-bAlternateSetting = 0x0
-
-bNumEndpoints = 0x3
-
-bInterfaceClass = 0xff
-
-bInterfaceSubClass = 0x0
-
-bInterfaceProtocol = 0x0
-
-bInterface = 0x0
-
-------------------------------
-
-USB_ENDPOINT_DESCRIPTOR for Pipe00
-
-bLength = 0x7
-
-bDescriptorType = 0x5 ( USB_ENDPOINT_DESCRIPTOR_TYPE )
-
-bEndpointAddress= 0x81 ( INPUT )
-
-bmAttributes= 0x3 ( USB_ENDPOINT_TYPE_INTERRUPT )
-
-wMaxPacketSize= 0x49, decimal 73
-
-bInterval = 0x1, decimal 1
-
-------------------------------
-
-USB_ENDPOINT_DESCRIPTOR for Pipe01
-
-bLength = 0x7
-
-bDescriptorType = 0x5 ( USB_ENDPOINT_DESCRIPTOR_TYPE )
-
-bEndpointAddress= 0x6 ( OUTPUT )
-
-bmAttributes= 0x2 ( USB_ENDPOINT_TYPE_BULK )
-
-wMaxPacketSize= 0x200,
-
-decimal 512 bInterval = 0x0,
-
-decimal 0
-
-------------------------------
-
-USB_ENDPOINT_DESCRIPTOR for Pipe02
-
-bLength = 0x7
-
-bDescriptorType = 0x5 ( USB_ENDPOINT_DESCRIPTOR_TYPE )
-
-bEndpointAddress= 0x88 ( INPUT )
-
-bmAttributes= 0x2 ( USB_ENDPOINT_TYPE_BULK )
-
-wMaxPacketSize= 0x200, decimal 512
-
-bInterval = 0x0, decimal 0
-```
-
-If the device is operating in low speed mode, you will get the following information:
-
-```cmd
-===================
-
-USB_CONFIGURATION_DESCRIPTOR
-
-bLength = 0x9, decimal 9
-
-bDescriptorType = 0x2 ( USB_CONFIGURATION_DESCRIPTOR_TYPE )
-
-wTotalLength = 0x27, decimal 39
-
-bNumInterfaces = 0x1, decimal 1
-
-bConfigurationValue = 0x1, decimal 1
-
-iConfiguration = 0x3, decimal 3
-
-bmAttributes = 0xa0 ( USB_CONFIG_BUS_POWERED )
-
-MaxPower = 0x32, decimal 50
-
------------------------------
-
-USB_INTERFACE_DESCRIPTOR #0
-
-bLength = 0x9
-
-bDescriptorType = 0x4 ( USB_INTERFACE_DESCRIPTOR_TYPE )
-
-bInterfaceNumber = 0x0 bAlternateSetting = 0x0
-
-bNumEndpoints = 0x3
-
-bInterfaceClass = 0xff
-
-bInterfaceSubClass = 0x0
-
-bInterfaceProtocol = 0x0
-
-bInterface = 0x0
-
-------------------------------
-
-USB_ENDPOINT_DESCRIPTOR for Pipe00
-
-bLength = 0x7
-
-bDescriptorType = 0x5 ( USB_ENDPOINT_DESCRIPTOR_TYPE )
-
-bEndpointAddress= 0x81 ( INPUT )
-
-bmAttributes= 0x3 ( USB_ENDPOINT_TYPE_INTERRUPT )
-
-wMaxPacketSize= 0x49, decimal 73
-
-bInterval = 0x1, decimal 1
-
-------- -----------------------
-
-USB_ENDPOINT_DESCRIPTOR for Pipe01
-
-bLength = 0x7
-
-bDescriptorType = 0x5 ( USB_ENDPOINT_DESCRIPTOR_TYPE )
-
-bEndpointAddress= 0x6 ( OUTPUT )
-
-bmAttributes= 0x2 ( USB_ENDPOINT_TYPE_BULK )
-
-wMaxPacketSize= 0x40, decimal 64
-
-bInterval = 0x0, decimal 0
-
-------------------------------
-
-USB_ENDPOINT_DESCRIPTOR for Pipe02
-
-bLength = 0x7
-
-bDescriptorType = 0x5 ( USB_ENDPOINT_DESCRIPTOR_TYPE )
-
-bEndpointAddress= 0x88 ( INPUT )
-
-bmAttributes= 0x2 ( USB_ENDPOINT_TYPE_BULK )
-
-wMaxPacketSize= 0x40, decimal 64
-
-bInterval = 0x0, decimal 0
-```
-
-## Sample Contents
-
-### usb\\umdf\_fx2\\driver
-
-This directory contains driver code that demonstrates the following functionality:
-
-- Loads the driver and responds to PnP and Power events. You can install, uninstall, disable, enable, suspend, and resume the system.
-
-- Registers a PnP device interface so that application can open a handle to the device.
-
-- Implements **IPnpCallbackHardware** interface and initializes USB I/O targets in **IPnpCallbackHardware::OnPrepareHardware** method.
-
-- Creates a sequential queue for handling IOCTL requests.
-
-- Adds code to handle the IOCTL to set bar graph display.
-
-- Creates a parallel queue for handling read and write requests.
-
-- Retrieves memory from read and write requests, format the requests, and sends them to a USB target.
-
-- Supports additional IOCTLs to get and set the 7-segment display, get bar graph display, and get config descriptor.
-
-- Sets power policy for the device.
-
-- Adds code to indicate that the device is ready by lighting up the period on 7-segment display.
-
-- Calls **SetupDi** functions to determine the "BusTypeGUID" of the device, and uses impersonation to access resources that only the caller has access to.
-
-- Shows how to implement idle and wake functionality to make the driver the power policy owner (PPO). The sample achieves this using power-managed queues and UMDF DDIs, AssignS0IdleSettings, and AssignSxWakeSettings.
-
-- Demonstrates implementation of a continuous reader.
-
-- Demonstrates the use of impersonation.
-
-### usb\\umdf\_fx2\\exe
-
-This directory contains a test application that can be used to drive the UMDF driver and FX2 device. This is a modified version of the test application for the KMDF Fx2 driver.
-
-### usb\\umdf\_fx2\\deviceMetadata
-
-This directory contains the device metadata package for the sample. You must copy the device metadata to the system before installing the device. For information on how to update and deploy device metadata, see [Custom driver access sample](https://go.microsoft.com/fwlink/p/?linkid=2114373).
diff --git a/usb/umdf_fx2/deviceMetadata/B4D697F5-1C56-4807-ACCD-B28C09D37FF0.devicemetadata-ms b/usb/umdf_fx2/deviceMetadata/B4D697F5-1C56-4807-ACCD-B28C09D37FF0.devicemetadata-ms
deleted file mode 100644
index 5f8e82ee..00000000
--- a/usb/umdf_fx2/deviceMetadata/B4D697F5-1C56-4807-ACCD-B28C09D37FF0.devicemetadata-ms
+++ /dev/null
Binary files differ
diff --git a/usb/umdf_fx2/driver/ControlQueue.cpp b/usb/umdf_fx2/driver/ControlQueue.cpp
deleted file mode 100644
index f4058941..00000000
--- a/usb/umdf_fx2/driver/ControlQueue.cpp
+++ /dev/null
@@ -1,564 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ControlQueue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "winioctl.h"
-
-#include "ControlQueue.tmh"
-
-CMyControlQueue::CMyControlQueue(
- _In_ PCMyDevice Device
- ) : CMyQueue(Device)
-{
-
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CMyControlQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
-
- if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackDeviceIoControl)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackDeviceIoControl();
-
- }
- else
- {
- hr = CMyQueue::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyControlQueue::CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyControlQueue *Queue
- )
-/*++
-
-Routine Description:
-
-
- CreateInstance creates an instance of the queue object.
-
-Aruments:
-
- ppUkwn - OUT parameter is an IUnknown interface to the queue object
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- PCMyControlQueue queue = NULL;
- HRESULT hr = S_OK;
-
- queue = new CMyControlQueue(Device);
-
- if (NULL == queue)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Call the queue callback object to initialize itself. This will create
- // its partner queue framework object.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = queue->Initialize();
- }
-
- if (SUCCEEDED(hr))
- {
- *Queue = queue;
- }
- else
- {
- SAFE_RELEASE(queue);
- }
-
- return hr;
-}
-
-HRESULT
-CMyControlQueue::Initialize(
- VOID
- )
-{
- HRESULT hr;
-
- //
- // First initialize the base class. This will create the partner FxIoQueue
- // object and setup automatic forwarding of I/O controls.
- //
-
- //
- // The framework (UMDF) will not deliver a
- // request to the driver that arrives on a power-managed queue, unless
- // the device is in a powered-up state. If you receive a request on a
- // power-managed queue after the device has idled out,
- // the framework will not be able to power-up and present the request
- // to the driver unless it is the power policy owner (PPO).
- // Since this driver is the PPO it can use power managed queues
- //
-
- hr = __super::Initialize(WdfIoQueueDispatchSequential,
- false,
- true /* use power managed queue */);
-
- //
- // return the status.
- //
-
- return hr;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyControlQueue::OnDeviceIoControl(
- _In_ IWDFIoQueue *FxQueue,
- _In_ IWDFIoRequest *FxRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- DeviceIoControl dispatch routine
-
-Aruments:
-
- FxQueue - Framework Queue instance
- FxRequest - Framework Request instance
- ControlCode - IO Control Code
- InputBufferSizeInBytes - Lenth of input buffer
- OutputBufferSizeInBytes - Lenth of output buffer
-
- Always succeeds DeviceIoIoctl
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(FxQueue);
-
- IWDFMemory *memory = NULL;
- PVOID buffer;
-
- SIZE_T bigBufferCb;
-
- ULONG information = 0;
-
- bool completeRequest = true;
-
- HRESULT hr = S_OK;
-
- switch (ControlCode)
- {
- case IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR:
- {
- //
- // Get the output buffer.
- //
-
- FxRequest->GetOutputMemory(&memory );
-
- //
- // request the descriptor.
- //
-
- ULONG bufferCb;
-
- //
- // Get the buffer address then release the memory object.
- // The memory object remains valid until the request is
- // completed.
- //
-
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- if (bigBufferCb > ULONG_MAX)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- break;
- }
- else
- {
- bufferCb = (ULONG) bigBufferCb;
- }
-
- hr = m_Device->GetUsbTargetDevice()->RetrieveDescriptor(
- USB_CONFIGURATION_DESCRIPTOR_TYPE,
- 0,
- 0,
- &bufferCb,
- (PUCHAR) buffer
- );
-
- if (SUCCEEDED(hr))
- {
- information = bufferCb;
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the result of the
- // control transfer.
- //
-
- if (OutputBufferSizeInBytes < sizeof(BAR_GRAPH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetOutputMemory(&memory );
- }
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->GetBarGraphDisplay((PBAR_GRAPH_STATE) buffer);
- }
-
- //
- // If that worked then record how many bytes of data we're
- // returning.
- //
-
- if (SUCCEEDED(hr))
- {
- information = sizeof(BAR_GRAPH_STATE);
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the input for the
- // control transfer.
- //
-
- if (InputBufferSizeInBytes < sizeof(BAR_GRAPH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetInputMemory(&memory);
- }
-
- //
- // Get the data buffer and use it to set the bar graph on the
- // device.
- //
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->SetBarGraphDisplay((PBAR_GRAPH_STATE) buffer);
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the result of the
- // control transfer.
- //
-
- if (OutputBufferSizeInBytes < sizeof(SEVEN_SEGMENT))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetOutputMemory(&memory );
- }
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
- hr = m_Device->GetSevenSegmentDisplay((PSEVEN_SEGMENT) buffer);
- }
-
- //
- // If that worked then record how many bytes of data we're
- // returning.
- //
-
- if (SUCCEEDED(hr))
- {
- information = sizeof(SEVEN_SEGMENT);
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the input for the
- // control transfer.
- //
-
- if (InputBufferSizeInBytes < sizeof(SEVEN_SEGMENT))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetInputMemory(&memory );
- }
-
- //
- // Get the data buffer and use it to set the bar graph on the
- // device.
- //
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->SetSevenSegmentDisplay((PSEVEN_SEGMENT) buffer);
- }
- break;
- }
-
- case IOCTL_OSRUSBFX2_READ_SWITCHES:
- {
- //
- // Make sure the buffer is big enough to hold the input for the
- // control transfer.
- //
-
- if (OutputBufferSizeInBytes < sizeof(SWITCH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetOutputMemory(&memory );
- }
-
- //
- // Get the data buffer and use it to set the bar graph on the
- // device.
- //
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->ReadSwitchState((PSWITCH_STATE) buffer);
- }
-
- if (SUCCEEDED(hr))
- {
- information = sizeof(SWITCH_STATE);
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE:
- {
- //
- // Make sure the buffer is big enough to hold the switch
- // state.
- //
-
- if (OutputBufferSizeInBytes < sizeof(SWITCH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- //
- // Forward the request to the switch state change queue.
- //
-
- hr = FxRequest->ForwardToIoQueue(
- m_Device->GetSwitchChangeQueue()
- );
-
- if (SUCCEEDED(hr))
- {
- completeRequest = false;
- }
- }
-
- break;
- }
-
- case IOCTL_OSRUSBFX2_RESET_DEVICE:
- case IOCTL_OSRUSBFX2_REENUMERATE_DEVICE:
- {
- //
- // WinUSB does not allow us to reset or re-enumerate the device.
- // Return not-supported for the error in both of these cases.
- //
-
- hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
- break;
- }
-
- case IOCTL_OSRUSBFX2_PLAY_FILE:
- {
- //
- // This IOCTL demonstrates how to use impersonation to access
- // resources using the credentials provided by the client. Note
- // that for impersonation to work it has to be enabled in the device
- // INF and the client must allow impersonation when they open the
- // device.
- //
- // This IOCTL opens a file using the path provided by the client
- // and then plays the characters in that file out to the seven segment
- // display in a worker thread.
- //
-
- PFILE_PLAYBACK playback;
- SIZE_T playbackCb;
- size_t realPlaybackCb;
-
- FxRequest->GetInputMemory(&memory);
-
- if (memory == NULL)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
- break;
- }
-
- //
- // Get the playback structure from the input buffer.
- //
-
- playback = (PFILE_PLAYBACK) memory->GetDataBuffer(&playbackCb);
-
- memory->Release();
-
- //
- // Make sure the length is at least as big as the fixed portion
- // of the input structure.
- //
-
- if (playbackCb < (FIELD_OFFSET(FILE_PLAYBACK, Path)))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
- break;
- }
-
- //
- // Make sure the file name is at least one character long.
- //
-
- playbackCb -= FIELD_OFFSET(FILE_PLAYBACK, Path);
-
- if (playbackCb < sizeof(WCHAR))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
- break;
- }
-
- //
- // Verify that the string provided is valid.
- //
-
- hr = StringCbLength(playback->Path,
- min(playbackCb, (STRSAFE_MAX_CCH * sizeof(WCHAR))),
- &realPlaybackCb);
-
- if (FAILED(hr))
- {
- break;
- }
-
- hr = m_Device->PlaybackFile(playback, FxRequest);
-
- break;
- }
-
-
-
- default:
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION);
- break;
- }
- }
-
- if (completeRequest)
- {
- FxRequest->CompleteWithInformation(hr, information);
- }
-
- return;
-}
diff --git a/usb/umdf_fx2/driver/ControlQueue.h b/usb/umdf_fx2/driver/ControlQueue.h
deleted file mode 100644
index 251521e1..00000000
--- a/usb/umdf_fx2/driver/ControlQueue.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ControlQueue.h
-
-Abstract:
-
- This file defines the queue callback object for handling device I/O
- control requests. This is a serialized queue.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class CMyControlQueue : public IQueueCallbackDeviceIoControl,
- public CMyQueue
-{
- HRESULT
- Initialize(
- VOID
- );
-
-public:
-
- CMyControlQueue(
- _In_ PCMyDevice Device
- );
-
- virtual
- ~CMyControlQueue(
- VOID
- )
- {
- return;
- }
-
- static
- HRESULT
- CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyControlQueue *Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return S_OK;
- }
-
- IQueueCallbackDeviceIoControl *
- QueryIQueueCallbackDeviceIoControl(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackDeviceIoControl *>(this);
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // Wdf Callbacks
- //
-
- //
- // IQueueCallbackDeviceIoControl
- //
- STDMETHOD_ (void, OnDeviceIoControl)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- );
-};
-
diff --git a/usb/umdf_fx2/driver/Device.cpp b/usb/umdf_fx2/driver/Device.cpp
deleted file mode 100644
index 101b3b79..00000000
--- a/usb/umdf_fx2/driver/Device.cpp
+++ /dev/null
@@ -1,2091 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR Fx2 driver's
- device callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-#include "internal.h"
-#include "initguid.h"
-#include "usb_hw.h"
-#include <devpkey.h>
-
-#include "device.tmh"
-#define CONCURRENT_READS 2
-
-CMyDevice::~CMyDevice(
- )
-{
- SAFE_RELEASE(m_pIoTargetInterruptPipeStateMgmt);
-}
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the OSR Fx2 driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice2 *fxDevice = NULL;
-
- HRESULT hr = S_OK;
-
- //
- // TODO: Any per-device initialization which must be done before
- // creating the partner object.
- //
-
- //
- // Set no locking unless you need an automatic callbacks synchronization
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // TODO: If you're writing a filter driver then indicate that here.
- // And then don't claim power policy ownership below
- //
- // FxDeviceInit->SetFilter();
- //
-
- //
- // Set the Fx2 driver as the power policy owner.
- //
-
- FxDeviceInit->SetPowerPolicyOwnership(TRUE);
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- if (SUCCEEDED(hr))
- {
- IUnknown *unknown = this->QueryIUnknown();
- IWDFDevice* device1;
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &device1);
-
- //
- // Convert the interface to version 2
- //
-
- if (SUCCEEDED(hr)) {
- device1->QueryInterface(IID_PPV_ARGS(&fxDevice));
- _Analysis_assume_(fxDevice != NULL);
- device1->Release();
- }
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr = S_OK;
-
- //
- // Get the bus type GUID for the device and confirm that we're attached to
- // USB.
- //
- // NOTE: Since this device only supports USB we'd normally trust our INF
- // to ensure this.
- //
- // But if the device also supported 1394 then we could
- // use this to determine which type of bus we were attached to.
- //
-
- hr = GetBusTypeGuid();
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- //
- // Create the read-write queue.
- //
-
- hr = CMyReadWriteQueue::CreateInstance(this, &m_ReadWriteQueue);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- //
- // We use default queue for read/write
- //
-
- hr = m_ReadWriteQueue->Configure();
-
- m_ReadWriteQueue->Release();
-
- //
- // Create the control queue and configure forwarding for IOCTL requests.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CMyControlQueue::CreateInstance(this, &m_ControlQueue);
-
- if (SUCCEEDED(hr))
- {
- hr = m_ControlQueue->Configure();
- if (SUCCEEDED(hr))
- {
- m_FxDevice->ConfigureRequestDispatching(
- m_ControlQueue->GetFxQueue(),
- WdfRequestDeviceIoControl,
- true
- );
- }
- m_ControlQueue->Release();
- }
- }
-
- //
- // Create a manual I/O queue to hold requests for notification when
- // the switch state changes.
- //
-
- hr = m_FxDevice->CreateIoQueue(NULL,
- FALSE,
- WdfIoQueueDispatchManual,
- FALSE,
- FALSE,
- &m_SwitchChangeQueue);
-
-
- //
- // Release creation reference as object tree will keep a reference
- //
-
- m_SwitchChangeQueue->Release();
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_OSRUSBFX2,
- NULL);
- }
-
- //
- // Mark the interface as restricted to allow access to applications bound
- // using device metadata. Failures here are not fatal so we log them but
- // ignore them otherwise.
- //
- if (SUCCEEDED(hr))
- {
- WDF_PROPERTY_STORE_ROOT RootSpecifier;
- IWDFUnifiedPropertyStoreFactory * pUnifiedPropertyStoreFactory = NULL;
- IWDFUnifiedPropertyStore * pUnifiedPropertyStore = NULL;
- DEVPROP_BOOLEAN isRestricted = DEVPROP_TRUE;
- HRESULT hrSetProp;
-
- hrSetProp = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pUnifiedPropertyStoreFactory));
-
- WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrSetProp));
-
- RootSpecifier.LengthCb = sizeof(RootSpecifier);
- RootSpecifier.RootClass = WdfPropertyStoreRootClassDeviceInterfaceKey;
- RootSpecifier.Qualifier.DeviceInterfaceKey.InterfaceGUID = &GUID_DEVINTERFACE_OSRUSBFX2;
- RootSpecifier.Qualifier.DeviceInterfaceKey.ReferenceString = NULL;
-
- hrSetProp = pUnifiedPropertyStoreFactory->RetrieveUnifiedDevicePropertyStore(&RootSpecifier,
- &pUnifiedPropertyStore);
-
- if (SUCCEEDED(hrSetProp))
- {
- hrSetProp = pUnifiedPropertyStore->SetPropertyData(&DEVPKEY_DeviceInterface_Restricted,
- 0, // Lcid
- 0, // Flags
- DEVPROP_TYPE_BOOLEAN,
- sizeof(isRestricted),
- &isRestricted);
- }
-
- if (FAILED(hrSetProp))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Could not set restricted property %!HRESULT!",
- hrSetProp
- );
- }
-
- SAFE_RELEASE(pUnifiedPropertyStoreFactory);
- SAFE_RELEASE(pUnifiedPropertyStore);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
- if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackHardware)))
- {
- *Object = QueryIPnpCallbackHardware();
- hr = S_OK;
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IPnpCallback)))
- {
- *Object = QueryIPnpCallback();
- hr = S_OK;
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackSelfManagedIo)))
- {
- *Object = QueryIPnpCallbackSelfManagedIo();
- hr = S_OK;
- }
- else if(IsEqualIID(InterfaceId, __uuidof(IUsbTargetPipeContinuousReaderCallbackReadersFailed)))
- {
- *Object = QueryContinousReaderFailureCompletion();
- hr = S_OK;
- }
- else if(IsEqualIID(InterfaceId, __uuidof(IUsbTargetPipeContinuousReaderCallbackReadComplete)))
- {
- *Object = QueryContinousReaderCompletion();
- hr = S_OK;
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnPrepareHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked to ready the driver
- to talk to hardware. It opens the handle to the
- device and talks to it using the WINUSB interface.
- It invokes WINUSB to discver the interfaces and stores
- the information related to bulk endpoints.
-
-Arguments:
-
- FxDevice : Pointer to the WDF device interface
-
-Return Value:
-
- HRESULT
-
---*/
-{
- PWSTR deviceName = NULL;
- DWORD deviceNameCch = 0;
-
- HRESULT hr;
-
- //
- // Get the device name.
- // Get the length to allocate first
- //
-
- hr = m_FxDevice->RetrieveDeviceName(NULL, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!HRESULT!",
- hr
- );
- }
-
- //
- // Allocate the buffer
- //
-
- if (SUCCEEDED(hr))
- {
- deviceName = new WCHAR[deviceNameCch];
-
- if (deviceName == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- }
-
- //
- // Get the actual name
- //
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->RetrieveDeviceName(deviceName, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Device name %S",
- deviceName
- );
- }
-
- //
- // Create USB I/O Targets and configure them
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CreateUsbIoTargets();
- }
-
- if (SUCCEEDED(hr))
- {
- ULONG length = sizeof(m_Speed);
-
- hr = m_pIUsbTargetDevice->RetrieveDeviceInformation(DEVICE_SPEED,
- &length,
- &m_Speed);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb device speed information %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Speed - %x\n",
- m_Speed
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = ConfigureUsbPipes();
- }
-
- // Setup power-management settings on the device.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = SetPowerManagement();
- }
-
- //
- //
- // Clear the seven segement display to indicate that we're done with
- // prepare hardware.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = IndicateDeviceReady();
- }
-
- if (SUCCEEDED(hr))
- {
- hr = ConfigContReaderForInterruptEndPoint();
- }
-
- delete[] deviceName;
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnReleaseHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked when the device is being removed or stopped
- It releases all resources allocated for this device.
-
-Arguments:
-
- FxDevice - Pointer to the Device object.
-
-Return Value:
-
- HRESULT - Always succeeds.
-
---*/
-{
- //
- // Delete USB Target Device WDF Object, this will in turn
- // delete all the children - interface and the pipe objects
- //
- // This makes sure that
- // 1. We drain the the pending read which does not come from an I/O queue
- // 2. We remove USB target objects from object tree (and thereby free them)
- // before any potential subsequent OnPrepareHardware creates new ones
- //
- // m_pIUsbTargetDevice could be NULL if OnPrepareHardware failed so we need
- // to guard against that
- //
-
- if (m_pIUsbTargetDevice)
- {
- m_pIUsbTargetDevice->DeleteWdfObject();
- }
-
- return S_OK;
-}
-
-HRESULT
-CMyDevice::CreateUsbIoTargets(
- )
-/*++
-
-Routine Description:
-
- This routine creates Usb device, interface and pipe objects
-
-Arguments:
-
- None
-
-Return Value:
-
- HRESULT
---*/
-{
- HRESULT hr;
- UCHAR NumEndPoints = 0;
- IWDFUsbTargetFactory * pIUsbTargetFactory = NULL;
- IWDFUsbTargetDevice * pIUsbTargetDevice = NULL;
- IWDFUsbInterface * pIUsbInterface = NULL;
- IWDFUsbTargetPipe * pIUsbPipe = NULL;
-
- hr = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pIUsbTargetFactory));
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb target factory %!HRESULT!",
- hr
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pIUsbTargetFactory->CreateUsbTargetDevice(
- &pIUsbTargetDevice);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to create USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- else
- {
- m_pIUsbTargetDevice = pIUsbTargetDevice;
-
- //
- // Release the creation reference as object tree will maintain a reference
- //
-
- pIUsbTargetDevice->Release();
- }
- }
-
- if (SUCCEEDED(hr))
- {
- UCHAR NumInterfaces = pIUsbTargetDevice->GetNumInterfaces();
-
- WUDF_TEST_DRIVER_ASSERT(1 == NumInterfaces);
-
- hr = pIUsbTargetDevice->RetrieveUsbInterface(0, &pIUsbInterface);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to retrieve USB interface from USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- else
- {
- m_pIUsbInterface = pIUsbInterface;
-
- pIUsbInterface->Release(); //release creation reference
- }
- }
-
- if (SUCCEEDED(hr))
- {
- NumEndPoints = pIUsbInterface->GetNumEndPoints();
-
- if (NumEndPoints != NUM_OSRUSB_ENDPOINTS) {
- hr = E_UNEXPECTED;
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Has %d endpoints, expected %d, returning %!HRESULT! ",
- NumEndPoints,
- NUM_OSRUSB_ENDPOINTS,
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- for (UCHAR PipeIndex = 0; PipeIndex < NumEndPoints; PipeIndex++)
- {
- hr = pIUsbInterface->RetrieveUsbPipeObject(PipeIndex,
- &pIUsbPipe);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to retrieve USB Pipe for PipeIndex %d, %!HRESULT!",
- PipeIndex,
- hr
- );
- }
- else
- {
- if ( pIUsbPipe->IsInEndPoint() )
- {
- if ( UsbdPipeTypeInterrupt == pIUsbPipe->GetType() )
- {
- m_pIUsbInterruptPipe = pIUsbPipe;
-
- WUDF_TEST_DRIVER_ASSERT (m_pIoTargetInterruptPipeStateMgmt == NULL);
-
- hr = m_pIUsbInterruptPipe->QueryInterface(__uuidof(
- IWDFIoTargetStateManagement),
- reinterpret_cast<void**>(&m_pIoTargetInterruptPipeStateMgmt)
- );
- if (FAILED(hr))
- {
- m_pIoTargetInterruptPipeStateMgmt = NULL;
- }
- }
- else if ( UsbdPipeTypeBulk == pIUsbPipe->GetType() )
- {
- m_pIUsbInputPipe = pIUsbPipe;
- }
- else
- {
- pIUsbPipe->DeleteWdfObject();
- }
- }
- else if ( pIUsbPipe->IsOutEndPoint() && (UsbdPipeTypeBulk == pIUsbPipe->GetType()) )
- {
- m_pIUsbOutputPipe = pIUsbPipe;
- }
- else
- {
- pIUsbPipe->DeleteWdfObject();
- }
-
- SAFE_RELEASE(pIUsbPipe); //release creation reference
- }
- }
-
- if (NULL == m_pIUsbInputPipe || NULL == m_pIUsbOutputPipe)
- {
- hr = E_UNEXPECTED;
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Input or output pipe not found, returning %!HRESULT!",
- hr
- );
- }
- }
-
- SAFE_RELEASE(pIUsbTargetFactory);
-
- return hr;
-}
-
-HRESULT
-CMyDevice::ConfigureUsbPipes(
- )
-/*++
-
-Routine Description:
-
- This routine retrieves the IDs for the bulk end points of the USB device.
-
-Arguments:
-
- None
-
-Return Value:
-
- HRESULT
---*/
-{
- HRESULT hr = S_OK;
- LONG timeout;
-
- //
- // Set timeout policies for input/output pipes
- //
-
- if (SUCCEEDED(hr))
- {
- timeout = ENDPOINT_TIMEOUT;
-
- hr = m_pIUsbInputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT,
- sizeof(timeout),
- &timeout);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to set timeout policy for input pipe %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- timeout = ENDPOINT_TIMEOUT;
-
- hr = m_pIUsbOutputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT,
- sizeof(timeout),
- &timeout);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to set timeout policy for output pipe %!HRESULT!",
- hr
- );
- }
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::IndicateDeviceReady(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method lights the period on the device's seven-segment display to
- indicate that the driver's PrepareHardware method has completed.
-
- Arguments:
-
- None
-
- Return Value:
-
- Status
-
---*/
-{
- SEVEN_SEGMENT display = {0};
-
- HRESULT hr;
-
- //
- // First read the contents of the seven segment display.
- //
-
- hr = GetSevenSegmentDisplay(&display);
-
- if (SUCCEEDED(hr))
- {
- display.Segments |= 0x08;
-
- hr = SetSevenSegmentDisplay(&display);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::GetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- )
-/*++
-
- Routine Description:
-
- This method synchronously retrieves the bar graph display information
- from the OSR USB-FX2 device. It uses the buffers in the FxRequest
- to hold the data it retrieves.
-
- Arguments:
-
- FxRequest - the request for the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesReturned;
-
- HRESULT hr = S_OK;
-
- //
- // Zero the contents of the buffer - the controller OR's in every
- // light that's set.
- //
-
- BarGraphState->BarsAsUChar = 0;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestDeviceToHost,
- BmRequestToDevice,
- USBFX2LK_READ_BARGRAPH_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) BarGraphState,
- sizeof(BAR_GRAPH_STATE),
- &bytesReturned
- );
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- )
-/*++
-
- Routine Description:
-
- This method synchronously sets the bar graph display on the OSR USB-FX2
- device using the buffers in the FxRequest as input.
-
- Arguments:
-
- FxRequest - the request to set the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesTransferred;
-
- HRESULT hr = S_OK;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestHostToDevice,
- BmRequestToDevice,
- USBFX2LK_SET_BARGRAPH_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) BarGraphState,
- sizeof(BAR_GRAPH_STATE),
- &bytesTransferred
- );
-
-
- return hr;
-}
-
-HRESULT
-CMyDevice::GetSevenSegmentDisplay(
- _In_ PSEVEN_SEGMENT SevenSegment
- )
-/*++
-
- Routine Description:
-
- This method synchronously retrieves the bar graph display information
- from the OSR USB-FX2 device. It uses the buffers in the FxRequest
- to hold the data it retrieves.
-
- Arguments:
-
- FxRequest - the request for the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesReturned;
-
- HRESULT hr = S_OK;
-
- //
- // Zero the output buffer - the device will or in the bits for
- // the lights that are set.
- //
-
- SevenSegment->Segments = 0;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestDeviceToHost,
- BmRequestToDevice,
- USBFX2LK_READ_7SEGMENT_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) SevenSegment,
- sizeof(SEVEN_SEGMENT),
- &bytesReturned
- );
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SetSevenSegmentDisplay(
- _In_ PSEVEN_SEGMENT SevenSegment
- )
-/*++
-
- Routine Description:
-
- This method synchronously sets the bar graph display on the OSR USB-FX2
- device using the buffers in the FxRequest as input.
-
- Arguments:
-
- FxRequest - the request to set the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesTransferred;
-
- HRESULT hr = S_OK;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestHostToDevice,
- BmRequestToDevice,
- USBFX2LK_SET_7SEGMENT_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) SevenSegment,
- sizeof(SEVEN_SEGMENT),
- &bytesTransferred
- );
-
- return hr;
-}
-
-HRESULT
-CMyDevice::ReadSwitchState(
- _In_ PSWITCH_STATE SwitchState
- )
-/*++
-
- Routine Description:
-
- This method synchronously retrieves the bar graph display information
- from the OSR USB-FX2 device. It uses the buffers in the FxRequest
- to hold the data it retrieves.
-
- Arguments:
-
- FxRequest - the request for the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesReturned;
-
- HRESULT hr = S_OK;
-
- //
- // Zero the output buffer - the device will or in the bits for
- // the lights that are set.
- //
-
- SwitchState->SwitchesAsUChar = 0;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestDeviceToHost,
- BmRequestToDevice,
- USBFX2LK_READ_SWITCHES,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) SwitchState,
- sizeof(SWITCH_STATE),
- &bytesReturned
- );
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- )
-{
- HRESULT hr = S_OK;
- HRESULT hrRequest = S_OK;
- IWDFIoRequest *pWdfRequest = NULL;
- IWDFDriver * FxDriver = NULL;
- IWDFMemory * FxMemory = NULL;
- IWDFRequestCompletionParams * FxComplParams = NULL;
- IWDFUsbRequestCompletionParams * FxUsbComplParams = NULL;
-
- *LengthTransferred = 0;
-
- hr = m_FxDevice->CreateRequest( NULL, //pCallbackInterface
- NULL, //pParentObject
- &pWdfRequest);
- hrRequest = hr;
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice->GetDriver(&FxDriver);
-
- hr = FxDriver->CreatePreallocatedWdfMemory( Buffer,
- BufferLength,
- NULL, //pCallbackInterface
- pWdfRequest, //pParetObject
- &FxMemory );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_pIUsbTargetDevice->FormatRequestForControlTransfer( pWdfRequest,
- SetupPacket,
- FxMemory,
- NULL); //TransferOffset
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pWdfRequest->Send( m_pIUsbTargetDevice,
- WDF_REQUEST_SEND_OPTION_SYNCHRONOUS,
- 0); //Timeout
- }
-
- if (SUCCEEDED(hr))
- {
- pWdfRequest->GetCompletionParams(&FxComplParams);
-
- hr = FxComplParams->GetCompletionStatus();
- }
-
- if (SUCCEEDED(hr))
- {
- HRESULT hrQI = FxComplParams->QueryInterface(IID_PPV_ARGS(&FxUsbComplParams));
- WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrQI));
-
- WUDF_TEST_DRIVER_ASSERT( WdfUsbRequestTypeDeviceControlTransfer ==
- FxUsbComplParams->GetCompletedUsbRequestType() );
-
- FxUsbComplParams->GetDeviceControlTransferParameters( NULL,
- LengthTransferred,
- NULL,
- NULL );
- }
-
- SAFE_RELEASE(FxUsbComplParams);
- SAFE_RELEASE(FxComplParams);
- SAFE_RELEASE(FxMemory);
-
- if (SUCCEEDED(hrRequest))
- {
- pWdfRequest->DeleteWdfObject();
- }
- SAFE_RELEASE(pWdfRequest);
-
- SAFE_RELEASE(FxDriver);
-
- return hr;
-}
-
-WDF_IO_TARGET_STATE
-CMyDevice::GetTargetState(
- IWDFIoTarget * pTarget
- )
-{
- IWDFIoTargetStateManagement * pStateMgmt = NULL;
- WDF_IO_TARGET_STATE state;
-
- HRESULT hrQI = pTarget->QueryInterface(IID_PPV_ARGS(&pStateMgmt));
- WUDF_TEST_DRIVER_ASSERT((SUCCEEDED(hrQI) && pStateMgmt));
-
- state = pStateMgmt->GetState();
-
- SAFE_RELEASE(pStateMgmt);
-
- return state;
-}
-
-VOID
-CMyDevice::ServiceSwitchChangeQueue(
- _In_ SWITCH_STATE NewState,
- _In_ HRESULT CompletionStatus,
- _In_opt_ IWDFFile *SpecificFile
- )
-/*++
-
- Routine Description:
-
- This method processes switch-state change notification requests as
- part of reading the OSR device's interrupt pipe. As each read completes
- this pulls all pending I/O off the switch change queue and completes
- each request with the current switch state.
-
- Arguments:
-
- NewState - the state of the switches
-
- CompletionStatus - all pending operations are completed with this status.
-
- SpecificFile - if provided only requests for this file object will get
- completed.
-
- Return Value:
-
- None
-
---*/
-{
- IWDFIoRequest *fxRequest;
-
- HRESULT enumHr = S_OK;
-
- do
- {
- HRESULT hr;
-
- //
- // Get the next request.
- //
-
- if (NULL != SpecificFile)
- {
- enumHr = m_SwitchChangeQueue->RetrieveNextRequestByFileObject(
- SpecificFile,
- &fxRequest
- );
- }
- else
- {
- enumHr = m_SwitchChangeQueue->RetrieveNextRequest(&fxRequest);
- }
-
- //
- // if we got one then complete it.
- //
-
- if (SUCCEEDED(enumHr))
- {
- if (SUCCEEDED(CompletionStatus))
- {
- IWDFMemory *fxMemory;
-
- //
- // First copy the result to the request buffer.
- //
-
- fxRequest->GetOutputMemory(&fxMemory );
-
- hr = fxMemory->CopyFromBuffer(0,
- &NewState,
- sizeof(SWITCH_STATE));
- fxMemory->Release();
- }
- else
- {
- hr = CompletionStatus;
- }
-
- //
- // Complete the request with the status of the copy (or the completion
- // status if that was an error).
- //
-
- if (SUCCEEDED(hr))
- {
- fxRequest->CompleteWithInformation(hr, sizeof(SWITCH_STATE));
- }
- else
- {
- fxRequest->Complete(hr);
- }
-
- fxRequest->Release();
- }
- }
- while (SUCCEEDED(enumHr));
-}
-
-HRESULT
-CMyDevice::SetPowerManagement(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method enables the idle and wake functionality
- using UMDF. UMDF has been set as the power policy
- owner (PPO) for the device stack and we are using power
- managed queues.
-
- Arguments:
-
- None
-
- Return Value:
-
- Status
-
---*/
-{
- HRESULT hr;
-
- //
- // Enable USB selective suspend on the device.
- //
-
- hr = m_FxDevice->AssignS0IdleSettings( IdleUsbSelectiveSuspend,
- PowerDeviceMaximum,
- IDLE_TIMEOUT_IN_MSEC,
- IdleAllowUserControl,
- WdfUseDefault);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to assign S0 idle settings for the device %!HRESULT!",
- hr
- );
- }
-
- //
- // Enable Sx wake settings
- //
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->AssignSxWakeSettings( PowerDeviceMaximum,
- WakeAllowUserControl,
- WdfUseDefault);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to set Sx Wake Settings for the device %!HRESULT!",
- hr
- );
- }
-
- }
-
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnD0Entry(
- _In_ IWDFDevice* pWdfDevice,
- _In_ WDF_POWER_DEVICE_STATE previousState
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- UNREFERENCED_PARAMETER(previousState);
-
- //
- // Start/Stop the I/O target if you support a continuous reader.
- // The rest of the I/O is fed through power managed queues. The queue
- // itself will stop feeding I/O to targets (and will wait for any pending
- // I/O to complete before going into low power state), hence targets
- // don�t need to be stopped/started. The continuous reader I/O is outside
- // of power managed queues so we need to Stop the I/O target on D0Exit and
- // start it on D0Entry. Please note that bulk pipe target doesn't need to
- // be stopped/started because I/O submitted to this pipe comes from power
- // managed I/O queue, which delivers I/O only in power on state.
- //
-
- m_pIoTargetInterruptPipeStateMgmt->Start();
-
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnD0Exit(
- _In_ IWDFDevice* pWdfDevice,
- _In_ WDF_POWER_DEVICE_STATE previousState
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- UNREFERENCED_PARAMETER(previousState);
-
- //
- // Stop the I/O target always succeedes.
- //
- m_pIoTargetInterruptPipeStateMgmt->Stop(WdfIoTargetCancelSentIo);
- return S_OK;
-}
-
-void
-CMyDevice::OnSurpriseRemoval(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return;
-}
-
-HRESULT
-CMyDevice::OnQueryRemove(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnQueryStop(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-//
-// Self Managed Io Callbacks
-//
-
-VOID
-CMyDevice::OnSelfManagedIoCleanup(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return;
-}
-
-VOID
-CMyDevice::OnSelfManagedIoFlush(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
-
- //
- // Complete every switch change operation with an error.
- //
- ServiceSwitchChangeQueue(m_SwitchState,
- HRESULT_FROM_WIN32(ERROR_DEVICE_REMOVED),
- NULL);
-
- return;
-}
-
-HRESULT
-CMyDevice::OnSelfManagedIoInit(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnSelfManagedIoRestart(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnSelfManagedIoStop(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-HRESULT
-CMyDevice::OnSelfManagedIoSuspend(
- _In_ IWDFDevice* pWdfDevice
- )
-{
- UNREFERENCED_PARAMETER(pWdfDevice);
- return S_OK;
-}
-
-
-
-HRESULT
-CMyDevice::ConfigContReaderForInterruptEndPoint(
- VOID
- )
-/*++
-
-Routine Description:
-
- This routine configures a continuous reader on the
- interrupt endpoint. It's called from the PrepareHarware event.
-
-Arguments:
-
-
-Return Value:
-
- HRESULT value
-
---*/
-{
- HRESULT hr, hrQI;
- IUsbTargetPipeContinuousReaderCallbackReadComplete *pOnCompletionCallback = NULL;
- IUsbTargetPipeContinuousReaderCallbackReadersFailed *pOnFailureCallback= NULL;
- IWDFUsbTargetPipe2 * pIUsbInterruptPipe2;
-
- hrQI = this->QueryInterface(IID_PPV_ARGS(&pOnCompletionCallback));
- WUDF_TEST_DRIVER_ASSERT((SUCCEEDED(hrQI) && pOnCompletionCallback));
-
- hrQI = this->QueryInterface(IID_PPV_ARGS(&pOnFailureCallback));
- WUDF_TEST_DRIVER_ASSERT((SUCCEEDED(hrQI) && pOnFailureCallback));
-
- hrQI = m_pIUsbInterruptPipe->QueryInterface(IID_PPV_ARGS(&pIUsbInterruptPipe2));
- WUDF_TEST_DRIVER_ASSERT((SUCCEEDED(hrQI) && pIUsbInterruptPipe2));
-
- //
- // Reader requests are not posted to the target automatically.
- // Driver must explictly call WdfIoTargetStart to kick start the
- // reader. In this sample, it's done in D0Entry.
- // By defaut, framework queues two requests to the target
- // endpoint. Driver can configure up to 10 requests with the
- // parameter CONCURRENT_READS
- //
- hr = pIUsbInterruptPipe2->ConfigureContinuousReader( sizeof(m_SwitchStateBuffer),
- 0,//header
- 0,//trailer
- CONCURRENT_READS,
- NULL,
- pOnCompletionCallback,
- m_pIUsbInterruptPipe,
- pOnFailureCallback
- );
-
- if (FAILED(hr)) {
- TraceEvents(TRACE_LEVEL_ERROR, TEST_TRACE_DEVICE,
- "OsrFxConfigContReaderForInterruptEndPoint failed %!HRESULT!",
- hr);
- }
-
- SAFE_RELEASE(pOnCompletionCallback);
- SAFE_RELEASE(pOnFailureCallback);
- SAFE_RELEASE(pIUsbInterruptPipe2);
-
- return hr;
-}
-
-
-BOOL
-CMyDevice::OnReaderFailure(
- IWDFUsbTargetPipe * pPipe,
- HRESULT hrCompletion
- )
-{
- UNREFERENCED_PARAMETER(pPipe);
-
- m_InterruptReadProblem = hrCompletion;
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Failure completed with %!HRESULT!",
- hrCompletion
- );
-
- ServiceSwitchChangeQueue(m_SwitchState,
- hrCompletion,
- NULL);
-
- return TRUE;
-}
-
-VOID
-CMyDevice::OnReaderCompletion(
- IWDFUsbTargetPipe * pPipe,
- IWDFMemory * pMemory,
- SIZE_T NumBytesTransferred,
- PVOID Context
- )
-{
- WUDF_TEST_DRIVER_ASSERT(pPipe == (IWDFUsbTargetPipe *)Context);
-
- //
- // Make sure that there is data in the read packet. Depending on the device
- // specification, it is possible for it to return a 0 length read in
- // certain conditions.
- //
-
- if (NumBytesTransferred == 0) {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Zero length read occured on the Interrupt Pipe's "
- "Continuous Reader\n"
- );
- return;
- }
-
- WUDF_TEST_DRIVER_ASSERT(NumBytesTransferred == sizeof(m_SwitchState));
-
- //
- // Get the switch state
- //
-
- PVOID pBuff = pMemory->GetDataBuffer(NULL);
-
- CopyMemory(&m_SwitchState, pBuff, sizeof(m_SwitchState));
-
-
- //
- // Satisfy application request for switch change notification
- //
-
- ServiceSwitchChangeQueue(m_SwitchState,
- S_OK,
- NULL);
-
- //
- // Make sure that the request that got completed is the one that we reuse
- // Don't Delete the request because it gets reused
- //
-}
-
-
-HRESULT
-CMyDevice::GetBusTypeGuid(
- VOID
- )
-/*++
-
- Routine Description:
-
- This routine gets the device instance ID then invokes SetupDi to
- retrieve the bus type guid for the device. The bus type guid is
- stored in object.
-
- Arguments:
-
- None
-
- Return Value:
-
- Status
-
---*/
-{
- ULONG instanceIdCch = 0;
- PWSTR instanceId = NULL;
-
- HDEVINFO deviceInfoSet = NULL;
- SP_DEVINFO_DATA deviceInfo = {sizeof(SP_DEVINFO_DATA)};
-
- HRESULT hr;
-
- //
- // Retrieve the device instance ID.
- //
-
- hr = m_FxDevice->RetrieveDeviceInstanceId(NULL, &instanceIdCch);
-
- if (FAILED(hr))
- {
- goto Exit;
- }
-
- instanceId = new WCHAR[instanceIdCch];
-
- if (instanceId == NULL)
- {
- hr = E_OUTOFMEMORY;
- goto Exit;
- }
-
- hr = m_FxDevice->RetrieveDeviceInstanceId(instanceId, &instanceIdCch);
-
- if (FAILED(hr))
- {
- goto Exit2;
- }
-
- //
- // Call SetupDI to open the device info.
- //
-
- deviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL);
-
- if (deviceInfoSet == INVALID_HANDLE_VALUE)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit2;
- }
-
- if (SetupDiOpenDeviceInfo(deviceInfoSet,
- instanceId,
- NULL,
- 0,
- &deviceInfo) == FALSE)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit3;
- }
-
- if (SetupDiGetDeviceRegistryProperty(deviceInfoSet,
- &deviceInfo,
- SPDRP_BUSTYPEGUID,
- NULL,
- (PBYTE) &m_BusTypeGuid,
- sizeof(m_BusTypeGuid),
- NULL) == FALSE)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto Exit3;
- }
-
-Exit3:
- SetupDiDestroyDeviceInfoList(deviceInfoSet);
-
-Exit2:
-
- delete[] instanceId;
-
-Exit:
-
- return hr;
-}
-
-HRESULT
-CMyDevice::PlaybackFile(
- _In_ PFILE_PLAYBACK PlayInfo,
- _In_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method impersonates the caller, opens the file and prints each
- character to the seven segement display.
-
- Arguments:
-
- PlayInfo - the playback info from the request.
-
- FxRequest - the request (used for impersonation)
-
- Return Value:
-
- Status
-
---*/
-
-{
- PLAYBACK_IMPERSONATION_CONTEXT context = {PlayInfo, NULL, S_OK};
- IWDFIoRequest2* fxRequest2;
-
- HRESULT hr;
-
- // Convert FxRequest to FxRequest2. No error can occur here.
- FxRequest->QueryInterface(IID_PPV_ARGS(&fxRequest2));
- _Analysis_assume_(fxRequest2 != NULL);
-
- //
- // Impersonate and open the playback file.
- //
-
- hr = FxRequest->Impersonate(
- SecurityImpersonation,
- this->QueryIImpersonateCallback(),
- &context
- );
- if (FAILED(hr))
- {
- goto exit;
- }
-
- //
- // Release the reference that was added in QueryIImpersonateCallback()
- //
- this->Release();
-
- hr = context.Hr;
-
- if (FAILED(hr))
- {
- goto exit;
- }
-
- //
- // The impersonation callback succeeded - tell code analysis that the
- // file handle is non-null
- //
-
- _Analysis_assume_(context.FileHandle != NULL);
-
- //
- // Read from the file one character at a time until we hit
- // EOF or the request is cancelled.
- //
-
- do
- {
- UCHAR c;
- ULONG bytesRead;
-
- //
- // Check for cancellation.
- //
-
- if (fxRequest2->IsCanceled())
- {
- hr = HRESULT_FROM_WIN32(ERROR_CANCELLED);
- }
- else
- {
- BOOL result;
-
- //
- // Read a character from the file and see if we can
- // encode it on the display.
- //
-
- result = ReadFile(context.FileHandle,
- &c,
- sizeof(c),
- &bytesRead,
- NULL);
-
- if (result)
- {
- SEVEN_SEGMENT segment;
- BAR_GRAPH_STATE barGraph;
-
- if (bytesRead > 0)
- {
- #pragma prefast(suppress:__WARNING_USING_UNINIT_VAR,"Above this->Release() method does not actually free 'this'")
- if(EncodeSegmentValue(c, &segment) == true)
- {
- barGraph.BarsAsUChar = c;
-
- SetSevenSegmentDisplay(&segment);
- SetBarGraphDisplay(&barGraph);
- }
-
- Sleep(PlayInfo->Delay);
- }
- else
- {
- hr = S_OK;
- break;
- }
- }
- else
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- }
- }
-
- } while(SUCCEEDED(hr));
-
- CloseHandle(context.FileHandle);
-
-exit:
-
- fxRequest2->Release();
- return hr;
-}
-
-VOID
-CMyDevice::OnImpersonate(
- _In_ PVOID Context
- )
-/*++
-
- Routine Description:
-
- This routine handles the impersonation for the PLAY FILE I/O control.
-
- Arguments:
-
- Context - pointer to the impersonation context
-
- Return Value:
-
- None
-
---*/
-{
- PPLAYBACK_IMPERSONATION_CONTEXT context;
-
- context = (PPLAYBACK_IMPERSONATION_CONTEXT) Context;
-
- context->FileHandle = CreateFile(context->PlaybackInfo->Path,
- GENERIC_READ,
- FILE_SHARE_READ,
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
-
- if (context->FileHandle == INVALID_HANDLE_VALUE)
- {
- DWORD error = GetLastError();
- context->Hr = HRESULT_FROM_WIN32(error);
- }
- else
- {
- context->Hr = S_OK;
- }
-
- return;
-}
-
-#define SS_LEFT (SS_TOP_LEFT | SS_BOTTOM_LEFT)
-#define SS_RIGHT (SS_TOP_RIGHT | SS_BOTTOM_RIGHT)
-
-bool
-CMyDevice::EncodeSegmentValue(
- _In_ UCHAR Character,
- _Out_ SEVEN_SEGMENT *SevenSegment
- )
-{
- UCHAR letterMap[] = {
- (SS_TOP | SS_BOTTOM_LEFT | SS_RIGHT | SS_CENTER | SS_BOTTOM), // a
- (SS_LEFT | SS_CENTER | SS_BOTTOM | SS_BOTTOM_RIGHT), // b
- (SS_CENTER | SS_BOTTOM_LEFT | SS_BOTTOM), // c
- (SS_BOTTOM_LEFT | SS_CENTER | SS_BOTTOM | SS_RIGHT), // d
- (SS_LEFT | SS_TOP | SS_CENTER | SS_BOTTOM), // e
- (SS_LEFT | SS_TOP | SS_CENTER), // f
- (SS_TOP | SS_TOP_LEFT | SS_CENTER | SS_BOTTOM | SS_RIGHT), // g
- (SS_LEFT | SS_RIGHT | SS_CENTER), // h
- (SS_BOTTOM_LEFT), // i
- (SS_BOTTOM | SS_RIGHT), // j
- (SS_LEFT | SS_CENTER | SS_BOTTOM), // k
- (SS_LEFT | SS_BOTTOM), // l
- (SS_LEFT | SS_TOP | SS_RIGHT), // m
- (SS_BOTTOM_LEFT | SS_CENTER | SS_BOTTOM_RIGHT), // n
- (SS_BOTTOM_LEFT | SS_BOTTOM_RIGHT | SS_CENTER | SS_BOTTOM), // o
- (SS_LEFT | SS_TOP | SS_CENTER | SS_TOP_RIGHT), // p
- (SS_TOP_LEFT | SS_TOP | SS_CENTER | SS_RIGHT), // q
- (SS_BOTTOM_LEFT | SS_CENTER), // r
- (SS_TOP_LEFT |
- SS_TOP | SS_CENTER | SS_BOTTOM |
- SS_BOTTOM_RIGHT), // s
- (SS_TOP | SS_RIGHT), // t
- (SS_LEFT | SS_RIGHT | SS_BOTTOM), // u
- (SS_BOTTOM_LEFT | SS_BOTTOM | SS_BOTTOM_RIGHT), // v
- (SS_LEFT | SS_BOTTOM | SS_BOTTOM_RIGHT), // w
- (SS_LEFT | SS_CENTER | SS_RIGHT), // x
- (SS_TOP_LEFT | SS_CENTER | SS_RIGHT), // y
- (SS_TOP_RIGHT |
- SS_TOP | SS_CENTER | SS_BOTTOM |
- SS_BOTTOM_LEFT), // z
- };
-
- UCHAR numberMap[] = {
- (SS_LEFT | SS_TOP | SS_BOTTOM | SS_RIGHT | SS_DOT), // 0
- (SS_RIGHT | SS_DOT), // 1
- (SS_TOP |
- SS_TOP_RIGHT | SS_CENTER | SS_BOTTOM_LEFT |
- SS_BOTTOM | SS_DOT), // 2
- (SS_TOP | SS_CENTER | SS_BOTTOM | SS_RIGHT | SS_DOT), // 3
- (SS_TOP_LEFT | SS_CENTER | SS_RIGHT | SS_DOT), // 4
- (SS_TOP_LEFT |
- SS_TOP | SS_CENTER | SS_BOTTOM |
- SS_BOTTOM_RIGHT | SS_DOT), // 5
- (SS_TOP | SS_CENTER | SS_BOTTOM |
- SS_LEFT | SS_BOTTOM_RIGHT | SS_DOT), // 6
- (SS_TOP | SS_RIGHT | SS_DOT), // 7
- (SS_TOP | SS_BOTTOM | SS_CENTER |
- SS_LEFT | SS_RIGHT | SS_DOT), // 8
- (SS_TOP_LEFT | SS_TOP | SS_CENTER | SS_RIGHT | SS_DOT), // 9
- };
-
- if ((Character >= 'a') && (Character <= 'z'))
- {
- SevenSegment->Segments = letterMap[Character - 'a'];
- return true;
- }
- else if ((Character >= 'A') && (Character <= 'Z'))
- {
- SevenSegment->Segments = letterMap[Character - 'A'];
- return true;
- }
- else if ((Character >= '0') && (Character <= '9'))
- {
- SevenSegment->Segments = numberMap[Character - '0'];
- return true;
- }
- else
- {
- SevenSegment->Segments = 0;
- return false;
- }
-}
-
diff --git a/usb/umdf_fx2/driver/Device.h b/usb/umdf_fx2/driver/Device.h
deleted file mode 100644
index 641a04de..00000000
--- a/usb/umdf_fx2/driver/Device.h
+++ /dev/null
@@ -1,604 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF OSR Fx2 sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "internal.h"
-
-#define ENDPOINT_TIMEOUT 10000
-#define NUM_OSRUSB_ENDPOINTS 3
-
-//
-// Define the vendor commands supported by our device
-//
-#define USBFX2LK_READ_7SEGMENT_DISPLAY 0xD4
-#define USBFX2LK_READ_SWITCHES 0xD6
-#define USBFX2LK_READ_BARGRAPH_DISPLAY 0xD7
-#define USBFX2LK_SET_BARGRAPH_DISPLAY 0xD8
-#define USBFX2LK_IS_HIGH_SPEED 0xD9
-#define USBFX2LK_REENUMERATE 0xDA
-#define USBFX2LK_SET_7SEGMENT_DISPLAY 0xDB
-
-typedef struct {
- UCHAR Segments;
-} SEVEN_SEGMENT, *PSEVEN_SEGMENT;
-
-//
-// Context for the impersonation callback.
-//
-
-typedef struct
-{
- PFILE_PLAYBACK PlaybackInfo;
-
- HANDLE FileHandle;
-
- HRESULT Hr;
-} PLAYBACK_IMPERSONATION_CONTEXT, *PPLAYBACK_IMPERSONATION_CONTEXT;
-
-//
-// Class for the driver.
-//
-
-class CMyDevice :
- public CUnknown,
- public IPnpCallbackHardware,
- public IPnpCallback,
- public IPnpCallbackSelfManagedIo,
- public IUsbTargetPipeContinuousReaderCallbackReadersFailed,
- public IUsbTargetPipeContinuousReaderCallbackReadComplete,
- public IImpersonateCallback
-{
-//
-// Private data members.
-//
-private:
- //
- // Weak reference to framework device
- // Use IWDFDevice2 so we can set power policy settings
- //
- IWDFDevice2 *m_FxDevice;
-
- //
- // Weak reference to the control queue
- //
- PCMyReadWriteQueue m_ReadWriteQueue;
-
- //
- // Weak reference to the control queue
- //
- PCMyControlQueue m_ControlQueue;
-
- //
- // The bus type for this device (used here for
- // illustrative purposes only)
- //
-
- GUID m_BusTypeGuid;
-
- //
- // USB Device I/O Target
- //
- IWDFUsbTargetDevice * m_pIUsbTargetDevice;
-
- //
- // USB Interface
- //
- IWDFUsbInterface * m_pIUsbInterface;
-
- //
- // USB Input pipe for Reads
- //
- IWDFUsbTargetPipe * m_pIUsbInputPipe;
-
- //
- // USB Output pipe for writes
- //
- IWDFUsbTargetPipe * m_pIUsbOutputPipe;
-
- //
- // USB interrupt pipe
- //
- IWDFUsbTargetPipe * m_pIUsbInterruptPipe;
-
- //
- // Use I/O target state management interfaces if you are going to
- // support a continuous reader.
- //
-
- //
- // USB interrupt pipe state management
- //
- IWDFIoTargetStateManagement * m_pIoTargetInterruptPipeStateMgmt;
-
- //
- // Device Speed (Low, Full, High)
- //
- UCHAR m_Speed;
-
- //
- // Current switch state
- //
- SWITCH_STATE m_SwitchState;
-
- //
- // Request to be used for pending reads from interrupt pipe
- // (to get switch state change notifications)
- //
-
- IWDFIoRequest * m_RequestForPendingRead;
-
- //
- // If reads stopped because of a transient problem, the error status
- // is stored here.
- //
-
- HRESULT m_InterruptReadProblem;
-
- //
- // Switch state buffer - this might hold the transient value
- // m_SwitchState holds stable value of the switch state
- //
- SWITCH_STATE m_SwitchStateBuffer;
-
- //
- // A manual queue to hold requests for changes in the I/O switch state.
- //
-
- IWDFIoQueue * m_SwitchChangeQueue;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- ) :
- m_FxDevice(NULL),
- m_ControlQueue(NULL),
- m_ReadWriteQueue(NULL),
- m_SwitchChangeQueue(NULL),
- m_pIUsbTargetDevice(NULL),
- m_pIUsbInterface(NULL),
- m_pIUsbInputPipe(NULL),
- m_pIUsbOutputPipe(NULL),
- m_pIUsbInterruptPipe(NULL),
- m_Speed(0),
- m_InterruptReadProblem(S_OK),
- m_RequestForPendingRead(NULL),
- m_pIoTargetInterruptPipeStateMgmt(NULL)
- {
- ZeroMemory(&m_BusTypeGuid, sizeof(m_BusTypeGuid));
- }
-
- ~CMyDevice(
- );
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- //
- // Helper methods
- //
-
- HRESULT
- GetBusTypeGuid(
- VOID
- );
-
- HRESULT
- CreateUsbIoTargets(
- VOID
- );
-
-
- HRESULT
- ConfigureUsbPipes(
- );
-
- HRESULT
- SetPowerManagement(
- VOID
- );
-
- HRESULT
- IndicateDeviceReady(
- VOID
- );
-
- //
- // Helper functions
- //
-
- HRESULT
- SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- );
-
- static
- WDF_IO_TARGET_STATE
- GetTargetState(
- IWDFIoTarget * pTarget
- );
-
- VOID
- ServiceSwitchChangeQueue(
- _In_ SWITCH_STATE NewState,
- _In_ HRESULT CompletionStatus,
- _In_opt_ IWDFFile *SpecificFile
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- IWDFDevice *
- GetFxDevice(
- VOID
- )
- {
- return m_FxDevice;
- }
-
- HRESULT
- Configure(
- VOID
- );
-
- IPnpCallback *
- QueryIPnpCallback(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallback *>(this);
- }
-
- IPnpCallbackHardware *
- QueryIPnpCallbackHardware(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallbackHardware *>(this);
- }
-
- IPnpCallbackSelfManagedIo *
- QueryIPnpCallbackSelfManagedIo(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallbackSelfManagedIo *>(this);
- }
-
-
- IUsbTargetPipeContinuousReaderCallbackReadersFailed *
- QueryContinousReaderFailureCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IUsbTargetPipeContinuousReaderCallbackReadersFailed *>(this);
- }
-
- IUsbTargetPipeContinuousReaderCallbackReadComplete *
- QueryContinousReaderCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IUsbTargetPipeContinuousReaderCallbackReadComplete *>(this);
- }
-
- IImpersonateCallback *
- QueryIImpersonateCallback(
- VOID
- )
- {
- AddRef();
- return static_cast<IImpersonateCallback *>(this);
- }
-
- HRESULT
- GetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- );
-
- HRESULT
- SetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- );
-
- HRESULT
- GetSevenSegmentDisplay(
- _In_ PSEVEN_SEGMENT SevenSegment
- );
-
- HRESULT
- SetSevenSegmentDisplay(
- _In_ PSEVEN_SEGMENT SevenSegment
- );
-
- HRESULT
- ReadSwitchState(
- _In_ PSWITCH_STATE SwitchState
- );
-
- bool
- EncodeSegmentValue(
- _In_ UCHAR Character,
- _Out_ SEVEN_SEGMENT *SevenSegment
- );
-
- HRESULT
- PlaybackFile(
- _In_ PFILE_PLAYBACK PlaybackInfo,
- _In_ IWDFIoRequest *FxRequest
- );
-
- //
- //returns a weak reference to the target USB device
- //DO NOT release it
- //
- IWDFUsbTargetDevice *
- GetUsbTargetDevice(
- )
- {
- return m_pIUsbTargetDevice;
- }
-
- //
- //returns a weak reference to input pipe
- //DO NOT release it
- //
- IWDFUsbTargetPipe *
- GetInputPipe(
- )
- {
- return m_pIUsbInputPipe;
- }
-
- //
- //returns a weak reference to output pipe
- //DO NOT release it
- //
- IWDFUsbTargetPipe *
- GetOutputPipe(
- )
- {
- return m_pIUsbOutputPipe;
- }
-
- IWDFIoQueue *
- GetSwitchChangeQueue(
- VOID
- )
- {
- return m_SwitchChangeQueue;
- }
-
- PSWITCH_STATE
- GetCurrentSwitchState(
- VOID
- )
- {
- return &m_SwitchState;
- }
-
-
- HRESULT
- ConfigContReaderForInterruptEndPoint(
- VOID
- );
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IPnpCallbackHardware
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnPrepareHardware(
- _In_ IWDFDevice *FxDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnReleaseHardware(
- _In_ IWDFDevice *FxDevice
- );
-
-
- //
- // IPnpCallback
- //
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnD0Entry(
- _In_ IWDFDevice* pWdfDevice,
- _In_ WDF_POWER_DEVICE_STATE previousState
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnD0Exit(
- _In_ IWDFDevice* pWdfDevice,
- _In_ WDF_POWER_DEVICE_STATE previousState
- );
-
- virtual
- void
- STDMETHODCALLTYPE
- OnSurpriseRemoval(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnQueryRemove(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnQueryStop(
- _In_ IWDFDevice* pWdfDevice
- );
-
- //
- // IPnpCallbackSelfManagedIo
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnSelfManagedIoCleanup(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnSelfManagedIoFlush(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoInit(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoRestart(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoStop(
- _In_ IWDFDevice* pWdfDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnSelfManagedIoSuspend(
- _In_ IWDFDevice* pWdfDevice
- );
-
- //
- // IUsbTargetPipeContinuousReaderCallbackReadersFailed
- //
- virtual
- BOOL
- STDMETHODCALLTYPE
- OnReaderFailure(
- IWDFUsbTargetPipe * pPipe,
- HRESULT hrCompletion
- );
-
- //
- // IUsbTargetPipeContinuousReaderCallbackReadComplete
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnReaderCompletion(
- IWDFUsbTargetPipe * pPipe,
- IWDFMemory * pMemory,
- SIZE_T NumBytesTransferred,
- PVOID Context
- );
-
- // IImpersonateCallback
- virtual
- VOID
- STDMETHODCALLTYPE
- OnImpersonate(
- _In_ PVOID Context
- );
-};
-
diff --git a/usb/umdf_fx2/driver/Driver.cpp b/usb/umdf_fx2/driver/Driver.cpp
deleted file mode 100644
index d6635242..00000000
--- a/usb/umdf_fx2/driver/Driver.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR Fx2 driver's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // TODO: Do any per-device initialization (reading settings from the
- // registry for example) that's necessary before creating your
- // device callback object here. Otherwise you can leave such
- // initialization to the initialization of the device event
- // handler.
- //
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // TODO: Change any per-device settings that the object exposes before
- // calling Configure to let it complete its initialization.
- //
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/usb/umdf_fx2/driver/Driver.h b/usb/umdf_fx2/driver/Driver.h
deleted file mode 100644
index d9cafb4e..00000000
--- a/usb/umdf_fx2/driver/Driver.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF OSR Fx2 sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the OSR Fx2 sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/umdf_fx2/driver/OsrUsbFx2.ctl b/usb/umdf_fx2/driver/OsrUsbFx2.ctl
deleted file mode 100644
index 4dab56ae..00000000
--- a/usb/umdf_fx2/driver/OsrUsbFx2.ctl
+++ /dev/null
@@ -1 +0,0 @@
-da5fbdfd-1eae-4ecf-b426-a3818f325ddb WudfOsrUsbFx2TraceGuid
diff --git a/usb/umdf_fx2/driver/OsrUsbFx2.rc b/usb/umdf_fx2/driver/OsrUsbFx2.rc
deleted file mode 100644
index 36f10ea9..00000000
--- a/usb/umdf_fx2/driver/OsrUsbFx2.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// OsrUsbDevice.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF OSR USB Fx2 User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "WUDFOsrUsbFx2"
-#define VER_ORIGINALFILENAME_STR "WUDFOsrUsbFx2.dll"
-
-#include "common.ver"
diff --git a/usb/umdf_fx2/driver/ReadWriteQueue.cpp b/usb/umdf_fx2/driver/ReadWriteQueue.cpp
deleted file mode 100644
index 46144829..00000000
--- a/usb/umdf_fx2/driver/ReadWriteQueue.cpp
+++ /dev/null
@@ -1,425 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "ReadWriteQueue.tmh"
-
-VOID
-CMyReadWriteQueue::OnCompletion(
- _In_ IWDFIoRequest* pWdfRequest,
- _In_ IWDFIoTarget* pIoTarget,
- _In_ IWDFRequestCompletionParams* pParams,
- _In_ PVOID pContext
- )
-{
- UNREFERENCED_PARAMETER(pIoTarget);
- UNREFERENCED_PARAMETER(pContext);
-
- pWdfRequest->CompleteWithInformation(
- pParams->GetCompletionStatus(),
- pParams->GetInformation()
- );
-}
-
-void
-CMyReadWriteQueue::ForwardFormattedRequest(
- _In_ IWDFIoRequest* pRequest,
- _In_ IWDFIoTarget* pIoTarget
- )
-{
- //
- //First set the completion callback
- //
-
- IRequestCallbackRequestCompletion * pCompletionCallback = NULL;
- HRESULT hrQI = this->QueryInterface(IID_PPV_ARGS(&pCompletionCallback));
- WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrQI) && (NULL != pCompletionCallback));
-
- pRequest->SetCompletionCallback(
- pCompletionCallback,
- NULL
- );
-
- pCompletionCallback->Release();
- pCompletionCallback = NULL;
-
- //
- //Send down the request
- //
-
- HRESULT hrSend = S_OK;
- hrSend = pRequest->Send(pIoTarget,
- 0, //flags
- 0); //timeout
-
- if (FAILED(hrSend))
- {
- pRequest->CompleteWithInformation(hrSend, 0);
- }
-
- return;
-}
-
-
-CMyReadWriteQueue::CMyReadWriteQueue(
- _In_ PCMyDevice Device
- ) :
- CMyQueue(Device)
-{
-}
-
-//
-// Queue destructor.
-// Free up the buffer, wait for thread to terminate and
-//
-
-CMyReadWriteQueue::~CMyReadWriteQueue(
- VOID
- )
-/*++
-
-Routine Description:
-
-
- IUnknown implementation of Release
-
-Aruments:
-
-
-Return Value:
-
- ULONG (reference count after Release)
-
---*/
-{
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC! Entry"
- );
-
-}
-
-
-HRESULT
-STDMETHODCALLTYPE
-CMyReadWriteQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
-
- if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackWrite)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackWrite();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackRead)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackRead();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IRequestCallbackRequestCompletion)))
- {
- hr = S_OK;
- *Object = QueryIRequestCallbackRequestCompletion();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackIoStop)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackIoStop();
- }
- else
- {
- hr = CMyQueue::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyReadWriteQueue::CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyReadWriteQueue *Queue
- )
-/*++
-
-Routine Description:
-
-
- CreateInstance creates an instance of the queue object.
-
-Aruments:
-
- ppUkwn - OUT parameter is an IUnknown interface to the queue object
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- PCMyReadWriteQueue queue;
- HRESULT hr = S_OK;
-
- queue = new CMyReadWriteQueue(Device);
-
- if (NULL == queue)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Call the queue callback object to initialize itself. This will create
- // its partner queue framework object.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = queue->Initialize();
- }
-
- if (SUCCEEDED(hr))
- {
- *Queue = queue;
- }
- else
- {
- SAFE_RELEASE(queue);
- }
-
- return hr;
-}
-
-HRESULT
-CMyReadWriteQueue::Initialize(
- )
-{
- HRESULT hr;
-
- //
- // First initialize the base class. This will create the partner FxIoQueue
- // object and setup automatic forwarding of I/O controls.
- //
-
- hr = __super::Initialize(WdfIoQueueDispatchParallel,
- true,
- true);
-
- //
- // return the status.
- //
-
- return hr;
-}
-
-STDMETHODIMP_ (void)
-CMyReadWriteQueue::OnWrite(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToWrite
- )
-/*++
-
-Routine Description:
-
-
- Write dispatch routine
- IQueueCallbackWrite
-
-Aruments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToWrite - Lenth of bytes in the write buffer
-
- Allocate and copy data to local buffer
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC!: Queue %p Request %p BytesToTransfer %d\n",
- this,
- pWdfRequest,
- (ULONG)(ULONG_PTR)BytesToWrite
- );
-
- HRESULT hr = S_OK;
- IWDFMemory * pInputMemory = NULL;
- IWDFUsbTargetPipe * pOutputPipe = m_Device->GetOutputPipe();
-
- pWdfRequest->GetInputMemory(&pInputMemory);
-
- hr = pOutputPipe->FormatRequestForWrite(
- pWdfRequest,
- NULL, //pFile
- pInputMemory,
- NULL, //Memory offset
- NULL //DeviceOffset
- );
-
- if (FAILED(hr))
- {
- pWdfRequest->Complete(hr);
- }
- else
- {
- ForwardFormattedRequest(pWdfRequest, pOutputPipe);
- }
-
- SAFE_RELEASE(pInputMemory);
-
- return;
-}
-
-STDMETHODIMP_ (void)
-CMyReadWriteQueue::OnRead(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToRead
- )
-/*++
-
-Routine Description:
-
-
- Read dispatch routine
- IQueueCallbackRead
-
-Aruments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToRead - Lenth of bytes in the read buffer
-
- Copy available data into the read buffer
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC!: Queue %p Request %p BytesToTransfer %d\n",
- this,
- pWdfRequest,
- (ULONG)(ULONG_PTR)BytesToRead
- );
-
- HRESULT hr = S_OK;
- IWDFMemory * pOutputMemory = NULL;
-
- pWdfRequest->GetOutputMemory(&pOutputMemory);
-
- hr = m_Device->GetInputPipe()->FormatRequestForRead(
- pWdfRequest,
- NULL, //pFile
- pOutputMemory,
- NULL, //Memory offset
- NULL //DeviceOffset
- );
-
- if (FAILED(hr))
- {
- pWdfRequest->Complete(hr);
- }
- else
- {
- ForwardFormattedRequest(pWdfRequest, m_Device->GetInputPipe());
- }
-
- SAFE_RELEASE(pOutputMemory);
-
- return;
-}
-
-STDMETHODIMP_ (void)
-CMyReadWriteQueue::OnIoStop(
- _In_ IWDFIoQueue * pWdfQueue,
- _In_ IWDFIoRequest * pWdfRequest,
- _In_ ULONG ActionFlags
- )
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
-
-
- //
- // The driver owns the request and no locking constraint is safe for
- // the queue callbacks
- //
- if (ActionFlags == WdfRequestStopActionSuspend )
- {
- IWDFIoRequest2 * request2 = NULL;
- HRESULT hr;
-
- hr = pWdfRequest->QueryInterface(IID_PPV_ARGS(&request2));
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC!: Failed to QI for IWDFIoRequest2: %!hresult!",
- hr);
- return;
- }
-
- request2->StopAcknowledge(FALSE); //don't requeue
- SAFE_RELEASE(request2);
- }
- else if(ActionFlags == WdfRequestStopActionPurge)
- {
- //
- // Cancel the sent request since we are asked to purge the request
- //
-
- pWdfRequest->CancelSentRequest();
- }
-
- return;
-}
-
diff --git a/usb/umdf_fx2/driver/ReadWriteQueue.h b/usb/umdf_fx2/driver/ReadWriteQueue.h
deleted file mode 100644
index 4f1a98c1..00000000
--- a/usb/umdf_fx2/driver/ReadWriteQueue.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-#define MAX_TRANSFER_SIZE(x) 64*1024*1024
-
-//
-// Queue Callback Object.
-//
-
-class CMyReadWriteQueue :
- public IQueueCallbackRead,
- public IQueueCallbackWrite,
- public IRequestCallbackRequestCompletion,
- public IQueueCallbackIoStop,
- public CMyQueue
-{
-protected:
- HRESULT
- Initialize(
- );
-
- void
- ForwardFormattedRequest(
- _In_ IWDFIoRequest* pRequest,
- _In_ IWDFIoTarget* pIoTarget
- );
-
-public:
-
- CMyReadWriteQueue(
- _In_ PCMyDevice Device
- );
-
- virtual ~CMyReadWriteQueue();
-
- static
- HRESULT
- CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyReadWriteQueue *Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return CMyQueue::Configure();
- }
-
- IQueueCallbackWrite *
- QueryIQueueCallbackWrite(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackWrite *>(this);
- }
-
- IQueueCallbackRead *
- QueryIQueueCallbackRead(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackRead *>(this);
- }
-
- IRequestCallbackRequestCompletion *
- QueryIRequestCallbackRequestCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IRequestCallbackRequestCompletion *>(this);
- }
-
- IQueueCallbackIoStop*
- QueryIQueueCallbackIoStop(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackIoStop *>(this);
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
-
- //
- // Wdf Callbacks
- //
-
- //
- // IQueueCallbackWrite
- //
- STDMETHOD_ (void, OnWrite)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToWrite
- );
-
- //
- // IQueueCallbackRead
- //
- STDMETHOD_ (void, OnRead)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToRead
- );
-
- //
- //IRequestCallbackRequestCompletion
- //
-
- STDMETHOD_ (void, OnCompletion)(
- _In_ IWDFIoRequest* pWdfRequest,
- _In_ IWDFIoTarget* pIoTarget,
- _In_ IWDFRequestCompletionParams* pParams,
- _In_ PVOID pContext
- );
-
- //
- //IQueueCallbackIoStop
- //
-
- STDMETHOD_ (void, OnIoStop)(
- _In_ IWDFIoQueue * pWdfQueue,
- _In_ IWDFIoRequest * pWdfRequest,
- _In_ ULONG ActionFlags
- );
-
-};
diff --git a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx b/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx
deleted file mode 100644
index 9ad339b6..00000000
--- a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.inx
+++ /dev/null
Binary files differ
diff --git a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.vcxproj b/usb/umdf_fx2/driver/WUDFOsrUsbFx2.vcxproj
deleted file mode 100644
index 3a21cae8..00000000
--- a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.vcxproj
+++ /dev/null
@@ -1,281 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{6E5D412E-EF25-4DA4-B64E-6EAE67AF8D98}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <SupportsPackaging>false</SupportsPackaging>
- <RequiresPackageProject>true</RequiresPackageProject>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{87BFB278-0771-439F-893D-89376B83F7F0}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp; queue.cpp; ControlQueue.cpp; ReadWriteQueue.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="OsrUsbFx2.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFOsrUsbFx2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFOsrUsbFx2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFOsrUsbFx2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFOsrUsbFx2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\setupapi.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.vcxproj.Filters b/usb/umdf_fx2/driver/WUDFOsrUsbFx2.vcxproj.Filters
deleted file mode 100644
index 372badf0..00000000
--- a/usb/umdf_fx2/driver/WUDFOsrUsbFx2.vcxproj.Filters
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{F8E1CCD2-AADC-44B5-B631-5C6E6D74CFCD}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{0E050956-9FA9-495C-9F9F-D663EFA3A344}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{49CD21A6-260A-471B-B532-9E9E23F6195F}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{A942026F-83A0-4223-881A-29732777F22C}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ControlQueue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ReadWriteQueue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_fx2/driver/comsup.cpp b/usb/umdf_fx2/driver/comsup.cpp
deleted file mode 100644
index 2f14f588..00000000
--- a/usb/umdf_fx2/driver/comsup.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-_Use_decl_annotations_
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/usb/umdf_fx2/driver/comsup.h b/usb/umdf_fx2/driver/comsup.h
deleted file mode 100644
index 167b21ff..00000000
--- a/usb/umdf_fx2/driver/comsup.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/usb/umdf_fx2/driver/dllsup.cpp b/usb/umdf_fx2/driver/dllsup.cpp
deleted file mode 100644
index 7fda91e4..00000000
--- a/usb/umdf_fx2/driver/dllsup.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF OSR Fx2
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the driver uses
- L"Microsoft\\UMDF\\OsrUsb"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for this sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing, and saves the module handle away in a
- global variable so that it can be referenced should the COM registration
- code (Dll[Un]RegisterServer) be called.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
- UNREFERENCED_PARAMETER(ModuleHandle);
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllCanUnloadNow(
- VOID
- )
-/*++
-
- Routine Description:
-
- Called by the COM runtime when determining whether or not this module
- can be unloaded. Our answer is always "no".
-
- Arguments:
-
- None
-
- Return Value:
-
- S_FALSE
-
---*/
-{
- return S_FALSE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- REFCLSID ClassId,
- REFIID InterfaceId,
- LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- OSR Fx2 driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/usb/umdf_fx2/driver/exports.def b/usb/umdf_fx2/driver/exports.def
deleted file mode 100644
index 15f923d3..00000000
--- a/usb/umdf_fx2/driver/exports.def
+++ /dev/null
@@ -1,4 +0,0 @@
-; WudfOsrUsbDriver.def : Declares the module parameters.
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/usb/umdf_fx2/driver/internal.h b/usb/umdf_fx2/driver/internal.h
deleted file mode 100644
index 2d57793d..00000000
--- a/usb/umdf_fx2/driver/internal.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF OSR Fx2
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF Headers
-//
-
-#include "wudfddi.h"
-
-//
-// Include SetupDi functions.
-//
-
-#include "setupapi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Include the safestring functions.
-//
-
-#include "strsafe.h"
-
-//
-// Get limits on common data types (ULONG_MAX for example)
-//
-
-#include "limits.h"
-
-//
-// We need usb I/O targets to talk to the OSR device.
-//
-
-#include "wudfusb.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "public.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "WUDFOsrUsbPublic.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-
-typedef class CMyControlQueue *PCMyControlQueue;
-typedef class CMyReadWriteQueue *PCMyReadWriteQueue;
-
-typedef class CCancelCallback *PCCancelCallback;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- WudfOsrUsbFx2TraceGuid, (da5fbdfd,1eae,4ecf,b426,a3818f325ddb), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- WPP_DEFINE_BIT(TEST_TRACE_DRIVER) \
- WPP_DEFINE_BIT(TEST_TRACE_DEVICE) \
- WPP_DEFINE_BIT(TEST_TRACE_QUEUE) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
- WPP_LEVEL_LOGGER(flags)
-
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
- (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\OsrUsb"
-#define MYDRIVER_CLASS_ID {0x0865b2b0, 0x6b73, 0x428f, {0xa3, 0xea, 0x21, 0x72, 0x83, 0x2d, 0x6b, 0xfc}}
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "queue.h"
-#include "ControlQueue.h"
-#include "ReadWriteQueue.h"
-#include "list.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_TEST_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
-
-#define IDLE_TIMEOUT_IN_MSEC 10*1000
diff --git a/usb/umdf_fx2/driver/queue.cpp b/usb/umdf_fx2/driver/queue.cpp
deleted file mode 100644
index c56b38bb..00000000
--- a/usb/umdf_fx2/driver/queue.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "queue.tmh"
-
-CMyQueue::CMyQueue(
- _In_ PCMyDevice Device
- ) :
- m_FxQueue(NULL),
- m_Device(Device)
-{
-}
-
-//
-// Queue destructor.
-// Free up the buffer, wait for thread to terminate and
-//
-
-CMyQueue::~CMyQueue(
- VOID
- )
-/*++
-
-Routine Description:
-
-
- IUnknown implementation of Release
-
-Aruments:
-
-
-Return Value:
-
- ULONG (reference count after Release)
-
---*/
-{
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC! Entry"
- );
-
-}
-
-
-HRESULT
-STDMETHODCALLTYPE
-CMyQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
- hr = CUnknown::QueryInterface(InterfaceId, Object);
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyQueue::Initialize(
- _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType,
- _In_ bool Default,
- _In_ bool PowerManaged
- )
-{
- IWDFIoQueue *fxQueue;
- HRESULT hr;
-
- //
- // Create the I/O Queue object.
- //
-
- {
- IUnknown *callback = QueryIUnknown();
-
- hr = m_Device->GetFxDevice()->CreateIoQueue(
- callback,
- Default,
- DispatchType,
- PowerManaged,
- FALSE,
- &fxQueue
- );
- callback->Release();
- }
-
- if (SUCCEEDED(hr))
- {
- m_FxQueue = fxQueue;
-
- //
- // Release the creation reference on the queue. This object will be
- // destroyed before the queue so we don't need to have a reference out
- // on it.
- //
-
- fxQueue->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyQueue::Configure(
- VOID
- )
-{
- return S_OK;
-}
diff --git a/usb/umdf_fx2/driver/queue.h b/usb/umdf_fx2/driver/queue.h
deleted file mode 100644
index 5659224b..00000000
--- a/usb/umdf_fx2/driver/queue.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class CMyQueue :
- public CUnknown
-{
-protected:
- //
- // Unreferenced pointer to the partner Fx device.
- //
-
- IWDFIoQueue *m_FxQueue;
-
- //
- // Unreferenced pointer to the parent device.
- //
-
- PCMyDevice m_Device;
-
- HRESULT
- Initialize(
- _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType,
- _In_ bool Default,
- _In_ bool PowerManaged
- );
-
-protected:
-
- CMyQueue(
- _In_ PCMyDevice Device
- );
-
- virtual ~CMyQueue();
-
- HRESULT
- Configure(
- VOID
- );
-
-public:
-
- IWDFIoQueue *
- GetFxQueue(
- VOID
- )
- {
- return m_FxQueue;
- }
-
-
- PCMyDevice
- GetDevice(
- VOID
- )
- {
- return m_Device;
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/umdf_fx2/exe/WudfOsrUsbFx2Test.vcxproj b/usb/umdf_fx2/exe/WudfOsrUsbFx2Test.vcxproj
deleted file mode 100644
index 53ba424d..00000000
--- a/usb/umdf_fx2/exe/WudfOsrUsbFx2Test.vcxproj
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{B4244D54-7EBF-43D4-BB6D-C994C182C572}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{6A99CFCE-4C34-4F5D-B7D4-D810AE496B95}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WudfOsrUsbFx2Test</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WudfOsrUsbFx2Test</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WudfOsrUsbFx2Test</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WudfOsrUsbFx2Test</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <FilesToPackage Include="$(OutDir)WudfOsrUsbFx2Test.exe" />
- </ItemGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="dump.c" />
- <ClCompile Include="testapp.c" />
- <ResourceCompile Include="testapp.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inf" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/umdf_fx2/exe/WudfOsrUsbFx2Test.vcxproj.Filters b/usb/umdf_fx2/exe/WudfOsrUsbFx2Test.vcxproj.Filters
deleted file mode 100644
index a430f986..00000000
--- a/usb/umdf_fx2/exe/WudfOsrUsbFx2Test.vcxproj.Filters
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{047255FC-568B-4968-9167-306B7BC95B6D}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{4B1DCCF4-7F0A-4571-BA4F-DF378E24BD68}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{AC1DECB1-7996-4C71-8D32-0543B4C57AD4}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="dump.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="testapp.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="testapp.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/umdf_fx2/exe/dump.c b/usb/umdf_fx2/exe/dump.c
deleted file mode 100644
index aef55116..00000000
--- a/usb/umdf_fx2/exe/dump.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- DUMP.C
-
-Abstract:
-
- Routines to dump the descriptors information in a human readable form.
-
-Environment:
-
- user mode only
-
---*/
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "devioctl.h"
-
-#pragma warning(disable:4200) //
-#pragma warning(disable:4201) // nameless struct/union
-#pragma warning(disable:4214) // bit field types other than int
-
-#include <basetyps.h>
-#include "usbdi.h"
-#include "public.h"
-
-#pragma warning(default:4200)
-#pragma warning(default:4201)
-#pragma warning(default:4214)
-
-HANDLE
-OpenDevice(
- _In_ BOOL Synchronous
- );
-
-
-char*
-usbDescriptorTypeString(UCHAR bDescriptorType )
-/*++
-Routine Description:
-
- Called to get ascii string of USB descriptor
-
-Arguments:
-
- PUSB_ENDPOINT_DESCRIPTOR->bDescriptorType or
- PUSB_DEVICE_DESCRIPTOR->bDescriptorType or
- PUSB_INTERFACE_DESCRIPTOR->bDescriptorType or
- PUSB_STRING_DESCRIPTOR->bDescriptorType or
- PUSB_POWER_DESCRIPTOR->bDescriptorType or
- PUSB_CONFIGURATION_DESCRIPTOR->bDescriptorType
-
-Return Value:
-
- ptr to string
-
---*/
-{
-
- switch(bDescriptorType) {
-
- case USB_DEVICE_DESCRIPTOR_TYPE:
- return "USB_DEVICE_DESCRIPTOR_TYPE";
-
- case USB_CONFIGURATION_DESCRIPTOR_TYPE:
- return "USB_CONFIGURATION_DESCRIPTOR_TYPE";
-
-
- case USB_STRING_DESCRIPTOR_TYPE:
- return "USB_STRING_DESCRIPTOR_TYPE";
-
-
- case USB_INTERFACE_DESCRIPTOR_TYPE:
- return "USB_INTERFACE_DESCRIPTOR_TYPE";
-
-
- case USB_ENDPOINT_DESCRIPTOR_TYPE:
- return "USB_ENDPOINT_DESCRIPTOR_TYPE";
-
-
-#ifdef USB_POWER_DESCRIPTOR_TYPE // this is the older definintion which is actually obsolete
- // workaround for temporary bug in 98ddk, older USB100.h file
- case USB_POWER_DESCRIPTOR_TYPE:
- return "USB_POWER_DESCRIPTOR_TYPE";
-#endif
-
-#ifdef USB_RESERVED_DESCRIPTOR_TYPE // this is the current version of USB100.h as in NT5DDK
-
- case USB_RESERVED_DESCRIPTOR_TYPE:
- return "USB_RESERVED_DESCRIPTOR_TYPE";
-
- case USB_CONFIG_POWER_DESCRIPTOR_TYPE:
- return "USB_CONFIG_POWER_DESCRIPTOR_TYPE";
-
- case USB_INTERFACE_POWER_DESCRIPTOR_TYPE:
- return "USB_INTERFACE_POWER_DESCRIPTOR_TYPE";
-#endif // for current nt5ddk version of USB100.h
-
- default:
- return "??? UNKNOWN!!";
- }
-}
-
-
-char *
-usbEndPointTypeString(UCHAR bmAttributes)
-/*++
-Routine Description:
-
- Called to get ascii string of endpt descriptor type
-
-Arguments:
-
- PUSB_ENDPOINT_DESCRIPTOR->bmAttributes
-
-Return Value:
-
- ptr to string
-
---*/
-{
- UINT typ = bmAttributes & USB_ENDPOINT_TYPE_MASK;
-
-
- switch( typ) {
- case USB_ENDPOINT_TYPE_INTERRUPT:
- return "USB_ENDPOINT_TYPE_INTERRUPT";
-
- case USB_ENDPOINT_TYPE_BULK:
- return "USB_ENDPOINT_TYPE_BULK";
-
- case USB_ENDPOINT_TYPE_ISOCHRONOUS:
- return "USB_ENDPOINT_TYPE_ISOCHRONOUS";
-
- case USB_ENDPOINT_TYPE_CONTROL:
- return "USB_ENDPOINT_TYPE_CONTROL";
-
- default:
- return "??? UNKNOWN!!";
- }
-}
-
-
-char *
-usbConfigAttributesString(UCHAR bmAttributes)
-/*++
-Routine Description:
-
- Called to get ascii string of USB_CONFIGURATION_DESCRIPTOR attributes
-
-Arguments:
-
- PUSB_CONFIGURATION_DESCRIPTOR->bmAttributes
-
-Return Value:
-
- ptr to string
-
---*/
-{
- UINT typ = bmAttributes & USB_CONFIG_POWERED_MASK;
-
-
- switch( typ) {
-
- case USB_CONFIG_BUS_POWERED:
- return "USB_CONFIG_BUS_POWERED";
-
- case USB_CONFIG_SELF_POWERED:
- return "USB_CONFIG_SELF_POWERED";
-
- case USB_CONFIG_REMOTE_WAKEUP:
- return "USB_CONFIG_REMOTE_WAKEUP";
-
-
- default:
- return "??? UNKNOWN!!";
- }
-}
-
-
-void
-print_USB_CONFIGURATION_DESCRIPTOR(PUSB_CONFIGURATION_DESCRIPTOR cd)
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of a USB config descriptor
-
-Arguments:
-
- ptr to USB configuration descriptor
-
-Return Value:
-
- none
-
---*/
-{
- printf("\n===================\nUSB_CONFIGURATION_DESCRIPTOR\n");
-
- printf(
- "bLength = 0x%x, decimal %u\n", cd->bLength, cd->bLength
- );
-
- printf(
- "bDescriptorType = 0x%x ( %s )\n", cd->bDescriptorType,
- usbDescriptorTypeString( cd->bDescriptorType )
- );
-
- printf(
- "wTotalLength = 0x%x, decimal %u\n", cd->wTotalLength, cd->wTotalLength
- );
-
- printf(
- "bNumInterfaces = 0x%x, decimal %u\n", cd->bNumInterfaces, cd->bNumInterfaces
- );
-
- printf(
- "bConfigurationValue = 0x%x, decimal %u\n",
- cd->bConfigurationValue, cd->bConfigurationValue
- );
-
- printf(
- "iConfiguration = 0x%x, decimal %u\n", cd->iConfiguration, cd->iConfiguration
- );
-
- printf(
- "bmAttributes = 0x%x ( %s )\n", cd->bmAttributes,
- usbConfigAttributesString( cd->bmAttributes )
- );
-
- printf(
- "MaxPower = 0x%x, decimal %u\n", cd->MaxPower, cd->MaxPower
- );
-}
-
-
-void
-print_USB_INTERFACE_DESCRIPTOR(PUSB_INTERFACE_DESCRIPTOR id, UINT ix)
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of a USB interface descriptor
-
-Arguments:
-
- ptr to USB interface descriptor
-
-Return Value:
-
- none
-
---*/
-{
- printf("\n-----------------------------\nUSB_INTERFACE_DESCRIPTOR #%u\n", ix);
-
-
- printf(
- "bLength = 0x%x\n", id->bLength
- );
-
-
- printf(
- "bDescriptorType = 0x%x ( %s )\n", id->bDescriptorType,
- usbDescriptorTypeString( id->bDescriptorType )
- );
-
-
- printf(
- "bInterfaceNumber = 0x%x\n", id->bInterfaceNumber
- );
- printf(
- "bAlternateSetting = 0x%x\n", id->bAlternateSetting
- );
- printf(
- "bNumEndpoints = 0x%x\n", id->bNumEndpoints
- );
- printf(
- "bInterfaceClass = 0x%x\n", id->bInterfaceClass
- );
- printf(
- "bInterfaceSubClass = 0x%x\n", id->bInterfaceSubClass
- );
- printf(
- "bInterfaceProtocol = 0x%x\n", id->bInterfaceProtocol
- );
- printf(
- "bInterface = 0x%x\n", id->iInterface
- );
-}
-
-
-void
-print_USB_ENDPOINT_DESCRIPTOR(PUSB_ENDPOINT_DESCRIPTOR ed, int i)
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of a USB endpoint descriptor
-
-Arguments:
-
- ptr to USB endpoint descriptor,
- index of this endpt in interface desc
-
-Return Value:
-
- none
-
---*/
-{
- printf(
- "------------------------------\nUSB_ENDPOINT_DESCRIPTOR for Pipe%02d\n", i
- );
-
- printf(
- "bLength = 0x%x\n", ed->bLength
- );
-
- printf(
- "bDescriptorType = 0x%x ( %s )\n", ed->bDescriptorType,
- usbDescriptorTypeString( ed->bDescriptorType )
- );
-
- if ( USB_ENDPOINT_DIRECTION_IN( ed->bEndpointAddress ) ) {
- printf(
- "bEndpointAddress= 0x%x ( INPUT )\n", ed->bEndpointAddress
- );
- } else {
- printf(
- "bEndpointAddress= 0x%x ( OUTPUT )\n", ed->bEndpointAddress
- );
- }
-
- printf(
- "bmAttributes= 0x%x ( %s )\n", ed->bmAttributes,
- usbEndPointTypeString ( ed->bmAttributes )
- );
-
- printf(
- "wMaxPacketSize= 0x%x, decimal %u\n", ed->wMaxPacketSize,
- ed->wMaxPacketSize
- );
-
- printf(
- "bInterval = 0x%x, decimal %u\n", ed->bInterval, ed->bInterval
- );
-}
-
-
-BOOL
-DumpUsbConfig()
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of USB
- configuration, interface, and endpoint descriptors.
-
-Arguments:
-
- none
-
-Return Value:
-
- TRUE or FALSE
-
---*/
-{
- HANDLE hDev;
- UINT success;
- int siz, nBytes;
- char buf[256] = {0};
-
- hDev = OpenDevice(TRUE);
- if(hDev == INVALID_HANDLE_VALUE)
- {
- return FALSE;
- }
-
- siz = sizeof(buf);
-
- success = DeviceIoControl(hDev,
- IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR,
- NULL,
- 0,
- buf,
- siz,
- (PULONG) &nBytes,
- NULL);
-
- if(success == FALSE) {
- printf("Ioct - GetConfigDesc failed %u\n", GetLastError());
- } else {
-
- ULONG i;
- UINT j, n;
- char *pch;
- PUSB_CONFIGURATION_DESCRIPTOR cd;
- PUSB_INTERFACE_DESCRIPTOR id;
- PUSB_ENDPOINT_DESCRIPTOR ed;
-
- pch = buf;
- n = 0;
-
- cd = (PUSB_CONFIGURATION_DESCRIPTOR) pch;
-
- print_USB_CONFIGURATION_DESCRIPTOR( cd );
-
- pch += cd->bLength;
-
- do {
- id = (PUSB_INTERFACE_DESCRIPTOR) pch;
-
- print_USB_INTERFACE_DESCRIPTOR(id, n++);
-
- pch += id->bLength;
- for (j=0; j<id->bNumEndpoints; j++) {
-
- ed = (PUSB_ENDPOINT_DESCRIPTOR) pch;
-
- print_USB_ENDPOINT_DESCRIPTOR(ed,j);
-
- pch += ed->bLength;
- }
- i = (ULONG)(pch - buf);
-
- } while (i<cd->wTotalLength);
- }
-
- CloseHandle(hDev);
-
- return success;
-
-}
-
diff --git a/usb/umdf_fx2/exe/testapp.c b/usb/umdf_fx2/exe/testapp.c
deleted file mode 100644
index 4e9684e3..00000000
--- a/usb/umdf_fx2/exe/testapp.c
+++ /dev/null
@@ -1,1368 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- TESTAPP.C
-
-Abstract:
-
- Console test app for osrusbfx2 driver.
-
-Environment:
-
- user mode only
-
---*/
-
-#include <driverspecs.h>
-_Analysis_mode_(_Analysis_code_type_user_code_);
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "devioctl.h"
-#include "strsafe.h"
-
-#pragma warning(push)
-#pragma warning(disable:4200) //
-#pragma warning(disable:4201) // nameless struct/union
-#pragma warning(disable:4214) // bit field types other than int
-
-#include <setupapi.h>
-#include <basetyps.h>
-#include "usbdi.h"
-#include "public.h"
-
-#pragma warning(pop)
-
-#define WHILE(a) \
-while(__pragma(warning(disable:4127)) a __pragma(warning(disable:4127)))
-
-#define countof(x) (sizeof(x) / sizeof(x[0]))
-
-#define MAX_DEVPATH_LENGTH 256
-#define NUM_ASYNCH_IO 100
-#define BUFFER_SIZE 1024
-#define READER_TYPE 1
-#define WRITER_TYPE 2
-
-BOOL G_fDumpUsbConfig = FALSE; // flags set in response to console command line switches
-BOOL G_fDumpReadData = FALSE;
-BOOL G_fRead = FALSE;
-BOOL G_fWrite = FALSE;
-BOOL G_fPlayWithDevice = FALSE;
-BOOL G_fPerformAsyncIo = FALSE;
-ULONG G_IterationCount = 1; //count of iterations of the test we are to perform
-int G_WriteLen = 512; // #bytes to write
-int G_ReadLen = 512; // #bytes to read
-PCWSTR G_SendFileName = NULL;
-ULONG G_SendFileInterval = 1;
-
-BOOL
-DumpUsbConfig( // defined in dump.c
- );
-
-typedef enum _INPUT_FUNCTION {
- LIGHT_ONE_BAR = 1,
- CLEAR_ONE_BAR,
- LIGHT_ALL_BARS,
- CLEAR_ALL_BARS,
- GET_BAR_GRAPH_LIGHT_STATE,
- GET_SWITCH_STATE,
- GET_SWITCH_STATE_AS_INTERRUPT_MESSAGE,
- GET_7_SEGEMENT_STATE,
- SET_7_SEGEMENT_STATE,
- RESET_DEVICE,
- REENUMERATE_DEVICE,
-} INPUT_FUNCTION;
-
-_Success_ (return != FALSE)
-BOOL
-GetDevicePath(
- IN LPGUID InterfaceGuid,
- _Out_writes_(BufLen) PWSTR DevicePath,
- _In_ size_t BufLen
- )
-{
- HDEVINFO HardwareDeviceInfo;
- SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
- PSP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData = NULL;
- ULONG Length, RequiredLength = 0;
- BOOL bResult;
- HRESULT hr;
-
- HardwareDeviceInfo = SetupDiGetClassDevs(
- InterfaceGuid,
- NULL,
- NULL,
- (DIGCF_PRESENT | DIGCF_DEVICEINTERFACE));
-
- if (HardwareDeviceInfo == INVALID_HANDLE_VALUE) {
- wprintf(L"SetupDiGetClassDevs failed!\n");
- return FALSE;
- }
-
- DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
-
- bResult = SetupDiEnumDeviceInterfaces(HardwareDeviceInfo,
- 0,
- InterfaceGuid,
- 0,
- &DeviceInterfaceData);
-
- if (bResult == FALSE) {
-
- LPVOID lpMsgBuf;
-
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPWSTR) &lpMsgBuf,
- 0,
- NULL
- )) {
-
- printf("SetupDiEnumDeviceInterfaces failed: %s", (LPSTR)lpMsgBuf);
- LocalFree(lpMsgBuf);
- }
-
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- return FALSE;
- }
-
- SetupDiGetDeviceInterfaceDetail(
- HardwareDeviceInfo,
- &DeviceInterfaceData,
- NULL,
- 0,
- &RequiredLength,
- NULL
- );
-
- DeviceInterfaceDetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA)
- LocalAlloc(LMEM_FIXED, RequiredLength);
-
- if (DeviceInterfaceDetailData == NULL) {
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- wprintf(L"Failed to allocate memory.\n");
- return FALSE;
- }
-
- DeviceInterfaceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
-
- Length = RequiredLength;
-
- bResult = SetupDiGetDeviceInterfaceDetail(
- HardwareDeviceInfo,
- &DeviceInterfaceData,
- DeviceInterfaceDetailData,
- Length,
- &RequiredLength,
- NULL);
-
- if (bResult == FALSE) {
-
- LPVOID lpMsgBuf;
-
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPWSTR) &lpMsgBuf,
- 0,
- NULL)) {
-
- printf("Error in SetupDiGetDeviceInterfaceDetail: %s\n", (LPSTR)lpMsgBuf);
- LocalFree(lpMsgBuf);
- }
-
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- LocalFree(DeviceInterfaceDetailData);
- return FALSE;
- }
-
- hr = StringCchCopy(DevicePath,
- BufLen,
- DeviceInterfaceDetailData->DevicePath);
- if (FAILED(hr)) {
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- LocalFree(DeviceInterfaceDetailData);
- return FALSE;
- }
-
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- LocalFree(DeviceInterfaceDetailData);
-
- return TRUE;
-
-}
-
-
-_Check_return_
-_Ret_notnull_
-_Success_(return != INVALID_HANDLE_VALUE)
-HANDLE
-OpenDevice(
- _In_ BOOL Synchronous
- )
-
-/*++
-Routine Description:
-
- Called by main() to open an instance of our device after obtaining its name
-
-Arguments:
-
- Synchronous - TRUE, if Device is to be opened for synchronous access.
- FALSE, otherwise.
-
-Return Value:
-
- Device handle on success else INVALID_HANDLE_VALUE
-
---*/
-
-{
- HANDLE hDev;
- WCHAR completeDeviceName[MAX_DEVPATH_LENGTH];
-
- if ( !GetDevicePath(
- (LPGUID) &GUID_DEVINTERFACE_OSRUSBFX2,
- completeDeviceName,
- countof(completeDeviceName)) )
- {
- return INVALID_HANDLE_VALUE;
- }
-
- wprintf(L"DeviceName = (%s)\n", completeDeviceName);
-
- hDev = CreateFile(completeDeviceName,
- GENERIC_WRITE | GENERIC_READ,
- FILE_SHARE_WRITE | FILE_SHARE_READ,
- NULL, // default security
- OPEN_EXISTING,
- ((Synchronous ? FILE_ATTRIBUTE_NORMAL : FILE_FLAG_OVERLAPPED) | SECURITY_IMPERSONATION),
- NULL);
-
- if (hDev == INVALID_HANDLE_VALUE) {
- wprintf(L"Failed to open the device, error - %d", GetLastError());
- } else {
- wprintf(L"Opened the device successfully.\n");
- }
-
- return hDev;
-}
-
-
-
-VOID
-Usage()
-
-/*++
-Routine Description:
-
- Called by main() to dump usage info to the console when
- the app is called with no parms or with an invalid parm
-
-Arguments:
-
- None
-
-Return Value:
-
- None
-
---*/
-
-{
- wprintf(L"Usage for osrusbfx2 testapp:\n");
- wprintf(L"-r <n> where n is number of bytes to read\n");
- wprintf(L"-w <n> where n is number of bytes to write\n");
- wprintf(L"-c <n> where n is number of iterations (default = 1)\n");
- wprintf(L"-v <verbose> -- dumps read data\n");
- wprintf(L"-p to control bar LEDs, seven segment, and dip switch\n");
- wprintf(L"-a to perform asynchronous I/O\n");
- wprintf(L"-u to dump USB configuration and pipe info \n");
- wprintf(L"-f <filename> [interval-seconds] to send a text file to the seven-segment display (UMDF only)\n");
-
- return;
-}
-
-
-void
-Parse(
- _In_ int argc,
- _In_reads_(argc) LPWSTR *argv
- )
-
-/*++
-Routine Description:
-
- Called by main() to parse command line parms
-
-Arguments:
-
- argc and argv that was passed to main()
-
-Return Value:
-
- Sets global flags as per user function request
-
---*/
-
-{
- int i;
- PWSTR endchar;
-
- if ( argc < 2 ) // give usage if invoked with no parms
- Usage();
-
- for (i=0; i<argc; i++) {
- if (argv[i][0] == L'-' ||
- argv[i][0] == L'/') {
- switch(argv[i][1]) {
- case L'r':
- case L'R':
- if (i+1 >= argc) {
- Usage();
- exit(1);
- }
- else {
- G_ReadLen = wcstoul(&argv[i+1][0], &endchar, 10);
- G_fRead = TRUE;
- }
- i++;
- break;
- case L'w':
- case L'W':
- if (i+1 >= argc) {
- Usage();
- exit(1);
- }
- else {
- G_WriteLen = wcstoul(&argv[i+1][0], &endchar, 10);
- G_fWrite = TRUE;
- }
- i++;
- break;
- case L'c':
- case L'C':
- if (i+1 >= argc) {
- Usage();
- exit(1);
- }
- else {
- G_IterationCount = wcstoul(&argv[i+1][0], &endchar, 10);
- }
- i++;
- break;
- case L'f':
- case L'F':
- if (i+1 >= argc) {
- Usage();
- exit(1);
- }
- else {
- G_SendFileName = argv[i+1];
- }
-
- i++;
-
- if (i+1 < argc) {
- G_SendFileInterval = wcstoul(&argv[i+1][0], &endchar, 10);
- }
- i++;
-
- break;
- case L'u':
- case L'U':
- G_fDumpUsbConfig = TRUE;
- break;
- case L'p':
- case L'P':
- G_fPlayWithDevice = TRUE;
- break;
- case L'a':
- case L'A':
- G_fPerformAsyncIo = TRUE;
- break;
- case L'v':
- case L'V':
- G_fDumpReadData = TRUE;
- break;
- default:
- Usage();
- }
- }
- }
-}
-
-BOOL
-Compare_Buffs(
- _In_reads_bytes_(length) PVOID *buff1,
- _In_reads_bytes_(length) PVOID *buff2,
- _In_ int length
- )
-/*++
-Routine Description:
-
- Called to verify read and write buffers match for loopback test
-
-Arguments:
-
- buffers to compare and length
-
-Return Value:
-
- TRUE if buffers match, else FALSE
-
---*/
-{
- int ok = 1;
-
- if (memcmp(buff1, buff2, length )) {
- // Edi, and Esi point to the mismatching char and ecx indicates the
- // remaining length.
- ok = 0;
- }
-
- return ok;
-}
-
-#define NPERLN 8
-
-VOID
-Dump(
- UCHAR *b,
- int len
-)
-
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of the io buffer
-
-Arguments:
-
- buffer and length
-
-Return Value:
-
- none
-
---*/
-
-{
- ULONG i;
- ULONG longLen = (ULONG)len / sizeof( ULONG );
- PULONG pBuf = (PULONG) b;
-
- // dump an ordinal ULONG for each sizeof(ULONG)'th byte
- wprintf(L"\n****** BEGIN DUMP LEN decimal %d, 0x%x\n", len,len);
- for (i=0; i<longLen; i++) {
- wprintf(L"%04X ", *pBuf++);
- if (i % NPERLN == (NPERLN - 1)) {
- wprintf(L"\n");
- }
- }
- if (i % NPERLN != 0) {
- wprintf(L"\n");
- }
- wprintf(L"\n****** END DUMP LEN decimal %d, 0x%x\n", len,len);
-}
-
-
-BOOL
-PlayWithDevice()
-{
- HANDLE deviceHandle;
- DWORD code;
- ULONG index;
- INPUT_FUNCTION function;
- BAR_GRAPH_STATE barGraphState;
- ULONG bar;
- SWITCH_STATE switchState;
- UCHAR sevenSegment = 0;
- UCHAR i;
- BOOL result = FALSE;
-
- deviceHandle = OpenDevice(FALSE);
-
- if (deviceHandle == INVALID_HANDLE_VALUE) {
-
- wprintf(L"Unable to find any OSR FX2 devices!\n");
-
- return FALSE;
-
- }
-
- //
- // Infinitely print out the list of choices, ask for input, process
- // the request
- //
- WHILE(TRUE) {
-
- printf ("\nUSBFX TEST -- Functions:\n\n");
- printf ("\t1. Light Bar\n");
- printf ("\t2. Clear Bar\n");
- printf ("\t3. Light entire Bar graph\n");
- printf ("\t4. Clear entire Bar graph\n");
- printf ("\t5. Get bar graph state\n");
- printf ("\t6. Get Switch state\n");
- printf ("\t7. Get Switch Interrupt Message\n");
- printf ("\t8. Get 7 segment state\n");
- printf ("\t9. Set 7 segment state\n");
- printf ("\t10. Reset the device\n");
- printf ("\t11. Reenumerate the device\n");
- printf ("\n\t0. Exit\n");
- printf ("\n\tSelection: ");
-
- if (scanf_s ("%d", &function) <= 0) {
-
- wprintf(L"Error reading input!\n");
- goto Error;
-
- }
-
- switch(function) {
-
- case LIGHT_ONE_BAR:
-
- wprintf(L"Which Bar (input number 1 thru 8)?\n");
- if (scanf_s ("%d", &bar) <= 0) {
-
- wprintf(L"Error reading input!\n");
- goto Error;
-
- }
-
- if(bar == 0 || bar > 8){
- wprintf(L"Invalid bar number!\n");
- goto Error;
- }
-
- bar--; // normalize to 0 to 7
-
- barGraphState.BarsAsUChar = 1 << (UCHAR)bar;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY,
- &barGraphState, // Ptr to InBuffer
- sizeof(BAR_GRAPH_STATE), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- break;
-
- case CLEAR_ONE_BAR:
-
-
- wprintf(L"Which Bar (input number 1 thru 8)?\n");
- if (scanf_s ("%d", &bar) <= 0) {
-
- wprintf(L"Error reading input!\n");
- goto Error;
-
- }
-
- if(bar == 0 || bar > 8){
- wprintf(L"Invalid bar number!\n");
- goto Error;
- }
-
- bar--;
-
- //
- // Read the current state
- //
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &barGraphState, // Ptr to OutBuffer
- sizeof(BAR_GRAPH_STATE), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- if (barGraphState.BarsAsUChar & (1 << bar)) {
-
- wprintf(L"Bar is set...Clearing it\n");
- barGraphState.BarsAsUChar &= ~(1 << bar);
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY,
- &barGraphState, // Ptr to InBuffer
- sizeof(BAR_GRAPH_STATE), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
-
- }
-
- } else {
-
- wprintf(L"Bar not set.\n");
-
- }
-
- break;
-
- case LIGHT_ALL_BARS:
-
- barGraphState.BarsAsUChar = 0xFF;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY,
- &barGraphState, // Ptr to InBuffer
- sizeof(BAR_GRAPH_STATE), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- break;
-
- case CLEAR_ALL_BARS:
-
- barGraphState.BarsAsUChar = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY,
- &barGraphState, // Ptr to InBuffer
- sizeof(BAR_GRAPH_STATE), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- break;
-
-
- case GET_BAR_GRAPH_LIGHT_STATE:
-
- barGraphState.BarsAsUChar = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &barGraphState, // Ptr to OutBuffer
- sizeof(BAR_GRAPH_STATE), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"Bar Graph: \n");
- wprintf(L" Bar8 is %s\n", barGraphState.Bar8 ? L"ON" : L"OFF");
- wprintf(L" Bar7 is %s\n", barGraphState.Bar7 ? L"ON" : L"OFF");
- wprintf(L" Bar6 is %s\n", barGraphState.Bar6 ? L"ON" : L"OFF");
- wprintf(L" Bar5 is %s\n", barGraphState.Bar5 ? L"ON" : L"OFF");
- wprintf(L" Bar4 is %s\n", barGraphState.Bar4 ? L"ON" : L"OFF");
- wprintf(L" Bar3 is %s\n", barGraphState.Bar3 ? L"ON" : L"OFF");
- wprintf(L" Bar2 is %s\n", barGraphState.Bar2 ? L"ON" : L"OFF");
- wprintf(L" Bar1 is %s\n", barGraphState.Bar1 ? L"ON" : L"OFF");
-
- break;
-
- case GET_SWITCH_STATE:
-
- switchState.SwitchesAsUChar = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_READ_SWITCHES,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &switchState, // Ptr to OutBuffer
- sizeof(SWITCH_STATE), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"Switches: \n");
- wprintf(L" Switch8 is %s\n", switchState.Switch8 ? L"ON" : L"OFF");
- wprintf(L" Switch7 is %s\n", switchState.Switch7 ? L"ON" : L"OFF");
- wprintf(L" Switch6 is %s\n", switchState.Switch6 ? L"ON" : L"OFF");
- wprintf(L" Switch5 is %s\n", switchState.Switch5 ? L"ON" : L"OFF");
- wprintf(L" Switch4 is %s\n", switchState.Switch4 ? L"ON" : L"OFF");
- wprintf(L" Switch3 is %s\n", switchState.Switch3 ? L"ON" : L"OFF");
- wprintf(L" Switch2 is %s\n", switchState.Switch2 ? L"ON" : L"OFF");
- wprintf(L" Switch1 is %s\n", switchState.Switch1 ? L"ON" : L"OFF");
-
- break;
-
- case GET_SWITCH_STATE_AS_INTERRUPT_MESSAGE:
-
- switchState.SwitchesAsUChar = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &switchState, // Ptr to OutBuffer
- sizeof(switchState), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"Switches: %d\n",index);
- wprintf(L" Switch8 is %s\n", switchState.Switch8 ? L"ON" : L"OFF");
- wprintf(L" Switch7 is %s\n", switchState.Switch7 ? L"ON" : L"OFF");
- wprintf(L" Switch6 is %s\n", switchState.Switch6 ? L"ON" : L"OFF");
- wprintf(L" Switch5 is %s\n", switchState.Switch5 ? L"ON" : L"OFF");
- wprintf(L" Switch4 is %s\n", switchState.Switch4 ? L"ON" : L"OFF");
- wprintf(L" Switch3 is %s\n", switchState.Switch3 ? L"ON" : L"OFF");
- wprintf(L" Switch2 is %s\n", switchState.Switch2 ? L"ON" : L"OFF");
- wprintf(L" Switch1 is %s\n", switchState.Switch1 ? L"ON" : L"OFF");
-
- break;
-
- case GET_7_SEGEMENT_STATE:
-
- sevenSegment = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &sevenSegment, // Ptr to OutBuffer
- sizeof(UCHAR), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"7 Segment mask: 0x%x\n", sevenSegment);
- break;
-
- case SET_7_SEGEMENT_STATE:
-
- for (i = 0; i < 8; i++) {
-
- sevenSegment = 1 << i;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY,
- &sevenSegment, // Ptr to InBuffer
- sizeof(UCHAR), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"This is %d\n", i);
- Sleep(500);
-
- }
-
- wprintf(L"7 Segment mask: 0x%x\n", sevenSegment);
- break;
-
- case RESET_DEVICE:
-
- wprintf(L"Reset the device\n");
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_RESET_DEVICE,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- NULL)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- break;
-
- case REENUMERATE_DEVICE:
-
- wprintf(L"Re-enumerate the device\n");
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_REENUMERATE_DEVICE,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- NULL)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- //
- // Close the handle to the device and exit out so that
- // the driver can unload when the device is surprise-removed
- // and reenumerated.
- //
- default:
-
- result = TRUE;
- goto Error;
-
- }
-
- } // end of while loop
-
-Error:
-
- CloseHandle(deviceHandle);
- return result;
-
-}
-
-BOOL
-SendFileToDevice(
- _In_ PCWSTR FileName
- )
-{
- HANDLE deviceHandle;
-
- struct
- {
- USHORT delay;
- WCHAR buffer[MAX_PATH + 1];
- } playback;
-
- ULONG bufferCch;
-
- DWORD code;
- BOOL result = FALSE;
-
- //
- // Open a handle to the device.
- //
-
- deviceHandle = OpenDevice(FALSE);
-
- if (deviceHandle == INVALID_HANDLE_VALUE) {
-
- wprintf(L"Unable to find any OSR FX2 devices!\n");
-
- return FALSE;
-
- }
-
- //
- // Convert the file name from relative to absolute.
- //
-
- bufferCch = GetFullPathName(FileName,
- countof(playback.buffer),
- playback.buffer,
- NULL);
-
- if (bufferCch == 0)
- {
- wprintf(L"Error getting full path name for %s - %d\n",
- FileName,
- GetLastError());
- goto Error;
- }
-
- if ((G_SendFileInterval * 1000) >= ((USHORT) 0xffff))
- {
- wprintf(L"Error - delay is too large. Remember that it's in terms of seconds.\n");
- goto Error;
- }
-
- playback.delay = (USHORT) (G_SendFileInterval * 1000);
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_PLAY_FILE,
- &playback,
- sizeof(playback),
- NULL,
- 0,
- &bufferCch,
- 0)) {
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- result = TRUE;
-
-Error:
-
- CloseHandle(deviceHandle);
- return result;
-}
-
-ULONG
-AsyncIo(
- PVOID ThreadParameter
- )
-{
- HANDLE hDevice = INVALID_HANDLE_VALUE;
- HANDLE hCompletionPort = NULL;
- OVERLAPPED *pOvList = NULL;
- PUCHAR buf = NULL;
- ULONG_PTR i;
- ULONG ioType = (ULONG)(ULONG_PTR)ThreadParameter;
- ULONG error;
-
- hDevice = OpenDevice(FALSE);
-
- if (hDevice == INVALID_HANDLE_VALUE) {
- wprintf(L"Cannot open device %d\n", GetLastError());
- goto Error;
- }
-
- hCompletionPort = CreateIoCompletionPort(hDevice, NULL, 1, 0);
-
- if (hCompletionPort == NULL) {
- wprintf(L"Cannot open completion port %d \n",GetLastError());
- goto Error;
- }
-
- pOvList = (OVERLAPPED *)malloc(NUM_ASYNCH_IO * sizeof(OVERLAPPED));
-
- if (pOvList == NULL) {
- wprintf(L"Cannot allocate overlapped array \n");
- goto Error;
- }
-
- buf = (PUCHAR)malloc(NUM_ASYNCH_IO * BUFFER_SIZE);
-
- if (buf == NULL) {
- wprintf(L"Cannot allocate buffer \n");
- goto Error;
- }
-
- ZeroMemory(pOvList, NUM_ASYNCH_IO * sizeof(OVERLAPPED));
- ZeroMemory(buf, NUM_ASYNCH_IO * BUFFER_SIZE);
-
- //
- // Issue asynch I/O
- //
-
- for (i = 0; i < NUM_ASYNCH_IO; i++) {
- if (ioType == READER_TYPE) {
- if ( ReadFile( hDevice,
- buf + (i* BUFFER_SIZE),
- BUFFER_SIZE,
- NULL,
- &pOvList[i]) == 0) {
-
- error = GetLastError();
- if (error != ERROR_IO_PENDING) {
- wprintf(L" %Iu th read failed %d \n",i, GetLastError());
- goto Error;
- }
- }
-
- } else {
- if ( WriteFile( hDevice,
- buf + (i* BUFFER_SIZE),
- BUFFER_SIZE,
- NULL,
- &pOvList[i]) == 0) {
- error = GetLastError();
- if (error != ERROR_IO_PENDING) {
- wprintf(L" %Iu th write failed %d \n",i, GetLastError());
- goto Error;
- }
- }
- }
- }
-
- //
- // Wait for the I/Os to complete. If one completes then reissue the I/O
- //
-
- WHILE (1) {
- OVERLAPPED *completedOv;
- ULONG_PTR key;
- ULONG numberOfBytesTransferred;
-
- if ( GetQueuedCompletionStatus(hCompletionPort, &numberOfBytesTransferred,
- &key, &completedOv, INFINITE) == 0) {
- wprintf(L"GetQueuedCompletionStatus failed %d\n", GetLastError());
- goto Error;
- }
-
- //
- // Read successfully completed. Issue another one.
- //
-
- if (ioType == READER_TYPE) {
-
- i = completedOv - pOvList;
-
- wprintf(L"Number of bytes read by request number %Iu is %d\n",
- i, numberOfBytesTransferred);
-
- if ( ReadFile( hDevice,
- buf + (i * BUFFER_SIZE),
- BUFFER_SIZE,
- NULL,
- completedOv) == 0) {
- error = GetLastError();
- if (error != ERROR_IO_PENDING) {
- wprintf(L"%Iu th Read failed %d \n", i, GetLastError());
- goto Error;
- }
- }
- } else {
-
- i = completedOv - pOvList;
-
- wprintf(L"Number of bytes written by request number %Iu is %d\n",
- i, numberOfBytesTransferred);
-
- if ( WriteFile( hDevice,
- buf + (i * BUFFER_SIZE),
- BUFFER_SIZE,
- NULL,
- completedOv) == 0) {
- error = GetLastError();
- if (error != ERROR_IO_PENDING) {
- wprintf(L"%Iu th write failed %d \n", i, GetLastError());
- goto Error;
- }
- }
- }
- }
-
-Error:
- if (hDevice != INVALID_HANDLE_VALUE) {
- CloseHandle(hDevice);
- }
-
- if (hCompletionPort) {
- CloseHandle(hCompletionPort);
- }
-
- if (pOvList) {
- free(pOvList);
- }
- if (buf) {
- free(buf);
- }
-
- return 1;
-
-}
-
-
-int
-_cdecl
-wmain(
- _In_ int argc,
- _In_reads_(argc) LPWSTR *argv
- )
-/*++
-Routine Description:
-
- Entry point to rwbulk.exe
- Parses cmdline, performs user-requested tests
-
-Arguments:
-
- argc, argv standard console 'c' app arguments
-
-Return Value:
-
- Zero
-
---*/
-
-{
- PWSTR * pinBuf = NULL;
- PWSTR * poutBuf = NULL;
- int nBytesRead;
- int nBytesWrite;
- int ok;
- int retValue = 0;
- UINT success;
- HANDLE hRead = INVALID_HANDLE_VALUE;
- HANDLE hWrite = INVALID_HANDLE_VALUE;
- ULONG fail = 0L;
- ULONG i;
-
-
- Parse(argc, argv );
-
- //
- // dump USB configuation and pipe info
- //
- if (G_fDumpUsbConfig) {
- DumpUsbConfig();
- }
-
- if (G_fPlayWithDevice) {
- PlayWithDevice();
- goto exit;
- }
-
- if (G_SendFileName != NULL)
- {
- SendFileToDevice(G_SendFileName);
- goto exit;
- }
-
- if (G_fPerformAsyncIo) {
- HANDLE th1;
-
- //
- // Create a reader thread
- //
- th1 = CreateThread( NULL, // Default Security Attrib.
- 0, // Initial Stack Size,
- AsyncIo, // Thread Func
- (LPVOID)READER_TYPE,
- 0, // Creation Flags
- NULL ); // Don't need the Thread Id.
-
- if (th1 == NULL) {
- wprintf(L"Couldn't create reader thread - error %d\n", GetLastError());
- retValue = 1;
- goto exit;
- }
-
- //
- // Use this thread for peforming write.
- //
- AsyncIo((PVOID)WRITER_TYPE);
-
- goto exit;
- }
-
- //
- // doing a read, write, or both test
- //
- if ((G_fRead) || (G_fWrite)) {
-
- if (G_fRead) {
- if ( G_fDumpReadData ) { // round size to sizeof ULONG for readable dumping
- while( G_ReadLen % sizeof( ULONG ) ) {
- G_ReadLen++;
- }
- }
-
- //
- // open the output file
- //
- hRead = OpenDevice(TRUE);
- if(hRead == INVALID_HANDLE_VALUE) {
- retValue = 1;
- goto exit;
- }
-
- pinBuf = malloc(G_ReadLen);
- }
-
- if (G_fWrite) {
- if ( G_fDumpReadData ) { // round size to sizeof ULONG for readable dumping
- while( G_WriteLen % sizeof( ULONG ) ) {
- G_WriteLen++;
- }
- }
-
- //
- // open the output file
- //
- hWrite = OpenDevice(TRUE);
- if(hWrite == INVALID_HANDLE_VALUE) {
- retValue = 1;
- goto exit;
- }
-
- poutBuf = malloc(G_WriteLen);
- if (poutBuf == NULL) {
- retValue = 1;
- goto exit;
- }
- }
-
- for (i = 0; i < G_IterationCount; i++) {
- ULONG j;
-
- if (G_fWrite && poutBuf && hWrite != INVALID_HANDLE_VALUE) {
-
- PULONG pOut = (PULONG) poutBuf;
- ULONG numLongs = G_WriteLen / sizeof( ULONG );
-
- //
- // put some data in the output buffer
- //
- for (j=0; j<numLongs; j++) {
- *(pOut+j) = j;
- }
-
- //
- // send the write
- //
- success = WriteFile(hWrite, poutBuf, G_WriteLen, (PULONG) &nBytesWrite, NULL);
- if(success == 0) {
- wprintf(L"WriteFile failed - error %d\n", GetLastError());
- retValue = 1;
- goto exit;
- }
- wprintf(L"Write (%04.4d) : request %06.6d bytes -- %06.6d bytes written\n",
- i, G_WriteLen, nBytesWrite);
-
- assert(nBytesWrite == G_WriteLen);
- }
-
- if (G_fRead && pinBuf) {
-
- success = ReadFile(hRead, pinBuf, G_ReadLen, (PULONG) &nBytesRead, NULL);
- if(success == 0) {
- wprintf(L"ReadFile failed - error %d\n", GetLastError());
- retValue = 1;
- goto exit;
- }
-
- wprintf(L"Read (%04.4d) : request %06.6d bytes -- %06.6d bytes read\n",
- i, G_ReadLen, nBytesRead);
-
- if (G_fWrite) {
-
- //
- // validate the input buffer against what
- // we sent to the 82930 (loopback test)
- //
-
- ok = Compare_Buffs(pinBuf, poutBuf, nBytesRead);
-
- if( G_fDumpReadData ) {
- wprintf(L"Dumping read buffer\n");
- Dump( (PUCHAR) pinBuf, nBytesRead );
- wprintf(L"Dumping write buffer\n");
- Dump( (PUCHAR) poutBuf, nBytesRead );
- }
- assert(ok);
-
- if(ok != 1) {
- fail++;
- }
-
- assert(G_ReadLen == G_WriteLen);
- assert(nBytesRead == G_ReadLen);
- }
- }
- }
-
- }
-
-exit:
-
- if (pinBuf) {
- free(pinBuf);
- }
-
- if (poutBuf) {
- free(poutBuf);
- }
-
- // close devices if needed
- if (hRead != INVALID_HANDLE_VALUE) {
- CloseHandle(hRead);
- }
-
- if (hWrite != INVALID_HANDLE_VALUE) {
- _Analysis_assume_(hWrite != NULL);
- CloseHandle(hWrite);
- }
-
- return retValue;
-}
-
-
-
-
diff --git a/usb/umdf_fx2/exe/testapp.rc b/usb/umdf_fx2/exe/testapp.rc
deleted file mode 100644
index 28dd29d7..00000000
--- a/usb/umdf_fx2/exe/testapp.rc
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <windows.h>
-
-#include <ntverp.h>
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT2_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "OSRUSBFX2 Bulk & Isoch Read and Write test App for UMDF"
-#define VER_INTERNALNAME_STR "WudfOsrUsbFx2Test.exe"
-#define VER_ORIGINALFILENAME_STR "WudfOsrUsbFx2Test.exe"
-
-#include <common.ver>
-
-
diff --git a/usb/umdf_fx2/inc/WUDFOsrUsbPublic.h b/usb/umdf_fx2/inc/WUDFOsrUsbPublic.h
deleted file mode 100644
index 6681fa14..00000000
--- a/usb/umdf_fx2/inc/WUDFOsrUsbPublic.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- WUDFOsrUsbPublic.h
-
-Abstract:
-
- This module contains the common declarations shared by driver
- and user applications for the UMDF OSR device sample.
-
- Note that this driver does NOT use the same device interface GUID
- as the KMDF OSR USB sample.
-
-Environment:
-
- user and kernel
-
---*/
-
-#pragma once
-
-//
-// Define an Interface Guid so that app can find the device and talk to it.
-//
-
-// {573E8C73-0CB4-4471-A1BF-FAB26C31D384}
-DEFINE_GUID(GUID_DEVINTERFACE_OSRUSBFX2,
- 0x573e8c73, 0xcb4, 0x4471, 0xa1, 0xbf, 0xfa, 0xb2, 0x6c, 0x31, 0xd3, 0x84);
-
diff --git a/usb/umdf_fx2/inc/list.h b/usb/umdf_fx2/inc/list.h
deleted file mode 100644
index 38d0b1e9..00000000
--- a/usb/umdf_fx2/inc/list.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- list.h
-
-Abstract:
-
- This module contains doubly linked list macros
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-FORCEINLINE
-VOID
-InitializeListHead(
- IN PLIST_ENTRY ListHead
- )
-{
- ListHead->Flink = ListHead->Blink = ListHead;
-}
-
-FORCEINLINE
-BOOLEAN
-RemoveEntryList(
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
- PLIST_ENTRY Flink;
-
- Flink = Entry->Flink;
- Blink = Entry->Blink;
- Blink->Flink = Flink;
- Flink->Blink = Blink;
- return (BOOLEAN)(Flink == Blink);
-}
-
-FORCEINLINE
-VOID
-InsertHeadList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Flink;
-
- Flink = ListHead->Flink;
- Entry->Flink = Flink;
- Entry->Blink = ListHead;
- Flink->Blink = Entry;
- ListHead->Flink = Entry;
-}
-
-FORCEINLINE
-VOID
-InsertTailList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
-
- Blink = ListHead->Blink;
- Entry->Flink = ListHead;
- Entry->Blink = Blink;
- Blink->Flink = Entry;
- ListHead->Blink = Entry;
-}
diff --git a/usb/umdf_fx2/inc/public.h b/usb/umdf_fx2/inc/public.h
deleted file mode 100644
index 2c3f6805..00000000
--- a/usb/umdf_fx2/inc/public.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- public.h
-
-Abstract:
-
- Public definitions for the OSR_FX2 device operations.
-
-Environment:
-
- User & Kernel mode
-
---*/
-
-#ifndef _PUBLIC_H
-#define _PUBLIC_H
-
-#include <initguid.h>
-
-#include "WudfOsrUsbPublic.h"
-
-
-//
-// Define the structures that will be used by the IOCTL
-// interface to the driver
-//
-
-//
-// BAR_GRAPH_STATE
-//
-// BAR_GRAPH_STATE is a bit field structure with each
-// bit corresponding to one of the bar graph on the
-// OSRFX2 Development Board
-//
-#include <pshpack1.h>
-
-#pragma warning( push )
-#pragma warning( disable : 4201 ) // nameless struct/union
-#pragma warning( disable : 4214 ) // bit-field type other than int
-
-typedef struct _BAR_GRAPH_STATE {
-
- union {
-
- struct {
- //
- // Individual bars starting from the
- // top of the stack of bars
- //
- // NOTE: There are actually 10 bars,
- // but the very top two do not light
- // and are not counted here
- //
- UCHAR Bar1 : 1;
- UCHAR Bar2 : 1;
- UCHAR Bar3 : 1;
- UCHAR Bar4 : 1;
- UCHAR Bar5 : 1;
- UCHAR Bar6 : 1;
- UCHAR Bar7 : 1;
- UCHAR Bar8 : 1;
- };
-
- //
- // The state of all the bar graph as a single
- // UCHAR
- //
- UCHAR BarsAsUChar;
-
- };
-
-}BAR_GRAPH_STATE, *PBAR_GRAPH_STATE;
-
-//
-// SWITCH_STATE
-//
-// SWITCH_STATE is a bit field structure with each
-// bit corresponding to one of the switches on the
-// OSRFX2 Development Board
-//
-typedef struct _SWITCH_STATE {
-
- union {
- struct {
- //
- // Individual switches starting from the
- // left of the set of switches
- //
- UCHAR Switch1 : 1;
- UCHAR Switch2 : 1;
- UCHAR Switch3 : 1;
- UCHAR Switch4 : 1;
- UCHAR Switch5 : 1;
- UCHAR Switch6 : 1;
- UCHAR Switch7 : 1;
- UCHAR Switch8 : 1;
- };
-
- //
- // The state of all the switches as a single
- // UCHAR
- //
- UCHAR SwitchesAsUChar;
-
- };
-
-
-}SWITCH_STATE, *PSWITCH_STATE;
-
-//
-// Seven segment display bit values.
-//
-
-//
-// Undefine conflicting MFC constant
-//
-#undef SS_CENTER
-#undef SS_LEFT
-#undef SS_RIGHT
-
-#define SS_TOP 0x01
-#define SS_TOP_LEFT 0x40
-#define SS_TOP_RIGHT 0x02
-#define SS_CENTER 0x20
-#define SS_BOTTOM_LEFT 0x10
-#define SS_BOTTOM_RIGHT 0x04
-#define SS_BOTTOM 0x80
-#define SS_DOT 0x08
-
-//
-// FILE_PLAYBACK
-//
-// FILE_PLAYBACK structure contains the parameters for the PLAY_FILE I/O Control.
-//
-
-typedef struct _FILE_PLAYBACK
-{
- //
- // The delay between changes in the display, in milliseconds.
- //
-
- USHORT Delay;
-
- //
- // The data file path.
- //
-
- WCHAR Path[1];
-} FILE_PLAYBACK, *PFILE_PLAYBACK;
-
-#include <poppack.h>
-
-#define IOCTL_INDEX 0x800
-#define FILE_DEVICE_OSRUSBFX2 65500U
-
-#define IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-#define IOCTL_OSRUSBFX2_RESET_DEVICE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 1, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_REENUMERATE_DEVICE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 3, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 4, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 5, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_READ_SWITCHES CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 6, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 7, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 8, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 9, \
- METHOD_OUT_DIRECT, \
- FILE_READ_ACCESS)
-
-#define IOCTL_OSRUSBFX2_PLAY_FILE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 10, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#pragma warning(pop)
-
-#endif
-
diff --git a/usb/umdf_fx2/inc/usb_hw.h b/usb/umdf_fx2/inc/usb_hw.h
deleted file mode 100644
index d6e983f1..00000000
--- a/usb/umdf_fx2/inc/usb_hw.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- Usb.h
-
-Abstract:
-
- Contains prototypes for interfacing with a USB connected device. These
- are copied from the KMDF WDFUSB.H header file (but with the WDF specific
- portions removed)
-
-Environment:
-
- kernel mode only
-
---*/
-
-#pragma once
-
-typedef enum _WINUSB_BMREQUEST_DIRECTION {
- BmRequestHostToDevice = BMREQUEST_HOST_TO_DEVICE,
- BmRequestDeviceToHost = BMREQUEST_DEVICE_TO_HOST,
-} WINUSB_BMREQUEST_DIRECTION;
-
-typedef enum _WINUSB_BMREQUEST_TYPE {
- BmRequestStandard = BMREQUEST_STANDARD,
- BmRequestClass = BMREQUEST_CLASS,
- BmRequestVendor = BMREQUEST_VENDOR,
-} WINUSB_BMREQUEST_TYPE;
-
-typedef enum _WINUSB_BMREQUEST_RECIPIENT {
- BmRequestToDevice = BMREQUEST_TO_DEVICE,
- BmRequestToInterface = BMREQUEST_TO_INTERFACE,
- BmRequestToEndpoint = BMREQUEST_TO_ENDPOINT,
- BmRequestToOther = BMREQUEST_TO_OTHER,
-} WINUSB_BMREQUEST_RECIPIENT;
-
-typedef enum _WINUSB_DEVICE_TRAITS {
- WINUSB_DEVICE_TRAIT_SELF_POWERED = 0x00000001,
- WINUSB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE = 0x00000002,
- WINUSB_DEVICE_TRAIT_AT_HIGH_SPEED = 0x00000004,
-} WINUSB_DEVICE_TRAITS;
-
-typedef enum _WdfUsbTargetDeviceSelectInterfaceType {
- WdfUsbTargetDeviceSelectInterfaceTypeInterface = 0x10,
- WdfUsbTargetDeviceSelectInterfaceTypeUrb = 0x11,
-} WdfUsbTargetDeviceSelectInterfaceType;
-
-
-
-typedef union _WINUSB_CONTROL_SETUP_PACKET {
- struct {
- union {
- #pragma warning(disable:4214) // bit field types other than int
- struct {
- //
- // Valid values are BMREQUEST_TO_DEVICE, BMREQUEST_TO_INTERFACE,
- // BMREQUEST_TO_ENDPOINT, BMREQUEST_TO_OTHER
- //
- BYTE Recipient:2;
-
- BYTE Reserved:3;
-
- //
- // Valid values are BMREQUEST_STANDARD, BMREQUEST_CLASS,
- // BMREQUEST_VENDOR
- //
- BYTE Type:2;
-
- //
- // Valid values are BMREQUEST_HOST_TO_DEVICE,
- // BMREQUEST_DEVICE_TO_HOST
- //
- BYTE Dir:1;
- } Request;
- #pragma warning(default:4214) // bit field types other than int
- BYTE Byte;
- } bm;
-
- BYTE bRequest;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wValue;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wIndex;
-
- USHORT wLength;
- } Packet;
-
- struct {
- BYTE Bytes[8];
- } Generic;
-
- WINUSB_SETUP_PACKET WinUsb;
-
-} WINUSB_CONTROL_SETUP_PACKET, *PWINUSB_CONTROL_SETUP_PACKET;
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_CLASS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestClass;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_VENDOR(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestVendor;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_FEATURE(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT FeatureSelector,
- USHORT Index,
- BOOLEAN SetFeature
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestHostToDevice;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- if (SetFeature) {
- Packet->Packet.bRequest = USB_REQUEST_SET_FEATURE;
- }
- else {
- Packet->Packet.bRequest = USB_REQUEST_CLEAR_FEATURE;
- }
-
- Packet->Packet.wValue.Value = FeatureSelector;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_GET_STATUS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestDeviceToHost;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- Packet->Packet.bRequest = USB_REQUEST_GET_STATUS;
- Packet->Packet.wIndex.Value = Index;
- Packet->Packet.wValue.Value = 0;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
diff --git a/usb/umdf_fx2/umdf_fx2.sln b/usb/umdf_fx2/umdf_fx2.sln
deleted file mode 100644
index c67f4db3..00000000
--- a/usb/umdf_fx2/umdf_fx2.sln
+++ /dev/null
@@ -1,46 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0
-MinimumVisualStudioVersion = 12.0
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Driver", "Driver", "{0F58CCC8-C87F-436A-8155-C5A9C20AE3A0}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Exe", "Exe", "{F891F391-8DC0-4256-B1E3-993DE7A0DEFF}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFOsrUsbFx2", "driver\WUDFOsrUsbFx2.vcxproj", "{E73991B4-029F-448E-9CA8-0827CBE1EF0E}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WudfOsrUsbFx2Test", "exe\WudfOsrUsbFx2Test.vcxproj", "{F0965B23-D0A3-4587-85A3-FA4B20F2051D}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- Debug|x64 = Debug|x64
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {E73991B4-029F-448E-9CA8-0827CBE1EF0E}.Debug|Win32.ActiveCfg = Debug|Win32
- {E73991B4-029F-448E-9CA8-0827CBE1EF0E}.Debug|Win32.Build.0 = Debug|Win32
- {E73991B4-029F-448E-9CA8-0827CBE1EF0E}.Release|Win32.ActiveCfg = Release|Win32
- {E73991B4-029F-448E-9CA8-0827CBE1EF0E}.Release|Win32.Build.0 = Release|Win32
- {E73991B4-029F-448E-9CA8-0827CBE1EF0E}.Debug|x64.ActiveCfg = Debug|x64
- {E73991B4-029F-448E-9CA8-0827CBE1EF0E}.Debug|x64.Build.0 = Debug|x64
- {E73991B4-029F-448E-9CA8-0827CBE1EF0E}.Release|x64.ActiveCfg = Release|x64
- {E73991B4-029F-448E-9CA8-0827CBE1EF0E}.Release|x64.Build.0 = Release|x64
- {F0965B23-D0A3-4587-85A3-FA4B20F2051D}.Debug|Win32.ActiveCfg = Debug|Win32
- {F0965B23-D0A3-4587-85A3-FA4B20F2051D}.Debug|Win32.Build.0 = Debug|Win32
- {F0965B23-D0A3-4587-85A3-FA4B20F2051D}.Release|Win32.ActiveCfg = Release|Win32
- {F0965B23-D0A3-4587-85A3-FA4B20F2051D}.Release|Win32.Build.0 = Release|Win32
- {F0965B23-D0A3-4587-85A3-FA4B20F2051D}.Debug|x64.ActiveCfg = Debug|x64
- {F0965B23-D0A3-4587-85A3-FA4B20F2051D}.Debug|x64.Build.0 = Debug|x64
- {F0965B23-D0A3-4587-85A3-FA4B20F2051D}.Release|x64.ActiveCfg = Release|x64
- {F0965B23-D0A3-4587-85A3-FA4B20F2051D}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {E73991B4-029F-448E-9CA8-0827CBE1EF0E} = {0F58CCC8-C87F-436A-8155-C5A9C20AE3A0}
- {F0965B23-D0A3-4587-85A3-FA4B20F2051D} = {F891F391-8DC0-4256-B1E3-993DE7A0DEFF}
- EndGlobalSection
-EndGlobal
diff --git a/usb/wdf_osrfx2_lab/README.md b/usb/wdf_osrfx2_lab/README.md
index aee7a886..d24a43d0 100644
--- a/usb/wdf_osrfx2_lab/README.md
+++ b/usb/wdf_osrfx2_lab/README.md
@@ -10,6 +10,13 @@ products:
# WDF Sample Driver Learning Lab for OSR USB-FX2
+> [!WARNING]
+> UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2.
+>
+> For more info, see [Getting Started with UMDF](https://docs.microsoft.com/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2).
+>
+> The UMDF v1 sample can be accessed using `git checkout win11-22h2`. A direct link is: https://github.com/microsoft/Windows-driver-samples/tree/win11-22h2
+
The wdf\_osrfx2\_lab sample contains a console test application and a series of iterative drivers for both Kernel-Mode Driver Framework (KMDF) and User-Mode Driver Framework (UMDF) version 1.
In the Windows Driver Kit (WDK) for Windows 7 and earlier versions of Windows, the osrusbfx2 sample demonstrated how to perform bulk and interrupt data transfers to an USB device. The sample was written for the OSR USB-FX2 Learning Kit.
diff --git a/usb/wdf_osrfx2_lab/umdf/exe/WudfOsrUsbFx2Test.vcxproj b/usb/wdf_osrfx2_lab/umdf/exe/WudfOsrUsbFx2Test.vcxproj
deleted file mode 100644
index 53ba424d..00000000
--- a/usb/wdf_osrfx2_lab/umdf/exe/WudfOsrUsbFx2Test.vcxproj
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{B4244D54-7EBF-43D4-BB6D-C994C182C572}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{6A99CFCE-4C34-4F5D-B7D4-D810AE496B95}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WudfOsrUsbFx2Test</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WudfOsrUsbFx2Test</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WudfOsrUsbFx2Test</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WudfOsrUsbFx2Test</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);BUILT_IN_DDK=1;UNICODE=1;_UNICODE=1</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\inc;..\..\inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib</AdditionalDependencies>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <FilesToPackage Include="$(OutDir)WudfOsrUsbFx2Test.exe" />
- </ItemGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="dump.c" />
- <ClCompile Include="testapp.c" />
- <ResourceCompile Include="testapp.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inf" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/exe/WudfOsrUsbFx2Test.vcxproj.Filters b/usb/wdf_osrfx2_lab/umdf/exe/WudfOsrUsbFx2Test.vcxproj.Filters
deleted file mode 100644
index a430f986..00000000
--- a/usb/wdf_osrfx2_lab/umdf/exe/WudfOsrUsbFx2Test.vcxproj.Filters
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{047255FC-568B-4968-9167-306B7BC95B6D}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{4B1DCCF4-7F0A-4571-BA4F-DF378E24BD68}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{AC1DECB1-7996-4C71-8D32-0543B4C57AD4}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="dump.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="testapp.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="testapp.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/exe/dump.c b/usb/wdf_osrfx2_lab/umdf/exe/dump.c
deleted file mode 100644
index aef55116..00000000
--- a/usb/wdf_osrfx2_lab/umdf/exe/dump.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- DUMP.C
-
-Abstract:
-
- Routines to dump the descriptors information in a human readable form.
-
-Environment:
-
- user mode only
-
---*/
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "devioctl.h"
-
-#pragma warning(disable:4200) //
-#pragma warning(disable:4201) // nameless struct/union
-#pragma warning(disable:4214) // bit field types other than int
-
-#include <basetyps.h>
-#include "usbdi.h"
-#include "public.h"
-
-#pragma warning(default:4200)
-#pragma warning(default:4201)
-#pragma warning(default:4214)
-
-HANDLE
-OpenDevice(
- _In_ BOOL Synchronous
- );
-
-
-char*
-usbDescriptorTypeString(UCHAR bDescriptorType )
-/*++
-Routine Description:
-
- Called to get ascii string of USB descriptor
-
-Arguments:
-
- PUSB_ENDPOINT_DESCRIPTOR->bDescriptorType or
- PUSB_DEVICE_DESCRIPTOR->bDescriptorType or
- PUSB_INTERFACE_DESCRIPTOR->bDescriptorType or
- PUSB_STRING_DESCRIPTOR->bDescriptorType or
- PUSB_POWER_DESCRIPTOR->bDescriptorType or
- PUSB_CONFIGURATION_DESCRIPTOR->bDescriptorType
-
-Return Value:
-
- ptr to string
-
---*/
-{
-
- switch(bDescriptorType) {
-
- case USB_DEVICE_DESCRIPTOR_TYPE:
- return "USB_DEVICE_DESCRIPTOR_TYPE";
-
- case USB_CONFIGURATION_DESCRIPTOR_TYPE:
- return "USB_CONFIGURATION_DESCRIPTOR_TYPE";
-
-
- case USB_STRING_DESCRIPTOR_TYPE:
- return "USB_STRING_DESCRIPTOR_TYPE";
-
-
- case USB_INTERFACE_DESCRIPTOR_TYPE:
- return "USB_INTERFACE_DESCRIPTOR_TYPE";
-
-
- case USB_ENDPOINT_DESCRIPTOR_TYPE:
- return "USB_ENDPOINT_DESCRIPTOR_TYPE";
-
-
-#ifdef USB_POWER_DESCRIPTOR_TYPE // this is the older definintion which is actually obsolete
- // workaround for temporary bug in 98ddk, older USB100.h file
- case USB_POWER_DESCRIPTOR_TYPE:
- return "USB_POWER_DESCRIPTOR_TYPE";
-#endif
-
-#ifdef USB_RESERVED_DESCRIPTOR_TYPE // this is the current version of USB100.h as in NT5DDK
-
- case USB_RESERVED_DESCRIPTOR_TYPE:
- return "USB_RESERVED_DESCRIPTOR_TYPE";
-
- case USB_CONFIG_POWER_DESCRIPTOR_TYPE:
- return "USB_CONFIG_POWER_DESCRIPTOR_TYPE";
-
- case USB_INTERFACE_POWER_DESCRIPTOR_TYPE:
- return "USB_INTERFACE_POWER_DESCRIPTOR_TYPE";
-#endif // for current nt5ddk version of USB100.h
-
- default:
- return "??? UNKNOWN!!";
- }
-}
-
-
-char *
-usbEndPointTypeString(UCHAR bmAttributes)
-/*++
-Routine Description:
-
- Called to get ascii string of endpt descriptor type
-
-Arguments:
-
- PUSB_ENDPOINT_DESCRIPTOR->bmAttributes
-
-Return Value:
-
- ptr to string
-
---*/
-{
- UINT typ = bmAttributes & USB_ENDPOINT_TYPE_MASK;
-
-
- switch( typ) {
- case USB_ENDPOINT_TYPE_INTERRUPT:
- return "USB_ENDPOINT_TYPE_INTERRUPT";
-
- case USB_ENDPOINT_TYPE_BULK:
- return "USB_ENDPOINT_TYPE_BULK";
-
- case USB_ENDPOINT_TYPE_ISOCHRONOUS:
- return "USB_ENDPOINT_TYPE_ISOCHRONOUS";
-
- case USB_ENDPOINT_TYPE_CONTROL:
- return "USB_ENDPOINT_TYPE_CONTROL";
-
- default:
- return "??? UNKNOWN!!";
- }
-}
-
-
-char *
-usbConfigAttributesString(UCHAR bmAttributes)
-/*++
-Routine Description:
-
- Called to get ascii string of USB_CONFIGURATION_DESCRIPTOR attributes
-
-Arguments:
-
- PUSB_CONFIGURATION_DESCRIPTOR->bmAttributes
-
-Return Value:
-
- ptr to string
-
---*/
-{
- UINT typ = bmAttributes & USB_CONFIG_POWERED_MASK;
-
-
- switch( typ) {
-
- case USB_CONFIG_BUS_POWERED:
- return "USB_CONFIG_BUS_POWERED";
-
- case USB_CONFIG_SELF_POWERED:
- return "USB_CONFIG_SELF_POWERED";
-
- case USB_CONFIG_REMOTE_WAKEUP:
- return "USB_CONFIG_REMOTE_WAKEUP";
-
-
- default:
- return "??? UNKNOWN!!";
- }
-}
-
-
-void
-print_USB_CONFIGURATION_DESCRIPTOR(PUSB_CONFIGURATION_DESCRIPTOR cd)
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of a USB config descriptor
-
-Arguments:
-
- ptr to USB configuration descriptor
-
-Return Value:
-
- none
-
---*/
-{
- printf("\n===================\nUSB_CONFIGURATION_DESCRIPTOR\n");
-
- printf(
- "bLength = 0x%x, decimal %u\n", cd->bLength, cd->bLength
- );
-
- printf(
- "bDescriptorType = 0x%x ( %s )\n", cd->bDescriptorType,
- usbDescriptorTypeString( cd->bDescriptorType )
- );
-
- printf(
- "wTotalLength = 0x%x, decimal %u\n", cd->wTotalLength, cd->wTotalLength
- );
-
- printf(
- "bNumInterfaces = 0x%x, decimal %u\n", cd->bNumInterfaces, cd->bNumInterfaces
- );
-
- printf(
- "bConfigurationValue = 0x%x, decimal %u\n",
- cd->bConfigurationValue, cd->bConfigurationValue
- );
-
- printf(
- "iConfiguration = 0x%x, decimal %u\n", cd->iConfiguration, cd->iConfiguration
- );
-
- printf(
- "bmAttributes = 0x%x ( %s )\n", cd->bmAttributes,
- usbConfigAttributesString( cd->bmAttributes )
- );
-
- printf(
- "MaxPower = 0x%x, decimal %u\n", cd->MaxPower, cd->MaxPower
- );
-}
-
-
-void
-print_USB_INTERFACE_DESCRIPTOR(PUSB_INTERFACE_DESCRIPTOR id, UINT ix)
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of a USB interface descriptor
-
-Arguments:
-
- ptr to USB interface descriptor
-
-Return Value:
-
- none
-
---*/
-{
- printf("\n-----------------------------\nUSB_INTERFACE_DESCRIPTOR #%u\n", ix);
-
-
- printf(
- "bLength = 0x%x\n", id->bLength
- );
-
-
- printf(
- "bDescriptorType = 0x%x ( %s )\n", id->bDescriptorType,
- usbDescriptorTypeString( id->bDescriptorType )
- );
-
-
- printf(
- "bInterfaceNumber = 0x%x\n", id->bInterfaceNumber
- );
- printf(
- "bAlternateSetting = 0x%x\n", id->bAlternateSetting
- );
- printf(
- "bNumEndpoints = 0x%x\n", id->bNumEndpoints
- );
- printf(
- "bInterfaceClass = 0x%x\n", id->bInterfaceClass
- );
- printf(
- "bInterfaceSubClass = 0x%x\n", id->bInterfaceSubClass
- );
- printf(
- "bInterfaceProtocol = 0x%x\n", id->bInterfaceProtocol
- );
- printf(
- "bInterface = 0x%x\n", id->iInterface
- );
-}
-
-
-void
-print_USB_ENDPOINT_DESCRIPTOR(PUSB_ENDPOINT_DESCRIPTOR ed, int i)
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of a USB endpoint descriptor
-
-Arguments:
-
- ptr to USB endpoint descriptor,
- index of this endpt in interface desc
-
-Return Value:
-
- none
-
---*/
-{
- printf(
- "------------------------------\nUSB_ENDPOINT_DESCRIPTOR for Pipe%02d\n", i
- );
-
- printf(
- "bLength = 0x%x\n", ed->bLength
- );
-
- printf(
- "bDescriptorType = 0x%x ( %s )\n", ed->bDescriptorType,
- usbDescriptorTypeString( ed->bDescriptorType )
- );
-
- if ( USB_ENDPOINT_DIRECTION_IN( ed->bEndpointAddress ) ) {
- printf(
- "bEndpointAddress= 0x%x ( INPUT )\n", ed->bEndpointAddress
- );
- } else {
- printf(
- "bEndpointAddress= 0x%x ( OUTPUT )\n", ed->bEndpointAddress
- );
- }
-
- printf(
- "bmAttributes= 0x%x ( %s )\n", ed->bmAttributes,
- usbEndPointTypeString ( ed->bmAttributes )
- );
-
- printf(
- "wMaxPacketSize= 0x%x, decimal %u\n", ed->wMaxPacketSize,
- ed->wMaxPacketSize
- );
-
- printf(
- "bInterval = 0x%x, decimal %u\n", ed->bInterval, ed->bInterval
- );
-}
-
-
-BOOL
-DumpUsbConfig()
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of USB
- configuration, interface, and endpoint descriptors.
-
-Arguments:
-
- none
-
-Return Value:
-
- TRUE or FALSE
-
---*/
-{
- HANDLE hDev;
- UINT success;
- int siz, nBytes;
- char buf[256] = {0};
-
- hDev = OpenDevice(TRUE);
- if(hDev == INVALID_HANDLE_VALUE)
- {
- return FALSE;
- }
-
- siz = sizeof(buf);
-
- success = DeviceIoControl(hDev,
- IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR,
- NULL,
- 0,
- buf,
- siz,
- (PULONG) &nBytes,
- NULL);
-
- if(success == FALSE) {
- printf("Ioct - GetConfigDesc failed %u\n", GetLastError());
- } else {
-
- ULONG i;
- UINT j, n;
- char *pch;
- PUSB_CONFIGURATION_DESCRIPTOR cd;
- PUSB_INTERFACE_DESCRIPTOR id;
- PUSB_ENDPOINT_DESCRIPTOR ed;
-
- pch = buf;
- n = 0;
-
- cd = (PUSB_CONFIGURATION_DESCRIPTOR) pch;
-
- print_USB_CONFIGURATION_DESCRIPTOR( cd );
-
- pch += cd->bLength;
-
- do {
- id = (PUSB_INTERFACE_DESCRIPTOR) pch;
-
- print_USB_INTERFACE_DESCRIPTOR(id, n++);
-
- pch += id->bLength;
- for (j=0; j<id->bNumEndpoints; j++) {
-
- ed = (PUSB_ENDPOINT_DESCRIPTOR) pch;
-
- print_USB_ENDPOINT_DESCRIPTOR(ed,j);
-
- pch += ed->bLength;
- }
- i = (ULONG)(pch - buf);
-
- } while (i<cd->wTotalLength);
- }
-
- CloseHandle(hDev);
-
- return success;
-
-}
-
diff --git a/usb/wdf_osrfx2_lab/umdf/exe/testapp.c b/usb/wdf_osrfx2_lab/umdf/exe/testapp.c
deleted file mode 100644
index 48f49492..00000000
--- a/usb/wdf_osrfx2_lab/umdf/exe/testapp.c
+++ /dev/null
@@ -1,1367 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
- THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- PURPOSE.
-
-Module Name:
-
- TESTAPP.C
-
-Abstract:
-
- Console test app for osrusbfx2 driver.
-
-Environment:
-
- user mode only
-
---*/
-
-#include <driverspecs.h>
-_Analysis_mode_(_Analysis_code_type_user_code_);
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "devioctl.h"
-#include "strsafe.h"
-
-#pragma warning(push)
-#pragma warning(disable:4200) //
-#pragma warning(disable:4201) // nameless struct/union
-#pragma warning(disable:4214) // bit field types other than int
-
-#include <setupapi.h>
-#include <basetyps.h>
-#include "usbdi.h"
-#include "public.h"
-
-#pragma warning(pop)
-
-#define WHILE(a) \
-while(__pragma(warning(disable:4127)) a __pragma(warning(disable:4127)))
-
-#define countof(x) (sizeof(x) / sizeof(x[0]))
-
-#define MAX_DEVPATH_LENGTH 256
-#define NUM_ASYNCH_IO 100
-#define BUFFER_SIZE 1024
-#define READER_TYPE 1
-#define WRITER_TYPE 2
-
-BOOL G_fDumpUsbConfig = FALSE; // flags set in response to console command line switches
-BOOL G_fDumpReadData = FALSE;
-BOOL G_fRead = FALSE;
-BOOL G_fWrite = FALSE;
-BOOL G_fPlayWithDevice = FALSE;
-BOOL G_fPerformAsyncIo = FALSE;
-ULONG G_IterationCount = 1; //count of iterations of the test we are to perform
-int G_WriteLen = 512; // #bytes to write
-int G_ReadLen = 512; // #bytes to read
-PCWSTR G_SendFileName = NULL;
-ULONG G_SendFileInterval = 1;
-
-BOOL
-DumpUsbConfig( // defined in dump.c
- );
-
-typedef enum _INPUT_FUNCTION {
- LIGHT_ONE_BAR = 1,
- CLEAR_ONE_BAR,
- LIGHT_ALL_BARS,
- CLEAR_ALL_BARS,
- GET_BAR_GRAPH_LIGHT_STATE,
- GET_SWITCH_STATE,
- GET_SWITCH_STATE_AS_INTERRUPT_MESSAGE,
- GET_7_SEGEMENT_STATE,
- SET_7_SEGEMENT_STATE,
- RESET_DEVICE,
- REENUMERATE_DEVICE,
-} INPUT_FUNCTION;
-
-_Success_ (return != FALSE)
-BOOL
-GetDevicePath(
- IN LPGUID InterfaceGuid,
- _Out_writes_(BufLen) PWSTR DevicePath,
- _In_ size_t BufLen
- )
-{
- HDEVINFO HardwareDeviceInfo;
- SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
- PSP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData = NULL;
- ULONG Length, RequiredLength = 0;
- BOOL bResult;
- HRESULT hr;
-
- HardwareDeviceInfo = SetupDiGetClassDevs(
- InterfaceGuid,
- NULL,
- NULL,
- (DIGCF_PRESENT | DIGCF_DEVICEINTERFACE));
-
- if (HardwareDeviceInfo == INVALID_HANDLE_VALUE) {
- wprintf(L"SetupDiGetClassDevs failed!\n");
- return FALSE;
- }
-
- DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
-
- bResult = SetupDiEnumDeviceInterfaces(HardwareDeviceInfo,
- 0,
- InterfaceGuid,
- 0,
- &DeviceInterfaceData);
-
- if (bResult == FALSE) {
-
- LPVOID lpMsgBuf;
-
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPWSTR) &lpMsgBuf,
- 0,
- NULL
- )) {
-
- printf("SetupDiEnumDeviceInterfaces failed: %s", (LPSTR)lpMsgBuf);
- LocalFree(lpMsgBuf);
- }
-
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- return FALSE;
- }
-
- SetupDiGetDeviceInterfaceDetail(
- HardwareDeviceInfo,
- &DeviceInterfaceData,
- NULL,
- 0,
- &RequiredLength,
- NULL
- );
-
- DeviceInterfaceDetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA)
- LocalAlloc(LMEM_FIXED, RequiredLength);
-
- if (DeviceInterfaceDetailData == NULL) {
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- wprintf(L"Failed to allocate memory.\n");
- return FALSE;
- }
-
- DeviceInterfaceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
-
- Length = RequiredLength;
-
- bResult = SetupDiGetDeviceInterfaceDetail(
- HardwareDeviceInfo,
- &DeviceInterfaceData,
- DeviceInterfaceDetailData,
- Length,
- &RequiredLength,
- NULL);
-
- if (bResult == FALSE) {
-
- LPVOID lpMsgBuf;
-
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPWSTR) &lpMsgBuf,
- 0,
- NULL)) {
-
- printf("Error in SetupDiGetDeviceInterfaceDetail: %s\n", (LPSTR)lpMsgBuf);
- LocalFree(lpMsgBuf);
- }
-
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- LocalFree(DeviceInterfaceDetailData);
- return FALSE;
- }
-
- hr = StringCchCopy(DevicePath,
- BufLen,
- DeviceInterfaceDetailData->DevicePath);
- if (FAILED(hr)) {
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- LocalFree(DeviceInterfaceDetailData);
- return FALSE;
- }
-
- SetupDiDestroyDeviceInfoList(HardwareDeviceInfo);
- LocalFree(DeviceInterfaceDetailData);
-
- return TRUE;
-
-}
-
-_Check_return_
-_Ret_notnull_
-_Success_(return != INVALID_HANDLE_VALUE)
-HANDLE
-OpenDevice(
- _In_ BOOL Synchronous
- )
-
-/*++
-Routine Description:
-
- Called by main() to open an instance of our device after obtaining its name
-
-Arguments:
-
- Synchronous - TRUE, if Device is to be opened for synchronous access.
- FALSE, otherwise.
-
-Return Value:
-
- Device handle on success else INVALID_HANDLE_VALUE
-
---*/
-
-{
- HANDLE hDev;
- WCHAR completeDeviceName[MAX_DEVPATH_LENGTH];
-
- if ( !GetDevicePath(
- (LPGUID) &GUID_DEVINTERFACE_OSRUSBFX2,
- completeDeviceName,
- countof(completeDeviceName)) )
- {
- return INVALID_HANDLE_VALUE;
- }
-
- wprintf(L"DeviceName = (%s)\n", completeDeviceName);
-
- hDev = CreateFile(completeDeviceName,
- GENERIC_WRITE | GENERIC_READ,
- FILE_SHARE_WRITE | FILE_SHARE_READ,
- NULL, // default security
- OPEN_EXISTING,
- ((Synchronous ? FILE_ATTRIBUTE_NORMAL : FILE_FLAG_OVERLAPPED) | SECURITY_IMPERSONATION),
- NULL);
-
- if (hDev == INVALID_HANDLE_VALUE) {
- wprintf(L"Failed to open the device, error - %d", GetLastError());
- } else {
- wprintf(L"Opened the device successfully.\n");
- }
-
- return hDev;
-}
-
-
-
-VOID
-Usage()
-
-/*++
-Routine Description:
-
- Called by main() to dump usage info to the console when
- the app is called with no parms or with an invalid parm
-
-Arguments:
-
- None
-
-Return Value:
-
- None
-
---*/
-
-{
- wprintf(L"Usage for osrusbfx2 testapp:\n");
- wprintf(L"-r <n> where n is number of bytes to read\n");
- wprintf(L"-w <n> where n is number of bytes to write\n");
- wprintf(L"-c <n> where n is number of iterations (default = 1)\n");
- wprintf(L"-v <verbose> -- dumps read data\n");
- wprintf(L"-p to control bar LEDs, seven segment, and dip switch\n");
- wprintf(L"-a to perform asynchronous I/O\n");
- wprintf(L"-u to dump USB configuration and pipe info \n");
- wprintf(L"-f <filename> [interval-seconds] to send a text file to the seven-segment display (UMDF only)\n");
-
- return;
-}
-
-
-void
-Parse(
- _In_ int argc,
- _In_reads_(argc) LPWSTR *argv
- )
-
-/*++
-Routine Description:
-
- Called by main() to parse command line parms
-
-Arguments:
-
- argc and argv that was passed to main()
-
-Return Value:
-
- Sets global flags as per user function request
-
---*/
-
-{
- int i;
- PWSTR endchar;
-
- if ( argc < 2 ) // give usage if invoked with no parms
- Usage();
-
- for (i=0; i<argc; i++) {
- if (argv[i][0] == L'-' ||
- argv[i][0] == L'/') {
- switch(argv[i][1]) {
- case L'r':
- case L'R':
- if (i+1 >= argc) {
- Usage();
- exit(1);
- }
- else {
- G_ReadLen = wcstoul(&argv[i+1][0], &endchar, 10);
- G_fRead = TRUE;
- }
- i++;
- break;
- case L'w':
- case L'W':
- if (i+1 >= argc) {
- Usage();
- exit(1);
- }
- else {
- G_WriteLen = wcstoul(&argv[i+1][0], &endchar, 10);
- G_fWrite = TRUE;
- }
- i++;
- break;
- case L'c':
- case L'C':
- if (i+1 >= argc) {
- Usage();
- exit(1);
- }
- else {
- G_IterationCount = wcstoul(&argv[i+1][0], &endchar, 10);
- }
- i++;
- break;
- case L'f':
- case L'F':
- if (i+1 >= argc) {
- Usage();
- exit(1);
- }
- else {
- G_SendFileName = argv[i+1];
- }
-
- i++;
-
- if (i+1 < argc) {
- G_SendFileInterval = wcstoul(&argv[i+1][0], &endchar, 10);
- }
- i++;
-
- break;
- case L'u':
- case L'U':
- G_fDumpUsbConfig = TRUE;
- break;
- case L'p':
- case L'P':
- G_fPlayWithDevice = TRUE;
- break;
- case L'a':
- case L'A':
- G_fPerformAsyncIo = TRUE;
- break;
- case L'v':
- case L'V':
- G_fDumpReadData = TRUE;
- break;
- default:
- Usage();
- }
- }
- }
-}
-
-BOOL
-Compare_Buffs(
- _In_reads_bytes_(length) PVOID *buff1,
- _In_reads_bytes_(length) PVOID *buff2,
- _In_ int length
- )
-/*++
-Routine Description:
-
- Called to verify read and write buffers match for loopback test
-
-Arguments:
-
- buffers to compare and length
-
-Return Value:
-
- TRUE if buffers match, else FALSE
-
---*/
-{
- int ok = 1;
-
- if (memcmp(buff1, buff2, length )) {
- // Edi, and Esi point to the mismatching char and ecx indicates the
- // remaining length.
- ok = 0;
- }
-
- return ok;
-}
-
-#define NPERLN 8
-
-VOID
-Dump(
- UCHAR *b,
- int len
-)
-
-/*++
-Routine Description:
-
- Called to do formatted ascii dump to console of the io buffer
-
-Arguments:
-
- buffer and length
-
-Return Value:
-
- none
-
---*/
-
-{
- ULONG i;
- ULONG longLen = (ULONG)len / sizeof( ULONG );
- PULONG pBuf = (PULONG) b;
-
- // dump an ordinal ULONG for each sizeof(ULONG)'th byte
- wprintf(L"\n****** BEGIN DUMP LEN decimal %d, 0x%x\n", len,len);
- for (i=0; i<longLen; i++) {
- wprintf(L"%04X ", *pBuf++);
- if (i % NPERLN == (NPERLN - 1)) {
- wprintf(L"\n");
- }
- }
- if (i % NPERLN != 0) {
- wprintf(L"\n");
- }
- wprintf(L"\n****** END DUMP LEN decimal %d, 0x%x\n", len,len);
-}
-
-
-BOOL
-PlayWithDevice()
-{
- HANDLE deviceHandle;
- DWORD code;
- ULONG index;
- INPUT_FUNCTION function;
- BAR_GRAPH_STATE barGraphState;
- ULONG bar;
- SWITCH_STATE switchState;
- UCHAR sevenSegment = 0;
- UCHAR i;
- BOOL result = FALSE;
-
- deviceHandle = OpenDevice(FALSE);
-
- if (deviceHandle == INVALID_HANDLE_VALUE) {
-
- wprintf(L"Unable to find any OSR FX2 devices!\n");
-
- return FALSE;
-
- }
-
- //
- // Infinitely print out the list of choices, ask for input, process
- // the request
- //
- WHILE(TRUE) {
-
- printf ("\nUSBFX TEST -- Functions:\n\n");
- printf ("\t1. Light Bar\n");
- printf ("\t2. Clear Bar\n");
- printf ("\t3. Light entire Bar graph\n");
- printf ("\t4. Clear entire Bar graph\n");
- printf ("\t5. Get bar graph state\n");
- printf ("\t6. Get Switch state\n");
- printf ("\t7. Get Switch Interrupt Message\n");
- printf ("\t8. Get 7 segment state\n");
- printf ("\t9. Set 7 segment state\n");
- printf ("\t10. Reset the device\n");
- printf ("\t11. Reenumerate the device\n");
- printf ("\n\t0. Exit\n");
- printf ("\n\tSelection: ");
-
- if (scanf_s ("%d", &function) <= 0) {
-
- wprintf(L"Error reading input!\n");
- goto Error;
-
- }
-
- switch(function) {
-
- case LIGHT_ONE_BAR:
-
- wprintf(L"Which Bar (input number 1 thru 8)?\n");
- if (scanf_s ("%d", &bar) <= 0) {
-
- wprintf(L"Error reading input!\n");
- goto Error;
-
- }
-
- if(bar == 0 || bar > 8){
- wprintf(L"Invalid bar number!\n");
- goto Error;
- }
-
- bar--; // normalize to 0 to 7
-
- barGraphState.BarsAsUChar = 1 << (UCHAR)bar;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY,
- &barGraphState, // Ptr to InBuffer
- sizeof(BAR_GRAPH_STATE), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- break;
-
- case CLEAR_ONE_BAR:
-
-
- wprintf(L"Which Bar (input number 1 thru 8)?\n");
- if (scanf_s ("%d", &bar) <= 0) {
-
- wprintf(L"Error reading input!\n");
- goto Error;
-
- }
-
- if(bar == 0 || bar > 8){
- wprintf(L"Invalid bar number!\n");
- goto Error;
- }
-
- bar--;
-
- //
- // Read the current state
- //
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &barGraphState, // Ptr to OutBuffer
- sizeof(BAR_GRAPH_STATE), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- if (barGraphState.BarsAsUChar & (1 << bar)) {
-
- wprintf(L"Bar is set...Clearing it\n");
- barGraphState.BarsAsUChar &= ~(1 << bar);
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY,
- &barGraphState, // Ptr to InBuffer
- sizeof(BAR_GRAPH_STATE), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
-
- }
-
- } else {
-
- wprintf(L"Bar not set.\n");
-
- }
-
- break;
-
- case LIGHT_ALL_BARS:
-
- barGraphState.BarsAsUChar = 0xFF;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY,
- &barGraphState, // Ptr to InBuffer
- sizeof(BAR_GRAPH_STATE), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- break;
-
- case CLEAR_ALL_BARS:
-
- barGraphState.BarsAsUChar = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY,
- &barGraphState, // Ptr to InBuffer
- sizeof(BAR_GRAPH_STATE), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- break;
-
-
- case GET_BAR_GRAPH_LIGHT_STATE:
-
- barGraphState.BarsAsUChar = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &barGraphState, // Ptr to OutBuffer
- sizeof(BAR_GRAPH_STATE), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"Bar Graph: \n");
- wprintf(L" Bar8 is %s\n", barGraphState.Bar8 ? L"ON" : L"OFF");
- wprintf(L" Bar7 is %s\n", barGraphState.Bar7 ? L"ON" : L"OFF");
- wprintf(L" Bar6 is %s\n", barGraphState.Bar6 ? L"ON" : L"OFF");
- wprintf(L" Bar5 is %s\n", barGraphState.Bar5 ? L"ON" : L"OFF");
- wprintf(L" Bar4 is %s\n", barGraphState.Bar4 ? L"ON" : L"OFF");
- wprintf(L" Bar3 is %s\n", barGraphState.Bar3 ? L"ON" : L"OFF");
- wprintf(L" Bar2 is %s\n", barGraphState.Bar2 ? L"ON" : L"OFF");
- wprintf(L" Bar1 is %s\n", barGraphState.Bar1 ? L"ON" : L"OFF");
-
- break;
-
- case GET_SWITCH_STATE:
-
- switchState.SwitchesAsUChar = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_READ_SWITCHES,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &switchState, // Ptr to OutBuffer
- sizeof(SWITCH_STATE), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"Switches: \n");
- wprintf(L" Switch8 is %s\n", switchState.Switch8 ? L"ON" : L"OFF");
- wprintf(L" Switch7 is %s\n", switchState.Switch7 ? L"ON" : L"OFF");
- wprintf(L" Switch6 is %s\n", switchState.Switch6 ? L"ON" : L"OFF");
- wprintf(L" Switch5 is %s\n", switchState.Switch5 ? L"ON" : L"OFF");
- wprintf(L" Switch4 is %s\n", switchState.Switch4 ? L"ON" : L"OFF");
- wprintf(L" Switch3 is %s\n", switchState.Switch3 ? L"ON" : L"OFF");
- wprintf(L" Switch2 is %s\n", switchState.Switch2 ? L"ON" : L"OFF");
- wprintf(L" Switch1 is %s\n", switchState.Switch1 ? L"ON" : L"OFF");
-
- break;
-
- case GET_SWITCH_STATE_AS_INTERRUPT_MESSAGE:
-
- switchState.SwitchesAsUChar = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &switchState, // Ptr to OutBuffer
- sizeof(switchState), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"Switches: %d\n",index);
- wprintf(L" Switch8 is %s\n", switchState.Switch8 ? L"ON" : L"OFF");
- wprintf(L" Switch7 is %s\n", switchState.Switch7 ? L"ON" : L"OFF");
- wprintf(L" Switch6 is %s\n", switchState.Switch6 ? L"ON" : L"OFF");
- wprintf(L" Switch5 is %s\n", switchState.Switch5 ? L"ON" : L"OFF");
- wprintf(L" Switch4 is %s\n", switchState.Switch4 ? L"ON" : L"OFF");
- wprintf(L" Switch3 is %s\n", switchState.Switch3 ? L"ON" : L"OFF");
- wprintf(L" Switch2 is %s\n", switchState.Switch2 ? L"ON" : L"OFF");
- wprintf(L" Switch1 is %s\n", switchState.Switch1 ? L"ON" : L"OFF");
-
- break;
-
- case GET_7_SEGEMENT_STATE:
-
- sevenSegment = 0;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- &sevenSegment, // Ptr to OutBuffer
- sizeof(UCHAR), // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"7 Segment mask: 0x%x\n", sevenSegment);
- break;
-
- case SET_7_SEGEMENT_STATE:
-
- for (i = 0; i < 8; i++) {
-
- sevenSegment = 1 << i;
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY,
- &sevenSegment, // Ptr to InBuffer
- sizeof(UCHAR), // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- 0)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- wprintf(L"This is %d\n", i);
- Sleep(500);
-
- }
-
- wprintf(L"7 Segment mask: 0x%x\n", sevenSegment);
- break;
-
- case RESET_DEVICE:
-
- wprintf(L"Reset the device\n");
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_RESET_DEVICE,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- NULL)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- break;
-
- case REENUMERATE_DEVICE:
-
- wprintf(L"Re-enumerate the device\n");
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_REENUMERATE_DEVICE,
- NULL, // Ptr to InBuffer
- 0, // Length of InBuffer
- NULL, // Ptr to OutBuffer
- 0, // Length of OutBuffer
- &index, // BytesReturned
- NULL)) { // Ptr to Overlapped structure
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- //
- // Close the handle to the device and exit out so that
- // the driver can unload when the device is surprise-removed
- // and reenumerated.
- //
- default:
-
- result = TRUE;
- goto Error;
-
- }
-
- } // end of while loop
-
-Error:
-
- CloseHandle(deviceHandle);
- return result;
-
-}
-
-BOOL
-SendFileToDevice(
- _In_ PCWSTR FileName
- )
-{
- HANDLE deviceHandle;
-
- struct
- {
- USHORT delay;
- WCHAR buffer[MAX_PATH + 1];
- } playback;
-
- ULONG bufferCch;
-
- DWORD code;
- BOOL result = FALSE;
-
- //
- // Open a handle to the device.
- //
-
- deviceHandle = OpenDevice(FALSE);
-
- if (deviceHandle == INVALID_HANDLE_VALUE) {
-
- wprintf(L"Unable to find any OSR FX2 devices!\n");
-
- return FALSE;
-
- }
-
- //
- // Convert the file name from relative to absolute.
- //
-
- bufferCch = GetFullPathName(FileName,
- countof(playback.buffer),
- playback.buffer,
- NULL);
-
- if (bufferCch == 0)
- {
- wprintf(L"Error getting full path name for %s - %d\n",
- FileName,
- GetLastError());
- goto Error;
- }
-
- if ((G_SendFileInterval * 1000) >= ((USHORT) 0xffff))
- {
- wprintf(L"Error - delay is too large. Remember that it's in terms of seconds.\n");
- goto Error;
- }
-
- playback.delay = (USHORT) (G_SendFileInterval * 1000);
-
- if (!DeviceIoControl(deviceHandle,
- IOCTL_OSRUSBFX2_PLAY_FILE,
- &playback,
- sizeof(playback),
- NULL,
- 0,
- &bufferCch,
- 0)) {
-
- code = GetLastError();
-
- wprintf(L"DeviceIoControl failed with error 0x%x\n", code);
-
- goto Error;
- }
-
- result = TRUE;
-
-Error:
-
- CloseHandle(deviceHandle);
- return result;
-}
-
-ULONG
-AsyncIo(
- PVOID ThreadParameter
- )
-{
- HANDLE hDevice = INVALID_HANDLE_VALUE;
- HANDLE hCompletionPort = NULL;
- OVERLAPPED *pOvList = NULL;
- PUCHAR buf = NULL;
- ULONG_PTR i;
- ULONG ioType = (ULONG)(ULONG_PTR)ThreadParameter;
- ULONG error;
-
- hDevice = OpenDevice(FALSE);
-
- if (hDevice == INVALID_HANDLE_VALUE) {
- wprintf(L"Cannot open device %d\n", GetLastError());
- goto Error;
- }
-
- hCompletionPort = CreateIoCompletionPort(hDevice, NULL, 1, 0);
-
- if (hCompletionPort == NULL) {
- wprintf(L"Cannot open completion port %d \n",GetLastError());
- goto Error;
- }
-
- pOvList = (OVERLAPPED *)malloc(NUM_ASYNCH_IO * sizeof(OVERLAPPED));
-
- if (pOvList == NULL) {
- wprintf(L"Cannot allocate overlapped array \n");
- goto Error;
- }
-
- buf = (PUCHAR)malloc(NUM_ASYNCH_IO * BUFFER_SIZE);
-
- if (buf == NULL) {
- wprintf(L"Cannot allocate buffer \n");
- goto Error;
- }
-
- ZeroMemory(pOvList, NUM_ASYNCH_IO * sizeof(OVERLAPPED));
- ZeroMemory(buf, NUM_ASYNCH_IO * BUFFER_SIZE);
-
- //
- // Issue asynch I/O
- //
-
- for (i = 0; i < NUM_ASYNCH_IO; i++) {
- if (ioType == READER_TYPE) {
- if ( ReadFile( hDevice,
- buf + (i* BUFFER_SIZE),
- BUFFER_SIZE,
- NULL,
- &pOvList[i]) == 0) {
-
- error = GetLastError();
- if (error != ERROR_IO_PENDING) {
- wprintf(L" %Iu th read failed %d \n",i, GetLastError());
- goto Error;
- }
- }
-
- } else {
- if ( WriteFile( hDevice,
- buf + (i* BUFFER_SIZE),
- BUFFER_SIZE,
- NULL,
- &pOvList[i]) == 0) {
- error = GetLastError();
- if (error != ERROR_IO_PENDING) {
- wprintf(L" %Iu th write failed %d \n",i, GetLastError());
- goto Error;
- }
- }
- }
- }
-
- //
- // Wait for the I/Os to complete. If one completes then reissue the I/O
- //
-
- WHILE (1) {
- OVERLAPPED *completedOv;
- ULONG_PTR key;
- ULONG numberOfBytesTransferred;
-
- if ( GetQueuedCompletionStatus(hCompletionPort, &numberOfBytesTransferred,
- &key, &completedOv, INFINITE) == 0) {
- wprintf(L"GetQueuedCompletionStatus failed %d\n", GetLastError());
- goto Error;
- }
-
- //
- // Read successfully completed. Issue another one.
- //
-
- if (ioType == READER_TYPE) {
-
- i = completedOv - pOvList;
-
- wprintf(L"Number of bytes read by request number %Iu is %d\n",
- i, numberOfBytesTransferred);
-
- if ( ReadFile( hDevice,
- buf + (i * BUFFER_SIZE),
- BUFFER_SIZE,
- NULL,
- completedOv) == 0) {
- error = GetLastError();
- if (error != ERROR_IO_PENDING) {
- wprintf(L"%Iu th Read failed %d \n", i, GetLastError());
- goto Error;
- }
- }
- } else {
-
- i = completedOv - pOvList;
-
- wprintf(L"Number of bytes written by request number %Iu is %d\n",
- i, numberOfBytesTransferred);
-
- if ( WriteFile( hDevice,
- buf + (i * BUFFER_SIZE),
- BUFFER_SIZE,
- NULL,
- completedOv) == 0) {
- error = GetLastError();
- if (error != ERROR_IO_PENDING) {
- wprintf(L"%Iu th write failed %d \n", i, GetLastError());
- goto Error;
- }
- }
- }
- }
-
-Error:
- if (hDevice != INVALID_HANDLE_VALUE) {
- CloseHandle(hDevice);
- }
-
- if (hCompletionPort) {
- CloseHandle(hCompletionPort);
- }
-
- if (pOvList) {
- free(pOvList);
- }
- if (buf) {
- free(buf);
- }
-
- return 1;
-
-}
-
-
-int
-_cdecl
-wmain(
- _In_ int argc,
- _In_reads_(argc) LPWSTR *argv
- )
-/*++
-Routine Description:
-
- Entry point to rwbulk.exe
- Parses cmdline, performs user-requested tests
-
-Arguments:
-
- argc, argv standard console 'c' app arguments
-
-Return Value:
-
- Zero
-
---*/
-
-{
- PWSTR * pinBuf = NULL;
- PWSTR * poutBuf = NULL;
- int nBytesRead;
- int nBytesWrite;
- int ok;
- int retValue = 0;
- UINT success;
- HANDLE hRead = INVALID_HANDLE_VALUE;
- HANDLE hWrite = INVALID_HANDLE_VALUE;
- ULONG fail = 0L;
- ULONG i;
-
-
- Parse(argc, argv );
-
- //
- // dump USB configuation and pipe info
- //
- if (G_fDumpUsbConfig) {
- DumpUsbConfig();
- }
-
- if (G_fPlayWithDevice) {
- PlayWithDevice();
- goto exit;
- }
-
- if (G_SendFileName != NULL)
- {
- SendFileToDevice(G_SendFileName);
- goto exit;
- }
-
- if (G_fPerformAsyncIo) {
- HANDLE th1;
-
- //
- // Create a reader thread
- //
- th1 = CreateThread( NULL, // Default Security Attrib.
- 0, // Initial Stack Size,
- AsyncIo, // Thread Func
- (LPVOID)READER_TYPE,
- 0, // Creation Flags
- NULL ); // Don't need the Thread Id.
-
- if (th1 == NULL) {
- wprintf(L"Couldn't create reader thread - error %d\n", GetLastError());
- retValue = 1;
- goto exit;
- }
-
- //
- // Use this thread for peforming write.
- //
- AsyncIo((PVOID)WRITER_TYPE);
-
- goto exit;
- }
-
- //
- // doing a read, write, or both test
- //
- if ((G_fRead) || (G_fWrite)) {
-
- if (G_fRead) {
- if ( G_fDumpReadData ) { // round size to sizeof ULONG for readable dumping
- while( G_ReadLen % sizeof( ULONG ) ) {
- G_ReadLen++;
- }
- }
-
- //
- // open the output file
- //
- hRead = OpenDevice(TRUE);
- if(hRead == INVALID_HANDLE_VALUE) {
- retValue = 1;
- goto exit;
- }
-
- pinBuf = malloc(G_ReadLen);
- if (pinBuf == 0) {
- retValue = 1;
- goto exit;
- }
- }
-
- if (G_fWrite) {
- if ( G_fDumpReadData ) { // round size to sizeof ULONG for readable dumping
- while( G_WriteLen % sizeof( ULONG ) ) {
- G_WriteLen++;
- }
- }
-
- //
- // open the output file
- //
- hWrite = OpenDevice(TRUE);
- if(hWrite == INVALID_HANDLE_VALUE) {
- retValue = 1;
- goto exit;
- }
-
- poutBuf = malloc(G_WriteLen);
- if (poutBuf == 0) {
- retValue = 1;
- goto exit;
- }
- }
-
- for (i = 0; i < G_IterationCount; i++) {
- ULONG j;
-
- if (G_fWrite && poutBuf && hWrite != INVALID_HANDLE_VALUE) {
-
- PULONG pOut = (PULONG) poutBuf;
- ULONG numLongs = G_WriteLen / sizeof( ULONG );
-
- //
- // put some data in the output buffer
- //
- for (j=0; j<numLongs; j++) {
- *(pOut+j) = j;
- }
-
- //
- // send the write
- //
- success = WriteFile(hWrite, poutBuf, G_WriteLen, (PULONG) &nBytesWrite, NULL);
- if(success == 0) {
- wprintf(L"WriteFile failed - error %d\n", GetLastError());
- retValue = 1;
- goto exit;
- }
- wprintf(L"Write (%04.4d) : request %06.6d bytes -- %06.6d bytes written\n",
- i, G_WriteLen, nBytesWrite);
-
- assert(nBytesWrite == G_WriteLen);
- }
-
- if (G_fRead && pinBuf) {
-
- success = ReadFile(hRead, pinBuf, G_ReadLen, (PULONG) &nBytesRead, NULL);
- if(success == 0) {
- wprintf(L"ReadFile failed - error %d\n", GetLastError());
- retValue = 1;
- goto exit;
- }
-
- wprintf(L"Read (%04.4d) : request %06.6d bytes -- %06.6d bytes read\n",
- i, G_ReadLen, nBytesRead);
-
- if (G_fWrite) {
-
- //
- // validate the input buffer against what
- // we sent to the 82930 (loopback test)
- //
-
- ok = Compare_Buffs(pinBuf, poutBuf, nBytesRead);
-
- if( G_fDumpReadData ) {
- wprintf(L"Dumping read buffer\n");
- Dump( (PUCHAR) pinBuf, nBytesRead );
- wprintf(L"Dumping write buffer\n");
- Dump( (PUCHAR) poutBuf, nBytesRead );
- }
- assert(ok);
-
- if(ok != 1) {
- fail++;
- }
-
- assert(G_ReadLen == G_WriteLen);
- assert(nBytesRead == G_ReadLen);
- }
- }
- }
-
- }
-
-exit:
-
- if (pinBuf) {
- free(pinBuf);
- }
-
- if (poutBuf) {
- free(poutBuf);
- }
-
- // close devices if needed
- if (hRead != INVALID_HANDLE_VALUE) {
- CloseHandle(hRead);
- }
-
- if (hWrite != INVALID_HANDLE_VALUE) {
- _Analysis_assume_(hWrite != NULL);
- CloseHandle(hWrite);
- }
-
- return retValue;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/exe/testapp.rc b/usb/wdf_osrfx2_lab/umdf/exe/testapp.rc
deleted file mode 100644
index 28dd29d7..00000000
--- a/usb/wdf_osrfx2_lab/umdf/exe/testapp.rc
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <windows.h>
-
-#include <ntverp.h>
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT2_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "OSRUSBFX2 Bulk & Isoch Read and Write test App for UMDF"
-#define VER_INTERNALNAME_STR "WudfOsrUsbFx2Test.exe"
-#define VER_ORIGINALFILENAME_STR "WudfOsrUsbFx2Test.exe"
-
-#include <common.ver>
-
-
diff --git a/usb/wdf_osrfx2_lab/umdf/inc/WUDFOsrUsbPublic.h b/usb/wdf_osrfx2_lab/umdf/inc/WUDFOsrUsbPublic.h
deleted file mode 100644
index 6681fa14..00000000
--- a/usb/wdf_osrfx2_lab/umdf/inc/WUDFOsrUsbPublic.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- WUDFOsrUsbPublic.h
-
-Abstract:
-
- This module contains the common declarations shared by driver
- and user applications for the UMDF OSR device sample.
-
- Note that this driver does NOT use the same device interface GUID
- as the KMDF OSR USB sample.
-
-Environment:
-
- user and kernel
-
---*/
-
-#pragma once
-
-//
-// Define an Interface Guid so that app can find the device and talk to it.
-//
-
-// {573E8C73-0CB4-4471-A1BF-FAB26C31D384}
-DEFINE_GUID(GUID_DEVINTERFACE_OSRUSBFX2,
- 0x573e8c73, 0xcb4, 0x4471, 0xa1, 0xbf, 0xfa, 0xb2, 0x6c, 0x31, 0xd3, 0x84);
-
diff --git a/usb/wdf_osrfx2_lab/umdf/inc/list.h b/usb/wdf_osrfx2_lab/umdf/inc/list.h
deleted file mode 100644
index 38d0b1e9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/inc/list.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- list.h
-
-Abstract:
-
- This module contains doubly linked list macros
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-FORCEINLINE
-VOID
-InitializeListHead(
- IN PLIST_ENTRY ListHead
- )
-{
- ListHead->Flink = ListHead->Blink = ListHead;
-}
-
-FORCEINLINE
-BOOLEAN
-RemoveEntryList(
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
- PLIST_ENTRY Flink;
-
- Flink = Entry->Flink;
- Blink = Entry->Blink;
- Blink->Flink = Flink;
- Flink->Blink = Blink;
- return (BOOLEAN)(Flink == Blink);
-}
-
-FORCEINLINE
-VOID
-InsertHeadList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Flink;
-
- Flink = ListHead->Flink;
- Entry->Flink = Flink;
- Entry->Blink = ListHead;
- Flink->Blink = Entry;
- ListHead->Flink = Entry;
-}
-
-FORCEINLINE
-VOID
-InsertTailList(
- IN PLIST_ENTRY ListHead,
- IN PLIST_ENTRY Entry
- )
-{
- PLIST_ENTRY Blink;
-
- Blink = ListHead->Blink;
- Entry->Flink = ListHead;
- Entry->Blink = Blink;
- Blink->Flink = Entry;
- ListHead->Blink = Entry;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/inc/public.h b/usb/wdf_osrfx2_lab/umdf/inc/public.h
deleted file mode 100644
index 2c3f6805..00000000
--- a/usb/wdf_osrfx2_lab/umdf/inc/public.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- public.h
-
-Abstract:
-
- Public definitions for the OSR_FX2 device operations.
-
-Environment:
-
- User & Kernel mode
-
---*/
-
-#ifndef _PUBLIC_H
-#define _PUBLIC_H
-
-#include <initguid.h>
-
-#include "WudfOsrUsbPublic.h"
-
-
-//
-// Define the structures that will be used by the IOCTL
-// interface to the driver
-//
-
-//
-// BAR_GRAPH_STATE
-//
-// BAR_GRAPH_STATE is a bit field structure with each
-// bit corresponding to one of the bar graph on the
-// OSRFX2 Development Board
-//
-#include <pshpack1.h>
-
-#pragma warning( push )
-#pragma warning( disable : 4201 ) // nameless struct/union
-#pragma warning( disable : 4214 ) // bit-field type other than int
-
-typedef struct _BAR_GRAPH_STATE {
-
- union {
-
- struct {
- //
- // Individual bars starting from the
- // top of the stack of bars
- //
- // NOTE: There are actually 10 bars,
- // but the very top two do not light
- // and are not counted here
- //
- UCHAR Bar1 : 1;
- UCHAR Bar2 : 1;
- UCHAR Bar3 : 1;
- UCHAR Bar4 : 1;
- UCHAR Bar5 : 1;
- UCHAR Bar6 : 1;
- UCHAR Bar7 : 1;
- UCHAR Bar8 : 1;
- };
-
- //
- // The state of all the bar graph as a single
- // UCHAR
- //
- UCHAR BarsAsUChar;
-
- };
-
-}BAR_GRAPH_STATE, *PBAR_GRAPH_STATE;
-
-//
-// SWITCH_STATE
-//
-// SWITCH_STATE is a bit field structure with each
-// bit corresponding to one of the switches on the
-// OSRFX2 Development Board
-//
-typedef struct _SWITCH_STATE {
-
- union {
- struct {
- //
- // Individual switches starting from the
- // left of the set of switches
- //
- UCHAR Switch1 : 1;
- UCHAR Switch2 : 1;
- UCHAR Switch3 : 1;
- UCHAR Switch4 : 1;
- UCHAR Switch5 : 1;
- UCHAR Switch6 : 1;
- UCHAR Switch7 : 1;
- UCHAR Switch8 : 1;
- };
-
- //
- // The state of all the switches as a single
- // UCHAR
- //
- UCHAR SwitchesAsUChar;
-
- };
-
-
-}SWITCH_STATE, *PSWITCH_STATE;
-
-//
-// Seven segment display bit values.
-//
-
-//
-// Undefine conflicting MFC constant
-//
-#undef SS_CENTER
-#undef SS_LEFT
-#undef SS_RIGHT
-
-#define SS_TOP 0x01
-#define SS_TOP_LEFT 0x40
-#define SS_TOP_RIGHT 0x02
-#define SS_CENTER 0x20
-#define SS_BOTTOM_LEFT 0x10
-#define SS_BOTTOM_RIGHT 0x04
-#define SS_BOTTOM 0x80
-#define SS_DOT 0x08
-
-//
-// FILE_PLAYBACK
-//
-// FILE_PLAYBACK structure contains the parameters for the PLAY_FILE I/O Control.
-//
-
-typedef struct _FILE_PLAYBACK
-{
- //
- // The delay between changes in the display, in milliseconds.
- //
-
- USHORT Delay;
-
- //
- // The data file path.
- //
-
- WCHAR Path[1];
-} FILE_PLAYBACK, *PFILE_PLAYBACK;
-
-#include <poppack.h>
-
-#define IOCTL_INDEX 0x800
-#define FILE_DEVICE_OSRUSBFX2 65500U
-
-#define IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-#define IOCTL_OSRUSBFX2_RESET_DEVICE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 1, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_REENUMERATE_DEVICE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 3, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 4, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 5, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_READ_SWITCHES CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 6, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 7, \
- METHOD_BUFFERED, \
- FILE_READ_ACCESS)
-
-
-#define IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 8, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#define IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE CTL_CODE(FILE_DEVICE_OSRUSBFX2,\
- IOCTL_INDEX + 9, \
- METHOD_OUT_DIRECT, \
- FILE_READ_ACCESS)
-
-#define IOCTL_OSRUSBFX2_PLAY_FILE CTL_CODE(FILE_DEVICE_OSRUSBFX2, \
- IOCTL_INDEX + 10, \
- METHOD_BUFFERED, \
- FILE_WRITE_ACCESS)
-
-#pragma warning(pop)
-
-#endif
-
diff --git a/usb/wdf_osrfx2_lab/umdf/inc/usb_hw.h b/usb/wdf_osrfx2_lab/umdf/inc/usb_hw.h
deleted file mode 100644
index d6e983f1..00000000
--- a/usb/wdf_osrfx2_lab/umdf/inc/usb_hw.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
- Usb.h
-
-Abstract:
-
- Contains prototypes for interfacing with a USB connected device. These
- are copied from the KMDF WDFUSB.H header file (but with the WDF specific
- portions removed)
-
-Environment:
-
- kernel mode only
-
---*/
-
-#pragma once
-
-typedef enum _WINUSB_BMREQUEST_DIRECTION {
- BmRequestHostToDevice = BMREQUEST_HOST_TO_DEVICE,
- BmRequestDeviceToHost = BMREQUEST_DEVICE_TO_HOST,
-} WINUSB_BMREQUEST_DIRECTION;
-
-typedef enum _WINUSB_BMREQUEST_TYPE {
- BmRequestStandard = BMREQUEST_STANDARD,
- BmRequestClass = BMREQUEST_CLASS,
- BmRequestVendor = BMREQUEST_VENDOR,
-} WINUSB_BMREQUEST_TYPE;
-
-typedef enum _WINUSB_BMREQUEST_RECIPIENT {
- BmRequestToDevice = BMREQUEST_TO_DEVICE,
- BmRequestToInterface = BMREQUEST_TO_INTERFACE,
- BmRequestToEndpoint = BMREQUEST_TO_ENDPOINT,
- BmRequestToOther = BMREQUEST_TO_OTHER,
-} WINUSB_BMREQUEST_RECIPIENT;
-
-typedef enum _WINUSB_DEVICE_TRAITS {
- WINUSB_DEVICE_TRAIT_SELF_POWERED = 0x00000001,
- WINUSB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE = 0x00000002,
- WINUSB_DEVICE_TRAIT_AT_HIGH_SPEED = 0x00000004,
-} WINUSB_DEVICE_TRAITS;
-
-typedef enum _WdfUsbTargetDeviceSelectInterfaceType {
- WdfUsbTargetDeviceSelectInterfaceTypeInterface = 0x10,
- WdfUsbTargetDeviceSelectInterfaceTypeUrb = 0x11,
-} WdfUsbTargetDeviceSelectInterfaceType;
-
-
-
-typedef union _WINUSB_CONTROL_SETUP_PACKET {
- struct {
- union {
- #pragma warning(disable:4214) // bit field types other than int
- struct {
- //
- // Valid values are BMREQUEST_TO_DEVICE, BMREQUEST_TO_INTERFACE,
- // BMREQUEST_TO_ENDPOINT, BMREQUEST_TO_OTHER
- //
- BYTE Recipient:2;
-
- BYTE Reserved:3;
-
- //
- // Valid values are BMREQUEST_STANDARD, BMREQUEST_CLASS,
- // BMREQUEST_VENDOR
- //
- BYTE Type:2;
-
- //
- // Valid values are BMREQUEST_HOST_TO_DEVICE,
- // BMREQUEST_DEVICE_TO_HOST
- //
- BYTE Dir:1;
- } Request;
- #pragma warning(default:4214) // bit field types other than int
- BYTE Byte;
- } bm;
-
- BYTE bRequest;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wValue;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wIndex;
-
- USHORT wLength;
- } Packet;
-
- struct {
- BYTE Bytes[8];
- } Generic;
-
- WINUSB_SETUP_PACKET WinUsb;
-
-} WINUSB_CONTROL_SETUP_PACKET, *PWINUSB_CONTROL_SETUP_PACKET;
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_CLASS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestClass;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_VENDOR(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestVendor;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_FEATURE(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT FeatureSelector,
- USHORT Index,
- BOOLEAN SetFeature
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestHostToDevice;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- if (SetFeature) {
- Packet->Packet.bRequest = USB_REQUEST_SET_FEATURE;
- }
- else {
- Packet->Packet.bRequest = USB_REQUEST_CLEAR_FEATURE;
- }
-
- Packet->Packet.wValue.Value = FeatureSelector;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_GET_STATUS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestDeviceToHost;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- Packet->Packet.bRequest = USB_REQUEST_GET_STATUS;
- Packet->Packet.wIndex.Value = Index;
- Packet->Packet.wValue.Value = 0;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/Device.cpp b/usb/wdf_osrfx2_lab/umdf/step1/Device.cpp
deleted file mode 100644
index 68c1245c..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/Device.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton sample driver's
- device callback object.
-
- The skeleton sample device does very little. It does not implement either
- of the PNP interfaces so once the device is setup, it won't ever get any
- callbacks until the device is removed.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "initguid.h"
-#include "usb_hw.h"
-
-#include "device.tmh"
-
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the skeleton driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice = NULL;
-
- HRESULT hr = S_OK;
-
- //
- // TODO: If you're writing a filter driver then indicate that here.
- //
- // FxDeviceInit->SetFilter();
- //
-
- //
- // Set no locking unless you need an automatic callbacks synchronization
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // TODO: Any per-device initialization which must be done before
- // creating the partner object.
- //
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- if (SUCCEEDED(hr))
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Since the skeleton driver doesn't support any of the device events, this
- method simply calls the base class's BaseQueryInterface.
-
- If the skeleton is extended to include device event interfaces then this
- method must be changed to check the IID and return pointers to them as
- appropriate.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- return CUnknown::QueryInterface(InterfaceId, Object);
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/Device.h b/usb/wdf_osrfx2_lab/umdf/step1/Device.h
deleted file mode 100644
index 24954a6b..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/Device.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "internal.h"
-
-//
-// Class for the iotrace driver.
-//
-
-class CMyDevice :
- public CUnknown
-{
-
-//
-// Private data members.
-//
-private:
- //
- // Weak reference to framework device
- //
-
- IWDFDevice *m_FxDevice;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- ) :
- m_FxDevice(NULL)
- {
- }
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- IWDFDevice *
- GetFxDevice(
- VOID
- )
- {
- return m_FxDevice;
- }
-
- HRESULT
- Configure(
- VOID
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/Driver.cpp b/usb/wdf_osrfx2_lab/umdf/step1/Driver.cpp
deleted file mode 100644
index bac5caca..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/Driver.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // TODO: Do any per-device initialization (reading settings from the
- // registry for example) that's necessary before creating your
- // device callback object here. Otherwise you can leave such
- // initialization to the initialization of the device event
- // handler.
- //
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // TODO: Change any per-device settings that the object exposes before
- // calling Configure to let it complete its initialization.
- //
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/Driver.h b/usb/wdf_osrfx2_lab/umdf/step1/Driver.h
deleted file mode 100644
index 800ab1d9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/Driver.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the skeleton sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/OsrUsbFx2.ctl b/usb/wdf_osrfx2_lab/umdf/step1/OsrUsbFx2.ctl
deleted file mode 100644
index 4dab56ae..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/OsrUsbFx2.ctl
+++ /dev/null
@@ -1 +0,0 @@
-da5fbdfd-1eae-4ecf-b426-a3818f325ddb WudfOsrUsbFx2TraceGuid
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/OsrUsbFx2.rc b/usb/wdf_osrfx2_lab/umdf/step1/OsrUsbFx2.rc
deleted file mode 100644
index 36f10ea9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/OsrUsbFx2.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// OsrUsbDevice.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF OSR USB Fx2 User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "WUDFOsrUsbFx2"
-#define VER_ORIGINALFILENAME_STR "WUDFOsrUsbFx2.dll"
-
-#include "common.ver"
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx b/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx
deleted file mode 100644
index 69f0c0c4..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.inx
+++ /dev/null
Binary files differ
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.vcxproj b/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.vcxproj
deleted file mode 100644
index 676fbe6e..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.vcxproj
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{94BDC8D1-B62F-4200-9873-D403B6D30301}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{A2C76CA1-1B47-420E-9768-93D69A3266B6}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="OsrUsbFx2.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFOsrUsbFx2_1</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFOsrUsbFx2_1</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFOsrUsbFx2_1</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFOsrUsbFx2_1</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.vcxproj.Filters b/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.vcxproj.Filters
deleted file mode 100644
index 6b21dc4a..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/WUDFOsrUsbFx2_1.vcxproj.Filters
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{83D4660B-A09F-4A40-A1FD-237876304103}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{3C16D1C8-B1DE-467D-9DF0-AE732A9B8915}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{E23C96E3-DE9A-457A-A1D4-DA476B16AD08}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{C71DC5A8-0692-4670-A5B8-B6706FA885E7}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/comsup.cpp b/usb/wdf_osrfx2_lab/umdf/step1/comsup.cpp
deleted file mode 100644
index 9c9aec3b..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/comsup.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/comsup.h b/usb/wdf_osrfx2_lab/umdf/step1/comsup.h
deleted file mode 100644
index dedf78c8..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/comsup.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/dllsup.cpp b/usb/wdf_osrfx2_lab/umdf/step1/dllsup.cpp
deleted file mode 100644
index bd681ac2..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/dllsup.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the skeleton uses
- L"Microsoft\\UMDF\\Skeleton"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the skeleton sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing, and saves the module handle away in a
- global variable so that it can be referenced should the COM registration
- code (Dll[Un]RegisterServer) be called.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
- UNREFERENCED_PARAMETER(ModuleHandle);
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllCanUnloadNow(
- VOID
- )
-/*++
-
- Routine Description:
-
- Called by the COM runtime when determining whether or not this module
- can be unloaded. Our answer is always "no".
-
- Arguments:
-
- None
-
- Return Value:
-
- S_FALSE
-
---*/
-{
- return S_FALSE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- REFCLSID ClassId,
- REFIID InterfaceId,
- LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- skeleton driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/exports.def b/usb/wdf_osrfx2_lab/umdf/step1/exports.def
deleted file mode 100644
index 15f923d3..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/exports.def
+++ /dev/null
@@ -1,4 +0,0 @@
-; WudfOsrUsbDriver.def : Declares the module parameters.
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/usb/wdf_osrfx2_lab/umdf/step1/internal.h b/usb/wdf_osrfx2_lab/umdf/step1/internal.h
deleted file mode 100644
index 374931e0..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step1/internal.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF Skeleton
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF Headers
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Get limits on common data types (ULONG_MAX for example)
-//
-
-#include "limits.h"
-
-//
-// We need usb I/O targets to talk to the OSR device.
-//
-
-#include "wudfusb.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "public.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "WUDFOsrUsbPublic.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-
-typedef class CMyControlQueue *PCMyControlQueue;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- WudfOsrUsbFx2TraceGuid, (da5fbdfd,1eae,4ecf,b426,a3818f325ddb), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- WPP_DEFINE_BIT(TEST_TRACE_DRIVER) \
- WPP_DEFINE_BIT(TEST_TRACE_DEVICE) \
- WPP_DEFINE_BIT(TEST_TRACE_QUEUE) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
- WPP_LEVEL_LOGGER(flags)
-
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
- (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\OsrUsb"
-#define MYDRIVER_CLASS_ID {0x0865b2b0, 0x6b73, 0x428f, {0xa3, 0xea, 0x21, 0x72, 0x83, 0x2d, 0x6b, 0xfc}}
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "list.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_TEST_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/Device.cpp b/usb/wdf_osrfx2_lab/umdf/step2/Device.cpp
deleted file mode 100644
index 433309ca..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/Device.cpp
+++ /dev/null
@@ -1,483 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton sample driver's
- device callback object.
-
- The skeleton sample device does very little. It does not implement either
- of the PNP interfaces so once the device is setup, it won't ever get any
- callbacks until the device is removed.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "initguid.h"
-#include "usb_hw.h"
-
-#include "device.tmh"
-
-CMyDevice::~CMyDevice(
- )
-{
-}
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the skeleton driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice = NULL;
-
- HRESULT hr = S_OK;
-
- //
- // TODO: If you're writing a filter driver then indicate that here.
- //
- // FxDeviceInit->SetFilter();
- //
-
- //
- // Set no locking unless you need an automatic callbacks synchronization
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // TODO: Any per-device initialization which must be done before
- // creating the partner object.
- //
-
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- if (SUCCEEDED(hr))
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr = S_OK;
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_OSRUSBFX2,
- NULL);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Since the skeleton driver doesn't support any of the device events, this
- method simply calls the base class's BaseQueryInterface.
-
- If the skeleton is extended to include device event interfaces then this
- method must be changed to check the IID and return pointers to them as
- appropriate.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
- if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackHardware)))
- {
- *Object = QueryIPnpCallbackHardware();
- hr = S_OK;
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnPrepareHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked to ready the driver
- to talk to hardware. It opens the handle to the
- device and talks to it using the WINUSB interface.
- It invokes WINUSB to discver the interfaces and stores
- the information related to bulk endpoints.
-
-Arguments:
-
- FxDevice : Pointer to the WDF device interface
-
-Return Value:
-
- HRESULT
-
---*/
-{
- PWSTR deviceName = NULL;
- DWORD deviceNameCch = 0;
-
- HRESULT hr;
-
- //
- // Get the device name.
- // Get the length to allocate first
- //
-
- hr = m_FxDevice->RetrieveDeviceName(NULL, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!hresult!",
- hr
- );
- }
-
- //
- // Allocate the buffer
- //
-
- if (SUCCEEDED(hr))
- {
- deviceName = new WCHAR[deviceNameCch];
-
- if (deviceName == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- }
-
- //
- // Get the actual name
- //
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->RetrieveDeviceName(deviceName, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!hresult!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Device name %S",
- deviceName
- );
- }
-
- //
- // Create USB I/O Targets and configure them
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CreateUsbIoTargets();
- }
-
- if (SUCCEEDED(hr))
- {
- ULONG length = sizeof(m_Speed);
-
- hr = m_pIUsbTargetDevice->RetrieveDeviceInformation(DEVICE_SPEED,
- &length,
- &m_Speed);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb device speed information %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Speed - %x\n",
- m_Speed
- );
- }
-
- delete[] deviceName;
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnReleaseHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked when the device is being removed or stopped
- It releases all resources allocated for this device.
-
-Arguments:
-
- FxDevice - Pointer to the Device object.
-
-Return Value:
-
- HRESULT - Always succeeds.
-
---*/
-{
- //
- // Remove I/O target from object tree before any potential subsequent
- // OnPrepareHardware creates a new one
- //
-
- if (m_pIUsbTargetDevice)
- {
- m_pIUsbTargetDevice->DeleteWdfObject();
- }
-
- return S_OK;
-}
-
-HRESULT
-CMyDevice::CreateUsbIoTargets(
- )
-/*++
-
-Routine Description:
-
- This routine creates Usb device, interface and pipe objects
-
-Arguments:
-
- None
-
-Return Value:
-
- HRESULT
---*/
-{
- HRESULT hr;
- IWDFUsbTargetFactory * pIUsbTargetFactory = NULL;
- IWDFUsbTargetDevice * pIUsbTargetDevice = NULL;
-
- hr = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pIUsbTargetFactory));
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb target factory %!HRESULT!",
- hr
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pIUsbTargetFactory->CreateUsbTargetDevice(
- &pIUsbTargetDevice);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to create USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- m_pIUsbTargetDevice = pIUsbTargetDevice;
-
- //
- // Release the creation reference as object tree will maintain a reference
- //
-
- pIUsbTargetDevice->Release();
- }
-
- SAFE_RELEASE(pIUsbTargetFactory);
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/Device.h b/usb/wdf_osrfx2_lab/umdf/step2/Device.h
deleted file mode 100644
index dadbfd5b..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/Device.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "internal.h"
-
-//
-// Class for the iotrace driver.
-//
-
-class CMyDevice :
- public CUnknown,
- public IPnpCallbackHardware
-{
-
-//
-// Private data members.
-//
-private:
- //
- // Weak reference to framework device
- //
- IWDFDevice *m_FxDevice;
-
- //
- // USB Device I/O Target
- //
- IWDFUsbTargetDevice * m_pIUsbTargetDevice;
-
-
- //
- // Device Speed (Low, Full, High)
- //
- UCHAR m_Speed;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- ) :
- m_FxDevice(NULL),
- m_pIUsbTargetDevice(NULL),
- m_Speed(0)
- {
- }
-
- ~CMyDevice(
- );
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- //
- // Helper methods
- //
-
- HRESULT
- CreateUsbIoTargets(
- VOID
- );
-
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- IWDFDevice *
- GetFxDevice(
- VOID
- )
- {
- return m_FxDevice;
- }
-
- HRESULT
- Configure(
- VOID
- );
-
- IPnpCallbackHardware *
- QueryIPnpCallbackHardware(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallbackHardware *>(this);
- }
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IPnpCallbackHardware
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnPrepareHardware(
- _In_ IWDFDevice *FxDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnReleaseHardware(
- _In_ IWDFDevice *FxDevice
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/Driver.cpp b/usb/wdf_osrfx2_lab/umdf/step2/Driver.cpp
deleted file mode 100644
index bac5caca..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/Driver.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // TODO: Do any per-device initialization (reading settings from the
- // registry for example) that's necessary before creating your
- // device callback object here. Otherwise you can leave such
- // initialization to the initialization of the device event
- // handler.
- //
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // TODO: Change any per-device settings that the object exposes before
- // calling Configure to let it complete its initialization.
- //
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/Driver.h b/usb/wdf_osrfx2_lab/umdf/step2/Driver.h
deleted file mode 100644
index 800ab1d9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/Driver.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the skeleton sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/OsrUsbFx2.ctl b/usb/wdf_osrfx2_lab/umdf/step2/OsrUsbFx2.ctl
deleted file mode 100644
index 4dab56ae..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/OsrUsbFx2.ctl
+++ /dev/null
@@ -1 +0,0 @@
-da5fbdfd-1eae-4ecf-b426-a3818f325ddb WudfOsrUsbFx2TraceGuid
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/OsrUsbFx2.rc b/usb/wdf_osrfx2_lab/umdf/step2/OsrUsbFx2.rc
deleted file mode 100644
index 36f10ea9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/OsrUsbFx2.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// OsrUsbDevice.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF OSR USB Fx2 User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "WUDFOsrUsbFx2"
-#define VER_ORIGINALFILENAME_STR "WUDFOsrUsbFx2.dll"
-
-#include "common.ver"
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx b/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx
deleted file mode 100644
index 98d8c453..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.inx
+++ /dev/null
Binary files differ
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.vcxproj b/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.vcxproj
deleted file mode 100644
index c73716b9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.vcxproj
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{808B6774-93FA-4ABF-A23F-35C55FA80B80}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{A944547C-61E9-47C5-82EC-797D95019735}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="OsrUsbFx2.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFOsrUsbFx2_2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFOsrUsbFx2_2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFOsrUsbFx2_2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFOsrUsbFx2_2</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.vcxproj.Filters b/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.vcxproj.Filters
deleted file mode 100644
index 228729fe..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/WUDFOsrUsbFx2_2.vcxproj.Filters
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{CAFDA06D-52D2-4C5B-B355-1D19E80B1C72}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{2C5F0467-9539-41AD-95E0-0BD835F2F9EE}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{310FFCBB-E46B-43FA-B790-61A981127DBF}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{04E87A31-118A-4F72-8349-D26123A6EE71}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/comsup.cpp b/usb/wdf_osrfx2_lab/umdf/step2/comsup.cpp
deleted file mode 100644
index 9c9aec3b..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/comsup.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/comsup.h b/usb/wdf_osrfx2_lab/umdf/step2/comsup.h
deleted file mode 100644
index dedf78c8..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/comsup.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/dllsup.cpp b/usb/wdf_osrfx2_lab/umdf/step2/dllsup.cpp
deleted file mode 100644
index bd681ac2..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/dllsup.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the skeleton uses
- L"Microsoft\\UMDF\\Skeleton"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the skeleton sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing, and saves the module handle away in a
- global variable so that it can be referenced should the COM registration
- code (Dll[Un]RegisterServer) be called.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
- UNREFERENCED_PARAMETER(ModuleHandle);
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllCanUnloadNow(
- VOID
- )
-/*++
-
- Routine Description:
-
- Called by the COM runtime when determining whether or not this module
- can be unloaded. Our answer is always "no".
-
- Arguments:
-
- None
-
- Return Value:
-
- S_FALSE
-
---*/
-{
- return S_FALSE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- REFCLSID ClassId,
- REFIID InterfaceId,
- LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- skeleton driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/exports.def b/usb/wdf_osrfx2_lab/umdf/step2/exports.def
deleted file mode 100644
index 15f923d3..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/exports.def
+++ /dev/null
@@ -1,4 +0,0 @@
-; WudfOsrUsbDriver.def : Declares the module parameters.
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/usb/wdf_osrfx2_lab/umdf/step2/internal.h b/usb/wdf_osrfx2_lab/umdf/step2/internal.h
deleted file mode 100644
index 374931e0..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step2/internal.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF Skeleton
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF Headers
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Get limits on common data types (ULONG_MAX for example)
-//
-
-#include "limits.h"
-
-//
-// We need usb I/O targets to talk to the OSR device.
-//
-
-#include "wudfusb.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "public.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "WUDFOsrUsbPublic.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-
-typedef class CMyControlQueue *PCMyControlQueue;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- WudfOsrUsbFx2TraceGuid, (da5fbdfd,1eae,4ecf,b426,a3818f325ddb), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- WPP_DEFINE_BIT(TEST_TRACE_DRIVER) \
- WPP_DEFINE_BIT(TEST_TRACE_DEVICE) \
- WPP_DEFINE_BIT(TEST_TRACE_QUEUE) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
- WPP_LEVEL_LOGGER(flags)
-
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
- (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\OsrUsb"
-#define MYDRIVER_CLASS_ID {0x0865b2b0, 0x6b73, 0x428f, {0xa3, 0xea, 0x21, 0x72, 0x83, 0x2d, 0x6b, 0xfc}}
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "list.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_TEST_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/ControlQueue.cpp b/usb/wdf_osrfx2_lab/umdf/step3/ControlQueue.cpp
deleted file mode 100644
index 48de237d..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/ControlQueue.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ControlQueue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "winioctl.h"
-
-#include "ControlQueue.tmh"
-
-CMyControlQueue::CMyControlQueue(
- _In_ PCMyDevice Device
- ) : CMyQueue(Device)
-{
-
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CMyControlQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
-
- if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackDeviceIoControl)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackDeviceIoControl();
-
- }
- else
- {
- hr = CMyQueue::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyControlQueue::CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyControlQueue *Queue
- )
-/*++
-
-Routine Description:
-
-
- CreateInstance creates an instance of the queue object.
-
-Aruments:
-
- ppUkwn - OUT parameter is an IUnknown interface to the queue object
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- PCMyControlQueue queue = NULL;
- HRESULT hr = S_OK;
-
- queue = new CMyControlQueue(Device);
-
- if (NULL == queue)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Call the queue callback object to initialize itself. This will create
- // its partner queue framework object.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = queue->Initialize();
- }
-
- if (SUCCEEDED(hr))
- {
- *Queue = queue;
- }
- else
- {
- SAFE_RELEASE(queue);
- }
-
- return hr;
-}
-
-HRESULT
-CMyControlQueue::Initialize(
- VOID
- )
-{
- HRESULT hr;
-
- //
- // First initialize the base class. This will create the partner FxIoQueue
- // object and setup automatic forwarding of I/O controls.
- //
-
- hr = __super::Initialize(WdfIoQueueDispatchSequential,
- false,
- true);
-
- //
- // return the status.
- //
-
- return hr;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyControlQueue::OnDeviceIoControl(
- _In_ IWDFIoQueue *FxQueue,
- _In_ IWDFIoRequest *FxRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- DeviceIoControl dispatch routine
-
-Aruments:
-
- FxQueue - Framework Queue instance
- FxRequest - Framework Request instance
- ControlCode - IO Control Code
- InputBufferSizeInBytes - Lenth of input buffer
- OutputBufferSizeInBytes - Lenth of output buffer
-
- Always succeeds DeviceIoIoctl
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(FxQueue);
- UNREFERENCED_PARAMETER(OutputBufferSizeInBytes);
-
- IWDFMemory *memory = NULL;
- PVOID buffer;
-
- SIZE_T bigBufferCb;
-
- ULONG information = 0;
-
- bool completeRequest = true;
-
- HRESULT hr = S_OK;
-
- switch (ControlCode)
- {
- case IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the input for the
- // control transfer.
- //
-
- if (InputBufferSizeInBytes < sizeof(BAR_GRAPH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetInputMemory(&memory);
- }
-
- //
- // Get the data buffer and use it to set the bar graph on the
- // device.
- //
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->SetBarGraphDisplay((PBAR_GRAPH_STATE) buffer);
- }
-
- break;
- }
-
- default:
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION);
- break;
- }
- }
-
- if (completeRequest)
- {
- FxRequest->CompleteWithInformation(hr, information);
- }
-
- return;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/ControlQueue.h b/usb/wdf_osrfx2_lab/umdf/step3/ControlQueue.h
deleted file mode 100644
index 251521e1..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/ControlQueue.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ControlQueue.h
-
-Abstract:
-
- This file defines the queue callback object for handling device I/O
- control requests. This is a serialized queue.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class CMyControlQueue : public IQueueCallbackDeviceIoControl,
- public CMyQueue
-{
- HRESULT
- Initialize(
- VOID
- );
-
-public:
-
- CMyControlQueue(
- _In_ PCMyDevice Device
- );
-
- virtual
- ~CMyControlQueue(
- VOID
- )
- {
- return;
- }
-
- static
- HRESULT
- CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyControlQueue *Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return S_OK;
- }
-
- IQueueCallbackDeviceIoControl *
- QueryIQueueCallbackDeviceIoControl(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackDeviceIoControl *>(this);
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // Wdf Callbacks
- //
-
- //
- // IQueueCallbackDeviceIoControl
- //
- STDMETHOD_ (void, OnDeviceIoControl)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- );
-};
-
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/Device.cpp b/usb/wdf_osrfx2_lab/umdf/step3/Device.cpp
deleted file mode 100644
index 20c997c5..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/Device.cpp
+++ /dev/null
@@ -1,644 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton sample driver's
- device callback object.
-
- The skeleton sample device does very little. It does not implement either
- of the PNP interfaces so once the device is setup, it won't ever get any
- callbacks until the device is removed.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "initguid.h"
-#include "usb_hw.h"
-
-#include "device.tmh"
-
-CMyDevice::~CMyDevice(
- )
-{
-}
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the skeleton driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice = NULL;
-
- HRESULT hr = S_OK;
-
- //
- // TODO: If you're writing a filter driver then indicate that here.
- //
- // FxDeviceInit->SetFilter();
- //
-
- //
- // Set no locking unless you need an automatic callbacks synchronization
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // TODO: Any per-device initialization which must be done before
- // creating the partner object.
- //
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- if (SUCCEEDED(hr))
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr = S_OK;
-
-
- //
- // Create the control queue and configure forwarding for IOCTL requests.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CMyControlQueue::CreateInstance(this, &m_ControlQueue);
-
- if (SUCCEEDED(hr))
- {
- hr = m_ControlQueue->Configure();
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->ConfigureRequestDispatching(
- m_ControlQueue->GetFxQueue(),
- WdfRequestDeviceIoControl,
- true
- );
- }
- m_ControlQueue->Release();
- }
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_OSRUSBFX2,
- NULL);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Since the skeleton driver doesn't support any of the device events, this
- method simply calls the base class's BaseQueryInterface.
-
- If the skeleton is extended to include device event interfaces then this
- method must be changed to check the IID and return pointers to them as
- appropriate.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
- if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackHardware)))
- {
- *Object = QueryIPnpCallbackHardware();
- hr = S_OK;
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnPrepareHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked to ready the driver
- to talk to hardware. It opens the handle to the
- device and talks to it using the WINUSB interface.
- It invokes WINUSB to discver the interfaces and stores
- the information related to bulk endpoints.
-
-Arguments:
-
- FxDevice : Pointer to the WDF device interface
-
-Return Value:
-
- HRESULT
-
---*/
-{
- PWSTR deviceName = NULL;
- DWORD deviceNameCch = 0;
-
- HRESULT hr;
-
- //
- // Get the device name.
- // Get the length to allocate first
- //
-
- hr = m_FxDevice->RetrieveDeviceName(NULL, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!hresult!",
- hr
- );
- }
-
- //
- // Allocate the buffer
- //
-
- if (SUCCEEDED(hr))
- {
- deviceName = new WCHAR[deviceNameCch];
-
- if (deviceName == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- }
-
- //
- // Get the actual name
- //
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->RetrieveDeviceName(deviceName, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!hresult!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Device name %S",
- deviceName
- );
- }
-
- //
- // Create USB I/O Targets and configure them
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CreateUsbIoTargets();
- }
-
- if (SUCCEEDED(hr))
- {
- ULONG length = sizeof(m_Speed);
-
- hr = m_pIUsbTargetDevice->RetrieveDeviceInformation(DEVICE_SPEED,
- &length,
- &m_Speed);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb device speed information %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Speed - %x\n",
- m_Speed
- );
- }
-
- delete[] deviceName;
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnReleaseHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked when the device is being removed or stopped
- It releases all resources allocated for this device.
-
-Arguments:
-
- FxDevice - Pointer to the Device object.
-
-Return Value:
-
- HRESULT - Always succeeds.
-
---*/
-{
- //
- // Remove I/O target from object tree before any potential subsequent
- // OnPrepareHardware creates a new one
- //
-
- if (m_pIUsbTargetDevice)
- {
- m_pIUsbTargetDevice->DeleteWdfObject();
- }
-
- return S_OK;
-}
-
-HRESULT
-CMyDevice::CreateUsbIoTargets(
- )
-/*++
-
-Routine Description:
-
- This routine creates Usb device, interface and pipe objects
-
-Arguments:
-
- None
-
-Return Value:
-
- HRESULT
---*/
-{
- HRESULT hr;
- IWDFUsbTargetFactory * pIUsbTargetFactory = NULL;
- IWDFUsbTargetDevice * pIUsbTargetDevice = NULL;
-
- hr = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pIUsbTargetFactory));
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb target factory %!HRESULT!",
- hr
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pIUsbTargetFactory->CreateUsbTargetDevice(
- &pIUsbTargetDevice);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to create USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- m_pIUsbTargetDevice = pIUsbTargetDevice;
-
- //
- // Release the creation reference as object tree will maintain a reference
- //
-
- pIUsbTargetDevice->Release();
- }
-
- SAFE_RELEASE(pIUsbTargetFactory);
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- )
-/*++
-
- Routine Description:
-
- This method synchronously sets the bar graph display on the OSR USB-FX2
- device using the buffers in the FxRequest as input.
-
- Arguments:
-
- FxRequest - the request to set the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesTransferred;
-
- HRESULT hr = S_OK;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestHostToDevice,
- BmRequestToDevice,
- USBFX2LK_SET_BARGRAPH_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) BarGraphState,
- sizeof(BAR_GRAPH_STATE),
- &bytesTransferred
- );
-
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- )
-{
- HRESULT hr = S_OK;
- HRESULT hrRequest = S_OK;
- IWDFIoRequest *pWdfRequest = NULL;
- IWDFDriver * FxDriver = NULL;
- IWDFMemory * FxMemory = NULL;
- IWDFRequestCompletionParams * FxComplParams = NULL;
- IWDFUsbRequestCompletionParams * FxUsbComplParams = NULL;
-
- *LengthTransferred = 0;
-
- hr = m_FxDevice->CreateRequest( NULL, //pCallbackInterface
- NULL, //pParentObject
- &pWdfRequest);
- hrRequest = hr;
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice->GetDriver(&FxDriver);
-
- hr = FxDriver->CreatePreallocatedWdfMemory( Buffer,
- BufferLength,
- NULL, //pCallbackInterface
- pWdfRequest, //pParetObject
- &FxMemory );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_pIUsbTargetDevice->FormatRequestForControlTransfer( pWdfRequest,
- SetupPacket,
- FxMemory,
- NULL); //TransferOffset
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pWdfRequest->Send( m_pIUsbTargetDevice,
- WDF_REQUEST_SEND_OPTION_SYNCHRONOUS,
- 0); //Timeout
- }
-
- if (SUCCEEDED(hr))
- {
- pWdfRequest->GetCompletionParams(&FxComplParams);
-
- hr = FxComplParams->GetCompletionStatus();
- }
-
- if (SUCCEEDED(hr))
- {
- HRESULT hrQI = FxComplParams->QueryInterface(IID_PPV_ARGS(&FxUsbComplParams));
- WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrQI));
-
- WUDF_TEST_DRIVER_ASSERT( WdfUsbRequestTypeDeviceControlTransfer ==
- FxUsbComplParams->GetCompletedUsbRequestType() );
-
- FxUsbComplParams->GetDeviceControlTransferParameters( NULL,
- LengthTransferred,
- NULL,
- NULL );
- }
-
- SAFE_RELEASE(FxUsbComplParams);
- SAFE_RELEASE(FxComplParams);
- SAFE_RELEASE(FxMemory);
-
- if (SUCCEEDED(hrRequest))
- {
- pWdfRequest->DeleteWdfObject();
- }
- SAFE_RELEASE(pWdfRequest);
-
- SAFE_RELEASE(FxDriver);
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/Device.h b/usb/wdf_osrfx2_lab/umdf/step3/Device.h
deleted file mode 100644
index 6d343582..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/Device.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "internal.h"
-
-//
-// Define the vendor commands supported by our device
-//
-#define USBFX2LK_SET_BARGRAPH_DISPLAY 0xD8
-
-//
-// Class for the iotrace driver.
-//
-
-class CMyDevice :
- public CUnknown,
- public IPnpCallbackHardware
-{
-
-//
-// Private data members.
-//
-private:
- //
- // Weak reference to framework device
- //
- IWDFDevice *m_FxDevice;
-
- //
- // Weak reference to the control queue
- //
- PCMyControlQueue m_ControlQueue;
-
- //
- // USB Device I/O Target
- //
- IWDFUsbTargetDevice * m_pIUsbTargetDevice;
-
-
- //
- // Device Speed (Low, Full, High)
- //
- UCHAR m_Speed;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- ) :
- m_FxDevice(NULL),
- m_ControlQueue(NULL),
- m_pIUsbTargetDevice(NULL),
- m_Speed(0)
- {
- }
-
- ~CMyDevice(
- );
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- //
- // Helper methods
- //
-
- HRESULT
- CreateUsbIoTargets(
- VOID
- );
-
- HRESULT
- SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- IWDFDevice *
- GetFxDevice(
- VOID
- )
- {
- return m_FxDevice;
- }
-
- HRESULT
- Configure(
- VOID
- );
-
- IPnpCallbackHardware *
- QueryIPnpCallbackHardware(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallbackHardware *>(this);
- }
-
- HRESULT
- SetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IPnpCallbackHardware
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnPrepareHardware(
- _In_ IWDFDevice *FxDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnReleaseHardware(
- _In_ IWDFDevice *FxDevice
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/Driver.cpp b/usb/wdf_osrfx2_lab/umdf/step3/Driver.cpp
deleted file mode 100644
index bac5caca..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/Driver.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // TODO: Do any per-device initialization (reading settings from the
- // registry for example) that's necessary before creating your
- // device callback object here. Otherwise you can leave such
- // initialization to the initialization of the device event
- // handler.
- //
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // TODO: Change any per-device settings that the object exposes before
- // calling Configure to let it complete its initialization.
- //
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/Driver.h b/usb/wdf_osrfx2_lab/umdf/step3/Driver.h
deleted file mode 100644
index 800ab1d9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/Driver.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the skeleton sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/OsrUsbFx2.ctl b/usb/wdf_osrfx2_lab/umdf/step3/OsrUsbFx2.ctl
deleted file mode 100644
index 4dab56ae..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/OsrUsbFx2.ctl
+++ /dev/null
@@ -1 +0,0 @@
-da5fbdfd-1eae-4ecf-b426-a3818f325ddb WudfOsrUsbFx2TraceGuid
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/OsrUsbFx2.rc b/usb/wdf_osrfx2_lab/umdf/step3/OsrUsbFx2.rc
deleted file mode 100644
index 36f10ea9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/OsrUsbFx2.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// OsrUsbDevice.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF OSR USB Fx2 User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "WUDFOsrUsbFx2"
-#define VER_ORIGINALFILENAME_STR "WUDFOsrUsbFx2.dll"
-
-#include "common.ver"
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/Queue.cpp b/usb/wdf_osrfx2_lab/umdf/step3/Queue.cpp
deleted file mode 100644
index c56b38bb..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/Queue.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "queue.tmh"
-
-CMyQueue::CMyQueue(
- _In_ PCMyDevice Device
- ) :
- m_FxQueue(NULL),
- m_Device(Device)
-{
-}
-
-//
-// Queue destructor.
-// Free up the buffer, wait for thread to terminate and
-//
-
-CMyQueue::~CMyQueue(
- VOID
- )
-/*++
-
-Routine Description:
-
-
- IUnknown implementation of Release
-
-Aruments:
-
-
-Return Value:
-
- ULONG (reference count after Release)
-
---*/
-{
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC! Entry"
- );
-
-}
-
-
-HRESULT
-STDMETHODCALLTYPE
-CMyQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
- hr = CUnknown::QueryInterface(InterfaceId, Object);
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyQueue::Initialize(
- _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType,
- _In_ bool Default,
- _In_ bool PowerManaged
- )
-{
- IWDFIoQueue *fxQueue;
- HRESULT hr;
-
- //
- // Create the I/O Queue object.
- //
-
- {
- IUnknown *callback = QueryIUnknown();
-
- hr = m_Device->GetFxDevice()->CreateIoQueue(
- callback,
- Default,
- DispatchType,
- PowerManaged,
- FALSE,
- &fxQueue
- );
- callback->Release();
- }
-
- if (SUCCEEDED(hr))
- {
- m_FxQueue = fxQueue;
-
- //
- // Release the creation reference on the queue. This object will be
- // destroyed before the queue so we don't need to have a reference out
- // on it.
- //
-
- fxQueue->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyQueue::Configure(
- VOID
- )
-{
- return S_OK;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/Queue.h b/usb/wdf_osrfx2_lab/umdf/step3/Queue.h
deleted file mode 100644
index 5659224b..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/Queue.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class CMyQueue :
- public CUnknown
-{
-protected:
- //
- // Unreferenced pointer to the partner Fx device.
- //
-
- IWDFIoQueue *m_FxQueue;
-
- //
- // Unreferenced pointer to the parent device.
- //
-
- PCMyDevice m_Device;
-
- HRESULT
- Initialize(
- _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType,
- _In_ bool Default,
- _In_ bool PowerManaged
- );
-
-protected:
-
- CMyQueue(
- _In_ PCMyDevice Device
- );
-
- virtual ~CMyQueue();
-
- HRESULT
- Configure(
- VOID
- );
-
-public:
-
- IWDFIoQueue *
- GetFxQueue(
- VOID
- )
- {
- return m_FxQueue;
- }
-
-
- PCMyDevice
- GetDevice(
- VOID
- )
- {
- return m_Device;
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx b/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx
deleted file mode 100644
index c4846f6e..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.inx
+++ /dev/null
Binary files differ
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.vcxproj b/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.vcxproj
deleted file mode 100644
index 1bccba8b..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.vcxproj
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{4BED411D-1B55-4A64-84C9-36EC25F083D2}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{9EBE799A-093D-4C8A-9CDC-63244A61D166}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp; queue.cpp; ControlQueue.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="OsrUsbFx2.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFOsrUsbFx2_3</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFOsrUsbFx2_3</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFOsrUsbFx2_3</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFOsrUsbFx2_3</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.vcxproj.Filters b/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.vcxproj.Filters
deleted file mode 100644
index 1007a353..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/WUDFOsrUsbFx2_3.vcxproj.Filters
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{275FF43B-A34B-4413-A946-DB6C89B85700}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{3E57B132-7C76-4977-9406-304A1D0E3E93}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{9A62ABB9-1665-44C3-A018-B30C085A8EC5}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{6FE8DFE2-D3E3-4713-9FD8-A937B598C72C}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ControlQueue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/comsup.cpp b/usb/wdf_osrfx2_lab/umdf/step3/comsup.cpp
deleted file mode 100644
index 9c9aec3b..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/comsup.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/comsup.h b/usb/wdf_osrfx2_lab/umdf/step3/comsup.h
deleted file mode 100644
index dedf78c8..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/comsup.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/dllsup.cpp b/usb/wdf_osrfx2_lab/umdf/step3/dllsup.cpp
deleted file mode 100644
index bd681ac2..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/dllsup.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the skeleton uses
- L"Microsoft\\UMDF\\Skeleton"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the skeleton sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing, and saves the module handle away in a
- global variable so that it can be referenced should the COM registration
- code (Dll[Un]RegisterServer) be called.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
- UNREFERENCED_PARAMETER(ModuleHandle);
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllCanUnloadNow(
- VOID
- )
-/*++
-
- Routine Description:
-
- Called by the COM runtime when determining whether or not this module
- can be unloaded. Our answer is always "no".
-
- Arguments:
-
- None
-
- Return Value:
-
- S_FALSE
-
---*/
-{
- return S_FALSE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- REFCLSID ClassId,
- REFIID InterfaceId,
- LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- skeleton driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/exports.def b/usb/wdf_osrfx2_lab/umdf/step3/exports.def
deleted file mode 100644
index 15f923d3..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/exports.def
+++ /dev/null
@@ -1,4 +0,0 @@
-; WudfOsrUsbDriver.def : Declares the module parameters.
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/usb/wdf_osrfx2_lab/umdf/step3/internal.h b/usb/wdf_osrfx2_lab/umdf/step3/internal.h
deleted file mode 100644
index 7db8f1c4..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step3/internal.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF Skeleton
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF Headers
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Get limits on common data types (ULONG_MAX for example)
-//
-
-#include "limits.h"
-
-//
-// We need usb I/O targets to talk to the OSR device.
-//
-
-#include "wudfusb.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "public.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "WUDFOsrUsbPublic.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-
-typedef class CMyControlQueue *PCMyControlQueue;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- WudfOsrUsbFx2TraceGuid, (da5fbdfd,1eae,4ecf,b426,a3818f325ddb), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- WPP_DEFINE_BIT(TEST_TRACE_DRIVER) \
- WPP_DEFINE_BIT(TEST_TRACE_DEVICE) \
- WPP_DEFINE_BIT(TEST_TRACE_QUEUE) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
- WPP_LEVEL_LOGGER(flags)
-
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
- (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\OsrUsb"
-#define MYDRIVER_CLASS_ID {0x0865b2b0, 0x6b73, 0x428f, {0xa3, 0xea, 0x21, 0x72, 0x83, 0x2d, 0x6b, 0xfc}}
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "queue.h"
-#include "ControlQueue.h"
-#include "list.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_TEST_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/ControlQueue.cpp b/usb/wdf_osrfx2_lab/umdf/step4/ControlQueue.cpp
deleted file mode 100644
index 48de237d..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/ControlQueue.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ControlQueue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "winioctl.h"
-
-#include "ControlQueue.tmh"
-
-CMyControlQueue::CMyControlQueue(
- _In_ PCMyDevice Device
- ) : CMyQueue(Device)
-{
-
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CMyControlQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
-
- if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackDeviceIoControl)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackDeviceIoControl();
-
- }
- else
- {
- hr = CMyQueue::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyControlQueue::CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyControlQueue *Queue
- )
-/*++
-
-Routine Description:
-
-
- CreateInstance creates an instance of the queue object.
-
-Aruments:
-
- ppUkwn - OUT parameter is an IUnknown interface to the queue object
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- PCMyControlQueue queue = NULL;
- HRESULT hr = S_OK;
-
- queue = new CMyControlQueue(Device);
-
- if (NULL == queue)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Call the queue callback object to initialize itself. This will create
- // its partner queue framework object.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = queue->Initialize();
- }
-
- if (SUCCEEDED(hr))
- {
- *Queue = queue;
- }
- else
- {
- SAFE_RELEASE(queue);
- }
-
- return hr;
-}
-
-HRESULT
-CMyControlQueue::Initialize(
- VOID
- )
-{
- HRESULT hr;
-
- //
- // First initialize the base class. This will create the partner FxIoQueue
- // object and setup automatic forwarding of I/O controls.
- //
-
- hr = __super::Initialize(WdfIoQueueDispatchSequential,
- false,
- true);
-
- //
- // return the status.
- //
-
- return hr;
-}
-
-VOID
-STDMETHODCALLTYPE
-CMyControlQueue::OnDeviceIoControl(
- _In_ IWDFIoQueue *FxQueue,
- _In_ IWDFIoRequest *FxRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- DeviceIoControl dispatch routine
-
-Aruments:
-
- FxQueue - Framework Queue instance
- FxRequest - Framework Request instance
- ControlCode - IO Control Code
- InputBufferSizeInBytes - Lenth of input buffer
- OutputBufferSizeInBytes - Lenth of output buffer
-
- Always succeeds DeviceIoIoctl
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(FxQueue);
- UNREFERENCED_PARAMETER(OutputBufferSizeInBytes);
-
- IWDFMemory *memory = NULL;
- PVOID buffer;
-
- SIZE_T bigBufferCb;
-
- ULONG information = 0;
-
- bool completeRequest = true;
-
- HRESULT hr = S_OK;
-
- switch (ControlCode)
- {
- case IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY:
- {
- //
- // Make sure the buffer is big enough to hold the input for the
- // control transfer.
- //
-
- if (InputBufferSizeInBytes < sizeof(BAR_GRAPH_STATE))
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- FxRequest->GetInputMemory(&memory);
- }
-
- //
- // Get the data buffer and use it to set the bar graph on the
- // device.
- //
-
- if (SUCCEEDED(hr))
- {
- buffer = memory->GetDataBuffer(&bigBufferCb);
- memory->Release();
-
- hr = m_Device->SetBarGraphDisplay((PBAR_GRAPH_STATE) buffer);
- }
-
- break;
- }
-
- default:
- {
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION);
- break;
- }
- }
-
- if (completeRequest)
- {
- FxRequest->CompleteWithInformation(hr, information);
- }
-
- return;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/ControlQueue.h b/usb/wdf_osrfx2_lab/umdf/step4/ControlQueue.h
deleted file mode 100644
index 251521e1..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/ControlQueue.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ControlQueue.h
-
-Abstract:
-
- This file defines the queue callback object for handling device I/O
- control requests. This is a serialized queue.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class CMyControlQueue : public IQueueCallbackDeviceIoControl,
- public CMyQueue
-{
- HRESULT
- Initialize(
- VOID
- );
-
-public:
-
- CMyControlQueue(
- _In_ PCMyDevice Device
- );
-
- virtual
- ~CMyControlQueue(
- VOID
- )
- {
- return;
- }
-
- static
- HRESULT
- CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyControlQueue *Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return S_OK;
- }
-
- IQueueCallbackDeviceIoControl *
- QueryIQueueCallbackDeviceIoControl(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackDeviceIoControl *>(this);
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- //
- // Wdf Callbacks
- //
-
- //
- // IQueueCallbackDeviceIoControl
- //
- STDMETHOD_ (void, OnDeviceIoControl)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- );
-};
-
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/Device.cpp b/usb/wdf_osrfx2_lab/umdf/step4/Device.cpp
deleted file mode 100644
index bc6700c5..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/Device.cpp
+++ /dev/null
@@ -1,812 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton sample driver's
- device callback object.
-
- The skeleton sample device does very little. It does not implement either
- of the PNP interfaces so once the device is setup, it won't ever get any
- callbacks until the device is removed.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "initguid.h"
-#include "usb_hw.h"
-
-#include "device.tmh"
-
-CMyDevice::~CMyDevice(
- )
-{
-}
-
-HRESULT
-CMyDevice::CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ PCMyDevice *Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the skeleton driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- PCMyDevice device;
- HRESULT hr;
-
- //
- // Allocate a new instance of the device class.
- //
-
- device = new CMyDevice();
-
- if (NULL == device)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the instance.
- //
-
- hr = device->Initialize(FxDriver, FxDeviceInit);
-
- if (SUCCEEDED(hr))
- {
- *Device = device;
- }
- else
- {
- device->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice = NULL;
-
- HRESULT hr = S_OK;
-
- //
- // TODO: If you're writing a filter driver then indicate that here.
- //
- // FxDeviceInit->SetFilter();
- //
-
- //
- // Set no locking unless you need an automatic callbacks synchronization
- //
-
- FxDeviceInit->SetLockingConstraint(None);
-
- //
- // TODO: Any per-device initialization which must be done before
- // creating the partner object.
- //
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // QueryIUnknown references the IUnknown interface that it returns
- // (which is the same as referencing the device). We pass that to
- // CreateDevice, which takes its own reference if everything works.
- //
-
- if (SUCCEEDED(hr))
- {
- IUnknown *unknown = this->QueryIUnknown();
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
-
- unknown->Release();
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- fxDevice->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr = S_OK;
-
- hr = CMyReadWriteQueue::CreateInstance(this, &m_ReadWriteQueue);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- //
- // We use default queue for read/write
- //
-
- hr = m_ReadWriteQueue->Configure();
-
- m_ReadWriteQueue->Release();
-
- //
- // Create the control queue and configure forwarding for IOCTL requests.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CMyControlQueue::CreateInstance(this, &m_ControlQueue);
-
- if (SUCCEEDED(hr))
- {
- hr = m_ControlQueue->Configure();
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->ConfigureRequestDispatching(
- m_ControlQueue->GetFxQueue(),
- WdfRequestDeviceIoControl,
- true
- );
- }
- m_ControlQueue->Release();
- }
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_OSRUSBFX2,
- NULL);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method is called to get a pointer to one of the object's callback
- interfaces.
-
- Since the skeleton driver doesn't support any of the device events, this
- method simply calls the base class's BaseQueryInterface.
-
- If the skeleton is extended to include device event interfaces then this
- method must be changed to check the IID and return pointers to them as
- appropriate.
-
- Arguments:
-
- InterfaceId - the interface being requested
-
- Object - a location to store the interface pointer if successful
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- HRESULT hr;
-
- if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackHardware)))
- {
- *Object = QueryIPnpCallbackHardware();
- hr = S_OK;
- }
- else
- {
- hr = CUnknown::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnPrepareHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked to ready the driver
- to talk to hardware. It opens the handle to the
- device and talks to it using the WINUSB interface.
- It invokes WINUSB to discver the interfaces and stores
- the information related to bulk endpoints.
-
-Arguments:
-
- FxDevice : Pointer to the WDF device interface
-
-Return Value:
-
- HRESULT
-
---*/
-{
- PWSTR deviceName = NULL;
- DWORD deviceNameCch = 0;
-
- HRESULT hr;
-
- //
- // Get the device name.
- // Get the length to allocate first
- //
-
- hr = m_FxDevice->RetrieveDeviceName(NULL, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!hresult!",
- hr
- );
- }
-
- //
- // Allocate the buffer
- //
-
- if (SUCCEEDED(hr))
- {
- deviceName = new WCHAR[deviceNameCch];
-
- if (deviceName == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- }
-
- //
- // Get the actual name
- //
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->RetrieveDeviceName(deviceName, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!hresult!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Device name %S",
- deviceName
- );
- }
-
- //
- // Create USB I/O Targets and configure them
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CreateUsbIoTargets();
- }
-
- if (SUCCEEDED(hr))
- {
- ULONG length = sizeof(m_Speed);
-
- hr = m_pIUsbTargetDevice->RetrieveDeviceInformation(DEVICE_SPEED,
- &length,
- &m_Speed);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb device speed information %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_DEVICE,
- "%!FUNC! Speed - %x\n",
- m_Speed
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = ConfigureUsbPipes();
- }
-
- delete[] deviceName;
-
- return hr;
-}
-
-HRESULT
-CMyDevice::OnReleaseHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked when the device is being removed or stopped
- It releases all resources allocated for this device.
-
-Arguments:
-
- FxDevice - Pointer to the Device object.
-
-Return Value:
-
- HRESULT - Always succeeds.
-
---*/
-{
- //
- // Remove I/O target from object tree before any potential subsequent
- // OnPrepareHardware creates a new one
- //
-
- if (m_pIUsbTargetDevice)
- {
- m_pIUsbTargetDevice->DeleteWdfObject();
- }
-
- return S_OK;
-}
-
-HRESULT
-CMyDevice::CreateUsbIoTargets(
- )
-/*++
-
-Routine Description:
-
- This routine creates Usb device, interface and pipe objects
-
-Arguments:
-
- None
-
-Return Value:
-
- HRESULT
---*/
-{
- HRESULT hr;
- UCHAR NumEndPoints = 0;
- IWDFUsbTargetFactory * pIUsbTargetFactory = NULL;
- IWDFUsbTargetDevice * pIUsbTargetDevice = NULL;
- IWDFUsbInterface * pIUsbInterface = NULL;
- IWDFUsbTargetPipe * pIUsbPipe = NULL;
-
- hr = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pIUsbTargetFactory));
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Cannot get usb target factory %!HRESULT!",
- hr
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pIUsbTargetFactory->CreateUsbTargetDevice(
- &pIUsbTargetDevice);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to create USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- else
- {
- m_pIUsbTargetDevice = pIUsbTargetDevice;
-
- //
- // Release the creation reference as object tree will maintain a reference
- //
-
- pIUsbTargetDevice->Release();
- }
- }
-
- if (SUCCEEDED(hr))
- {
- UCHAR NumInterfaces = pIUsbTargetDevice->GetNumInterfaces();
-
- WUDF_TEST_DRIVER_ASSERT(1 == NumInterfaces);
-
- hr = pIUsbTargetDevice->RetrieveUsbInterface(0, &pIUsbInterface);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to retrieve USB interface from USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- else
- {
- m_pIUsbInterface = pIUsbInterface;
-
- pIUsbInterface->Release(); //release creation reference
- }
- }
-
- if (SUCCEEDED(hr))
- {
- NumEndPoints = pIUsbInterface->GetNumEndPoints();
-
- if (NumEndPoints != NUM_OSRUSB_ENDPOINTS) {
- hr = E_UNEXPECTED;
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Has %d endpoints, expected %d, returning %!HRESULT! ",
- NumEndPoints,
- NUM_OSRUSB_ENDPOINTS,
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- for (UCHAR PipeIndex = 0; PipeIndex < NumEndPoints; PipeIndex++)
- {
- hr = pIUsbInterface->RetrieveUsbPipeObject(PipeIndex,
- &pIUsbPipe);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to retrieve USB Pipe for PipeIndex %d, %!HRESULT!",
- PipeIndex,
- hr
- );
- }
- else
- {
- if ( pIUsbPipe->IsInEndPoint() && (UsbdPipeTypeBulk == pIUsbPipe->GetType()) )
- {
- m_pIUsbInputPipe = pIUsbPipe;
- }
- else if ( pIUsbPipe->IsOutEndPoint() && (UsbdPipeTypeBulk == pIUsbPipe->GetType()) )
- {
- m_pIUsbOutputPipe = pIUsbPipe;
- }
- else
- {
- pIUsbPipe->DeleteWdfObject();
- }
-
- SAFE_RELEASE(pIUsbPipe); //release creation reference
- }
- }
-
- if (NULL == m_pIUsbInputPipe || NULL == m_pIUsbOutputPipe)
- {
- hr = E_UNEXPECTED;
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Input or output pipe not found, returning %!HRESULT!",
- hr
- );
- }
- }
-
- SAFE_RELEASE(pIUsbTargetFactory);
-
- return hr;
-}
-
-HRESULT
-CMyDevice::ConfigureUsbPipes(
- )
-/*++
-
-Routine Description:
-
- This routine retrieves the IDs for the bulk end points of the USB device.
-
-Arguments:
-
- None
-
-Return Value:
-
- HRESULT
---*/
-{
- HRESULT hr = S_OK;
- LONG timeout;
-
- //
- // Set timeout policies for input/output pipes
- //
-
- if (SUCCEEDED(hr))
- {
- timeout = ENDPOINT_TIMEOUT;
-
- hr = m_pIUsbInputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT,
- sizeof(timeout),
- &timeout);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to set timeout policy for input pipe %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- timeout = ENDPOINT_TIMEOUT;
-
- hr = m_pIUsbOutputPipe->SetPipePolicy(PIPE_TRANSFER_TIMEOUT,
- sizeof(timeout),
- &timeout);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- TEST_TRACE_DEVICE,
- "%!FUNC! Unable to set timeout policy for output pipe %!HRESULT!",
- hr
- );
- }
- }
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- )
-/*++
-
- Routine Description:
-
- This method synchronously sets the bar graph display on the OSR USB-FX2
- device using the buffers in the FxRequest as input.
-
- Arguments:
-
- FxRequest - the request to set the bar-graph info.
-
- Return Value:
-
- Status
-
---*/
-{
- WINUSB_CONTROL_SETUP_PACKET setupPacket;
-
- ULONG bytesTransferred;
-
- HRESULT hr = S_OK;
-
- //
- // Setup the control packet.
- //
-
- WINUSB_CONTROL_SETUP_PACKET_INIT( &setupPacket,
- BmRequestHostToDevice,
- BmRequestToDevice,
- USBFX2LK_SET_BARGRAPH_DISPLAY,
- 0,
- 0 );
-
- //
- // Issue the request to WinUsb.
- //
-
- hr = SendControlTransferSynchronously(
- &(setupPacket.WinUsb),
- (PUCHAR) BarGraphState,
- sizeof(BAR_GRAPH_STATE),
- &bytesTransferred
- );
-
-
- return hr;
-}
-
-HRESULT
-CMyDevice::SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- )
-{
- HRESULT hr = S_OK;
- HRESULT hrRequest = S_OK;
- IWDFIoRequest *pWdfRequest = NULL;
- IWDFDriver * FxDriver = NULL;
- IWDFMemory * FxMemory = NULL;
- IWDFRequestCompletionParams * FxComplParams = NULL;
- IWDFUsbRequestCompletionParams * FxUsbComplParams = NULL;
-
- *LengthTransferred = 0;
-
- hr = m_FxDevice->CreateRequest( NULL, //pCallbackInterface
- NULL, //pParentObject
- &pWdfRequest);
- hrRequest = hr;
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice->GetDriver(&FxDriver);
-
- hr = FxDriver->CreatePreallocatedWdfMemory( Buffer,
- BufferLength,
- NULL, //pCallbackInterface
- pWdfRequest, //pParetObject
- &FxMemory );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_pIUsbTargetDevice->FormatRequestForControlTransfer( pWdfRequest,
- SetupPacket,
- FxMemory,
- NULL); //TransferOffset
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pWdfRequest->Send( m_pIUsbTargetDevice,
- WDF_REQUEST_SEND_OPTION_SYNCHRONOUS,
- 0); //Timeout
- }
-
- if (SUCCEEDED(hr))
- {
- pWdfRequest->GetCompletionParams(&FxComplParams);
-
- hr = FxComplParams->GetCompletionStatus();
- }
-
- if (SUCCEEDED(hr))
- {
- HRESULT hrQI = FxComplParams->QueryInterface(IID_PPV_ARGS(&FxUsbComplParams));
- WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrQI));
-
- WUDF_TEST_DRIVER_ASSERT( WdfUsbRequestTypeDeviceControlTransfer ==
- FxUsbComplParams->GetCompletedUsbRequestType() );
-
- FxUsbComplParams->GetDeviceControlTransferParameters( NULL,
- LengthTransferred,
- NULL,
- NULL );
- }
-
- SAFE_RELEASE(FxUsbComplParams);
- SAFE_RELEASE(FxComplParams);
- SAFE_RELEASE(FxMemory);
-
- if (SUCCEEDED(hrRequest))
- {
- pWdfRequest->DeleteWdfObject();
- }
- SAFE_RELEASE(pWdfRequest);
-
- SAFE_RELEASE(FxDriver);
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/Device.h b/usb/wdf_osrfx2_lab/umdf/step4/Device.h
deleted file mode 100644
index fe5acfed..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/Device.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample
- driver's device callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-#include "internal.h"
-
-#define ENDPOINT_TIMEOUT 10000
-#define NUM_OSRUSB_ENDPOINTS 3
-
-//
-// Define the vendor commands supported by our device
-//
-#define USBFX2LK_SET_BARGRAPH_DISPLAY 0xD8
-
-//
-// Class for the iotrace driver.
-//
-
-class CMyDevice :
- public CUnknown,
- public IPnpCallbackHardware
-{
-
-//
-// Private data members.
-//
-private:
- //
- // Weak reference to framework device
- //
- IWDFDevice *m_FxDevice;
-
- //
- // Weak reference to the control queue
- //
- PCMyReadWriteQueue m_ReadWriteQueue;
-
- //
- // Weak reference to the control queue
- //
- PCMyControlQueue m_ControlQueue;
-
- //
- // USB Device I/O Target
- //
- IWDFUsbTargetDevice * m_pIUsbTargetDevice;
-
- //
- // USB Interface
- //
- IWDFUsbInterface * m_pIUsbInterface;
-
- //
- // USB Input pipe for Reads
- //
- IWDFUsbTargetPipe * m_pIUsbInputPipe;
-
- //
- // USB Output pipe for writes
- //
- IWDFUsbTargetPipe * m_pIUsbOutputPipe;
-
- //
- // Device Speed (Low, Full, High)
- //
- UCHAR m_Speed;
-
-//
-// Private methods.
-//
-
-private:
-
- CMyDevice(
- VOID
- ) :
- m_FxDevice(NULL),
- m_ControlQueue(NULL),
- m_ReadWriteQueue(NULL),
- m_pIUsbTargetDevice(NULL),
- m_pIUsbInterface(NULL),
- m_pIUsbInputPipe(NULL),
- m_pIUsbOutputPipe(NULL),
- m_Speed(0)
- {
- }
-
- ~CMyDevice(
- );
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- //
- // Helper methods
- //
-
- HRESULT
- CreateUsbIoTargets(
- VOID
- );
-
-
- HRESULT
- ConfigureUsbPipes(
- );
-
- HRESULT
- SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ PCMyDevice *Device
- );
-
- IWDFDevice *
- GetFxDevice(
- VOID
- )
- {
- return m_FxDevice;
- }
-
- HRESULT
- Configure(
- VOID
- );
-
- IPnpCallbackHardware *
- QueryIPnpCallbackHardware(
- VOID
- )
- {
- AddRef();
- return static_cast<IPnpCallbackHardware *>(this);
- }
-
- HRESULT
- SetBarGraphDisplay(
- _In_ PBAR_GRAPH_STATE BarGraphState
- );
-
- //
- //returns a weak reference to input pipe
- //DO NOT release it
- //
- IWDFUsbTargetPipe *
- GetInputPipe(
- )
- {
- return m_pIUsbInputPipe;
- }
-
- //
- //returns a weak reference to output pipe
- //DO NOT release it
- //
- IWDFUsbTargetPipe *
- GetOutputPipe(
- )
- {
- return m_pIUsbOutputPipe;
- }
-
-//
-// COM methods
-//
-public:
-
- //
- // IUnknown methods.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IPnpCallbackHardware
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnPrepareHardware(
- _In_ IWDFDevice *FxDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnReleaseHardware(
- _In_ IWDFDevice *FxDevice
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/Driver.cpp b/usb/wdf_osrfx2_lab/umdf/step4/Driver.cpp
deleted file mode 100644
index bac5caca..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/Driver.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample's
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CMyDriver::CreateInstance(
- _Out_ PCMyDriver *Driver
- )
-/*++
-
- Routine Description:
-
- This static method is invoked in order to create and initialize a new
- instance of the driver class. The caller should arrange for the object
- to be released when it is no longer in use.
-
- Arguments:
-
- Driver - a location to store a referenced pointer to the new instance
-
- Return Value:
-
- S_OK if successful, or error otherwise.
-
---*/
-{
- PCMyDriver driver;
- HRESULT hr;
-
- //
- // Allocate the callback object.
- //
-
- driver = new CMyDriver();
-
- if (NULL == driver)
- {
- return E_OUTOFMEMORY;
- }
-
- //
- // Initialize the callback object.
- //
-
- hr = driver->Initialize();
-
- if (SUCCEEDED(hr))
- {
- //
- // Store a pointer to the new, initialized object in the output
- // parameter.
- //
-
- *Driver = driver;
- }
- else
- {
-
- //
- // Release the reference on the driver object to get it to delete
- // itself.
- //
-
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyDriver::Initialize(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called to initialize a newly created driver callback object
- before it is returned to the creator. Unlike the constructor, the
- Initialize method contains operations which could potentially fail.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- return S_OK;
-}
-
-HRESULT
-CMyDriver::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This method returns a pointer to the requested interface on the callback
- object..
-
- Arguments:
-
- InterfaceId - the IID of the interface to query/reference
-
- Interface - a location to store the interface pointer.
-
- Return Value:
-
- S_OK if the interface is supported.
- E_NOINTERFACE if it is not supported.
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry)))
- {
- *Interface = QueryIDriverEntry();
- return S_OK;
- }
- else
- {
- return CUnknown::QueryInterface(InterfaceId, Interface);
- }
-}
-
-HRESULT
-CMyDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr;
-
- PCMyDevice device = NULL;
-
- //
- // TODO: Do any per-device initialization (reading settings from the
- // registry for example) that's necessary before creating your
- // device callback object here. Otherwise you can leave such
- // initialization to the initialization of the device event
- // handler.
- //
-
- //
- // Create a new instance of our device callback object
- //
-
- hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device);
-
- //
- // TODO: Change any per-device settings that the object exposes before
- // calling Configure to let it complete its initialization.
- //
-
- //
- // If that succeeded then call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- //
- // Release the reference on the device callback object now that it's been
- // associated with an fx device object.
- //
-
- if (NULL != device)
- {
- device->Release();
- }
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/Driver.h b/usb/wdf_osrfx2_lab/umdf/step4/Driver.h
deleted file mode 100644
index 800ab1d9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/Driver.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the UMDF Skeleton sample's
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the skeleton sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-class CMyDriver : public CUnknown, public IDriverEntry
-{
-//
-// Private data members.
-//
-private:
-
-//
-// Private methods.
-//
-private:
-
- //
- // Returns a refernced pointer to the IDriverEntry interface.
- //
-
- IDriverEntry *
- QueryIDriverEntry(
- VOID
- )
- {
- AddRef();
- return static_cast<IDriverEntry*>(this);
- }
-
- HRESULT
- Initialize(
- VOID
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstance(
- _Out_ PCMyDriver *Driver
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
-
- return;
- }
-
- //
- // IUnknown methods.
- //
- // We have to implement basic ones here that redirect to the
- // base class becuase of the multiple inheritance.
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/OsrUsbFx2.ctl b/usb/wdf_osrfx2_lab/umdf/step4/OsrUsbFx2.ctl
deleted file mode 100644
index 4dab56ae..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/OsrUsbFx2.ctl
+++ /dev/null
@@ -1 +0,0 @@
-da5fbdfd-1eae-4ecf-b426-a3818f325ddb WudfOsrUsbFx2TraceGuid
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/OsrUsbFx2.rc b/usb/wdf_osrfx2_lab/umdf/step4/OsrUsbFx2.rc
deleted file mode 100644
index 36f10ea9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/OsrUsbFx2.rc
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-// OsrUsbDevice.rc
-//
-// Copyright (c) Microsoft Corporation, All Rights Reserved
-//---------------------------------------------------------------------------
-
-
-#include <windows.h>
-#include <ntverp.h>
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WDF:UMDF OSR USB Fx2 User-Mode Driver Sample"
-#define VER_INTERNALNAME_STR "WUDFOsrUsbFx2"
-#define VER_ORIGINALFILENAME_STR "WUDFOsrUsbFx2.dll"
-
-#include "common.ver"
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/ReadWriteQueue.cpp b/usb/wdf_osrfx2_lab/umdf/step4/ReadWriteQueue.cpp
deleted file mode 100644
index 21f42548..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/ReadWriteQueue.cpp
+++ /dev/null
@@ -1,423 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "ReadWriteQueue.tmh"
-
-VOID
-CMyReadWriteQueue::OnCompletion(
- _In_ IWDFIoRequest* pWdfRequest,
- _In_ IWDFIoTarget* pIoTarget,
- _In_ IWDFRequestCompletionParams* pParams,
- _In_ PVOID pContext
- )
-{
- UNREFERENCED_PARAMETER(pIoTarget);
- UNREFERENCED_PARAMETER(pContext);
-
- pWdfRequest->CompleteWithInformation(
- pParams->GetCompletionStatus(),
- pParams->GetInformation()
- );
-}
-
-void
-CMyReadWriteQueue::ForwardFormattedRequest(
- _In_ IWDFIoRequest* pRequest,
- _In_ IWDFIoTarget* pIoTarget
- )
-{
- //
- //First set the completion callback
- //
-
- IRequestCallbackRequestCompletion * pCompletionCallback = NULL;
- HRESULT hrQI = this->QueryInterface(IID_PPV_ARGS(&pCompletionCallback));
- WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrQI) && (NULL != pCompletionCallback));
-
- pRequest->SetCompletionCallback(
- pCompletionCallback,
- NULL
- );
-
- pCompletionCallback->Release();
- pCompletionCallback = NULL;
-
- //
- //Send down the request
- //
-
- HRESULT hrSend = S_OK;
- hrSend = pRequest->Send(pIoTarget,
- 0, //flags
- 0); //timeout
-
- if (FAILED(hrSend))
- {
- pRequest->CompleteWithInformation(hrSend, 0);
- }
-
- return;
-}
-
-
-CMyReadWriteQueue::CMyReadWriteQueue(
- _In_ PCMyDevice Device
- ) :
- CMyQueue(Device)
-{
-}
-
-//
-// Queue destructor.
-// Free up the buffer, wait for thread to terminate and
-//
-
-CMyReadWriteQueue::~CMyReadWriteQueue(
- VOID
- )
-/*++
-
-Routine Description:
-
-
- IUnknown implementation of Release
-
-Aruments:
-
-
-Return Value:
-
- ULONG (reference count after Release)
-
---*/
-{
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC! Entry"
- );
-
-}
-
-
-HRESULT
-STDMETHODCALLTYPE
-CMyReadWriteQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
-
- if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackWrite)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackWrite();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackRead)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackRead();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IRequestCallbackRequestCompletion)))
- {
- hr = S_OK;
- *Object = QueryIRequestCallbackRequestCompletion();
- }
- else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackIoStop)))
- {
- hr = S_OK;
- *Object = QueryIQueueCallbackIoStop();
- }
- else
- {
- hr = CMyQueue::QueryInterface(InterfaceId, Object);
- }
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyReadWriteQueue::CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyReadWriteQueue *Queue
- )
-/*++
-
-Routine Description:
-
-
- CreateInstance creates an instance of the queue object.
-
-Aruments:
-
- ppUkwn - OUT parameter is an IUnknown interface to the queue object
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- PCMyReadWriteQueue queue;
- HRESULT hr = S_OK;
-
- queue = new CMyReadWriteQueue(Device);
-
- if (NULL == queue)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Call the queue callback object to initialize itself. This will create
- // its partner queue framework object.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = queue->Initialize();
- }
-
- if (SUCCEEDED(hr))
- {
- *Queue = queue;
- }
- else
- {
- SAFE_RELEASE(queue);
- }
-
- return hr;
-}
-
-HRESULT
-CMyReadWriteQueue::Initialize(
- )
-{
- HRESULT hr;
-
- //
- // First initialize the base class. This will create the partner FxIoQueue
- // object and setup automatic forwarding of I/O controls.
- //
-
- hr = __super::Initialize(WdfIoQueueDispatchParallel,
- true,
- true);
-
- //
- // return the status.
- //
-
- return hr;
-}
-
-STDMETHODIMP_ (void)
-CMyReadWriteQueue::OnWrite(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToWrite
- )
-/*++
-
-Routine Description:
-
-
- Write dispatch routine
- IQueueCallbackWrite
-
-Aruments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToWrite - Lenth of bytes in the write buffer
-
- Allocate and copy data to local buffer
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC!: Queue %p Request %p BytesToTransfer %d\n",
- this,
- pWdfRequest,
- (ULONG)(ULONG_PTR)BytesToWrite
- );
-
- HRESULT hr = S_OK;
- IWDFMemory * pInputMemory = NULL;
- IWDFUsbTargetPipe * pOutputPipe = m_Device->GetOutputPipe();
-
- pWdfRequest->GetInputMemory(&pInputMemory);
-
- hr = pOutputPipe->FormatRequestForWrite(
- pWdfRequest,
- NULL, //pFile
- pInputMemory,
- NULL, //Memory offset
- NULL //DeviceOffset
- );
-
- if (FAILED(hr))
- {
- pWdfRequest->Complete(hr);
- }
- else
- {
- ForwardFormattedRequest(pWdfRequest, pOutputPipe);
- }
-
- SAFE_RELEASE(pInputMemory);
-
- return;
-}
-
-STDMETHODIMP_ (void)
-CMyReadWriteQueue::OnRead(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T BytesToRead
- )
-/*++
-
-Routine Description:
-
-
- Read dispatch routine
- IQueueCallbackRead
-
-Aruments:
-
- pWdfQueue - Framework Queue instance
- pWdfRequest - Framework Request instance
- BytesToRead - Lenth of bytes in the read buffer
-
- Copy available data into the read buffer
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
-
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC!: Queue %p Request %p BytesToTransfer %d\n",
- this,
- pWdfRequest,
- (ULONG)(ULONG_PTR)BytesToRead
- );
-
- HRESULT hr = S_OK;
- IWDFMemory * pOutputMemory = NULL;
-
- pWdfRequest->GetOutputMemory(&pOutputMemory);
-
- hr = m_Device->GetInputPipe()->FormatRequestForRead(
- pWdfRequest,
- NULL, //pFile
- pOutputMemory,
- NULL, //Memory offset
- NULL //DeviceOffset
- );
-
- if (FAILED(hr))
- {
- pWdfRequest->Complete(hr);
- }
- else
- {
- ForwardFormattedRequest(pWdfRequest, m_Device->GetInputPipe());
- }
-
- SAFE_RELEASE(pOutputMemory);
-
- return;
-}
-
-STDMETHODIMP_ (void)
-CMyReadWriteQueue::OnIoStop(
- _In_ IWDFIoQueue * pWdfQueue,
- _In_ IWDFIoRequest * pWdfRequest,
- _In_ ULONG ActionFlags
- )
-{
- UNREFERENCED_PARAMETER(pWdfQueue);
-
-
- //
- // Because of device level locking we know that if our driver
- // owns the request and we get here, our OnRead/OnWrite callback
- // has returned and the request has been sent to I/O target
- //
-
- if (ActionFlags == WdfRequestStopActionSuspend )
- {
- //
- // UMDF does not support an equivalent to WdfRequestStopAcknowledge.
- //
- // Cancel the request so that the power management operation can continue.
- //
- // NOTE: if cancelling the request would have an adverse affect and if the
- // requests are expected to complete very quickly then leaving the
- // request running may be a better option.
- //
-
- pWdfRequest->CancelSentRequest();
- }
- else if(ActionFlags == WdfRequestStopActionPurge)
- {
- //
- // Cancel the sent request since we are asked to purge the request
- //
-
- pWdfRequest->CancelSentRequest();
- }
-
- return;
-}
-
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/ReadWriteQueue.h b/usb/wdf_osrfx2_lab/umdf/step4/ReadWriteQueue.h
deleted file mode 100644
index 4f1a98c1..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/ReadWriteQueue.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-
-#define MAX_TRANSFER_SIZE(x) 64*1024*1024
-
-//
-// Queue Callback Object.
-//
-
-class CMyReadWriteQueue :
- public IQueueCallbackRead,
- public IQueueCallbackWrite,
- public IRequestCallbackRequestCompletion,
- public IQueueCallbackIoStop,
- public CMyQueue
-{
-protected:
- HRESULT
- Initialize(
- );
-
- void
- ForwardFormattedRequest(
- _In_ IWDFIoRequest* pRequest,
- _In_ IWDFIoTarget* pIoTarget
- );
-
-public:
-
- CMyReadWriteQueue(
- _In_ PCMyDevice Device
- );
-
- virtual ~CMyReadWriteQueue();
-
- static
- HRESULT
- CreateInstance(
- _In_ PCMyDevice Device,
- _Out_ PCMyReadWriteQueue *Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return CMyQueue::Configure();
- }
-
- IQueueCallbackWrite *
- QueryIQueueCallbackWrite(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackWrite *>(this);
- }
-
- IQueueCallbackRead *
- QueryIQueueCallbackRead(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackRead *>(this);
- }
-
- IRequestCallbackRequestCompletion *
- QueryIRequestCallbackRequestCompletion(
- VOID
- )
- {
- AddRef();
- return static_cast<IRequestCallbackRequestCompletion *>(this);
- }
-
- IQueueCallbackIoStop*
- QueryIQueueCallbackIoStop(
- VOID
- )
- {
- AddRef();
- return static_cast<IQueueCallbackIoStop *>(this);
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
-
- //
- // Wdf Callbacks
- //
-
- //
- // IQueueCallbackWrite
- //
- STDMETHOD_ (void, OnWrite)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToWrite
- );
-
- //
- // IQueueCallbackRead
- //
- STDMETHOD_ (void, OnRead)(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ SIZE_T NumOfBytesToRead
- );
-
- //
- //IRequestCallbackRequestCompletion
- //
-
- STDMETHOD_ (void, OnCompletion)(
- _In_ IWDFIoRequest* pWdfRequest,
- _In_ IWDFIoTarget* pIoTarget,
- _In_ IWDFRequestCompletionParams* pParams,
- _In_ PVOID pContext
- );
-
- //
- //IQueueCallbackIoStop
- //
-
- STDMETHOD_ (void, OnIoStop)(
- _In_ IWDFIoQueue * pWdfQueue,
- _In_ IWDFIoRequest * pWdfRequest,
- _In_ ULONG ActionFlags
- );
-
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx b/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx
deleted file mode 100644
index 215e5f98..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.inx
+++ /dev/null
Binary files differ
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.vcxproj b/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.vcxproj
deleted file mode 100644
index ea987abd..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.vcxproj
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{48343119-5771-494E-977E-0D439A45BF65}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{F45B07B6-EA19-4312-9BB3-5CF1BAFF50A8}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp; queue.cpp; ControlQueue.cpp; ReadWriteQueue.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </ClCompile>
- <OtherWpp Include="OsrUsbFx2.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WUDFOsrUsbFx2_4</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WUDFOsrUsbFx2_4</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WUDFOsrUsbFx2_4</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WUDFOsrUsbFx2_4</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc;..\inc</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inx" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.vcxproj.Filters b/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.vcxproj.Filters
deleted file mode 100644
index 43c2d881..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/WUDFOsrUsbFx2_4.vcxproj.Filters
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{FFDE5D69-37F8-4393-A23B-564E903D88CD}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{0B249192-6B94-4C90-BD54-09BDA2702DF1}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{080D7F17-64DE-4D25-95ED-5FB56D2F35D7}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{71EC47E9-66DB-49A4-A668-16475FA16BB4}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ControlQueue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="queue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ReadWriteQueue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <None Include="exports.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="OsrUsbFx2.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/comsup.cpp b/usb/wdf_osrfx2_lab/umdf/step4/comsup.cpp
deleted file mode 100644
index 9c9aec3b..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/comsup.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.cpp
-
-Abstract:
-
- This module contains implementations for the functions and methods
- used for providing COM support.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-
-#include "comsup.tmh"
-
-//
-// Implementation of CUnknown methods.
-//
-
-CUnknown::CUnknown(
- VOID
- ) : m_ReferenceCount(1)
-/*++
-
- Routine Description:
-
- Constructor for an instance of the CUnknown class. This simply initializes
- the reference count of the object to 1. The caller is expected to
- call Release() if it wants to delete the object once it has been allocated.
-
- Arguments:
-
- None
-
- Return Value:
-
- None
-
---*/
-{
- // do nothing.
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CUnknown::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method provides the basic support for query interface on CUnknown.
- If the interface requested is IUnknown it references the object and
- returns an interface pointer. Otherwise it returns an error.
-
- Arguments:
-
- InterfaceId - the IID being requested
-
- Object - a location to store the interface pointer to return.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- if (IsEqualIID(InterfaceId, __uuidof(IUnknown)))
- {
- *Object = QueryIUnknown();
- return S_OK;
- }
- else
- {
- *Object = NULL;
- return E_NOINTERFACE;
- }
-}
-
-IUnknown *
-CUnknown::QueryIUnknown(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IUnknown interface.
-
- This allows other methods to convert a CUnknown pointer into an IUnknown
- pointer without a typecast and without calling QueryInterface and dealing
- with the return value.
-
- Arguments:
-
- None
-
- Return Value:
-
- A pointer to the object's IUnknown interface.
-
---*/
-{
- AddRef();
- return static_cast<IUnknown *>(this);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::AddRef(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method adds one to the object's reference count.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. The caller should only use this for debugging
- as the object's actual reference count can change while the caller
- examines the return value.
-
---*/
-{
- return InterlockedIncrement(&m_ReferenceCount);
-}
-
-ULONG
-STDMETHODCALLTYPE
-CUnknown::Release(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method subtracts one to the object's reference count. If the count
- goes to zero, this method deletes the object.
-
- Arguments:
-
- None
-
- Return Value:
-
- The new reference count. If the caller uses this value it should only be
- to check for zero (i.e. this call caused or will cause deletion) or
- non-zero (i.e. some other call may have caused deletion, but this one
- didn't).
-
---*/
-{
- ULONG count = InterlockedDecrement(&m_ReferenceCount);
-
- if (count == 0)
- {
- delete this;
- }
- return count;
-}
-
-//
-// Implementation of CClassFactory methods.
-//
-
-//
-// Define storage for the factory's static lock count variable.
-//
-
-LONG CClassFactory::s_LockCount = 0;
-
-IClassFactory *
-CClassFactory::QueryIClassFactory(
- VOID
- )
-/*++
-
- Routine Description:
-
- This helper method references the object and returns a pointer to the
- object's IClassFactory interface.
-
- This allows other methods to convert a CClassFactory pointer into an
- IClassFactory pointer without a typecast and without dealing with the
- return value QueryInterface.
-
- Arguments:
-
- None
-
- Return Value:
-
- A referenced pointer to the object's IClassFactory interface.
-
---*/
-{
- AddRef();
- return static_cast<IClassFactory *>(this);
-}
-
-HRESULT
-CClassFactory::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This method attempts to retrieve the requested interface from the object.
-
- If the interface is found then the reference count on that interface (and
- thus the object itself) is incremented.
-
- Arguments:
-
- InterfaceId - the interface the caller is requesting.
-
- Object - a location to store the interface pointer.
-
- Return Value:
-
- S_OK or E_NOINTERFACE
-
---*/
-{
- //
- // This class only supports IClassFactory so check for that.
- //
-
- if (IsEqualIID(InterfaceId, __uuidof(IClassFactory)))
- {
- *Object = QueryIClassFactory();
- return S_OK;
- }
- else
- {
- //
- // See if the base class supports the interface.
- //
-
- return CUnknown::QueryInterface(InterfaceId, Object);
- }
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::CreateInstance(
- _In_opt_ IUnknown * /* OuterObject */,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- )
-/*++
-
- Routine Description:
-
- This COM method is the factory routine - it creates instances of the driver
- callback class and returns the specified interface on them.
-
- Arguments:
-
- OuterObject - only used for aggregation, which our driver callback class
- does not support.
-
- InterfaceId - the interface ID the caller would like to get from our
- new object.
-
- Object - a location to store the referenced interface pointer to the new
- object.
-
- Return Value:
-
- Status.
-
---*/
-{
- HRESULT hr;
-
- PCMyDriver driver;
-
- *Object = NULL;
-
- hr = CMyDriver::CreateInstance(&driver);
-
- if (SUCCEEDED(hr))
- {
- hr = driver->QueryInterface(InterfaceId, Object);
- driver->Release();
- }
-
- return hr;
-}
-
-HRESULT
-STDMETHODCALLTYPE
-CClassFactory::LockServer(
- _In_ BOOL Lock
- )
-/*++
-
- Routine Description:
-
- This COM method can be used to keep the DLL in memory. However since the
- driver's DllCanUnloadNow function always returns false, this has little
- effect. Still it tracks the number of lock and unlock operations.
-
- Arguments:
-
- Lock - Whether the caller wants to lock or unlock the "server"
-
- Return Value:
-
- S_OK
-
---*/
-{
- if (Lock)
- {
- InterlockedIncrement(&s_LockCount);
- }
- else
- {
- InterlockedDecrement(&s_LockCount);
- }
- return S_OK;
-}
-
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/comsup.h b/usb/wdf_osrfx2_lab/umdf/step4/comsup.h
deleted file mode 100644
index dedf78c8..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/comsup.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- ComSup.h
-
-Abstract:
-
- This module contains classes and functions use for providing COM support
- code.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Forward type declarations. They are here rather than in internal.h as
-// you only need them if you choose to use these support classes.
-//
-
-typedef class CUnknown *PCUnknown;
-typedef class CClassFactory *PCClassFactory;
-
-//
-// Base class to implement IUnknown. You can choose to derive your COM
-// classes from this class, or simply implement IUnknown in each of your
-// classes.
-//
-
-class CUnknown : public IUnknown
-{
-
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The reference count for this object. Initialized to 1 in the
- // constructor.
- //
-
- LONG m_ReferenceCount;
-
-//
-// Protected data members and methods. These are accessible by the subclasses
-// but not by other classes.
-//
-protected:
-
- //
- // The constructor and destructor are protected to ensure that only the
- // subclasses of CUnknown can create and destroy instances.
- //
-
- CUnknown(
- VOID
- );
-
- //
- // The destructor MUST be virtual. Since any instance of a CUnknown
- // derived class should only be deleted from within CUnknown::Release,
- // the destructor MUST be virtual or only CUnknown::~CUnknown will get
- // invoked on deletion.
- //
- // If you see that your CMyDevice specific destructor is never being
- // called, make sure you haven't deleted the virtual destructor here.
- //
-
- virtual
- ~CUnknown(
- VOID
- )
- {
- // Do nothing
- }
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IUnknown *
- QueryIUnknown(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- );
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
-
-//
-// Class factory support class. Create an instance of this from your
-// DllGetClassObject method and modify the implementation to create
-// an instance of your driver event handler class.
-//
-
-class CClassFactory : public CUnknown, public IClassFactory
-{
-//
-// Private data members and methods. These are only accessible by the methods
-// of this class.
-//
-private:
-
- //
- // The lock count. This is shared across all instances of IClassFactory
- // and can be queried through the public IsLocked method.
- //
-
- static LONG s_LockCount;
-
-//
-// Public Methods. These are accessible by any class.
-//
-public:
-
- IClassFactory *
- QueryIClassFactory(
- VOID
- );
-
-//
-// COM Methods.
-//
-public:
-
- //
- // IUnknown methods
- //
-
- virtual
- ULONG
- STDMETHODCALLTYPE
- AddRef(
- VOID
- )
- {
- return __super::AddRef();
- }
-
- _At_(this, __drv_freesMem(object))
- virtual
- ULONG
- STDMETHODCALLTYPE
- Release(
- VOID
- )
- {
- return __super::Release();
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-
- //
- // IClassFactory methods.
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- CreateInstance(
- _In_opt_ IUnknown *OuterObject,
- _In_ REFIID InterfaceId,
- _Out_ PVOID *Object
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- LockServer(
- _In_ BOOL Lock
- );
-};
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/dllsup.cpp b/usb/wdf_osrfx2_lab/umdf/step4/dllsup.cpp
deleted file mode 100644
index bd681ac2..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/dllsup.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved.
-
-Module Name:
-
- dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the UMDF Skeleton Sample
- Driver's entry point and its exported functions for providing COM support.
-
- This module can be copied without modification to a new UMDF driver. It
- depends on some of the code in comsup.cpp & comsup.h to handle DLL
- registration and creating the first class factory.
-
- This module is dependent on the following defines:
-
- MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing
- tracing. For example the skeleton uses
- L"Microsoft\\UMDF\\Skeleton"
-
- MYDRIVER_CLASS_ID - A GUID encoded in struct format used to
- initialize the driver's ClassID.
-
- These are defined in internal.h for the skeleton sample. If you choose
- to use a different primary include file, you should ensure they are
- defined there as well.
-
-Environment:
-
- WDF User-Mode Driver Framework (WDF:UMDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID;
-
-BOOL
-WINAPI
-DllMain(
- HINSTANCE ModuleHandle,
- DWORD Reason,
- PVOID /* Reserved */
- )
-/*++
-
- Routine Description:
-
- This is the entry point and exit point for the I/O trace driver. This
- does very little as the I/O trace driver has minimal global data.
-
- This method initializes tracing, and saves the module handle away in a
- global variable so that it can be referenced should the COM registration
- code (Dll[Un]RegisterServer) be called.
-
- Arguments:
-
- ModuleHandle - the DLL handle for this module.
-
- Reason - the reason this entry point was called.
-
- Reserved - unused
-
- Return Value:
-
- TRUE
-
---*/
-{
- UNREFERENCED_PARAMETER(ModuleHandle);
-
- if (DLL_PROCESS_ATTACH == Reason)
- {
- //
- // Initialize tracing.
- //
-
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
- }
- else if (DLL_PROCESS_DETACH == Reason)
- {
- //
- // Cleanup tracing.
- //
-
- WPP_CLEANUP();
- }
-
- return TRUE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllCanUnloadNow(
- VOID
- )
-/*++
-
- Routine Description:
-
- Called by the COM runtime when determining whether or not this module
- can be unloaded. Our answer is always "no".
-
- Arguments:
-
- None
-
- Return Value:
-
- S_FALSE
-
---*/
-{
- return S_FALSE;
-}
-
-_Use_decl_annotations_
-HRESULT
-STDAPICALLTYPE
-DllGetClassObject(
- REFCLSID ClassId,
- REFIID InterfaceId,
- LPVOID *Interface
- )
-/*++
-
- Routine Description:
-
- This routine is called by COM in order to instantiate the
- skeleton driver callback object and do an initial query interface on it.
-
- This method only creates an instance of the driver's class factory, as this
- is the minimum required to support UMDF.
-
- Arguments:
-
- ClassId - the CLSID of the object being "gotten"
-
- InterfaceId - the interface the caller wants from that object.
-
- Interface - a location to store the referenced interface pointer
-
- Return Value:
-
- S_OK if the function succeeds or error indicating the cause of the
- failure.
-
---*/
-{
- PCClassFactory factory;
-
- HRESULT hr = S_OK;
-
- *Interface = NULL;
-
- //
- // If the CLSID doesn't match that of our "coclass" (defined in the IDL
- // file) then we can't create the object the caller wants. This may
- // indicate that the COM registration is incorrect, and another CLSID
- // is referencing this drvier.
- //
-
- if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false)
- {
- Trace(
- TRACE_LEVEL_ERROR,
- L"ERROR: Called to create instance of unrecognized class (%!GUID!)",
- &ClassId
- );
-
- return CLASS_E_CLASSNOTAVAILABLE;
- }
-
- //
- // Create an instance of the class factory for the caller.
- //
-
- factory = new CClassFactory();
-
- if (NULL == factory)
- {
- hr = E_OUTOFMEMORY;
- }
-
- //
- // Query the object we created for the interface the caller wants. After
- // that we release the object. This will drive the reference count to
- // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed).
- // In the later case the object is automatically deleted.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = factory->QueryInterface(InterfaceId, Interface);
- factory->Release();
- }
-
- return hr;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/exports.def b/usb/wdf_osrfx2_lab/umdf/step4/exports.def
deleted file mode 100644
index 15f923d3..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/exports.def
+++ /dev/null
@@ -1,4 +0,0 @@
-; WudfOsrUsbDriver.def : Declares the module parameters.
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/internal.h b/usb/wdf_osrfx2_lab/umdf/step4/internal.h
deleted file mode 100644
index 86487dd9..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/internal.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*++
-
-Copyright (C) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- Internal.h
-
-Abstract:
-
- This module contains the local type definitions for the UMDF Skeleton
- driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-#endif
-
-//
-// Include the WUDF Headers
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Get limits on common data types (ULONG_MAX for example)
-//
-
-#include "limits.h"
-
-//
-// We need usb I/O targets to talk to the OSR device.
-//
-
-#include "wudfusb.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "public.h"
-
-//
-// Include the header shared between the drivers and the test applications.
-//
-
-#include "WUDFOsrUsbPublic.h"
-
-//
-// Forward definitions of classes in the other header files.
-//
-
-typedef class CMyDriver *PCMyDriver;
-typedef class CMyDevice *PCMyDevice;
-typedef class CMyQueue *PCMyQueue;
-
-typedef class CMyControlQueue *PCMyControlQueue;
-typedef class CMyReadWriteQueue *PCMyReadWriteQueue;
-
-//
-// Define the tracing flags.
-//
-// TODO: Choose a different trace control GUID
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- WudfOsrUsbFx2TraceGuid, (da5fbdfd,1eae,4ecf,b426,a3818f325ddb), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- WPP_DEFINE_BIT(TEST_TRACE_DRIVER) \
- WPP_DEFINE_BIT(TEST_TRACE_DEVICE) \
- WPP_DEFINE_BIT(TEST_TRACE_QUEUE) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
- WPP_LEVEL_LOGGER(flags)
-
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
- (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
-// end_wpp
-//
-
-//
-// Driver specific #defines
-//
-// TODO: Change these values to be appropriate for your driver.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\OsrUsb"
-#define MYDRIVER_CLASS_ID {0x0865b2b0, 0x6b73, 0x428f, {0xa3, 0xea, 0x21, 0x72, 0x83, 0x2d, 0x6b, 0xfc}}
-
-//
-// Include the type specific headers.
-//
-
-#include "comsup.h"
-#include "driver.h"
-#include "device.h"
-#include "queue.h"
-#include "ControlQueue.h"
-#include "ReadWriteQueue.h"
-#include "list.h"
-
-__forceinline
-#ifdef _PREFAST_
-__declspec(noreturn)
-#endif
-VOID
-WdfTestNoReturn(
- VOID
- )
-{
- // do nothing.
-}
-
-#define WUDF_TEST_DRIVER_ASSERT(p) \
-{ \
- if ( !(p) ) \
- { \
- DebugBreak(); \
- WdfTestNoReturn(); \
- } \
-}
-
-#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }}
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/queue.cpp b/usb/wdf_osrfx2_lab/umdf/step4/queue.cpp
deleted file mode 100644
index c56b38bb..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/queue.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the read/write/ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "queue.tmh"
-
-CMyQueue::CMyQueue(
- _In_ PCMyDevice Device
- ) :
- m_FxQueue(NULL),
- m_Device(Device)
-{
-}
-
-//
-// Queue destructor.
-// Free up the buffer, wait for thread to terminate and
-//
-
-CMyQueue::~CMyQueue(
- VOID
- )
-/*++
-
-Routine Description:
-
-
- IUnknown implementation of Release
-
-Aruments:
-
-
-Return Value:
-
- ULONG (reference count after Release)
-
---*/
-{
- TraceEvents(TRACE_LEVEL_INFORMATION,
- TEST_TRACE_QUEUE,
- "%!FUNC! Entry"
- );
-
-}
-
-
-HRESULT
-STDMETHODCALLTYPE
-CMyQueue::QueryInterface(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- )
-/*++
-
-Routine Description:
-
-
- Query Interface
-
-Aruments:
-
- Follows COM specifications
-
-Return Value:
-
- HRESULT indicatin success or failure
-
---*/
-{
- HRESULT hr;
-
- hr = CUnknown::QueryInterface(InterfaceId, Object);
-
- return hr;
-}
-
-//
-// Initialize
-//
-
-HRESULT
-CMyQueue::Initialize(
- _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType,
- _In_ bool Default,
- _In_ bool PowerManaged
- )
-{
- IWDFIoQueue *fxQueue;
- HRESULT hr;
-
- //
- // Create the I/O Queue object.
- //
-
- {
- IUnknown *callback = QueryIUnknown();
-
- hr = m_Device->GetFxDevice()->CreateIoQueue(
- callback,
- Default,
- DispatchType,
- PowerManaged,
- FALSE,
- &fxQueue
- );
- callback->Release();
- }
-
- if (SUCCEEDED(hr))
- {
- m_FxQueue = fxQueue;
-
- //
- // Release the creation reference on the queue. This object will be
- // destroyed before the queue so we don't need to have a reference out
- // on it.
- //
-
- fxQueue->Release();
- }
-
- return hr;
-}
-
-HRESULT
-CMyQueue::Configure(
- VOID
- )
-{
- return S_OK;
-}
diff --git a/usb/wdf_osrfx2_lab/umdf/step4/queue.h b/usb/wdf_osrfx2_lab/umdf/step4/queue.h
deleted file mode 100644
index 5659224b..00000000
--- a/usb/wdf_osrfx2_lab/umdf/step4/queue.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*++
-
-Copyright (c) Microsoft Corporation, All Rights Reserved
-
-Module Name:
-
- queue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class CMyQueue :
- public CUnknown
-{
-protected:
- //
- // Unreferenced pointer to the partner Fx device.
- //
-
- IWDFIoQueue *m_FxQueue;
-
- //
- // Unreferenced pointer to the parent device.
- //
-
- PCMyDevice m_Device;
-
- HRESULT
- Initialize(
- _In_ WDF_IO_QUEUE_DISPATCH_TYPE DispatchType,
- _In_ bool Default,
- _In_ bool PowerManaged
- );
-
-protected:
-
- CMyQueue(
- _In_ PCMyDevice Device
- );
-
- virtual ~CMyQueue();
-
- HRESULT
- Configure(
- VOID
- );
-
-public:
-
- IWDFIoQueue *
- GetFxQueue(
- VOID
- )
- {
- return m_FxQueue;
- }
-
-
- PCMyDevice
- GetDevice(
- VOID
- )
- {
- return m_Device;
- }
-
- //
- // IUnknown
- //
-
- STDMETHOD_(ULONG,AddRef) (VOID) {return CUnknown::AddRef();}
-
- _At_(this, __drv_freesMem(object))
- STDMETHOD_(ULONG,Release) (VOID) {return CUnknown::Release();}
-
- STDMETHOD_(HRESULT, QueryInterface)(
- _In_ REFIID InterfaceId,
- _Outptr_ PVOID *Object
- );
-};
diff --git a/usb/wdf_osrfx2_lab/wdf_osrfx2_lab.sln b/usb/wdf_osrfx2_lab/wdf_osrfx2_lab.sln
index 105c6643..13795799 100644
--- a/usb/wdf_osrfx2_lab/wdf_osrfx2_lab.sln
+++ b/usb/wdf_osrfx2_lab/wdf_osrfx2_lab.sln
@@ -17,18 +17,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Step5", "Step5", "{20339A89
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Exe", "Exe", "{BC1A657D-F736-42B1-8B6F-65660268D1E4}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Step1", "Step1", "{5B8D9AE9-CD64-4BDE-924B-85E2CFF7AC6D}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umdf", "Umdf", "{891C089F-780C-4983-8C50-1A1C9BEB0593}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Step2", "Step2", "{9C88D019-1CD4-44BD-8355-75C0F1A0D348}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Step3", "Step3", "{F9F19F6E-0B8B-4ED0-BA15-75455AC110D4}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Step4", "Step4", "{852E07AA-FE41-404F-BE25-30B5BCE596B7}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Exe", "Exe", "{CAFB7E8F-109E-4224-BD53-EE93946311DF}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrusbfx2", "kmdf\step1\osrusbfx2.vcxproj", "{E54BDD18-FDE9-42BF-BC23-343F8764B387}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrusbfx2", "kmdf\step2\osrusbfx2.vcxproj", "{CE2CAF81-E96B-4C32-9BE9-58238742D295}"
@@ -41,16 +29,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrusbfx2", "kmdf\step5\osr
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrusbfx2", "kmdf\exe\osrusbfx2.vcxproj", "{6EED5CDD-5526-40DC-97F9-582857E10187}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFOsrUsbFx2_1", "umdf\step1\WUDFOsrUsbFx2_1.vcxproj", "{94BDC8D1-B62F-4200-9873-D403B6D30301}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFOsrUsbFx2_2", "umdf\step2\WUDFOsrUsbFx2_2.vcxproj", "{808B6774-93FA-4ABF-A23F-35C55FA80B80}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFOsrUsbFx2_3", "umdf\step3\WUDFOsrUsbFx2_3.vcxproj", "{4BED411D-1B55-4A64-84C9-36EC25F083D2}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFOsrUsbFx2_4", "umdf\step4\WUDFOsrUsbFx2_4.vcxproj", "{48343119-5771-494E-977E-0D439A45BF65}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WudfOsrUsbFx2Test", "umdf\exe\WudfOsrUsbFx2Test.vcxproj", "{B4244D54-7EBF-43D4-BB6D-C994C182C572}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -107,46 +85,6 @@ Global
{6EED5CDD-5526-40DC-97F9-582857E10187}.Debug|x64.Build.0 = Debug|x64
{6EED5CDD-5526-40DC-97F9-582857E10187}.Release|x64.ActiveCfg = Release|x64
{6EED5CDD-5526-40DC-97F9-582857E10187}.Release|x64.Build.0 = Release|x64
- {94BDC8D1-B62F-4200-9873-D403B6D30301}.Debug|Win32.ActiveCfg = Debug|Win32
- {94BDC8D1-B62F-4200-9873-D403B6D30301}.Debug|Win32.Build.0 = Debug|Win32
- {94BDC8D1-B62F-4200-9873-D403B6D30301}.Release|Win32.ActiveCfg = Release|Win32
- {94BDC8D1-B62F-4200-9873-D403B6D30301}.Release|Win32.Build.0 = Release|Win32
- {94BDC8D1-B62F-4200-9873-D403B6D30301}.Debug|x64.ActiveCfg = Debug|x64
- {94BDC8D1-B62F-4200-9873-D403B6D30301}.Debug|x64.Build.0 = Debug|x64
- {94BDC8D1-B62F-4200-9873-D403B6D30301}.Release|x64.ActiveCfg = Release|x64
- {94BDC8D1-B62F-4200-9873-D403B6D30301}.Release|x64.Build.0 = Release|x64
- {808B6774-93FA-4ABF-A23F-35C55FA80B80}.Debug|Win32.ActiveCfg = Debug|Win32
- {808B6774-93FA-4ABF-A23F-35C55FA80B80}.Debug|Win32.Build.0 = Debug|Win32
- {808B6774-93FA-4ABF-A23F-35C55FA80B80}.Release|Win32.ActiveCfg = Release|Win32
- {808B6774-93FA-4ABF-A23F-35C55FA80B80}.Release|Win32.Build.0 = Release|Win32
- {808B6774-93FA-4ABF-A23F-35C55FA80B80}.Debug|x64.ActiveCfg = Debug|x64
- {808B6774-93FA-4ABF-A23F-35C55FA80B80}.Debug|x64.Build.0 = Debug|x64
- {808B6774-93FA-4ABF-A23F-35C55FA80B80}.Release|x64.ActiveCfg = Release|x64
- {808B6774-93FA-4ABF-A23F-35C55FA80B80}.Release|x64.Build.0 = Release|x64
- {4BED411D-1B55-4A64-84C9-36EC25F083D2}.Debug|Win32.ActiveCfg = Debug|Win32
- {4BED411D-1B55-4A64-84C9-36EC25F083D2}.Debug|Win32.Build.0 = Debug|Win32
- {4BED411D-1B55-4A64-84C9-36EC25F083D2}.Release|Win32.ActiveCfg = Release|Win32
- {4BED411D-1B55-4A64-84C9-36EC25F083D2}.Release|Win32.Build.0 = Release|Win32
- {4BED411D-1B55-4A64-84C9-36EC25F083D2}.Debug|x64.ActiveCfg = Debug|x64
- {4BED411D-1B55-4A64-84C9-36EC25F083D2}.Debug|x64.Build.0 = Debug|x64
- {4BED411D-1B55-4A64-84C9-36EC25F083D2}.Release|x64.ActiveCfg = Release|x64
- {4BED411D-1B55-4A64-84C9-36EC25F083D2}.Release|x64.Build.0 = Release|x64
- {48343119-5771-494E-977E-0D439A45BF65}.Debug|Win32.ActiveCfg = Debug|Win32
- {48343119-5771-494E-977E-0D439A45BF65}.Debug|Win32.Build.0 = Debug|Win32
- {48343119-5771-494E-977E-0D439A45BF65}.Release|Win32.ActiveCfg = Release|Win32
- {48343119-5771-494E-977E-0D439A45BF65}.Release|Win32.Build.0 = Release|Win32
- {48343119-5771-494E-977E-0D439A45BF65}.Debug|x64.ActiveCfg = Debug|x64
- {48343119-5771-494E-977E-0D439A45BF65}.Debug|x64.Build.0 = Debug|x64
- {48343119-5771-494E-977E-0D439A45BF65}.Release|x64.ActiveCfg = Release|x64
- {48343119-5771-494E-977E-0D439A45BF65}.Release|x64.Build.0 = Release|x64
- {B4244D54-7EBF-43D4-BB6D-C994C182C572}.Debug|Win32.ActiveCfg = Debug|Win32
- {B4244D54-7EBF-43D4-BB6D-C994C182C572}.Debug|Win32.Build.0 = Debug|Win32
- {B4244D54-7EBF-43D4-BB6D-C994C182C572}.Release|Win32.ActiveCfg = Release|Win32
- {B4244D54-7EBF-43D4-BB6D-C994C182C572}.Release|Win32.Build.0 = Release|Win32
- {B4244D54-7EBF-43D4-BB6D-C994C182C572}.Debug|x64.ActiveCfg = Debug|x64
- {B4244D54-7EBF-43D4-BB6D-C994C182C572}.Debug|x64.Build.0 = Debug|x64
- {B4244D54-7EBF-43D4-BB6D-C994C182C572}.Release|x64.ActiveCfg = Release|x64
- {B4244D54-7EBF-43D4-BB6D-C994C182C572}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -158,21 +96,11 @@ Global
{AE6270A1-FAC6-45B2-A641-9BFAF534DD01} = {A9C9BC25-9393-405C-A366-B7F457CAD629}
{EEB5FBCF-333A-4D54-B937-C24FB0CC10EB} = {20339A89-50EB-4567-9AD9-BF3B2484D1EA}
{6EED5CDD-5526-40DC-97F9-582857E10187} = {BC1A657D-F736-42B1-8B6F-65660268D1E4}
- {94BDC8D1-B62F-4200-9873-D403B6D30301} = {5B8D9AE9-CD64-4BDE-924B-85E2CFF7AC6D}
- {808B6774-93FA-4ABF-A23F-35C55FA80B80} = {9C88D019-1CD4-44BD-8355-75C0F1A0D348}
- {4BED411D-1B55-4A64-84C9-36EC25F083D2} = {F9F19F6E-0B8B-4ED0-BA15-75455AC110D4}
- {48343119-5771-494E-977E-0D439A45BF65} = {852E07AA-FE41-404F-BE25-30B5BCE596B7}
- {B4244D54-7EBF-43D4-BB6D-C994C182C572} = {CAFB7E8F-109E-4224-BD53-EE93946311DF}
{D00328D3-8C3F-4702-B819-5A3830E7FA70} = {EA42BA41-FC92-4985-80CA-B8BAC85DA33D}
{46FAA529-1596-416E-82DA-C7BE08A96774} = {EA42BA41-FC92-4985-80CA-B8BAC85DA33D}
{DB521009-ED4B-48E6-85CE-9C5B8B6CA915} = {EA42BA41-FC92-4985-80CA-B8BAC85DA33D}
{A9C9BC25-9393-405C-A366-B7F457CAD629} = {EA42BA41-FC92-4985-80CA-B8BAC85DA33D}
{20339A89-50EB-4567-9AD9-BF3B2484D1EA} = {EA42BA41-FC92-4985-80CA-B8BAC85DA33D}
{BC1A657D-F736-42B1-8B6F-65660268D1E4} = {EA42BA41-FC92-4985-80CA-B8BAC85DA33D}
- {5B8D9AE9-CD64-4BDE-924B-85E2CFF7AC6D} = {891C089F-780C-4983-8C50-1A1C9BEB0593}
- {9C88D019-1CD4-44BD-8355-75C0F1A0D348} = {891C089F-780C-4983-8C50-1A1C9BEB0593}
- {F9F19F6E-0B8B-4ED0-BA15-75455AC110D4} = {891C089F-780C-4983-8C50-1A1C9BEB0593}
- {852E07AA-FE41-404F-BE25-30B5BCE596B7} = {891C089F-780C-4983-8C50-1A1C9BEB0593}
- {CAFB7E8F-109E-4224-BD53-EE93946311DF} = {891C089F-780C-4983-8C50-1A1C9BEB0593}
EndGlobalSection
EndGlobal