2 * ReactOS New devices installation
3 * Copyright (C) 2005, 2008 ReactOS Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * PROJECT: ReactOS Add hardware control panel
21 * FILE: dll/cpl/hdwwiz/hdwwiz.c
22 * PURPOSE: ReactOS Add hardware control panel
23 * PROGRAMMER: Hervé Poussineau (hpoussin@reactos.org)
24 * Dmitry Chapyshev (dmitry@reactos.org)
30 /* GLOBALS ******************************************************************/
32 HINSTANCE hApplet
= NULL
;
34 SP_CLASSIMAGELIST_DATA ImageListData
;
35 PWSTR pDeviceStatusText
;
37 HDEVINFO hDevInfoTypes
;
39 typedef BOOL (WINAPI
*PINSTALL_NEW_DEVICE
)(HWND
, LPGUID
, PDWORD
);
42 /* STATIC FUNCTIONS *********************************************************/
53 ncm
.cbSize
= sizeof(NONCLIENTMETRICS
);
54 SystemParametersInfo(SPI_GETNONCLIENTMETRICS
, 0, &ncm
, 0);
56 LogFont
= ncm
.lfMessageFont
;
57 LogFont
.lfWeight
= FW_BOLD
;
58 wcscpy(LogFont
.lfFaceName
, L
"MS Shell Dlg");
62 LogFont
.lfHeight
= 0 - GetDeviceCaps (hdc
, LOGPIXELSY
) * FontSize
/ 72;
63 hFont
= CreateFontIndirect(&LogFont
);
69 static INT_PTR CALLBACK
70 StartPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
77 SendDlgItemMessage(hwndDlg
, IDC_FINISHTITLE
, WM_SETFONT
, (WPARAM
)hTitleFont
, (LPARAM
)TRUE
);
83 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
89 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
);
100 static INT_PTR CALLBACK
101 SearchPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
107 /* TODO: PnP devices search */
113 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
119 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
| PSWIZB_BACK
);
130 static INT_PTR CALLBACK
131 IsConnectedPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
137 if(HIWORD(wParam
) == BN_CLICKED
)
139 if ((SendDlgItemMessage(hwndDlg
, IDC_CONNECTED
, BM_GETCHECK
, 0, 0) == BST_CHECKED
) ||
140 (SendDlgItemMessage(hwndDlg
, IDC_NOTCONNECTED
, BM_GETCHECK
, 0, 0) == BST_CHECKED
))
142 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
| PSWIZB_BACK
);
146 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
154 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
160 if ((SendDlgItemMessage(hwndDlg
, IDC_CONNECTED
, BM_GETCHECK
, 0, 0) == BST_CHECKED
) ||
161 (SendDlgItemMessage(hwndDlg
, IDC_NOTCONNECTED
, BM_GETCHECK
, 0, 0) == BST_CHECKED
))
163 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
| PSWIZB_BACK
);
167 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
174 if (SendDlgItemMessage(hwndDlg
, IDC_NOTCONNECTED
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
175 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_NOTCONNECTEDPAGE
);
177 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_PROBELISTPAGE
);
189 static INT_PTR CALLBACK
190 FinishPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
197 SendDlgItemMessage(hwndDlg
, IDC_FINISHTITLE
, WM_SETFONT
, (WPARAM
)hTitleFont
, (LPARAM
)TRUE
);
203 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
209 /* Only "Finish" button */
210 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
);
221 static INT_PTR CALLBACK
222 NotConnectedPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
229 SendDlgItemMessage(hwndDlg
, IDC_FINISHTITLE
, WM_SETFONT
, (WPARAM
)hTitleFont
, (LPARAM
)TRUE
);
235 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
241 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
| PSWIZB_BACK
);
247 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_ISCONNECTEDPAGE
);
259 TrimGuidString(LPWSTR szString
, LPWSTR szNewString
)
264 if (wcslen(szString
) == 38)
266 if ((szString
[0] == L
'{') && (szString
[37] == L
'}'))
268 for (Index
= 0; Index
< wcslen(szString
); Index
++)
269 szBuffer
[Index
] = szString
[Index
+ 1];
271 szBuffer
[36] = L
'\0';
272 wcscpy(szNewString
, szBuffer
);
276 wcscpy(szNewString
, L
"\0");
280 InitProbeListPage(HWND hwndDlg
)
284 WCHAR szBuffer
[MAX_STR_SIZE
], szGuid
[MAX_STR_SIZE
],
285 szTrimGuid
[MAX_STR_SIZE
], szStatusText
[MAX_STR_SIZE
];
286 HWND hList
= GetDlgItem(hwndDlg
, IDC_PROBELIST
);
287 PWSTR pstrStatusText
;
289 SP_DEVINFO_DATA DevInfoData
;
290 ULONG ulStatus
, ulProblemNumber
;
297 ZeroMemory(&Column
, sizeof(LV_COLUMN
));
299 GetClientRect(hList
, &Rect
);
301 Column
.mask
= LVCF_FMT
| LVCF_TEXT
| LVCF_WIDTH
;
302 Column
.fmt
= LVCFMT_LEFT
;
304 Column
.pszText
= NULL
;
305 Column
.cx
= Rect
.right
- GetSystemMetrics(SM_CXVSCROLL
);
306 (VOID
) ListView_InsertColumn(hList
, 0, &Column
);
308 ZeroMemory(&Item
, sizeof(LV_ITEM
));
310 LoadString(hApplet
, IDS_ADDNEWDEVICE
, szBuffer
, sizeof(szBuffer
) / sizeof(WCHAR
));
312 Item
.mask
= LVIF_TEXT
| LVIF_PARAM
| LVIF_STATE
| LVIF_IMAGE
;
313 Item
.pszText
= (LPWSTR
) szBuffer
;
314 Item
.iItem
= (INT
) ListView_GetItemCount(hList
);
316 (VOID
) ListView_InsertItem(hList
, &Item
);
318 hDevInfo
= SetupDiGetClassDevsEx(NULL
, NULL
, NULL
, DIGCF_ALLCLASSES
| DIGCF_PRESENT
, NULL
, NULL
, 0);
320 if (hDevInfo
== INVALID_HANDLE_VALUE
) return;
322 /* Get the device image List */
323 ImageListData
.cbSize
= sizeof(ImageListData
);
324 SetupDiGetClassImageList(&ImageListData
);
326 DevInfoData
.cbSize
= sizeof(SP_DEVINFO_DATA
);
327 for (Index
= 0; TRUE
; Index
++)
331 if (!SetupDiEnumDeviceInfo(hDevInfo
, Index
, &DevInfoData
)) break;
333 if (CM_Get_DevNode_Status_Ex(&ulStatus
, &ulProblemNumber
, DevInfoData
.DevInst
, 0, NULL
) == CR_SUCCESS
)
335 if (ulStatus
& DN_NO_SHOW_IN_DM
) continue;
338 /* Get the device's friendly name */
339 if (!SetupDiGetDeviceRegistryProperty(hDevInfo
,
347 /* If the friendly name fails, try the description instead */
348 SetupDiGetDeviceRegistryProperty(hDevInfo
,
357 SetupDiGetDeviceRegistryProperty(hDevInfo
,
365 TrimGuidString(szGuid
, szTrimGuid
);
366 UuidFromStringW(szTrimGuid
, &ClassGuid
);
368 SetupDiGetClassImageIndex(&ImageListData
,
372 DeviceProblemTextW(NULL
,
376 sizeof(szStatusText
) / sizeof(WCHAR
));
378 pstrStatusText
= (PWSTR
)HeapAlloc(hProcessHeap
, 0, sizeof(szStatusText
));
379 lstrcpy(pstrStatusText
, szStatusText
);
381 if (szBuffer
[0] != L
'\0')
383 /* Set device name */
384 Item
.pszText
= (LPWSTR
) szBuffer
;
385 Item
.mask
= LVIF_TEXT
| LVIF_PARAM
| LVIF_STATE
| LVIF_IMAGE
;
386 Item
.lParam
= (LPARAM
) pstrStatusText
;
387 Item
.iItem
= (INT
) ListView_GetItemCount(hList
);
388 (VOID
) ListView_InsertItem(hList
, &Item
);
391 DevInfoData
.cbSize
= sizeof(SP_DEVINFO_DATA
);
394 (VOID
) ListView_SetImageList(hList
, ImageListData
.ImageList
, LVSIL_SMALL
);
395 (VOID
) ListView_SetExtendedListViewStyle(hList
, LVS_EX_FULLROWSELECT
);
396 SetupDiDestroyDeviceInfoList(hDevInfo
);
399 static INT_PTR CALLBACK
400 ProbeListPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
409 pDeviceStatusText
= (PWSTR
)HeapAlloc(hProcessHeap
, 0, MAX_STR_SIZE
);
410 InitProbeListPage(hwndDlg
);
416 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
422 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
| PSWIZB_NEXT
);
428 Index
= (INT
) SendMessage(GetDlgItem(hwndDlg
, IDC_PROBELIST
), LVM_GETNEXTITEM
, -1, LVNI_FOCUSED
);
429 if (Index
== -1) Index
= 0;
433 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_SELECTWAYPAGE
);
440 ZeroMemory(&Item
, sizeof(LV_ITEM
));
441 Item
.mask
= LVIF_PARAM
;
443 (VOID
) ListView_GetItem(GetDlgItem(hwndDlg
, IDC_PROBELIST
), &Item
);
444 pts
= (PWSTR
) Item
.lParam
;
445 wcscpy(pDeviceStatusText
, pts
);
447 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_HWSTATUSPAGE
);
457 for (Index
= ListView_GetItemCount(GetDlgItem(hwndDlg
, IDC_PROBELIST
)); --Index
> 0;)
459 ZeroMemory(&Item
, sizeof(LV_ITEM
));
460 Item
.mask
= LVIF_PARAM
;
462 (VOID
) ListView_GetItem(GetDlgItem(hwndDlg
, IDC_PROBELIST
), &Item
);
463 HeapFree(hProcessHeap
, 0, (LPVOID
) Item
.lParam
);
465 HeapFree(hProcessHeap
, 0, (LPVOID
) pDeviceStatusText
);
473 static INT_PTR CALLBACK
474 SelectWayPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
480 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
486 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_NEXT
| PSWIZB_BACK
);
487 if (SendDlgItemMessage(hwndDlg
, IDC_AUTOINSTALL
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
488 SendDlgItemMessage(hwndDlg
, IDC_MANUALLYINST
, BM_SETCHECK
, 0, 0);
491 SendDlgItemMessage(hwndDlg
, IDC_AUTOINSTALL
, BM_SETCHECK
, 1, 1);
492 SendDlgItemMessage(hwndDlg
, IDC_MANUALLYINST
, BM_SETCHECK
, 0, 0);
499 if (SendDlgItemMessage(hwndDlg
, IDC_AUTOINSTALL
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
500 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_PROGRESSPAGE
);
502 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_HWTYPESPAGE
);
514 static INT_PTR CALLBACK
515 DevStatusPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
522 SendDlgItemMessage(hwndDlg
, IDC_FINISHTITLE
, WM_SETFONT
, (WPARAM
)hTitleFont
, (LPARAM
)TRUE
);
528 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
534 /* Set status text */
535 SetWindowText(GetDlgItem(hwndDlg
, IDC_HWSTATUSEDIT
), pDeviceStatusText
);
537 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_FINISH
| PSWIZB_BACK
);
543 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_PROBELISTPAGE
);
555 EnumDeviceClasses(INT ClassIndex
,
563 WCHAR ClassName
[MAX_STR_SIZE
];
564 DWORD RequiredSize
= MAX_STR_SIZE
;
568 *DevClassName
= L
'\0';
570 Ret
= CM_Enumerate_Classes(ClassIndex
,
573 if (Ret
!= CR_SUCCESS
)
575 /* All classes enumerated */
576 if(Ret
== CR_NO_SUCH_VALUE
)
578 hDevInfoTypes
= NULL
;
582 if (Ret
== CR_INVALID_DATA
)
584 ; /* FIXME: What should we do here? */
587 /* Handle other errors... */
590 if (SetupDiClassNameFromGuid(&ClassGuid
,
595 lstrcpy(DevClassName
, ClassName
);
598 if (!SetupDiGetClassImageIndex(&ImageListData
,
602 /* FIXME: Can we do this?
603 * Set the blank icon: IDI_SETUPAPI_BLANK = 41
604 * It'll be image 24 in the imagelist */
608 /* Get device info for all devices of a particular class */
609 hDevInfoTypes
= SetupDiGetClassDevs(&ClassGuid
,
613 if (hDevInfoTypes
== INVALID_HANDLE_VALUE
)
615 hDevInfoTypes
= NULL
;
619 KeyClass
= SetupDiOpenClassRegKeyEx(&ClassGuid
,
624 if (KeyClass
!= INVALID_HANDLE_VALUE
)
627 LONG dwSize
= MAX_STR_SIZE
;
629 if (RegQueryValue(KeyClass
,
632 &dwSize
) != ERROR_SUCCESS
)
634 *DevClassDesc
= L
'\0';
644 RegCloseKey(KeyClass
);
650 InitHardWareTypesPage(HWND hwndDlg
)
652 HWND hList
= GetDlgItem(hwndDlg
, IDC_HWTYPESLIST
);
653 WCHAR DevName
[MAX_STR_SIZE
];
654 WCHAR DevDesc
[MAX_STR_SIZE
];
655 BOOL DevExist
= FALSE
;
656 INT ClassRet
, DevImage
, Index
= 0;
663 ZeroMemory(&Column
, sizeof(LV_COLUMN
));
665 GetClientRect(hList
, &Rect
);
667 Column
.mask
= LVCF_FMT
| LVCF_TEXT
| LVCF_WIDTH
;
668 Column
.fmt
= LVCFMT_LEFT
;
670 Column
.pszText
= NULL
;
671 Column
.cx
= Rect
.right
- GetSystemMetrics(SM_CXVSCROLL
);
672 (VOID
) ListView_InsertColumn(hList
, 0, &Column
);
674 ZeroMemory(&Item
, sizeof(LV_ITEM
));
678 ClassRet
= EnumDeviceClasses(Index
,
684 if ((ClassRet
!= -1) && (DevExist
))
686 Item
.mask
= LVIF_TEXT
| LVIF_PARAM
| LVIF_STATE
| LVIF_IMAGE
;
688 Item
.iImage
= DevImage
;
690 if (DevDesc
[0] != L
'\0')
691 Item
.pszText
= (LPWSTR
) DevDesc
;
693 Item
.pszText
= (LPWSTR
) DevName
;
695 (VOID
) ListView_InsertItem(hList
, &Item
);
697 /* Kill InfoList initialized in EnumDeviceClasses */
700 SetupDiDestroyDeviceInfoList(hDevInfoTypes
);
701 hDevInfoTypes
= NULL
;
706 while (ClassRet
!= -1);
708 (VOID
) ListView_SetImageList(hList
, ImageListData
.ImageList
, LVSIL_SMALL
);
711 static INT_PTR CALLBACK
712 HdTypesPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
718 InitHardWareTypesPage(hwndDlg
);
724 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
730 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
736 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_SELECTWAYPAGE
);
747 static INT_PTR CALLBACK
748 ProgressPageDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
754 LPNMHDR lpnm
= (LPNMHDR
)lParam
;
760 PropSheet_SetWizButtons(GetParent(hwndDlg
), PSWIZB_BACK
);
766 SetWindowLongPtr(hwndDlg
, DWLP_MSGRESULT
, IDD_SELECTWAYPAGE
);
778 PropSheetProc(HWND hwndDlg
, UINT uMsg
, LPARAM lParam
)
780 // NOTE: This callback is needed to set large icon correctly.
784 case PSCB_INITIALIZED
:
786 hIcon
= LoadIconW(hApplet
, MAKEINTRESOURCEW(IDI_CPLICON
));
787 SendMessageW(hwndDlg
, WM_SETICON
, ICON_BIG
, (LPARAM
)hIcon
);
795 HardwareWizardInit(HWND hwnd
)
797 HPROPSHEETPAGE ahpsp
[10];
798 PROPSHEETPAGE psp
= {0};
802 /* Create the Start page, until setup is working */
803 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
804 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
805 psp
.hInstance
= hApplet
;
807 psp
.pfnDlgProc
= StartPageDlgProc
;
808 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_STARTPAGE
);
809 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
811 /* Create search page */
812 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
813 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
814 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDS_SEARCHTITLE
);
815 psp
.pszHeaderSubTitle
= NULL
;
816 psp
.hInstance
= hApplet
;
818 psp
.pfnDlgProc
= SearchPageDlgProc
;
819 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_SEARCHPAGE
);
820 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
822 /* Create is connected page */
823 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
824 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
825 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDS_ISCONNECTED
);
826 psp
.pszHeaderSubTitle
= NULL
;
827 psp
.hInstance
= hApplet
;
829 psp
.pfnDlgProc
= IsConnectedPageDlgProc
;
830 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_ISCONNECTEDPAGE
);
831 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
833 /* Create probe list page */
834 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
835 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
836 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDS_PROBELISTTITLE
);
837 psp
.pszHeaderSubTitle
= NULL
;
838 psp
.hInstance
= hApplet
;
840 psp
.pfnDlgProc
= ProbeListPageDlgProc
;
841 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_PROBELISTPAGE
);
842 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
844 /* Create select search way page */
845 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
846 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
847 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDS_SELECTWAYTITLE
);
848 psp
.pszHeaderSubTitle
= NULL
;
849 psp
.hInstance
= hApplet
;
851 psp
.pfnDlgProc
= SelectWayPageDlgProc
;
852 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_SELECTWAYPAGE
);
853 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
855 /* Create device status page */
856 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
857 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
858 psp
.hInstance
= hApplet
;
860 psp
.pfnDlgProc
= DevStatusPageDlgProc
;
861 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_HWSTATUSPAGE
);
862 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
864 /* Create hardware types page */
865 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
866 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
867 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDS_HDTYPESTITLE
);
868 psp
.pszHeaderSubTitle
= NULL
;
869 psp
.hInstance
= hApplet
;
871 psp
.pfnDlgProc
= HdTypesPageDlgProc
;
872 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_HWTYPESPAGE
);
873 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
875 /* Create progress page */
876 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
877 psp
.dwFlags
= PSP_DEFAULT
| PSP_USEHEADERTITLE
| PSP_USEHEADERSUBTITLE
;
878 psp
.pszHeaderTitle
= MAKEINTRESOURCE(IDS_SEARCHTITLE
);
879 psp
.pszHeaderSubTitle
= NULL
;
880 psp
.hInstance
= hApplet
;
882 psp
.pfnDlgProc
= ProgressPageDlgProc
;
883 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_PROGRESSPAGE
);
884 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
886 /* Create finish page */
887 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
888 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
889 psp
.hInstance
= hApplet
;
891 psp
.pfnDlgProc
= FinishPageDlgProc
;
892 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_FINISHPAGE
);
893 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
895 /* Create not connected page */
896 psp
.dwSize
= sizeof(PROPSHEETPAGE
);
897 psp
.dwFlags
= PSP_DEFAULT
| PSP_HIDEHEADER
;
898 psp
.hInstance
= hApplet
;
900 psp
.pfnDlgProc
= NotConnectedPageDlgProc
;
901 psp
.pszTemplate
= MAKEINTRESOURCE(IDD_NOTCONNECTEDPAGE
);
902 ahpsp
[nPages
++] = CreatePropertySheetPage(&psp
);
904 /* Create the property sheet */
905 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
906 psh
.dwFlags
= PSH_WIZARD97
| PSH_WATERMARK
| PSH_HEADER
| PSH_USEICONID
| PSH_USECALLBACK
;
907 psh
.hInstance
= hApplet
;
908 psh
.pszIcon
= MAKEINTRESOURCEW(IDI_CPLICON
);
909 psh
.hwndParent
= hwnd
;
913 psh
.pszbmWatermark
= MAKEINTRESOURCE(IDB_WATERMARK
);
914 psh
.pszbmHeader
= MAKEINTRESOURCE(IDB_HEADER
);
915 psh
.pfnCallback
= PropSheetProc
;
917 /* Create title font */
918 hTitleFont
= CreateTitleFont();
920 /* Display the wizard */
923 DeleteObject(hTitleFont
);
926 /* FUNCTIONS ****************************************************************/
929 InstallNewDevice(HWND hwndParent
, LPGUID ClassGuid
, PDWORD pReboot
)
935 AddHardwareWizard(HWND hwnd
, LPWSTR lpName
)
939 DPRINT1("No support of remote installation yet!\n");
943 HardwareWizardInit(hwnd
);
946 /* Control Panel Callback */
948 CPlApplet(HWND hwndCpl
, UINT uMsg
, LPARAM lParam1
, LPARAM lParam2
)
960 CPLINFO
*CPlInfo
= (CPLINFO
*)lParam2
;
962 CPlInfo
->idIcon
= IDI_CPLICON
;
963 CPlInfo
->idName
= IDS_CPLNAME
;
964 CPlInfo
->idInfo
= IDS_CPLDESCRIPTION
;
969 AddHardwareWizard(hwndCpl
, NULL
);
977 DllMain(HINSTANCE hinstDLL
, DWORD dwReason
, LPVOID lpvReserved
)
979 UNREFERENCED_PARAMETER(lpvReserved
);
983 case DLL_PROCESS_ATTACH
:
985 hProcessHeap
= GetProcessHeap();
986 DisableThreadLibraryCalls(hinstDLL
);