Author: janderwald Date: Sun Mar 1 15:26:49 2015 New Revision: 66521 URL: http://svn.reactos.org/svn/reactos?rev=66521&view=rev Log: [STREAMCI] - install driver's inf
Modified: trunk/reactos/dll/win32/streamci/streamci.c Modified: trunk/reactos/dll/win32/streamci/streamci.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/streamci/streamci.c?rev=66521&r1=66520&r2=66521&view=diff ============================================================================== --- trunk/reactos/dll/win32/streamci/streamci.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/streamci/streamci.c [iso-8859-1] Sun Mar 1 15:26:49 2015 @@ -130,6 +130,53 @@ return dwResult; } +DWORD +InstallSoftwareDeviceInterfaceInf(IN LPWSTR InfName, + IN LPWSTR SectionName) +{ + HDEVINFO hDevInfo; + HINF hInf; + HKEY hKey; + SP_DEVICE_INTERFACE_DATA DeviceInterfaceData; + GUID SWBusGuid = {STATIC_BUSID_SoftwareDeviceEnumerator}; + + hDevInfo = SetupDiGetClassDevsW(&SWBusGuid, NULL, NULL, 0); + if (!hDevInfo) + { + // failed + return GetLastError(); + } + + DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA); + if (!SetupDiEnumDeviceInterfaces(hDevInfo, NULL, &SWBusGuid, 0, &DeviceInterfaceData)) + { + // failed + return GetLastError(); + } + + hInf = SetupOpenInfFileW(InfName, NULL, INF_STYLE_WIN4, NULL); + if (hInf == INVALID_HANDLE_VALUE) + { + SetupDiDestroyDeviceInfoList(hDevInfo); + return GetLastError(); + } + + // + // FIXME check if interface is already installed + // + + hKey = SetupDiCreateDeviceInterfaceRegKeyW(hDevInfo, &DeviceInterfaceData, 0, KEY_ALL_ACCESS, hInf, SectionName); + + SetupCloseInfFile(hInf); + SetupDiDestroyDeviceInfoList(hDevInfo); + if (hKey != INVALID_HANDLE_VALUE) + { + RegCloseKey(hKey); + } + return ERROR_SUCCESS; +} + + VOID WINAPI StreamingDeviceSetupW(IN HWND hwnd, @@ -137,11 +184,11 @@ IN LPWSTR lpszCmdLine, IN int nCmdShow) { - DWORD Length; + DWORD Length, dwResult; LPWSTR pCmdLine; LPWSTR pStr; GUID Guids[2]; - //WCHAR DevicePath[MAX_PATH]; + WCHAR DevicePath[MAX_PATH]; HRESULT hResult; DWORD Index; @@ -187,10 +234,19 @@ }while(Index < 2); - - hResult = InstallSoftwareDeviceInterface(&Guids[0], &Guids[1], pStr); - - // FIXME - // install inf section - + + dwResult = InstallSoftwareDeviceInterface(&Guids[0], &Guids[1], pStr); + if (dwResult == ERROR_SUCCESS) + { + pStr = wcstok(NULL, L",\t\""); + if (pStr != NULL) + { + wcscpy(DevicePath, pStr); + pStr = wcstok(NULL, L",\t\""); + if (pStr != NULL) + { + dwResult = InstallSoftwareDeviceInterfaceInf(DevicePath, pStr); + } + } + } }