From 47282c86ceae6ebf779687737ea8ea38a0f3f2fa Mon Sep 17 00:00:00 2001 From: Matthew Montera Date: Fri, 18 Aug 2017 17:10:41 -0700 Subject: AddComponent to Extension Put the Win32 Service into the base, and created two separate extensions that create the component in a loose and tight manner. --- general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base.sln | 19 + .../osrfx2_DCHU_base/osrfx2_DCHU_base.inx | Bin 6664 -> 10398 bytes .../osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj | 36 +- .../osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj | 12 +- .../osrfx2_DCHU_testapp/osrusbfx2.vcxproj | 8 +- .../osrfx2_DCHU_usersvc/CppWindowsService.cpp | 74 ++ .../osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp | 1152 ++++++++++++++++++++ .../osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h | 342 ++++++ .../osrfx2_DCHU_usersvc/SampleService.cpp | 287 +++++ .../osrfx2_DCHU_usersvc/SampleService.h | 174 +++ .../osrfx2_DCHU_usersvc/ServiceBase.cpp | 794 ++++++++++++++ .../osrfx2_DCHU_usersvc/ServiceBase.h | 423 +++++++ .../osrfx2_DCHU_usersvc/ThreadPool.h | 80 ++ .../osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.cpp | 156 +++ .../osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.h | 111 ++ .../osrfx2_DCHU_usersvc.filters | 54 + .../osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx | Bin 0 -> 3190 bytes .../osrfx2_DCHU_usersvc.vcxproj | 206 ++++ .../osrfx2_DCHU_component.sln | 73 -- .../osrfx2_DCHU_component.filters | 14 - .../osrfx2_DCHU_component.inx | 64 -- .../osrfx2_DCHU_component.vcxproj | 272 ----- .../osrfx2_DCHU_componentsoftware.cpp | 489 --------- .../osrfx2_DCHU_componentsoftware.filters | 33 - .../osrfx2_DCHU_componentsoftware.vcxproj | 169 --- .../osrfx2_DCHU_componentsoftware/stdafx.cpp | 8 - .../osrfx2_DCHU_componentsoftware/stdafx.h | 18 - .../osrfx2_DCHU_componentsoftware/targetver.h | 8 - .../osrfx2_DCHU_extension.sln | 73 -- .../osrfx2_DCHU_extension.filters | 14 - .../osrfx2_DCHU_extension.inx | 79 -- .../osrfx2_DCHU_extension.vcxproj | 281 ----- .../osrfx2_DCHU_usersvc/CppWindowsService.cpp | 74 -- .../osrfx2_DCHU_usersvc/Main.cpp | 320 ------ .../osrfx2_DCHU_usersvc/Main.h | 261 ----- .../osrfx2_DCHU_usersvc/SampleService.cpp | 254 ----- .../osrfx2_DCHU_usersvc/SampleService.h | 174 --- .../osrfx2_DCHU_usersvc/ServiceBase.cpp | 794 -------------- .../osrfx2_DCHU_usersvc/ServiceBase.h | 423 ------- .../osrfx2_DCHU_usersvc/ThreadPool.h | 80 -- .../osrfx2_DCHU_usersvc/Utils.cpp | 156 --- .../osrfx2_DCHU_usersvc/Utils.h | 111 -- .../osrfx2_DCHU_usersvc.filters | 54 - .../osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx | Bin 3190 -> 0 bytes .../osrfx2_DCHU_usersvc.vcxproj | 206 ---- .../osrfx2_DCHU_component.filters | 14 + .../osrfx2_DCHU_component.inx | 64 ++ .../osrfx2_DCHU_component.vcxproj | 276 +++++ .../osrfx2_DCHU_componentsoftware.cpp | 489 +++++++++ .../osrfx2_DCHU_componentsoftware.filters | 33 + .../osrfx2_DCHU_componentsoftware.vcxproj | 169 +++ .../osrfx2_DCHU_componentsoftware/stdafx.cpp | 8 + .../osrfx2_DCHU_componentsoftware/stdafx.h | 18 + .../osrfx2_DCHU_componentsoftware/targetver.h | 8 + .../osrfx2_DCHU_extension.sln | 102 ++ .../osrfx2_DCHU_extension.filters | 14 + .../osrfx2_DCHU_extension.inx | 54 + .../osrfx2_DCHU_extension.vcxproj | 266 +++++ .../osrfx2_DCHU_component.inx | 64 ++ .../osrfx2_DCHU_componentsoftware.cpp | 489 +++++++++ .../osrfx2_DCHU_componentsoftware.filters | 33 + .../osrfx2_DCHU_componentsoftware.vcxproj | 169 +++ .../osrfx2_DCHU_componentsoftware/stdafx.cpp | 8 + .../osrfx2_DCHU_componentsoftware/stdafx.h | 18 + .../osrfx2_DCHU_componentsoftware/targetver.h | 8 + .../osrfx2_DCHU_extension.sln | 73 ++ .../osrfx2_DCHU_extension.filters | 14 + .../osrfx2_DCHU_extension.inx | 55 + .../osrfx2_DCHU_extension.vcxproj | 273 +++++ 69 files changed, 6629 insertions(+), 4520 deletions(-) create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/CppWindowsService.cpp create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.cpp create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.h create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ThreadPool.h create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.cpp create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.h create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx create mode 100644 general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component.sln delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.filters delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.inx delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.cpp delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.h delete mode 100644 general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/targetver.h delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension.sln delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/CppWindowsService.cpp delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Main.cpp delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Main.h delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.cpp delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.h delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.cpp delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.h delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ThreadPool.h delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.cpp delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.h delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx delete mode 100644 general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.filters create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.cpp create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.h create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/targetver.h create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension.sln create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx create mode 100644 general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/stdafx.cpp create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/stdafx.h create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/targetver.h create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension.sln create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx create mode 100644 general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base.sln b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base.sln index ce0593e1..dfa90dbd 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base.sln +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base.sln @@ -10,6 +10,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_base", "osrfx2_DCHU_base\osrfx2_DCHU_base.vcxproj", "{5B711254-3F53-4E1D-A1AD-CC81E34588B7}" ProjectSection(ProjectDependencies) = postProject {3CC42473-D121-41F4-AE26-1F2F0AC65E82} = {3CC42473-D121-41F4-AE26-1F2F0AC65E82} + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} = {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_testapp", "osrfx2_DCHU_testapp\osrusbfx2.vcxproj", "{6EED5CDD-5526-40DC-97F9-582857E10187}" @@ -18,6 +19,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_filter", "osrfx EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_filter", "osrfx2_DCHU_filter\osrfx2_DCHU_filter.vcxproj", "{3CC42473-D121-41F4-AE26-1F2F0AC65E82}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_usersvc", "osrfx2_DCHU_usersvc", "{DA04929E-1AFF-4EB7-935F-E9485C0316DB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_usersvc", "osrfx2_DCHU_usersvc\osrfx2_DCHU_usersvc.vcxproj", "{DE70E2D1-6A4D-4984-BD82-CE750889F0D3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM @@ -42,6 +47,7 @@ Global {5B711254-3F53-4E1D-A1AD-CC81E34588B7}.Release|ARM64.ActiveCfg = Release|Win32 {5B711254-3F53-4E1D-A1AD-CC81E34588B7}.Release|Win32.ActiveCfg = Release|Win32 {5B711254-3F53-4E1D-A1AD-CC81E34588B7}.Release|Win32.Build.0 = Release|Win32 + {5B711254-3F53-4E1D-A1AD-CC81E34588B7}.Release|Win32.Deploy.0 = Release|Win32 {5B711254-3F53-4E1D-A1AD-CC81E34588B7}.Release|x64.ActiveCfg = Release|x64 {5B711254-3F53-4E1D-A1AD-CC81E34588B7}.Release|x64.Build.0 = Release|x64 {6EED5CDD-5526-40DC-97F9-582857E10187}.Debug|ARM.ActiveCfg = Debug|Win32 @@ -72,6 +78,18 @@ Global {3CC42473-D121-41F4-AE26-1F2F0AC65E82}.Release|x64.ActiveCfg = Release|x64 {3CC42473-D121-41F4-AE26-1F2F0AC65E82}.Release|x64.Build.0 = Release|x64 {3CC42473-D121-41F4-AE26-1F2F0AC65E82}.Release|x64.Deploy.0 = Release|x64 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|ARM.ActiveCfg = Debug|Win32 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|ARM64.ActiveCfg = Debug|Win32 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|Win32.ActiveCfg = Debug|Win32 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|Win32.Build.0 = Debug|Win32 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|x64.ActiveCfg = Debug|x64 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|x64.Build.0 = Debug|x64 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|ARM.ActiveCfg = Release|Win32 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|ARM64.ActiveCfg = Release|Win32 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|Win32.ActiveCfg = Release|Win32 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|Win32.Build.0 = Release|Win32 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|x64.ActiveCfg = Release|x64 + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -80,5 +98,6 @@ Global {5B711254-3F53-4E1D-A1AD-CC81E34588B7} = {3B268182-F450-4AB8-B350-A2CF6495F756} {6EED5CDD-5526-40DC-97F9-582857E10187} = {52ABC41E-9AAA-4DA8-8986-F6298E32C8A3} {3CC42473-D121-41F4-AE26-1F2F0AC65E82} = {1665ED66-7966-4FE2-9BA5-B5843511E325} + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} = {DA04929E-1AFF-4EB7-935F-E9485C0316DB} EndGlobalSection EndGlobal diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx index c4cead6a..4b37e644 100644 Binary files a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx and b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.inx differ diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj index 4a34c9dc..4cfeed87 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj @@ -26,7 +26,7 @@ Win32 {F915ED95-7BE9-4CDB-B09A-0D3F4C9657FE} osrfx2_DCHU_base - $(LatestTargetPlatformVersion) + 10.0.15063.0 @@ -42,7 +42,7 @@ True Universal UMDF - WindowsUserModeDriver10.0 + v140 DynamicLibrary @@ -50,7 +50,7 @@ False Universal UMDF - WindowsUserModeDriver10.0 + v140 DynamicLibrary @@ -58,12 +58,12 @@ True Universal UMDF - WindowsUserModeDriver10.0 + v140 DynamicLibrary - $(IntDir) + $(SolutionDir)$(Platform)\$(ConfigurationName)\ @@ -137,6 +137,7 @@ %(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib;$(SDK_LIB_PATH)\WppRecorderUM.lib + 1.0.0.0 @@ -162,6 +163,7 @@ %(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib;$(SDK_LIB_PATH)\WppRecorderUM.lib + 1.0.0.0 @@ -187,6 +189,7 @@ %(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib;$(SDK_LIB_PATH)\WppRecorderUM.lib + 1.0.0.0 @@ -212,21 +215,30 @@ %(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib;$(SDK_LIB_PATH)\WppRecorderUM.lib + 1.0.0.0 + + + + + + + + - + @@ -234,11 +246,19 @@ - - + + + + + + + + + + diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj index 0ef42141..5e015f80 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj @@ -27,7 +27,7 @@ Debug Win32 {1A4A32BA-1596-4F52-BC48-B85A6D8D5D12} - $(LatestTargetPlatformVersion) + 10.0.15063.0 osrfx2_DCHU_filter @@ -44,7 +44,7 @@ True Universal UMDF - WindowsUserModeDriver10.0 + v140 DynamicLibrary @@ -52,7 +52,7 @@ False Universal UMDF - WindowsUserModeDriver10.0 + v140 DynamicLibrary @@ -60,7 +60,7 @@ True Universal UMDF - WindowsUserModeDriver10.0 + v140 DynamicLibrary @@ -101,7 +101,7 @@ - %(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib + %(AdditionalDependencies);$(SDK_LIB_PATH)onecore.lib %(AdditionalIncludeDirectories);..\..\inc @@ -137,7 +137,7 @@ - %(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib + %(AdditionalDependencies);$(SDK_LIB_PATH)onecore.lib %(AdditionalIncludeDirectories);..\..\inc diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj index e1450faf..9ac1e4f3 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj @@ -25,7 +25,7 @@ Win32 {F19E45AF-8B05-4204-A66B-9BDBFE333233} osrfx2_DCHU_testapp - $(LatestTargetPlatformVersion) + 10.0.15063.0 @@ -41,7 +41,7 @@ True Universal - WindowsApplicationForDrivers10.0 + v140 Application @@ -49,7 +49,7 @@ False Universal - WindowsApplicationForDrivers10.0 + v140 Application @@ -57,7 +57,7 @@ True Universal - WindowsApplicationForDrivers10.0 + v140 Application diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/CppWindowsService.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/CppWindowsService.cpp new file mode 100644 index 00000000..98a3975c --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/CppWindowsService.cpp @@ -0,0 +1,74 @@ +/*++ + +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: + + CppWindowsService.cpp + +Abstract: + + The file defines the entry point of the application. According to the + arguments in the command line, the function installs or uninstalls or + starts the service by calling into different routines. + +Environment: + + User mode + +--*/ + +#pragma region Includes +#include +#include +#include "ServiceBase.h" +#include "SampleService.h" +#pragma endregion + +// +// Settings of the service +// + +// +// Internal name of the service +// +#define SERVICE_NAME L"OsrUsbFx2UmUserSvc" + + +/*++ + +Routine Description: + + Entry point for the service. + +Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + +Return Value: + + VOID + +--*/ +INT +wmain( + INT Argc, + WCHAR *Argv[] + ) +{ + CSampleService service(SERVICE_NAME); + + if (!CServiceBase::Run(service)) + { + wprintf(L"Service failed to run w/err 0x%08lx\n", GetLastError()); + } + + return 0; +} \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp new file mode 100644 index 00000000..e9d24c1b --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp @@ -0,0 +1,1152 @@ +/*++ + +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: + + Main.cpp + +Abstract: + + Implements the functions to control the OSR USB FX2 device. + +Environment: + + User mode + +--*/ + +#include "Main.h" +#include "Utils.h" + +// +// Keep track of where the OSRFX2 device's bar graph currently is. +// +INT CurrentBar; +BAR_GRAPH_STATE BarGraphState; + +/*++ + +Routine Description: + + Sets the variables in this service to their default values. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +SetVariables() +{ + CurrentBar = 0; +} + + +/*++ + +Routine Description: + + Retrieves the device path of a given interface. + +Arguments: + + InterfaceGuid - The GUID of the interface to search for + + DevicePath - The resulting device path + + DevicePathLength - The length of DevicePath + +Return Value: + + TRUE if the function succeeded and FALSE otherwise. Errors + are logged in the Application event log. + +--*/ +_Success_(return) +BOOL +GetDevicePath( + _In_ LPGUID InterfaceGuid, + _Out_writes_z_(DevicePathLength) PWCHAR DevicePath, + _In_ size_t DevicePathLength + ) +{ + HRESULT hr = E_FAIL; + BOOL Return = FALSE; + CONFIGRET Status = CR_SUCCESS; + PWSTR DeviceInterfaceList = NULL; + ULONG DeviceInterfaceListLength = 0; + PWSTR NextInterface; + + // + // Determine if there are any interfaces that match the OSRFX2 device. + // + Status = CM_Get_Device_Interface_List_Size(&DeviceInterfaceListLength, + InterfaceGuid, + NULL, + CM_GET_DEVICE_INTERFACE_LIST_PRESENT); + + if (Status != CR_SUCCESS) + { + WriteToErrorLog(L"CM_Get_DeviceInterface_List_Size", + CM_MapCrToWin32Err(Status, ERROR_FILE_NOT_FOUND)); + goto clean0; + } + + if (DeviceInterfaceListLength < 1) + { + WriteToErrorLog(L"CM_Get_DeviceInterface_List_Size", + CM_MapCrToWin32Err(Status, ERROR_EMPTY)); + goto clean0; + } + + DeviceInterfaceList = (PWSTR)malloc(DeviceInterfaceListLength * sizeof(WCHAR)); + + if (DeviceInterfaceList == NULL) + { + WriteToEventLog(L"Failed to allocate memory for the device interface list", + TRACE_LEVEL_ERROR); + goto clean0; + } + + ZeroMemory(DeviceInterfaceList, DeviceInterfaceListLength * sizeof(WCHAR)); + + Status = CM_Get_Device_Interface_List(InterfaceGuid, + NULL, + DeviceInterfaceList, + DeviceInterfaceListLength, + CM_GET_DEVICE_INTERFACE_LIST_PRESENT); + + if (Status != CR_SUCCESS) + { + WriteToErrorLog(L"CM_Get_Device_Interface_List", + CM_MapCrToWin32Err(Status, ERROR_FILE_NOT_FOUND)); + goto clean0; + } + + if (*DeviceInterfaceList == UNICODE_NULL) + { + WriteToEventLog(L"CM_Get_Device_Interface_List returned an empty list", + TRACE_LEVEL_ERROR); + } + + // + // This sample only expects one interface for the OSRFX2 device. For other + // devices, though, it maybe necessary to sift through the interfaces + // from CM_Get_Device_Interface_List in order to find the correct device. + // + NextInterface = DeviceInterfaceList + wcslen(DeviceInterfaceList) + 1; + + if (*NextInterface != UNICODE_NULL) + { + WriteToEventLog(L"More than one device interface instance found. " + "Selecting first matching device.", + TRACE_LEVEL_WARNING); + } + + hr = StringCchCopy(DevicePath, DevicePathLength, DeviceInterfaceList); + + if (FAILED(hr)) + { + WriteToErrorLog(L"StringCchCopy", HRESULT_CODE(hr)); + goto clean0; + } + +clean0: + + if (DeviceInterfaceList != NULL) + { + free(DeviceInterfaceList); + } + + if (Status == CR_SUCCESS) + { + Return = TRUE; + } + + return Return; +} + + +/*++ + +Routine Description: + + Opens up the OSR USB FX2 device handle. + +Arguments: + + Synchronous - Whether or not this device should be opened for syncrhonous + access + +Return Value: + + The handle to the OSR USB FX2 device. + +--*/ +_Check_return_ +_Ret_notnull_ +_Success_(return != INVALID_HANDLE_VALUE) +HANDLE +OpenDevice( + _In_ BOOL Synchronous +) +{ + HANDLE DeviceHandle; + WCHAR DeviceName[MAX_DEVPATH_LENGTH]; + + if (!GetDevicePath((LPGUID)&GUID_DEVINTERFACE_OSRUSBFX2, + DeviceName, + sizeof(DeviceName) / sizeof(DeviceName[0]))) + { + return INVALID_HANDLE_VALUE; + } + + // + // Open a handle to the interface. + // + if (Synchronous) + { + DeviceHandle = CreateFile(DeviceName, + GENERIC_WRITE | GENERIC_READ, + FILE_SHARE_WRITE | FILE_SHARE_READ, + NULL, // default security + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + } + else + { + DeviceHandle = CreateFile(DeviceName, + GENERIC_WRITE | GENERIC_READ, + FILE_SHARE_WRITE | FILE_SHARE_READ, + NULL, // default security + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, + NULL); + } + + if (DeviceHandle == INVALID_HANDLE_VALUE) + { + WriteToErrorLog(L"CreateFile", GetLastError()); + } + else + { + WriteToEventLog(L"Opened Device Successfully", TRACE_LEVEL_INFORMATION); + } + + return DeviceHandle; +} + + +/*++ + +Routine Description: + + Handles an interface arrival notification. + +Arguments: + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +InterfaceArrivalAction( + _In_ PHANDLE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + + // + // Now that the interface has arrived, open a handle to it, and then + // register that handle for device events. + // + EnterCriticalSection(&Context->Lock); + + if (Context->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) + { + // + // The handle was already retrieved. + // + Err = ERROR_SUCCESS; + goto cleanup; + } + + Context->DeviceInterfaceHandle = OpenDevice(FALSE); + + if (Context->DeviceInterfaceHandle == INVALID_HANDLE_VALUE) + { + Err = GetLastError(); + WriteToErrorLog(L"Could not open device interface", Err); + goto cleanup; + } + + Err = RegisterDeviceNotifications(Context); + + if (Err != ERROR_SUCCESS) + { + WriteToErrorLog(L"Could not register device notifications", Err); + goto cleanup; + } + +cleanup: + + LeaveCriticalSection(&Context->Lock); + + return Err; +} + + +/*++ + +Routine Description: + + Handles an interface arrival notification. + +Arguments: + + hNotify - The notification that fired the callback + + hContext - The callback context + + Action - The type of notification + + EventData - Additional information about the callback + + EventDataSize - The size of EventData + +Return Value: + + A Win32 error code. + +--*/ +DWORD +InterfaceCallback( + _In_ HCMNOTIFICATION hNotify, + _In_ PVOID hContext, + _In_ CM_NOTIFY_ACTION Action, + _In_ PCM_NOTIFY_EVENT_DATA EventData, + _In_ DWORD EventDataSize + ) +{ + DWORD Err = ERROR_SUCCESS; + PHANDLE_CONTEXT Context = (PHANDLE_CONTEXT)hContext; + + // + // Validate Context. + // + if (Context == NULL) + { + goto cleanup; + } + + if (Action == CM_NOTIFY_ACTION_DEVICEINTERFACEARRIVAL) + { + Err = InterfaceArrivalAction(Context); + } + +cleanup: + + return Err; +} + + +/*++ + +Routine Description: + + Registers the service for notifications using the notification handle in + Context. + +Arguments: + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +RegisterInterfaceNotifications( + _In_ PHANDLE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + CONFIGRET cr; + CM_NOTIFY_FILTER NotifyFilter = {0}; + + if (Context == NULL) + { + goto cleanup; + } + + ZeroMemory(&NotifyFilter, sizeof(NotifyFilter)); + NotifyFilter.cbSize = sizeof(NotifyFilter); + NotifyFilter.FilterType = CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE; + NotifyFilter.u.DeviceInterface.ClassGuid = GUID_DEVINTERFACE_OSRUSBFX2; + + cr = CM_Register_Notification(&NotifyFilter, + (PVOID)Context, + (PCM_NOTIFY_CALLBACK)InterfaceCallback, + &Context->InterfaceNotificationHandle); + + if (cr != CR_SUCCESS) + { + Err = CM_MapCrToWin32Err(cr, ERROR_INVALID_DATA); + WriteToErrorLog(L"CM_Register_Notification", Err); + goto cleanup; + } + +cleanup: + + return Err; +} + + +/*++ + +Routine Description: + + Unregister for interface notifications. Note, this routine deadlocks + when called from an interface callback. + +Arguments: + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +UnregisterInterfaceNotifications( + PHANDLE_CONTEXT Context + ) +{ + CONFIGRET cr; + + if (Context->InterfaceNotificationHandle != NULL) + { + cr = CM_Unregister_Notification(Context->InterfaceNotificationHandle); + + Context->InterfaceNotificationHandle = NULL; + } + + return CM_MapCrToWin32Err(cr, ERROR_INVALID_DATA); +} + + +/*++ + +Routine Description: + + Callback for when a device is being query removed. + +Arguments: + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +DeviceQueryRemoveAction( + _In_ PHANDLE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + + EnterCriticalSection(&Context->Lock); + + if (Context->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) + { + // + // Close open handles to allow the device to exit + // + CloseHandle(Context->DeviceInterfaceHandle); + + Context->DeviceInterfaceHandle = INVALID_HANDLE_VALUE; + } + + LeaveCriticalSection(&Context->Lock); + + return Err; +} + + +/*++ + +Routine Description: + + This callback avoids a deadlock when unregistering device notifications. + Rather than calling CM_Unregister_Notification from the callback, the + callback gives that work to a separate thread to avoid deadlock. + +Arguments: + + Instance - The thread's callback instance + + hContext - The callback context + + pWork - The thread handle + +Return Value: + + VOID + +--*/ +VOID +CALLBACK +UnregisterWorkerThreadCallback( + _Inout_ PTP_CALLBACK_INSTANCE Instance, + _Inout_opt_ PVOID hContext, + _Inout_ PTP_WORK pWork + ) +{ + PHANDLE_CONTEXT Context = (PHANDLE_CONTEXT)hContext; + + EnterCriticalSection(&Context->Lock); + + UnregisterDeviceNotifications(Context); + + // + // Close the device handle. + // + if (Context->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) + { + CloseHandle(Context->DeviceInterfaceHandle); + + Context->DeviceInterfaceHandle = INVALID_HANDLE_VALUE; + } + + LeaveCriticalSection(&Context->Lock); +} + + +/*++ + +Routine Description: + + Handles a device query remove failed notification. + +Arguments: + + hNotify - The notification that spurred this callback + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +DeviceQueryRemoveFailedAction( + HCMNOTIFICATION hNotify, + PHANDLE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + + EnterCriticalSection(&Context->Lock); + + // + // In case this callback fires before the registration call returns, make + // sure the notification handle is properly set. + // + Context->InterfaceNotificationHandle = hNotify; + + // + // Unregister the device callback, and then close the handle + // + if (!Context->Unregister) + { + Context->Unregister = TRUE; + SubmitThreadpoolWork(Context->Work); + } + + LeaveCriticalSection(&Context->Lock); + + // + // Wait for the callback and then re-register the device + // + WaitForThreadpoolWorkCallbacks(Context->Work, FALSE); + + EnterCriticalSection(&Context->Lock); + + if (Context->DeviceInterfaceHandle == INVALID_HANDLE_VALUE) + { + Context->DeviceInterfaceHandle = OpenDevice(FALSE); + } + + if (Context->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) + { + RegisterDeviceNotifications(Context); + } + + LeaveCriticalSection(&Context->Lock); + + return Err; +} + + +/*++ + +Routine Description: + + Handles a device remove pending notification. + +Arguments: + + hNotify - The notification that spurred this callback + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +DeviceRemovePendingAction( + HCMNOTIFICATION hNotify, + PHANDLE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + + EnterCriticalSection(&Context->Lock); + + // + // In case this callback fires before the registration call returns, make + // sure the notification handle is properly set. + // + Context->InterfaceNotificationHandle = hNotify; + + // + // Unregister the device callback, and then close the handle + // + if (!Context->Unregister) + { + Context->Unregister = TRUE; + SubmitThreadpoolWork(Context->Work); + } + + LeaveCriticalSection(&Context->Lock); + + return Err; +} + + +/*++ + +Routine Description: + + Handles a device remove complete notification. + +Arguments: + + hNotify - The notification that spurred this callback + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +DeviceRemoveCompleteAction( + HCMNOTIFICATION hNotify, + PHANDLE_CONTEXT Context + ) +{ + __debugbreak(); + + DWORD Err = ERROR_SUCCESS; + + EnterCriticalSection(&Context->Lock); + + // + // In case this callback fires before the registration call returns, make + // sure the notification handle is properly set. + // + Context->InterfaceNotificationHandle = hNotify; + + // + // Unregister the device callback, and then close the handle + // + if (!Context->Unregister) + { + Context->Unregister = TRUE; + SubmitThreadpoolWork(Context->Work); + } + + LeaveCriticalSection(&Context->Lock); + + return Err; +} + + +/*++ + +Routine Description: + + Handles device notifications. + +Arguments: + + hNotify - The notification that spurred this callback + + hContext - The callback context + + Action - The type of callback + + EventData - Additional information about this callback + + EventDataSize - The size of EventData + +Return Value: + + A Win32 error code. + +--*/ +DWORD +DeviceCallback( + _In_ HCMNOTIFICATION hNotify, + _In_ PVOID hContext, + _In_ CM_NOTIFY_ACTION Action, + _In_ PCM_NOTIFY_EVENT_DATA EventData, + _In_ DWORD EventDataSize +) +{ + DWORD Err = ERROR_SUCCESS; + PHANDLE_CONTEXT Context = (PHANDLE_CONTEXT)hContext; + + // + // Validate Context. + // + if (Context == NULL) + { + goto cleanup; + } + + switch (Action) + { + + case CM_NOTIFY_ACTION_DEVICEQUERYREMOVE: + DeviceQueryRemoveAction(Context); + break; + + case CM_NOTIFY_ACTION_DEVICEQUERYREMOVEFAILED: + DeviceQueryRemoveFailedAction(hNotify, Context); + break; + + case CM_NOTIFY_ACTION_DEVICEREMOVEPENDING: + DeviceRemovePendingAction(hNotify, Context); + break; + + case CM_NOTIFY_ACTION_DEVICEREMOVECOMPLETE: + DeviceRemoveCompleteAction(hNotify, Context); + break; + + } + +cleanup: + + return Err; +} + + +/*++ + +Routine Description: + + Register for device notifications. + +Arguments: + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +RegisterDeviceNotifications( + _In_ PHANDLE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + CONFIGRET cr; + CM_NOTIFY_FILTER NotifyFilter = {0}; + + NotifyFilter.cbSize = sizeof(NotifyFilter); + NotifyFilter.FilterType = CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE; + NotifyFilter.u.DeviceHandle.hTarget = Context->DeviceInterfaceHandle; + + cr = CM_Register_Notification(&NotifyFilter, + (PVOID)Context, + (PCM_NOTIFY_CALLBACK)DeviceCallback, + &Context->DeviceNotificationHandle); + + if (cr != CR_SUCCESS) + { + Err = CM_MapCrToWin32Err(cr, ERROR_INVALID_DATA); + WriteToEventLog(L"Could not register for notifications", TRACE_LEVEL_WARNING); + goto cleanup; + } + + Context->Unregister = FALSE; + +cleanup: + + return Err; +} + + +/*++ + +Routine Description: + + Unregister for device notifications. + +Arguments: + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +UnregisterDeviceNotifications( + PHANDLE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + CONFIGRET cr; + + if (Context->DeviceNotificationHandle != NULL) + { + cr = CM_Unregister_Notification(Context->DeviceNotificationHandle); + + if (cr != CR_SUCCESS) + { + Err = CM_MapCrToWin32Err(cr, ERROR_INVALID_DATA); + WriteToEventLog(L"Could not unregister notifications", TRACE_LEVEL_WARNING); + } + + Context->DeviceNotificationHandle = NULL; + } + + return Err; +} + + +/*++ + +Routine Description: + + Initialize the given PHANDLE_CONTEXT. + +Arguments: + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +InitializeContext( + _Out_ PHANDLE_CONTEXT* Context + ) +{ + DWORD Err = ERROR_SUCCESS; + + *Context = (PHANDLE_CONTEXT)malloc(sizeof(HANDLE_CONTEXT)); + + if (*Context == NULL) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + (*Context)->DeviceInterfaceHandle = INVALID_HANDLE_VALUE; + + InitializeCriticalSection(&(*Context)->Lock); + + (*Context)->Work = CreateThreadpoolWork(UnregisterWorkerThreadCallback, (PVOID)(*Context), NULL); + + if ((*Context)->Work == NULL) + { + WriteToErrorLog(L"Could not create worker thread callback", ERROR_OUTOFMEMORY); + goto cleanup; + } + + (*Context)->DeviceNotificationHandle = NULL; + (*Context)->InterfaceNotificationHandle = NULL; + + // + // Register for device interface events to open and close the handle to + // the interface. + // + Err = RegisterInterfaceNotifications(*Context); + + if (Err != ERROR_SUCCESS) + { + WriteToErrorLog(L"Could not register notifications", Err); + goto cleanup; + } + + EnterCriticalSection(&(*Context)->Lock); + + // + // The interface may already have arrived while registering for + // notifications. + // + if ((*Context)->DeviceInterfaceHandle == INVALID_HANDLE_VALUE) + { + (*Context)->DeviceInterfaceHandle = OpenDevice(FALSE); + } + + if ((*Context)->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) + { + Err = RegisterDeviceNotifications(*Context); + + if (Err != ERROR_SUCCESS) + { + WriteToErrorLog(L"Could not register device notifications", Err); + goto cleanup; + } + } + + // + // If OpenDevice ends up returning INVALID_HANDLE_VALUE, that's fine + // since a notification for the interface will arrive later. + // + +cleanup: + + LeaveCriticalSection(&(*Context)->Lock); + + return Err; +} + + +/*++ + +Routine Description: + + Clean up the given PHANDLE_CONTEXT. + +Arguments: + + Context - The callback context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +CloseContext( + _In_ PHANDLE_CONTEXT* Context + ) +{ + DWORD Err = ERROR_SUCCESS; + BOOL Unregister = FALSE; + + if ((Context == NULL) || + (*Context == NULL)) + { + // + // Nothing to remove. + // + goto cleanup; + } + + EnterCriticalSection(&(*Context)->Lock); + + if (!(*Context)->Unregister) + { + // + // Unregister from the callback here. + // + Unregister = TRUE; + (*Context)->Unregister = TRUE; + } + + LeaveCriticalSection(&(*Context)->Lock); + + // + // Unregister from the interface first, so that re-appearance of the interface + // doesn't cause us to register device events again. + // + Err = UnregisterInterfaceNotifications(*Context); + + if (Err != ERROR_SUCCESS) + { + WriteToErrorLog(L"Could not unregister interface notifications", Err); + } + + if (Unregister) + { + Err = UnregisterDeviceNotifications(*Context); + + if (Err != ERROR_SUCCESS) + { + WriteToErrorLog(L"Could not unregister device notifications", Err); + } + } + else + { + WaitForThreadpoolWorkCallbacks((*Context)->Work, FALSE); + } + + // + // No need to lock here, UnregisterDeviceNotifications will wait for all + // outstanding callbacks before returning. + // + if ((*Context)->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) + { + CloseHandle((*Context)->DeviceInterfaceHandle); + + (*Context)->DeviceInterfaceHandle = INVALID_HANDLE_VALUE; + } + + if ((*Context)->Work != NULL) + { + CloseThreadpoolWork((*Context)->Work); + } + + DeleteCriticalSection(&(*Context)->Lock); + + free(*Context); + + *Context = NULL; + +cleanup: + + return Err; +} + +/*++ + +Routine Description: + + Turns off all of the bar graph lights on the OSR USB FX2 device. + +Arguments: + + Context - The callback context + +Return Value: + + VOID + +--*/ +DWORD +ClearAllBars( + _In_ PHANDLE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + ULONG BytesReturned; + + BarGraphState.BarsAsUChar = 0; + + if (!DeviceIoControl(Context->DeviceInterfaceHandle, + IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY, + &BarGraphState, // Pointer to InBuffer + sizeof(BAR_GRAPH_STATE), // Length of InBuffer + NULL, // Pointer to OutBuffer + 0, // Length of OutBuffer + &BytesReturned, // BytesReturned + 0)) // Pointer to Overlapped structure + { + Err = GetLastError(); + WriteToErrorLog(L"DeviceIOControl", Err); + goto cleanup; + } + +cleanup: + + return Err; +} + + +/*++ + +Routine Description: + + Lights the next bar on the OSR USB FX2 device. + +Arguments: + + Context - The callback context + +Return Value: + + VOID + +--*/ +DWORD +LightNextBar( + _In_ PHANDLE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + ULONG BytesReturned; + + // + // Normalize to 0-7 + // + CurrentBar += 1; + + if (CurrentBar > 7) + { + CurrentBar = 0; + } + + BarGraphState.BarsAsUChar = 1 << (UCHAR)CurrentBar; + + if (!DeviceIoControl(Context->DeviceInterfaceHandle, + IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY, + &BarGraphState, // Pointer to InBuffer + sizeof(BAR_GRAPH_STATE), // Length of InBuffer + NULL, // Pointer to OutBuffer + 0, // Length of OutBuffer + &BytesReturned, // BytesReturned + 0)) // Pointer to Overlapped structure + { + Err = GetLastError(); + WriteToErrorLog(L"DeviceIOControl", Err); + goto cleanup; + } + +cleanup: + + return Err; +} \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h new file mode 100644 index 00000000..ecdfa4ad --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h @@ -0,0 +1,342 @@ +/*++ + +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: + + Main.h + +Abstract: + + Implements the functions to control the OSR USB FX2 device. + +Environment: + + User mode + +--*/ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// {573E8C73-0CB4-4471-A1BF-FAB26C31D384} +DEFINE_GUID(GUID_DEVINTERFACE_OSRUSBFX2, + 0x573e8c73, 0xcb4, 0x4471, 0xa1, 0xbf, 0xfa, 0xb2, 0x6c, 0x31, 0xd3, 0x84); + +// +// Most device interface paths will fit into a buffer of this size. +// However, some could be longer, and a larger buffer or dynamically +// allocated buffer may be needed for robust code. +// +#define MAX_DEVPATH_LENGTH 1024 + +#pragma warning(push) +#pragma warning(disable:4201) // nameless struct/union +#pragma warning(disable:4214) // bit field types other than int + +typedef struct _HANDLE_CONTEXT { + HANDLE DeviceInterfaceHandle; + CRITICAL_SECTION Lock; + PTP_WORK Work; + BOOL Unregister; + HCMNOTIFICATION InterfaceNotificationHandle; + HCMNOTIFICATION DeviceNotificationHandle; +} HANDLE_CONTEXT, *PHANDLE_CONTEXT; + +// +// 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 +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; + +#include + +#pragma warning(pop) + +#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) + +/*++ + +Routine Description: + + Sets the variables in this service to their default values. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID SetVariables(VOID); + + +/*++ + +Routine Description: + + Opens up the OSR USB FX2 device handle. + +Arguments: + + Synchronous - Whether or not this device should be + opened for synchronous access + +Return Value: + + The handle to the OSR USB FX2 device. + +--*/ +HANDLE OpenDevice(_In_ BOOL Synchronous); + + +/*++ + +Routine Description: + + Turns off all of the bar graph lights on the OSR USB FX2 device. + +Arguments: + + DeviceHandle - The handle to the OSR USB FX2 device. + +Return Value: + + VOID + +--*/ +DWORD ClearAllBars(PHANDLE_CONTEXT Context); + + +/*++ + +Routine Description: + + Lights the next bar on the OSR USB FX2 device. + +Arguments: + + DeviceHandle - The handle to the OSR USB FX2 device. + +Return Value: + +VOID + +--*/ +DWORD LightNextBar(PHANDLE_CONTEXT Context); + + +/*++ + +Routine Description: + +Register for device notifications. + +Arguments: + +Context - The callback context + +Return Value: + +A Win32 error code. + +--*/ +DWORD RegisterDeviceNotifications(PHANDLE_CONTEXT Context); + + +/*++ + +Routine Description: + +Unregister for device notifications. + +Arguments: + +Context - The callback context + +Return Value: + +A Win32 error code. + +--*/ +DWORD UnregisterDeviceNotifications(PHANDLE_CONTEXT Context); + + +/*++ + +Routine Description: + +Initialize the given PHANDLE_CONTEXT. + +Arguments: + +Context - The callback context + +Return Value: + +A Win32 error code. + +--*/ +DWORD InitializeContext(PHANDLE_CONTEXT* Context); + + +/*++ + +Routine Description: + +Clean up the given PHANDLE_CONTEXT. + +Arguments: + +Context - The callback context + +Return Value: + +A Win32 error code. + +--*/ +DWORD CloseContext(PHANDLE_CONTEXT* Context); \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp new file mode 100644 index 00000000..0a246eb4 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp @@ -0,0 +1,287 @@ +/*++ + +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: + + SampleService.cpp + +Abstract: + + Provides a sample service class that derives from the service base class - + CServiceBase. The sample service logs the service start and stop + information to the Application event log, and shows how to run the main + function of the service in a thread pool worker thread. + +Environment: + + User mode + +--*/ + +#pragma region Includes +#include "SampleService.h" +#include "ThreadPool.h" +#pragma endregion + +// +// Variables used for device notifications should normally be local. However, +// we must use a global variable here since there is a potential race condition +// when the service needs to restart during device installation that could +// cause the service to prevent the device from being restarted as well. So, +// this variable is global so that the services OnStart and OnStart method can +// handle its creation and destruction. +// +PHANDLE_CONTEXT Context; + +/*++ + +Routine Description: + + The constructor of CSampleService. It initializes a new instance + of the CSampleService class. The optional parameters (CanStop, + CanShutdown and CanPauseContinue) allow you to specify whether the + service can be stopped, paused and continued, or be notified when system + shutdown occurs. Inherits properties from the class CServiceBase. + +Arguments: + + ServiceName - The name of the service + + CanStop - The service can be stopped + + CanShutdown - The service is notified when system shutdown occurs + + CanPauseContinue - The service can be paused and continued + +Return Value: + + VOID + +--*/ +CSampleService::CSampleService( + PWSTR ServiceName, + BOOL CanStop, + BOOL CanShutdown, + BOOL CanPauseContinue + ) +: CServiceBase(ServiceName, CanStop, CanShutdown, CanPauseContinue) +{ + m_fStopping = FALSE; + + // + // Create a manual-reset event that is not signaled at first to indicate + // the stopped signal of the service. + // + m_hStoppedEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + + if (m_hStoppedEvent == NULL) + { + throw GetLastError(); + } +} + + +/*++ + +Routine Description: + + The virtual destructor of CSampleService. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +CSampleService::~CSampleService() +{ + if (m_hStoppedEvent) + { + CloseHandle(m_hStoppedEvent); + m_hStoppedEvent = NULL; + } +} + + +/*++ + +Routine Description: + + This function is executed when a Start command is sent to the + service by the SCM or when the operating system starts (for a service + that starts automatically). It specifies actions to take when the + service starts. In this code sample, OnStart logs a service-start + message to the Application log, and queues the main service function for + execution in a thread pool worker thread. + + NOTE: A service application is designed to be long running. Therefore, + it usually polls or monitors something in the system. The monitoring is + set up in the OnStart method. However, OnStart does not actually do the + monitoring. The OnStart method must return to the operating system after + the service's operation has begun. It must not loop forever or block. To + set up a simple monitoring mechanism, one general solution is to create + a timer in OnStart. The timer would then raise events in your code + periodically, at which time your service could do its monitoring. The + other solution is to spawn a new thread to perform the main service + functions, which is demonstrated in this code sample. + +Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + +Return Value: + + VOID + +--*/ +VOID +CSampleService::OnStart( + DWORD Argc, + PWSTR *Argv + ) +{ + // + // Log a service start message to the Application log. + // + WriteToEventLog(L"SampleService in OnStart", + EVENTLOG_INFORMATION_TYPE); + + // + // Set up any variables the service needs. + // + SetVariables(); + + // + // Set up the context, and register for notifications. + // + InitializeContext(&Context); + + // + // Queue the main service function for execution in a worker thread. + // + CThreadPool::QueueUserWorkItem(&CSampleService::ServiceWorkerThread, this); +} + + +/*++ + +Routine Description: + + This method performs the main function of the service. It runs + on a thread pool worker thread. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CSampleService::ServiceWorkerThread() +{ + DWORD Err = ERROR_SUCCESS; + + // + // Periodically check if the service is stopping. + // + while (!m_fStopping) + { + // + // Perform main service function here... + // + + // + // Wait for the device to arrive. + // + if (Context->DeviceInterfaceHandle == INVALID_HANDLE_VALUE) + { + ::Sleep(2000); + continue; + } + + Err = ClearAllBars(Context); + + if (Err != ERROR_SUCCESS) + { + continue; + } + + Err = LightNextBar(Context); + + if (Err != ERROR_SUCCESS) + { + continue; + } + + ::Sleep(2000); // Simulate some lengthy operations. + } + + // + // Signal the stopped event. + // + SetEvent(m_hStoppedEvent); +} + + +/*++ + +Routine Description: + + This function is executed when a Stop command is sent to the service by SCM. + It specifies actions to take when a service stops running. In this code + sample, OnStop logs a service-stop message to the Application log, and + waits for the finish of the main service function. + + Be sure to periodically call ReportServiceStatus() with + SERVICE_STOP_PENDING if the procedure is going to take a long time. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CSampleService::OnStop() +{ + __debugbreak(); + + // + // Log a service stop message to the Application log. + // + WriteToEventLog(L"SampleService in OnStop", + EVENTLOG_INFORMATION_TYPE); + + // + // Indicate that the service is stopping and wait for the finish of the + // main service function (ServiceWorkerThread). + // + m_fStopping = TRUE; + + if (WaitForSingleObject(m_hStoppedEvent, INFINITE) != WAIT_OBJECT_0) + { + throw GetLastError(); + } + + // + // Clean up the context after the worker thread has finished. + // + CloseContext(&Context); +} \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h new file mode 100644 index 00000000..eee8a609 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h @@ -0,0 +1,174 @@ +/*++ + +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: + + SampleService.h + +Abstract: + + Provides a sample service class that derives from the service base class - + CServiceBase. The sample service logs the service start and stop + information to the Application event log, and shows how to run the main + function of the service in a thread pool worker thread. + +Environment: + + User mode + +--*/ + +#pragma once + +#include "ServiceBase.h" +#include "Main.h" + +class CSampleService : public CServiceBase +{ +public: + + /*++ + + Routine Description: + + The constructor of CSampleService. It initializes a new instance + of the CSampleService class. The optional parameters (CanStop, + CanShutdown and CanPauseContinue) allow you to specify whether the + service can be stopped, paused and continued, or be notified when system + shutdown occurs. Inherits properties from the class CServiceBase. + + Arguments: + + ServiceName - The name of the service + + CanStop - The service can be stopped + + CanShutdown - The service is notified when system shutdown occurs + + CanPauseContinue - The service can be paused and continued + + Return Value: + + VOID + + --*/ + CSampleService(PWSTR ServiceName, + BOOL CanStop = TRUE, + BOOL CanShutdown = TRUE, + BOOL CanPauseContinue = FALSE); + + /*++ + + Routine Description: + + The virtual destructor of CSampleService. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + virtual ~CSampleService(); + +protected: + + /*++ + + Routine Description: + + This function is executed when a Start command is sent to the + service by the SCM or when the operating system starts (for a service + that starts automatically). It specifies actions to take when the + service starts. In this code sample, OnStart logs a service-start + message to the Application log, and queues the main service function for + execution in a thread pool worker thread. + + NOTE: A service application is designed to be long running. Therefore, + it usually polls or monitors something in the system. The monitoring is + set up in the OnStart method. However, OnStart does not actually do the + monitoring. The OnStart method must return to the operating system after + the service's operation has begun. It must not loop forever or block. To + set up a simple monitoring mechanism, one general solution is to create + a timer in OnStart. The timer would then raise events in your code + periodically, at which time your service could do its monitoring. The + other solution is to spawn a new thread to perform the main service + functions, which is demonstrated in this code sample. + + Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + + Return Value: + + VOID + + --*/ + virtual VOID OnStart(DWORD Argc, PWSTR *Argv); + + + /*++ + + Routine Description: + + This function is executed when a Stop command is sent to the service by SCM. + It specifies actions to take when a service stops running. In this code + sample, OnStop logs a service-stop message to the Application log, and + waits for the finish of the main service function. + + Be sure to periodically call ReportServiceStatus() with + SERVICE_STOP_PENDING if the procedure is going to take a long time. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + virtual VOID OnStop(); + + + /*++ + + Routine Description: + + This method performs the main function of the service. It runs + on a thread pool worker thread. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + VOID ServiceWorkerThread(); + +private: + + // + // Determines if the service is currently stopping. + // + BOOL m_fStopping; + + // + // The handle to wait for a stop event. + // + HANDLE m_hStoppedEvent; +}; \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.cpp new file mode 100644 index 00000000..4c20af2e --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.cpp @@ -0,0 +1,794 @@ +/*++ + +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: + + ServiceBase.cpp + +Abstract: + + Provides a base class for a service that will exist as part of a service + application. CServiceBase must be derived from when creating a new service + class. + +Environment: + + User mode + +--*/ + +#pragma region Includes +#include "ServiceBase.h" +#include "Main.h" +#include "Utils.h" +#include +#include +#pragma endregion + + +#pragma region Static Members + +// +// Initialize the singleton service instance. +// +CServiceBase *CServiceBase::s_service = NULL; + + +/*++ + +Routine Description: + + Register the executable for a service with the Service Control + Manager (SCM). After you call Run(ServiceBase), the SCM issues a Start + command, which results in a call to the OnStart method in the service. + This method blocks until the service has stopped. + +Arguments: + + Service - The reference to a CServiceBase object. It will become the + singleton service instance of this service application. + +Return Value: + + If the function succeeds, the return value is TRUE. If the function + fails, the return value is FALSE. To get extended error information, + call GetLastError. + +--*/ +BOOL +CServiceBase::Run( + CServiceBase &Service + ) +{ + s_service = &Service; + + SERVICE_TABLE_ENTRY serviceTable[] = + { + { Service.m_name, ServiceMain }, + { NULL, NULL } + }; + + // + // Connects the main thread of a service process to the service control + // manager, which causes the thread to be the service control dispatcher + // thread for the calling process. This call returns when the service has + // stopped. The process should simply terminate when the call returns. + // + return StartServiceCtrlDispatcher(serviceTable); +} + + +/*++ + +Routine Description: + + The entry point for the service. It registers the handler function + for the service and starts the service. + +Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + +Return Value: + + VOID + +--*/ +VOID +WINAPI +CServiceBase::ServiceMain( + DWORD Argc, + PWSTR *Argv + ) +{ + assert(s_service != NULL); + + // + // Register the handler function for the service. + // + s_service->m_statusHandle = RegisterServiceCtrlHandler(s_service->m_name, + ServiceCtrlHandler); + + if (s_service->m_statusHandle == NULL) + { + throw GetLastError(); + } + + // + // Start the service. + // + s_service->Start(Argc, Argv); +} + + +/*++ + +Routine Description: + + Called by the SCM whenever a control code is sent to the service. + +Arguments: + + CtrlCode - The control code. This parameter can be one of + the following values: + + SERVICE_CONTROL_CONTINUE + SERVICE_CONTROL_INTERROGATE + SERVICE_CONTROL_NETBINDADD + SERVICE_CONTROL_NETBINDDISABLE + SERVICE_CONTROL_NETBINDREMOVE + SERVICE_CONTROL_PARAMCHANGE + SERVICE_CONTROL_PAUSE + SERVICE_CONTROL_SHUTDOWN + SERVICE_CONTROL_STOP + + This parameter can also be a user-defined control + code ranging from 128 to 255. + +Return Value: + + VOID + +--*/ +VOID +WINAPI +CServiceBase::ServiceCtrlHandler( + DWORD Ctrl + ) +{ + switch (Ctrl) + { + case SERVICE_CONTROL_STOP: + s_service->Stop(); + break; + case SERVICE_CONTROL_PAUSE: + s_service->Pause(); + break; + case SERVICE_CONTROL_CONTINUE: + s_service->Continue(); + break; + case SERVICE_CONTROL_SHUTDOWN: + s_service->Shutdown(); + break; + case SERVICE_CONTROL_INTERROGATE: + break; + default: + break; + } +} + +#pragma endregion + + +#pragma region Service Constructor and Destructor + +/*++ + +Routine Description: + + The constructor of CServiceBase. It initializes a new instance + of the CServiceBase class. The optional parameters (CanStop, + CanShutdown and CanPauseContinue) allow you to specify whether the + service can be stopped, paused and continued, or be notified when system + shutdown occurs. + +Arguments: + + ServiceName - The name of the service + + CanStop - The service can be stopped + + CanShutdown - The service is notified when system shutdown occurs + + CanPauseContinue - The service can be paused and continued + +Return Value: + + VOID + +--*/ +CServiceBase::CServiceBase( + PWSTR ServiceName, + BOOL CanStop, + BOOL CanShutdown, + BOOL CanPauseContinue + ) +{ + // + // Service name must be a valid string and cannot be NULL. + // + m_name = (ServiceName == NULL) ? L"" : ServiceName; + + m_statusHandle = NULL; + + // + // The service runs in its own process. + // + m_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + + // + // The service is starting. + // + m_status.dwCurrentState = SERVICE_START_PENDING; + + // + // The accepted commands of the service. + // + DWORD dwControlsAccepted = 0; + + if (CanStop) + { + dwControlsAccepted |= SERVICE_ACCEPT_STOP; + } + + if (CanShutdown) + { + dwControlsAccepted |= SERVICE_ACCEPT_SHUTDOWN; + } + + if (CanPauseContinue) + { + dwControlsAccepted |= SERVICE_ACCEPT_PAUSE_CONTINUE; + } + + m_status.dwControlsAccepted = dwControlsAccepted; + + m_status.dwWin32ExitCode = NO_ERROR; + m_status.dwServiceSpecificExitCode = 0; + m_status.dwCheckPoint = 0; + m_status.dwWaitHint = 0; + + SetupEvents(); +} + + +/*++ + +Routine Description: + + The virtual destructor of CServiceBase. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +CServiceBase::~CServiceBase() +{ + DestroyEvents(); +} + +#pragma endregion + + +#pragma region Service Start, Stop, Pause, Continue, and Shutdown + +/*++ + +Routine Description: + + This function starts the service. It calls the OnStart virtual function + in which you can specify the actions to take when the service starts. If + an error occurs during the startup, the error will be logged in the + Application event log, and the service will be stopped. + +Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::Start( + DWORD Argc, + PWSTR *Argv +) +{ + try + { + // + // Tell SCM that the service is starting. + // + SetServiceStatus(SERVICE_START_PENDING); + + // + // Perform service-specific initialization. + // + OnStart(Argc, Argv); + + // + // Tell SCM that the service is started. + // + SetServiceStatus(SERVICE_RUNNING); + } + catch (DWORD Error) + { + // + // Log the error. + // + WriteToErrorLog(L"Service Start", Error); + + // + // Set the service status to be stopped. + // + SetServiceStatus(SERVICE_STOPPED, Error); + } + catch (...) + { + // + // Log the error. + // + WriteToEventLog(L"Service failed to start.", EVENTLOG_ERROR_TYPE); + + // + // Set the service status to be stopped. + // + SetServiceStatus(SERVICE_STOPPED); + } +} + + +/*++ + +Routine Description: + + When implemented in a derived class, executes when a Start + command is sent to the service by the SCM or when the operating system + starts (for a service that starts automatically). Specifies actions to + take when the service starts. Be sure to periodically call + CServiceBase::SetServiceStatus() with SERVICE_START_PENDING if the + procedure is going to take long time. You may also consider spawning a + new thread in OnStart to perform time-consuming initialization tasks. + +Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::OnStart( + DWORD Argc, + PWSTR *Argv +) +{ + SetVariables(); +} + + +/*++ + +Routine Description: + + This function stops the service. It calls the OnStop virtual + function in which you can specify the actions to take when the service + stops. If an error occurs, the error will be logged in the Application + event log, and the service will be restored to the original state. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::Stop() +{ + DWORD OriginalState = m_status.dwCurrentState; + + try + { + // + // Tell SCM that the service is stopping. + // + SetServiceStatus(SERVICE_STOP_PENDING); + + // + // Perform service-specific stop operations. + // + OnStop(); + + // + // Tell SCM that the service is stopped. + // + SetServiceStatus(SERVICE_STOPPED); + } + catch (DWORD Error) + { + // + // Log the error. + // + WriteToErrorLog(L"Service Stop", Error); + + // + // Set the orginal service status. + // + SetServiceStatus(OriginalState); + } + catch (...) + { + // + // Log the error. + // + WriteToEventLog(L"Service failed to stop.", EVENTLOG_ERROR_TYPE); + + // + // Set the orginal service status. + // + SetServiceStatus(OriginalState); + } +} + + +/*++ + +Routine Description: + + When implemented in a derived class, executes when a Stop + command is sent to the service by the SCM. Specifies actions to take + when a service stops running. Be sure to periodically call + CServiceBase::SetServiceStatus() with SERVICE_STOP_PENDING if the + procedure is going to take long time. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::OnStop() +{ +} + + +/*++ + +Routine Description: + + The function pauses the service if the service supports pause + and continue. It calls the OnPause virtual function in which you can + specify the actions to take when the service pauses. If an error occurs, + the error will be logged in the Application event log, and the service + will become running. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::Pause() +{ + try + { + // + // Tell SCM that the service is pausing. + // + SetServiceStatus(SERVICE_PAUSE_PENDING); + + // + // Perform service-specific pause operations. + // + OnPause(); + + // + // Tell SCM that the service is paused. + // + SetServiceStatus(SERVICE_PAUSED); + } + catch (DWORD Error) + { + // + // Log the error. + // + WriteToErrorLog(L"Service Pause", Error); + + // + // Tell SCM that the service is still running. + // + SetServiceStatus(SERVICE_RUNNING); + } + catch (...) + { + // + // Log the error. + // + WriteToEventLog(L"Service failed to pause.", EVENTLOG_ERROR_TYPE); + + // + // Tell SCM that the service is still running. + // + SetServiceStatus(SERVICE_RUNNING); + } +} + + +/*++ + +Routine Description: + + When implemented in a derived class, executes when a Pause + command is sent to the service by the SCM. Specifies actions to take + when a service pauses. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::OnPause() +{ +} + + +/*++ + +Routine Description: + + The function resumes normal functioning after being paused if + the service supports pause and continue. It calls the OnContinue virtual + function in which you can specify the actions to take when the service + continues. If an error occurs, the error will be logged in the + Application event log, and the service will still be paused. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::Continue() +{ + try + { + // + // Tell SCM that the service is resuming. + // + SetServiceStatus(SERVICE_CONTINUE_PENDING); + + // + // Perform service-specific continue operations. + // + OnContinue(); + + // + // Tell SCM that the service is running. + // + SetServiceStatus(SERVICE_RUNNING); + } + catch (DWORD Error) + { + // + // Log the error. + // + WriteToErrorLog(L"Service Continue", Error); + + // + // Tell SCM that the service is still paused. + // + SetServiceStatus(SERVICE_PAUSED); + } + catch (...) + { + // + // Log the error. + // + WriteToEventLog(L"Service failed to resume.", EVENTLOG_ERROR_TYPE); + + // + // Tell SCM that the service is still paused. + // + SetServiceStatus(SERVICE_PAUSED); + } +} + + +/*++ + +Routine Description: + + When implemented in a derived class, OnContinue runs when a + Continue command is sent to the service by the SCM. Specifies actions to + take when a service resumes normal functioning after being paused. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::OnContinue() +{ +} + + +/*++ + +Routine Description: + + The function executes when the system is shutting down. It + calls the OnShutdown virtual function in which you can specify what + should occur immediately prior to the system shutting down. If an error + occurs, the error will be logged in the Application event log. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::Shutdown() +{ + try + { + // + // Perform service-specific shutdown operations. + // + OnShutdown(); + + // + // Tell SCM that the service is stopped. + // + SetServiceStatus(SERVICE_STOPPED); + } + catch (DWORD Error) + { + // + // Log the error. + // + WriteToErrorLog(L"Service Shutdown", Error); + } + catch (...) + { + // + // Log the error. + // + WriteToEventLog(L"Service failed to shut down.", EVENTLOG_ERROR_TYPE); + } +} + + +/*++ + +Routine Description: + + When implemented in a derived class, executes when the system + is shutting down. Specifies what should occur immediately prior to the + system shutting down. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::OnShutdown() +{ +} + +#pragma endregion + + +#pragma region Helper Functions + +/*++ + +Routine Description: + + The function sets the service status and reports the status to the SCM. + +Arguments: + + CurrentState - The current state of the service + + Win32ExitCode - The error code to report + + WaitHint - The estimated time for pending operation, in milliseconds + +Return Value: + + VOID + +--*/ +VOID +CServiceBase::SetServiceStatus( + DWORD CurrentState, + DWORD Win32ExitCode, + DWORD WaitHint + ) +{ + static DWORD CheckPoint = 1; + + // + // Fill in the SERVICE_STATUS structure of the service. + // + + m_status.dwCurrentState = CurrentState; + m_status.dwWin32ExitCode = Win32ExitCode; + m_status.dwWaitHint = WaitHint; + + m_status.dwCheckPoint = ((CurrentState == SERVICE_RUNNING) || + (CurrentState == SERVICE_STOPPED)) ? 0 : + CheckPoint++; + + // + // Report the status of the service to the SCM. + // + ::SetServiceStatus(m_statusHandle, &m_status); +} + +#pragma endregion \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.h new file mode 100644 index 00000000..106597e1 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.h @@ -0,0 +1,423 @@ +/*++ + +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: + + ServiceBase.cpp + +Abstract: + + Provides a base class for a service that will exist as part of a service + application. CServiceBase must be derived from when creating a new service + class. + +Environment: + + User mode + +--*/ + +#pragma once + +#include +#include "Utils.h" + +class CServiceBase +{ +public: + + /*++ + + Routine Description: + + Register the executable for a service with the Service Control + Manager (SCM). After you call Run(ServiceBase), the SCM issues a Start + command, which results in a call to the OnStart method in the service. + This method blocks until the service has stopped. + + Arguments: + + Service - The reference to a CServiceBase object. It will become the + singleton service instance of this service application. + + Return Value: + + If the function succeeds, the return value is TRUE. If the function + fails, the return value is FALSE. To get extended error information, + call GetLastError. + + --*/ + static BOOL Run(CServiceBase &service); + + + /*++ + + Routine Description: + + The constructor of CServiceBase. It initializes a new instance + of the CServiceBase class. The optional parameters (CanStop, + CanShutdown and CanPauseContinue) allow you to specify whether the + service can be stopped, paused and continued, or be notified when system + shutdown occurs. + + Arguments: + + ServiceName - The name of the service + + CanStop - The service can be stopped + + CanShutdown - The service is notified when system shutdown occurs + + CanPauseContinue - The service can be paused and continued + + Return Value: + + VOID + + --*/ + CServiceBase(PWSTR ServiceName, + BOOL CanStop = TRUE, + BOOL CanShutdown = TRUE, + BOOL CanPauseContinue = FALSE); + + + /*++ + + Routine Description: + + The virtual destructor of CServiceBase. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + virtual ~CServiceBase(); + + + /*++ + + Routine Description: + + This function stops the service. It calls the OnStop virtual + function in which you can specify the actions to take when the service + stops. If an error occurs, the error will be logged in the Application + event log, and the service will be restored to the original state. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + VOID Stop(); + +protected: + + /*++ + + Routine Description: + + When implemented in a derived class, executes when a Start + command is sent to the service by the SCM or when the operating system + starts (for a service that starts automatically). Specifies actions to + take when the service starts. Be sure to periodically call + CServiceBase::SetServiceStatus() with SERVICE_START_PENDING if the + procedure is going to take long time. You may also consider spawning a + new thread in OnStart to perform time-consuming initialization tasks. + + Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + + Return Value: + + VOID + + --*/ + virtual VOID OnStart(DWORD Argc, PWSTR *Argv); + + + /*++ + + Routine Description: + + When implemented in a derived class, executes when a Stop + command is sent to the service by the SCM. Specifies actions to take + when a service stops running. Be sure to periodically call + CServiceBase::SetServiceStatus() with SERVICE_STOP_PENDING if the + procedure is going to take long time. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + virtual VOID OnStop(); + + + /*++ + + Routine Description: + + When implemented in a derived class, executes when a Pause + command is sent to the service by the SCM. Specifies actions to take + when a service pauses. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + virtual VOID OnPause(); + + + /*++ + + Routine Description: + + When implemented in a derived class, OnContinue runs when a + Continue command is sent to the service by the SCM. Specifies actions to + take when a service resumes normal functioning after being paused. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + virtual VOID OnContinue(); + + + /*++ + + Routine Description: + + When implemented in a derived class, executes when the system + is shutting down. Specifies what should occur immediately prior to the + system shutting down. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + virtual VOID OnShutdown(); + + + /*++ + + Routine Description: + + The function sets the service status and reports the status to the SCM. + + Arguments: + + CurrentState - The current state of the service + + Win32ExitCode - The error code to report + + WaitHint - The estimated time for pending operation, in milliseconds + + Return Value: + + VOID + + --*/ + VOID SetServiceStatus(DWORD CurrentState, + DWORD Win32ExitCode = NO_ERROR, + DWORD WaitHint = 0); + +private: + + /*++ + + Routine Description: + + The entry point for the service. It registers the handler function + for the service and starts the service. + + Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + + Return Value: + + VOID + + --*/ + static VOID WINAPI ServiceMain(DWORD Argc, PWSTR *Argv); + + + /*++ + + Routine Description: + + Called by the SCM whenever a control code is sent to the service. + + Arguments: + + CtrlCode - The control code. This parameter can be one of + the following values: + + SERVICE_CONTROL_CONTINUE + SERVICE_CONTROL_INTERROGATE + SERVICE_CONTROL_NETBINDADD + SERVICE_CONTROL_NETBINDDISABLE + SERVICE_CONTROL_NETBINDREMOVE + SERVICE_CONTROL_PARAMCHANGE + SERVICE_CONTROL_PAUSE + SERVICE_CONTROL_SHUTDOWN + SERVICE_CONTROL_STOP + + This parameter can also be a user-defined control + code ranging from 128 to 255. + + Return Value: + + VOID + + --*/ + static VOID WINAPI ServiceCtrlHandler(DWORD Ctrl); + + + /*++ + + Routine Description: + + This function starts the service. It calls the OnStart virtual function + in which you can specify the actions to take when the service starts. If + an error occurs during the startup, the error will be logged in the + Application event log, and the service will be stopped. + + Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + + Return Value: + + VOID + + --*/ + VOID Start(DWORD Argc, PWSTR *Argv); + + + /*++ + + Routine Description: + + The function pauses the service if the service supports pause + and continue. It calls the OnPause virtual function in which you can + specify the actions to take when the service pauses. If an error occurs, + the error will be logged in the Application event log, and the service + will become running. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + VOID Pause(); + + + /*++ + + Routine Description: + + The function resumes normal functioning after being paused if + the service supports pause and continue. It calls the OnContinue virtual + function in which you can specify the actions to take when the service + continues. If an error occurs, the error will be logged in the + Application event log, and the service will still be paused. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + VOID Continue(); + + + /*++ + + Routine Description: + + The function executes when the system is shutting down. It + calls the OnShutdown virtual function in which you can specify what + should occur immediately prior to the system shutting down. If an error + occurs, the error will be logged in the Application event log. + + Arguments: + + VOID + + Return Value: + + VOID + + --*/ + VOID Shutdown(); + + + // + // The singleton service instance. + // + static CServiceBase *s_service; + + // + // The name of the service. + // + PWSTR m_name; + + // + // The status of the service. + // + SERVICE_STATUS m_status; + + // + // The service status handle. + // + SERVICE_STATUS_HANDLE m_statusHandle; +}; \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ThreadPool.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ThreadPool.h new file mode 100644 index 00000000..3d851537 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ThreadPool.h @@ -0,0 +1,80 @@ +/****************************** Module Header ******************************\ +* Module Name: ThreadPool.h +* Project: CppWindowsService +* Copyright (c) Microsoft Corporation. +* +* The class was designed by Kenny Kerr. It provides the ability to queue +* simple member functions of a class to the Windows thread pool. +* +* Using the thread pool is simple and feels natural in C++. +* +* class CSampleService +* { +* public: +* +* void AsyncRun() +* { +* CThreadPool::QueueUserWorkItem(&Service::Run, this); +* } +* +* void Run() +* { +* // Some lengthy operation +* } +* }; +* +* Kenny Kerr spends most of his time designing and building distributed +* applications for the Microsoft Windows platform. He also has a particular +* passion for C++ and security programming. Reach Kenny at +* http://weblogs.asp.net/kennykerr/ or visit his Web site: +* http://www.kennyandkarin.com/Kenny/. +* +* This source is subject to the Microsoft Public License. +* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL. +* All other 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. +\***************************************************************************/ + +#pragma once + +#include + + +class CThreadPool +{ +public: + + template + static void QueueUserWorkItem(void (T::*function)(void), + T *object, ULONG flags = WT_EXECUTELONGFUNCTION) + { + typedef std::pair CallbackType; + std::auto_ptr p(new CallbackType(function, object)); + + if (::QueueUserWorkItem(ThreadProc, p.get(), flags)) + { + // The ThreadProc now has the responsibility of deleting the pair. + p.release(); + } + else + { + throw GetLastError(); + } + } + +private: + + template + static DWORD WINAPI ThreadProc(PVOID context) + { + typedef std::pair CallbackType; + + std::auto_ptr p(static_cast(context)); + + (p->second->*p->first)(); + return 0; + } +}; \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.cpp new file mode 100644 index 00000000..e8fc87ee --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.cpp @@ -0,0 +1,156 @@ +/*++ + +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: + + Utils.cpp + +Abstract: + + Provides utility function to SampleApp.cpp. + +Environment: + + User mode + +--*/ + +#include "Utils.h" + +// +// Service trace event provider +// {54a25c42-cd91-4210-98cc-c3447b56e447} +// +EXTERN_C __declspec(selectany) const GUID SERVICE_PROVIDER_GUID = { 0x54a25c42, 0xcd91, 0x4210,{ 0x98, 0xcc, 0xc3, 0x44, 0x7b, 0x56, 0xe4, 0x47 } }; + +REGHANDLE m_etwRegHandle; + + +/*++ + +Routine Description: + + Sets up logging. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +SetupEvents() +{ + NTSTATUS status = EventRegister(&SERVICE_PROVIDER_GUID, + nullptr, + nullptr, + &m_etwRegHandle); + + if (status != ERROR_SUCCESS) + { + wprintf(L"Provider not registered. EventRegister failed with error: 0x%08X\n", status); + } +} + + +/*++ + +Routine Description: + + Destroys logging. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID +DestroyEvents() +{ + if (m_etwRegHandle != NULL) + { + EventUnregister(m_etwRegHandle); + } +} + + +/*++ + +Routine Description: + + Log a message. + +Arguments: + + Message - The string message to be logged + + Level - The type of event to be logged. This parameter can + be one of the following values: + + TRACE_LEVEL_CRITICAL + TRACE_LEVEL_ERROR + TRACE_LEVEL_WARNING + TRACE_LEVEL_INFORMATION + TRACE_LEVEL_VERBOSE + +Return Value: + + VOID + +--*/ +VOID +WriteToEventLog( + PWSTR Message, + BYTE Level + ) +{ + if (m_etwRegHandle != NULL) + { + EventWriteString(m_etwRegHandle, Level, 0, Message); + } +} + + +/*++ + +Routine Description: + + Log an error message. + +Arguments: + + Function - The function that gives the error + + Error - The error code + +Return Value: + + VOID + +--*/ +VOID +WriteToErrorLog( + PWSTR Function, + DWORD Error + ) +{ + WCHAR Message[260]; + + StringCchPrintf(Message, ARRAYSIZE(Message), + L"%ws failed with error: 0x%08x", Function, Error); + + WriteToEventLog(Message, TRACE_LEVEL_ERROR); +} \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.h new file mode 100644 index 00000000..b619f461 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.h @@ -0,0 +1,111 @@ +/*++ + +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: + + Utils.cpp + +Abstract: + + Provides utility function to SampleApp.cpp. + +Environment: + + User mode + +--*/ + +#pragma once + +#include +#include +#include +#include + +/*++ + +Routine Description: + + Sets up logging. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID SetupEvents(); + + +/*++ + +Routine Description: + + Destroys logging. + +Arguments: + + VOID + +Return Value: + + VOID + +--*/ +VOID DestroyEvents(); + + +/*++ + +Routine Description: + + Log a message. + +Arguments: + + Message - The string message to be logged + + Level - The type of event to be logged. This parameter can + be one of the following values: + + TRACE_LEVEL_CRITICAL + TRACE_LEVEL_ERROR + TRACE_LEVEL_WARNING + TRACE_LEVEL_INFORMATION + TRACE_LEVEL_VERBOSE + +Return Value: + + VOID + +--*/ +VOID WriteToEventLog(PWSTR Message, BYTE Level); + + +/*++ + +Routine Description: + + Log an error message. + +Arguments: + + Function - The function that gives the error + + Error - The error code + +Return Value: + + VOID + +--*/ +VOID WriteToErrorLog(PWSTR Function, DWORD Error); \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters new file mode 100644 index 00000000..7f12a302 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters @@ -0,0 +1,54 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx new file mode 100644 index 00000000..61e1e958 Binary files /dev/null and b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx differ diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj new file mode 100644 index 00000000..8547d303 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj @@ -0,0 +1,206 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} + osrfx2_DCHU_usersvc + Win32Proj + osrfx2_DCHU_usersvc + 10.0.15063.0 + + + + Application + Unicode + true + v140 + + + Application + Unicode + v140 + + + Application + Unicode + false + v140 + + + Application + Unicode + v140 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Full + WIN32;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreaded + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + onecoreuap.lib;%(AdditionalDependencies); + + + + + Full + true + WIN32;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + onecoreuap.lib;%(AdditionalDependencies); + + + + + X64 + + + Full + WIN32;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreaded + + + Level3 + ProgramDatabase + + + true + Console + MachineX64 + onecoreuap.lib;%(AdditionalDependencies); + + + + + + + + + X64 + + + Full + true + WIN32;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX64 + onecoreuap.lib;%(AdditionalDependencies); + + + + + + + + + + + + + + + + + + + true + + + + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component.sln b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component.sln deleted file mode 100644 index e09b5650..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component.sln +++ /dev/null @@ -1,73 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_component", "osrfx2_DCHU_component", "{E498C537-BA1A-4E9D-8F1E-9DC7646D2E1A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_componentsoftware", "osrfx2_DCHU_componentsoftware", "{E50E958C-B5D0-43E0-9D81-87F484F11E9F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_component", "osrfx2_DCHU_component\osrfx2_DCHU_component.vcxproj", "{F90EFA96-B075-4531-B4E1-F406362D16BF}" - ProjectSection(ProjectDependencies) = postProject - {26D91630-B8FF-4102-A258-32F7D1C84E20} = {26D91630-B8FF-4102-A258-32F7D1C84E20} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_componentsoftware", "osrfx2_DCHU_componentsoftware\osrfx2_DCHU_componentsoftware.vcxproj", "{26D91630-B8FF-4102-A258-32F7D1C84E20}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|ARM64 = Debug|ARM64 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|ARM64 = Release|ARM64 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM.ActiveCfg = Debug|ARM - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM.Build.0 = Debug|ARM - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM.Deploy.0 = Debug|ARM - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM64.Build.0 = Debug|ARM64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x64.ActiveCfg = Debug|x64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x64.Build.0 = Debug|x64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x64.Deploy.0 = Debug|x64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x86.ActiveCfg = Debug|Win32 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x86.Build.0 = Debug|Win32 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x86.Deploy.0 = Debug|Win32 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM.ActiveCfg = Release|ARM - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM.Build.0 = Release|ARM - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM.Deploy.0 = Release|ARM - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM64.ActiveCfg = Release|ARM64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM64.Build.0 = Release|ARM64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM64.Deploy.0 = Release|ARM64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x64.ActiveCfg = Release|x64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x64.Build.0 = Release|x64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x64.Deploy.0 = Release|x64 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x86.ActiveCfg = Release|Win32 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x86.Build.0 = Release|Win32 - {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x86.Deploy.0 = Release|Win32 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|ARM.ActiveCfg = Debug|Win32 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|ARM64.ActiveCfg = Debug|Win32 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x64.ActiveCfg = Debug|x64 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x64.Build.0 = Debug|x64 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x86.ActiveCfg = Debug|Win32 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x86.Build.0 = Debug|Win32 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|ARM.ActiveCfg = Release|Win32 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|ARM64.ActiveCfg = Release|Win32 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x64.ActiveCfg = Release|x64 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x64.Build.0 = Release|x64 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x86.ActiveCfg = Release|Win32 - {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {F90EFA96-B075-4531-B4E1-F406362D16BF} = {E498C537-BA1A-4E9D-8F1E-9DC7646D2E1A} - {26D91630-B8FF-4102-A258-32F7D1C84E20} = {E50E958C-B5D0-43E0-9D81-87F484F11E9F} - EndGlobalSection -EndGlobal diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.filters b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.filters deleted file mode 100644 index fa953f4c..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.filters +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {8E41214B-6785-4CFE-B992-037D68949A14} - inf;inv;inx;mof;mc; - - - - - Driver Files - - - \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.inx deleted file mode 100644 index 8baab1a0..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.inx +++ /dev/null @@ -1,64 +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: -; -; osrfx2_DCHU_component.INF -; -;Abstract: -; -; Installation inf for one of the OSR FX2 Learning Kit's -; AddComponent directives -; -;--*/ - -[Version] -Signature = "$Windows NT$" -Class = SoftwareComponent -ClassGuid = {5c4c3332-344d-483c-8739-259e934c9cc8} -Provider = %ManufacturerName% -CatalogFile = osrfx2_DCHU_component.cat - -[Manufacturer] -%ManufacturerName% = OsrFx2Component, NT$ARCH$ - -[OsrFx2Component.NT$ARCH$] -%DeviceName% = OsrFx2Component_Install, SWC\VID_045e&PID_94ab - -[SourceDisksFiles] -osrfx2_DCHU_componentsoftware.exe = 1 - -[SourceDisksNames] -1 = %DiskName% - -[DestinationDirs] -OsrFx2Component_CopyFiles = 13 ; copy to driverstore - -[OsrFx2Component_Install.NT] -CopyFiles = OsrFx2Component_CopyFiles - -[OsrFx2Component_Install.NT.Services] -AddService = , 0x00000002 - -[OsrFx2Component_Install.NT.Software] -AddSoftware = osrfx2_DCHU_componentsoftware,, OsrFx2Component_SoftwareInstall - -[OsrFx2Component_SoftwareInstall] -SoftwareType = 1 -SoftwareBinary = osrfx2_DCHU_componentsoftware.exe -SoftwareArguments = <> -SoftwareVersion = 1.0.0.0 - -[OsrFx2Component_CopyFiles] -osrfx2_DCHU_componentsoftware.exe - -[Strings] -ManufacturerName = "Contoso" -DiskName = "OsrFx2 DCHU Component Installation Disk" -DeviceName = "OsrFx2 DCHU Component Device" \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj deleted file mode 100644 index fed7ddf4..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj +++ /dev/null @@ -1,272 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - Debug - ARM - - - Release - ARM - - - Debug - ARM64 - - - Release - ARM64 - - - - - - - - - - - - - - - - - - - - - - - - - {F90EFA96-B075-4531-B4E1-F406362D16BF} - {4605da2c-74a5-4865-98e1-152ef136825f} - v4.5 - 12.0 - Debug - Win32 - osrfx2_DCHU_component - osrfx2_DCHU_component - - - - Windows10 - true - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - false - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - true - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - false - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - true - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - false - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - true - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - false - WindowsKernelModeDriver10.0 - Utility - Package - true - - - - - - - - - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - - 1.0.0.0 - - - - - 1.0.0.0 - - - - - 1.0.0.0 - - - - - 1.0.0.0 - - - - - 1.0.0.0 - - - - - 1.0.0.0 - - - - - 1.0.0.0 - - - - - 1.0.0.0 - - - - - - \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp deleted file mode 100644 index c14e66d1..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp +++ /dev/null @@ -1,489 +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: - - osrfx2_DCHU_componentsoftware.cpp - -Abstract: - - An example .exe to run using the AddSoftware directive within an INF. - Contains an example on how to obtain a handle to the primary device using - SoftwareArguments within an AddSoftware directive's section. - -Environment: - - User mode - ---*/ - -#include "stdafx.h" - -#define BUFFER_SIZE (128 * sizeof(WCHAR)) -#define DEVICE_REG_SUBKEY L"OSR" -#define DEVICE_VALUE_OP_MODE L"OperatingMode" -#define DEVICE_VALUE_OP_PARAMS L"OperatingParams" -#define DEVICE_VALUE_OP_EXCEPTIONS L"OperatingExceptions" -#define CONTOSO_FILEPATH L"C:\\Program Files\\Contoso" -#define OSRFX2_DCHU_FILEPATH L"C:\\Program Files\\Contoso\\OsrFx2_DCHU" -#define FILEPATH L"C:\\Program Files\\Contoso\\OsrFx2_DCHU\\AddSoftwareInstallationFile.txt" -#define FILE_CONTENT L"Operating Mode: %ws\r\nOperating Params: %ws\r\nOperating Exceptions: %ws" - - -/*++ - -Routine Description: - -Arguments: - -Return Value: - - ---*/ -DWORD -WriteToFile( - _In_ PWSTR MessageText, - _In_ DWORD MessageTextLength - ) -{ - DWORD Err = ERROR_SUCCESS; - BOOL ErrorFlag = FALSE; - HANDLE hFile = INVALID_HANDLE_VALUE; - DWORD BytesToWrite; - DWORD BytesWritten; - - if (!CreateDirectory(CONTOSO_FILEPATH, NULL)) - { - Err = GetLastError(); - - if (Err == ERROR_ALREADY_EXISTS) - { - Err = ERROR_SUCCESS; - } - else - { - goto cleanup; - } - } - - if (!CreateDirectory(OSRFX2_DCHU_FILEPATH, NULL)) - { - Err = GetLastError(); - - if (Err == ERROR_ALREADY_EXISTS) - { - Err = ERROR_SUCCESS; - } - else - { - goto cleanup; - } - } - - hFile = CreateFile(FILEPATH, - GENERIC_WRITE, - 0, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (hFile == INVALID_HANDLE_VALUE) - { - Err = ERROR_INVALID_PARAMETER; - goto cleanup; - } - - BytesToWrite = MessageTextLength * sizeof(WCHAR); - - ErrorFlag = WriteFile(hFile, - MessageText, - BytesToWrite, - &BytesWritten, - NULL); - - if ((!ErrorFlag) || - (BytesToWrite != BytesWritten)) - { - Err = GetLastError(); - goto cleanup; - } - -cleanup: - - if (hFile != INVALID_HANDLE_VALUE) - { - CloseHandle(hFile); - } - - return Err; -} - - -/*++ - -Routine Description: - - Obtains the handle to the device that used a separate Software Component - INF to install software. - -Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - -Return Value: - - VOID - ---*/ -VOID -__cdecl -_tmain( - INT Argc, - TCHAR *Argv[]) -{ - DWORD Err = ERROR_SUCCESS; - HRESULT hr = S_OK; - BOOL ErrorFlag = FALSE; - DWORD BytesToWrite = 0; - DWORD BytesWritten = 0; - PTSTR DeviceInstanceId; - HDEVINFO DevInfoList = INVALID_HANDLE_VALUE; - SP_DEVINFO_DATA DevInfoData; - WCHAR ParentDeviceInstanceId[MAX_DEVICE_ID_LEN]; - DWORD RequiredSize; - DEVPROPTYPE DevPropType; - SP_DEVINFO_DATA ParentDevInfoData; - HKEY DevRegKey = NULL; - PWSTR OperatingMode = NULL; - PWSTR OperatingParams = NULL; - PWSTR OperatingExceptions = NULL; - DWORD ValueType; - DWORD ValueSize = BUFFER_SIZE; - HKEY DevOsrRegKey = NULL; - PWSTR FileText = NULL; - DWORD FileTextLength; - - // - // Validate arguments. - // - if (Argc != 2) - { - Err = ERROR_INVALID_PARAMETER; - goto cleanup; - } - - OperatingMode = (PWSTR)malloc(BUFFER_SIZE * sizeof(WCHAR)); - - if (OperatingMode == NULL) - { - Err = ERROR_OUTOFMEMORY; - goto cleanup; - } - - OperatingParams = (PWSTR)malloc(BUFFER_SIZE * sizeof(WCHAR)); - - if (OperatingParams == NULL) - { - Err = ERROR_OUTOFMEMORY; - goto cleanup; - } - - OperatingExceptions = (PWSTR)malloc(BUFFER_SIZE * sizeof(WCHAR)); - - if (OperatingExceptions == NULL) - { - Err = ERROR_OUTOFMEMORY; - goto cleanup; - } - - // - // Argv[1] should be the device instance ID. - // - DeviceInstanceId = Argv[1]; - - // - // Create a device info list to store queried device handles. - // - DevInfoList = SetupDiCreateDeviceInfoList(NULL, NULL); - - if (DevInfoList == INVALID_HANDLE_VALUE) - { - Err = ERROR_OUTOFMEMORY; - goto cleanup; - } - - DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); - - // - // Add the Software Component device that called AddSoftware to the - // device info list, which will be used to find the primary device that - // called AddComponent in the first place. - // - if (!SetupDiOpenDeviceInfo(DevInfoList, - DeviceInstanceId, - NULL, - 0, - &DevInfoData)) - { - Err = GetLastError(); - goto cleanup; - } - - // - // Get the device instance id of the opened device's parent. - // - if (!SetupDiGetDeviceProperty(DevInfoList, - &DevInfoData, - &DEVPKEY_Device_Parent, - &DevPropType, - (PBYTE)ParentDeviceInstanceId, - sizeof(ParentDeviceInstanceId), - &RequiredSize, - 0)) - { - Err = GetLastError(); - goto cleanup; - } - - if ((DevPropType != DEVPROP_TYPE_STRING) || - (RequiredSize < sizeof(WCHAR))) - { - Err = ERROR_INVALID_PARAMETER; - goto cleanup; - } - - ParentDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); - - // - // Get the parent of the device we retrieved first, which is the device - // that called AddComponent in its INF. - // - if (!SetupDiOpenDeviceInfoW(DevInfoList, - ParentDeviceInstanceId, - NULL, - 0, - &ParentDevInfoData)) - { - Err = GetLastError(); - goto cleanup; - } - - // - // Open up the HW registry keys of the primary device. - // - DevRegKey = SetupDiOpenDevRegKey(DevInfoList, - &ParentDevInfoData, - DICS_FLAG_GLOBAL, - 0, - DIREG_DEV, - KEY_READ); - - if (DevRegKey == INVALID_HANDLE_VALUE) - { - Err = GetLastError(); - DevRegKey = NULL; - goto cleanup; - } - - Err = RegOpenKeyEx(DevRegKey, - DEVICE_REG_SUBKEY, - 0, - KEY_QUERY_VALUE, - &DevOsrRegKey); - - if (Err != ERROR_SUCCESS) - { - goto cleanup; - } - - // - // Retrieve the registry values defined in the primary device's INF. - // Note that if the extension INF was applied, the extension INF would - // overwrite OperatingParams and create OperatingExceptions. - // - Err = RegQueryValueEx(DevOsrRegKey, - DEVICE_VALUE_OP_MODE, - NULL, - &ValueType, - (LPBYTE)OperatingMode, - &ValueSize); - - while (Err == ERROR_MORE_DATA) - { - // - // Create a larger buffer. - // - OperatingMode = (PTSTR)realloc(OperatingMode, ValueSize); - - Err = RegQueryValueEx(DevOsrRegKey, - DEVICE_VALUE_OP_MODE, - NULL, - &ValueType, - (LPBYTE)OperatingMode, - &ValueSize); - } - - if (Err != ERROR_SUCCESS) - { - OperatingMode[0] = TEXT('\0'); - } - else if ((ValueType != REG_SZ) || - (ValueSize < sizeof(TCHAR))) - { - Err = ERROR_REGISTRY_CORRUPT; - OperatingMode[0] = TEXT('\0'); - } - - ValueSize = BUFFER_SIZE; - - Err = RegQueryValueEx(DevOsrRegKey, - DEVICE_VALUE_OP_PARAMS, - NULL, - &ValueType, - (LPBYTE)OperatingParams, - &ValueSize); - - while (Err == ERROR_MORE_DATA) - { - // - // Create a larger buffer. - // - OperatingParams = (PTSTR)realloc(OperatingParams, ValueSize); - - Err = RegQueryValueEx(DevOsrRegKey, - DEVICE_VALUE_OP_MODE, - NULL, - &ValueType, - (LPBYTE)OperatingParams, - &ValueSize); - } - - if (Err != ERROR_SUCCESS) - { - OperatingParams[0] = TEXT('\0'); - } - else if ((ValueType != REG_SZ) || - (ValueSize < sizeof(TCHAR))) - { - Err = ERROR_REGISTRY_CORRUPT; - OperatingParams[0] = TEXT('\0'); - } - - ValueSize = BUFFER_SIZE; - - Err = RegQueryValueEx(DevOsrRegKey, - DEVICE_VALUE_OP_EXCEPTIONS, - NULL, - &ValueType, - (LPBYTE)OperatingExceptions, - &ValueSize); - - while (Err == ERROR_MORE_DATA) - { - // - // Create a larger buffer. - // - OperatingExceptions = (PTSTR)realloc(OperatingExceptions, ValueSize); - - Err = RegQueryValueEx(DevOsrRegKey, - DEVICE_VALUE_OP_EXCEPTIONS, - NULL, - &ValueType, - (LPBYTE)OperatingExceptions, - &ValueSize); - } - - if (Err != ERROR_SUCCESS) - { - OperatingExceptions[0] = TEXT('\0'); - } - else if ((ValueType != REG_SZ) || - (ValueSize < sizeof(TCHAR))) - { - Err = ERROR_REGISTRY_CORRUPT; - OperatingExceptions[0] = TEXT('\0'); - } - - FileTextLength = (DWORD)wcslen(OperatingMode) + - (DWORD)wcslen(OperatingParams) + - (DWORD)wcslen(OperatingExceptions) + - (DWORD)wcslen(FILE_CONTENT) - - 9; // Subtract the 3 %ws - - FileText = (PWSTR)malloc((FileTextLength + 1) * sizeof(WCHAR)); - - if (FileText == NULL) - { - Err = ERROR_OUTOFMEMORY; - goto cleanup; - } - - hr = StringCchPrintf(FileText, - FileTextLength + 1, - FILE_CONTENT, - OperatingMode, - OperatingParams, - OperatingExceptions); - - if (FAILED(hr)) - { - Err = HRESULT_CODE(hr); - goto cleanup; - } - - Err = WriteToFile(FileText, FileTextLength); - - if (Err != ERROR_SUCCESS) - { - goto cleanup; - } - -cleanup: - - if (FileText != NULL) - { - free(FileText); - } - - if (OperatingExceptions != NULL) - { - free(OperatingExceptions); - } - - if (OperatingParams != NULL) - { - free(OperatingParams); - } - - if (OperatingMode != NULL) - { - free(OperatingMode); - } - - if (DevOsrRegKey != NULL) - { - RegCloseKey(DevOsrRegKey); - } - - if (DevRegKey != NULL) - { - RegCloseKey(DevRegKey); - } - - if (DevInfoList != INVALID_HANDLE_VALUE) - { - SetupDiDestroyDeviceInfoList(DevInfoList); - } - - return; -} - diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters deleted file mode 100644 index 395438fa..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters +++ /dev/null @@ -1,33 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - Header Files - - - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj deleted file mode 100644 index 2bb8b05d..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj +++ /dev/null @@ -1,169 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {26D91630-B8FF-4102-A258-32F7D1C84E20} - Win32Proj - osrfx2_DCHU_componentsoftware - 10.0.15063.0 - osrfx2_DCHU_componentsoftware - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - true - $(ProjectName) - - - false - - - false - $(ProjectName) - .exe - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - - - Console - true - onecoreuap.lib;setupapi.lib; - - - - - Use - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - - - Console - true - onecoreuap.lib;setupapi.lib; - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - true - onecoreuap.lib;setupapi.lib; - - - - - Level3 - Use - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - - - Console - true - true - true - onecoreuap.lib;setupapi.lib; - - - - - - - - - - - - Create - Create - Create - Create - - - - - - \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.cpp b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.cpp deleted file mode 100644 index 79325e21..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// osrusbfx2umsoftware.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.h b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.h deleted file mode 100644 index edb61924..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.h +++ /dev/null @@ -1,18 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// TODO: reference additional headers your program requires here diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/targetver.h b/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/targetver.h deleted file mode 100644 index 87c0086d..00000000 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension.sln b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension.sln deleted file mode 100644 index 386ba436..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension.sln +++ /dev/null @@ -1,73 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DHCU_extension", "osrfx2_DHCU_extension", "{4577857A-CCAE-42EB-BDE2-16C1E3DC7B14}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_usersvc", "osrfx2_DCHU_usersvc", "{D10B02D6-7E48-4F78-8AAE-20C93E77FA52}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_extension", "osrfx2_DCHU_extension\osrfx2_DCHU_extension.vcxproj", "{0588DF70-3923-42E6-8DC9-13C2C0186F20}" - ProjectSection(ProjectDependencies) = postProject - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} = {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_usersvc", "osrfx2_DCHU_usersvc\osrfx2_DCHU_usersvc.vcxproj", "{DE70E2D1-6A4D-4984-BD82-CE750889F0D3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|ARM64 = Debug|ARM64 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|ARM64 = Release|ARM64 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM.ActiveCfg = Debug|ARM - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM.Build.0 = Debug|ARM - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM.Deploy.0 = Debug|ARM - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM64.Build.0 = Debug|ARM64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x64.ActiveCfg = Debug|x64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x64.Build.0 = Debug|x64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x64.Deploy.0 = Debug|x64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x86.ActiveCfg = Debug|Win32 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x86.Build.0 = Debug|Win32 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x86.Deploy.0 = Debug|Win32 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM.ActiveCfg = Release|ARM - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM.Build.0 = Release|ARM - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM.Deploy.0 = Release|ARM - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM64.ActiveCfg = Release|ARM64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM64.Build.0 = Release|ARM64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM64.Deploy.0 = Release|ARM64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x64.ActiveCfg = Release|x64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x64.Build.0 = Release|x64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x64.Deploy.0 = Release|x64 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x86.ActiveCfg = Release|Win32 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x86.Build.0 = Release|Win32 - {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x86.Deploy.0 = Release|Win32 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|ARM.ActiveCfg = Debug|Win32 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|ARM64.ActiveCfg = Debug|Win32 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|x64.ActiveCfg = Debug|x64 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|x64.Build.0 = Debug|x64 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|x86.ActiveCfg = Debug|Win32 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Debug|x86.Build.0 = Debug|Win32 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|ARM.ActiveCfg = Release|Win32 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|ARM64.ActiveCfg = Release|Win32 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|x64.ActiveCfg = Release|x64 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|x64.Build.0 = Release|x64 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|x86.ActiveCfg = Release|Win32 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {0588DF70-3923-42E6-8DC9-13C2C0186F20} = {4577857A-CCAE-42EB-BDE2-16C1E3DC7B14} - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} = {D10B02D6-7E48-4F78-8AAE-20C93E77FA52} - EndGlobalSection -EndGlobal diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters deleted file mode 100644 index 0ba1a59c..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {8E41214B-6785-4CFE-B992-037D68949A14} - inf;inv;inx;mof;mc; - - - - - Driver Files - - - \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx deleted file mode 100644 index d90c39f7..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx +++ /dev/null @@ -1,79 +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: -; -; osrfx2_DCHU_extension.INF -; -;Abstract: -; -; Extension inf for the OSR FX2 Learning Kit -; -;--*/ - -[Version] -Signature = "$WINDOWS NT$" -Class = Extension -ClassGuid = {e2f84ce7-8efa-411c-aa69-97454ca4cb57} -Provider = %ManufacturerName% -ExtensionId = {3846ad8c-dd27-433d-ab89-453654cd542a} -CatalogFile = osrfx2_DCHU_extension.cat -DriverVer = 05/16/2017,15.14.36.721 - -[Manufacturer] -%ManufacturerName% = OsrFx2Extension, NT$ARCH$ - -[OsrFx2Extension.NT$ARCH$] -%OsrFx2.ExtensionDesc% = OsrFx2Extension_Install, USB\Vid_045e&Pid_94aa&mi_00 -%OsrFx2.ExtensionDesc% = OsrFx2Extension_Install, USB\Vid_0547&PID_1002 - -[OsrFx2Extension_Install.NT] -CopyInf=osrfx2_DCHU_usersvc.inf - -[OsrFx2Extension_Install.NT.HW] -AddReg = OsrFx2Extension_AddReg -AddReg = OsrFx2Extension_COMAddReg - -[OsrFx2Extension_AddReg] -HKR, OSR, "OperatingParams",, "-Extended" -HKR, OSR, "OperatingExceptions",, "x86" - -; Add all registry keys to successfully register the -; In-Process ATL COM Server MSFT Sample. -[OsrFx2Extension_COMAddReg] -HKCR,AppID\ATLDllCOMServer.DLL,AppID,,"{9DD18FED-55F6-4741-AF25-798B90C4AED5}" -HKCR,AppID\{9DD18FED-55F6-4741-AF25-798B90C4AED5},,,"ATLDllCOMServer" -HKCR,ATLDllCOMServer.SimpleObject,,,"SimpleObject Class" -HKCR,ATLDllCOMServer.SimpleObject\CLSID,,,"{92FCF37F-F6C7-4F8A-AA09-1A14BA118084}" -HKCR,ATLDllCOMServer.SimpleObject\CurVer,,,"ATLDllCOMServer.SimpleObject.1" -HKCR,ATLDllCOMServer.SimpleObject.1,,,"SimpleObject Class" -HKCR,ATLDllCOMServer.SimpleObject.1\CLSID,,,"{92FCF37F-F6C7-4F8A-AA09-1A14BA118084}" -HKCR,CLSID\{92FCF37F-F6C7-4F8A-AA09-1A14BA118084},,,"SimpleObject Class" -HKCR,CLSID\{92FCF37F-F6C7-4F8A-AA09-1A14BA118084}\InprocServer32,,%REG_EXPAND_SZ%,"%%SystemRoot%%\System32\ATLDllCOMServer.dll" -HKCR,CLSID\{92FCF37F-F6C7-4F8A-AA09-1A14BA118084}\InprocServer32,ThreadingModel,,"Apartment" -HKCR,CLSID\{92FCF37F-F6C7-4F8A-AA09-1A14BA118084}\ProgID,,,"ATLDllCOMServer.SimpleObject.1" -HKCR,CLSID\{92FCF37F-F6C7-4F8A-AA09-1A14BA118084}\Programmable,,%FLG_ADDREG_KEYONLY% -HKCR,CLSID\{92FCF37F-F6C7-4F8A-AA09-1A14BA118084}\TypeLib,,,"{9B23EFED-A0C1-46B6-A903-218206447F3E}" -HKCR,CLSID\{92FCF37F-F6C7-4F8A-AA09-1A14BA118084}\VersionIndependentProgID,,,"ATLDllCOMServer.SimpleObject" - -[OsrFx2Extension_Install.NT.Components] -AddComponent = osrfx2_DCHU_component,,OsrFx2Extension_ComponentInstall -AddComponent = osrfx2_DCHU_usersvc,,OsrFx2Extension_ComponentInstall_UserSvc - -[OsrFx2Extension_ComponentInstall] -ComponentIds=VID_045e&PID_94ab - -[OsrFx2Extension_ComponentInstall_UserSvc] -ComponentIds=VID_045e&PID_94ac - -[Strings] -ManufacturerName = "Contoso" -OsrFx2.ExtensionDesc = "OsrFx2 DCHU Device Extension" -REG_EXPAND_SZ = 0x00020000 -FLG_ADDREG_KEYONLY = 0x00000010 \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj deleted file mode 100644 index 232cfa89..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj +++ /dev/null @@ -1,281 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - Debug - ARM - - - Release - ARM - - - Debug - ARM64 - - - Release - ARM64 - - - - - - - - - - - - - - - - - - - - - - - - - - {0588DF70-3923-42E6-8DC9-13C2C0186F20} - {4605da2c-74a5-4865-98e1-152ef136825f} - v4.6.1 - 12.0 - Debug - Win32 - osrfx2_DCHU_extension - osrfx2_DCHU_extension - - - - Windows10 - true - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - false - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - true - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - false - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - true - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - false - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - true - WindowsKernelModeDriver10.0 - Utility - Package - true - - - Windows10 - false - WindowsKernelModeDriver10.0 - Utility - Package - true - - - - - - - - - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - DbgengRemoteDebugger - - - - False - False - True - - 133563 - - - - $(InfArch) - 1.0.0.0 - - - - - $(InfArch) - 1.0.0.0 - - - - - $(InfArch) - 1.0.0.0 - - - - - $(InfArch) - 1.0.0.0 - - - - - $(InfArch) - 1.0.0.0 - - - - - $(InfArch) - 1.0.0.0 - - - - - $(InfArch) - 1.0.0.0 - - - - - $(InfArch) - 1.0.0.0 - - - - - - \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/CppWindowsService.cpp b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/CppWindowsService.cpp deleted file mode 100644 index 98a3975c..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/CppWindowsService.cpp +++ /dev/null @@ -1,74 +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: - - CppWindowsService.cpp - -Abstract: - - The file defines the entry point of the application. According to the - arguments in the command line, the function installs or uninstalls or - starts the service by calling into different routines. - -Environment: - - User mode - ---*/ - -#pragma region Includes -#include -#include -#include "ServiceBase.h" -#include "SampleService.h" -#pragma endregion - -// -// Settings of the service -// - -// -// Internal name of the service -// -#define SERVICE_NAME L"OsrUsbFx2UmUserSvc" - - -/*++ - -Routine Description: - - Entry point for the service. - -Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - -Return Value: - - VOID - ---*/ -INT -wmain( - INT Argc, - WCHAR *Argv[] - ) -{ - CSampleService service(SERVICE_NAME); - - if (!CServiceBase::Run(service)) - { - wprintf(L"Service failed to run w/err 0x%08lx\n", GetLastError()); - } - - return 0; -} \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Main.cpp b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Main.cpp deleted file mode 100644 index 157a6cb9..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Main.cpp +++ /dev/null @@ -1,320 +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: - - Main.cpp - -Abstract: - - Implements the functions to control the OSR USB FX2 device. - -Environment: - - User mode - ---*/ - -#include "Main.h" -#include "Utils.h" - -INT CurrentBar; -BAR_GRAPH_STATE BarGraphState; - -/*++ - -Routine Description: - - Sets the variables in this service to their default values. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -SetVariables() -{ - CurrentBar = 0; -} - - -/*++ - -Routine Description: - - Retrieves the device path of a given interface. - -Arguments: - - InterfaceGuid - The GUID of the interface to search for - - DevicePath - The resulting device path - - DevicePathLength - The length of DevicePath - -Return Value: - - TRUE if the function succeeded and FALSE otherwise. Errors - are logged in the Application event log. - ---*/ -_Success_(return) -BOOL -GetDevicePath( - _In_ LPGUID InterfaceGuid, - _Out_writes_z_(DevicePathLength) PWCHAR DevicePath, - _In_ size_t DevicePathLength - ) -{ - HRESULT hr = E_FAIL; - BOOL Return = FALSE; - CONFIGRET Status = CR_SUCCESS; - PWSTR DeviceInterfaceList = NULL; - ULONG DeviceInterfaceListLength = 0; - PWSTR NextInterface; - - Status = CM_Get_Device_Interface_List_Size(&DeviceInterfaceListLength, - InterfaceGuid, - NULL, - CM_GET_DEVICE_INTERFACE_LIST_PRESENT); - - if (Status != CR_SUCCESS) - { - WriteToErrorLog(L"CM_Get_DeviceInterface_List_Size", - CM_MapCrToWin32Err(Status, ERROR_FILE_NOT_FOUND)); - goto clean0; - } - - if (DeviceInterfaceListLength < 1) - { - WriteToErrorLog(L"CM_Get_DeviceInterface_List_Size", - CM_MapCrToWin32Err(Status, ERROR_EMPTY)); - goto clean0; - } - - DeviceInterfaceList = (PWSTR)malloc(DeviceInterfaceListLength * sizeof(WCHAR)); - - if (DeviceInterfaceList == NULL) - { - WriteToEventLog(L"Failed to allocate memory for the device interface list", - TRACE_LEVEL_ERROR); - goto clean0; - } - - ZeroMemory(DeviceInterfaceList, DeviceInterfaceListLength * sizeof(WCHAR)); - - Status = CM_Get_Device_Interface_List(InterfaceGuid, - NULL, - DeviceInterfaceList, - DeviceInterfaceListLength, - CM_GET_DEVICE_INTERFACE_LIST_PRESENT); - - if (Status != CR_SUCCESS) - { - WriteToErrorLog(L"CM_Get_Device_Interface_List", - CM_MapCrToWin32Err(Status, ERROR_FILE_NOT_FOUND)); - goto clean0; - } - - if (*DeviceInterfaceList == UNICODE_NULL) - { - WriteToEventLog(L"CM_Get_Device_Interface_List returned an empty list", - TRACE_LEVEL_ERROR); - } - - NextInterface = DeviceInterfaceList + wcslen(DeviceInterfaceList) + 1; - - if (*NextInterface != UNICODE_NULL) - { - WriteToEventLog(L"More than one device interface instance found. " - "Selecting first matching device.", - TRACE_LEVEL_WARNING); - } - - hr = StringCchCopy(DevicePath, DevicePathLength, DeviceInterfaceList); - - if (FAILED(hr)) - { - WriteToErrorLog(L"StringCchCopy", HRESULT_CODE(hr)); - goto clean0; - } - -clean0: - - if (DeviceInterfaceList != NULL) - { - free(DeviceInterfaceList); - } - - if (Status == CR_SUCCESS) - { - Return = TRUE; - } - - return Return; -} - - -/*++ - -Routine Description: - - Opens up the OSR USB FX2 device handle. - -Arguments: - - Synchronous - Whether or not this device should be - opened for synchronous access - -Return Value: - - The handle to the OSR USB FX2 device. - ---*/ -_Check_return_ -_Ret_notnull_ -_Success_(return != INVALID_HANDLE_VALUE) -HANDLE -OpenDevice( - _In_ BOOL Synchronous - ) -{ - HANDLE DeviceHandle; - WCHAR DeviceName[MAX_DEVPATH_LENGTH]; - - if (!GetDevicePath((LPGUID)&GUID_DEVINTERFACE_OSRUSBFX2, - DeviceName, - sizeof(DeviceName) / sizeof(DeviceName[0]))) - { - return INVALID_HANDLE_VALUE; - } - - if (Synchronous) - { - DeviceHandle = CreateFile(DeviceName, - GENERIC_WRITE | GENERIC_READ, - FILE_SHARE_WRITE | FILE_SHARE_READ, - NULL, // default security - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - } - else - { - DeviceHandle = CreateFile(DeviceName, - GENERIC_WRITE | GENERIC_READ, - FILE_SHARE_WRITE | FILE_SHARE_READ, - NULL, // default security - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, - NULL); - } - - if (DeviceHandle == INVALID_HANDLE_VALUE) - { - WriteToErrorLog(L"CreateFile", GetLastError()); - } - else - { - WriteToEventLog(L"Opened Device Successfully", TRACE_LEVEL_INFORMATION); - } - - return DeviceHandle; -} - - -/*++ - -Routine Description: - - Turns off all of the bar graph lights on the OSR USB FX2 device. - -Arguments: - - DeviceHandle - The handle to the OSR USB FX2 device - -Return Value: - - VOID - ---*/ -VOID -ClearAllBars( - _In_ HANDLE DeviceHandle - ) -{ - ULONG BytesReturned; - - BarGraphState.BarsAsUChar = 0; - - if (!DeviceIoControl(DeviceHandle, - IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY, - &BarGraphState, // Pointer to InBuffer - sizeof(BAR_GRAPH_STATE), // Length of InBuffer - NULL, // Pointer to OutBuffer - 0, // Length of OutBuffer - &BytesReturned, // BytesReturned - 0)) // Pointer to Overlapped structure - { - WriteToErrorLog(L"DeviceIOControl", GetLastError()); - } -} - - -/*++ - -Routine Description: - - Lights the next bar on the OSR USB FX2 device. - -Arguments: - - DeviceHandle - The handle to the OSR USB FX2 device - -Return Value: - - VOID - ---*/ -VOID -LightNextBar( - _In_ HANDLE DeviceHandle - ) -{ - ULONG BytesReturned; - - // - // Normalize to 0-7 - // - CurrentBar += 1; - - if (CurrentBar > 7) - { - CurrentBar = 0; - } - - BarGraphState.BarsAsUChar = 1 << (UCHAR)CurrentBar; - - if (!DeviceIoControl(DeviceHandle, - IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY, - &BarGraphState, // Pointer to InBuffer - sizeof(BAR_GRAPH_STATE), // Length of InBuffer - NULL, // Pointer to OutBuffer - 0, // Length of OutBuffer - &BytesReturned, // BytesReturned - 0)) // Pointer to Overlapped structure - { - WriteToErrorLog(L"DeviceIOControl", GetLastError()); - } -} \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Main.h b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Main.h deleted file mode 100644 index dcbd950e..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Main.h +++ /dev/null @@ -1,261 +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: - - Main.h - -Abstract: - - Implements the functions to control the OSR USB FX2 device. - -Environment: - - User mode - ---*/ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// {573E8C73-0CB4-4471-A1BF-FAB26C31D384} -DEFINE_GUID(GUID_DEVINTERFACE_OSRUSBFX2, - 0x573e8c73, 0xcb4, 0x4471, 0xa1, 0xbf, 0xfa, 0xb2, 0x6c, 0x31, 0xd3, 0x84); - -// -// Most device interface paths will fit into a buffer of this size. -// However, some could be longer, and a larger buffer or dynamically -// allocated buffer may be needed for robust code. -// -#define MAX_DEVPATH_LENGTH 1024 - -#pragma warning(push) -#pragma warning(disable:4201) // nameless struct/union -#pragma warning(disable:4214) // bit field types other than int - -// -// 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 -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; - -#include - -#pragma warning(pop) - -#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) - -/*++ - -Routine Description: - - Sets the variables in this service to their default values. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID SetVariables(); - - -/*++ - -Routine Description: - - Opens up the OSR USB FX2 device handle. - -Arguments: - - Synchronous - Whether or not this device should be - opened for synchronous access - -Return Value: - - The handle to the OSR USB FX2 device. - ---*/ -HANDLE OpenDevice(_In_ BOOL Synchronous); - - -/*++ - -Routine Description: - - Turns off all of the bar graph lights on the OSR USB FX2 device. - -Arguments: - - DeviceHandle - The handle to the OSR USB FX2 device. - -Return Value: - - VOID - ---*/ -VOID ClearAllBars(HANDLE deviceHandle); - - -/*++ - -Routine Description: - - Lights the next bar on the OSR USB FX2 device. - -Arguments: - - DeviceHandle - The handle to the OSR USB FX2 device. - -Return Value: - -VOID - ---*/ -VOID LightNextBar(HANDLE deviceHandle); \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.cpp b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.cpp deleted file mode 100644 index c39e4838..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.cpp +++ /dev/null @@ -1,254 +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: - - SampleService.cpp - -Abstract: - - Provides a sample service class that derives from the service base class - - CServiceBase. The sample service logs the service start and stop - information to the Application event log, and shows how to run the main - function of the service in a thread pool worker thread. - -Environment: - - User mode - ---*/ - -#pragma region Includes -#include "SampleService.h" -#include "ThreadPool.h" -#pragma endregion - -HANDLE DeviceHandle; - -/*++ - -Routine Description: - - The constructor of CSampleService. It initializes a new instance - of the CSampleService class. The optional parameters (CanStop, - CanShutdown and CanPauseContinue) allow you to specify whether the - service can be stopped, paused and continued, or be notified when system - shutdown occurs. Inherits properties from the class CServiceBase. - -Arguments: - - ServiceName - The name of the service - - CanStop - The service can be stopped - - CanShutdown - The service is notified when system shutdown occurs - - CanPauseContinue - The service can be paused and continued - -Return Value: - - VOID - ---*/ -CSampleService::CSampleService( - PWSTR ServiceName, - BOOL CanStop, - BOOL CanShutdown, - BOOL CanPauseContinue - ) -: CServiceBase(ServiceName, CanStop, CanShutdown, CanPauseContinue) -{ - m_fStopping = FALSE; - - // - // Create a manual-reset event that is not signaled at first to indicate - // the stopped signal of the service. - // - m_hStoppedEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - - if (m_hStoppedEvent == NULL) - { - throw GetLastError(); - } -} - - -/*++ - -Routine Description: - - The virtual destructor of CSampleService. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -CSampleService::~CSampleService() -{ - if (m_hStoppedEvent) - { - CloseHandle(m_hStoppedEvent); - m_hStoppedEvent = NULL; - } -} - - -/*++ - -Routine Description: - - This function is executed when a Start command is sent to the - service by the SCM or when the operating system starts (for a service - that starts automatically). It specifies actions to take when the - service starts. In this code sample, OnStart logs a service-start - message to the Application log, and queues the main service function for - execution in a thread pool worker thread. - - NOTE: A service application is designed to be long running. Therefore, - it usually polls or monitors something in the system. The monitoring is - set up in the OnStart method. However, OnStart does not actually do the - monitoring. The OnStart method must return to the operating system after - the service's operation has begun. It must not loop forever or block. To - set up a simple monitoring mechanism, one general solution is to create - a timer in OnStart. The timer would then raise events in your code - periodically, at which time your service could do its monitoring. The - other solution is to spawn a new thread to perform the main service - functions, which is demonstrated in this code sample. - -Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - -Return Value: - - VOID - ---*/ -VOID -CSampleService::OnStart( - DWORD Argc, - PWSTR *Argv - ) -{ - // - // Log a service start message to the Application log. - // - WriteToEventLog(L"SampleService in OnStart", - EVENTLOG_INFORMATION_TYPE); - - // - // Set variables in the base class - // - - // - // Open the device - // - DeviceHandle = OpenDevice(FALSE); - - if (DeviceHandle == INVALID_HANDLE_VALUE) - { - return; - } - - // - // Queue the main service function for execution in a worker thread. - // - CThreadPool::QueueUserWorkItem(&CSampleService::ServiceWorkerThread, this); -} - - -/*++ - -Routine Description: - - This method performs the main function of the service. It runs - on a thread pool worker thread. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CSampleService::ServiceWorkerThread() -{ - // - // Periodically check if the service is stopping. - // - while (!m_fStopping) - { - // - // Perform main service function here... - // - - ClearAllBars(DeviceHandle); - LightNextBar(DeviceHandle); - - ::Sleep(2000); // Simulate some lengthy operations. - } - - // - // Signal the stopped event. - // - SetEvent(m_hStoppedEvent); -} - - -/*++ - -Routine Description: - - This function is executed when a Stop command is sent to the service by SCM. - It specifies actions to take when a service stops running. In this code - sample, OnStop logs a service-stop message to the Application log, and - waits for the finish of the main service function. - - Be sure to periodically call ReportServiceStatus() with - SERVICE_STOP_PENDING if the procedure is going to take a long time. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CSampleService::OnStop() -{ - // - // Log a service stop message to the Application log. - // - WriteToEventLog(L"SampleService in OnStop", - EVENTLOG_INFORMATION_TYPE); - - // - // Indicate that the service is stopping and wait for the finish of the - // main service function (ServiceWorkerThread). - // - m_fStopping = TRUE; - - if (WaitForSingleObject(m_hStoppedEvent, INFINITE) != WAIT_OBJECT_0) - { - throw GetLastError(); - } -} \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.h b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.h deleted file mode 100644 index eee8a609..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.h +++ /dev/null @@ -1,174 +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: - - SampleService.h - -Abstract: - - Provides a sample service class that derives from the service base class - - CServiceBase. The sample service logs the service start and stop - information to the Application event log, and shows how to run the main - function of the service in a thread pool worker thread. - -Environment: - - User mode - ---*/ - -#pragma once - -#include "ServiceBase.h" -#include "Main.h" - -class CSampleService : public CServiceBase -{ -public: - - /*++ - - Routine Description: - - The constructor of CSampleService. It initializes a new instance - of the CSampleService class. The optional parameters (CanStop, - CanShutdown and CanPauseContinue) allow you to specify whether the - service can be stopped, paused and continued, or be notified when system - shutdown occurs. Inherits properties from the class CServiceBase. - - Arguments: - - ServiceName - The name of the service - - CanStop - The service can be stopped - - CanShutdown - The service is notified when system shutdown occurs - - CanPauseContinue - The service can be paused and continued - - Return Value: - - VOID - - --*/ - CSampleService(PWSTR ServiceName, - BOOL CanStop = TRUE, - BOOL CanShutdown = TRUE, - BOOL CanPauseContinue = FALSE); - - /*++ - - Routine Description: - - The virtual destructor of CSampleService. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - virtual ~CSampleService(); - -protected: - - /*++ - - Routine Description: - - This function is executed when a Start command is sent to the - service by the SCM or when the operating system starts (for a service - that starts automatically). It specifies actions to take when the - service starts. In this code sample, OnStart logs a service-start - message to the Application log, and queues the main service function for - execution in a thread pool worker thread. - - NOTE: A service application is designed to be long running. Therefore, - it usually polls or monitors something in the system. The monitoring is - set up in the OnStart method. However, OnStart does not actually do the - monitoring. The OnStart method must return to the operating system after - the service's operation has begun. It must not loop forever or block. To - set up a simple monitoring mechanism, one general solution is to create - a timer in OnStart. The timer would then raise events in your code - periodically, at which time your service could do its monitoring. The - other solution is to spawn a new thread to perform the main service - functions, which is demonstrated in this code sample. - - Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - - Return Value: - - VOID - - --*/ - virtual VOID OnStart(DWORD Argc, PWSTR *Argv); - - - /*++ - - Routine Description: - - This function is executed when a Stop command is sent to the service by SCM. - It specifies actions to take when a service stops running. In this code - sample, OnStop logs a service-stop message to the Application log, and - waits for the finish of the main service function. - - Be sure to periodically call ReportServiceStatus() with - SERVICE_STOP_PENDING if the procedure is going to take a long time. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - virtual VOID OnStop(); - - - /*++ - - Routine Description: - - This method performs the main function of the service. It runs - on a thread pool worker thread. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - VOID ServiceWorkerThread(); - -private: - - // - // Determines if the service is currently stopping. - // - BOOL m_fStopping; - - // - // The handle to wait for a stop event. - // - HANDLE m_hStoppedEvent; -}; \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.cpp b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.cpp deleted file mode 100644 index 4c20af2e..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.cpp +++ /dev/null @@ -1,794 +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: - - ServiceBase.cpp - -Abstract: - - Provides a base class for a service that will exist as part of a service - application. CServiceBase must be derived from when creating a new service - class. - -Environment: - - User mode - ---*/ - -#pragma region Includes -#include "ServiceBase.h" -#include "Main.h" -#include "Utils.h" -#include -#include -#pragma endregion - - -#pragma region Static Members - -// -// Initialize the singleton service instance. -// -CServiceBase *CServiceBase::s_service = NULL; - - -/*++ - -Routine Description: - - Register the executable for a service with the Service Control - Manager (SCM). After you call Run(ServiceBase), the SCM issues a Start - command, which results in a call to the OnStart method in the service. - This method blocks until the service has stopped. - -Arguments: - - Service - The reference to a CServiceBase object. It will become the - singleton service instance of this service application. - -Return Value: - - If the function succeeds, the return value is TRUE. If the function - fails, the return value is FALSE. To get extended error information, - call GetLastError. - ---*/ -BOOL -CServiceBase::Run( - CServiceBase &Service - ) -{ - s_service = &Service; - - SERVICE_TABLE_ENTRY serviceTable[] = - { - { Service.m_name, ServiceMain }, - { NULL, NULL } - }; - - // - // Connects the main thread of a service process to the service control - // manager, which causes the thread to be the service control dispatcher - // thread for the calling process. This call returns when the service has - // stopped. The process should simply terminate when the call returns. - // - return StartServiceCtrlDispatcher(serviceTable); -} - - -/*++ - -Routine Description: - - The entry point for the service. It registers the handler function - for the service and starts the service. - -Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - -Return Value: - - VOID - ---*/ -VOID -WINAPI -CServiceBase::ServiceMain( - DWORD Argc, - PWSTR *Argv - ) -{ - assert(s_service != NULL); - - // - // Register the handler function for the service. - // - s_service->m_statusHandle = RegisterServiceCtrlHandler(s_service->m_name, - ServiceCtrlHandler); - - if (s_service->m_statusHandle == NULL) - { - throw GetLastError(); - } - - // - // Start the service. - // - s_service->Start(Argc, Argv); -} - - -/*++ - -Routine Description: - - Called by the SCM whenever a control code is sent to the service. - -Arguments: - - CtrlCode - The control code. This parameter can be one of - the following values: - - SERVICE_CONTROL_CONTINUE - SERVICE_CONTROL_INTERROGATE - SERVICE_CONTROL_NETBINDADD - SERVICE_CONTROL_NETBINDDISABLE - SERVICE_CONTROL_NETBINDREMOVE - SERVICE_CONTROL_PARAMCHANGE - SERVICE_CONTROL_PAUSE - SERVICE_CONTROL_SHUTDOWN - SERVICE_CONTROL_STOP - - This parameter can also be a user-defined control - code ranging from 128 to 255. - -Return Value: - - VOID - ---*/ -VOID -WINAPI -CServiceBase::ServiceCtrlHandler( - DWORD Ctrl - ) -{ - switch (Ctrl) - { - case SERVICE_CONTROL_STOP: - s_service->Stop(); - break; - case SERVICE_CONTROL_PAUSE: - s_service->Pause(); - break; - case SERVICE_CONTROL_CONTINUE: - s_service->Continue(); - break; - case SERVICE_CONTROL_SHUTDOWN: - s_service->Shutdown(); - break; - case SERVICE_CONTROL_INTERROGATE: - break; - default: - break; - } -} - -#pragma endregion - - -#pragma region Service Constructor and Destructor - -/*++ - -Routine Description: - - The constructor of CServiceBase. It initializes a new instance - of the CServiceBase class. The optional parameters (CanStop, - CanShutdown and CanPauseContinue) allow you to specify whether the - service can be stopped, paused and continued, or be notified when system - shutdown occurs. - -Arguments: - - ServiceName - The name of the service - - CanStop - The service can be stopped - - CanShutdown - The service is notified when system shutdown occurs - - CanPauseContinue - The service can be paused and continued - -Return Value: - - VOID - ---*/ -CServiceBase::CServiceBase( - PWSTR ServiceName, - BOOL CanStop, - BOOL CanShutdown, - BOOL CanPauseContinue - ) -{ - // - // Service name must be a valid string and cannot be NULL. - // - m_name = (ServiceName == NULL) ? L"" : ServiceName; - - m_statusHandle = NULL; - - // - // The service runs in its own process. - // - m_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - - // - // The service is starting. - // - m_status.dwCurrentState = SERVICE_START_PENDING; - - // - // The accepted commands of the service. - // - DWORD dwControlsAccepted = 0; - - if (CanStop) - { - dwControlsAccepted |= SERVICE_ACCEPT_STOP; - } - - if (CanShutdown) - { - dwControlsAccepted |= SERVICE_ACCEPT_SHUTDOWN; - } - - if (CanPauseContinue) - { - dwControlsAccepted |= SERVICE_ACCEPT_PAUSE_CONTINUE; - } - - m_status.dwControlsAccepted = dwControlsAccepted; - - m_status.dwWin32ExitCode = NO_ERROR; - m_status.dwServiceSpecificExitCode = 0; - m_status.dwCheckPoint = 0; - m_status.dwWaitHint = 0; - - SetupEvents(); -} - - -/*++ - -Routine Description: - - The virtual destructor of CServiceBase. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -CServiceBase::~CServiceBase() -{ - DestroyEvents(); -} - -#pragma endregion - - -#pragma region Service Start, Stop, Pause, Continue, and Shutdown - -/*++ - -Routine Description: - - This function starts the service. It calls the OnStart virtual function - in which you can specify the actions to take when the service starts. If - an error occurs during the startup, the error will be logged in the - Application event log, and the service will be stopped. - -Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::Start( - DWORD Argc, - PWSTR *Argv -) -{ - try - { - // - // Tell SCM that the service is starting. - // - SetServiceStatus(SERVICE_START_PENDING); - - // - // Perform service-specific initialization. - // - OnStart(Argc, Argv); - - // - // Tell SCM that the service is started. - // - SetServiceStatus(SERVICE_RUNNING); - } - catch (DWORD Error) - { - // - // Log the error. - // - WriteToErrorLog(L"Service Start", Error); - - // - // Set the service status to be stopped. - // - SetServiceStatus(SERVICE_STOPPED, Error); - } - catch (...) - { - // - // Log the error. - // - WriteToEventLog(L"Service failed to start.", EVENTLOG_ERROR_TYPE); - - // - // Set the service status to be stopped. - // - SetServiceStatus(SERVICE_STOPPED); - } -} - - -/*++ - -Routine Description: - - When implemented in a derived class, executes when a Start - command is sent to the service by the SCM or when the operating system - starts (for a service that starts automatically). Specifies actions to - take when the service starts. Be sure to periodically call - CServiceBase::SetServiceStatus() with SERVICE_START_PENDING if the - procedure is going to take long time. You may also consider spawning a - new thread in OnStart to perform time-consuming initialization tasks. - -Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::OnStart( - DWORD Argc, - PWSTR *Argv -) -{ - SetVariables(); -} - - -/*++ - -Routine Description: - - This function stops the service. It calls the OnStop virtual - function in which you can specify the actions to take when the service - stops. If an error occurs, the error will be logged in the Application - event log, and the service will be restored to the original state. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::Stop() -{ - DWORD OriginalState = m_status.dwCurrentState; - - try - { - // - // Tell SCM that the service is stopping. - // - SetServiceStatus(SERVICE_STOP_PENDING); - - // - // Perform service-specific stop operations. - // - OnStop(); - - // - // Tell SCM that the service is stopped. - // - SetServiceStatus(SERVICE_STOPPED); - } - catch (DWORD Error) - { - // - // Log the error. - // - WriteToErrorLog(L"Service Stop", Error); - - // - // Set the orginal service status. - // - SetServiceStatus(OriginalState); - } - catch (...) - { - // - // Log the error. - // - WriteToEventLog(L"Service failed to stop.", EVENTLOG_ERROR_TYPE); - - // - // Set the orginal service status. - // - SetServiceStatus(OriginalState); - } -} - - -/*++ - -Routine Description: - - When implemented in a derived class, executes when a Stop - command is sent to the service by the SCM. Specifies actions to take - when a service stops running. Be sure to periodically call - CServiceBase::SetServiceStatus() with SERVICE_STOP_PENDING if the - procedure is going to take long time. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::OnStop() -{ -} - - -/*++ - -Routine Description: - - The function pauses the service if the service supports pause - and continue. It calls the OnPause virtual function in which you can - specify the actions to take when the service pauses. If an error occurs, - the error will be logged in the Application event log, and the service - will become running. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::Pause() -{ - try - { - // - // Tell SCM that the service is pausing. - // - SetServiceStatus(SERVICE_PAUSE_PENDING); - - // - // Perform service-specific pause operations. - // - OnPause(); - - // - // Tell SCM that the service is paused. - // - SetServiceStatus(SERVICE_PAUSED); - } - catch (DWORD Error) - { - // - // Log the error. - // - WriteToErrorLog(L"Service Pause", Error); - - // - // Tell SCM that the service is still running. - // - SetServiceStatus(SERVICE_RUNNING); - } - catch (...) - { - // - // Log the error. - // - WriteToEventLog(L"Service failed to pause.", EVENTLOG_ERROR_TYPE); - - // - // Tell SCM that the service is still running. - // - SetServiceStatus(SERVICE_RUNNING); - } -} - - -/*++ - -Routine Description: - - When implemented in a derived class, executes when a Pause - command is sent to the service by the SCM. Specifies actions to take - when a service pauses. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::OnPause() -{ -} - - -/*++ - -Routine Description: - - The function resumes normal functioning after being paused if - the service supports pause and continue. It calls the OnContinue virtual - function in which you can specify the actions to take when the service - continues. If an error occurs, the error will be logged in the - Application event log, and the service will still be paused. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::Continue() -{ - try - { - // - // Tell SCM that the service is resuming. - // - SetServiceStatus(SERVICE_CONTINUE_PENDING); - - // - // Perform service-specific continue operations. - // - OnContinue(); - - // - // Tell SCM that the service is running. - // - SetServiceStatus(SERVICE_RUNNING); - } - catch (DWORD Error) - { - // - // Log the error. - // - WriteToErrorLog(L"Service Continue", Error); - - // - // Tell SCM that the service is still paused. - // - SetServiceStatus(SERVICE_PAUSED); - } - catch (...) - { - // - // Log the error. - // - WriteToEventLog(L"Service failed to resume.", EVENTLOG_ERROR_TYPE); - - // - // Tell SCM that the service is still paused. - // - SetServiceStatus(SERVICE_PAUSED); - } -} - - -/*++ - -Routine Description: - - When implemented in a derived class, OnContinue runs when a - Continue command is sent to the service by the SCM. Specifies actions to - take when a service resumes normal functioning after being paused. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::OnContinue() -{ -} - - -/*++ - -Routine Description: - - The function executes when the system is shutting down. It - calls the OnShutdown virtual function in which you can specify what - should occur immediately prior to the system shutting down. If an error - occurs, the error will be logged in the Application event log. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::Shutdown() -{ - try - { - // - // Perform service-specific shutdown operations. - // - OnShutdown(); - - // - // Tell SCM that the service is stopped. - // - SetServiceStatus(SERVICE_STOPPED); - } - catch (DWORD Error) - { - // - // Log the error. - // - WriteToErrorLog(L"Service Shutdown", Error); - } - catch (...) - { - // - // Log the error. - // - WriteToEventLog(L"Service failed to shut down.", EVENTLOG_ERROR_TYPE); - } -} - - -/*++ - -Routine Description: - - When implemented in a derived class, executes when the system - is shutting down. Specifies what should occur immediately prior to the - system shutting down. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::OnShutdown() -{ -} - -#pragma endregion - - -#pragma region Helper Functions - -/*++ - -Routine Description: - - The function sets the service status and reports the status to the SCM. - -Arguments: - - CurrentState - The current state of the service - - Win32ExitCode - The error code to report - - WaitHint - The estimated time for pending operation, in milliseconds - -Return Value: - - VOID - ---*/ -VOID -CServiceBase::SetServiceStatus( - DWORD CurrentState, - DWORD Win32ExitCode, - DWORD WaitHint - ) -{ - static DWORD CheckPoint = 1; - - // - // Fill in the SERVICE_STATUS structure of the service. - // - - m_status.dwCurrentState = CurrentState; - m_status.dwWin32ExitCode = Win32ExitCode; - m_status.dwWaitHint = WaitHint; - - m_status.dwCheckPoint = ((CurrentState == SERVICE_RUNNING) || - (CurrentState == SERVICE_STOPPED)) ? 0 : - CheckPoint++; - - // - // Report the status of the service to the SCM. - // - ::SetServiceStatus(m_statusHandle, &m_status); -} - -#pragma endregion \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.h b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.h deleted file mode 100644 index 106597e1..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.h +++ /dev/null @@ -1,423 +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: - - ServiceBase.cpp - -Abstract: - - Provides a base class for a service that will exist as part of a service - application. CServiceBase must be derived from when creating a new service - class. - -Environment: - - User mode - ---*/ - -#pragma once - -#include -#include "Utils.h" - -class CServiceBase -{ -public: - - /*++ - - Routine Description: - - Register the executable for a service with the Service Control - Manager (SCM). After you call Run(ServiceBase), the SCM issues a Start - command, which results in a call to the OnStart method in the service. - This method blocks until the service has stopped. - - Arguments: - - Service - The reference to a CServiceBase object. It will become the - singleton service instance of this service application. - - Return Value: - - If the function succeeds, the return value is TRUE. If the function - fails, the return value is FALSE. To get extended error information, - call GetLastError. - - --*/ - static BOOL Run(CServiceBase &service); - - - /*++ - - Routine Description: - - The constructor of CServiceBase. It initializes a new instance - of the CServiceBase class. The optional parameters (CanStop, - CanShutdown and CanPauseContinue) allow you to specify whether the - service can be stopped, paused and continued, or be notified when system - shutdown occurs. - - Arguments: - - ServiceName - The name of the service - - CanStop - The service can be stopped - - CanShutdown - The service is notified when system shutdown occurs - - CanPauseContinue - The service can be paused and continued - - Return Value: - - VOID - - --*/ - CServiceBase(PWSTR ServiceName, - BOOL CanStop = TRUE, - BOOL CanShutdown = TRUE, - BOOL CanPauseContinue = FALSE); - - - /*++ - - Routine Description: - - The virtual destructor of CServiceBase. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - virtual ~CServiceBase(); - - - /*++ - - Routine Description: - - This function stops the service. It calls the OnStop virtual - function in which you can specify the actions to take when the service - stops. If an error occurs, the error will be logged in the Application - event log, and the service will be restored to the original state. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - VOID Stop(); - -protected: - - /*++ - - Routine Description: - - When implemented in a derived class, executes when a Start - command is sent to the service by the SCM or when the operating system - starts (for a service that starts automatically). Specifies actions to - take when the service starts. Be sure to periodically call - CServiceBase::SetServiceStatus() with SERVICE_START_PENDING if the - procedure is going to take long time. You may also consider spawning a - new thread in OnStart to perform time-consuming initialization tasks. - - Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - - Return Value: - - VOID - - --*/ - virtual VOID OnStart(DWORD Argc, PWSTR *Argv); - - - /*++ - - Routine Description: - - When implemented in a derived class, executes when a Stop - command is sent to the service by the SCM. Specifies actions to take - when a service stops running. Be sure to periodically call - CServiceBase::SetServiceStatus() with SERVICE_STOP_PENDING if the - procedure is going to take long time. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - virtual VOID OnStop(); - - - /*++ - - Routine Description: - - When implemented in a derived class, executes when a Pause - command is sent to the service by the SCM. Specifies actions to take - when a service pauses. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - virtual VOID OnPause(); - - - /*++ - - Routine Description: - - When implemented in a derived class, OnContinue runs when a - Continue command is sent to the service by the SCM. Specifies actions to - take when a service resumes normal functioning after being paused. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - virtual VOID OnContinue(); - - - /*++ - - Routine Description: - - When implemented in a derived class, executes when the system - is shutting down. Specifies what should occur immediately prior to the - system shutting down. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - virtual VOID OnShutdown(); - - - /*++ - - Routine Description: - - The function sets the service status and reports the status to the SCM. - - Arguments: - - CurrentState - The current state of the service - - Win32ExitCode - The error code to report - - WaitHint - The estimated time for pending operation, in milliseconds - - Return Value: - - VOID - - --*/ - VOID SetServiceStatus(DWORD CurrentState, - DWORD Win32ExitCode = NO_ERROR, - DWORD WaitHint = 0); - -private: - - /*++ - - Routine Description: - - The entry point for the service. It registers the handler function - for the service and starts the service. - - Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - - Return Value: - - VOID - - --*/ - static VOID WINAPI ServiceMain(DWORD Argc, PWSTR *Argv); - - - /*++ - - Routine Description: - - Called by the SCM whenever a control code is sent to the service. - - Arguments: - - CtrlCode - The control code. This parameter can be one of - the following values: - - SERVICE_CONTROL_CONTINUE - SERVICE_CONTROL_INTERROGATE - SERVICE_CONTROL_NETBINDADD - SERVICE_CONTROL_NETBINDDISABLE - SERVICE_CONTROL_NETBINDREMOVE - SERVICE_CONTROL_PARAMCHANGE - SERVICE_CONTROL_PAUSE - SERVICE_CONTROL_SHUTDOWN - SERVICE_CONTROL_STOP - - This parameter can also be a user-defined control - code ranging from 128 to 255. - - Return Value: - - VOID - - --*/ - static VOID WINAPI ServiceCtrlHandler(DWORD Ctrl); - - - /*++ - - Routine Description: - - This function starts the service. It calls the OnStart virtual function - in which you can specify the actions to take when the service starts. If - an error occurs during the startup, the error will be logged in the - Application event log, and the service will be stopped. - - Arguments: - - Argc - The number of command line arguments - - Argv - The array of command line arguments - - Return Value: - - VOID - - --*/ - VOID Start(DWORD Argc, PWSTR *Argv); - - - /*++ - - Routine Description: - - The function pauses the service if the service supports pause - and continue. It calls the OnPause virtual function in which you can - specify the actions to take when the service pauses. If an error occurs, - the error will be logged in the Application event log, and the service - will become running. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - VOID Pause(); - - - /*++ - - Routine Description: - - The function resumes normal functioning after being paused if - the service supports pause and continue. It calls the OnContinue virtual - function in which you can specify the actions to take when the service - continues. If an error occurs, the error will be logged in the - Application event log, and the service will still be paused. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - VOID Continue(); - - - /*++ - - Routine Description: - - The function executes when the system is shutting down. It - calls the OnShutdown virtual function in which you can specify what - should occur immediately prior to the system shutting down. If an error - occurs, the error will be logged in the Application event log. - - Arguments: - - VOID - - Return Value: - - VOID - - --*/ - VOID Shutdown(); - - - // - // The singleton service instance. - // - static CServiceBase *s_service; - - // - // The name of the service. - // - PWSTR m_name; - - // - // The status of the service. - // - SERVICE_STATUS m_status; - - // - // The service status handle. - // - SERVICE_STATUS_HANDLE m_statusHandle; -}; \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ThreadPool.h b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ThreadPool.h deleted file mode 100644 index 3d851537..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ThreadPool.h +++ /dev/null @@ -1,80 +0,0 @@ -/****************************** Module Header ******************************\ -* Module Name: ThreadPool.h -* Project: CppWindowsService -* Copyright (c) Microsoft Corporation. -* -* The class was designed by Kenny Kerr. It provides the ability to queue -* simple member functions of a class to the Windows thread pool. -* -* Using the thread pool is simple and feels natural in C++. -* -* class CSampleService -* { -* public: -* -* void AsyncRun() -* { -* CThreadPool::QueueUserWorkItem(&Service::Run, this); -* } -* -* void Run() -* { -* // Some lengthy operation -* } -* }; -* -* Kenny Kerr spends most of his time designing and building distributed -* applications for the Microsoft Windows platform. He also has a particular -* passion for C++ and security programming. Reach Kenny at -* http://weblogs.asp.net/kennykerr/ or visit his Web site: -* http://www.kennyandkarin.com/Kenny/. -* -* This source is subject to the Microsoft Public License. -* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL. -* All other 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. -\***************************************************************************/ - -#pragma once - -#include - - -class CThreadPool -{ -public: - - template - static void QueueUserWorkItem(void (T::*function)(void), - T *object, ULONG flags = WT_EXECUTELONGFUNCTION) - { - typedef std::pair CallbackType; - std::auto_ptr p(new CallbackType(function, object)); - - if (::QueueUserWorkItem(ThreadProc, p.get(), flags)) - { - // The ThreadProc now has the responsibility of deleting the pair. - p.release(); - } - else - { - throw GetLastError(); - } - } - -private: - - template - static DWORD WINAPI ThreadProc(PVOID context) - { - typedef std::pair CallbackType; - - std::auto_ptr p(static_cast(context)); - - (p->second->*p->first)(); - return 0; - } -}; \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.cpp b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.cpp deleted file mode 100644 index e8fc87ee..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.cpp +++ /dev/null @@ -1,156 +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: - - Utils.cpp - -Abstract: - - Provides utility function to SampleApp.cpp. - -Environment: - - User mode - ---*/ - -#include "Utils.h" - -// -// Service trace event provider -// {54a25c42-cd91-4210-98cc-c3447b56e447} -// -EXTERN_C __declspec(selectany) const GUID SERVICE_PROVIDER_GUID = { 0x54a25c42, 0xcd91, 0x4210,{ 0x98, 0xcc, 0xc3, 0x44, 0x7b, 0x56, 0xe4, 0x47 } }; - -REGHANDLE m_etwRegHandle; - - -/*++ - -Routine Description: - - Sets up logging. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -SetupEvents() -{ - NTSTATUS status = EventRegister(&SERVICE_PROVIDER_GUID, - nullptr, - nullptr, - &m_etwRegHandle); - - if (status != ERROR_SUCCESS) - { - wprintf(L"Provider not registered. EventRegister failed with error: 0x%08X\n", status); - } -} - - -/*++ - -Routine Description: - - Destroys logging. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID -DestroyEvents() -{ - if (m_etwRegHandle != NULL) - { - EventUnregister(m_etwRegHandle); - } -} - - -/*++ - -Routine Description: - - Log a message. - -Arguments: - - Message - The string message to be logged - - Level - The type of event to be logged. This parameter can - be one of the following values: - - TRACE_LEVEL_CRITICAL - TRACE_LEVEL_ERROR - TRACE_LEVEL_WARNING - TRACE_LEVEL_INFORMATION - TRACE_LEVEL_VERBOSE - -Return Value: - - VOID - ---*/ -VOID -WriteToEventLog( - PWSTR Message, - BYTE Level - ) -{ - if (m_etwRegHandle != NULL) - { - EventWriteString(m_etwRegHandle, Level, 0, Message); - } -} - - -/*++ - -Routine Description: - - Log an error message. - -Arguments: - - Function - The function that gives the error - - Error - The error code - -Return Value: - - VOID - ---*/ -VOID -WriteToErrorLog( - PWSTR Function, - DWORD Error - ) -{ - WCHAR Message[260]; - - StringCchPrintf(Message, ARRAYSIZE(Message), - L"%ws failed with error: 0x%08x", Function, Error); - - WriteToEventLog(Message, TRACE_LEVEL_ERROR); -} \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.h b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.h deleted file mode 100644 index b619f461..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.h +++ /dev/null @@ -1,111 +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: - - Utils.cpp - -Abstract: - - Provides utility function to SampleApp.cpp. - -Environment: - - User mode - ---*/ - -#pragma once - -#include -#include -#include -#include - -/*++ - -Routine Description: - - Sets up logging. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID SetupEvents(); - - -/*++ - -Routine Description: - - Destroys logging. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID DestroyEvents(); - - -/*++ - -Routine Description: - - Log a message. - -Arguments: - - Message - The string message to be logged - - Level - The type of event to be logged. This parameter can - be one of the following values: - - TRACE_LEVEL_CRITICAL - TRACE_LEVEL_ERROR - TRACE_LEVEL_WARNING - TRACE_LEVEL_INFORMATION - TRACE_LEVEL_VERBOSE - -Return Value: - - VOID - ---*/ -VOID WriteToEventLog(PWSTR Message, BYTE Level); - - -/*++ - -Routine Description: - - Log an error message. - -Arguments: - - Function - The function that gives the error - - Error - The error code - -Return Value: - - VOID - ---*/ -VOID WriteToErrorLog(PWSTR Function, DWORD Error); \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters deleted file mode 100644 index 7f12a302..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters +++ /dev/null @@ -1,54 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - - \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx deleted file mode 100644 index 61e1e958..00000000 Binary files a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx and /dev/null differ diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj b/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj deleted file mode 100644 index 111fd2bf..00000000 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj +++ /dev/null @@ -1,206 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} - osrfx2_DCHU_usersvc - Win32Proj - osrfx2_DCHU_usersvc - 10.0.15063.0 - - - - Application - Unicode - true - v141 - - - Application - Unicode - v141 - - - Application - Unicode - true - v141 - - - Application - Unicode - v141 - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Configuration)\ - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_CONSOLE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreaded - - - Level3 - EditAndContinue - - - true - Console - MachineX86 - onecoreuap.lib;%(AdditionalDependencies); - - - - - MaxSpeed - true - WIN32;_CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - true - - - Level3 - ProgramDatabase - - - true - Console - true - true - MachineX86 - onecoreuap.lib;%(AdditionalDependencies); - - - - - X64 - - - Disabled - WIN32;_CONSOLE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreaded - - - Level3 - ProgramDatabase - - - true - Console - MachineX64 - onecoreuap.lib;%(AdditionalDependencies); - - - - - - - - - X64 - - - MaxSpeed - true - WIN32;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - - - true - Console - true - true - MachineX64 - onecoreuap.lib;%(AdditionalDependencies); - - - - - - - - - - - - - - - - - - - true - - - - - - \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.filters b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.filters new file mode 100644 index 00000000..fa953f4c --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.filters @@ -0,0 +1,14 @@ + + + + + {8E41214B-6785-4CFE-B992-037D68949A14} + inf;inv;inx;mof;mc; + + + + + Driver Files + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx new file mode 100644 index 00000000..8baab1a0 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx @@ -0,0 +1,64 @@ +;/*++ +; +;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: +; +; osrfx2_DCHU_component.INF +; +;Abstract: +; +; Installation inf for one of the OSR FX2 Learning Kit's +; AddComponent directives +; +;--*/ + +[Version] +Signature = "$Windows NT$" +Class = SoftwareComponent +ClassGuid = {5c4c3332-344d-483c-8739-259e934c9cc8} +Provider = %ManufacturerName% +CatalogFile = osrfx2_DCHU_component.cat + +[Manufacturer] +%ManufacturerName% = OsrFx2Component, NT$ARCH$ + +[OsrFx2Component.NT$ARCH$] +%DeviceName% = OsrFx2Component_Install, SWC\VID_045e&PID_94ab + +[SourceDisksFiles] +osrfx2_DCHU_componentsoftware.exe = 1 + +[SourceDisksNames] +1 = %DiskName% + +[DestinationDirs] +OsrFx2Component_CopyFiles = 13 ; copy to driverstore + +[OsrFx2Component_Install.NT] +CopyFiles = OsrFx2Component_CopyFiles + +[OsrFx2Component_Install.NT.Services] +AddService = , 0x00000002 + +[OsrFx2Component_Install.NT.Software] +AddSoftware = osrfx2_DCHU_componentsoftware,, OsrFx2Component_SoftwareInstall + +[OsrFx2Component_SoftwareInstall] +SoftwareType = 1 +SoftwareBinary = osrfx2_DCHU_componentsoftware.exe +SoftwareArguments = <> +SoftwareVersion = 1.0.0.0 + +[OsrFx2Component_CopyFiles] +osrfx2_DCHU_componentsoftware.exe + +[Strings] +ManufacturerName = "Contoso" +DiskName = "OsrFx2 DCHU Component Installation Disk" +DeviceName = "OsrFx2 DCHU Component Device" \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj new file mode 100644 index 00000000..bc19d287 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj @@ -0,0 +1,276 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + + + + + + + + + + + + + + + + + + + + + + + {F90EFA96-B075-4531-B4E1-F406362D16BF} + {4605da2c-74a5-4865-98e1-152ef136825f} + v4.5 + 12.0 + Debug + Win32 + osrfx2_DCHU_component + osrfx2_DCHU_component + + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + + + + + + + + + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + + 1.0.0.0 + + + + + 1.0.0.0 + + + + + 1.0.0.0 + + + + + 1.0.0.0 + + + + + 1.0.0.0 + + + + + 1.0.0.0 + + + + + 1.0.0.0 + + + + + 1.0.0.0 + + + + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp new file mode 100644 index 00000000..c14e66d1 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp @@ -0,0 +1,489 @@ +/*++ + +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: + + osrfx2_DCHU_componentsoftware.cpp + +Abstract: + + An example .exe to run using the AddSoftware directive within an INF. + Contains an example on how to obtain a handle to the primary device using + SoftwareArguments within an AddSoftware directive's section. + +Environment: + + User mode + +--*/ + +#include "stdafx.h" + +#define BUFFER_SIZE (128 * sizeof(WCHAR)) +#define DEVICE_REG_SUBKEY L"OSR" +#define DEVICE_VALUE_OP_MODE L"OperatingMode" +#define DEVICE_VALUE_OP_PARAMS L"OperatingParams" +#define DEVICE_VALUE_OP_EXCEPTIONS L"OperatingExceptions" +#define CONTOSO_FILEPATH L"C:\\Program Files\\Contoso" +#define OSRFX2_DCHU_FILEPATH L"C:\\Program Files\\Contoso\\OsrFx2_DCHU" +#define FILEPATH L"C:\\Program Files\\Contoso\\OsrFx2_DCHU\\AddSoftwareInstallationFile.txt" +#define FILE_CONTENT L"Operating Mode: %ws\r\nOperating Params: %ws\r\nOperating Exceptions: %ws" + + +/*++ + +Routine Description: + +Arguments: + +Return Value: + + +--*/ +DWORD +WriteToFile( + _In_ PWSTR MessageText, + _In_ DWORD MessageTextLength + ) +{ + DWORD Err = ERROR_SUCCESS; + BOOL ErrorFlag = FALSE; + HANDLE hFile = INVALID_HANDLE_VALUE; + DWORD BytesToWrite; + DWORD BytesWritten; + + if (!CreateDirectory(CONTOSO_FILEPATH, NULL)) + { + Err = GetLastError(); + + if (Err == ERROR_ALREADY_EXISTS) + { + Err = ERROR_SUCCESS; + } + else + { + goto cleanup; + } + } + + if (!CreateDirectory(OSRFX2_DCHU_FILEPATH, NULL)) + { + Err = GetLastError(); + + if (Err == ERROR_ALREADY_EXISTS) + { + Err = ERROR_SUCCESS; + } + else + { + goto cleanup; + } + } + + hFile = CreateFile(FILEPATH, + GENERIC_WRITE, + 0, + NULL, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (hFile == INVALID_HANDLE_VALUE) + { + Err = ERROR_INVALID_PARAMETER; + goto cleanup; + } + + BytesToWrite = MessageTextLength * sizeof(WCHAR); + + ErrorFlag = WriteFile(hFile, + MessageText, + BytesToWrite, + &BytesWritten, + NULL); + + if ((!ErrorFlag) || + (BytesToWrite != BytesWritten)) + { + Err = GetLastError(); + goto cleanup; + } + +cleanup: + + if (hFile != INVALID_HANDLE_VALUE) + { + CloseHandle(hFile); + } + + return Err; +} + + +/*++ + +Routine Description: + + Obtains the handle to the device that used a separate Software Component + INF to install software. + +Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + +Return Value: + + VOID + +--*/ +VOID +__cdecl +_tmain( + INT Argc, + TCHAR *Argv[]) +{ + DWORD Err = ERROR_SUCCESS; + HRESULT hr = S_OK; + BOOL ErrorFlag = FALSE; + DWORD BytesToWrite = 0; + DWORD BytesWritten = 0; + PTSTR DeviceInstanceId; + HDEVINFO DevInfoList = INVALID_HANDLE_VALUE; + SP_DEVINFO_DATA DevInfoData; + WCHAR ParentDeviceInstanceId[MAX_DEVICE_ID_LEN]; + DWORD RequiredSize; + DEVPROPTYPE DevPropType; + SP_DEVINFO_DATA ParentDevInfoData; + HKEY DevRegKey = NULL; + PWSTR OperatingMode = NULL; + PWSTR OperatingParams = NULL; + PWSTR OperatingExceptions = NULL; + DWORD ValueType; + DWORD ValueSize = BUFFER_SIZE; + HKEY DevOsrRegKey = NULL; + PWSTR FileText = NULL; + DWORD FileTextLength; + + // + // Validate arguments. + // + if (Argc != 2) + { + Err = ERROR_INVALID_PARAMETER; + goto cleanup; + } + + OperatingMode = (PWSTR)malloc(BUFFER_SIZE * sizeof(WCHAR)); + + if (OperatingMode == NULL) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + OperatingParams = (PWSTR)malloc(BUFFER_SIZE * sizeof(WCHAR)); + + if (OperatingParams == NULL) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + OperatingExceptions = (PWSTR)malloc(BUFFER_SIZE * sizeof(WCHAR)); + + if (OperatingExceptions == NULL) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + // + // Argv[1] should be the device instance ID. + // + DeviceInstanceId = Argv[1]; + + // + // Create a device info list to store queried device handles. + // + DevInfoList = SetupDiCreateDeviceInfoList(NULL, NULL); + + if (DevInfoList == INVALID_HANDLE_VALUE) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + + // + // Add the Software Component device that called AddSoftware to the + // device info list, which will be used to find the primary device that + // called AddComponent in the first place. + // + if (!SetupDiOpenDeviceInfo(DevInfoList, + DeviceInstanceId, + NULL, + 0, + &DevInfoData)) + { + Err = GetLastError(); + goto cleanup; + } + + // + // Get the device instance id of the opened device's parent. + // + if (!SetupDiGetDeviceProperty(DevInfoList, + &DevInfoData, + &DEVPKEY_Device_Parent, + &DevPropType, + (PBYTE)ParentDeviceInstanceId, + sizeof(ParentDeviceInstanceId), + &RequiredSize, + 0)) + { + Err = GetLastError(); + goto cleanup; + } + + if ((DevPropType != DEVPROP_TYPE_STRING) || + (RequiredSize < sizeof(WCHAR))) + { + Err = ERROR_INVALID_PARAMETER; + goto cleanup; + } + + ParentDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + + // + // Get the parent of the device we retrieved first, which is the device + // that called AddComponent in its INF. + // + if (!SetupDiOpenDeviceInfoW(DevInfoList, + ParentDeviceInstanceId, + NULL, + 0, + &ParentDevInfoData)) + { + Err = GetLastError(); + goto cleanup; + } + + // + // Open up the HW registry keys of the primary device. + // + DevRegKey = SetupDiOpenDevRegKey(DevInfoList, + &ParentDevInfoData, + DICS_FLAG_GLOBAL, + 0, + DIREG_DEV, + KEY_READ); + + if (DevRegKey == INVALID_HANDLE_VALUE) + { + Err = GetLastError(); + DevRegKey = NULL; + goto cleanup; + } + + Err = RegOpenKeyEx(DevRegKey, + DEVICE_REG_SUBKEY, + 0, + KEY_QUERY_VALUE, + &DevOsrRegKey); + + if (Err != ERROR_SUCCESS) + { + goto cleanup; + } + + // + // Retrieve the registry values defined in the primary device's INF. + // Note that if the extension INF was applied, the extension INF would + // overwrite OperatingParams and create OperatingExceptions. + // + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_MODE, + NULL, + &ValueType, + (LPBYTE)OperatingMode, + &ValueSize); + + while (Err == ERROR_MORE_DATA) + { + // + // Create a larger buffer. + // + OperatingMode = (PTSTR)realloc(OperatingMode, ValueSize); + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_MODE, + NULL, + &ValueType, + (LPBYTE)OperatingMode, + &ValueSize); + } + + if (Err != ERROR_SUCCESS) + { + OperatingMode[0] = TEXT('\0'); + } + else if ((ValueType != REG_SZ) || + (ValueSize < sizeof(TCHAR))) + { + Err = ERROR_REGISTRY_CORRUPT; + OperatingMode[0] = TEXT('\0'); + } + + ValueSize = BUFFER_SIZE; + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_PARAMS, + NULL, + &ValueType, + (LPBYTE)OperatingParams, + &ValueSize); + + while (Err == ERROR_MORE_DATA) + { + // + // Create a larger buffer. + // + OperatingParams = (PTSTR)realloc(OperatingParams, ValueSize); + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_MODE, + NULL, + &ValueType, + (LPBYTE)OperatingParams, + &ValueSize); + } + + if (Err != ERROR_SUCCESS) + { + OperatingParams[0] = TEXT('\0'); + } + else if ((ValueType != REG_SZ) || + (ValueSize < sizeof(TCHAR))) + { + Err = ERROR_REGISTRY_CORRUPT; + OperatingParams[0] = TEXT('\0'); + } + + ValueSize = BUFFER_SIZE; + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_EXCEPTIONS, + NULL, + &ValueType, + (LPBYTE)OperatingExceptions, + &ValueSize); + + while (Err == ERROR_MORE_DATA) + { + // + // Create a larger buffer. + // + OperatingExceptions = (PTSTR)realloc(OperatingExceptions, ValueSize); + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_EXCEPTIONS, + NULL, + &ValueType, + (LPBYTE)OperatingExceptions, + &ValueSize); + } + + if (Err != ERROR_SUCCESS) + { + OperatingExceptions[0] = TEXT('\0'); + } + else if ((ValueType != REG_SZ) || + (ValueSize < sizeof(TCHAR))) + { + Err = ERROR_REGISTRY_CORRUPT; + OperatingExceptions[0] = TEXT('\0'); + } + + FileTextLength = (DWORD)wcslen(OperatingMode) + + (DWORD)wcslen(OperatingParams) + + (DWORD)wcslen(OperatingExceptions) + + (DWORD)wcslen(FILE_CONTENT) - + 9; // Subtract the 3 %ws + + FileText = (PWSTR)malloc((FileTextLength + 1) * sizeof(WCHAR)); + + if (FileText == NULL) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + hr = StringCchPrintf(FileText, + FileTextLength + 1, + FILE_CONTENT, + OperatingMode, + OperatingParams, + OperatingExceptions); + + if (FAILED(hr)) + { + Err = HRESULT_CODE(hr); + goto cleanup; + } + + Err = WriteToFile(FileText, FileTextLength); + + if (Err != ERROR_SUCCESS) + { + goto cleanup; + } + +cleanup: + + if (FileText != NULL) + { + free(FileText); + } + + if (OperatingExceptions != NULL) + { + free(OperatingExceptions); + } + + if (OperatingParams != NULL) + { + free(OperatingParams); + } + + if (OperatingMode != NULL) + { + free(OperatingMode); + } + + if (DevOsrRegKey != NULL) + { + RegCloseKey(DevOsrRegKey); + } + + if (DevRegKey != NULL) + { + RegCloseKey(DevRegKey); + } + + if (DevInfoList != INVALID_HANDLE_VALUE) + { + SetupDiDestroyDeviceInfoList(DevInfoList); + } + + return; +} + diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters new file mode 100644 index 00000000..395438fa --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj new file mode 100644 index 00000000..32ebdebe --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj @@ -0,0 +1,169 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {26D91630-B8FF-4102-A258-32F7D1C84E20} + Win32Proj + osrfx2_DCHU_componentsoftware + 10.0.16245.0 + osrfx2_DCHU_componentsoftware + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + $(ProjectName) + + + false + + + false + $(ProjectName) + .exe + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + Console + true + onecoreuap.lib;setupapi.lib; + + + + + Use + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + Console + true + onecoreuap.lib;setupapi.lib; + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + onecoreuap.lib;setupapi.lib; + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + Console + true + true + true + onecoreuap.lib;setupapi.lib; + + + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.cpp b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.cpp new file mode 100644 index 00000000..79325e21 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// osrusbfx2umsoftware.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.h b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.h new file mode 100644 index 00000000..edb61924 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.h @@ -0,0 +1,18 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// TODO: reference additional headers your program requires here diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/targetver.h b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/targetver.h new file mode 100644 index 00000000..87c0086d --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension.sln b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension.sln new file mode 100644 index 00000000..6cc1d6b0 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension.sln @@ -0,0 +1,102 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.16 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_extension", "osrfx2_DCHU_extension", "{4577857A-CCAE-42EB-BDE2-16C1E3DC7B14}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_extension", "osrfx2_DCHU_extension\osrfx2_DCHU_extension.vcxproj", "{0588DF70-3923-42E6-8DC9-13C2C0186F20}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_component", "osrfx2_DCHU_component", "{E148C50E-31A6-423E-A867-526FD51DA164}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_component", "osrfx2_DCHU_component\osrfx2_DCHU_component.vcxproj", "{F90EFA96-B075-4531-B4E1-F406362D16BF}" + ProjectSection(ProjectDependencies) = postProject + {26D91630-B8FF-4102-A258-32F7D1C84E20} = {26D91630-B8FF-4102-A258-32F7D1C84E20} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_componentsoftware", "osrfx2_DCHU_componentsoftware", "{272BE7AA-9011-46FA-96C9-2051C9526476}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_componentsoftware", "osrfx2_DCHU_componentsoftware\osrfx2_DCHU_componentsoftware.vcxproj", "{26D91630-B8FF-4102-A258-32F7D1C84E20}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM.ActiveCfg = Debug|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM.Build.0 = Debug|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM.Deploy.0 = Debug|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM64.Build.0 = Debug|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x64.ActiveCfg = Debug|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x64.Build.0 = Debug|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x64.Deploy.0 = Debug|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x86.ActiveCfg = Debug|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x86.Build.0 = Debug|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x86.Deploy.0 = Debug|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM.ActiveCfg = Release|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM.Build.0 = Release|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM.Deploy.0 = Release|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM64.ActiveCfg = Release|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM64.Build.0 = Release|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM64.Deploy.0 = Release|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x64.ActiveCfg = Release|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x64.Build.0 = Release|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x64.Deploy.0 = Release|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x86.ActiveCfg = Release|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x86.Build.0 = Release|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x86.Deploy.0 = Release|Win32 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM.ActiveCfg = Debug|ARM + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM.Build.0 = Debug|ARM + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM.Deploy.0 = Debug|ARM + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM64.Build.0 = Debug|ARM64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x64.ActiveCfg = Debug|x64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x64.Build.0 = Debug|x64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x64.Deploy.0 = Debug|x64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x86.ActiveCfg = Debug|Win32 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x86.Build.0 = Debug|Win32 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Debug|x86.Deploy.0 = Debug|Win32 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM.ActiveCfg = Release|ARM + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM.Build.0 = Release|ARM + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM.Deploy.0 = Release|ARM + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM64.ActiveCfg = Release|ARM64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM64.Build.0 = Release|ARM64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|ARM64.Deploy.0 = Release|ARM64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x64.ActiveCfg = Release|x64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x64.Build.0 = Release|x64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x64.Deploy.0 = Release|x64 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x86.ActiveCfg = Release|Win32 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x86.Build.0 = Release|Win32 + {F90EFA96-B075-4531-B4E1-F406362D16BF}.Release|x86.Deploy.0 = Release|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|ARM.ActiveCfg = Debug|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|ARM64.ActiveCfg = Debug|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x64.ActiveCfg = Debug|x64 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x64.Build.0 = Debug|x64 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x86.ActiveCfg = Debug|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x86.Build.0 = Debug|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|ARM.ActiveCfg = Release|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|ARM64.ActiveCfg = Release|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x64.ActiveCfg = Release|x64 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x64.Build.0 = Release|x64 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x86.ActiveCfg = Release|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {0588DF70-3923-42E6-8DC9-13C2C0186F20} = {4577857A-CCAE-42EB-BDE2-16C1E3DC7B14} + {F90EFA96-B075-4531-B4E1-F406362D16BF} = {E148C50E-31A6-423E-A867-526FD51DA164} + {26D91630-B8FF-4102-A258-32F7D1C84E20} = {272BE7AA-9011-46FA-96C9-2051C9526476} + EndGlobalSection +EndGlobal diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters new file mode 100644 index 00000000..0ba1a59c --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters @@ -0,0 +1,14 @@ + + + + + {8E41214B-6785-4CFE-B992-037D68949A14} + inf;inv;inx;mof;mc; + + + + + Driver Files + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx new file mode 100644 index 00000000..660e5049 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx @@ -0,0 +1,54 @@ +;/*++ +; +;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: +; +; osrfx2_DCHU_extension.INF +; +;Abstract: +; +; Extension inf for the OSR FX2 Learning Kit +; +;--*/ + +[Version] +Signature = "$WINDOWS NT$" +Class = Extension +ClassGuid = {e2f84ce7-8efa-411c-aa69-97454ca4cb57} +Provider = %ManufacturerName% +ExtensionId = {3846ad8c-dd27-433d-ab89-453654cd542a} +CatalogFile = osrfx2_DCHU_extension.cat +DriverVer = 05/16/2017,15.14.36.721 + +[Manufacturer] +%ManufacturerName% = OsrFx2Extension, NT$ARCH$ + +[OsrFx2Extension.NT$ARCH$] +%OsrFx2.ExtensionDesc% = OsrFx2Extension_Install, USB\Vid_045e&Pid_94aa&mi_00 +%OsrFx2.ExtensionDesc% = OsrFx2Extension_Install, USB\Vid_0547&PID_1002 + +[OsrFx2Extension_Install.NT] +; Empty + +[OsrFx2Extension_Install.NT.HW] +AddReg = OsrFx2Extension_AddReg + +[OsrFx2Extension_AddReg] +HKR, OSR, "OperatingParams",, "-Extended" +HKR, OSR, "OperatingExceptions",, "x86" + +[OsrFx2Extension_Install.NT.Components] +AddComponent = osrfx2_DCHU_component,,OsrFx2Extension_ComponentInstall + +[OsrFx2Extension_ComponentInstall] +ComponentIds=VID_045e&PID_94ab + +[Strings] +ManufacturerName = "Contoso" +OsrFx2.ExtensionDesc = "OsrFx2 DCHU Device Extension" \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj new file mode 100644 index 00000000..bfc7ded6 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj @@ -0,0 +1,266 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + + + + + {0588DF70-3923-42E6-8DC9-13C2C0186F20} + {4605da2c-74a5-4865-98e1-152ef136825f} + v4.6.1 + 12.0 + Debug + Win32 + osrfx2_DCHU_extension + osrfx2_DCHU_extension + + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + + + + + + + + + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx new file mode 100644 index 00000000..8baab1a0 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_component/osrfx2_DCHU_component.inx @@ -0,0 +1,64 @@ +;/*++ +; +;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: +; +; osrfx2_DCHU_component.INF +; +;Abstract: +; +; Installation inf for one of the OSR FX2 Learning Kit's +; AddComponent directives +; +;--*/ + +[Version] +Signature = "$Windows NT$" +Class = SoftwareComponent +ClassGuid = {5c4c3332-344d-483c-8739-259e934c9cc8} +Provider = %ManufacturerName% +CatalogFile = osrfx2_DCHU_component.cat + +[Manufacturer] +%ManufacturerName% = OsrFx2Component, NT$ARCH$ + +[OsrFx2Component.NT$ARCH$] +%DeviceName% = OsrFx2Component_Install, SWC\VID_045e&PID_94ab + +[SourceDisksFiles] +osrfx2_DCHU_componentsoftware.exe = 1 + +[SourceDisksNames] +1 = %DiskName% + +[DestinationDirs] +OsrFx2Component_CopyFiles = 13 ; copy to driverstore + +[OsrFx2Component_Install.NT] +CopyFiles = OsrFx2Component_CopyFiles + +[OsrFx2Component_Install.NT.Services] +AddService = , 0x00000002 + +[OsrFx2Component_Install.NT.Software] +AddSoftware = osrfx2_DCHU_componentsoftware,, OsrFx2Component_SoftwareInstall + +[OsrFx2Component_SoftwareInstall] +SoftwareType = 1 +SoftwareBinary = osrfx2_DCHU_componentsoftware.exe +SoftwareArguments = <> +SoftwareVersion = 1.0.0.0 + +[OsrFx2Component_CopyFiles] +osrfx2_DCHU_componentsoftware.exe + +[Strings] +ManufacturerName = "Contoso" +DiskName = "OsrFx2 DCHU Component Installation Disk" +DeviceName = "OsrFx2 DCHU Component Device" \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp new file mode 100644 index 00000000..c14e66d1 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp @@ -0,0 +1,489 @@ +/*++ + +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: + + osrfx2_DCHU_componentsoftware.cpp + +Abstract: + + An example .exe to run using the AddSoftware directive within an INF. + Contains an example on how to obtain a handle to the primary device using + SoftwareArguments within an AddSoftware directive's section. + +Environment: + + User mode + +--*/ + +#include "stdafx.h" + +#define BUFFER_SIZE (128 * sizeof(WCHAR)) +#define DEVICE_REG_SUBKEY L"OSR" +#define DEVICE_VALUE_OP_MODE L"OperatingMode" +#define DEVICE_VALUE_OP_PARAMS L"OperatingParams" +#define DEVICE_VALUE_OP_EXCEPTIONS L"OperatingExceptions" +#define CONTOSO_FILEPATH L"C:\\Program Files\\Contoso" +#define OSRFX2_DCHU_FILEPATH L"C:\\Program Files\\Contoso\\OsrFx2_DCHU" +#define FILEPATH L"C:\\Program Files\\Contoso\\OsrFx2_DCHU\\AddSoftwareInstallationFile.txt" +#define FILE_CONTENT L"Operating Mode: %ws\r\nOperating Params: %ws\r\nOperating Exceptions: %ws" + + +/*++ + +Routine Description: + +Arguments: + +Return Value: + + +--*/ +DWORD +WriteToFile( + _In_ PWSTR MessageText, + _In_ DWORD MessageTextLength + ) +{ + DWORD Err = ERROR_SUCCESS; + BOOL ErrorFlag = FALSE; + HANDLE hFile = INVALID_HANDLE_VALUE; + DWORD BytesToWrite; + DWORD BytesWritten; + + if (!CreateDirectory(CONTOSO_FILEPATH, NULL)) + { + Err = GetLastError(); + + if (Err == ERROR_ALREADY_EXISTS) + { + Err = ERROR_SUCCESS; + } + else + { + goto cleanup; + } + } + + if (!CreateDirectory(OSRFX2_DCHU_FILEPATH, NULL)) + { + Err = GetLastError(); + + if (Err == ERROR_ALREADY_EXISTS) + { + Err = ERROR_SUCCESS; + } + else + { + goto cleanup; + } + } + + hFile = CreateFile(FILEPATH, + GENERIC_WRITE, + 0, + NULL, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (hFile == INVALID_HANDLE_VALUE) + { + Err = ERROR_INVALID_PARAMETER; + goto cleanup; + } + + BytesToWrite = MessageTextLength * sizeof(WCHAR); + + ErrorFlag = WriteFile(hFile, + MessageText, + BytesToWrite, + &BytesWritten, + NULL); + + if ((!ErrorFlag) || + (BytesToWrite != BytesWritten)) + { + Err = GetLastError(); + goto cleanup; + } + +cleanup: + + if (hFile != INVALID_HANDLE_VALUE) + { + CloseHandle(hFile); + } + + return Err; +} + + +/*++ + +Routine Description: + + Obtains the handle to the device that used a separate Software Component + INF to install software. + +Arguments: + + Argc - The number of command line arguments + + Argv - The array of command line arguments + +Return Value: + + VOID + +--*/ +VOID +__cdecl +_tmain( + INT Argc, + TCHAR *Argv[]) +{ + DWORD Err = ERROR_SUCCESS; + HRESULT hr = S_OK; + BOOL ErrorFlag = FALSE; + DWORD BytesToWrite = 0; + DWORD BytesWritten = 0; + PTSTR DeviceInstanceId; + HDEVINFO DevInfoList = INVALID_HANDLE_VALUE; + SP_DEVINFO_DATA DevInfoData; + WCHAR ParentDeviceInstanceId[MAX_DEVICE_ID_LEN]; + DWORD RequiredSize; + DEVPROPTYPE DevPropType; + SP_DEVINFO_DATA ParentDevInfoData; + HKEY DevRegKey = NULL; + PWSTR OperatingMode = NULL; + PWSTR OperatingParams = NULL; + PWSTR OperatingExceptions = NULL; + DWORD ValueType; + DWORD ValueSize = BUFFER_SIZE; + HKEY DevOsrRegKey = NULL; + PWSTR FileText = NULL; + DWORD FileTextLength; + + // + // Validate arguments. + // + if (Argc != 2) + { + Err = ERROR_INVALID_PARAMETER; + goto cleanup; + } + + OperatingMode = (PWSTR)malloc(BUFFER_SIZE * sizeof(WCHAR)); + + if (OperatingMode == NULL) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + OperatingParams = (PWSTR)malloc(BUFFER_SIZE * sizeof(WCHAR)); + + if (OperatingParams == NULL) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + OperatingExceptions = (PWSTR)malloc(BUFFER_SIZE * sizeof(WCHAR)); + + if (OperatingExceptions == NULL) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + // + // Argv[1] should be the device instance ID. + // + DeviceInstanceId = Argv[1]; + + // + // Create a device info list to store queried device handles. + // + DevInfoList = SetupDiCreateDeviceInfoList(NULL, NULL); + + if (DevInfoList == INVALID_HANDLE_VALUE) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + + // + // Add the Software Component device that called AddSoftware to the + // device info list, which will be used to find the primary device that + // called AddComponent in the first place. + // + if (!SetupDiOpenDeviceInfo(DevInfoList, + DeviceInstanceId, + NULL, + 0, + &DevInfoData)) + { + Err = GetLastError(); + goto cleanup; + } + + // + // Get the device instance id of the opened device's parent. + // + if (!SetupDiGetDeviceProperty(DevInfoList, + &DevInfoData, + &DEVPKEY_Device_Parent, + &DevPropType, + (PBYTE)ParentDeviceInstanceId, + sizeof(ParentDeviceInstanceId), + &RequiredSize, + 0)) + { + Err = GetLastError(); + goto cleanup; + } + + if ((DevPropType != DEVPROP_TYPE_STRING) || + (RequiredSize < sizeof(WCHAR))) + { + Err = ERROR_INVALID_PARAMETER; + goto cleanup; + } + + ParentDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + + // + // Get the parent of the device we retrieved first, which is the device + // that called AddComponent in its INF. + // + if (!SetupDiOpenDeviceInfoW(DevInfoList, + ParentDeviceInstanceId, + NULL, + 0, + &ParentDevInfoData)) + { + Err = GetLastError(); + goto cleanup; + } + + // + // Open up the HW registry keys of the primary device. + // + DevRegKey = SetupDiOpenDevRegKey(DevInfoList, + &ParentDevInfoData, + DICS_FLAG_GLOBAL, + 0, + DIREG_DEV, + KEY_READ); + + if (DevRegKey == INVALID_HANDLE_VALUE) + { + Err = GetLastError(); + DevRegKey = NULL; + goto cleanup; + } + + Err = RegOpenKeyEx(DevRegKey, + DEVICE_REG_SUBKEY, + 0, + KEY_QUERY_VALUE, + &DevOsrRegKey); + + if (Err != ERROR_SUCCESS) + { + goto cleanup; + } + + // + // Retrieve the registry values defined in the primary device's INF. + // Note that if the extension INF was applied, the extension INF would + // overwrite OperatingParams and create OperatingExceptions. + // + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_MODE, + NULL, + &ValueType, + (LPBYTE)OperatingMode, + &ValueSize); + + while (Err == ERROR_MORE_DATA) + { + // + // Create a larger buffer. + // + OperatingMode = (PTSTR)realloc(OperatingMode, ValueSize); + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_MODE, + NULL, + &ValueType, + (LPBYTE)OperatingMode, + &ValueSize); + } + + if (Err != ERROR_SUCCESS) + { + OperatingMode[0] = TEXT('\0'); + } + else if ((ValueType != REG_SZ) || + (ValueSize < sizeof(TCHAR))) + { + Err = ERROR_REGISTRY_CORRUPT; + OperatingMode[0] = TEXT('\0'); + } + + ValueSize = BUFFER_SIZE; + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_PARAMS, + NULL, + &ValueType, + (LPBYTE)OperatingParams, + &ValueSize); + + while (Err == ERROR_MORE_DATA) + { + // + // Create a larger buffer. + // + OperatingParams = (PTSTR)realloc(OperatingParams, ValueSize); + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_MODE, + NULL, + &ValueType, + (LPBYTE)OperatingParams, + &ValueSize); + } + + if (Err != ERROR_SUCCESS) + { + OperatingParams[0] = TEXT('\0'); + } + else if ((ValueType != REG_SZ) || + (ValueSize < sizeof(TCHAR))) + { + Err = ERROR_REGISTRY_CORRUPT; + OperatingParams[0] = TEXT('\0'); + } + + ValueSize = BUFFER_SIZE; + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_EXCEPTIONS, + NULL, + &ValueType, + (LPBYTE)OperatingExceptions, + &ValueSize); + + while (Err == ERROR_MORE_DATA) + { + // + // Create a larger buffer. + // + OperatingExceptions = (PTSTR)realloc(OperatingExceptions, ValueSize); + + Err = RegQueryValueEx(DevOsrRegKey, + DEVICE_VALUE_OP_EXCEPTIONS, + NULL, + &ValueType, + (LPBYTE)OperatingExceptions, + &ValueSize); + } + + if (Err != ERROR_SUCCESS) + { + OperatingExceptions[0] = TEXT('\0'); + } + else if ((ValueType != REG_SZ) || + (ValueSize < sizeof(TCHAR))) + { + Err = ERROR_REGISTRY_CORRUPT; + OperatingExceptions[0] = TEXT('\0'); + } + + FileTextLength = (DWORD)wcslen(OperatingMode) + + (DWORD)wcslen(OperatingParams) + + (DWORD)wcslen(OperatingExceptions) + + (DWORD)wcslen(FILE_CONTENT) - + 9; // Subtract the 3 %ws + + FileText = (PWSTR)malloc((FileTextLength + 1) * sizeof(WCHAR)); + + if (FileText == NULL) + { + Err = ERROR_OUTOFMEMORY; + goto cleanup; + } + + hr = StringCchPrintf(FileText, + FileTextLength + 1, + FILE_CONTENT, + OperatingMode, + OperatingParams, + OperatingExceptions); + + if (FAILED(hr)) + { + Err = HRESULT_CODE(hr); + goto cleanup; + } + + Err = WriteToFile(FileText, FileTextLength); + + if (Err != ERROR_SUCCESS) + { + goto cleanup; + } + +cleanup: + + if (FileText != NULL) + { + free(FileText); + } + + if (OperatingExceptions != NULL) + { + free(OperatingExceptions); + } + + if (OperatingParams != NULL) + { + free(OperatingParams); + } + + if (OperatingMode != NULL) + { + free(OperatingMode); + } + + if (DevOsrRegKey != NULL) + { + RegCloseKey(DevOsrRegKey); + } + + if (DevRegKey != NULL) + { + RegCloseKey(DevRegKey); + } + + if (DevInfoList != INVALID_HANDLE_VALUE) + { + SetupDiDestroyDeviceInfoList(DevInfoList); + } + + return; +} + diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters new file mode 100644 index 00000000..395438fa --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj new file mode 100644 index 00000000..32ebdebe --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj @@ -0,0 +1,169 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {26D91630-B8FF-4102-A258-32F7D1C84E20} + Win32Proj + osrfx2_DCHU_componentsoftware + 10.0.16245.0 + osrfx2_DCHU_componentsoftware + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + $(ProjectName) + + + false + + + false + $(ProjectName) + .exe + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + Console + true + onecoreuap.lib;setupapi.lib; + + + + + Use + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + Console + true + onecoreuap.lib;setupapi.lib; + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + onecoreuap.lib;setupapi.lib; + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + Console + true + true + true + onecoreuap.lib;setupapi.lib; + + + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/stdafx.cpp b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/stdafx.cpp new file mode 100644 index 00000000..79325e21 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// osrusbfx2umsoftware.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/stdafx.h b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/stdafx.h new file mode 100644 index 00000000..edb61924 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/stdafx.h @@ -0,0 +1,18 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// TODO: reference additional headers your program requires here diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/targetver.h b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/targetver.h new file mode 100644 index 00000000..87c0086d --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension.sln b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension.sln new file mode 100644 index 00000000..40b15034 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension.sln @@ -0,0 +1,73 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.16 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_extension", "osrfx2_DCHU_extension", "{4577857A-CCAE-42EB-BDE2-16C1E3DC7B14}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_extension", "osrfx2_DCHU_extension\osrfx2_DCHU_extension.vcxproj", "{0588DF70-3923-42E6-8DC9-13C2C0186F20}" + ProjectSection(ProjectDependencies) = postProject + {26D91630-B8FF-4102-A258-32F7D1C84E20} = {26D91630-B8FF-4102-A258-32F7D1C84E20} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_componentsoftware", "osrfx2_DCHU_componentsoftware", "{B327FC27-5816-4F28-959F-4C35F1D22678}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_componentsoftware", "osrfx2_DCHU_componentsoftware\osrfx2_DCHU_componentsoftware.vcxproj", "{26D91630-B8FF-4102-A258-32F7D1C84E20}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM.ActiveCfg = Debug|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM.Build.0 = Debug|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM.Deploy.0 = Debug|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM64.Build.0 = Debug|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x64.ActiveCfg = Debug|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x64.Build.0 = Debug|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x64.Deploy.0 = Debug|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x86.ActiveCfg = Debug|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x86.Build.0 = Debug|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Debug|x86.Deploy.0 = Debug|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM.ActiveCfg = Release|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM.Build.0 = Release|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM.Deploy.0 = Release|ARM + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM64.ActiveCfg = Release|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM64.Build.0 = Release|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|ARM64.Deploy.0 = Release|ARM64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x64.ActiveCfg = Release|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x64.Build.0 = Release|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x64.Deploy.0 = Release|x64 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x86.ActiveCfg = Release|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x86.Build.0 = Release|Win32 + {0588DF70-3923-42E6-8DC9-13C2C0186F20}.Release|x86.Deploy.0 = Release|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|ARM.ActiveCfg = Debug|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|ARM64.ActiveCfg = Debug|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x64.ActiveCfg = Debug|x64 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x64.Build.0 = Debug|x64 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x86.ActiveCfg = Debug|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Debug|x86.Build.0 = Debug|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|ARM.ActiveCfg = Release|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|ARM64.ActiveCfg = Release|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x64.ActiveCfg = Release|x64 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x64.Build.0 = Release|x64 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x86.ActiveCfg = Release|Win32 + {26D91630-B8FF-4102-A258-32F7D1C84E20}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {0588DF70-3923-42E6-8DC9-13C2C0186F20} = {4577857A-CCAE-42EB-BDE2-16C1E3DC7B14} + {26D91630-B8FF-4102-A258-32F7D1C84E20} = {B327FC27-5816-4F28-959F-4C35F1D22678} + EndGlobalSection +EndGlobal diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters new file mode 100644 index 00000000..0ba1a59c --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters @@ -0,0 +1,14 @@ + + + + + {8E41214B-6785-4CFE-B992-037D68949A14} + inf;inv;inx;mof;mc; + + + + + Driver Files + + + \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx new file mode 100644 index 00000000..d6bc7e00 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx @@ -0,0 +1,55 @@ +;/*++ +; +;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: +; +; osrfx2_DCHU_extension.INF +; +;Abstract: +; +; Extension inf for the OSR FX2 Learning Kit +; +;--*/ + +[Version] +Signature = "$WINDOWS NT$" +Class = Extension +ClassGuid = {e2f84ce7-8efa-411c-aa69-97454ca4cb57} +Provider = %ManufacturerName% +ExtensionId = {3846ad8c-dd27-433d-ab89-453654cd542a} +CatalogFile = osrfx2_DCHU_extension.cat +DriverVer = 05/16/2017,15.14.36.721 + +[Manufacturer] +%ManufacturerName% = OsrFx2Extension, NT$ARCH$ + +[OsrFx2Extension.NT$ARCH$] +%OsrFx2.ExtensionDesc% = OsrFx2Extension_Install, USB\Vid_045e&Pid_94aa&mi_00 +%OsrFx2.ExtensionDesc% = OsrFx2Extension_Install, USB\Vid_0547&PID_1002 + +[OsrFx2Extension_Install.NT] +CopyInf=osrfx2_DCHU_component.inf + +[OsrFx2Extension_Install.NT.HW] +AddReg = OsrFx2Extension_AddReg +AddReg = OsrFx2Extension_COMAddReg + +[OsrFx2Extension_AddReg] +HKR, OSR, "OperatingParams",, "-Extended" +HKR, OSR, "OperatingExceptions",, "x86" + +[OsrFx2Extension_Install.NT.Components] +AddComponent = osrfx2_DCHU_component,,OsrFx2Extension_ComponentInstall + +[OsrFx2Extension_ComponentInstall] +ComponentIds=VID_045e&PID_94ab + +[Strings] +ManufacturerName = "Contoso" +OsrFx2.ExtensionDesc = "OsrFx2 DCHU Device Extension" \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj new file mode 100644 index 00000000..4542c3a7 --- /dev/null +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj @@ -0,0 +1,273 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + + + + + + + + + + + + {0588DF70-3923-42E6-8DC9-13C2C0186F20} + {4605da2c-74a5-4865-98e1-152ef136825f} + v4.6.1 + 12.0 + Debug + Win32 + osrfx2_DCHU_extension + osrfx2_DCHU_extension + + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + Universal + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + + + Windows10 + true + WindowsKernelModeDriver10.0 + Utility + Package + true + + + Windows10 + false + WindowsKernelModeDriver10.0 + Utility + Package + true + + + + + + + + + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + DbgengRemoteDebugger + + + + False + False + True + + 133563 + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + $(InfArch) + 1.0.0.0 + + + + + + \ No newline at end of file -- cgit v1.3.1 From 022a2da881f19f740d5b86122360de6015b2b0b6 Mon Sep 17 00:00:00 2001 From: Matthew Montera Date: Tue, 22 Aug 2017 11:43:26 -0700 Subject: Fixed project settings Fixed project settings and removed a debugbreak that I had missed. --- .../osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj | 6 +++--- .../osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj | 6 +++--- .../osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj | 6 +++--- general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp | 4 +--- .../osrfx2_DCHU_componentsoftware.vcxproj | 14 +++++++------- .../osrfx2_DCHU_componentsoftware.vcxproj | 14 +++++++------- 6 files changed, 24 insertions(+), 26 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj index 4cfeed87..0c4dec56 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_base/osrfx2_DCHU_base.vcxproj @@ -42,7 +42,7 @@ True Universal UMDF - v140 + WindowsUserModeDriver10.0 DynamicLibrary @@ -50,7 +50,7 @@ False Universal UMDF - v140 + WindowsUserModeDriver10.0 DynamicLibrary @@ -58,7 +58,7 @@ True Universal UMDF - v140 + WindowsUserModeDriver10.0 DynamicLibrary diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj index 5e015f80..36d85583 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_filter/osrfx2_DCHU_filter.vcxproj @@ -44,7 +44,7 @@ True Universal UMDF - v140 + WindowsUserModeDriver10.0 DynamicLibrary @@ -52,7 +52,7 @@ False Universal UMDF - v140 + WindowsUserModeDriver10.0 DynamicLibrary @@ -60,7 +60,7 @@ True Universal UMDF - v140 + WindowsUserModeDriver10.0 DynamicLibrary diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj index 9ac1e4f3..225dcde2 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_testapp/osrusbfx2.vcxproj @@ -41,7 +41,7 @@ True Universal - v140 + WindowsApplicationForDrivers10.0 Application @@ -49,7 +49,7 @@ False Universal - v140 + WindowsApplicationForDrivers10.0 Application @@ -57,7 +57,7 @@ True Universal - v140 + WindowsApplicationForDrivers10.0 Application diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp index e9d24c1b..6484f834 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp @@ -678,9 +678,7 @@ DeviceRemoveCompleteAction( PHANDLE_CONTEXT Context ) { - __debugbreak(); - - DWORD Err = ERROR_SUCCESS; + DWORD Err = ERROR_SUCCESS; EnterCriticalSection(&Context->Lock); diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj index 32ebdebe..931646bb 100644 --- a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj @@ -22,34 +22,34 @@ {26D91630-B8FF-4102-A258-32F7D1C84E20} Win32Proj osrfx2_DCHU_componentsoftware - 10.0.16245.0 + 10.0.15063.0 osrfx2_DCHU_componentsoftware Application true - v141 + v140 Unicode Application false - v141 - true + v140 + false Unicode Application true - v141 + v140 Unicode Application false - v141 - true + v140 + false Unicode diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj index 32ebdebe..931646bb 100644 --- a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj @@ -22,34 +22,34 @@ {26D91630-B8FF-4102-A258-32F7D1C84E20} Win32Proj osrfx2_DCHU_componentsoftware - 10.0.16245.0 + 10.0.15063.0 osrfx2_DCHU_componentsoftware Application true - v141 + v140 Unicode Application false - v141 - true + v140 + false Unicode Application true - v141 + v140 Unicode Application false - v141 - true + v140 + false Unicode -- cgit v1.3.1 From 5f434058994bb32f63ca2578847be9c6388dd9c2 Mon Sep 17 00:00:00 2001 From: Matthew Montera Date: Tue, 22 Aug 2017 11:47:36 -0700 Subject: debugbreak removed another debugbreak --- general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp index 0a246eb4..5a59319b 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp @@ -261,8 +261,6 @@ Return Value: VOID CSampleService::OnStop() { - __debugbreak(); - // // Log a service stop message to the Application log. // -- cgit v1.3.1 From 0ee60f8f25486045aed0bf4b47a483b000c9cf98 Mon Sep 17 00:00:00 2001 From: Barry Golden Date: Thu, 24 Aug 2017 20:04:35 -0700 Subject: VSTS 12737998 --- README.md | 4 ++++ audio/sysvad/README.md | 9 +++++++++ avstream/avscamera/README.md | 9 +++++++++ avstream/avshws/README.md | 9 +++++++++ avstream/avssamp/README.md | 9 +++++++++ avstream/samplemft0/README.md | 9 +++++++++ biometrics/README.md | 10 ++++++++++ bluetooth/bthecho/README.md | 9 +++++++++ bluetooth/serialhcibus/README.md | 9 +++++++++ filesys/cdfs/README.md | 10 ++++++++++ filesys/fastfat/README.md | 11 +++++++++++ filesys/miniFilter/MetadataManager/README.md | 10 ++++++++++ filesys/miniFilter/NameChanger/README.md | 10 ++++++++++ filesys/miniFilter/avscan/README.md | 10 ++++++++++ filesys/miniFilter/cancelSafe/README.md | 10 ++++++++++ filesys/miniFilter/cdo/README.md | 10 ++++++++++ filesys/miniFilter/change/README.md | 10 ++++++++++ filesys/miniFilter/ctx/README.md | 10 ++++++++++ filesys/miniFilter/delete/README.md | 9 +++++++++ filesys/miniFilter/minispy/README.md | 10 ++++++++++ filesys/miniFilter/nullFilter/README.md | 9 +++++++++ filesys/miniFilter/passThrough/README.md | 10 ++++++++++ filesys/miniFilter/scanner/README.md | 10 ++++++++++ filesys/miniFilter/simrep/README.md | 10 ++++++++++ filesys/miniFilter/swapBuffers/README.md | 10 ++++++++++ general/DCHU/README.md | 10 ++++++++++ general/PLX9x5x/README.md | 10 ++++++++++ general/SystemDma/wdm/README.md | 10 ++++++++++ general/cancel/README.md | 10 ++++++++++ general/echo/kmdf/README.md | 10 ++++++++++ general/echo/umdf/README.md | 10 ++++++++++ general/echo/umdf2/README.md | 9 +++++++++ general/echo/umdfSocketEcho/README.md | 10 ++++++++++ general/event/README.md | 10 ++++++++++ general/filehistory/README.md | 10 ++++++++++ general/installwdf/README.md | 10 ++++++++++ general/ioctl/kmdf/README.md | 10 ++++++++++ general/ioctl/wdm/README.md | 10 ++++++++++ general/obcallback/README.md | 10 ++++++++++ general/pcidrv/README.md | 10 ++++++++++ general/perfcounters/kcs/README.md | 10 ++++++++++ general/registry/regfltr/README.md | 10 ++++++++++ general/toaster/toastDrv/README.md | 10 ++++++++++ general/toaster/toastpkg/README.md | 14 ++++++++++++-- general/toaster/umdf2/README.md | 10 ++++++++++ general/tracing/SystemTraceControl/README.md | 10 ++++++++++ general/tracing/evntdrv/README.md | 10 ++++++++++ general/tracing/tracedriver/README.md | 10 ++++++++++ general/umdfSkeleton/README.md | 10 ++++++++++ gpio/samples/README.md | 10 ++++++++++ hid/firefly/README.md | 10 ++++++++++ hid/hclient/README.md | 10 ++++++++++ hid/hidusbfx2/README.md | 11 +++++++++++ hid/vhidmini2/README.md | 11 ++++++++++- input/hiddigi/SynapticsTouch/README.md | 19 ++++++++++--------- input/kbfiltr/README.md | 10 ++++++++++ input/layout/README.md | 10 ++++++++++ input/moufiltr/README.md | 10 ++++++++++ 58 files changed, 568 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 190349c2..67fc57bd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ + + # Driver samples for Windows 10 These are the official Microsoft Windows Driver Kit (WDK) team driver code samples for Windows 10. They provide a foundation for Universal Windows driver support of all hardware form factors, from phones to desktop PCs. Use these samples with Visual Studio 2015 and Windows Driver Kit (WDK) 10. diff --git a/audio/sysvad/README.md b/audio/sysvad/README.md index 9dfc0193..8a5c7709 100644 --- a/audio/sysvad/README.md +++ b/audio/sysvad/README.md @@ -1,3 +1,12 @@ + + SysVAD Virtual Audio Device Driver Sample ======================================== diff --git a/avstream/avscamera/README.md b/avstream/avscamera/README.md index e6f79be6..ef956c88 100644 --- a/avstream/avscamera/README.md +++ b/avstream/avscamera/README.md @@ -1,3 +1,12 @@ + + AvsCamera: AVStream Camera Sample Driver ======================================== The AvsCamera sample provides a pin-centric AVStream capture driver for a simulated front and back camera. The driver performs simulated captures at 320x240 or 640x480 in RGB24, RGB32, YUY2 and NV12 formats at various frame rates. The purpose of the sample is to demonstrate how to write a fully functional AVStream camera driver. diff --git a/avstream/avshws/README.md b/avstream/avshws/README.md index 240f9b6c..19019304 100644 --- a/avstream/avshws/README.md +++ b/avstream/avshws/README.md @@ -1,3 +1,12 @@ + + AVStream simulated hardware sample driver (Avshws) ================================================== diff --git a/avstream/avssamp/README.md b/avstream/avssamp/README.md index 6188c5b3..979dda3c 100644 --- a/avstream/avssamp/README.md +++ b/avstream/avssamp/README.md @@ -1,3 +1,12 @@ + + AVStream filter-centric simulated capture sample driver (Avssamp) ================================================================= diff --git a/avstream/samplemft0/README.md b/avstream/samplemft0/README.md index 7f6e50f6..42f23db4 100644 --- a/avstream/samplemft0/README.md +++ b/avstream/samplemft0/README.md @@ -1,3 +1,12 @@ + + Driver MFT Sample ================= diff --git a/biometrics/README.md b/biometrics/README.md index 0a366501..102a94b8 100644 --- a/biometrics/README.md +++ b/biometrics/README.md @@ -1,3 +1,13 @@ + + + Windows Biometric Driver Samples (UMDF Version 1) ================================================= diff --git a/bluetooth/bthecho/README.md b/bluetooth/bthecho/README.md index 6c1a7a2f..be465a7e 100644 --- a/bluetooth/bthecho/README.md +++ b/bluetooth/bthecho/README.md @@ -1,3 +1,12 @@ + + Bluetooth Echo L2CAP Profile Driver =================================== diff --git a/bluetooth/serialhcibus/README.md b/bluetooth/serialhcibus/README.md index 45f56512..9fc965b6 100644 --- a/bluetooth/serialhcibus/README.md +++ b/bluetooth/serialhcibus/README.md @@ -1,3 +1,12 @@ + + Bluetooth Serial HCI Bus Driver =============================== diff --git a/filesys/cdfs/README.md b/filesys/cdfs/README.md index 601b22bf..cbe8e4c4 100644 --- a/filesys/cdfs/README.md +++ b/filesys/cdfs/README.md @@ -1,3 +1,13 @@ + + + CDFS File System Driver ======================= diff --git a/filesys/fastfat/README.md b/filesys/fastfat/README.md index c5ef6b75..801e3f73 100644 --- a/filesys/fastfat/README.md +++ b/filesys/fastfat/README.md @@ -1,3 +1,14 @@ + + + + fastfat File System Driver ========================== diff --git a/filesys/miniFilter/MetadataManager/README.md b/filesys/miniFilter/MetadataManager/README.md index 6df7bd91..2c56f719 100644 --- a/filesys/miniFilter/MetadataManager/README.md +++ b/filesys/miniFilter/MetadataManager/README.md @@ -1,3 +1,13 @@ + + + Metadata Manager File System Minifilter Driver ============================================== diff --git a/filesys/miniFilter/NameChanger/README.md b/filesys/miniFilter/NameChanger/README.md index 9a2e9929..71b857ef 100644 --- a/filesys/miniFilter/NameChanger/README.md +++ b/filesys/miniFilter/NameChanger/README.md @@ -1,3 +1,13 @@ + + + NameChanger File System Minifilter Driver ========================================= diff --git a/filesys/miniFilter/avscan/README.md b/filesys/miniFilter/avscan/README.md index 31954fec..d1159670 100644 --- a/filesys/miniFilter/avscan/README.md +++ b/filesys/miniFilter/avscan/README.md @@ -1,3 +1,13 @@ + + + AvScan File System Minifilter Driver ==================================== diff --git a/filesys/miniFilter/cancelSafe/README.md b/filesys/miniFilter/cancelSafe/README.md index c8cacf28..3e4c7b06 100644 --- a/filesys/miniFilter/cancelSafe/README.md +++ b/filesys/miniFilter/cancelSafe/README.md @@ -1,3 +1,13 @@ + + + CancelSafe File System Minifilter Driver ======================================== diff --git a/filesys/miniFilter/cdo/README.md b/filesys/miniFilter/cdo/README.md index 4f37890f..4a0fb6d9 100644 --- a/filesys/miniFilter/cdo/README.md +++ b/filesys/miniFilter/cdo/README.md @@ -1,3 +1,13 @@ + + + CDO File System Minifilter Driver ================================= diff --git a/filesys/miniFilter/change/README.md b/filesys/miniFilter/change/README.md index 6d541083..3e4af1db 100644 --- a/filesys/miniFilter/change/README.md +++ b/filesys/miniFilter/change/README.md @@ -1,3 +1,13 @@ + + + Change File System Minifilter Driver ==================================== diff --git a/filesys/miniFilter/ctx/README.md b/filesys/miniFilter/ctx/README.md index 7609985a..326c9221 100644 --- a/filesys/miniFilter/ctx/README.md +++ b/filesys/miniFilter/ctx/README.md @@ -1,3 +1,13 @@ + + + Ctx File System Minifilter Driver ================================= diff --git a/filesys/miniFilter/delete/README.md b/filesys/miniFilter/delete/README.md index ad60db1a..b56eded0 100644 --- a/filesys/miniFilter/delete/README.md +++ b/filesys/miniFilter/delete/README.md @@ -1,3 +1,12 @@ + + Delete File System Minifilter Driver ==================================== diff --git a/filesys/miniFilter/minispy/README.md b/filesys/miniFilter/minispy/README.md index ca3749d3..075675b7 100644 --- a/filesys/miniFilter/minispy/README.md +++ b/filesys/miniFilter/minispy/README.md @@ -1,3 +1,13 @@ + + + Minispy File System Minifilter Driver ===================================== diff --git a/filesys/miniFilter/nullFilter/README.md b/filesys/miniFilter/nullFilter/README.md index 06d825eb..e0c2ff2e 100644 --- a/filesys/miniFilter/nullFilter/README.md +++ b/filesys/miniFilter/nullFilter/README.md @@ -1,3 +1,12 @@ + + NullFilter File System Minifilter Driver ======================================== diff --git a/filesys/miniFilter/passThrough/README.md b/filesys/miniFilter/passThrough/README.md index 91230df5..7400c146 100644 --- a/filesys/miniFilter/passThrough/README.md +++ b/filesys/miniFilter/passThrough/README.md @@ -1,3 +1,13 @@ + + + PassThrough File System Minifilter Driver ========================================= diff --git a/filesys/miniFilter/scanner/README.md b/filesys/miniFilter/scanner/README.md index 46009e9a..eb9d2bcd 100644 --- a/filesys/miniFilter/scanner/README.md +++ b/filesys/miniFilter/scanner/README.md @@ -1,3 +1,13 @@ + + + Scanner File System Minifilter Driver ===================================== diff --git a/filesys/miniFilter/simrep/README.md b/filesys/miniFilter/simrep/README.md index fcf31965..df02b1f5 100644 --- a/filesys/miniFilter/simrep/README.md +++ b/filesys/miniFilter/simrep/README.md @@ -1,3 +1,13 @@ + + + SimRep File System Minifilter Driver ==================================== diff --git a/filesys/miniFilter/swapBuffers/README.md b/filesys/miniFilter/swapBuffers/README.md index e57b38a5..f2c48181 100644 --- a/filesys/miniFilter/swapBuffers/README.md +++ b/filesys/miniFilter/swapBuffers/README.md @@ -1,3 +1,13 @@ + + + SwapBuffer File System Minifilter Driver ======================================== diff --git a/general/DCHU/README.md b/general/DCHU/README.md index df571af6..7311db0c 100644 --- a/general/DCHU/README.md +++ b/general/DCHU/README.md @@ -1,3 +1,13 @@ + + + # Driver package installation toolkit for universal drivers This sample illustrates the DCHU principles of universal driver design. The sample uses the [OSR FX2 learning kit](http://store.osr.com/product/osr-usb-fx2-learning-kit-v2/). For a detailed code walkthrough, see [Universal Driver Scenarios](https://docs.microsoft.com/windows-hardware/drivers/develop/universal-driver-scenarios). diff --git a/general/PLX9x5x/README.md b/general/PLX9x5x/README.md index a706b7d0..e665839b 100644 --- a/general/PLX9x5x/README.md +++ b/general/PLX9x5x/README.md @@ -1,3 +1,13 @@ + + + PLX9x5x PCI Driver ================== diff --git a/general/SystemDma/wdm/README.md b/general/SystemDma/wdm/README.md index a077fe8d..ad7d9dbc 100644 --- a/general/SystemDma/wdm/README.md +++ b/general/SystemDma/wdm/README.md @@ -1,3 +1,13 @@ + + + System DMA ========== diff --git a/general/cancel/README.md b/general/cancel/README.md index 2a1be648..491ef673 100644 --- a/general/cancel/README.md +++ b/general/cancel/README.md @@ -1,3 +1,13 @@ + + + Cancel-Safe IRP Queue Sample ============================ diff --git a/general/echo/kmdf/README.md b/general/echo/kmdf/README.md index 3b89850c..2ed4518a 100644 --- a/general/echo/kmdf/README.md +++ b/general/echo/kmdf/README.md @@ -1,3 +1,13 @@ + + + KMDF Echo Sample ================ diff --git a/general/echo/umdf/README.md b/general/echo/umdf/README.md index e2123cd3..af4818d4 100644 --- a/general/echo/umdf/README.md +++ b/general/echo/umdf/README.md @@ -1,3 +1,13 @@ + + + Echo Sample (UMDF Version 1) ============================ diff --git a/general/echo/umdf2/README.md b/general/echo/umdf2/README.md index ba3ffa36..a9ec9e76 100644 --- a/general/echo/umdf2/README.md +++ b/general/echo/umdf2/README.md @@ -1,3 +1,12 @@ + + Echo Sample (UMDF Version 2) ============================ diff --git a/general/echo/umdfSocketEcho/README.md b/general/echo/umdfSocketEcho/README.md index 06819a47..26cd5a7e 100644 --- a/general/echo/umdfSocketEcho/README.md +++ b/general/echo/umdfSocketEcho/README.md @@ -1,3 +1,13 @@ + + + UMDF SocketEcho Sample (UMDF Version 1) ======================================= diff --git a/general/event/README.md b/general/event/README.md index c091af5a..68da1666 100644 --- a/general/event/README.md +++ b/general/event/README.md @@ -1,3 +1,13 @@ + + + Hardware Event Sample ===================== diff --git a/general/filehistory/README.md b/general/filehistory/README.md index 3e29b08e..7ed723d8 100644 --- a/general/filehistory/README.md +++ b/general/filehistory/README.md @@ -1,3 +1,13 @@ + + + File History Sample ================== diff --git a/general/installwdf/README.md b/general/installwdf/README.md index 429957d5..df9e8445 100644 --- a/general/installwdf/README.md +++ b/general/installwdf/README.md @@ -1,3 +1,13 @@ + + + WDF Installation Package ======================== diff --git a/general/ioctl/kmdf/README.md b/general/ioctl/kmdf/README.md index c9a10365..9c3d80d4 100644 --- a/general/ioctl/kmdf/README.md +++ b/general/ioctl/kmdf/README.md @@ -1,3 +1,13 @@ + + + Non-PnP Driver Sample ==================== diff --git a/general/ioctl/wdm/README.md b/general/ioctl/wdm/README.md index fcbf71f2..e9e2e57d 100644 --- a/general/ioctl/wdm/README.md +++ b/general/ioctl/wdm/README.md @@ -1,3 +1,13 @@ + + + IOCTL ===== diff --git a/general/obcallback/README.md b/general/obcallback/README.md index ca4069a2..37326565 100644 --- a/general/obcallback/README.md +++ b/general/obcallback/README.md @@ -1,3 +1,13 @@ + + + ObCallback Callback Registration Driver ======================================= diff --git a/general/pcidrv/README.md b/general/pcidrv/README.md index 04bf35b5..2fa15558 100644 --- a/general/pcidrv/README.md +++ b/general/pcidrv/README.md @@ -1,3 +1,13 @@ + + + PCIDRV - WDF Driver for PCI Device ================================== diff --git a/general/perfcounters/kcs/README.md b/general/perfcounters/kcs/README.md index 1cbd3ac0..2e7553e5 100644 --- a/general/perfcounters/kcs/README.md +++ b/general/perfcounters/kcs/README.md @@ -1,3 +1,13 @@ + + + Kernel Counter Sample (Kcs) =========================== diff --git a/general/registry/regfltr/README.md b/general/registry/regfltr/README.md index 9e5a0740..40fe7011 100644 --- a/general/registry/regfltr/README.md +++ b/general/registry/regfltr/README.md @@ -1,3 +1,13 @@ + + + RegFltr Sample Driver ===================== diff --git a/general/toaster/toastDrv/README.md b/general/toaster/toastDrv/README.md index 326d40a9..4a29ff7d 100644 --- a/general/toaster/toastDrv/README.md +++ b/general/toaster/toastDrv/README.md @@ -1,3 +1,13 @@ + + + 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. diff --git a/general/toaster/toastpkg/README.md b/general/toaster/toastpkg/README.md index 326d40a9..a4763177 100644 --- a/general/toaster/toastpkg/README.md +++ b/general/toaster/toastpkg/README.md @@ -1,5 +1,15 @@ -Toaster Sample Driver -===================== + + + +Toaster Package 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. All the samples work with a hypothetical toaster bus, over which toaster devices can be connected to a PC. diff --git a/general/toaster/umdf2/README.md b/general/toaster/umdf2/README.md index 9dcdd158..75cf882b 100644 --- a/general/toaster/umdf2/README.md +++ b/general/toaster/umdf2/README.md @@ -1,3 +1,13 @@ + + + Toaster Sample (UMDF Version 2) =============================== The Toaster (UMDF version 2) sample is an iterative series of samples that demonstrate fundamental aspects of Windows driver development. diff --git a/general/tracing/SystemTraceControl/README.md b/general/tracing/SystemTraceControl/README.md index eb044ddb..b45ae788 100644 --- a/general/tracing/SystemTraceControl/README.md +++ b/general/tracing/SystemTraceControl/README.md @@ -1,3 +1,13 @@ + + + SystemTraceProvider =================== diff --git a/general/tracing/evntdrv/README.md b/general/tracing/evntdrv/README.md index 4e64ecae..41359ad1 100644 --- a/general/tracing/evntdrv/README.md +++ b/general/tracing/evntdrv/README.md @@ -1,3 +1,13 @@ + + + Eventdrv ======== diff --git a/general/tracing/tracedriver/README.md b/general/tracing/tracedriver/README.md index 064fb133..358053a1 100644 --- a/general/tracing/tracedriver/README.md +++ b/general/tracing/tracedriver/README.md @@ -1,3 +1,13 @@ + + + Tracedrv ======== diff --git a/general/umdfSkeleton/README.md b/general/umdfSkeleton/README.md index 923f44df..85d384f5 100644 --- a/general/umdfSkeleton/README.md +++ b/general/umdfSkeleton/README.md @@ -1,3 +1,13 @@ + + + UMDF Driver Skeleton Sample (UMDF Version 1) ============================================ diff --git a/gpio/samples/README.md b/gpio/samples/README.md index dcf5ca64..ba05c2f6 100644 --- a/gpio/samples/README.md +++ b/gpio/samples/README.md @@ -1,3 +1,13 @@ + + + GPIO Sample Drivers =================== diff --git a/hid/firefly/README.md b/hid/firefly/README.md index 306d816f..cd526150 100644 --- a/hid/firefly/README.md +++ b/hid/firefly/README.md @@ -1,3 +1,13 @@ + + + KMDF filter driver for a HID device =================================== Firefly is a KMDF-based filter driver for a HID device. Along with illustrating how to write a filter driver, this sample shows how to use remote I/O target interfaces to open a HID collection in kernel-mode and send IOCTL requests to set and get feature reports, as well as how an application can use WMI interfaces to send commands to a filter driver. diff --git a/hid/hclient/README.md b/hid/hclient/README.md index b98902fe..192f4f90 100644 --- a/hid/hclient/README.md +++ b/hid/hclient/README.md @@ -1,3 +1,13 @@ + + + HClient sample application ========================== diff --git a/hid/hidusbfx2/README.md b/hid/hidusbfx2/README.md index bd0b88a9..20eb2001 100644 --- a/hid/hidusbfx2/README.md +++ b/hid/hidusbfx2/README.md @@ -1,3 +1,14 @@ + + + + HIDUSBFX2 sample driver ======================= The HIDUSBFX2 sample driver (hidusbfx2.sys) demonstrates how to map a non-HID USB device to a HID device. diff --git a/hid/vhidmini2/README.md b/hid/vhidmini2/README.md index 7679a849..bd6ea894 100644 --- a/hid/vhidmini2/README.md +++ b/hid/vhidmini2/README.md @@ -1,4 +1,13 @@ -HID Minidriver Sample (UMDF V2) + + +HID Minidriver Sample (UMDF version 2) ====================================== The *HID minidriver* sample demonstrates how to write a HID minidriver using User-Mode Driver Framework (UMDF). diff --git a/input/hiddigi/SynapticsTouch/README.md b/input/hiddigi/SynapticsTouch/README.md index df0347d2..6fb9b5ee 100644 --- a/input/hiddigi/SynapticsTouch/README.md +++ b/input/hiddigi/SynapticsTouch/README.md @@ -1,3 +1,13 @@ + + + Synaptics Touch Sample ====================== @@ -17,15 +27,6 @@ Related technologies [Windows Pointer Device](http://msdn.microsoft.com/en-us/library/windows/hardware/jj151570) -##System requirements -------------------- -**Client:** Windows 10 Technical Preview - -**Server:** Windows 10 Technical Preview - -**Phone:** Windows 10 Technical Preview - - File Manifest ------------- diff --git a/input/kbfiltr/README.md b/input/kbfiltr/README.md index 9942ec40..f570c5cb 100644 --- a/input/kbfiltr/README.md +++ b/input/kbfiltr/README.md @@ -1,3 +1,13 @@ + + + Keyboard Input WDF Filter Driver (Kbfiltr) ========================================== diff --git a/input/layout/README.md b/input/layout/README.md index 341c8ade..d998e379 100644 --- a/input/layout/README.md +++ b/input/layout/README.md @@ -1,3 +1,13 @@ + + + Keyboard Layout Samples ======================= diff --git a/input/moufiltr/README.md b/input/moufiltr/README.md index e0cc32c5..6cf5c585 100644 --- a/input/moufiltr/README.md +++ b/input/moufiltr/README.md @@ -1,3 +1,13 @@ + + + Mouse Input WDF Filter Driver (Moufiltr) ======================================== The Moufiltr sample is an example of a mouse input filter driver. -- cgit v1.3.1 From 389bdb217d54112d96b40bc967f86b17a605bed6 Mon Sep 17 00:00:00 2001 From: Tim Felser Date: Fri, 25 Aug 2017 16:42:50 +0200 Subject: Added a new command "removeall" Just like "findall" corresponds to "find" this new command acts like "remove" but it will also remove non-present devices. So it is easy to remove all instances of an USB driver. --- setup/devcon/cmds.cpp | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ setup/devcon/msg.mc | 21 +++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/setup/devcon/cmds.cpp b/setup/devcon/cmds.cpp index 1af49c5c..0002b393 100644 --- a/setup/devcon/cmds.cpp +++ b/setup/devcon/cmds.cpp @@ -1551,6 +1551,78 @@ Return Value: return failcode; } +int cmdRemoveAll(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[]) +/*++ + +Routine Description: + +REMOVEALL +remove devices +like remove, but also remove not-present devices + +Arguments: + +BaseName - name of executable +Machine - machine name, must be NULL +argc/argv - remaining parameters + +Return Value: + +EXIT_xxxx + +--*/ +{ + GenericContext context; + TCHAR strRemove[80]; + TCHAR strReboot[80]; + TCHAR strFail[80]; + int failcode = EXIT_FAIL; + + UNREFERENCED_PARAMETER(Flags); + + if (!argc) { + // + // arguments required + // + return EXIT_USAGE; + } + if (Machine) { + // + // must be local machine as we need to involve class/co installers + // + return EXIT_USAGE; + } + if (!LoadString(NULL, IDS_REMOVED, strRemove, ARRAYSIZE(strRemove))) { + return EXIT_FAIL; + } + if (!LoadString(NULL, IDS_REMOVED_REBOOT, strReboot, ARRAYSIZE(strReboot))) { + return EXIT_FAIL; + } + if (!LoadString(NULL, IDS_REMOVE_FAILED, strFail, ARRAYSIZE(strFail))) { + return EXIT_FAIL; + } + + context.reboot = FALSE; + context.count = 0; + context.strReboot = strReboot; + context.strSuccess = strRemove; + context.strFail = strFail; + failcode = EnumerateDevices(BaseName, Machine, 0, argc, argv, RemoveCallback, &context); + + if (failcode == EXIT_OK) { + + if (!context.count) { + FormatToStream(stdout, MSG_REMOVE_TAIL_NONE); + } else if (!context.reboot) { + FormatToStream(stdout, MSG_REMOVE_TAIL, context.count); + } else { + FormatToStream(stdout, MSG_REMOVE_TAIL_REBOOT, context.count); + failcode = EXIT_REBOOT; + } + } + return failcode; +} + int cmdRescan(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[]) /*++ @@ -2389,6 +2461,7 @@ DispatchEntry DispatchTable[] = { { TEXT("listclass"), cmdListClass, MSG_LISTCLASS_SHORT, MSG_LISTCLASS_LONG }, { TEXT("reboot"), cmdReboot, MSG_REBOOT_SHORT, MSG_REBOOT_LONG }, { TEXT("remove"), cmdRemove, MSG_REMOVE_SHORT, MSG_REMOVE_LONG }, + { TEXT("removeall"), cmdRemoveAll, MSG_REMOVEALL_SHORT, MSG_REMOVEALL_LONG }, { TEXT("rescan"), cmdRescan, MSG_RESCAN_SHORT, MSG_RESCAN_LONG }, { TEXT("resources"), cmdResources, MSG_RESOURCES_SHORT, MSG_RESOURCES_LONG }, { TEXT("restart"), cmdRestart, MSG_RESTART_SHORT, MSG_RESTART_LONG }, diff --git a/setup/devcon/msg.mc b/setup/devcon/msg.mc index a3c677e9..ca348bde 100644 --- a/setup/devcon/msg.mc +++ b/setup/devcon/msg.mc @@ -811,6 +811,27 @@ MessageId=61204 SymbolicName=MSG_REMOVE_TAIL Language=English %1!u! device(s) were removed. . +MessageId=61205 SymbolicName=MSG_REMOVEALL_LONG +Language=English +Devcon Removeall Command +Removes devices with the specified hardware or instance ID, including devices +that are not currently attached. Valid only on the local computer. +(To reboot when necesary, Include -r .) +%1 [-r] %2 [...] +%1 [-r] %2 = [...] + Specifies a device setup class. +Examples of : + * - All devices + ISAPNP\PNP0501 - Hardware ID + *PNP* - Hardware ID with wildcards (* matches anything) + @ISAPNP\*\* - Instance ID with wildcards (@ prefixes instance ID) + '*PNP0501 - Hardware ID with apostrophe (' prefixes literal match - matches exactly as typed, + including the asterisk.) +. +MessageId=61206 SymbolicName=MSG_REMOVEALL_SHORT +Language=English +%1!-20s! Remove devices, including those that are not currently attached. +. ;// ;// RESCAN -- cgit v1.3.1 From 806725d560858c2018611fc4e7693d56bb2d29d5 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Fri, 25 Aug 2017 13:45:41 -0700 Subject: Remove gallery.xml --- sensors/ADXL345Acc/Gallery.xml | 161 --------------------- sensors/Activity/Gallery.xml | 160 --------------------- sensors/CustomSensors/Gallery.xml | 168 ---------------------- sensors/Pedometer/Gallery.xml | 160 --------------------- sensors/SimpleDeviceOrientationSensor/Gallery.xml | 160 --------------------- 5 files changed, 809 deletions(-) delete mode 100644 sensors/ADXL345Acc/Gallery.xml delete mode 100644 sensors/Activity/Gallery.xml delete mode 100644 sensors/CustomSensors/Gallery.xml delete mode 100644 sensors/Pedometer/Gallery.xml delete mode 100644 sensors/SimpleDeviceOrientationSensor/Gallery.xml diff --git a/sensors/ADXL345Acc/Gallery.xml b/sensors/ADXL345Acc/Gallery.xml deleted file mode 100644 index 2d3eabf5..00000000 --- a/sensors/ADXL345Acc/Gallery.xml +++ /dev/null @@ -1,161 +0,0 @@ - - - - - ADXL345Accelerometer - - - - - - - - - - - - -

The ADXL345Accelerometer sample shows how to write a UMDF v2 driver to control an ADXL345 accelerometer chip.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
-
- - -
- -

To install the sample driver, follow these steps:

- - Ensure that the driver builds without errors. - Ensure the appropriate hardware resources have been assigned in the ACPI table using ASL. A device node with HWID ACPI\ADXL345Acc should be created. - Copy the DLL and INF files to a separate folder. - Enter the command "devcon.exe update ADXL345Acc.inf ACPI\ADXL345Acc" to install the driver on an existing device node. You can find the devcon.exe program in the tools\devcon folder where you installed the WDK. - -
-
-
- File manifest - -

The following source files are in the src\Sensors\ADXL345Acc folder and are used to build the ADXL345Acc.dll and ADXL345Acc.inf files.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileDescription
-

device.h, device.cpp

-
-

Implements the driver's WDF PnP event callbacks and helper methods

-
-

client.cpp

-
-

Implements the driver's callback functions from the class extension to the ADXL345 accelerometer.

-
-

driver.h, driver.cpp

-
-

WDF driver entry event callbacks and helper methods

-
-

ADXL345.h

-
-

Device specific definitions.

-
-

makefile.inc

-
-

Defines custom build actions. Includes the conversion of the .INX file into a .INF file.

-
-

SensorsTrace.h

-
-

Implementation the sensor traces files.

-
-

ADXL345Acc.ctl

-
-

Declaration of driver's tracing GUID

-
-

ADXL345Acc.inx

-
-

Describes the installation of the driver. The build process converts this into a .INF.

-
-
-
-
-
-
- - - - - -
diff --git a/sensors/Activity/Gallery.xml b/sensors/Activity/Gallery.xml deleted file mode 100644 index bb6e792a..00000000 --- a/sensors/Activity/Gallery.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - Activity - - - - - - - - - - - - -

The activity sensor sample shows how to write a UMDF v2 driver to control a virtual activity sensor.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
-
- - -
- -

To install the sample driver, follow these steps:

- - Ensure that the driver builds without errors. - Copy the DLL and INF files to a separate folder. - Enter the command "devcon.exe update Activity.inf ACPI\<HWID>" to install the driver on an existing device node. You can find the devcon.exe program in the tools\devcon folder where you installed the WDK. - -
-
-
- File manifest - -

The following source files are in the src\Sensors\Activity folder and are used to build the Activity.dll and Activity.inf files.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileDescription
-

device.h, device.cpp

-
-

Implements the driver's WDF PnP event callbacks and helper methods

-
-

client.cpp

-
-

Implements the driver's callback functions from the class extension to activity sensors.

-
-

driver.h, driver.cpp

-
-

WDF driver entry event callbacks and helper methods

-
-

hardwaresimulator.h, hardwaresimulator.cpp

-
-

Hardware simulator implementation

-
-

makefile.inc

-
-

Defines custom build actions. Includes the conversion of the .INX file into a .INF file.

-
-

SensorsTrace.h

-
-

Implementation the sensor traces files.

-
-

Activity.ctl

-
-

Declaration of driver's tracing GUID

-
-

Activity.inx

-
-

Describes the installation of the driver. The build process converts this into a .INF.

-
-
-
-
-
-
- - - - - -
diff --git a/sensors/CustomSensors/Gallery.xml b/sensors/CustomSensors/Gallery.xml deleted file mode 100644 index 8f84093a..00000000 --- a/sensors/CustomSensors/Gallery.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - CustomSensors - - - - - - - - - - - - -

The CustomSensors sample shows how to write a UMDF v2 driver to control a virtual CO2 sensor.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
-
- - -
- -

To install the sample driver, follow these steps:

- - Ensure that the driver builds without errors. - Copy the DLL and INF files to a separate folder. - Enter the command "devcon.exe update CustomSensors.inf ACPI\<HWID>" to install the driver on an existing device node. You can find the devcon.exe program in the tools\devcon folder where you installed the WDK. - -
-
-
- File manifest - -

The following source files are in the src\Sensors\CustomSensors folder and are used to build the CustomSensors.dll and CustomSensors.inf files.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileDescription
-

device.h, device.cpp

-
-

Implements the driver's WDF PnP event callbacks and helper methods

-
-

client.cpp

-
-

Implements the driver's callback functions from the class extension to custom sensors.

-
-

driver.h, driver.cpp

-
-

WDF driver entry event callbacks and helper methods

-
-

hardwaresimulator.h, hardwaresimulator.cpp

-
-

Hardware simulator implementation

-
-

makefile.inc

-
-

Defines custom build actions. Includes the conversion of the .INX file into a .INF file.

-
-

SensorsTrace.h

-
-

Implementation the sensor traces files.

-
-

CustomSensors.ctl

-
-

Declaration of driver's tracing GUID

-
-

CustomSensor.inx

-
-

Describes the installation of the driver. The build process converts this into a .INF.

-
-

Trace.h

-
-

Sets up WPP tracing.

-
-
-
-
-
-
- - - - - -
diff --git a/sensors/Pedometer/Gallery.xml b/sensors/Pedometer/Gallery.xml deleted file mode 100644 index ba572bcf..00000000 --- a/sensors/Pedometer/Gallery.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - Pedometer - - - - - - - - - - - - -

The Pedometer sample shows how to write a UMDF v2 driver to control a virtual Pedometer sensor.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
-
- - -
- -

To install the sample driver, follow these steps:

- - Ensure that the driver builds without errors. - Copy the DLL and INF files to a separate folder. - Enter the command "devcon.exe update Pedometer.inf ACPI\<HWID>" to install the driver on an existing device node. You can find the devcon.exe program in the tools\devcon folder where you installed the WDK. - -
-
-
- File manifest - -

The following source files are in the src\Sensors\Pedometer folder and are used to build the Pedometer.dll and Pedometer.inf files.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileDescription
-

device.h, device.cpp

-
-

Implements the driver's WDF PnP event callbacks and helper methods

-
-

client.cpp

-
-

Implements the driver's callback functions from the class extension to pedometer sensors.

-
-

driver.h, driver.cpp

-
-

WDF driver entry event callbacks and helper methods

-
-

hardwaresimulator.h, hardwaresimulator.cpp

-
-

Hardware simulator implementation

-
-

makefile.inc

-
-

Defines custom build actions. Includes the conversion of the .INX file into a .INF file.

-
-

SensorsTrace.h

-
-

Implementation the sensor traces files.

-
-

Pedometer.ctl

-
-

Declaration of driver's tracing GUID

-
-

Pedometer.inx

-
-

Describes the installation of the driver. The build process converts this into a .INF.

-
-
-
-
-
-
- - - - - -
diff --git a/sensors/SimpleDeviceOrientationSensor/Gallery.xml b/sensors/SimpleDeviceOrientationSensor/Gallery.xml deleted file mode 100644 index 8fbb8b8c..00000000 --- a/sensors/SimpleDeviceOrientationSensor/Gallery.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - SimpleDeviceOrientationSensor - - - - - - - - - - - - -

The SimpleDeviceOrientationSensor sample shows how to write a UMDF v2 sensor driver to output Simple Device Orientation values.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
-
- - -
- -

To install the sample driver, follow these steps:

- - Ensure that the driver builds without errors. - Copy the DLL and INF files to a separate folder. - Enter the command "devcon.exe update SimpleDeviceOrientationSensor.inf ACPI\<HWID>" to install the driver on an existing device node. You can find the devcon.exe program in the tools\devcon folder where you installed the WDK. - -
-
-
- File manifest - -

The following source files are in the src\Sensors\SimpleDeviceOrientationSensor folder and are used to build the SimpleDeviceOrientationSensor.dll and SimpleDeviceOrientationSensor.inf files.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileDescription
-

device.h, device.cpp

-
-

Implements the driver's WDF PnP event callbacks and helper methods

-
-

client.cpp

-
-

Implements the driver's callback functions from the class extension to simple device orientation sensors.

-
-

driver.h, driver.cpp

-
-

WDF driver entry event callbacks and helper methods

-
-

hardwaresimulator.h, hardwaresimulator.cpp

-
-

Hardware simulator implementation

-
-

makefile.inc

-
-

Defines custom build actions. Includes the conversion of the .INX file into a .INF file.

-
-

SensorsTrace.h

-
-

Implementation the sensor traces files.

-
-

SimpleDeviceOrientationSensor.ctl

-
-

Declaration of driver's tracing GUID

-
-

SimpleDeviceOrientationSensor.inx

-
-

Describes the installation of the driver. The build process converts this into a .INF.

-
-
-
-
-
-
- - - - - -
-- cgit v1.3.1 From 112a28423dea2f79402bc20d1cad07afe4f69e22 Mon Sep 17 00:00:00 2001 From: Barry Golden Date: Fri, 25 Aug 2017 14:50:13 -0700 Subject: VSTS 12737998 --- network/config/bindview/README.md | 10 ++++++++++ network/modem/fakemodem/README.md | 9 +++++++++ network/ndis/extension/README.md | 10 ++++++++++ network/ndis/filter/README.md | 10 ++++++++++ network/ndis/mux/README.md | 10 ++++++++++ network/ndis/ndisprot/6x/README.md | 16 +++++++++++++--- network/ndis/ndisprot_kmdf/README.md | 17 ++++++++++++++--- network/ndis/netvmini/6x/README.md | 10 ++++++++++ network/radio/HidSwitchDriverSample/README.md | 10 ++++++++++ network/radio/RadioManagerSample/README.md | 10 ++++++++++ network/trans/WFPSampler/README.md | 10 ++++++++++ network/trans/ddproxy/README.md | 10 ++++++++++ network/trans/inspect/README.md | 10 ++++++++++ network/trans/msnmntr/README.md | 10 ++++++++++ network/trans/stmedit/README.md | 10 ++++++++++ network/wsk/echosrv/README.md | 10 ++++++++++ nfc/Simulator/README.md | 10 ++++++++++ nfp/net/README.md | 10 ++++++++++ pofx/PEP/README.md | 10 ++++++++++ pofx/UMDF2/README.md | 10 ++++++++++ pofx/WDF/README.md | 10 ++++++++++ pos/drivers/MagneticStripeReader/README.md | 10 ++++++++++ pos/drivers/barcodescanner/README.md | 10 ++++++++++ print/SampleOpenXPS/README.md | 10 ++++++++++ print/SampleXPS/README.md | 10 ++++++++++ print/SimplePipelineFilter/README.md | 10 ++++++++++ print/XPSDrvSmpl/README.md | 10 ++++++++++ print/XpsRasFilter/README.md | 11 +++++++++++ print/autoconfig/README.md | 10 ++++++++++ print/cpsuisam/README.md | 10 ++++++++++ .../PrinterExtensionSample/README.md | 10 ++++++++++ .../v4PrintDriver-ConstraintScript/README.md | 10 ++++++++++ .../v4PrintDriver-HostBasedSampleDriver/README.md | 11 +++++++++++ .../v4PrintDriver-USBMon-Bidi-Extension/README.md | 10 ++++++++++ .../v4PrintDriver-WSDMon-Bidi-Extension/README.md | 10 ++++++++++ 35 files changed, 358 insertions(+), 6 deletions(-) diff --git a/network/config/bindview/README.md b/network/config/bindview/README.md index 01e1cd8d..b239b700 100644 --- a/network/config/bindview/README.md +++ b/network/config/bindview/README.md @@ -1,3 +1,13 @@ + + + Bindview Network Configuration Utility ====================================== diff --git a/network/modem/fakemodem/README.md b/network/modem/fakemodem/README.md index b79071cb..3734a95a 100644 --- a/network/modem/fakemodem/README.md +++ b/network/modem/fakemodem/README.md @@ -1,3 +1,12 @@ + + Fakemodem Driver ================ diff --git a/network/ndis/extension/README.md b/network/ndis/extension/README.md index dc3b6b92..df154559 100644 --- a/network/ndis/extension/README.md +++ b/network/ndis/extension/README.md @@ -1,3 +1,13 @@ + + + Hyper-V Extensible Switch extension filter driver ================================================= diff --git a/network/ndis/filter/README.md b/network/ndis/filter/README.md index ac1bc67c..274287bc 100644 --- a/network/ndis/filter/README.md +++ b/network/ndis/filter/README.md @@ -1,3 +1,13 @@ + + + NDIS 6.0 Filter Driver ====================== diff --git a/network/ndis/mux/README.md b/network/ndis/mux/README.md index 0a545a3a..cf9a112c 100644 --- a/network/ndis/mux/README.md +++ b/network/ndis/mux/README.md @@ -1,3 +1,13 @@ + + + NDIS MUX Intermediate Driver and Notify Object ============================================== diff --git a/network/ndis/ndisprot/6x/README.md b/network/ndis/ndisprot/6x/README.md index 55843a0c..211a8721 100644 --- a/network/ndis/ndisprot/6x/README.md +++ b/network/ndis/ndisprot/6x/README.md @@ -1,7 +1,17 @@ -NDIS Connection-less Protocol Driver Sample -=========================================== + -This sample demonstrates a connection-less NDIS 6.0 protocol.The driver supports sending and receiving raw Ethernet frames using `ReadFile`/`WriteFile` calls from user-mode. It only receives frames with a specific EtherType field. As an NDIS protocol, it illustrates how to establish and tear down bindings to Ethernet adapters, i.e. those that export medium type **NdisMedium802\_3**. It shows how to set a packet filter, send and receive data, and handle plug-and-play events. + +NDIS Connection-less Protocol WDM Driver Sample +=============================================== + +This sample demonstrates a connection-less NDIS 6.0 protocol WDM driver. The driver supports sending and receiving raw Ethernet frames using `ReadFile`/`WriteFile` calls from user-mode. It only receives frames with a specific EtherType field. As an NDIS protocol, it illustrates how to establish and tear down bindings to Ethernet adapters, i.e. those that export medium type **NdisMedium802\_3**. It shows how to set a packet filter, send and receive data, and handle plug-and-play events. ### INSTALLATION diff --git a/network/ndis/ndisprot_kmdf/README.md b/network/ndis/ndisprot_kmdf/README.md index 0da2ae31..0f2ceb23 100644 --- a/network/ndis/ndisprot_kmdf/README.md +++ b/network/ndis/ndisprot_kmdf/README.md @@ -1,6 +1,17 @@ -Connection-less NDIS 6.0 Sample Protocol Driver -=============================================== -This sample demonstrates a connection-less NDIS 6.0 protocol driver. + + + +Connection-less NDIS 6.0 Protocol KMDF Sample Driver +==================================================== + +This sample demonstrates a connection-less NDIS 6.0 protocol KMDF driver. The driver supports sending and receiving raw Ethernet frames using ReadFile/WriteFile calls from user-mode. As an NDIS protocol, it illustrates how to establish and tear down bindings to Ethernet adapters, i.e. those that export medium type *NdisMedium802\_3*. It shows how to set a packet filter, send and receive data, and handle plug-and-play events. diff --git a/network/ndis/netvmini/6x/README.md b/network/ndis/netvmini/6x/README.md index 76020b5d..023e1674 100644 --- a/network/ndis/netvmini/6x/README.md +++ b/network/ndis/netvmini/6x/README.md @@ -1,3 +1,13 @@ + + + NDIS Virtual Miniport Driver ============================ diff --git a/network/radio/HidSwitchDriverSample/README.md b/network/radio/HidSwitchDriverSample/README.md index 5f4fdd81..9726babf 100644 --- a/network/radio/HidSwitchDriverSample/README.md +++ b/network/radio/HidSwitchDriverSample/README.md @@ -1,3 +1,13 @@ + + + Radio Switch Test Driver for OSR USB-FX2 Development Board ========================================================== diff --git a/network/radio/RadioManagerSample/README.md b/network/radio/RadioManagerSample/README.md index e391e051..3cac53e9 100644 --- a/network/radio/RadioManagerSample/README.md +++ b/network/radio/RadioManagerSample/README.md @@ -1,3 +1,13 @@ + + + Windows Radio Management Sample =============================== diff --git a/network/trans/WFPSampler/README.md b/network/trans/WFPSampler/README.md index d23c2554..84621bcd 100644 --- a/network/trans/WFPSampler/README.md +++ b/network/trans/WFPSampler/README.md @@ -1,3 +1,13 @@ + + + Windows Filtering Platform Sample ================================= diff --git a/network/trans/ddproxy/README.md b/network/trans/ddproxy/README.md index a9e1d427..45a122d9 100644 --- a/network/trans/ddproxy/README.md +++ b/network/trans/ddproxy/README.md @@ -1,3 +1,13 @@ + + + Windows Filtering Platform Packet Modification Sample ===================================================== diff --git a/network/trans/inspect/README.md b/network/trans/inspect/README.md index 4f28598c..2c197c4f 100644 --- a/network/trans/inspect/README.md +++ b/network/trans/inspect/README.md @@ -1,3 +1,13 @@ + + + Windows Filtering Platform Traffic Inspection Sample ==================================================== diff --git a/network/trans/msnmntr/README.md b/network/trans/msnmntr/README.md index fcc9c420..14127cbc 100644 --- a/network/trans/msnmntr/README.md +++ b/network/trans/msnmntr/README.md @@ -1,3 +1,13 @@ + + + Windows Filtering Platform MSN Messenger Monitor Sample ======================================================= diff --git a/network/trans/stmedit/README.md b/network/trans/stmedit/README.md index 0c434b07..67905639 100644 --- a/network/trans/stmedit/README.md +++ b/network/trans/stmedit/README.md @@ -1,3 +1,13 @@ + + + Windows Filtering Platform Stream Edit Sample ============================================= diff --git a/network/wsk/echosrv/README.md b/network/wsk/echosrv/README.md index 8b93db2d..96cc02d5 100644 --- a/network/wsk/echosrv/README.md +++ b/network/wsk/echosrv/README.md @@ -1,3 +1,13 @@ + + + WSK TCP Echo Server =================== diff --git a/nfc/Simulator/README.md b/nfc/Simulator/README.md index dfdeaa7c..17b3bdac 100644 --- a/nfc/Simulator/README.md +++ b/nfc/Simulator/README.md @@ -1,3 +1,13 @@ + + + NFC Simulator Driver Sample =========================== This sample demonstrates how to use User-Mode Driver Framework (UMDF) to write a Near-Field Communication (NFC) universal driver along with best practices. diff --git a/nfp/net/README.md b/nfp/net/README.md index aeb2c630..5f9c670b 100644 --- a/nfp/net/README.md +++ b/nfp/net/README.md @@ -1,3 +1,13 @@ + + + Near-Field Proximity Sample Driver (UMDF Version 1) =================================================== diff --git a/pofx/PEP/README.md b/pofx/PEP/README.md index 41bef908..079dbec6 100644 --- a/pofx/PEP/README.md +++ b/pofx/PEP/README.md @@ -1,3 +1,13 @@ + + + PEP ACPI Sample =============== diff --git a/pofx/UMDF2/README.md b/pofx/UMDF2/README.md index db47b385..78cf1f40 100644 --- a/pofx/UMDF2/README.md +++ b/pofx/UMDF2/README.md @@ -1,3 +1,13 @@ + + + Power Framework (PoFx) Sample (UMDF Version 2) ============================================== diff --git a/pofx/WDF/README.md b/pofx/WDF/README.md index 2f8009c3..7915dbd7 100644 --- a/pofx/WDF/README.md +++ b/pofx/WDF/README.md @@ -1,3 +1,13 @@ + + + KMDF Power Framework (PoFx) Sample ================================== diff --git a/pos/drivers/MagneticStripeReader/README.md b/pos/drivers/MagneticStripeReader/README.md index 5530f60c..4e8d8088 100644 --- a/pos/drivers/MagneticStripeReader/README.md +++ b/pos/drivers/MagneticStripeReader/README.md @@ -1,3 +1,13 @@ + + + Magnetic Stripe Reader Driver Sample ==================================== This sample serves as a template for creating a new Magnetic Stripe Reader driver. diff --git a/pos/drivers/barcodescanner/README.md b/pos/drivers/barcodescanner/README.md index 8df934b3..f6d7926b 100644 --- a/pos/drivers/barcodescanner/README.md +++ b/pos/drivers/barcodescanner/README.md @@ -1,3 +1,13 @@ + + + Barcode Scanner Driver Sample ==================================== This sample serves as a template for creating a new Barcode Scanner driver. diff --git a/print/SampleOpenXPS/README.md b/print/SampleOpenXPS/README.md index a50148e4..f939583f 100644 --- a/print/SampleOpenXPS/README.md +++ b/print/SampleOpenXPS/README.md @@ -1,3 +1,13 @@ + + + OpenXPS Documents Print Sample ============================== diff --git a/print/SampleXPS/README.md b/print/SampleXPS/README.md index 18a242bb..b1c39d3e 100644 --- a/print/SampleXPS/README.md +++ b/print/SampleXPS/README.md @@ -1,3 +1,13 @@ + + + XPS Documents Print Sample ========================== diff --git a/print/SimplePipelineFilter/README.md b/print/SimplePipelineFilter/README.md index 06f17b61..c7a92e48 100644 --- a/print/SimplePipelineFilter/README.md +++ b/print/SimplePipelineFilter/README.md @@ -1,3 +1,13 @@ + + + Print Pipeline Simple Filter ============================ diff --git a/print/XPSDrvSmpl/README.md b/print/XPSDrvSmpl/README.md index f90ae5cf..7c75a314 100644 --- a/print/XPSDrvSmpl/README.md +++ b/print/XPSDrvSmpl/README.md @@ -1,3 +1,13 @@ + + + XPSDrv Driver and Filter Sample =============================== diff --git a/print/XpsRasFilter/README.md b/print/XpsRasFilter/README.md index a742f66c..344c6bf9 100644 --- a/print/XpsRasFilter/README.md +++ b/print/XpsRasFilter/README.md @@ -1,3 +1,14 @@ + + + + XPS Rasterization Filter Service Sample ======================================= diff --git a/print/autoconfig/README.md b/print/autoconfig/README.md index e4642008..38a442e2 100644 --- a/print/autoconfig/README.md +++ b/print/autoconfig/README.md @@ -1,3 +1,13 @@ + + + Print auto-configuration sample =============================== diff --git a/print/cpsuisam/README.md b/print/cpsuisam/README.md index a4fddfb9..b289ad82 100644 --- a/print/cpsuisam/README.md +++ b/print/cpsuisam/README.md @@ -1,3 +1,13 @@ + + + Common Property Sheet UI Sample =============================== diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/README.md b/print/v4PrintDriverSamples/PrinterExtensionSample/README.md index ca5f6837..c76f31d8 100644 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/README.md +++ b/print/v4PrintDriverSamples/PrinterExtensionSample/README.md @@ -1,3 +1,13 @@ + + + Printer Extension Sample ======================== diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md index 71a6f72b..f0f64424 100644 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md +++ b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md @@ -1,3 +1,13 @@ + + + Print Driver Constraints Sample =============================== diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/README.md b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/README.md index 6d3b77d0..09fdd30c 100644 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/README.md +++ b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/README.md @@ -1,3 +1,14 @@ + + + + USB Host-Based Print Driver Sample ================================== diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/README.md b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/README.md index 294dee1e..cebf8145 100644 --- a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/README.md +++ b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/README.md @@ -1,3 +1,13 @@ + + + Print Driver USB Monitor and Bidi Sample ======================================== diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/README.md b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/README.md index 6556ab25..385002c0 100644 --- a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/README.md +++ b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/README.md @@ -1,3 +1,13 @@ + + + WSDMon Bidi Extension Sample ============================ -- cgit v1.3.1 From 037d71513ccc6149d3ec6633c7c5574df7903e86 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Fri, 25 Aug 2017 14:58:26 -0700 Subject: Add Fusion Sensor sample --- sensors/Fusion/Device.h | 199 +++++++ sensors/Fusion/Driver.h | 19 + sensors/Fusion/FusionSensor.ctl | 1 + sensors/Fusion/FusionSensor.def | 6 + sensors/Fusion/FusionSensor.inx | Bin 0 -> 4990 bytes sensors/Fusion/FusionSensor.sln | 28 + sensors/Fusion/FusionSensor.vcxproj | 203 +++++++ sensors/Fusion/FusionSensor.vcxproj.Filters | 43 ++ sensors/Fusion/HardwareSimulator.h | 60 +++ sensors/Fusion/SensorsTrace.h | 102 ++++ sensors/Fusion/client.cpp | 789 ++++++++++++++++++++++++++++ sensors/Fusion/device.cpp | 729 +++++++++++++++++++++++++ sensors/Fusion/driver.cpp | 76 +++ sensors/Fusion/hardwaresimulator.cpp | 277 ++++++++++ sensors/Fusion/readme.md | 3 + 15 files changed, 2535 insertions(+) create mode 100644 sensors/Fusion/Device.h create mode 100644 sensors/Fusion/Driver.h create mode 100644 sensors/Fusion/FusionSensor.ctl create mode 100644 sensors/Fusion/FusionSensor.def create mode 100644 sensors/Fusion/FusionSensor.inx create mode 100644 sensors/Fusion/FusionSensor.sln create mode 100644 sensors/Fusion/FusionSensor.vcxproj create mode 100644 sensors/Fusion/FusionSensor.vcxproj.Filters create mode 100644 sensors/Fusion/HardwareSimulator.h create mode 100644 sensors/Fusion/SensorsTrace.h create mode 100644 sensors/Fusion/client.cpp create mode 100644 sensors/Fusion/device.cpp create mode 100644 sensors/Fusion/driver.cpp create mode 100644 sensors/Fusion/hardwaresimulator.cpp create mode 100644 sensors/Fusion/readme.md diff --git a/sensors/Fusion/Device.h b/sensors/Fusion/Device.h new file mode 100644 index 00000000..1bd39606 --- /dev/null +++ b/sensors/Fusion/Device.h @@ -0,0 +1,199 @@ +//Copyright (C) Microsoft Corporation, All Rights Reserved +// +//Abstract: +// +// This module contains the type definitions for the client +// driver's device callback class. +// +//Environment: +// +// Windows User-Mode Driver Framework (UMDF) + +#pragma once + +#include +#include +#include + +#include "SensorsTrace.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#define SENSOR_POOL_TAG_FUSIONSENSOR 'esuF' + +#define FusionSensor_Default_MinDataInterval_Ms (16) // 60Hz +#define FusionSensor_Default_DataInterval (100) // 10Hz +#define FusionSensor_Quarternion_Maximum (1.0f) +#define FusionSensor_Quarternion_Minimum (-1.0f) +#define FusionSensor_Quarternion_Resolution ((FusionSensor_Quarternion_Maximum-FusionSensor_Quarternion_Minimum)/65536) + + +// TODO: Customize the following 5 lines based on the hardware being used +#define GyrFakeDevice_Minimum_DegreesPerSecond (-2000.0f) +#define GyrFakeDevice_Maximum_DegreesPerSecond (2000.0f) +#define GyrFakeDevice_Precision (65536.0f) // 65536 = 2^16, 16 bit data +#define GyrFakeDevice_Range_DegreesPerSecond (GyrFakeDevice_Maximum_DegreesPerSecond - GyrFakeDevice_Minimum_DegreesPerSecond) +#define GyrFakeDevice_Resolution_DegreesPerSecond (GyrFakeDevice_Range_DegreesPerSecond / GyrFakeDevice_Precision) + +// TODO: Customize the following 3 lines based on the hardware being used +#define AccFakeDevice_Axis_Resolution (4.0f / 65536.0f) // in delta g +#define AccFakeDevice_Axis_Minimum (-2.0f) // in g +#define AccFakeDevice_Axis_Maximum (2.0f) // in g + +// Sensor Common Properties +typedef enum +{ + SENSOR_PROPERTY_STATE = 0, + SENSOR_PROPERTY_MIN_INTERVAL, + SENSOR_PROPERTY_MAX_DATAFIELDSIZE, + SENSOR_PROPERTY_SENSOR_TYPE, + SENSOR_PROPERTY_USE_GYRO, + SENSOR_PROPERTIES_COUNT +} SENSOR_COMMON_PROPERTIES_INDEX; + +// Sensor Enumeration Properties +typedef enum +{ + SENSOR_TYPE_GUID = 0, + SENSOR_MANUFACTURER, + SENSOR_MODEL, + SENSOR_PERSISTENT_UNIQUEID, + SENSOR_ISPRIMARY, + SENSOR_ENUMERATION_PROPERTIES_COUNT +} SENSOR_ENUMERATION_PROPERTIES_INDEX; + +// Accelerometer related data-field Properties +typedef enum +{ + SENSOR_ACC_RESOLUTION = 0, + SENSOR_ACC_MIN_RANGE, + SENSOR_ACC_MAX_RANGE, + SENSOR_ACC_DATA_FIELD_PROPERTY_COUNT +} SENSOR_ACC_DATA_FIELD_PROPERTY_INDEX; + +// Gyroscope related data-field Properties +typedef enum +{ + SENSOR_GYR_RESOLUTION = 0, + SENSOR_GYR_MIN_RANGE, + SENSOR_GYR_MAX_RANGE, + SENSOR_GYR_DATA_FIELD_PROPERTY_COUNT +} SENSOR_GYR_DATA_FIELD_PROPERTY_INDEX; + +// Supported Data +typedef enum +{ + FUSIONSENSOR_DATA_TIMESTAMP = 0, + FUSIONSENSOR_DATA_QUATERNION_W, + FUSIONSENSOR_DATA_QUATERNION_X, + FUSIONSENSOR_DATA_QUATERNION_Y, + FUSIONSENSOR_DATA_QUATERNION_Z, + FUSIONSENSOR_DATA_ACCURACY, + FUSIONSENSOR_DATA_DECLINATION_ANGLE, + FUSIONSENSOR_DATA_COUNT +} FUSIONSENSOR_DATA_INDEX; + +typedef enum +{ + FUSIONSENSOR_THRESHOLD_ROTATION_ANGLE = 0, + FUSIONSENSOR_THRESHOLD_LINEAR_ACCELERATION_X, + FUSIONSENSOR_THRESHOLD_LINEAR_ACCELERATION_Y, + FUSIONSENSOR_THRESHOLD_LINEAR_ACCELERATION_Z, + FUSIONSENSOR_THRESHOLD_ROTATION_RATE_X, + FUSIONSENSOR_THRESHOLD_ROTATION_RATE_Y, + FUSIONSENSOR_THRESHOLD_ROTATION_RATE_Z, + FUSIONSENSOR_THRESHOLD_COUNT +} FUSIONSENSOR_THRESHOLD_INDEX; + +typedef struct FusionSensorSample +{ + FILETIME Timestamp; + QUATERNION Quaternion; + ULONG Accuracy; + FLOAT DeclinationAngle; +} FusionSensorSample, *PFusionSensorSample; + +// +// Fusion Threshold +// +typedef struct _FusThreshold +{ + FLOAT RotationAngle; + VEC3D LinearAcceleration; + VEC3D RotationRate; +} FusThreshold, *PFusThreshold; + +typedef class FusionSensorDevice +{ +private: + // Simulator + WDFOBJECT m_SimulatorInstance; + + // WDF + WDFDEVICE m_FxDevice; + SENSOROBJECT m_SensorInstance; + WDFWAITLOCK m_Lock; + WDFTIMER m_Timer; + + // Sensor operation + BOOLEAN m_PoweredOn; + BOOLEAN m_Started; + ULONG m_Interval; + + BOOLEAN m_FirstSample; + ULONG m_StartTime; + ULONGLONG m_SampleCount; + + FusThreshold m_CachedThresholds; + + FusionSensorSample m_LastSample; + + // Sensor Specific Properties + PSENSOR_COLLECTION_LIST m_pEnumerationProperties; + PSENSOR_COLLECTION_LIST m_pProperties; + PSENSOR_PROPERTY_LIST m_pSupportedDataFields; + PSENSOR_COLLECTION_LIST m_pAccDataFieldProperties; // Accelerometer related datafield properties + PSENSOR_COLLECTION_LIST m_pGyrDataFieldProperties; // Gyroscope related datafield properties + PSENSOR_COLLECTION_LIST m_pThresholds; + PSENSOR_COLLECTION_LIST m_pData; + +public: + // WDF callbacks + static EVT_WDF_DRIVER_DEVICE_ADD OnDeviceAdd; + static EVT_WDF_DEVICE_PREPARE_HARDWARE OnPrepareHardware; + static EVT_WDF_DEVICE_RELEASE_HARDWARE OnReleaseHardware; + static EVT_WDF_DEVICE_D0_ENTRY OnD0Entry; + static EVT_WDF_DEVICE_D0_EXIT OnD0Exit; + static EVT_WDF_TIMER OnTimerExpire; + + // CLX callbacks + static EVT_SENSOR_DRIVER_START_SENSOR OnStart; + static EVT_SENSOR_DRIVER_STOP_SENSOR OnStop; + static EVT_SENSOR_DRIVER_GET_SUPPORTED_DATA_FIELDS OnGetSupportedDataFields; + static EVT_SENSOR_DRIVER_GET_PROPERTIES OnGetProperties; + static EVT_SENSOR_DRIVER_GET_DATA_FIELD_PROPERTIES OnGetDataFieldProperties; + static EVT_SENSOR_DRIVER_GET_DATA_INTERVAL OnGetDataInterval; + static EVT_SENSOR_DRIVER_SET_DATA_INTERVAL OnSetDataInterval; + static EVT_SENSOR_DRIVER_GET_DATA_THRESHOLDS OnGetDataThresholds; + static EVT_SENSOR_DRIVER_SET_DATA_THRESHOLDS OnSetDataThresholds; + static EVT_SENSOR_DRIVER_DEVICE_IO_CONTROL OnIoControl; + +private: + + NTSTATUS Initialize(_In_ WDFDEVICE Device, _In_ SENSOROBJECT SensorObj); + NTSTATUS GetData(); + +} FusionSensorDevice, *PFusionSensorDevice; + +// Set up accessor function to retrieve device context +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(FusionSensorDevice, GetFusionSensorContextFromSensorInstance); + +#define FusionSensorDevice_StepCount_Resolution (1) +#define FusionSensorDevice_StepCount_Minimum (0) +#define FusionSensorDevice_StepCount_Maximum (0xFFFFFFFF) diff --git a/sensors/Fusion/Driver.h b/sensors/Fusion/Driver.h new file mode 100644 index 00000000..46153894 --- /dev/null +++ b/sensors/Fusion/Driver.h @@ -0,0 +1,19 @@ +//Copyright (C) Microsoft Corporation, All Rights Reserved +// +//Abstract: +// +// This module contains the type definitions for the FusionSensor sample driver's +// driver callback class. +// +//Environment: +// +// Windows User-Mode Driver Framework (UMDF) + +#pragma once + +WDF_EXTERN_C_START + +DRIVER_INITIALIZE DriverEntry; +EVT_WDF_DRIVER_UNLOAD OnDriverUnload; + +WDF_EXTERN_C_END \ No newline at end of file diff --git a/sensors/Fusion/FusionSensor.ctl b/sensors/Fusion/FusionSensor.ctl new file mode 100644 index 00000000..54959227 --- /dev/null +++ b/sensors/Fusion/FusionSensor.ctl @@ -0,0 +1 @@ +0E08A3BA,F045,44EE,B00C,292C91C5F95A FusionSensorTraceGuid diff --git a/sensors/Fusion/FusionSensor.def b/sensors/Fusion/FusionSensor.def new file mode 100644 index 00000000..f49a363a --- /dev/null +++ b/sensors/Fusion/FusionSensor.def @@ -0,0 +1,6 @@ +; FusionSensor.def : Declares the module parameters. + +LIBRARY FusionSensor + +EXPORTS + diff --git a/sensors/Fusion/FusionSensor.inx b/sensors/Fusion/FusionSensor.inx new file mode 100644 index 00000000..1c562304 Binary files /dev/null and b/sensors/Fusion/FusionSensor.inx differ diff --git a/sensors/Fusion/FusionSensor.sln b/sensors/Fusion/FusionSensor.sln new file mode 100644 index 00000000..39ab0322 --- /dev/null +++ b/sensors/Fusion/FusionSensor.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0 +MinimumVisualStudioVersion = 12.0 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FusionSensor", "FusionSensor.vcxproj", "{2D98FAA6-F523-420D-9F3A-480CD7C3F9CA}" +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 + {2D98FAA6-F523-420D-9F3A-480CD7C3F9CA}.Debug|Win32.ActiveCfg = Debug|Win32 + {2D98FAA6-F523-420D-9F3A-480CD7C3F9CA}.Debug|Win32.Build.0 = Debug|Win32 + {2D98FAA6-F523-420D-9F3A-480CD7C3F9CA}.Release|Win32.ActiveCfg = Release|Win32 + {2D98FAA6-F523-420D-9F3A-480CD7C3F9CA}.Release|Win32.Build.0 = Release|Win32 + {2D98FAA6-F523-420D-9F3A-480CD7C3F9CA}.Debug|x64.ActiveCfg = Debug|x64 + {2D98FAA6-F523-420D-9F3A-480CD7C3F9CA}.Debug|x64.Build.0 = Debug|x64 + {2D98FAA6-F523-420D-9F3A-480CD7C3F9CA}.Release|x64.ActiveCfg = Release|x64 + {2D98FAA6-F523-420D-9F3A-480CD7C3F9CA}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/sensors/Fusion/FusionSensor.vcxproj b/sensors/Fusion/FusionSensor.vcxproj new file mode 100644 index 00000000..f7a68e66 --- /dev/null +++ b/sensors/Fusion/FusionSensor.vcxproj @@ -0,0 +1,203 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {2D98FAA6-F523-420D-9F3A-480CD7C3F9CA} + $(MSBuildProjectName) + 2 + Debug + Win32 + {63E5D8E2-D2E3-4B7E-9F5A-78DA39FA9BED} + + + + Windows10 + False + Universal + UMDF + WindowsUserModeDriver10.0 + DynamicLibrary + + + Windows10 + True + Universal + UMDF + WindowsUserModeDriver10.0 + DynamicLibrary + + + Windows10 + False + Universal + UMDF + WindowsUserModeDriver10.0 + DynamicLibrary + + + Windows10 + True + Universal + UMDF + WindowsUserModeDriver10.0 + DynamicLibrary + + + + $(IntDir) + + + + + + + + + + + + + + + + true + true + FusionSensor + sensorstrace.h + + + $(InfArch) + true + .\$(IntDir)\FusionSensor.inf + + + + FusionSensor + + + FusionSensor + + + FusionSensor + + + FusionSensor + AllRules.ruleset + + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + true + Level4 + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + %(AdditionalDependencies);$(SDK_LIB_PATH)\mincore.lib;$(SDK_LIB_PATH)\propsys.lib;$(SDK_LIB_PATH)\sensors\1.1\sensorscxstub.lib;$(SDK_LIB_PATH)\sensorsutils.lib + FusionSensor.def + + + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + true + Level4 + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + Sync + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + %(AdditionalDependencies);$(SDK_LIB_PATH)\mincore.lib;$(SDK_LIB_PATH)\propsys.lib;$(SDK_LIB_PATH)\sensors\1.1\sensorscxstub.lib;$(SDK_LIB_PATH)\sensorsutils.lib + FusionSensor.def + + + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + true + Level4 + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + %(AdditionalDependencies);$(SDK_LIB_PATH)\mincore.lib;$(SDK_LIB_PATH)\propsys.lib;$(SDK_LIB_PATH)\sensors\1.1\sensorscxstub.lib;$(SDK_LIB_PATH)\sensorsutils.lib + FusionSensor.def + + + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + true + Level4 + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + Sync + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + %(PreprocessorDefinitions);_UNICODE;UNICODE;WPP_MACRO_USE_KM_VERSION_FOR_UM + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);$(DDK_INC_PATH)\sensors\1.1;$(SDK_INC_PATH)\sensors\1.1 + + + %(AdditionalDependencies);$(SDK_LIB_PATH)\mincore.lib;$(SDK_LIB_PATH)\propsys.lib;$(SDK_LIB_PATH)\sensors\1.1\sensorscxstub.lib;$(SDK_LIB_PATH)\sensorsutils.lib + FusionSensor.def + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sensors/Fusion/FusionSensor.vcxproj.Filters b/sensors/Fusion/FusionSensor.vcxproj.Filters new file mode 100644 index 00000000..a5ed8ef6 --- /dev/null +++ b/sensors/Fusion/FusionSensor.vcxproj.Filters @@ -0,0 +1,43 @@ + + + + + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* + {47BC76FB-31D6-4043-A1F0-24C8EE1EC77D} + + + h;hpp;hxx;hm;inl;inc;xsd + {822384CB-A39F-4A21-8529-34A65C4CE181} + + + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml + {C6D84098-A64B-429D-8EE2-D8ED8C5BF2FE} + + + inf;inv;inx;mof;mc; + {A379ED39-5FF0-4DB2-A773-BDEA4FB77D87} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Driver Files + + + \ No newline at end of file diff --git a/sensors/Fusion/HardwareSimulator.h b/sensors/Fusion/HardwareSimulator.h new file mode 100644 index 00000000..67e56436 --- /dev/null +++ b/sensors/Fusion/HardwareSimulator.h @@ -0,0 +1,60 @@ +//Copyright (C) Microsoft Corporation, All Rights Reserved +// +//Abstract: +// +// This module contains the type definitions for the FusionSensor sample driver +// hardware simulator. +// +//Environment: +// +// Windows User-Mode Driver Framework (UMDF) + +#pragma once + +#include +#include + +#include "SensorsTrace.h" +#include + +#include "Device.h" + +#define SIMULATOR_HARDWARE_INTERVAL_MS (1000) // 1 second interval in milliseconds + +typedef enum SIMULATOR_STATE +{ + SimulatorState_NotInitialized = 0, + SimulatorState_Initialized, + SimulatorState_Started +} SIMULATOR_STATE; + +typedef class HardwareSimulator +{ +private: + WDFTIMER m_Timer; + ULONG m_Index; + WDFWAITLOCK m_Lock; + SIMULATOR_STATE m_State; + WDFOBJECT m_SimulatorInstance; + BOOLEAN m_HasReset; + +public: + HardwareSimulator(); + ~HardwareSimulator(); + + // WDF callbacks + static EVT_WDF_TIMER OnTimerExpire; + + static NTSTATUS Initialize(_In_ WDFDEVICE Device, _Out_ WDFOBJECT *SimulatorInstance); + NTSTATUS Cleanup(); + NTSTATUS Start(); + NTSTATUS Stop(); + NTSTATUS GetSample(_Out_ FusionSensorSample *Sample); + +private: + NTSTATUS InitializeInternal(_In_ WDFOBJECT SimulatorInstance); +} HardwareSimulator, *PHardwareSimulator; + + +// Set up accessor function to retrieve device context +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(HardwareSimulator, GetHardwareSimulatorContextFromInstance); diff --git a/sensors/Fusion/SensorsTrace.h b/sensors/Fusion/SensorsTrace.h new file mode 100644 index 00000000..8b3b8769 --- /dev/null +++ b/sensors/Fusion/SensorsTrace.h @@ -0,0 +1,102 @@ +//Copyright (C) Microsoft Corporation, All Rights Reserved +// +//Abstract: +// +// Header file for the debug tracing related function defintions and macros. +// +//Environment: +// +// User mode + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +// Define the tracing flags. +// +// Tracing GUID - 0E08A3BA-F045-44EE-B00C-292C91C5F95A + +#define WPP_CONTROL_GUIDS \ + WPP_DEFINE_CONTROL_GUID( \ + FusionSensorTraceGuid, (0E08A3BA,F045,44EE,B00C,292C91C5F95A), \ + WPP_DEFINE_BIT(EntryExit) \ + WPP_DEFINE_BIT(DataFlow) \ + WPP_DEFINE_BIT(Verbose) \ + WPP_DEFINE_BIT(Information) \ + WPP_DEFINE_BIT(Warning) \ + WPP_DEFINE_BIT(Error) \ + WPP_DEFINE_BIT(Fatal) \ + WPP_DEFINE_BIT(DriverStatus) \ + ) + +#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(level,flags) WPP_LEVEL_LOGGER(flags) + +#define WPP_LEVEL_FLAGS_ENABLED(level, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= level) + +// This comment block is scanned by the trace preprocessor to define our +// Trace function. +// +// begin_wpp config +// +// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...); +// +// FUNC TraceFatal{LEVEL=TRACE_LEVEL_FATAL,FLAGS=Fatal}(MSG,...); +// FUNC TraceError{LEVEL=TRACE_LEVEL_ERROR,FLAGS=Error}(MSG,...); +// FUNC TraceWarning{LEVEL=TRACE_LEVEL_WARNING,FLAGS=Warning}(MSG,...); +// FUNC TraceInformation{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=Information}(MSG,...); +// FUNC TraceVerbose{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=Verbose}(MSG,...); +// FUNC TracePerformance{PERF=DUMMY,LEVEL=TRACE_LEVEL_PERF}(FLAGS,MSG,...); +// +// FUNC TraceData{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=DataFlow}(MSG,...); +// +// FUNC TraceDriverStatus{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=DriverStatus}(MSG,...); +// +// end_wpp + + + +// SENSOR ------------------------------------------------------------------------------------------------ + +// MACRO: SENSOR_FunctionEnter +// +// begin_wpp config +// USEPREFIX (SENSOR_FunctionEnter, "%!STDPREFIX! SENSOR %!FUNC! FunctionEnter"); +// FUNC SENSOR_FunctionEnter{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=EntryExit}(...); +// end_wpp + + +// MACRO: SENSOR_FunctionExit +// +// begin_wpp config +// USEPREFIX (SENSOR_FunctionExit, "%!STDPREFIX! SENSOR %!FUNC! FunctionExit: %!STATUS!", __status); +// FUNC SENSOR_FunctionExit{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=EntryExit}(SENSOREXIT); +// end_wpp +#define WPP_LEVEL_FLAGS_SENSOREXIT_ENABLED(LEVEL, FLAGS, status) WPP_LEVEL_FLAGS_ENABLED(LEVEL, FLAGS) +#define WPP_LEVEL_FLAGS_SENSOREXIT_LOGGER(LEVEL, FLAGS, status) WPP_LEVEL_FLAGS_LOGGER(LEVEL, FLAGS) + +#define WPP_LEVEL_FLAGS_SENSOREXIT_PRE(LEVEL, FLAGS, status) { \ + NTSTATUS __status = status; +#define WPP_LEVEL_FLAGS_SENSOREXIT_POST(LEVEL, FLAGS, status) /*TraceMessage()*/; \ + } + + + +// WPP Recorder ------------------------------------------------------------------------------------------- +// +// The following two macros are required to enable WPP Recorder functionality for clients of the Sensor Class Extension +// +#define WPP_RECORDER_LEVEL_FLAGS_SENSOREXIT_FILTER(LEVEL, FLAGS, status) WPP_RECORDER_LEVEL_FLAGS_FILTER(LEVEL, FLAGS) +#define WPP_RECORDER_LEVEL_FLAGS_SENSOREXIT_ARGS(LEVEL, FLAGS, status) WPP_RECORDER_LEVEL_FLAGS_ARGS(LEVEL, FLAGS) + + +#ifdef __cplusplus +} +#endif + + diff --git a/sensors/Fusion/client.cpp b/sensors/Fusion/client.cpp new file mode 100644 index 00000000..686b4197 --- /dev/null +++ b/sensors/Fusion/client.cpp @@ -0,0 +1,789 @@ +//Copyright (C) Microsoft Corporation, All Rights Reserved. +// +//Abstract: +// +// This module contains the implementation of driver callback function +// from clx to FusionSensor. +// +//Environment: +// +// Windows User-Mode Driver Framework (UMDF) + +#include "Device.h" +#include "HardwareSimulator.h" + +#include +#include + +#include "Client.tmh" + +// This routine is called by worker thread to read a single sample, compare threshold +// and push it back to CLX. It simulates hardware thresholding by only generating data +// when the change of data is greater than threshold. +NTSTATUS +FusionSensorDevice::GetData( +) +{ + // TODO: Remove the HardwareSimulator code in your final driver. The HardwareSimulator is only used for the purpose of demonstrating how sensor driver samples work. + PHardwareSimulator pSimulator = GetHardwareSimulatorContextFromInstance(m_SimulatorInstance); + BOOLEAN DataReady = FALSE; + NTSTATUS Status = STATUS_SUCCESS; + FusionSensorSample Sample = {}; + + SENSOR_FunctionEnter(); + + if (nullptr == pSimulator) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! GetHardwareSimulatorContextFromInstance failed %!STATUS!", Status); + goto Exit; + } + + // TODO: In this case, we are calling into the HardwareSimulator code to get some simulated data. + // In a real driver (which either communicates with real hardware or some other drivers), this call should be replaced by some + // logic to get data comming from the hardware/other drivers. The "Sample" variable is expected to contain actual data from here on. + Status = pSimulator->GetSample(&Sample); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! GetSample failed %!STATUS!", Status); + goto Exit; + } + + if (FALSE != m_FirstSample) + { + Status = GetPerformanceTime(&m_StartTime); + if (!NT_SUCCESS(Status)) + { + m_StartTime = 0; + TraceError("FUS %!FUNC! GetPerformanceTime failed %!STATUS!", Status); + } + + m_SampleCount = 0; + + DataReady = TRUE; + } + else + { + // Compare the change of data to threshold, and only push the data back to + // clx if the change exceeds threshold. + + CQUATERNION Quaternion = Sample.Quaternion; + FLOAT RotationAngle = Quaternion.ToAngleAxis(nullptr) * RadToDegRatio; + + CQUATERNION LastQuaternion = m_LastSample.Quaternion; + FLOAT LastRotationAngle = LastQuaternion.ToAngleAxis(nullptr) * RadToDegRatio; + + TraceData("FUS %!FUNC! Rotation Angle: new=%f, old=%f", RotationAngle, LastRotationAngle); + + if ((abs(RotationAngle - LastRotationAngle) >= m_CachedThresholds.RotationAngle)) + { + DataReady = TRUE; + } + } + + if (FALSE != DataReady) + { + // update last sample + m_LastSample.Quaternion = Sample.Quaternion; + m_LastSample.Accuracy = Sample.Accuracy; + m_LastSample.DeclinationAngle = Sample.DeclinationAngle; + + // push to clx + InitPropVariantFromFileTime(&m_LastSample.Timestamp, &(m_pData->List[FUSIONSENSOR_DATA_TIMESTAMP].Value)); + InitPropVariantFromFloat(m_LastSample.Quaternion.W, &(m_pData->List[FUSIONSENSOR_DATA_QUATERNION_W].Value)); + InitPropVariantFromFloat(m_LastSample.Quaternion.X, &(m_pData->List[FUSIONSENSOR_DATA_QUATERNION_X].Value)); + InitPropVariantFromFloat(m_LastSample.Quaternion.Y, &(m_pData->List[FUSIONSENSOR_DATA_QUATERNION_Y].Value)); + InitPropVariantFromFloat(m_LastSample.Quaternion.Z, &(m_pData->List[FUSIONSENSOR_DATA_QUATERNION_Z].Value)); + InitPropVariantFromUInt32(m_LastSample.Accuracy, &(m_pData->List[FUSIONSENSOR_DATA_ACCURACY].Value)); + InitPropVariantFromFloat(m_LastSample.DeclinationAngle, &(m_pData->List[FUSIONSENSOR_DATA_DECLINATION_ANGLE].Value)); + + + SensorsCxSensorDataReady(m_SensorInstance, m_pData); + m_FirstSample = FALSE; + } + else + { + Status = STATUS_DATA_NOT_ACCEPTED; + TraceInformation("FUS %!FUNC! Data did NOT meet the threshold"); + } + + SENSOR_FunctionExit(Status); + +Exit: + return Status; +} + + + +// This callback is called when interval wait time has expired and driver is ready +// to collect new sample. The callback reads current value, compare value to threshold, +// pushes it up to CLX framework, and schedule next wake up time. +VOID +FusionSensorDevice::OnTimerExpire( + _In_ WDFTIMER Timer // WDF timer object + ) +{ + PFusionSensorDevice pDevice = nullptr; + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + pDevice = GetFusionSensorContextFromSensorInstance(WdfTimerGetParentObject(Timer)); + if (nullptr == pDevice) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! GetFusionSensorContextFromSensorInstance failed %!STATUS!", Status); + goto Exit; + } + + // Get data and push to clx + WdfWaitLockAcquire(pDevice->m_Lock, NULL); + Status = pDevice->GetData(); + if (!NT_SUCCESS(Status) && Status != STATUS_DATA_NOT_ACCEPTED) + { + TraceError("FUS %!FUNC! GetData Failed %!STATUS!", Status); + } + WdfWaitLockRelease(pDevice->m_Lock); + + // Schedule next wake up time + if (FALSE != pDevice->m_PoweredOn && + FALSE != pDevice->m_Started) + { + LONGLONG WaitTimeHundredNanoseconds = 0; // in unit of 100ns + + if (0 == pDevice->m_StartTime) + { + // in case we fail to get sensor start time, use static wait time + WaitTimeHundredNanoseconds = WDF_REL_TIMEOUT_IN_MS(pDevice->m_Interval); + } + else + { + ULONG CurrentTimeMs = 0; + + // dynamically calculate wait time to avoid jitter + Status = GetPerformanceTime (&CurrentTimeMs); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! GetPerformanceTime %!STATUS!", Status); + WaitTimeHundredNanoseconds = WDF_REL_TIMEOUT_IN_MS(pDevice->m_Interval); + } + else + { + pDevice->m_SampleCount++; + if (CurrentTimeMs > (pDevice->m_StartTime + (pDevice->m_Interval * (pDevice->m_SampleCount + 1)))) + { + // If we skipped two or more beats, reschedule the timer with a zero due time to catch up on missing samples + WaitTimeHundredNanoseconds = 0; + } + else + { + WaitTimeHundredNanoseconds = (pDevice->m_StartTime + + (pDevice->m_Interval * (pDevice->m_SampleCount + 1))) - CurrentTimeMs; + } + WaitTimeHundredNanoseconds = WDF_REL_TIMEOUT_IN_MS(WaitTimeHundredNanoseconds); + } + } + WdfTimerStart(pDevice->m_Timer, WaitTimeHundredNanoseconds); + } + +Exit: + + SENSOR_FunctionExit(Status); +} + + + +// Called by Sensor CLX to begin continuously sampling the sensor. +NTSTATUS +FusionSensorDevice::OnStart( + _In_ SENSOROBJECT SensorInstance // Sensor device object + ) +{ + PHardwareSimulator pSimulator = nullptr; + PFusionSensorDevice pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (nullptr == pDevice) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! Sensor(0x%p) parameter is invalid. Failed %!STATUS!", SensorInstance, Status); + goto Exit; + } + + // Get the simulator context + pSimulator = GetHardwareSimulatorContextFromInstance(pDevice->m_SimulatorInstance); + if (nullptr == pSimulator) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! GetHardwareSimulatorContextFromInstance failed %!STATUS!", Status); + } + + if (NT_SUCCESS(Status)) + { + // Start the simulator + pSimulator->Start(); + + pDevice->m_FirstSample = TRUE; + + // Start polling + + pDevice->m_Started = TRUE; + + InitPropVariantFromUInt32(SensorState_Active, + &(pDevice->m_pProperties->List[SENSOR_PROPERTY_STATE].Value)); + + // Start the sample polling timer. + // + // Note: The polling timer is configured to allow for the first sample to be reported immediately. + // Some hardware may want to delay the first sample report a little to account for hardware start time. + WdfTimerStart(pDevice->m_Timer, WDF_REL_TIMEOUT_IN_MS(FusionSensor_Default_MinDataInterval_Ms)); + } +Exit: + SENSOR_FunctionExit(Status); + return Status; +} + + + +// Called by Sensor CLX to stop continuously sampling the sensor. +NTSTATUS +FusionSensorDevice::OnStop( + _In_ SENSOROBJECT SensorInstance // Sensor device object + ) +{ + PHardwareSimulator pSimulator = nullptr; + PFusionSensorDevice pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (nullptr == pDevice) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! Sensor(0x%p) parameter is invalid. Failed %!STATUS!", SensorInstance, Status); + goto Exit; + } + + // Stop polling + pDevice->m_Started = FALSE; + + // Waiting for the callback to complete, then stopping the timer + WdfTimerStop(pDevice->m_Timer, TRUE); + + InitPropVariantFromUInt32(SensorState_Idle, + &(pDevice->m_pProperties->List[SENSOR_PROPERTY_STATE].Value)); + + // Stop the simulator + pSimulator = GetHardwareSimulatorContextFromInstance(pDevice->m_SimulatorInstance); + if (nullptr == pSimulator) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! GetHardwareSimulatorContextFromInstance failed %!STATUS!", Status); + goto Exit; + } + + pSimulator->Stop(); + +Exit: + SENSOR_FunctionExit(Status); + return Status; +} + +// Called by Sensor CLX to get supported data fields. The typical usage is to call +// this function once with buffer pointer as NULL to acquire the required size +// for the buffer, allocate buffer, then call the function again to retrieve +// sensor information. +NTSTATUS +FusionSensorDevice::OnGetSupportedDataFields( + _In_ SENSOROBJECT SensorInstance, // Sensor device object + _Inout_opt_ PSENSOR_PROPERTY_LIST pFields, // Pointer to a list of supported properties + _Out_ PULONG pSize // Number of bytes for the list of supported properties + ) +{ + PFusionSensorDevice pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (nullptr == pDevice || nullptr == pSize) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! Invalid parameters! %!STATUS!", Status); + goto Exit; + } + + if (nullptr == pFields) + { + // Just return size + *pSize = pDevice->m_pSupportedDataFields->AllocatedSizeInBytes; + } + else + { + if (pFields->AllocatedSizeInBytes < pDevice->m_pSupportedDataFields->AllocatedSizeInBytes) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! Buffer is too small. Failed %!STATUS!", Status); + goto Exit; + } + + // Fill out data + Status = PropertiesListCopy(pFields, pDevice->m_pSupportedDataFields); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! PropertiesListCopy failed %!STATUS!", Status); + goto Exit; + } + + *pSize = pDevice->m_pSupportedDataFields->AllocatedSizeInBytes; + } + +Exit: + if (!NT_SUCCESS(Status)) + { + *pSize = 0; + } + SENSOR_FunctionExit(Status); + return Status; +} + + + +// Called by Sensor CLX to get sensor properties. The typical usage is to call +// this function once with buffer pointer as NULL to acquire the required size +// for the buffer, allocate buffer, then call the function again to retrieve +// sensor information. +NTSTATUS +FusionSensorDevice::OnGetProperties( + _In_ SENSOROBJECT SensorInstance, // Sensor device object + _Inout_opt_ PSENSOR_COLLECTION_LIST pProperties, // Pointer to a list of sensor properties + _Out_ PULONG pSize // Number of bytes for the list of sensor properties + ) +{ + PFusionSensorDevice pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (nullptr == pDevice || nullptr == pSize) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! Invalid parameters! %!STATUS!", Status); + goto Exit; + } + + if (nullptr == pProperties) + { + // Just return size + *pSize = CollectionsListGetMarshalledSize(pDevice->m_pProperties); + } + else + { + if (pProperties->AllocatedSizeInBytes < + CollectionsListGetMarshalledSize(pDevice->m_pProperties)) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! Buffer is too small. Failed %!STATUS!", Status); + goto Exit; + } + + // Fill out all data + Status = CollectionsListCopyAndMarshall(pProperties, pDevice->m_pProperties); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! CollectionsListCopyAndMarshall failed %!STATUS!", Status); + goto Exit; + } + + *pSize = CollectionsListGetMarshalledSize(pDevice->m_pProperties); + } + +Exit: + if (!NT_SUCCESS(Status)) + { + *pSize = 0; + } + SENSOR_FunctionExit(Status); + return Status; +} + + +// Called by Sensor CLX to get data field properties. The typical usage is to call +// this function once with buffer pointer as NULL to acquire the required size +// for the buffer, allocate buffer, then call the function again to retrieve +// sensor information. +NTSTATUS +FusionSensorDevice::OnGetDataFieldProperties( + _In_ SENSOROBJECT SensorInstance, // Sensor device object + _In_ const PROPERTYKEY *DataField, // Pointer to the propertykey of requested property + _Inout_opt_ PSENSOR_COLLECTION_LIST pProperties, // Pointer to a list of sensor properties + _Out_ PULONG pSize // Number of bytes for the list of sensor properties + ) +{ + PFusionSensorDevice pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (nullptr == pDevice || nullptr == pSize || nullptr == DataField) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! Invalid parameters! %!STATUS!", Status); + goto Exit; + } + + + if ((*DataField == PKEY_SensorData_LinearAccelerationX_Gs) || + (*DataField == PKEY_SensorData_LinearAccelerationY_Gs) || + (*DataField == PKEY_SensorData_LinearAccelerationZ_Gs)) + { + // Linear Acceleration + if (nullptr == pProperties) + { + // Just return size + *pSize = CollectionsListGetMarshalledSize(pDevice->m_pAccDataFieldProperties); + } + else + { + if (pProperties->AllocatedSizeInBytes < + CollectionsListGetMarshalledSize(pDevice->m_pAccDataFieldProperties)) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! Buffer is too small. Failed %!STATUS!", Status); + goto Exit; + } + + // Fill out all data + Status = CollectionsListCopyAndMarshall(pProperties, pDevice->m_pAccDataFieldProperties); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! CollectionsListCopyAndMarshall failed %!STATUS!", Status); + goto Exit; + } + + *pSize = CollectionsListGetMarshalledSize(pDevice->m_pAccDataFieldProperties); + } + } + else if ((*DataField == PKEY_SensorData_CorrectedAngularVelocityX_DegreesPerSecond) || + (*DataField == PKEY_SensorData_CorrectedAngularVelocityY_DegreesPerSecond) || + (*DataField == PKEY_SensorData_CorrectedAngularVelocityZ_DegreesPerSecond)) + { + // Rotation Rate + if (nullptr == pProperties) + { + // Just return size + *pSize = CollectionsListGetMarshalledSize(pDevice->m_pGyrDataFieldProperties); + } + else + { + if (pProperties->AllocatedSizeInBytes < + CollectionsListGetMarshalledSize(pDevice->m_pGyrDataFieldProperties)) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! Buffer is too small. Failed %!STATUS!", Status); + goto Exit; + } + + // Fill out all data + Status = CollectionsListCopyAndMarshall(pProperties, pDevice->m_pGyrDataFieldProperties); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! CollectionsListCopyAndMarshall failed %!STATUS!", Status); + goto Exit; + } + + *pSize = CollectionsListGetMarshalledSize(pDevice->m_pGyrDataFieldProperties); + } + } + else + { + Status = STATUS_NOT_SUPPORTED; + TraceError("FUS %!FUNC! Fusion sensor does NOT have properties for this data field. Failed %!STATUS!", Status); + goto Exit; + } + +Exit: + if (!NT_SUCCESS(Status)) + { + *pSize = 0; + } + SENSOR_FunctionExit(Status); + return Status; +} + + + +// Called by Sensor CLX to get sampling rate of the sensor. +NTSTATUS +FusionSensorDevice::OnGetDataInterval( + _In_ SENSOROBJECT SensorInstance, // Sensor device object + _Out_ PULONG DataRateMs // Sampling rate in ms + ) +{ + PFusionSensorDevice pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (nullptr == pDevice) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! Sensor(0x%p) parameter is invalid. Failed %!STATUS!", SensorInstance, Status); + goto Exit; + } + + if (nullptr == DataRateMs) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! DataRateMs(0x%p) parameter is invalid. Failed %!STATUS!", DataRateMs, Status); + goto Exit; + } + + *DataRateMs = pDevice->m_Interval; + +Exit: + SENSOR_FunctionExit(Status); + return Status; +} + + + +// Called by Sensor CLX to set sampling rate of the sensor. +NTSTATUS +FusionSensorDevice::OnSetDataInterval( + _In_ SENSOROBJECT SensorInstance, // Sensor device object + _In_ ULONG DataRateMs // Sampling rate in ms + ) +{ + PFusionSensorDevice pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (nullptr == pDevice) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! Sensor(0x%p) parameter is invalid. Failed %!STATUS!", SensorInstance, Status); + goto Exit; + } + + if (FusionSensor_Default_MinDataInterval_Ms > DataRateMs) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! DataRateMs(%d) parameter is smaller than the minimum data interval. Failed %!STATUS!", DataRateMs, Status); + goto Exit; + } + + pDevice->m_Interval = DataRateMs; + + // reschedule sample to return as soon as possible if it's started + if (FALSE != pDevice->m_Started) + { + pDevice->m_Started = FALSE; + WdfTimerStop(pDevice->m_Timer, TRUE); + + pDevice->m_Started = TRUE; + pDevice->m_FirstSample = TRUE; + WdfTimerStart(pDevice->m_Timer, WDF_REL_TIMEOUT_IN_MS(FusionSensor_Default_MinDataInterval_Ms)); + } + +Exit: + SENSOR_FunctionExit(Status); + return Status; +} + + + +// Called by Sensor CLX to get data thresholds. The typical usage is to call +// this function once with buffer pointer as NULL to acquire the required size +// for the buffer, allocate buffer, then call the function again to retrieve +// sensor information. +NTSTATUS +FusionSensorDevice::OnGetDataThresholds( + _In_ SENSOROBJECT SensorInstance, // Sensor device object + _Inout_opt_ PSENSOR_COLLECTION_LIST pThresholds, // Pointer to a list of sensor thresholds + _Out_ PULONG pSize // Number of bytes for the list of sensor thresholds + ) +{ + PFusionSensorDevice pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (nullptr == pDevice || nullptr == pSize) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! Invalid parameters! %!STATUS!", Status); + goto Exit; + } + + if (nullptr == pThresholds) + { + // Just return size + *pSize = CollectionsListGetMarshalledSize(pDevice->m_pThresholds); + } + else + { + if (pThresholds->AllocatedSizeInBytes < + CollectionsListGetMarshalledSize(pDevice->m_pThresholds)) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! Buffer is too small. Failed %!STATUS!", Status); + goto Exit; + } + + // Fill out all data + Status = CollectionsListCopyAndMarshall(pThresholds, pDevice->m_pThresholds); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! CollectionsListCopyAndMarshall failed %!STATUS!", Status); + goto Exit; + } + + *pSize = CollectionsListGetMarshalledSize(pDevice->m_pThresholds); + } + +Exit: + if (!NT_SUCCESS(Status)) + { + *pSize = 0; + } + + SENSOR_FunctionExit(Status); + + return Status; +} + + + +// Called by Sensor CLX to set data thresholds. +NTSTATUS +FusionSensorDevice::OnSetDataThresholds( + _In_ SENSOROBJECT SensorInstance, // Sensor device object + _In_ PSENSOR_COLLECTION_LIST pThresholds // Pointer to a list of sensor thresholds + ) +{ + ULONG Element; + BOOLEAN IsLocked = FALSE; + PFusionSensorDevice pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (pDevice == nullptr) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! Sensor(0x%p) parameter is invalid. Failed %!STATUS!", SensorInstance, Status); + goto Exit; + } + + WdfWaitLockAcquire(pDevice->m_Lock, NULL); + IsLocked = TRUE; + + for (Element = 0; Element < pThresholds->Count; Element++) + { + Status = PropKeyFindKeySetPropVariant(pDevice->m_pThresholds, + &(pThresholds->List[Element].Key), + TRUE, + &(pThresholds->List[Element].Value)); + if (!NT_SUCCESS(Status)) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! FusionSensor driver does NOT have threshold for this data field. Failed %!STATUS!", Status); + goto Exit; + } + } + + // Get data thresholds + Status = PropKeyFindKeyGetFloat(pDevice->m_pThresholds, + &PKEY_SensorData_RotationAngle_Degrees, + &(pDevice->m_CachedThresholds.RotationAngle)); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! PropKeyFindKeyGetFloat for rotation angle failed! %!STATUS!", Status); + goto Exit; + } + + Status = PropKeyFindKeyGetFloat(pDevice->m_pThresholds, + &PKEY_SensorData_LinearAccelerationX_Gs, + &(pDevice->m_CachedThresholds.LinearAcceleration.X)); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! PropKeyFindKeyGetFloat for linear acceleration X failed! %!STATUS!", Status); + goto Exit; + } + + Status = PropKeyFindKeyGetFloat(pDevice->m_pThresholds, + &PKEY_SensorData_LinearAccelerationY_Gs, + &(pDevice->m_CachedThresholds.LinearAcceleration.Y)); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! PropKeyFindKeyGetFloat for linear acceleration Y failed! %!STATUS!", Status); + goto Exit; + } + + Status = PropKeyFindKeyGetFloat(pDevice->m_pThresholds, + &PKEY_SensorData_LinearAccelerationZ_Gs, + &(pDevice->m_CachedThresholds.LinearAcceleration.Z)); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! PropKeyFindKeyGetFloat for linear acceleration Z failed! %!STATUS!", Status); + goto Exit; + } + + Status = PropKeyFindKeyGetFloat(pDevice->m_pThresholds, + &PKEY_SensorData_CorrectedAngularVelocityX_DegreesPerSecond, + &(pDevice->m_CachedThresholds.RotationRate.X)); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! PropKeyFindKeyGetFloat for rotation rate X failed! %!STATUS!", Status); + goto Exit; + } + + Status = PropKeyFindKeyGetFloat(pDevice->m_pThresholds, + &PKEY_SensorData_CorrectedAngularVelocityY_DegreesPerSecond, + &(pDevice->m_CachedThresholds.RotationRate.Y)); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! PropKeyFindKeyGetFloat for rotation rate Y failed! %!STATUS!", Status); + goto Exit; + } + + Status = PropKeyFindKeyGetFloat(pDevice->m_pThresholds, + &PKEY_SensorData_CorrectedAngularVelocityZ_DegreesPerSecond, + &(pDevice->m_CachedThresholds.RotationRate.Z)); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! PropKeyFindKeyGetFloat for rotation rate Z failed! %!STATUS!", Status); + goto Exit; + } + +Exit: + if (FALSE != IsLocked) + { + WdfWaitLockRelease(pDevice->m_Lock); + IsLocked = FALSE; + } + SENSOR_FunctionExit(Status); + return Status; +} + + +// Called by Sensor CLX to handle IOCTLs that clx does not support +NTSTATUS +FusionSensorDevice::OnIoControl( + _In_ SENSOROBJECT /*SensorInstance*/, // WDF queue object + _In_ WDFREQUEST /*Request*/, // WDF request object + _In_ size_t /*OutputBufferLength*/, // number of bytes to retrieve from output buffer + _In_ size_t /*InputBufferLength*/, // number of bytes to retrieve from input buffer + _In_ ULONG /*IoControlCode*/ // IOCTL control code + ) +{ + NTSTATUS Status = STATUS_NOT_SUPPORTED; + + SENSOR_FunctionEnter(); + + SENSOR_FunctionExit(Status); + return Status; +} \ No newline at end of file diff --git a/sensors/Fusion/device.cpp b/sensors/Fusion/device.cpp new file mode 100644 index 00000000..0ac6e042 --- /dev/null +++ b/sensors/Fusion/device.cpp @@ -0,0 +1,729 @@ +//Copyright (C) Microsoft Corporation, All Rights Reserved. +// +//Abstract: +// +// This module contains the implementation of WDF callback functions +// for FusionSensor driver. +// +//Environment: +// +// Windows User-Mode Driver Framework (UMDF) + +#include "Device.h" +#include "HardwareSimulator.h" + +#include "Device.tmh" + +// FusionSensor Unique ID +// {997335D7-A71C-4C89-9D95-58EAEF917C6A} +// +// TODO: The unique ID below must be set per sensor. A different GUID must be provided for each sensor. Please generate a new GUID. +DEFINE_GUID(GUID_FusionSensorDevice_UniqueID, + 0x997335d7, 0xa71c, 0x4c89, 0x9d, 0x95, 0x58, 0xea, 0xef, 0x91, 0x7c, 0x6a); + + +// This routine initializes the sensor to its default properties +NTSTATUS +FusionSensorDevice::Initialize( + _In_ WDFDEVICE Device, // WDFDEVICE object + _In_ SENSOROBJECT SensorInstance // SENSOROBJECT for each sensor instance + ) +{ + ULONG Size = 0; + WDF_OBJECT_ATTRIBUTES MemoryAttributes; + WDFMEMORY MemoryHandle = NULL; + FILETIME Time = {}; + WDF_OBJECT_ATTRIBUTES TimerAttributes; + WDF_TIMER_CONFIG TimerConfig; + NTSTATUS Status = STATUS_SUCCESS; + PHardwareSimulator pSimulator = nullptr; + + SENSOR_FunctionEnter(); + + // Store device and instance + m_FxDevice = Device; + m_SensorInstance = SensorInstance; + m_Started = FALSE; + + // TODO: Remove the HardwareSimulator code in your final driver. The HardwareSimulator is only used for the purpose of demonstrating how sensor driver samples work. + // Initialize the FusionSensor simulator + Status = HardwareSimulator::Initialize(Device, &m_SimulatorInstance); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! HardwareSimulator::Initialize failed %!STATUS!", Status); + goto Exit; + } + + pSimulator = GetHardwareSimulatorContextFromInstance(m_SimulatorInstance); + if (nullptr == pSimulator) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! GetHardwareSimulatorContextFromInstance failed %!STATUS!", Status); + goto Exit; + } + + // Create Lock + Status = WdfWaitLockCreate(WDF_NO_OBJECT_ATTRIBUTES, &m_Lock); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! WdfWaitLockCreate failed %!STATUS!", Status); + goto Exit; + } + + // Create timer object for polling sensor samples + WDF_TIMER_CONFIG_INIT(&TimerConfig, FusionSensorDevice::OnTimerExpire); + WDF_OBJECT_ATTRIBUTES_INIT(&TimerAttributes); + TimerAttributes.ParentObject = SensorInstance; + TimerAttributes.ExecutionLevel = WdfExecutionLevelPassive; + + Status = WdfTimerCreate(&TimerConfig, &TimerAttributes, &m_Timer); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! WdfTimerCreate failed %!STATUS!", Status); + goto Exit; + } + + // + // Sensor Enumeration Properties + // + { + Size = SENSOR_COLLECTION_LIST_SIZE(SENSOR_ENUMERATION_PROPERTIES_COUNT); + + MemoryHandle = NULL; + WDF_OBJECT_ATTRIBUTES_INIT(&MemoryAttributes); + MemoryAttributes.ParentObject = SensorInstance; + Status = WdfMemoryCreate(&MemoryAttributes, + PagedPool, + SENSOR_POOL_TAG_FUSIONSENSOR, + Size, + &MemoryHandle, + (PVOID*)&m_pEnumerationProperties); + if (!NT_SUCCESS(Status) || m_pEnumerationProperties == nullptr) + { + TraceError("FUS %!FUNC! WdfMemoryCreate failed %!STATUS!", Status); + goto Exit; + } + + SENSOR_COLLECTION_LIST_INIT(m_pEnumerationProperties, Size); + m_pEnumerationProperties->Count = SENSOR_ENUMERATION_PROPERTIES_COUNT; + + m_pEnumerationProperties->List[SENSOR_TYPE_GUID].Key = DEVPKEY_Sensor_Type; + InitPropVariantFromCLSID(GUID_SensorType_Orientation, + &(m_pEnumerationProperties->List[SENSOR_TYPE_GUID].Value)); + + m_pEnumerationProperties->List[SENSOR_MANUFACTURER].Key = DEVPKEY_Sensor_Manufacturer; + InitPropVariantFromString(L"TODO-Set-Manufacturer", + &(m_pEnumerationProperties->List[SENSOR_MANUFACTURER].Value)); + + m_pEnumerationProperties->List[SENSOR_MODEL].Key = DEVPKEY_Sensor_Model; + InitPropVariantFromString(L"Sample fusion sensor", + &(m_pEnumerationProperties->List[SENSOR_MODEL].Value)); + + m_pEnumerationProperties->List[SENSOR_PERSISTENT_UNIQUEID].Key = DEVPKEY_Sensor_PersistentUniqueId; + InitPropVariantFromCLSID(GUID_FusionSensorDevice_UniqueID, + &(m_pEnumerationProperties->List[SENSOR_PERSISTENT_UNIQUEID].Value)); + + m_pEnumerationProperties->List[SENSOR_ISPRIMARY].Key = DEVPKEY_Sensor_IsPrimary; + InitPropVariantFromBoolean(FALSE, + &(m_pEnumerationProperties->List[SENSOR_ISPRIMARY].Value)); + } + + // + // Supported Data-Fields + // + { + Size = SENSOR_PROPERTY_LIST_SIZE(FUSIONSENSOR_DATA_COUNT); + + MemoryHandle = NULL; + WDF_OBJECT_ATTRIBUTES_INIT(&MemoryAttributes); + MemoryAttributes.ParentObject = SensorInstance; + Status = WdfMemoryCreate(&MemoryAttributes, + PagedPool, + SENSOR_POOL_TAG_FUSIONSENSOR, + Size, + &MemoryHandle, + (PVOID*)&m_pSupportedDataFields); + if (!NT_SUCCESS(Status) || m_pSupportedDataFields == nullptr) + { + TraceError("FUS %!FUNC! WdfMemoryCreate failed %!STATUS!", Status); + goto Exit; + } + + SENSOR_PROPERTY_LIST_INIT(m_pSupportedDataFields, Size); + m_pSupportedDataFields->Count = FUSIONSENSOR_DATA_COUNT; + + m_pSupportedDataFields->List[FUSIONSENSOR_DATA_TIMESTAMP] = PKEY_SensorData_Timestamp; + m_pSupportedDataFields->List[FUSIONSENSOR_DATA_QUATERNION_W] = PKEY_SensorData_QuaternionW; + m_pSupportedDataFields->List[FUSIONSENSOR_DATA_QUATERNION_X] = PKEY_SensorData_QuaternionX; + m_pSupportedDataFields->List[FUSIONSENSOR_DATA_QUATERNION_Y] = PKEY_SensorData_QuaternionY; + m_pSupportedDataFields->List[FUSIONSENSOR_DATA_QUATERNION_Z] = PKEY_SensorData_QuaternionZ; + m_pSupportedDataFields->List[FUSIONSENSOR_DATA_ACCURACY] = PKEY_SensorData_MagnetometerAccuracy; + m_pSupportedDataFields->List[FUSIONSENSOR_DATA_DECLINATION_ANGLE] = PKEY_SensorData_DeclinationAngle_Degrees; + } + + // + // Data + // + { + Size = SENSOR_COLLECTION_LIST_SIZE(FUSIONSENSOR_DATA_COUNT); + + MemoryHandle = NULL; + WDF_OBJECT_ATTRIBUTES_INIT(&MemoryAttributes); + MemoryAttributes.ParentObject = SensorInstance; + Status = WdfMemoryCreate(&MemoryAttributes, + PagedPool, + SENSOR_POOL_TAG_FUSIONSENSOR, + Size, + &MemoryHandle, + (PVOID*)&m_pData); + if (!NT_SUCCESS(Status) || m_pData == nullptr) + { + TraceError("FUS %!FUNC! WdfMemoryCreate failed %!STATUS!", Status); + goto Exit; + } + + SENSOR_COLLECTION_LIST_INIT(m_pData, Size); + m_pData->Count = FUSIONSENSOR_DATA_COUNT; + + m_pData->List[FUSIONSENSOR_DATA_TIMESTAMP].Key = PKEY_SensorData_Timestamp; + GetSystemTimePreciseAsFileTime(&Time); + InitPropVariantFromFileTime(&Time, &(m_pData->List[FUSIONSENSOR_DATA_TIMESTAMP].Value)); + + m_pData->List[FUSIONSENSOR_DATA_QUATERNION_W].Key = PKEY_SensorData_QuaternionW; + InitPropVariantFromFloat(0.0, &(m_pData->List[FUSIONSENSOR_DATA_QUATERNION_W].Value)); + + m_pData->List[FUSIONSENSOR_DATA_QUATERNION_X].Key = PKEY_SensorData_QuaternionX; + InitPropVariantFromFloat(0.0, &(m_pData->List[FUSIONSENSOR_DATA_QUATERNION_X].Value)); + + m_pData->List[FUSIONSENSOR_DATA_QUATERNION_Y].Key = PKEY_SensorData_QuaternionY; + InitPropVariantFromFloat(0.0, &(m_pData->List[FUSIONSENSOR_DATA_QUATERNION_Y].Value)); + + m_pData->List[FUSIONSENSOR_DATA_QUATERNION_Z].Key = PKEY_SensorData_QuaternionZ; + InitPropVariantFromFloat(0.0, &(m_pData->List[FUSIONSENSOR_DATA_QUATERNION_Z].Value)); + + m_pData->List[FUSIONSENSOR_DATA_ACCURACY].Key = PKEY_SensorData_MagnetometerAccuracy; + InitPropVariantFromUInt32(Unknown, &(m_pData->List[FUSIONSENSOR_DATA_ACCURACY].Value)); + + // Declination angle is optional, it will be computed by the system if not present. + m_pData->List[FUSIONSENSOR_DATA_DECLINATION_ANGLE].Key = PKEY_SensorData_DeclinationAngle_Degrees; + InitPropVariantFromFloat(0.0, &(m_pData->List[FUSIONSENSOR_DATA_DECLINATION_ANGLE].Value)); + } + + // + // Sensor Properties + // + { + m_Interval = FusionSensor_Default_DataInterval; + + Size = SENSOR_COLLECTION_LIST_SIZE(SENSOR_PROPERTIES_COUNT); + + MemoryHandle = NULL; + WDF_OBJECT_ATTRIBUTES_INIT(&MemoryAttributes); + MemoryAttributes.ParentObject = SensorInstance; + Status = WdfMemoryCreate(&MemoryAttributes, + PagedPool, + SENSOR_POOL_TAG_FUSIONSENSOR, + Size, + &MemoryHandle, + (PVOID*)&m_pProperties); + if (!NT_SUCCESS(Status) || m_pProperties == nullptr) + { + TraceError("FUS %!FUNC! WdfMemoryCreate failed %!STATUS!", Status); + goto Exit; + } + + SENSOR_COLLECTION_LIST_INIT(m_pProperties, Size); + m_pProperties->Count = SENSOR_PROPERTIES_COUNT; + + m_pProperties->List[SENSOR_PROPERTY_STATE].Key = PKEY_Sensor_State; + InitPropVariantFromUInt32(SensorState_Initializing, + &(m_pProperties->List[SENSOR_PROPERTY_STATE].Value)); + + m_pProperties->List[SENSOR_PROPERTY_MIN_INTERVAL].Key = PKEY_Sensor_MinimumDataInterval_Ms; + InitPropVariantFromUInt32(FusionSensor_Default_MinDataInterval_Ms, + &(m_pProperties->List[SENSOR_PROPERTY_MIN_INTERVAL].Value)); + + m_pProperties->List[SENSOR_PROPERTY_MAX_DATAFIELDSIZE].Key = PKEY_Sensor_MaximumDataFieldSize_Bytes; + InitPropVariantFromUInt32(CollectionsListGetMarshalledSize(m_pData), + &(m_pProperties->List[SENSOR_PROPERTY_MAX_DATAFIELDSIZE].Value)); + + m_pProperties->List[SENSOR_PROPERTY_SENSOR_TYPE].Key = PKEY_Sensor_Type; + InitPropVariantFromCLSID(GUID_SensorType_Orientation, + &(m_pProperties->List[SENSOR_PROPERTY_SENSOR_TYPE].Value)); + + m_pProperties->List[SENSOR_PROPERTY_USE_GYRO].Key = PKEY_OrientationSensor_GyroscopeUsed; + InitPropVariantFromBoolean(FALSE, &(m_pProperties->List[SENSOR_PROPERTY_USE_GYRO].Value)); + } + + // + // Accelerometer related data field properties + // + { + Size = SENSOR_COLLECTION_LIST_SIZE(SENSOR_ACC_DATA_FIELD_PROPERTY_COUNT); + + MemoryHandle = NULL; + WDF_OBJECT_ATTRIBUTES_INIT(&MemoryAttributes); + MemoryAttributes.ParentObject = SensorInstance; + Status = WdfMemoryCreate(&MemoryAttributes, + PagedPool, + SENSOR_POOL_TAG_FUSIONSENSOR, + Size, + &MemoryHandle, + (PVOID*)&m_pAccDataFieldProperties); + if (!NT_SUCCESS(Status) || m_pAccDataFieldProperties == nullptr) + { + TraceError("FUS %!FUNC! Fusion sensor WdfMemoryCreate failed %!STATUS!", Status); + goto Exit; + } + + SENSOR_COLLECTION_LIST_INIT(m_pAccDataFieldProperties, Size); + m_pAccDataFieldProperties->Count = SENSOR_ACC_DATA_FIELD_PROPERTY_COUNT; + + m_pAccDataFieldProperties->List[SENSOR_ACC_RESOLUTION].Key = PKEY_SensorDataField_Resolution; + InitPropVariantFromFloat((float)AccFakeDevice_Axis_Resolution, + &(m_pAccDataFieldProperties->List[SENSOR_ACC_RESOLUTION].Value)); + + m_pAccDataFieldProperties->List[SENSOR_ACC_MIN_RANGE].Key = PKEY_SensorDataField_RangeMinimum; + InitPropVariantFromFloat(AccFakeDevice_Axis_Minimum, + &(m_pAccDataFieldProperties->List[SENSOR_ACC_MIN_RANGE].Value)); + + m_pAccDataFieldProperties->List[SENSOR_ACC_MAX_RANGE].Key = PKEY_SensorDataField_RangeMaximum; + InitPropVariantFromFloat(AccFakeDevice_Axis_Maximum, + &(m_pAccDataFieldProperties->List[SENSOR_ACC_MAX_RANGE].Value)); + + } + + // + // Gyroscope related data field properties + // + { + Size = SENSOR_COLLECTION_LIST_SIZE(SENSOR_GYR_DATA_FIELD_PROPERTY_COUNT); + + MemoryHandle = NULL; + WDF_OBJECT_ATTRIBUTES_INIT(&MemoryAttributes); + MemoryAttributes.ParentObject = SensorInstance; + Status = WdfMemoryCreate(&MemoryAttributes, + PagedPool, + SENSOR_POOL_TAG_FUSIONSENSOR, + Size, + &MemoryHandle, + (PVOID*)&m_pGyrDataFieldProperties); + if (!NT_SUCCESS(Status) || m_pGyrDataFieldProperties == nullptr) + { + TraceError("FUS %!FUNC! Fusion sensor WdfMemoryCreate failed %!STATUS!", Status); + goto Exit; + } + + SENSOR_COLLECTION_LIST_INIT(m_pGyrDataFieldProperties, Size); + m_pGyrDataFieldProperties->Count = SENSOR_GYR_DATA_FIELD_PROPERTY_COUNT; + + m_pGyrDataFieldProperties->List[SENSOR_GYR_RESOLUTION].Key = PKEY_SensorDataField_Resolution; + InitPropVariantFromFloat(GyrFakeDevice_Resolution_DegreesPerSecond, + &(m_pGyrDataFieldProperties->List[SENSOR_GYR_RESOLUTION].Value)); + + m_pGyrDataFieldProperties->List[SENSOR_GYR_MIN_RANGE].Key = PKEY_SensorDataField_RangeMinimum; + InitPropVariantFromFloat(GyrFakeDevice_Minimum_DegreesPerSecond, + &(m_pGyrDataFieldProperties->List[SENSOR_GYR_MIN_RANGE].Value)); + + m_pGyrDataFieldProperties->List[SENSOR_GYR_MAX_RANGE].Key = PKEY_SensorDataField_RangeMaximum; + InitPropVariantFromFloat(GyrFakeDevice_Maximum_DegreesPerSecond, + &(m_pGyrDataFieldProperties->List[SENSOR_GYR_MAX_RANGE].Value)); + } + + // + // Set default threshold + // + { + Size = SENSOR_COLLECTION_LIST_SIZE(FUSIONSENSOR_THRESHOLD_COUNT); + + MemoryHandle = NULL; + WDF_OBJECT_ATTRIBUTES_INIT(&MemoryAttributes); + MemoryAttributes.ParentObject = SensorInstance; + Status = WdfMemoryCreate(&MemoryAttributes, + PagedPool, + SENSOR_POOL_TAG_FUSIONSENSOR, + Size, + &MemoryHandle, + (PVOID*)&m_pThresholds); + if (!NT_SUCCESS(Status) || m_pThresholds == nullptr) + { + TraceError("FUS %!FUNC! WdfMemoryCreate failed %!STATUS!", Status); + goto Exit; + } + + SENSOR_COLLECTION_LIST_INIT(m_pThresholds, Size); + m_pThresholds->Count = FUSIONSENSOR_THRESHOLD_COUNT; + + m_pThresholds->List[FUSIONSENSOR_THRESHOLD_ROTATION_ANGLE].Key = PKEY_SensorData_RotationAngle_Degrees; + InitPropVariantFromFloat(0.0, &(m_pThresholds->List[FUSIONSENSOR_THRESHOLD_ROTATION_ANGLE].Value)); + + m_pThresholds->List[FUSIONSENSOR_THRESHOLD_LINEAR_ACCELERATION_X].Key = PKEY_SensorData_LinearAccelerationX_Gs; + InitPropVariantFromFloat(0.0, &(m_pThresholds->List[FUSIONSENSOR_THRESHOLD_LINEAR_ACCELERATION_X].Value)); + + m_pThresholds->List[FUSIONSENSOR_THRESHOLD_LINEAR_ACCELERATION_Y].Key = PKEY_SensorData_LinearAccelerationY_Gs; + InitPropVariantFromFloat(0.0, &(m_pThresholds->List[FUSIONSENSOR_THRESHOLD_LINEAR_ACCELERATION_Y].Value)); + + m_pThresholds->List[FUSIONSENSOR_THRESHOLD_LINEAR_ACCELERATION_Z].Key = PKEY_SensorData_LinearAccelerationZ_Gs; + InitPropVariantFromFloat(0.0, &(m_pThresholds->List[FUSIONSENSOR_THRESHOLD_LINEAR_ACCELERATION_Z].Value)); + + m_pThresholds->List[FUSIONSENSOR_THRESHOLD_ROTATION_RATE_X].Key = PKEY_SensorData_CorrectedAngularVelocityX_DegreesPerSecond; + InitPropVariantFromFloat(0.0, &(m_pThresholds->List[FUSIONSENSOR_THRESHOLD_ROTATION_RATE_X].Value)); + + m_pThresholds->List[FUSIONSENSOR_THRESHOLD_ROTATION_RATE_Y].Key = PKEY_SensorData_CorrectedAngularVelocityY_DegreesPerSecond; + InitPropVariantFromFloat(0.0, &(m_pThresholds->List[FUSIONSENSOR_THRESHOLD_ROTATION_RATE_Y].Value)); + + m_pThresholds->List[FUSIONSENSOR_THRESHOLD_ROTATION_RATE_Z].Key = PKEY_SensorData_CorrectedAngularVelocityZ_DegreesPerSecond; + InitPropVariantFromFloat(0.0, &(m_pThresholds->List[FUSIONSENSOR_THRESHOLD_ROTATION_RATE_Z].Value)); + + ZeroMemory(&m_CachedThresholds, sizeof(m_CachedThresholds)); + } + + ZeroMemory(&m_LastSample, sizeof(m_LastSample)); + + // Set default threshold + m_FirstSample = TRUE; + +Exit: + SENSOR_FunctionExit(Status); + return Status; +} + + + +// This routine is the AddDevice entry point for the FusionSensor client +// driver. This routine is called by the framework in response to AddDevice +// call from the PnP manager. It will create and initialize the device object +// to represent a new instance of the sensor client. +NTSTATUS +FusionSensorDevice::OnDeviceAdd( + _In_ WDFDRIVER /*Driver*/, // Supplies a handle to the driver object created in DriverEntry + _Inout_ PWDFDEVICE_INIT pDeviceInit // Supplies a pointer to a framework-allocated WDFDEVICE_INIT structure + ) +{ + WDF_PNPPOWER_EVENT_CALLBACKS Callbacks; + WDFDEVICE Device = nullptr; + WDF_OBJECT_ATTRIBUTES FdoAttributes; + ULONG Flag = 0; + SENSOR_CONTROLLER_CONFIG SensorConfig; + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + WDF_OBJECT_ATTRIBUTES_INIT(&FdoAttributes); + + // Initialize FDO attributes and set up file object with sensor extension + Status = SensorsCxDeviceInitConfig(pDeviceInit, &FdoAttributes, Flag); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! SensorsCxDeviceInitConfig failed %!STATUS!", Status); + goto Exit; + } + + // Register the PnP callbacks with the framework. + WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&Callbacks); + Callbacks.EvtDevicePrepareHardware = FusionSensorDevice::OnPrepareHardware; + Callbacks.EvtDeviceReleaseHardware = FusionSensorDevice::OnReleaseHardware; + Callbacks.EvtDeviceD0Entry = FusionSensorDevice::OnD0Entry; + Callbacks.EvtDeviceD0Exit = FusionSensorDevice::OnD0Exit; + + WdfDeviceInitSetPnpPowerEventCallbacks(pDeviceInit, &Callbacks); + + // Call the framework to create the device + Status = WdfDeviceCreate(&pDeviceInit, &FdoAttributes, &Device); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! WdfDeviceCreate failed %!STATUS!", Status); + goto Exit; + } + + // Register CLX callback function pointers + SENSOR_CONTROLLER_CONFIG_INIT(&SensorConfig); + SensorConfig.DriverIsPowerPolicyOwner = WdfUseDefault; + + SensorConfig.EvtSensorStart = FusionSensorDevice::OnStart; + SensorConfig.EvtSensorStop = FusionSensorDevice::OnStop; + SensorConfig.EvtSensorGetSupportedDataFields = FusionSensorDevice::OnGetSupportedDataFields; + SensorConfig.EvtSensorGetDataInterval = FusionSensorDevice::OnGetDataInterval; + SensorConfig.EvtSensorSetDataInterval = FusionSensorDevice::OnSetDataInterval; + SensorConfig.EvtSensorGetDataFieldProperties = FusionSensorDevice::OnGetDataFieldProperties; + SensorConfig.EvtSensorGetDataThresholds = FusionSensorDevice::OnGetDataThresholds; + SensorConfig.EvtSensorSetDataThresholds = FusionSensorDevice::OnSetDataThresholds; + SensorConfig.EvtSensorGetProperties = FusionSensorDevice::OnGetProperties; + SensorConfig.EvtSensorDeviceIoControl = FusionSensorDevice::OnIoControl; + + // Set up power capabilities and IO queues + Status = SensorsCxDeviceInitialize(Device, &SensorConfig); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! SensorsCxDeviceInitialize failed %!STATUS!", Status); + goto Exit; + } + +Exit: + SENSOR_FunctionExit(Status); + return Status; +} + + + +// This routine is called by the framework when the PnP manager sends an +// IRP_MN_START_DEVICE request to the driver stack. This routine is +// responsible for performing operations that are necessary to make the +// driver's device operational (for e.g. mapping the hardware resources +// into memory). +NTSTATUS +FusionSensorDevice::OnPrepareHardware( + _In_ WDFDEVICE Device, // Supplies a handle to the framework device object + _In_ WDFCMRESLIST /*ResourcesRaw*/, // Supplies a handle to a collection of framework resource + // objects. This collection identifies the raw (bus-relative) hardware + // resources that have been assigned to the device. + _In_ WDFCMRESLIST /*ResourcesTranslated*/) // Supplies a handle to a collection of framework + // resource objects. This collection identifies the translated + // (system-physical) hardware resources that have been assigned to the + // device. The resources appear from the CPU's point of view. +{ + PFusionSensorDevice pDevice = nullptr; + WDF_OBJECT_ATTRIBUTES SensorAttr = {}; + SENSOR_CONFIG SensorConfig = {}; + SENSOROBJECT SensorInstance = nullptr; + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + // Construct sensor instance + + // Create WDFOBJECT for the sensor + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&SensorAttr, FusionSensorDevice); + + // Register sensor instance with clx + + Status = SensorsCxSensorCreate(Device, &SensorAttr, &SensorInstance); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! SensorsCxSensorCreate failed %!STATUS!", Status); + goto Exit; + } + + pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + if (nullptr == pDevice) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! GetFusionSensorContextFromSensorInstance failed %!STATUS!", Status); + goto Exit; + } + + // Device initialization + + Status = pDevice->Initialize(Device, SensorInstance); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! Initialize device object failed %!STATUS!", Status); + goto Exit; + } + + SENSOR_CONFIG_INIT(&SensorConfig); + SensorConfig.pEnumerationList = pDevice->m_pEnumerationProperties; + Status = SensorsCxSensorInitialize(SensorInstance, &SensorConfig); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! SensorsCxSensorInitialize failed %!STATUS!", Status); + goto Exit; + } + +Exit: + SENSOR_FunctionExit(Status); + + return Status; +} + + + +// This routine is called by the framework when the PnP manager is revoking +// ownership of our resources. This may be in response to either +// IRP_MN_STOP_DEVICE or IRP_MN_REMOVE_DEVICE. This routine is responsible for +// performing cleanup of resources allocated in PrepareHardware callback. +// This callback is invoked before passing the request down to the lower driver. +// This routine will also be invoked by the framework if the prepare hardware +// callback returns a failure. +// +// Argument: +// Device: IN: Supplies a handle to the framework device object +// ResourcesTranslated: IN: Supplies a handle to a collection of framework +// resource objects. This collection identifies the translated +// (system-physical) hardware resources that have been assigned to the +// device. The resources appear from the CPU's point of view. +// +// Return Value: +// NTSTATUS code +//------------------------------------------------------------------------------ +NTSTATUS +FusionSensorDevice::OnReleaseHardware( + _In_ WDFDEVICE Device, // Supplies a handle to the framework device object + _In_ WDFCMRESLIST /*ResourcesTranslated*/) // Supplies a handle to a collection of framework + // resource objects. This collection identifies the translated + // (system-physical) hardware resources that have been assigned to the + // device. The resources appear from the CPU's point of view. +{ + PHardwareSimulator pSimulator = nullptr; + PFusionSensorDevice pDevice = nullptr; + SENSOROBJECT SensorInstance = nullptr; + ULONG SensorInstanceCount = 1; // only expect 1 sensor instance + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + // Get sensor instance + Status = SensorsCxDeviceGetSensorList(Device, &SensorInstance, &SensorInstanceCount); + if (!NT_SUCCESS(Status) || + 0 == SensorInstanceCount || + NULL == SensorInstance) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! SensorsCxDeviceGetSensorList failed %!STATUS!", Status); + goto Exit; + } + + pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + if (nullptr == pDevice) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! GetFusionSensorContextFromSensorInstance failed %!STATUS!", Status); + goto Exit; + } + + // TODO: Remove the HardwareSimulator code in your final driver. The HardwareSimulator is only used for the purpose of demonstrating how sensor driver samples work. + pSimulator = GetHardwareSimulatorContextFromInstance(pDevice->m_SimulatorInstance); + if (nullptr == pSimulator) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! GetHardwareSimulatorContextFromInstance failed %!STATUS!", Status); + goto Exit; + } + + + // Delete lock + if (NULL != pDevice->m_Lock) + { + WdfObjectDelete(pDevice->m_Lock); + pDevice->m_Lock = NULL; + } + + // Cleanup the FusionSensor simulator + pSimulator->Cleanup(); + + // Delete hardware simulator instance + if (NULL != pDevice->m_SimulatorInstance) + { + WdfObjectDelete(pDevice->m_SimulatorInstance); + pDevice->m_SimulatorInstance = NULL; + } + + // Delete sensor instance + if (NULL != pDevice->m_SensorInstance) + { + WdfObjectDelete(pDevice->m_SensorInstance); + } + +Exit: + SENSOR_FunctionExit(Status); + return Status; +} + + + +// This routine is invoked by the framework to program the device to goto +// D0, which is the working state. The framework invokes callback every +// time the hardware needs to be (re-)initialized. This includes after +// IRP_MN_START_DEVICE, IRP_MN_CANCEL_STOP_DEVICE, IRP_MN_CANCEL_REMOVE_DEVICE, +// and IRP_MN_SET_POWER-D0. +NTSTATUS +FusionSensorDevice::OnD0Entry( + _In_ WDFDEVICE Device, // Supplies a handle to the framework device object + _In_ WDF_POWER_DEVICE_STATE /*PreviousState*/) // WDF_POWER_DEVICE_STATE-typed enumerator that identifies + // the device power state that the device was in before this transition to D0 +{ + PFusionSensorDevice pDevice; + SENSOROBJECT SensorInstance = NULL; + ULONG SensorInstanceCount = 1; + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + // Get sensor instance + Status = SensorsCxDeviceGetSensorList(Device, &SensorInstance, &SensorInstanceCount); + if (!NT_SUCCESS(Status) || + 0 == SensorInstanceCount || + NULL == SensorInstance) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! SensorsCxDeviceGetSensorList failed %!STATUS!", Status); + goto Exit; + } + + pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + if (nullptr == pDevice) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! GetFusionSensorContextFromSensorInstance failed %!STATUS!", Status); + goto Exit; + } + + // + // Power on sensor + // + pDevice->m_PoweredOn = TRUE; + InitPropVariantFromUInt32(SensorState_Idle, + &(pDevice->m_pProperties->List[SENSOR_PROPERTY_STATE].Value)); + +Exit: + SENSOR_FunctionExit(Status); + return Status; +} + + + +// This routine is invoked by the framework to program the device to go into +// a certain Dx state. The framework invokes callback every the the device is +// leaving the D0 state, which happens when the device is stopped, when it is +// removed, and when it is powered off. +NTSTATUS +FusionSensorDevice::OnD0Exit( + _In_ WDFDEVICE Device, // Supplies a handle to the framework device object + _In_ WDF_POWER_DEVICE_STATE /*TargetState*/) // Supplies the device power state which the device will be put + // in once the callback is complete +{ + PFusionSensorDevice pDevice; + SENSOROBJECT SensorInstance = NULL; + ULONG SensorInstanceCount = 1; + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + // Get sensor instance + Status = SensorsCxDeviceGetSensorList(Device, &SensorInstance, &SensorInstanceCount); + if (!NT_SUCCESS(Status) || + 0 == SensorInstanceCount || + NULL == SensorInstance) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! SensorsCxDeviceGetSensorList failed %!STATUS!", Status); + goto Exit; + } + + pDevice = GetFusionSensorContextFromSensorInstance(SensorInstance); + if (nullptr == pDevice) + { + Status = STATUS_INVALID_PARAMETER; + TraceError("FUS %!FUNC! GetFusionSensorContextFromSensorInstance failed %!STATUS!", Status); + goto Exit; + } + + // + // Power on sensor + // + pDevice->m_PoweredOn = FALSE; + +Exit: + SENSOR_FunctionExit(Status); + return Status; +} diff --git a/sensors/Fusion/driver.cpp b/sensors/Fusion/driver.cpp new file mode 100644 index 00000000..1fd117f3 --- /dev/null +++ b/sensors/Fusion/driver.cpp @@ -0,0 +1,76 @@ +//Copyright (C) Microsoft Corporation, All Rights Reserved. +// +//Abstract: +// +// This module contains the implementation of entry and exit point of FusionSensor sample driver. +// +//Environment: +// +// Windows User-Mode Driver Framework (UMDF) + +#include "Device.h" +#include "Driver.h" + +#include "Driver.tmh" + + + +// This routine is the driver initialization entry point. +NTSTATUS +DriverEntry( + _In_ PDRIVER_OBJECT DriverObject, // Pointer to the driver object created by the I/O manager + _In_ PUNICODE_STRING RegistryPath // Pointer to the driver specific registry key + ) +{ + WDF_DRIVER_CONFIG DriverConfig; + NTSTATUS Status = STATUS_SUCCESS; + + // Initialize WPP Tracing + WPP_INIT_TRACING(DriverObject, NULL); + + SENSOR_FunctionEnter(); + + DriverConfig.DriverPoolTag = SENSOR_POOL_TAG_FUSIONSENSOR; + + // Initialize the driver configuration structure. + WDF_DRIVER_CONFIG_INIT(&DriverConfig, FusionSensorDevice::OnDeviceAdd); + DriverConfig.EvtDriverUnload = OnDriverUnload; + + // Create a framework driver object to represent our driver. + Status = WdfDriverCreate(DriverObject, + RegistryPath, + WDF_NO_OBJECT_ATTRIBUTES, + &DriverConfig, + WDF_NO_HANDLE); + + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! WdfDriverCreate failed: %!STATUS!", Status); + goto Exit; + } + +Exit: + SENSOR_FunctionExit(Status); + + return Status; +} + + + +// This routine is called when the driver unloads. +VOID +OnDriverUnload( + _In_ WDFDRIVER Driver // Driver object + ) +{ + SENSOR_FunctionEnter(); + + SENSOR_FunctionExit(STATUS_SUCCESS); + + // WPP_CLEANUP doesn't actually use the Driver parameter + // So we need to set it as unreferenced. + UNREFERENCED_PARAMETER(Driver); + WPP_CLEANUP(WdfDriverWdmGetDriverObject(Driver)); + + return; +} \ No newline at end of file diff --git a/sensors/Fusion/hardwaresimulator.cpp b/sensors/Fusion/hardwaresimulator.cpp new file mode 100644 index 00000000..b498defb --- /dev/null +++ b/sensors/Fusion/hardwaresimulator.cpp @@ -0,0 +1,277 @@ +//Copyright (C) Microsoft Corporation, All Rights Reserved. +// +//Abstract: +// +// This module contains the implementation of the FusionSensor sample driver +// hardware simulator. +// +//Environment: +// +// Windows User-Mode Driver Framework (UMDF) + +#include "HardwareSimulator.h" + +#include "HardwareSimulator.tmh" + +#include "Device.h" + +// Simulated FusionSensor data +// The simulation data represent the FusionSensor data for a user walking and running at different paces +// Since the simulator is designed to report a sample every second, +// each line in the table represents 1 second of data +const FusionSensorSample SimulatorData[] = { +// 1: Timestamp +// 2: Quaternion; +// 3: Accuracy; +// 4: DeclinationAngle; +// +// 1 | 2 | 3 | 4 | + { {},{ 0.6118738f, 0.1390667f, 0.136009f, 0.7658455f }, MagnetometerAccuracy_Unknown, 17.1f }, + { {},{ 0.6174188f, 0.1399692f, 0.1338535f, 0.7625271f }, MagnetometerAccuracy_Approximate, 17.1f }, + { {},{ 0.6028171f, 0.1740682f, 0.1788765f, 0.7570137f }, MagnetometerAccuracy_High, 17.1f }, + { {},{ 0.4333673f, 0.05344541f, 0.06945555f, 0.8965058f }, MagnetometerAccuracy_High, 17.1f }, +}; + +HardwareSimulator::HardwareSimulator() : + m_HasReset(TRUE), + m_Index(0), + m_Lock(NULL), + m_State(SimulatorState_NotInitialized), + m_SimulatorInstance(NULL), + m_Timer(NULL) +{ +} + +HardwareSimulator::~HardwareSimulator() +{ +} + +// This static routine performs simulator initialization. The routine creates a +// timer object that periodically updates the m_Index location +NTSTATUS +HardwareSimulator::Initialize( + _In_ WDFDEVICE Device, // WDF device representing the sensor + _Out_ WDFOBJECT *SimulatorInstance) // Instance of the WDF object for the simulator +{ + PHardwareSimulator pSimulator = nullptr; + NTSTATUS Status = STATUS_SUCCESS; + WDF_OBJECT_ATTRIBUTES HardwareSimulatorAttributes = {}; + + SENSOR_FunctionEnter(); + + // Create WDFOBJECT for the hardware simulator + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&HardwareSimulatorAttributes, HardwareSimulator); + HardwareSimulatorAttributes.ParentObject = Device; + + Status = WdfObjectCreate(&HardwareSimulatorAttributes, SimulatorInstance); + if (!NT_SUCCESS(Status)) + { + TraceError("FUS %!FUNC! WdfObjectCreate failed %!STATUS!", Status); + goto Exit; + } + + pSimulator = GetHardwareSimulatorContextFromInstance(*SimulatorInstance); + if (nullptr == pSimulator) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! GetHardwareSimulatorContextFromInstance failed %!STATUS!", Status); + goto Exit; + } + + pSimulator->InitializeInternal(*SimulatorInstance); + +Exit: + + SENSOR_FunctionExit(Status); + + return Status; +} + + +// Internal routine to perform simulator initialization +NTSTATUS +HardwareSimulator::InitializeInternal( + _In_ WDFOBJECT SimulatorInstance) // Instance of the WDF object for the simulator +{ + NTSTATUS Status = STATUS_SUCCESS; + WDF_OBJECT_ATTRIBUTES TimerAttributes = {}; + WDF_TIMER_CONFIG TimerConfig = {}; + + SENSOR_FunctionEnter(); + + // Only initialize the simulator if it is in the "not initialized" state + if (SimulatorState_NotInitialized == m_State) + { + // Create sample Lock + Status = WdfWaitLockCreate(WDF_NO_OBJECT_ATTRIBUTES, &m_Lock); + if (!NT_SUCCESS(Status)) + { + m_Lock = NULL; + + TraceError("FUS %!FUNC! WdfWaitLockCreate for m_Lock failed %!STATUS!", Status); + goto Exit; + } + + // Create a timer object for simulation updates + WDF_TIMER_CONFIG_INIT(&TimerConfig, HardwareSimulator::OnTimerExpire); + WDF_OBJECT_ATTRIBUTES_INIT(&TimerAttributes); + TimerAttributes.ParentObject = SimulatorInstance; + TimerAttributes.ExecutionLevel = WdfExecutionLevelPassive; + + Status = WdfTimerCreate(&TimerConfig, &TimerAttributes, &m_Timer); + if (!NT_SUCCESS(Status)) + { + m_Timer = NULL; + + TraceError("FUS %!FUNC! WdfTimerCreate failed %!STATUS!", Status); + goto Exit; + } + + // Set the simulator state to "initialized" + m_State = SimulatorState_Initialized; + m_SimulatorInstance = SimulatorInstance; + } + +Exit: + if (!NT_SUCCESS(Status) && NULL != m_Lock) + { + WdfObjectDelete(m_Lock); + m_Lock = NULL; + } + + SENSOR_FunctionExit(Status); + + return Status; +} + + +// This routine perform a simulator cleanup +NTSTATUS +HardwareSimulator::Cleanup() +{ + NTSTATUS status = STATUS_SUCCESS; + + if (SimulatorState_Started == m_State) + { + Stop(); + } + + // Delete lock + if (NULL != m_Lock) + { + WdfObjectDelete(m_Lock); + m_Lock = NULL; + } + + // Set the simulator state to "not initialized" + m_State = SimulatorState_NotInitialized; + + return status; +} + + +// This routine starts the simulator +NTSTATUS +HardwareSimulator::Start() +{ + NTSTATUS status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (SimulatorState_Initialized == m_State) + { + WdfTimerStart(m_Timer, WDF_REL_TIMEOUT_IN_MS(SIMULATOR_HARDWARE_INTERVAL_MS)); + m_State = SimulatorState_Started; + } + + SENSOR_FunctionExit(status); + + return status; +} + + +// This routine stops the simulator +NTSTATUS +HardwareSimulator::Stop() +{ + NTSTATUS status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (SimulatorState_Started == m_State) + { + WdfTimerStop(m_Timer, TRUE); + m_State = SimulatorState_Initialized; + } + + SENSOR_FunctionExit(status); + + return status; +} + + +// This callback is called when the simulator wait time has expired and the simulator +// is ready to switch to the next sample. The callback updates the sample index and +// schedules the next wake up time. +VOID +HardwareSimulator::OnTimerExpire( + _In_ WDFTIMER Timer) // WDF timer object +{ + HardwareSimulator *pSimulator = nullptr; + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + pSimulator = GetHardwareSimulatorContextFromInstance(WdfTimerGetParentObject(Timer)); + if (nullptr == pSimulator) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! GetHardwareSimulatorContextFromInstance failed %!STATUS!", Status); + } + + if (NT_SUCCESS(Status)) + { + // Increment the sample index, roll over if the index reach the end of the array + WdfWaitLockAcquire(pSimulator->m_Lock, NULL); + pSimulator->m_Index++; + pSimulator->m_Index = pSimulator->m_Index % ARRAYSIZE(SimulatorData); + + WdfWaitLockRelease(pSimulator->m_Lock); + + WdfTimerStart(pSimulator->m_Timer, WDF_REL_TIMEOUT_IN_MS(SIMULATOR_HARDWARE_INTERVAL_MS)); + } + + SENSOR_FunctionExit(Status); +} + + +// This routine returns the current sample from the driver at the current m_Index +// location +NTSTATUS +HardwareSimulator::GetSample( + _Out_ FusionSensorSample *Sample) // FusionSensor sample +{ + NTSTATUS Status = STATUS_SUCCESS; + + SENSOR_FunctionEnter(); + + if (nullptr == Sample) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + TraceError("FUS %!FUNC! Sample parameter is null"); + } + + if (NT_SUCCESS(Status)) + { + WdfWaitLockAcquire(m_Lock, NULL); + *Sample = SimulatorData[m_Index]; + + WdfWaitLockRelease(m_Lock); + + GetSystemTimePreciseAsFileTime(&Sample->Timestamp); + } + + SENSOR_FunctionExit(Status); + + return Status; +} diff --git a/sensors/Fusion/readme.md b/sensors/Fusion/readme.md new file mode 100644 index 00000000..3a4bb2bf --- /dev/null +++ b/sensors/Fusion/readme.md @@ -0,0 +1,3 @@ +### Fusion Sensor Driver Sample + +The FusionSensor sample shows how to write a UMDF v2 driver to control a virtual FusionSensor sensor. \ No newline at end of file -- cgit v1.3.1 From 8b505c949ca8133219adbfce912c6dbb726f2895 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Fri, 25 Aug 2017 15:11:28 -0700 Subject: Add readmes to samples --- sensors/ADXL345Acc/readme.md | 3 +++ sensors/Activity/readme.md | 3 +++ sensors/CustomSensors/readme.md | 3 +++ sensors/Pedometer/readme.md | 3 +++ sensors/SensorsComboDriver/readme.md | 3 +++ sensors/SimpleDeviceOrientationSensor/readme.md | 3 +++ 6 files changed, 18 insertions(+) create mode 100644 sensors/ADXL345Acc/readme.md create mode 100644 sensors/Activity/readme.md create mode 100644 sensors/CustomSensors/readme.md create mode 100644 sensors/Pedometer/readme.md create mode 100644 sensors/SensorsComboDriver/readme.md create mode 100644 sensors/SimpleDeviceOrientationSensor/readme.md diff --git a/sensors/ADXL345Acc/readme.md b/sensors/ADXL345Acc/readme.md new file mode 100644 index 00000000..d60e78cd --- /dev/null +++ b/sensors/ADXL345Acc/readme.md @@ -0,0 +1,3 @@ +### ADXL345 Accelerometer Sample Driver + +The ADXL345Accelerometer sample shows how to write a UMDF v2 driver to control an ADXL345 accelerometer chip. \ No newline at end of file diff --git a/sensors/Activity/readme.md b/sensors/Activity/readme.md new file mode 100644 index 00000000..3456b263 --- /dev/null +++ b/sensors/Activity/readme.md @@ -0,0 +1,3 @@ +### Activity Sensor Driver Sample + +The Activity sample shows how to write a UMDF v2 driver to control an activity sensor. \ No newline at end of file diff --git a/sensors/CustomSensors/readme.md b/sensors/CustomSensors/readme.md new file mode 100644 index 00000000..c5125de7 --- /dev/null +++ b/sensors/CustomSensors/readme.md @@ -0,0 +1,3 @@ +### Custom Sensor Driver Sample + +The CustomSensor sample shows how to write a UMDF v2 driver to control a custom sensor. \ No newline at end of file diff --git a/sensors/Pedometer/readme.md b/sensors/Pedometer/readme.md new file mode 100644 index 00000000..092bca57 --- /dev/null +++ b/sensors/Pedometer/readme.md @@ -0,0 +1,3 @@ +### Pedometer Sensor Sample + +The Pedometer sample shows how to write a UMDF v2 driver to control a virtual Pedometer sensor. \ No newline at end of file diff --git a/sensors/SensorsComboDriver/readme.md b/sensors/SensorsComboDriver/readme.md new file mode 100644 index 00000000..80fca3d7 --- /dev/null +++ b/sensors/SensorsComboDriver/readme.md @@ -0,0 +1,3 @@ +# Sensors Combo Driver Sample + +The sensors combo driver sensor sample shows how to write UMDF v2 drivers to control various types of virtual sensors such as Ambient Light, Barometer, Gyroscope, Magnetometer, Geomagnetic, Gravity Vector, Proximity, Linear Accelerometer and Relative Fusion. \ No newline at end of file diff --git a/sensors/SimpleDeviceOrientationSensor/readme.md b/sensors/SimpleDeviceOrientationSensor/readme.md new file mode 100644 index 00000000..b4fa4580 --- /dev/null +++ b/sensors/SimpleDeviceOrientationSensor/readme.md @@ -0,0 +1,3 @@ +### Simple Device Orientation Sensor Sample + +The SimpleDeviceOrientationSensor sample shows how to write a UMDF v2 sensor driver to output Simple Device Orientation values. \ No newline at end of file -- cgit v1.3.1 From 7306c1456b4b6bf82560af70b9e104c874051ee9 Mon Sep 17 00:00:00 2001 From: Matthew Montera Date: Fri, 25 Aug 2017 17:35:47 -0700 Subject: Many changes Went through PR --- .../osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp | 499 ++++++++++++--------- .../osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h | 66 ++- .../osrfx2_DCHU_usersvc/SampleService.cpp | 61 +-- .../osrfx2_DCHU_usersvc/SampleService.h | 13 + 4 files changed, 337 insertions(+), 302 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp index 6484f834..a02ac24a 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.cpp @@ -81,32 +81,31 @@ GetDevicePath( ) { HRESULT hr = E_FAIL; - BOOL Return = FALSE; - CONFIGRET Status = CR_SUCCESS; + CONFIGRET cr = CR_SUCCESS; PWSTR DeviceInterfaceList = NULL; ULONG DeviceInterfaceListLength = 0; PWSTR NextInterface; - // - // Determine if there are any interfaces that match the OSRFX2 device. - // - Status = CM_Get_Device_Interface_List_Size(&DeviceInterfaceListLength, - InterfaceGuid, - NULL, - CM_GET_DEVICE_INTERFACE_LIST_PRESENT); + // + // Determine if there are any interfaces that match the OSRFX2 device. + // + cr = CM_Get_Device_Interface_List_Size(&DeviceInterfaceListLength, + InterfaceGuid, + NULL, + CM_GET_DEVICE_INTERFACE_LIST_PRESENT); - if (Status != CR_SUCCESS) + if (cr != CR_SUCCESS) { WriteToErrorLog(L"CM_Get_DeviceInterface_List_Size", - CM_MapCrToWin32Err(Status, ERROR_FILE_NOT_FOUND)); - goto clean0; + CM_MapCrToWin32Err(cr, ERROR_FILE_NOT_FOUND)); + goto cleanup; } if (DeviceInterfaceListLength < 1) { WriteToErrorLog(L"CM_Get_DeviceInterface_List_Size", - CM_MapCrToWin32Err(Status, ERROR_EMPTY)); - goto clean0; + CM_MapCrToWin32Err(cr, ERROR_EMPTY)); + goto cleanup; } DeviceInterfaceList = (PWSTR)malloc(DeviceInterfaceListLength * sizeof(WCHAR)); @@ -115,22 +114,20 @@ GetDevicePath( { WriteToEventLog(L"Failed to allocate memory for the device interface list", TRACE_LEVEL_ERROR); - goto clean0; + goto cleanup; } - ZeroMemory(DeviceInterfaceList, DeviceInterfaceListLength * sizeof(WCHAR)); + cr = CM_Get_Device_Interface_List(InterfaceGuid, + NULL, + DeviceInterfaceList, + DeviceInterfaceListLength, + CM_GET_DEVICE_INTERFACE_LIST_PRESENT); - Status = CM_Get_Device_Interface_List(InterfaceGuid, - NULL, - DeviceInterfaceList, - DeviceInterfaceListLength, - CM_GET_DEVICE_INTERFACE_LIST_PRESENT); - - if (Status != CR_SUCCESS) + if (cr != CR_SUCCESS) { WriteToErrorLog(L"CM_Get_Device_Interface_List", - CM_MapCrToWin32Err(Status, ERROR_FILE_NOT_FOUND)); - goto clean0; + CM_MapCrToWin32Err(cr, ERROR_FILE_NOT_FOUND)); + goto cleanup; } if (*DeviceInterfaceList == UNICODE_NULL) @@ -139,11 +136,11 @@ GetDevicePath( TRACE_LEVEL_ERROR); } - // - // This sample only expects one interface for the OSRFX2 device. For other - // devices, though, it maybe necessary to sift through the interfaces - // from CM_Get_Device_Interface_List in order to find the correct device. - // + // + // This sample only expects one interface for the OSRFX2 device. For other + // devices, though, it maybe necessary to sift through the interfaces + // from CM_Get_Device_Interface_List in order to find the correct device. + // NextInterface = DeviceInterfaceList + wcslen(DeviceInterfaceList) + 1; if (*NextInterface != UNICODE_NULL) @@ -158,22 +155,17 @@ GetDevicePath( if (FAILED(hr)) { WriteToErrorLog(L"StringCchCopy", HRESULT_CODE(hr)); - goto clean0; + goto cleanup; } -clean0: +cleanup: if (DeviceInterfaceList != NULL) { free(DeviceInterfaceList); } - if (Status == CR_SUCCESS) - { - Return = TRUE; - } - - return Return; + return (cr == CR_SUCCESS); } @@ -199,21 +191,21 @@ _Success_(return != INVALID_HANDLE_VALUE) HANDLE OpenDevice( _In_ BOOL Synchronous -) + ) { - HANDLE DeviceHandle; + HANDLE DeviceHandle = INVALID_HANDLE_VALUE; WCHAR DeviceName[MAX_DEVPATH_LENGTH]; if (!GetDevicePath((LPGUID)&GUID_DEVINTERFACE_OSRUSBFX2, DeviceName, sizeof(DeviceName) / sizeof(DeviceName[0]))) { - return INVALID_HANDLE_VALUE; + goto cleanup; } - // - // Open a handle to the interface. - // + // + // Open a handle to the interface. + // if (Synchronous) { DeviceHandle = CreateFile(DeviceName, @@ -244,6 +236,8 @@ OpenDevice( WriteToEventLog(L"Opened Device Successfully", TRACE_LEVEL_INFORMATION); } +cleanup: + return DeviceHandle; } @@ -265,7 +259,7 @@ Return Value: --*/ DWORD InterfaceArrivalAction( - _In_ PHANDLE_CONTEXT Context + _In_ PDEVICE_CONTEXT Context ) { DWORD Err = ERROR_SUCCESS; @@ -304,7 +298,7 @@ InterfaceArrivalAction( cleanup: - LeaveCriticalSection(&Context->Lock); + LeaveCriticalSection(&Context->Lock); return Err; } @@ -320,13 +314,13 @@ Arguments: hNotify - The notification that fired the callback - hContext - The callback context + hContext - The callback context - Action - The type of notification + Action - The type of notification - EventData - Additional information about the callback + EventData - Additional information about the callback - EventDataSize - The size of EventData + EventDataSize - The size of EventData Return Value: @@ -343,15 +337,15 @@ InterfaceCallback( ) { DWORD Err = ERROR_SUCCESS; - PHANDLE_CONTEXT Context = (PHANDLE_CONTEXT)hContext; + PDEVICE_CONTEXT Context = (PDEVICE_CONTEXT)hContext; - // - // Validate Context. - // - if (Context == NULL) - { - goto cleanup; - } + // + // Validate Context. + // + if (Context == NULL) + { + goto cleanup; + } if (Action == CM_NOTIFY_ACTION_DEVICEINTERFACEARRIVAL) { @@ -369,7 +363,7 @@ cleanup: Routine Description: Registers the service for notifications using the notification handle in - Context. + Context. Arguments: @@ -382,17 +376,17 @@ Return Value: --*/ DWORD RegisterInterfaceNotifications( - _In_ PHANDLE_CONTEXT Context + _In_ PDEVICE_CONTEXT Context ) { DWORD Err = ERROR_SUCCESS; CONFIGRET cr; CM_NOTIFY_FILTER NotifyFilter = {0}; - if (Context == NULL) - { - goto cleanup; - } + if (Context == NULL) + { + goto cleanup; + } ZeroMemory(&NotifyFilter, sizeof(NotifyFilter)); NotifyFilter.cbSize = sizeof(NotifyFilter); @@ -422,7 +416,7 @@ cleanup: Routine Description: Unregister for interface notifications. Note, this routine deadlocks - when called from an interface callback. + when called from an interface callback. Arguments: @@ -435,7 +429,7 @@ Return Value: --*/ DWORD UnregisterInterfaceNotifications( - PHANDLE_CONTEXT Context + _In_ PDEVICE_CONTEXT Context ) { CONFIGRET cr; @@ -468,7 +462,7 @@ Return Value: --*/ DWORD DeviceQueryRemoveAction( - _In_ PHANDLE_CONTEXT Context + _In_ PDEVICE_CONTEXT Context ) { DWORD Err = ERROR_SUCCESS; @@ -496,16 +490,16 @@ DeviceQueryRemoveAction( Routine Description: This callback avoids a deadlock when unregistering device notifications. - Rather than calling CM_Unregister_Notification from the callback, the - callback gives that work to a separate thread to avoid deadlock. + Rather than calling CM_Unregister_Notification from the callback, the + callback gives that work to a separate thread to avoid deadlock. Arguments: - Instance - The thread's callback instance + Instance - The thread's callback instance hContext - The callback context - pWork - The thread handle + pWork - The thread handle Return Value: @@ -520,7 +514,7 @@ UnregisterWorkerThreadCallback( _Inout_ PTP_WORK pWork ) { - PHANDLE_CONTEXT Context = (PHANDLE_CONTEXT)hContext; + PDEVICE_CONTEXT Context = (PDEVICE_CONTEXT)hContext; EnterCriticalSection(&Context->Lock); @@ -548,7 +542,7 @@ Routine Description: Arguments: - hNotify - The notification that spurred this callback + hNotify - The notification that spurred this callback Context - The callback context @@ -559,8 +553,8 @@ Return Value: --*/ DWORD DeviceQueryRemoveFailedAction( - HCMNOTIFICATION hNotify, - PHANDLE_CONTEXT Context + _In_ HCMNOTIFICATION hNotify, + _In_ PDEVICE_CONTEXT Context ) { DWORD Err = ERROR_SUCCESS; @@ -576,32 +570,32 @@ DeviceQueryRemoveFailedAction( // // Unregister the device callback, and then close the handle // - if (!Context->Unregister) - { - Context->Unregister = TRUE; - SubmitThreadpoolWork(Context->Work); - } + if (!Context->Unregister) + { + Context->Unregister = TRUE; + SubmitThreadpoolWork(Context->Work); + } LeaveCriticalSection(&Context->Lock); - // - // Wait for the callback and then re-register the device - // - WaitForThreadpoolWorkCallbacks(Context->Work, FALSE); + // + // Wait for the callback and then re-register the device + // + WaitForThreadpoolWorkCallbacks(Context->Work, FALSE); - EnterCriticalSection(&Context->Lock); + EnterCriticalSection(&Context->Lock); - if (Context->DeviceInterfaceHandle == INVALID_HANDLE_VALUE) - { - Context->DeviceInterfaceHandle = OpenDevice(FALSE); - } + if (Context->DeviceInterfaceHandle == INVALID_HANDLE_VALUE) + { + Context->DeviceInterfaceHandle = OpenDevice(FALSE); + } - if (Context->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) - { - RegisterDeviceNotifications(Context); - } + if (Context->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) + { + RegisterDeviceNotifications(Context); + } - LeaveCriticalSection(&Context->Lock); + LeaveCriticalSection(&Context->Lock); return Err; } @@ -626,11 +620,11 @@ Return Value: --*/ DWORD DeviceRemovePendingAction( - HCMNOTIFICATION hNotify, - PHANDLE_CONTEXT Context + _In_ HCMNOTIFICATION hNotify, + _In_ PDEVICE_CONTEXT Context ) { - DWORD Err = ERROR_SUCCESS; + DWORD Err = ERROR_SUCCESS; EnterCriticalSection(&Context->Lock); @@ -643,11 +637,11 @@ DeviceRemovePendingAction( // // Unregister the device callback, and then close the handle // - if (!Context->Unregister) - { - Context->Unregister = TRUE; - SubmitThreadpoolWork(Context->Work); - } + if (!Context->Unregister) + { + Context->Unregister = TRUE; + SubmitThreadpoolWork(Context->Work); + } LeaveCriticalSection(&Context->Lock); @@ -674,11 +668,11 @@ Return Value: --*/ DWORD DeviceRemoveCompleteAction( - HCMNOTIFICATION hNotify, - PHANDLE_CONTEXT Context + _In_ HCMNOTIFICATION hNotify, + _In_ PDEVICE_CONTEXT Context ) { - DWORD Err = ERROR_SUCCESS; + DWORD Err = ERROR_SUCCESS; EnterCriticalSection(&Context->Lock); @@ -691,11 +685,11 @@ DeviceRemoveCompleteAction( // // Unregister the device callback, and then close the handle // - if (!Context->Unregister) - { - Context->Unregister = TRUE; - SubmitThreadpoolWork(Context->Work); - } + if (!Context->Unregister) + { + Context->Unregister = TRUE; + SubmitThreadpoolWork(Context->Work); + } LeaveCriticalSection(&Context->Lock); @@ -715,11 +709,11 @@ Arguments: hContext - The callback context - Action - The type of callback + Action - The type of callback - EventData - Additional information about this callback + EventData - Additional information about this callback - EventDataSize - The size of EventData + EventDataSize - The size of EventData Return Value: @@ -733,39 +727,37 @@ DeviceCallback( _In_ CM_NOTIFY_ACTION Action, _In_ PCM_NOTIFY_EVENT_DATA EventData, _In_ DWORD EventDataSize -) + ) { - DWORD Err = ERROR_SUCCESS; - PHANDLE_CONTEXT Context = (PHANDLE_CONTEXT)hContext; - - // - // Validate Context. - // - if (Context == NULL) - { - goto cleanup; - } - - switch (Action) - { + DWORD Err = ERROR_SUCCESS; + PDEVICE_CONTEXT Context = (PDEVICE_CONTEXT)hContext; - case CM_NOTIFY_ACTION_DEVICEQUERYREMOVE: - DeviceQueryRemoveAction(Context); - break; + // + // Validate Context. + // + if (Context == NULL) + { + goto cleanup; + } - case CM_NOTIFY_ACTION_DEVICEQUERYREMOVEFAILED: - DeviceQueryRemoveFailedAction(hNotify, Context); - break; + switch (Action) + { + case CM_NOTIFY_ACTION_DEVICEQUERYREMOVE: + DeviceQueryRemoveAction(Context); + break; - case CM_NOTIFY_ACTION_DEVICEREMOVEPENDING: - DeviceRemovePendingAction(hNotify, Context); - break; + case CM_NOTIFY_ACTION_DEVICEQUERYREMOVEFAILED: + DeviceQueryRemoveFailedAction(hNotify, Context); + break; - case CM_NOTIFY_ACTION_DEVICEREMOVECOMPLETE: - DeviceRemoveCompleteAction(hNotify, Context); - break; + case CM_NOTIFY_ACTION_DEVICEREMOVEPENDING: + DeviceRemovePendingAction(hNotify, Context); + break; - } + case CM_NOTIFY_ACTION_DEVICEREMOVECOMPLETE: + DeviceRemoveCompleteAction(hNotify, Context); + break; + } cleanup: @@ -790,10 +782,10 @@ Return Value: --*/ DWORD RegisterDeviceNotifications( - _In_ PHANDLE_CONTEXT Context + _In_ PDEVICE_CONTEXT Context ) { - DWORD Err = ERROR_SUCCESS; + DWORD Err = ERROR_SUCCESS; CONFIGRET cr; CM_NOTIFY_FILTER NotifyFilter = {0}; @@ -813,7 +805,7 @@ RegisterDeviceNotifications( goto cleanup; } - Context->Unregister = FALSE; + Context->Unregister = FALSE; cleanup: @@ -838,10 +830,10 @@ Return Value: --*/ DWORD UnregisterDeviceNotifications( - PHANDLE_CONTEXT Context + _In_ PDEVICE_CONTEXT Context ) { - DWORD Err = ERROR_SUCCESS; + DWORD Err = ERROR_SUCCESS; CONFIGRET cr; if (Context->DeviceNotificationHandle != NULL) @@ -865,7 +857,7 @@ UnregisterDeviceNotifications( Routine Description: - Initialize the given PHANDLE_CONTEXT. + Initialize the given PDEVICE_CONTEXT. Arguments: @@ -878,39 +870,49 @@ Return Value: --*/ DWORD InitializeContext( - _Out_ PHANDLE_CONTEXT* Context + _Out_ PDEVICE_CONTEXT *Context ) { - DWORD Err = ERROR_SUCCESS; + DWORD Err = ERROR_SUCCESS; + BOOL LockInitialized = FALSE; + BOOL LockEntered = FALSE; + BOOL InterfaceNotificationsInitialized = FALSE; + BOOL DeviceNotificationsInitialized = FALSE; + PDEVICE_CONTEXT DeviceContext; - *Context = (PHANDLE_CONTEXT)malloc(sizeof(HANDLE_CONTEXT)); + DeviceContext = (PDEVICE_CONTEXT)malloc(sizeof(DEVICE_CONTEXT)); - if (*Context == NULL) + if (DeviceContext == NULL) { Err = ERROR_OUTOFMEMORY; goto cleanup; } - (*Context)->DeviceInterfaceHandle = INVALID_HANDLE_VALUE; + DeviceContext->DeviceInterfaceHandle = INVALID_HANDLE_VALUE; + DeviceContext->LockEnabled = FALSE; + DeviceContext->InterfaceNotificationsEnabled = FALSE; + DeviceContext->DeviceNotificationsEnabled = FALSE; - InitializeCriticalSection(&(*Context)->Lock); + InitializeCriticalSection(&DeviceContext->Lock); + DeviceContext->LockEnabled = TRUE; - (*Context)->Work = CreateThreadpoolWork(UnregisterWorkerThreadCallback, (PVOID)(*Context), NULL); + DeviceContext->Work = CreateThreadpoolWork(UnregisterWorkerThreadCallback, (PVOID)DeviceContext, NULL); - if ((*Context)->Work == NULL) + if (DeviceContext->Work == NULL) { - WriteToErrorLog(L"Could not create worker thread callback", ERROR_OUTOFMEMORY); + Err = GetLastError(); + WriteToErrorLog(L"Could not create worker thread callback", Err); goto cleanup; } - (*Context)->DeviceNotificationHandle = NULL; - (*Context)->InterfaceNotificationHandle = NULL; + DeviceContext->DeviceNotificationHandle = NULL; + DeviceContext->InterfaceNotificationHandle = NULL; // // Register for device interface events to open and close the handle to // the interface. // - Err = RegisterInterfaceNotifications(*Context); + Err = RegisterInterfaceNotifications(DeviceContext); if (Err != ERROR_SUCCESS) { @@ -918,27 +920,33 @@ InitializeContext( goto cleanup; } - EnterCriticalSection(&(*Context)->Lock); + DeviceContext->InterfaceNotificationsEnabled = TRUE; + + EnterCriticalSection(&DeviceContext->Lock); + LockEntered = TRUE; // // The interface may already have arrived while registering for - // notifications. + // notifications. The lock could be moved earlier, but for sample + // purposes this is the proper way to initialize notifications. // - if ((*Context)->DeviceInterfaceHandle == INVALID_HANDLE_VALUE) + if (DeviceContext->DeviceInterfaceHandle == INVALID_HANDLE_VALUE) { - (*Context)->DeviceInterfaceHandle = OpenDevice(FALSE); + DeviceContext->DeviceInterfaceHandle = OpenDevice(FALSE); } - if ((*Context)->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) - { - Err = RegisterDeviceNotifications(*Context); + if (DeviceContext->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) + { + Err = RegisterDeviceNotifications(DeviceContext); - if (Err != ERROR_SUCCESS) - { - WriteToErrorLog(L"Could not register device notifications", Err); - goto cleanup; - } - } + if (Err != ERROR_SUCCESS) + { + WriteToErrorLog(L"Could not register device notifications", Err); + goto cleanup; + } + + DeviceContext->DeviceNotificationsEnabled = TRUE; + } // // If OpenDevice ends up returning INVALID_HANDLE_VALUE, that's fine @@ -947,7 +955,18 @@ InitializeContext( cleanup: - LeaveCriticalSection(&(*Context)->Lock); + if (LockEntered) + { + LeaveCriticalSection(&DeviceContext->Lock); + } + + *Context = DeviceContext; + DeviceContext = NULL; + + if (DeviceContext != NULL) + { + CloseContext(DeviceContext); + } return Err; } @@ -957,7 +976,7 @@ cleanup: Routine Description: - Clean up the given PHANDLE_CONTEXT. + Clean up the given PDEVICE_CONTEXT. Arguments: @@ -970,80 +989,83 @@ Return Value: --*/ DWORD CloseContext( - _In_ PHANDLE_CONTEXT* Context + _In_ PDEVICE_CONTEXT Context ) { - DWORD Err = ERROR_SUCCESS; + DWORD Err = ERROR_SUCCESS; BOOL Unregister = FALSE; - if ((Context == NULL) || - (*Context == NULL)) - { - // - // Nothing to remove. - // - goto cleanup; - } + if (Context == NULL) + { + // + // Nothing to remove. + // + goto cleanup; + } - EnterCriticalSection(&(*Context)->Lock); + EnterCriticalSection(&Context->Lock); - if (!(*Context)->Unregister) + if (!Context->Unregister) { // // Unregister from the callback here. // Unregister = TRUE; - (*Context)->Unregister = TRUE; + Context->Unregister = TRUE; } - LeaveCriticalSection(&(*Context)->Lock); - - // - // Unregister from the interface first, so that re-appearance of the interface - // doesn't cause us to register device events again. - // - Err = UnregisterInterfaceNotifications(*Context); + LeaveCriticalSection(&Context->Lock); - if (Err != ERROR_SUCCESS) + // + // Unregister from the interface first, so that re-appearance of the interface + // doesn't cause us to register device events again. + // + if (Context->InterfaceNotificationsEnabled) { - WriteToErrorLog(L"Could not unregister interface notifications", Err); + Err = UnregisterInterfaceNotifications(Context); + + if (Err != ERROR_SUCCESS) + { + WriteToErrorLog(L"Could not unregister interface notifications", Err); + } } if (Unregister) { - Err = UnregisterDeviceNotifications(*Context); + if (Context->DeviceNotificationsEnabled) + { + Err = UnregisterDeviceNotifications(Context); - if (Err != ERROR_SUCCESS) - { - WriteToErrorLog(L"Could not unregister device notifications", Err); - } + if (Err != ERROR_SUCCESS) + { + WriteToErrorLog(L"Could not unregister device notifications", Err); + } + } } else { - WaitForThreadpoolWorkCallbacks((*Context)->Work, FALSE); + WaitForThreadpoolWorkCallbacks(Context->Work, FALSE); } - // - // No need to lock here, UnregisterDeviceNotifications will wait for all - // outstanding callbacks before returning. - // - if ((*Context)->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) + // + // No need to lock here, UnregisterDeviceNotifications will wait for all + // outstanding callbacks before returning. + // + if (Context->DeviceInterfaceHandle != INVALID_HANDLE_VALUE) { - CloseHandle((*Context)->DeviceInterfaceHandle); + CloseHandle(Context->DeviceInterfaceHandle); - (*Context)->DeviceInterfaceHandle = INVALID_HANDLE_VALUE; + Context->DeviceInterfaceHandle = INVALID_HANDLE_VALUE; } - if ((*Context)->Work != NULL) + if (Context->Work != NULL) { - CloseThreadpoolWork((*Context)->Work); + CloseThreadpoolWork(Context->Work); } - DeleteCriticalSection(&(*Context)->Lock); - - free(*Context); + DeleteCriticalSection(&Context->Lock); - *Context = NULL; + free(Context); cleanup: @@ -1067,7 +1089,7 @@ Return Value: --*/ DWORD ClearAllBars( - _In_ PHANDLE_CONTEXT Context + _In_ PDEVICE_CONTEXT Context ) { DWORD Err = ERROR_SUCCESS; @@ -1112,7 +1134,7 @@ Return Value: --*/ DWORD LightNextBar( - _In_ PHANDLE_CONTEXT Context + _In_ PDEVICE_CONTEXT Context ) { DWORD Err = ERROR_SUCCESS; @@ -1146,5 +1168,50 @@ LightNextBar( cleanup: + return Err; +} + +/*++ + +Routine Description: + + Lights the next bar on the OSRFX2 device. + +Arguments: + + Context - The device context + +Return Value: + + A Win32 error code. + +--*/ +DWORD +ControlDevice( + _In_ PDEVICE_CONTEXT Context + ) +{ + DWORD Err = ERROR_SUCCESS; + + EnterCriticalSection(&Context->Lock); + + Err = ClearAllBars(Context); + + if (Err != ERROR_SUCCESS) + { + goto cleanup; + } + + Err = LightNextBar(Context); + + if (Err != ERROR_SUCCESS) + { + goto cleanup; + } + +cleanup: + + LeaveCriticalSection(&Context->Lock); + return Err; } \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h index ecdfa4ad..3b8be711 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h @@ -50,14 +50,17 @@ DEFINE_GUID(GUID_DEVINTERFACE_OSRUSBFX2, #pragma warning(disable:4201) // nameless struct/union #pragma warning(disable:4214) // bit field types other than int -typedef struct _HANDLE_CONTEXT { +typedef struct _DEVICE_CONTEXT { HANDLE DeviceInterfaceHandle; CRITICAL_SECTION Lock; + BOOL LockEnabled; PTP_WORK Work; BOOL Unregister; - HCMNOTIFICATION InterfaceNotificationHandle; - HCMNOTIFICATION DeviceNotificationHandle; -} HANDLE_CONTEXT, *PHANDLE_CONTEXT; + HCMNOTIFICATION InterfaceNotificationHandle; + BOOL InterfaceNotificationsEnabled; + HCMNOTIFICATION DeviceNotificationHandle; + BOOL DeviceNotificationsEnabled; +} DEVICE_CONTEXT, *PDEVICE_CONTEXT; // // Define the structures that will be used by the IOCTL @@ -201,73 +204,56 @@ typedef struct _SWITCH_STATE { Routine Description: - Sets the variables in this service to their default values. - -Arguments: - - VOID - -Return Value: - - VOID - ---*/ -VOID SetVariables(VOID); - - -/*++ - -Routine Description: - - Opens up the OSR USB FX2 device handle. +Lights the next bar on the OSRFX2 device. Arguments: - Synchronous - Whether or not this device should be - opened for synchronous access +Context - The device context Return Value: - The handle to the OSR USB FX2 device. +A Win32 error code. --*/ -HANDLE OpenDevice(_In_ BOOL Synchronous); +DWORD +ControlDevice(PDEVICE_CONTEXT Context); /*++ Routine Description: - Turns off all of the bar graph lights on the OSR USB FX2 device. + Sets the variables in this service to their default values. Arguments: - DeviceHandle - The handle to the OSR USB FX2 device. + VOID Return Value: VOID --*/ -DWORD ClearAllBars(PHANDLE_CONTEXT Context); +VOID SetVariables(VOID); /*++ Routine Description: - Lights the next bar on the OSR USB FX2 device. + Opens up the OSR USB FX2 device handle. Arguments: - DeviceHandle - The handle to the OSR USB FX2 device. + Synchronous - Whether or not this device should be + opened for synchronous access Return Value: -VOID + The handle to the OSR USB FX2 device. --*/ -DWORD LightNextBar(PHANDLE_CONTEXT Context); +HANDLE OpenDevice(_In_ BOOL Synchronous); /*++ @@ -285,7 +271,7 @@ Return Value: A Win32 error code. --*/ -DWORD RegisterDeviceNotifications(PHANDLE_CONTEXT Context); +DWORD RegisterDeviceNotifications(PDEVICE_CONTEXT Context); /*++ @@ -303,14 +289,14 @@ Return Value: A Win32 error code. --*/ -DWORD UnregisterDeviceNotifications(PHANDLE_CONTEXT Context); +DWORD UnregisterDeviceNotifications(PDEVICE_CONTEXT Context); /*++ Routine Description: -Initialize the given PHANDLE_CONTEXT. +Initialize the given PDEVICE_CONTEXT. Arguments: @@ -321,14 +307,14 @@ Return Value: A Win32 error code. --*/ -DWORD InitializeContext(PHANDLE_CONTEXT* Context); +DWORD InitializeContext(PDEVICE_CONTEXT* Context); /*++ Routine Description: -Clean up the given PHANDLE_CONTEXT. +Clean up the given PDEVICE_CONTEXT. Arguments: @@ -339,4 +325,4 @@ Return Value: A Win32 error code. --*/ -DWORD CloseContext(PHANDLE_CONTEXT* Context); \ No newline at end of file +DWORD CloseContext(PDEVICE_CONTEXT Context); \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp index 5a59319b..fd3d497f 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp @@ -29,16 +29,6 @@ Environment: #include "ThreadPool.h" #pragma endregion -// -// Variables used for device notifications should normally be local. However, -// we must use a global variable here since there is a potential race condition -// when the service needs to restart during device installation that could -// cause the service to prevent the device from being restarted as well. So, -// this variable is global so that the services OnStart and OnStart method can -// handle its creation and destruction. -// -PHANDLE_CONTEXT Context; - /*++ Routine Description: @@ -151,21 +141,23 @@ CSampleService::OnStart( PWSTR *Argv ) { + __debugbreak(); + // // Log a service start message to the Application log. // WriteToEventLog(L"SampleService in OnStart", EVENTLOG_INFORMATION_TYPE); - // - // Set up any variables the service needs. - // - SetVariables(); + // + // Set up any variables the service needs. + // + SetVariables(); - // - // Set up the context, and register for notifications. - // - InitializeContext(&Context); + // + // Set up the context, and register for notifications. + // + InitializeContext(&m_Context); // // Queue the main service function for execution in a worker thread. @@ -193,8 +185,6 @@ Return Value: VOID CSampleService::ServiceWorkerThread() { - DWORD Err = ERROR_SUCCESS; - // // Periodically check if the service is stopping. // @@ -204,28 +194,7 @@ CSampleService::ServiceWorkerThread() // Perform main service function here... // - // - // Wait for the device to arrive. - // - if (Context->DeviceInterfaceHandle == INVALID_HANDLE_VALUE) - { - ::Sleep(2000); - continue; - } - - Err = ClearAllBars(Context); - - if (Err != ERROR_SUCCESS) - { - continue; - } - - Err = LightNextBar(Context); - - if (Err != ERROR_SUCCESS) - { - continue; - } + ControlDevice(m_Context); ::Sleep(2000); // Simulate some lengthy operations. } @@ -278,8 +247,8 @@ CSampleService::OnStop() throw GetLastError(); } - // - // Clean up the context after the worker thread has finished. - // - CloseContext(&Context); + // + // Clean up the context after the worker thread has finished. + // + CloseContext(m_Context); } \ No newline at end of file diff --git a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h index eee8a609..73be42e9 100644 --- a/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h @@ -171,4 +171,17 @@ private: // The handle to wait for a stop event. // HANDLE m_hStoppedEvent; + + // + // The device context to manage notifications with. + // + // NOTE: + // Variables used for device notifications should normally be local. However, + // we must use a global variable here since there is a potential race condition + // when the service needs to restart during device installation that could + // cause the service to prevent the device from being restarted. So, this + // variable is global so that the service's OnStart and OnStart method can + // handle its creation and destruction. + // + PDEVICE_CONTEXT m_Context; }; \ No newline at end of file -- cgit v1.3.1 From 13ca5b69d2a1b20e5cfa8ecc94bfea9ece8aaa9a Mon Sep 17 00:00:00 2001 From: Barry Golden Date: Fri, 25 Aug 2017 20:51:02 -0700 Subject: VSTS 12737998 --- sd/miniport/sdhc/README.md | 12 +++++++++++- sd/sdiomars/README.md | 10 ++++++++++ security/elam/README.md | 10 ++++++++++ serial/VirtualSerial/README.md | 10 ++++++++++ serial/VirtualSerial2/README.md | 10 ++++++++++ serial/serenum/README.md | 10 ++++++++++ serial/serial/README.md | 10 ++++++++++ setup/devcon/README.md | 10 ++++++++++ simbatt/README.md | 12 +++++++++++- smartcrd/README.md | 10 ++++++++++ spb/SkeletonI2C/README.md | 12 +++++++++++- spb/SpbTestTool/README.md | 10 ++++++++++ storage/class/cdrom/README.md | 10 ++++++++++ storage/class/classpnp/README.md | 10 ++++++++++ storage/class/disk/README.md | 10 ++++++++++ storage/filters/addfilter/README.md | 10 ++++++++++ storage/iscsi/README.md | 10 ++++++++++ storage/miniports/lsi_u3/README.md | 10 ++++++++++ storage/miniports/storahci/README.md | 10 ++++++++++ storage/msdsm/README.md | 10 ++++++++++ storage/ramdisk/README.md | 10 ++++++++++ storage/sfloppy/README.md | 10 ++++++++++ storage/tools/spti/README.md | 10 ++++++++++ 23 files changed, 233 insertions(+), 3 deletions(-) diff --git a/sd/miniport/sdhc/README.md b/sd/miniport/sdhc/README.md index b5c35093..a1e81cde 100644 --- a/sd/miniport/sdhc/README.md +++ b/sd/miniport/sdhc/README.md @@ -1,5 +1,15 @@ + + + Standard SD Host Controller Miniport -=================== +==================================== This is a sample for a Secure Digital (SD) Host Controller miniport driver. The driver works in conjunction with sdport.sys, which implements SD/SDIO/eMMC protocol and WDM interfaces, to provide the host register interface. diff --git a/sd/sdiomars/README.md b/sd/sdiomars/README.md index 322ac5a4..2f248936 100644 --- a/sd/sdiomars/README.md +++ b/sd/sdiomars/README.md @@ -1,3 +1,13 @@ + + + Storage SDIO Driver =================== diff --git a/security/elam/README.md b/security/elam/README.md index 927dc32d..bbd5b772 100644 --- a/security/elam/README.md +++ b/security/elam/README.md @@ -1,3 +1,13 @@ + + + Early Launch Anti-Malware Driver ================================ diff --git a/serial/VirtualSerial/README.md b/serial/VirtualSerial/README.md index 2b1bc513..59d9afb6 100644 --- a/serial/VirtualSerial/README.md +++ b/serial/VirtualSerial/README.md @@ -1,3 +1,13 @@ + + + Virtual serial driver sample ============================ diff --git a/serial/VirtualSerial2/README.md b/serial/VirtualSerial2/README.md index 3c5baf78..81405d15 100644 --- a/serial/VirtualSerial2/README.md +++ b/serial/VirtualSerial2/README.md @@ -1,3 +1,13 @@ + + + Virtual serial driver sample ============================ diff --git a/serial/serenum/README.md b/serial/serenum/README.md index 7b28ae46..c4690bbf 100644 --- a/serial/serenum/README.md +++ b/serial/serenum/README.md @@ -1,3 +1,13 @@ + + + Serenum sample ============== diff --git a/serial/serial/README.md b/serial/serial/README.md index de76bfb3..583e9cae 100644 --- a/serial/serial/README.md +++ b/serial/serial/README.md @@ -1,3 +1,13 @@ + + + Serial Port Driver ================== diff --git a/setup/devcon/README.md b/setup/devcon/README.md index b559f0f1..60e79702 100644 --- a/setup/devcon/README.md +++ b/setup/devcon/README.md @@ -1,3 +1,13 @@ + + + Device Console (DevCon) Tool ============================ diff --git a/simbatt/README.md b/simbatt/README.md index e52e7d40..24332b56 100644 --- a/simbatt/README.md +++ b/simbatt/README.md @@ -1,3 +1,13 @@ -SimBatt: Battery Battery Driver Sample + + + +SimBatt: Simulated Battery Driver Sample ====================================== SimBatt is simulated battery device driver, this source code is intended to demonstrate implementation of Windows battery driver interfaces. This is a KMDF based sample. You may use this sample as a starting point to implement a battery miniport specific to your needs. \ No newline at end of file diff --git a/smartcrd/README.md b/smartcrd/README.md index d9454735..c3b5ca74 100644 --- a/smartcrd/README.md +++ b/smartcrd/README.md @@ -1,3 +1,13 @@ + + + PCMCIA Smart Card Driver ======================== diff --git a/spb/SkeletonI2C/README.md b/spb/SkeletonI2C/README.md index 4522af7c..2e639a9d 100644 --- a/spb/SkeletonI2C/README.md +++ b/spb/SkeletonI2C/README.md @@ -1,5 +1,15 @@ + + + Skeleton I2C Sample Driver -========================= +========================== The SkeletonI2C sample demonstrates how to design a KMDF controller driver for Windows that conforms to the [simple peripheral bus](http://msdn.microsoft.com/en-us/library/windows/hardware/hh450903) (SPB) device driver interface (DDI). SPB is an abstraction for low-speed serial buses (for example, I2C and SPI) that allows peripheral drivers to be developed for cross-platform use without any knowledge of the underlying bus hardware or device connections. While this sample implements an empty I2C driver, it could just as easily be the starting point for an SPI driver with only minor modifications. diff --git a/spb/SpbTestTool/README.md b/spb/SpbTestTool/README.md index d7c9eb2e..fbee4e70 100644 --- a/spb/SpbTestTool/README.md +++ b/spb/SpbTestTool/README.md @@ -1,3 +1,13 @@ + + + SpbTestTool =========== diff --git a/storage/class/cdrom/README.md b/storage/class/cdrom/README.md index 187ca63b..92ddf79b 100644 --- a/storage/class/cdrom/README.md +++ b/storage/class/cdrom/README.md @@ -1,3 +1,13 @@ + + + CDROM Storage Class Driver ========================== diff --git a/storage/class/classpnp/README.md b/storage/class/classpnp/README.md index c3a893ba..ec3c0e9b 100644 --- a/storage/class/classpnp/README.md +++ b/storage/class/classpnp/README.md @@ -1,3 +1,13 @@ + + + ClassPnP Storage Class Driver Library ===================================== diff --git a/storage/class/disk/README.md b/storage/class/disk/README.md index 1acd4ed5..c4032547 100644 --- a/storage/class/disk/README.md +++ b/storage/class/disk/README.md @@ -1,3 +1,13 @@ + + + Disk Class Driver ================= diff --git a/storage/filters/addfilter/README.md b/storage/filters/addfilter/README.md index 3981aa20..8d3084c4 100644 --- a/storage/filters/addfilter/README.md +++ b/storage/filters/addfilter/README.md @@ -1,3 +1,13 @@ + + + AddFilter Storage Filter Tool ============================= diff --git a/storage/iscsi/README.md b/storage/iscsi/README.md index 8bfb6982..320e1206 100644 --- a/storage/iscsi/README.md +++ b/storage/iscsi/README.md @@ -1,3 +1,13 @@ + + + iSCSI WMI Client ================ diff --git a/storage/miniports/lsi_u3/README.md b/storage/miniports/lsi_u3/README.md index 2e7950ea..2ca91c64 100644 --- a/storage/miniports/lsi_u3/README.md +++ b/storage/miniports/lsi_u3/README.md @@ -1,3 +1,13 @@ + + + LSI\_U3 StorPort Miniport Driver ================================ diff --git a/storage/miniports/storahci/README.md b/storage/miniports/storahci/README.md index 7705ebd5..ed65a9ff 100644 --- a/storage/miniports/storahci/README.md +++ b/storage/miniports/storahci/README.md @@ -1,3 +1,13 @@ + + + StorAhci StorPort Miniport Driver ================================= diff --git a/storage/msdsm/README.md b/storage/msdsm/README.md index d43f1b68..599dc963 100644 --- a/storage/msdsm/README.md +++ b/storage/msdsm/README.md @@ -1,3 +1,13 @@ + + + Multipath I/O (MPIO) DSM Sample =============================== diff --git a/storage/ramdisk/README.md b/storage/ramdisk/README.md index 66e97691..83e0bae1 100644 --- a/storage/ramdisk/README.md +++ b/storage/ramdisk/README.md @@ -1,3 +1,13 @@ + + + RAMDisk Storage Driver Sample ============================= diff --git a/storage/sfloppy/README.md b/storage/sfloppy/README.md index be7bd211..a48c6230 100644 --- a/storage/sfloppy/README.md +++ b/storage/sfloppy/README.md @@ -1,3 +1,13 @@ + + + Super Floppy (sfloppy) Storage Class Driver =========================================== diff --git a/storage/tools/spti/README.md b/storage/tools/spti/README.md index 0d9ad39a..10037d01 100644 --- a/storage/tools/spti/README.md +++ b/storage/tools/spti/README.md @@ -1,3 +1,13 @@ + + + SCSI Pass-Through Interface Tool ================================ -- cgit v1.3.1 From db44fd903e44b470e6429f9b9ef761b1269cb1bd Mon Sep 17 00:00:00 2001 From: Barry Golden Date: Sun, 27 Aug 2017 00:29:46 -0700 Subject: VSTS 12737998 --- thermal/simsensor/README.md | 10 ++++++++++ thermal/thermalclient/README.md | 10 ++++++++++ tools/sdv/samples/DV-FailDriver-WDM/README.md | 10 ++++++++++ tools/sdv/samples/SDV-FailDriver-KMDF/README.md | 10 ++++++++++ tools/sdv/samples/SDV-FailDriver-NDIS/README.md | 10 ++++++++++ tools/sdv/samples/SDV-FailDriver-STORPORT/README.md | 10 ++++++++++ tools/sdv/samples/SDV-FailDriver-WDM/README.md | 10 ++++++++++ usb/UcmCxUcsi/README.md | 10 ++++++++++ usb/UcmTcpciCxClientSample/README.md | 10 ++++++++++ usb/kmdf_enumswitches/README.md | 10 ++++++++++ usb/kmdf_fx2/README.md | 10 ++++++++++ usb/ufxclientsample/README.md | 12 +++++++++++- usb/umdf2_fx2/README.md | 11 ++++++++++- usb/umdf_filter_kmdf/README.md | 10 ++++++++++ usb/umdf_filter_umdf/README.md | 10 ++++++++++ usb/umdf_fx2/README.md | 10 ++++++++++ usb/usbsamp/README.md | 10 ++++++++++ usb/usbview/README.md | 10 ++++++++++ usb/wdf_osrfx2_lab/README.md | 10 ++++++++++ 19 files changed, 191 insertions(+), 2 deletions(-) diff --git a/thermal/simsensor/README.md b/thermal/simsensor/README.md index 668c5b56..a2537ce5 100644 --- a/thermal/simsensor/README.md +++ b/thermal/simsensor/README.md @@ -1,3 +1,13 @@ + + + SimSensor: Simulated Temperature Sensor Sample Driver ===================================================== diff --git a/thermal/thermalclient/README.md b/thermal/thermalclient/README.md index 47f8a2f6..e5812871 100644 --- a/thermal/thermalclient/README.md +++ b/thermal/thermalclient/README.md @@ -1,3 +1,13 @@ + + + SimThermalClient: Simulated Thermal Client Sample Driver ======================================================== diff --git a/tools/sdv/samples/DV-FailDriver-WDM/README.md b/tools/sdv/samples/DV-FailDriver-WDM/README.md index aade7dd9..9851ff31 100644 --- a/tools/sdv/samples/DV-FailDriver-WDM/README.md +++ b/tools/sdv/samples/DV-FailDriver-WDM/README.md @@ -1,3 +1,13 @@ + + + DV-FailDriver-WDM ================= diff --git a/tools/sdv/samples/SDV-FailDriver-KMDF/README.md b/tools/sdv/samples/SDV-FailDriver-KMDF/README.md index ce2b381c..6d4d71cd 100644 --- a/tools/sdv/samples/SDV-FailDriver-KMDF/README.md +++ b/tools/sdv/samples/SDV-FailDriver-KMDF/README.md @@ -1,3 +1,13 @@ + + + SDV-FailDriver-KMDF =================== diff --git a/tools/sdv/samples/SDV-FailDriver-NDIS/README.md b/tools/sdv/samples/SDV-FailDriver-NDIS/README.md index 5903ad29..eaf5dc56 100644 --- a/tools/sdv/samples/SDV-FailDriver-NDIS/README.md +++ b/tools/sdv/samples/SDV-FailDriver-NDIS/README.md @@ -1,3 +1,13 @@ + + + SDV-FailDriver-NDIS =================== diff --git a/tools/sdv/samples/SDV-FailDriver-STORPORT/README.md b/tools/sdv/samples/SDV-FailDriver-STORPORT/README.md index 8611e51d..600b0023 100644 --- a/tools/sdv/samples/SDV-FailDriver-STORPORT/README.md +++ b/tools/sdv/samples/SDV-FailDriver-STORPORT/README.md @@ -1,3 +1,13 @@ + + + SDV-FailDriver-STORPORT ======================= diff --git a/tools/sdv/samples/SDV-FailDriver-WDM/README.md b/tools/sdv/samples/SDV-FailDriver-WDM/README.md index 49a69753..a32fbcf5 100644 --- a/tools/sdv/samples/SDV-FailDriver-WDM/README.md +++ b/tools/sdv/samples/SDV-FailDriver-WDM/README.md @@ -1,3 +1,13 @@ + + + SDV-FailDriver-WDM ================== diff --git a/usb/UcmCxUcsi/README.md b/usb/UcmCxUcsi/README.md index dc6b865d..3ebd5d5d 100644 --- a/usb/UcmCxUcsi/README.md +++ b/usb/UcmCxUcsi/README.md @@ -1,3 +1,13 @@ + + + # UcmTcpciCx Port Controller Client Driver This is a sample driver that shows how to create a Windows USB Type-C port controller driver using the USB Connector Manager class extension driver (UcmCx). The sample is a driver for an embedded controller which is complient with the [USB Type-C Connector System Software Interface (UCSI)](http://www.intel.com/content/www/us/en/io/universal-serial-bus/usb-type-c-ucsi-spec.html). diff --git a/usb/UcmTcpciCxClientSample/README.md b/usb/UcmTcpciCxClientSample/README.md index d3fd73ec..02d043bf 100644 --- a/usb/UcmTcpciCxClientSample/README.md +++ b/usb/UcmTcpciCxClientSample/README.md @@ -1,3 +1,13 @@ + + + # UcmTcpciCx Port Controller Client Driver This is a skeleton sample driver that shows how to create a Windows USB Type-C port controller driver using the USB Connector Manager Type-C Port Controller Interface class extension driver (UcmTcpciCx). UcmTcpciCx is currently only availble using the Windows Insider program - documentation for UcmTcpciCx will be available at the next release of Windows. diff --git a/usb/kmdf_enumswitches/README.md b/usb/kmdf_enumswitches/README.md index d6a7ee9f..dda67616 100644 --- a/usb/kmdf_enumswitches/README.md +++ b/usb/kmdf_enumswitches/README.md @@ -1,3 +1,13 @@ + + + Sample KMDF Bus Driver for OSR USB-FX2 ====================================== diff --git a/usb/kmdf_fx2/README.md b/usb/kmdf_fx2/README.md index 0bf65d1d..68666660 100644 --- a/usb/kmdf_fx2/README.md +++ b/usb/kmdf_fx2/README.md @@ -1,3 +1,13 @@ + + + Sample KMDF Function Driver for OSR USB-FX2 =========================================== diff --git a/usb/ufxclientsample/README.md b/usb/ufxclientsample/README.md index ec39fd35..54a2f69f 100644 --- a/usb/ufxclientsample/README.md +++ b/usb/ufxclientsample/README.md @@ -1,4 +1,14 @@ -USB Function Client Driver + + + +USB Function Client Driver ========================== This is a skeleton sample driver that shows how to create a Windows USB function controller driver using the USB function class extension driver (UFX). diff --git a/usb/umdf2_fx2/README.md b/usb/umdf2_fx2/README.md index 0d98a5ce..bc2cfba5 100644 --- a/usb/umdf2_fx2/README.md +++ b/usb/umdf2_fx2/README.md @@ -1,3 +1,12 @@ + + Sample Function Driver for OSR USB-FX2 (UMDF Version 2) ======================================================= @@ -55,7 +64,7 @@ Build the sample using MSBuild As an alternative to building the driver sample in Visual Studio, you can build it in a Visual Studio Command Prompt window. In Visual Studio, on the **Tools** menu, choose **Visual Studio Command Prompt**. In the Visual Studio Command Prompt window, navigate to the folder that has the solution file, umdf2echo.sln. Use the MSBuild command to build the solution. Here is an example: -**msbuild /p:configuration=”Win8 Release” /p:platform=”Win32” umdf2\_fx2.sln** +**msbuild /p:configuration=�Win8 Release� /p:platform=�Win32� umdf2\_fx2.sln** For more information about using MSBuild to build a driver package, see [Building a Driver](http://msdn.microsoft.com/en-us/library/windows/hardware/ff554644). diff --git a/usb/umdf_filter_kmdf/README.md b/usb/umdf_filter_kmdf/README.md index ecc62acd..5eaf3347 100644 --- a/usb/umdf_filter_kmdf/README.md +++ b/usb/umdf_filter_kmdf/README.md @@ -1,3 +1,13 @@ + + + Sample UMDF Filter above KMDF Function Driver for OSR USB-FX2 (UMDF Version 1) ============================================================================== diff --git a/usb/umdf_filter_umdf/README.md b/usb/umdf_filter_umdf/README.md index b0c7970f..f4d3dc26 100644 --- a/usb/umdf_filter_umdf/README.md +++ b/usb/umdf_filter_umdf/README.md @@ -1,3 +1,13 @@ + + + Sample UMDF Filter above UMDF Function Driver for OSR USB-FX2 (UMDF Version 1) ============================================================================== diff --git a/usb/umdf_fx2/README.md b/usb/umdf_fx2/README.md index 2f7f1ded..4b707cbe 100644 --- a/usb/umdf_fx2/README.md +++ b/usb/umdf_fx2/README.md @@ -1,3 +1,13 @@ + + + Sample UMDF Function Driver for OSR USB-FX2 (UMDF Version 1) ============================================================ diff --git a/usb/usbsamp/README.md b/usb/usbsamp/README.md index 8d9d4d9d..30f46c17 100644 --- a/usb/usbsamp/README.md +++ b/usb/usbsamp/README.md @@ -1,3 +1,13 @@ + + + Usbsamp Generic USB Driver ========================== diff --git a/usb/usbview/README.md b/usb/usbview/README.md index cd117f82..fe1bbbb1 100644 --- a/usb/usbview/README.md +++ b/usb/usbview/README.md @@ -1,3 +1,13 @@ + + + USBView sample application ========================== diff --git a/usb/wdf_osrfx2_lab/README.md b/usb/wdf_osrfx2_lab/README.md index 6940418f..faba87fa 100644 --- a/usb/wdf_osrfx2_lab/README.md +++ b/usb/wdf_osrfx2_lab/README.md @@ -1,3 +1,13 @@ + + + WDF Sample Driver Learning Lab for OSR USB-FX2 ============================================== -- cgit v1.3.1 From 53bcc426c1870374bf941424ddf8b85b745079fd Mon Sep 17 00:00:00 2001 From: Barry Golden Date: Sun, 27 Aug 2017 16:17:45 -0700 Subject: VSTS 12737998 --- video/KMDOD/README.md | 9 +++++++++ video/pixlib/README.md | 10 ++++++++++ wia/README.md | 12 +++++++++++- wmi/wmiacpi/README.md | 10 ++++++++++ wmi/wmisamp/README.md | 10 ++++++++++ wpd/WpdBasicHardwareDriver/README.md | 10 ++++++++++ wpd/WpdHelloWorldDriver/README.md | 10 ++++++++++ wpd/WpdMultiTransportDriver/README.md | 10 ++++++++++ wpd/WpdServiceSampleDriver/README.md | 16 +++++++++++----- wpd/WpdWudfSampleDriver/README.md | 10 ++++++++++ 10 files changed, 101 insertions(+), 6 deletions(-) diff --git a/video/KMDOD/README.md b/video/KMDOD/README.md index 5e005256..6c724af7 100644 --- a/video/KMDOD/README.md +++ b/video/KMDOD/README.md @@ -1,3 +1,12 @@ + + Kernel mode display-only miniport driver (KMDOD) sample ======================================================= diff --git a/video/pixlib/README.md b/video/pixlib/README.md index b7667909..81258ab7 100644 --- a/video/pixlib/README.md +++ b/video/pixlib/README.md @@ -1,3 +1,13 @@ + + + PixLib sample ============= diff --git a/wia/README.md b/wia/README.md index 9d74b0d5..75df38c3 100644 --- a/wia/README.md +++ b/wia/README.md @@ -1,4 +1,14 @@ -Windows Image Acquisition (WIA) Driver Samples + + + +Windows Image Acquisition (WIA) Driver Samples ============================================== The Windows Image Acquisition driver sample set contains samples and test tools for Windows Image Acquisition (WIA), a driver architecture and user interface for acquiring images from still image devices such as scanners. diff --git a/wmi/wmiacpi/README.md b/wmi/wmiacpi/README.md index b2057e16..75b3ef9e 100644 --- a/wmi/wmiacpi/README.md +++ b/wmi/wmiacpi/README.md @@ -1,3 +1,13 @@ + + + WMI ACPI Sample =============== diff --git a/wmi/wmisamp/README.md b/wmi/wmisamp/README.md index b32c2b04..63f41048 100644 --- a/wmi/wmisamp/README.md +++ b/wmi/wmisamp/README.md @@ -1,3 +1,13 @@ + + + Sample KMDF Driver Implementing a WMI Data Provider =================================================== diff --git a/wpd/WpdBasicHardwareDriver/README.md b/wpd/WpdBasicHardwareDriver/README.md index 523d6022..cf1b6dc7 100644 --- a/wpd/WpdBasicHardwareDriver/README.md +++ b/wpd/WpdBasicHardwareDriver/README.md @@ -1,3 +1,13 @@ + + + WPD Basic Hardware Sample Driver (UMDF Version 1) ================================================= diff --git a/wpd/WpdHelloWorldDriver/README.md b/wpd/WpdHelloWorldDriver/README.md index 0bf883bd..e63159e3 100644 --- a/wpd/WpdHelloWorldDriver/README.md +++ b/wpd/WpdHelloWorldDriver/README.md @@ -1,3 +1,13 @@ + + + WPDHelloWorld sample driver for portable devices ================================================ diff --git a/wpd/WpdMultiTransportDriver/README.md b/wpd/WpdMultiTransportDriver/README.md index 4e277f0a..81e6bf30 100644 --- a/wpd/WpdMultiTransportDriver/README.md +++ b/wpd/WpdMultiTransportDriver/README.md @@ -1,3 +1,13 @@ + + + WPD multi-transport sample driver ================================= diff --git a/wpd/WpdServiceSampleDriver/README.md b/wpd/WpdServiceSampleDriver/README.md index 4e277f0a..d946d59d 100644 --- a/wpd/WpdServiceSampleDriver/README.md +++ b/wpd/WpdServiceSampleDriver/README.md @@ -1,11 +1,17 @@ -WPD multi-transport sample driver -================================= + -The WpdMultiTransportDriver sample demonstrates how you could extend the WpdHelloWorldDriver for a device that supports multiple transports. A transport is a protocol over which a portable device communicates with a computer. Example transports include Internet Protocol (IP), Bluetooth, and USB. -A number of portable devices now support multiple transports. For example, a number of cell phones support both Bluetooth and USB. Windows supports a multitransport driver model that ensures that only one node appears for each device. +WPD service sample driver +================================= -For a complete description of this sample and its underlying code and functionality, refer to the [WPD MultiTransport Driver](http://msdn.microsoft.com/en-us/library/windows/hardware/ff597709) description in the Windows Driver Kit documentation. +Demonstrates how to extend the WpdHelloWorldDriver sample so that it supports a simulated device with a Contacts device service. Related topics -------------- diff --git a/wpd/WpdWudfSampleDriver/README.md b/wpd/WpdWudfSampleDriver/README.md index 3d2f449b..f325d5da 100644 --- a/wpd/WpdWudfSampleDriver/README.md +++ b/wpd/WpdWudfSampleDriver/README.md @@ -1,3 +1,13 @@ + + + WPD WUDF sample driver ====================== -- cgit v1.3.1 From d07ec2fd46b1150747ed584a9a1987dd2b24e3d8 Mon Sep 17 00:00:00 2001 From: NabilFates Date: Mon, 28 Aug 2017 10:53:22 -0700 Subject: Update README.md --- general/DCHU/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/general/DCHU/README.md b/general/DCHU/README.md index df571af6..58277b0c 100644 --- a/general/DCHU/README.md +++ b/general/DCHU/README.md @@ -19,9 +19,9 @@ To install these driver packages, make sure that the target machine is in Test M Then, use `pnputil /i /a ` to install each of the three driver packages. They should be installed in the following order: - * `osrfx2_DCHU_base` - * `osrfx2_DCHU_extension` - * `osrfx2_DCHU_component` +* `osrfx2_DCHU_base` +* `osrfx2_DCHU_extension` +* `osrfx2_DCHU_component` Technically the order of `osrfx2_DCHU_extension` and `osrfx2_DCHU_component` doesn't matter, but the software within `osrfx2_DCHU_component` will read the registry set by the extension to show that an extension INF's settings are applied *after* the base INF's. - \ No newline at end of file + -- cgit v1.3.1 From ad6e2c1ee8d7d53b80646461f96ee95af2ccf298 Mon Sep 17 00:00:00 2001 From: NabilFates Date: Mon, 28 Aug 2017 11:10:49 -0700 Subject: Update osrfx2_DCHU_extension.inx --- .../osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx index 660e5049..702a176c 100644 --- a/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx @@ -22,7 +22,7 @@ Signature = "$WINDOWS NT$" Class = Extension ClassGuid = {e2f84ce7-8efa-411c-aa69-97454ca4cb57} Provider = %ManufacturerName% -ExtensionId = {3846ad8c-dd27-433d-ab89-453654cd542a} +ExtensionId = {zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz} ; replace with your own GUID CatalogFile = osrfx2_DCHU_extension.cat DriverVer = 05/16/2017,15.14.36.721 @@ -51,4 +51,4 @@ ComponentIds=VID_045e&PID_94ab [Strings] ManufacturerName = "Contoso" -OsrFx2.ExtensionDesc = "OsrFx2 DCHU Device Extension" \ No newline at end of file +OsrFx2.ExtensionDesc = "OsrFx2 DCHU Device Extension" -- cgit v1.3.1 From 5afc248a8d0e15e5f198f3404a23d696103fcfa2 Mon Sep 17 00:00:00 2001 From: NabilFates Date: Mon, 28 Aug 2017 11:11:10 -0700 Subject: Update osrfx2_DCHU_extension.inx --- .../osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx index d6bc7e00..570cd389 100644 --- a/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.inx @@ -22,7 +22,7 @@ Signature = "$WINDOWS NT$" Class = Extension ClassGuid = {e2f84ce7-8efa-411c-aa69-97454ca4cb57} Provider = %ManufacturerName% -ExtensionId = {3846ad8c-dd27-433d-ab89-453654cd542a} +ExtensionId = {zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz} ; replace with your own GUID CatalogFile = osrfx2_DCHU_extension.cat DriverVer = 05/16/2017,15.14.36.721 @@ -52,4 +52,4 @@ ComponentIds=VID_045e&PID_94ab [Strings] ManufacturerName = "Contoso" -OsrFx2.ExtensionDesc = "OsrFx2 DCHU Device Extension" \ No newline at end of file +OsrFx2.ExtensionDesc = "OsrFx2 DCHU Device Extension" -- cgit v1.3.1 From 91785e7a059151525d90fcae378a9590a946cd6b Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 30 Aug 2017 11:12:04 -0700 Subject: Remove coinstaller references to sensors inf files --- sensors/ADXL345Acc/ADXL345Acc.inx | Bin 5282 -> 4986 bytes sensors/Activity/Activity.inx | Bin 5078 -> 4790 bytes sensors/CustomSensors/CustomSensors.inx | Bin 5352 -> 5054 bytes sensors/Pedometer/Pedometer.inx | Bin 5130 -> 4840 bytes sensors/SensorsComboDriver/SensorsComboDriver.inx | Bin 5638 -> 5262 bytes .../SimpleDeviceOrientationSensor.inx | Bin 6302 -> 5972 bytes 6 files changed, 0 insertions(+), 0 deletions(-) diff --git a/sensors/ADXL345Acc/ADXL345Acc.inx b/sensors/ADXL345Acc/ADXL345Acc.inx index 763a75e8..14ae5aad 100644 Binary files a/sensors/ADXL345Acc/ADXL345Acc.inx and b/sensors/ADXL345Acc/ADXL345Acc.inx differ diff --git a/sensors/Activity/Activity.inx b/sensors/Activity/Activity.inx index 91c32a5c..01f2fd3b 100644 Binary files a/sensors/Activity/Activity.inx and b/sensors/Activity/Activity.inx differ diff --git a/sensors/CustomSensors/CustomSensors.inx b/sensors/CustomSensors/CustomSensors.inx index 6a0ec8cc..fb73ab41 100644 Binary files a/sensors/CustomSensors/CustomSensors.inx and b/sensors/CustomSensors/CustomSensors.inx differ diff --git a/sensors/Pedometer/Pedometer.inx b/sensors/Pedometer/Pedometer.inx index f9cb099f..bb6cb2a2 100644 Binary files a/sensors/Pedometer/Pedometer.inx and b/sensors/Pedometer/Pedometer.inx differ diff --git a/sensors/SensorsComboDriver/SensorsComboDriver.inx b/sensors/SensorsComboDriver/SensorsComboDriver.inx index 50326f48..36389fad 100644 Binary files a/sensors/SensorsComboDriver/SensorsComboDriver.inx and b/sensors/SensorsComboDriver/SensorsComboDriver.inx differ diff --git a/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx b/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx index 6c61d4e6..6dbbf7be 100644 Binary files a/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx and b/sensors/SimpleDeviceOrientationSensor/SimpleDeviceOrientationSensor.inx differ -- cgit v1.3.1 From bf166f46e1e61f47487631912f211797b2a40bb7 Mon Sep 17 00:00:00 2001 From: Matthew Montera Date: Wed, 30 Aug 2017 13:30:12 -0700 Subject: Update README Updated README to reflect new package structure --- general/DCHU/README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/general/DCHU/README.md b/general/DCHU/README.md index 92d7e76f..290ceff7 100644 --- a/general/DCHU/README.md +++ b/general/DCHU/README.md @@ -16,22 +16,26 @@ There are three Visual Studio solutions in this sample. Each one represents a s * `osrfx2_DCHU_base` : The driver for the OSR FX2 Learning Kit. This includes the device driver, an upper filter driver for the device (a no-op), a Win32 User Service that controls lights on the device, and a console app that can control the device. -* `osrfx2_DCHU_extension`: An extension driver for the OSR FX2 device. This extension modifies some registry settings originally specified by the base driver (`osrfx2_DCHU_base`). +* `osrfx2_DCHU_extension_loose`: An extension INF for the OSR FX2 device. This extension modifies some registry settings originally specified by the base driver (`osrfx2_DCHU_base`) and also uses AddComponent to create a Software Component. There is also a component INF project that would be a separate submission to DevCenter, which runs some simple software. These two projects are loosely coupled, and can be installed in any order on the machine. -* `osrfx2_DCHU_component`: A Software Component that installs on a device that the base driver package's INF (`osrfx2_DCHU_base.inf`) creates using the [INF AddComponent Directive](https://docs.microsoft.com/windows-hardware/drivers/install/inf-addcomponent-directive). This Software Component executes a legacy .exe to install a file in the `C:\Program Files\...` directory that reads the OSR FX2 device's registry settings applied in the base driver package's INF (`osrfx2_DCHU_base.inf`) +* `osrfx2_DCHU_extension_tight`: An extension INF for the OSR FX2 device. This extension mimics the behavior of `osrfx2_DCHU_extension_loose`; however, it does so in a tightly coupled manner. Using CopyINF, both the extension and component INF are placed into one driver package (and one submission to DevCenter). Here there is less flexibility with the base/component/extension relationship, but it ensures that the component INF is applied at the same time as the extension. + +Both `osrfx2_DCHU_extension_loose` and `osrfx2_DCHU_extension_tight` provide the same functionality, so installing both on the same OSR FX2 device is unnecessary. They are intended to show a different way to use extension and component INF's depending on a project's needs. + +NOTE: osrfx2_DCHU_extension_tight will not currently build on Windows 10 version 1703. You will see an error saying that the directive CopyINF does not work from extension INFs. This has been fixed for the Windows 10 Fall Creators Update. Each of these solutions can be built with the latest WDK on Visual Studio 2015. Additionally, you can also download a [Universal Windows Platform app (UWP)](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/CustomCapability) that controls the OSR FX2 Learning Kit's device. To learn how to pair a UWP app with a device, see [Hardware access for Universal Windows Platform apps](https://docs.microsoft.com/windows-hardware/drivers/devapps/hardware-access-for-universal-windows-platform-apps) -The app and the contents of this sample can coexist, but on Windows 10, version 1703, to build the app with Visual Studio 2017, the computer cannot have the WDK installed. +The app and the contents of this sample can coexist, but on Windows 10 version 1703, to build the app with Visual Studio 2017, the computer cannot have the WDK installed. To install these driver packages, make sure that the target machine is in Test Mode, using `bcdedit /set testsigning on`. -Then, use `pnputil /i /a ` to install each of the three driver packages. They should +Then, use `pnputil /i /a ` to install each of the desired driver packages. They should be installed in the following order: * `osrfx2_DCHU_base` * `osrfx2_DCHU_extension` -* `osrfx2_DCHU_component` +* [`osrfx2_DCHU_component`] Technically the order of `osrfx2_DCHU_extension` and `osrfx2_DCHU_component` doesn't matter, but the software within `osrfx2_DCHU_component` will read the registry set by the extension to show that an extension INF's settings are applied *after* the base INF's. -- cgit v1.3.1 From 1a69aaaf45d7978bf00e17aeba8d4f028e138c4c Mon Sep 17 00:00:00 2001 From: Barry Golden Date: Wed, 30 Aug 2017 15:31:01 -0700 Subject: Added metadata to sensor README.md files. --- sensors/ADXL345Acc/readme.md | 13 +++++++++++-- sensors/Activity/readme.md | 11 ++++++++++- sensors/CustomSensors/readme.md | 13 +++++++++++-- sensors/Fusion/readme.md | 11 ++++++++++- sensors/Pedometer/readme.md | 11 ++++++++++- sensors/SensorsComboDriver/readme.md | 9 +++++++++ sensors/SimpleDeviceOrientationSensor/readme.md | 11 ++++++++++- 7 files changed, 71 insertions(+), 8 deletions(-) diff --git a/sensors/ADXL345Acc/readme.md b/sensors/ADXL345Acc/readme.md index d60e78cd..3d49e89f 100644 --- a/sensors/ADXL345Acc/readme.md +++ b/sensors/ADXL345Acc/readme.md @@ -1,3 +1,12 @@ -### ADXL345 Accelerometer Sample Driver + -The ADXL345Accelerometer sample shows how to write a UMDF v2 driver to control an ADXL345 accelerometer chip. \ No newline at end of file +# ADXL345 Accelerometer Sample Driver + +The ADXL345 accelerometer sample shows how to write a UMDF v2 driver to control an ADXL345 accelerometer chip. diff --git a/sensors/Activity/readme.md b/sensors/Activity/readme.md index 3456b263..7c9292e0 100644 --- a/sensors/Activity/readme.md +++ b/sensors/Activity/readme.md @@ -1,3 +1,12 @@ -### Activity Sensor Driver Sample + + +# Activity Sensor Driver Sample The Activity sample shows how to write a UMDF v2 driver to control an activity sensor. \ No newline at end of file diff --git a/sensors/CustomSensors/readme.md b/sensors/CustomSensors/readme.md index c5125de7..4f58fd68 100644 --- a/sensors/CustomSensors/readme.md +++ b/sensors/CustomSensors/readme.md @@ -1,3 +1,12 @@ -### Custom Sensor Driver Sample + -The CustomSensor sample shows how to write a UMDF v2 driver to control a custom sensor. \ No newline at end of file +# Custom Sensor Driver Sample + +The CustomSensor sample shows how to write a UMDF v2 driver to control a custom sensor. diff --git a/sensors/Fusion/readme.md b/sensors/Fusion/readme.md index 3a4bb2bf..a93f9195 100644 --- a/sensors/Fusion/readme.md +++ b/sensors/Fusion/readme.md @@ -1,3 +1,12 @@ -### Fusion Sensor Driver Sample + + +# Fusion Sensor Driver Sample The FusionSensor sample shows how to write a UMDF v2 driver to control a virtual FusionSensor sensor. \ No newline at end of file diff --git a/sensors/Pedometer/readme.md b/sensors/Pedometer/readme.md index 092bca57..fcf6c82f 100644 --- a/sensors/Pedometer/readme.md +++ b/sensors/Pedometer/readme.md @@ -1,3 +1,12 @@ -### Pedometer Sensor Sample + + +# Pedometer Sensor Sample The Pedometer sample shows how to write a UMDF v2 driver to control a virtual Pedometer sensor. \ No newline at end of file diff --git a/sensors/SensorsComboDriver/readme.md b/sensors/SensorsComboDriver/readme.md index 80fca3d7..9c8e4c67 100644 --- a/sensors/SensorsComboDriver/readme.md +++ b/sensors/SensorsComboDriver/readme.md @@ -1,3 +1,12 @@ + + # Sensors Combo Driver Sample The sensors combo driver sensor sample shows how to write UMDF v2 drivers to control various types of virtual sensors such as Ambient Light, Barometer, Gyroscope, Magnetometer, Geomagnetic, Gravity Vector, Proximity, Linear Accelerometer and Relative Fusion. \ No newline at end of file diff --git a/sensors/SimpleDeviceOrientationSensor/readme.md b/sensors/SimpleDeviceOrientationSensor/readme.md index b4fa4580..7a1e39f7 100644 --- a/sensors/SimpleDeviceOrientationSensor/readme.md +++ b/sensors/SimpleDeviceOrientationSensor/readme.md @@ -1,3 +1,12 @@ -### Simple Device Orientation Sensor Sample + + +# Simple Device Orientation Sensor Sample The SimpleDeviceOrientationSensor sample shows how to write a UMDF v2 sensor driver to output Simple Device Orientation values. \ No newline at end of file -- cgit v1.3.1 From c296df11dfbbcc2dfd72e5b7f17f88df4b9c00b2 Mon Sep 17 00:00:00 2001 From: Barry Golden Date: Wed, 30 Aug 2017 15:32:16 -0700 Subject: Update FWLINK. --- filesys/miniFilter/cdo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filesys/miniFilter/cdo/README.md b/filesys/miniFilter/cdo/README.md index 4a0fb6d9..2c0a03fa 100644 --- a/filesys/miniFilter/cdo/README.md +++ b/filesys/miniFilter/cdo/README.md @@ -4,7 +4,7 @@ language: cpp category: FileSystem description: An example of using a control device object (CDO) with a minifilter. - samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId= + samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=617646 ---> -- cgit v1.3.1 From 1f4ef4b3c7c137f19990cb98f0895ac5b9a0fa35 Mon Sep 17 00:00:00 2001 From: NabilFates Date: Tue, 12 Sep 2017 14:37:39 -0700 Subject: Update README.md Fixing typo --- general/DCHU/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/general/DCHU/README.md b/general/DCHU/README.md index 290ceff7..bf74d451 100644 --- a/general/DCHU/README.md +++ b/general/DCHU/README.md @@ -35,7 +35,7 @@ be installed in the following order: * `osrfx2_DCHU_base` * `osrfx2_DCHU_extension` -* [`osrfx2_DCHU_component`] +* `osrfx2_DCHU_component` Technically the order of `osrfx2_DCHU_extension` and `osrfx2_DCHU_component` doesn't matter, but the software within `osrfx2_DCHU_component` will read the registry set by the extension to show that an extension INF's settings are applied *after* the base INF's. -- cgit v1.3.1 From 96b567f49ef5c445d09f4fef0752da83024c6968 Mon Sep 17 00:00:00 2001 From: Wei Mao Date: Mon, 18 Sep 2017 01:33:03 -0700 Subject: Include headers from current folder --- .../PhoneAudioSample/PhoneAudioSample.vcxproj | 26 +- audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj | 26 +- audio/sysvad/SwapAPO/DelayAPO/DelayAPO.vcxproj | 24 +- .../TabletAudioSample/TabletAudioSample.vcxproj | 26 +- audio/sysvad/common.cpp | 2 + bluetooth/serialhcibus/WDK/SerialBusWdk.vcxproj | 26 +- general/filehistory/exe/fhsetup.vcxproj | 26 +- general/perfcounters/kcs/kcs.vcxproj | 4 +- .../SystemTraceControl/SystemTraceControl.vcxproj | 8 +- hid/hidusbfx2/sys/driver.c | 10 +- hid/hidusbfx2/sys/hid.c | 112 +- hid/hidusbfx2/sys/usb.c | 26 +- network/radio/HidSwitchDriverSample/driver.c | 10 +- network/radio/HidSwitchDriverSample/hid.c | 10 +- network/radio/HidSwitchDriverSample/usb.c | 12 +- network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj | 6 +- network/wlan/WDI/PLATFORM/NDIS6/WDI_Cmds.c | 1112 ++++++++++---------- network/wlan/WDI/PLATFORM/NDIS6/WDI_Common.c | 540 +++++----- print/XPSDrvSmpl/src/common/pshndlr.cpp | 6 +- print/XPSDrvSmpl/src/common/ptquerybld.cpp | 13 +- print/XPSDrvSmpl/src/common/wmpthndlr.cpp | 4 +- print/XPSDrvSmpl/src/filters/color/cmimg.cpp | 2 +- print/XPSDrvSmpl/src/filters/color/dictionary.cpp | 2 +- print/XPSDrvSmpl/src/filters/color/profman.cpp | 2 +- print/XPSDrvSmpl/src/filters/common/ptmanage.cpp | 22 +- print/XPSDrvSmpl/src/filters/nup/nupsax.cpp | 6 +- print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp | 2 +- print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp | 3 +- sd/sdiomars/mars.vcxproj | 26 +- security/elam/elamsample.c | 2 +- sensors/Activity/Device.h | 4 +- sensors/CustomSensors/Device.h | 4 +- sensors/CustomSensors/HardwareSimulator.h | 2 +- sensors/Fusion/Device.h | 4 - sensors/Pedometer/Device.h | 2 +- sensors/Pedometer/HardwareSimulator.h | 2 +- .../SensorsComboDriver/SensorsComboDriver.vcxproj | 6 +- sensors/SimpleDeviceOrientationSensor/Device.h | 2 +- .../HardwareSimulator.h | 2 +- smartcrd/pscr/Pscr.vcxproj | 26 +- storage/class/classpnp/src/srblib.c | 2 +- storage/miniports/lsi_u3/src/lsi_u3.inf | Bin 5998 -> 6022 bytes storage/msdsm/src/intrface.c | 56 +- usb/UcmCxUcsi/UcmCxUcsi.vcxproj | 3 +- .../sys/kmdf_enumswitches.vcxproj | 26 +- usb/kmdf_fx2/driver/osrusbfx2.vcxproj | 26 +- usb/umdf2_fx2/driver/osrusbfx2um.vcxproj | 26 +- usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj | 26 +- wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx | 1 + .../WpdMultiTransportDriver.inx | 1 + .../WpdServiceSampleDriver.inx | 1 + wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx | Bin 4018 -> 4074 bytes 52 files changed, 1154 insertions(+), 1164 deletions(-) diff --git a/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj b/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj index f140a088..cf608ab0 100644 --- a/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj +++ b/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj @@ -83,19 +83,19 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\portcls.lib;$(DDK_LIB_PATH)\stdunk.lib;$(DDK_LIB_PATH)\libcntpr.lib - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. true Level4 %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE @@ -105,19 +105,19 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\portcls.lib;$(DDK_LIB_PATH)\stdunk.lib;$(DDK_LIB_PATH)\libcntpr.lib - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. true Level4 %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE @@ -127,19 +127,19 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\portcls.lib;$(DDK_LIB_PATH)\stdunk.lib;$(DDK_LIB_PATH)\libcntpr.lib - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. true Level4 %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE @@ -149,19 +149,19 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\portcls.lib;$(DDK_LIB_PATH)\stdunk.lib;$(DDK_LIB_PATH)\libcntpr.lib - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. true Level4 %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..;. %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE @@ -301,4 +301,4 @@
- \ No newline at end of file + diff --git a/audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj b/audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj index 563f6375..9737729a 100644 --- a/audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj +++ b/audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj @@ -134,18 +134,18 @@ true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib @@ -158,18 +158,18 @@ true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib @@ -182,18 +182,18 @@ true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib @@ -206,18 +206,18 @@ true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib @@ -247,4 +247,4 @@ - \ No newline at end of file + diff --git a/audio/sysvad/SwapAPO/DelayAPO/DelayAPO.vcxproj b/audio/sysvad/SwapAPO/DelayAPO/DelayAPO.vcxproj index 68fd57b6..ee3db3f6 100644 --- a/audio/sysvad/SwapAPO/DelayAPO/DelayAPO.vcxproj +++ b/audio/sysvad/SwapAPO/DelayAPO/DelayAPO.vcxproj @@ -134,18 +134,18 @@ true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib @@ -158,18 +158,18 @@ true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib @@ -182,18 +182,18 @@ true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib @@ -206,18 +206,18 @@ true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;. %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib diff --git a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj index 8efc42cf..48c5665e 100644 --- a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj +++ b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj @@ -185,7 +185,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. 4595;%(DisableSpecificWarnings) @@ -193,12 +193,12 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. @@ -208,7 +208,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. 4595;%(DisableSpecificWarnings) @@ -216,12 +216,12 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. @@ -231,7 +231,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. 4595;%(DisableSpecificWarnings) @@ -239,12 +239,12 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. @@ -254,7 +254,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. 4595;%(DisableSpecificWarnings) @@ -262,12 +262,12 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates - %(AdditionalIncludeDirectories);..\EndpointsCommon + %(AdditionalIncludeDirectories);..\EndpointsCommon;. @@ -296,4 +296,4 @@ - \ No newline at end of file + diff --git a/audio/sysvad/common.cpp b/audio/sysvad/common.cpp index 2aadb5e6..a4c8f5e2 100644 --- a/audio/sysvad/common.cpp +++ b/audio/sysvad/common.cpp @@ -4281,6 +4281,7 @@ BthHfpDevice::GetBthHfpCodecId(_Out_ UCHAR * CodecId) ASSERT(CodecId != NULL); +#if !defined(NTDDI_WIN10_RS3) typedef enum _HFP_BYPASS_CODEC_ID_VERSION { REQ_HFP_BYPASS_CODEC_ID_V1 = 1, } HFP_BYPASS_CODEC_ID_VERSION, *PHFP_BYPASS_CODEC_ID_VERSION; @@ -4288,6 +4289,7 @@ BthHfpDevice::GetBthHfpCodecId(_Out_ UCHAR * CodecId) typedef struct _HFP_BYPASS_CODEC_ID_V1 { UCHAR CodecId; } HFP_BYPASS_CODEC_ID_V1, *PHFP_BYPASS_CODEC_ID_V1; +#endif NTSTATUS ntStatus = STATUS_SUCCESS; diff --git a/bluetooth/serialhcibus/WDK/SerialBusWdk.vcxproj b/bluetooth/serialhcibus/WDK/SerialBusWdk.vcxproj index 1aa3a43c..6319ca83 100644 --- a/bluetooth/serialhcibus/WDK/SerialBusWdk.vcxproj +++ b/bluetooth/serialhcibus/WDK/SerialBusWdk.vcxproj @@ -103,11 +103,11 @@ - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES true Level4 @@ -115,7 +115,7 @@ - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES @@ -124,11 +124,11 @@ - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES true Level4 @@ -136,7 +136,7 @@ - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES @@ -145,11 +145,11 @@ - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES true Level4 @@ -157,7 +157,7 @@ - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES @@ -166,11 +166,11 @@ - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES true Level4 @@ -178,7 +178,7 @@ - %(AdditionalIncludeDirectories);..\ + %(AdditionalIncludeDirectories);..\;. %(PreprocessorDefinitions);RESHUB_USE_HELPER_ROUTINES @@ -201,4 +201,4 @@ - \ No newline at end of file + diff --git a/general/filehistory/exe/fhsetup.vcxproj b/general/filehistory/exe/fhsetup.vcxproj index fdb347e1..e6e78377 100644 --- a/general/filehistory/exe/fhsetup.vcxproj +++ b/general/filehistory/exe/fhsetup.vcxproj @@ -97,15 +97,15 @@ Level4 Sync %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(AdditionalDependencies);shell32.lib;shlwapi.lib;Ole32.lib;Oleaut32.lib;User32.lib;fhsvcctl.lib @@ -117,15 +117,15 @@ Level4 Sync %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(AdditionalDependencies);shell32.lib;shlwapi.lib;Ole32.lib;Oleaut32.lib;User32.lib;fhsvcctl.lib @@ -137,15 +137,15 @@ Level4 Sync %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(AdditionalDependencies);shell32.lib;shlwapi.lib;Ole32.lib;Oleaut32.lib;User32.lib;fhsvcctl.lib @@ -157,15 +157,15 @@ Level4 Sync %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(PreprocessorDefinitions);UNICODE;_UNICODE - %(AdditionalIncludeDirectories);$(SDK_INC_PATH) + %(AdditionalIncludeDirectories);$(SDK_INC_PATH);. %(AdditionalDependencies);shell32.lib;shlwapi.lib;Ole32.lib;Oleaut32.lib;User32.lib;fhsvcctl.lib @@ -187,4 +187,4 @@ - \ No newline at end of file + diff --git a/general/perfcounters/kcs/kcs.vcxproj b/general/perfcounters/kcs/kcs.vcxproj index 5f30eb23..e97abb07 100644 --- a/general/perfcounters/kcs/kcs.vcxproj +++ b/general/perfcounters/kcs/kcs.vcxproj @@ -151,7 +151,7 @@ $([System.IO.Path]::GetDirectoryName($(ProjectDir)\$(IntDir))) - + @@ -170,4 +170,4 @@ - \ No newline at end of file + diff --git a/general/tracing/SystemTraceControl/SystemTraceControl.vcxproj b/general/tracing/SystemTraceControl/SystemTraceControl.vcxproj index 7669ebaa..1d635e7e 100644 --- a/general/tracing/SystemTraceControl/SystemTraceControl.vcxproj +++ b/general/tracing/SystemTraceControl/SystemTraceControl.vcxproj @@ -26,22 +26,22 @@ Application true - v140 + WindowsApplicationForDrivers10.0 Application false - v140 + WindowsApplicationForDrivers10.0 Application true - v140 + WindowsApplicationForDrivers10.0 Application false - v140 + WindowsApplicationForDrivers10.0 diff --git a/hid/hidusbfx2/sys/driver.c b/hid/hidusbfx2/sys/driver.c index 825c803f..5ec4a441 100644 --- a/hid/hidusbfx2/sys/driver.c +++ b/hid/hidusbfx2/sys/driver.c @@ -26,7 +26,7 @@ Revision History: --*/ -#include +#include "hidusbfx2.h" #if defined(EVENT_TRACING) // @@ -110,7 +110,7 @@ Return Value: if (!NT_SUCCESS(status)) { TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "WdfDriverCreate failed with status 0x%x\n", status); - + WPP_CLEANUP(DriverObject); } @@ -160,7 +160,7 @@ Return Value: "HidFx2EvtDeviceAdd called\n"); // - // Tell framework this is a filter driver. Filter drivers by default are + // Tell framework this is a filter driver. Filter drivers by default are // not power policy owners. This works well for this driver because // HIDclass driver is the power policy owner for HID minidrivers. // @@ -202,7 +202,7 @@ Return Value: } devContext = GetDeviceContext(hDevice); - + WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&queueConfig, WdfIoQueueDispatchParallel); queueConfig.EvtIoInternalDeviceControl = HidFx2EvtInternalDeviceControl; @@ -246,7 +246,7 @@ Return Value: } // - // Create a timer to handle debouncing of switchpack + // Create a timer to handle debouncing of switchpack // WDF_TIMER_CONFIG_INIT( &timerConfig, diff --git a/hid/hidusbfx2/sys/hid.c b/hid/hidusbfx2/sys/hid.c index 362ed515..423e1131 100644 --- a/hid/hidusbfx2/sys/hid.c +++ b/hid/hidusbfx2/sys/hid.c @@ -28,7 +28,7 @@ Revision History: #define USE_HARDCODED_HID_REPORT_DESCRIPTOR -#include +#include "hidusbfx2.h" #if defined(EVENT_TRACING) #include "hid.tmh" @@ -53,7 +53,7 @@ HidFx2EvtInternalDeviceControl( Routine Description: - This event is called when the framework receives + This event is called when the framework receives IRP_MJ_INTERNAL DEVICE_CONTROL requests from the system. Arguments: @@ -90,7 +90,7 @@ Return Value: TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL, "%s, Queue:0x%p, Request:0x%p\n", DbgHidInternalIoctlString(IoControlCode), - Queue, + Queue, Request ); @@ -139,14 +139,14 @@ Return Value: if(!NT_SUCCESS(status)){ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "WdfRequestForwardToIoQueue failed with status: 0x%x\n", status); - + WdfRequestComplete(Request, status); } return; // -// This feature is only supported on WinXp and later. Compiling in W2K +// This feature is only supported on WinXp and later. Compiling in W2K // build environment will fail without this conditional preprocessor statement. // case IOCTL_HID_SEND_IDLE_NOTIFICATION_REQUEST: @@ -154,16 +154,16 @@ Return Value: // // Hidclass sends this IOCTL for devices that have opted-in for Selective // Suspend feature. This feature is enabled by adding a registry value - // "SelectiveSuspendEnabled" = 1 in the hardware key through inf file - // (see hidusbfx2.inf). Since hidclass is the power policy owner for - // this stack, it controls when to send idle notification and when to - // cancel it. This IOCTL is passed to USB stack. USB stack pends it. + // "SelectiveSuspendEnabled" = 1 in the hardware key through inf file + // (see hidusbfx2.inf). Since hidclass is the power policy owner for + // this stack, it controls when to send idle notification and when to + // cancel it. This IOCTL is passed to USB stack. USB stack pends it. // USB stack completes the request when it determines that the device is - // idle. Hidclass's idle notification callback get called that requests a - // wait-wake Irp and subsequently powers down the device. - // The device is powered-up either when a handle is opened for the PDOs + // idle. Hidclass's idle notification callback get called that requests a + // wait-wake Irp and subsequently powers down the device. + // The device is powered-up either when a handle is opened for the PDOs // exposed by hidclass, or when usb stack completes wait - // wake request. In the first case, hidclass cancels the notification + // wake request. In the first case, hidclass cancels the notification // request (pended with usb stack), cancels wait-wake Irp and powers up // the device. In the second case, an external wake event triggers completion // of wait-wake irp and powering up of device. @@ -173,10 +173,10 @@ Return Value: if (!NT_SUCCESS(status)) { TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "SendIdleNotification failed with status: 0x%x\n", status); - + WdfRequestComplete(Request, status); - } - + } + return; case IOCTL_HID_SET_FEATURE: @@ -187,7 +187,7 @@ Return Value: status = HidFx2SetFeature(Request); WdfRequestComplete(Request, status); return; - + case IOCTL_HID_GET_FEATURE: // // Get a HID class feature report from a top-level collection of @@ -248,7 +248,7 @@ Routine Description Arguments: - Request - Wdf Request + Request - Wdf Request Return Value: @@ -268,7 +268,7 @@ Return Value: TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "HidFx2SetFeature Enter\n"); device = WdfIoQueueGetDevice(WdfRequestGetIoQueue(Request)); - + WDF_REQUEST_PARAMETERS_INIT(¶ms); WdfRequestGetParameters(Request, ¶ms); @@ -276,7 +276,7 @@ Return Value: // IOCTL_HID_SET_FEATURE & IOCTL_HID_GET_FEATURE are not METHOD_NIEHTER // IOCTLs. So you cannot retreive UserBuffer from the IRP using Wdf // function. As a result we have to escape out to WDM to get the UserBuffer - // directly from the IRP. + // directly from the IRP. // if (params.Parameters.DeviceIoControl.InputBufferLength < sizeof(HID_XFER_PACKET)) { status = STATUS_BUFFER_TOO_SMALL; @@ -321,15 +321,15 @@ Return Value: if (transferPacket->reportId == SEVEN_SEGMENT_REPORT_ID) { status = SendVendorCommand( - device, + device, HIDFX2_SET_7SEGMENT_DISPLAY, - &featureUsage + &featureUsage ); } else if (transferPacket->reportId == BARGRAPH_REPORT_ID) { status = SendVendorCommand( - device, + device, HIDFX2_SET_BARGRAPH_DISPLAY, &featureUsage ); @@ -360,7 +360,7 @@ Routine Description Arguments: - Request - Wdf Request + Request - Wdf Request BytesReturned - Size of buffer returned for the request @@ -383,7 +383,7 @@ Return Value: *BytesReturned = 0; device = WdfIoQueueGetDevice(WdfRequestGetIoQueue(Request)); - + WDF_REQUEST_PARAMETERS_INIT(¶ms); WdfRequestGetParameters(Request, ¶ms); @@ -391,7 +391,7 @@ Return Value: // IOCTL_HID_SET_FEATURE & IOCTL_HID_GET_FEATURE are not METHOD_NIEHTER // IOCTLs. So you cannot retreive UserBuffer from the IRP using Wdf // function. As a result we have to escape out to WDM to get the UserBuffer - // directly from the IRP. + // directly from the IRP. // if (params.Parameters.DeviceIoControl.OutputBufferLength < sizeof(HID_XFER_PACKET)) { status = STATUS_BUFFER_TOO_SMALL; @@ -431,15 +431,15 @@ Return Value: if (transferPacket->reportId == SEVEN_SEGMENT_REPORT_ID) { status = GetVendorData( - device, + device, HIDFX2_READ_7SEGMENT_DISPLAY, - &featureReport->FeatureData + &featureReport->FeatureData ); } else if (transferPacket->reportId == BARGRAPH_REPORT_ID) { status = GetVendorData( - device, + device, HIDFX2_READ_BARGRAPH_DISPLAY, &featureReport->FeatureData ); @@ -473,7 +473,7 @@ Routine Description Arguments: - Request - Wdf Request + Request - Wdf Request Return Value: @@ -487,7 +487,7 @@ Return Value: WDF_MEMORY_DESCRIPTOR memDesc; WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket; WDF_REQUEST_SEND_OPTIONS sendOptions; - + PAGED_CODE(); TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "SendVendorCommand Enter\n"); @@ -495,7 +495,7 @@ Return Value: pDevContext = GetDeviceContext(Device); TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL, - "SendVendorCommand: Command:0x%x, data: 0x%x\n", + "SendVendorCommand: Command:0x%x, data: 0x%x\n", VendorCommand, *CommandData); // @@ -503,7 +503,7 @@ Return Value: // // Send the I/O with a timeout. We do that because we send the // I/O in the context of the user thread and if it gets stuck, it would - // prevent the user process from existing. + // prevent the user process from existing. // WDF_REQUEST_SEND_OPTIONS_INIT(&sendOptions, WDF_REQUEST_SEND_OPTION_TIMEOUT); @@ -535,7 +535,7 @@ Return Value: TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "SendtVendorCommand: Failed to set Segment Display state - 0x%x \n", status); - } + } TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "SendVendorCommand Exit\n"); @@ -557,7 +557,7 @@ Routine Description Arguments: - Request - Wdf Request + Request - Wdf Request Return Value: @@ -571,7 +571,7 @@ Return Value: WDF_MEMORY_DESCRIPTOR memDesc; WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket; WDF_REQUEST_SEND_OPTIONS sendOptions; - + PAGED_CODE(); TraceEvents(TRACE_LEVEL_VERBOSE, DBG_IOCTL, "GetVendorData Enter\n"); @@ -579,7 +579,7 @@ Return Value: pDevContext = GetDeviceContext(Device); TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL, - "GetVendorData: Command:0x%x, data: 0x%x\n", + "GetVendorData: Command:0x%x, data: 0x%x\n", VendorCommand, *CommandData); // @@ -587,7 +587,7 @@ Return Value: // // Send the I/O with a timeout. We do that because we send the // I/O in the context of the user thread and if it gets stuck, it would - // prevent the user process from existing. + // prevent the user process from existing. // WDF_REQUEST_SEND_OPTIONS_INIT(&sendOptions, WDF_REQUEST_SEND_OPTION_TIMEOUT); @@ -619,11 +619,11 @@ Return Value: TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "GetVendorData: Failed to get state - 0x%x \n", status); - } + } else { TraceEvents(TRACE_LEVEL_INFORMATION, DBG_IOCTL, - "GetVendorData: Command:0x%x, data after command: 0x%x\n", + "GetVendorData: Command:0x%x, data after command: 0x%x\n", VendorCommand, *CommandData); } @@ -642,7 +642,7 @@ HidFx2GetHidDescriptor( Routine Description: - Finds the HID descriptor and copies it into the buffer provided by the + Finds the HID descriptor and copies it into the buffer provided by the Request. Arguments: @@ -668,7 +668,7 @@ Return Value: // // This IOCTL is METHOD_NEITHER so WdfRequestRetrieveOutputMemory - // will correctly retrieve buffer from Irp->UserBuffer. + // will correctly retrieve buffer from Irp->UserBuffer. // Remember that HIDCLASS provides the buffer in the Irp->UserBuffer // field irrespective of the ioctl buffer type. However, framework is very // strict about type checking. You cannot get Irp->UserBuffer by using @@ -683,7 +683,7 @@ Return Value: } // - // Use hardcoded "HID Descriptor" + // Use hardcoded "HID Descriptor" // bytesToCopy = G_DefaultHidDescriptor.bLength; @@ -691,9 +691,9 @@ Return Value: status = STATUS_INVALID_DEVICE_STATE; TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "G_DefaultHidDescriptor is zero, 0x%x\n", status); - return status; + return status; } - + status = WdfMemoryCopyFromBuffer(memory, 0, // Offset (PVOID) &G_DefaultHidDescriptor, @@ -749,7 +749,7 @@ Return Value: // // This IOCTL is METHOD_NEITHER so WdfRequestRetrieveOutputMemory - // will correctly retrieve buffer from Irp->UserBuffer. + // will correctly retrieve buffer from Irp->UserBuffer. // Remember that HIDCLASS provides the buffer in the Irp->UserBuffer // field irrespective of the ioctl buffer type. However, framework is very // strict about type checking. You cannot get Irp->UserBuffer by using @@ -772,9 +772,9 @@ Return Value: status = STATUS_INVALID_DEVICE_STATE; TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL, "G_DefaultHidDescriptor's reportLenght is zero, 0x%x\n", status); - return status; + return status; } - + status = WdfMemoryCopyFromBuffer(memory, 0, (PVOID) G_DefaultReportDescriptor, @@ -828,7 +828,7 @@ Return Value: // // This IOCTL is METHOD_NEITHER so WdfRequestRetrieveOutputMemory - // will correctly retrieve buffer from Irp->UserBuffer. + // will correctly retrieve buffer from Irp->UserBuffer. // Remember that HIDCLASS provides the buffer in the Irp->UserBuffer // field irrespective of the ioctl buffer type. However, framework is very // strict about type checking. You cannot get Irp->UserBuffer by using @@ -890,7 +890,7 @@ Return Value: BOOLEAN sendStatus = FALSE; WDF_REQUEST_SEND_OPTIONS options; WDFIOTARGET nextLowerDriver; - WDFDEVICE device; + WDFDEVICE device; PIO_STACK_LOCATION currentIrpStack = NULL; IO_STACK_LOCATION nextIrpStack; @@ -900,7 +900,7 @@ Return Value: // // Convert the request to corresponding USB Idle notification request // - if (currentIrpStack->Parameters.DeviceIoControl.InputBufferLength < + if (currentIrpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(HID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO)) { status = STATUS_BUFFER_TOO_SMALL; @@ -909,7 +909,7 @@ Return Value: return status; } - ASSERT(sizeof(HID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO) + ASSERT(sizeof(HID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO) == sizeof(USB_IDLE_CALLBACK_INFO)); #pragma warning(suppress :4127) // conditional expression is constant warning @@ -925,15 +925,15 @@ Return Value: // prepare next stack location // RtlZeroMemory(&nextIrpStack, sizeof(IO_STACK_LOCATION)); - + nextIrpStack.MajorFunction = currentIrpStack->MajorFunction; nextIrpStack.Parameters.DeviceIoControl.InputBufferLength = currentIrpStack->Parameters.DeviceIoControl.InputBufferLength; nextIrpStack.Parameters.DeviceIoControl.Type3InputBuffer = currentIrpStack->Parameters.DeviceIoControl.Type3InputBuffer; - nextIrpStack.Parameters.DeviceIoControl.IoControlCode = + nextIrpStack.Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION; - nextIrpStack.DeviceObject = + nextIrpStack.DeviceObject = WdfIoTargetWdmGetTargetDeviceObject(WdfDeviceGetIoTarget(device)); // @@ -954,7 +954,7 @@ Return Value: ); nextLowerDriver = WdfDeviceGetIoTarget(device); - + sendStatus = WdfRequestSend( Request, nextLowerDriver, diff --git a/hid/hidusbfx2/sys/usb.c b/hid/hidusbfx2/sys/usb.c index 50f1a03b..676d92d6 100644 --- a/hid/hidusbfx2/sys/usb.c +++ b/hid/hidusbfx2/sys/usb.c @@ -26,7 +26,7 @@ Revision History: --*/ -#include +#include "hidusbfx2.h" #if defined(EVENT_TRACING) #include "usb.tmh" @@ -84,7 +84,7 @@ Return Value: "HidFx2EvtDevicePrepareHardware Enter\n"); devContext = GetDeviceContext(Device); - + // // Create a WDFUSBDEVICE object. WdfUsbTargetDeviceCreate obtains the // USB device descriptor and the first USB configuration descriptor from @@ -95,8 +95,8 @@ Return Value: // object. The driver cannot change this parent, and the ParentObject // member or the WDF_OBJECT_ATTRIBUTES structure must be NULL. // - // We only create device the first time PrepareHardware is called. If - // the device is restarted by pnp manager for resource rebalance, we + // We only create device the first time 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. // @@ -104,7 +104,7 @@ Return Value: status = WdfUsbTargetDeviceCreate(Device, WDF_NO_OBJECT_ATTRIBUTES, &devContext->UsbDevice); - + if (!NT_SUCCESS(status)) { TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, "WdfUsbTargetDeviceCreate failed 0x%x\n", status); @@ -113,7 +113,7 @@ Return Value: // // TODO: If you are fetching configuration descriptor from device for - // selecting a configuration or to parse other descriptors, call + // selecting a configuration or to parse other descriptors, call // HidFx2ValidateConfigurationDescriptor // to do basic validation on the descriptors before you access them. // @@ -332,7 +332,7 @@ Return Value: ); return; } - + switchState = WdfMemoryGetBuffer(Buffer, NULL); currentSwitchState = *switchState; @@ -812,8 +812,8 @@ Return Value: // 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; @@ -821,10 +821,10 @@ Return Value: // // 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 - // - + // Check that all such descriptors have size >= sizeof(the descriptor they point to) + // Check for any association between them if required + // + return status; } diff --git a/network/radio/HidSwitchDriverSample/driver.c b/network/radio/HidSwitchDriverSample/driver.c index 54e80dae..61cc97fc 100644 --- a/network/radio/HidSwitchDriverSample/driver.c +++ b/network/radio/HidSwitchDriverSample/driver.c @@ -1,4 +1,4 @@ -#include +#include "RadioSwitchHidUsbFx2.h" #pragma warning(disable:28252) #pragma warning(disable:28253) #include "driver.tmh" @@ -39,7 +39,7 @@ NTSTATUS DriverEntry (_In_ PDRIVER_OBJECT pDriverObject, _In_ PUNICODE_STRING ps &config, // Driver Config Info WDF_NO_HANDLE ); - if (!NT_SUCCESS(status)) + if (!NT_SUCCESS(status)) { TraceErr(DBG_INIT, "(%!FUNC!)WdfDriverCreate failed with status %!STATUS!\n", status); WPP_CLEANUP(pDriverObject); @@ -64,7 +64,7 @@ void HidFx2EvtDriverContextCleanup(_In_ WDFOBJECT hDriver) -//HidFx2EvtDeviceAdd is called by the framework in response to AddDevicecall from the PnP manager. +//HidFx2EvtDeviceAdd is called by the framework in response to AddDevicecall from the PnP manager. //We create and initialize a WDF device object to represent a new instance of device. // NTSTATUS HidFx2EvtDeviceAdd(_In_ WDFDRIVER hDriver, _Inout_ PWDFDEVICE_INIT pDeviceInit) @@ -111,7 +111,7 @@ NTSTATUS HidFx2EvtDeviceAdd(_In_ WDFDRIVER hDriver, _Inout_ PWDFDEVICE_INIT pDev } pDevContext = GetDeviceContext(hDevice); - + WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&queueConfig, WdfIoQueueDispatchParallel); queueConfig.EvtIoInternalDeviceControl = HidFx2EvtInternalDeviceControl; @@ -136,7 +136,7 @@ NTSTATUS HidFx2EvtDeviceAdd(_In_ WDFDRIVER hDriver, _Inout_ PWDFDEVICE_INIT pDev return status; } - // Create a timer to handle debouncing of switchpack + // Create a timer to handle debouncing of switchpack WDF_TIMER_CONFIG_INIT(&timerConfig, HidFx2EvtTimerFunction); timerConfig.AutomaticSerialization = FALSE; diff --git a/network/radio/HidSwitchDriverSample/hid.c b/network/radio/HidSwitchDriverSample/hid.c index 27fcefea..2421b88f 100644 --- a/network/radio/HidSwitchDriverSample/hid.c +++ b/network/radio/HidSwitchDriverSample/hid.c @@ -1,4 +1,4 @@ -#include +#include "RadioSwitchHidUsbFx2.h" #include "hid.tmh" // Radio Management Collection - Scenario 1 control collection (Button only) @@ -223,7 +223,7 @@ NTSTATUS HidFx2GetInput(_In_ WDFREQUEST hRequest) TraceVerbose(DBG_IOCTL, "(%!FUNC!) Enter\n"); hDevice = WdfIoQueueGetDevice(WdfRequestGetIoQueue(hRequest)); - + WDF_REQUEST_PARAMETERS_INIT(¶ms); WdfRequestGetParameters(hRequest, ¶ms); @@ -296,7 +296,7 @@ NTSTATUS HidFx2SetOutput(_In_ WDFREQUEST hRequest) TraceVerbose(DBG_IOCTL, "(%!FUNC!) Enter\n"); hDevice = WdfIoQueueGetDevice(WdfRequestGetIoQueue(hRequest)); - + WDF_REQUEST_PARAMETERS_INIT(¶ms); WdfRequestGetParameters(hRequest, ¶ms); @@ -335,7 +335,7 @@ NTSTATUS HidFx2SetOutput(_In_ WDFREQUEST hRequest) TraceErr(DBG_IOCTL, "(%!FUNC!) Incorrect report ID, %!STATUS!\n", status); return status; } - + pOutputReport = (PHIDFX2_IO_REPORT)pTransferPacket->reportBuffer; if (pOutputReport->bData == 0) @@ -471,7 +471,7 @@ NTSTATUS HidFx2GetHidDescriptor(_In_ WDFDEVICE hDevice, _In_ WDFREQUEST hRequest TraceErr(DBG_IOCTL, "(%!FUNC!) c_DefaultHidDescriptor is zero, %!STATUS!\n", status); return status; } - + } else // WdfRequestRetrieveOutputMemory failed { diff --git a/network/radio/HidSwitchDriverSample/usb.c b/network/radio/HidSwitchDriverSample/usb.c index bacd1bce..84cf7faa 100644 --- a/network/radio/HidSwitchDriverSample/usb.c +++ b/network/radio/HidSwitchDriverSample/usb.c @@ -1,4 +1,4 @@ -#include +#include "RadioSwitchHidUsbFx2.h" #include "usb.tmh" @@ -39,7 +39,7 @@ HidFx2EvtDevicePrepareHardware( // The parent of each USB device object is the driver's framework driver object. The driver cannot change this parent, and the ParentObject // member or the WDF_OBJECT_ATTRIBUTES structure must be NULL. // - // We only create device the first time PrepareHardware is called. If the device is restarted by pnp manager for resource rebalance, we + // We only create device the first time 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 (pDevContext->hUsbDevice == NULL) { @@ -162,7 +162,7 @@ void HidFx2EvtUsbInterruptPipeReadComplete( } - // Make sure that there is data in the read packet. + // 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 (cNumBytesTransferred == 0) { @@ -269,7 +269,7 @@ void HidFx2EvtTimerFunction(_In_ WDFTIMER hTimer) WdfRequestCompleteWithInformation(hRequest, status, cBytesReturned); - } + } else if (status != STATUS_NO_MORE_ENTRIES) { TraceErr(DBG_IOCTL, "(%!FUNC!) WdfIoQueueRetrieveNextRequest status %!STATUS!\n", status); @@ -340,7 +340,7 @@ NTSTATUS HidFx2GetSwitchState(_In_ WDFDEVICE hDevice, _Out_ unsigned char *pbSwi // EvtDeviceD0Entry event callback must perform any operations that are necessary before the specified device is used. // Called every time the hardware needs to be initialized/reinitialized. -// This function is not marked pageable because this function is in the device power up path. +// This function is not marked pageable because this function is in the device power up path. // This function runs at PASSIVE_LEVEL, even though it is not paged. // NTSTATUS HidFx2EvtDeviceD0Entry(_In_ WDFDEVICE hDevice, _In_ WDF_POWER_DEVICE_STATE previousState) @@ -412,7 +412,7 @@ 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. +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. diff --git a/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj b/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj index c6089236..af48c0a4 100644 --- a/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj +++ b/network/wlan/WDI/PLATFORM/NDIS6/SDIO/sdio.vcxproj @@ -577,6 +577,8 @@ $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)COMMON\$(Configuration)\$(Platform)\common.lib;$(SolutionDir)PLATFORM\NdisComm\$(Configuration)\$(Platform)\NdisComm.lib;$(SolutionDir)\LIB\x64\hal.lib;$(SolutionDir)\LIB\x64\rtklibcom.lib;$(WindowsSDK_LibraryPath_x64)km\x64\ndis.lib;$(WindowsSDK_LibraryPath_x64)km\x64\ntoskrnl.lib;$(WindowsSDK_LibraryPath_x64)km\x64\sdbus.lib;$(WindowsSDK_LibraryPath_x64)km\x64\wlan\1.0\TlvGeneratorParser.lib; + + $(AdditionalOptions) /IGNORE:4099 true @@ -636,7 +638,7 @@ - @@ -748,4 +750,4 @@ - \ No newline at end of file + diff --git a/network/wlan/WDI/PLATFORM/NDIS6/WDI_Cmds.c b/network/wlan/WDI/PLATFORM/NDIS6/WDI_Cmds.c index d1005a4b..ec5cddd6 100644 --- a/network/wlan/WDI/PLATFORM/NDIS6/WDI_Cmds.c +++ b/network/wlan/WDI/PLATFORM/NDIS6/WDI_Cmds.c @@ -28,7 +28,7 @@ wdi_task_WriteResult( { NdisMoveMemory((u1Byte *)hdr + sizeof(*hdr), tlv, tlvlen); } - + hTask->OutputBufferLength = tlvlen; } @@ -40,7 +40,7 @@ wdi_ScanCb( ) { ADAPTER *pAdapter = (ADAPTER *)pCtx; - + RT_TRACE_F(COMP_MLME, DBG_LOUD, ("%s\n", CustomScan_ScanStateTxt(state))); if(CUSTOM_SCAN_STATE_PRE_DESTROY == state) @@ -59,13 +59,13 @@ wdi_P2PDiscoveryCb( ADAPTER *pAdapter = (ADAPTER *)pCtx; RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; P2P_INFO *info = GET_P2P_INFO(pAdapter); - + RT_TRACE_F(COMP_P2P, DBG_LOUD, ("%s\n", CustomScan_ScanStateTxt(state))); if(CUSTOM_SCAN_STATE_COMPLETED == state) { WDI_TASK_P2P_DISCOVER_PARAMETERS *param = hTask->tlvParser.parsedTlv.paramP2pDiscover; - + MGNT_INFO *mgnt = &pAdapter->MgntInfo; u4Byte it = 0; @@ -118,18 +118,18 @@ wdi_ConstructScanReq( u2Byte duration = (u2Byte)(SCAN_ACTIVE == scanType ? param->DwellTime.ActiveChannelDwellTime : param->DwellTime.PassiveChannelDwellTime); FunctionIn(COMP_SCAN); - + if(param->Optional.BandChannelList_IsPresent) { u4Byte itBand = 0; u4Byte itChnl = 0; - + for(itBand = 0; itBand < param->BandChannelList.ElementCount; itBand++) { for(itChnl = 0; itChnl < param->BandChannelList.pElements[itBand].ChannelList.ElementCount; itChnl++) { u1Byte chnl = (u1Byte)param->BandChannelList.pElements[itBand].ChannelList.pElements[itChnl]; - + CustomScan_AddScanChnl(req, chnl, 1, scanType, duration, 0, NULL); } } @@ -138,7 +138,7 @@ wdi_ConstructScanReq( { RT_CHANNEL_DOMAIN domain = GetDefaultAdapter(pAdapter)->MgntInfo.ChannelPlan; RT_CHANNEL_PLAN *plan = NULL; - + RtActChannelList(pAdapter, RT_CHNL_LIST_ACTION_GET_CHANNEL_PLAN, &domain, &plan); CustomScan_AddChnlPlanChnls(req, plan, scanType, duration, 0, NULL); @@ -163,7 +163,7 @@ wdi_ConstructP2PSpecificChnlReq( { RT_SCAN_TYPE scanType = WDI_P2P_SCAN_TYPE_PASSIVE == param->DiscoverMode.ScanType ? SCAN_PASSIVE : SCAN_ACTIVE; u2Byte duration = (u2Byte)(SCAN_ACTIVE == scanType ? param->DwellTime.ActiveChannelDwellTime : param->DwellTime.PassiveChannelDwellTime); - + if(param->Optional.DiscoveryChannelSettings_IsPresent) { u4Byte itSettings = 0; @@ -171,15 +171,15 @@ wdi_ConstructP2PSpecificChnlReq( u4Byte itChnl = 0; RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("channel setting present\n")); - + for(itSettings = 0; itSettings < param->DiscoveryChannelSettings.ElementCount; itSettings++) { WDI_P2P_DISCOVERY_CHANNEL_SETTINGS_CONTAINER *setting = param->DiscoveryChannelSettings.pElements + itSettings; - + for(itBand = 0; itBand < setting->BandChannelList.ElementCount; itBand++) { WDI_BAND_CHANNEL_LIST_CONTAINER *band = setting->BandChannelList.pElements + itBand; - + for(itChnl = 0; itChnl < band->ChannelList.ElementCount; itChnl++) { WDI_CHANNEL_NUMBER *chnl = band->ChannelList.pElements + itChnl; @@ -206,7 +206,7 @@ wdi_ConstructP2PScanPhaseReq( u2Byte duration = (u2Byte)(SCAN_ACTIVE == scanType ? param->DwellTime.ActiveChannelDwellTime : param->DwellTime.PassiveChannelDwellTime); RT_CHANNEL_DOMAIN domain = GetDefaultAdapter(pAdapter)->MgntInfo.ChannelPlan; RT_CHANNEL_PLAN *plan = NULL; - + RtActChannelList(pAdapter, RT_CHNL_LIST_ACTION_GET_CHANNEL_PLAN, &domain, &plan); CustomScan_AddChnlPlanChnls(req, plan, scanType, duration, MGN_6M, NULL); @@ -254,7 +254,7 @@ wdi_Construct_FakeInvitationRsp( OCTET_STRING osWFDIE, osProbeRspPkt; FunctionIn(COMP_OID_SET); - + // MAC Header p2p_add_ActionFrameMacHdr(fbuf, info->DeviceAddress, dev->mac, info->DeviceAddress); @@ -267,11 +267,11 @@ wdi_Construct_FakeInvitationRsp( // WFD IE, from probe rsp if(dev->rxFrames[P2P_FID_PROBE_RSP] && dev->rxFrames[P2P_FID_PROBE_RSP]->frameLen) { - FillOctetString(osProbeRspPkt, - dev->rxFrames[P2P_FID_PROBE_RSP]->frame, + FillOctetString(osProbeRspPkt, + dev->rxFrames[P2P_FID_PROBE_RSP]->frame, dev->rxFrames[P2P_FID_PROBE_RSP]->frameLen ); - + osWFDIE = PacketGetElement(osProbeRspPkt, EID_Vendor, OUI_SUB_WIFI_DISPLAY, OUI_SUB_DONT_CARE); if(osWFDIE.Length > 0) @@ -284,7 +284,7 @@ wdi_Construct_FakeInvitationRsp( FrameBuf_Dump(fbuf, 0, DBG_LOUD, __FUNCTION__); FunctionOut(COMP_OID_SET); - + return TRUE; } @@ -299,13 +299,13 @@ wdi_Construct_FakePdRsp( { P2P_INFO *info = GET_P2P_INFO(pAdapter); OCTET_STRING osPdReq, osTmpIe; - + FunctionIn(COMP_OID_SET); if(dev->txFrames[P2P_FID_PD_REQ] && dev->txFrames[P2P_FID_PD_REQ]->frameLen) { - FillOctetString(osPdReq, - dev->txFrames[P2P_FID_PD_REQ]->frame, + FillOctetString(osPdReq, + dev->txFrames[P2P_FID_PD_REQ]->frame, dev->txFrames[P2P_FID_PD_REQ]->frameLen ); } @@ -314,7 +314,7 @@ wdi_Construct_FakePdRsp( RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("no corresp. pd req\n")); FillOctetString(osPdReq, NULL, 0); } - + // MAC Header p2p_add_ActionFrameMacHdr(fbuf, info->DeviceAddress, dev->mac, dev->mac); @@ -323,14 +323,14 @@ wdi_Construct_FakePdRsp( // WPS IE, getting from the original PD request if(osPdReq.Length) - { + { osTmpIe = PacketGetElement(osPdReq, EID_Vendor, OUI_SUB_SimpleConfig, OUI_SUB_DONT_CARE); if(osTmpIe.Length) { PacketMakeElement(&fbuf->os, EID_Vendor, osTmpIe); } } - + // WFD IE if(osPdReq.Length) { @@ -338,9 +338,9 @@ wdi_Construct_FakePdRsp( if(osTmpIe.Length) { PacketMakeElement(&fbuf->os, EID_Vendor, osTmpIe); - } + } } - + RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("a fake pd rsp constructed\n")); FrameBuf_Dump(fbuf, 0, DBG_LOUD, __FUNCTION__); @@ -365,7 +365,7 @@ wdi_IndicateRxP2pRspActionFrame( u1Byte *buf = NULL; ULONG buflen = 0; - + NDIS_STATUS_INDICATION *indic = NULL; WDI_MESSAGE_HEADER *wdiHdr = NULL; @@ -384,7 +384,7 @@ wdi_IndicateRxP2pRspActionFrame( } FrameBuf_Init(GEN_TEMP_BUFFER_SIZE, 0, (u1Byte *)pGenBuf->Buffer.Ptr, &fbuf); - + if(WDI_P2P_ACTION_FRAME_PROVISION_DISCOVERY_RESPONSE == ctx->rspType) ft = P2P_FID_PD_RSP; else if(WDI_P2P_ACTION_FRAME_GO_NEGOTIATION_RESPONSE == ctx->rspType) @@ -407,10 +407,10 @@ wdi_IndicateRxP2pRspActionFrame( { dev = p2p_DevList_Get(&info->devList, ctx->da, P2P_DEV_TYPE_DEV); } - + if(NULL == dev) { - RT_TRACE_F(COMP_OID_SET, DBG_WARNING, + RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("dev not found: bGo: %u, mac: %02X:%02X:%02X:%02X:%02X:%02X\n", ctx->bGo, ctx->da[0], ctx->da[1], ctx->da[2], ctx->da[3], ctx->da[4], ctx->da[5] )); @@ -459,9 +459,9 @@ wdi_IndicateRxP2pRspActionFrame( // gen TLV if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationP2pActionFrameReceived( - ¶m, - sizeof(*indic) + sizeof(*wdiHdr), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(*indic) + sizeof(*wdiHdr), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) { RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("gen tlv failed\n")); @@ -471,7 +471,7 @@ wdi_IndicateRxP2pRspActionFrame( // fill ptrs indic = (NDIS_STATUS_INDICATION *)buf; wdiHdr = (WDI_MESSAGE_HEADER *)(buf + sizeof(*indic)); - + // indication data PlatformZeroMemory(indic, sizeof(*indic)); indic->Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION; @@ -492,7 +492,7 @@ wdi_IndicateRxP2pRspActionFrame( // indicate NdisMIndicateStatusEx(pAdapter->pNdisCommon->hNdisAdapter, indic); - + // cleanup FreeGenerated((UINT8 *)buf); @@ -504,7 +504,7 @@ wdi_IndicateRxP2pRspActionFrame( } p2p_DevList_Unlock(&info->devList); - + FunctionOut(COMP_OID_SET); return; @@ -534,12 +534,12 @@ wdi_SendP2pActionFrameStateCb( } if(OFF_CHNL_TX_STATE_COMPLETE == state) - { + { RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("complete\n")); bHandled = TRUE; break; } - + if(OFF_CHNL_TX_STATE_FRAME_SENT == state) { RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("frame sent\n")); @@ -563,11 +563,11 @@ wdi_SendP2pReqActionFrameStateCb( ADAPTER *pAdapter = ctx->pAdapter; wdi_SendP2pActionFrameStateCb(req, state, pCtx); - + if(OFF_CHNL_TX_STATE_COMPLETE == state) { P2P_INFO *info = GET_P2P_INFO(pAdapter); - + WDI_CMD_P2pSendRequestActionFrameComplete(pAdapter, ctx); RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("restore StateBeforeScan to initialized\n")); @@ -581,7 +581,7 @@ wdi_SendP2pReqActionFrameStateCb( ) { wdi_IndicateRxP2pRspActionFrame(pAdapter, ctx); - } + } } else if(OFF_CHNL_TX_STATE_RETRY == state) { @@ -592,17 +592,17 @@ wdi_SendP2pReqActionFrameStateCb( if(pAdapter->bInHctTest) { - // Not to skip probing under HCT test, because it wastes time + // Not to skip probing under HCT test, because it wastes time // sending action frame to peer on its Listen Channel when peer // is not doing extended listen bSkip = FALSE; } - + if(bSkip) { WDI_SendAction_SkipProbeTemporarilly(req); } - + RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("retry with token: %u, reqType: %u, skip probe: %u\n", newToken, ctx->reqType, bSkip)); bSkip = !bSkip; @@ -626,13 +626,13 @@ wdi_SendP2pRspActionFrameStateCb( RT_TRACE_F(COMP_P2P, DBG_LOUD, ("state = %d\n", state)); wdi_SendP2pActionFrameStateCb(req, state, pCtx); - + if(OFF_CHNL_TX_STATE_COMPLETE == state) { WDI_CMD_P2pSendResponseActionFrameComplete(pAdapter, ctx); - // restore Dialog Token in P2PInfo since we are sending - // response action frame, self dialog token shall not be + // restore Dialog Token in P2PInfo since we are sending + // response action frame, self dialog token shall not be // modified RT_TRACE_F(COMP_P2P, DBG_LOUD, ("restore token from %u to %u\n", info->DialogToken, ctx->oldToken)); info->DialogToken = ctx->oldToken; @@ -643,7 +643,7 @@ wdi_SendP2pRspActionFrameStateCb( if(WDI_P2P_ACTION_FRAME_GO_NEGOTIATION_CONFIRM == ctx->rspType) { wdi_IndicateRxP2pRspActionFrame(pAdapter, ctx); - } + } } else if(OFF_CHNL_TX_STATE_RETRY == state) { @@ -664,7 +664,7 @@ wdi_SendActionFrameStateCb( BOOLEAN bHandled = FALSE; N63C_SEND_ACTION_CTX *ctx = (N63C_SEND_ACTION_CTX *)pCtx; ADAPTER *pAdapter = ctx->pAdapter; - + RT_TRACE(COMP_OID_SET, DBG_TRACE, ("wdi_SendActionFrameStateCb (0x%x)\n", state)); do @@ -677,12 +677,12 @@ wdi_SendActionFrameStateCb( } if(OFF_CHNL_TX_STATE_COMPLETE == state) - { + { RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("complete\n")); bHandled = TRUE; break; } - + if(OFF_CHNL_TX_STATE_FRAME_SENT == state) { RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("frame sent\n")); @@ -700,7 +700,7 @@ wdi_SendActionFrameStateCb( { WDI_SendAction_SkipProbeTemporarilly(req); } - + RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("retry with token: %u, reqType: %u, skip probe: %u\n", newToken, ctx->reqType, bSkip)); bSkip = !bSkip; @@ -728,7 +728,7 @@ wdi_SendReqActionFrameStateCb( RT_TRACE(COMP_OID_SET, DBG_TRACE, ("wdi_SendReqActionFrameStateCb (0x%x)\n", state)); wdi_SendActionFrameStateCb(req, state, pCtx); - + if(OFF_CHNL_TX_STATE_COMPLETE == state) { WDI_CMD_SendReqActionFrameComplete(pAdapter, ctx); @@ -750,11 +750,11 @@ wdi_SendRspActionFrameStateCb( { WDI_SEND_ACTION_CTX *ctx = (WDI_SEND_ACTION_CTX *)pCtx; ADAPTER *pAdapter = ctx->pAdapter; - + RT_TRACE(COMP_OID_SET, DBG_TRACE, ("wdi_SendRspActionFrameStateCb (0x%x)\n", state)); wdi_SendActionFrameStateCb(req, state, pCtx); - + if(OFF_CHNL_TX_STATE_COMPLETE == state) { WDI_CMD_SendRspActionFrameComplete(pAdapter, ctx); @@ -780,8 +780,8 @@ Wdi_Task_Scan( BOOLEAN bScanByRoam = FALSE; PMGNT_INFO pMgntInfo =&(pAdapter->MgntInfo); - RT_TRACE(COMP_OID_SET, DBG_LOUD, - ("==> Wdi_Task_Scan(): Input InformationBuffer (%d)\n", + RT_TRACE(COMP_OID_SET, DBG_LOUD, + ("==> Wdi_Task_Scan(): Input InformationBuffer (%d)\n", pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength)); ScanRequest.dot11BSSType = dot11_BSS_type_infrastructure; @@ -793,21 +793,21 @@ Wdi_Task_Scan( CopyMem(ScanRequest.dot11BSSID, param->BSSID.Address, ETHERNET_ADDRESS_LENGTH); RT_PRINT_ADDR(COMP_SCAN, DBG_LOUD, ("ScanRequest \n"), ScanRequest.dot11BSSID); - RT_TRACE(COMP_OID_SET, DBG_LOUD, ("WIFI_TLV_SSID\n")); + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("WIFI_TLV_SSID\n")); MgntClearSsidsToScan(pAdapter); - + for(itSsidl = 0; itSsidl < param->SSIDList.ElementCount; itSsidl++) { WdiSsid = param->SSIDList.pElements[itSsidl]; - + RT_PRINT_STR(COMP_MLME, DBG_LOUD, "===> Wdi_Task_Scan(): ", WdiSsid.pElements, WdiSsid.ElementCount); - + Ssid.Octet = WdiSsid.pElements; - Ssid.Length = (u2Byte)WdiSsid.ElementCount; - + Ssid.Length = (u2Byte)WdiSsid.ElementCount; + RT_PRINT_STR(COMP_MLME, DBG_LOUD, "===> Wdi_Task_Scan(): SSid ", Ssid.Octet, Ssid.Length); - + MgntAddSsidsToScan(pAdapter, Ssid); } RT_TRACE(COMP_OID_SET, DBG_LOUD, ("Scan Type\n")); @@ -827,11 +827,11 @@ Wdi_Task_Scan( if(param->Optional.VendorIEs_IsPresent) { RT_TRACE(COMP_OID_SET, DBG_LOUD, ("WIFI_TLV_VENDORIE\n")); - - MgntActSet_AdditionalProbeReqIE(pAdapter, + + MgntActSet_AdditionalProbeReqIE(pAdapter, (u1Byte *)param->VendorIEs.pElements, (u4Byte)param->VendorIEs.ElementCount); - } + } // Sinda, 20150512 // Skip all scan triggered by Roam. @@ -857,7 +857,7 @@ Wdi_Task_Scan( { if(param->Optional.VendorIEs_IsPresent) { - MgntActSet_AdditionalProbeReqIE(pAdapter, + MgntActSet_AdditionalProbeReqIE(pAdapter, (u1Byte *)param->VendorIEs.pElements, (u4Byte)param->VendorIEs.ElementCount); } @@ -865,11 +865,11 @@ Wdi_Task_Scan( if(NULL != (req = CustomScan_AllocReq(GET_CUSTOM_SCAN_INFO(pAdapter), NULL, NULL))) { wdi_ConstructScanReq(pAdapter, param, req); - + CustomScan_SetTimeBound(req, param->DwellTime.MaximumScanTime); CustomScan_SetupCbCtx(req, wdi_ScanCb, pAdapter); CustomScan_SetRepeatCount(req, param->ScanModeParameters.ScanRepeatCount); - + CustomScan_IssueReq(GET_CUSTOM_SCAN_INFO(pAdapter), req, CUSTOM_SCAN_SRC_TYPE_SYS, "sys"); } } @@ -878,7 +878,7 @@ Wdi_Task_Scan( WDI_IndicateScanComplete(pAdapter, RT_STATUS_FAILURE); } } - + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("<== Wdi_Task_Scan()\n")); return status; } @@ -897,15 +897,15 @@ Wdi_Task_Connect( WDI_TASK_CONNECT_PARAMETERS *Params = pOidHandle->tlvParser.parsedTlv.paramConnect; PWDI_CONNECT_BSS_ENTRY_CONTAINER connectBssEntry = NULL; PMGNT_INFO pMgntInfo=&pAdapter->MgntInfo; - - PWDI_MESSAGE_HEADER pWdiHeader + + PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER)pOidHandle->pInputBuffer; - //Save PMKID + //Save PMKID u4Byte ulIndex, i, j; BOOLEAN blInserted; u1Byte bssidcount=0; - int NumPreferredBSSID = Params->PreferredBSSEntryList.ElementCount; + int NumPreferredBSSID = Params->PreferredBSSEntryList.ElementCount; RT_TRACE(COMP_MLME, DBG_LOUD, ("==> Wdi_Task_Connect()\n")); @@ -918,26 +918,26 @@ Wdi_Task_Connect( N6_ASSIGN_OBJECT_HEADER( SsidList.Header, - NDIS_OBJECT_TYPE_DEFAULT, - DOT11_SSID_LIST_REVISION_1, + NDIS_OBJECT_TYPE_DEFAULT, + DOT11_SSID_LIST_REVISION_1, sizeof(DOT11_SSID_LIST) ); - // Clear all entries + // Clear all entries for( ulIndex=0; ulIndexPMKIDList[ulIndex].bUsed = FALSE; } pSecInfo->PMKIDCount = 0; - - FtResetEntryList(pAdapter); + + FtResetEntryList(pAdapter); // TODO: Choose corresponding adapter before assigning parameters for(bssidcount=0;bssidcountPreferredBSSEntryList.pElements[bssidcount]; if( connectBssEntry->Optional.PMKID_IsPresent == TRUE ) - { + { // 2. Insert or cover with new PMKID. blInserted = FALSE; for(j=0 ; jOptional.FTInitialAssocParameters_IsPresent) { FtUpdateEntryInfo(pAdapter, FT_ENTRY_ACTION_UPDATE_MDE, connectBssEntry->BSSID.Address, @@ -986,12 +986,12 @@ Wdi_Task_Connect( connectBssEntry->FTReAssocParameters.MDE.pElements, connectBssEntry->FTReAssocParameters.MDE.ElementCount); RT_PRINT_DATA(COMP_MLME, DBG_LOUD, "FTReAssocParameters MDE:\n", connectBssEntry->FTReAssocParameters.MDE.pElements, connectBssEntry->FTReAssocParameters.MDE.ElementCount); - + FtUpdateEntryInfo(pAdapter, FT_ENTRY_ACTION_UPDATE_FTE, connectBssEntry->BSSID.Address, connectBssEntry->FTReAssocParameters.FTE.pElements, connectBssEntry->FTReAssocParameters.FTE.ElementCount); RT_PRINT_DATA(COMP_MLME, DBG_LOUD, "FTReAssocParameters FTE:\n", connectBssEntry->FTReAssocParameters.FTE.pElements, connectBssEntry->FTReAssocParameters.FTE.ElementCount); - + FtUpdateEntryInfo(pAdapter, FT_ENTRY_ACTION_UPDATE_PMKR0_NAME, connectBssEntry->BSSID.Address, connectBssEntry->FTReAssocParameters.PMKR0Name.pmkname.Name, sizeof(WDI_TYPE_PMK_NAME)); RT_PRINT_DATA(COMP_MLME, DBG_LOUD, "FTReAssocParameters PMKR0:\n", @@ -1019,14 +1019,14 @@ Wdi_Task_Connect( // TODO: HiddenNetwork / MFPEnabled / HostFIPSModeEnabled pMgntInfo->bRoamRequest = Params->ConnectParameters.ConnectionSettings.RoamRequest; RT_TRACE( COMP_MLME, DBG_LOUD, ("bRoamRequest %d\n", pMgntInfo->bRoamRequest) ); - + pMgntInfo->SafeModeEnabled = Params->ConnectParameters.ConnectionSettings.HostFIPSModeEnabled; - + if(pMgntInfo->SafeModeEnabled && !pMgntInfo->pHTInfo->bEnableHT) - pMgntInfo->pStaQos->QosCapability = QOS_DISABLE; + pMgntInfo->pStaQos->QosCapability = QOS_DISABLE; else - pMgntInfo->pStaQos->QosCapability = pMgntInfo->pStaQos->QosCapabilityBackup; - + pMgntInfo->pStaQos->QosCapability = pMgntInfo->pStaQos->QosCapabilityBackup; + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("Wdi_task_connect(): bExcludeUnencrypted %d HostFIPSModeEnabled %d QosCapability 0x%x QosCapabilityBackup 0x%x enableHT %d\n", pMgntInfo->bExcludeUnencrypted, pMgntInfo->SafeModeEnabled, pMgntInfo->pStaQos->QosCapability, pMgntInfo->pStaQos->QosCapabilityBackup, pMgntInfo->pHTInfo->bEnableHT)); //3 DesiredSSIDList @@ -1040,9 +1040,9 @@ Wdi_Task_Connect( RT_PRINT_STR(COMP_MLME, DBG_LOUD, ("Desired SSID \n"), SsidList.SSIDs[i].ucSSID, SsidList.SSIDs[i].uSSIDLength); } pNdisCommon->dot11DesiredSSIDList = SsidList; - + //3 Authentication Algorithm - N6CSet_DOT11_AUTHENTICATION_ALOGORITHM(pAdapter, Params->ConnectParameters.AuthenticationAlgorithms.pElements[0]); + N6CSet_DOT11_AUTHENTICATION_ALOGORITHM(pAdapter, Params->ConnectParameters.AuthenticationAlgorithms.pElements[0]); RT_TRACE_F(COMP_SEC, DBG_LOUD, ("AuthenticationAlgorithms count = %d\n", Params->ConnectParameters.AuthenticationAlgorithms.ElementCount)); //3 Unicast Cipher Algorithm @@ -1052,20 +1052,20 @@ Wdi_Task_Connect( //3 Multicast Cipher Algorithm N6CSet_DOT11_MULTICAST_CIPHER_ALGORITHM(pAdapter, Params->ConnectParameters.MulticastCipherAlgorithms.pElements[0]); RT_TRACE_F(COMP_SEC, DBG_LOUD, ("MulticastCipherAlgorithms count = %d\n", Params->ConnectParameters.MulticastCipherAlgorithms.ElementCount)); - - + + //3 Additional Association Request IEs if(Params->ConnectParameters.Optional.AssociationRequestVendorIE_IsPresent) { if(Params->ConnectParameters.AssociationRequestVendorIE.ElementCount > 0) { RT_TRACE(COMP_MLME, DBG_LOUD, ("Wdi_Task_Connect(): set association request additional IE\n")); - MgntActSet_AdditionalAssocReqIE(pAdapter, - Params->ConnectParameters.AssociationRequestVendorIE.pElements, + MgntActSet_AdditionalAssocReqIE(pAdapter, + Params->ConnectParameters.AssociationRequestVendorIE.pElements, Params->ConnectParameters.AssociationRequestVendorIE.ElementCount ); - - RT_PRINT_DATA(COMP_MLME, DBG_TRACE, ("Wdi_Task_Connect(): AssociationRequestVendorIE\n"), + + RT_PRINT_DATA(COMP_MLME, DBG_TRACE, ("Wdi_Task_Connect(): AssociationRequestVendorIE\n"), Params->ConnectParameters.AssociationRequestVendorIE.pElements, Params->ConnectParameters.AssociationRequestVendorIE.ElementCount); } @@ -1084,11 +1084,11 @@ Wdi_Task_Connect( { RT_TRACE(COMP_MLME, DBG_LOUD, ("Wdi_Task_Connect(): set disallowed BSSIDs\n")); MgntActSet_ExcludedMacAddressList( - pAdapter, - (pu1Byte)Params->ConnectParameters.DisallowedBSSIDs.pElements, + pAdapter, + (pu1Byte)Params->ConnectParameters.DisallowedBSSIDs.pElements, Params->ConnectParameters.DisallowedBSSIDs.ElementCount ); - + for(; i < Params->ConnectParameters.DisallowedBSSIDs.ElementCount; i++) { RT_PRINT_ADDR(COMP_MLME, DBG_TRACE, ("Wdi_Task_Connect(): disallowed BSSID:"), @@ -1120,7 +1120,7 @@ Wdi_Task_Connect( PTLV_WDI_STRUCT pTlvData = NULL; ULONG BytesProcessed = 0; ULONG Prefix = sizeof(WDI_MESSAGE_HEADER); - + pTlvData = (PTLV_WDI_STRUCT)((pu1Byte)pOidHandle->pInputBuffer + sizeof(WDI_MESSAGE_HEADER)); // WDI_CONNECT_BSS_ENTRY @@ -1130,20 +1130,20 @@ Wdi_Task_Connect( DOT11_SSID_LIST SsidList; u1Byte NumSsid = 0; PRT_SECURITY_T pSecInfo = &(pAdapter->MgntInfo.SecurityInfo); - + InputBufferLength = pTlvData->Length; N6_ASSIGN_OBJECT_HEADER( SsidList.Header, - NDIS_OBJECT_TYPE_DEFAULT, - DOT11_SSID_LIST_REVISION_1, + NDIS_OBJECT_TYPE_DEFAULT, + DOT11_SSID_LIST_REVISION_1, sizeof(DOT11_SSID_LIST) ); SsidList.uNumOfEntries = NumSsid; pTlvData = (PTLV_WDI_STRUCT)((pu1Byte)pTlvData->Value); - + while(BytesProcessed < InputBufferLength) { // Parse Type @@ -1154,7 +1154,7 @@ Wdi_Task_Connect( RT_TRACE(COMP_MLME, DBG_LOUD, ("unknown TLV 0x%x\n", pTlvData->Type)); } break; - + case WDI_TLV_CONNECTION_SETTINGS: { u1Byte RoamRequest = 0; @@ -1168,7 +1168,7 @@ Wdi_Task_Connect( ExcludeUnencrypted = *(pu1Byte)(pTlvData->Value + 2); MFPEnabled = *(pu1Byte)(pTlvData->Value + 3); HostFIPSModeEnabled = *(pu1Byte)(pTlvData->Value + 4); - + RT_TRACE(COMP_MLME, DBG_LOUD, ("WDI_TLV_CONNECTION_SETTINGS\n")); RT_TRACE(COMP_MLME, DBG_LOUD, ("RoamRequest = %d, HiddenNetwork = %d, ExcludeUnencrypted = %d, MFPEnabled = %d, HostFIPSModeEnabled = %d\n", RoamRequest, HiddenNetwork, ExcludeUnencrypted, MFPEnabled, HostFIPSModeEnabled)); @@ -1208,7 +1208,7 @@ Wdi_Task_Connect( case WDI_TLV_MULTICAST_CIPHER_ALGO_LIST: { u4Byte AlgorithmId = (*((pu4Byte)(pTlvData->Value))); - + RT_TRACE(COMP_MLME, DBG_LOUD, ("WDI_TLV_MULTICAST_CIPHER_ALGO_LIST\n")); switch( AlgorithmId ) @@ -1222,7 +1222,7 @@ Wdi_Task_Connect( pSecInfo->GroupEncAlgorithm = RT_ENC_ALG_WEP40; RT_TRACE( COMP_SEC, DBG_LOUD, ("Wdi_Task_Connect(): DOT11_CIPHER_ALGO_WEP\n") ); break; - + case WDI_CIPHER_ALGO_WEP40: pSecInfo->GroupEncAlgorithm = RT_ENC_ALG_WEP40; RT_TRACE( COMP_SEC, DBG_LOUD, ("Wdi_Task_Connect(): DOT11_CIPHER_ALGO_WEP40\n") ); @@ -1239,8 +1239,8 @@ Wdi_Task_Connect( break; case DOT11_CIPHER_ALGO_WAPI_SMS4: //For WAPI IHV service support add by ylb 20111114 - pSecInfo->GroupEncAlgorithm = RT_ENC_ALG_SMS4; - RT_TRACE( COMP_SEC, DBG_LOUD, ("Wdi_Task_Connect(): DOT11_CIPHER_ALGO_WAPI_SMS4\n") ); + pSecInfo->GroupEncAlgorithm = RT_ENC_ALG_SMS4; + RT_TRACE( COMP_SEC, DBG_LOUD, ("Wdi_Task_Connect(): DOT11_CIPHER_ALGO_WAPI_SMS4\n") ); break; case WDI_CIPHER_ALGO_WEP104: pSecInfo->GroupEncAlgorithm = RT_ENC_ALG_WEP104; @@ -1263,7 +1263,7 @@ Wdi_Task_Connect( case WDI_TLV_UNICAST_CIPHER_ALGO_LIST: { u4Byte AlgorithmId = (*((pu4Byte)(pTlvData->Value))); - + RT_TRACE(COMP_MLME, DBG_LOUD, ("WDI_TLV_UNICAST_CIPHER_ALGO_LIST\n")); N6CSet_DOT11_UNICAST_CIPHER_ALGORITHM(pAdapter, (DOT11_CIPHER_ALGORITHM)AlgorithmId); @@ -1293,7 +1293,7 @@ Wdi_Task_Connect( RT_TRACE(COMP_MLME, DBG_LOUD, ("WDI_TLV_ALLOWED_BSSIDS_LIST\n")); } break; - + } // Parse Length @@ -1302,7 +1302,7 @@ Wdi_Task_Connect( // Parse Content BytesProcessed += (4 + pTlvData->Length); - + pTlvData = (PTLV_WDI_STRUCT)((pu1Byte)pOidHandle->pInputBuffer + Prefix + 4 + BytesProcessed); } @@ -1322,12 +1322,12 @@ Wdi_Task_Connect( { pMgntInfo->Ssid.Octet = pNdisCommon->dot11DesiredSSIDList.SSIDs[0].ucSSID; pMgntInfo->Ssid.Length = (u2Byte)pNdisCommon->dot11DesiredSSIDList.SSIDs[0].uSSIDLength; - + pMgntInfo->bDisconnectRequest = FALSE; RT_TRACE(COMP_MLME, DBG_LOUD, ("This is roam request, go to roam flow\n")); MgntLinkStatusSetRoamingState(pAdapter, 0, RT_ROAMING_BY_DEAUTH, ROAMINGSTATE_SCANNING); DrvIFIndicateRoamingStart(pAdapter); - + if( MgntRoamRetry(pAdapter, FALSE) == FALSE ) ndisStatus = NDIS_STATUS_FAILURE; else @@ -1349,7 +1349,7 @@ Wdi_Task_Disconnect( WDI_TASK_DISCONNECT_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramDisconnect; NDIS_OID_REQUEST *req = NULL; - + FunctionIn(COMP_OID_SET); do @@ -1358,7 +1358,7 @@ Wdi_Task_Disconnect( { RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("N6CSet_DOT11_DISCONNECT_REQUEST returns: 0x%08X\n", status)); break; - } + } }while(FALSE); // M4 indication is not required since bWaitComplete in RT_SUPPORT_TASKs is FALSE @@ -1389,12 +1389,12 @@ Wdi_Task_CreatePort( NDIS_OID_REQUEST *req = NULL; WDI_TASK_CREATE_PORT_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramCreatePort; - + FunctionIn(COMP_OID_SET); do { - RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("NdisPortNumber:%d OpModeMask: 0x%08X\n", + RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("NdisPortNumber:%d OpModeMask: 0x%08X\n", param->CreatePortParameters.NdisPortNumber, param->CreatePortParameters.OpModeMask)); @@ -1412,19 +1412,19 @@ Wdi_Task_CreatePort( ) // TODO: OpModeMask is a bitmap with combination of possible op modes { status = N62C_OID_DOT11_CREATE_MAC(pAdapter, req); - + if(NDIS_STATUS_SUCCESS != status && NDIS_STATUS_PENDING != status) { RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("N62C_OID_DOT11_CREATE_MAC returns error: 0x%08X\n", status)); Wdi_Xlat_FreeOid(req); } - + break; } else {// cases which we don't need to create mac DOT11_MAC_INFO *macInfo = req->DATA.METHOD_INFORMATION.InformationBuffer; - + status = NDIS_STATUS_SUCCESS; macInfo->uNdisPortNumber = 0; @@ -1436,7 +1436,7 @@ Wdi_Task_CreatePort( } }while(FALSE); - + FunctionOut(COMP_OID_SET); return status; } @@ -1452,9 +1452,9 @@ Wdi_Task_DeletePort( NDIS_OID_REQUEST *req = NULL; PADAPTER pTargetAdapter = NULL; WDI_TASK_DELETE_PORT_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramDeletePort; - + FunctionIn(COMP_OID_SET); - + do { if(NULL == (req = Wdi_Xlat_AllocDeleteMacOid(pOidHandle, param))) @@ -1462,36 +1462,36 @@ Wdi_Task_DeletePort( status = NDIS_STATUS_RESOURCES; break; } - + // delete mac if(0 != param->DeletePortParameters.PortNumber) { //Delete group peer. WDI_DeleteGroupPeer(pAdapter, param->DeletePortParameters.PortNumber); - + status = N62C_OID_DOT11_DELETE_MAC(pAdapter, req); - + if(NDIS_STATUS_SUCCESS != status && NDIS_STATUS_PENDING != status) { RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("N62C_OID_DOT11_DELETE_MAC returns error: 0x%08X\n", status)); Wdi_Xlat_FreeOid(req); } - + break; } else {// cases which we don't need to delete mac status = NDIS_STATUS_SUCCESS; - + //Delete group peer. WDI_DeleteGroupPeer(pAdapter, param->DeletePortParameters.PortNumber); - + WDI_CMD_DeletePortComplete(pAdapter, req, status); break; } - + }while(FALSE); - + FunctionOut(COMP_OID_SET); return status; } @@ -1513,16 +1513,16 @@ Wdi_Task_SetApCipherKeyMappingKey( if(!pEntry) return NDIS_STATUS_INVALID_DATA; - + CopyMem(pEntry->perSTAKeyInfo.PTK, pKeyMaterial, keyLen); // Added by Annie, 2005-07-12. - + if(WDI_CIPHER_ALGO_TKIP == cipherAlgo) { pEntry->perSTAKeyInfo.TempEncKey = pEntry->perSTAKeyInfo.PTK+TKIP_ENC_KEY_POS; - pEntry->perSTAKeyInfo.TxMICKey = pEntry->perSTAKeyInfo.PTK+(TKIP_MIC_KEY_POS); + pEntry->perSTAKeyInfo.TxMICKey = pEntry->perSTAKeyInfo.PTK+(TKIP_MIC_KEY_POS); pEntry->perSTAKeyInfo.RxMICKey = pEntry->perSTAKeyInfo.PTK+(TKIP_MIC_KEY_POS+TKIP_MIC_KEY_LEN); - //Add for AP mode HW enc,by CCW + //Add for AP mode HW enc,by CCW ucIndex = AP_FindFreeEntry(pAdapter , pEntry->MacAddr); if(ucIndex == TOTAL_CAM_ENTRY) { @@ -1531,12 +1531,12 @@ Wdi_Task_SetApCipherKeyMappingKey( } //set key - AP_Setkey(pAdapter , + AP_Setkey(pAdapter , pEntry->perSTAKeyInfo.pWLanSTA->MacAddr, - ucIndex, // Entey index + ucIndex, // Entey index CAM_TKIP, - 0, // Parise key - pEntry->perSTAKeyInfo.TempEncKey); + 0, // Parise key + pEntry->perSTAKeyInfo.TempEncKey); pEntry->keyindex = ucIndex; } @@ -1544,28 +1544,28 @@ Wdi_Task_SetApCipherKeyMappingKey( { // AES mode AP-WPA AES,CCW AESCCMP_BLOCK blockKey; AUTH_PKEY_MGNT_TAG *pKeyMgnt = &pEntry->perSTAKeyInfo; - + RT_TRACE(COMP_SEC, DBG_LOUD, ("===>CCMP Set Station Key.\n")); RT_PRINT_ADDR(COMP_SEC, DBG_LOUD, "===> Peer Address : ", addr); - - //Add for AP mode HW enc,by CCW + + //Add for AP mode HW enc,by CCW ucIndex = AP_FindFreeEntry(pAdapter, pEntry->MacAddr); if(ucIndex == TOTAL_CAM_ENTRY) { RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("[Warning]: Cam Entry is FULL!!!\n")); return NDIS_STATUS_INVALID_DATA; } - - //Set Key + + //Set Key PlatformMoveMemory(blockKey.x , pEntry->perSTAKeyInfo.PTK, 16); AES_SetKey(blockKey.x, AESCCMP_BLK_SIZE * 8, (u4Byte *)pEntry->perSTAKeyInfo.AESKeyBuf); //set hw key - AP_Setkey(pAdapter , + AP_Setkey(pAdapter , pEntry->perSTAKeyInfo.pWLanSTA->MacAddr, - ucIndex, // Entey index + ucIndex, // Entey index CAM_AES, - 0, // Parise key - pEntry->perSTAKeyInfo.PTK); + 0, // Parise key + pEntry->perSTAKeyInfo.PTK); pEntry->keyindex = ucIndex; } @@ -1599,7 +1599,7 @@ Wdi_Task_SetApCipherDefaultKey( else if(WDI_CIPHER_ALGO_CCMP == cipherAlgo) { AESCCMP_BLOCK blockKey; - + PlatformMoveMemory(blockKey.x, pGlInfo->GTK, 16); pMgntInfo->SecurityInfo.GroupTransmitKeyIdx = (u1Byte)keyId; AES_SetKey(blockKey.x, AESCCMP_BLK_SIZE * 8, (u4Byte *)pGlInfo->AESGTK); @@ -1618,7 +1618,7 @@ Wdi_Task_Set_Radio_State( PRT_NDIS6_COMMON pNdisCommon = pAdapter->pNdisCommon; ULONG InputBufferLength = pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength; WDI_SET_RADIO_STATE_PARAMETERS *Params = pOidHandle->tlvParser.parsedTlv.paramSetRadioState; - + RT_TRACE(COMP_MLME, DBG_LOUD, ("==> Wdi_Task_Set_Radio_State()\n")); if( Params->SoftwareRadioState == TRUE ) @@ -1657,8 +1657,8 @@ Wdi_Task_Roam( u4Byte ulIndex, i, j; BOOLEAN blInserted; u1Byte bssidcount=0; - int NumPreferredBSSID = Params->PreferredBSSEntryList.ElementCount; - + int NumPreferredBSSID = Params->PreferredBSSEntryList.ElementCount; + RT_TRACE(COMP_MLME, DBG_LOUD, ("==> Wdi_Task_Roam()\n")); @@ -1671,28 +1671,28 @@ Wdi_Task_Roam( N6_ASSIGN_OBJECT_HEADER( SsidList.Header, - NDIS_OBJECT_TYPE_DEFAULT, - DOT11_SSID_LIST_REVISION_1, + NDIS_OBJECT_TYPE_DEFAULT, + DOT11_SSID_LIST_REVISION_1, sizeof(DOT11_SSID_LIST) ); // TODO: Choose corresponding adapter before assigning parameters - - // Clear all entries + + // Clear all entries for( ulIndex=0; ulIndexPMKIDList[ulIndex].bUsed = FALSE; } pSecInfo->PMKIDCount = 0; - - FtResetEntryList(pAdapter); + + FtResetEntryList(pAdapter); // TODO: Choose corresponding adapter before assigning parameters for(bssidcount=0;bssidcountPreferredBSSEntryList.pElements[bssidcount]; if( connectBssEntry->Optional.PMKID_IsPresent == TRUE ) - { + { // 2. Insert or cover with new PMKID. blInserted = FALSE; for(j=0 ; jOptional.FTInitialAssocParameters_IsPresent) { FtUpdateEntryInfo(pAdapter, FT_ENTRY_ACTION_UPDATE_MDE, connectBssEntry->BSSID.Address, @@ -1741,12 +1741,12 @@ Wdi_Task_Roam( connectBssEntry->FTReAssocParameters.MDE.pElements, connectBssEntry->FTReAssocParameters.MDE.ElementCount); RT_PRINT_DATA(COMP_MLME, DBG_LOUD, "FTReAssocParameters MDE:\n", connectBssEntry->FTReAssocParameters.MDE.pElements, connectBssEntry->FTReAssocParameters.MDE.ElementCount); - + FtUpdateEntryInfo(pAdapter, FT_ENTRY_ACTION_UPDATE_FTE, connectBssEntry->BSSID.Address, connectBssEntry->FTReAssocParameters.FTE.pElements, connectBssEntry->FTReAssocParameters.FTE.ElementCount); RT_PRINT_DATA(COMP_MLME, DBG_LOUD, "FTReAssocParameters FTE:\n", connectBssEntry->FTReAssocParameters.FTE.pElements, connectBssEntry->FTReAssocParameters.FTE.ElementCount); - + FtUpdateEntryInfo(pAdapter, FT_ENTRY_ACTION_UPDATE_PMKR0_NAME, connectBssEntry->BSSID.Address, connectBssEntry->FTReAssocParameters.PMKR0Name.pmkname.Name, sizeof(WDI_TYPE_PMK_NAME)); RT_PRINT_DATA(COMP_MLME, DBG_LOUD, "FTReAssocParameters PMKR0:\n", @@ -1768,26 +1768,26 @@ Wdi_Task_Roam( RT_PRINT_DATA( COMP_MLME, DBG_LOUD, "PMKID: ", pSecInfo->PMKIDList[ulIndex].PMKID, connectBssEntry->PMKID.ElementCount); } } - + pAdapter->MgntInfo.bExcludeUnencrypted = Params->ConnectParameters.ConnectionSettings.ExcludeUnencrypted; // TODO: HiddenNetwork / MFPEnabled / HostFIPSModeEnabled pMgntInfo->SafeModeEnabled = Params->ConnectParameters.ConnectionSettings.HostFIPSModeEnabled; - + if(pMgntInfo->SafeModeEnabled && !pMgntInfo->pHTInfo->bEnableHT) - pMgntInfo->pStaQos->QosCapability = QOS_DISABLE; + pMgntInfo->pStaQos->QosCapability = QOS_DISABLE; else - pMgntInfo->pStaQos->QosCapability = pMgntInfo->pStaQos->QosCapabilityBackup; - + pMgntInfo->pStaQos->QosCapability = pMgntInfo->pStaQos->QosCapabilityBackup; + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("Wdi_task_roam(): bExcludeUnencrypted %d HostFIPSModeEnabled %d QosCapability 0x%x\n", pMgntInfo->bExcludeUnencrypted, pMgntInfo->SafeModeEnabled, pMgntInfo->pStaQos->QosCapability)); - + //3 RoamNeededReason if( Params->ConnectParameters.ConnectionSettings.RoamRequest == TRUE ) { AssocStatus = Params->ConnectParameters.ConnectionSettings.RoamNeededReason; RT_TRACE_F(COMP_MLME, DBG_LOUD, ("RoamNeededReason %d\n", AssocStatus)); } - + //3 DesiredSSIDList SsidList.uNumOfEntries = Params->ConnectParameters.SSIDList.ElementCount; @@ -1809,19 +1809,19 @@ Wdi_Task_Roam( //3 Multicast Cipher Algorithm N6CSet_DOT11_MULTICAST_CIPHER_ALGORITHM(pAdapter, Params->ConnectParameters.MulticastCipherAlgorithms.pElements[0]); - + //3 Additional Association Request IEs if(Params->ConnectParameters.Optional.AssociationRequestVendorIE_IsPresent) { if(Params->ConnectParameters.AssociationRequestVendorIE.ElementCount > 0) { RT_TRACE(COMP_MLME, DBG_LOUD, ("Wdi_Task_Roam(): set association request additional IE\n")); - MgntActSet_AdditionalAssocReqIE(pAdapter, - Params->ConnectParameters.AssociationRequestVendorIE.pElements, + MgntActSet_AdditionalAssocReqIE(pAdapter, + Params->ConnectParameters.AssociationRequestVendorIE.pElements, Params->ConnectParameters.AssociationRequestVendorIE.ElementCount ); - - RT_PRINT_DATA(COMP_MLME, DBG_TRACE, ("Wdi_Task_Roam(): AssociationRequestVendorIE\n"), + + RT_PRINT_DATA(COMP_MLME, DBG_TRACE, ("Wdi_Task_Roam(): AssociationRequestVendorIE\n"), Params->ConnectParameters.AssociationRequestVendorIE.pElements, Params->ConnectParameters.AssociationRequestVendorIE.ElementCount); } @@ -1840,11 +1840,11 @@ Wdi_Task_Roam( { RT_TRACE(COMP_MLME, DBG_LOUD, ("Wdi_Task_Roam(): set disallowed BSSIDs\n")); MgntActSet_ExcludedMacAddressList( - pAdapter, - (pu1Byte)Params->ConnectParameters.DisallowedBSSIDs.pElements, + pAdapter, + (pu1Byte)Params->ConnectParameters.DisallowedBSSIDs.pElements, Params->ConnectParameters.DisallowedBSSIDs.ElementCount ); - + for(; i < Params->ConnectParameters.DisallowedBSSIDs.ElementCount; i++) { RT_PRINT_ADDR(COMP_MLME, DBG_TRACE, ("Wdi_Task_Roam(): disallowed BSSID:"), @@ -1871,7 +1871,7 @@ Wdi_Task_Roam( } } } - + if( pMgntInfo->bMediaConnect || pMgntInfo->bIbssStarter) { if( pMgntInfo->mIbss ){ @@ -1885,7 +1885,7 @@ Wdi_Task_Roam( MgntDisconnectAP(pAdapter, disas_lv_ss); } } - + RT_TRACE(COMP_MLME, DBG_LOUD, ("pMgntInfo->PrepareRoamState %d\n", pMgntInfo->PrepareRoamState)); switch(pMgntInfo->PrepareRoamState) { @@ -1909,13 +1909,13 @@ Wdi_Task_Roam( RT_TRACE(COMP_MLME, DBG_WARNING, ("No matched roaming state\n")); break; } - + pMgntInfo->bPrepareRoaming = FALSE; pMgntInfo->PrepareRoamState = RT_PREPARE_ROAM_NONE; pMgntInfo->PrepareRoamingCount = 0; - + DrvIFIndicateRoamingStart(pAdapter); - + if( MgntRoamRetry(pAdapter, FALSE) == FALSE ) ndisStatus = NDIS_STATUS_FAILURE; else @@ -1937,7 +1937,7 @@ WdiSimpleSetProperty( PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); PRT_NDIS6_COMMON pNdisCommon = pAdapter->pNdisCommon; - PWDI_MESSAGE_HEADER pWdiHeader + PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER)pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; // We complete the OID. Need to populate some fields @@ -1955,11 +1955,11 @@ WdiSimpleSetProperty( return ndisStatus; } -// +// // Translate from RT_PS_MODE to WDI_POWER_SAVE_LEVEL // 2005.02.15, by rcnjko. // -int +int TranslatePsToWdiPs( IN POWER_LEVEL_CONFIG PowerMode ) @@ -1969,20 +1969,20 @@ TranslatePsToWdiPs( switch(PowerMode) { case POWER_SAVING_NO_POWER_SAVING: - WdiPsMode = WDI_POWER_SAVE_LEVEL_NO_POWER_SAVE; - break; + WdiPsMode = WDI_POWER_SAVE_LEVEL_NO_POWER_SAVE; + break; case POWER_SAVING_FAST_PSP: - WdiPsMode = WDI_POWER_SAVE_LEVEL_FAST_PSP; - break; + WdiPsMode = WDI_POWER_SAVE_LEVEL_FAST_PSP; + break; case POWER_SAVING_MAX_PSP: - WdiPsMode = WDI_POWER_SAVE_LEVEL_MAX_PSP; - break; + WdiPsMode = WDI_POWER_SAVE_LEVEL_MAX_PSP; + break; case POWER_SAVING_MAXIMUM_LEVEL: - WdiPsMode = WDI_POWER_SAVE_LEVEL_MAXIMUM_LEVEL; - break; + WdiPsMode = WDI_POWER_SAVE_LEVEL_MAXIMUM_LEVEL; + break; default: RT_TRACE(COMP_DBG, DBG_SERIOUS, ("TranslatePsToWdiPs(): Unknown PowerMode: 0x%X !!!\n", PowerMode)); - WdiPsMode = WDI_POWER_SAVE_LEVEL_NO_POWER_SAVE; + WdiPsMode = WDI_POWER_SAVE_LEVEL_NO_POWER_SAVE; break; } @@ -2041,15 +2041,15 @@ Wdi_Set_Add_Cipher_Keys( cpMacAddr(MacAddress, CipherKey.PeerMacAddress.Address); bDefaultKey = FALSE; - RT_PRINT_ADDR(COMP_SCAN, DBG_LOUD, "WDI_TLV_PEER_MAC_ADDRESS(): ", MacAddress); + RT_PRINT_ADDR(COMP_SCAN, DBG_LOUD, "WDI_TLV_PEER_MAC_ADDRESS(): ", MacAddress); } if(CipherKey.Optional.CipherKeyID_IsPresent) { KeyIndex = CipherKey.CipherKeyID.CipherKeyID; - RT_TRACE(COMP_SEC, DBG_LOUD, ("WDI_TLV_CIPHER_KEY_ID 0x%x\n", KeyIndex)); + RT_TRACE(COMP_SEC, DBG_LOUD, ("WDI_TLV_CIPHER_KEY_ID 0x%x\n", KeyIndex)); } - + { cipherAlgo = CipherKey.CipherKeyTypeInfo.CipherAlgorithm; direction = CipherKey.CipherKeyTypeInfo.Direction; @@ -2061,7 +2061,7 @@ Wdi_Set_Add_Cipher_Keys( switch(cipherAlgo) { case WDI_CIPHER_ALGO_WEP: - rtEncAlgo = RT_ENC_ALG_WEP; + rtEncAlgo = RT_ENC_ALG_WEP; break; case WDI_CIPHER_ALGO_WEP40: @@ -2070,59 +2070,59 @@ Wdi_Set_Add_Cipher_Keys( case WDI_CIPHER_ALGO_WEP104: rtEncAlgo = RT_ENC_ALG_WEP104; - break; - - case WDI_CIPHER_ALGO_TKIP: + break; + + case WDI_CIPHER_ALGO_TKIP: rtEncAlgo = RT_ENC_ALG_TKIP; break; - case WDI_CIPHER_ALGO_CCMP: - rtEncAlgo = RT_ENC_ALG_AESCCMP; + case WDI_CIPHER_ALGO_CCMP: + rtEncAlgo = RT_ENC_ALG_AESCCMP; break; - case WDI_CIPHER_ALGO_BIP: + case WDI_CIPHER_ALGO_BIP: break; default: break; - } - } + } + } - if(CipherKey.Optional.ReceiveSequenceCount_IsPresent) + if(CipherKey.Optional.ReceiveSequenceCount_IsPresent) { PlatformMoveMemory(&KeyRSC, CipherKey.ReceiveSequenceCount.ReceiveSequenceCount, 6); -// RT_TRACE(COMP_SEC, DBG_LOUD, ("WIFI_TLV_CIPHER_KEY_RECEIVE_SEQUENCE_COUNT 0x%"i64fmt"x\n", KeyRSC)); +// RT_TRACE(COMP_SEC, DBG_LOUD, ("WIFI_TLV_CIPHER_KEY_RECEIVE_SEQUENCE_COUNT 0x%"i64fmt"x\n", KeyRSC)); } if(CipherKey.Optional.CCMPKey_IsPresent) - { + { KeyLen = CipherKey.CCMPKey.ElementCount; pKeyMaterial = CipherKey.CCMPKey.pElements; - bValidKeyRSC = TRUE; + bValidKeyRSC = TRUE; RT_PRINT_DATA(COMP_SEC, DBG_LOUD,("WDI_TLV_CIPHER_KEY_CCMP_KEY\n"),pKeyMaterial,KeyLen); } if(CipherKey.Optional.TKIPInfo_IsPresent) - { + { // Tkip Enc Key(16) + STA Rx MIC Key(8) + STA Tx MIC Key(8). RT_PRINT_DATA(COMP_SEC, DBG_LOUD, ("TKIPKey \n"), CipherKey.TKIPInfo.TKIPKey.pElements, CipherKey.TKIPInfo.TKIPKey.ElementCount); RT_PRINT_DATA(COMP_SEC, DBG_LOUD, ("TKIPMIC \n"), CipherKey.TKIPInfo.TKIPMIC.pElements, CipherKey.TKIPInfo.TKIPMIC.ElementCount); - + PlatformMoveMemory(pTkipKeyMaterial, CipherKey.TKIPInfo.TKIPKey.pElements, CipherKey.TKIPInfo.TKIPKey.ElementCount); - PlatformMoveMemory(pTkipKeyMaterial+CipherKey.TKIPInfo.TKIPKey.ElementCount, CipherKey.TKIPInfo.TKIPMIC.pElements, CipherKey.TKIPInfo.TKIPMIC.ElementCount); - - RT_PRINT_DATA(COMP_SEC, DBG_LOUD, ("pTkipKeyMaterial \n"), pTkipKeyMaterial, TKIP_KEY_LEN); - - pKeyMaterial = pTkipKeyMaterial; - KeyLen = CipherKey.TKIPInfo.TKIPKey.ElementCount + CipherKey.TKIPInfo.TKIPMIC.ElementCount; - - bValidKeyRSC = TRUE; - RT_PRINT_DATA(COMP_SEC, DBG_LOUD,("WDI_TLV_CIPHER_KEY_TKIP_KEY_INFO\n"),pKeyMaterial,KeyLen); + PlatformMoveMemory(pTkipKeyMaterial+CipherKey.TKIPInfo.TKIPKey.ElementCount, CipherKey.TKIPInfo.TKIPMIC.pElements, CipherKey.TKIPInfo.TKIPMIC.ElementCount); + + RT_PRINT_DATA(COMP_SEC, DBG_LOUD, ("pTkipKeyMaterial \n"), pTkipKeyMaterial, TKIP_KEY_LEN); + + pKeyMaterial = pTkipKeyMaterial; + KeyLen = CipherKey.TKIPInfo.TKIPKey.ElementCount + CipherKey.TKIPInfo.TKIPMIC.ElementCount; + + bValidKeyRSC = TRUE; + RT_PRINT_DATA(COMP_SEC, DBG_LOUD,("WDI_TLV_CIPHER_KEY_TKIP_KEY_INFO\n"),pKeyMaterial,KeyLen); } if(CipherKey.Optional.BIPKey_IsPresent) - { + { if( CipherKey.BIPKey.ElementCount == BIP_KEY_LEN) { PlatformMoveMemory( pSecInfo->BIPKeyBuffer ,CipherKey.BIPKey.pElements, CipherKey.BIPKey.ElementCount); @@ -2135,13 +2135,13 @@ Wdi_Set_Add_Cipher_Keys( { ndisStatus = NDIS_STATUS_INVALID_DATA; } - - return ndisStatus; - } - + + return ndisStatus; + } + if(CipherKey.Optional.WEPKey_IsPresent) - { - if(rtEncAlgo == RT_ENC_ALG_WEP) + { + if(rtEncAlgo == RT_ENC_ALG_WEP) { if (CipherKey.WEPKey.ElementCount == NATIVE_802_11_WEP40_KEY_LENGTH) { @@ -2154,13 +2154,13 @@ Wdi_Set_Add_Cipher_Keys( RT_TRACE( COMP_SEC, DBG_LOUD, ("Wdi_Set_Add_Cipher_Keys(): DOT11_CIPHER_ALGO_WEP104\n") ); } } - + KeyLen = CipherKey.WEPKey.ElementCount; pKeyMaterial = CipherKey.WEPKey.pElements; - RT_PRINT_DATA(COMP_SEC, DBG_LOUD,("WDI_TLV_CIPHER_KEY_WEP_KEY\n"),pKeyMaterial,KeyLen); - } - + RT_PRINT_DATA(COMP_SEC, DBG_LOUD,("WDI_TLV_CIPHER_KEY_WEP_KEY\n"),pKeyMaterial,KeyLen); + } + RT_TRACE(COMP_SEC, DBG_LOUD,("==>CipherType %s\n", (WDI_CIPHER_KEY_TYPE_PAIRWISE_KEY == cipherType)?"WDI_CIPHER_KEY_TYPE_PAIRWISE_KEY":( (WDI_CIPHER_KEY_TYPE_GROUP_KEY == cipherType)?"WDI_CIPHER_KEY_TYPE_GROUP_KEY":"WDI_CIPHER_KEY_TYPE_IGTK"))); if(0 == i && !ACTING_AS_AP(pAdapter)) { @@ -2169,12 +2169,12 @@ Wdi_Set_Add_Cipher_Keys( pSecInfo->PairwiseEncAlgorithm = rtEncAlgo; } else if(WDI_CIPHER_KEY_TYPE_GROUP_KEY == cipherType) - { - pSecInfo->GroupEncAlgorithm = rtEncAlgo; + { + pSecInfo->GroupEncAlgorithm = rtEncAlgo; } RT_TRACE(COMP_SEC, DBG_LOUD,("==> pSecInfo->PairwiseEncAlgorithm=0x%x\n",pSecInfo->PairwiseEncAlgorithm)); - - } + + } { if( ACTING_AS_AP(pAdapter)) { @@ -2201,7 +2201,7 @@ Wdi_Set_Add_Cipher_Keys( KeyRSC); } else - { + { for(i=0;i<4;i++){ // Save for Reconnent for Ad-hoc ,by CCW // PlatformMoveMemory( pNdisCommon->RegDefaultKeyBuf[i], pKeyMaterial, KeyLen); @@ -2222,13 +2222,13 @@ Wdi_Set_Add_Cipher_Keys( PlatformMoveMemory( pNdisCommon->RegDefaultKeyBuf[i], pKeyMaterial, KeyLen); pNdisCommon->RegDefaultKey[i].Length = (u2Byte)KeyLen; } - else if(rtEncAlgo == RT_ENC_ALG_WEP104) + else if(rtEncAlgo == RT_ENC_ALG_WEP104) { PlatformMoveMemory( pNdisCommon->RegDefaultKeyWBuf[i], pKeyMaterial, KeyLen); pNdisCommon->RegDefaultKeyW[i].Length =(u2Byte)KeyLen; } - } + } } } else @@ -2253,21 +2253,21 @@ Wdi_Set_Add_Cipher_Keys( PlatformMoveMemory( pNdisCommon->RegDefaultKeyBuf[i], pKeyMaterial, KeyLen); pNdisCommon->RegDefaultKey[i].Length = (u2Byte)KeyLen; } - else if(rtEncAlgo == RT_ENC_ALG_WEP104) + else if(rtEncAlgo == RT_ENC_ALG_WEP104) { PlatformMoveMemory( pNdisCommon->RegDefaultKeyWBuf[i], pKeyMaterial, KeyLen); pNdisCommon->RegDefaultKeyW[i].Length =(u2Byte)KeyLen; } } PlatformRequestPreAuthentication( pAdapter, PRE_AUTH_INDICATION_REASON_ASSOCIATION ); - + } else { // TODO: [WDI] security for Ad-hoc mode - + } - } + } } } @@ -2295,7 +2295,7 @@ Wdi_Set_Delete_Cipher_Keys( WDI_SET_DELETE_CIPHER_KEYS_PARAMETERS *Params = pOidHandle->tlvParser.parsedTlv.paramSetDeleteDefaultCipherKeys; WDI_SET_DELETE_CIPHER_KEYS_CONTAINER CipherKeyInfo = {0}; - PWDI_MESSAGE_HEADER pWdiHeader + PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER)pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; BOOLEAN bDefaultKey = TRUE; @@ -2305,7 +2305,7 @@ Wdi_Set_Delete_Cipher_Keys( ULONG cipherAlgo = 0; ULONG direction = WDI_CIPHER_KEY_DIRECTION_BOTH; u1Byte static_key = TRUE; - ULONG cipherType = WDI_CIPHER_KEY_TYPE_PAIRWISE_KEY; + ULONG cipherType = WDI_CIPHER_KEY_TYPE_PAIRWISE_KEY; u4Byte i = 0; @@ -2323,17 +2323,17 @@ Wdi_Set_Delete_Cipher_Keys( CipherKeyInfo = Params->CipherKeyInfo.pElements[i]; if(CipherKeyInfo.Optional.PeerMacAddress_IsPresent) { - RT_TRACE(COMP_SEC, DBG_LOUD, ("WDI_TLV_PEER_MAC_ADDRESS\n")); + RT_TRACE(COMP_SEC, DBG_LOUD, ("WDI_TLV_PEER_MAC_ADDRESS\n")); cpMacAddr(MacAddress, CipherKeyInfo.PeerMacAddress.Address); bDefaultKey = FALSE; } if(CipherKeyInfo.Optional.CipherKeyID_IsPresent) { - RT_TRACE(COMP_SEC, DBG_LOUD, ("WDI_TLV_CIPHER_KEY_ID\n")); + RT_TRACE(COMP_SEC, DBG_LOUD, ("WDI_TLV_CIPHER_KEY_ID\n")); KeyIndex = CipherKeyInfo.CipherKeyID.CipherKeyID; } - + { cipherAlgo = CipherKeyInfo.CipherKeyTypeInfo.CipherAlgorithm; direction = CipherKeyInfo.CipherKeyTypeInfo.Direction; @@ -2345,7 +2345,7 @@ Wdi_Set_Delete_Cipher_Keys( switch(cipherAlgo) { case WDI_CIPHER_ALGO_WEP: - rtEncAlgo = RT_ENC_ALG_WEP; + rtEncAlgo = RT_ENC_ALG_WEP; break; case WDI_CIPHER_ALGO_WEP40: @@ -2354,40 +2354,40 @@ Wdi_Set_Delete_Cipher_Keys( case WDI_CIPHER_ALGO_WEP104: rtEncAlgo = RT_ENC_ALG_WEP104; - break; - - case WDI_CIPHER_ALGO_TKIP: + break; + + case WDI_CIPHER_ALGO_TKIP: rtEncAlgo = RT_ENC_ALG_TKIP; break; - case WDI_CIPHER_ALGO_CCMP: - rtEncAlgo = RT_ENC_ALG_AESCCMP; + case WDI_CIPHER_ALGO_CCMP: + rtEncAlgo = RT_ENC_ALG_AESCCMP; break; - case WDI_CIPHER_ALGO_BIP: + case WDI_CIPHER_ALGO_BIP: break; default: break; - } - } + } + } RT_TRACE(COMP_SEC, DBG_LOUD, ("[WDI] [Property] WDI_SET_DELETE_CIPHER_KEYS: delete Key\n")); { // - // 061028, rcnjko: WDK said we shall ignore AlgorithmId if bDelete is set, - // so we use GroupEncAlgorithm instead. + // 061028, rcnjko: WDK said we shall ignore AlgorithmId if bDelete is set, + // so we use GroupEncAlgorithm instead. // if( KeyIndex > 3 && KeyIndex < 6 ) { // 802.11w BIP key Key index 5 or 6 - + PlatformZeroMemory(pSecInfo->BIPKeyBuffer, MAX_KEY_LEN); } else if( !pAdapter->MgntInfo.bRSNAPSKMode) { MgntActSet_802_11_REMOVE_KEY( - pAdapter, + pAdapter, rtEncAlgo, KeyIndex, MacAddress, @@ -2403,18 +2403,18 @@ Wdi_Set_Delete_Cipher_Keys( RT_TRACE( COMP_OID_SET, DBG_WARNING, (" <- [WDI] Property WIFI_SET_DELETE_CIPHER_KEYS, MgntActSet_RSNA_REMOVE_DEAULT_KEY return FALSE !!!\n")); return NDIS_STATUS_INVALID_DATA; } - } + } } - } + } } else if(WDI_TLV_DELETE_CIPHER_KEY_INFO== pTlvData->Type) - { + { InputBufferLength = pTlvData->Length; pTlvData = (PTLV_WDI_STRUCT)((pu1Byte)pTlvData->Value); Prefix += 4; - + while(BytesProcessed < InputBufferLength) { // Parse Type @@ -2425,7 +2425,7 @@ Wdi_Set_Delete_Cipher_Keys( RT_TRACE(COMP_SEC, DBG_LOUD, ("unknown TLV 0x%x\n", pTlvData->Type)); } break; - + case WDI_TLV_PEER_MAC_ADDRESS: { RT_TRACE(COMP_SEC, DBG_LOUD, ("WDI_TLV_PEER_MAC_ADDRESS\n")); @@ -2462,26 +2462,26 @@ Wdi_Set_Delete_Cipher_Keys( // Parse Content BytesProcessed += (4 + pTlvData->Length); - + pTlvData = (PTLV_WDI_STRUCT)((pu1Byte)pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer + Prefix + BytesProcessed); } RT_TRACE(COMP_SEC, DBG_LOUD, ("[WDI] [Property] WDI_SET_DELETE_CIPHER_KEYS: delete Key\n")); // - // 061028, rcnjko: WDK said we shall ignore AlgorithmId if bDelete is set, - // so we use GroupEncAlgorithm instead. + // 061028, rcnjko: WDK said we shall ignore AlgorithmId if bDelete is set, + // so we use GroupEncAlgorithm instead. // rtEncAlgo = pSecInfo->GroupEncAlgorithm; if( KeyIndex > 3 && KeyIndex < 6 ) { // 802.11w BIP key Key index 5 or 6 - + PlatformZeroMemory(pSecInfo->BIPKeyBuffer, MAX_KEY_LEN); } else if( !pAdapter->MgntInfo.bRSNAPSKMode) { MgntActSet_802_11_REMOVE_KEY( - pAdapter, + pAdapter, rtEncAlgo, KeyIndex, MacAddress, @@ -2523,7 +2523,7 @@ Wdi_Set_Default_Key_ID( // Set default key id: 0 ~ 3. KeyId &= 0x3; - // The following code will cause 8187 failed to link to AP. + // The following code will cause 8187 failed to link to AP. pSecInfo->DefaultTransmitKeyIdx = (u1Byte)KeyId; pNdisCommon->RegDefaultKeyId = (u1Byte)KeyId; @@ -2542,9 +2542,9 @@ Wdi_Set_Receive_Packet_Filter( NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; ULONG BytesRead = 0, BytesNeeded = 0; - PWDI_MESSAGE_HEADER pWdiHeader + PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER)pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; - ULONG InputBufferLength + ULONG InputBufferLength = pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength;; WDI_SET_RECEIVE_PACKET_FILTER_PARAMETERS *Params = pOidHandle->tlvParser.parsedTlv.paramSetReceivePacketFilter; @@ -2562,7 +2562,7 @@ Wdi_Set_Receive_Packet_Filter( pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength, &BytesRead, &BytesNeeded); - + return ndisStatus; } @@ -2581,7 +2581,7 @@ Wdi_Set_Network_List_Offload( NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; PADAPTER pDefaultAdapter = GetDefaultAdapter(pAdapter); PRT_NDIS6_COMMON pNdisCommon = pDefaultAdapter->pNdisCommon; - PRT_NLO_INFO pNLOInfo = &(pDefaultAdapter->MgntInfo.NLOInfo); + PRT_NLO_INFO pNLOInfo = &(pDefaultAdapter->MgntInfo.NLOInfo); u4Byte ChannelIndex = 0; u4Byte Index = 0; u4Byte ItemCnt = 0; @@ -2601,7 +2601,7 @@ Wdi_Set_Network_List_Offload( pNLOInfo->FastScanPeriod = 0; pNLOInfo->SlowScanPeriod = 0; pNdisCommon->ScanPeriod = 0; - + RT_TRACE( COMP_POWER, DBG_LOUD , (" ===>SsidOffload_IsPresent == 0 \n") ); return NDIS_STATUS_SUCCESS; } @@ -2633,12 +2633,12 @@ Wdi_Set_Network_List_Offload( for( i=0 ; iUnicastAlgorithms.ElementCount ; ++i, ++Index) { - // Copy SSID - CopySsid( pNLOInfo->dDot11OffloadNetworkList[Index].ssidbuf, + // Copy SSID + CopySsid( pNLOInfo->dDot11OffloadNetworkList[Index].ssidbuf, pNLOInfo->dDot11OffloadNetworkList[Index].ssidlen, pOffloadItem->SsidToScan.pElements, pOffloadItem->SsidToScan.ElementCount); - + RT_TRACE(COMP_POWER, DBG_LOUD, ("The %u OFFLOAD NETWORK SSID: %s\n", Index+1, pNLOInfo->dDot11OffloadNetworkList[Index].ssidbuf)); pAlgorithmItem = &(pOffloadItem->UnicastAlgorithms.pElements[i]); @@ -2658,15 +2658,15 @@ Wdi_Set_Network_List_Offload( pNLOInfo->dDot11OffloadNetworkList[Index].bPrivacy = TRUE; pNLOInfo->dDot11OffloadNetworkList[Index].chiper = 0x0; break; - case WDI_CIPHER_ALGO_TKIP : - if( pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_WPA || + case WDI_CIPHER_ALGO_TKIP : + if( pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_WPA || pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_WPA_PSK ) { pNLOInfo->dDot11OffloadNetworkList[Index].SecLvl = RT_SEC_LVL_WPA; pNLOInfo->dDot11OffloadNetworkList[Index].bPrivacy = TRUE; pNLOInfo->dDot11OffloadNetworkList[Index].chiper = WPA_TKIP; } - else if( pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_RSNA || + else if( pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_RSNA || pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_RSNA_PSK ) { pNLOInfo->dDot11OffloadNetworkList[Index].SecLvl = RT_SEC_LVL_WPA2; @@ -2682,14 +2682,14 @@ Wdi_Set_Network_List_Offload( } break; case WDI_CIPHER_ALGO_CCMP : - if( pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_WPA || + if( pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_WPA || pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_WPA_PSK ) { pNLOInfo->dDot11OffloadNetworkList[Index].SecLvl = RT_SEC_LVL_WPA; pNLOInfo->dDot11OffloadNetworkList[Index].bPrivacy = TRUE; pNLOInfo->dDot11OffloadNetworkList[Index].chiper = WPA_AES; } - else if( pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_RSNA || + else if( pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_RSNA || pAlgorithmItem->AuthAlgorithm == WDI_AUTH_ALGO_RSNA_PSK ) { pNLOInfo->dDot11OffloadNetworkList[Index].SecLvl = RT_SEC_LVL_WPA2; @@ -2711,29 +2711,29 @@ Wdi_Set_Network_List_Offload( RT_TRACE( COMP_POWER, DBG_LOUD , (" ===> Unknow UnicastCipher : %x\n", pAlgorithmItem->CipherAlgorithm) ); break; } - + RT_TRACE(COMP_POWER , DBG_LOUD , (" Seclvl : %d\n", pNLOInfo->dDot11OffloadNetworkList[Index].SecLvl) ); RT_TRACE(COMP_POWER , DBG_LOUD , (" bPrivacy : %d\n", pNLOInfo->dDot11OffloadNetworkList[Index].bPrivacy) ); RT_TRACE(COMP_POWER , DBG_LOUD , (" chiper : %d\n", pNLOInfo->dDot11OffloadNetworkList[Index].chiper) ); RT_TRACE( COMP_POWER, DBG_LOUD, (" Channel Hint:\n")); - - // Save channel info + + // Save channel info // DOT11_MAX_CHANNEL_HINTS 4 for( ChannelIndex = 0 ; ChannelIndex < pOffloadItem->ChannellHintList.ElementCount ; ChannelIndex++ ) { pNLOInfo->dDot11OffloadNetworkList[Index].channelNumberHit[ChannelIndex] = pChannelItem[ChannelIndex].ChannelNumber; RT_TRACE( COMP_POWER, DBG_LOUD, (" %u", pNLOInfo->dDot11OffloadNetworkList[Index].channelNumberHit[ChannelIndex])); } - + RT_TRACE( COMP_POWER, DBG_LOUD, ("\n")); - - // Show Entry information !! + + // Show Entry information !! RT_TRACE( COMP_POWER, DBG_LOUD , (" ===> Show NLO info Index (%x):\n", Index) ); RT_PRINT_STR(COMP_POWER, DBG_LOUD, (" SSID"), pNLOInfo->dDot11OffloadNetworkList[Index].ssidbuf, pNLOInfo->dDot11OffloadNetworkList[Index].ssidlen); RT_TRACE( COMP_POWER , DBG_LOUD , (" chiper : %x \n", pNLOInfo->dDot11OffloadNetworkList[Index].chiper) ); } - } + } } else { @@ -2757,9 +2757,9 @@ Wdi_Set_Privacy_Exemption_List( ULONG BytesRead = 0, BytesNeeded = 0; PRT_NDIS6_COMMON pNdisCommon = pAdapter->pNdisCommon; PNDIS_OID_REQUEST pNdisRequest = pOidHandle->pNdisRequest; - PWDI_MESSAGE_HEADER pWdiHeader + PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER)pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; - ULONG InputBufferLength + ULONG InputBufferLength = pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength; WDI_SET_PRIVACY_EXEMPTION_LIST_PARAMETERS *Params = pOidHandle->tlvParser.parsedTlv.paramSetPrivacyExemptionList; WDI_PRIVACY_EXEMPTION_LIST_CONTAINER PrivacyList = {0}; @@ -2780,34 +2780,34 @@ Wdi_Set_Privacy_Exemption_List( for(i = 0; i < Params->PrivacyExemptionEntry.ElementCount; i++) { PrivacyList = Params->PrivacyExemptionEntry.pElements[i]; - pNdisCommon->PrivacyExemptionEntries[i].usEtherType = + pNdisCommon->PrivacyExemptionEntries[i].usEtherType = PrivacyList.EtherType; - pNdisCommon->PrivacyExemptionEntries[i].usExemptionActionType = - PrivacyList.ExemptionActionType; - pNdisCommon->PrivacyExemptionEntries[i].usExemptionPacketType = - PrivacyList.ExemptionPacketType; + pNdisCommon->PrivacyExemptionEntries[i].usExemptionActionType = + PrivacyList.ExemptionActionType; + pNdisCommon->PrivacyExemptionEntries[i].usExemptionPacketType = + PrivacyList.ExemptionPacketType; } - RT_PRINT_DATA(COMP_OID_SET, DBG_LOUD, - "Privacy exempt list:", - pNdisCommon->PrivacyExemptionEntries, - (int)(pNdisCommon->PrivacyExemptionEntrieNum * sizeof(DOT11_PRIVACY_EXEMPTION))); + RT_PRINT_DATA(COMP_OID_SET, DBG_LOUD, + "Privacy exempt list:", + pNdisCommon->PrivacyExemptionEntries, + (int)(pNdisCommon->PrivacyExemptionEntrieNum * sizeof(DOT11_PRIVACY_EXEMPTION))); } - + return ndisStatus; } NDIS_STATUS -Wdi_Set_Power_State( +Wdi_Set_Power_State( IN PADAPTER pAdapter, IN PRT_OID_HANDLER pOidHandle ) { NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; - + ndisStatus = N6SdioWdi_Mgnt_SetPower(pAdapter, pOidHandle); return ndisStatus; @@ -2815,15 +2815,15 @@ Wdi_Set_Power_State( NDIS_STATUS -Wdi_Abort_Task( +Wdi_Abort_Task( IN PADAPTER pAdapter, IN PRT_OID_HANDLER pOidHandle ) { NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; - PWDI_MESSAGE_HEADER pWdiHeader + PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER) pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; - ULONG InputBufferLength + ULONG InputBufferLength = pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength; WDI_TASK_ABORT_PARAMETERS *Params = pOidHandle->tlvParser.parsedTlv.paramAbort; @@ -2875,7 +2875,7 @@ Wdi_Set_Add_Wol_Pattern( u1Byte Index, ptnIndex; RT_TRACE(COMP_OID_SET, DBG_LOUD, ("==> Wdi_Set_Add_Wol_Pattern()\n")); - + pWdiHeader->Status = NDIS_STATUS_SUCCESS; pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.BytesWritten = sizeof(WDI_MESSAGE_HEADER); @@ -2895,20 +2895,20 @@ Wdi_Set_Add_Wol_Pattern( for(Index = 0; Index < Params->WakePacketPattern.ElementCount; Index++, pPatternElements++) { RT_TRACE(COMP_OID_SET, DBG_LOUD, ("SET OID_PM_ADD_WOL_PATTERN[%d]:\n", Index)); - + if(pPatternElements->PacketPattern.ElementCount <= MAX_WOL_PATTERN_SIZE) { PlatformMoveMemory(WoLBitMapPatternContent, pPatternElements->PacketPattern.pElements, pPatternElements->PacketPattern.ElementCount); - RT_PRINT_DATA( COMP_OID_SET | COMP_POWER, DBG_LOUD, ("WoLBitMapPatternContent...\n"), + RT_PRINT_DATA( COMP_OID_SET | COMP_POWER, DBG_LOUD, ("WoLBitMapPatternContent...\n"), WoLBitMapPatternContent, sizeof(WoLBitMapPatternContent)); } if(pPatternElements->PacketPatternMask.ElementCount <= MAX_WOL_BIT_MASK_SIZE) { - PlatformMoveMemory(WoLBitMapPatternMask, pPatternElements->PacketPatternMask.pElements, pPatternElements->PacketPatternMask.ElementCount); - RT_PRINT_DATA( COMP_OID_SET | COMP_POWER, DBG_LOUD, ("WoLBitMapPatternMask...\n"), + PlatformMoveMemory(WoLBitMapPatternMask, pPatternElements->PacketPatternMask.pElements, pPatternElements->PacketPatternMask.ElementCount); + RT_PRINT_DATA( COMP_OID_SET | COMP_POWER, DBG_LOUD, ("WoLBitMapPatternMask...\n"), WoLBitMapPatternMask, sizeof(WoLBitMapPatternMask)); } - + //Find the index of the first empty entry. for(Index = 0; Index < MAX_SUPPORT_WOL_PATTERN_NUM(pAdapter); Index++) { @@ -2921,12 +2921,12 @@ Wdi_Set_Add_Wol_Pattern( if(pPmWoLPatternInfo[Index].PatternId == 0) break; } - + if(Index >= MAX_SUPPORT_WOL_PATTERN_NUM(pAdapter)) { ndisStatus = NDIS_STATUS_RESOURCES; RT_TRACE(COMP_POWER, DBG_LOUD, - ("SET OID_PNP_ADD_WOL_PATTERN: Return status(%#X). The number of wake up pattern is more than %d or the pattern Id is exist.\n", + ("SET OID_PNP_ADD_WOL_PATTERN: Return status(%#X). The number of wake up pattern is more than %d or the pattern Id is exist.\n", ndisStatus, MAX_SUPPORT_WOL_PATTERN_NUM(pAdapter))); return ndisStatus; } @@ -2946,9 +2946,9 @@ Wdi_Set_Add_Wol_Pattern( //Skip IPv4/IPv6 TCP SYN pattern because it will hit HW bug for the CRC. // We offload this pattern to FW. pPmWoLPatternInfo[Index].PatternType = eUnicastPattern; - RT_TRACE(COMP_OID_SET, DBG_LOUD, + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("OID_PM_ADD_WOL_PATTERN: IPv4/IPv6 TCP SYN pattern.\n")); - + } else if(PlatformCompareMemory(WoLBitMapPatternContent, MULTICAST_ADDR, sizeof(MULTICAST_ADDR)) == 0) { //Multicast @@ -2962,12 +2962,12 @@ Wdi_Set_Add_Wol_Pattern( { pPmWoLPatternInfo[Index].PatternType = eDontCareDA; } - + { - GetWOLWakeUpPattern(pAdapter, - (pu1Byte)&WoLBitMapPatternMask, - pPatternElements->PacketPatternMask.ElementCount, - (pu1Byte)&WoLBitMapPatternContent, + GetWOLWakeUpPattern(pAdapter, + (pu1Byte)&WoLBitMapPatternMask, + pPatternElements->PacketPatternMask.ElementCount, + (pu1Byte)&WoLBitMapPatternContent, pPatternElements->PacketPattern.ElementCount, Index, FALSE @@ -2976,7 +2976,7 @@ Wdi_Set_Add_Wol_Pattern( pPSC->WoLPatternNum++; } } - + } //2 Wake Packet Magic Packet @@ -3019,7 +3019,7 @@ Wdi_Set_Add_Wol_Pattern( if(Params->WakePacketEapolRequestIdPatternId) { RT_TRACE(COMP_OID_SET, DBG_LOUD, ("SET OID_PM_ADD_WOL_PATTERN: Support EapolRequestIdMessage.\n")); - + if(!pPSC->EapolRequestIdMessagePatternId) { pPSC->EapolRequestIdMessagePatternId = Params->WakePacketEapolRequestIdPatternId; @@ -3047,7 +3047,7 @@ Wdi_Set_Remove_Wol_Pattern( PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); PRT_POWER_SAVE_CONTROL pPSC = GET_POWER_SAVE_CONTROL(pMgntInfo); PRT_PM_WOL_PATTERN_INFO pPmWoLPatternInfo = &(pPSC->PmWoLPatternInfo[0]); - + u4Byte RemovePatternId = Params->PatternId; RT_TRACE(COMP_OID_SET, DBG_LOUD, ("==> Wdi_Set_Remove_Wol_Pattern()\n")); @@ -3059,41 +3059,41 @@ Wdi_Set_Remove_Wol_Pattern( if(RemovePatternId == pPSC->MagicPacketPatternId) { RT_TRACE(COMP_OID_SET, DBG_LOUD, ("SET_OID_PM_REMOVE_WOL_PATTERN: Remove MagicPacket.\n")); - + pPSC->MagicPacketPatternId = 0; pPSC->WoLPktNoPtnNum--; } else if(RemovePatternId == pPSC->EapolRequestIdMessagePatternId) { RT_TRACE(COMP_OID_SET, DBG_LOUD, ("SET_OID_PM_REMOVE_WOL_PATTERN: Remove EapolRequestIdMessage.\n")); - + pPSC->EapolRequestIdMessagePatternId = 0; pPSC->WoLPktNoPtnNum--; } else if(RemovePatternId == pPSC->IPv4TcpSynPatternId) { RT_TRACE(COMP_OID_SET, DBG_LOUD, ("SET_OID_PM_REMOVE_WOL_PATTERN: Remove IPv4TcpSyn.\n")); - + pPSC->IPv4TcpSynPatternId = 0; pPSC->WoLPktNoPtnNum--; } else if(RemovePatternId == pPSC->IPv6TcpSynPatternId) { RT_TRACE(COMP_OID_SET, DBG_LOUD, ("SET_OID_PM_REMOVE_WOL_PATTERN: Remove IPv6TcpSyn.\n")); - + pPSC->IPv6TcpSynPatternId = 0; pPSC->WoLPktNoPtnNum--; } else { u1Byte Index; - + for(Index = 0; Index < MAX_SUPPORT_WOL_PATTERN_NUM(pAdapter); Index++) { if(pPmWoLPatternInfo[Index].PatternId == RemovePatternId) break; } - + if(Index >= MAX_SUPPORT_WOL_PATTERN_NUM(pAdapter)) { RT_TRACE(COMP_OID_SET, DBG_LOUD,("SET OID_PM_REMOVE_WOL_PATTERN: Cannot find the wake up pattern Id(%08X).\n", RemovePatternId)); @@ -3106,9 +3106,9 @@ Wdi_Set_Remove_Wol_Pattern( pPmWoLPatternInfo[Index].CrcRemainder = 0xffff; pPmWoLPatternInfo[Index].IsPatternMatch = 0; pPmWoLPatternInfo[Index].IsSupportedByFW = 0; - - pAdapter->HalFunc.SetHwRegHandler(pAdapter, HW_VAR_WF_MASK, (pu1Byte)(&Index)); - pAdapter->HalFunc.SetHwRegHandler(pAdapter, HW_VAR_WF_CRC, (pu1Byte)(&Index)); + + pAdapter->HalFunc.SetHwRegHandler(pAdapter, HW_VAR_WF_MASK, (pu1Byte)(&Index)); + pAdapter->HalFunc.SetHwRegHandler(pAdapter, HW_VAR_WF_CRC, (pu1Byte)(&Index)); pPmWoLPatternInfo[Index].HwWFMIndex = 0xff; // reset the value after clear HW/CAM entry. pPSC->WoLPatternNum--; @@ -3139,7 +3139,7 @@ Wdi_Set_Multicast_List( NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; ULONG BytesRead = 0, BytesNeeded = 0; PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER)pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; - ULONG InputBufferLength = pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength; + ULONG InputBufferLength = pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength; WDI_SET_MULTICAST_LIST_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramSetMulticastList; WDI_MAC_ADDRESS Address = {0}; DOT11_MAC_ADDRESS MulticastList[MAX_MCAST_LIST_NUM]; @@ -3155,7 +3155,7 @@ Wdi_Set_Multicast_List( Address = param->MulticastList.pElements[i]; CopyMem(MulticastList[i], Address.Address, sizeof(DOT11_MAC_ADDRESS)); RT_PRINT_ADDR(COMP_OID_SET, DBG_TRACE, ("Wdi_Set_Multicast_List MulticastList\n"), MulticastList[i]); - RT_PRINT_ADDR(COMP_OID_SET, DBG_TRACE, ("Wdi_Set_Multicast_List Address.Address\n"), Address.Address); + RT_PRINT_ADDR(COMP_OID_SET, DBG_TRACE, ("Wdi_Set_Multicast_List Address.Address\n"), Address.Address); } ndisStatus = N6CSet_DOT11_MULTICAST_LIST(pAdapter, @@ -3168,7 +3168,7 @@ Wdi_Set_Multicast_List( { // Shall we need to clear multicast list since parameter was empty? } - + return ndisStatus; } @@ -3183,9 +3183,9 @@ Wdi_Set_Add_Pm_Protocol_Offload( PRT_POWER_SAVE_CONTROL pPSC = GET_POWER_SAVE_CONTROL(pMgntInfo); PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER) pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; WDI_SET_ADD_PM_PROTOCOL_OFFLOAD_PARAMETERS_PARAMETERS *Params = pOidHandle->tlvParser.parsedTlv.paramSetAddProtocolOffload; - + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("==> Wdi_Set_Add_Pm_Protocol_Offload()\n")); - + pWdiHeader->Status = NDIS_STATUS_SUCCESS; pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.BytesWritten = sizeof(WDI_MESSAGE_HEADER); @@ -3193,21 +3193,21 @@ Wdi_Set_Add_Pm_Protocol_Offload( //2 DOT11 RSN REKey Offload if(Params->DOT11RSNREKeyOffload.ProtocolOffloadId) { - RT_TRACE(COMP_OID_SET, DBG_LOUD, ("ProtocolOffloadId = %d\n", + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("ProtocolOffloadId = %d\n", Params->DOT11RSNREKeyOffload.ProtocolOffloadId)); - - pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eGTKOffloadIdx] + + pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eGTKOffloadIdx] = Params->DOT11RSNREKeyOffload.ProtocolOffloadId; - + //Copy kck, kek - PlatformMoveMemory(&(pMgntInfo->PMDot11RSNRekeyPara.KCK), - Params->DOT11RSNREKeyOffload.KCK_CONTENT, 32); + PlatformMoveMemory(&(pMgntInfo->PMDot11RSNRekeyPara.KCK), + Params->DOT11RSNREKeyOffload.KCK_CONTENT, 32); - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("KCK_CONTENT:\n"), + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("KCK_CONTENT:\n"), pMgntInfo->PMDot11RSNRekeyPara.KCK, 16); - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("KEK_CONTENT:\n"), + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("KEK_CONTENT:\n"), pMgntInfo->PMDot11RSNRekeyPara.KEK, 16); - + pMgntInfo->PMDot11RSNRekeyPara.KeyReplayCounter = Params->DOT11RSNREKeyOffload.ReplayCounter; if(pPSC->RegGTKOffloadEnable) @@ -3218,18 +3218,18 @@ Wdi_Set_Add_Pm_Protocol_Offload( //2 ipv4 ARP Offload if(Params->ipv4ARPOffload.ProtocolOffloadId) { - pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eARPOffloadIdx] + pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eARPOffloadIdx] = Params->ipv4ARPOffload.ProtocolOffloadId; //Copy RemoteIPv4Address, HostIPv4Address & MacAddress - PlatformMoveMemory(&(pMgntInfo->PMIPV4ARPPara.RemoteIPv4Address), - Params->ipv4ARPOffload.RemoteIPV4Address, 14); - - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("RemoteIPv4Address:\n"), + PlatformMoveMemory(&(pMgntInfo->PMIPV4ARPPara.RemoteIPv4Address), + Params->ipv4ARPOffload.RemoteIPV4Address, 14); + + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("RemoteIPv4Address:\n"), pMgntInfo->PMIPV4ARPPara.RemoteIPv4Address, 4); - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("HostIPv4Address:\n"), + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("HostIPv4Address:\n"), pMgntInfo->PMIPV4ARPPara.HostIPv4Address, 4); - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("MacAddress:\n"), + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("MacAddress:\n"), pMgntInfo->PMIPV4ARPPara.MacAddress, 6); if(pPSC->RegARPOffloadEnable) @@ -3241,7 +3241,7 @@ Wdi_Set_Add_Pm_Protocol_Offload( if(Params->ipv6ARPOffload.ProtocolOffloadId) { RT_TRACE(COMP_OID_SET, DBG_LOUD, ("SET OID_PM_ADD_PROTOCOL_OFFLOAD. (NS IPv6)\n")); - + if((pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eNSOffloadIdx1] != 0) && (pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eNSOffloadIdx2] != 0)) { @@ -3252,43 +3252,43 @@ Wdi_Set_Add_Pm_Protocol_Offload( { u1Byte IPv6NSIndex = 0; RT_PM_IPV6_NS_PARAMETERS *NsParams; - + if( pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eNSOffloadIdx1] == 0) { - pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eNSOffloadIdx1] + pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eNSOffloadIdx1] = Params->ipv6ARPOffload.ProtocolOffloadId; IPv6NSIndex = 0; RT_TRACE( COMP_OID_SET, DBG_LOUD, ("==> eNSOffloadIdx1: \n")); } else { - pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eNSOffloadIdx2] + pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eNSOffloadIdx2] = Params->ipv6ARPOffload.ProtocolOffloadId; IPv6NSIndex = 1; RT_TRACE( COMP_OID_SET, DBG_LOUD, ("==> eNSOffloadIdx2: \n")); } NsParams = &(pMgntInfo->PMIPV6NSPara[IPv6NSIndex]); - - PlatformMoveMemory(NsParams->RemoteIPv6Address, + + PlatformMoveMemory(NsParams->RemoteIPv6Address, Params->ipv6ARPOffload.RemoteIPV6Address, 16); - PlatformMoveMemory(NsParams->SolicitedNodeIPv6Address, + PlatformMoveMemory(NsParams->SolicitedNodeIPv6Address, Params->ipv6ARPOffload.SolicitdNodeIPv6Address, 16); - PlatformMoveMemory(NsParams->MacAddress, + PlatformMoveMemory(NsParams->MacAddress, Params->ipv6ARPOffload.MacAddress.Address, 6); - PlatformMoveMemory(NsParams->TargetIPv6Addresses[0], + PlatformMoveMemory(NsParams->TargetIPv6Addresses[0], Params->ipv6ARPOffload.TargetIPV6Address1, 16); - PlatformMoveMemory(NsParams->TargetIPv6Addresses[1], + PlatformMoveMemory(NsParams->TargetIPv6Addresses[1], Params->ipv6ARPOffload.TargetIPV6Address2, 16); - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM RemoteIPv6Address: \n"), + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM RemoteIPv6Address: \n"), NsParams->RemoteIPv6Address, 16); - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM SolicitedNodeIPv6Address: \n"), + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM SolicitedNodeIPv6Address: \n"), NsParams->SolicitedNodeIPv6Address, 16); - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM MacAddress: \n"), + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM MacAddress: \n"), NsParams->MacAddress, 6); - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM TargetIPv6Addresses[0]: \n"), + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM TargetIPv6Addresses[0]: \n"), NsParams->TargetIPv6Addresses[0], 16); - RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM TargetIPv6Addresses[1]: \n"), + RT_PRINT_DATA( COMP_OID_SET, DBG_LOUD, ("SET PM TargetIPv6Addresses[1]: \n"), NsParams->TargetIPv6Addresses[1], 16); if(pPSC->RegNSOffloadEnable) @@ -3297,7 +3297,7 @@ Wdi_Set_Add_Pm_Protocol_Offload( } RT_TRACE(COMP_OID_SET, DBG_LOUD, ("<== Wdi_Set_Add_Pm_Protocol_Offload()\n")); - + return ndisStatus; } @@ -3313,9 +3313,9 @@ Wdi_Set_Remove_Pm_Protocol_Offload( WDI_SET_REMOVE_PM_PROTOCOL_OFFLOAD_PARAMETERS *Params = pOidHandle->tlvParser.parsedTlv.paramSetRemoveProtocolOffload; u4Byte MatchId, ProtocolOffloadId = Params->RemovePMOffload; - + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("==> Wdi_Set_Remove_Pm_Protocol_Offload()\n")); - + pWdiHeader->Status = NDIS_STATUS_SUCCESS; pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.BytesWritten = sizeof(WDI_MESSAGE_HEADER); @@ -3324,19 +3324,19 @@ Wdi_Set_Remove_Pm_Protocol_Offload( if(ProtocolOffloadId == pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[MatchId]) { RT_TRACE(COMP_POWER, DBG_LOUD, ("Find match protocol offload ID idx (%d)\n", MatchId)); - + if(MatchId == eGTKOffloadIdx) { - PlatformZeroMemory(&(pMgntInfo->PMDot11RSNRekeyPara), sizeof(RT_PM_DOT11_RSN_REKEY_PARAMETERS)); + PlatformZeroMemory(&(pMgntInfo->PMDot11RSNRekeyPara), sizeof(RT_PM_DOT11_RSN_REKEY_PARAMETERS)); RT_TRACE( COMP_OID_SET, DBG_LOUD, ("==>REMOVE eGTKOffloadIdx\n")); } else if(MatchId == eARPOffloadIdx) { - PlatformZeroMemory(&(pMgntInfo->PMIPV4ARPPara), sizeof(RT_PM_IPV4_ARP_PARAMETERS)); + PlatformZeroMemory(&(pMgntInfo->PMIPV4ARPPara), sizeof(RT_PM_IPV4_ARP_PARAMETERS)); RT_TRACE( COMP_OID_SET, DBG_LOUD, ("==>REMOVE eARPOffloadIdx\n")); } else if(MatchId == eNSOffloadIdx1 ) - { + { // Disable eNSOffloadIdx1 , set ID = 0 !! pMgntInfo->PowerSaveControl.PMProtocolOffloadIDs[eNSOffloadIdx1] = 0; RT_TRACE( COMP_OID_SET, DBG_LOUD, ("==>REMOVE eNSOffloadIdx1\n")); @@ -3351,7 +3351,7 @@ Wdi_Set_Remove_Pm_Protocol_Offload( } RT_TRACE(COMP_OID_SET, DBG_LOUD, ("<== Wdi_Set_Remove_Pm_Protocol_Offload()\n")); - + return ndisStatus; } @@ -3365,10 +3365,10 @@ Wdi_Set_Connection_Quality( ULONG BytesRead = 0, BytesNeeded = 0; PMGNT_INFO pMgntInfo=&(pAdapter->MgntInfo); PRT_POWER_SAVE_CONTROL pPSC = GET_POWER_SAVE_CONTROL(pMgntInfo); - PWDI_MESSAGE_HEADER pWdiHeader + PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER)pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; - ULONG InputBufferLength - = pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength; + ULONG InputBufferLength + = pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InputBufferLength; WDI_SET_CONNECTION_QUALITY_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramSetConnectionQuality; pWdiHeader->Status = NDIS_STATUS_SUCCESS; @@ -3385,18 +3385,18 @@ Wdi_Set_Connection_Quality( pPSC->ConnectionQuality = param->Quality; RT_TRACE(COMP_OID_SET, DBG_LOUD, ("Wdi_Set_Connection_Quality ConnectionQuality 0x%x\n", pPSC->ConnectionQuality)); - + if(param->Optional.LowLatencyParameters_IsPresent) { pPSC->MaximumOffChannelOperationTime = param->LowLatencyParameters.MaximumOffChannelOperationTime; - pPSC->RoamingNeededLinkQualityThreshold = param->LowLatencyParameters.RoamingNeededLinkQualityThreshold; + pPSC->RoamingNeededLinkQualityThreshold = param->LowLatencyParameters.RoamingNeededLinkQualityThreshold; RT_TRACE(COMP_OID_SET, DBG_LOUD, ("Wdi_Set_Connection_Quality MaximumOffChannelOperationTime 0x%x\n", pPSC->MaximumOffChannelOperationTime)); - RT_TRACE(COMP_OID_SET, DBG_LOUD, ("Wdi_Set_Connection_Quality RoamingNeededLinkQualityThreshold 0x%x\n", pPSC->RoamingNeededLinkQualityThreshold)); + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("Wdi_Set_Connection_Quality RoamingNeededLinkQualityThreshold 0x%x\n", pPSC->RoamingNeededLinkQualityThreshold)); } } - - + + return ndisStatus; } @@ -3413,23 +3413,23 @@ Wdi_Get_Auto_Power_Save( WDI_GET_AUTO_POWER_SAVE_RESULTS adapterPowerSave = {0}; PUCHAR pOutput = NULL; ULONG length = 0; - - PWDI_MESSAGE_HEADER pOidHeader + + PWDI_MESSAGE_HEADER pOidHeader = (PWDI_MESSAGE_HEADER)pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; - adapterPowerSave.AutoPowerSaveParameters.EnableAutoPSM = + adapterPowerSave.AutoPowerSaveParameters.EnableAutoPSM = pMgntInfo->bInAutoPowerSavemode; - adapterPowerSave.AutoPowerSaveParameters.BeaconInterval = + adapterPowerSave.AutoPowerSaveParameters.BeaconInterval = pMgntInfo->dot11BeaconPeriod; - adapterPowerSave.AutoPowerSaveParameters.ListenInterval = + adapterPowerSave.AutoPowerSaveParameters.ListenInterval = (UINT8)pMgntInfo->ListenInterval; if(pMgntInfo->ListenIntervalInDX) { - adapterPowerSave.AutoPowerSaveParameters.ListenIntervalInDx = - (UINT8)pMgntInfo->ListenIntervalInDX; + adapterPowerSave.AutoPowerSaveParameters.ListenIntervalInDx = + (UINT8)pMgntInfo->ListenIntervalInDX; } else { @@ -3446,13 +3446,13 @@ Wdi_Get_Auto_Power_Save( else { adapterPowerSave.AutoPowerSaveParameters.PowerMode = WDI_POWER_SAVE_LEVEL_NO_POWER_SAVE; - adapterPowerSave.AutoPowerSaveParameters.PowerModeinDx = WDI_POWER_SAVE_LEVEL_NO_POWER_SAVE; + adapterPowerSave.AutoPowerSaveParameters.PowerModeinDx = WDI_POWER_SAVE_LEVEL_NO_POWER_SAVE; } //2 Todo adapterPowerSave.AutoPowerSaveParameters.Reason = 0; - - adapterPowerSave.AutoPowerSaveParameters.MillisecondsSinceStart = + + adapterPowerSave.AutoPowerSaveParameters.MillisecondsSinceStart = (PlatformGetCurrentTime() - pDefAdapter->DriverUpTime) / 1000; if (pPSC->bLeisurePs && pMgntInfo->dot11PowerSaveMode != eActive) @@ -3461,21 +3461,21 @@ Wdi_Get_Auto_Power_Save( (PlatformGetCurrentTime() - pPSC->LastLPSEnterTime) / 1000; } else if (pPSC->LastLPSEnterTime) - { + { adapterPowerSave.AutoPowerSaveParameters.MillisecondsInPowerSave = (pPSC->LastLPSLeaveTime - pPSC->LastLPSEnterTime) / 1000; - } + } else { adapterPowerSave.AutoPowerSaveParameters.MillisecondsInPowerSave = 0; } //2 Todo - adapterPowerSave.AutoPowerSaveParameters.ReceivedMulticastPackets = - adapterPowerSave.AutoPowerSaveParameters.SentMulticastPackets = - adapterPowerSave.AutoPowerSaveParameters.ReceivedUnicastPackets = + adapterPowerSave.AutoPowerSaveParameters.ReceivedMulticastPackets = + adapterPowerSave.AutoPowerSaveParameters.SentMulticastPackets = + adapterPowerSave.AutoPowerSaveParameters.ReceivedUnicastPackets = adapterPowerSave.AutoPowerSaveParameters.SentUnicastPacket = 0; - + ndisStatus = GenerateWdiGetAutoPowerSave( //pAdapterCapabilities, &adapterPowerSave, @@ -3495,7 +3495,7 @@ Wdi_Get_Auto_Power_Save( return ndisStatus; } - if (pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.OutputBufferLength >= + if (pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.OutputBufferLength >= (length + sizeof(WDI_MESSAGE_HEADER))) { PlatformMoveMemory( @@ -3508,9 +3508,9 @@ Wdi_Get_Auto_Power_Save( { ndisStatus = NDIS_STATUS_BUFFER_TOO_SHORT; pOidHandle->pNdisRequest->DATA.METHOD_INFORMATION.BytesNeeded += (length + sizeof(WDI_MESSAGE_HEADER)); - RT_TRACE(COMP_INIT, DBG_WARNING, ("[Error] GenerateWdiGetAdapterCapabilities() failed with status(%x)\n", ndisStatus)); + RT_TRACE(COMP_INIT, DBG_WARNING, ("[Error] GenerateWdiGetAdapterCapabilities() failed with status(%x)\n", ndisStatus)); } - + if(pOutput) { FreeGenerated(pOutput); @@ -3518,7 +3518,7 @@ Wdi_Get_Auto_Power_Save( } pOidHeader->Status = ndisStatus; - + return ndisStatus; } @@ -3532,10 +3532,10 @@ Wdi_IHV_Request( PTLV_WDI_STRUCT pTlvData = NULL; ULONG BytesWritten = 0, BytesRead = 0, BytesNeeded = 0; PNDIS_OID_REQUEST pNdisRequest = pOidHandle->pNdisRequest; - PWDI_MESSAGE_HEADER pWdiHeader + PWDI_MESSAGE_HEADER pWdiHeader = (PWDI_MESSAGE_HEADER)pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; //20150915-KenSun -//Temp Workaround for setting a private OID +//Temp Workaround for setting a private OID #if 1 PCCX_NIC_SPECIFIC_EXTENSION ccxData; PIHV_CCX_TLV pTlv = NULL; @@ -3589,9 +3589,9 @@ Wdi_IHV_Request( //Because WDI would always pass 2046 in pNdisRequest->DATA.METHOD_INFORMATION.OutputBufferLength //which is not the same value that passed in RTK Appilcations. (All RTK appilcation pass 0 outputbufferlength when issuing a SET OID request) //Therefore, we cannot use it as refence. -//For interfacing with WDI, we have to make sure BytesWriiten is sizeof(WDI_MESSAGE_HEADER) when dealing with a SET method request. +//For interfacing with WDI, we have to make sure BytesWriiten is sizeof(WDI_MESSAGE_HEADER) when dealing with a SET method request. // -#if 1 +#if 1 ccxData = (PCCX_NIC_SPECIFIC_EXTENSION)pTlvData->Value; if(ccxData->event == CCX_EVENT_OID) { @@ -3631,7 +3631,7 @@ Wdi_Get_Statistics( WDI_MAC_STATISTICS_CONTAINER MacStatistics[2]; WDI_PHY_STATISTICS_CONTAINER PhyStatistics[WDI_802_11_MAX_NUM_PHY_TYPES]; PNDIS_OID_REQUEST pNdisRequest = pOidHandle->pNdisRequest; - PWDI_MESSAGE_HEADER pOidHeader + PWDI_MESSAGE_HEADER pOidHeader = (PWDI_MESSAGE_HEADER)pNdisRequest->DATA.METHOD_INFORMATION.InformationBuffer; FunctionIn(COMP_OID_QUERY); @@ -3652,7 +3652,7 @@ Wdi_Get_Statistics( MacStatistics[0].CCMPFormatErrors = pAdapter->RxStats.NumRxCCMPDecryptErrorsUnicast; MacStatistics[0].CCMPReplays = pAdapter->RxStats.NumRxCCMPReplayUnicast; MacStatistics[0].CCMPDecryptErrors = pAdapter->RxStats.NumRxCCMPDecryptErrorsUnicast; - MacStatistics[0].WEPUndecryptableCount = pAdapter->RxStats.NumRxWEPUndecryptableUnicast; + MacStatistics[0].WEPUndecryptableCount = pAdapter->RxStats.NumRxWEPUndecryptableUnicast; MacStatistics[0].WEPICVErrorCount = pAdapter->RxStats.NumRxWEPICVErrorUnicast; MacStatistics[0].DecryptSuccessCount = pAdapter->RxStats.NumRxDecryptSuccessUnicast; MacStatistics[0].DecryptFailureCount = pAdapter->RxStats.NumRxDecryptFailureUnicast; @@ -3668,11 +3668,11 @@ Wdi_Get_Statistics( MacStatistics[1].CCMPFormatErrors = pAdapter->RxStats.NumRxCCMPDecryptErrorsMulticast + pAdapter->RxStats.NumRxCCMPDecryptErrorsBroadcast; MacStatistics[1].CCMPReplays = pAdapter->RxStats.NumRxCCMPReplayMulticast; MacStatistics[1].CCMPDecryptErrors = pAdapter->RxStats.NumRxCCMPDecryptErrorsMulticast + pAdapter->RxStats.NumRxCCMPDecryptErrorsBroadcast; - MacStatistics[1].WEPUndecryptableCount = pAdapter->RxStats.NumRxWEPUndecryptableMulticast + pAdapter->RxStats.NumRxWEPUndecryptableBroadcast; + MacStatistics[1].WEPUndecryptableCount = pAdapter->RxStats.NumRxWEPUndecryptableMulticast + pAdapter->RxStats.NumRxWEPUndecryptableBroadcast; MacStatistics[1].WEPICVErrorCount = pAdapter->RxStats.NumRxWEPICVErrorMulticast + pAdapter->RxStats.NumRxWEPICVErrorBroadcast; MacStatistics[1].DecryptSuccessCount = pAdapter->RxStats.NumRxDecryptSuccessMulticast + pAdapter->RxStats.NumRxDecryptSuccessBroadcast; MacStatistics[1].DecryptFailureCount = pAdapter->RxStats.NumRxDecryptFailureMulticast + pAdapter->RxStats.NumRxDecryptFailureBroadcast; - + Params.PeerMACStatistics.ElementCount = 2; Params.PeerMACStatistics.pElements = MacStatistics; @@ -3704,24 +3704,24 @@ Wdi_Get_Statistics( PhyStatistics[0].PhyType = WDI_PHY_TYPE_VHT; break; - + } PhyStatistics[0].TransmittedFrameCount = pAdapter->TxStats.NumTxOkTotal; PhyStatistics[0].GroupTransmittedFrameCount = pAdapter->TxStats.NumTxMulticast + pAdapter->TxStats.NumTxBroadcast; - PhyStatistics[0].FailedCount = pAdapter->TxStats.NumTxErrTotal; - PhyStatistics[0].RetryCount = pAdapter->TxStats.NumTxRetryCount; + PhyStatistics[0].FailedCount = pAdapter->TxStats.NumTxErrTotal; + PhyStatistics[0].RetryCount = pAdapter->TxStats.NumTxRetryCount; PhyStatistics[0].MultipleRetryCount = 0; // TODO PhyStatistics[0].MaxTXLifetimeExceededCount = 0; // TODO - PhyStatistics[0].TransmittedFragmentCount = pAdapter->TxStats.NumTxOkTotal; + PhyStatistics[0].TransmittedFragmentCount = pAdapter->TxStats.NumTxOkTotal; PhyStatistics[0].RTSSuccessCount = 0; // TODO PhyStatistics[0].RTSFailureCount = 0; // TODO PhyStatistics[0].ACKFailureCount = 0; // TODO PhyStatistics[0].ReceivedFrameCount = pAdapter->RxStats.NumRxFramgment; - PhyStatistics[0].GroupReceivedFrameCount = pAdapter->RxStats.NumRxFramgment; + PhyStatistics[0].GroupReceivedFrameCount = pAdapter->RxStats.NumRxFramgment; PhyStatistics[0].PromiscuousReceivedFrameCount = 0; // TODO PhyStatistics[0].MaxRXLifetimeExceededCount = 0; // TODO PhyStatistics[0].FrameDuplicateCount = 0; // TODO - PhyStatistics[0].ReceivedFragmentCount = pAdapter->RxStats.NumRxFramgment; + PhyStatistics[0].ReceivedFragmentCount = pAdapter->RxStats.NumRxFramgment; PhyStatistics[0].PromiscuousReceivedFragmentCount = 0; // TODO PhyStatistics[0].FCSErrorCount = pAdapter->RxStats.NumRxErrTotalUnicast + pAdapter->RxStats.NumRxErrTotalMulticast; Params.PhyStatistics.ElementCount = 1; @@ -3730,7 +3730,7 @@ Wdi_Get_Statistics( else { u1Byte count = 0; - + PlatformZeroMemory(&MacStatistics[0], sizeof(WDI_MAC_STATISTICS_CONTAINER)*2); cpMacAddr(MacStatistics[0].MACAddress.Address, BroadcastAddress); Params.PeerMACStatistics.ElementCount = 1; @@ -3761,7 +3761,7 @@ Wdi_Get_Statistics( return ndisStatus; } - if (pNdisRequest->DATA.METHOD_INFORMATION.OutputBufferLength >= + if (pNdisRequest->DATA.METHOD_INFORMATION.OutputBufferLength >= (length + sizeof(WDI_MESSAGE_HEADER))) { PlatformMoveMemory( @@ -3774,9 +3774,9 @@ Wdi_Get_Statistics( { ndisStatus = NDIS_STATUS_BUFFER_TOO_SHORT; pNdisRequest->DATA.METHOD_INFORMATION.BytesNeeded += (length + sizeof(WDI_MESSAGE_HEADER)); - RT_TRACE(COMP_INIT, DBG_WARNING, ("[Error] GenerateWdiGetStatistics() failed with status(%x)\n", ndisStatus)); + RT_TRACE(COMP_INIT, DBG_WARNING, ("[Error] GenerateWdiGetStatistics() failed with status(%x)\n", ndisStatus)); } - + if(pOutput) { FreeGenerated(pOutput); @@ -3784,9 +3784,9 @@ Wdi_Get_Statistics( } pOidHeader->Status = ndisStatus; - + FunctionOut(COMP_OID_QUERY); - + return ndisStatus; } @@ -3798,7 +3798,7 @@ WDI_OID_TASK_OPEN( ) { NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; - + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("Not Support WDI_OID_TASK_OPEN\n")); return ndisStatus; @@ -3813,7 +3813,7 @@ WDI_OID_TASK_CLOSE( { NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; - + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("Not Support WDI_OID_TASK_CLOSE\n")); return ndisStatus; @@ -3837,7 +3837,7 @@ WDI_OID_TASK_P2P_DISCOVER( { NDIS_STATUS status = NDIS_STATUS_SUCCESS; WDI_TASK_P2P_DISCOVER_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramP2pDiscover; - + FunctionIn(COMP_OID_SET); do @@ -3846,7 +3846,7 @@ WDI_OID_TASK_P2P_DISCOVER( P2P_INFO *info = GET_P2P_INFO(pAdapter); FRAME_BUF *buf = NULL; - + // additional ie if(param->Optional.VendorIEs_IsPresent) { @@ -3856,20 +3856,20 @@ WDI_OID_TASK_P2P_DISCOVER( ); } - RT_TRACE_F(COMP_P2P, DBG_LOUD, ("DiscoveryType = %d, ScanType = %d\n", + RT_TRACE_F(COMP_P2P, DBG_LOUD, ("DiscoveryType = %d, ScanType = %d\n", param->DiscoverMode.DiscoveryType, param->DiscoverMode.ScanType)); // construct req if(NULL != (req = CustomScan_AllocReq(GET_CUSTOM_SCAN_INFO(pAdapter), NULL, NULL))) { static u1Byte bcst[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - + buf = CustomScan_GetProbeReqBuf(req); if(param->SSIDList.ElementCount) { WDI_SSID *ssid = ¶m->SSIDList.pElements[0]; - + RT_PRINT_STR(COMP_OID_SET, DBG_LOUD, "to probe with ssid", ssid->pElements, ssid->ElementCount); P2P_Construct_ProbeReqEx(buf, info, bcst, (u1Byte)ssid->ElementCount, (u1Byte *)ssid->pElements); } @@ -3892,10 +3892,10 @@ WDI_OID_TASK_P2P_DISCOVER( if(WDI_P2P_SCAN_TYPE_PASSIVE == param->DiscoverMode.ScanType) CustomScan_ForcePassiveScan(req); - + CustomScan_SetTimeBound(req, param->DwellTime.MaximumScanTime); CustomScan_SetupCbCtx(req, wdi_P2PDiscoveryCb, pAdapter); - + CustomScan_IssueReq(GET_CUSTOM_SCAN_INFO(pAdapter), req, CUSTOM_SCAN_SRC_TYPE_P2P, "wdi-p2p-discovery"); } }while(FALSE); @@ -3936,7 +3936,7 @@ WDI_OID_TASK_DOT11_RESET( WDI_TASK_DOT11_RESET_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramDot11Reset; NDIS_OID_REQUEST *req = NULL; - + FunctionIn(COMP_OID_SET); do @@ -3959,7 +3959,7 @@ WDI_OID_TASK_DOT11_RESET( N63CResetNetworkListOffload(pAdapter); - // MAC Address Randomization + // MAC Address Randomization if(param->Optional.ResetMACAddress_IsPresent && pAdapter->MgntInfo.RegSupportMACRandom) { cpMacAddr( pAdapter->CurrentAddress, param->ResetMACAddress.Address); @@ -3968,7 +3968,7 @@ WDI_OID_TASK_DOT11_RESET( } // cleanup - if(req && NDIS_STATUS_SUCCESS != status) + if(req && NDIS_STATUS_SUCCESS != status) Wdi_Xlat_FreeOid(req); FunctionOut(COMP_OID_SET); @@ -3996,7 +3996,7 @@ WDI_OID_TASK_P2P_SEND_REQUEST_ACTION_FRAME( NDIS_STATUS status = NDIS_STATUS_SUCCESS; WDI_TASK_P2P_SEND_REQUEST_ACTION_FRAME_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramP2pSendRequestActionFrame; VOID *req = NULL; - + FunctionIn(COMP_OID_SET); do @@ -4026,7 +4026,7 @@ WDI_OID_TASK_P2P_SEND_REQUEST_ACTION_FRAME( break; } }while(FALSE); - + FunctionOut(COMP_OID_SET); return status; @@ -4042,12 +4042,12 @@ WDI_OID_TASK_P2P_SEND_RESPONSE_ACTION_FRAME( NDIS_STATUS status = NDIS_STATUS_SUCCESS; WDI_TASK_P2P_SEND_RESPONSE_ACTION_FRAME_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramP2pSendResponseActionFrame; VOID *req = NULL; - + FunctionIn(COMP_OID_SET); do { - // termincate any ongoing scan for sending rsp + // termincate any ongoing scan for sending rsp WDI_SendAction_TerminateReq(pAdapter); if(WDI_P2P_ACTION_FRAME_GO_NEGOTIATION_RESPONSE == param->ResponseParams.ResponseFrameType) @@ -4079,7 +4079,7 @@ WDI_OID_TASK_P2P_SEND_RESPONSE_ACTION_FRAME( break; } }while(FALSE); - + FunctionOut(COMP_OID_SET); return status; @@ -4103,7 +4103,7 @@ WDI_OID_TASK_CREATE_PORT( { NDIS_STATUS status = NDIS_STATUS_SUCCESS; PORT_HELPER *pPortHelper = pAdapter->pPortCommonInfo->pPortHelper; - + status = Wdi_Task_CreatePort(pAdapter, pOidHandle); if(NDIS_STATUS_PENDING == status) @@ -4113,7 +4113,7 @@ WDI_OID_TASK_CREATE_PORT( PlatformReleaseSpinLock(pAdapter, RT_PENDED_OID_SPINLOCK); status = NDIS_STATUS_SUCCESS; } - + return status; } @@ -4128,7 +4128,7 @@ WDI_OID_TASK_DELETE_PORT( PORT_HELPER *pPortHelper = pAdapter->pPortCommonInfo->pPortHelper; status = Wdi_Task_DeletePort(pAdapter, pOidHandle); - + if(NDIS_STATUS_PENDING == status) {// WDI always return success regardless of our status here, so we need to record pended req here PlatformAcquireSpinLock(pAdapter, RT_PENDED_OID_SPINLOCK); @@ -4151,7 +4151,7 @@ WDI_OID_TASK_START_AP( WDI_TASK_START_AP_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramStartAp; NDIS_OID_REQUEST *req = NULL; - + FunctionIn(COMP_OID_SET); do @@ -4171,7 +4171,7 @@ WDI_OID_TASK_START_AP( Wdi_Xlat_FreeOid(req); req = NULL; - + // Start AP if(NULL == (req = Wdi_Xlat_AllocStartApReqOid(pOidHandle, param))) { @@ -4187,13 +4187,13 @@ WDI_OID_TASK_START_AP( RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("N63C_OID_DOT11_WFD_START_GO_REQUEST returns: 0x%08X\n", status)); break; } - + }while(FALSE); // M4 indication is not required since bWaitComplete in RT_SUPPORT_TASKs is FALSE // cleanup - if(req) + if(req) Wdi_Xlat_FreeOid(req); FunctionOut(COMP_OID_SET); @@ -4209,17 +4209,17 @@ WDI_OID_TASK_STOP_AP( ) { NDIS_STATUS status = NDIS_STATUS_SUCCESS; - + FunctionIn(COMP_OID_SET); if(RT_AP_TYPE_VWIFI_AP == MgntActQuery_ApType(pAdapter)) { status = N6CSet_DOT11_DISCONNECT_REQUEST(pAdapter, NULL, 0, 0, 0); - + if(NDIS_STATUS_SUCCESS != status) { RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("N6CSet_DOT11_DISCONNECT_REQUEST returns: 0x%08X\n", status)); - } + } } else { @@ -4242,14 +4242,14 @@ WDI_OID_TASK_SEND_AP_ASSOCIATION_RESPONSE( WDI_TASK_SEND_AP_ASSOCIATION_RESPONSE_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramSendApAssociationResponse; NDIS_OID_REQUEST *req = NULL; - + FunctionIn(COMP_OID_SET); do { MGNT_INFO *pMgntInfo = NULL; RT_WLAN_STA *pEntry = NULL; - + pMgntInfo = &pAdapter->MgntInfo; if(NULL == (req = Wdi_Xlat_AllocIncomingAssociationDecisionOid(pOidHandle, param))) @@ -4263,7 +4263,7 @@ WDI_OID_TASK_SEND_AP_ASSOCIATION_RESPONSE( status = NDIS_STATUS_INVALID_STATE; break; } - + if(NDIS_STATUS_SUCCESS != (status = N62C_OID_DOT11_INCOMING_ASSOCIATION_DECISION(pAdapter, req))) { RT_TRACE_F(COMP_MLME, DBG_WARNING, ("N62C_OID_DOT11_INCOMING_ASSOCIATION_DECISION returns: 0x%08X\n", status)); @@ -4273,21 +4273,21 @@ WDI_OID_TASK_SEND_AP_ASSOCIATION_RESPONSE( pOidHandle->pvCtx = req; AP_SendAsocRsp( - pAdapter, - pEntry, - TRUE == param->IncomingRequestInfo.AssocRequestParams.IsReassociationRequest, - FALSE, + pAdapter, + pEntry, + TRUE == param->IncomingRequestInfo.AssocRequestParams.IsReassociationRequest, + FALSE, param->AssocResponseParameters.ReasonCode ); // If succeeded, WDI_CMD_SendApAssociationResponseComplete is called from DrvIFIndicateIncommingAssociationComplete - + }while(FALSE); // cleanup if(NDIS_STATUS_SUCCESS != status) { - if(req) + if(req) Wdi_Xlat_FreeOid(req); } @@ -4299,7 +4299,7 @@ WDI_OID_TASK_SEND_AP_ASSOCIATION_RESPONSE( NDIS_STATUS -WDI_OID_TASK_CHANGE_OPERATION_MODE( +WDI_OID_TASK_CHANGE_OPERATION_MODE( IN PADAPTER pAdapter, IN PRT_OID_HANDLER pOidHandle ) @@ -4308,7 +4308,7 @@ WDI_OID_TASK_CHANGE_OPERATION_MODE( WDI_TASK_CHANGE_OPERATION_MODE_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramChangeOperationMode; NDIS_OID_REQUEST *req = NULL; - + FunctionIn(COMP_OID_SET); do @@ -4318,7 +4318,7 @@ WDI_OID_TASK_CHANGE_OPERATION_MODE( status = NDIS_STATUS_RESOURCES; break; } - + if(NDIS_STATUS_SUCCESS != (status = N6C_OID_DOT11_CURRENT_OPERATION_MODE(pAdapter, req))) { RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("N6C_OID_DOT11_CURRENT_OPERATION_MODE returns: 0x%08X\n", status)); @@ -4327,11 +4327,11 @@ WDI_OID_TASK_CHANGE_OPERATION_MODE( // Indicate completed successfully WDI_CMD_ChangeOpModeComplete(pAdapter, req, status); - + }while(FALSE); // cleanup - if(req && NDIS_STATUS_SUCCESS != status) + if(req && NDIS_STATUS_SUCCESS != status) Wdi_Xlat_FreeOid(req); FunctionOut(COMP_OID_SET); @@ -4348,9 +4348,9 @@ WDI_OID_TASK_SEND_REQUEST_ACTION_FRAME( NDIS_STATUS status = NDIS_STATUS_SUCCESS; WDI_TASK_SEND_REQUEST_ACTION_FRAME_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramSendRequestActionFrame; VOID *req = NULL; - + FunctionIn(COMP_OID_SET); - + do { req = WDI_SendAction_Req(pAdapter, param, wdi_SendReqActionFrameStateCb); @@ -4361,7 +4361,7 @@ WDI_OID_TASK_SEND_REQUEST_ACTION_FRAME( status = NDIS_STATUS_FAILURE; } }while(FALSE); - + FunctionOut(COMP_OID_SET); return status; @@ -4376,7 +4376,7 @@ WDI_OID_TASK_SEND_RESPONSE_ACTION_FRAME( NDIS_STATUS status = NDIS_STATUS_SUCCESS; WDI_TASK_SEND_RESPONSE_ACTION_FRAME_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramSendResponseActionFrame; VOID *req = NULL; - + FunctionIn(COMP_OID_SET); do @@ -4389,7 +4389,7 @@ WDI_OID_TASK_SEND_RESPONSE_ACTION_FRAME( status = NDIS_STATUS_FAILURE; } }while(FALSE); - + FunctionOut(COMP_OID_SET); return status; @@ -4404,7 +4404,7 @@ WDI_OID_SET_P2P_LISTEN_STATE( NDIS_STATUS status = NDIS_STATUS_SUCCESS; WDI_SET_P2P_LISTEN_STATE_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramSetP2pListenState; NDIS_OID_REQUEST *req = NULL; - + FunctionIn(COMP_OID_SET); if( param == NULL ) @@ -4453,7 +4453,7 @@ WDI_OID_SET_P2P_LISTEN_STATE( // TODO: }while(FALSE); - if(req) + if(req) Wdi_Xlat_FreeOid(req); FunctionOut(COMP_OID_SET); @@ -4518,7 +4518,7 @@ WDI_OID_GET_AUTO_POWER_SAVE( ) { NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; - + return Wdi_Get_Auto_Power_Save(pAdapter, pOidHandle); } @@ -4539,7 +4539,7 @@ WDI_OID_GET_ADAPTER_CAPABILITIES( ) { NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; - + ndisStatus = N6SdioWdi_AdapterCapabilities( pAdapter, pOidHandle @@ -4688,7 +4688,7 @@ WDI_OID_SET_ADVERTISEMENT_INFORMATION( NDIS_STATUS status = NDIS_STATUS_SUCCESS; WDI_SET_ADVERTISEMENT_INFORMATION_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramSetAdvertisementInformation; NDIS_OID_REQUEST *req = NULL; - + if( param == NULL ) return NDIS_STATUS_FAILURE; @@ -4706,8 +4706,8 @@ WDI_OID_SET_ADVERTISEMENT_INFORMATION( if(param->AdditionalIEs.AdditionalBeaconIEs.ElementCount) { P2P_AddIe_Set( - &info->AdditionalIEs, P2P_ADD_IE_BEACON, - param->AdditionalIEs.AdditionalBeaconIEs.ElementCount, + &info->AdditionalIEs, P2P_ADD_IE_BEACON, + param->AdditionalIEs.AdditionalBeaconIEs.ElementCount, param->AdditionalIEs.AdditionalBeaconIEs.pElements); RT_PRINT_DATA(COMP_P2P, DBG_LOUD, "WDI_OID_SET_ADVERTISEMENT_INFORMATION(): AdditionalBeaconIEs\n", param->AdditionalIEs.AdditionalBeaconIEs.pElements, param->AdditionalIEs.AdditionalBeaconIEs.ElementCount); @@ -4716,8 +4716,8 @@ WDI_OID_SET_ADVERTISEMENT_INFORMATION( if(param->AdditionalIEs.AdditionalProbeResponseIEs.ElementCount) { P2P_AddIe_Set( - &info->AdditionalIEs, P2P_ADD_IE_PROBE_RESPONSE, - param->AdditionalIEs.AdditionalProbeResponseIEs.ElementCount, + &info->AdditionalIEs, P2P_ADD_IE_PROBE_RESPONSE, + param->AdditionalIEs.AdditionalProbeResponseIEs.ElementCount, param->AdditionalIEs.AdditionalProbeResponseIEs.pElements); RT_PRINT_DATA(COMP_P2P, DBG_LOUD, "WDI_OID_SET_ADVERTISEMENT_INFORMATION(): AdditionalProbeResponseIEs\n", param->AdditionalIEs.AdditionalProbeResponseIEs.pElements, param->AdditionalIEs.AdditionalProbeResponseIEs.ElementCount); @@ -4728,14 +4728,14 @@ WDI_OID_SET_ADVERTISEMENT_INFORMATION( if(param->AdditionalIEs.AdditionalProbeRequestDefaultIEs.ElementCount) { P2P_AddIe_Set( - &info->AdditionalIEs, P2P_ADD_IE_DEFAULT_REQUEST, - param->AdditionalIEs.AdditionalProbeRequestDefaultIEs.ElementCount, + &info->AdditionalIEs, P2P_ADD_IE_DEFAULT_REQUEST, + param->AdditionalIEs.AdditionalProbeRequestDefaultIEs.ElementCount, param->AdditionalIEs.AdditionalProbeRequestDefaultIEs.pElements); RT_PRINT_DATA(COMP_P2P, DBG_LOUD, "WDI_OID_SET_ADVERTISEMENT_INFORMATION(): AdditionalProbeRequestDefaultIEs\n", param->AdditionalIEs.AdditionalProbeRequestDefaultIEs.pElements, param->AdditionalIEs.AdditionalProbeRequestDefaultIEs.ElementCount); } } - + // device info if(param->Optional.DeviceInformation_IsPresent) { @@ -4753,7 +4753,7 @@ WDI_OID_SET_ADVERTISEMENT_INFORMATION( Wdi_Xlat_FreeOid(req); req = NULL; } - + // dev cap if(param->Optional.DeviceCapability_IsPresent) { @@ -4807,12 +4807,12 @@ WDI_OID_SET_ADVERTISEMENT_INFORMATION( Wdi_Xlat_FreeOid(req); req = NULL; } - + // TODO: adv svc }while(FALSE); - if(req) + if(req) Wdi_Xlat_FreeOid(req); FunctionOut(COMP_OID_SET); @@ -4845,7 +4845,7 @@ WDI_OID_GET_NEXT_ACTION_FRAME_DIALOG_TOKEN( ULONG tlvlen = 0; UINT8 *tlv = NULL; - + FunctionIn(COMP_OID_SET); do @@ -4887,7 +4887,7 @@ WDI_OID_GET_NEXT_ACTION_FRAME_DIALOG_TOKEN( } GenerateWdiGetNextActionFrameDialogToken( - ¶m, 0, + ¶m, 0, &pAdapter->pPortCommonInfo->WdiData.TlvContext, &tlvlen, &tlv); @@ -4903,11 +4903,11 @@ WDI_OID_GET_NEXT_ACTION_FRAME_DIALOG_TOKEN( tlv, tlvlen); pNdisRequest->DATA.METHOD_INFORMATION.BytesWritten += tlvlen; - + }while(FALSE); // cleanup; - if(req) + if(req) Wdi_Xlat_FreeOid(req); if(tlv) @@ -4929,7 +4929,7 @@ WDI_OID_SET_P2P_WPS_ENABLED( NDIS_STATUS status = NDIS_STATUS_SUCCESS; WDI_SET_P2P_WPS_ENABLED_PARAMETERS *param = pOidHandle->tlvParser.parsedTlv.paramSetP2pWpsEnabled; NDIS_OID_REQUEST *req = NULL; - + if( param == NULL ) return NDIS_STATUS_FAILURE; @@ -4945,10 +4945,10 @@ WDI_OID_SET_P2P_WPS_ENABLED( RT_TRACE_F(COMP_OID_SET, DBG_WARNING, ("N62C_OID_DOT11_WPS_ENABLED returns: 0x%08X\n", status)); break; } - + }while(FALSE); - if(req) + if(req) Wdi_Xlat_FreeOid(req); FunctionOut(COMP_OID_SET); @@ -4985,7 +4985,7 @@ WDI_OID_SET_FAST_BSS_TRANSITION_PARAMETERS( NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; WDI_SET_FAST_BSS_TRANSITION_PARAMETERS_COMMAND *param = pOidHandle->tlvParser.parsedTlv.paramSetFastBssTransitionParametersCommand; u1Byte targetAddr[6] = {0}; - + if( param == NULL ) return NDIS_STATUS_FAILURE; @@ -5008,7 +5008,7 @@ WDI_OID_SET_FAST_BSS_TRANSITION_PARAMETERS( RT_PRINT_DATA(COMP_MLME, DBG_LOUD, "RSNIE:\n", param->RSNIE.pElements, param->RSNIE.ElementCount); } - + if(param->Optional.MDE_IsPresent) { FtUpdateEntryInfo(pAdapter, FT_ENTRY_ACTION_UPDATE_MDE, targetAddr, @@ -5048,8 +5048,8 @@ WDI_OID_SET_FAST_BSS_TRANSITION_PARAMETERS( // // Description: // Prepare indication data for WDI create port. -// Also add data path (via AddDataPathPeer()) as -// it was copied from the original code in +// Also add data path (via AddDataPathPeer()) as +// it was copied from the original code in // WdiSimpleTask(). // // Note: @@ -5066,12 +5066,12 @@ WDI_CMD_CreatePortComplete( { RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; DOT11_MAC_INFO *macInfo = NULL; - + UINT8 *tlv = NULL; ULONG len = 0; WDI_INDICATION_CREATE_PORT_COMPLETE_PARAMETERS param = {0}; - + macInfo = (DOT11_MAC_INFO *)req->DATA.METHOD_INFORMATION.InformationBuffer; FunctionIn(COMP_OID_SET); @@ -5108,7 +5108,7 @@ WDI_CMD_CreatePortComplete( PlatformAcquireSpinLock(pAdapter, RT_PENDED_OID_SPINLOCK); pAdapter->pNdisCommon->PendedRequest = NULL; PlatformReleaseSpinLock(pAdapter, RT_PENDED_OID_SPINLOCK); - + FunctionOut(COMP_OID_SET); return TRUE; @@ -5122,7 +5122,7 @@ WDI_CMD_DeletePortComplete( ) { RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; - + UINT8 *tlv = NULL; ULONG len = 0; @@ -5149,7 +5149,7 @@ WDI_CMD_DeletePortComplete( // Free pended oid PlatformAcquireSpinLock(pAdapter, RT_PENDED_OID_SPINLOCK); pAdapter->pNdisCommon->PendedRequest = NULL; - PlatformReleaseSpinLock(pAdapter, RT_PENDED_OID_SPINLOCK); + PlatformReleaseSpinLock(pAdapter, RT_PENDED_OID_SPINLOCK); FunctionOut(COMP_OID_SET); @@ -5164,7 +5164,7 @@ WDI_CMD_ResetComplete( ) { RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; - + UINT8 *tlv = NULL; ULONG len = 0; @@ -5177,7 +5177,7 @@ WDI_CMD_ResetComplete( // generate TLV //GenerateWdiIndicationDot11ResetComplete(¶m, 0, &pAdapter->pPortCommonInfo->WdiData.TlvContext, &len, &tlv); - + // copy tlv wdi_task_WriteResult(hTask, tlv, len, status); @@ -5201,7 +5201,7 @@ WDI_CMD_ChangeOpModeComplete( ) { RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; - + UINT8 *tlv = NULL; ULONG len = 0; @@ -5237,7 +5237,7 @@ WDI_CMD_P2PDiscoverComplete( ) { RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; - + UINT8 *tlv = NULL; ULONG len = 0; @@ -5255,7 +5255,7 @@ WDI_CMD_P2PDiscoverComplete( // generate TLV //GenerateWdiIndicationDot11ResetComplete(¶m, 0, &pAdapter->pPortCommonInfo->WdiData.TlvContext, &len, &tlv); - + // copy tlv wdi_task_WriteResult(hTask, tlv, len, status); @@ -5278,10 +5278,10 @@ WDI_CMD_P2pSendRequestActionFrameComplete( { RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; OFF_CHNL_TX_STATUS_FLAG txStatusFlag; - + u4Byte ieOffset = FRAME_OFFSET_P2P_PUB_ACT_ELEMENTS; NDIS_STATUS status = NDIS_STATUS_SUCCESS; - + UINT8 *tlv = NULL; ULONG len = 0; @@ -5300,7 +5300,7 @@ WDI_CMD_P2pSendRequestActionFrameComplete( FRAME_BUF *buf = OffChnlTx_GetTxFrameBuf(ctx->req); RT_ASSERT(buf, ("%s(): buf is NULL!!!n", __FUNCTION__)); - + cpMacAddr(param.SendActionFrameResult.FrameParameters.PeerDeviceAddress.Address, (FrameBuf_Head(buf) + FRAME_OFFSET_ADDRESS1)); param.SendActionFrameResult.FrameParameters.DialogToken = ctx->token; param.SendActionFrameResult.FrameIEs.ElementCount = FrameBuf_Length(buf) - ieOffset; @@ -5308,13 +5308,13 @@ WDI_CMD_P2pSendRequestActionFrameComplete( RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("token: %u\n", param.SendActionFrameResult.FrameParameters.DialogToken)); } - + // generate TLV GenerateWdiIndicationP2pSendRequestActionFrameComplete( - ¶m, 0, - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, 0, + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &len, &tlv); - + // copy tlv wdi_task_WriteResult(hTask, tlv, len, status); @@ -5337,10 +5337,10 @@ WDI_CMD_P2pSendResponseActionFrameComplete( { RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; OFF_CHNL_TX_STATUS_FLAG txStatusFlag; - + u4Byte ieOffset = FRAME_OFFSET_P2P_PUB_ACT_ELEMENTS; NDIS_STATUS status = NDIS_STATUS_SUCCESS; - + UINT8 *tlv = NULL; ULONG len = 0; @@ -5351,13 +5351,13 @@ WDI_CMD_P2pSendResponseActionFrameComplete( status = (TEST_FLAG(txStatusFlag.perTxAttemptFlag, OFF_CHNL_TX_PER_TX_ATTEMPT_FLAG_FRAME_SENT) ? NDIS_STATUS_SUCCESS : NDIS_STATUS_FAILURE); FunctionIn(COMP_OID_SET); - + if(NDIS_STATUS_SUCCESS == status) { FRAME_BUF *buf = OffChnlTx_GetTxFrameBuf(ctx->req); RT_ASSERT(buf, ("%s(): buf is NULL!!!n", __FUNCTION__)); - + cpMacAddr(param.SendActionFrameResult.FrameParameters.PeerDeviceAddress.Address, (FrameBuf_Head(buf) + FRAME_OFFSET_ADDRESS1)); param.SendActionFrameResult.FrameParameters.DialogToken = ctx->token; param.SendActionFrameResult.FrameIEs.ElementCount = FrameBuf_Length(buf) - ieOffset; @@ -5365,13 +5365,13 @@ WDI_CMD_P2pSendResponseActionFrameComplete( RT_TRACE_F(COMP_OID_SET, DBG_LOUD, ("token: %u\n", param.SendActionFrameResult.FrameParameters.DialogToken)); } - + // generate TLV GenerateWdiIndicationP2pSendResponseActionFrameComplete( - ¶m, 0, - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, 0, + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &len, &tlv); - + // copy tlv wdi_task_WriteResult(hTask, tlv, len, status); @@ -5391,11 +5391,11 @@ WDI_CMD_SendReqActionFrameComplete( IN PADAPTER pAdapter, IN const WDI_SEND_ACTION_CTX *ctx ) -{ +{ NDIS_STATUS status = NDIS_STATUS_SUCCESS; RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; OFF_CHNL_TX_STATUS_FLAG txStatusFlag = {0}; - + UINT8 *tlv = NULL; ULONG len = 0; @@ -5413,13 +5413,13 @@ WDI_CMD_SendReqActionFrameComplete( { RT_TRACE(COMP_MLME, DBG_WARNING, ("Action Req frame send failure.\n")); } - + #if 0 //GenerateWdiIndicationSendRequestActionFrameComplete( - // ¶m, 0, - // &pAdapter->pPortCommonInfo->WdiData.TlvContext, + // ¶m, 0, + // &pAdapter->pPortCommonInfo->WdiData.TlvContext, // &len, &tlv); - + wdi_task_WriteResult(hTask, tlv, len, status); FreeGenerated(tlv); @@ -5434,11 +5434,11 @@ WDI_CMD_SendRspActionFrameComplete( IN PADAPTER pAdapter, IN const WDI_SEND_ACTION_CTX *ctx ) -{ +{ NDIS_STATUS status = NDIS_STATUS_SUCCESS; RT_OID_HANDLER *hTask = &pAdapter->pPortCommonInfo->WdiData.TaskHandle; OFF_CHNL_TX_STATUS_FLAG txStatusFlag = {0}; - + UINT8 *tlv = NULL; ULONG len = 0; @@ -5453,13 +5453,13 @@ WDI_CMD_SendRspActionFrameComplete( { RT_TRACE(COMP_MLME, DBG_WARNING, ("Action Rsp frame send failure.\n")); } - + #if 0 GenerateWdiIndicationSendRequestActionFrameComplete( - ¶m, 0, - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, 0, + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &len, &tlv); - + wdi_task_WriteResult(hTask, tlv, len, status); FreeGenerated(tlv); @@ -5487,11 +5487,13 @@ WDI_CMD_SendApAssociationResponseComplete( FunctionIn(COMP_MLME); // prepare structure, ref N62CAPIndicateIncomAssocComplete +#if !defined(NTDDI_WIN10_RS3) param.Optional.ActivePhyList_IsPresent = FALSE; +#endif cpMacAddr(param.AssocResponseResult.PeerMACAddress.Address, sta->MacAddr); - param.AssocResponseResult.IsReassociationRequest = + param.AssocResponseResult.IsReassociationRequest = Type_Reasoc_Rsp == GET_80211_HDR_TYPE(sta->AP_SendAsocResp) ? TRUE : FALSE; - param.AssocResponseResult.IsReAssociationResponse = + param.AssocResponseResult.IsReAssociationResponse = param.AssocResponseResult.IsReassociationRequest; if(RT_802_11AuthModeOpen == sta->AuthMode) param.AssocResponseResult.AuthAlgorithm = WDI_AUTH_ALGO_80211_OPEN; @@ -5509,7 +5511,7 @@ WDI_CMD_SendApAssociationResponseComplete( param.AssocResponseResult.AuthAlgorithm = WDI_AUTH_ALGO_WPA_NONE; else if(RT_802_11AuthModeWPA2PSK == sta->AuthMode) param.AssocResponseResult.AuthAlgorithm = WDI_AUTH_ALGO_WPA_PSK; - else + else param.AssocResponseResult.AuthAlgorithm = WDI_AUTH_ALGO_80211_OPEN; if(RT_ENC_ALG_NO_CIPHER == sta->perSTAKeyInfo.PairwiseCipherSuite[0]) @@ -5543,7 +5545,7 @@ WDI_CMD_SendApAssociationResponseComplete( param.AssocResponseResult.UnicastCipherAlgorithm = WDI_CIPHER_ALGO_NONE; param.AssocResponseFrame.ElementCount = MMPDU_BODY_LEN(sta->AP_SendAsocRespLength); - param.AssocResponseFrame.pElements = MMPDU_BODY(sta->AP_SendAsocResp); + param.AssocResponseFrame.pElements = MMPDU_BODY(sta->AP_SendAsocResp); if(pAdapter->MgntInfo.beaconframe.Length) { @@ -5555,13 +5557,13 @@ WDI_CMD_SendApAssociationResponseComplete( param.BeaconIEs.ElementCount = 0; param.BeaconIEs.pElements = NULL; } - + // generate TLV GenerateWdiIndicationSendApAssociationResponseComplete( - ¶m, 0, - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, 0, + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &len, &tlv); - + // copy tlv wdi_task_WriteResult(hTask, tlv, len, status); @@ -5569,7 +5571,7 @@ WDI_CMD_SendApAssociationResponseComplete( FreeGenerated(tlv); ndisStatus = WDI_AddDatapathPeer(pAdapter, sta->MacAddr); - + // Free the OID Wdi_Xlat_FreeOid(req); @@ -5577,7 +5579,7 @@ WDI_CMD_SendApAssociationResponseComplete( OidHandle_Complete(pAdapter, OIDHANDLE_TYPE_TASK); if( ndisStatus != NDIS_STATUS_SUCCESS ) - { + { RT_TRACE(COMP_MLME, DBG_WARNING, ("WDI_CMD_SendApAssociationResponseComplete: fail to create peer, so disconnect with this AP[%2x:%2x:%2x:%2x:%2x:%2x]\n", sta->MacAddr[0], sta->MacAddr[1], sta->MacAddr[2], sta->MacAddr[3], sta->MacAddr[4], sta->MacAddr[5])); // 1. Send disassoc frame to the STA. @@ -5612,7 +5614,7 @@ WDI_CMD_PreIndicateRxP2pActionFrameCb( ADAPTER *pAdapter = pP2PInfo->pAdapter; FunctionIn(COMP_OID_SET); - + if(P2P_EVENT_RECEIVED_PROVISION_DISCOVERY_RESPONSE == EventID || P2P_EVENT_RECEIVED_INVITATION_RESPONSE == EventID || P2P_EVENT_RECEIVED_GO_NEGOTIATION_RESPONSE == EventID @@ -5621,7 +5623,7 @@ WDI_CMD_PreIndicateRxP2pActionFrameCb( { WDI_SendAction_TerminateReq(pAdapter); } - + FunctionOut(COMP_OID_SET); return; @@ -5732,7 +5734,7 @@ WDI_CANCEL_OID_TASK_SEND_RESPONSE_ACTION_FRAME( return NDIS_STATUS_SUCCESS; } -NDIS_STATUS +NDIS_STATUS WDI_PRE_M4_OID_TASK_SCAN( IN PADAPTER pAdapter, IN PRT_OID_HANDLER pOidHandle diff --git a/network/wlan/WDI/PLATFORM/NDIS6/WDI_Common.c b/network/wlan/WDI/PLATFORM/NDIS6/WDI_Common.c index 1b478b21..bfb1cce8 100644 --- a/network/wlan/WDI/PLATFORM/NDIS6/WDI_Common.c +++ b/network/wlan/WDI/PLATFORM/NDIS6/WDI_Common.c @@ -24,7 +24,7 @@ wdi_UnsolicitedIndication( NDIS_OID_REQUEST *req = NULL; RT_TRACE(COMP_MLME, DBG_LOUD, ("==>wdi_UnsolicitedIndication(): status indication code = %x, length=%d\n", Indication, Length)); - + indic = (NDIS_STATUS_INDICATION *)pInput; wdiHdr = (WDI_MESSAGE_HEADER *)(pInput + sizeof(*indic)); @@ -59,12 +59,12 @@ wdi_UnsolicitedIndication( pAdapter->pNdisCommon->hNdisAdapter, indic ); - + RT_TRACE(COMP_MLME, DBG_LOUD, ("<== wdi_UnsolicitedIndication()\n")); } // -// The following helper functions are used to determined if a +// The following helper functions are used to determined if a // BSS has the capability of specific wireless mode. // 2005.01.13, by rcnjko. // @@ -106,7 +106,7 @@ WDIWithWirelessG( { return FALSE; } - + // Check supported rates. for(i = 0; i < pRtBss->bdSupportRateEXLen; i++) { @@ -119,12 +119,12 @@ WDIWithWirelessG( } // Check if it contains ERP information element. - // Some AP, WAG-302, will not always claim OFDM rates in their ProbeRsp or Beacon + // Some AP, WAG-302, will not always claim OFDM rates in their ProbeRsp or Beacon // but it is in G mode. 2005.08.23, by rcnjko. if(pRtBss->bERPInfoValid) { return TRUE; - } + } return FALSE; } @@ -158,7 +158,7 @@ WDIWithWirelessA( //// // This routine determine if we should report the BSS scanned -// to upper layer. +// to upper layer. // 2005.01.13, by rcnjko. // BOOLEAN @@ -169,19 +169,19 @@ WDIFilterRtBss( { PRT_NDIS6_COMMON pNdisCommon = Adapter->pNdisCommon; BOOLEAN bAcceptable = TRUE; - BOOLEAN bHasB, bHasG, bHasA; + BOOLEAN bHasB, bHasG, bHasA; // Determine the capability of wireless mode of the BSS. bHasB = WDIWithWirelessB(pRtBss); bHasG = WDIWithWirelessG(pRtBss); bHasA = WDIWithWirelessA(pRtBss); - - // - // 1. Maybe we may need to use a table in the future. + + // + // 1. Maybe we may need to use a table in the future. // 2. Currently, we only consider B/G case. if( bHasB && !bHasG && !bHasA ) { // The BSS is pure B. - if( pNdisCommon->RegWirelessMode4ScanList == WIRELESS_MODE_G || + if( pNdisCommon->RegWirelessMode4ScanList == WIRELESS_MODE_G || pNdisCommon->RegWirelessMode4ScanList == WIRELESS_MODE_A ) { // We are pure A or pure G. bAcceptable = FALSE; @@ -219,7 +219,7 @@ wdiext_IndicateP2PDeviceFound( // get info of last rx frame if(RTIsListEmpty(&dev->rxFrameQ)) return; - + if(!pAdapter->pPortCommonInfo->WdiData.TaskHandle.pNdisRequest) return; @@ -280,13 +280,13 @@ wdiext_IndicateP2PDeviceFound( // Gen tlv if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationBssEntryList( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) return; - wdi_UnsolicitedIndication(pAdapter, + wdi_UnsolicitedIndication(pAdapter, FALSE, (PVOID)req->RequestId, NDIS_STATUS_WDI_INDICATION_BSS_ENTRY_LIST, @@ -302,7 +302,7 @@ wdiext_IndicateP2PDeviceFound( VOID wdiext_IndicateP2PActionFrameReceived( - IN VOID *pvP2PInfo, + IN VOID *pvP2PInfo, IN u4Byte eid, IN MEMORY_BUFFER *info ) @@ -346,22 +346,22 @@ wdiext_IndicateP2PActionFrameReceived( param.FrameInfo.FrameParams.ActionFrameType = WDI_P2P_ACTION_FRAME_INVITATION_RESPONSE; else return; - + cpMacAddr(param.FrameInfo.FrameParams.PeerDeviceAddress.Address, evtData->Packet.Buffer + FRAME_OFFSET_ADDRESS2); param.FrameInfo.FrameParams.DialogToken = *(evtData->Packet.Buffer + FRAME_OFFSET_P2P_PUB_ACT_DIALOG_TOKEN); param.FrameInfo.FrameIEs.ElementCount = evtData->Packet.Length - ieOffset; param.FrameInfo.FrameIEs.pElements = evtData->Packet.Buffer + ieOffset; } - + // gen TLV if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationP2pActionFrameReceived( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) return; - wdi_UnsolicitedIndication(pAdapter, + wdi_UnsolicitedIndication(pAdapter, FALSE, NULL, NDIS_STATUS_WDI_INDICATION_P2P_ACTION_FRAME_RECEIVED, @@ -371,7 +371,7 @@ wdiext_IndicateP2PActionFrameReceived( // cleanup FreeGenerated((UINT8 *)buf); - + FunctionOut(COMP_OID_SET); return; @@ -394,7 +394,7 @@ wdiext_IndicateBSSEntry( WDI_MESSAGE_HEADER *reqWdiHdr = NULL; u4Byte devSpecCtx = 0x07060504; LARGE_INTEGER CurrentTime; - + if(!pAdapter->pPortCommonInfo->WdiData.TaskHandle.pNdisRequest) return; @@ -417,7 +417,7 @@ wdiext_IndicateBSSEntry( RT_TRACE(COMP_MLME, DBG_LOUD, ("Indicate actual scan result of BSS list\n")); MgntActQuery_802_11_BSSID_LIST(pAdapter, &RtBssList, TRUE); #endif - } + } req = pAdapter->pPortCommonInfo->WdiData.TaskHandle.pNdisRequest; reqWdiHdr = (WDI_MESSAGE_HEADER *)req->DATA.METHOD_INFORMATION.InformationBuffer; @@ -468,7 +468,7 @@ wdiext_IndicateBSSEntry( else { FunctionOut(COMP_MLME); - return; + return; } // WDI_SIGNAL_INFO_CONTAINER SignalInfo @@ -487,23 +487,23 @@ wdiext_IndicateBSSEntry( entry.DeviceSpecificContext.pElements = (UINT8 *)&devSpecCtx; NdisGetCurrentSystemTime(&CurrentTime); - + // WDI_AGE_INFO_CONTAINER EntryAgeInfo entry.EntryAgeInfo.HostTimeStamp = CurrentTime.QuadPart;// [SDIO-482] in JIRA entry.EntryAgeInfo.CachedInformation = 0; // Gen tlv if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationBssEntryList( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) { FunctionOut(COMP_MLME); return; } - - wdi_UnsolicitedIndication(pAdapter, + + wdi_UnsolicitedIndication(pAdapter, FALSE, (PVOID)req->RequestId, NDIS_STATUS_WDI_INDICATION_BSS_ENTRY_LIST, @@ -516,7 +516,7 @@ wdiext_IndicateBSSEntry( } FunctionOut(COMP_MLME); - + return; } @@ -539,7 +539,7 @@ wdiext_IndicateBSSEntryBySSID( u4Byte devSpecCtx = 0x07060504; BOOL bWildCardSSID = TRUE; LARGE_INTEGER CurrentTime; - + if(!pAdapter->pPortCommonInfo->WdiData.TaskHandle.pNdisRequest) return; @@ -565,7 +565,7 @@ wdiext_IndicateBSSEntryBySSID( RT_TRACE(COMP_MLME, DBG_LOUD, ("Indicate actual scan result of BSS list\n")); MgntActQuery_802_11_BSSID_LIST(pAdapter, &RtBssList, TRUE); #endif - } + } req = pAdapter->pPortCommonInfo->WdiData.TaskHandle.pNdisRequest; reqWdiHdr = (WDI_MESSAGE_HEADER *)req->DATA.METHOD_INFORMATION.InformationBuffer; @@ -626,7 +626,7 @@ wdiext_IndicateBSSEntryBySSID( else { FunctionOut(COMP_MLME); - return; + return; } // WDI_SIGNAL_INFO_CONTAINER SignalInfo @@ -645,23 +645,23 @@ wdiext_IndicateBSSEntryBySSID( entry.DeviceSpecificContext.pElements = (UINT8 *)&devSpecCtx; NdisGetCurrentSystemTime(&CurrentTime); - + // WDI_AGE_INFO_CONTAINER EntryAgeInfo entry.EntryAgeInfo.HostTimeStamp = CurrentTime.QuadPart;// [SDIO-482] in JIRA entry.EntryAgeInfo.CachedInformation = 0; // Gen tlv if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationBssEntryList( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) { FunctionOut(COMP_MLME); return; } - - wdi_UnsolicitedIndication(pAdapter, + + wdi_UnsolicitedIndication(pAdapter, FALSE, (PVOID)req->RequestId, NDIS_STATUS_WDI_INDICATION_BSS_ENTRY_LIST, @@ -674,7 +674,7 @@ wdiext_IndicateBSSEntryBySSID( } FunctionOut(COMP_MLME); - + return; } @@ -720,7 +720,7 @@ wdiext_IndicateAssociationResult( else AssocComeBackTime = 0; } - else + else AssocComeBackTime = 0; if(pMgntInfo->dot11CurrentChannelNumber < 36) BandID = WDI_BAND_ID_2400; @@ -736,7 +736,7 @@ wdiext_IndicateAssociationResult( case WIRELESS_MODE_A: PhyType = WDI_PHY_TYPE_OFDM; break; - + case WIRELESS_MODE_G: PhyType = WDI_PHY_TYPE_ERP; break; @@ -757,7 +757,7 @@ wdiext_IndicateAssociationResult( PhyType = WDI_PHY_TYPE_VHT; break; - + } PlatformZeroMemory(&AsocResult, sizeof(WDI_ASSOCIATION_RESULT_CONTAINER)); @@ -787,12 +787,14 @@ wdiext_IndicateAssociationResult( AsocResult.Optional.BeaconProbeResponse_IsPresent = TRUE; AsocResult.BeaconProbeResponse.ElementCount = MMPDU_BODY_LEN(pMgntInfo->AsocInfo.BeaconLength); AsocResult.BeaconProbeResponse.pElements = MMPDU_BODY(pMgntInfo->AsocInfo.Beacon); +#if 0 AsocResult.Optional.ActivePhyTypeList_IsPresent = TRUE; +#endif AsocResult.ActivePhyTypeList.ElementCount = 1; AsocResult.ActivePhyTypeList.pElements = &PhyType; ndisStatus = GenerateWdiIndicationAssociationResult( - &AsocResultList, + &AsocResultList, sizeof(NDIS_STATUS_INDICATION)+sizeof(WDI_MESSAGE_HEADER), &pAdapter->pPortCommonInfo->WdiData.TlvContext, &length, @@ -802,10 +804,10 @@ wdiext_IndicateAssociationResult( RT_TRACE(COMP_MLME, DBG_LOUD, ("GenerateWdiIndicationAssociationResult(): return length %d\n", length)); RT_PRINT_DATA(COMP_MLME, DBG_TRACE, ("buffer\n"), pOutput, length); RT_TRACE(COMP_MLME, DBG_LOUD, ("SendUnsolictedIndication(): EthertypeEncapTable_IsPresent %d\n", AsocResult.Optional.EthertypeEncapTable_IsPresent)); - + ndisStatus = WDI_AddDatapathPeer(pAdapter, AsocResult.BSSID.Address); - - wdi_UnsolicitedIndication(pAdapter, + + wdi_UnsolicitedIndication(pAdapter, FALSE, (PVOID)pAdapter->pPortCommonInfo->WdiData.TaskHandle.pNdisRequest->RequestId, NDIS_STATUS_WDI_INDICATION_ASSOCIATION_RESULT, @@ -833,7 +835,7 @@ wdiext_IndicateAssociationResult( // RT_STATUS wdiext_IndicateFtAssocNeeded( - IN PADAPTER pAdapter + IN PADAPTER pAdapter ) { RT_STATUS rtStatus = RT_STATUS_SUCCESS; @@ -851,18 +853,18 @@ wdiext_IndicateFtAssocNeeded( { RT_TRACE_F(COMP_INDIC, DBG_WARNING, ("Too short of AuthSeq2Length = %d\n", pMgntInfo->AsocInfo.AuthSeq1Length)); rtStatus = RT_STATUS_INVALID_DATA; - break; + break; } if(pMgntInfo->AsocInfo.AuthSeq2Length < sMacHdrLng) { RT_TRACE_F(COMP_INDIC, DBG_WARNING, ("Too short of AuthSeq2Length = %d\n", pMgntInfo->AsocInfo.AuthSeq2Length)); rtStatus = RT_STATUS_INVALID_DATA; - break; + break; } cpMacAddr(param.BssId.Address, pMgntInfo->Bssid); - + param.AuthRequest.ElementCount = MMPDU_BODY_LEN(pMgntInfo->AsocInfo.AuthSeq1Length); param.AuthRequest.pElements = MMPDU_BODY(pMgntInfo->AsocInfo.AuthSeq1); @@ -870,21 +872,21 @@ wdiext_IndicateFtAssocNeeded( param.AuthResponse.pElements = MMPDU_BODY(pMgntInfo->AsocInfo.AuthSeq2); // Gen tlv - if(NDIS_STATUS_SUCCESS != (ndisStatus = + if(NDIS_STATUS_SUCCESS != (ndisStatus = GenerateWdiIndicationFtAssocParamsNeeded( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &indicBufLen, &((UINT8 *)pIndicBuf)))) { RT_TRACE_F(COMP_INDIC, DBG_SERIOUS, ("Fail (ndisStatus = 0x%08X) from GenerateWdiIndicationFtAssocParamsNeeded()\n", ndisStatus)); rtStatus = RT_STATUS_OS_API_FAILED; - break; + break; } RT_PRINT_DATA(COMP_INDIC, DBG_LOUD, "NDIS_STATUS_WDI_INDICATION_FT_ASSOC_PARAMS_NEEDED:\n", pIndicBuf, indicBufLen); - wdi_UnsolicitedIndication(pAdapter, + wdi_UnsolicitedIndication(pAdapter, FALSE, NULL, NDIS_STATUS_WDI_INDICATION_FT_ASSOC_PARAMS_NEEDED, @@ -930,8 +932,8 @@ wdiext_IndicateDisassociation( param.Optional.NeedPeerStateCleanup_IsPresent = FALSE; cpMacAddr(param.DisconnectIndicationParameters.MacAddress.Address, addr); - param.DisconnectIndicationParameters.DisassociationWABIReason = bDisassoc - ? WDI_ASSOC_STATUS_PEER_DISASSOCIATED + param.DisconnectIndicationParameters.DisassociationWABIReason = bDisassoc + ? WDI_ASSOC_STATUS_PEER_DISASSOCIATED : WDI_ASSOC_STATUS_PEER_DEAUTHENTICATED; if(frameLen) @@ -947,23 +949,23 @@ wdiext_IndicateDisassociation( param.DeauthFrame.pElements = frame + sMacHdrLng; } } - + // Gen tlv if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationDisassociation( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) return; - wdi_UnsolicitedIndication(pAdapter, + wdi_UnsolicitedIndication(pAdapter, FALSE, NULL, NDIS_STATUS_WDI_INDICATION_DISASSOCIATION, NDIS_STATUS_SUCCESS, buf, buflen); - + // cleanup FreeGenerated((UINT8 *)buf); @@ -987,24 +989,24 @@ wdiext_IndicateRadioStatus( Params.RadioState.HardwareState = (pMgntInfo->RfOffReason&RF_CHANGE_BY_HW)?0:1; RT_TRACE(COMP_RF, DBG_LOUD, ("wdiext_IndicateRadioStatus(): Params.RadioState.SoftwareState is %d, Params.RadioState.HardwareState is %d\n", Params.RadioState.SoftwareState, Params.RadioState.HardwareState)); - + ndisStatus = GenerateWdiIndicationRadioStatus( &Params, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), &pAdapter->pPortCommonInfo->WdiData.TlvContext, &length, &pOutput); if(NDIS_STATUS_SUCCESS == ndisStatus) { - wdi_UnsolicitedIndication(pAdapter, + wdi_UnsolicitedIndication(pAdapter, TRUE, NULL, NDIS_STATUS_WDI_INDICATION_RADIO_STATUS, NDIS_STATUS_SUCCESS, pOutput, length); - + FreeGenerated(pOutput); pOutput = NULL; } @@ -1023,7 +1025,7 @@ wdiext_IndicateLinkStateChanged( PUCHAR pOutput = NULL; ULONG length = 0; NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; - + if (pMgntInfo->mAssoc || pMgntInfo->mIbss) { Params.LinkStateChangeParameters.LinkQuality = GetSignalQuality(pAdapter); @@ -1044,7 +1046,7 @@ wdiext_IndicateLinkStateChanged( RT_TRACE(COMP_MLME, DBG_LOUD, ("wdiext_IndicateLinkStateChanged(): Params.LinkStateChangeParameters.TxLinkSpeed is %d\n", Params.LinkStateChangeParameters.TxLinkSpeed)); RT_TRACE(COMP_MLME, DBG_LOUD, ("wdiext_IndicateLinkStateChanged(): Params.LinkStateChangeParameters.RxLinkSpeed is %d\n", Params.LinkStateChangeParameters.RxLinkSpeed)); - + ndisStatus = GenerateWdiIndicationLinkStateChange( &Params, sizeof(NDIS_STATUS_INDICATION)+sizeof(WDI_MESSAGE_HEADER), @@ -1080,7 +1082,7 @@ wdiext_IndicateRoamingNeeded( NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; pMgntInfo->bPrepareRoaming = TRUE; - + Params.RoamingReason = IndicationReason; RT_TRACE_F(COMP_MLME, DBG_LOUD, ("Params.RoamingReason %d\n", Params.RoamingReason)); @@ -1143,20 +1145,20 @@ wdiext_IndicateP2POpChnl( // Gen tlv if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationP2pGroupOperatingChannel( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) return; - wdi_UnsolicitedIndication(pAdapter, + wdi_UnsolicitedIndication(pAdapter, FALSE, (PVOID)req->RequestId, NDIS_STATUS_WDI_INDICATION_P2P_GROUP_OPERATING_CHANNEL, NDIS_STATUS_SUCCESS, buf, buflen); - + // cleanup FreeGenerated((UINT8 *)buf); @@ -1173,7 +1175,7 @@ wdi_FindGroupPeerByPort( PADAPTER pDefaultAdapter = GetDefaultAdapter(pAdapter); PRT_PEER_ENTRY pPeerEntry = NULL; u1Byte i; - + for(i = 0; i < MP_DEFAULT_NUMBER_OF_PORT; i++) { pPeerEntry = &pDefaultAdapter->RxPeerTable[i]; @@ -1185,7 +1187,7 @@ wdi_FindGroupPeerByPort( } } } - + return NULL; } @@ -1198,24 +1200,24 @@ wdi_FindPeerByAddr( PADAPTER pDefaultAdapter = GetDefaultAdapter(pAdapter); PRT_PEER_ENTRY pPeerEntry = NULL; u1Byte i = 0, count = 0; - + count = pDefaultAdapter->RxPeerUsedCount; for(i = MP_DEFAULT_NUMBER_OF_PORT; i < MAX_PEER_NUM; i++) { if( count == 0 ) break; - + pPeerEntry = &pDefaultAdapter->RxPeerTable[i]; if( pPeerEntry->bUsed == TRUE ) { - count--; + count--; if( PlatformCompareMemory(pPeerEntry->PeerAddr, pAddr, 6) == 0 ) { return (PVOID)pPeerEntry; } } } - + return NULL; } @@ -1230,18 +1232,18 @@ wdi_GetAvailablePeer( PRT_PEER_ENTRY pCurPeerEntry = NULL, pPeerEntry = NULL; u1Byte i = 0, UnusedIndex = 0, count = 0; BOOLEAN bFound = FALSE; - + FunctionIn(COMP_MLME); - + count = pDefaultAdapter->RxPeerUsedCount; - + for(i = MP_DEFAULT_NUMBER_OF_PORT; i < MAX_PEER_NUM; i++) { if( (count == 0) && (bFound == TRUE) ) break; - + pPeerEntry = &pDefaultAdapter->RxPeerTable[i]; - + if( (pPeerEntry->bUsed == FALSE) && (bFound == FALSE) ) { bFound = TRUE; @@ -1252,32 +1254,32 @@ wdi_GetAvailablePeer( count--; if( PlatformCompareMemory(pPeerEntry->PeerAddr, pAddr, 6) == 0 ) { - RT_TRACE(COMP_MLME, DBG_WARNING, ("wdi_GetAvailablePeer: The addres [%2x:%2x:%2x:%2x:%2x:%2x] had associated with specified Peer %d\n", pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5], pPeerEntry->uPeerId)); + RT_TRACE(COMP_MLME, DBG_WARNING, ("wdi_GetAvailablePeer: The addres [%2x:%2x:%2x:%2x:%2x:%2x] had associated with specified Peer %d\n", pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5], pPeerEntry->uPeerId)); FunctionOut(COMP_MLME); return (PVOID)pPeerEntry; } } } - + if( (i == MAX_PEER_NUM) && (bFound == FALSE) ) { - RT_TRACE(COMP_MLME, DBG_WARNING, ("wdi_GetAvailablePeer: Peer is already full, so cannot find an unused peer to associate [%2x:%2x:%2x:%2x:%2x:%2x]\n", pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5])); + RT_TRACE(COMP_MLME, DBG_WARNING, ("wdi_GetAvailablePeer: Peer is already full, so cannot find an unused peer to associate [%2x:%2x:%2x:%2x:%2x:%2x]\n", pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5])); FunctionOut(COMP_MLME); return NULL; } - + pDefaultAdapter->RxPeerUsedCount++; - + pCurPeerEntry = &pDefaultAdapter->RxPeerTable[UnusedIndex]; pCurPeerEntry->bUsed = TRUE; pCurPeerEntry->uPeerId = UnusedIndex; pCurPeerEntry->uPortId = (u2Byte)PortId; PlatformMoveMemory(pCurPeerEntry->PeerAddr, pAddr, 6); - RT_TRACE(COMP_MLME, DBG_LOUD, ("wdi_GetAvailablePeer: Port %d associate the addres [%2x:%2x:%2x:%2x:%2x:%2x] at Peer %d\n", (u2Byte)PortId, pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5], UnusedIndex)); - + RT_TRACE(COMP_MLME, DBG_LOUD, ("wdi_GetAvailablePeer: Port %d associate the addres [%2x:%2x:%2x:%2x:%2x:%2x] at Peer %d\n", (u2Byte)PortId, pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5], UnusedIndex)); + FunctionOut(COMP_MLME); - + return (PVOID)pCurPeerEntry; } @@ -1299,17 +1301,17 @@ wdi_NotifyPeerData( WDI_EXTENDED_TID ExtendTid = (WDI_EXTENDED_TID)ExTid; KIRQL Irql = 0; BOOLEAN bLackResource = FALSE; - + PlatformAcquireSpinLock(pAdapter, RT_RX_CONTROL_SPINLOCK); if( (pNdisCommon->bRxControlState != RT_RX_STOP) && (pDefaultNdisCommon->bRxDataPathState != RT_RX_PAUSE) ) - { + { pNdisCommon->bRxControlState = RT_RX_NOTIFYING; PlatformReleaseSpinLock(pAdapter, RT_RX_CONTROL_SPINLOCK); - + PlatformAcquireSpinLock(pAdapter, RT_RX_SPINLOCK); bLackResource = RxCheckResource(pAdapter)?FALSE:TRUE; PlatformReleaseSpinLock(pAdapter, RT_RX_SPINLOCK); - + if( bLackResource ) RT_TRACE(COMP_RECV, DBG_WARNING, ("wdi_NotifyPeerData(): RFD is less than lower bound (%d)\n", RFD_LOWER_BOUND)); @@ -1349,7 +1351,7 @@ wdi_NotifyPeerData( } pTempAdapter = GetNextExtAdapter(pTempAdapter); }while(pTempAdapter != NULL ); - + PlatformReleaseSpinLock(pAdapter, RT_RX_CONTROL_SPINLOCK); RT_TRACE(COMP_INIT, DBG_WARNING, ("Driver call RxStopConfirm for Rx manager\n")); pWdi->WdiDataApi.RxStopConfirm(pWdi->DataPathHandle); @@ -1395,23 +1397,23 @@ WDI_Initialize( // WorkAround for 0x9F BSOD pMChars->ResetHandlerEx = N6SdioReset; - + RtlZeroMemory(&WdiChar, sizeof(WdiChar)); WdiChar.WdiVersion = WDI_VERSION_LATEST; WdiChar.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_WDI_CHARACTERISTICS, WdiChar.Header.Size = NDIS_SIZEOF_MINIPORT_WDI_CHARACTERISTICS_REVISION_1; - WdiChar.Header.Revision = NDIS_MINIPORT_DRIVER_WDI_CHARACTERISTICS_REVISION_1; + WdiChar.Header.Revision = NDIS_MINIPORT_DRIVER_WDI_CHARACTERISTICS_REVISION_1; WdiChar.AllocateAdapterHandler = N6SdioWdi_AllocateAdapter; WdiChar.FreeAdapterHandler = N6SdioWdi_FreeAdapter; - WdiChar.OpenAdapterHandler = N6SdioWdi_OpenAdapter; - WdiChar.CloseAdapterHandler = N6SdioWdi_CloseAdapter; + WdiChar.OpenAdapterHandler = N6SdioWdi_OpenAdapter; + WdiChar.CloseAdapterHandler = N6SdioWdi_CloseAdapter; WdiChar.TalTxRxInitializeHandler = N6SdioWdi_TalTxRxInitialize; WdiChar.TalTxRxDeinitializeHandler = N6SdioWdi_TalTxRxDeinitialize; - WdiChar.HangDiagnoseHandler = N6SdioWdi_HangDiagnose; + WdiChar.HangDiagnoseHandler = N6SdioWdi_HangDiagnose; // Optional handler WdiChar.StartOperationHandler = N6SdioWdi_StartOperation; @@ -1432,7 +1434,7 @@ WDI_Initialize( VOID -WDI_DeInitialize( +WDI_DeInitialize( IN NDIS_HANDLE DriverHandle ) { @@ -1440,7 +1442,7 @@ WDI_DeInitialize( } VOID -WDI_InitRxQueue( +WDI_InitRxQueue( IN PADAPTER pAdapter ) { @@ -1463,14 +1465,14 @@ WDI_InitRxQueue( } VOID -WDI_DeInitRxQueue( +WDI_DeInitRxQueue( IN PADAPTER pAdapter ) { PADAPTER pDefaultAdapter = GetDefaultAdapter(pAdapter); u2Byte index = 0; PNET_BUFFER_LIST pNetBufferList=NULL; - + RT_TRACE(COMP_INIT, DBG_LOUD, ("[WDI], WDI_DeInitRxQueue() ==> \n")); PlatformAcquireSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); for(index=0; indexpPortCommonInfo->WdiData); - + if( pWdi->TaskHandle.Status & RT_OID_HANDLER_STATUS_SET ) { OidHandle_Complete(pAdapter, OIDHANDLE_TYPE_TASK); @@ -1541,11 +1543,11 @@ WdiExt_IndicateApAssocReqReceived( PlatformZeroMemory(¶m, sizeof(param)); - cpMacAddr(param.IncomingRequestInfo.AssocRequestParams.PeerMacAddress.Address, + cpMacAddr(param.IncomingRequestInfo.AssocRequestParams.PeerMacAddress.Address, assocReq + FRAME_OFFSET_ADDRESS2 ); - param.IncomingRequestInfo.AssocRequestParams.IsReassociationRequest = + param.IncomingRequestInfo.AssocRequestParams.IsReassociationRequest = (Type_Reasoc_Req == GET_80211_HDR_TYPE(assocReq)) ? TRUE : FALSE; FillOctetString(osAssocReq, assocReq, (u2Byte)assocReqLen); @@ -1561,20 +1563,20 @@ WdiExt_IndicateApAssocReqReceived( // Gen tlv if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationApAssociationRequestReceived( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) return; - wdi_UnsolicitedIndication(pAdapter, + wdi_UnsolicitedIndication(pAdapter, FALSE, NULL, NDIS_STATUS_WDI_INDICATION_AP_ASSOCIATION_REQUEST_RECEIVED, NDIS_STATUS_SUCCESS, buf, buflen); - + // cleanup FreeGenerated((UINT8 *)buf); @@ -1593,16 +1595,16 @@ WdiExt_IndicateApAssocRspSent( if(FALSE == OidHandle_VerifyTask(pAdapter, OID_WDI_TASK_SEND_AP_ASSOCIATION_RESPONSE)) { - RT_TRACE(COMP_OID_SET, DBG_WARNING, + RT_TRACE(COMP_OID_SET, DBG_WARNING, ("WdiExt_IndicateApAssocRspSent(): skip indication because OidHandle_VerifyTask() returns FALSE\n")); return; } - + if(task->pvCtx) { if(WDI_CMD_SendApAssociationResponseComplete( - pAdapter, - (NDIS_OID_REQUEST *)task->pvCtx, + pAdapter, + (NDIS_OID_REQUEST *)task->pvCtx, StatusCode_success == status ? RT_STATUS_SUCCESS : RT_STATUS_FAILURE)) {// set pvCtx to NULL only when it is freed in WDI_CMD_SendApAssociationResponseComplete task->pvCtx = NULL; @@ -1621,18 +1623,18 @@ WDIAllocateMetaData( { PWDI_DATA_STRUCT pWdi = &(pAdapter->pPortCommonInfo->WdiData); PWDI_FRAME_METADATA pWdiFrameMeta = NULL; - + pWdiFrameMeta = pWdi->WdiDataApi.AllocateWiFiFrameMetaData(pWdi->DataPathHandle); if( pWdiFrameMeta == NULL ) return RT_STATUS_FAILURE; pWdiFrameMeta->u.rxMetaData.PayloadType = WDI_FRAME_MSDU; pWdiFrameMeta->pNBL = pNBL; - + RT_TRACE(COMP_RECV, DBG_TRACE, ("PayloadType %d\n", pWdiFrameMeta->u.rxMetaData.PayloadType)); MP_SET_PACKET_RFD_RESERVED_0(pNBL, pWdiFrameMeta); - + return RT_STATUS_SUCCESS; } @@ -1673,7 +1675,7 @@ WDI_InsertDataInQueue( FillOctetString(osMpdu, pRfd->Buffer.VirtualAddress + pRfd->FragOffset, pRfd->FragLength); PlatformAcquireSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); - + /**************************************************************************************************** * 20150707 Sinda * We insert frames in queue as below rules @@ -1694,12 +1696,12 @@ WDI_InsertDataInQueue( else PeerId = pPeerEntry->uPeerId; } - + if(pPeerEntry->bUsed == TRUE) { RT_TRACE(COMP_RECV, DBG_TRACE, ("WDI_InsertDataInQueue: Port %d, PeerId %d\n", PortNumber, PeerId)); for (pCurrNetBufferList = pNBL; pCurrNetBufferList != NULL; pCurrNetBufferList = pNextNetBufferList) - { + { pNextNetBufferList = NET_BUFFER_LIST_NEXT_NBL(pCurrNetBufferList); NET_BUFFER_LIST_NEXT_NBL(pCurrNetBufferList) = NULL; N6CAddNblWaitQueue(&pDefaultAdapter->RxPeerQueue[PeerId], pCurrNetBufferList, FALSE); @@ -1808,7 +1810,7 @@ WDI_IndicateBssListBySSID( } VOID -WDI_IndicateConnectionComplete( +WDI_IndicateConnectionComplete( PADAPTER pAdapter, RT_STATUS status ) @@ -1817,7 +1819,7 @@ WDI_IndicateConnectionComplete( if(FALSE == OidHandle_VerifyTask(pAdapter, OID_WDI_TASK_CONNECT)) return; - + OidHandle_Complete(pAdapter, OIDHANDLE_TYPE_TASK); } @@ -1827,7 +1829,7 @@ WDI_IndicateAssociationComplete( PADAPTER pAdapter, RT_STATUS status ) -{ +{ if( status == RT_STATUS_SUCCESS ) { wdiext_IndicateAssociationResult(pAdapter); @@ -1837,17 +1839,17 @@ WDI_IndicateAssociationComplete( VOID -WDI_IndicateDisassociation( +WDI_IndicateDisassociation( PADAPTER pAdapter, u2Byte reason, pu1Byte pAddr ) { PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); - + if(ACTING_AS_AP(pAdapter)) {// AP mode - RT_WLAN_STA *sta = pMgntInfo->pCurrentSta; + RT_WLAN_STA *sta = pMgntInfo->pCurrentSta; RT_ASSERT(sta, ("%s(): sta is NULL!!!\n", __FUNCTION__)); @@ -1856,7 +1858,7 @@ WDI_IndicateDisassociation( RT_TRACE_F(COMP_AP, DBG_SERIOUS, ("pMgntInfo->pCurrentSta is NULL!\n")); return; } - + wdiext_IndicateDisassociation(pAdapter, sta->MacAddr, 0, NULL, TRUE, reason); } else @@ -1876,17 +1878,17 @@ WDI_IndicateNLODiscovery( ) { WDI_INDICATION_NLO_DISCOVERY_PARAMETERS param; - PWDI_BSS_ENTRY_CONTAINER pEntry; + PWDI_BSS_ENTRY_CONTAINER pEntry; PRT_NLO_INFO pNLOInfo = &(pAdapter->MgntInfo.NLOInfo); PRT_WLAN_BSS pRtBss = NULL; - RT_802_11_BSSID_LIST RtBssList = {0}; + RT_802_11_BSSID_LIST RtBssList = {0}; u4Byte i = 0; u4Byte j = 0; - u4Byte nBss = 0; + u4Byte nBss = 0; ULONG buflen = 0; - pu1Byte buf = NULL; - pu1Byte pBssList = NULL; + pu1Byte buf = NULL; + pu1Byte pBssList = NULL; u4Byte devSpecCtx = 0x07060504; BOOLEAN Hit = FALSE; LARGE_INTEGER CurrentTime; @@ -1898,15 +1900,15 @@ WDI_IndicateNLODiscovery( // zero PlatformZeroMemory(¶m, sizeof(param)); - + //Get scan list RtBssList.NumberOfItems = 0; RtBssList.pbssidentry = pAdapter->bssDescList; - + MgntActQuery_802_11_BSSID_LIST(pAdapter, &RtBssList, FALSE); - PlatformAllocateMemoryWithZero(pAdapter, (PVOID *)&pEntry, sizeof(WDI_BSS_ENTRY_CONTAINER)*RtBssList.NumberOfItems); - + PlatformAllocateMemoryWithZero(pAdapter, (PVOID *)&pEntry, sizeof(WDI_BSS_ENTRY_CONTAINER)*RtBssList.NumberOfItems); + param.DeviceDescriptor.pElements = pEntry; nBss = 0; @@ -1922,14 +1924,14 @@ WDI_IndicateNLODiscovery( } pRtBss = &(RtBssList.pbssidentry[i]); - + // Determine if we shall report the BSS found by RegWirelessMode4ScanList. if(!WDIFilterRtBss(pAdapter, pRtBss)) { // Skip this BSS. continue; } - + for( j=0 ; jNumDot11OffloadNetwork ; ++j ) { // Compare to check whether it is what we desired or not @@ -1942,7 +1944,7 @@ WDI_IndicateNLODiscovery( if( !Hit ) // This BSS is not we desired. continue; - + // WIFI_MAC_ADDRESS_CONTAINER BSSID cpMacAddr(pEntry->BSSID.Address, pRtBss->bdBssIdBuf); @@ -1963,7 +1965,7 @@ WDI_IndicateNLODiscovery( { RT_TRACE(COMP_POWER, DBG_LOUD, ("Unknown BssPacketType: %u\n", pRtBss->BssPacketType)); FunctionOut(COMP_POWER); - return; + return; } // WDI_SIGNAL_INFO_CONTAINER SignalInfo @@ -1975,9 +1977,9 @@ WDI_IndicateNLODiscovery( pEntry->ChannelInfo.ChannelNumber = (UINT32)pRtBss->ChannelNumber; pEntry->ChannelInfo.BandId = (pRtBss->ChannelNumber < 36) ? WDI_BAND_ID_2400 : WDI_BAND_ID_5000; RT_TRACE(COMP_POWER, DBG_LOUD, ("pRtBss->ChannelNumber=%d, ", pRtBss->ChannelNumber)); - RT_TRACE(COMP_POWER, DBG_LOUD, ("%x:%x:%x:%x:%x:%x, ", - pEntry->BSSID.Address[0], pEntry->BSSID.Address[1], - pEntry->BSSID.Address[2], pEntry->BSSID.Address[3], + RT_TRACE(COMP_POWER, DBG_LOUD, ("%x:%x:%x:%x:%x:%x, ", + pEntry->BSSID.Address[0], pEntry->BSSID.Address[1], + pEntry->BSSID.Address[2], pEntry->BSSID.Address[3], pEntry->BSSID.Address[4], pEntry->BSSID.Address[5])); RT_TRACE(COMP_POWER, DBG_LOUD, ("SSID: %s\n", pRtBss->bdSsIdBuf)); @@ -1988,7 +1990,7 @@ WDI_IndicateNLODiscovery( // Get current timestamp NdisGetCurrentSystemTime(&CurrentTime); - + // WDI_AGE_INFO_CONTAINER EntryAgeInfo pEntry->EntryAgeInfo.HostTimeStamp = CurrentTime.QuadPart; // [SDIO-482] in JIRA pEntry->EntryAgeInfo.CachedInformation = 0; @@ -2007,17 +2009,17 @@ WDI_IndicateNLODiscovery( // Gen tlv if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationNloDiscovery( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) { RT_TRACE(COMP_POWER, DBG_LOUD, ("WDI_IndicateNLODiscovery(): GenerateWdiIndicationNloDiscovery Failed\n")); FunctionOut(COMP_POWER); return; } - - wdi_UnsolicitedIndication( pAdapter, + + wdi_UnsolicitedIndication( pAdapter, FALSE, NULL, NDIS_STATUS_WDI_INDICATION_NLO_DISCOVERY, @@ -2026,8 +2028,8 @@ WDI_IndicateNLODiscovery( buflen); // cleanup - FreeGenerated((UINT8 *)buf); - + FreeGenerated((UINT8 *)buf); + FunctionOut(COMP_POWER); } @@ -2042,7 +2044,7 @@ WDI_IndicateCurrentPhyStatus( VOID -WDI_IndicateP2PEvent( +WDI_IndicateP2PEvent( VOID *pvP2PInfo, u4Byte EventID, MEMORY_BUFFER *pInformation @@ -2051,7 +2053,7 @@ WDI_IndicateP2PEvent( { P2P_INFO *pP2PInfo = (P2P_INFO *)pvP2PInfo; RT_OID_HANDLER *task = &pP2PInfo->pAdapter->pPortCommonInfo->WdiData.TaskHandle; - + if(P2P_EVENT_DEV_FOUND == EventID) { wdiext_IndicateP2PDeviceFound(pP2PInfo->pAdapter, pInformation->Buffer); @@ -2060,8 +2062,8 @@ WDI_IndicateP2PEvent( || P2P_EVENT_RECEIVED_GO_NEGOTIATION_REQUEST == EventID || P2P_EVENT_RECEIVED_INVITATION_REQUEST == EventID ) - {// rx req action - WDI_CMD_PreIndicateRxP2pActionFrameCb(pvP2PInfo, EventID, pInformation); + {// rx req action + WDI_CMD_PreIndicateRxP2pActionFrameCb(pvP2PInfo, EventID, pInformation); wdiext_IndicateP2PActionFrameReceived(pvP2PInfo, EventID, pInformation); WDI_CMD_PostIndicateRxP2pActionFrameCb(pvP2PInfo, EventID, pInformation); } @@ -2072,10 +2074,10 @@ WDI_IndicateP2PEvent( ) {// rx rsp action WDI_CMD_PreIndicateRxP2pActionFrameCb(pvP2PInfo, EventID, pInformation); - + // indicate in the corresp. OffChnlTx complete cb //wdiext_IndicateP2PActionFrameReceived(pvP2PInfo, EventID, pInformation); - + WDI_CMD_PostIndicateRxP2pActionFrameCb(pvP2PInfo, EventID, pInformation); } else if(P2P_EVENT_GO_OPERATING_CHANNEL == EventID) @@ -2083,7 +2085,7 @@ WDI_IndicateP2PEvent( wdiext_IndicateP2POpChnl(pP2PInfo->pAdapter, pP2PInfo); } - return; + return; } @@ -2105,7 +2107,7 @@ WDI_CompleteCreateDeleteMac( } VOID -WDI_IndicateLinkStateChanged( +WDI_IndicateLinkStateChanged( PADAPTER pAdapter, BOOLEAN bForceLinkQuality, u1Byte ucLinkQuality @@ -2122,14 +2124,14 @@ WDI_IndicateActionFrame( { NDIS_STATUS_INDICATION *indic = NULL; WDI_MESSAGE_HEADER *wdiHdr = NULL; - + u1Byte *buf = NULL; ULONG buflen = 0; WDI_INDICATION_ACTION_FRAME_RECEIVED_PARAMETERS param = {0}; RT_TRACE(COMP_OID_SET, DBG_WARNING, ("WDI_IndicateActionFrame +\n")); - + // TODO: fill the valid info into param PlatformMoveMemory(param.SourceAddress.Address,Frame_pSaddr(*posMpdu),6); @@ -2137,13 +2139,13 @@ WDI_IndicateActionFrame( param.ActionFrameBody.ElementCount = posMpdu->Length; // TODO: double check here to make sure channel correct - param.ChannelInfo.ChannelNumber = RT_GetChannelNumber(pAdapter); + param.ChannelInfo.ChannelNumber = RT_GetChannelNumber(pAdapter); param.ChannelInfo.BandId = WDI_BAND_ID_2400; if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationActionFrameReceived( - ¶m, - sizeof(*indic) + sizeof(*wdiHdr), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(*indic) + sizeof(*wdiHdr), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) { RT_TRACE(COMP_OID_SET, DBG_WARNING, ("ActionFrame generate tlv failed\n")); @@ -2173,7 +2175,7 @@ WDI_IndicateActionFrame( NdisMIndicateStatusEx(pAdapter->pNdisCommon->hNdisAdapter, indic); FreeGenerated((UINT8 *)buf); - + return RT_STATUS_SUCCESS; } @@ -2184,12 +2186,12 @@ WDI_IndicateWakeReason( IN pu1Byte pBuffer, IN u2Byte BufferLen ) -{ +{ WDI_INDICATION_WAKE_REASON_PARAMETERS param; PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); PRT_POWER_SAVE_CONTROL pPSC = GET_POWER_SAVE_CONTROL(pMgntInfo); - pu1Byte pWakePktbuf = NULL; + pu1Byte pWakePktbuf = NULL; BOOLEAN bIndicate = TRUE; u1Byte *buf = NULL; ULONG buflen = 0; @@ -2207,7 +2209,7 @@ WDI_IndicateWakeReason( RT_TRACE(COMP_POWER, DBG_SERIOUS, ("WDI_IndicateWakeReason(): Unknown pPSC->WakeUpReason(%#x)\n", pPSC->WakeUpReason)); } - param.WakeEventCode = WDI_WAKE_REASON_CODE_PACKET; + param.WakeEventCode = WDI_WAKE_REASON_CODE_PACKET; param.WakePacketPatternId = pPSC->MagicPacketPatternId; PlatformAllocateMemoryWithZero(pAdapter, (PVOID *)&pWakePktbuf, BufferLen); @@ -2241,47 +2243,47 @@ WDI_IndicateWakeReason( bIndicate = FALSE; } } - + if(bIndicate) { RT_TRACE(COMP_POWER, DBG_LOUD, ("WDI_IndicateWakeReason(): WakeEventCode(%#X)\n", param.WakeEventCode)); // Gen tlv if(NDIS_STATUS_SUCCESS != GenerateWdiIndicationWakeReasonFromIhv( - ¶m, - sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), - &pAdapter->pPortCommonInfo->WdiData.TlvContext, + ¶m, + sizeof(NDIS_STATUS_INDICATION) + sizeof(WDI_MESSAGE_HEADER), + &pAdapter->pPortCommonInfo->WdiData.TlvContext, &buflen, &((UINT8 *)buf))) { RT_TRACE(COMP_POWER, DBG_LOUD, ("WDI_IndicateWakeReason(): GenerateWdiIndicationWakeReasonFromIhv Failed\n")); return; } - - wdi_UnsolicitedIndication(pAdapter, + + wdi_UnsolicitedIndication(pAdapter, FALSE, NULL, NDIS_STATUS_WDI_INDICATION_WAKE_REASON, NDIS_STATUS_SUCCESS, buf, buflen); - + // cleanup FreeGenerated((UINT8 *)buf); - } - + } + } VOID -WDI_IndicateRoamingNeeded( +WDI_IndicateRoamingNeeded( PADAPTER pAdapter, RT_PREPARE_ROAM_TYPE IndicationReason ) { PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); - + pMgntInfo->PrepareRoamState = IndicationReason; - + switch(IndicationReason) { case RT_PREPARE_ROAM_DEAUTH_DISASSOC: @@ -2299,7 +2301,7 @@ WDI_IndicateRoamingNeeded( } VOID -WDI_IndicateRoamingComplete( +WDI_IndicateRoamingComplete( PADAPTER pAdapter ) { @@ -2307,11 +2309,11 @@ WDI_IndicateRoamingComplete( if(FALSE == OidHandle_VerifyTask(pAdapter, OID_WDI_TASK_ROAM)) return; - + OidHandle_Complete(pAdapter, OIDHANDLE_TYPE_TASK); } -VOID +VOID WDI_AddGroupPeer( IN PADAPTER pAdapter, IN u2Byte PortNumber @@ -2319,44 +2321,44 @@ WDI_AddGroupPeer( { PADAPTER pDefaultAdapter = GetDefaultAdapter(pAdapter); PWDI_DATA_STRUCT pWdi = &(pAdapter->pPortCommonInfo->WdiData); - WDI_MAC_ADDRESS PeerAddr = {0}; + WDI_MAC_ADDRESS PeerAddr = {0}; PRT_PEER_ENTRY pPeerEntry = NULL; u1Byte i = 0; - + FunctionIn(COMP_INIT); - + PlatformAcquireSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); for(i = 0; i < MP_DEFAULT_NUMBER_OF_PORT; i++) { pPeerEntry = &pDefaultAdapter->RxPeerTable[i]; if( pPeerEntry->bUsed == FALSE ) { - RT_TRACE(COMP_INIT, DBG_LOUD, ("WDI_AddGroupPeer: create group peer %d for port %d\n", i, PortNumber)); + RT_TRACE(COMP_INIT, DBG_LOUD, ("WDI_AddGroupPeer: create group peer %d for port %d\n", i, PortNumber)); break; } } - + if( i == MP_DEFAULT_NUMBER_OF_PORT ) { - RT_TRACE(COMP_INIT, DBG_WARNING, ("WDI_AddGroupPeer: there is no available group peer for port %d\n", PortNumber)); + RT_TRACE(COMP_INIT, DBG_WARNING, ("WDI_AddGroupPeer: there is no available group peer for port %d\n", PortNumber)); FunctionOut(COMP_INIT); PlatformReleaseSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); return ; } - + pPeerEntry->bUsed = TRUE; pPeerEntry->uPeerId = i; pPeerEntry->uPortId = PortNumber; PlatformMoveMemory(pPeerEntry->PeerAddr, MAC_BROADCAST_ADDR, 6); PlatformMoveMemory(PeerAddr.Address, pPeerEntry->PeerAddr, 6); pWdi->WdiDataApi.PeerCreateIndication(pWdi->DataPathHandle, (WDI_PORT_ID)pPeerEntry->uPortId, (WDI_PEER_ID)pPeerEntry->uPeerId, PeerAddr); - + PlatformReleaseSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); - + FunctionOut(COMP_INIT); } -VOID +VOID WDI_DeleteGroupPeer( IN PADAPTER pAdapter, IN u2Byte PortNumber @@ -2368,15 +2370,15 @@ WDI_DeleteGroupPeer( WDI_PEER_ID PeerId = 0; PRT_PEER_ENTRY pPeerEntry = NULL; u1Byte i; - + FunctionIn(COMP_INIT); PlatformAcquireSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); - + pPeerEntry = (PRT_PEER_ENTRY)wdi_FindGroupPeerByPort(pAdapter, PortNumber); if( pPeerEntry == NULL ) { - RT_TRACE(COMP_INIT, DBG_WARNING, ("wdi_FindPeerByAddr: Cannot find group peer of port %d\n", PortNumber)); + RT_TRACE(COMP_INIT, DBG_WARNING, ("wdi_FindPeerByAddr: Cannot find group peer of port %d\n", PortNumber)); FunctionOut(COMP_INIT); PlatformReleaseSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); return ; @@ -2385,23 +2387,23 @@ WDI_DeleteGroupPeer( { PeerId = (WDI_PEER_ID)pPeerEntry->uPeerId; pPeerEntry->bUsed = FALSE; - - PlatformZeroMemory(pPeerEntry->PeerAddr, 6); - + + PlatformZeroMemory(pPeerEntry->PeerAddr, 6); + pWdi->WdiDataApi.PeerDeleteIndication(pWdi->DataPathHandle, (WDI_PORT_ID)PortNumber, PeerId, &ndisStatus); - + WDI_FreeRxFrame(pAdapter, (PNET_BUFFER_LIST)N6CGetHeadNblWaitQueue(pDefaultAdapter->RxPeerQueue[PeerId])); RTInitializeSListHead(&pDefaultAdapter->RxPeerQueue[PeerId]); - + RT_TRACE(COMP_INIT, DBG_LOUD, ("WDI_DeleteGroupPeer: delete group peer %d of port %d, Status: %d\n", PeerId, PortNumber, ndisStatus)); } - + PlatformReleaseSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); - + FunctionOut(COMP_INIT); } -NDIS_STATUS +NDIS_STATUS WDI_AddDatapathPeer( IN PADAPTER pAdapter, IN pu1Byte pAddr) @@ -2412,28 +2414,28 @@ WDI_AddDatapathPeer( WDI_PORT_ID PortId = (WDI_PORT_ID)pAdapter->pNdis62Common->PortNumber; WDI_MAC_ADDRESS PeerAddr = {0}; PRT_PEER_ENTRY pPeerEntry = NULL; - + FunctionIn(COMP_MLME); - + PlatformAcquireSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); - + pPeerEntry = (PRT_PEER_ENTRY)wdi_GetAvailablePeer(pAdapter, pAddr); if( pPeerEntry != NULL ) - { + { PlatformMoveMemory(PeerAddr.Address, pPeerEntry->PeerAddr, 6); pWdi->WdiDataApi.PeerCreateIndication(pWdi->DataPathHandle, (WDI_PORT_ID)pPeerEntry->uPortId, (WDI_PEER_ID)pPeerEntry->uPeerId, PeerAddr); - + PlatformReleaseSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); - + FunctionOut(COMP_MLME); - + return NDIS_STATUS_SUCCESS; } - + PlatformReleaseSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); - + FunctionOut(COMP_MLME); - + return NDIS_STATUS_FAILURE; } @@ -2448,11 +2450,11 @@ void WDI_DeleteDatapathPeer( NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS; WDI_PEER_ID PeerId = 0; PRT_PEER_ENTRY pPeerEntry = NULL; - + FunctionIn(COMP_MLME); - + PlatformAcquireSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); - + pPeerEntry = (PRT_PEER_ENTRY)wdi_FindPeerByAddr(pAdapter, pAddr); if( pPeerEntry == NULL ) { @@ -2461,23 +2463,23 @@ void WDI_DeleteDatapathPeer( PlatformReleaseSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); return ; } - RT_TRACE(COMP_INIT, DBG_LOUD, ("WDI_DeleteDatapathPeer: Find the addres [%2x:%2x:%2x:%2x:%2x:%2x] associated at Peer %d\n", pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5], pPeerEntry->uPeerId)); - + RT_TRACE(COMP_INIT, DBG_LOUD, ("WDI_DeleteDatapathPeer: Find the addres [%2x:%2x:%2x:%2x:%2x:%2x] associated at Peer %d\n", pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5], pPeerEntry->uPeerId)); + pDefaultAdapter->RxPeerUsedCount--; PeerId = (WDI_PEER_ID)pPeerEntry->uPeerId; PortId = (WDI_PORT_ID)pPeerEntry->uPortId; pPeerEntry->bUsed = FALSE; - PlatformZeroMemory(pPeerEntry->PeerAddr, 6); - + PlatformZeroMemory(pPeerEntry->PeerAddr, 6); + pWdi->WdiDataApi.PeerDeleteIndication(pWdi->DataPathHandle, PortId, PeerId, &ndisStatus); - + WDI_FreeRxFrame(pAdapter, (PNET_BUFFER_LIST)N6CGetHeadNblWaitQueue(pDefaultAdapter->RxPeerQueue[PeerId])); RTInitializeSListHead(&pDefaultAdapter->RxPeerQueue[PeerId]); - + PlatformReleaseSpinLock(pAdapter, RT_RX_QUEUE_SPINLOCK); - + RT_TRACE(COMP_MLME, DBG_LOUD, ("WDI_DeleteDatapathPeer: delete peer %d, Status: %d\n", PeerId, ndisStatus)); - + FunctionOut(COMP_MLME); } @@ -2491,7 +2493,7 @@ WDI_FetchNBLByPort( PADAPTER pDefaultAdapter = GetDefaultAdapter(pAdapter); u2Byte index = 0; PRT_SINGLE_LIST_ENTRY pFirst = NULL, pTemp = NULL; - + *ppNetBufferList = NULL; RT_TRACE(COMP_RECV, DBG_LOUD, ("WDI_FetchNBLByPort: fetch frames of all peers at port %d\n", Port_ID)); @@ -2505,7 +2507,7 @@ WDI_FetchNBLByPort( { if(N6CIsNblWaitQueueEmpty(pDefaultAdapter->RxPeerQueue[index])) continue; - + pTemp = RTGetHeadSList(&pDefaultAdapter->RxPeerQueue[index]); if( pFirst == NULL ) { @@ -2518,7 +2520,7 @@ WDI_FetchNBLByPort( RTInitializeSListHead(&pDefaultAdapter->RxPeerQueue[index]); } } - + if( pFirst != NULL ) { *ppNetBufferList = RT_GET_NBL_FROM_QUEUE_LINK(pFirst); @@ -2534,7 +2536,7 @@ WDI_FetchNBLByPort( { if(N6CIsNblWaitQueueEmpty(pDefaultAdapter->RxPeerQueue[index])) continue; - + pTemp = RTGetHeadSList(&pDefaultAdapter->RxPeerQueue[index]); if( pFirst == NULL ) { @@ -2547,7 +2549,7 @@ WDI_FetchNBLByPort( RTInitializeSListHead(&pDefaultAdapter->RxPeerQueue[index]); } } - + if( pFirst != NULL ) { *ppNetBufferList = RT_GET_NBL_FROM_QUEUE_LINK(pFirst); @@ -2577,11 +2579,11 @@ WDI_FreeRxFrame( FunctionOut(COMP_RECV); return; } - + do - { + { //Get next NBL - pNextNBL = NET_BUFFER_LIST_NEXT_NBL(pNetBufferList); + pNextNBL = NET_BUFFER_LIST_NEXT_NBL(pNetBufferList); //Get RFD from NBL pRfd = MP_GET_PACKET_RFD(pNetBufferList); @@ -2617,22 +2619,22 @@ WDI_FreeRxFrame( //Assign NextNBL pointer pNetBufferList = pNextNBL; }while(pNetBufferList!=NULL); - + if (Count == 0) { NdisSetEvent(&pNdisCommon->AllPacketReturnedEvent); - if(pAdapter->MgntInfo.NdisVersion >= RT_NDIS_VERSION_6_20) - { + if(pAdapter->MgntInfo.NdisVersion >= RT_NDIS_VERSION_6_20) + { PADAPTER pTempAdapter = GetFirstExtAdapter(pAdapter); while(pTempAdapter != NULL) { NdisSetEvent(&pTempAdapter->pNdisCommon->AllPacketReturnedEvent); - pTempAdapter = GetNextExtAdapter(pTempAdapter); - } + pTempAdapter = GetNextExtAdapter(pTempAdapter); + } } } - + FunctionOut(COMP_RECV); } @@ -2641,7 +2643,7 @@ WDI_IndicateTKIPMICFailure( PADAPTER pAdapter ) { - PMGNT_INFO pMgntInfo; + PMGNT_INFO pMgntInfo; pMgntInfo = &(pAdapter->MgntInfo); PUCHAR pOutput = NULL; ULONG length = 0; @@ -2650,13 +2652,13 @@ WDI_IndicateTKIPMICFailure( FunctionIn(COMP_SEC); - + Params.FailureInfo.DefaultKeyFailure = FALSE; Params.FailureInfo.KeyIndex=0; //WDI_TKIPFailureParam.PeerMacAddress=pMgntInfo->Bssid; cpMacAddr(Params.FailureInfo.PeerMacAddress.Address, pMgntInfo->Bssid); - - + + ndisStatus = GenerateWdiIndicationTkipMicFailure( &Params, @@ -2696,7 +2698,7 @@ WDI_TxCreditCheck( GLWdiTxRxStatistics.monitorTxPauseReason = pWdi->txPauseReason; // First check if we have pause indication before. - // not to acquire tx lock frequently, so we do not acquire tx lock when read, but remember + // not to acquire tx lock frequently, so we do not acquire tx lock when read, but remember // we should acquire tx lock when need to change the pause reason. if(pWdi->txPauseReason) { @@ -2704,26 +2706,26 @@ WDI_TxCreditCheck( txCredit = *Get_NUM_IDLE_TCB(pAdapter); preTxPauseReason = pWdi->txPauseReason; - + RT_TRACE(COMP_INIT, DBG_LOUD, ("[WDI], WDI_TxCreditCheck(): txCredit=%d\n", txCredit)); - + if(txCredit > (pAdapter->RT_TCB_NUM/4)) { GLWdiTxRxStatistics.numTxResourceAvailable++; - + if( (preTxPauseReason&WDI_TX_PAUSE_REASON_CREDIT) == WDI_TX_PAUSE_REASON_CREDIT) { - RT_TRACE(COMP_INIT, DBG_LOUD, ("[WDI], WDI_TxCreditCheck(): TxPauseReason = 0x%x!!!\n", preTxPauseReason)); + RT_TRACE(COMP_INIT, DBG_LOUD, ("[WDI], WDI_TxCreditCheck(): TxPauseReason = 0x%x!!!\n", preTxPauseReason)); GLWdiTxRxStatistics.numWdiTxRestartIndicate++; RT_TRACE(COMP_INIT, DBG_LOUD, ("[WDI], WDI_TxCreditCheck(): TxSendRestart: %d times!!!\n", GLWdiTxRxStatistics.numWdiTxRestartIndicate)); - + pWdi->txPauseReason &= ~WDI_TX_PAUSE_REASON_CREDIT; PlatformReleaseSpinLock(pAdapter, RT_TX_SPINLOCK); // Before indicate to WDI, release the tx lock. - pWdi->WdiDataApi.TxSendRestartIndication(pWdi->DataPathHandle, - WDI_PORT_ANY, + pWdi->WdiDataApi.TxSendRestartIndication(pWdi->DataPathHandle, + WDI_PORT_ANY, WDI_PEER_ANY, WDI_EXT_TID_UNKNOWN, WDI_TX_PAUSE_REASON_CREDIT); @@ -2749,10 +2751,10 @@ WDI_IndicateFWStalled( PWDI_DATA_STRUCT pWdi = &(pAdapter->pPortCommonInfo->WdiData); NDIS_STATUS_INDICATION statusIndication = {0}; WDI_MESSAGE_HEADER WdiHeader = {0}; - + if(!pWdi->bWdiLEPLDR) return; - + RT_TRACE(COMP_OID_SET, DBG_LOUD, ("==> WDI_IndicateFWStalled\n")); N6_ASSIGN_OBJECT_HEADER( @@ -2818,7 +2820,7 @@ WDI_IndicateGeneralEvent( ) { RT_STATUS rtStatus = RT_STATUS_SUCCESS; - + switch(Event) { default: diff --git a/print/XPSDrvSmpl/src/common/pshndlr.cpp b/print/XPSDrvSmpl/src/common/pshndlr.cpp index 989837be..90acda70 100644 --- a/print/XPSDrvSmpl/src/common/pshndlr.cpp +++ b/print/XPSDrvSmpl/src/common/pshndlr.cpp @@ -133,7 +133,7 @@ CPSHandler::CPSHandler( cstrNSPrefix.Delete(iIndex, 1) > 0) { CStringXDW cstrOrgNamespaces; - cstrOrgNamespaces.Format(szNSSelection, cstrNSPrefix, FRAMEWORK_URI); + cstrOrgNamespaces.Format(szNSSelection, static_cast(cstrNSPrefix), FRAMEWORK_URI); hr = m_pPrintDocument->setProperty(CComBSTR(szSelectNS), CComVariant(cstrOrgNamespaces)); } @@ -1259,7 +1259,7 @@ Note: The annotation for pbstrValue is intended to express that the BSTR may be NULL when S_FALSE is returned, but not when S_OK is returned. - + In any case, when a failure HRESULT is returned, all out parameter annotations are ignored. @@ -1593,7 +1593,7 @@ CPSHandler::GetPrefixFromURI( // Construct the Root Query string // CStringXDW cstrRootQuery; - cstrRootQuery.Format(szPTRootQuery, szTmpNS, m_bstrDocumentType); + cstrRootQuery.Format(szPTRootQuery, szTmpNS, static_cast(m_bstrDocumentType)); // // Find the PrintSchema element so we can retrieve the private namespace prefix diff --git a/print/XPSDrvSmpl/src/common/ptquerybld.cpp b/print/XPSDrvSmpl/src/common/ptquerybld.cpp index 885af0b2..2b3bd749 100644 --- a/print/XPSDrvSmpl/src/common/ptquerybld.cpp +++ b/print/XPSDrvSmpl/src/common/ptquerybld.cpp @@ -236,7 +236,7 @@ CPTQueryBuilder::AddFeature( if (SUCCEEDED(hr)) { CStringXDW cstrFeatureQuery; - cstrFeatureQuery.Format(szPTQFeature, m_bstrFrameworkNS, bstrKeyword); + cstrFeatureQuery.Format(szPTQFeature, static_cast(m_bstrFrameworkNS), static_cast(bstrKeyword)); hr = m_bstrQuery.Append(cstrFeatureQuery); } @@ -305,7 +305,7 @@ CPTQueryBuilder::AddProperty( if (SUCCEEDED(hr)) { CStringXDW cstrPropertyQuery; - cstrPropertyQuery.Format(szPTQProperty, m_bstrFrameworkNS, bstrKeyword); + cstrPropertyQuery.Format(szPTQProperty, static_cast(m_bstrFrameworkNS), static_cast(bstrKeyword)); hr = m_bstrQuery.Append(cstrPropertyQuery); } @@ -369,7 +369,7 @@ CPTQueryBuilder::AddScoredProperty( if (SUCCEEDED(hr)) { CStringXDW cstrScoredPropertyQuery; - cstrScoredPropertyQuery.Format(szPTQScoredProperty, m_bstrFrameworkNS, bstrKeyword); + cstrScoredPropertyQuery.Format(szPTQScoredProperty, static_cast(m_bstrFrameworkNS), static_cast(bstrKeyword)); hr = m_bstrQuery.Append(cstrScoredPropertyQuery); } @@ -437,7 +437,7 @@ CPTQueryBuilder::AddParamRef( if (SUCCEEDED(hr)) { CStringXDW cstrParamRefQuery; - cstrParamRefQuery.Format(szPTQParamRef, m_bstrFrameworkNS, bstrKeyword); + cstrParamRefQuery.Format(szPTQParamRef, static_cast(m_bstrFrameworkNS), static_cast(bstrKeyword)); hr = m_bstrQuery.Append(cstrParamRefQuery); } @@ -490,13 +490,14 @@ CPTQueryBuilder::AddOption( { CStringXDW cstrQueryRoot(m_bstrQuery); CStringXDW cstrOptionQuery; - cstrOptionQuery.Format(szPTQOptionSH, m_bstrFrameworkNS); + cstrOptionQuery.Format(szPTQOptionSH, static_cast(m_bstrFrameworkNS)); if (SUCCEEDED(hr = m_bstrQuery.Append(cstrOptionQuery)) && SUCCEEDED(hr = m_bstrQuery.Append(szPTQOrNodes)) && SUCCEEDED(hr = m_bstrQuery.Append(cstrQueryRoot))) { - cstrOptionQuery.Format(szPTQOptionLH, m_bstrFrameworkNS, bstrKeywordNS, m_bstrFrameworkNS); + cstrOptionQuery.Format(szPTQOptionLH, static_cast(m_bstrFrameworkNS), + static_cast(bstrKeywordNS), static_cast(m_bstrFrameworkNS)); hr = m_bstrQuery.Append(cstrOptionQuery); } } diff --git a/print/XPSDrvSmpl/src/common/wmpthndlr.cpp b/print/XPSDrvSmpl/src/common/wmpthndlr.cpp index dcb1eff7..49792d6a 100644 --- a/print/XPSDrvSmpl/src/common/wmpthndlr.cpp +++ b/print/XPSDrvSmpl/src/common/wmpthndlr.cpp @@ -1123,7 +1123,7 @@ CWMPTHandler::GetTxtPropTypeAndValue( case FontColor: { cstrType = SCHEMA_STRING; - cstrValue.Format(L"%s", pWmData->txtData.bstrFontColor); + cstrValue.Format(L"%s", static_cast(pWmData->txtData.bstrFontColor)); } break; @@ -1137,7 +1137,7 @@ CWMPTHandler::GetTxtPropTypeAndValue( case Text: { cstrType = SCHEMA_STRING; - cstrValue.Format(L"%s", pWmData->txtData.bstrText); + cstrValue.Format(L"%s", static_cast(pWmData->txtData.bstrText)); } break; diff --git a/print/XPSDrvSmpl/src/filters/color/cmimg.cpp b/print/XPSDrvSmpl/src/filters/color/cmimg.cpp index f44fa028..6c312629 100644 --- a/print/XPSDrvSmpl/src/filters/color/cmimg.cpp +++ b/print/XPSDrvSmpl/src/filters/color/cmimg.cpp @@ -537,7 +537,7 @@ CColorManagedImage::GetResURI( // Create a unique name for the bitmap for this print session // CStringXDW cstrURI; - cstrURI.Format(L"%s_%u.wdp", cstrFileName, GetUniqueNumber()); + cstrURI.Format(L"%s_%u.wdp", static_cast(cstrFileName), GetUniqueNumber()); SysFreeString(*pbstrResURI); *pbstrResURI = cstrURI.AllocSysString(); diff --git a/print/XPSDrvSmpl/src/filters/color/dictionary.cpp b/print/XPSDrvSmpl/src/filters/color/dictionary.cpp index 5106aad7..efd15760 100644 --- a/print/XPSDrvSmpl/src/filters/color/dictionary.cpp +++ b/print/XPSDrvSmpl/src/filters/color/dictionary.cpp @@ -273,7 +273,7 @@ CRemoteDictionary::GetResURI( // Create a unique name for the dictionary for this print session // CStringXDW cstrURI; - cstrURI.Format(L"%s_%u.dict", m_bstrDictionaryURI, GetUniqueNumber()); + cstrURI.Format(L"%s_%u.dict", static_cast(m_bstrDictionaryURI), GetUniqueNumber()); *pbstrResURI = cstrURI.AllocSysString(); } diff --git a/print/XPSDrvSmpl/src/filters/color/profman.cpp b/print/XPSDrvSmpl/src/filters/color/profman.cpp index 8bd06284..16ee9dc2 100644 --- a/print/XPSDrvSmpl/src/filters/color/profman.cpp +++ b/print/XPSDrvSmpl/src/filters/color/profman.cpp @@ -692,7 +692,7 @@ CProfileManager::GetResURI( // Create a unique name for the profile for this print session // CStringXDW cstrURI; - cstrURI.Format(L"/%s_%u%s", cstrFileName, GetUniqueNumber(), cstrFileExt); + cstrURI.Format(L"/%s_%u%s", static_cast(cstrFileName), GetUniqueNumber(), static_cast(cstrFileExt)); *pbstrResURI = cstrURI.AllocSysString(); } diff --git a/print/XPSDrvSmpl/src/filters/common/ptmanage.cpp b/print/XPSDrvSmpl/src/filters/common/ptmanage.cpp index 209c344a..fa50170f 100644 --- a/print/XPSDrvSmpl/src/filters/common/ptmanage.cpp +++ b/print/XPSDrvSmpl/src/filters/common/ptmanage.cpp @@ -178,9 +178,9 @@ CPTManager::Initialise( // // We couldn't revert the security context. The filter pipeline // manager will clean up the thread when operation is complete, - // when it is determined that the security context was not - // reverted. Since there are no security implications with - // running this filter in an elevated context, we can + // when it is determined that the security context was not + // reverted. Since there are no security implications with + // running this filter in an elevated context, we can // continue to run. // } @@ -589,7 +589,7 @@ CPTManager::GetCapabilities( { } } - + // // Always revert back to the default security context // @@ -598,9 +598,9 @@ CPTManager::GetCapabilities( // // We couldn't revert the security context. The filter pipeline // manager will clean up the thread when operation is complete, - // when it is determined that the security context was not - // reverted. Since there are no security implications with - // running this filter in an elevated context, we can + // when it is determined that the security context was not + // reverted. Since there are no security implications with + // running this filter in an elevated context, we can // continue to run. // } @@ -1034,7 +1034,7 @@ CPTManager::GetMergedTicket( { CStringXDA cstrMessage; CStringXDA cstrError(bstrErrorMessage); - cstrMessage.Format("PTMergeAndValidatePrintTicket failed with message: %s\n", cstrError); + cstrMessage.Format("PTMergeAndValidatePrintTicket failed with message: %s\n", static_cast(cstrError)); ERR(cstrMessage.GetBuffer()); } @@ -1047,9 +1047,9 @@ CPTManager::GetMergedTicket( // // We couldn't revert the security context. The filter pipeline // manager will clean up the thread when operation is complete, - // when it is determined that the security context was not - // reverted. Since there are no security implications with - // running this filter in an elevated context, we can + // when it is determined that the security context was not + // reverted. Since there are no security implications with + // running this filter in an elevated context, we can // continue to run. // } diff --git a/print/XPSDrvSmpl/src/filters/nup/nupsax.cpp b/print/XPSDrvSmpl/src/filters/nup/nupsax.cpp index 830f6928..6c92730c 100644 --- a/print/XPSDrvSmpl/src/filters/nup/nupsax.cpp +++ b/print/XPSDrvSmpl/src/filters/nup/nupsax.cpp @@ -266,7 +266,7 @@ CNUpSaxHandler::startElement( if (sizePage.Width < 1.f) { // - // According to the Xps Specification, + // According to the Xps Specification, // FixedPage Width must be >= 1.0 // hr = E_FAIL; @@ -363,8 +363,8 @@ CNUpSaxHandler::startElement( sizePage.Height); cstrOut.Format(L"(bstrMatrix), + static_cast(strClip)); // // Add additional namespaces from the FixedPage diff --git a/print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp b/print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp index 44e0d5d3..7a7bc160 100644 --- a/print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp +++ b/print/XPSDrvSmpl/src/filters/scaling/pagescale.cpp @@ -699,7 +699,7 @@ CPageScaling::GetOpenTagXML( if (SUCCEEDED(hr = CreateTransform(&bstrMatrixXForm))) { CStringXDW cstrCanvas; - cstrCanvas.Format(L"(bstrMatrixXForm)); *pbstrXML = cstrCanvas.AllocSysString(); } } diff --git a/print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp b/print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp index 578995bf..5f139830 100644 --- a/print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp +++ b/print/XPSDrvSmpl/src/filters/watermark/wmvect.cpp @@ -159,7 +159,8 @@ CVectorWatermark::CreateXMLElement( try { CStringXDW strOpenCanvas; - strOpenCanvas.Format(L"", bstrWMOpacity, bstrMatrixXForm); + strOpenCanvas.Format(L"", + static_cast(bstrWMOpacity), static_cast(bstrMatrixXForm)); IStream* pStream; CComBSTR bstrContent; diff --git a/sd/sdiomars/mars.vcxproj b/sd/sdiomars/mars.vcxproj index fc11a774..21ca54ce 100644 --- a/sd/sdiomars/mars.vcxproj +++ b/sd/sdiomars/mars.vcxproj @@ -101,15 +101,15 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\sdbus.lib;$(DDK_LIB_PATH)\ntstrsafe.lib - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. @@ -117,15 +117,15 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\sdbus.lib;$(DDK_LIB_PATH)\ntstrsafe.lib - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. @@ -133,15 +133,15 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\sdbus.lib;$(DDK_LIB_PATH)\ntstrsafe.lib - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. @@ -149,15 +149,15 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\sdbus.lib;$(DDK_LIB_PATH)\ntstrsafe.lib - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. - %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories);. @@ -176,4 +176,4 @@ - \ No newline at end of file + diff --git a/security/elam/elamsample.c b/security/elam/elamsample.c index 13654d6e..0877ee71 100644 --- a/security/elam/elamsample.c +++ b/security/elam/elamsample.c @@ -20,7 +20,7 @@ // Kernel mode only. // -#include +#include "elamsample.h" #ifdef ALLOC_PRAGMA #pragma alloc_text(INIT, DriverEntry) diff --git a/sensors/Activity/Device.h b/sensors/Activity/Device.h index 64b2a5e4..afd205db 100644 --- a/sensors/Activity/Device.h +++ b/sensors/Activity/Device.h @@ -12,7 +12,7 @@ #include #include -#include +#include "SensorsTrace.h" #include #include @@ -197,4 +197,4 @@ private: // // Set up accessor function to retrieve device context // -WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(ActivityDevice, GetActivityContextFromSensorInstance); \ No newline at end of file +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(ActivityDevice, GetActivityContextFromSensorInstance); diff --git a/sensors/CustomSensors/Device.h b/sensors/CustomSensors/Device.h index 0679b137..692bf675 100644 --- a/sensors/CustomSensors/Device.h +++ b/sensors/CustomSensors/Device.h @@ -15,7 +15,7 @@ #include #include -#include +#include "SensorsTrace.h" #include #include @@ -135,4 +135,4 @@ WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CustomSensorDevice, GetCustomSensorContextFro #define CustomSensorDevice_Resolution (0.1f) // CO2 concentration resolution in parts per million (ppmv). #define CustomSensorDevice_Minimum_CO2Level (0.0f) // Minimum CO2 concentration in parts per million (ppmv). -#define CustomSensorDevice_Maximum_CO2Level (10000.0f) // Maximum CO2 concentration in parts per million (ppmv). \ No newline at end of file +#define CustomSensorDevice_Maximum_CO2Level (10000.0f) // Maximum CO2 concentration in parts per million (ppmv). diff --git a/sensors/CustomSensors/HardwareSimulator.h b/sensors/CustomSensors/HardwareSimulator.h index e170918b..3bb6e04c 100644 --- a/sensors/CustomSensors/HardwareSimulator.h +++ b/sensors/CustomSensors/HardwareSimulator.h @@ -14,7 +14,7 @@ #include #include -#include +#include "SensorsTrace.h" #include #define SIMULATOR_HARDWARE_INTERVAL_MS (100) // 100ms diff --git a/sensors/Fusion/Device.h b/sensors/Fusion/Device.h index 1bd39606..89d45ed9 100644 --- a/sensors/Fusion/Device.h +++ b/sensors/Fusion/Device.h @@ -19,11 +19,7 @@ #include #include #include -#include #include -#include -#include -#include #define SENSOR_POOL_TAG_FUSIONSENSOR 'esuF' diff --git a/sensors/Pedometer/Device.h b/sensors/Pedometer/Device.h index 008c3ef6..593e0b95 100644 --- a/sensors/Pedometer/Device.h +++ b/sensors/Pedometer/Device.h @@ -15,7 +15,7 @@ #include #include -#include +#include "SensorsTrace.h" #include #include diff --git a/sensors/Pedometer/HardwareSimulator.h b/sensors/Pedometer/HardwareSimulator.h index 3d9646b9..c0f72cac 100644 --- a/sensors/Pedometer/HardwareSimulator.h +++ b/sensors/Pedometer/HardwareSimulator.h @@ -14,7 +14,7 @@ #include #include -#include +#include "SensorsTrace.h" #include #include "Device.h" diff --git a/sensors/SensorsComboDriver/SensorsComboDriver.vcxproj b/sensors/SensorsComboDriver/SensorsComboDriver.vcxproj index 15e5d0a5..381f5a03 100644 --- a/sensors/SensorsComboDriver/SensorsComboDriver.vcxproj +++ b/sensors/SensorsComboDriver/SensorsComboDriver.vcxproj @@ -118,7 +118,6 @@ %(AdditionalDependencies);$(SDK_LIB_PATH)\mincore.lib;$(SDK_LIB_PATH)\propsys.lib;$(SDK_LIB_PATH)\sensors\1.1\sensorscxstub.lib;$(SDK_LIB_PATH)\sensorsutils.lib - SensorsComboDriver.def @@ -139,7 +138,6 @@ %(AdditionalDependencies);$(SDK_LIB_PATH)\mincore.lib;$(SDK_LIB_PATH)\propsys.lib;$(SDK_LIB_PATH)\sensors\1.1\sensorscxstub.lib;$(SDK_LIB_PATH)\sensorsutils.lib - SensorsComboDriver.def @@ -160,7 +158,6 @@ %(AdditionalDependencies);$(SDK_LIB_PATH)\mincore.lib;$(SDK_LIB_PATH)\propsys.lib;$(SDK_LIB_PATH)\sensors\1.1\sensorscxstub.lib;$(SDK_LIB_PATH)\sensorsutils.lib - SensorsComboDriver.def @@ -181,7 +178,6 @@ %(AdditionalDependencies);$(SDK_LIB_PATH)\mincore.lib;$(SDK_LIB_PATH)\propsys.lib;$(SDK_LIB_PATH)\sensors\1.1\sensorscxstub.lib;$(SDK_LIB_PATH)\sensorsutils.lib - SensorsComboDriver.def @@ -197,4 +193,4 @@ - \ No newline at end of file + diff --git a/sensors/SimpleDeviceOrientationSensor/Device.h b/sensors/SimpleDeviceOrientationSensor/Device.h index b75b5ceb..3d1e677c 100644 --- a/sensors/SimpleDeviceOrientationSensor/Device.h +++ b/sensors/SimpleDeviceOrientationSensor/Device.h @@ -15,7 +15,7 @@ #include #include -#include +#include "SensorsTrace.h" #include #include diff --git a/sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h b/sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h index 8f96b902..7da0be14 100644 --- a/sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h +++ b/sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h @@ -14,7 +14,7 @@ #include #include -#include +#include "SensorsTrace.h" #include #include diff --git a/smartcrd/pscr/Pscr.vcxproj b/smartcrd/pscr/Pscr.vcxproj index 519d508f..2bcdd80d 100644 --- a/smartcrd/pscr/Pscr.vcxproj +++ b/smartcrd/pscr/Pscr.vcxproj @@ -99,15 +99,15 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\smclib.lib;$(DDK_LIB_PATH)\ntoskrnl.lib - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. @@ -115,15 +115,15 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\smclib.lib;$(DDK_LIB_PATH)\ntoskrnl.lib - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. @@ -131,15 +131,15 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\smclib.lib;$(DDK_LIB_PATH)\ntoskrnl.lib - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. @@ -147,15 +147,15 @@ %(AdditionalDependencies);$(DDK_LIB_PATH)\smclib.lib;$(DDK_LIB_PATH)\ntoskrnl.lib - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. @@ -179,4 +179,4 @@ - \ No newline at end of file + diff --git a/storage/class/classpnp/src/srblib.c b/storage/class/classpnp/src/srblib.c index a888d390..64a7ca88 100644 --- a/storage/class/classpnp/src/srblib.c +++ b/storage/class/classpnp/src/srblib.c @@ -22,7 +22,7 @@ Revision History: --*/ -#include +#include "classp.h" PVOID DefaultStorageRequestBlockAllocateRoutine( diff --git a/storage/miniports/lsi_u3/src/lsi_u3.inf b/storage/miniports/lsi_u3/src/lsi_u3.inf index 1225dad4..8d631d41 100644 Binary files a/storage/miniports/lsi_u3/src/lsi_u3.inf and b/storage/miniports/lsi_u3/src/lsi_u3.inf differ diff --git a/storage/msdsm/src/intrface.c b/storage/msdsm/src/intrface.c index e7c1eb29..925252be 100644 --- a/storage/msdsm/src/intrface.c +++ b/storage/msdsm/src/intrface.c @@ -2159,13 +2159,13 @@ Return Value: group->LBPolicySelection = DSM_DEFAULT_LB_POLICY_LUN_EXPLICIT; } - + if (!explicitlySet && !vidpidPolicySet && !overallPolicySet) { group->LBPolicySelection = DSM_DEFAULT_LB_POLICY_ALUA_CAPABILITY; - } - + } + // // If ALUA is enabled and the load balance policy is set to Round Robin, // we need to set it to Round Robin with Subset instead. @@ -2466,7 +2466,7 @@ Return Value: KIRQL irql; BOOLEAN retVal; ULONG SpecialHandlingFlag = 0; - + // // 1. If PR and reserved by this node, register the PR keys. // 2. Find the FOG for the passed in PathId @@ -2714,7 +2714,7 @@ Return Value: PDSM_FOG_DEVICELIST_ENTRY fogDeviceListEntry = NULL; PDSM_GROUP_ENTRY group = deviceInfo->Group; ULONG SpecialHandlingFlag = 0; - + TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_PNP, "DsmPathVerify (DevInfo %p): Entering function.\n", @@ -2722,22 +2722,6 @@ Return Value: if (DsmpIsDeviceInitialized(deviceInfo)) { - if (deviceInfo->Unresponsive) { - // - // Since the device is marked unresponsive, there - // is no point in sending RTPG or TUR down - // as that will fail by port driver. - // but that doesn't necessarily mean that the path doesn't exist. - // Return SUCCESS here so that MPIO doesn't remove - // disk in case of failover etc. - // If really this path is gone, this should get deleted - // as part of pnp removal and then if no other paths are left - // disk will be removed - // - status = STATUS_SUCCESS; - return status; - } - irql = ExAcquireSpinLockExclusive(&(dsmCtxt->DsmContextLock)); // @@ -2974,11 +2958,11 @@ Return Value: // Initialize all the entries to indicate that they haven't been processed. // for (entry = failGroup->ZombieGroupList.Flink; entry != &(failGroup->ZombieGroupList); entry = entry->Flink) { - + group = CONTAINING_RECORD(entry, DSM_ZOMBIEGROUP_ENTRY, ListEntry); group->Processed = FALSE; } - + // // Since we need to drop the spin lock while processing an entry, it is possible // that a removal in parallel frees up this entry during that time, thus making it @@ -2988,7 +2972,7 @@ Return Value: // of the list, skipping over the already processed ones. // entry = failGroup->ZombieGroupList.Flink; - + while (entry != &(failGroup->ZombieGroupList)) { group = CONTAINING_RECORD(entry, DSM_ZOMBIEGROUP_ENTRY, ListEntry); @@ -3165,7 +3149,7 @@ Return Value: BOOLEAN adminRequest = FALSE; PDSM_GROUP_ENTRY group = NULL; ULONG SpecialHandlingFlag = 0; - + TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_WMI, "DsmMoveDevice (DsmIds %p): Entering function - DsmContext %p MPIOPath (%p) SuggestedPath %p.\n", @@ -3613,7 +3597,7 @@ Return Value: cdb = SrbGetCdb(Srb); if (cdb) { opCode = cdb->AsByte[0]; - + } } @@ -3739,7 +3723,7 @@ Return Value: // 2. If the old path was supposed to be removed, check if there are // no more requests are outstanding, and if yes, remove the path // - + irpStack = IoGetCurrentIrpStackLocation(irp); oldPath = irpStack->Parameters.Others.Argument3; @@ -3788,7 +3772,7 @@ Return Value: } } else { - + *Status = STATUS_NO_SUCH_DEVICE; @@ -3796,7 +3780,7 @@ Return Value: TRACE_FLAG_RW, "DsmLBGetPath (DsmIds %p): Failed to get FO group in LBGetPath.\n", DsmList)); - + } @@ -4101,16 +4085,16 @@ Return Value: __Exit_DsmSrbDeviceControl: if (status != STATUS_PENDING) { - + // // Set-up the Irp status for mpio's completion of the request. // If it was IRP_MJ_SCSI, one of the helper routines set Srb->SrbStatus // already. // if ((irpStack->MajorFunction == IRP_MJ_SCSI) && - (Srb != NULL) && + (Srb != NULL) && (Srb->SrbStatus == SRB_STATUS_PENDING)) { - + Srb->SrbStatus = SRB_STATUS_ERROR; } @@ -4694,7 +4678,7 @@ Return Value: handled = TRUE; break; - } + } } } } @@ -4884,7 +4868,7 @@ Return Value: break; } - + default: { if ((scsiStatus == SCSISTAT_CHECK_CONDITION) && @@ -4998,7 +4982,7 @@ Return Value: if (failover) { ULONG SpecialHandlingFlag = 0; - + // // If ALUA is supported, then it is possible that we may need to send // down an STPG so build an IRP and fill in the SRB for STPG and send it down. @@ -5072,7 +5056,7 @@ Return Value: deviceInfo->Group->PathToBeUsed)); } } - } + } *Retry = retry; diff --git a/usb/UcmCxUcsi/UcmCxUcsi.vcxproj b/usb/UcmCxUcsi/UcmCxUcsi.vcxproj index 6a028bd4..6b1efbb1 100644 --- a/usb/UcmCxUcsi/UcmCxUcsi.vcxproj +++ b/usb/UcmCxUcsi/UcmCxUcsi.vcxproj @@ -90,6 +90,7 @@ pch.h + %(AdditionalIncludeDirectories);. true true trace.h @@ -128,4 +129,4 @@ - \ No newline at end of file + diff --git a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.vcxproj b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.vcxproj index e771d816..39422319 100644 --- a/usb/kmdf_enumswitches/sys/kmdf_enumswitches.vcxproj +++ b/usb/kmdf_enumswitches/sys/kmdf_enumswitches.vcxproj @@ -99,18 +99,18 @@ true Level4 - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING %(AdditionalDependencies);$(DDK_LIB_PATH)\ntstrsafe.lib;$(DDK_LIB_PATH)\wdmsec.lib - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -118,18 +118,18 @@ true Level4 - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING %(AdditionalDependencies);$(DDK_LIB_PATH)\ntstrsafe.lib;$(DDK_LIB_PATH)\wdmsec.lib - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -137,18 +137,18 @@ true Level4 - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING %(AdditionalDependencies);$(DDK_LIB_PATH)\ntstrsafe.lib;$(DDK_LIB_PATH)\wdmsec.lib - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -156,18 +156,18 @@ true Level4 - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING %(AdditionalDependencies);$(DDK_LIB_PATH)\ntstrsafe.lib;$(DDK_LIB_PATH)\wdmsec.lib - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -220,4 +220,4 @@ - \ No newline at end of file + diff --git a/usb/kmdf_fx2/driver/osrusbfx2.vcxproj b/usb/kmdf_fx2/driver/osrusbfx2.vcxproj index 08cde31a..2bcf6616 100644 --- a/usb/kmdf_fx2/driver/osrusbfx2.vcxproj +++ b/usb/kmdf_fx2/driver/osrusbfx2.vcxproj @@ -115,17 +115,17 @@ - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. true Level4 %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -134,17 +134,17 @@ - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. true Level4 %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -153,17 +153,17 @@ - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. true Level4 %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -172,17 +172,17 @@ - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. true Level4 %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -241,4 +241,4 @@ - \ No newline at end of file + diff --git a/usb/umdf2_fx2/driver/osrusbfx2um.vcxproj b/usb/umdf2_fx2/driver/osrusbfx2um.vcxproj index 72e39bc1..a4209763 100644 --- a/usb/umdf2_fx2/driver/osrusbfx2um.vcxproj +++ b/usb/umdf2_fx2/driver/osrusbfx2um.vcxproj @@ -114,17 +114,17 @@ true Level4 - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE @@ -135,17 +135,17 @@ true Level4 - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE @@ -156,17 +156,17 @@ true Level4 - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE @@ -177,17 +177,17 @@ true Level4 - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING;UNICODE;_UNICODE @@ -207,4 +207,4 @@ - \ No newline at end of file + diff --git a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj b/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj index 2db1f7c1..3974f664 100644 --- a/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj +++ b/usb/umdf_filter_kmdf/kmdf_driver/osrusbfx2.vcxproj @@ -115,17 +115,17 @@ - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. true Level4 %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -134,17 +134,17 @@ - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. true Level4 %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -153,17 +153,17 @@ - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. true Level4 %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -172,17 +172,17 @@ - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. true Level4 %(PreprocessorDefinitions);EVENT_TRACING - %(AdditionalIncludeDirectories);..\inc + %(AdditionalIncludeDirectories);..\inc;. %(PreprocessorDefinitions);EVENT_TRACING @@ -241,4 +241,4 @@ - \ No newline at end of file + diff --git a/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx b/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx index 40d31f8c..f79d7810 100644 --- a/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx +++ b/wpd/WpdHelloWorldDriver/WpdHelloWorldDriver.inx @@ -68,6 +68,7 @@ ServiceBinary=%12%\WUDFRd.sys [DestinationDirs] System32Copy=12,UMDF ; copy to system32\drivers\umdf +CoInstallers_CopyFiles= 11 [System32Copy] WpdHelloWorldDriver.dll diff --git a/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx b/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx index d293c9f7..5e20c4c3 100644 --- a/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx +++ b/wpd/WpdMultiTransportDriver/WpdMultiTransportDriver.inx @@ -69,6 +69,7 @@ ServiceBinary=%12%\WUDFRd.sys [DestinationDirs] System32Copy=12,UMDF ; copy to system32\drivers\umdf +CoInstallers_CopyFiles= 11 [System32Copy] WpdMultiTransportDriver.dll diff --git a/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx b/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx index 935a61cd..0f4365cc 100644 --- a/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx +++ b/wpd/WpdServiceSampleDriver/WpdServiceSampleDriver.inx @@ -65,6 +65,7 @@ ServiceBinary=%12%\WUDFRd.sys [DestinationDirs] System32Copy=12,UMDF ; copy to system32\drivers\umdf +CoInstallers_CopyFiles= 11 [System32Copy] WpdServiceSampleDriver.dll diff --git a/wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx b/wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx index c66eb485..a2e11b1b 100644 Binary files a/wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx and b/wpd/WpdWudfSampleDriver/WpdWudfSampleDriver.inx differ -- cgit v1.3.1 From fb27e1ecfc10630a3cb41f48c1816be30ec91f4c Mon Sep 17 00:00:00 2001 From: Barry Golden Date: Mon, 18 Sep 2017 13:36:25 -0700 Subject: Update README.md platform metadata. --- general/toaster/toastDrv/README.md | 2 +- general/umdfSkeleton/README.md | 2 +- serial/VirtualSerial/README.md | 2 +- usb/wdf_osrfx2_lab/README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/general/toaster/toastDrv/README.md b/general/toaster/toastDrv/README.md index 4a29ff7d..9e9a469a 100644 --- a/general/toaster/toastDrv/README.md +++ b/general/toaster/toastDrv/README.md @@ -1,6 +1,6 @@