ReactOS  0.4.15-dev-3719-g41b8715
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 563 of file wizard.c.

564 {
568 }
#define IDC_CHECK_MEDIA
Definition: resource.h:14
static void IncludePath(HWND Dlg, BOOL Enabled)
Definition: wizard.c:556
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 117 of file wizard.c.

121 {
122  CONFIGRET cr;
123  ULONG Status, ProblemNumber;
124  BOOL Ret = FALSE;
125 
127  &ProblemNumber,
128  DevInst,
129  0,
130  hMachine);
131  if (cr == CR_SUCCESS)
132  {
133  *CanDisable = ((Status & DN_DISABLEABLE) != 0);
134  Ret = TRUE;
135  }
136 
137  return Ret;
138 }
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:3587
#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 
46  hWnd,
47  HWND_TOP,
48  ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
49  ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
50  0,
51  0,
52  SWP_NOSIZE);
53 }
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 571 of file wizard.c.

576 {
577  PDEVINSTDATA DevInstData;
578 
579  /* Retrieve pointer to the global setup data */
580  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
581 
582  switch (uMsg)
583  {
584  case WM_INITDIALOG:
585  {
586  HWND hwndControl, hwndCombo;
587  DWORD dwStyle;
588  COMBOBOXINFO info = { sizeof(info) };
589 
590  /* Get pointer to the global setup data */
591  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
592  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
593 
594  hwndControl = GetParent(hwndDlg);
595 
596  /* Center the wizard window */
597  CenterWindow(hwndControl);
598 
599  /* Hide the system menu */
600  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
601  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
602 
603  hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_PATH);
604  PopulateCustomPathCombo(hwndCombo);
605 
606  GetComboBoxInfo(hwndCombo, &info);
608 
610  hwndDlg,
612  BM_SETCHECK,
613  (WPARAM)TRUE,
614  (LPARAM)0);
615  AutoDriver(hwndDlg, TRUE);
616  IncludePath(hwndDlg, FALSE);
617 
618  /* Disable manual driver choice for now */
620 
621  break;
622  }
623 
624  case WM_COMMAND:
625  {
626  switch (LOWORD(wParam))
627  {
629  AutoDriver(hwndDlg, TRUE);
630  return TRUE;
631 
632  case IDC_RADIO_CHOOSE:
633  AutoDriver(hwndDlg, FALSE);
634  return TRUE;
635 
636  case IDC_CHECK_PATH:
637  IncludePath(hwndDlg, IsDlgButtonChecked(hwndDlg, IDC_CHECK_PATH));
638  return TRUE;
639 
640  case IDC_BROWSE:
641  {
642  BROWSEINFO bi = { 0 };
643  LPITEMIDLIST pidl;
646 
647  bi.hwndOwner = hwndDlg;
649  bi.lpszTitle = Title;
650  pidl = SHBrowseForFolder(&bi);
651  if (pidl)
652  {
654  IMalloc* malloc;
655 
656  if (SHGetPathFromIDListW(pidl, Directory))
657  {
658  /* Set the IDC_COMBO_PATH text */
660  }
661 
662  /* Free memory, if possible */
664  {
665  IMalloc_Free(malloc, pidl);
666  IMalloc_Release(malloc);
667  }
668  return TRUE;
669  }
670  break;
671  }
672  }
673  break;
674  }
675 
676  case WM_NOTIFY:
677  {
678  LPNMHDR lpnm = (LPNMHDR)lParam;
679 
680  switch (lpnm->code)
681  {
682  case PSN_SETACTIVE:
683  /* Enable the Next and Back buttons */
685  break;
686 
687  case PSN_WIZNEXT:
688  /* Handle a Next button click, if necessary */
690  {
692  HeapFree(GetProcessHeap(), 0, DevInstData->CustomSearchPath);
693  DevInstData->CustomSearchPath = NULL;
695  DevInstData,
698  GetDlgItem(hwndDlg, IDC_COMBO_PATH)))
699  {
701  }
702  else
703  {
705  }
706  }
707  else
708  {
709  /* FIXME */;
710  }
711  return TRUE;
712 
713  default:
714  break;
715  }
716  break;
717  }
718 
719  default:
720  break;
721  }
722 
723  return FALSE;
724 }
#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:275
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
static VOID SaveCustomPath(IN HWND hwndCombo)
Definition: wizard.c:350
#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:556
#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:5822
#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:3139
#define FALSE
Definition: types.h:117
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:1908
#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
struct _test_info info[]
Definition: SetCursorPos.c:19
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define IDC_RADIO_SEARCHHERE
Definition: resource.h:12
#define WM_COMMAND
Definition: winuser.h:1727
#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:563
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:1726
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 1291 of file wizard.c.

1292 {
1293  NONCLIENTMETRICSW ncm;
1294  LOGFONTW LogFont;
1295  HDC hdc;
1296  INT FontSize;
1297  HFONT hFont;
1298 
1299  ncm.cbSize = sizeof(NONCLIENTMETRICSW);
1300  SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
1301 
1302  LogFont = ncm.lfMessageFont;
1303  LogFont.lfWeight = FW_BOLD;
1304  wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
1305 
1306  hdc = GetDC(NULL);
1307  FontSize = 12;
1308  LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72;
1309  hFont = CreateFontIndirectW(&LogFont);
1310  ReleaseDC(NULL, hdc);
1311 
1312  return hFont;
1313 }
HDC WINAPI GetDC(_In_opt_ HWND)
LONG lfHeight
Definition: dimm.idl:59
static HDC
Definition: imagelist.c:92
#define SystemParametersInfo
Definition: winuser.h:5838
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 1316 of file wizard.c.

1320 {
1321  PROPSHEETHEADER psh = {0};
1322  HPROPSHEETPAGE ahpsp[IDD_MAXIMUMPAGE + 1];
1323  PROPSHEETPAGE psp = {0};
1324  HRESULT hr = CoInitialize(NULL); /* for SHAutoComplete */
1325 
1326  /* zero based index */
1327  startPage -= IDD_FIRSTPAGE;
1328 
1329  /* Create the Welcome page */
1330  ZeroMemory(&psp, sizeof(PROPSHEETPAGE));
1331  psp.dwSize = sizeof(PROPSHEETPAGE);
1332  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1333  psp.hInstance = hDllInstance;
1334  psp.lParam = (LPARAM)DevInstData;
1335  psp.pszTitle = MAKEINTRESOURCE(DevInstData->bUpdate ? IDS_UPDATEWIZARDTITLE : IDS_INSTALLWIZARDTITLE);
1336  psp.pfnDlgProc = WelcomeDlgProc;
1337  psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
1339 
1340  /* Create the Select Source page */
1341  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USETITLE;
1342  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_CHSOURCE_TITLE);
1343  psp.pfnDlgProc = CHSourceDlgProc;
1344  psp.pszTemplate = MAKEINTRESOURCE(IDD_CHSOURCE);
1346 
1347  /* Create the Search driver page */
1348  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USETITLE;
1349  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SEARCHDRV_TITLE);
1350  psp.pfnDlgProc = SearchDrvDlgProc;
1351  psp.pszTemplate = MAKEINTRESOURCE(IDD_SEARCHDRV);
1353 
1354  /* Create the Install driver page */
1355  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USETITLE;
1356  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_INSTALLDRV_TITLE);
1357  psp.pfnDlgProc = InstallDrvDlgProc;
1358  psp.pszTemplate = MAKEINTRESOURCE(IDD_INSTALLDRV);
1360 
1361  /* Create the No driver page */
1362  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1363  psp.pfnDlgProc = NoDriverDlgProc;
1364  psp.pszTemplate = MAKEINTRESOURCE(IDD_NODRIVER);
1366 
1367  /* Create the Install failed page */
1368  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1369  psp.pfnDlgProc = InstallFailedDlgProc;
1370  psp.pszTemplate = MAKEINTRESOURCE(IDD_INSTALLFAILED);
1372 
1373  /* Create the Need reboot page */
1374  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1375  psp.pfnDlgProc = NeedRebootDlgProc;
1376  psp.pszTemplate = MAKEINTRESOURCE(IDD_NEEDREBOOT);
1378 
1379  /* Create the Finish page */
1380  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER | PSP_USETITLE;
1381  psp.pfnDlgProc = FinishDlgProc;
1382  psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
1384 
1385  /* Create the property sheet */
1386  psh.dwSize = sizeof(PROPSHEETHEADER);
1387  psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
1388  psh.hInstance = hDllInstance;
1389  psh.hwndParent = hwndParent;
1390  psh.nPages = IDD_MAXIMUMPAGE + 1;
1391  psh.nStartPage = startPage;
1392  psh.phpage = ahpsp;
1393  psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
1394  psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
1395 
1396  /* Create title font */
1397  DevInstData->hTitleFont = CreateTitleFont();
1398 
1399  /* Display the wizard */
1400  PropertySheet(&psh);
1401 
1402  DeleteObject(DevInstData->hTitleFont);
1403 
1404  if (SUCCEEDED(hr))
1405  CoUninitialize();
1406  return TRUE;
1407 }
#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:822
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:1664
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:933
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:727
#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:1054
static HFONT CreateTitleFont(VOID)
Definition: wizard.c:1291
static INT_PTR CALLBACK NeedRebootDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:1133
#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:460
static INT_PTR CALLBACK CHSourceDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:571
#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:1212
#define PROPSHEETPAGE
Definition: prsht.h:389

Referenced by DevInstallW(), and InstallDevInstEx().

◆ FindDriverProc()

static DWORD WINAPI FindDriverProc ( IN LPVOID  lpParam)
static

Definition at line 235 of file wizard.c.

237 {
238  PDEVINSTDATA DevInstData;
239  BOOL result = FALSE;
240 
241  DevInstData = (PDEVINSTDATA)lpParam;
242 
243  result = ScanFoldersForDriver(DevInstData);
244 
245  if (result)
246  {
247  PostMessage(DevInstData->hDialog, WM_SEARCH_FINISHED, 1, 0);
248  }
249  else
250  {
251  /* Update device configuration */
252  SetFailedInstall(DevInstData->hDevInfo,
253  &DevInstData->devInfoData,
254  TRUE);
255 
256  PostMessage(DevInstData->hDialog, WM_SEARCH_FINISHED, 0, 0);
257  }
258  return 0;
259 }
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:5812
HDEVINFO hDevInfo
static BOOL SetFailedInstall(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOLEAN Set)
Definition: wizard.c:56
#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 1212 of file wizard.c.

1217 {
1218  PDEVINSTDATA DevInstData;
1220 
1221  /* Retrieve pointer to the global setup data */
1222  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1223 
1224  switch (uMsg)
1225  {
1226  case WM_INITDIALOG:
1227  {
1228  HWND hwndControl;
1229 
1230  /* Get pointer to the global setup data */
1231  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1232  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1233 
1234  /* Center the wizard window */
1235  CenterWindow(GetParent(hwndDlg));
1236 
1237  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1238  ShowWindow(hwndControl, SW_HIDE);
1239  EnableWindow(hwndControl, FALSE);
1240 
1242  hwndDlg,
1243  IDC_DEVICE,
1244  WM_SETTEXT,
1245  0,
1246  (LPARAM)DevInstData->drvInfoData.Description);
1247 
1248  /* Set title font */
1250  hwndDlg,
1252  WM_SETFONT,
1253  (WPARAM)DevInstData->hTitleFont,
1254  (LPARAM)TRUE);
1255  break;
1256  }
1257 
1258  case WM_NOTIFY:
1259  {
1260  LPNMHDR lpnm = (LPNMHDR)lParam;
1261 
1262  switch (lpnm->code)
1263  {
1264  case PSN_SETACTIVE:
1265  /* Enable the correct buttons on for the active page */
1267  break;
1268 
1269  case PSN_WIZBACK:
1270  /* Handle a Back button click, if necessary */
1271  break;
1272 
1273  case PSN_WIZFINISH:
1274  /* Handle a Finish button click, if necessary */
1275  break;
1276 
1277  default:
1278  break;
1279  }
1280  break;
1281  }
1282 
1283  default:
1284  break;
1285  }
1286 
1287  return FALSE;
1288 }
#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:5822
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:3139
#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:1604
#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:1637
#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:1726
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 556 of file wizard.c.

557 {
560 }
#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 262 of file wizard.c.

264 {
265  PDEVINSTDATA DevInstData;
266  BOOL res;
267 
268  DevInstData = (PDEVINSTDATA)lpParam;
269  res = InstallCurrentDriver(DevInstData);
270  PostMessage(DevInstData->hDialog, WM_INSTALL_FINISHED, res ? 0 : 1, 0);
271  return 0;
272 }
#define WM_INSTALL_FINISHED
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PostMessage
Definition: winuser.h:5812
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 822 of file wizard.c.

827 {
828  PDEVINSTDATA DevInstData;
830 
831  /* Retrieve pointer to the global setup data */
832  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
833 
834  switch (uMsg)
835  {
836  case WM_INITDIALOG:
837  {
838  HWND hwndControl;
839  DWORD dwStyle;
840 
841  /* Get pointer to the global setup data */
842  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
843  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
844 
845  DevInstData->hDialog = hwndDlg;
846  hwndControl = GetParent(hwndDlg);
847 
848  /* Center the wizard window */
849  CenterWindow(hwndControl);
850 
852  hwndDlg,
853  IDC_DEVICE,
854  WM_SETTEXT,
855  0,
856  (LPARAM)DevInstData->drvInfoData.Description);
857 
858  /* Hide the system menu */
859  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
860  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
861  break;
862  }
863 
864  case WM_INSTALL_FINISHED:
865  {
867  hThread = 0;
868  if (wParam == 0)
869  {
870  SP_DEVINSTALL_PARAMS installParams;
871 
872  SetFailedInstall(DevInstData->hDevInfo,
873  &DevInstData->devInfoData,
874  FALSE);
875 
876  /* Should we reboot? */
877  installParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
879  DevInstData->hDevInfo,
880  &DevInstData->devInfoData,
881  &installParams))
882  {
883  if (installParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT))
884  {
886  }
887  else
889  break;
890  }
891  }
893  break;
894  }
895 
896  case WM_NOTIFY:
897  {
898  LPNMHDR lpnm = (LPNMHDR)lParam;
899 
900  switch (lpnm->code)
901  {
902  case PSN_SETACTIVE:
904  hThread = CreateThread(NULL, 0, InstallDriverProc, DevInstData, 0, &dwThreadId);
905  break;
906 
907  case PSN_KILLACTIVE:
908  if (hThread != 0)
909  {
911  return TRUE;
912  }
913  break;
914 
915  case PSN_WIZNEXT:
916  /* Handle a Next button click, if necessary */
917  break;
918 
919  default:
920  break;
921  }
922  break;
923  }
924 
925  default:
926  break;
927  }
928 
929  return FALSE;
930 }
#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:5822
#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:3139
#define WM_INSTALL_FINISHED
static DWORD WINAPI InstallDriverProc(IN LPVOID lpParam)
Definition: wizard.c:262
#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:136
#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:1604
#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:56
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:1726
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 1054 of file wizard.c.

1059 {
1060  PDEVINSTDATA DevInstData;
1062 
1063  /* Retrieve pointer to the global setup data */
1064  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1065 
1066  switch (uMsg)
1067  {
1068  case WM_INITDIALOG:
1069  {
1070  HWND hwndControl;
1071 
1072  /* Get pointer to the global setup data */
1073  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1074  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1075 
1076  /* Center the wizard window */
1077  CenterWindow(GetParent(hwndDlg));
1078 
1079  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1080  ShowWindow(hwndControl, SW_HIDE);
1081  EnableWindow(hwndControl, FALSE);
1082 
1084  hwndDlg,
1085  IDC_DEVICE,
1086  WM_SETTEXT,
1087  0,
1088  (LPARAM)DevInstData->drvInfoData.Description);
1089 
1090  /* Set title font */
1092  hwndDlg,
1094  WM_SETFONT,
1095  (WPARAM)DevInstData->hTitleFont,
1096  (LPARAM)TRUE);
1097  break;
1098  }
1099 
1100  case WM_NOTIFY:
1101  {
1102  LPNMHDR lpnm = (LPNMHDR)lParam;
1103 
1104  switch (lpnm->code)
1105  {
1106  case PSN_SETACTIVE:
1107  /* Enable the correct buttons on for the active page */
1109  break;
1110 
1111  case PSN_WIZBACK:
1112  /* Handle a Back button click, if necessary */
1113  break;
1114 
1115  case PSN_WIZFINISH:
1116  /* Handle a Finish button click, if necessary */
1117  break;
1118 
1119  default:
1120  break;
1121  }
1122  break;
1123  }
1124 
1125  default:
1126  break;
1127  }
1128 
1129  return FALSE;
1130 }
#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:5822
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:3139
#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:1604
#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:1637
#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:1726
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 141 of file wizard.c.

145 {
146  CONFIGRET cr;
147  ULONG Status, ProblemNumber;
148  BOOL Ret = FALSE;
149 
151  &Status,
152  &ProblemNumber,
153  DevInst,
154  0,
155  hMachine);
156  if (cr == CR_SUCCESS)
157  {
158  *IsEnabled = ((Status & DN_STARTED) != 0);
159  Ret = TRUE;
160  }
161 
162  return Ret;
163 }
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:3587
#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 1133 of file wizard.c.

1138 {
1139  PDEVINSTDATA DevInstData;
1141 
1142  /* Retrieve pointer to the global setup data */
1143  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1144 
1145  switch (uMsg)
1146  {
1147  case WM_INITDIALOG:
1148  {
1149  HWND hwndControl;
1150 
1151  /* Get pointer to the global setup data */
1152  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1153  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
1154 
1155  /* Center the wizard window */
1156  CenterWindow(GetParent(hwndDlg));
1157 
1158  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
1159  ShowWindow(hwndControl, SW_HIDE);
1160  EnableWindow(hwndControl, FALSE);
1161 
1163  hwndDlg,
1164  IDC_DEVICE,
1165  WM_SETTEXT,
1166  0,
1167  (LPARAM)DevInstData->drvInfoData.Description);
1168 
1169  /* Set title font */
1171  hwndDlg,
1173  WM_SETFONT,
1174  (WPARAM)DevInstData->hTitleFont,
1175  (LPARAM)TRUE);
1176  break;
1177  }
1178 
1179  case WM_NOTIFY:
1180  {
1181  LPNMHDR lpnm = (LPNMHDR)lParam;
1182 
1183  switch (lpnm->code)
1184  {
1185  case PSN_SETACTIVE:
1186  /* Enable the correct buttons on for the active page */
1188  break;
1189 
1190  case PSN_WIZBACK:
1191  /* Handle a Back button click, if necessary */
1192  break;
1193 
1194  case PSN_WIZFINISH:
1195  /* Handle a Finish button click, if necessary */
1196  break;
1197 
1198  default:
1199  break;
1200  }
1201  break;
1202  }
1203 
1204  default:
1205  break;
1206  }
1207 
1208  return FALSE;
1209 }
#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:5822
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:3139
#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:1604
#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:1637
#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:1726
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 933 of file wizard.c.

938 {
939  PDEVINSTDATA DevInstData;
940  HWND hwndControl;
941 
943 
944  /* Get pointer to the global setup data */
945  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
946 
947  switch (uMsg)
948  {
949  case WM_INITDIALOG:
950  {
951  BOOL DisableableDevice = FALSE;
952 
953  /* Get pointer to the global setup data */
954  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
955  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
956 
957  /* Center the wizard window */
958  CenterWindow(GetParent(hwndDlg));
959 
960  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
961  ShowWindow(hwndControl, SW_HIDE);
962  EnableWindow(hwndControl, FALSE);
963 
964  /* Set title font */
966  hwndDlg,
968  WM_SETFONT,
969  (WPARAM)DevInstData->hTitleFont,
970  (LPARAM)TRUE);
971 
972  /* disable the "do not show this dialog anymore" checkbox
973  if the device cannot be disabled */
975  DevInstData->devInfoData.DevInst,
976  NULL,
977  &DisableableDevice);
978  EnableWindow(
979  GetDlgItem(hwndDlg, IDC_DONOTSHOWDLG),
980  DisableableDevice);
981  break;
982  }
983 
984  case WM_NOTIFY:
985  {
986  LPNMHDR lpnm = (LPNMHDR)lParam;
987 
988  switch (lpnm->code)
989  {
990  case PSN_SETACTIVE:
991  /* Enable the correct buttons on for the active page */
993  break;
994 
995  case PSN_WIZBACK:
996  /* Handle a Back button click, if necessary */
997  hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
998  ShowWindow(hwndControl, SW_SHOW);
999  EnableWindow(hwndControl, TRUE);
1001  return TRUE;
1002 
1003  case PSN_WIZFINISH:
1004  {
1005  BOOL DisableableDevice = FALSE;
1006  BOOL IsStarted = FALSE;
1007 
1008  if (CanDisableDevice(DevInstData->devInfoData.DevInst,
1009  NULL,
1010  &DisableableDevice) &&
1011  DisableableDevice &&
1013  DevInstData->devInfoData.DevInst,
1014  NULL,
1015  &IsStarted) &&
1016  !IsStarted &&
1018  hwndDlg,
1020  BM_GETCHECK,
1021  (WPARAM)0, (LPARAM)0) == BST_CHECKED)
1022  {
1023  /* disable the device */
1024  StartDevice(
1025  DevInstData->hDevInfo,
1026  &DevInstData->devInfoData,
1027  FALSE,
1028  0,
1029  NULL);
1030  }
1031  else
1032  {
1033  SetFailedInstall(DevInstData->hDevInfo,
1034  &DevInstData->devInfoData,
1035  FALSE);
1036  }
1037  break;
1038  }
1039 
1040  default:
1041  break;
1042  }
1043  break;
1044  }
1045 
1046  default:
1047  break;
1048  }
1049 
1050  return FALSE;
1051 }
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:5822
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:141
UINT code
Definition: winuser.h:3139
#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:1905
#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:166
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:56
#define BST_CHECKED
Definition: winuser.h:197
#define WM_SETFONT
Definition: winuser.h:1637
#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:117
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1726
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 275 of file wizard.c.

277 {
278  HKEY hKey = NULL;
279  DWORD dwRegType;
280  DWORD dwPathLength = 0;
281  LPWSTR Buffer = NULL;
282  LPCWSTR Path;
283  LONG rc;
284 
285  (void)ComboBox_ResetContent(hwndCombo);
286 
287  /* RegGetValue would have been better... */
288  rc = RegOpenKeyEx(
291  0,
293  &hKey);
294  if (rc != ERROR_SUCCESS)
295  {
296  TRACE("RegOpenKeyEx() failed with error 0x%lx\n", rc);
297  goto cleanup;
298  }
299  rc = RegQueryValueExW(
300  hKey,
301  L"Installation Sources",
302  NULL,
303  &dwRegType,
304  NULL,
305  &dwPathLength);
306  if (rc != ERROR_SUCCESS || dwRegType != REG_MULTI_SZ)
307  {
308  TRACE("RegQueryValueEx() failed with error 0x%lx\n", rc);
309  goto cleanup;
310  }
311 
312  /* Allocate enough space to add 2 NULL chars at the end of the string */
313  Buffer = HeapAlloc(GetProcessHeap(), 0, dwPathLength + 2 * sizeof(WCHAR));
314  if (!Buffer)
315  {
316  TRACE("HeapAlloc() failed\n");
317  goto cleanup;
318  }
319  rc = RegQueryValueExW(
320  hKey,
321  L"Installation Sources",
322  NULL,
323  NULL,
324  (LPBYTE)Buffer,
325  &dwPathLength);
326  if (rc != ERROR_SUCCESS)
327  {
328  TRACE("RegQueryValueEx() failed with error 0x%lx\n", rc);
329  goto cleanup;
330  }
331 
332  Buffer[dwPathLength / sizeof(WCHAR)] = UNICODE_NULL;
333  Buffer[dwPathLength / sizeof(WCHAR) + 1] = UNICODE_NULL;
334 
335  /* Populate combo box */
336  for (Path = Buffer; *Path; Path += wcslen(Path) + 1)
337  {
338  (void)ComboBox_AddString(hwndCombo, Path);
339  if (Path == Buffer)
340  (void)ComboBox_SetCurSel(hwndCombo, 0);
341  }
342 
343 cleanup:
344  if (hKey != NULL)
345  RegCloseKey(hKey);
347 }
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:40
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CHSourceDlgProc().

◆ SaveCustomPath()

static VOID SaveCustomPath ( IN HWND  hwndCombo)
static

Definition at line 350 of file wizard.c.

352 {
353  LPWSTR CustomPath = NULL;
354  DWORD CustomPathLength;
355  LPWSTR Buffer = NULL;
356  LPWSTR pBuffer; /* Pointer into Buffer */
357  int ItemsCount, Length;
358  int i;
359  DWORD TotalLength = 0;
360  BOOL UseCustomPath = TRUE;
361  HKEY hKey = NULL;
362  LONG rc;
363 
364  /* Get custom path */
365  Length = ComboBox_GetTextLength(hwndCombo) + 1;
366  CustomPath = HeapAlloc(GetProcessHeap(), 0, Length * sizeof(WCHAR));
367  if (!CustomPath)
368  {
369  TRACE("HeapAlloc() failed\n");
370  goto cleanup;
371  }
372  CustomPathLength = GetWindowTextW(hwndCombo, CustomPath, Length) + 1;
373 
374  /* Calculate length of the buffer */
375  ItemsCount = ComboBox_GetCount(hwndCombo);
376  if (ItemsCount == CB_ERR)
377  {
378  TRACE("ComboBox_GetCount() failed\n");
379  goto cleanup;
380  }
381  for (i = 0; i < ItemsCount; i++)
382  {
383  Length = ComboBox_GetLBTextLen(hwndCombo, i);
384  if (Length == CB_ERR)
385  {
386  TRACE("ComboBox_GetLBTextLen() failed\n");
387  goto cleanup;
388  }
389  TotalLength += Length + 1;
390  }
391  TotalLength++; /* Final NULL char */
392 
393  /* Allocate buffer */
394  Buffer = HeapAlloc(GetProcessHeap(), 0, (CustomPathLength + TotalLength + 1) * sizeof(WCHAR));
395  if (!Buffer)
396  {
397  TRACE("HeapAlloc() failed\n");
398  goto cleanup;
399  }
400 
401  /* Fill the buffer */
402  pBuffer = &Buffer[CustomPathLength];
403  for (i = 0; i < ItemsCount; i++)
404  {
405  Length = ComboBox_GetLBText(hwndCombo, i, pBuffer);
406  if (Length == CB_ERR)
407  {
408  TRACE("ComboBox_GetLBText() failed\n");
409  goto cleanup;
410  }
411  else if (UseCustomPath && _wcsicmp(CustomPath, pBuffer) == 0)
412  UseCustomPath = FALSE;
413  pBuffer += 1 + Length;
414  }
415  *pBuffer = '\0'; /* Add final NULL char */
416 
417  if (!UseCustomPath)
418  {
419  /* Nothing to save to registry */
420  goto cleanup;
421  }
422 
423  TotalLength += CustomPathLength;
424  wcscpy(Buffer, CustomPath);
425 
426  /* Save the buffer */
427  /* RegSetKeyValue would have been better... */
428  rc = RegOpenKeyEx(
431  0,
433  &hKey);
434  if (rc != ERROR_SUCCESS)
435  {
436  TRACE("RegOpenKeyEx() failed with error 0x%lx\n", rc);
437  goto cleanup;
438  }
439  rc = RegSetValueExW(
440  hKey,
441  L"Installation Sources",
442  0,
443  REG_MULTI_SZ,
444  (const BYTE*)Buffer,
445  TotalLength * sizeof(WCHAR));
446  if (rc != ERROR_SUCCESS)
447  {
448  TRACE("RegSetValueEx() failed with error 0x%lx\n", rc);
449  goto cleanup;
450  }
451 
452 cleanup:
453  if (hKey != NULL)
454  RegCloseKey(hKey);
455  HeapFree(GetProcessHeap(), 0, CustomPath);
457 }
_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:2415
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:40
_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 727 of file wizard.c.

732 {
733  PDEVINSTDATA DevInstData;
735 
736  /* Retrieve pointer to the global setup data */
737  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
738 
739  switch (uMsg)
740  {
741  case WM_INITDIALOG:
742  {
743  HWND hwndControl;
744  DWORD dwStyle;
745 
746  /* Get pointer to the global setup data */
747  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
748  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
749 
750  DevInstData->hDialog = hwndDlg;
751  hwndControl = GetParent(hwndDlg);
752 
753  /* Center the wizard window */
754  CenterWindow(hwndControl);
755 
757  hwndDlg,
758  IDC_DEVICE,
759  WM_SETTEXT,
760  0,
761  (LPARAM)DevInstData->buffer);
762 
763  /* Hide the system menu */
764  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
765  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
766  break;
767  }
768 
769  case WM_SEARCH_FINISHED:
770  {
772  hThread = 0;
773  if (wParam == 0)
775  else
777  break;
778  }
779 
780  case WM_NOTIFY:
781  {
782  LPNMHDR lpnm = (LPNMHDR)lParam;
783 
784  switch (lpnm->code)
785  {
786  case PSN_SETACTIVE:
788  /* Yes, we can safely ignore the problem (if any) */
790  DevInstData->hDevInfo,
791  &DevInstData->devInfoData,
793  hThread = CreateThread(NULL, 0, FindDriverProc, DevInstData, 0, &dwThreadId);
794  break;
795 
796  case PSN_KILLACTIVE:
797  if (hThread != 0)
798  {
800  return TRUE;
801  }
802  break;
803 
804  case PSN_WIZNEXT:
805  /* Handle a Next button click, if necessary */
806  break;
807 
808  default:
809  break;
810  }
811  break;
812  }
813 
814  default:
815  break;
816  }
817 
818  return FALSE;
819 }
#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:5822
#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:3139
#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:136
#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:1604
#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:1726
LPARAM lParam
Definition: combotst.c:139
static DWORD WINAPI FindDriverProc(IN LPVOID lpParam)
Definition: wizard.c:235
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 56 of file wizard.c.

60 {
61  DWORD dwType, dwSize, dwFlags = 0;
62 
63  dwSize = sizeof(dwFlags);
65  DevInfoData,
67  &dwType,
68  (PBYTE)&dwFlags,
69  dwSize,
70  &dwSize))
71  {
72  return FALSE;
73  }
74 
75  if (Set)
77  else
79 
81  DevInfoData,
83  (PBYTE)&dwFlags,
84  dwSize))
85  {
86 
87  return FALSE;
88  }
89 
90  if (Set)
91  {
92  /* Set the 'Unknown' device class */
93  PWSTR pszUnknown = L"Unknown";
95  DevInfoData,
97  (PBYTE)pszUnknown,
98  (wcslen(pszUnknown) + 1) * sizeof(WCHAR));
99 
100  PWSTR pszUnknownGuid = L"{4D36E97E-E325-11CE-BFC1-08002BE10318}";
102  DevInfoData,
104  (PBYTE)pszUnknownGuid,
105  (wcslen(pszUnknownGuid) + 1) * sizeof(WCHAR));
106 
107  /* Set device problem code CM_PROB_FAILED_INSTALL */
108  CM_Set_DevNode_Problem(DevInfoData->DevInst,
111  }
112 
113  return TRUE;
114 }
#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:7745
#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:3448
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 166 of file wizard.c.

172 {
175  DWORD LastErr;
176  BOOL Ret = FALSE;
177 
180  pcp.HwProfile = HardwareProfile;
181 
182  if (bEnable)
183  {
184  /* try to enable the device on the global profile */
185  pcp.StateChange = DICS_ENABLE;
186  pcp.Scope = DICS_FLAG_GLOBAL;
187 
188  /* ignore errors */
189  LastErr = GetLastError();
192  DevInfoData,
193  &pcp.ClassInstallHeader,
194  sizeof(SP_PROPCHANGE_PARAMS)))
195  {
199  DevInfoData);
200  }
201  SetLastError(LastErr);
202  }
203 
204  /* try config-specific */
207 
210  DevInfoData,
211  &pcp.ClassInstallHeader,
212  sizeof(SP_PROPCHANGE_PARAMS)) &&
215  DevInfoData))
216  {
217  dp.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
220  DevInfoData,
221  &dp))
222  {
223  if (bNeedReboot != NULL)
224  {
225  *bNeedReboot = ((dp.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT)) != 0);
226  }
227 
228  Ret = TRUE;
229  }
230  }
231  return Ret;
232 }
#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:4020
#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 460 of file wizard.c.

465 {
466  PDEVINSTDATA DevInstData;
468 
469  /* Retrieve pointer to the global setup data */
470  DevInstData = (PDEVINSTDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
471 
472  switch (uMsg)
473  {
474  case WM_INITDIALOG:
475  {
476  HWND hwndControl;
477  DWORD dwStyle;
478 
479  /* Get pointer to the global setup data */
480  DevInstData = (PDEVINSTDATA)((LPPROPSHEETPAGE)lParam)->lParam;
481  SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)DevInstData);
482 
483  hwndControl = GetParent(hwndDlg);
484 
485  /* Center the wizard window */
486  CenterWindow(hwndControl);
487 
488  /* Hide the system menu */
489  dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
490  SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
491 
492  /* Set title font */
494  hwndDlg,
496  WM_SETFONT,
497  (WPARAM)DevInstData->hTitleFont,
498  (LPARAM)TRUE);
499 
501  hwndDlg,
502  IDC_DEVICE,
503  WM_SETTEXT,
504  0,
505  (LPARAM)DevInstData->buffer);
506 
508  hwndDlg,
510  BM_SETCHECK,
511  (WPARAM)TRUE,
512  (LPARAM)0);
513 
514  SetFailedInstall(DevInstData->hDevInfo,
515  &DevInstData->devInfoData,
516  TRUE);
517  break;
518  }
519 
520  case WM_NOTIFY:
521  {
522  LPNMHDR lpnm = (LPNMHDR)lParam;
523 
524  switch (lpnm->code)
525  {
526  case PSN_SETACTIVE:
527  /* Enable the Next button */
529  break;
530 
531  case PSN_WIZNEXT:
532  /* Handle a Next button click, if necessary */
534  {
535  if (PrepareFoldersToScan(DevInstData, TRUE, FALSE, NULL))
537  else
539  }
540  return TRUE;
541 
542  default:
543  break;
544  }
545  break;
546  }
547 
548  default:
549  break;
550  }
551 
552  return FALSE;
553 }
#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:5822
#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:3139
#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:1905
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define WM_SETTEXT
Definition: winuser.h:1604
#define BM_SETCHECK
Definition: winuser.h:1908
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:56
#define BST_CHECKED
Definition: winuser.h:197
#define WM_SETFONT
Definition: winuser.h:1637
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:1726
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(), 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(), Imm32UnknownProcess1(), init(), CDesktopThread::Initialize(), 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().