46 TRACE(
"InstallInfSections()\n");
48 if (InfSection ==
NULL)
83 ERR(
"SetupInstallFromInfSectionW(%S) failed (Error %lx)\n", InfSection,
GetLastError());
104 TRACE(
"InstallInfSections() done %u\n",
ret);
116 WCHAR szKeyBuffer[128];
124 TRACE(
"CreateInstanceKey()\n");
126 *pInstanceKey =
NULL;
128 wcscpy(szKeyBuffer,
L"SYSTEM\\CurrentControlSet\\Control\\Network\\");
129 wcscat(szKeyBuffer, pComponentInfo->pszClassGuid);
136 ERR(
"UuidCreate() failed with RPC status 0x%lx\n", RpcStatus);
143 ERR(
"UuidToStringW() failed with RPC status 0x%lx\n", RpcStatus);
147 wcscat(szKeyBuffer, UuidString);
152 TRACE(
"szKeyBuffer %S\n", szKeyBuffer);
165 ERR(
"RegCreateKeyExW() failed with error 0x%lx\n", rc);
173 (
LPBYTE)&pComponentInfo->dwCharacteristics,
177 ERR(
"RegSetValueExW() failed with error 0x%lx\n", rc);
185 (
LPBYTE)pComponentInfo->pszComponentId,
186 (
wcslen(pComponentInfo->pszComponentId) + 1) *
sizeof(
WCHAR));
189 ERR(
"RegSetValueExW() failed with error 0x%lx\n", rc);
197 (
LPBYTE)pComponentInfo->pszDescription,
198 (
wcslen(pComponentInfo->pszDescription) + 1) *
sizeof(
WCHAR));
201 ERR(
"RegSetValueExW() failed with error 0x%lx\n", rc);
209 (
LPBYTE)pComponentInfo->pszInfPath,
210 (
wcslen(pComponentInfo->pszInfPath) + 1) *
sizeof(
WCHAR));
213 ERR(
"RegSetValueExW() failed with error 0x%lx\n", rc);
221 (
LPBYTE)pComponentInfo->pszInfSection,
222 (
wcslen(pComponentInfo->pszInfSection) + 1) *
sizeof(
WCHAR));
225 ERR(
"RegSetValueExW() failed with error 0x%lx\n", rc);
229 *pInstanceKey = hInstanceKey;
236 TRACE(
"CreateInstanceKey() done %u\n",
ret);
251 INFCONTEXT MfgContext, DevContext, MiscContext;
269 ERR(
"No Manufacurer section found!\n");
282 TRACE(
"Manufacturer: %S\n", szLineBuffer);
298 TRACE(
"Device: %S\n", szLineBuffer);
299 if (
_wcsicmp(szLineBuffer, pszComponentId) == 0)
301 TRACE(
"Found it!\n");
313 if (pComponentInfo->pszInfSection)
317 pComponentInfo->pszInfSection,
332 if (pComponentInfo->pszDescription)
336 pComponentInfo->pszDescription,
356 if (pComponentInfo->pszInfSection)
360 pComponentInfo->pszClassGuid,
368 pComponentInfo->pszInfSection,
374 (
PINT)&pComponentInfo->dwCharacteristics);
413 wcscpy(szPathBuffer, szInfPath);
414 wcscat(szPathBuffer,
L"\\*.inf");
422 if (
wcscmp(fdw.cFileName,
L".") == 0 ||
423 wcscmp(fdw.cFileName,
L"..") == 0)
426 TRACE(
"FileName: %S\n", fdw.cFileName);
428 wcscpy(szFullInfName, szInfPath);
430 wcscat(szFullInfName, fdw.cFileName);
432 TRACE(
"Full Inf Name: %S\n", szFullInfName);
440 if (pComponentInfo->pszFullInfPath)
441 wcscpy(pComponentInfo->pszFullInfPath, szFullInfName);
446 if (pComponentInfo->pszInfPath)
447 wcscpy(pComponentInfo->pszInfPath, fdw.cFileName);
452 if (pComponentInfo->pszComponentId)
453 wcscpy(pComponentInfo->pszComponentId, pszComponentId);
474 WCHAR szServiceName[64];
479 SC_HANDLE hManager =
NULL;
480 SC_HANDLE hService =
NULL;
485 if (hManager ==
NULL)
503 if (pServiceSection ==
NULL)
509 wcscpy(pServiceSection, pComponentInfo->pszInfSection);
510 wcscat(pServiceSection,
L".Service");
512 TRACE(
"ServiceSection: %S\n", pServiceSection);
555 if (hManager !=
NULL)
568 TRACE(
"InstallNetworkComponent(%S)\n", pszComponentId);
603 if (hInstanceKey !=
NULL)
#define RegCloseKey(hKey)
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
static DWORD DWORD * dwLength
static void cleanup(void)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
BOOL WINAPI SetupInstallFromInfSectionW(HWND owner, HINF hinf, PCWSTR section, UINT flags, HKEY key_root, PCWSTR src_root, UINT copy_flags, PSP_FILE_CALLBACK_W callback, PVOID context, HDEVINFO devinfo, PSP_DEVINFO_DATA devinfo_data)
BOOL WINAPI SetupInstallServicesFromInfSectionW(_In_ HINF InfHandle, _In_ PCWSTR SectionName, _In_ DWORD Flags)
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
void WINAPI SetupTermDefaultQueueCallback(PVOID context)
PVOID WINAPI SetupInitDefaultQueueCallback(HWND owner)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOL InstallNetworkComponent(_In_ PCWSTR pszComponentId)
static BOOL ScanForInfFile(_In_ PCWSTR pszComponentId, _In_ PCOMPONENT_INFO pComponentInfo)
static BOOL InstallInfSections(_In_ HWND hWnd, _In_ HKEY hKey, _In_ LPCWSTR InfFile, _In_ LPCWSTR InfSection)
static BOOL CreateInstanceKey(_In_ PCOMPONENT_INFO pComponentInfo, _Out_ PHKEY pInstanceKey)
static BOOL CheckInfFile(_In_ PWSTR pszFullInfName, _In_ PCWSTR pszComponentId, _In_ PCOMPONENT_INFO pComponentInfo)
struct _COMPONENT_INFO COMPONENT_INFO
struct _COMPONENT_INFO * PCOMPONENT_INFO
static VOID StartNetworkServices(_In_ PCOMPONENT_INFO pComponentInfo)
#define KEY_CREATE_SUB_KEY
#define REG_OPTION_NON_VOLATILE
RPC_STATUS WINAPI UuidToStringW(UUID *Uuid, RPC_WSTR *StringUuid)
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
DWORD WINAPI GetLastError(void)
#define ERROR_GEN_FAILURE
#define RPC_S_UUID_LOCAL_ONLY
#define HKEY_LOCAL_MACHINE
#define SC_MANAGER_ALL_ACCESS