ReactOS 0.4.15-dev-7928-g68a8619
hdwwiz.c File Reference
#include "resource.h"
#include "hdwwiz.h"
Include dependency graph for hdwwiz.c:

Go to the source code of this file.

Typedefs

typedef BOOL(WINAPIPINSTALL_NEW_DEVICE) (HWND, LPGUID, PDWORD)
 

Functions

static HFONT CreateTitleFont (VOID)
 
static INT_PTR CALLBACK StartPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK SearchPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK IsConnectedPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK FinishPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK NotConnectedPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID TrimGuidString (LPWSTR szString, LPWSTR szNewString)
 
static VOID InitProbeListPage (HWND hwndDlg)
 
static INT_PTR CALLBACK ProbeListPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK SelectWayPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK DevStatusPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT EnumDeviceClasses (INT ClassIndex, LPWSTR DevClassName, LPWSTR DevClassDesc, BOOL *DevPresent, INT *ClassImage)
 
static VOID InitHardWareTypesPage (HWND hwndDlg)
 
static INT_PTR CALLBACK HdTypesPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK ProgressPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
static VOID HardwareWizardInit (HWND hwnd)
 
BOOL WINAPI InstallNewDevice (HWND hwndParent, LPGUID ClassGuid, PDWORD pReboot)
 
VOID WINAPI AddHardwareWizard (HWND hwnd, LPWSTR lpName)
 
LONG CALLBACK CPlApplet (HWND hwndCpl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
 

Variables

HINSTANCE hApplet = NULL
 
HFONT hTitleFont
 
SP_CLASSIMAGELIST_DATA ImageListData
 
PWSTR pDeviceStatusText
 
HANDLE hProcessHeap
 
HDEVINFO hDevInfoTypes
 

Typedef Documentation

◆ PINSTALL_NEW_DEVICE

typedef BOOL(WINAPI * PINSTALL_NEW_DEVICE) (HWND, LPGUID, PDWORD)

Definition at line 39 of file hdwwiz.c.

Function Documentation

◆ AddHardwareWizard()

VOID WINAPI AddHardwareWizard ( HWND  hwnd,
LPWSTR  lpName 
)

Definition at line 934 of file hdwwiz.c.

935{
936 if (lpName != NULL)
937 {
938 DPRINT1("No support of remote installation yet!\n");
939 return;
940 }
941
943}
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
static VOID HardwareWizardInit(HWND hwnd)
Definition: hdwwiz.c:794
_In_ LPCSTR lpName
Definition: winbase.h:2789
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by CPlApplet().

◆ CPlApplet()

LONG CALLBACK CPlApplet ( HWND  hwndCpl,
UINT  uMsg,
LPARAM  lParam1,
LPARAM  lParam2 
)

Definition at line 947 of file hdwwiz.c.

948{
949 switch (uMsg)
950 {
951 case CPL_INIT:
952 return TRUE;
953
954 case CPL_GETCOUNT:
955 return 1;
956
957 case CPL_INQUIRE:
958 {
959 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
960 CPlInfo->lData = 0;
961 CPlInfo->idIcon = IDI_CPLICON;
962 CPlInfo->idName = IDS_CPLNAME;
963 CPlInfo->idInfo = IDS_CPLDESCRIPTION;
964 }
965 break;
966
967 case CPL_DBLCLK:
968 AddHardwareWizard(hwndCpl, NULL);
969 break;
970 }
971
972 return FALSE;
973}
#define CPL_INQUIRE
Definition: cpl.h:14
#define CPL_DBLCLK
Definition: cpl.h:16
#define CPL_INIT
Definition: cpl.h:12
#define CPL_GETCOUNT
Definition: cpl.h:13
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_CPLNAME
Definition: resource.h:8
#define IDS_CPLDESCRIPTION
Definition: resource.h:9
#define IDI_CPLICON
Definition: resource.h:4
VOID WINAPI AddHardwareWizard(HWND hwnd, LPWSTR lpName)
Definition: hdwwiz.c:934
Definition: cpl.h:24
LONG_PTR lData
Definition: cpl.h:28
int idName
Definition: cpl.h:26
int idInfo
Definition: cpl.h:27
int idIcon
Definition: cpl.h:25

◆ CreateTitleFont()

static HFONT CreateTitleFont ( VOID  )
static

Definition at line 45 of file hdwwiz.c.

46{
47 NONCLIENTMETRICS ncm;
48 LOGFONT LogFont;
49 HDC hdc;
50 INT FontSize;
52
53 ncm.cbSize = sizeof(NONCLIENTMETRICS);
54 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
55
56 LogFont = ncm.lfMessageFont;
57 LogFont.lfWeight = FW_BOLD;
58 wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
59
60 hdc = GetDC(NULL);
61 FontSize = 12;
62 LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72;
63 hFont = CreateFontIndirect(&LogFont);
65
66 return hFont;
67}
HFONT hFont
Definition: main.c:53
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
LONG lfHeight
Definition: dimm.idl:42
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
int32_t INT
Definition: typedefs.h:58
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_BOLD
Definition: wingdi.h:378
#define LOGPIXELSY
Definition: wingdi.h:719
#define CreateFontIndirect
Definition: wingdi.h:4444
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
#define SystemParametersInfo
Definition: winuser.h:5858

Referenced by HardwareWizardInit().

◆ DevStatusPageDlgProc()

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

Definition at line 514 of file hdwwiz.c.

515{
516 switch (uMsg)
517 {
518 case WM_INITDIALOG:
519 {
520 /* Set title font */
522 }
523 break;
524
525 case WM_NOTIFY:
526 {
527 LPNMHDR lpnm = (LPNMHDR)lParam;
528
529 switch (lpnm->code)
530 {
531 case PSN_SETACTIVE:
532 {
533 /* Set status text */
535
537 }
538 break;
539
540 case PSN_WIZBACK:
541 {
543 return TRUE;
544 }
545 }
546 }
547 break;
548 }
549
550 return FALSE;
551}
#define IDC_FINISHTITLE
Definition: resource.h:60
LPARAM lParam
Definition: combotst.c:139
#define IDC_HWSTATUSEDIT
Definition: resource.h:52
#define IDD_PROBELISTPAGE
Definition: resource.h:29
PWSTR pDeviceStatusText
Definition: hdwwiz.c:35
HFONT hTitleFont
Definition: hdwwiz.c:33
#define PSWIZB_FINISH
Definition: prsht.h:155
#define PSWIZB_BACK
Definition: prsht.h:153
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define PSN_WIZBACK
Definition: prsht.h:120
#define PSN_SETACTIVE
Definition: prsht.h:115
#define WM_NOTIFY
Definition: richedit.h:61
UINT code
Definition: winuser.h:3159
#define SetWindowLongPtr
Definition: treelist.c:70
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_SETFONT
Definition: winuser.h:1650
struct tagNMHDR * LPNMHDR
HWND WINAPI GetParent(_In_ HWND)
#define DWLP_MSGRESULT
Definition: winuser.h:870
#define SetWindowText
Definition: winuser.h:5857
#define SendDlgItemMessage
Definition: winuser.h:5842

Referenced by HardwareWizardInit().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  dwReason,
LPVOID  lpvReserved 
)

Definition at line 976 of file hdwwiz.c.

977{
979
980 switch (dwReason)
981 {
983 hApplet = hinstDLL;
986 break;
987 }
988
989 return TRUE;
990}
DWORD dwReason
Definition: misc.cpp:154
#define GetProcessHeap()
Definition: compat.h:736
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
HANDLE hProcessHeap
Definition: hdwwiz.c:36
HINSTANCE hApplet
Definition: hdwwiz.c:32
static IN DWORD IN LPVOID lpvReserved
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

◆ EnumDeviceClasses()

static INT EnumDeviceClasses ( INT  ClassIndex,
LPWSTR  DevClassName,
LPWSTR  DevClassDesc,
BOOL DevPresent,
INT ClassImage 
)
static

Definition at line 554 of file hdwwiz.c.

559{
560 GUID ClassGuid;
561 HKEY KeyClass;
562 WCHAR ClassName[MAX_STR_SIZE];
564 UINT Ret;
565
566 *DevPresent = FALSE;
567 *DevClassName = L'\0';
568
569 Ret = CM_Enumerate_Classes(ClassIndex,
570 &ClassGuid,
571 0);
572 if (Ret != CR_SUCCESS)
573 {
574 /* All classes enumerated */
575 if(Ret == CR_NO_SUCH_VALUE)
576 {
578 return -1;
579 }
580
581 if (Ret == CR_INVALID_DATA)
582 {
583 ; /* FIXME: What should we do here? */
584 }
585
586 /* Handle other errors... */
587 }
588
589 if (SetupDiClassNameFromGuid(&ClassGuid,
590 ClassName,
592 &RequiredSize))
593 {
594 lstrcpy(DevClassName, ClassName);
595 }
596
598 &ClassGuid,
599 ClassImage))
600 {
601 /* FIXME: Can we do this?
602 * Set the blank icon: IDI_SETUPAPI_BLANK = 41
603 * It'll be image 24 in the imagelist */
604 *ClassImage = 24;
605 }
606
607 /* Get device info for all devices of a particular class */
609 NULL,
610 NULL,
613 {
615 return 0;
616 }
617
618 KeyClass = SetupDiOpenClassRegKeyEx(&ClassGuid,
621 NULL,
622 0);
623 if (KeyClass != INVALID_HANDLE_VALUE)
624 {
625
627
628 if (RegQueryValue(KeyClass,
629 NULL,
630 DevClassDesc,
632 {
633 *DevClassDesc = L'\0';
634 }
635 }
636 else
637 {
638 return -3;
639 }
640
641 *DevPresent = TRUE;
642
643 RegCloseKey(KeyClass);
644
645 return 0;
646}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define CR_INVALID_DATA
Definition: cfgmgr32.h:877
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define CR_NO_SUCH_VALUE
Definition: cfgmgr32.h:883
CONFIGRET WINAPI CM_Enumerate_Classes(_In_ ULONG ulClassIndex, _Out_ LPGUID ClassGuid, _In_ ULONG ulFlags)
Definition: cfgmgr.c:1992
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
BOOL WINAPI SetupDiGetClassImageIndex(IN PSP_CLASSIMAGELIST_DATA ClassImageListData, IN CONST GUID *ClassGuid, OUT PINT ImageIndex)
Definition: devclass.c:277
unsigned long DWORD
Definition: ntddk_ex.h:95
SP_CLASSIMAGELIST_DATA ImageListData
Definition: hdwwiz.c:34
HDEVINFO hDevInfoTypes
Definition: hdwwiz.c:37
#define MAX_STR_SIZE
Definition: hdwwiz.h:21
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
unsigned int UINT
Definition: ndis.h:50
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
long LONG
Definition: pedump.c:60
#define SetupDiClassNameFromGuid
Definition: setupapi.h:2577
#define SetupDiGetClassDevs
Definition: setupapi.h:2593
#define DIGCF_PRESENT
Definition: setupapi.h:171
#define SetupDiOpenClassRegKeyEx
Definition: setupapi.h:2613
#define DIOCR_INSTALLER
Definition: setupapi.h:176
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4439
#define lstrcpy
Definition: winbase.h:3874
#define RegQueryValue
Definition: winreg.h:523
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by InitHardWareTypesPage().

◆ FinishPageDlgProc()

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

Definition at line 190 of file hdwwiz.c.

191{
192 switch (uMsg)
193 {
194 case WM_INITDIALOG:
195 {
196 /* Set title font */
198 }
199 break;
200
201 case WM_NOTIFY:
202 {
203 LPNMHDR lpnm = (LPNMHDR)lParam;
204
205 switch (lpnm->code)
206 {
207 case PSN_SETACTIVE:
208 {
209 /* Only "Finish" button */
211 }
212 break;
213 }
214 }
215 break;
216 }
217
218 return FALSE;
219}

Referenced by HardwareWizardInit().

◆ HardwareWizardInit()

static VOID HardwareWizardInit ( HWND  hwnd)
static

Definition at line 794 of file hdwwiz.c.

795{
796 HPROPSHEETPAGE ahpsp[10];
797 PROPSHEETPAGE psp = {0};
798 PROPSHEETHEADER psh;
799 UINT nPages = 0;
800
801 /* Create the Start page, until setup is working */
802 psp.dwSize = sizeof(PROPSHEETPAGE);
803 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
804 psp.hInstance = hApplet;
805 psp.lParam = 0;
806 psp.pfnDlgProc = StartPageDlgProc;
807 psp.pszTemplate = MAKEINTRESOURCE(IDD_STARTPAGE);
808 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
809
810 /* Create search page */
811 psp.dwSize = sizeof(PROPSHEETPAGE);
812 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
813 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SEARCHTITLE);
814 psp.pszHeaderSubTitle = NULL;
815 psp.hInstance = hApplet;
816 psp.lParam = 0;
817 psp.pfnDlgProc = SearchPageDlgProc;
818 psp.pszTemplate = MAKEINTRESOURCE(IDD_SEARCHPAGE);
819 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
820
821 /* Create is connected page */
822 psp.dwSize = sizeof(PROPSHEETPAGE);
823 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
824 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_ISCONNECTED);
825 psp.pszHeaderSubTitle = NULL;
826 psp.hInstance = hApplet;
827 psp.lParam = 0;
828 psp.pfnDlgProc = IsConnectedPageDlgProc;
829 psp.pszTemplate = MAKEINTRESOURCE(IDD_ISCONNECTEDPAGE);
830 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
831
832 /* Create probe list page */
833 psp.dwSize = sizeof(PROPSHEETPAGE);
834 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
835 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROBELISTTITLE);
836 psp.pszHeaderSubTitle = NULL;
837 psp.hInstance = hApplet;
838 psp.lParam = 0;
839 psp.pfnDlgProc = ProbeListPageDlgProc;
840 psp.pszTemplate = MAKEINTRESOURCE(IDD_PROBELISTPAGE);
841 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
842
843 /* Create select search way page */
844 psp.dwSize = sizeof(PROPSHEETPAGE);
845 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
846 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SELECTWAYTITLE);
847 psp.pszHeaderSubTitle = NULL;
848 psp.hInstance = hApplet;
849 psp.lParam = 0;
850 psp.pfnDlgProc = SelectWayPageDlgProc;
851 psp.pszTemplate = MAKEINTRESOURCE(IDD_SELECTWAYPAGE);
852 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
853
854 /* Create device status page */
855 psp.dwSize = sizeof(PROPSHEETPAGE);
856 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
857 psp.hInstance = hApplet;
858 psp.lParam = 0;
859 psp.pfnDlgProc = DevStatusPageDlgProc;
860 psp.pszTemplate = MAKEINTRESOURCE(IDD_HWSTATUSPAGE);
861 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
862
863 /* Create hardware types page */
864 psp.dwSize = sizeof(PROPSHEETPAGE);
865 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
866 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_HDTYPESTITLE);
867 psp.pszHeaderSubTitle = NULL;
868 psp.hInstance = hApplet;
869 psp.lParam = 0;
870 psp.pfnDlgProc = HdTypesPageDlgProc;
871 psp.pszTemplate = MAKEINTRESOURCE(IDD_HWTYPESPAGE);
872 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
873
874 /* Create progress page */
875 psp.dwSize = sizeof(PROPSHEETPAGE);
876 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
877 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SEARCHTITLE);
878 psp.pszHeaderSubTitle = NULL;
879 psp.hInstance = hApplet;
880 psp.lParam = 0;
881 psp.pfnDlgProc = ProgressPageDlgProc;
882 psp.pszTemplate = MAKEINTRESOURCE(IDD_PROGRESSPAGE);
883 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
884
885 /* Create finish page */
886 psp.dwSize = sizeof(PROPSHEETPAGE);
887 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
888 psp.hInstance = hApplet;
889 psp.lParam = 0;
890 psp.pfnDlgProc = FinishPageDlgProc;
891 psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
892 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
893
894 /* Create not connected page */
895 psp.dwSize = sizeof(PROPSHEETPAGE);
896 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
897 psp.hInstance = hApplet;
898 psp.lParam = 0;
899 psp.pfnDlgProc = NotConnectedPageDlgProc;
900 psp.pszTemplate = MAKEINTRESOURCE(IDD_NOTCONNECTEDPAGE);
901 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
902
903 /* Create the property sheet */
904 psh.dwSize = sizeof(PROPSHEETHEADER);
905 psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER | PSH_USEICONID | PSH_USECALLBACK;
906 psh.hInstance = hApplet;
907 psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
908 psh.hwndParent = hwnd;
909 psh.nPages = nPages;
910 psh.nStartPage = 0;
911 psh.phpage = ahpsp;
912 psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
913 psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
914 psh.pfnCallback = PropSheetProc;
915
916 /* Create title font */
918
919 /* Display the wizard */
920 PropertySheet(&psh);
921
923}
#define IDB_HEADER
Definition: resource.h:30
#define IDB_WATERMARK
Definition: resource.h:4
#define IDD_STARTPAGE
Definition: resource.h:18
#define IDD_SEARCHPAGE
Definition: resource.h:25
#define IDS_ISCONNECTED
Definition: resource.h:21
#define IDD_ISCONNECTEDPAGE
Definition: resource.h:27
#define IDS_HDTYPESTITLE
Definition: resource.h:19
#define IDD_SELECTWAYPAGE
Definition: resource.h:31
#define IDS_SELECTWAYTITLE
Definition: resource.h:18
#define IDD_HWTYPESPAGE
Definition: resource.h:35
#define IDS_SEARCHTITLE
Definition: resource.h:17
#define IDD_PROGRESSPAGE
Definition: resource.h:32
#define IDS_PROBELISTTITLE
Definition: resource.h:15
#define IDD_HWSTATUSPAGE
Definition: resource.h:30
#define IDD_NOTCONNECTEDPAGE
Definition: resource.h:28
#define IDD_FINISHPAGE
Definition: resource.h:34
pKey DeleteObject()
static INT_PTR CALLBACK FinishPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:190
static HFONT CreateTitleFont(VOID)
Definition: hdwwiz.c:45
static INT_PTR CALLBACK DevStatusPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:514
static INT_PTR CALLBACK ProgressPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:747
static INT_PTR CALLBACK NotConnectedPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:222
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: hdwwiz.c:777
static INT_PTR CALLBACK StartPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:70
static INT_PTR CALLBACK SearchPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:101
static INT_PTR CALLBACK SelectWayPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:473
static INT_PTR CALLBACK IsConnectedPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:131
static INT_PTR CALLBACK HdTypesPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:711
static INT_PTR CALLBACK ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hdwwiz.c:400
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define PROPSHEETHEADER
Definition: prsht.h:392
#define CreatePropertySheetPage
Definition: prsht.h:399
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSP_DEFAULT
Definition: prsht.h:22
#define PropertySheet
Definition: prsht.h:400
#define PSH_USEICONID
Definition: prsht.h:42
#define PROPSHEETPAGE
Definition: prsht.h:389
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by AddHardwareWizard().

◆ HdTypesPageDlgProc()

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

Definition at line 711 of file hdwwiz.c.

712{
713 switch (uMsg)
714 {
715 case WM_INITDIALOG:
716 {
717 InitHardWareTypesPage(hwndDlg);
718 }
719 break;
720
721 case WM_NOTIFY:
722 {
723 LPNMHDR lpnm = (LPNMHDR)lParam;
724
725 switch (lpnm->code)
726 {
727 case PSN_SETACTIVE:
728 {
730 }
731 break;
732
733 case PSN_WIZBACK:
734 {
736 return TRUE;
737 }
738 }
739 }
740 break;
741 }
742
743 return FALSE;
744}
static VOID InitHardWareTypesPage(HWND hwndDlg)
Definition: hdwwiz.c:649

Referenced by HardwareWizardInit().

◆ InitHardWareTypesPage()

static VOID InitHardWareTypesPage ( HWND  hwndDlg)
static

Definition at line 649 of file hdwwiz.c.

650{
652 WCHAR DevName[MAX_STR_SIZE];
653 WCHAR DevDesc[MAX_STR_SIZE];
654 BOOL DevExist = FALSE;
655 INT ClassRet, DevImage, Index = 0;
656 LV_COLUMN Column;
658 RECT Rect;
659
660 if (!hList) return;
661
662 ZeroMemory(&Column, sizeof(LV_COLUMN));
663
665
666 Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
667 Column.fmt = LVCFMT_LEFT;
668 Column.iSubItem = 0;
669 Column.pszText = NULL;
670 Column.cx = Rect.right - GetSystemMetrics(SM_CXVSCROLL);
671 (VOID) ListView_InsertColumn(hList, 0, &Column);
672
673 ZeroMemory(&Item, sizeof(LV_ITEM));
674
675 do
676 {
677 ClassRet = EnumDeviceClasses(Index,
678 DevName,
679 DevDesc,
680 &DevExist,
681 &DevImage);
682
683 if ((ClassRet != -1) && (DevExist))
684 {
686 Item.iItem = Index;
687 Item.iImage = DevImage;
688
689 if (DevDesc[0] != L'\0')
690 Item.pszText = (LPWSTR) DevDesc;
691 else
692 Item.pszText = (LPWSTR) DevName;
693
695
696 /* Kill InfoList initialized in EnumDeviceClasses */
697 if (hDevInfoTypes)
698 {
701 }
702 }
703 Index++;
704 }
705 while (ClassRet != -1);
706
708}
#define VOID
Definition: acefi.h:82
#define IDC_HWTYPESLIST
Definition: resource.h:51
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2893
unsigned int BOOL
Definition: ntddk_ex.h:94
static INT EnumDeviceClasses(INT ClassIndex, LPWSTR DevClassName, LPWSTR DevClassDesc, BOOL *DevPresent, INT *ClassImage)
Definition: hdwwiz.c:554
HWND hList
Definition: livecd.c:10
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define LVIF_STATE
Definition: commctrl.h:2312
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2304
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LV_ITEM
Definition: commctrl.h:2337
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define LVIF_IMAGE
Definition: commctrl.h:2310
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LV_COLUMN
Definition: commctrl.h:2547
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define ZeroMemory
Definition: winbase.h:1712
#define SM_CXVSCROLL
Definition: winuser.h:961
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
int WINAPI GetSystemMetrics(_In_ int)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by HdTypesPageDlgProc().

◆ InitProbeListPage()

static VOID InitProbeListPage ( HWND  hwndDlg)
static

Definition at line 280 of file hdwwiz.c.

281{
282 LV_COLUMN Column;
285 szTrimGuid[MAX_STR_SIZE], szStatusText[MAX_STR_SIZE];
287 PWSTR pstrStatusText;
288 HDEVINFO hDevInfo;
289 SP_DEVINFO_DATA DevInfoData;
290 ULONG ulStatus, ulProblemNumber;
291 GUID ClassGuid;
292 RECT Rect;
293 DWORD Index;
294
295 if (!hList) return;
296
297 ZeroMemory(&Column, sizeof(LV_COLUMN));
298
300
301 Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
302 Column.fmt = LVCFMT_LEFT;
303 Column.iSubItem = 0;
304 Column.pszText = NULL;
305 Column.cx = Rect.right - GetSystemMetrics(SM_CXVSCROLL);
306 (VOID) ListView_InsertColumn(hList, 0, &Column);
307
308 ZeroMemory(&Item, sizeof(LV_ITEM));
309
310 LoadString(hApplet, IDS_ADDNEWDEVICE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
311
313 Item.pszText = (LPWSTR) szBuffer;
315 Item.iImage = -1;
317
319
320 if (hDevInfo == INVALID_HANDLE_VALUE) return;
321
322 /* Get the device image List */
325
326 DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
327 for (Index = 0; TRUE; Index++)
328 {
329 szBuffer[0] = L'\0';
330
331 if (!SetupDiEnumDeviceInfo(hDevInfo, Index, &DevInfoData)) break;
332
333 if (CM_Get_DevNode_Status_Ex(&ulStatus, &ulProblemNumber, DevInfoData.DevInst, 0, NULL) == CR_SUCCESS)
334 {
335 if (ulStatus & DN_NO_SHOW_IN_DM) continue;
336 }
337
338 /* Get the device's friendly name */
340 &DevInfoData,
342 0,
343 (BYTE*)szBuffer,
345 NULL))
346 {
347 /* If the friendly name fails, try the description instead */
349 &DevInfoData,
351 0,
352 (BYTE*)szBuffer,
354 NULL);
355 }
356
358 &DevInfoData,
360 0,
361 (BYTE*)szGuid,
363 NULL);
364
365 TrimGuidString(szGuid, szTrimGuid);
366 UuidFromStringW(szTrimGuid, &ClassGuid);
367
369 &ClassGuid,
370 &Item.iImage);
371
373 DevInfoData.DevInst,
374 ulProblemNumber,
375 szStatusText,
376 sizeof(szStatusText) / sizeof(WCHAR));
377
378 pstrStatusText = (PWSTR)HeapAlloc(hProcessHeap, 0, sizeof(szStatusText));
379 lstrcpy(pstrStatusText, szStatusText);
380
381 if (szBuffer[0] != L'\0')
382 {
383 /* Set device name */
384 Item.pszText = (LPWSTR) szBuffer;
386 Item.lParam = (LPARAM) pstrStatusText;
389 }
390
391 DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
392 }
393
397}
#define DN_NO_SHOW_IN_DM
Definition: cfg.h:148
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:3591
UINT WINAPI DeviceProblemTextW(IN HMACHINE hMachine OPTIONAL, IN DEVINST dnDevInst, IN ULONG uProblemId, OUT LPWSTR lpString, IN UINT uMaxString)
Definition: devprblm.cpp:491
#define IDS_ADDNEWDEVICE
Definition: resource.h:20
#define IDC_PROBELIST
Definition: resource.h:39
#define HeapAlloc
Definition: compat.h:733
BOOL WINAPI SetupDiGetClassImageList(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:322
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1787
static VOID TrimGuidString(LPWSTR szString, LPWSTR szNewString)
Definition: hdwwiz.c:259
static const WCHAR szGuid[]
Definition: rtlstr.c:1892
#define INT
Definition: polytest.cpp:20
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:614
#define SPDRP_DEVICEDESC
Definition: setupapi.h:507
#define SetupDiGetClassDevsEx
Definition: setupapi.h:2594
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2603
#define SPDRP_CLASSGUID
Definition: setupapi.h:515
#define DIGCF_ALLCLASSES
Definition: setupapi.h:172
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
#define SPDRP_FRIENDLYNAME
Definition: setupapi.h:519
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define LoadString
Definition: winuser.h:5819
unsigned char BYTE
Definition: xxhash.c:193

Referenced by ProbeListPageDlgProc().

◆ InstallNewDevice()

BOOL WINAPI InstallNewDevice ( HWND  hwndParent,
LPGUID  ClassGuid,
PDWORD  pReboot 
)

Definition at line 928 of file hdwwiz.c.

929{
930 return FALSE;
931}

◆ IsConnectedPageDlgProc()

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

Definition at line 131 of file hdwwiz.c.

132{
133 switch (uMsg)
134 {
135 case WM_COMMAND:
136 {
137 if(HIWORD(wParam) == BN_CLICKED)
138 {
139 if ((SendDlgItemMessage(hwndDlg, IDC_CONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED) ||
141 {
143 }
144 else
145 {
147 }
148 }
149 }
150 break;
151
152 case WM_NOTIFY:
153 {
154 LPNMHDR lpnm = (LPNMHDR)lParam;
155
156 switch (lpnm->code)
157 {
158 case PSN_SETACTIVE:
159 {
160 if ((SendDlgItemMessage(hwndDlg, IDC_CONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED) ||
162 {
164 }
165 else
166 {
168 }
169 }
170 break;
171
172 case PSN_WIZNEXT:
173 {
176 else
178
179 return TRUE;
180 }
181 }
182 }
183 break;
184 }
185
186 return FALSE;
187}
WPARAM wParam
Definition: combotst.c:138
#define IDC_NOTCONNECTED
Definition: resource.h:56
#define IDC_CONNECTED
Definition: resource.h:55
#define PSN_WIZNEXT
Definition: prsht.h:121
#define PSWIZB_NEXT
Definition: prsht.h:154
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_COMMAND
Definition: winuser.h:1740
#define BN_CLICKED
Definition: winuser.h:1925
#define BST_CHECKED
Definition: winuser.h:197
#define BM_GETCHECK
Definition: winuser.h:1918

Referenced by HardwareWizardInit().

◆ NotConnectedPageDlgProc()

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

Definition at line 222 of file hdwwiz.c.

223{
224 switch (uMsg)
225 {
226 case WM_INITDIALOG:
227 {
228 /* Set title font */
230 }
231 break;
232
233 case WM_NOTIFY:
234 {
235 LPNMHDR lpnm = (LPNMHDR)lParam;
236
237 switch (lpnm->code)
238 {
239 case PSN_SETACTIVE:
240 {
242 }
243 break;
244
245 case PSN_WIZBACK:
246 {
248 return TRUE;
249 }
250 }
251 }
252 break;
253 }
254
255 return FALSE;
256}

Referenced by HardwareWizardInit().

◆ ProbeListPageDlgProc()

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

Definition at line 400 of file hdwwiz.c.

401{
402 INT Index;
403 LVITEM Item;
404
405 switch (uMsg)
406 {
407 case WM_INITDIALOG:
408 {
410 InitProbeListPage(hwndDlg);
411 }
412 break;
413
414 case WM_NOTIFY:
415 {
416 LPNMHDR lpnm = (LPNMHDR)lParam;
417
418 switch (lpnm->code)
419 {
420 case PSN_SETACTIVE:
421 {
423 }
424 break;
425
426 case PSN_WIZNEXT:
427 {
429 if (Index == -1) Index = 0;
430
431 if (Index == 0)
432 {
434 }
435 else
436 {
437 PWSTR pts;
438
439 ZeroMemory(&Item, sizeof(LV_ITEM));
440 Item.mask = LVIF_PARAM;
441 Item.iItem = Index;
443 pts = (PWSTR) Item.lParam;
445
447 }
448 return TRUE;
449 }
450 }
451 }
452 break;
453
454 case WM_DESTROY:
455 {
456 for (Index = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_PROBELIST)); --Index > 0;)
457 {
458 ZeroMemory(&Item, sizeof(LV_ITEM));
459 Item.mask = LVIF_PARAM;
460 Item.iItem = Index;
462 HeapFree(hProcessHeap, 0, (LPVOID) Item.lParam);
463 }
465 }
466 break;
467 }
468
469 return FALSE;
470}
#define HeapFree(x, y, z)
Definition: compat.h:735
static VOID InitProbeListPage(HWND hwndDlg)
Definition: hdwwiz.c:280
#define LVNI_FOCUSED
Definition: commctrl.h:2423
#define LVM_GETNEXTITEM
Definition: commctrl.h:2433
#define LVITEM
Definition: commctrl.h:2375
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define SendMessage
Definition: winuser.h:5843
#define WM_DESTROY
Definition: winuser.h:1609

Referenced by HardwareWizardInit().

◆ ProgressPageDlgProc()

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

Definition at line 747 of file hdwwiz.c.

748{
749 switch (uMsg)
750 {
751 case WM_NOTIFY:
752 {
753 LPNMHDR lpnm = (LPNMHDR)lParam;
754
755 switch (lpnm->code)
756 {
757 case PSN_SETACTIVE:
758 {
760 }
761 break;
762
763 case PSN_WIZBACK:
764 {
766 return TRUE;
767 }
768 }
769 }
770 break;
771 }
772
773 return FALSE;
774}

Referenced by HardwareWizardInit().

◆ PropSheetProc()

static int CALLBACK PropSheetProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
static

Definition at line 777 of file hdwwiz.c.

778{
779 // NOTE: This callback is needed to set large icon correctly.
780 HICON hIcon;
781 switch (uMsg)
782 {
783 case PSCB_INITIALIZED:
784 {
786 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
787 break;
788 }
789 }
790 return 0;
791}
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define ICON_BIG
Definition: tnclass.cpp:51
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2075
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by HardwareWizardInit().

◆ SearchPageDlgProc()

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

Definition at line 101 of file hdwwiz.c.

102{
103 switch (uMsg)
104 {
105 case WM_INITDIALOG:
106 {
107 /* TODO: PnP devices search */
108 }
109 break;
110
111 case WM_NOTIFY:
112 {
113 LPNMHDR lpnm = (LPNMHDR)lParam;
114
115 switch (lpnm->code)
116 {
117 case PSN_SETACTIVE:
118 {
120 }
121 break;
122 }
123 }
124 break;
125 }
126
127 return FALSE;
128}

Referenced by HardwareWizardInit().

◆ SelectWayPageDlgProc()

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

Definition at line 473 of file hdwwiz.c.

474{
475 switch (uMsg)
476 {
477 case WM_NOTIFY:
478 {
479 LPNMHDR lpnm = (LPNMHDR)lParam;
480
481 switch (lpnm->code)
482 {
483 case PSN_SETACTIVE:
484 {
488 else
489 {
492 }
493 }
494 break;
495
496 case PSN_WIZNEXT:
497 {
500 else
502
503 return TRUE;
504 }
505 }
506 }
507 break;
508 }
509
510 return FALSE;
511}
#define IDC_MANUALLYINST
Definition: resource.h:43
#define IDC_AUTOINSTALL
Definition: resource.h:42
#define BM_SETCHECK
Definition: winuser.h:1921

Referenced by HardwareWizardInit().

◆ StartPageDlgProc()

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

Definition at line 70 of file hdwwiz.c.

71{
72 switch (uMsg)
73 {
74 case WM_INITDIALOG:
75 {
76 /* Set title font */
78 }
79 break;
80
81 case WM_NOTIFY:
82 {
83 LPNMHDR lpnm = (LPNMHDR)lParam;
84
85 switch (lpnm->code)
86 {
87 case PSN_SETACTIVE:
88 {
90 }
91 break;
92 }
93 }
94 break;
95 }
96
97 return FALSE;
98}

Referenced by HardwareWizardInit().

◆ TrimGuidString()

static VOID TrimGuidString ( LPWSTR  szString,
LPWSTR  szNewString 
)
static

Definition at line 259 of file hdwwiz.c.

260{
261 WCHAR szBuffer[39];
262 INT Index;
263
264 if (wcslen(szString) == 38)
265 {
266 if ((szString[0] == L'{') && (szString[37] == L'}'))
267 {
268 for (Index = 0; Index < wcslen(szString); Index++)
269 szBuffer[Index] = szString[Index + 1];
270
271 szBuffer[36] = L'\0';
272 wcscpy(szNewString, szBuffer);
273 return;
274 }
275 }
276 wcscpy(szNewString, L"\0");
277}
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by InitProbeListPage().

Variable Documentation

◆ hApplet

HINSTANCE hApplet = NULL

Definition at line 32 of file hdwwiz.c.

Referenced by DllMain(), HardwareWizardInit(), InitProbeListPage(), and PropSheetProc().

◆ hDevInfoTypes

HDEVINFO hDevInfoTypes

Definition at line 37 of file hdwwiz.c.

Referenced by EnumDeviceClasses(), and InitHardWareTypesPage().

◆ hProcessHeap

HANDLE hProcessHeap

Definition at line 36 of file hdwwiz.c.

Referenced by DllMain(), InitProbeListPage(), and ProbeListPageDlgProc().

◆ hTitleFont

◆ ImageListData

◆ pDeviceStatusText

PWSTR pDeviceStatusText

Definition at line 35 of file hdwwiz.c.

Referenced by DevStatusPageDlgProc(), and ProbeListPageDlgProc().