ReactOS  0.4.15-dev-5126-g3bb451b
wizard.c File Reference
#include "newdev_private.h"
#include <wincon.h>
#include <cfgmgr32.h>
#include <shlobj.h>
#include <shlwapi.h>
Include dependency graph for wizard.c:

Go to the source code of this file.

Functions

static VOID CenterWindow (IN HWND hWnd)
 
static BOOL SetFailedInstall (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOLEAN Set)
 
static BOOL CanDisableDevice (IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *CanDisable)
 
static BOOL IsDeviceStarted (IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *IsEnabled)
 
static BOOL StartDevice (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOL bEnable, IN DWORD HardwareProfile OPTIONAL, OUT BOOL *bNeedReboot OPTIONAL)
 
static DWORD WINAPI FindDriverProc (IN LPVOID lpParam)
 
static DWORD WINAPI InstallDriverProc (IN LPVOID lpParam)
 
static VOID PopulateCustomPathCombo (IN HWND hwndCombo)
 
static VOID SaveCustomPath (IN HWND hwndCombo)
 
static INT_PTR CALLBACK WelcomeDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static void IncludePath (HWND Dlg, BOOL Enabled)
 
static void AutoDriver (HWND Dlg, BOOL Enabled)
 
static INT_PTR CALLBACK CHSourceDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK SearchDrvDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK InstallDrvDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK NoDriverDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK InstallFailedDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK NeedRebootDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK FinishDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static HFONT CreateTitleFont (VOID)
 
BOOL DisplayWizard (IN PDEVINSTDATA DevInstData, IN HWND hwndParent, IN UINT startPage)
 

Variables

HANDLE hThread
 

Function Documentation

◆ AutoDriver()

static void AutoDriver ( HWND  Dlg,
BOOL  Enabled 
)
static

Definition at line 575 of file wizard.c.

576 {
580 }
#define IDC_CHECK_MEDIA
Definition: resource.h:14
static void IncludePath(HWND Dlg, BOOL Enabled)
Definition: wizard.c:568
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_CHECK_PATH
Definition: resource.h:15

Referenced by CHSourceDlgProc().

◆ CanDisableDevice()

static BOOL CanDisableDevice ( IN DEVINST  DevInst,
IN HMACHINE  hMachine,
OUT BOOL CanDisable 
)
static

Definition at line 124 of file wizard.c.

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 }
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 TRUE
Definition: types.h:120
#define DN_DISABLEABLE
Definition: cfg.h:131
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CR_SUCCESS
Definition: cfgmgr32.h:842
Status
Definition: gdiplustypes.h:24
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
unsigned int ULONG
Definition: retypes.h:1

Referenced by NoDriverDlgProc().

◆ CenterWindow()

static VOID CenterWindow ( IN HWND  hWnd)
static

Definition at line 31 of file wizard.c.

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 }
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
#define HWND_TOP
Definition: winuser.h:1197
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define SWP_NOSIZE
Definition: winuser.h:1235
HWND WINAPI GetParent(_In_ HWND)
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)

Referenced by CHSourceDlgProc(), FinishDlgProc(), InstallDrvDlgProc(), InstallFailedDlgProc(), NeedRebootDlgProc(), NoDriverDlgProc(), SearchDrvDlgProc(), and WelcomeDlgProc().

◆ CHSourceDlgProc()

static INT_PTR CALLBACK CHSourceDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 583 of file wizard.c.

588 {
589  PDEVINSTDATA DevInstData;
590 
591  /* Retrieve pointer to the global setup data */
592  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
593 
594  switch (uMsg)
595  {
596  case WM_INITDIALOG:
597  {
598  HWND hwndControl, hwndCombo;
599  DWORD dwStyle;
600  COMBOBOXINFO info = { sizeof(info) };
601 
602  /* Get pointer to the global setup data */
603  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
604  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
605 
606  hwndControl = GetParent(hwndDlg);
607 
608  /* Center the wizard window */
609  CenterWindow(hwndControl);
610 
611  /* Hide the system menu */
612  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
613  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
614 
615  hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_PATH);
616  PopulateCustomPathCombo(hwndCombo);
617 
618  GetComboBoxInfo(hwndCombo, &info);
620 
622  hwndDlg,
624  BM_SETCHECK,
625  (WPARAM)TRUE,
626  (LPARAM)0);
627  AutoDriver(hwndDlg, TRUE);
628  IncludePath(hwndDlg, FALSE);
629 
630  /* Disable manual driver choice for now */
632 
633  break;
634  }
635 
636  case WM_COMMAND:
637  {
638  switch (LOWORD(wParam))
639  {
641  AutoDriver(hwndDlg, TRUE);
642  return TRUE;
643 
644  case IDC_RADIO_CHOOSE:
645  AutoDriver(hwndDlg, FALSE);
646  return TRUE;
647 
648  case IDC_CHECK_PATH:
649  IncludePath(hwndDlg, IsDlgButtonChecked(hwndDlg, IDC_CHECK_PATH));
650  return TRUE;
651 
652  case IDC_BROWSE:
653  {
654  BROWSEINFO bi = { 0 };
655  LPITEMIDLIST pidl;
658 
659  bi.hwndOwner = hwndDlg;
661  bi.lpszTitle = Title;
662  pidl = SHBrowseForFolder(&bi);
663  if (pidl)
664  {
666  IMalloc* malloc;
667 
668  if (SHGetPathFromIDListW(pidl, Directory))
669  {
670  /* Set the IDC_COMBO_PATH text */
672  }
673 
674  /* Free memory, if possible */
676  {
677  IMalloc_Free(malloc, pidl);
678  IMalloc_Release(malloc);
679  }
680  return TRUE;
681  }
682  break;
683  }
684  }
685  break;
686  }
687 
688  case WM_NOTIFY:
689  {
690  LPNMHDR lpnm = (LPNMHDR)lParam;
691 
692  switch (lpnm->code)
693  {
694  case PSN_SETACTIVE:
695  /* Enable the Next and Back buttons */
697  break;
698 
699  case PSN_WIZNEXT:
700  /* Handle a Next button click, if necessary */
702  {
704  HeapFree(GetProcessHeap(), 0, DevInstData->CustomSearchPath);
705  DevInstData->CustomSearchPath = NULL;
707  DevInstData,
710  GetDlgItem(hwndDlg, IDC_COMBO_PATH)))
711  {
713  }
714  else
715  {
717  }
718  }
719  else
720  {
721  /* FIXME */;
722  }
723  return TRUE;
724 
725  default:
726  break;
727  }
728  break;
729  }
730 
731  default:
732  break;
733  }
734 
735  return FALSE;
736 }
#define IDC_CHECK_MEDIA
Definition: resource.h:14
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
#define TRUE
Definition: types.h:120
#define IDC_BROWSE
Definition: resource.h:21
static VOID PopulateCustomPathCombo(IN HWND hwndCombo)
Definition: wizard.c:284
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
static VOID SaveCustomPath(IN HWND hwndCombo)
Definition: wizard.c:359
#define IDS_BROWSE_FOR_FOLDER_TITLE
Definition: resource.h:37
#define PSWIZB_NEXT
Definition: prsht.h:154
HRESULT WINAPI SHGetMalloc(LPMALLOC *lpmal)
Definition: shellole.c:285
static void IncludePath(HWND Dlg, BOOL Enabled)
Definition: wizard.c:568
#define IDD_SEARCHDRV
Definition: resource.h:23
LPWSTR CustomSearchPath
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
#define BIF_NONEWFOLDERBUTTON
Definition: shlobj.h:1154
#define SendDlgItemMessage
Definition: winuser.h:5832
#define BROWSEINFO
Definition: shlobj.h:1137
#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)
#define IDC_RADIO_CHOOSE
Definition: resource.h:13
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3149
#define FALSE
Definition: types.h:117
static struct _test_info info[]
Definition: SetCursorPos.c:19
if SUCCEEDED(hr)
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define PSN_WIZNEXT
Definition: prsht.h:121
LONG_PTR LPARAM
Definition: windef.h:208
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define SHBrowseForFolder
Definition: shlobj.h:1180
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Definition: autocomp.cpp:191
static HINSTANCE hDllInstance
Definition: clb.c:30
#define BM_SETCHECK
Definition: winuser.h:1911
#define BIF_STATUSTEXT
Definition: shlobj.h:1146
static const WCHAR Title[]
Definition: oid.c:1259
#define GetProcessHeap()
Definition: compat.h:595
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PSWIZB_BACK
Definition: prsht.h:153
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define BIF_USENEWUI
Definition: shlobj.h:1151
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define IDC_RADIO_SEARCHHERE
Definition: resource.h:12
#define WM_COMMAND
Definition: winuser.h:1730
#define IDD_INSTALLFAILED
Definition: resource.h:26
uint32_t DWORD_PTR
Definition: typedefs.h:65
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define GWL_STYLE
Definition: winuser.h:846
HWND WINAPI GetParent(_In_ HWND)
#define IDC_CHECK_PATH
Definition: resource.h:15
#define BIF_RETURNONLYFSDIRS
Definition: shlobj.h:1144
#define NULL
Definition: types.h:112
static void AutoDriver(HWND Dlg, BOOL Enabled)
Definition: wizard.c:575
base for all directory entries
Definition: entries.h:138
BOOL PrepareFoldersToScan(IN PDEVINSTDATA DevInstData, IN BOOL IncludeRemovableDevices, IN BOOL IncludeCustomPath, IN HWND hwndCombo OPTIONAL)
Definition: newdev.c:447
#define malloc
Definition: debug_ros.c:4
#define IDC_COMBO_PATH
Definition: resource.h:18
#define GetWindowLongPtr
Definition: treelist.c:73
#define WS_SYSMENU
Definition: pedump.c:629
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
struct _DEVINSTDATA * PDEVINSTDATA
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
#define WM_NOTIFY
Definition: richedit.h:61
BOOL WINAPI GetComboBoxInfo(_In_ HWND, _Inout_ PCOMBOBOXINFO)
#define SHACF_FILESYS_DIRS
Definition: shlwapi.h:1918

Referenced by DisplayWizard().

◆ CreateTitleFont()

static HFONT CreateTitleFont ( VOID  )
static

Definition at line 1303 of file wizard.c.

1304 {
1305  NONCLIENTMETRICSW ncm;
1306  LOGFONTW LogFont;
1307  HDC hdc;
1308  INT FontSize;
1309  HFONT hFont;
1310 
1311  ncm.cbSize = sizeof(NONCLIENTMETRICSW);
1312  SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
1313 
1314  LogFont = ncm.lfMessageFont;
1315  LogFont.lfWeight = FW_BOLD;
1316  wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
1317 
1318  hdc = GetDC(NULL);
1319  FontSize = 12;
1320  LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72;
1321  hFont = CreateFontIndirectW(&LogFont);
1322  ReleaseDC(NULL, hdc);
1323 
1324  return hFont;
1325 }
HDC WINAPI GetDC(_In_opt_ HWND)
LONG lfHeight
Definition: dimm.idl:59
static HDC
Definition: imagelist.c:92
#define SystemParametersInfo
Definition: winuser.h:5848
int32_t INT
Definition: typedefs.h:58
HFONT hFont
Definition: main.c:53
#define L(x)
Definition: ntvdm.h:50
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_BOLD
Definition: wingdi.h:378
#define NULL
Definition: types.h:112
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define LOGPIXELSY
Definition: wingdi.h:719
LONG lfWeight
Definition: dimm.idl:63

Referenced by DisplayWizard().

◆ DisplayWizard()

BOOL DisplayWizard ( IN PDEVINSTDATA  DevInstData,
IN HWND  hwndParent,
IN UINT  startPage 
)

Definition at line 1328 of file wizard.c.

1332 {
1333  PROPSHEETHEADER psh = {0};
1334  HPROPSHEETPAGE ahpsp[IDD_MAXIMUMPAGE + 1];
1335  PROPSHEETPAGE psp = {0};
1336  HRESULT hr = CoInitialize(NULL); /* for SHAutoComplete */
1337 
1338  /* zero based index */
1339  startPage -= IDD_FIRSTPAGE;
1340 
1341  /* Create the Welcome page */
1342  ZeroMemory(&psp, sizeof(PROPSHEETPAGE));
1343  psp.dwSize = sizeof(PROPSHEETPAGE);
1344  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1345  psp.hInstance = hDllInstance;
1346  psp.lParam = (LPARAM)DevInstData;
1347  psp.pszTitle = MAKEINTRESOURCE(DevInstData->bUpdate ? IDS_UPDATEWIZARDTITLE : IDS_INSTALLWIZARDTITLE);
1348  psp.pfnDlgProc = WelcomeDlgProc;
1349  psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
1351 
1352  /* Create the Select Source page */
1353  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USETITLE;
1354  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_CHSOURCE_TITLE);
1355  psp.pfnDlgProc = CHSourceDlgProc;
1356  psp.pszTemplate = MAKEINTRESOURCE(IDD_CHSOURCE);
1358 
1359  /* Create the Search driver page */
1360  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USETITLE;
1361  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SEARCHDRV_TITLE);
1362  psp.pfnDlgProc = SearchDrvDlgProc;
1363  psp.pszTemplate = MAKEINTRESOURCE(IDD_SEARCHDRV);
1365 
1366  /* Create the Install driver page */
1367  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USETITLE;
1368  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_INSTALLDRV_TITLE);
1369  psp.pfnDlgProc = InstallDrvDlgProc;
1370  psp.pszTemplate = MAKEINTRESOURCE(IDD_INSTALLDRV);
1372 
1373  /* Create the No driver page */
1374  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1375  psp.pfnDlgProc = NoDriverDlgProc;
1376  psp.pszTemplate = MAKEINTRESOURCE(IDD_NODRIVER);
1378 
1379  /* Create the Install failed page */
1380  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1381  psp.pfnDlgProc = InstallFailedDlgProc;
1382  psp.pszTemplate = MAKEINTRESOURCE(IDD_INSTALLFAILED);
1384 
1385  /* Create the Need reboot page */
1386  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1387  psp.pfnDlgProc = NeedRebootDlgProc;
1388  psp.pszTemplate = MAKEINTRESOURCE(IDD_NEEDREBOOT);
1390 
1391  /* Create the Finish page */
1392  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1393  psp.pfnDlgProc = FinishDlgProc;
1394  psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
1396 
1397  /* Create the property sheet */
1398  psh.dwSize = sizeof(PROPSHEETHEADER);
1399  psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
1400  psh.hInstance = hDllInstance;
1401  psh.hwndParent = hwndParent;
1402  psh.nPages = IDD_MAXIMUMPAGE + 1;
1403  psh.nStartPage = startPage;
1404  psh.phpage = ahpsp;
1405  psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
1406  psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
1407 
1408  /* Create title font */
1409  DevInstData->hTitleFont = CreateTitleFont();
1410 
1411  /* Display the wizard */
1412  PropertySheet(&psh);
1413 
1414  DeleteObject(DevInstData->hTitleFont);
1415 
1416  if (SUCCEEDED(hr))
1417  CoUninitialize();
1418  return TRUE;
1419 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDD_INSTALLDRV
Definition: resource.h:24
static INT_PTR CALLBACK InstallDrvDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:834
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
#define IDS_INSTALLWIZARDTITLE
Definition: resource.h:32
#define IDD_NEEDREBOOT
Definition: resource.h:27
#define IDS_INSTALLDRV_TITLE
Definition: resource.h:36
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define IDD_SEARCHDRV
Definition: resource.h:23
#define IDD_NODRIVER
Definition: resource.h:25
#define IDS_UPDATEWIZARDTITLE
Definition: resource.h:33
#define IDB_HEADER
Definition: resource.h:30
static INT_PTR CALLBACK NoDriverDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:945
if SUCCEEDED(hr)
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define IDD_CHSOURCE
Definition: resource.h:22
#define IDD_FIRSTPAGE
Definition: resource.h:29
#define PROPSHEETHEADER
Definition: prsht.h:392
static HWND hwndParent
Definition: cryptui.c:300
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK SearchDrvDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:739
#define IDD_WELCOMEPAGE
Definition: resource.h:21
#define CreatePropertySheetPage
Definition: prsht.h:399
static HINSTANCE hDllInstance
Definition: clb.c:30
#define PSP_DEFAULT
Definition: prsht.h:22
LONG HRESULT
Definition: typedefs.h:79
static INT_PTR CALLBACK InstallFailedDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:1066
static HFONT CreateTitleFont(VOID)
Definition: wizard.c:1303
static INT_PTR CALLBACK NeedRebootDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:1145
#define IDD_FINISHPAGE
Definition: resource.h:34
#define IDS_CHSOURCE_TITLE
Definition: resource.h:34
#define IDD_INSTALLFAILED
Definition: resource.h:26
#define PSP_USETITLE
Definition: prsht.h:26
#define IDS_SEARCHDRV_TITLE
Definition: resource.h:35
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define IDB_WATERMARK
Definition: resource.h:4
#define NULL
Definition: types.h:112
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
#define PropertySheet
Definition: prsht.h:400
static INT_PTR CALLBACK WelcomeDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:469
static INT_PTR CALLBACK CHSourceDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:583
#define IDD_MAXIMUMPAGE
Definition: resource.h:30
static INT_PTR CALLBACK FinishDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:1224
#define PROPSHEETPAGE
Definition: prsht.h:389

Referenced by DevInstallW(), and InstallDevInstEx().

◆ FindDriverProc()

static DWORD WINAPI FindDriverProc ( IN LPVOID  lpParam)
static

Definition at line 242 of file wizard.c.

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 }
SP_DEVINFO_DATA devInfoData
GLuint64EXT * result
Definition: glext.h:11304
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PostMessage
Definition: winuser.h:5822
HDEVINFO hDevInfo
static BOOL SetFailedInstall(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOLEAN Set)
Definition: wizard.c:63
#define WM_SEARCH_FINISHED
BOOL ScanFoldersForDriver(IN PDEVINSTDATA DevInstData)
Definition: newdev.c:412
struct _DEVINSTDATA * PDEVINSTDATA

Referenced by SearchDrvDlgProc().

◆ FinishDlgProc()

static INT_PTR CALLBACK FinishDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1224 of file wizard.c.

1229 {
1230  PDEVINSTDATA DevInstData;
1232 
1233  /* Retrieve pointer to the global setup data */
1234  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1235 
1236  switch (uMsg)
1237  {
1238  case WM_INITDIALOG:
1239  {
1240  HWND hwndControl;
1241 
1242  /* Get pointer to the global setup data */
1243  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1244  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1245 
1246  /* Center the wizard window */
1247  CenterWindow(GetParent(hwndDlg));
1248 
1249  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1250  ShowWindow(hwndControl, SW_HIDE);
1251  EnableWindow(hwndControl, FALSE);
1252 
1254  hwndDlg,
1255  IDC_DEVICE,
1256  WM_SETTEXT,
1257  0,
1258  (LPARAM)DevInstData->drvInfoData.Description);
1259 
1260  /* Set title font */
1262  hwndDlg,
1264  WM_SETFONT,
1265  (WPARAM)DevInstData->hTitleFont,
1266  (LPARAM)TRUE);
1267  break;
1268  }
1269 
1270  case WM_NOTIFY:
1271  {
1272  LPNMHDR lpnm = (LPNMHDR)lParam;
1273 
1274  switch (lpnm->code)
1275  {
1276  case PSN_SETACTIVE:
1277  /* Enable the correct buttons on for the active page */
1279  break;
1280 
1281  case PSN_WIZBACK:
1282  /* Handle a Back button click, if necessary */
1283  break;
1284 
1285  case PSN_WIZFINISH:
1286  /* Handle a Finish button click, if necessary */
1287  break;
1288 
1289  default:
1290  break;
1291  }
1292  break;
1293  }
1294 
1295  default:
1296  break;
1297  }
1298 
1299  return FALSE;
1300 }
#define IDC_DEVICE
Definition: resource.h:8
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define SW_HIDE
Definition: winuser.h:762
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5832
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3149
#define FALSE
Definition: types.h:117
#define PSN_WIZFINISH
Definition: prsht.h:122
#define GWLP_USERDATA
Definition: treelist.c:63
SP_DRVINFO_DATA_W drvInfoData
#define LPPROPSHEETPAGE
Definition: prsht.h:390
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR Description[LINE_LEN]
Definition: setupapi.h:1016
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define WM_SETTEXT
Definition: winuser.h:1607
#define IDC_FINISHTITLE
Definition: resource.h:60
#define PSWIZB_FINISH
Definition: prsht.h:155
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
uint32_t DWORD_PTR
Definition: typedefs.h:65
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
#define WM_SETFONT
Definition: winuser.h:1640
#define PSN_WIZBACK
Definition: prsht.h:120
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
struct _DEVINSTDATA * PDEVINSTDATA
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by DisplayWizard().

◆ IncludePath()

static void IncludePath ( HWND  Dlg,
BOOL  Enabled 
)
static

Definition at line 568 of file wizard.c.

569 {
572 }
#define IDC_BROWSE
Definition: resource.h:21
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_COMBO_PATH
Definition: resource.h:18

Referenced by AutoDriver(), and CHSourceDlgProc().

◆ InstallDriverProc()

static DWORD WINAPI InstallDriverProc ( IN LPVOID  lpParam)
static

Definition at line 271 of file wizard.c.

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 }
#define WM_INSTALL_FINISHED
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PostMessage
Definition: winuser.h:5822
BOOL InstallCurrentDriver(IN PDEVINSTDATA DevInstData)
Definition: newdev.c:521
GLuint res
Definition: glext.h:9613
struct _DEVINSTDATA * PDEVINSTDATA

Referenced by InstallDrvDlgProc().

◆ InstallDrvDlgProc()

static INT_PTR CALLBACK InstallDrvDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 834 of file wizard.c.

839 {
840  PDEVINSTDATA DevInstData;
842 
843  /* Retrieve pointer to the global setup data */
844  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
845 
846  switch (uMsg)
847  {
848  case WM_INITDIALOG:
849  {
850  HWND hwndControl;
851  DWORD dwStyle;
852 
853  /* Get pointer to the global setup data */
854  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
855  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
856 
857  DevInstData->hDialog = hwndDlg;
858  hwndControl = GetParent(hwndDlg);
859 
860  /* Center the wizard window */
861  CenterWindow(hwndControl);
862 
864  hwndDlg,
865  IDC_DEVICE,
866  WM_SETTEXT,
867  0,
868  (LPARAM)DevInstData->drvInfoData.Description);
869 
870  /* Hide the system menu */
871  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
872  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
873  break;
874  }
875 
876  case WM_INSTALL_FINISHED:
877  {
879  hThread = 0;
880  if (wParam == 0)
881  {
882  SP_DEVINSTALL_PARAMS installParams;
883 
884  SetFailedInstall(DevInstData->hDevInfo,
885  &DevInstData->devInfoData,
886  FALSE);
887 
888  /* Should we reboot? */
889  installParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
891  DevInstData->hDevInfo,
892  &DevInstData->devInfoData,
893  &installParams))
894  {
895  if (installParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT))
896  {
898  }
899  else
901  break;
902  }
903  }
905  break;
906  }
907 
908  case WM_NOTIFY:
909  {
910  LPNMHDR lpnm = (LPNMHDR)lParam;
911 
912  switch (lpnm->code)
913  {
914  case PSN_SETACTIVE:
916  hThread = CreateThread(NULL, 0, InstallDriverProc, DevInstData, 0, &dwThreadId);
917  break;
918 
919  case PSN_KILLACTIVE:
920  if (hThread != 0)
921  {
923  return TRUE;
924  }
925  break;
926 
927  case PSN_WIZNEXT:
928  /* Handle a Next button click, if necessary */
929  break;
930 
931  default:
932  break;
933  }
934  break;
935  }
936 
937  default:
938  break;
939  }
940 
941  return FALSE;
942 }
#define IDC_DEVICE
Definition: resource.h:8
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
SP_DEVINFO_DATA devInfoData
#define CloseHandle
Definition: compat.h:598
#define DI_NEEDREBOOT
Definition: setupapi.h:54
#define TRUE
Definition: types.h:120
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2599
#define PSWIZB_NEXT
Definition: prsht.h:154
#define IDD_NEEDREBOOT
Definition: resource.h:27
#define SendDlgItemMessage
Definition: winuser.h:5832
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3149
#define WM_INSTALL_FINISHED
static DWORD WINAPI InstallDriverProc(IN LPVOID lpParam)
Definition: wizard.c:271
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define FALSE
Definition: types.h:117
#define GWLP_USERDATA
Definition: treelist.c:63
SP_DRVINFO_DATA_W drvInfoData
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
#define PSN_WIZNEXT
Definition: prsht.h:121
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR Description[LINE_LEN]
Definition: setupapi.h:1016
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define WM_SETTEXT
Definition: winuser.h:1607
#define PSWIZB_BACK
Definition: prsht.h:153
unsigned long DWORD
Definition: ntddk_ex.h:95
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1155
HDEVINFO hDevInfo
DWORD dwThreadId
Definition: fdebug.c:31
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define IDD_FINISHPAGE
Definition: resource.h:34
#define IDD_INSTALLFAILED
Definition: resource.h:26
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define GWL_STYLE
Definition: winuser.h:846
HWND WINAPI GetParent(_In_ HWND)
#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
#define DI_NEEDRESTART
Definition: setupapi.h:53
#define GetWindowLongPtr
Definition: treelist.c:73
#define WS_SYSMENU
Definition: pedump.c:629
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
struct _DEVINSTDATA * PDEVINSTDATA
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by DisplayWizard().

◆ InstallFailedDlgProc()

static INT_PTR CALLBACK InstallFailedDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1066 of file wizard.c.

1071 {
1072  PDEVINSTDATA DevInstData;
1074 
1075  /* Retrieve pointer to the global setup data */
1076  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1077 
1078  switch (uMsg)
1079  {
1080  case WM_INITDIALOG:
1081  {
1082  HWND hwndControl;
1083 
1084  /* Get pointer to the global setup data */
1085  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1086  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1087 
1088  /* Center the wizard window */
1089  CenterWindow(GetParent(hwndDlg));
1090 
1091  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1092  ShowWindow(hwndControl, SW_HIDE);
1093  EnableWindow(hwndControl, FALSE);
1094 
1096  hwndDlg,
1097  IDC_DEVICE,
1098  WM_SETTEXT,
1099  0,
1100  (LPARAM)DevInstData->drvInfoData.Description);
1101 
1102  /* Set title font */
1104  hwndDlg,
1106  WM_SETFONT,
1107  (WPARAM)DevInstData->hTitleFont,
1108  (LPARAM)TRUE);
1109  break;
1110  }
1111 
1112  case WM_NOTIFY:
1113  {
1114  LPNMHDR lpnm = (LPNMHDR)lParam;
1115 
1116  switch (lpnm->code)
1117  {
1118  case PSN_SETACTIVE:
1119  /* Enable the correct buttons on for the active page */
1121  break;
1122 
1123  case PSN_WIZBACK:
1124  /* Handle a Back button click, if necessary */
1125  break;
1126 
1127  case PSN_WIZFINISH:
1128  /* Handle a Finish button click, if necessary */
1129  break;
1130 
1131  default:
1132  break;
1133  }
1134  break;
1135  }
1136 
1137  default:
1138  break;
1139  }
1140 
1141  return FALSE;
1142 }
#define IDC_DEVICE
Definition: resource.h:8
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define SW_HIDE
Definition: winuser.h:762
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5832
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3149
#define FALSE
Definition: types.h:117
#define PSN_WIZFINISH
Definition: prsht.h:122
#define GWLP_USERDATA
Definition: treelist.c:63
SP_DRVINFO_DATA_W drvInfoData
#define LPPROPSHEETPAGE
Definition: prsht.h:390
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR Description[LINE_LEN]
Definition: setupapi.h:1016
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define WM_SETTEXT
Definition: winuser.h:1607
#define IDC_FINISHTITLE
Definition: resource.h:60
#define PSWIZB_FINISH
Definition: prsht.h:155
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
uint32_t DWORD_PTR
Definition: typedefs.h:65
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
#define WM_SETFONT
Definition: winuser.h:1640
#define PSN_WIZBACK
Definition: prsht.h:120
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
struct _DEVINSTDATA * PDEVINSTDATA
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by DisplayWizard().

◆ IsDeviceStarted()

static BOOL IsDeviceStarted ( IN DEVINST  DevInst,
IN HMACHINE  hMachine,
OUT BOOL IsEnabled 
)
static

Definition at line 148 of file wizard.c.

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 }
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 TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CR_SUCCESS
Definition: cfgmgr32.h:842
Status
Definition: gdiplustypes.h:24
return pProvider IsEnabled(ProviderControl)
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define DN_STARTED
Definition: cfg.h:121
unsigned int ULONG
Definition: retypes.h:1

Referenced by NoDriverDlgProc().

◆ NeedRebootDlgProc()

static INT_PTR CALLBACK NeedRebootDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1145 of file wizard.c.

1150 {
1151  PDEVINSTDATA DevInstData;
1153 
1154  /* Retrieve pointer to the global setup data */
1155  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1156 
1157  switch (uMsg)
1158  {
1159  case WM_INITDIALOG:
1160  {
1161  HWND hwndControl;
1162 
1163  /* Get pointer to the global setup data */
1164  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1165  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1166 
1167  /* Center the wizard window */
1168  CenterWindow(GetParent(hwndDlg));
1169 
1170  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1171  ShowWindow(hwndControl, SW_HIDE);
1172  EnableWindow(hwndControl, FALSE);
1173 
1175  hwndDlg,
1176  IDC_DEVICE,
1177  WM_SETTEXT,
1178  0,
1179  (LPARAM)DevInstData->drvInfoData.Description);
1180 
1181  /* Set title font */
1183  hwndDlg,
1185  WM_SETFONT,
1186  (WPARAM)DevInstData->hTitleFont,
1187  (LPARAM)TRUE);
1188  break;
1189  }
1190 
1191  case WM_NOTIFY:
1192  {
1193  LPNMHDR lpnm = (LPNMHDR)lParam;
1194 
1195  switch (lpnm->code)
1196  {
1197  case PSN_SETACTIVE:
1198  /* Enable the correct buttons on for the active page */
1200  break;
1201 
1202  case PSN_WIZBACK:
1203  /* Handle a Back button click, if necessary */
1204  break;
1205 
1206  case PSN_WIZFINISH:
1207  /* Handle a Finish button click, if necessary */
1208  break;
1209 
1210  default:
1211  break;
1212  }
1213  break;
1214  }
1215 
1216  default:
1217  break;
1218  }
1219 
1220  return FALSE;
1221 }
#define IDC_DEVICE
Definition: resource.h:8
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define SW_HIDE
Definition: winuser.h:762
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5832
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3149
#define FALSE
Definition: types.h:117
#define PSN_WIZFINISH
Definition: prsht.h:122
#define GWLP_USERDATA
Definition: treelist.c:63
SP_DRVINFO_DATA_W drvInfoData
#define LPPROPSHEETPAGE
Definition: prsht.h:390
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR Description[LINE_LEN]
Definition: setupapi.h:1016
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define WM_SETTEXT
Definition: winuser.h:1607
#define IDC_FINISHTITLE
Definition: resource.h:60
#define PSWIZB_FINISH
Definition: prsht.h:155
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
uint32_t DWORD_PTR
Definition: typedefs.h:65
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
#define WM_SETFONT
Definition: winuser.h:1640
#define PSN_WIZBACK
Definition: prsht.h:120
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
struct _DEVINSTDATA * PDEVINSTDATA
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by DisplayWizard().

◆ NoDriverDlgProc()

static INT_PTR CALLBACK NoDriverDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 945 of file wizard.c.

950 {
951  PDEVINSTDATA DevInstData;
952  HWND hwndControl;
953 
955 
956  /* Get pointer to the global setup data */
957  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
958 
959  switch (uMsg)
960  {
961  case WM_INITDIALOG:
962  {
963  BOOL DisableableDevice = FALSE;
964 
965  /* Get pointer to the global setup data */
966  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
967  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
968 
969  /* Center the wizard window */
970  CenterWindow(GetParent(hwndDlg));
971 
972  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
973  ShowWindow(hwndControl, SW_HIDE);
974  EnableWindow(hwndControl, FALSE);
975 
976  /* Set title font */
978  hwndDlg,
980  WM_SETFONT,
981  (WPARAM)DevInstData->hTitleFont,
982  (LPARAM)TRUE);
983 
984  /* disable the "do not show this dialog anymore" checkbox
985  if the device cannot be disabled */
987  DevInstData->devInfoData.DevInst,
988  NULL,
989  &DisableableDevice);
990  EnableWindow(
991  GetDlgItem(hwndDlg, IDC_DONOTSHOWDLG),
992  DisableableDevice);
993  break;
994  }
995 
996  case WM_NOTIFY:
997  {
998  LPNMHDR lpnm = (LPNMHDR)lParam;
999 
1000  switch (lpnm->code)
1001  {
1002  case PSN_SETACTIVE:
1003  /* Enable the correct buttons on for the active page */
1005  break;
1006 
1007  case PSN_WIZBACK:
1008  /* Handle a Back button click, if necessary */
1009  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1010  ShowWindow(hwndControl, SW_SHOW);
1011  EnableWindow(hwndControl, TRUE);
1013  return TRUE;
1014 
1015  case PSN_WIZFINISH:
1016  {
1017  BOOL DisableableDevice = FALSE;
1018  BOOL IsStarted = FALSE;
1019 
1020  if (CanDisableDevice(DevInstData->devInfoData.DevInst,
1021  NULL,
1022  &DisableableDevice) &&
1023  DisableableDevice &&
1025  DevInstData->devInfoData.DevInst,
1026  NULL,
1027  &IsStarted) &&
1028  !IsStarted &&
1030  hwndDlg,
1032  BM_GETCHECK,
1033  (WPARAM)0, (LPARAM)0) == BST_CHECKED)
1034  {
1035  /* disable the device */
1036  StartDevice(
1037  DevInstData->hDevInfo,
1038  &DevInstData->devInfoData,
1039  FALSE,
1040  0,
1041  NULL);
1042  }
1043  else
1044  {
1045  SetFailedInstall(DevInstData->hDevInfo,
1046  &DevInstData->devInfoData,
1047  FALSE);
1048  }
1049  break;
1050  }
1051 
1052  default:
1053  break;
1054  }
1055  break;
1056  }
1057 
1058  default:
1059  break;
1060  }
1061 
1062  return FALSE;
1063 }
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
SP_DEVINFO_DATA devInfoData
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define SW_HIDE
Definition: winuser.h:762
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5832
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define IDC_DONOTSHOWDLG
Definition: resource.h:11
struct tagNMHDR * LPNMHDR
static BOOL IsDeviceStarted(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *IsEnabled)
Definition: wizard.c:148
UINT code
Definition: winuser.h:3149
#define FALSE
Definition: types.h:117
#define PSN_WIZFINISH
Definition: prsht.h:122
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDD_CHSOURCE
Definition: resource.h:22
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:390
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1908
#define SW_SHOW
Definition: winuser.h:769
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define IDC_FINISHTITLE
Definition: resource.h:60
#define PSWIZB_FINISH
Definition: prsht.h:155
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PSWIZB_BACK
Definition: prsht.h:153
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
HDEVINFO hDevInfo
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
uint32_t DWORD_PTR
Definition: typedefs.h:65
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
#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
#define BST_CHECKED
Definition: winuser.h:197
#define WM_SETFONT
Definition: winuser.h:1640
#define PSN_WIZBACK
Definition: prsht.h:120
#define GetWindowLongPtr
Definition: treelist.c:73
static BOOL CanDisableDevice(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *CanDisable)
Definition: wizard.c:124
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
struct _DEVINSTDATA * PDEVINSTDATA
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by DisplayWizard().

◆ PopulateCustomPathCombo()

static VOID PopulateCustomPathCombo ( IN HWND  hwndCombo)
static

Definition at line 284 of file wizard.c.

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 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ComboBox_AddString(hwndCtl, lpsz)
Definition: windowsx.h:16
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define UNICODE_NULL
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
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:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REGSTR_KEY_SETUP
Definition: regstr.h:105
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:41
#define RegOpenKeyEx
Definition: winreg.h:520
PRTL_UNICODE_STRING_BUFFER Path
#define ComboBox_ResetContent(hwndCtl)
Definition: windowsx.h:38
FxAutoRegKey hKey
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
char * cleanup(char *str)
Definition: wpickclick.c:99
#define REGSTR_PATH_SETUP
Definition: regstr.h:23
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CHSourceDlgProc().

◆ SaveCustomPath()

static VOID SaveCustomPath ( IN HWND  hwndCombo)
static

Definition at line 359 of file wizard.c.

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 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define ComboBox_GetLBText(hwndCtl, index, lpszBuffer)
Definition: windowsx.h:31
#define TRUE
Definition: types.h:120
_In_ ULONG TotalLength
Definition: usbdlib.h:158
#define ComboBox_GetTextLength(hwndCtl)
Definition: windowsx.h:34
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
PVOID pBuffer
Definition: bufpool.h:45
#define CB_ERR
Definition: winuser.h:2425
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:4899
#define ComboBox_GetCount(hwndCtl)
Definition: windowsx.h:23
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REGSTR_KEY_SETUP
Definition: regstr.h:105
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define ComboBox_GetLBTextLen(hwndCtl, index)
Definition: windowsx.h:32
unsigned char BYTE
Definition: xxhash.c:193
#define RegOpenKeyEx
Definition: winreg.h:520
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
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
char * cleanup(char *str)
Definition: wpickclick.c:99
#define REGSTR_PATH_SETUP
Definition: regstr.h:23
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CHSourceDlgProc().

◆ SearchDrvDlgProc()

static INT_PTR CALLBACK SearchDrvDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 739 of file wizard.c.

744 {
745  PDEVINSTDATA DevInstData;
747 
748  /* Retrieve pointer to the global setup data */
749  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
750 
751  switch (uMsg)
752  {
753  case WM_INITDIALOG:
754  {
755  HWND hwndControl;
756  DWORD dwStyle;
757 
758  /* Get pointer to the global setup data */
759  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
760  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
761 
762  DevInstData->hDialog = hwndDlg;
763  hwndControl = GetParent(hwndDlg);
764 
765  /* Center the wizard window */
766  CenterWindow(hwndControl);
767 
769  hwndDlg,
770  IDC_DEVICE,
771  WM_SETTEXT,
772  0,
773  (LPARAM)DevInstData->buffer);
774 
775  /* Hide the system menu */
776  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
777  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
778  break;
779  }
780 
781  case WM_SEARCH_FINISHED:
782  {
784  hThread = 0;
785  if (wParam == 0)
787  else
789  break;
790  }
791 
792  case WM_NOTIFY:
793  {
794  LPNMHDR lpnm = (LPNMHDR)lParam;
795 
796  switch (lpnm->code)
797  {
798  case PSN_SETACTIVE:
800  /* Yes, we can safely ignore the problem (if any) */
802  DevInstData->hDevInfo,
803  &DevInstData->devInfoData,
805  hThread = CreateThread(NULL, 0, FindDriverProc, DevInstData, 0, &dwThreadId);
806  break;
807 
808  case PSN_KILLACTIVE:
809  if (hThread != 0)
810  {
812  return TRUE;
813  }
814  break;
815 
816  case PSN_WIZNEXT:
817  /* Handle a Next button click, if necessary */
818  break;
819 
820  default:
821  break;
822  }
823  break;
824  }
825 
826  default:
827  break;
828  }
829 
830  return FALSE;
831 }
#define IDC_DEVICE
Definition: resource.h:8
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
SP_DEVINFO_DATA devInfoData
#define IDD_INSTALLDRV
Definition: resource.h:24
#define CloseHandle
Definition: compat.h:598
#define TRUE
Definition: types.h:120
#define PSWIZB_NEXT
Definition: prsht.h:154
#define IDD_NODRIVER
Definition: resource.h:25
#define SendDlgItemMessage
Definition: winuser.h:5832
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3149
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define FALSE
Definition: types.h:117
#define GWLP_USERDATA
Definition: treelist.c:63
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
#define PSN_WIZNEXT
Definition: prsht.h:121
LONG_PTR LPARAM
Definition: windef.h:208
#define SPDIT_COMPATDRIVER
Definition: setupapi.h:506
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define WM_SETTEXT
Definition: winuser.h:1607
#define PSWIZB_BACK
Definition: prsht.h:153
unsigned long DWORD
Definition: ntddk_ex.h:95
HDEVINFO hDevInfo
DWORD dwThreadId
Definition: fdebug.c:31
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
uint32_t DWORD_PTR
Definition: typedefs.h:65
#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
HWND WINAPI GetParent(_In_ HWND)
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:28
#define WM_SEARCH_FINISHED
#define GetWindowLongPtr
Definition: treelist.c:73
#define WS_SYSMENU
Definition: pedump.c:629
#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 WM_NOTIFY
Definition: richedit.h:61

Referenced by DisplayWizard().

◆ SetFailedInstall()

static BOOL SetFailedInstall ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DevInfoData  OPTIONAL,
IN BOOLEAN  Set 
)
static

Definition at line 63 of file wizard.c.

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 }
#define TRUE
Definition: types.h:120
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 SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2603
static BOOL Set
Definition: pageheap.c:10
#define SPDRP_CLASSGUID
Definition: setupapi.h:515
#define CM_SET_DEVNODE_PROBLEM_OVERRIDE
Definition: cfgmgr32.h:807
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetupDiSetDeviceRegistryProperty
Definition: setupapi.h:2620
#define SPDRP_CLASS
Definition: setupapi.h:514
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define SPDRP_CONFIGFLAGS
Definition: setupapi.h:517
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define CM_PROB_FAILED_INSTALL
Definition: cfg.h:58
BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize)
Definition: devinst.c:3452
BYTE * PBYTE
Definition: pedump.c:66
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define CONFIGFLAG_FAILEDINSTALL
Definition: regstr.h:396

Referenced by FindDriverProc(), InstallDrvDlgProc(), NoDriverDlgProc(), and WelcomeDlgProc().

◆ StartDevice()

static BOOL StartDevice ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DevInfoData  OPTIONAL,
IN BOOL  bEnable,
IN DWORD HardwareProfile  OPTIONAL,
OUT BOOL *bNeedReboot  OPTIONAL 
)
static

Definition at line 173 of file wizard.c.

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 }
#define DI_NEEDREBOOT
Definition: setupapi.h:54
#define TRUE
Definition: types.h:120
#define SetupDiGetDeviceInstallParams
Definition: setupapi.h:2599
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4024
#define DIF_PROPERTYCHANGE
Definition: setupapi.h:137
#define DICS_ENABLE
Definition: setupapi.h:112
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DICS_DISABLE
Definition: setupapi.h:114
SP_CLASSINSTALL_HEADER ClassInstallHeader
Definition: setupapi.h:916
#define DICS_FLAG_CONFIGSPECIFIC
Definition: setupapi.h:115
unsigned long DWORD
Definition: ntddk_ex.h:95
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1155
#define SetLastError(x)
Definition: compat.h:611
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
_In_ BOOL bEnable
Definition: winddi.h:3426
#define NULL
Definition: types.h:112
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
#define DI_NEEDRESTART
Definition: setupapi.h:53
#define SetupDiSetClassInstallParams
Definition: setupapi.h:2617
DI_FUNCTION InstallFunction
Definition: setupapi.h:904

Referenced by NoDriverDlgProc(), and PciPdoIrpStartDevice().

◆ WelcomeDlgProc()

static INT_PTR CALLBACK WelcomeDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 469 of file wizard.c.

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 }
#define IDC_DEVICE
Definition: resource.h:8
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
SP_DEVINFO_DATA devInfoData
#define IDC_RADIO_AUTO
Definition: resource.h:9
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define PSWIZB_NEXT
Definition: prsht.h:154
#define IDD_SEARCHDRV
Definition: resource.h:23
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5832
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3149
#define FALSE
Definition: types.h:117
#define GWLP_USERDATA
Definition: treelist.c:63
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define PSN_WIZNEXT
Definition: prsht.h:121
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1908
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define WM_SETTEXT
Definition: winuser.h:1607
#define BM_SETCHECK
Definition: winuser.h:1911
unsigned long DWORD
Definition: ntddk_ex.h:95
HDEVINFO hDevInfo
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define IDD_INSTALLFAILED
Definition: resource.h:26
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define IDC_WELCOMETITLE
Definition: resource.h:16
#define GWL_STYLE
Definition: winuser.h:846
HWND WINAPI GetParent(_In_ HWND)
#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
#define BST_CHECKED
Definition: winuser.h:197
#define WM_SETFONT
Definition: winuser.h:1640
BOOL PrepareFoldersToScan(IN PDEVINSTDATA DevInstData, IN BOOL IncludeRemovableDevices, IN BOOL IncludeCustomPath, IN HWND hwndCombo OPTIONAL)
Definition: newdev.c:447
#define GetWindowLongPtr
Definition: treelist.c:73
#define WS_SYSMENU
Definition: pedump.c:629
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
struct _DEVINSTDATA * PDEVINSTDATA
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by DisplayWizard().

Variable Documentation

◆ hThread

HANDLE hThread

Definition at line 28 of file wizard.c.

Referenced by _DoDLLInjection(), _ServiceMain(), AcceptConnections(), addr_to_linear(), check_thread_instance(), CommonInstall(), CreateLobbyMessageReceptionThread(), CreateRemoteThread(), CreateServers(), CreateServiceThread(), CSysTray::CreateSysTrayThread(), CreateTestThread(), CsrAddStaticServerThread(), CsrApiPortInitialize(), CsrCreateProcess(), CsrCreateRemoteThread(), CsrCreateThread(), CsrExecServerThread(), CsrpCheckRequestThreads(), CsrSbCreateSession(), CtfImmSetLangBand(), DbgUiIssueRemoteBreakin(), DialogProc_0(), DialogProc_1(), DoFormatDrive(), EndLocalThread(), ExpCreateWorkerThread(), fetch_thread_info(), FormatDriveDlg(), GetExitCodeThread(), GetThreadContext(), GetThreadIOPendingFlag(), GetThreadPriority(), GetThreadPriorityBoost(), GetThreadSelectorEntry(), GetThreadTimes(), GuiConsoleInputThread(), HandleLogoff(), HandleShutdown(), i386_get_addr(), IDirectSoundCaptureBufferImpl_Start(), init(), COutputPin::InitializeIOThread(), InitiateSoundStreaming(), InitProgressDialog(), InstallDrvDlgProc(), CZipFolder::InvokeCommand(), JustDoIt(), LocalScheduleJob(), MailSlotReader(), main(), mmTaskCreate(), NtOpenThread(), Window::OnCommand(), OpenPropSheet(), PlayLogonSound(), PrintThreads(), ProgressDlg::ProcessWindowMessage(), PspCreateThread(), QueueUserAPC(), CDeviceView::Refresh(), ResumeThread(), RunSetup(), CZipCreator::runThread(), SaveThreadHandle(), SearchDrvDlgProc(), ServiceInit(), ServiceMain(), SetThreadAffinityMask(), SetThreadContext(), SetThreadIdealProcessor(), SetThreadPriority(), SetThreadPriorityBoost(), SetThreadToken(), SHCreateThread(), SlideWindow(), StackWalk(), StackWalk64(), START_TEST(), CProgressDialog::StartProgressDialog(), StartSystemShutdown(), StartTestCORE10188(), SuspendThread(), TerminateThread(), test_attach_input(), test_CreateRemoteThread(), test_DragQueryFile(), test_events(), test_http_connection(), test_ImmThreads(), test_interthread_messages(), test_menu_input(), test_pack_CREATE_PROCESS_DEBUG_INFO(), test_pack_CREATE_THREAD_DEBUG_INFO(), test_pack_PROCESS_INFORMATION(), test_QueryInformationJobObject(), test_runner(), test_send(), Test_SimpleParameters(), test_smresult(), test_thread_handle_close(), TestMessages(), WdmAudSetMixerDeviceFormatByLegacy(), WinMain(), WlxAssignShellProtection(), wmain(), WriterThread::WriterThread(), and wWinMain().