diff options
| author | Matthew Montera <[email protected]> | 2017-08-18 17:10:41 -0700 |
|---|---|---|
| committer | Matthew Montera <[email protected]> | 2017-08-18 17:10:41 -0700 |
| commit | 47282c86ceae6ebf779687737ea8ea38a0f3f2fa (patch) | |
| tree | 0747c4747cbbccf5f2323a99ae766c2cf9071d56 | |
| parent | f0fbfbdba856bb905a6466d47bd760cf8622ec0f (diff) | |
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.
44 files changed, 2595 insertions, 486 deletions
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 Binary files differindex c4cead6a..4b37e644 100644 --- 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 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 @@ <Platform Condition="'$(Platform)' == ''">Win32</Platform> <SampleGuid>{F915ED95-7BE9-4CDB-B09A-0D3F4C9657FE}</SampleGuid> <ProjectName>osrfx2_DCHU_base</ProjectName> - <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> @@ -42,7 +42,7 @@ <UseDebugLibraries>True</UseDebugLibraries> <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> @@ -50,7 +50,7 @@ <UseDebugLibraries>False</UseDebugLibraries> <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -58,12 +58,12 @@ <UseDebugLibraries>True</UseDebugLibraries> <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <PropertyGroup> - <OutDir>$(IntDir)</OutDir> + <OutDir>$(SolutionDir)$(Platform)\$(ConfigurationName)\</OutDir> </PropertyGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> @@ -137,6 +137,7 @@ </Midl> <Link> <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib;$(SDK_LIB_PATH)\WppRecorderUM.lib</AdditionalDependencies> + <IgnoreSpecificDefaultLibraries /> </Link> <Inf> <TimeStamp>1.0.0.0</TimeStamp> @@ -162,6 +163,7 @@ </Midl> <Link> <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib;$(SDK_LIB_PATH)\WppRecorderUM.lib</AdditionalDependencies> + <IgnoreSpecificDefaultLibraries /> </Link> <Inf> <TimeStamp>1.0.0.0</TimeStamp> @@ -187,6 +189,7 @@ </Midl> <Link> <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib;$(SDK_LIB_PATH)\WppRecorderUM.lib</AdditionalDependencies> + <IgnoreSpecificDefaultLibraries /> </Link> <Inf> <TimeStamp>1.0.0.0</TimeStamp> @@ -212,21 +215,30 @@ </Midl> <Link> <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib;$(SDK_LIB_PATH)\WppRecorderUM.lib</AdditionalDependencies> + <IgnoreSpecificDefaultLibraries /> </Link> <Inf> <TimeStamp>1.0.0.0</TimeStamp> </Inf> </ItemDefinitionGroup> <ItemGroup> + <FilesToPackage Include="$(SolutionDir)$(Platform)\$(ConfigurationName)\osrfx2_DCHU_base.dll" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <PackageRelativeDirectory> + </PackageRelativeDirectory> + </FilesToPackage> <FilesToPackage Include="$(SolutionDir)$(Platform)\$(ConfigurationName)\osrfx2_DCHU_filter.dll" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PackageRelativeDirectory> </PackageRelativeDirectory> </FilesToPackage> + <FilesToPackage Include="$(SolutionDir)$(Platform)\$(ConfigurationName)\osrfx2_DCHU_usersvc.exe" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <PackageRelativeDirectory> + </PackageRelativeDirectory> + </FilesToPackage> <FilesToPackage Include="$(SolutionDir)$(Platform)\$(ConfigurationName)\osrfx2_DCHU_filter.dll" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PackageRelativeDirectory> </PackageRelativeDirectory> </FilesToPackage> - <FilesToPackage Include="$(SolutionDir)$(Platform)\$(ConfigurationName)\osrfx2_DCHU_filter.dll" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <FilesToPackage Include="$(SolutionDir)$(Platform)\$(ConfigurationName)\osrfx2_DCHU_usersvc.exe" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PackageRelativeDirectory> </PackageRelativeDirectory> </FilesToPackage> @@ -234,11 +246,19 @@ <PackageRelativeDirectory> </PackageRelativeDirectory> </FilesToPackage> - <Inf Include="osrfx2_DCHU_base.inx" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'"> + <FilesToPackage Include="$(SolutionDir)$(Platform)\$(ConfigurationName)\osrfx2_DCHU_usersvc.exe" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <PackageRelativeDirectory> + </PackageRelativeDirectory> + </FilesToPackage> + <FilesToPackage Include="$(SolutionDir)$(Platform)\$(ConfigurationName)\osrfx2_DCHU_filter.dll" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PackageRelativeDirectory> </PackageRelativeDirectory> </FilesToPackage> + <FilesToPackage Include="$(SolutionDir)$(Platform)\$(ConfigurationName)\osrfx2_DCHU_usersvc.exe" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <PackageRelativeDirectory> + </PackageRelativeDirectory> + </FilesToPackage> + <Inf Include="osrfx2_DCHU_base.inx" /> </ItemGroup> <ItemGroup> <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> 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 @@ <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> <Platform Condition="'$(Platform)' == ''">Win32</Platform> <SampleGuid>{1A4A32BA-1596-4F52-BC48-B85A6D8D5D12}</SampleGuid> - <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion> <ProjectName>osrfx2_DCHU_filter</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> @@ -44,7 +44,7 @@ <UseDebugLibraries>True</UseDebugLibraries> <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> @@ -52,7 +52,7 @@ <UseDebugLibraries>False</UseDebugLibraries> <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -60,7 +60,7 @@ <UseDebugLibraries>True</UseDebugLibraries> <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> @@ -101,7 +101,7 @@ </ExceptionHandling> </ClCompile> <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib</AdditionalDependencies> + <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)onecore.lib</AdditionalDependencies> </Link> <ResourceCompile> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc</AdditionalIncludeDirectories> @@ -137,7 +137,7 @@ </ExceptionHandling> </ClCompile> <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\onecore.lib</AdditionalDependencies> + <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)onecore.lib</AdditionalDependencies> </Link> <ResourceCompile> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\..\inc</AdditionalIncludeDirectories> 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 @@ <Platform Condition="'$(Platform)' == ''">Win32</Platform> <SampleGuid>{F19E45AF-8B05-4204-A66B-9BDBFE333233}</SampleGuid> <ProjectName>osrfx2_DCHU_testapp</ProjectName> - <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> @@ -41,7 +41,7 @@ <UseDebugLibraries>True</UseDebugLibraries> <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType /> - <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> <ConfigurationType>Application</ConfigurationType> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> @@ -49,7 +49,7 @@ <UseDebugLibraries>False</UseDebugLibraries> <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType /> - <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> <ConfigurationType>Application</ConfigurationType> </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -57,7 +57,7 @@ <UseDebugLibraries>True</UseDebugLibraries> <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType /> - <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> <ConfigurationType>Application</ConfigurationType> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/CppWindowsService.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/CppWindowsService.cpp index 98a3975c..98a3975c 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/CppWindowsService.cpp +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/CppWindowsService.cpp 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_extension/osrfx2_DCHU_usersvc/Main.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h index dcbd950e..ecdfa4ad 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Main.h +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Main.h @@ -50,6 +50,15 @@ 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 { + 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 @@ -203,7 +212,7 @@ Return Value: VOID --*/ -VOID SetVariables(); +VOID SetVariables(VOID); /*++ @@ -240,7 +249,7 @@ Return Value: VOID --*/ -VOID ClearAllBars(HANDLE deviceHandle); +DWORD ClearAllBars(PHANDLE_CONTEXT Context); /*++ @@ -258,4 +267,76 @@ Return Value: VOID --*/ -VOID LightNextBar(HANDLE deviceHandle);
\ No newline at end of file +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_extension/osrfx2_DCHU_usersvc/SampleService.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp index c39e4838..0a246eb4 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.cpp +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.cpp @@ -29,7 +29,15 @@ Environment: #include "ThreadPool.h" #pragma endregion -HANDLE DeviceHandle; +// +// 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; /*++ @@ -149,19 +157,15 @@ CSampleService::OnStart( WriteToEventLog(L"SampleService in OnStart", EVENTLOG_INFORMATION_TYPE); - // - // Set variables in the base class - // + // + // Set up any variables the service needs. + // + SetVariables(); - // - // Open the device - // - DeviceHandle = OpenDevice(FALSE); - - if (DeviceHandle == INVALID_HANDLE_VALUE) - { - return; - } + // + // Set up the context, and register for notifications. + // + InitializeContext(&Context); // // Queue the main service function for execution in a worker thread. @@ -189,6 +193,8 @@ Return Value: VOID CSampleService::ServiceWorkerThread() { + DWORD Err = ERROR_SUCCESS; + // // Periodically check if the service is stopping. // @@ -198,8 +204,28 @@ CSampleService::ServiceWorkerThread() // Perform main service function here... // - ClearAllBars(DeviceHandle); - LightNextBar(DeviceHandle); + // + // 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. } @@ -235,6 +261,8 @@ Return Value: VOID CSampleService::OnStop() { + __debugbreak(); + // // Log a service stop message to the Application log. // @@ -251,4 +279,9 @@ CSampleService::OnStop() { 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_extension/osrfx2_DCHU_usersvc/SampleService.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h index eee8a609..eee8a609 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/SampleService.h +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/SampleService.h diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.cpp index 4c20af2e..4c20af2e 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.cpp +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.cpp diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.h index 106597e1..106597e1 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ServiceBase.h +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ServiceBase.h diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ThreadPool.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ThreadPool.h index 3d851537..3d851537 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/ThreadPool.h +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/ThreadPool.h diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.cpp b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.cpp index e8fc87ee..e8fc87ee 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.cpp +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.cpp diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.h b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.h index b619f461..b619f461 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/Utils.h +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/Utils.h diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters index 7f12a302..7f12a302 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.filters diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx Binary files differindex 61e1e958..61e1e958 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.inx diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj index 111fd2bf..8547d303 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj +++ b/general/DCHU/osrfx2_DCHU_base/osrfx2_DCHU_usersvc/osrfx2_DCHU_usersvc.vcxproj @@ -30,23 +30,23 @@ <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v141</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>v141</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>v141</PlatformToolset> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -93,7 +93,7 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> - <Optimization>Disabled</Optimization> + <Optimization>Full</Optimization> <PreprocessorDefinitions>WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -112,7 +112,7 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> - <Optimization>MaxSpeed</Optimization> + <Optimization>Full</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> @@ -136,7 +136,7 @@ <TargetEnvironment>X64</TargetEnvironment> </Midl> <ClCompile> - <Optimization>Disabled</Optimization> + <Optimization>Full</Optimization> <PreprocessorDefinitions>WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -162,10 +162,10 @@ <TargetEnvironment>X64</TargetEnvironment> </Midl> <ClCompile> - <Optimization>MaxSpeed</Optimization> + <Optimization>Full</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> <PrecompiledHeader> </PrecompiledHeader> 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_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_component/osrfx2_DCHU_component/osrfx2_DCHU_component.filters b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.filters index fa953f4c..fa953f4c 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.filters +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.filters diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.inx b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx index 8baab1a0..8baab1a0 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.inx +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.inx diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj index fed7ddf4..bc19d287 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_component/osrfx2_DCHU_component.vcxproj @@ -73,6 +73,7 @@ <ConfigurationType>Utility</ConfigurationType> <DriverType>Package</DriverType> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -81,6 +82,7 @@ <ConfigurationType>Utility</ConfigurationType> <DriverType>Package</DriverType> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -89,6 +91,7 @@ <ConfigurationType>Utility</ConfigurationType> <DriverType>Package</DriverType> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -97,6 +100,7 @@ <ConfigurationType>Utility</ConfigurationType> <DriverType>Package</DriverType> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp index c14e66d1..c14e66d1 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.cpp diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters index 395438fa..395438fa 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.filters diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj index 2bb8b05d..32ebdebe 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/osrfx2_DCHU_componentsoftware.vcxproj @@ -22,7 +22,7 @@ <ProjectGuid>{26D91630-B8FF-4102-A258-32F7D1C84E20}</ProjectGuid> <Keyword>Win32Proj</Keyword> <RootNamespace>osrfx2_DCHU_componentsoftware</RootNamespace> - <WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.16245.0</WindowsTargetPlatformVersion> <ProjectName>osrfx2_DCHU_componentsoftware</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.cpp b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.cpp index 79325e21..79325e21 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.cpp +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.cpp diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.h b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.h index edb61924..edb61924 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/stdafx.h +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/stdafx.h diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/targetver.h b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/targetver.h index 87c0086d..87c0086d 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_componentsoftware/targetver.h +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_componentsoftware/targetver.h diff --git a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component.sln b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension.sln index e09b5650..6cc1d6b0 100644 --- a/general/DCHU/osrfx2_DCHU_component/osrfx2_DCHU_component.sln +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension.sln @@ -1,17 +1,21 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.16 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_component", "osrfx2_DCHU_component", "{E498C537-BA1A-4E9D-8F1E-9DC7646D2E1A}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_extension", "osrfx2_DCHU_extension", "{4577857A-CCAE-42EB-BDE2-16C1E3DC7B14}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "osrfx2_DCHU_componentsoftware", "osrfx2_DCHU_componentsoftware", "{E50E958C-B5D0-43E0-9D81-87F484F11E9F}" +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 @@ -26,6 +30,30 @@ Global 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 @@ -67,7 +95,8 @@ Global 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} + {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/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters index 0ba1a59c..0ba1a59c 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters +++ b/general/DCHU/osrfx2_DCHU_extension_loose/osrfx2_DCHU_extension/osrfx2_DCHU_extension.filters 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|ARM"> + <Configuration>Debug</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|ARM64"> + <Configuration>Debug</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM64"> + <Configuration>Release</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <Inf Include="osrfx2_DCHU_extension.inx" /> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{0588DF70-3923-42E6-8DC9-13C2C0186F20}</ProjectGuid> + <TemplateGuid>{4605da2c-74a5-4865-98e1-152ef136825f}</TemplateGuid> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion> + <Configuration>Debug</Configuration> + <Platform Condition="'$(Platform)' == ''">Win32</Platform> + <RootNamespace>osrfx2_DCHU_extension</RootNamespace> + <ProjectName>osrfx2_DCHU_extension</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + <DriverType>Package</DriverType> + <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + <DriverType>Package</DriverType> + <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + <DriverType>Package</DriverType> + <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + <DriverType>Package</DriverType> + <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + <DriverType>Package</DriverType> + <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + <DriverType>Package</DriverType> + <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + <DriverType>Package</DriverType> + <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Utility</ConfigurationType> + <DriverType>Package</DriverType> + <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor> + <HardwareIdString /> + <CommandLine /> + <DeployFiles /> + <EnableVerifier>False</EnableVerifier> + <AllDrivers>False</AllDrivers> + <VerifyProjectOutput>True</VerifyProjectOutput> + <VerifyDrivers /> + <VerifyFlags>133563</VerifyFlags> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor> + <HardwareIdString /> + <CommandLine /> + <DeployFiles /> + <EnableVerifier>False</EnableVerifier> + <AllDrivers>False</AllDrivers> + <VerifyProjectOutput>True</VerifyProjectOutput> + <VerifyDrivers /> + <VerifyFlags>133563</VerifyFlags> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor> + <HardwareIdString /> + <CommandLine /> + <DeployFiles /> + <EnableVerifier>False</EnableVerifier> + <AllDrivers>False</AllDrivers> + <VerifyProjectOutput>True</VerifyProjectOutput> + <VerifyDrivers /> + <VerifyFlags>133563</VerifyFlags> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor> + <HardwareIdString /> + <CommandLine /> + <DeployFiles /> + <EnableVerifier>False</EnableVerifier> + <AllDrivers>False</AllDrivers> + <VerifyProjectOutput>True</VerifyProjectOutput> + <VerifyDrivers /> + <VerifyFlags>133563</VerifyFlags> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor> + <HardwareIdString /> + <CommandLine /> + <DeployFiles /> + <EnableVerifier>False</EnableVerifier> + <AllDrivers>False</AllDrivers> + <VerifyProjectOutput>True</VerifyProjectOutput> + <VerifyDrivers /> + <VerifyFlags>133563</VerifyFlags> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor> + <HardwareIdString /> + <CommandLine /> + <DeployFiles /> + <EnableVerifier>False</EnableVerifier> + <AllDrivers>False</AllDrivers> + <VerifyProjectOutput>True</VerifyProjectOutput> + <VerifyDrivers /> + <VerifyFlags>133563</VerifyFlags> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> + <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor> + <HardwareIdString /> + <CommandLine /> + <DeployFiles /> + <EnableVerifier>False</EnableVerifier> + <AllDrivers>False</AllDrivers> + <VerifyProjectOutput>True</VerifyProjectOutput> + <VerifyDrivers /> + <VerifyFlags>133563</VerifyFlags> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> + <DebuggerFlavor>DbgengRemoteDebugger</DebuggerFlavor> + <HardwareIdString /> + <CommandLine /> + <DeployFiles /> + <EnableVerifier>False</EnableVerifier> + <AllDrivers>False</AllDrivers> + <VerifyProjectOutput>True</VerifyProjectOutput> + <VerifyDrivers /> + <VerifyFlags>133563</VerifyFlags> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> + <Inf> + <Architecture>$(InfArch)</Architecture> + <TimeStamp>1.0.0.0</TimeStamp> + </Inf> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> + <Inf> + <Architecture>$(InfArch)</Architecture> + <TimeStamp>1.0.0.0</TimeStamp> + </Inf> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Inf> + <Architecture>$(InfArch)</Architecture> + <TimeStamp>1.0.0.0</TimeStamp> + </Inf> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Inf> + <Architecture>$(InfArch)</Architecture> + <TimeStamp>1.0.0.0</TimeStamp> + </Inf> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <Inf> + <Architecture>$(InfArch)</Architecture> + <TimeStamp>1.0.0.0</TimeStamp> + </Inf> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <Inf> + <Architecture>$(InfArch)</Architecture> + <TimeStamp>1.0.0.0</TimeStamp> + </Inf> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Inf> + <Architecture>$(InfArch)</Architecture> + <TimeStamp>1.0.0.0</TimeStamp> + </Inf> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Inf> + <Architecture>$(InfArch)</Architecture> + <TimeStamp>1.0.0.0</TimeStamp> + </Inf> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ 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 = <<DeviceInstanceId>> +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 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <Text Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="stdafx.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="stdafx.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="osrfx2_DCHU_componentsoftware.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{26D91630-B8FF-4102-A258-32F7D1C84E20}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>osrfx2_DCHU_componentsoftware</RootNamespace> + <WindowsTargetPlatformVersion>10.0.16245.0</WindowsTargetPlatformVersion> + <ProjectName>osrfx2_DCHU_componentsoftware</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>true</LinkIncremental> + <TargetName>$(ProjectName)</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + <TargetName>$(ProjectName)</TargetName> + <TargetExt>.exe</TargetExt> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>onecoreuap.lib;setupapi.lib;</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>onecoreuap.lib;setupapi.lib;</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader>Use</PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>onecoreuap.lib;setupapi.lib;</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader>Use</PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>onecoreuap.lib;setupapi.lib;</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <Text Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="stdafx.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="osrfx2_DCHU_componentsoftware.cpp" /> + <ClCompile Include="stdafx.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ 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 <stdio.h> +#include <stdlib.h> +#include <tchar.h> +#include <Windows.h> +#include <initguid.h> +#include <Devpkey.h> +#include <SetupAPI.h> +#include <strsafe.h> +#include <cfgmgr32.h> + +// 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 <SDKDDKVer.h> diff --git a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension.sln b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension.sln index 386ba436..40b15034 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension.sln +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension.sln @@ -1,18 +1,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.16 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}" +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 - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} = {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} + {26D91630-B8FF-4102-A258-32F7D1C84E20} = {26D91630-B8FF-4102-A258-32F7D1C84E20} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osrfx2_DCHU_usersvc", "osrfx2_DCHU_usersvc\osrfx2_DCHU_usersvc.vcxproj", "{DE70E2D1-6A4D-4984-BD82-CE750889F0D3}" +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 @@ -50,24 +50,24 @@ Global {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 + {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} - {DE70E2D1-6A4D-4984-BD82-CE750889F0D3} = {D10B02D6-7E48-4F78-8AAE-20C93E77FA52} + {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 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Driver Files"> + <UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier> + <Extensions>inf;inv;inx;mof;mc;</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <Inf Include="osrfx2_DCHU_extension.inx"> + <Filter>Driver Files</Filter> + </Inf> + </ItemGroup> +</Project>
\ 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/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj index 232cfa89..4542c3a7 100644 --- a/general/DCHU/osrfx2_DCHU_extension/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj +++ b/general/DCHU/osrfx2_DCHU_extension_tight/osrfx2_DCHU_extension/osrfx2_DCHU_extension.vcxproj @@ -35,23 +35,11 @@ </ProjectConfiguration> </ItemGroup> <ItemGroup> - <Inf Include="..\osrfx2_DCHU_usersvc\osrfx2_DCHU_usersvc.inx" /> + <Inf Include="..\osrfx2_DCHU_component\osrfx2_DCHU_component.inx" /> <Inf Include="osrfx2_DCHU_extension.inx" /> </ItemGroup> <ItemGroup> - <FilesToPackage Include="$(SolutionDir)$(Platform)\$(Configuration)\osrfx2_DCHU_usersvc.exel" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <PackageRelativeDirectory> - </PackageRelativeDirectory> - </FilesToPackage> - <FilesToPackage Include="$(SolutionDir)$(Platform)\$(Configuration)\osrfx2_DCHU_usersvc.exe" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <PackageRelativeDirectory> - </PackageRelativeDirectory> - </FilesToPackage> - <FilesToPackage Include="$(SolutionDir)$(Platform)\$(Configuration)\osrfx2_DCHU_usersvc.exe" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <PackageRelativeDirectory> - </PackageRelativeDirectory> - </FilesToPackage> - <FilesToPackage Include="$(SolutionDir)$(Platform)\$(Configuration)\osrfx2_DCHU_usersvc.exe" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <FilesToPackage Include="C:\Users\mamont\Documents\GitHub\Windows-driver-samples\general\DCHU\osrfx2_DCHU_extension_tight\x64\Release\osrfx2_DCHU_componentsoftware.exe"> <PackageRelativeDirectory> </PackageRelativeDirectory> </FilesToPackage> @@ -74,6 +62,7 @@ <ConfigurationType>Utility</ConfigurationType> <DriverType>Package</DriverType> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -82,6 +71,7 @@ <ConfigurationType>Utility</ConfigurationType> <DriverType>Package</DriverType> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -90,6 +80,7 @@ <ConfigurationType>Utility</ConfigurationType> <DriverType>Package</DriverType> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> @@ -98,6 +89,7 @@ <ConfigurationType>Utility</ConfigurationType> <DriverType>Package</DriverType> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> + <DriverTargetPlatform>Universal</DriverTargetPlatform> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> <TargetVersion>Windows10</TargetVersion> |
