54 BOOL FoundHardwareId, FoundAtLeastOneDevice =
FALSE;
59 TRACE(
"UpdateDriverForPlugAndPlayDevicesW(%p %s %s 0x%x %p)\n",
91 FoundHardwareId =
FALSE;
112 TRACE(
"SetupDiGetDeviceRegistryPropertyW() failed with error 0x%x\n",
GetLastError());
128 for (CurrentHardwareId =
Buffer; *CurrentHardwareId !=
UNICODE_NULL; CurrentHardwareId +=
wcslen(CurrentHardwareId) + 1)
130 if (
_wcsicmp(CurrentHardwareId, HardwareId) == 0)
132 FoundHardwareId =
TRUE;
143 if (!FoundHardwareId)
190 FoundAtLeastOneDevice =
TRUE;
193 if (FoundAtLeastOneDevice)
271 TRACE(
"SetupDiGetDeviceInstallParams() failed with error 0x%x\n",
GetLastError());
283 DevInstallParams.
Flags &= ~DI_ENUMSINGLEINF;
288 DevInstallParams.
Flags &= ~DI_ENUMSINGLEINF;
293 DevInstData->hDevInfo,
294 &DevInstData->devInfoData,
298 TRACE(
"SetupDiSetDeviceInstallParams() failed with error 0x%x\n",
GetLastError());
303 DevInstData->hDevInfo,
304 &DevInstData->devInfoData,
314 DevInstData->hDevInfo,
315 &DevInstData->devInfoData,
318 &DevInstData->drvInfoData);
366 if (DirPath[
wcslen(DirPath) - 1] !=
'\\')
369 wcscpy(PathWithPattern, DirPath);
384 wcscpy(FullPath, DirPath);
396 if ((
_wcsicmp(pszExtension,
L".inf") == 0) && (
wcscmp(LastDirPath, DirPath) != 0))
398 wcscpy(LastDirPath, DirPath);
436 if (DevInstData->CustomSearchPath)
465 IN BOOL IncludeRemovableDevices,
466 IN BOOL IncludeCustomPath,
473 DWORD CustomTextLength = 0;
478 if (IncludeRemovableDevices)
493 if (IncludeCustomPath)
507 TRACE(
"HeapAlloc() failed\n");
513 if (IncludeRemovableDevices)
527 if (IncludeCustomPath)
542 TRACE(
"Installing driver %s: %s\n",
544 debugstr_w(DevInstData->drvInfoData.Description));
548 DevInstData->hDevInfo,
549 &DevInstData->devInfoData);
552 TRACE(
"SetupDiCallClassInstaller(DIF_SELECTBESTCOMPATDRV) failed with error 0x%x\n",
GetLastError());
558 DevInstData->hDevInfo,
559 &DevInstData->devInfoData);
562 TRACE(
"SetupDiCallClassInstaller(DIF_ALLOW_INSTALL) failed with error 0x%x\n",
GetLastError());
568 DevInstData->hDevInfo,
569 &DevInstData->devInfoData);
572 TRACE(
"SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_PREANALYZE) failed with error 0x%x\n",
GetLastError());
578 DevInstData->hDevInfo,
579 &DevInstData->devInfoData);
582 TRACE(
"SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_POSTANALYZE) failed with error 0x%x\n",
GetLastError());
588 DevInstData->hDevInfo,
589 &DevInstData->devInfoData);
592 TRACE(
"SetupDiCallClassInstaller(DIF_INSTALLDEVICEFILES) failed with error 0x%x\n",
GetLastError());
598 DevInstData->hDevInfo,
599 &DevInstData->devInfoData);
602 TRACE(
"SetupDiCallClassInstaller(DIF_REGISTER_COINSTALLERS) failed with error 0x%x\n",
GetLastError());
608 DevInstData->hDevInfo,
609 &DevInstData->devInfoData);
612 TRACE(
"SetupDiCallClassInstaller(DIF_INSTALLINTERFACES) failed with error 0x%x\n",
GetLastError());
618 DevInstData->hDevInfo,
619 &DevInstData->devInfoData);
622 TRACE(
"SetupDiCallClassInstaller(DIF_INSTALLDEVICE) failed with error 0x%x\n",
GetLastError());
628 DevInstData->hDevInfo,
629 &DevInstData->devInfoData);
632 TRACE(
"SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_FINISHINSTALL) failed with error 0x%x\n",
GetLastError());
638 DevInstData->hDevInfo,
639 &DevInstData->devInfoData);
642 TRACE(
"SetupDiCallClassInstaller(DIF_DESTROYPRIVATEDATA) failed with error 0x%x\n",
GetLastError());
675 TRACE(
"HeapAlloc() failed\n");
688 TRACE(
"SetupDiCreateDeviceInfoListExW() failed with error 0x%x\n",
GetLastError());
701 TRACE(
"SetupDiOpenDeviceInfoW() failed with error 0x%x (InstanceId %s)\n",
721 TRACE(
"HeapAlloc() failed\n");
737 TRACE(
"SetupDiGetDeviceRegistryProperty() failed with error 0x%x (InstanceId %s)\n",
747 (
BYTE *)&config_flags,
748 sizeof(config_flags),
754 TRACE(
"Device is disabled\n");
772 TRACE(
"InstallCurrentDriver() returned %d\n",
retval);
785 TRACE(
"Displaying 'Reboot' wizard page\n");
795 TRACE(
"No wizard\n");
800 TRACE(
"Need to show install wizard\n");
809 TRACE(
"SetupDiDestroyDriverInfoList() failed with error 0x%lx\n",
GetLastError());
814 TRACE(
"SetupDiDestroyDeviceInfoList() failed with error 0x%lx\n",
GetLastError());
837 TRACE(
"InstllDevInstEx(%p, %s, %d, %p, %lx)\n",
843 TRACE(
"HeapAlloc() failed\n");
851 DevInstData->
bUpdate = bUpdate;
857 TRACE(
"SetupDiCreateDeviceInfoListExW() failed with error 0x%x\n",
GetLastError());
870 TRACE(
"SetupDiOpenDeviceInfoW() failed with error 0x%x (InstanceId %s)\n",
890 TRACE(
"HeapAlloc() failed\n");
907 TRACE(
"SetupDiGetDeviceRegistryProperty() failed with error 0x%x (InstanceId %s)\n",
913 TRACE(
"Need to show install wizard\n");
922 TRACE(
"SetupDiDestroyDriverInfoList() failed with error 0x%lx\n",
GetLastError());
927 TRACE(
"SetupDiDestroyDeviceInfoList() failed with error 0x%lx\n",
GetLastError());
1029 TRACE(
"CreateEventW('%ls') failed with error %lu\n", InstallEventName,
GetLastError());
1040 if(InstallEventName)
PRTL_UNICODE_STRING_BUFFER Path
UINT32 void void ** ReturnValue
static DWORD const LPVOID const lpReserved
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
#define ERROR_NOT_ENOUGH_MEMORY
#define ERROR_INSUFFICIENT_BUFFER
#define DLL_PROCESS_ATTACH
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define ERROR_NO_MORE_ITEMS
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
#define MultiByteToWideChar
#define ERROR_ACCESS_DENIED
static void cleanup(void)
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
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)
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
VOID WINAPI ExitProcess(IN UINT uExitCode)
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid, HWND hwndParent, PCWSTR MachineName, PVOID Reserved)
BOOL WINAPI SetupDiSetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
BOOL WINAPI SetupDiOpenDeviceInfoW(IN HDEVINFO DeviceInfoSet, IN PCWSTR DeviceInstanceId, IN HWND hwndParent OPTIONAL, IN DWORD OpenFlags, OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
BOOL WINAPI SetupDiGetDeviceInstanceIdW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PWSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
BOOL WINAPI SetupDiBuildDriverInfoList(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType)
BOOL WINAPI SetupDiEnumDriverInfoW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType, IN DWORD MemberIndex, OUT PSP_DRVINFO_DATA_W DriverInfoData)
BOOL WINAPI SetupDiDestroyDriverInfoList(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType)
static const WCHAR DeviceInstance[]
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION _In_ ULONG _Out_opt_ PULONG LengthNeeded
_Must_inspect_result_ _In_opt_ PVOID _In_opt_ PVOID InstanceId
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ERROR_FILE_NOT_FOUND
static VOID InitControls(HWND hwnd)
static BOOL IsUserAdmin(VOID)
BOOL WINAPI DevInstallW(IN HWND hWndParent, IN HINSTANCE hInstance, IN LPCWSTR InstanceId, IN INT Show)
BOOL ScanFoldersForDriver(IN PDEVINSTDATA DevInstData)
BOOL PrepareFoldersToScan(IN PDEVINSTDATA DevInstData, IN BOOL IncludeRemovableDevices, IN BOOL IncludeCustomPath, IN HWND hwndCombo OPTIONAL)
BOOL WINAPI ClientSideInstallW(IN HWND hWndOwner, IN HINSTANCE hInstance, IN LPWSTR lpNamedPipeName, IN INT Show)
BOOL WINAPI InstallDevInstEx(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot, IN DWORD Unknown)
BOOL WINAPI UpdateDriverForPlugAndPlayDevicesA(IN HWND hwndParent, IN LPCSTR HardwareId, IN LPCSTR FullInfPath, IN DWORD InstallFlags, OUT PBOOL bRebootRequired OPTIONAL)
static BOOL IsDots(IN LPCWSTR str)
static BOOL SearchDriver(IN PDEVINSTDATA DevInstData, IN LPCWSTR Directory OPTIONAL, IN LPCWSTR InfFile OPTIONAL)
static BOOL SearchDriverRecursive(IN PDEVINSTDATA DevInstData, IN LPCWSTR Path)
BOOL WINAPI DllMain(IN HINSTANCE hInstance, IN DWORD dwReason, IN LPVOID lpReserved)
BOOL InstallCurrentDriver(IN PDEVINSTDATA DevInstData)
static LPCWSTR GetFileExt(IN LPWSTR FileName)
BOOL WINAPI InstallDevInst(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot)
BOOL WINAPI UpdateDriverForPlugAndPlayDevicesW(IN HWND hwndParent, IN LPCWSTR HardwareId, IN LPCWSTR FullInfPath, IN DWORD InstallFlags, OUT PBOOL bRebootRequired OPTIONAL)
BOOL CheckBestDriver(_In_ PDEVINSTDATA DevInstData, _In_ PCWSTR pszDir)
#define INSTALLFLAG_NONINTERACTIVE
#define INSTALLFLAG_FORCE
#define INSTALLFLAG_READONLY
BOOL DisplayWizard(IN PDEVINSTDATA DevInstData, IN HWND hwndParent, IN UINT startPage)
#define FILE_ATTRIBUTE_DIRECTORY
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define ICC_PROGRESS_CLASS
#define CONFIGFLAG_FAILEDINSTALL
_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)
#define DIF_INSTALLDEVICEFILES
#define SetupDiGetDeviceInstallParams
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
#define ERROR_NO_SUCH_DEVINST
#define SPDRP_COMPATIBLEIDS
#define SetupDiGetDeviceRegistryProperty
SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA
#define DIF_REGISTER_COINSTALLERS
#define DIF_INSTALLINTERFACES
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
#define DIF_NEWDEVICEWIZARD_PREANALYZE
#define DIF_INSTALLDEVICE
#define DIF_ALLOW_INSTALL
#define DIF_DESTROYPRIVATEDATA
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
#define DI_FLAGSEX_ALLOWEXCLUDEDDRVS
#define DIF_SELECTBESTCOMPATDRV
#define SPDRP_CONFIGFLAGS
#define DIF_NEWDEVICEWIZARD_POSTANALYZE
#define SPDIT_COMPATDRIVER
#define DIF_NEWDEVICEWIZARD_FINISHINSTALL
PULONG MinorVersion OPTIONAL
base for all directory entries
SP_DEVINFO_DATA devInfoData
WCHAR DriverPath[MAX_PATH]
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetLogicalDrives(void)
#define ComboBox_GetTextLength(hwndCtl)
#define ERROR_GEN_FAILURE
#define ERROR_INVALID_FLAGS
#define ERROR_PRIVILEGE_NOT_HELD
#define SW_SHOWNOACTIVATE
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO