implemented the general device information page

svn path=/trunk/; revision=19646
This commit is contained in:
Thomas Bluemel 2005-11-26 16:54:56 +00:00
parent 520fe4b055
commit c7f5d8268c
6 changed files with 468 additions and 95 deletions

View file

@ -29,3 +29,23 @@ BEGIN
BS_PUSHBUTTON | WS_CHILD | WS_DISABLED | WS_TABSTOP BS_PUSHBUTTON | WS_CHILD | WS_DISABLED | WS_TABSTOP
PUSHBUTTON "P&roperties",IDC_PROPERTIES,146,140,50,14 PUSHBUTTON "P&roperties",IDC_PROPERTIES,146,140,50,14
END END
IDD_DEVICEGENERAL DIALOG DISCARDABLE 0, 0, 252, 218
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "General"
FONT 8, "MS Shell Dlg"
BEGIN
ICON "", IDC_DEVICON, 7, 7, 20, 20
LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX
LTEXT "Device type:", -1, 37, 39, 60, 8, SS_NOPREFIX
EDITTEXT IDC_DEVTYPE, 100, 39, 146, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY
LTEXT "Manufacturer:", -1, 37, 53, 60, 8, SS_NOPREFIX
EDITTEXT IDC_DEVMANUFACTURER, 100, 53, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY
LTEXT "Location:", -1, 37, 67, 60, 8, SS_NOPREFIX
EDITTEXT IDC_DEVLOCATION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY
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_DROPDOWN | WS_VSCROLL
END

View file

@ -31,6 +31,130 @@
#include <debug.h> #include <debug.h>
typedef INT_PTR (WINAPI *PPROPERTYSHEETW)(LPCPROPSHEETHEADERW); typedef INT_PTR (WINAPI *PPROPERTYSHEETW)(LPCPROPSHEETHEADERW);
typedef HPROPSHEETPAGE (WINAPI *PCREATEPROPERTYSHEETPAGEW)(LPCPROPSHEETPAGEW);
typedef BOOL (WINAPI *PDESTROYPROPERTYSHEETPAGE)(HPROPSHEETPAGE);
typedef struct _DEVADVPROP_INFO
{
HDEVINFO DeviceInfoSet;
PSP_DEVINFO_DATA DeviceInfoData;
HINSTANCE hComCtl32;
WCHAR szDevName[255];
WCHAR szTemp[255];
} DEVADVPROP_INFO, *PDEVADVPROP_INFO;
static INT_PTR
CALLBACK
AdvPropGeneralDlgProc(IN HWND hwndDlg,
IN UINT uMsg,
IN WPARAM wParam,
IN LPARAM lParam)
{
PDEVADVPROP_INFO dap;
dap = (PDEVADVPROP_INFO)GetWindowLongPtr(hwndDlg,
DWL_USER);
if (dap != NULL || uMsg == WM_INITDIALOG)
{
switch (uMsg)
{
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->DeviceInfoSet,
dap->DeviceInfoData,
dap->szTemp,
sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
{
SetDlgItemText(hwndDlg,
IDC_DEVSTATUS,
dap->szTemp);
}
}
break;
}
case WM_DESTROY:
{
HICON hDevIcon;
/* destroy the device icon */
hDevIcon = (HICON)SendDlgItemMessage(hwndDlg,
IDC_DEVICON,
STM_GETICON,
0,
0);
if (hDevIcon != NULL)
{
DestroyIcon(hDevIcon);
}
break;
}
}
}
return FALSE;
}
INT_PTR INT_PTR
DisplayDeviceAdvancedProperties(IN HWND hWndParent, DisplayDeviceAdvancedProperties(IN HWND hWndParent,
@ -38,34 +162,74 @@ DisplayDeviceAdvancedProperties(IN HWND hWndParent,
IN PSP_DEVINFO_DATA DeviceInfoData, IN PSP_DEVINFO_DATA DeviceInfoData,
IN HINSTANCE hComCtl32) IN HINSTANCE hComCtl32)
{ {
WCHAR szDevName[255];
DWORD RegDataType; DWORD RegDataType;
PROPSHEETHEADER psh = {0}; PROPSHEETHEADER psh = {0};
PROPSHEETPAGE pspGeneral = {0};
DWORD nPropSheets = 0; DWORD nPropSheets = 0;
DWORD nDevSheetsStart = 0;
PPROPERTYSHEETW pPropertySheetW; PPROPERTYSHEETW pPropertySheetW;
PCREATEPROPERTYSHEETPAGEW pCreatePropertySheetPageW;
PDESTROYPROPERTYSHEETPAGE pDestroyPropertySheetPage;
PDEVADVPROP_INFO DevAdvPropInfo;
UINT nPages = 0;
union
{
ULONG Mask;
struct
{
ULONG General : 1;
ULONG Device : 1;
} Page;
} DelPropSheets = {0};
INT_PTR Ret = -1; INT_PTR Ret = -1;
pPropertySheetW = (PPROPERTYSHEETW)GetProcAddress(hComCtl32, /* we don't want to statically link against comctl32, so find the
"PropertySheetW"); functions we need dynamically */
if (pPropertySheetW == NULL) pPropertySheetW =
(PPROPERTYSHEETW)GetProcAddress(hComCtl32,
"PropertySheetW");
pCreatePropertySheetPageW =
(PCREATEPROPERTYSHEETPAGEW)GetProcAddress(hComCtl32,
"CreatePropertySheetPageW");
pDestroyPropertySheetPage =
(PDESTROYPROPERTYSHEETPAGE)GetProcAddress(hComCtl32,
"DestroyPropertySheetPage");
if (pPropertySheetW == NULL ||
pCreatePropertySheetPageW == NULL ||
pDestroyPropertySheetPage == NULL)
{ {
return -1; return -1;
} }
/* create the internal structure associated with the "General",
"Driver", ... pages */
DevAdvPropInfo = HeapAlloc(GetProcessHeap(),
0,
sizeof(DEVADVPROP_INFO));
if (DevAdvPropInfo == NULL)
{
return -1;
}
DevAdvPropInfo->DeviceInfoSet = DeviceInfoSet;
DevAdvPropInfo->DeviceInfoData = DeviceInfoData;
DevAdvPropInfo->hComCtl32 = hComCtl32;
DevAdvPropInfo->szDevName[0] = L'\0';
/* get the device name */ /* get the device name */
if ((SetupDiGetDeviceRegistryProperty(DeviceInfoSet, if ((SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
DeviceInfoData, DeviceInfoData,
SPDRP_FRIENDLYNAME, SPDRP_FRIENDLYNAME,
&RegDataType, &RegDataType,
(PBYTE)szDevName, (PBYTE)DevAdvPropInfo->szDevName,
sizeof(szDevName), sizeof(DevAdvPropInfo->szDevName),
NULL) || NULL) ||
SetupDiGetDeviceRegistryProperty(DeviceInfoSet, SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
DeviceInfoData, DeviceInfoData,
SPDRP_DEVICEDESC, SPDRP_DEVICEDESC,
&RegDataType, &RegDataType,
(PBYTE)szDevName, (PBYTE)DevAdvPropInfo->szDevName,
sizeof(szDevName), sizeof(DevAdvPropInfo->szDevName),
NULL)) && NULL)) &&
RegDataType == REG_SZ) RegDataType == REG_SZ)
{ {
@ -74,7 +238,7 @@ DisplayDeviceAdvancedProperties(IN HWND hWndParent,
psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPTITLE; psh.dwFlags = PSH_PROPTITLE;
psh.hwndParent = hWndParent; psh.hwndParent = hWndParent;
psh.pszCaption = szDevName; psh.pszCaption = DevAdvPropInfo->szDevName;
/* find out how many property sheets we need */ /* find out how many property sheets we need */
if (SetupDiGetClassDevPropertySheets(DeviceInfoSet, if (SetupDiGetClassDevPropertySheets(DeviceInfoSet,
@ -89,42 +253,100 @@ DisplayDeviceAdvancedProperties(IN HWND hWndParent,
goto Cleanup; goto Cleanup;
} }
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) if (nPropSheets != 0 && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{ {
goto Cleanup; goto Cleanup;
} }
psh.phpage = HeapAlloc(GetProcessHeap(), psh.phpage = HeapAlloc(GetProcessHeap(),
0, HEAP_ZERO_MEMORY,
nPropSheets * sizeof(HPROPSHEETPAGE)); (nPropSheets + 1) * sizeof(HPROPSHEETPAGE));
if (psh.phpage == NULL) if (psh.phpage == NULL)
{ {
goto Cleanup; goto Cleanup;
} }
/* FIXME - add the "General" and "Driver" pages */ /* add the "General" property sheet */
pspGeneral.dwSize = sizeof(PROPSHEETPAGE);
if (!SetupDiGetClassDevPropertySheets(DeviceInfoSet, pspGeneral.dwFlags = PSP_DEFAULT;
DeviceInfoData, pspGeneral.hInstance = hDllInstance;
&psh, pspGeneral.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEGENERAL);
nPropSheets, pspGeneral.pfnDlgProc = AdvPropGeneralDlgProc;
NULL, pspGeneral.lParam = (LPARAM)DevAdvPropInfo;
DIGCDP_FLAG_ADVANCED)) psh.phpage[0] = pCreatePropertySheetPageW(&pspGeneral);
if (psh.phpage[0] != NULL)
{ {
goto Cleanup; DelPropSheets.Page.General = TRUE;
nDevSheetsStart++;
nPages++;
} }
if (nPropSheets != 0)
{
/* create the device property sheets but don't overwrite
the "General" property sheet handle */
psh.phpage += nDevSheetsStart;
if (!SetupDiGetClassDevPropertySheets(DeviceInfoSet,
DeviceInfoData,
&psh,
nPropSheets,
NULL,
DIGCDP_FLAG_ADVANCED))
{
goto Cleanup;
}
psh.phpage -= nDevSheetsStart;
DelPropSheets.Page.Device = TRUE;
nPages += nPropSheets;
}
psh.nPages = nPages;
/* FIXME - add the "Driver" property sheet if necessary */
Ret = pPropertySheetW(&psh); Ret = pPropertySheetW(&psh);
/* no need to destroy the property sheets anymore */
DelPropSheets.Mask = 0;
Cleanup: Cleanup:
/* in case of failure the property sheets must be destroyed */
if (DelPropSheets.Mask != 0)
{
if (DelPropSheets.Page.General && psh.phpage[0] != NULL)
{
pDestroyPropertySheetPage(psh.phpage[0]);
}
if (DelPropSheets.Page.Device)
{
UINT i;
for (i = 0;
i < nPropSheets;
i++)
{
if (psh.phpage[i + 1] != NULL)
{
pDestroyPropertySheetPage(psh.phpage[i + 1]);
}
}
}
}
HeapFree(GetProcessHeap(), HeapFree(GetProcessHeap(),
0, 0,
psh.phpage); psh.phpage);
} }
HeapFree(GetProcessHeap(),
0,
DevAdvPropInfo);
return Ret; return Ret;
} }
/*************************************************************************** /***************************************************************************
* NAME EXPORTED * NAME EXPORTED
* DeviceAdvancedPropertiesW * DeviceAdvancedPropertiesW
@ -177,6 +399,8 @@ DeviceAdvancedPropertiesW(HWND hWndParent,
0, 0,
&DevInfoData)) &DevInfoData))
{ {
/* create the image list */
Ret = DisplayDeviceAdvancedProperties(hWndParent, Ret = DisplayDeviceAdvancedProperties(hWndParent,
hDevInfo, hDevInfo,
&DevInfoData, &DevInfoData,
@ -185,12 +409,14 @@ DeviceAdvancedPropertiesW(HWND hWndParent,
SetupDiDestroyDeviceInfoList(hDevInfo); SetupDiDestroyDeviceInfoList(hDevInfo);
} }
FreeLibrary(hComCtl32); FreeLibrary(hComCtl32);
} }
return Ret; return Ret;
} }
/*************************************************************************** /***************************************************************************
* NAME EXPORTED * NAME EXPORTED
* DeviceAdvancedPropertiesA * DeviceAdvancedPropertiesA

View file

@ -158,30 +158,15 @@ UpdateControlStates(IN PHARDWARE_PAGE_DATA hpd)
if (HwDevInfo != NULL) if (HwDevInfo != NULL)
{ {
/* update static controls */ /* update static controls */
CONFIGRET cRet;
DWORD RegDataType;
ULONG DataSize;
WCHAR szBuffer[256]; WCHAR szBuffer[256];
LPWSTR szFormatted = NULL; LPWSTR szFormatted = NULL;
/* get the manufacturer string */ /* get the manufacturer string */
if (!SetupDiGetDeviceRegistryProperty(HwDevInfo->ClassDevInfo->hDevInfo, if (GetDeviceManufacturerString(HwDevInfo->ClassDevInfo->hDevInfo,
&HwDevInfo->DevInfoData, &HwDevInfo->DevInfoData,
SPDRP_MFG, szBuffer,
&RegDataType, sizeof(szBuffer) / sizeof(szBuffer[0])) &&
(PBYTE)szBuffer, LoadAndFormatString(hDllInstance,
sizeof(szBuffer),
NULL) ||
RegDataType != REG_SZ)
{
szBuffer[0] = L'\0';
LoadString(hDllInstance,
IDS_UNKNOWN,
szBuffer,
sizeof(szBuffer) / sizeof(szBuffer[0]));
}
/* FIXME - check string for NULL termination! */
if (LoadAndFormatString(hDllInstance,
IDS_MANUFACTURER, IDS_MANUFACTURER,
&szFormatted, &szFormatted,
szBuffer) != 0) szBuffer) != 0)
@ -193,46 +178,10 @@ UpdateControlStates(IN PHARDWARE_PAGE_DATA hpd)
} }
/* get the location string */ /* get the location string */
DataSize = sizeof(szBuffer); if (GetDeviceLocationString(HwDevInfo->DevInfoData.DevInst,
cRet = CM_Get_DevNode_Registry_Property(HwDevInfo->DevInfoData.DevInst, szBuffer,
CM_DRP_LOCATION_INFORMATION, sizeof(szBuffer) / sizeof(szBuffer[0])) &&
&RegDataType, LoadAndFormatString(hDllInstance,
szBuffer,
&DataSize,
0);
if (cRet != CR_SUCCESS ||
RegDataType != REG_SZ)
{
szBuffer[0] = L'\0';
LoadString(hDllInstance,
IDS_UNKNOWN,
szBuffer,
sizeof(szBuffer) / sizeof(szBuffer[0]));
}
/* FIXME - check string for NULL termination! */
if (szBuffer[0] >= L'0' && szBuffer[0] <= L'9')
{
/* convert the string to an integer value and create a
formatted string */
ULONG ulLocation = (ULONG)wcstoul(szBuffer,
NULL,
10);
if (LoadAndFormatString(hDllInstance,
IDS_LOCATIONSTR,
&szFormatted,
ulLocation,
szBuffer) != 0)
{
wcsncpy(szBuffer,
szFormatted,
(sizeof(szBuffer) / sizeof(szBuffer[0])) - 1);
szBuffer[(sizeof(szBuffer) / sizeof(szBuffer[0])) - 1] = L'\0';
LocalFree((HLOCAL)szFormatted);
}
}
if (LoadAndFormatString(hDllInstance,
IDS_LOCATION, IDS_LOCATION,
&szFormatted, &szFormatted,
szBuffer) != 0) szBuffer) != 0)
@ -243,13 +192,11 @@ UpdateControlStates(IN PHARDWARE_PAGE_DATA hpd)
LocalFree((HLOCAL)szFormatted); LocalFree((HLOCAL)szFormatted);
} }
/* FIXME - get the device status text */ if (GetDeviceStatusString(HwDevInfo->ClassDevInfo->hDevInfo,
LoadString(hDllInstance, &HwDevInfo->DevInfoData,
IDS_UNKNOWN, szBuffer,
szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])) &&
sizeof(szBuffer) / sizeof(szBuffer[0])); LoadAndFormatString(hDllInstance,
if (LoadAndFormatString(hDllInstance,
IDS_STATUS, IDS_STATUS,
&szFormatted, &szFormatted,
szBuffer) != 0) szBuffer) != 0)
@ -449,10 +396,9 @@ FillDevicesListViewControl(IN PHARDWARE_PAGE_DATA hpd)
ItemCount++; ItemCount++;
/* get the device type for the second column */ /* get the device type for the second column */
if (SetupDiGetClassDescription(&ClassDevInfo->Guid, if (GetDeviceTypeString(&HwDevInfo->DevInfoData,
szBuffer, szBuffer,
sizeof(szBuffer) / sizeof(szBuffer[0]), sizeof(szBuffer) / sizeof(szBuffer[0])))
NULL))
{ {
li.mask = LVIF_TEXT; li.mask = LVIF_TEXT;
li.iItem = iItem; li.iItem = iItem;

View file

@ -29,6 +29,7 @@
HINSTANCE hDllInstance = NULL; HINSTANCE hDllInstance = NULL;
static INT static INT
LengthOfStrResource(IN HINSTANCE hInst, LengthOfStrResource(IN HINSTANCE hInst,
IN UINT uID) IN UINT uID)
@ -65,6 +66,7 @@ LengthOfStrResource(IN HINSTANCE hInst,
return -1; return -1;
} }
static INT static INT
AllocAndLoadString(OUT LPWSTR *lpTarget, AllocAndLoadString(OUT LPWSTR *lpTarget,
IN HINSTANCE hInst, IN HINSTANCE hInst,
@ -91,6 +93,7 @@ AllocAndLoadString(OUT LPWSTR *lpTarget,
return 0; return 0;
} }
DWORD DWORD
LoadAndFormatString(IN HINSTANCE hInstance, LoadAndFormatString(IN HINSTANCE hInstance,
IN UINT uID, IN UINT uID,
@ -123,6 +126,7 @@ LoadAndFormatString(IN HINSTANCE hInstance,
return Ret; return Ret;
} }
LPARAM LPARAM
ListViewGetSelectedItemData(IN HWND hwnd) ListViewGetSelectedItemData(IN HWND hwnd)
{ {
@ -149,6 +153,7 @@ ListViewGetSelectedItemData(IN HWND hwnd)
return 0; return 0;
} }
LPWSTR LPWSTR
ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr, ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr,
IN UINT uCodePage) IN UINT uCodePage)
@ -187,6 +192,151 @@ ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr,
return lpUnicodeStr; return lpUnicodeStr;
} }
BOOL
GetDeviceManufacturerString(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData,
OUT LPWSTR szBuffer,
IN DWORD BufferSize)
{
DWORD RegDataType;
BOOL Ret = FALSE;
if (!SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
DeviceInfoData,
SPDRP_MFG,
&RegDataType,
(PBYTE)szBuffer,
BufferSize * sizeof(WCHAR),
NULL) ||
RegDataType != REG_SZ)
{
szBuffer[0] = L'\0';
if (LoadString(hDllInstance,
IDS_UNKNOWN,
szBuffer,
BufferSize))
{
Ret = TRUE;
}
}
else
{
/* FIXME - check string for NULL termination! */
Ret = TRUE;
}
return Ret;
}
BOOL
GetDeviceLocationString(IN DEVINST dnDevInst,
OUT LPWSTR szBuffer,
IN DWORD BufferSize)
{
DWORD RegDataType;
ULONG DataSize;
CONFIGRET cRet;
BOOL Ret = FALSE;
DataSize = BufferSize * sizeof(WCHAR);
cRet = CM_Get_DevNode_Registry_Property(dnDevInst,
CM_DRP_LOCATION_INFORMATION,
&RegDataType,
szBuffer,
&DataSize,
0);
if (cRet != CR_SUCCESS ||
RegDataType != REG_SZ)
{
szBuffer[0] = L'\0';
if (LoadString(hDllInstance,
IDS_UNKNOWN,
szBuffer,
BufferSize))
{
Ret = TRUE;
}
}
else
{
/* FIXME - check string for NULL termination! */
Ret = TRUE;
}
if (szBuffer[0] >= L'0' && szBuffer[0] <= L'9')
{
/* convert the string to an integer value and create a
formatted string */
LPWSTR szFormatted;
ULONG ulLocation = (ULONG)wcstoul(szBuffer,
NULL,
10);
if (LoadAndFormatString(hDllInstance,
IDS_LOCATIONSTR,
&szFormatted,
ulLocation,
szBuffer) != 0)
{
wcsncpy(szBuffer,
szFormatted,
BufferSize - 1);
szBuffer[BufferSize - 1] = L'\0';
LocalFree((HLOCAL)szFormatted);
}
else
Ret = FALSE;
}
return Ret;
}
BOOL
GetDeviceStatusString(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData,
OUT LPWSTR szBuffer,
IN DWORD BufferSize)
{
return LoadString(hDllInstance,
IDS_UNKNOWN,
szBuffer,
BufferSize) != 0;
}
BOOL
GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData,
OUT LPWSTR szBuffer,
IN DWORD BufferSize)
{
BOOL Ret = FALSE;
if (!SetupDiGetClassDescription(&DeviceInfoData->ClassGuid,
szBuffer,
BufferSize,
NULL))
{
szBuffer[0] = L'\0';
if (LoadString(hDllInstance,
IDS_UNKNOWN,
szBuffer,
BufferSize))
{
Ret = TRUE;
}
}
else
{
/* FIXME - check string for NULL termination! */
Ret = TRUE;
}
return Ret;
}
HINSTANCE HINSTANCE
LoadAndInitComctl32(VOID) LoadAndInitComctl32(VOID)
{ {
@ -212,6 +362,7 @@ LoadAndInitComctl32(VOID)
return hComCtl32; return hComCtl32;
} }
BOOL BOOL
STDCALL STDCALL
DllMain(IN HINSTANCE hinstDLL, DllMain(IN HINSTANCE hinstDLL,

View file

@ -206,6 +206,28 @@ ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr,
HINSTANCE HINSTANCE
LoadAndInitComctl32(VOID); LoadAndInitComctl32(VOID);
BOOL
GetDeviceManufacturerString(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData,
OUT LPWSTR szBuffer,
IN DWORD BufferSize);
BOOL
GetDeviceLocationString(IN DEVINST dnDevInst,
OUT LPWSTR szBuffer,
IN DWORD BufferSize);
BOOL
GetDeviceStatusString(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData,
OUT LPWSTR szBuffer,
IN DWORD BufferSize);
BOOL
GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData,
OUT LPWSTR szBuffer,
IN DWORD BufferSize);
#endif /* __DEVMGR_H */ #endif /* __DEVMGR_H */
/* EOF */ /* EOF */

View file

@ -2,10 +2,18 @@
#define __DEVMGR_RESOURCE_H #define __DEVMGR_RESOURCE_H
#define IDI_DEVMGR 100 #define IDI_DEVMGR 100
#define IDD_HARDWARE 100
/* control IDs *must* match, some windows components #define IDD_HARDWARE 100
seem to use them... */ #define IDD_DEVICEGENERAL 101
#define IDC_DEVICON 0x57B
#define IDC_DEVNAME 0x57C
#define IDC_DEVTYPE 0x57D
#define IDC_DEVMANUFACTURER 0x57E
#define IDC_DEVLOCATION 0x57F
#define IDC_DEVSTATUSGROUP 0x580
#define IDC_DEVSTATUS 0x581
#define IDC_DEVUSAGE 0x582
#define IDC_DEVICES 0x583 #define IDC_DEVICES 0x583
#define IDC_LV_DEVICES 0x584 #define IDC_LV_DEVICES 0x584
#define IDC_PROPERTIESGROUP 0x585 #define IDC_PROPERTIESGROUP 0x585