mirror of
https://github.com/reactos/reactos.git
synced 2025-01-13 01:22:03 +00:00
- display whether the device is enabled or disabled
- add the remaining missing device node status codes svn path=/trunk/; revision=19798
This commit is contained in:
parent
b0ce233169
commit
0d56435485
6 changed files with 482 additions and 176 deletions
|
@ -12,6 +12,9 @@ BEGIN
|
|||
IDS_UNKNOWN "Unknown"
|
||||
IDS_LOCATIONSTR "Location %1!u! (%2)"
|
||||
IDS_DEVCODE " (Code %1!u!)"
|
||||
IDS_ENABLEDEVICE "Use this device (enable)"
|
||||
IDS_DISABLEDEVICE "Do not use this device (disable)"
|
||||
IDS_UNKNOWNDEVICE "Unknown device"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
@ -100,6 +103,6 @@ BEGIN
|
|||
GROUPBOX "Device status", IDC_DEVSTATUSGROUP, 7, 83, 238, 100
|
||||
EDITTEXT IDC_DEVSTATUS, 14, 96, 224, 61, NOT WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
|
||||
PUSHBUTTON "&Troubleshoot...", IDC_TROUBLESHOOT, 148, 163, 90, 15
|
||||
LTEXT "&Device usage:", -1, 7, 188, 222, 8
|
||||
COMBOBOX IDC_DEVUSAGE, 7, 198, 239, 40, CBS_DROPDOWNLIST | WS_VSCROLL
|
||||
LTEXT "&Device usage:", IDC_DEVUSAGELABEL, 7, 188, 222, 8, WS_DISABLED
|
||||
COMBOBOX IDC_DEVUSAGE, 7, 198, 239, 40, CBS_DROPDOWNLIST | WS_VSCROLL | WS_DISABLED
|
||||
END
|
||||
|
|
|
@ -34,17 +34,282 @@ typedef INT_PTR (WINAPI *PPROPERTYSHEETW)(LPCPROPSHEETHEADERW);
|
|||
typedef HPROPSHEETPAGE (WINAPI *PCREATEPROPERTYSHEETPAGEW)(LPCPROPSHEETPAGEW);
|
||||
typedef BOOL (WINAPI *PDESTROYPROPERTYSHEETPAGE)(HPROPSHEETPAGE);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DEA_DISABLE = 0,
|
||||
DEA_ENABLE,
|
||||
DEA_UNKNOWN
|
||||
} DEVENABLEACTION;
|
||||
|
||||
typedef struct _DEVADVPROP_INFO
|
||||
{
|
||||
HDEVINFO DeviceInfoSet;
|
||||
PSP_DEVINFO_DATA DeviceInfoData;
|
||||
HINSTANCE hComCtl32;
|
||||
HANDLE hMachine;
|
||||
BOOL CanDisable;
|
||||
BOOL DeviceEnabled;
|
||||
WCHAR szDevName[255];
|
||||
WCHAR szTemp[255];
|
||||
} DEVADVPROP_INFO, *PDEVADVPROP_INFO;
|
||||
|
||||
|
||||
static VOID
|
||||
InitDevUsageActions(IN HWND hwndDlg,
|
||||
IN HWND hComboBox,
|
||||
IN PDEVADVPROP_INFO dap)
|
||||
{
|
||||
INT Index;
|
||||
UINT i;
|
||||
struct
|
||||
{
|
||||
UINT szId;
|
||||
DEVENABLEACTION Action;
|
||||
} Actions[] =
|
||||
{
|
||||
{IDS_ENABLEDEVICE, DEA_ENABLE},
|
||||
{IDS_DISABLEDEVICE, DEA_DISABLE},
|
||||
};
|
||||
|
||||
for (i = 0;
|
||||
i != sizeof(Actions) / sizeof(Actions[0]);
|
||||
i++)
|
||||
{
|
||||
/* fill in the device usage combo box */
|
||||
if (LoadString(hDllInstance,
|
||||
Actions[i].szId,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
|
||||
{
|
||||
Index = (INT)SendMessage(hComboBox,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)dap->szTemp);
|
||||
if (Index != CB_ERR)
|
||||
{
|
||||
SendMessage(hComboBox,
|
||||
CB_SETITEMDATA,
|
||||
(WPARAM)Index,
|
||||
(LPARAM)Actions[i].Action);
|
||||
|
||||
switch (Actions[i].Action)
|
||||
{
|
||||
case DEA_ENABLE:
|
||||
if (dap->DeviceEnabled)
|
||||
{
|
||||
SendMessage(hComboBox,
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)Index,
|
||||
0);
|
||||
}
|
||||
break;
|
||||
|
||||
case DEA_DISABLE:
|
||||
if (!dap->DeviceEnabled)
|
||||
{
|
||||
SendMessage(hComboBox,
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)Index,
|
||||
0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static DEVENABLEACTION
|
||||
GetSelectedUsageAction(IN HWND hComboBox)
|
||||
{
|
||||
INT Index;
|
||||
DEVENABLEACTION Ret = DEA_UNKNOWN;
|
||||
|
||||
Index = (INT)SendMessage(hComboBox,
|
||||
CB_GETCURSEL,
|
||||
0,
|
||||
0);
|
||||
if (Index != CB_ERR)
|
||||
{
|
||||
INT iRet = SendMessage(hComboBox,
|
||||
CB_GETITEMDATA,
|
||||
(WPARAM)Index,
|
||||
0);
|
||||
if (iRet != CB_ERR && iRet < (INT)DEA_UNKNOWN)
|
||||
{
|
||||
Ret = (DEVENABLEACTION)iRet;
|
||||
}
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
ApplyGeneralSettings(IN HWND hwndDlg,
|
||||
IN PDEVADVPROP_INFO dap)
|
||||
{
|
||||
DEVENABLEACTION SelectedUsageAction;
|
||||
|
||||
SelectedUsageAction = GetSelectedUsageAction(GetDlgItem(hwndDlg,
|
||||
IDC_DEVUSAGE));
|
||||
if (SelectedUsageAction != DEA_UNKNOWN)
|
||||
{
|
||||
switch (SelectedUsageAction)
|
||||
{
|
||||
case DEA_ENABLE:
|
||||
if (!dap->DeviceEnabled)
|
||||
{
|
||||
/* FIXME - enable device */
|
||||
}
|
||||
break;
|
||||
|
||||
case DEA_DISABLE:
|
||||
if (dap->DeviceEnabled)
|
||||
{
|
||||
/* FIXME - disable device */
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* disable the apply button */
|
||||
PropSheet_UnChanged(GetParent(hwndDlg),
|
||||
hwndDlg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
UpdateDevInfo(IN HWND hwndDlg,
|
||||
IN PDEVADVPROP_INFO dap)
|
||||
{
|
||||
HICON hIcon;
|
||||
HWND hDevUsage;
|
||||
|
||||
/* get the device name */
|
||||
if (GetDeviceDescriptionString(dap->DeviceInfoSet,
|
||||
dap->DeviceInfoData,
|
||||
dap->szDevName,
|
||||
sizeof(dap->szDevName) / sizeof(dap->szDevName[0])))
|
||||
{
|
||||
PropSheet_SetTitle(GetParent(hwndDlg),
|
||||
PSH_PROPTITLE,
|
||||
dap->szDevName);
|
||||
}
|
||||
|
||||
/* set the device image */
|
||||
if (SetupDiLoadClassIcon(&dap->DeviceInfoData->ClassGuid,
|
||||
&hIcon,
|
||||
NULL))
|
||||
{
|
||||
HICON hOldIcon = (HICON)SendDlgItemMessage(hwndDlg,
|
||||
IDC_DEVICON,
|
||||
STM_SETICON,
|
||||
(WPARAM)hIcon,
|
||||
0);
|
||||
if (hOldIcon != NULL)
|
||||
{
|
||||
DestroyIcon(hOldIcon);
|
||||
}
|
||||
}
|
||||
|
||||
/* set the device name edit control text */
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVNAME,
|
||||
dap->szDevName);
|
||||
|
||||
/* set the device type edit control text */
|
||||
if (GetDeviceTypeString(dap->DeviceInfoData,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
|
||||
{
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVTYPE,
|
||||
dap->szTemp);
|
||||
}
|
||||
|
||||
/* set the device manufacturer edit control text */
|
||||
if (GetDeviceManufacturerString(dap->DeviceInfoSet,
|
||||
dap->DeviceInfoData,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
|
||||
{
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVMANUFACTURER,
|
||||
dap->szTemp);
|
||||
}
|
||||
|
||||
/* set the device location edit control text */
|
||||
if (GetDeviceLocationString(dap->DeviceInfoData->DevInst,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
|
||||
{
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVLOCATION,
|
||||
dap->szTemp);
|
||||
}
|
||||
|
||||
/* set the device status edit control text */
|
||||
if (GetDeviceStatusString(dap->DeviceInfoData->DevInst,
|
||||
dap->hMachine,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
|
||||
{
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVSTATUS,
|
||||
dap->szTemp);
|
||||
}
|
||||
|
||||
/* check if the device can be enabled/disabled */
|
||||
hDevUsage = GetDlgItem(hwndDlg,
|
||||
IDC_DEVUSAGE);
|
||||
|
||||
if (!CanDisableDevice(dap->DeviceInfoData->DevInst,
|
||||
dap->hMachine,
|
||||
&dap->CanDisable))
|
||||
{
|
||||
dap->CanDisable = FALSE;
|
||||
}
|
||||
|
||||
if (!IsDeviceEnabled(dap->DeviceInfoData->DevInst,
|
||||
dap->hMachine,
|
||||
&dap->DeviceEnabled))
|
||||
{
|
||||
dap->DeviceEnabled = FALSE;
|
||||
}
|
||||
|
||||
/* enable/disable the device usage controls */
|
||||
EnableWindow(GetDlgItem(hwndDlg,
|
||||
IDC_DEVUSAGELABEL),
|
||||
dap->CanDisable);
|
||||
EnableWindow(hDevUsage,
|
||||
dap->CanDisable);
|
||||
|
||||
/* clear the combobox */
|
||||
SendMessage(hDevUsage,
|
||||
CB_RESETCONTENT,
|
||||
0,
|
||||
0);
|
||||
if (dap->CanDisable)
|
||||
{
|
||||
InitDevUsageActions(hwndDlg,
|
||||
hDevUsage,
|
||||
dap);
|
||||
}
|
||||
|
||||
/* finally, disable the apply button */
|
||||
PropSheet_UnChanged(GetParent(hwndDlg),
|
||||
hwndDlg);
|
||||
}
|
||||
|
||||
|
||||
static INT_PTR
|
||||
CALLBACK
|
||||
AdvPropGeneralDlgProc(IN HWND hwndDlg,
|
||||
|
@ -62,80 +327,60 @@ AdvPropGeneralDlgProc(IN HWND hwndDlg,
|
|||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_DEVUSAGE:
|
||||
{
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
PropSheet_Changed(GetParent(hwndDlg),
|
||||
hwndDlg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
NMHDR *hdr = (NMHDR*)lParam;
|
||||
switch (hdr->code)
|
||||
{
|
||||
case PSN_APPLY:
|
||||
ApplyGeneralSettings(hwndDlg,
|
||||
dap);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
dap = (PDEVADVPROP_INFO)((LPPROPSHEETPAGE)lParam)->lParam;
|
||||
if (dap != NULL)
|
||||
{
|
||||
HICON hIcon;
|
||||
|
||||
SetWindowLongPtr(hwndDlg,
|
||||
DWL_USER,
|
||||
(DWORD_PTR)dap);
|
||||
|
||||
/* set the device image */
|
||||
if (SetupDiLoadClassIcon(&dap->DeviceInfoData->ClassGuid,
|
||||
&hIcon,
|
||||
NULL))
|
||||
{
|
||||
SendDlgItemMessage(hwndDlg,
|
||||
IDC_DEVICON,
|
||||
STM_SETICON,
|
||||
(WPARAM)hIcon,
|
||||
0);
|
||||
}
|
||||
|
||||
/* set the device name edit control text */
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVNAME,
|
||||
dap->szDevName);
|
||||
|
||||
/* set the device type edit control text */
|
||||
if (GetDeviceTypeString(dap->DeviceInfoData,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
|
||||
{
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVTYPE,
|
||||
dap->szTemp);
|
||||
}
|
||||
|
||||
/* set the device manufacturer edit control text */
|
||||
if (GetDeviceManufacturerString(dap->DeviceInfoSet,
|
||||
dap->DeviceInfoData,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
|
||||
{
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVMANUFACTURER,
|
||||
dap->szTemp);
|
||||
}
|
||||
|
||||
/* set the device location edit control text */
|
||||
if (GetDeviceLocationString(dap->DeviceInfoData->DevInst,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
|
||||
{
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVLOCATION,
|
||||
dap->szTemp);
|
||||
}
|
||||
|
||||
/* set the device status edit control text */
|
||||
if (GetDeviceStatusString(dap->DeviceInfoData->DevInst,
|
||||
dap->hMachine,
|
||||
dap->szTemp,
|
||||
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
|
||||
{
|
||||
SetDlgItemText(hwndDlg,
|
||||
IDC_DEVSTATUS,
|
||||
dap->szTemp);
|
||||
}
|
||||
UpdateDevInfo(hwndDlg,
|
||||
dap);
|
||||
}
|
||||
Ret = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DEVICECHANGE:
|
||||
{
|
||||
/* FIXME - don't call UpdateDevInfo in all events */
|
||||
UpdateDevInfo(hwndDlg,
|
||||
dap);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
{
|
||||
HICON hDevIcon;
|
||||
|
@ -221,104 +466,97 @@ DisplayDeviceAdvancedProperties(IN HWND hWndParent,
|
|||
DevAdvPropInfo->hMachine = hMachine;
|
||||
DevAdvPropInfo->szDevName[0] = L'\0';
|
||||
|
||||
/* get the device name */
|
||||
if (GetDeviceDescriptionString(DeviceInfoSet,
|
||||
DeviceInfoData,
|
||||
DevAdvPropInfo->szDevName,
|
||||
sizeof(DevAdvPropInfo->szDevName) / sizeof(DevAdvPropInfo->szDevName[0])))
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPTITLE | PSH_NOAPPLYNOW;
|
||||
psh.hwndParent = hWndParent;
|
||||
psh.pszCaption = DevAdvPropInfo->szDevName;
|
||||
|
||||
PropertySheetType = lpMachineName != NULL ?
|
||||
DIGCDP_FLAG_REMOTE_ADVANCED :
|
||||
DIGCDP_FLAG_ADVANCED;
|
||||
|
||||
/* find out how many property sheets we need */
|
||||
if (SetupDiGetClassDevPropertySheets(DeviceInfoSet,
|
||||
DeviceInfoData,
|
||||
&psh,
|
||||
0,
|
||||
&nPropSheets,
|
||||
PropertySheetType) &&
|
||||
nPropSheets != 0)
|
||||
{
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPTITLE;
|
||||
psh.hwndParent = hWndParent;
|
||||
psh.pszCaption = DevAdvPropInfo->szDevName;
|
||||
DPRINT1("SetupDiGetClassDevPropertySheets unexpectedly returned TRUE!\n");
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
PropertySheetType = lpMachineName != NULL ?
|
||||
DIGCDP_FLAG_REMOTE_ADVANCED :
|
||||
DIGCDP_FLAG_ADVANCED;
|
||||
if (nPropSheets != 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* find out how many property sheets we need */
|
||||
if (SetupDiGetClassDevPropertySheets(DeviceInfoSet,
|
||||
DeviceInfoData,
|
||||
&psh,
|
||||
0,
|
||||
&nPropSheets,
|
||||
PropertySheetType) &&
|
||||
nPropSheets != 0)
|
||||
{
|
||||
DPRINT1("SetupDiGetClassDevPropertySheets unexpectedly returned TRUE!\n");
|
||||
goto Cleanup;
|
||||
}
|
||||
psh.phpage = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
(nPropSheets + 1) * sizeof(HPROPSHEETPAGE));
|
||||
if (psh.phpage == NULL)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if (nPropSheets != 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
/* add the "General" property sheet */
|
||||
pspGeneral.dwSize = sizeof(PROPSHEETPAGE);
|
||||
pspGeneral.dwFlags = PSP_DEFAULT;
|
||||
pspGeneral.hInstance = hDllInstance;
|
||||
pspGeneral.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEGENERAL);
|
||||
pspGeneral.pfnDlgProc = AdvPropGeneralDlgProc;
|
||||
pspGeneral.lParam = (LPARAM)DevAdvPropInfo;
|
||||
psh.phpage[0] = pCreatePropertySheetPageW(&pspGeneral);
|
||||
if (psh.phpage[0] != NULL)
|
||||
{
|
||||
psh.nPages++;
|
||||
}
|
||||
|
||||
if (nPropSheets != 0)
|
||||
{
|
||||
/* create the device property sheets */
|
||||
if (!SetupDiGetClassDevPropertySheets(DeviceInfoSet,
|
||||
DeviceInfoData,
|
||||
&psh,
|
||||
nPropSheets + psh.nPages,
|
||||
NULL,
|
||||
PropertySheetType))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
psh.phpage = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
(nPropSheets + 1) * sizeof(HPROPSHEETPAGE));
|
||||
if (psh.phpage == NULL)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
/* FIXME - add the "Driver" property sheet if necessary */
|
||||
|
||||
/* add the "General" property sheet */
|
||||
pspGeneral.dwSize = sizeof(PROPSHEETPAGE);
|
||||
pspGeneral.dwFlags = PSP_DEFAULT;
|
||||
pspGeneral.hInstance = hDllInstance;
|
||||
pspGeneral.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEGENERAL);
|
||||
pspGeneral.pfnDlgProc = AdvPropGeneralDlgProc;
|
||||
pspGeneral.lParam = (LPARAM)DevAdvPropInfo;
|
||||
psh.phpage[0] = pCreatePropertySheetPageW(&pspGeneral);
|
||||
if (psh.phpage[0] != NULL)
|
||||
{
|
||||
psh.nPages++;
|
||||
}
|
||||
if (psh.nPages != 0)
|
||||
{
|
||||
Ret = pPropertySheetW(&psh);
|
||||
|
||||
if (nPropSheets != 0)
|
||||
{
|
||||
/* create the device property sheets */
|
||||
if (!SetupDiGetClassDevPropertySheets(DeviceInfoSet,
|
||||
DeviceInfoData,
|
||||
&psh,
|
||||
nPropSheets + psh.nPages,
|
||||
NULL,
|
||||
PropertySheetType))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME - add the "Driver" property sheet if necessary */
|
||||
|
||||
if (psh.nPages != 0)
|
||||
{
|
||||
Ret = pPropertySheetW(&psh);
|
||||
|
||||
/* NOTE: no need to destroy the property sheets anymore! */
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT i;
|
||||
/* NOTE: no need to destroy the property sheets anymore! */
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT i;
|
||||
|
||||
Cleanup:
|
||||
/* in case of failure the property sheets must be destroyed */
|
||||
for (i = 0;
|
||||
i < psh.nPages;
|
||||
i++)
|
||||
/* in case of failure the property sheets must be destroyed */
|
||||
for (i = 0;
|
||||
i < psh.nPages;
|
||||
i++)
|
||||
{
|
||||
if (psh.phpage[i] != NULL)
|
||||
{
|
||||
if (psh.phpage[i] != NULL)
|
||||
{
|
||||
pDestroyPropertySheetPage(psh.phpage[i]);
|
||||
}
|
||||
pDestroyPropertySheetPage(psh.phpage[i]);
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(),
|
||||
0,
|
||||
psh.phpage);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(),
|
||||
0,
|
||||
psh.phpage);
|
||||
|
||||
HeapFree(GetProcessHeap(),
|
||||
0,
|
||||
DevAdvPropInfo);
|
||||
|
|
|
@ -439,22 +439,11 @@ GetDeviceStatusString(IN DEVINST DevInst,
|
|||
UINT MessageId = IDS_UNKNOWN;
|
||||
BOOL Ret = FALSE;
|
||||
|
||||
if (hMachine != NULL)
|
||||
{
|
||||
cr = CM_Get_DevNode_Status_Ex(&Status,
|
||||
&ProblemNumber,
|
||||
DevInst,
|
||||
0,
|
||||
hMachine);
|
||||
}
|
||||
else
|
||||
{
|
||||
cr = CM_Get_DevNode_Status(&Status,
|
||||
&ProblemNumber,
|
||||
DevInst,
|
||||
0);
|
||||
}
|
||||
|
||||
cr = CM_Get_DevNode_Status_Ex(&Status,
|
||||
&ProblemNumber,
|
||||
DevInst,
|
||||
0,
|
||||
hMachine);
|
||||
if (cr == CR_SUCCESS)
|
||||
{
|
||||
if (ProblemNumber < sizeof(ProblemStringId) / sizeof(ProblemStringId[0]))
|
||||
|
@ -516,22 +505,11 @@ IsDeviceHidden(IN DEVINST DevInst,
|
|||
ULONG Status, ProblemNumber;
|
||||
BOOL Ret = FALSE;
|
||||
|
||||
if (hMachine != NULL)
|
||||
{
|
||||
cr = CM_Get_DevNode_Status_Ex(&Status,
|
||||
&ProblemNumber,
|
||||
DevInst,
|
||||
0,
|
||||
hMachine);
|
||||
}
|
||||
else
|
||||
{
|
||||
cr = CM_Get_DevNode_Status(&Status,
|
||||
&ProblemNumber,
|
||||
DevInst,
|
||||
0);
|
||||
}
|
||||
|
||||
cr = CM_Get_DevNode_Status_Ex(&Status,
|
||||
&ProblemNumber,
|
||||
DevInst,
|
||||
0,
|
||||
hMachine);
|
||||
if (cr == CR_SUCCESS)
|
||||
{
|
||||
*IsHidden = ((Status & DN_NO_SHOW_IN_DM) != 0);
|
||||
|
@ -542,6 +520,54 @@ IsDeviceHidden(IN DEVINST DevInst,
|
|||
}
|
||||
|
||||
|
||||
BOOL
|
||||
CanDisableDevice(IN DEVINST DevInst,
|
||||
IN HANDLE hMachine,
|
||||
OUT BOOL *CanDisable)
|
||||
{
|
||||
CONFIGRET cr;
|
||||
ULONG Status, ProblemNumber;
|
||||
BOOL Ret = FALSE;
|
||||
|
||||
cr = CM_Get_DevNode_Status_Ex(&Status,
|
||||
&ProblemNumber,
|
||||
DevInst,
|
||||
0,
|
||||
hMachine);
|
||||
if (cr == CR_SUCCESS)
|
||||
{
|
||||
*CanDisable = ((Status & DN_DISABLEABLE) != 0);
|
||||
Ret = TRUE;
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
IsDeviceEnabled(IN DEVINST DevInst,
|
||||
IN HANDLE hMachine,
|
||||
OUT BOOL *IsEnabled)
|
||||
{
|
||||
CONFIGRET cr;
|
||||
ULONG Status, ProblemNumber;
|
||||
BOOL Ret = FALSE;
|
||||
|
||||
cr = CM_Get_DevNode_Status_Ex(&Status,
|
||||
&ProblemNumber,
|
||||
DevInst,
|
||||
0,
|
||||
hMachine);
|
||||
if (cr == CR_SUCCESS)
|
||||
{
|
||||
*IsEnabled = ((Status & DN_STARTED) != 0);
|
||||
Ret = TRUE;
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData,
|
||||
OUT LPWSTR szBuffer,
|
||||
|
@ -605,7 +631,7 @@ GetDeviceDescriptionString(IN HDEVINFO DeviceInfoSet,
|
|||
{
|
||||
szBuffer[0] = L'\0';
|
||||
if (LoadString(hDllInstance,
|
||||
IDS_UNKNOWN,
|
||||
IDS_UNKNOWNDEVICE,
|
||||
szBuffer,
|
||||
BufferSize))
|
||||
{
|
||||
|
|
|
@ -236,6 +236,16 @@ IsDeviceHidden(IN DEVINST DevInst,
|
|||
IN HANDLE hMachine,
|
||||
OUT BOOL *IsHidden);
|
||||
|
||||
BOOL
|
||||
CanDisableDevice(IN DEVINST DevInst,
|
||||
IN HANDLE hMachine,
|
||||
OUT BOOL *CanDisable);
|
||||
|
||||
BOOL
|
||||
IsDeviceEnabled(IN DEVINST DevInst,
|
||||
IN HANDLE hMachine,
|
||||
OUT BOOL *IsEnabled);
|
||||
|
||||
BOOL
|
||||
GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData,
|
||||
OUT LPWSTR szBuffer,
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define IDC_STATUS 0x586
|
||||
#define IDC_TROUBLESHOOT 0x589
|
||||
#define IDC_PROPERTIES 0x58A
|
||||
#define IDC_DEVUSAGELABEL 0x58B
|
||||
|
||||
|
||||
#define IDS_NAME 0x100
|
||||
|
@ -32,6 +33,9 @@
|
|||
#define IDS_UNKNOWN 0x105
|
||||
#define IDS_LOCATIONSTR 0x106
|
||||
#define IDS_DEVCODE 0x107
|
||||
#define IDS_ENABLEDEVICE 0x108
|
||||
#define IDS_DISABLEDEVICE 0x109
|
||||
#define IDS_UNKNOWNDEVICE 0x10A
|
||||
|
||||
#define IDS_DEV_NO_PROBLEM 0x200
|
||||
#define IDS_DEV_NOT_CONFIGURED 0x201
|
||||
|
|
|
@ -212,6 +212,31 @@ extern "C" {
|
|||
#define DMI_MASK 0x00000001
|
||||
#define DMI_BKCOLOR 0x00000002
|
||||
#define DMI_USERECT 0x00000004
|
||||
#define DN_ROOT_ENUMERATED 0x00000001
|
||||
#define DN_DRIVER_LOADED 0x00000002
|
||||
#define DN_ENUM_LOADED 0x00000004
|
||||
#define DN_STARTED 0x00000008
|
||||
#define DN_MANUAL 0x00000010
|
||||
#define DN_NEED_TO_ENUM 0x00000020
|
||||
#define DN_NOT_FIRST_TIME 0x00000040
|
||||
#define DN_HARDWARE_ENUM 0x00000080
|
||||
#define DN_LIAR 0x00000100
|
||||
#define DN_HAS_MARK 0x00000200
|
||||
#define DN_HAS_PROBLEM 0x00000400
|
||||
#define DN_FILTERED 0x00000800
|
||||
#define DN_MOVED 0x00001000
|
||||
#define DN_DISABLEABLE 0x00002000
|
||||
#define DN_REMOVABLE 0x00004000
|
||||
#define DN_PRIVATE_PROBLEM 0x00008000
|
||||
#define DN_MF_PARENT 0x00010000
|
||||
#define DN_MF_CHILD 0x00020000
|
||||
#define DN_WILL_BE_REMOVED 0x00040000
|
||||
#define DN_NOT_FIRST_TIMEE 0x00080000
|
||||
#define DN_STOP_FREE_RES 0x00100000
|
||||
#define DN_REBAL_CANDIDATE 0x00200000
|
||||
#define DN_BAD_PARTIAL 0x00400000
|
||||
#define DN_NT_ENUMERATOR 0x00800000
|
||||
#define DN_NT_DRIVER 0x01000000
|
||||
#define DN_NEEDS_LOCKING 0x02000000
|
||||
#define DN_ARM_WAKEUP 0x04000000
|
||||
#define DN_APM_ENUMERATOR 0x08000000
|
||||
|
|
Loading…
Reference in a new issue