ReactOS  0.4.15-dev-5608-gafb953a
wizard.c
Go to the documentation of this file.
1 /*
2  * New device installer (newdev.dll)
3  *
4  * Copyright 2006 HervĂ© Poussineau (hpoussin@reactos.org)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "newdev_private.h"
22 
23 #include <wincon.h>
24 #include <cfgmgr32.h>
25 #include <shlobj.h>
26 #include <shlwapi.h>
27 
29 
30 static VOID
32  IN HWND hWnd)
33 {
35  RECT rcParent;
36  RECT rcWindow;
37 
39  if (hWndParent == NULL)
41 
42  GetWindowRect(hWndParent, &rcParent);
43  GetWindowRect(hWnd, &rcWindow);
44 
45  /* Check if the child window fits inside the parent window */
46  if (rcWindow.left < rcParent.left || rcWindow.top < rcParent.top ||
47  rcWindow.right > rcParent.right || rcWindow.bottom > rcParent.bottom)
48  {
49  return;
50  }
51 
53  hWnd,
54  HWND_TOP,
55  ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
56  ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
57  0,
58  0,
59  SWP_NOSIZE);
60 }
61 
62 static BOOL
65  IN PSP_DEVINFO_DATA DevInfoData OPTIONAL,
66  IN BOOLEAN Set)
67 {
68  DWORD dwType, dwSize, dwFlags = 0;
69 
70  dwSize = sizeof(dwFlags);
72  DevInfoData,
74  &dwType,
75  (PBYTE)&dwFlags,
76  dwSize,
77  &dwSize))
78  {
79  return FALSE;
80  }
81 
82  if (Set)
84  else
86 
88  DevInfoData,
90  (PBYTE)&dwFlags,
91  dwSize))
92  {
93 
94  return FALSE;
95  }
96 
97  if (Set)
98  {
99  /* Set the 'Unknown' device class */
100  PWSTR pszUnknown = L"Unknown";
102  DevInfoData,
103  SPDRP_CLASS,
104  (PBYTE)pszUnknown,
105  (wcslen(pszUnknown) + 1) * sizeof(WCHAR));
106 
107  PWSTR pszUnknownGuid = L"{4D36E97E-E325-11CE-BFC1-08002BE10318}";
109  DevInfoData,
111  (PBYTE)pszUnknownGuid,
112  (wcslen(pszUnknownGuid) + 1) * sizeof(WCHAR));
113 
114  /* Set device problem code CM_PROB_FAILED_INSTALL */
115  CM_Set_DevNode_Problem(DevInfoData->DevInst,
118  }
119 
120  return TRUE;
121 }
122 
123 static BOOL
125  IN DEVINST DevInst,
126  IN HMACHINE hMachine,
127  OUT BOOL *CanDisable)
128 {
129  CONFIGRET cr;
130  ULONG Status, ProblemNumber;
131  BOOL Ret = FALSE;
132 
134  &ProblemNumber,
135  DevInst,
136  0,
137  hMachine);
138  if (cr == CR_SUCCESS)
139  {
140  *CanDisable = ((Status & DN_DISABLEABLE) != 0);
141  Ret = TRUE;
142  }
143 
144  return Ret;
145 }
146 
147 static BOOL
149  IN DEVINST DevInst,
150  IN HMACHINE hMachine,
151  OUT BOOL *IsEnabled)
152 {
153  CONFIGRET cr;
154  ULONG Status, ProblemNumber;
155  BOOL Ret = FALSE;
156 
158  &Status,
159  &ProblemNumber,
160  DevInst,
161  0,
162  hMachine);
163  if (cr == CR_SUCCESS)
164  {
165  *IsEnabled = ((Status & DN_STARTED) != 0);
166  Ret = TRUE;
167  }
168 
169  return Ret;
170 }
171 
172 static BOOL
175  IN PSP_DEVINFO_DATA DevInfoData OPTIONAL,
176  IN BOOL bEnable,
177  IN DWORD HardwareProfile OPTIONAL,
178  OUT BOOL *bNeedReboot OPTIONAL)
179 {
182  DWORD LastErr;
183  BOOL Ret = FALSE;
184 
187  pcp.HwProfile = HardwareProfile;
188 
189  if (bEnable)
190  {
191  /* try to enable the device on the global profile */
192  pcp.StateChange = DICS_ENABLE;
193  pcp.Scope = DICS_FLAG_GLOBAL;
194 
195  /* ignore errors */
196  LastErr = GetLastError();
199  DevInfoData,
200  &pcp.ClassInstallHeader,
201  sizeof(SP_PROPCHANGE_PARAMS)))
202  {
206  DevInfoData);
207  }
208  SetLastError(LastErr);
209  }
210 
211  /* try config-specific */
214 
217  DevInfoData,
218  &pcp.ClassInstallHeader,
219  sizeof(SP_PROPCHANGE_PARAMS)) &&
222  DevInfoData))
223  {
224  dp.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
227  DevInfoData,
228  &dp))
229  {
230  if (bNeedReboot != NULL)
231  {
232  *bNeedReboot = ((dp.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT)) != 0);
233  }
234 
235  Ret = TRUE;
236  }
237  }
238  return Ret;
239 }
240 
241 static DWORD WINAPI
243  IN LPVOID lpParam)
244 {
245  PDEVINSTDATA DevInstData;
246  BOOL result = FALSE;
247 
248  DevInstData = (PDEVINSTDATA)lpParam;
249 
250  result = ScanFoldersForDriver(DevInstData);
251 
252  if (result)
253  {
254  PostMessage(DevInstData->hDialog, WM_SEARCH_FINISHED, 1, 0);
255  }
256  else
257  {
258  if (!DevInstData->bUpdate)
259  {
260  /* Update device configuration */
261  SetFailedInstall(DevInstData->hDevInfo,
262  &DevInstData->devInfoData,
263  TRUE);
264  }
265  PostMessage(DevInstData->hDialog, WM_SEARCH_FINISHED, 0, 0);
266  }
267  return 0;
268 }
269 
270 static DWORD WINAPI
272  IN LPVOID lpParam)
273 {
274  PDEVINSTDATA DevInstData;
275  BOOL res;
276 
277  DevInstData = (PDEVINSTDATA)lpParam;
278  res = InstallCurrentDriver(DevInstData);
279  PostMessage(DevInstData->hDialog, WM_INSTALL_FINISHED, res ? 0 : 1, 0);
280  return 0;
281 }
282 
283 static VOID
285  IN HWND hwndCombo)
286 {
287  HKEY hKey = NULL;
288  DWORD dwRegType;
289  DWORD dwPathLength = 0;
290  LPWSTR Buffer = NULL;
291  LPCWSTR Path;
292  LONG rc;
293 
294  (void)ComboBox_ResetContent(hwndCombo);
295 
296  /* RegGetValue would have been better... */
297  rc = RegOpenKeyEx(
300  0,
302  &hKey);
303  if (rc != ERROR_SUCCESS)
304  {
305  TRACE("RegOpenKeyEx() failed with error 0x%lx\n", rc);
306  goto cleanup;
307  }
308  rc = RegQueryValueExW(
309  hKey,
310  L"Installation Sources",
311  NULL,
312  &dwRegType,
313  NULL,
314  &dwPathLength);
315  if (rc != ERROR_SUCCESS || dwRegType != REG_MULTI_SZ)
316  {
317  TRACE("RegQueryValueEx() failed with error 0x%lx\n", rc);
318  goto cleanup;
319  }
320 
321  /* Allocate enough space to add 2 NULL chars at the end of the string */
322  Buffer = HeapAlloc(GetProcessHeap(), 0, dwPathLength + 2 * sizeof(WCHAR));
323  if (!Buffer)
324  {
325  TRACE("HeapAlloc() failed\n");
326  goto cleanup;
327  }
328  rc = RegQueryValueExW(
329  hKey,
330  L"Installation Sources",
331  NULL,
332  NULL,
333  (LPBYTE)Buffer,
334  &dwPathLength);
335  if (rc != ERROR_SUCCESS)
336  {
337  TRACE("RegQueryValueEx() failed with error 0x%lx\n", rc);
338  goto cleanup;
339  }
340 
341  Buffer[dwPathLength / sizeof(WCHAR)] = UNICODE_NULL;
342  Buffer[dwPathLength / sizeof(WCHAR) + 1] = UNICODE_NULL;
343 
344  /* Populate combo box */
345  for (Path = Buffer; *Path; Path += wcslen(Path) + 1)
346  {
347  (void)ComboBox_AddString(hwndCombo, Path);
348  if (Path == Buffer)
349  (void)ComboBox_SetCurSel(hwndCombo, 0);
350  }
351 
352 cleanup:
353  if (hKey != NULL)
354  RegCloseKey(hKey);
356 }
357 
358 static VOID
360  IN HWND hwndCombo)
361 {
362  LPWSTR CustomPath = NULL;
363  DWORD CustomPathLength;
364  LPWSTR Buffer = NULL;
365  LPWSTR pBuffer; /* Pointer into Buffer */
366  int ItemsCount, Length;
367  int i;
368  DWORD TotalLength = 0;
369  BOOL UseCustomPath = TRUE;
370  HKEY hKey = NULL;
371  LONG rc;
372 
373  /* Get custom path */
374  Length = ComboBox_GetTextLength(hwndCombo) + 1;
375  CustomPath = HeapAlloc(GetProcessHeap(), 0, Length * sizeof(WCHAR));
376  if (!CustomPath)
377  {
378  TRACE("HeapAlloc() failed\n");
379  goto cleanup;
380  }
381  CustomPathLength = GetWindowTextW(hwndCombo, CustomPath, Length) + 1;
382 
383  /* Calculate length of the buffer */
384  ItemsCount = ComboBox_GetCount(hwndCombo);
385  if (ItemsCount == CB_ERR)
386  {
387  TRACE("ComboBox_GetCount() failed\n");
388  goto cleanup;
389  }
390  for (i = 0; i < ItemsCount; i++)
391  {
392  Length = ComboBox_GetLBTextLen(hwndCombo, i);
393  if (Length == CB_ERR)
394  {
395  TRACE("ComboBox_GetLBTextLen() failed\n");
396  goto cleanup;
397  }
398  TotalLength += Length + 1;
399  }
400  TotalLength++; /* Final NULL char */
401 
402  /* Allocate buffer */
403  Buffer = HeapAlloc(GetProcessHeap(), 0, (CustomPathLength + TotalLength + 1) * sizeof(WCHAR));
404  if (!Buffer)
405  {
406  TRACE("HeapAlloc() failed\n");
407  goto cleanup;
408  }
409 
410  /* Fill the buffer */
411  pBuffer = &Buffer[CustomPathLength];
412  for (i = 0; i < ItemsCount; i++)
413  {
414  Length = ComboBox_GetLBText(hwndCombo, i, pBuffer);
415  if (Length == CB_ERR)
416  {
417  TRACE("ComboBox_GetLBText() failed\n");
418  goto cleanup;
419  }
420  else if (UseCustomPath && _wcsicmp(CustomPath, pBuffer) == 0)
421  UseCustomPath = FALSE;
422  pBuffer += 1 + Length;
423  }
424  *pBuffer = '\0'; /* Add final NULL char */
425 
426  if (!UseCustomPath)
427  {
428  /* Nothing to save to registry */
429  goto cleanup;
430  }
431 
432  TotalLength += CustomPathLength;
433  wcscpy(Buffer, CustomPath);
434 
435  /* Save the buffer */
436  /* RegSetKeyValue would have been better... */
437  rc = RegOpenKeyEx(
440  0,
442  &hKey);
443  if (rc != ERROR_SUCCESS)
444  {
445  TRACE("RegOpenKeyEx() failed with error 0x%lx\n", rc);
446  goto cleanup;
447  }
448  rc = RegSetValueExW(
449  hKey,
450  L"Installation Sources",
451  0,
452  REG_MULTI_SZ,
453  (const BYTE*)Buffer,
454  TotalLength * sizeof(WCHAR));
455  if (rc != ERROR_SUCCESS)
456  {
457  TRACE("RegSetValueEx() failed with error 0x%lx\n", rc);
458  goto cleanup;
459  }
460 
461 cleanup:
462  if (hKey != NULL)
463  RegCloseKey(hKey);
464  HeapFree(GetProcessHeap(), 0, CustomPath);
466 }
467 
468 static INT_PTR CALLBACK
470  IN HWND hwndDlg,
471  IN UINT uMsg,
472  IN WPARAM wParam,
473  IN LPARAM lParam)
474 {
475  PDEVINSTDATA DevInstData;
477 
478  /* Retrieve pointer to the global setup data */
479  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
480 
481  switch (uMsg)
482  {
483  case WM_INITDIALOG:
484  {
485  HWND hwndControl;
486  DWORD dwStyle;
487 
488  /* Get pointer to the global setup data */
489  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
490  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
491 
492  hwndControl = GetParent(hwndDlg);
493 
494  /* Center the wizard window */
495  CenterWindow(hwndControl);
496 
497  /* Hide the system menu */
498  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
499  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
500 
501  /* Set title font */
503  hwndDlg,
505  WM_SETFONT,
506  (WPARAM)DevInstData->hTitleFont,
507  (LPARAM)TRUE);
508 
510  hwndDlg,
511  IDC_DEVICE,
512  WM_SETTEXT,
513  0,
514  (LPARAM)DevInstData->buffer);
515 
517  hwndDlg,
519  BM_SETCHECK,
520  (WPARAM)TRUE,
521  (LPARAM)0);
522 
523  if (!DevInstData->bUpdate)
524  {
525  SetFailedInstall(DevInstData->hDevInfo,
526  &DevInstData->devInfoData,
527  TRUE);
528  }
529  break;
530  }
531 
532  case WM_NOTIFY:
533  {
534  LPNMHDR lpnm = (LPNMHDR)lParam;
535 
536  switch (lpnm->code)
537  {
538  case PSN_SETACTIVE:
539  /* Enable the Next button */
541  break;
542 
543  case PSN_WIZNEXT:
544  /* Handle a Next button click, if necessary */
546  {
547  if (PrepareFoldersToScan(DevInstData, TRUE, FALSE, NULL))
549  else
551  }
552  return TRUE;
553 
554  default:
555  break;
556  }
557  break;
558  }
559 
560  default:
561  break;
562  }
563 
564  return FALSE;
565 }
566 
567 static void
569 {
572 }
573 
574 static void
576 {
580 }
581 
582 static INT CALLBACK
584 {
585  BOOL bValid = FALSE;
586 
587  switch (uMsg)
588  {
589  case BFFM_INITIALIZED:
590  {
591  PCWSTR pszPath = ((PDEVINSTDATA)lpData)->CustomSearchPath;
592 
593  bValid = CheckBestDriver((PDEVINSTDATA)lpData, pszPath);
595  SendMessageW(hwnd, BFFM_ENABLEOK, 0, bValid);
596  break;
597  }
598 
599  case BFFM_SELCHANGED:
600  {
601  WCHAR szDir[MAX_PATH];
602 
604  {
605  bValid = CheckBestDriver((PDEVINSTDATA)lpData, szDir);
606  }
607  PostMessageW(hwnd, BFFM_ENABLEOK, 0, bValid);
608  break;
609  }
610  }
611  return 0;
612 }
613 
614 static INT_PTR CALLBACK
616  IN HWND hwndDlg,
617  IN UINT uMsg,
618  IN WPARAM wParam,
619  IN LPARAM lParam)
620 {
621  PDEVINSTDATA DevInstData;
622 
623  /* Retrieve pointer to the global setup data */
624  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
625 
626  switch (uMsg)
627  {
628  case WM_INITDIALOG:
629  {
630  HWND hwndControl, hwndCombo;
631  DWORD dwStyle;
632  COMBOBOXINFO info = { sizeof(info) };
633 
634  /* Get pointer to the global setup data */
635  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
636  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
637 
638  hwndControl = GetParent(hwndDlg);
639 
640  /* Center the wizard window */
641  CenterWindow(hwndControl);
642 
643  /* Hide the system menu */
644  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
645  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
646 
647  hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_PATH);
648  PopulateCustomPathCombo(hwndCombo);
649 
650  GetComboBoxInfo(hwndCombo, &info);
652 
654  hwndDlg,
656  BM_SETCHECK,
657  (WPARAM)TRUE,
658  (LPARAM)0);
659  AutoDriver(hwndDlg, TRUE);
660  IncludePath(hwndDlg, FALSE);
661 
662  /* Disable manual driver choice for now */
664 
665  break;
666  }
667 
668  case WM_COMMAND:
669  {
670  switch (LOWORD(wParam))
671  {
673  AutoDriver(hwndDlg, TRUE);
674  return TRUE;
675 
676  case IDC_RADIO_CHOOSE:
677  AutoDriver(hwndDlg, FALSE);
678  return TRUE;
679 
680  case IDC_CHECK_PATH:
681  IncludePath(hwndDlg, IsDlgButtonChecked(hwndDlg, IDC_CHECK_PATH));
682  return TRUE;
683 
684  case IDC_BROWSE:
685  {
686  BROWSEINFOW bi = { 0 };
687  LPITEMIDLIST pidl;
689  WCHAR CustomSearchPath[MAX_PATH] = { 0 };
692 
693  if (idx == CB_ERR)
695  else
697 
698  if (len < _countof(CustomSearchPath))
699  {
700  if (idx == CB_ERR)
701  GetWindowTextW(GetDlgItem(hwndDlg, IDC_COMBO_PATH), CustomSearchPath, _countof(CustomSearchPath));
702  else
703  SendDlgItemMessageW(hwndDlg, IDC_COMBO_PATH, CB_GETLBTEXT, idx, (LPARAM)CustomSearchPath);
704  }
705  DevInstData->CustomSearchPath = CustomSearchPath;
706 
707  bi.hwndOwner = hwndDlg;
709  bi.lpszTitle = Title;
711  bi.lParam = (LPARAM)DevInstData;
712  pidl = SHBrowseForFolderW(&bi);
713  if (pidl)
714  {
716  IMalloc* malloc;
717 
718  if (SHGetPathFromIDListW(pidl, Directory))
719  {
720  /* Set the IDC_COMBO_PATH text */
722  }
723 
724  /* Free memory, if possible */
726  {
727  IMalloc_Free(malloc, pidl);
728  IMalloc_Release(malloc);
729  }
730  return TRUE;
731  }
732  break;
733  }
734  }
735  break;
736  }
737 
738  case WM_NOTIFY:
739  {
740  LPNMHDR lpnm = (LPNMHDR)lParam;
741 
742  switch (lpnm->code)
743  {
744  case PSN_SETACTIVE:
745  /* Enable the Next and Back buttons */
747  break;
748 
749  case PSN_WIZNEXT:
750  /* Handle a Next button click, if necessary */
752  {
754  HeapFree(GetProcessHeap(), 0, DevInstData->CustomSearchPath);
755  DevInstData->CustomSearchPath = NULL;
757  DevInstData,
760  GetDlgItem(hwndDlg, IDC_COMBO_PATH)))
761  {
763  }
764  else
765  {
767  }
768  }
769  else
770  {
771  /* FIXME */;
772  }
773  return TRUE;
774 
775  default:
776  break;
777  }
778  break;
779  }
780 
781  default:
782  break;
783  }
784 
785  return FALSE;
786 }
787 
788 static INT_PTR CALLBACK
790  IN HWND hwndDlg,
791  IN UINT uMsg,
792  IN WPARAM wParam,
793  IN LPARAM lParam)
794 {
795  PDEVINSTDATA DevInstData;
797 
798  /* Retrieve pointer to the global setup data */
799  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
800 
801  switch (uMsg)
802  {
803  case WM_INITDIALOG:
804  {
805  HWND hwndControl;
806  DWORD dwStyle;
807 
808  /* Get pointer to the global setup data */
809  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
810  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
811 
812  DevInstData->hDialog = hwndDlg;
813  hwndControl = GetParent(hwndDlg);
814 
815  /* Center the wizard window */
816  CenterWindow(hwndControl);
817 
819  hwndDlg,
820  IDC_DEVICE,
821  WM_SETTEXT,
822  0,
823  (LPARAM)DevInstData->buffer);
824 
825  /* Hide the system menu */
826  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
827  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
828  break;
829  }
830 
831  case WM_SEARCH_FINISHED:
832  {
834  hThread = 0;
835  if (wParam == 0)
837  else
839  break;
840  }
841 
842  case WM_NOTIFY:
843  {
844  LPNMHDR lpnm = (LPNMHDR)lParam;
845 
846  switch (lpnm->code)
847  {
848  case PSN_SETACTIVE:
850  /* Yes, we can safely ignore the problem (if any) */
852  DevInstData->hDevInfo,
853  &DevInstData->devInfoData,
855  hThread = CreateThread(NULL, 0, FindDriverProc, DevInstData, 0, &dwThreadId);
856  break;
857 
858  case PSN_KILLACTIVE:
859  if (hThread != 0)
860  {
862  return TRUE;
863  }
864  break;
865 
866  case PSN_WIZNEXT:
867  /* Handle a Next button click, if necessary */
868  break;
869 
870  default:
871  break;
872  }
873  break;
874  }
875 
876  default:
877  break;
878  }
879 
880  return FALSE;
881 }
882 
883 static INT_PTR CALLBACK
885  IN HWND hwndDlg,
886  IN UINT uMsg,
887  IN WPARAM wParam,
888  IN LPARAM lParam)
889 {
890  PDEVINSTDATA DevInstData;
892 
893  /* Retrieve pointer to the global setup data */
894  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
895 
896  switch (uMsg)
897  {
898  case WM_INITDIALOG:
899  {
900  HWND hwndControl;
901  DWORD dwStyle;
902 
903  /* Get pointer to the global setup data */
904  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
905  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
906 
907  DevInstData->hDialog = hwndDlg;
908  hwndControl = GetParent(hwndDlg);
909 
910  /* Center the wizard window */
911  CenterWindow(hwndControl);
912 
914  hwndDlg,
915  IDC_DEVICE,
916  WM_SETTEXT,
917  0,
918  (LPARAM)DevInstData->drvInfoData.Description);
919 
920  /* Hide the system menu */
921  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
922  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
923  break;
924  }
925 
926  case WM_INSTALL_FINISHED:
927  {
929  hThread = 0;
930  if (wParam == 0)
931  {
932  SP_DEVINSTALL_PARAMS installParams;
933 
934  SetFailedInstall(DevInstData->hDevInfo,
935  &DevInstData->devInfoData,
936  FALSE);
937 
938  /* Should we reboot? */
939  installParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
941  DevInstData->hDevInfo,
942  &DevInstData->devInfoData,
943  &installParams))
944  {
945  if (installParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT))
946  {
948  }
949  else
951  break;
952  }
953  }
955  break;
956  }
957 
958  case WM_NOTIFY:
959  {
960  LPNMHDR lpnm = (LPNMHDR)lParam;
961 
962  switch (lpnm->code)
963  {
964  case PSN_SETACTIVE:
966  hThread = CreateThread(NULL, 0, InstallDriverProc, DevInstData, 0, &dwThreadId);
967  break;
968 
969  case PSN_KILLACTIVE:
970  if (hThread != 0)
971  {
973  return TRUE;
974  }
975  break;
976 
977  case PSN_WIZNEXT:
978  /* Handle a Next button click, if necessary */
979  break;
980 
981  default:
982  break;
983  }
984  break;
985  }
986 
987  default:
988  break;
989  }
990 
991  return FALSE;
992 }
993 
994 static INT_PTR CALLBACK
996  IN HWND hwndDlg,
997  IN UINT uMsg,
998  IN WPARAM wParam,
999  IN LPARAM lParam)
1000 {
1001  PDEVINSTDATA DevInstData;
1002  HWND hwndControl;
1003 
1005 
1006  /* Get pointer to the global setup data */
1007  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1008 
1009  switch (uMsg)
1010  {
1011  case WM_INITDIALOG:
1012  {
1013  BOOL DisableableDevice = FALSE;
1014 
1015  /* Get pointer to the global setup data */
1016  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1017  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1018 
1019  /* Center the wizard window */
1020  CenterWindow(GetParent(hwndDlg));
1021 
1022  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1023  ShowWindow(hwndControl, SW_HIDE);
1024  EnableWindow(hwndControl, FALSE);
1025 
1026  /* Set title font */
1028  hwndDlg,
1030  WM_SETFONT,
1031  (WPARAM)DevInstData->hTitleFont,
1032  (LPARAM)TRUE);
1033 
1034  /* disable the "do not show this dialog anymore" checkbox
1035  if the device cannot be disabled */
1037  DevInstData->devInfoData.DevInst,
1038  NULL,
1039  &DisableableDevice);
1040  EnableWindow(
1041  GetDlgItem(hwndDlg, IDC_DONOTSHOWDLG),
1042  DisableableDevice);
1043  break;
1044  }
1045 
1046  case WM_NOTIFY:
1047  {
1048  LPNMHDR lpnm = (LPNMHDR)lParam;
1049 
1050  switch (lpnm->code)
1051  {
1052  case PSN_SETACTIVE:
1053  /* Enable the correct buttons on for the active page */
1055  break;
1056 
1057  case PSN_WIZBACK:
1058  /* Handle a Back button click, if necessary */
1059  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1060  ShowWindow(hwndControl, SW_SHOW);
1061  EnableWindow(hwndControl, TRUE);
1063  return TRUE;
1064 
1065  case PSN_WIZFINISH:
1066  {
1067  BOOL DisableableDevice = FALSE;
1068  BOOL IsStarted = FALSE;
1069 
1070  if (CanDisableDevice(DevInstData->devInfoData.DevInst,
1071  NULL,
1072  &DisableableDevice) &&
1073  DisableableDevice &&
1075  DevInstData->devInfoData.DevInst,
1076  NULL,
1077  &IsStarted) &&
1078  !IsStarted &&
1080  hwndDlg,
1082  BM_GETCHECK,
1083  (WPARAM)0, (LPARAM)0) == BST_CHECKED)
1084  {
1085  /* disable the device */
1086  StartDevice(
1087  DevInstData->hDevInfo,
1088  &DevInstData->devInfoData,
1089  FALSE,
1090  0,
1091  NULL);
1092  }
1093  else
1094  {
1095  SetFailedInstall(DevInstData->hDevInfo,
1096  &DevInstData->devInfoData,
1097  FALSE);
1098  }
1099  break;
1100  }
1101 
1102  default:
1103  break;
1104  }
1105  break;
1106  }
1107 
1108  default:
1109  break;
1110  }
1111 
1112  return FALSE;
1113 }
1114 
1115 static INT_PTR CALLBACK
1117  IN HWND hwndDlg,
1118  IN UINT uMsg,
1119  IN WPARAM wParam,
1120  IN LPARAM lParam)
1121 {
1122  PDEVINSTDATA DevInstData;
1124 
1125  /* Retrieve pointer to the global setup data */
1126  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1127 
1128  switch (uMsg)
1129  {
1130  case WM_INITDIALOG:
1131  {
1132  HWND hwndControl;
1133 
1134  /* Get pointer to the global setup data */
1135  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1136  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1137 
1138  /* Center the wizard window */
1139  CenterWindow(GetParent(hwndDlg));
1140 
1141  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1142  ShowWindow(hwndControl, SW_HIDE);
1143  EnableWindow(hwndControl, FALSE);
1144 
1146  hwndDlg,
1147  IDC_DEVICE,
1148  WM_SETTEXT,
1149  0,
1150  (LPARAM)DevInstData->drvInfoData.Description);
1151 
1152  /* Set title font */
1154  hwndDlg,
1156  WM_SETFONT,
1157  (WPARAM)DevInstData->hTitleFont,
1158  (LPARAM)TRUE);
1159  break;
1160  }
1161 
1162  case WM_NOTIFY:
1163  {
1164  LPNMHDR lpnm = (LPNMHDR)lParam;
1165 
1166  switch (lpnm->code)
1167  {
1168  case PSN_SETACTIVE:
1169  /* Enable the correct buttons on for the active page */
1171  break;
1172 
1173  case PSN_WIZBACK:
1174  /* Handle a Back button click, if necessary */
1175  break;
1176 
1177  case PSN_WIZFINISH:
1178  /* Handle a Finish button click, if necessary */
1179  break;
1180 
1181  default:
1182  break;
1183  }
1184  break;
1185  }
1186 
1187  default:
1188  break;
1189  }
1190 
1191  return FALSE;
1192 }
1193 
1194 static INT_PTR CALLBACK
1196  IN HWND hwndDlg,
1197  IN UINT uMsg,
1198  IN WPARAM wParam,
1199  IN LPARAM lParam)
1200 {
1201  PDEVINSTDATA DevInstData;
1203 
1204  /* Retrieve pointer to the global setup data */
1205  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1206 
1207  switch (uMsg)
1208  {
1209  case WM_INITDIALOG:
1210  {
1211  HWND hwndControl;
1212 
1213  /* Get pointer to the global setup data */
1214  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1215  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1216 
1217  /* Center the wizard window */
1218  CenterWindow(GetParent(hwndDlg));
1219 
1220  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1221  ShowWindow(hwndControl, SW_HIDE);
1222  EnableWindow(hwndControl, FALSE);
1223 
1225  hwndDlg,
1226  IDC_DEVICE,
1227  WM_SETTEXT,
1228  0,
1229  (LPARAM)DevInstData->drvInfoData.Description);
1230 
1231  /* Set title font */
1233  hwndDlg,
1235  WM_SETFONT,
1236  (WPARAM)DevInstData->hTitleFont,
1237  (LPARAM)TRUE);
1238  break;
1239  }
1240 
1241  case WM_NOTIFY:
1242  {
1243  LPNMHDR lpnm = (LPNMHDR)lParam;
1244 
1245  switch (lpnm->code)
1246  {
1247  case PSN_SETACTIVE:
1248  /* Enable the correct buttons on for the active page */
1250  break;
1251 
1252  case PSN_WIZBACK:
1253  /* Handle a Back button click, if necessary */
1254  break;
1255 
1256  case PSN_WIZFINISH:
1257  /* Handle a Finish button click, if necessary */
1258  break;
1259 
1260  default:
1261  break;
1262  }
1263  break;
1264  }
1265 
1266  default:
1267  break;
1268  }
1269 
1270  return FALSE;
1271 }
1272 
1273 static INT_PTR CALLBACK
1275  IN HWND hwndDlg,
1276  IN UINT uMsg,
1277  IN WPARAM wParam,
1278  IN LPARAM lParam)
1279 {
1280  PDEVINSTDATA DevInstData;
1282 
1283  /* Retrieve pointer to the global setup data */
1284  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1285 
1286  switch (uMsg)
1287  {
1288  case WM_INITDIALOG:
1289  {
1290  HWND hwndControl;
1291 
1292  /* Get pointer to the global setup data */
1293  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1294  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1295 
1296  /* Center the wizard window */
1297  CenterWindow(GetParent(hwndDlg));
1298 
1299  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1300  ShowWindow(hwndControl, SW_HIDE);
1301  EnableWindow(hwndControl, FALSE);
1302 
1304  hwndDlg,
1305  IDC_DEVICE,
1306  WM_SETTEXT,
1307  0,
1308  (LPARAM)DevInstData->drvInfoData.Description);
1309 
1310  /* Set title font */
1312  hwndDlg,
1314  WM_SETFONT,
1315  (WPARAM)DevInstData->hTitleFont,
1316  (LPARAM)TRUE);
1317  break;
1318  }
1319 
1320  case WM_NOTIFY:
1321  {
1322  LPNMHDR lpnm = (LPNMHDR)lParam;
1323 
1324  switch (lpnm->code)
1325  {
1326  case PSN_SETACTIVE:
1327  /* Enable the correct buttons on for the active page */
1329  break;
1330 
1331  case PSN_WIZBACK:
1332  /* Handle a Back button click, if necessary */
1333  break;
1334 
1335  case PSN_WIZFINISH:
1336  /* Handle a Finish button click, if necessary */
1337  break;
1338 
1339  default:
1340  break;
1341  }
1342  break;
1343  }
1344 
1345  default:
1346  break;
1347  }
1348 
1349  return FALSE;
1350 }
1351 
1352 static HFONT
1354 {
1355  NONCLIENTMETRICSW ncm;
1356  LOGFONTW LogFont;
1357  HDC hdc;
1358  INT FontSize;
1359  HFONT hFont;
1360 
1361  ncm.cbSize = sizeof(NONCLIENTMETRICSW);
1362  SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
1363 
1364  LogFont = ncm.lfMessageFont;
1365  LogFont.lfWeight = FW_BOLD;
1366  wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
1367 
1368  hdc = GetDC(NULL);
1369  FontSize = 12;
1370  LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72;
1371  hFont = CreateFontIndirectW(&LogFont);
1372  ReleaseDC(NULL, hdc);
1373 
1374  return hFont;
1375 }
1376 
1377 BOOL
1379  IN PDEVINSTDATA DevInstData,
1380  IN HWND hwndParent,
1381  IN UINT startPage)
1382 {
1383  PROPSHEETHEADER psh = {0};
1384  HPROPSHEETPAGE ahpsp[IDD_MAXIMUMPAGE + 1];
1385  PROPSHEETPAGE psp = {0};
1386  HRESULT hr = CoInitialize(NULL); /* for SHAutoComplete */
1387 
1388  /* zero based index */
1389  startPage -= IDD_FIRSTPAGE;
1390 
1391  /* Create the Welcome page */
1392  ZeroMemory(&psp, sizeof(PROPSHEETPAGE));
1393  psp.dwSize = sizeof(PROPSHEETPAGE);
1394  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1395  psp.hInstance = hDllInstance;
1396  psp.lParam = (LPARAM)DevInstData;
1397  psp.pszTitle = MAKEINTRESOURCE(DevInstData->bUpdate ? IDS_UPDATEWIZARDTITLE : IDS_INSTALLWIZARDTITLE);
1398  psp.pfnDlgProc = WelcomeDlgProc;
1399  psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
1401 
1402  /* Create the Select Source page */
1403  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USETITLE;
1404  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_CHSOURCE_TITLE);
1405  psp.pfnDlgProc = CHSourceDlgProc;
1406  psp.pszTemplate = MAKEINTRESOURCE(IDD_CHSOURCE);
1408 
1409  /* Create the Search driver page */
1410  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USETITLE;
1411  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SEARCHDRV_TITLE);
1412  psp.pfnDlgProc = SearchDrvDlgProc;
1413  psp.pszTemplate = MAKEINTRESOURCE(IDD_SEARCHDRV);
1415 
1416  /* Create the Install driver page */
1417  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USETITLE;
1418  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_INSTALLDRV_TITLE);
1419  psp.pfnDlgProc = InstallDrvDlgProc;
1420  psp.pszTemplate = MAKEINTRESOURCE(IDD_INSTALLDRV);
1422 
1423  /* Create the No driver page */
1424  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1425  psp.pfnDlgProc = NoDriverDlgProc;
1426  psp.pszTemplate = MAKEINTRESOURCE(IDD_NODRIVER);
1428 
1429  /* Create the Install failed page */
1430  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1431  psp.pfnDlgProc = InstallFailedDlgProc;
1432  psp.pszTemplate = MAKEINTRESOURCE(IDD_INSTALLFAILED);
1434 
1435  /* Create the Need reboot page */
1436  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1437  psp.pfnDlgProc = NeedRebootDlgProc;
1438  psp.pszTemplate = MAKEINTRESOURCE(IDD_NEEDREBOOT);
1440 
1441  /* Create the Finish page */
1442  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1443  psp.pfnDlgProc = FinishDlgProc;
1444  psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
1446 
1447  /* Create the property sheet */
1448  psh.dwSize = sizeof(PROPSHEETHEADER);
1449  psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
1450  psh.hInstance = hDllInstance;
1451  psh.hwndParent = hwndParent;
1452  psh.nPages = IDD_MAXIMUMPAGE + 1;
1453  psh.nStartPage = startPage;
1454  psh.phpage = ahpsp;
1455  psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
1456  psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
1457 
1458  /* Create title font */
1459  DevInstData->hTitleFont = CreateTitleFont();
1460 
1461  /* Display the wizard */
1462  PropertySheet(&psh);
1463 
1464  DeleteObject(DevInstData->hTitleFont);
1465 
1466  if (SUCCEEDED(hr))
1467  CoUninitialize();
1468  return TRUE;
1469 }
#define IDC_DEVICE
Definition: resource.h:8
#define IDC_CHECK_MEDIA
Definition: resource.h:14
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
CONFIGRET WINAPI CM_Get_DevNode_Status_Ex(_Out_ PULONG pulStatus, _Out_ PULONG pulProblemNumber, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:3592
#define MAKEINTRESOURCE
Definition: winuser.h:591
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define IN
Definition: typedefs.h:39
SP_DEVINFO_DATA devInfoData
#define IDD_INSTALLDRV
Definition: resource.h:24
#define CB_GETLBTEXTLEN
Definition: winuser.h:1943
static INT_PTR CALLBACK InstallDrvDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:884
#define CloseHandle
Definition: compat.h:739
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define IDC_RADIO_AUTO
Definition: resource.h:9
#define ComboBox_AddString(hwndCtl, lpsz)
Definition: windowsx.h:41
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define KEY_SET_VALUE
Definition: nt_native.h:1017
GLuint64EXT * result
Definition: glext.h:11304
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ComboBox_GetLBText(hwndCtl, index, lpszBuffer)
Definition: windowsx.h:56
#define DI_NEEDREBOOT
Definition: setupapi.h:54
HDC WINAPI GetDC(_In_opt_ HWND)
static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
Definition: wizard.c:583
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define CB_GETLBTEXT
Definition: winuser.h:1942
#define SW_HIDE
Definition: winuser.h:762
#define IDC_BROWSE
Definition: resource.h:21
uint16_t * PWSTR
Definition: typedefs.h:56
CONFIGRET WINAPI CM_Set_DevNode_Problem(_In_ DEVINST dnDevInst, _In_ ULONG ulProblem, _In_ ULONG ulFlags)
Definition: cfgmgr.c:7748
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2599
static VOID PopulateCustomPathCombo(IN HWND hwndCombo)
Definition: wizard.c:284
LONG lfHeight
Definition: dimm.idl:59
#define INT
Definition: polytest.cpp:20
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
static HDC
Definition: imagelist.c:92
static VOID SaveCustomPath(IN HWND hwndCombo)
Definition: wizard.c:359
#define CALLBACK
Definition: compat.h:35
#define IDS_BROWSE_FOR_FOLDER_TITLE
Definition: resource.h:37
HWND hWnd
Definition: settings.c:17
#define SystemParametersInfo
Definition: winuser.h:5848
#define BFFM_INITIALIZED
Definition: shlobj.h:1163
#define IDS_INSTALLWIZARDTITLE
Definition: resource.h:32
LONG top
Definition: windef.h:307
#define PSWIZB_NEXT
Definition: prsht.h:154
#define IDD_NEEDREBOOT
Definition: resource.h:27
HRESULT WINAPI SHGetMalloc(LPMALLOC *lpmal)
Definition: shellole.c:285
#define DN_DISABLEABLE
Definition: cfg.h:131
HWND hwndOwner
Definition: shlobj.h:1127
#define IDS_INSTALLDRV_TITLE
Definition: resource.h:36
static void IncludePath(HWND Dlg, BOOL Enabled)
Definition: wizard.c:568
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1670
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define HWND_TOP
Definition: winuser.h:1197
BOOL DisplayWizard(IN PDEVINSTDATA DevInstData, IN HWND hwndParent, IN UINT startPage)
Definition: wizard.c:1378
#define IDD_SEARCHDRV
Definition: resource.h:23
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2603
LPWSTR CustomSearchPath
#define IDD_NODRIVER
Definition: resource.h:25
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define IDS_UPDATEWIZARDTITLE
Definition: resource.h:33
UINT_PTR WPARAM
Definition: windef.h:207
#define BIF_NONEWFOLDERBUTTON
Definition: shlobj.h:1154
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4024
#define SendDlgItemMessage
Definition: winuser.h:5832
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define DIF_PROPERTYCHANGE
Definition: setupapi.h:137
int32_t INT_PTR
Definition: typedefs.h:64
_In_ ULONG TotalLength
Definition: usbdlib.h:158
#define ComboBox_GetTextLength(hwndCtl)
Definition: windowsx.h:59
#define DICS_ENABLE
Definition: setupapi.h:112
LONG right
Definition: windef.h:308
#define IDB_HEADER
Definition: resource.h:30
#define PSN_SETACTIVE
Definition: prsht.h:115
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
#define IDC_RADIO_CHOOSE
Definition: resource.h:13
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1933
WPARAM wParam
Definition: combotst.c:138
#define IDC_DONOTSHOWDLG
Definition: resource.h:11
static INT_PTR CALLBACK NoDriverDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:995
HFONT hFont
Definition: main.c:53
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
static BOOL Set
Definition: pageheap.c:10
#define SPDRP_CLASSGUID
Definition: setupapi.h:515
static BOOL IsDeviceStarted(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *IsEnabled)
Definition: wizard.c:148
UINT code
Definition: winuser.h:3149
#define CM_SET_DEVNODE_PROBLEM_OVERRIDE
Definition: cfgmgr32.h:807
#define WM_INSTALL_FINISHED
static DWORD WINAPI InstallDriverProc(IN LPVOID lpParam)
Definition: wizard.c:271
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
#define PSN_WIZFINISH
Definition: prsht.h:122
#define BFFM_SETSELECTION
Definition: shlobj.h:1183
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static struct _test_info info[]
Definition: SetCursorPos.c:19
if SUCCEEDED(hr)
#define DICS_DISABLE
Definition: setupapi.h:114
#define REG_MULTI_SZ
Definition: nt_native.h:1501
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define IDD_CHSOURCE
Definition: resource.h:22
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define IDD_FIRSTPAGE
Definition: resource.h:29
unsigned int idx
Definition: utils.c:41
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define GWLP_USERDATA
Definition: treelist.c:63
unsigned char BOOLEAN
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define LPPROPSHEETPAGE
Definition: prsht.h:390
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
PVOID pBuffer
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define PROPSHEETHEADER
Definition: prsht.h:392
static HWND hwndParent
Definition: cryptui.c:300
#define PSN_WIZNEXT
Definition: prsht.h:121
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1908
Definition: bufpool.h:45
#define SPDIT_COMPATDRIVER
Definition: setupapi.h:506
#define SW_SHOW
Definition: winuser.h:769
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
static INT_PTR CALLBACK SearchDrvDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:789
#define WM_SETTEXT
Definition: winuser.h:1607
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define CB_ERR
Definition: winuser.h:2425
#define IDD_WELCOMEPAGE
Definition: resource.h:21
#define CreatePropertySheetPage
Definition: prsht.h:399
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Definition: autocomp.cpp:191
#define PostMessage
Definition: winuser.h:5822
static HINSTANCE hDllInstance
Definition: clb.c:30
#define IDC_FINISHTITLE
Definition: resource.h:60
#define PSWIZB_FINISH
Definition: prsht.h:155
LPCWSTR lpszTitle
Definition: shlobj.h:1130
Status
Definition: gdiplustypes.h:24
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4900
SP_CLASSINSTALL_HEADER ClassInstallHeader
Definition: setupapi.h:916
#define PSP_DEFAULT
Definition: prsht.h:22
#define BM_SETCHECK
Definition: winuser.h:1911
#define ComboBox_GetCount(hwndCtl)
Definition: windowsx.h:48
#define TRACE(s)
Definition: solgame.cpp:4
#define BIF_STATUSTEXT
Definition: shlobj.h:1146
static const WCHAR Title[]
Definition: oid.c:1259
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PSWIZB_BACK
Definition: prsht.h:153
LONG HRESULT
Definition: typedefs.h:79
#define DICS_FLAG_CONFIGSPECIFIC
Definition: setupapi.h:115
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define WINAPI
Definition: msvc.h:6
static INT_PTR CALLBACK InstallFailedDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:1116
unsigned long DWORD
Definition: ntddk_ex.h:95
static HFONT CreateTitleFont(VOID)
Definition: wizard.c:1353
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1155
#define SetLastError(x)
Definition: compat.h:752
#define SetupDiSetDeviceRegistryProperty
Definition: setupapi.h:2620
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
return pProvider IsEnabled(ProviderControl)
#define BIF_USENEWUI
Definition: shlobj.h:1151
static BOOL StartDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOL bEnable, IN DWORD HardwareProfile OPTIONAL, OUT BOOL *bNeedReboot OPTIONAL)
Definition: wizard.c:173
#define REGSTR_KEY_SETUP
Definition: regstr.h:105
HDEVINFO hDevInfo
static INT_PTR CALLBACK NeedRebootDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:1195
DWORD dwThreadId
Definition: fdebug.c:31
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define SPDRP_CLASS
Definition: setupapi.h:514
#define IDC_RADIO_SEARCHHERE
Definition: resource.h:12
HDC hdc
Definition: main.c:9
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
BOOL InstallCurrentDriver(IN PDEVINSTDATA DevInstData)
Definition: newdev.c:529
#define IDD_FINISHPAGE
Definition: resource.h:34
GLenum GLsizei len
Definition: glext.h:6722
#define IDS_CHSOURCE_TITLE
Definition: resource.h:34
#define WM_COMMAND
Definition: winuser.h:1730
#define IDD_INSTALLFAILED
Definition: resource.h:26
#define ComboBox_GetLBTextLen(hwndCtl, index)
Definition: windowsx.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define PSP_USETITLE
Definition: prsht.h:26
unsigned char BYTE
Definition: xxhash.c:193
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:66
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_WELCOMETITLE
Definition: resource.h:16
#define IDS_SEARCHDRV_TITLE
Definition: resource.h:35
LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi)
Definition: brsfolder.c:1406
#define SWP_NOSIZE
Definition: winuser.h:1235
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI SetupDiDestroyDriverInfoList(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN DWORD DriverType)
Definition: driver.c:1208
#define SPDRP_CONFIGFLAGS
Definition: setupapi.h:517
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
HWND WINAPI GetParent(_In_ HWND)
#define RegOpenKeyEx
Definition: winreg.h:520
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
UINT ulFlags
Definition: shlobj.h:1131
#define IDC_CHECK_PATH
Definition: resource.h:15
PRTL_UNICODE_STRING_BUFFER Path
#define ComboBox_ResetContent(hwndCtl)
Definition: windowsx.h:63
_In_ BOOL bEnable
Definition: winddi.h:3426
DWORD DEVINST
Definition: cfgmgr32.h:76
#define FW_BOLD
Definition: wingdi.h:378
#define BIF_RETURNONLYFSDIRS
Definition: shlobj.h:1144
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
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
LPARAM lParam
Definition: shlobj.h:1133
FxAutoRegKey hKey
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define BFFM_SELCHANGED
Definition: shlobj.h:1164
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BFFCALLBACK lpfn
Definition: shlobj.h:1132
#define IDB_WATERMARK
Definition: resource.h:4
BOOL CheckBestDriver(_In_ PDEVINSTDATA DevInstData, _In_ PCWSTR pszDir)
Definition: newdev.c:412
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static BOOL SetFailedInstall(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOLEAN Set)
Definition: wizard.c:63
HANDLE hThread
Definition: wizard.c:28
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define BST_CHECKED
Definition: winuser.h:197
#define WM_SETFONT
Definition: winuser.h:1640
#define CM_PROB_FAILED_INSTALL
Definition: cfg.h:58
#define PSN_WIZBACK
Definition: prsht.h:120
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
static void AutoDriver(HWND Dlg, BOOL Enabled)
Definition: wizard.c:575
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DN_STARTED
Definition: cfg.h:121
#define OUT
Definition: typedefs.h:40
#define PropertySheet
Definition: prsht.h:400
GLuint res
Definition: glext.h:9613
BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize)
Definition: devinst.c:3452
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
unsigned int ULONG
Definition: retypes.h:1
base for all directory entries
Definition: entries.h:138
LONG bottom
Definition: windef.h:309
static INT_PTR CALLBACK WelcomeDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:469
char * cleanup(char *str)
Definition: wpickclick.c:99
#define WM_SEARCH_FINISHED
BOOL PrepareFoldersToScan(IN PDEVINSTDATA DevInstData, IN BOOL IncludeRemovableDevices, IN BOOL IncludeCustomPath, IN HWND hwndCombo OPTIONAL)
Definition: newdev.c:455
#define LOGPIXELSY
Definition: wingdi.h:719
#define malloc
Definition: debug_ros.c:4
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
static INT_PTR CALLBACK CHSourceDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:615
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define IDC_COMBO_PATH
Definition: resource.h:18
#define DI_NEEDRESTART
Definition: setupapi.h:53
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetupDiSetClassInstallParams
Definition: setupapi.h:2617
LONG lfWeight
Definition: dimm.idl:63
#define REGSTR_PATH_SETUP
Definition: regstr.h:23
static BOOL CanDisableDevice(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *CanDisable)
Definition: wizard.c:124
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define IDD_MAXIMUMPAGE
Definition: resource.h:30
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define WS_SYSMENU
Definition: pedump.c:629
static INT_PTR CALLBACK FinishDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:1274
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
BOOL ScanFoldersForDriver(IN PDEVINSTDATA DevInstData)
Definition: newdev.c:420
BYTE * PBYTE
Definition: pedump.c:66
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
static DWORD WINAPI FindDriverProc(IN LPVOID lpParam)
Definition: wizard.c:242
struct _DEVINSTDATA * PDEVINSTDATA
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:735
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define PROPSHEETPAGE
Definition: prsht.h:389
#define CONFIGFLAG_FAILEDINSTALL
Definition: regstr.h:396
#define WM_NOTIFY
Definition: richedit.h:61
BOOL WINAPI GetComboBoxInfo(_In_ HWND, _Inout_ PCOMBOBOXINFO)
DI_FUNCTION InstallFunction
Definition: setupapi.h:904
#define SHACF_FILESYS_DIRS
Definition: shlwapi.h:1918
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68