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;
479 if (IncludeRemovableDevices)
494 if (IncludeCustomPath)
496 CustomTextLength = 1 + ((
idx !=
CB_ERR) ?
509 TRACE(
"HeapAlloc() failed\n");
515 if (IncludeRemovableDevices)
529 if (IncludeCustomPath)
546 TRACE(
"Installing driver %s: %s\n",
548 debugstr_w(DevInstData->drvInfoData.Description));
552 DevInstData->hDevInfo,
553 &DevInstData->devInfoData);
556 TRACE(
"SetupDiCallClassInstaller(DIF_SELECTBESTCOMPATDRV) failed with error 0x%x\n",
GetLastError());
562 DevInstData->hDevInfo,
563 &DevInstData->devInfoData);
566 TRACE(
"SetupDiCallClassInstaller(DIF_ALLOW_INSTALL) failed with error 0x%x\n",
GetLastError());
572 DevInstData->hDevInfo,
573 &DevInstData->devInfoData);
576 TRACE(
"SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_PREANALYZE) failed with error 0x%x\n",
GetLastError());
582 DevInstData->hDevInfo,
583 &DevInstData->devInfoData);
586 TRACE(
"SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_POSTANALYZE) failed with error 0x%x\n",
GetLastError());
592 DevInstData->hDevInfo,
593 &DevInstData->devInfoData);
596 TRACE(
"SetupDiCallClassInstaller(DIF_INSTALLDEVICEFILES) failed with error 0x%x\n",
GetLastError());
602 DevInstData->hDevInfo,
603 &DevInstData->devInfoData);
606 TRACE(
"SetupDiCallClassInstaller(DIF_REGISTER_COINSTALLERS) failed with error 0x%x\n",
GetLastError());
612 DevInstData->hDevInfo,
613 &DevInstData->devInfoData);
616 TRACE(
"SetupDiCallClassInstaller(DIF_INSTALLINTERFACES) failed with error 0x%x\n",
GetLastError());
622 DevInstData->hDevInfo,
623 &DevInstData->devInfoData);
626 TRACE(
"SetupDiCallClassInstaller(DIF_INSTALLDEVICE) failed with error 0x%x\n",
GetLastError());
632 DevInstData->hDevInfo,
633 &DevInstData->devInfoData);
636 TRACE(
"SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_FINISHINSTALL) failed with error 0x%x\n",
GetLastError());
642 DevInstData->hDevInfo,
643 &DevInstData->devInfoData);
646 TRACE(
"SetupDiCallClassInstaller(DIF_DESTROYPRIVATEDATA) failed with error 0x%x\n",
GetLastError());
679 TRACE(
"HeapAlloc() failed\n");
692 TRACE(
"SetupDiCreateDeviceInfoListExW() failed with error 0x%x\n",
GetLastError());
705 TRACE(
"SetupDiOpenDeviceInfoW() failed with error 0x%x (InstanceId %s)\n",
725 TRACE(
"HeapAlloc() failed\n");
741 TRACE(
"SetupDiGetDeviceRegistryProperty() failed with error 0x%x (InstanceId %s)\n",
751 (
BYTE *)&config_flags,
752 sizeof(config_flags),
758 TRACE(
"Device is disabled\n");
776 TRACE(
"InstallCurrentDriver() returned %d\n",
retval);
789 TRACE(
"Displaying 'Reboot' wizard page\n");
799 TRACE(
"No wizard\n");
804 TRACE(
"Need to show install wizard\n");
813 TRACE(
"SetupDiDestroyDriverInfoList() failed with error 0x%lx\n",
GetLastError());
818 TRACE(
"SetupDiDestroyDeviceInfoList() failed with error 0x%lx\n",
GetLastError());
841 TRACE(
"InstllDevInstEx(%p, %s, %d, %p, %lx)\n",
847 TRACE(
"HeapAlloc() failed\n");
855 DevInstData->
bUpdate = bUpdate;
861 TRACE(
"SetupDiCreateDeviceInfoListExW() failed with error 0x%x\n",
GetLastError());
874 TRACE(
"SetupDiOpenDeviceInfoW() failed with error 0x%x (InstanceId %s)\n",
894 TRACE(
"HeapAlloc() failed\n");
911 TRACE(
"SetupDiGetDeviceRegistryProperty() failed with error 0x%x (InstanceId %s)\n",
917 TRACE(
"Need to show install wizard\n");
926 TRACE(
"SetupDiDestroyDriverInfoList() failed with error 0x%lx\n",
GetLastError());
931 TRACE(
"SetupDiDestroyDeviceInfoList() failed with error 0x%lx\n",
GetLastError());
1033 TRACE(
"CreateEventW('%ls') failed with error %lu\n", InstallEventName,
GetLastError());
1044 if(InstallEventName)
PRTL_UNICODE_STRING_BUFFER Path
UINT32 void void ** ReturnValue
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)
DWORD WINAPI DECLSPEC_HOTPATCH GetLogicalDrives(void)
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
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
#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
#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]
_Field_z_ WCHAR cFileName[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)
#define ComboBox_GetTextLength(hwndCtl)
#define ERROR_GEN_FAILURE
#define ERROR_INVALID_FLAGS
#define ERROR_PRIVILEGE_NOT_HELD
_In_ DWORD _In_ int _In_ int _In_opt_ LPNLSVERSIONINFO _In_opt_ LPVOID lpReserved
#define SW_SHOWNOACTIVATE
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_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