2005-10-03 07:48:59 +00:00
|
|
|
|
/*
|
|
|
|
|
* ReactOS New devices installation
|
2009-01-06 19:28:04 +00:00
|
|
|
|
* Copyright (C) 2005, 2008 ReactOS Team
|
2005-10-03 07:48:59 +00:00
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2009-10-27 10:34:16 +00:00
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2005-10-03 07:48:59 +00:00
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
* PROJECT: ReactOS Add hardware control panel
|
2007-09-16 13:38:26 +00:00
|
|
|
|
* FILE: dll/cpl/hdwwiz/hdwwiz.c
|
2005-10-03 07:48:59 +00:00
|
|
|
|
* PURPOSE: ReactOS Add hardware control panel
|
|
|
|
|
* PROGRAMMER: Herv<EFBFBD> Poussineau (hpoussin@reactos.org)
|
2009-01-06 18:32:51 +00:00
|
|
|
|
* Dmitry Chapyshev (dmitry@reactos.org)
|
2005-10-03 07:48:59 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "resource.h"
|
|
|
|
|
#include "hdwwiz.h"
|
|
|
|
|
|
2009-01-06 21:19:50 +00:00
|
|
|
|
/* GLOBALS ******************************************************************/
|
2009-01-06 19:28:04 +00:00
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
HINSTANCE hApplet = NULL;
|
2009-01-06 21:19:50 +00:00
|
|
|
|
HFONT hTitleFont;
|
2009-01-07 20:28:10 +00:00
|
|
|
|
SP_CLASSIMAGELIST_DATA ImageListData;
|
2009-01-08 14:24:45 +00:00
|
|
|
|
PWSTR pDeviceStatusText;
|
|
|
|
|
HANDLE hProcessHeap;
|
2009-01-16 15:21:32 +00:00
|
|
|
|
HDEVINFO hDevInfoTypes;
|
2005-10-03 07:48:59 +00:00
|
|
|
|
|
2007-07-18 12:23:29 +00:00
|
|
|
|
typedef BOOL (WINAPI *PINSTALL_NEW_DEVICE)(HWND, LPGUID, PDWORD);
|
2005-10-03 07:48:59 +00:00
|
|
|
|
|
2008-05-02 14:15:04 +00:00
|
|
|
|
|
2009-01-07 10:58:29 +00:00
|
|
|
|
/* STATIC FUNCTIONS *********************************************************/
|
2008-05-02 14:15:04 +00:00
|
|
|
|
|
2009-01-06 21:19:50 +00:00
|
|
|
|
static HFONT
|
|
|
|
|
CreateTitleFont(VOID)
|
|
|
|
|
{
|
|
|
|
|
NONCLIENTMETRICS ncm;
|
|
|
|
|
LOGFONT LogFont;
|
|
|
|
|
HDC hdc;
|
|
|
|
|
INT FontSize;
|
|
|
|
|
HFONT hFont;
|
|
|
|
|
|
|
|
|
|
ncm.cbSize = sizeof(NONCLIENTMETRICS);
|
|
|
|
|
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
|
|
|
|
|
|
|
|
|
|
LogFont = ncm.lfMessageFont;
|
|
|
|
|
LogFont.lfWeight = FW_BOLD;
|
2009-01-25 18:02:24 +00:00
|
|
|
|
wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
|
2009-01-06 21:19:50 +00:00
|
|
|
|
|
|
|
|
|
hdc = GetDC(NULL);
|
|
|
|
|
FontSize = 12;
|
|
|
|
|
LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72;
|
|
|
|
|
hFont = CreateFontIndirect(&LogFont);
|
|
|
|
|
ReleaseDC(NULL, hdc);
|
|
|
|
|
|
|
|
|
|
return hFont;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
|
StartPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2005-10-03 07:48:59 +00:00
|
|
|
|
{
|
2009-01-06 21:19:50 +00:00
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
|
{
|
|
|
|
|
/* Set title font */
|
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2009-01-08 14:24:45 +00:00
|
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2009-01-06 21:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2007-09-16 13:38:26 +00:00
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
|
SearchPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
2009-01-08 14:24:45 +00:00
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
|
{
|
|
|
|
|
/* TODO: PnP devices search */
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2007-09-16 13:38:26 +00:00
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
static INT_PTR CALLBACK
|
2016-11-12 21:53:33 +00:00
|
|
|
|
IsConnectedPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2009-01-06 18:32:51 +00:00
|
|
|
|
{
|
2009-01-06 19:28:04 +00:00
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
|
{
|
|
|
|
|
if(HIWORD(wParam) == BN_CLICKED)
|
|
|
|
|
{
|
|
|
|
|
if ((SendDlgItemMessage(hwndDlg, IDC_CONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED) ||
|
|
|
|
|
(SendDlgItemMessage(hwndDlg, IDC_NOTCONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED))
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
2009-01-07 13:50:54 +00:00
|
|
|
|
if ((SendDlgItemMessage(hwndDlg, IDC_CONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED) ||
|
|
|
|
|
(SendDlgItemMessage(hwndDlg, IDC_NOTCONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED))
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
|
|
|
|
|
}
|
2009-01-06 19:28:04 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2009-01-07 13:50:54 +00:00
|
|
|
|
|
|
|
|
|
case PSN_WIZNEXT:
|
|
|
|
|
{
|
|
|
|
|
if (SendDlgItemMessage(hwndDlg, IDC_NOTCONNECTED, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_NOTCONNECTEDPAGE);
|
2009-01-07 13:50:54 +00:00
|
|
|
|
else
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_PROBELISTPAGE);
|
2009-01-07 13:50:54 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2009-01-06 19:28:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2007-09-16 13:38:26 +00:00
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
|
FinishPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
2009-01-06 19:28:04 +00:00
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
2009-01-06 21:19:50 +00:00
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
|
{
|
|
|
|
|
/* Set title font */
|
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2009-01-06 19:28:04 +00:00
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
|
|
|
|
/* Only "Finish" button */
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2005-10-03 07:48:59 +00:00
|
|
|
|
|
2009-01-07 13:50:54 +00:00
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
|
NotConnectedPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
|
{
|
|
|
|
|
/* Set title font */
|
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH | PSWIZB_BACK);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PSN_WIZBACK:
|
|
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_ISCONNECTEDPAGE);
|
2009-01-07 13:50:54 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-07 20:28:10 +00:00
|
|
|
|
static VOID
|
|
|
|
|
TrimGuidString(LPWSTR szString, LPWSTR szNewString)
|
|
|
|
|
{
|
|
|
|
|
WCHAR szBuffer[39];
|
|
|
|
|
INT Index;
|
|
|
|
|
|
|
|
|
|
if (wcslen(szString) == 38)
|
|
|
|
|
{
|
|
|
|
|
if ((szString[0] == L'{') && (szString[37] == L'}'))
|
|
|
|
|
{
|
|
|
|
|
for (Index = 0; Index < wcslen(szString); Index++)
|
|
|
|
|
szBuffer[Index] = szString[Index + 1];
|
|
|
|
|
|
|
|
|
|
szBuffer[36] = L'\0';
|
|
|
|
|
wcscpy(szNewString, szBuffer);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
wcscpy(szNewString, L"\0");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static VOID
|
|
|
|
|
InitProbeListPage(HWND hwndDlg)
|
|
|
|
|
{
|
|
|
|
|
LV_COLUMN Column;
|
|
|
|
|
LV_ITEM Item;
|
2009-01-08 14:24:45 +00:00
|
|
|
|
WCHAR szBuffer[MAX_STR_SIZE], szGuid[MAX_STR_SIZE],
|
|
|
|
|
szTrimGuid[MAX_STR_SIZE], szStatusText[MAX_STR_SIZE];
|
2009-01-07 20:28:10 +00:00
|
|
|
|
HWND hList = GetDlgItem(hwndDlg, IDC_PROBELIST);
|
2009-01-08 14:24:45 +00:00
|
|
|
|
PWSTR pstrStatusText;
|
2009-01-07 20:28:10 +00:00
|
|
|
|
HDEVINFO hDevInfo;
|
|
|
|
|
SP_DEVINFO_DATA DevInfoData;
|
|
|
|
|
ULONG ulStatus, ulProblemNumber;
|
|
|
|
|
GUID ClassGuid;
|
|
|
|
|
RECT Rect;
|
|
|
|
|
DWORD Index;
|
|
|
|
|
|
|
|
|
|
if (!hList) return;
|
|
|
|
|
|
|
|
|
|
ZeroMemory(&Column, sizeof(LV_COLUMN));
|
|
|
|
|
|
|
|
|
|
GetClientRect(hList, &Rect);
|
|
|
|
|
|
|
|
|
|
Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
|
|
|
|
|
Column.fmt = LVCFMT_LEFT;
|
|
|
|
|
Column.iSubItem = 0;
|
|
|
|
|
Column.pszText = NULL;
|
|
|
|
|
Column.cx = Rect.right - GetSystemMetrics(SM_CXVSCROLL);
|
|
|
|
|
(VOID) ListView_InsertColumn(hList, 0, &Column);
|
|
|
|
|
|
|
|
|
|
ZeroMemory(&Item, sizeof(LV_ITEM));
|
|
|
|
|
|
|
|
|
|
LoadString(hApplet, IDS_ADDNEWDEVICE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
|
|
|
|
|
|
|
|
|
|
Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
|
2009-01-16 16:53:32 +00:00
|
|
|
|
Item.pszText = (LPWSTR) szBuffer;
|
|
|
|
|
Item.iItem = (INT) ListView_GetItemCount(hList);
|
2009-01-07 20:28:10 +00:00
|
|
|
|
Item.iImage = -1;
|
|
|
|
|
(VOID) ListView_InsertItem(hList, &Item);
|
|
|
|
|
|
|
|
|
|
hDevInfo = SetupDiGetClassDevsEx(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT, NULL, NULL, 0);
|
|
|
|
|
|
|
|
|
|
if (hDevInfo == INVALID_HANDLE_VALUE) return;
|
|
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
|
/* Get the device image List */
|
2009-01-07 20:28:10 +00:00
|
|
|
|
ImageListData.cbSize = sizeof(ImageListData);
|
|
|
|
|
SetupDiGetClassImageList(&ImageListData);
|
|
|
|
|
|
|
|
|
|
DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
|
|
|
|
|
for (Index = 0; TRUE; Index++)
|
|
|
|
|
{
|
2009-01-16 16:53:32 +00:00
|
|
|
|
szBuffer[0] = L'\0';
|
|
|
|
|
|
2009-01-07 20:28:10 +00:00
|
|
|
|
if (!SetupDiEnumDeviceInfo(hDevInfo, Index, &DevInfoData)) break;
|
|
|
|
|
|
|
|
|
|
if (CM_Get_DevNode_Status_Ex(&ulStatus, &ulProblemNumber, DevInfoData.DevInst, 0, NULL) == CR_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
if (ulStatus & DN_NO_SHOW_IN_DM) continue;
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
|
/* Get the device's friendly name */
|
2009-01-07 20:28:10 +00:00
|
|
|
|
if (!SetupDiGetDeviceRegistryProperty(hDevInfo,
|
|
|
|
|
&DevInfoData,
|
|
|
|
|
SPDRP_FRIENDLYNAME,
|
|
|
|
|
0,
|
|
|
|
|
(BYTE*)szBuffer,
|
|
|
|
|
MAX_STR_SIZE,
|
|
|
|
|
NULL))
|
|
|
|
|
{
|
2011-11-29 14:55:58 +00:00
|
|
|
|
/* If the friendly name fails, try the description instead */
|
2009-01-07 20:28:10 +00:00
|
|
|
|
SetupDiGetDeviceRegistryProperty(hDevInfo,
|
|
|
|
|
&DevInfoData,
|
|
|
|
|
SPDRP_DEVICEDESC,
|
|
|
|
|
0,
|
|
|
|
|
(BYTE*)szBuffer,
|
|
|
|
|
MAX_STR_SIZE,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetupDiGetDeviceRegistryProperty(hDevInfo,
|
|
|
|
|
&DevInfoData,
|
|
|
|
|
SPDRP_CLASSGUID,
|
|
|
|
|
0,
|
|
|
|
|
(BYTE*)szGuid,
|
|
|
|
|
MAX_STR_SIZE,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
TrimGuidString(szGuid, szTrimGuid);
|
|
|
|
|
UuidFromStringW(szTrimGuid, &ClassGuid);
|
|
|
|
|
|
|
|
|
|
SetupDiGetClassImageIndex(&ImageListData,
|
|
|
|
|
&ClassGuid,
|
|
|
|
|
&Item.iImage);
|
|
|
|
|
|
2009-01-08 14:24:45 +00:00
|
|
|
|
DeviceProblemTextW(NULL,
|
|
|
|
|
DevInfoData.DevInst,
|
|
|
|
|
ulProblemNumber,
|
|
|
|
|
szStatusText,
|
|
|
|
|
sizeof(szStatusText) / sizeof(WCHAR));
|
|
|
|
|
|
|
|
|
|
pstrStatusText = (PWSTR)HeapAlloc(hProcessHeap, 0, sizeof(szStatusText));
|
|
|
|
|
lstrcpy(pstrStatusText, szStatusText);
|
|
|
|
|
|
2009-01-16 16:53:32 +00:00
|
|
|
|
if (szBuffer[0] != L'\0')
|
|
|
|
|
{
|
|
|
|
|
/* Set device name */
|
|
|
|
|
Item.pszText = (LPWSTR) szBuffer;
|
|
|
|
|
Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
|
|
|
|
|
Item.lParam = (LPARAM) pstrStatusText;
|
|
|
|
|
Item.iItem = (INT) ListView_GetItemCount(hList);
|
|
|
|
|
(VOID) ListView_InsertItem(hList, &Item);
|
|
|
|
|
}
|
2009-01-07 20:28:10 +00:00
|
|
|
|
|
|
|
|
|
DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(VOID) ListView_SetImageList(hList, ImageListData.ImageList, LVSIL_SMALL);
|
2009-01-16 16:53:32 +00:00
|
|
|
|
(VOID) ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT);
|
2009-01-07 20:28:10 +00:00
|
|
|
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-07 13:50:54 +00:00
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
|
ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
2009-01-08 14:24:45 +00:00
|
|
|
|
INT Index;
|
2019-10-22 00:41:09 +00:00
|
|
|
|
LVITEM Item;
|
2009-01-08 14:24:45 +00:00
|
|
|
|
|
2009-01-07 13:50:54 +00:00
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
2009-01-07 20:28:10 +00:00
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
|
{
|
2009-01-08 14:24:45 +00:00
|
|
|
|
pDeviceStatusText = (PWSTR)HeapAlloc(hProcessHeap, 0, MAX_STR_SIZE);
|
2009-01-07 20:28:10 +00:00
|
|
|
|
InitProbeListPage(hwndDlg);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2009-01-07 13:50:54 +00:00
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
2009-01-16 16:53:32 +00:00
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
|
2009-01-07 13:50:54 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2009-01-16 16:53:32 +00:00
|
|
|
|
case PSN_WIZNEXT:
|
2009-01-08 14:24:45 +00:00
|
|
|
|
{
|
|
|
|
|
Index = (INT) SendMessage(GetDlgItem(hwndDlg, IDC_PROBELIST), LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
|
2009-01-16 16:53:32 +00:00
|
|
|
|
if (Index == -1) Index = 0;
|
|
|
|
|
|
|
|
|
|
if (Index == 0)
|
2009-01-08 14:24:45 +00:00
|
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTWAYPAGE);
|
2009-01-08 14:24:45 +00:00
|
|
|
|
}
|
2009-01-16 16:53:32 +00:00
|
|
|
|
else
|
2009-01-08 14:24:45 +00:00
|
|
|
|
{
|
2009-01-16 16:53:32 +00:00
|
|
|
|
PWSTR pts;
|
|
|
|
|
|
|
|
|
|
ZeroMemory(&Item, sizeof(LV_ITEM));
|
|
|
|
|
Item.mask = LVIF_PARAM;
|
|
|
|
|
Item.iItem = Index;
|
|
|
|
|
(VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
|
|
|
|
|
pts = (PWSTR) Item.lParam;
|
|
|
|
|
wcscpy(pDeviceStatusText, pts);
|
|
|
|
|
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_HWSTATUSPAGE);
|
2009-01-08 14:24:45 +00:00
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
|
{
|
|
|
|
|
for (Index = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_PROBELIST)); --Index > 0;)
|
|
|
|
|
{
|
|
|
|
|
ZeroMemory(&Item, sizeof(LV_ITEM));
|
|
|
|
|
Item.mask = LVIF_PARAM;
|
|
|
|
|
Item.iItem = Index;
|
|
|
|
|
(VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
|
|
|
|
|
HeapFree(hProcessHeap, 0, (LPVOID) Item.lParam);
|
|
|
|
|
}
|
|
|
|
|
HeapFree(hProcessHeap, 0, (LPVOID) pDeviceStatusText);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
|
SelectWayPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
2009-01-16 14:28:07 +00:00
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
|
2009-01-16 15:21:32 +00:00
|
|
|
|
if (SendDlgItemMessage(hwndDlg, IDC_AUTOINSTALL, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_MANUALLYINST, BM_SETCHECK, 0, 0);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_AUTOINSTALL, BM_SETCHECK, 1, 1);
|
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_MANUALLYINST, BM_SETCHECK, 0, 0);
|
|
|
|
|
}
|
2009-01-16 14:28:07 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PSN_WIZNEXT:
|
|
|
|
|
{
|
|
|
|
|
if (SendDlgItemMessage(hwndDlg, IDC_AUTOINSTALL, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_PROGRESSPAGE);
|
2009-01-16 14:28:07 +00:00
|
|
|
|
else
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_HWTYPESPAGE);
|
2009-01-16 14:28:07 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-08 14:24:45 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
|
DevStatusPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
|
{
|
|
|
|
|
/* Set title font */
|
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
2009-01-16 16:53:32 +00:00
|
|
|
|
/* Set status text */
|
|
|
|
|
SetWindowText(GetDlgItem(hwndDlg, IDC_HWSTATUSEDIT), pDeviceStatusText);
|
|
|
|
|
|
2009-01-08 14:24:45 +00:00
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH | PSWIZB_BACK);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PSN_WIZBACK:
|
|
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_PROBELISTPAGE);
|
2009-01-07 13:50:54 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-16 15:21:32 +00:00
|
|
|
|
static INT
|
|
|
|
|
EnumDeviceClasses(INT ClassIndex,
|
|
|
|
|
LPWSTR DevClassName,
|
|
|
|
|
LPWSTR DevClassDesc,
|
|
|
|
|
BOOL *DevPresent,
|
|
|
|
|
INT *ClassImage)
|
|
|
|
|
{
|
|
|
|
|
GUID ClassGuid;
|
|
|
|
|
HKEY KeyClass;
|
|
|
|
|
WCHAR ClassName[MAX_STR_SIZE];
|
|
|
|
|
DWORD RequiredSize = MAX_STR_SIZE;
|
|
|
|
|
UINT Ret;
|
|
|
|
|
|
|
|
|
|
*DevPresent = FALSE;
|
|
|
|
|
*DevClassName = L'\0';
|
|
|
|
|
|
|
|
|
|
Ret = CM_Enumerate_Classes(ClassIndex,
|
|
|
|
|
&ClassGuid,
|
|
|
|
|
0);
|
|
|
|
|
if (Ret != CR_SUCCESS)
|
|
|
|
|
{
|
2011-11-29 14:55:58 +00:00
|
|
|
|
/* All classes enumerated */
|
2009-01-16 15:21:32 +00:00
|
|
|
|
if(Ret == CR_NO_SUCH_VALUE)
|
|
|
|
|
{
|
|
|
|
|
hDevInfoTypes = NULL;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Ret == CR_INVALID_DATA)
|
|
|
|
|
{
|
2011-11-29 14:55:58 +00:00
|
|
|
|
; /* FIXME: What should we do here? */
|
2009-01-16 15:21:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
|
/* Handle other errors... */
|
2009-01-16 15:21:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SetupDiClassNameFromGuid(&ClassGuid,
|
|
|
|
|
ClassName,
|
|
|
|
|
RequiredSize,
|
|
|
|
|
&RequiredSize))
|
|
|
|
|
{
|
|
|
|
|
lstrcpy(DevClassName, ClassName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!SetupDiGetClassImageIndex(&ImageListData,
|
|
|
|
|
&ClassGuid,
|
|
|
|
|
ClassImage))
|
|
|
|
|
{
|
2011-11-29 14:55:58 +00:00
|
|
|
|
/* FIXME: Can we do this?
|
2009-01-16 15:21:32 +00:00
|
|
|
|
* Set the blank icon: IDI_SETUPAPI_BLANK = 41
|
2011-11-29 14:55:58 +00:00
|
|
|
|
* It'll be image 24 in the imagelist */
|
2009-01-16 15:21:32 +00:00
|
|
|
|
*ClassImage = 24;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get device info for all devices of a particular class */
|
|
|
|
|
hDevInfoTypes = SetupDiGetClassDevs(&ClassGuid,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
DIGCF_PRESENT);
|
|
|
|
|
if (hDevInfoTypes == INVALID_HANDLE_VALUE)
|
|
|
|
|
{
|
|
|
|
|
hDevInfoTypes = NULL;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KeyClass = SetupDiOpenClassRegKeyEx(&ClassGuid,
|
|
|
|
|
MAXIMUM_ALLOWED,
|
|
|
|
|
DIOCR_INSTALLER,
|
|
|
|
|
NULL,
|
|
|
|
|
0);
|
|
|
|
|
if (KeyClass != INVALID_HANDLE_VALUE)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
LONG dwSize = MAX_STR_SIZE;
|
|
|
|
|
|
|
|
|
|
if (RegQueryValue(KeyClass,
|
|
|
|
|
NULL,
|
|
|
|
|
DevClassDesc,
|
|
|
|
|
&dwSize) != ERROR_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
*DevClassDesc = L'\0';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return -3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*DevPresent = TRUE;
|
|
|
|
|
|
|
|
|
|
RegCloseKey(KeyClass);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static VOID
|
|
|
|
|
InitHardWareTypesPage(HWND hwndDlg)
|
|
|
|
|
{
|
|
|
|
|
HWND hList = GetDlgItem(hwndDlg, IDC_HWTYPESLIST);
|
|
|
|
|
WCHAR DevName[MAX_STR_SIZE];
|
|
|
|
|
WCHAR DevDesc[MAX_STR_SIZE];
|
|
|
|
|
BOOL DevExist = FALSE;
|
|
|
|
|
INT ClassRet, DevImage, Index = 0;
|
|
|
|
|
LV_COLUMN Column;
|
|
|
|
|
LV_ITEM Item;
|
|
|
|
|
RECT Rect;
|
|
|
|
|
|
|
|
|
|
if (!hList) return;
|
|
|
|
|
|
|
|
|
|
ZeroMemory(&Column, sizeof(LV_COLUMN));
|
|
|
|
|
|
|
|
|
|
GetClientRect(hList, &Rect);
|
|
|
|
|
|
|
|
|
|
Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
|
|
|
|
|
Column.fmt = LVCFMT_LEFT;
|
|
|
|
|
Column.iSubItem = 0;
|
|
|
|
|
Column.pszText = NULL;
|
|
|
|
|
Column.cx = Rect.right - GetSystemMetrics(SM_CXVSCROLL);
|
|
|
|
|
(VOID) ListView_InsertColumn(hList, 0, &Column);
|
|
|
|
|
|
|
|
|
|
ZeroMemory(&Item, sizeof(LV_ITEM));
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
ClassRet = EnumDeviceClasses(Index,
|
|
|
|
|
DevName,
|
|
|
|
|
DevDesc,
|
|
|
|
|
&DevExist,
|
|
|
|
|
&DevImage);
|
|
|
|
|
|
|
|
|
|
if ((ClassRet != -1) && (DevExist))
|
|
|
|
|
{
|
|
|
|
|
Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
|
|
|
|
|
Item.iItem = Index;
|
|
|
|
|
Item.iImage = DevImage;
|
|
|
|
|
|
|
|
|
|
if (DevDesc[0] != L'\0')
|
|
|
|
|
Item.pszText = (LPWSTR) DevDesc;
|
|
|
|
|
else
|
|
|
|
|
Item.pszText = (LPWSTR) DevName;
|
|
|
|
|
|
|
|
|
|
(VOID) ListView_InsertItem(hList, &Item);
|
|
|
|
|
|
2011-11-29 14:55:58 +00:00
|
|
|
|
/* Kill InfoList initialized in EnumDeviceClasses */
|
2009-01-16 15:21:32 +00:00
|
|
|
|
if (hDevInfoTypes)
|
|
|
|
|
{
|
|
|
|
|
SetupDiDestroyDeviceInfoList(hDevInfoTypes);
|
|
|
|
|
hDevInfoTypes = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Index++;
|
|
|
|
|
}
|
|
|
|
|
while (ClassRet != -1);
|
|
|
|
|
|
|
|
|
|
(VOID) ListView_SetImageList(hList, ImageListData.ImageList, LVSIL_SMALL);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-16 14:28:07 +00:00
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
|
HdTypesPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
2009-01-16 15:21:32 +00:00
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
|
{
|
|
|
|
|
InitHardWareTypesPage(hwndDlg);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2009-01-16 14:28:07 +00:00
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PSN_WIZBACK:
|
|
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTWAYPAGE);
|
2009-01-16 14:28:07 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
|
ProgressPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
|
{
|
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
|
{
|
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PSN_WIZBACK:
|
|
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTWAYPAGE);
|
2009-01-16 14:28:07 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-14 11:06:57 +00:00
|
|
|
|
static int CALLBACK
|
|
|
|
|
PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
// NOTE: This callback is needed to set large icon correctly.
|
|
|
|
|
HICON hIcon;
|
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
|
|
|
|
case PSCB_INITIALIZED:
|
|
|
|
|
{
|
|
|
|
|
hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_CPLICON));
|
|
|
|
|
SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
static VOID
|
|
|
|
|
HardwareWizardInit(HWND hwnd)
|
|
|
|
|
{
|
2009-01-16 14:28:07 +00:00
|
|
|
|
HPROPSHEETPAGE ahpsp[10];
|
2009-01-06 18:32:51 +00:00
|
|
|
|
PROPSHEETPAGE psp = {0};
|
|
|
|
|
PROPSHEETHEADER psh;
|
|
|
|
|
UINT nPages = 0;
|
|
|
|
|
|
|
|
|
|
/* Create the Start page, until setup is working */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
|
|
|
|
psp.pfnDlgProc = StartPageDlgProc;
|
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_STARTPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
|
|
|
|
/* Create search page */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SEARCHTITLE);
|
|
|
|
|
psp.pszHeaderSubTitle = NULL;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
|
|
|
|
psp.pfnDlgProc = SearchPageDlgProc;
|
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_SEARCHPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
|
|
|
|
/* Create is connected page */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_ISCONNECTED);
|
|
|
|
|
psp.pszHeaderSubTitle = NULL;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
2016-11-12 21:53:33 +00:00
|
|
|
|
psp.pfnDlgProc = IsConnectedPageDlgProc;
|
2009-01-06 18:32:51 +00:00
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_ISCONNECTEDPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
2009-01-07 13:50:54 +00:00
|
|
|
|
/* Create probe list page */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROBELISTTITLE);
|
|
|
|
|
psp.pszHeaderSubTitle = NULL;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
|
|
|
|
psp.pfnDlgProc = ProbeListPageDlgProc;
|
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROBELISTPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
2009-01-08 14:24:45 +00:00
|
|
|
|
/* Create select search way page */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SELECTWAYTITLE);
|
|
|
|
|
psp.pszHeaderSubTitle = NULL;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
|
|
|
|
psp.pfnDlgProc = SelectWayPageDlgProc;
|
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_SELECTWAYPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
|
|
|
|
/* Create device status page */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
|
|
|
|
psp.pfnDlgProc = DevStatusPageDlgProc;
|
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_HWSTATUSPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
2009-01-16 14:28:07 +00:00
|
|
|
|
/* Create hardware types page */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_HDTYPESTITLE);
|
|
|
|
|
psp.pszHeaderSubTitle = NULL;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
|
|
|
|
psp.pfnDlgProc = HdTypesPageDlgProc;
|
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_HWTYPESPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
|
|
|
|
/* Create progress page */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SEARCHTITLE);
|
|
|
|
|
psp.pszHeaderSubTitle = NULL;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
|
|
|
|
psp.pfnDlgProc = ProgressPageDlgProc;
|
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROGRESSPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
/* Create finish page */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
|
|
|
|
psp.pfnDlgProc = FinishPageDlgProc;
|
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
2009-01-07 13:50:54 +00:00
|
|
|
|
/* Create not connected page */
|
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
|
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
|
psp.lParam = 0;
|
|
|
|
|
psp.pfnDlgProc = NotConnectedPageDlgProc;
|
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_NOTCONNECTEDPAGE);
|
|
|
|
|
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
/* Create the property sheet */
|
|
|
|
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
2018-12-14 11:06:57 +00:00
|
|
|
|
psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER | PSH_USEICONID | PSH_USECALLBACK;
|
2009-01-06 18:32:51 +00:00
|
|
|
|
psh.hInstance = hApplet;
|
2018-12-14 11:06:57 +00:00
|
|
|
|
psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON);
|
2009-01-07 10:58:29 +00:00
|
|
|
|
psh.hwndParent = hwnd;
|
2009-01-06 18:32:51 +00:00
|
|
|
|
psh.nPages = nPages;
|
|
|
|
|
psh.nStartPage = 0;
|
|
|
|
|
psh.phpage = ahpsp;
|
|
|
|
|
psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
|
|
|
|
|
psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
|
2018-12-14 11:06:57 +00:00
|
|
|
|
psh.pfnCallback = PropSheetProc;
|
2009-01-06 18:32:51 +00:00
|
|
|
|
|
2009-01-06 21:19:50 +00:00
|
|
|
|
/* Create title font */
|
|
|
|
|
hTitleFont = CreateTitleFont();
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
/* Display the wizard */
|
|
|
|
|
PropertySheet(&psh);
|
2009-01-06 21:19:50 +00:00
|
|
|
|
|
|
|
|
|
DeleteObject(hTitleFont);
|
2005-10-03 07:48:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-01-07 10:58:29 +00:00
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
|
InstallNewDevice(HWND hwndParent, LPGUID ClassGuid, PDWORD pReboot)
|
|
|
|
|
{
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VOID WINAPI
|
2009-01-06 19:28:04 +00:00
|
|
|
|
AddHardwareWizard(HWND hwnd, LPWSTR lpName)
|
2009-01-06 18:32:51 +00:00
|
|
|
|
{
|
2009-01-06 19:28:04 +00:00
|
|
|
|
if (lpName != NULL)
|
|
|
|
|
{
|
|
|
|
|
DPRINT1("No support of remote installation yet!\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-06 18:32:51 +00:00
|
|
|
|
HardwareWizardInit(hwnd);
|
|
|
|
|
}
|
2007-09-16 13:38:26 +00:00
|
|
|
|
|
2005-10-03 07:48:59 +00:00
|
|
|
|
/* Control Panel Callback */
|
|
|
|
|
LONG CALLBACK
|
2009-01-07 10:58:29 +00:00
|
|
|
|
CPlApplet(HWND hwndCpl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
2005-10-03 07:48:59 +00:00
|
|
|
|
{
|
2007-09-16 13:38:26 +00:00
|
|
|
|
switch (uMsg)
|
|
|
|
|
{
|
|
|
|
|
case CPL_INIT:
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
case CPL_GETCOUNT:
|
2009-01-06 18:32:51 +00:00
|
|
|
|
return 1;
|
2007-09-16 13:38:26 +00:00
|
|
|
|
|
|
|
|
|
case CPL_INQUIRE:
|
|
|
|
|
{
|
|
|
|
|
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
|
|
|
|
CPlInfo->lData = 0;
|
2009-01-06 18:32:51 +00:00
|
|
|
|
CPlInfo->idIcon = IDI_CPLICON;
|
|
|
|
|
CPlInfo->idName = IDS_CPLNAME;
|
|
|
|
|
CPlInfo->idInfo = IDS_CPLDESCRIPTION;
|
2007-09-16 13:38:26 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CPL_DBLCLK:
|
2009-01-06 18:32:51 +00:00
|
|
|
|
AddHardwareWizard(hwndCpl, NULL);
|
2007-09-16 13:38:26 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
2005-10-03 07:48:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
|
DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
|
|
|
|
|
{
|
2007-09-16 13:38:26 +00:00
|
|
|
|
UNREFERENCED_PARAMETER(lpvReserved);
|
|
|
|
|
|
|
|
|
|
switch (dwReason)
|
|
|
|
|
{
|
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
|
hApplet = hinstDLL;
|
2009-01-08 14:24:45 +00:00
|
|
|
|
hProcessHeap = GetProcessHeap();
|
2009-01-07 10:58:29 +00:00
|
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
2007-09-16 13:38:26 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
2005-10-03 07:48:59 +00:00
|
|
|
|
}
|