ReactOS  0.4.13-dev-100-gc8611ae
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 
31 static 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  DWORD i;
50  LPWSTR Buffer = NULL;
52  LPCWSTR CurrentHardwareId; /* Pointer into Buffer */
53  BOOL FoundHardwareId, FoundAtLeastOneDevice = FALSE;
54  BOOL ret = FALSE;
55 
56  DevInstData.hDevInfo = INVALID_HANDLE_VALUE;
57 
58  TRACE("UpdateDriverForPlugAndPlayDevicesW(%p %s %s 0x%x %p)\n",
59  hwndParent, debugstr_w(HardwareId), debugstr_w(FullInfPath), InstallFlags, bRebootRequired);
60 
61  /* FIXME: InstallFlags bRebootRequired ignored! */
62 
63  /* Check flags */
65  {
66  TRACE("Unknown flags: 0x%08lx\n", InstallFlags & ~(INSTALLFLAG_FORCE | INSTALLFLAG_READONLY | INSTALLFLAG_NONINTERACTIVE));
68  goto cleanup;
69  }
70 
71  /* Enumerate all devices of the system */
73  if (DevInstData.hDevInfo == INVALID_HANDLE_VALUE)
74  goto cleanup;
75  DevInstData.devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
76  for (i = 0; ; i++)
77  {
78  if (!SetupDiEnumDeviceInfo(DevInstData.hDevInfo, i, &DevInstData.devInfoData))
79  {
81  {
82  TRACE("SetupDiEnumDeviceInfo() failed with error 0x%x\n", GetLastError());
83  goto cleanup;
84  }
85  /* This error was expected */
86  break;
87  }
88 
89  /* Get Hardware ID */
91  Buffer = NULL;
92  BufferSize = 0;
94  DevInstData.hDevInfo,
95  &DevInstData.devInfoData,
97  NULL,
98  (PBYTE)Buffer,
99  BufferSize,
100  &BufferSize))
101  {
103  {
104  Buffer = NULL;
105  break;
106  }
108  {
109  TRACE("SetupDiGetDeviceRegistryPropertyW() failed with error 0x%x\n", GetLastError());
110  goto cleanup;
111  }
112  /* This error was expected */
115  if (!Buffer)
116  {
117  TRACE("HeapAlloc() failed\n", GetLastError());
119  goto cleanup;
120  }
121  }
122  if (Buffer == NULL)
123  continue;
124 
125  /* Check if we match the given hardware ID */
126  FoundHardwareId = FALSE;
127  for (CurrentHardwareId = Buffer; *CurrentHardwareId != UNICODE_NULL; CurrentHardwareId += wcslen(CurrentHardwareId) + 1)
128  {
129  if (wcscmp(CurrentHardwareId, HardwareId) == 0)
130  {
131  FoundHardwareId = TRUE;
132  break;
133  }
134  }
135  if (!FoundHardwareId)
136  continue;
137 
138  /* We need to try to update the driver of this device */
139 
140  /* Get Instance ID */
142  Buffer = NULL;
143  if (SetupDiGetDeviceInstanceIdW(DevInstData.hDevInfo, &DevInstData.devInfoData, NULL, 0, &BufferSize))
144  {
145  /* Error, as the output buffer should be too small */
147  goto cleanup;
148  }
150  {
151  TRACE("SetupDiGetDeviceInstanceIdW() failed with error 0x%x\n", GetLastError());
152  goto cleanup;
153  }
154  else if ((Buffer = HeapAlloc(GetProcessHeap(), 0, BufferSize * sizeof(WCHAR))) == NULL)
155  {
156  TRACE("HeapAlloc() failed\n", GetLastError());
158  goto cleanup;
159  }
160  else if (!SetupDiGetDeviceInstanceIdW(DevInstData.hDevInfo, &DevInstData.devInfoData, Buffer, BufferSize, NULL))
161  {
162  TRACE("SetupDiGetDeviceInstanceIdW() failed with error 0x%x\n", GetLastError());
163  goto cleanup;
164  }
165  TRACE("Trying to update the driver of %s\n", debugstr_w(Buffer));
166 
167  /* Search driver in the specified .inf file */
168  if (!SearchDriver(&DevInstData, NULL, FullInfPath))
169  {
170  TRACE("SearchDriver() failed with error 0x%x\n", GetLastError());
171  continue;
172  }
173 
174  /* FIXME: HACK! We shouldn't check of ERROR_PRIVILEGE_NOT_HELD */
175  //if (!InstallCurrentDriver(&DevInstData))
177  {
178  TRACE("InstallCurrentDriver() failed with error 0x%x\n", GetLastError());
179  continue;
180  }
181 
182  FoundAtLeastOneDevice = TRUE;
183  }
184 
185  if (FoundAtLeastOneDevice)
186  {
188  ret = TRUE;
189  }
190  else
191  {
192  TRACE("No device found with HardwareID %s\n", debugstr_w(HardwareId));
194  }
195 
196 cleanup:
197  if (DevInstData.hDevInfo != INVALID_HANDLE_VALUE)
200  return ret;
201 }
202 
203 /*
204 * @implemented
205 */
206 BOOL WINAPI
209  IN LPCSTR HardwareId,
210  IN LPCSTR FullInfPath,
211  IN DWORD InstallFlags,
212  OUT PBOOL bRebootRequired OPTIONAL)
213 {
214  BOOL Result;
215  LPWSTR HardwareIdW = NULL;
216  LPWSTR FullInfPathW = NULL;
217 
218  int len = MultiByteToWideChar(CP_ACP, 0, HardwareId, -1, NULL, 0);
219  HardwareIdW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
220  if (!HardwareIdW)
221  {
223  return FALSE;
224  }
225  MultiByteToWideChar(CP_ACP, 0, HardwareId, -1, HardwareIdW, len);
226 
227  len = MultiByteToWideChar(CP_ACP, 0, FullInfPath, -1, NULL, 0);
228  FullInfPathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
229  if (!FullInfPathW)
230  {
231  HeapFree(GetProcessHeap(), 0, HardwareIdW);
233  return FALSE;
234  }
235  MultiByteToWideChar(CP_ACP, 0, FullInfPath, -1, FullInfPathW, len);
236 
238  hwndParent,
239  HardwareIdW,
240  FullInfPathW,
241  InstallFlags,
242  bRebootRequired);
243 
244  HeapFree(GetProcessHeap(), 0, HardwareIdW);
245  HeapFree(GetProcessHeap(), 0, FullInfPathW);
246 
247  return Result;
248 }
249 
250 /* Directory and InfFile MUST NOT be specified simultaneously */
251 static BOOL
253  IN PDEVINSTDATA DevInstData,
255  IN LPCWSTR InfFile OPTIONAL)
256 {
257  SP_DEVINSTALL_PARAMS_W DevInstallParams = {0,};
258  BOOL ret;
259 
260  DevInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
261  if (!SetupDiGetDeviceInstallParamsW(DevInstData->hDevInfo, &DevInstData->devInfoData, &DevInstallParams))
262  {
263  TRACE("SetupDiGetDeviceInstallParams() failed with error 0x%x\n", GetLastError());
264  return FALSE;
265  }
266  DevInstallParams.FlagsEx |= DI_FLAGSEX_ALLOWEXCLUDEDDRVS;
267 
268  if (InfFile)
269  {
270  DevInstallParams.Flags |= DI_ENUMSINGLEINF;
271  wcsncpy(DevInstallParams.DriverPath, InfFile, MAX_PATH);
272  }
273  else if (Directory)
274  {
275  DevInstallParams.Flags &= ~DI_ENUMSINGLEINF;
276  wcsncpy(DevInstallParams.DriverPath, Directory, MAX_PATH);
277  }
278  else
279  {
280  DevInstallParams.Flags &= ~DI_ENUMSINGLEINF;
281  *DevInstallParams.DriverPath = '\0';
282  }
283 
285  DevInstData->hDevInfo,
286  &DevInstData->devInfoData,
287  &DevInstallParams);
288  if (!ret)
289  {
290  TRACE("SetupDiSetDeviceInstallParams() failed with error 0x%x\n", GetLastError());
291  return FALSE;
292  }
293 
295  DevInstData->hDevInfo,
296  &DevInstData->devInfoData,
298  if (!ret)
299  {
300  TRACE("SetupDiBuildDriverInfoList() failed with error 0x%x\n", GetLastError());
301  return FALSE;
302  }
303 
304  DevInstData->drvInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
306  DevInstData->hDevInfo,
307  &DevInstData->devInfoData,
309  0,
310  &DevInstData->drvInfoData);
311  if (!ret)
312  {
314  return FALSE;
315  TRACE("SetupDiEnumDriverInfo() failed with error 0x%x\n", GetLastError());
316  return FALSE;
317  }
318 
319  return TRUE;
320 }
321 
322 static BOOL
324 {
325  if(wcscmp(str, L".") && wcscmp(str, L"..")) return FALSE;
326  return TRUE;
327 }
328 
329 static LPCWSTR
331 {
332  LPCWSTR Dot;
333 
334  Dot = wcsrchr(FileName, '.');
335  if (!Dot)
336  return L"";
337 
338  return Dot;
339 }
340 
341 static BOOL
343  IN PDEVINSTDATA DevInstData,
344  IN LPCWSTR Path)
345 {
346  WIN32_FIND_DATAW wfd;
347  WCHAR DirPath[MAX_PATH];
349  WCHAR FullPath[MAX_PATH];
350  WCHAR LastDirPath[MAX_PATH] = L"";
351  WCHAR PathWithPattern[MAX_PATH];
352  BOOL ok = TRUE;
353  BOOL retval = FALSE;
354  HANDLE hFindFile = INVALID_HANDLE_VALUE;
355 
356  wcscpy(DirPath, Path);
357 
358  if (DirPath[wcslen(DirPath) - 1] != '\\')
359  wcscat(DirPath, L"\\");
360 
361  wcscpy(PathWithPattern, DirPath);
362  wcscat(PathWithPattern, L"\\*");
363 
364  for (hFindFile = FindFirstFileW(PathWithPattern, &wfd);
365  ok && hFindFile != INVALID_HANDLE_VALUE;
366  ok = FindNextFileW(hFindFile, &wfd))
367  {
368 
369  wcscpy(FileName, wfd.cFileName);
370  if (IsDots(FileName))
371  continue;
372 
373  if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
374  {
375  /* Recursive search */
376  wcscpy(FullPath, DirPath);
377  wcscat(FullPath, FileName);
378  if (SearchDriverRecursive(DevInstData, FullPath))
379  {
380  retval = TRUE;
381  /* We continue the search for a better driver */
382  }
383  }
384  else
385  {
386  LPCWSTR pszExtension = GetFileExt(FileName);
387 
388  if ((_wcsicmp(pszExtension, L".inf") == 0) && (wcscmp(LastDirPath, DirPath) != 0))
389  {
390  wcscpy(LastDirPath, DirPath);
391 
392  if (wcslen(DirPath) > MAX_PATH)
393  /* Path is too long to be searched */
394  continue;
395 
396  if (SearchDriver(DevInstData, DirPath, NULL))
397  {
398  retval = TRUE;
399  /* We continue the search for a better driver */
400  }
401 
402  }
403  }
404  }
405 
406  if (hFindFile != INVALID_HANDLE_VALUE)
407  FindClose(hFindFile);
408  return retval;
409 }
410 
411 BOOL
413  IN PDEVINSTDATA DevInstData)
414 {
415  BOOL result;
416 
417  /* Search in default location */
418  result = SearchDriver(DevInstData, NULL, NULL);
419 
420  if (DevInstData->CustomSearchPath)
421  {
422  /* Search only in specified paths */
423  /* We need to check all specified directories to be
424  * sure to find the best driver for the device.
425  */
426  LPCWSTR Path;
427  for (Path = DevInstData->CustomSearchPath; *Path != '\0'; Path += wcslen(Path) + 1)
428  {
429  TRACE("Search driver in %s\n", debugstr_w(Path));
430  if (wcslen(Path) == 2 && Path[1] == ':')
431  {
432  if (SearchDriverRecursive(DevInstData, Path))
433  result = TRUE;
434  }
435  else
436  {
437  if (SearchDriver(DevInstData, Path, NULL))
438  result = TRUE;
439  }
440  }
441  }
442 
443  return result;
444 }
445 
446 BOOL
448  IN PDEVINSTDATA DevInstData,
449  IN BOOL IncludeRemovableDevices,
450  IN BOOL IncludeCustomPath,
451  IN HWND hwndCombo OPTIONAL)
452 {
453  WCHAR drive[] = {'?',':',0};
454  DWORD dwDrives = 0;
455  DWORD i;
456  UINT nType;
457  DWORD CustomTextLength = 0;
458  DWORD LengthNeeded = 0;
459  LPWSTR Buffer;
460 
461  /* Calculate length needed to store the search paths */
462  if (IncludeRemovableDevices)
463  {
464  dwDrives = GetLogicalDrives();
465  for (drive[0] = 'A', i = 1; drive[0] <= 'Z'; drive[0]++, i <<= 1)
466  {
467  if (dwDrives & i)
468  {
469  nType = GetDriveTypeW(drive);
470  if (nType == DRIVE_REMOVABLE || nType == DRIVE_CDROM)
471  {
472  LengthNeeded += 3;
473  }
474  }
475  }
476  }
477  if (IncludeCustomPath)
478  {
479  CustomTextLength = 1 + ComboBox_GetTextLength(hwndCombo);
480  LengthNeeded += CustomTextLength;
481  }
482 
483  /* Allocate space for search paths */
484  HeapFree(GetProcessHeap(), 0, DevInstData->CustomSearchPath);
485  DevInstData->CustomSearchPath = Buffer = HeapAlloc(
486  GetProcessHeap(),
487  0,
488  (LengthNeeded + 1) * sizeof(WCHAR));
489  if (!Buffer)
490  {
491  TRACE("HeapAlloc() failed\n");
493  return FALSE;
494  }
495 
496  /* Fill search paths */
497  if (IncludeRemovableDevices)
498  {
499  for (drive[0] = 'A', i = 1; drive[0] <= 'Z'; drive[0]++, i <<= 1)
500  {
501  if (dwDrives & i)
502  {
503  nType = GetDriveTypeW(drive);
504  if (nType == DRIVE_REMOVABLE || nType == DRIVE_CDROM)
505  {
506  Buffer += 1 + swprintf(Buffer, drive);
507  }
508  }
509  }
510  }
511  if (IncludeCustomPath)
512  {
513  Buffer += 1 + GetWindowTextW(hwndCombo, Buffer, CustomTextLength);
514  }
515  *Buffer = '\0';
516 
517  return TRUE;
518 }
519 
520 BOOL
522  IN PDEVINSTDATA DevInstData)
523 {
524  BOOL ret;
525 
526  TRACE("Installing driver %s: %s\n",
527  debugstr_w(DevInstData->drvInfoData.MfgName),
528  debugstr_w(DevInstData->drvInfoData.Description));
529 
532  DevInstData->hDevInfo,
533  &DevInstData->devInfoData);
534  if (!ret)
535  {
536  TRACE("SetupDiCallClassInstaller(DIF_SELECTBESTCOMPATDRV) failed with error 0x%x\n", GetLastError());
537  return FALSE;
538  }
539 
542  DevInstData->hDevInfo,
543  &DevInstData->devInfoData);
544  if (!ret)
545  {
546  TRACE("SetupDiCallClassInstaller(DIF_ALLOW_INSTALL) failed with error 0x%x\n", GetLastError());
547  return FALSE;
548  }
549 
552  DevInstData->hDevInfo,
553  &DevInstData->devInfoData);
554  if (!ret)
555  {
556  TRACE("SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_PREANALYZE) failed with error 0x%x\n", GetLastError());
557  return FALSE;
558  }
559 
562  DevInstData->hDevInfo,
563  &DevInstData->devInfoData);
564  if (!ret)
565  {
566  TRACE("SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_POSTANALYZE) failed with error 0x%x\n", GetLastError());
567  return FALSE;
568  }
569 
572  DevInstData->hDevInfo,
573  &DevInstData->devInfoData);
574  if (!ret)
575  {
576  TRACE("SetupDiCallClassInstaller(DIF_INSTALLDEVICEFILES) failed with error 0x%x\n", GetLastError());
577  return FALSE;
578  }
579 
582  DevInstData->hDevInfo,
583  &DevInstData->devInfoData);
584  if (!ret)
585  {
586  TRACE("SetupDiCallClassInstaller(DIF_REGISTER_COINSTALLERS) failed with error 0x%x\n", GetLastError());
587  return FALSE;
588  }
589 
592  DevInstData->hDevInfo,
593  &DevInstData->devInfoData);
594  if (!ret)
595  {
596  TRACE("SetupDiCallClassInstaller(DIF_INSTALLINTERFACES) failed with error 0x%x\n", GetLastError());
597  return FALSE;
598  }
599 
602  DevInstData->hDevInfo,
603  &DevInstData->devInfoData);
604  if (!ret)
605  {
606  TRACE("SetupDiCallClassInstaller(DIF_INSTALLDEVICE) failed with error 0x%x\n", GetLastError());
607  return FALSE;
608  }
609 
612  DevInstData->hDevInfo,
613  &DevInstData->devInfoData);
614  if (!ret)
615  {
616  TRACE("SetupDiCallClassInstaller(DIF_NEWDEVICEWIZARD_FINISHINSTALL) failed with error 0x%x\n", GetLastError());
617  return FALSE;
618  }
619 
622  DevInstData->hDevInfo,
623  &DevInstData->devInfoData);
624  if (!ret)
625  {
626  TRACE("SetupDiCallClassInstaller(DIF_DESTROYPRIVATEDATA) failed with error 0x%x\n", GetLastError());
627  return FALSE;
628  }
629 
630  return TRUE;
631 }
632 
633 /*
634 * @implemented
635 */
636 BOOL WINAPI
641  IN INT Show)
642 {
643  PDEVINSTDATA DevInstData = NULL;
644  BOOL ret;
645  DWORD config_flags;
646  BOOL retval = FALSE;
647 
648  TRACE("(%p, %p, %s, %d)\n", hWndParent, hInstance, debugstr_w(InstanceId), Show);
649 
650  if (!IsUserAdmin())
651  {
652  /* XP kills the process... */
654  }
655 
656  DevInstData = HeapAlloc(GetProcessHeap(), 0, sizeof(DEVINSTDATA));
657  if (!DevInstData)
658  {
659  TRACE("HeapAlloc() failed\n");
661  goto cleanup;
662  }
663 
664  /* Clear devinst data */
665  ZeroMemory(DevInstData, sizeof(DEVINSTDATA));
666  DevInstData->devInfoData.cbSize = 0; /* Tell if the devInfoData is valid */
667 
668  /* Fill devinst data */
670  if (DevInstData->hDevInfo == INVALID_HANDLE_VALUE)
671  {
672  TRACE("SetupDiCreateDeviceInfoListExW() failed with error 0x%x\n", GetLastError());
673  goto cleanup;
674  }
675 
676  DevInstData->devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
678  DevInstData->hDevInfo,
679  InstanceId,
680  NULL,
681  0, /* Open flags */
682  &DevInstData->devInfoData);
683  if (!ret)
684  {
685  TRACE("SetupDiOpenDeviceInfoW() failed with error 0x%x (InstanceId %s)\n",
687  DevInstData->devInfoData.cbSize = 0;
688  goto cleanup;
689  }
690 
693  DevInstData->hDevInfo,
694  &DevInstData->devInfoData,
696  &DevInstData->regDataType,
697  NULL, 0,
698  &DevInstData->requiredSize);
699 
700  if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER && DevInstData->regDataType == REG_SZ)
701  {
702  DevInstData->buffer = HeapAlloc(GetProcessHeap(), 0, DevInstData->requiredSize);
703  if (!DevInstData->buffer)
704  {
705  TRACE("HeapAlloc() failed\n");
707  }
708  else
709  {
711  DevInstData->hDevInfo,
712  &DevInstData->devInfoData,
714  &DevInstData->regDataType,
715  DevInstData->buffer, DevInstData->requiredSize,
716  &DevInstData->requiredSize);
717  }
718  }
719  if (!ret)
720  {
721  TRACE("SetupDiGetDeviceRegistryProperty() failed with error 0x%x (InstanceId %s)\n",
723  goto cleanup;
724  }
725 
727  DevInstData->hDevInfo,
728  &DevInstData->devInfoData,
730  NULL,
731  (BYTE *)&config_flags,
732  sizeof(config_flags),
733  NULL))
734  {
735  if (config_flags & CONFIGFLAG_FAILEDINSTALL)
736  {
737  /* The device is disabled */
738  TRACE("Device is disabled\n");
739  retval = TRUE;
740  goto cleanup;
741  }
742  }
743 
744  TRACE("Installing %s (%s)\n", debugstr_w((PCWSTR)DevInstData->buffer), debugstr_w(InstanceId));
745 
746  /* Search driver in default location and removable devices */
747  if (!PrepareFoldersToScan(DevInstData, FALSE, FALSE, NULL))
748  {
749  TRACE("PrepareFoldersToScan() failed with error 0x%lx\n", GetLastError());
750  goto cleanup;
751  }
752  if (ScanFoldersForDriver(DevInstData))
753  {
754  /* Driver found ; install it */
755  retval = InstallCurrentDriver(DevInstData);
756  TRACE("InstallCurrentDriver() returned %d\n", retval);
757  if (retval && Show != SW_HIDE)
758  {
759  /* Should we display the 'Need to reboot' page? */
760  SP_DEVINSTALL_PARAMS installParams;
761  installParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
763  DevInstData->hDevInfo,
764  &DevInstData->devInfoData,
765  &installParams))
766  {
767  if (installParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT))
768  {
769  TRACE("Displaying 'Reboot' wizard page\n");
770  retval = DisplayWizard(DevInstData, hWndParent, IDD_NEEDREBOOT);
771  }
772  }
773  }
774  goto cleanup;
775  }
776  else if (Show == SW_HIDE)
777  {
778  /* We can't show the wizard. Fail the install */
779  TRACE("No wizard\n");
780  goto cleanup;
781  }
782 
783  /* Prepare the wizard, and display it */
784  TRACE("Need to show install wizard\n");
785  retval = DisplayWizard(DevInstData, hWndParent, IDD_WELCOMEPAGE);
786 
787 cleanup:
788  if (DevInstData)
789  {
790  if (DevInstData->devInfoData.cbSize != 0)
791  {
792  if (!SetupDiDestroyDriverInfoList(DevInstData->hDevInfo, &DevInstData->devInfoData, SPDIT_COMPATDRIVER))
793  TRACE("SetupDiDestroyDriverInfoList() failed with error 0x%lx\n", GetLastError());
794  }
795  if (DevInstData->hDevInfo != INVALID_HANDLE_VALUE)
796  {
797  if (!SetupDiDestroyDeviceInfoList(DevInstData->hDevInfo))
798  TRACE("SetupDiDestroyDeviceInfoList() failed with error 0x%lx\n", GetLastError());
799  }
800  HeapFree(GetProcessHeap(), 0, DevInstData->buffer);
801  HeapFree(GetProcessHeap(), 0, DevInstData);
802  }
803 
804  return retval;
805 }
806 
807 
808 BOOL
809 WINAPI
813  IN BOOL bUpdate,
814  OUT LPDWORD lpReboot,
815  IN DWORD Unknown)
816 {
817  PDEVINSTDATA DevInstData = NULL;
818  BOOL ret;
819  BOOL retval = FALSE;
820 
821  TRACE("InstllDevInstEx(%p, %s, %d, %p, %lx)\n",
822  hWndParent, debugstr_w(InstanceId), bUpdate, lpReboot, Unknown);
823 
824  DevInstData = HeapAlloc(GetProcessHeap(), 0, sizeof(DEVINSTDATA));
825  if (!DevInstData)
826  {
827  TRACE("HeapAlloc() failed\n");
829  goto cleanup;
830  }
831 
832  /* Clear devinst data */
833  ZeroMemory(DevInstData, sizeof(DEVINSTDATA));
834  DevInstData->devInfoData.cbSize = 0; /* Tell if the devInfoData is valid */
835  DevInstData->bUpdate = bUpdate;
836 
837  /* Fill devinst data */
839  if (DevInstData->hDevInfo == INVALID_HANDLE_VALUE)
840  {
841  TRACE("SetupDiCreateDeviceInfoListExW() failed with error 0x%x\n", GetLastError());
842  goto cleanup;
843  }
844 
845  DevInstData->devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
847  DevInstData->hDevInfo,
848  InstanceId,
849  NULL,
850  0, /* Open flags */
851  &DevInstData->devInfoData);
852  if (!ret)
853  {
854  TRACE("SetupDiOpenDeviceInfoW() failed with error 0x%x (InstanceId %s)\n",
856  DevInstData->devInfoData.cbSize = 0;
857  goto cleanup;
858  }
859 
862  DevInstData->hDevInfo,
863  &DevInstData->devInfoData,
865  &DevInstData->regDataType,
866  NULL, 0,
867  &DevInstData->requiredSize);
868 
869  if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER && DevInstData->regDataType == REG_SZ)
870  {
871  DevInstData->buffer = HeapAlloc(GetProcessHeap(), 0, DevInstData->requiredSize);
872  if (!DevInstData->buffer)
873  {
874  TRACE("HeapAlloc() failed\n");
876  }
877  else
878  {
880  DevInstData->hDevInfo,
881  &DevInstData->devInfoData,
883  &DevInstData->regDataType,
884  DevInstData->buffer, DevInstData->requiredSize,
885  &DevInstData->requiredSize);
886  }
887  }
888 
889  if (!ret)
890  {
891  TRACE("SetupDiGetDeviceRegistryProperty() failed with error 0x%x (InstanceId %s)\n",
893  goto cleanup;
894  }
895 
896  /* Prepare the wizard, and display it */
897  TRACE("Need to show install wizard\n");
898  retval = DisplayWizard(DevInstData, hWndParent, IDD_WELCOMEPAGE);
899 
900 cleanup:
901  if (DevInstData)
902  {
903  if (DevInstData->devInfoData.cbSize != 0)
904  {
905  if (!SetupDiDestroyDriverInfoList(DevInstData->hDevInfo, &DevInstData->devInfoData, SPDIT_COMPATDRIVER))
906  TRACE("SetupDiDestroyDriverInfoList() failed with error 0x%lx\n", GetLastError());
907  }
908  if (DevInstData->hDevInfo != INVALID_HANDLE_VALUE)
909  {
910  if (!SetupDiDestroyDeviceInfoList(DevInstData->hDevInfo))
911  TRACE("SetupDiDestroyDeviceInfoList() failed with error 0x%lx\n", GetLastError());
912  }
913  HeapFree(GetProcessHeap(), 0, DevInstData->buffer);
914  HeapFree(GetProcessHeap(), 0, DevInstData);
915  }
916 
917  return retval;
918 }
919 
920 
921 /*
922  * @implemented
923  */
924 BOOL
925 WINAPI
929  IN BOOL bUpdate,
930  OUT LPDWORD lpReboot)
931 {
932  return InstallDevInstEx(hWndParent, InstanceId, bUpdate, lpReboot, 0);
933 }
934 
935 
936 /*
937 * @implemented
938 */
939 BOOL WINAPI
941  IN HWND hWndOwner,
943  IN LPWSTR lpNamedPipeName,
944  IN INT Show)
945 {
947  BOOL ShowWizard;
949  DWORD Value;
952  PWSTR InstallEventName = NULL;
954 
955  /* Open the pipe */
956  hPipe = CreateFileW(lpNamedPipeName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
957 
958  if(hPipe == INVALID_HANDLE_VALUE)
959  {
960  ERR("CreateFileW failed with error %u\n", GetLastError());
961  goto cleanup;
962  }
963 
964  /* Read the data. Some is just included for compatibility with Windows right now and not yet used by ReactOS.
965  See umpnpmgr for more details. */
966  if(!ReadFile(hPipe, &Value, sizeof(Value), &BytesRead, NULL))
967  {
968  ERR("ReadFile failed with error %u\n", GetLastError());
969  goto cleanup;
970  }
971 
972  InstallEventName = (PWSTR)HeapAlloc(GetProcessHeap(), 0, Value);
973 
974  if(!ReadFile(hPipe, InstallEventName, Value, &BytesRead, NULL))
975  {
976  ERR("ReadFile failed with error %u\n", GetLastError());
977  goto cleanup;
978  }
979 
980  /* I couldn't figure out what the following value means under Windows XP.
981  Therefore I used it in umpnpmgr to pass the ShowWizard variable. */
982  if(!ReadFile(hPipe, &ShowWizard, sizeof(ShowWizard), &BytesRead, NULL))
983  {
984  ERR("ReadFile failed with error %u\n", GetLastError());
985  goto cleanup;
986  }
987 
988  /* Next one is again size in bytes of the following string */
989  if(!ReadFile(hPipe, &Value, sizeof(Value), &BytesRead, NULL))
990  {
991  ERR("ReadFile failed with error %u\n", GetLastError());
992  goto cleanup;
993  }
994 
996 
997  if(!ReadFile(hPipe, DeviceInstance, Value, &BytesRead, NULL))
998  {
999  ERR("ReadFile failed with error %u\n", GetLastError());
1000  goto cleanup;
1001  }
1002 
1004  if(!ReturnValue)
1005  {
1006  ERR("DevInstallW failed with error %lu\n", GetLastError());
1007  goto cleanup;
1008  }
1009 
1010  hInstallEvent = CreateEventW(NULL, TRUE, FALSE, InstallEventName);
1011  if(!hInstallEvent)
1012  {
1013  TRACE("CreateEventW('%ls') failed with error %lu\n", InstallEventName, GetLastError());
1014  goto cleanup;
1015  }
1016 
1019 
1020 cleanup:
1021  if(hPipe != INVALID_HANDLE_VALUE)
1022  CloseHandle(hPipe);
1023 
1024  if(InstallEventName)
1025  HeapFree(GetProcessHeap(), 0, InstallEventName);
1026 
1027  if(DeviceInstance)
1029 
1030  return ReturnValue;
1031 }
1032 
1033 BOOL WINAPI
1036  IN DWORD dwReason,
1037  IN LPVOID lpReserved)
1038 {
1040  {
1042 
1044 
1045  InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
1049  }
1050 
1051  return TRUE;
1052 }
static BOOL SearchDriverRecursive(IN PDEVINSTDATA DevInstData, IN LPCWSTR Path)
Definition: newdev.c:342
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1792
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL WINAPI ClientSideInstallW(IN HWND hWndOwner, IN HINSTANCE hInstance, IN LPWSTR lpNamedPipeName, IN INT Show)
Definition: newdev.c:940
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
SP_DEVINFO_DATA devInfoData
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
BOOL WINAPI IsUserAdmin(VOID)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ERROR_PRIVILEGE_NOT_HELD
Definition: winerror.h:796
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define DI_NEEDREBOOT
Definition: setupapi.h:54
BOOL WINAPI SetupDiSetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4563
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2297
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:1355
#define SW_HIDE
Definition: winuser.h:762
uint16_t * PWSTR
Definition: typedefs.h:54
#define CP_ACP
Definition: compat.h:99
#define INSTALLFLAG_FORCE
Definition: newdev.h:34
#define INSTALLFLAG_READONLY
Definition: newdev.h:35
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2593
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid, HWND hwndParent, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:1268
BOOL WINAPI DllMain(IN HINSTANCE hInstance, IN DWORD dwReason, IN LPVOID lpReserved)
Definition: newdev.c:1034
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3229
#define IDD_NEEDREBOOT
Definition: resource.h:27
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
HINSTANCE hDllInstance
Definition: newdev.c:29
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1517
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2597
#define DIF_NEWDEVICEWIZARD_PREANALYZE
Definition: setupapi.h:147
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
static BOOL SearchDriver(IN PDEVINSTDATA DevInstData, IN LPCWSTR Directory OPTIONAL, IN LPCWSTR InfFile OPTIONAL)
Definition: newdev.c:252
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4029
#define DI_FLAGSEX_ALLOWEXCLUDEDDRVS
Definition: setupapi.h:87
#define ComboBox_GetTextLength(hwndCtl)
Definition: windowsx.h:34
#define NO_ERROR
Definition: dderror.h:5
#define DIF_NEWDEVICEWIZARD_POSTANALYZE
Definition: setupapi.h:148
#define DIF_DESTROYPRIVATEDATA
Definition: setupapi.h:131
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
int32_t INT
Definition: typedefs.h:56
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:303
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
#define DRIVE_REMOVABLE
Definition: winbase.h:248
static HANDLE hInstallEvent
Definition: umpnpmgr.c:68
#define Dot(u, v)
Definition: normal.c:49
DWORD requiredSize
DWORD dwReason
Definition: misc.cpp:154
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
HINSTANCE hInstance
Definition: charmap.c:20
UINT32 void void ** ReturnValue
Definition: acevents.h:213
#define UNICODE_NULL
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4456
#define ok(value,...)
_Must_inspect_result_ _In_opt_ PVOID _In_opt_ PVOID InstanceId
Definition: fsrtlfuncs.h:907
#define DIF_REGISTER_COINSTALLERS
Definition: setupapi.h:153
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
_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:426
BOOL WINAPI UpdateDriverForPlugAndPlayDevicesA(IN HWND hwndParent, IN LPCSTR HardwareId, IN LPCSTR FullInfPath, IN DWORD InstallFlags, OUT PBOOL bRebootRequired OPTIONAL)
Definition: newdev.c:207
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#define DIF_NEWDEVICEWIZARD_FINISHINSTALL
Definition: setupapi.h:149
Definition: bufpool.h:45
#define SPDIT_COMPATDRIVER
Definition: setupapi.h:501
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL * PBOOL
Definition: windef.h:161
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define OPEN_EXISTING
Definition: compat.h:426
#define IDD_WELCOMEPAGE
Definition: resource.h:21
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
BOOL DisplayWizard(IN PDEVINSTDATA DevInstData, IN HWND hwndParent, IN UINT startPage)
Definition: wizard.c:1298
#define DIF_INSTALLDEVICE
Definition: setupapi.h:121
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI InstallDevInstEx(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot, IN DWORD Unknown)
Definition: newdev.c:810
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
static BOOL IsDots(IN LPCWSTR str)
Definition: newdev.c:323
BOOL WINAPI UpdateDriverForPlugAndPlayDevicesW(IN HWND hwndParent, IN LPCWSTR HardwareId, IN LPCWSTR FullInfPath, IN DWORD InstallFlags, OUT PBOOL bRebootRequired OPTIONAL)
Definition: newdev.c:41
#define WINAPI
Definition: msvc.h:8
#define BufferSize
Definition: classpnp.h:419
unsigned long DWORD
Definition: ntddk_ex.h:95
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1150
#define SetLastError(x)
Definition: compat.h:409
#define SPDRP_HARDWAREID
Definition: setupapi.h:503
#define ERROR_NO_SUCH_DEVINST
Definition: setupapi.h:302
SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA
Definition: setupapi.h:1049
HDEVINFO hDevInfo
#define DIGCF_ALLCLASSES
Definition: setupapi.h:172
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
WCHAR DriverPath[MAX_PATH]
Definition: setupapi.h:895
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
BOOL InstallCurrentDriver(IN PDEVINSTDATA DevInstData)
Definition: newdev.c:521
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5184
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
#define GENERIC_READ
Definition: compat.h:124
#define SPDRP_DEVICEDESC
Definition: setupapi.h:502
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
DWORD WINAPI GetLogicalDrives(VOID)
Definition: disk.c:110
BOOL WINAPI InstallDevInst(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot)
Definition: newdev.c:926
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI SetupDiDestroyDriverInfoList(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType)
Definition: driver.c:1208
#define DIF_INSTALLINTERFACES
Definition: setupapi.h:151
#define SPDRP_CONFIGFLAGS
Definition: setupapi.h:512
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
PRTL_UNICODE_STRING_BUFFER Path
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
#define DRIVE_CDROM
Definition: winbase.h:251
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
#define DI_ENUMSINGLEINF
Definition: setupapi.h:62
#define ICC_PROGRESS_CLASS
Definition: commctrl.h:63
#define CreateFileW
Definition: compat.h:400
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
BOOL WINAPI SetupDiGetDeviceInstanceIdW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PWSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
Definition: devinst.c:1912
#define OUT
Definition: typedefs.h:39
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:4779
#define DIF_ALLOW_INSTALL
Definition: setupapi.h:143
BOOL WINAPI SetupDiBuildDriverInfoList(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType)
Definition: driver.c:718
uint32_t * LPDWORD
Definition: typedefs.h:57
static LPCWSTR GetFileExt(IN LPWSTR FileName)
Definition: newdev.c:330
base for all directory entries
Definition: entries.h:138
#define INSTALLFLAG_NONINTERACTIVE
Definition: newdev.h:36
char * cleanup(char *str)
Definition: wpickclick.c:99
BOOL PrepareFoldersToScan(IN PDEVINSTDATA DevInstData, IN BOOL IncludeRemovableDevices, IN BOOL IncludeCustomPath, IN HWND hwndCombo OPTIONAL)
Definition: newdev.c:447
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION _In_ ULONG _Out_opt_ PULONG LengthNeeded
Definition: fltkernel.h:1342
#define DIF_SELECTBESTCOMPATDRV
Definition: setupapi.h:142
#define DI_NEEDRESTART
Definition: setupapi.h:53
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
WCHAR * LPWSTR
Definition: xmlstorage.h:184
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define DIF_INSTALLDEVICEFILES
Definition: setupapi.h:140
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
GLuint64EXT * result
Definition: glext.h:11304
BOOL ScanFoldersForDriver(IN PDEVINSTDATA DevInstData)
Definition: newdev.c:412
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255
#define CONFIGFLAG_FAILEDINSTALL
Definition: regstr.h:396
#define DIGCF_PRESENT
Definition: setupapi.h:171
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI DevInstallW(IN HWND hWndParent, IN HINSTANCE hInstance, IN LPCWSTR InstanceId, IN INT Show)
Definition: newdev.c:637
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define REG_SZ
Definition: layer.c:22
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68