ReactOS 0.4.17-dev-1190-g4c812f4
newdev.c
Go to the documentation of this file.
1/*
2 * New device installer (newdev.dll)
3 *
4 * Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
5 * 2005 Christoph von Wittich (Christoph@ActiveVB.de)
6 * 2009 Colin Finck (colin@reactos.org)
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include "newdev_private.h"
24
25#include <stdio.h>
26#include <winnls.h>
27
28/* Global variables */
30
31static BOOL
33 IN PDEVINSTDATA DevInstData,
35 IN LPCWSTR InfFile OPTIONAL);
36
37/*
38* @implemented
39*/
43 IN LPCWSTR HardwareId,
44 IN LPCWSTR FullInfPath,
45 IN DWORD InstallFlags,
46 OUT PBOOL bRebootRequired OPTIONAL)
47{
48 DEVINSTDATA DevInstData;
49 SP_DEVINSTALL_PARAMS InstallParams;
50 DWORD i;
53 LPCWSTR CurrentHardwareId; /* Pointer into Buffer */
55 BOOL FoundHardwareId, FoundAtLeastOneDevice = FALSE;
56 BOOL RebootRequired = FALSE;
57 BOOL ret = FALSE;
58
59 DevInstData.hDevInfo = INVALID_HANDLE_VALUE;
60
61 TRACE("UpdateDriverForPlugAndPlayDevicesW(%p %s %s 0x%x %p)\n",
62 hwndParent, debugstr_w(HardwareId), debugstr_w(FullInfPath), InstallFlags, bRebootRequired);
63
64 /* Check flags */
66 {
67 TRACE("Unknown flags: 0x%08lx\n", InstallFlags & ~(INSTALLFLAG_FORCE | INSTALLFLAG_READONLY | INSTALLFLAG_NONINTERACTIVE));
69 goto cleanup;
70 }
71
72 /* Enumerate all devices of the system */
74 if (DevInstData.hDevInfo == INVALID_HANDLE_VALUE)
75 goto cleanup;
76 DevInstData.devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
77 for (i = 0; ; i++)
78 {
79 if (!SetupDiEnumDeviceInfo(DevInstData.hDevInfo, i, &DevInstData.devInfoData))
80 {
82 {
83 TRACE("SetupDiEnumDeviceInfo() failed with error 0x%x\n", GetLastError());
84 goto cleanup;
85 }
86 /* This error was expected */
87 break;
88 }
89
90 /* Match Hardware ID */
91 FoundHardwareId = FALSE;
93 while (TRUE)
94 {
95 /* Get IDs data */
96 Buffer = NULL;
97 BufferSize = 0;
99 &DevInstData.devInfoData,
100 Property,
101 NULL,
102 (PBYTE)Buffer,
104 &BufferSize))
105 {
107 {
108 break;
109 }
111 {
112 TRACE("SetupDiGetDeviceRegistryPropertyW() failed with error 0x%x\n", GetLastError());
113 goto cleanup;
114 }
115 /* This error was expected */
118 if (!Buffer)
119 {
120 TRACE("HeapAlloc() failed\n", GetLastError());
122 goto cleanup;
123 }
124 }
125 if (Buffer)
126 {
127 /* Check if we match the given hardware ID */
128 for (CurrentHardwareId = Buffer; *CurrentHardwareId != UNICODE_NULL; CurrentHardwareId += wcslen(CurrentHardwareId) + 1)
129 {
130 if (_wcsicmp(CurrentHardwareId, HardwareId) == 0)
131 {
132 FoundHardwareId = TRUE;
133 break;
134 }
135 }
136 }
137 if (FoundHardwareId || Property == SPDRP_COMPATIBLEIDS)
138 {
139 break;
140 }
142 }
143 if (!FoundHardwareId)
144 continue;
145
146 /* We need to try to update the driver of this device */
147
148 /* Get Instance ID */
150 Buffer = NULL;
151 if (SetupDiGetDeviceInstanceIdW(DevInstData.hDevInfo, &DevInstData.devInfoData, NULL, 0, &BufferSize))
152 {
153 /* Error, as the output buffer should be too small */
155 goto cleanup;
156 }
158 {
159 TRACE("SetupDiGetDeviceInstanceIdW() failed with error 0x%x\n", GetLastError());
160 goto cleanup;
161 }
162 else if ((Buffer = HeapAlloc(GetProcessHeap(), 0, BufferSize * sizeof(WCHAR))) == NULL)
163 {
164 TRACE("HeapAlloc() failed\n", GetLastError());
166 goto cleanup;
167 }
168 else if (!SetupDiGetDeviceInstanceIdW(DevInstData.hDevInfo, &DevInstData.devInfoData, Buffer, BufferSize, NULL))
169 {
170 TRACE("SetupDiGetDeviceInstanceIdW() failed with error 0x%x\n", GetLastError());
171 goto cleanup;
172 }
173 TRACE("Trying to update the driver of %s\n", debugstr_w(Buffer));
174
175 /* Search driver in the specified .inf file */
176 if (!SearchDriver(&DevInstData, NULL, FullInfPath))
177 {
178 TRACE("SearchDriver() failed with error 0x%x\n", GetLastError());
179 continue;
180 }
181
182 /* FIXME: HACK! We shouldn't check of ERROR_PRIVILEGE_NOT_HELD */
183 //if (!InstallCurrentDriver(&DevInstData))
185 {
186 TRACE("InstallCurrentDriver() failed with error 0x%x\n", GetLastError());
187 continue;
188 }
189
190 /* Do we need to reboot? */
191 InstallParams.cbSize = sizeof(InstallParams);
193 &DevInstData.devInfoData,
194 &InstallParams))
195 {
196 if (InstallParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT))
197 RebootRequired = TRUE;
198 }
199
200 FoundAtLeastOneDevice = TRUE;
201 }
202
203 if (FoundAtLeastOneDevice)
204 {
205 if (bRebootRequired)
206 *bRebootRequired = RebootRequired;
207
209 ret = TRUE;
210 }
211 else
212 {
213 TRACE("No device found with HardwareID %s\n", debugstr_w(HardwareId));
215 }
216
217cleanup:
218 if (DevInstData.hDevInfo != INVALID_HANDLE_VALUE)
221 return ret;
222}
223
224/*
225* @implemented
226*/
230 IN LPCSTR HardwareId,
231 IN LPCSTR FullInfPath,
232 IN DWORD InstallFlags,
233 OUT PBOOL bRebootRequired OPTIONAL)
234{
235 BOOL Result;
236 LPWSTR HardwareIdW = NULL;
237 LPWSTR FullInfPathW = NULL;
238
239 int len = MultiByteToWideChar(CP_ACP, 0, HardwareId, -1, NULL, 0);
240 HardwareIdW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
241 if (!HardwareIdW)
242 {
244 return FALSE;
245 }
246 MultiByteToWideChar(CP_ACP, 0, HardwareId, -1, HardwareIdW, len);
247
248 len = MultiByteToWideChar(CP_ACP, 0, FullInfPath, -1, NULL, 0);
249 FullInfPathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
250 if (!FullInfPathW)
251 {
252 HeapFree(GetProcessHeap(), 0, HardwareIdW);
254 return FALSE;
255 }
256 MultiByteToWideChar(CP_ACP, 0, FullInfPath, -1, FullInfPathW, len);
257
260 HardwareIdW,
261 FullInfPathW,
262 InstallFlags,
263 bRebootRequired);
264
265 HeapFree(GetProcessHeap(), 0, HardwareIdW);
266 HeapFree(GetProcessHeap(), 0, FullInfPathW);
267
268 return Result;
269}
270
271/* Directory and InfFile MUST NOT be specified simultaneously */
272static BOOL
274 IN PDEVINSTDATA DevInstData,
276 IN LPCWSTR InfFile OPTIONAL)
277{
278 SP_DEVINSTALL_PARAMS_W DevInstallParams = {0,};
279 BOOL ret;
280
281 DevInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
282 if (!SetupDiGetDeviceInstallParamsW(DevInstData->hDevInfo, &DevInstData->devInfoData, &DevInstallParams))
283 {
284 TRACE("SetupDiGetDeviceInstallParams() failed with error 0x%x\n", GetLastError());
285 return FALSE;
286 }
287 DevInstallParams.FlagsEx |= DI_FLAGSEX_ALLOWEXCLUDEDDRVS;
288
289 if (InfFile)
290 {
291 DevInstallParams.Flags |= DI_ENUMSINGLEINF;
292 wcsncpy(DevInstallParams.DriverPath, InfFile, MAX_PATH);
293 }
294 else if (Directory)
295 {
296 DevInstallParams.Flags &= ~DI_ENUMSINGLEINF;
297 wcsncpy(DevInstallParams.DriverPath, Directory, MAX_PATH);
298 }
299 else
300 {
301 DevInstallParams.Flags &= ~DI_ENUMSINGLEINF;
302 *DevInstallParams.DriverPath = '\0';
303 }
304
306 DevInstData->hDevInfo,
307 &DevInstData->devInfoData,
308 &DevInstallParams);
309 if (!ret)
310 {
311 TRACE("SetupDiSetDeviceInstallParams() failed with error 0x%x\n", GetLastError());
312 return FALSE;
313 }
314
316 DevInstData->hDevInfo,
317 &DevInstData->devInfoData,
319 if (!ret)
320 {
321 TRACE("SetupDiBuildDriverInfoList() failed with error 0x%x\n", GetLastError());
322 return FALSE;
323 }
324
325 DevInstData->drvInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
327 DevInstData->hDevInfo,
328 &DevInstData->devInfoData,
330 0,
331 &DevInstData->drvInfoData);
332 if (!ret)
333 {
335 return FALSE;
336 TRACE("SetupDiEnumDriverInfo() failed with error 0x%x\n", GetLastError());
337 return FALSE;
338 }
339
340 return TRUE;
341}
342
343static BOOL
345{
346 if(wcscmp(str, L".") && wcscmp(str, L"..")) return FALSE;
347 return TRUE;
348}
349
350static LPCWSTR
352{
353 LPCWSTR Dot;
354
355 Dot = wcsrchr(FileName, '.');
356 if (!Dot)
357 return L"";
358
359 return Dot;
360}
361
362static BOOL
364 IN PDEVINSTDATA DevInstData,
366{
368 WCHAR DirPath[MAX_PATH];
370 WCHAR FullPath[MAX_PATH];
371 WCHAR LastDirPath[MAX_PATH] = L"";
372 WCHAR PathWithPattern[MAX_PATH];
373 BOOL ok = TRUE;
374 BOOL retval = FALSE;
375 HANDLE hFindFile = INVALID_HANDLE_VALUE;
376
377 wcscpy(DirPath, Path);
378
379 if (DirPath[wcslen(DirPath) - 1] != '\\')
380 wcscat(DirPath, L"\\");
381
382 wcscpy(PathWithPattern, DirPath);
383 wcscat(PathWithPattern, L"*");
384
385 for (hFindFile = FindFirstFileW(PathWithPattern, &wfd);
386 ok && hFindFile != INVALID_HANDLE_VALUE;
387 ok = FindNextFileW(hFindFile, &wfd))
388 {
389
391 if (IsDots(FileName))
392 continue;
393
395 {
396 /* Recursive search */
397 wcscpy(FullPath, DirPath);
398 wcscat(FullPath, FileName);
399 if (SearchDriverRecursive(DevInstData, FullPath))
400 {
401 retval = TRUE;
402 /* We continue the search for a better driver */
403 }
404 }
405 else
406 {
407 LPCWSTR pszExtension = GetFileExt(FileName);
408
409 if ((_wcsicmp(pszExtension, L".inf") == 0) && (wcscmp(LastDirPath, DirPath) != 0))
410 {
411 wcscpy(LastDirPath, DirPath);
412
413 if (wcslen(DirPath) > MAX_PATH)
414 /* Path is too long to be searched */
415 continue;
416
417 if (SearchDriver(DevInstData, DirPath, NULL))
418 {
419 retval = TRUE;
420 /* We continue the search for a better driver */
421 }
422
423 }
424 }
425 }
426
427 if (hFindFile != INVALID_HANDLE_VALUE)
428 FindClose(hFindFile);
429 return retval;
430}
431
432BOOL
434 _In_ PDEVINSTDATA DevInstData,
436{
437 return SearchDriverRecursive(DevInstData, pszDir);
438}
439
440BOOL
442 IN PDEVINSTDATA DevInstData)
443{
444 BOOL result;
445
446 /* Search in default location */
447 result = SearchDriver(DevInstData, NULL, NULL);
448
449 if (DevInstData->CustomSearchPath)
450 {
451 /* Search only in specified paths */
452 /* We need to check all specified directories to be
453 * sure to find the best driver for the device.
454 */
456 for (Path = DevInstData->CustomSearchPath; *Path != '\0'; Path += wcslen(Path) + 1)
457 {
458 TRACE("Search driver in %s\n", debugstr_w(Path));
459 if (wcslen(Path) == 2 && Path[1] == ':')
460 {
461 if (SearchDriverRecursive(DevInstData, Path))
462 result = TRUE;
463 }
464 else
465 {
466 if (SearchDriver(DevInstData, Path, NULL))
467 result = TRUE;
468 }
469 }
470 }
471
472 return result;
473}
474
475BOOL
477 IN PDEVINSTDATA DevInstData,
478 IN BOOL IncludeRemovableDevices,
479 IN BOOL IncludeCustomPath,
480 IN HWND hwndCombo OPTIONAL)
481{
482 WCHAR drive[] = {'?',':',0};
483 DWORD dwDrives = 0;
484 DWORD i;
485 UINT nType;
486 DWORD CustomTextLength = 0;
489 INT idx = (INT)SendMessageW(hwndCombo, CB_GETCURSEL, 0, 0);
490
491 /* Calculate length needed to store the search paths */
492 if (IncludeRemovableDevices)
493 {
494 dwDrives = GetLogicalDrives();
495 for (drive[0] = 'A', i = 1; drive[0] <= 'Z'; drive[0]++, i <<= 1)
496 {
497 if (dwDrives & i)
498 {
499 nType = GetDriveTypeW(drive);
500 if (nType == DRIVE_REMOVABLE || nType == DRIVE_CDROM)
501 {
502 LengthNeeded += 3;
503 }
504 }
505 }
506 }
507 if (IncludeCustomPath)
508 {
509 CustomTextLength = 1 + ((idx != CB_ERR) ?
510 (INT)SendMessageW(hwndCombo, CB_GETLBTEXTLEN, idx, 0) : ComboBox_GetTextLength(hwndCombo));
511 LengthNeeded += CustomTextLength;
512 }
513
514 /* Allocate space for search paths */
515 HeapFree(GetProcessHeap(), 0, DevInstData->CustomSearchPath);
516 DevInstData->CustomSearchPath = Buffer = HeapAlloc(
518 0,
519 (LengthNeeded + 1) * sizeof(WCHAR));
520 if (!Buffer)
521 {
522 TRACE("HeapAlloc() failed\n");
524 return FALSE;
525 }
526
527 /* Fill search paths */
528 if (IncludeRemovableDevices)
529 {
530 for (drive[0] = 'A', i = 1; drive[0] <= 'Z'; drive[0]++, i <<= 1)
531 {
532 if (dwDrives & i)
533 {
534 nType = GetDriveTypeW(drive);
535 if (nType == DRIVE_REMOVABLE || nType == DRIVE_CDROM)
536 {
537 Buffer += 1 + _swprintf(Buffer, drive);
538 }
539 }
540 }
541 }
542 if (IncludeCustomPath)
543 {
544 Buffer += 1 + ((idx != CB_ERR) ?
545 SendMessageW(hwndCombo, CB_GETLBTEXT, idx, (LPARAM)Buffer) :
546 GetWindowTextW(hwndCombo, Buffer, CustomTextLength));
547 }
548 *Buffer = '\0';
549
550 return TRUE;
551}
552
553BOOL
555 IN PDEVINSTDATA DevInstData)
556{
557 BOOL ret;
558
559 TRACE("Installing driver %s: %s\n",
560 debugstr_w(DevInstData->drvInfoData.MfgName),
561 debugstr_w(DevInstData->drvInfoData.Description));
562
565 DevInstData->hDevInfo,
566 &DevInstData->devInfoData);
567 if (!ret)
568 {
569 TRACE("SetupDiCallClassInstaller(DIF_SELECTBESTCOMPATDRV) failed with error 0x%x\n", GetLastError());
570 return FALSE;
571 }
572
575 DevInstData->hDevInfo,
576 &DevInstData->devInfoData);
577 if (!ret)
578 {
579 TRACE("SetupDiCallClassInstaller(DIF_ALLOW_INSTALL) failed with error 0x%x\n", GetLastError());
580 return FALSE;
581 }
582
585 DevInstData->hDevInfo,
586 &DevInstData->devInfoData);
587 if (!ret)
588 {
589 TRACE("SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_PREANALYZE) failed with error 0x%x\n", GetLastError());
590 return FALSE;
591 }
592
595 DevInstData->hDevInfo,
596 &DevInstData->devInfoData);
597 if (!ret)
598 {
599 TRACE("SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_POSTANALYZE) failed with error 0x%x\n", GetLastError());
600 return FALSE;
601 }
602
605 DevInstData->hDevInfo,
606 &DevInstData->devInfoData);
607 if (!ret)
608 {
609 TRACE("SetupDiCallClassInstaller(DIF_INSTALLDEVICEFILES) failed with error 0x%x\n", GetLastError());
610 return FALSE;
611 }
612
615 DevInstData->hDevInfo,
616 &DevInstData->devInfoData);
617 if (!ret)
618 {
619 TRACE("SetupDiCallClassInstaller(DIF_REGISTER_COINSTALLERS) failed with error 0x%x\n", GetLastError());
620 return FALSE;
621 }
622
625 DevInstData->hDevInfo,
626 &DevInstData->devInfoData);
627 if (!ret)
628 {
629 TRACE("SetupDiCallClassInstaller(DIF_INSTALLINTERFACES) failed with error 0x%x\n", GetLastError());
630 return FALSE;
631 }
632
635 DevInstData->hDevInfo,
636 &DevInstData->devInfoData);
637 if (!ret)
638 {
639 TRACE("SetupDiCallClassInstaller(DIF_INSTALLDEVICE) failed with error 0x%x\n", GetLastError());
640 return FALSE;
641 }
642
645 DevInstData->hDevInfo,
646 &DevInstData->devInfoData);
647 if (!ret)
648 {
649 TRACE("SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_FINISHINSTALL) failed with error 0x%x\n", GetLastError());
650 return FALSE;
651 }
652
655 DevInstData->hDevInfo,
656 &DevInstData->devInfoData);
657 if (!ret)
658 {
659 TRACE("SetupDiCallClassInstaller(DIF_DESTROYPRIVATEDATA) failed with error 0x%x\n", GetLastError());
660 return FALSE;
661 }
662
663 return TRUE;
664}
665
666/*
667* @implemented
668*/
674 IN INT Show)
675{
676 PDEVINSTDATA DevInstData = NULL;
677 BOOL ret;
678 DWORD config_flags;
679 BOOL retval = FALSE;
680
681 TRACE("(%p, %p, %s, %d)\n", hWndParent, hInstance, debugstr_w(InstanceId), Show);
682
683 if (!IsUserAdmin())
684 {
685 /* XP kills the process... */
687 }
688
689 DevInstData = HeapAlloc(GetProcessHeap(), 0, sizeof(DEVINSTDATA));
690 if (!DevInstData)
691 {
692 TRACE("HeapAlloc() failed\n");
694 goto cleanup;
695 }
696
697 /* Clear devinst data */
698 ZeroMemory(DevInstData, sizeof(DEVINSTDATA));
699 DevInstData->devInfoData.cbSize = 0; /* Tell if the devInfoData is valid */
700
701 /* Fill devinst data */
703 if (DevInstData->hDevInfo == INVALID_HANDLE_VALUE)
704 {
705 TRACE("SetupDiCreateDeviceInfoListExW() failed with error 0x%x\n", GetLastError());
706 goto cleanup;
707 }
708
709 DevInstData->devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
711 DevInstData->hDevInfo,
713 NULL,
714 0, /* Open flags */
715 &DevInstData->devInfoData);
716 if (!ret)
717 {
718 TRACE("SetupDiOpenDeviceInfoW() failed with error 0x%x (InstanceId %s)\n",
720 DevInstData->devInfoData.cbSize = 0;
721 goto cleanup;
722 }
723
726 DevInstData->hDevInfo,
727 &DevInstData->devInfoData,
729 &DevInstData->regDataType,
730 NULL, 0,
731 &DevInstData->requiredSize);
732
733 if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER && DevInstData->regDataType == REG_SZ)
734 {
735 DevInstData->buffer = HeapAlloc(GetProcessHeap(), 0, DevInstData->requiredSize);
736 if (!DevInstData->buffer)
737 {
738 TRACE("HeapAlloc() failed\n");
740 }
741 else
742 {
744 DevInstData->hDevInfo,
745 &DevInstData->devInfoData,
747 &DevInstData->regDataType,
748 DevInstData->buffer, DevInstData->requiredSize,
749 &DevInstData->requiredSize);
750 }
751 }
752 if (!ret)
753 {
754 TRACE("SetupDiGetDeviceRegistryProperty() failed with error 0x%x (InstanceId %s)\n",
756 goto cleanup;
757 }
758
760 DevInstData->hDevInfo,
761 &DevInstData->devInfoData,
763 NULL,
764 (BYTE *)&config_flags,
765 sizeof(config_flags),
766 NULL))
767 {
768 if (config_flags & CONFIGFLAG_FAILEDINSTALL)
769 {
770 /* The device is disabled */
771 TRACE("Device is disabled\n");
772 retval = TRUE;
773 goto cleanup;
774 }
775 }
776
777 TRACE("Installing %s (%s)\n", debugstr_w((PCWSTR)DevInstData->buffer), debugstr_w(InstanceId));
778
779 /* Search driver in default location and removable devices */
780 if (!PrepareFoldersToScan(DevInstData, FALSE, FALSE, NULL))
781 {
782 TRACE("PrepareFoldersToScan() failed with error 0x%lx\n", GetLastError());
783 goto cleanup;
784 }
785 if (ScanFoldersForDriver(DevInstData))
786 {
787 /* Driver found ; install it */
788 retval = InstallCurrentDriver(DevInstData);
789 TRACE("InstallCurrentDriver() returned %d\n", retval);
790 if (retval && Show != SW_HIDE)
791 {
792 /* Should we display the 'Need to reboot' page? */
793 SP_DEVINSTALL_PARAMS installParams;
794 installParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
796 DevInstData->hDevInfo,
797 &DevInstData->devInfoData,
798 &installParams))
799 {
800 if (installParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT))
801 {
802 TRACE("Displaying 'Reboot' wizard page\n");
804 }
805 }
806 }
807 goto cleanup;
808 }
809 else if (Show == SW_HIDE)
810 {
811 /* We can't show the wizard. Fail the install */
812 TRACE("No wizard\n");
813 goto cleanup;
814 }
815
816 /* Prepare the wizard, and display it */
817 TRACE("Need to show install wizard\n");
819
820cleanup:
821 if (DevInstData)
822 {
823 if (DevInstData->devInfoData.cbSize != 0)
824 {
825 if (!SetupDiDestroyDriverInfoList(DevInstData->hDevInfo, &DevInstData->devInfoData, SPDIT_COMPATDRIVER))
826 TRACE("SetupDiDestroyDriverInfoList() failed with error 0x%lx\n", GetLastError());
827 }
828 if (DevInstData->hDevInfo != INVALID_HANDLE_VALUE)
829 {
830 if (!SetupDiDestroyDeviceInfoList(DevInstData->hDevInfo))
831 TRACE("SetupDiDestroyDeviceInfoList() failed with error 0x%lx\n", GetLastError());
832 }
833 HeapFree(GetProcessHeap(), 0, DevInstData->buffer);
834 HeapFree(GetProcessHeap(), 0, DevInstData);
835 }
836
837 return retval;
838}
839
840
841BOOL
842WINAPI
846 IN BOOL bUpdate,
847 OUT LPDWORD lpReboot,
849{
850 PDEVINSTDATA DevInstData = NULL;
851 BOOL ret;
852 BOOL retval = FALSE;
853
854 TRACE("InstllDevInstEx(%p, %s, %d, %p, %lx)\n",
855 hWndParent, debugstr_w(InstanceId), bUpdate, lpReboot, Unknown);
856
857 DevInstData = HeapAlloc(GetProcessHeap(), 0, sizeof(DEVINSTDATA));
858 if (!DevInstData)
859 {
860 TRACE("HeapAlloc() failed\n");
862 goto cleanup;
863 }
864
865 /* Clear devinst data */
866 ZeroMemory(DevInstData, sizeof(DEVINSTDATA));
867 DevInstData->devInfoData.cbSize = 0; /* Tell if the devInfoData is valid */
868 DevInstData->bUpdate = bUpdate;
869
870 /* Fill devinst data */
872 if (DevInstData->hDevInfo == INVALID_HANDLE_VALUE)
873 {
874 TRACE("SetupDiCreateDeviceInfoListExW() failed with error 0x%x\n", GetLastError());
875 goto cleanup;
876 }
877
878 DevInstData->devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
880 DevInstData->hDevInfo,
882 NULL,
883 0, /* Open flags */
884 &DevInstData->devInfoData);
885 if (!ret)
886 {
887 TRACE("SetupDiOpenDeviceInfoW() failed with error 0x%x (InstanceId %s)\n",
889 DevInstData->devInfoData.cbSize = 0;
890 goto cleanup;
891 }
892
895 DevInstData->hDevInfo,
896 &DevInstData->devInfoData,
898 &DevInstData->regDataType,
899 NULL, 0,
900 &DevInstData->requiredSize);
901
902 if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER && DevInstData->regDataType == REG_SZ)
903 {
904 DevInstData->buffer = HeapAlloc(GetProcessHeap(), 0, DevInstData->requiredSize);
905 if (!DevInstData->buffer)
906 {
907 TRACE("HeapAlloc() failed\n");
909 }
910 else
911 {
913 DevInstData->hDevInfo,
914 &DevInstData->devInfoData,
916 &DevInstData->regDataType,
917 DevInstData->buffer, DevInstData->requiredSize,
918 &DevInstData->requiredSize);
919 }
920 }
921
922 if (!ret)
923 {
924 TRACE("SetupDiGetDeviceRegistryProperty() failed with error 0x%x (InstanceId %s)\n",
926 goto cleanup;
927 }
928
929 /* Prepare the wizard, and display it */
930 TRACE("Need to show install wizard\n");
932
933cleanup:
934 if (DevInstData)
935 {
936 if (DevInstData->devInfoData.cbSize != 0)
937 {
938 if (!SetupDiDestroyDriverInfoList(DevInstData->hDevInfo, &DevInstData->devInfoData, SPDIT_COMPATDRIVER))
939 TRACE("SetupDiDestroyDriverInfoList() failed with error 0x%lx\n", GetLastError());
940 }
941 if (DevInstData->hDevInfo != INVALID_HANDLE_VALUE)
942 {
943 if (!SetupDiDestroyDeviceInfoList(DevInstData->hDevInfo))
944 TRACE("SetupDiDestroyDeviceInfoList() failed with error 0x%lx\n", GetLastError());
945 }
946 HeapFree(GetProcessHeap(), 0, DevInstData->buffer);
947 HeapFree(GetProcessHeap(), 0, DevInstData);
948 }
949
950 return retval;
951}
952
953
954/*
955 * @implemented
956 */
957BOOL
958WINAPI
962 IN BOOL bUpdate,
963 OUT LPDWORD lpReboot)
964{
965 return InstallDevInstEx(hWndParent, InstanceId, bUpdate, lpReboot, 0);
966}
967
968
969/*
970* @implemented
971*/
974 IN HWND hWndOwner,
976 IN LPWSTR lpNamedPipeName,
977 IN INT Show)
978{
980 BOOL ShowWizard;
982 DWORD Value;
985 PWSTR InstallEventName = NULL;
987
988 /* Open the pipe */
989 hPipe = CreateFileW(lpNamedPipeName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
990
991 if(hPipe == INVALID_HANDLE_VALUE)
992 {
993 ERR("CreateFileW failed with error %u\n", GetLastError());
994 goto cleanup;
995 }
996
997 /* Read the data. Some is just included for compatibility with Windows right now and not yet used by ReactOS.
998 See umpnpmgr for more details. */
999 if(!ReadFile(hPipe, &Value, sizeof(Value), &BytesRead, NULL))
1000 {
1001 ERR("ReadFile failed with error %u\n", GetLastError());
1002 goto cleanup;
1003 }
1004
1005 InstallEventName = (PWSTR)HeapAlloc(GetProcessHeap(), 0, Value);
1006
1007 if(!ReadFile(hPipe, InstallEventName, Value, &BytesRead, NULL))
1008 {
1009 ERR("ReadFile failed with error %u\n", GetLastError());
1010 goto cleanup;
1011 }
1012
1013 /* I couldn't figure out what the following value means under Windows XP.
1014 Therefore I used it in umpnpmgr to pass the ShowWizard variable. */
1015 if(!ReadFile(hPipe, &ShowWizard, sizeof(ShowWizard), &BytesRead, NULL))
1016 {
1017 ERR("ReadFile failed with error %u\n", GetLastError());
1018 goto cleanup;
1019 }
1020
1021 /* Next one is again size in bytes of the following string */
1022 if(!ReadFile(hPipe, &Value, sizeof(Value), &BytesRead, NULL))
1023 {
1024 ERR("ReadFile failed with error %u\n", GetLastError());
1025 goto cleanup;
1026 }
1027
1029
1030 if(!ReadFile(hPipe, DeviceInstance, Value, &BytesRead, NULL))
1031 {
1032 ERR("ReadFile failed with error %u\n", GetLastError());
1033 goto cleanup;
1034 }
1035
1037 if(!ReturnValue)
1038 {
1039 ERR("DevInstallW failed with error %lu\n", GetLastError());
1040 goto cleanup;
1041 }
1042
1043 hInstallEvent = CreateEventW(NULL, TRUE, FALSE, InstallEventName);
1044 if(!hInstallEvent)
1045 {
1046 TRACE("CreateEventW('%ls') failed with error %lu\n", InstallEventName, GetLastError());
1047 goto cleanup;
1048 }
1049
1052
1053cleanup:
1054 if(hPipe != INVALID_HANDLE_VALUE)
1055 CloseHandle(hPipe);
1056
1057 if(InstallEventName)
1058 HeapFree(GetProcessHeap(), 0, InstallEventName);
1059
1060 if(DeviceInstance)
1062
1063 return ReturnValue;
1064}
1065
1071{
1073 {
1075
1077
1078 InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
1082 }
1083
1084 return TRUE;
1085}
PRTL_UNICODE_STRING_BUFFER Path
UINT32 void void ** ReturnValue
Definition: acevents.h:216
#define REG_SZ
Definition: layer.c:22
#define ok(value,...)
Definition: atltest.h:57
HANDLE hInstallEvent
Definition: install.c:40
#define ERR(fmt,...)
Definition: precomp.h:57
DWORD dwReason
Definition: misc.cpp:135
HINSTANCE hInstance
Definition: charmap.c:19
Definition: bufpool.h:45
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:904
static HWND hwndParent
Definition: cryptui.c:299
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define BufferSize
Definition: mmc.h:75
_In_ ULONG BufferSize
Definition: dispmprt.h:490
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:40
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define wcsrchr
Definition: compat.h:16
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define MultiByteToWideChar
Definition: compat.h:110
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
static void cleanup(void)
Definition: main.c:1335
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1382
DWORD WINAPI DECLSPEC_HOTPATCH GetLogicalDrives(void)
Definition: volume.c:513
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
#define IDD_WELCOMEPAGE
Definition: resource.h:21
#define IDD_NEEDREBOOT
Definition: resource.h:27
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid, HWND hwndParent, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:1502
BOOL WINAPI SetupDiSetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4847
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:2030
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4740
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4313
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3513
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2535
BOOL WINAPI SetupDiOpenDeviceInfoW(IN HDEVINFO DeviceInfoSet, IN PCWSTR DeviceInstanceId, IN HWND hwndParent OPTIONAL, IN DWORD OpenFlags, OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
Definition: devinst.c:5063
BOOL WINAPI SetupDiGetDeviceInstanceIdW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PWSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
Definition: devinst.c:2150
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:3182
BOOL WINAPI SetupDiBuildDriverInfoList(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType)
Definition: driver.c:572
BOOL WINAPI SetupDiEnumDriverInfoW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType, IN DWORD MemberIndex, OUT PSP_DRVINFO_DATA_W DriverInfoData)
Definition: driver.c:1209
BOOL WINAPI SetupDiDestroyDriverInfoList(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType)
Definition: driver.c:1062
static const WCHAR DeviceInstance[]
Definition: interface.c:28
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION _In_ ULONG _Out_opt_ PULONG LengthNeeded
Definition: fltkernel.h:1343
_Must_inspect_result_ _In_opt_ PVOID _In_opt_ PVOID InstanceId
Definition: fsrtlfuncs.h:908
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLsizei len
Definition: glext.h:6722
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
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
@ Unknown
Definition: i8042prt.h:114
#define debugstr_w
Definition: kernel32.h:32
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
BOOL * PBOOL
Definition: minwindef.h:137
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:303
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3962
static BOOL IsUserAdmin(VOID)
Definition: netid.c:163
BOOL WINAPI DevInstallW(IN HWND hWndParent, IN HINSTANCE hInstance, IN LPCWSTR InstanceId, IN INT Show)
Definition: newdev.c:670
BOOL ScanFoldersForDriver(IN PDEVINSTDATA DevInstData)
Definition: newdev.c:441
BOOL PrepareFoldersToScan(IN PDEVINSTDATA DevInstData, IN BOOL IncludeRemovableDevices, IN BOOL IncludeCustomPath, IN HWND hwndCombo OPTIONAL)
Definition: newdev.c:476
BOOL WINAPI ClientSideInstallW(IN HWND hWndOwner, IN HINSTANCE hInstance, IN LPWSTR lpNamedPipeName, IN INT Show)
Definition: newdev.c:973
BOOL WINAPI InstallDevInstEx(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot, IN DWORD Unknown)
Definition: newdev.c:843
BOOL WINAPI UpdateDriverForPlugAndPlayDevicesA(IN HWND hwndParent, IN LPCSTR HardwareId, IN LPCSTR FullInfPath, IN DWORD InstallFlags, OUT PBOOL bRebootRequired OPTIONAL)
Definition: newdev.c:228
static BOOL IsDots(IN LPCWSTR str)
Definition: newdev.c:344
static BOOL SearchDriver(IN PDEVINSTDATA DevInstData, IN LPCWSTR Directory OPTIONAL, IN LPCWSTR InfFile OPTIONAL)
Definition: newdev.c:273
static BOOL SearchDriverRecursive(IN PDEVINSTDATA DevInstData, IN LPCWSTR Path)
Definition: newdev.c:363
BOOL WINAPI DllMain(IN HINSTANCE hInstance, IN DWORD dwReason, IN LPVOID lpReserved)
Definition: newdev.c:1067
BOOL InstallCurrentDriver(IN PDEVINSTDATA DevInstData)
Definition: newdev.c:554
static LPCWSTR GetFileExt(IN LPWSTR FileName)
Definition: newdev.c:351
BOOL WINAPI InstallDevInst(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot)
Definition: newdev.c:959
BOOL WINAPI UpdateDriverForPlugAndPlayDevicesW(IN HWND hwndParent, IN LPCWSTR HardwareId, IN LPCWSTR FullInfPath, IN DWORD InstallFlags, OUT PBOOL bRebootRequired OPTIONAL)
Definition: newdev.c:41
HINSTANCE hDllInstance
Definition: newdev.c:29
BOOL CheckBestDriver(_In_ PDEVINSTDATA DevInstData, _In_ PCWSTR pszDir)
Definition: newdev.c:433
#define INSTALLFLAG_NONINTERACTIVE
Definition: newdev.h:36
#define INSTALLFLAG_FORCE
Definition: newdev.h:34
#define INSTALLFLAG_READONLY
Definition: newdev.h:35
BOOL DisplayWizard(IN PDEVINSTDATA DevInstData, IN HWND hwndParent, IN UINT startPage)
Definition: wizard.c:1372
#define _In_
Definition: no_sal2.h:158
#define Dot(u, v)
Definition: normal.c:49
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define UNICODE_NULL
BYTE * PBYTE
Definition: pedump.c:66
short WCHAR
Definition: pedump.c:58
#define INT
Definition: polytest.cpp:20
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define ICC_PROGRESS_CLASS
Definition: commctrl.h:63
#define SW_HIDE
Definition: winuser.h:779
#define CB_GETLBTEXTLEN
Definition: winuser.h:1982
#define CB_GETLBTEXT
Definition: winuser.h:1981
#define CB_ERR
Definition: winuser.h:2471
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
#define CB_GETCURSEL
Definition: winuser.h:1972
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CONFIGFLAG_FAILEDINSTALL
Definition: regstr.h:396
const WCHAR * str
wcsncpy
wcscat
wcscpy
#define DI_NEEDRESTART
Definition: setupapi.h:55
#define SPDRP_DEVICEDESC
Definition: setupapi.h:510
#define DIF_INSTALLDEVICEFILES
Definition: setupapi.h:143
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2648
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1158
#define ERROR_NO_SUCH_DEVINST
Definition: setupapi.h:310
#define SPDRP_COMPATIBLEIDS
Definition: setupapi.h:512
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2652
#define DI_ENUMSINGLEINF
Definition: setupapi.h:64
SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA
Definition: setupapi.h:1057
#define DIF_REGISTER_COINSTALLERS
Definition: setupapi.h:156
#define DIF_INSTALLINTERFACES
Definition: setupapi.h:154
#define DIGCF_ALLCLASSES
Definition: setupapi.h:175
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
#define DIF_NEWDEVICEWIZARD_PREANALYZE
Definition: setupapi.h:150
#define DIGCF_PRESENT
Definition: setupapi.h:174
#define DI_NEEDREBOOT
Definition: setupapi.h:56
#define DIF_INSTALLDEVICE
Definition: setupapi.h:124
#define DIF_ALLOW_INSTALL
Definition: setupapi.h:146
#define DIF_DESTROYPRIVATEDATA
Definition: setupapi.h:134
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
#define DI_FLAGSEX_ALLOWEXCLUDEDDRVS
Definition: setupapi.h:89
#define DIF_SELECTBESTCOMPATDRV
Definition: setupapi.h:145
#define SPDRP_CONFIGFLAGS
Definition: setupapi.h:520
#define SPDRP_HARDWAREID
Definition: setupapi.h:511
#define DIF_NEWDEVICEWIZARD_POSTANALYZE
Definition: setupapi.h:151
#define SPDIT_COMPATDRIVER
Definition: setupapi.h:509
#define DIF_NEWDEVICEWIZARD_FINISHINSTALL
Definition: setupapi.h:152
_In_ LPCSTR pszDir
Definition: shellapi.h:612
#define TRACE(s)
Definition: solgame.cpp:4
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
SP_DEVINFO_DATA devInfoData
HDEVINFO hDevInfo
DWORD requiredSize
WCHAR DriverPath[MAX_PATH]
Definition: setupapi.h:903
_Field_z_ WCHAR cFileName[MAX_PATH]
Definition: minwinbase.h:291
DWORD dwFileAttributes
Definition: minwinbase.h:283
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
uint16_t * PWSTR
Definition: typedefs.h:56
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint16_t * LPWSTR
Definition: typedefs.h:56
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
int retval
Definition: wcstombs.cpp:91
_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
Definition: wdfiotarget.h:870
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define DRIVE_CDROM
Definition: winbase.h:279
#define DRIVE_REMOVABLE
Definition: winbase.h:276
#define WINAPI
Definition: msvc.h:6
#define ComboBox_GetTextLength(hwndCtl)
Definition: windowsx.h:59
#define ERROR_GEN_FAILURE
Definition: winerror.h:256
#define ERROR_INVALID_FLAGS
Definition: winerror.h:907
#define ERROR_PRIVILEGE_NOT_HELD
Definition: winerror.h:1141
_In_ DWORD _In_ int _In_ int _In_opt_ LPNLSVERSIONINFO _In_opt_ LPVOID lpReserved
Definition: winnls.h:1279
_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
Definition: wsk.h:409
unsigned char BYTE
Definition: xxhash.c:193