Display the driver provider, date and version. Based on a patch by
Herve.
Modified: trunk/reactos/lib/devmgr/advprop.c
Modified: trunk/reactos/lib/devmgr/misc.c
Modified: trunk/reactos/lib/devmgr/precomp.h
_____
Modified: trunk/reactos/lib/devmgr/advprop.c
--- trunk/reactos/lib/devmgr/advprop.c 2005-12-27 16:19:07 UTC (rev
20372)
+++ trunk/reactos/lib/devmgr/advprop.c 2005-12-27 17:15:51 UTC (rev
20373)
@@ -79,6 +79,71 @@
#define PM_INITIALIZE (WM_APP + 0x101)
+static VOID
+UpdateDriverDlg(IN HWND hwndDlg,
+ IN PDEVADVPROP_INFO dap)
+{
+ HDEVINFO DeviceInfoSet;
+ PSP_DEVINFO_DATA DeviceInfoData;
+
+ if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
+ {
+ DeviceInfoSet = dap->CurrentDeviceInfoSet;
+ DeviceInfoData = &dap->CurrentDeviceInfoData;
+ }
+ else
+ {
+ DeviceInfoSet = dap->DeviceInfoSet;
+ DeviceInfoData = &dap->DeviceInfoData;
+ }
+
+ /* set the device image */
+ SendDlgItemMessage(hwndDlg,
+ IDC_DEVICON,
+ STM_SETICON,
+ (WPARAM)dap->hDevIcon,
+ 0);
+
+ /* set the device name edit control text */
+ SetDlgItemText(hwndDlg,
+ IDC_DEVNAME,
+ dap->szDevName);
+
+ /* query the driver provider */
+ if (GetDriverProviderString(DeviceInfoSet,
+ DeviceInfoData,
+ dap->szTemp,
+ sizeof(dap->szTemp) /
sizeof(dap->szTemp[0])))
+ {
+ SetDlgItemText(hwndDlg,
+ IDC_DRVPROVIDER,
+ dap->szTemp);
+ }
+
+ /* query the driver date */
+ if (GetDriverDateString(DeviceInfoSet,
+ DeviceInfoData,
+ dap->szTemp,
+ sizeof(dap->szTemp) /
sizeof(dap->szTemp[0])))
+ {
+ SetDlgItemText(hwndDlg,
+ IDC_DRVDATE,
+ dap->szTemp);
+ }
+
+ /* query the driver version */
+ if (GetDriverVersionString(DeviceInfoSet,
+ DeviceInfoData,
+ dap->szTemp,
+ sizeof(dap->szTemp) /
sizeof(dap->szTemp[0])))
+ {
+ SetDlgItemText(hwndDlg,
+ IDC_DRVVERSION,
+ dap->szTemp);
+ }
+}
+
+
static INT_PTR
CALLBACK
AdvProcDriverDlgProc(IN HWND hwndDlg,
@@ -116,17 +181,8 @@
DWL_USER,
(DWORD_PTR)dap);
- /* set the device image */
- SendDlgItemMessage(hwndDlg,
- IDC_DEVICON,
- STM_SETICON,
- (WPARAM)dap->hDevIcon,
- 0);
-
- /* set the device name edit control text */
- SetDlgItemText(hwndDlg,
- IDC_DEVNAME,
- dap->szDevName);
+ UpdateDriverDlg(hwndDlg,
+ dap);
}
Ret = TRUE;
break;
@@ -391,7 +447,7 @@
}
else
{
- GetParentNode:
+GetParentNode:
/* get the parent node from the initial devinst */
CM_Get_Parent_Ex(&dap->ParentDevInst,
dap->DeviceInfoData.DevInst,
_____
Modified: trunk/reactos/lib/devmgr/misc.c
--- trunk/reactos/lib/devmgr/misc.c 2005-12-27 16:19:07 UTC (rev
20372)
+++ trunk/reactos/lib/devmgr/misc.c 2005-12-27 17:15:51 UTC (rev
20373)
@@ -449,10 +449,13 @@
else
{
GeneralMessage:
- Ret = LoadString(hDllInstance,
- MessageId,
- szBuffer,
- (int)BufferSize);
+ if (LoadString(hDllInstance,
+ MessageId,
+ szBuffer,
+ (int)BufferSize))
+ {
+ Ret = TRUE;
+ }
}
return Ret;
@@ -460,6 +463,189 @@
BOOL
+GetDriverProviderString(IN HDEVINFO DeviceInfoSet,
+ IN PSP_DEVINFO_DATA DeviceInfoData,
+ OUT LPWSTR szBuffer,
+ IN DWORD BufferSize)
+{
+ HKEY hKey;
+ DWORD dwSize, dwType;
+ BOOL Ret = FALSE;
+
+ szBuffer[0] = L'\0';
+
+ /* get driver provider, date and version */
+ hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
+ DeviceInfoData,
+ DICS_FLAG_GLOBAL,
+ 0,
+ DIREG_DRV,
+ KEY_QUERY_VALUE);
+ if (hKey != INVALID_HANDLE_VALUE)
+ {
+ /* query the driver provider */
+ dwSize = BufferSize;
+ if (RegQueryValueEx(hKey,
+ REGSTR_VAL_PROVIDER_NAME,
+ NULL,
+ &dwType,
+ (LPBYTE)szBuffer,
+ &dwSize) == ERROR_SUCCESS &&
+ dwType == REG_SZ &&
+ szBuffer[0] != L'\0')
+ {
+ Ret = TRUE;
+ }
+ else
+ {
+ szBuffer[0] = L'\0';
+ }
+
+ RegCloseKey(hKey);
+ }
+
+ if (szBuffer[0] == L'\0')
+ {
+ /* unable to query the information */
+ if (LoadString(hDllInstance,
+ IDS_UNKNOWN,
+ szBuffer,
+ BufferSize))
+ {
+ Ret = TRUE;
+ }
+ }
+
+ return Ret;
+}
+
+
+BOOL
+GetDriverVersionString(IN HDEVINFO DeviceInfoSet,
+ IN PSP_DEVINFO_DATA DeviceInfoData,
+ OUT LPWSTR szBuffer,
+ IN DWORD BufferSize)
+{
+ HKEY hKey;
+ DWORD dwSize, dwType;
+ BOOL Ret = FALSE;
+
+ szBuffer[0] = L'\0';
+
+ /* get driver provider, date and version */
+ hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
+ DeviceInfoData,
+ DICS_FLAG_GLOBAL,
+ 0,
+ DIREG_DRV,
+ KEY_QUERY_VALUE);
+ if (hKey != INVALID_HANDLE_VALUE)
+ {
+ /* query the driver provider */
+ dwSize = BufferSize;
+ if (RegQueryValueEx(hKey,
+ L"DriverVersion",
+ NULL,
+ &dwType,
+ (LPBYTE)szBuffer,
+ &dwSize) == ERROR_SUCCESS &&
+ dwType == REG_SZ &&
+ szBuffer[0] != L'\0')
+ {
+ Ret = TRUE;
+ }
+ else
+ {
+ szBuffer[0] = L'\0';
+ }
+
+ RegCloseKey(hKey);
+ }
+
+ if (szBuffer[0] == L'\0')
+ {
+ /* unable to query the information */
+ if (LoadString(hDllInstance,
+ IDS_UNKNOWN,
+ szBuffer,
+ BufferSize))
+ {
+ Ret = TRUE;
+ }
+ }
+
+ return Ret;
+}
+
+BOOL
+GetDriverDateString(IN HDEVINFO DeviceInfoSet,
+ IN PSP_DEVINFO_DATA DeviceInfoData,
+ OUT LPWSTR szBuffer,
+ IN DWORD BufferSize)
+{
+ HKEY hKey;
+ FILETIME DriverDate;
+ SYSTEMTIME SystemTime, LocalTime;
+ DWORD dwSize, dwType;
+ BOOL Ret = FALSE;
+
+ szBuffer[0] = L'\0';
+
+ /* get driver provider, date and version */
+ hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
+ DeviceInfoData,
+ DICS_FLAG_GLOBAL,
+ 0,
+ DIREG_DRV,
+ KEY_QUERY_VALUE);
+ if (hKey != INVALID_HANDLE_VALUE)
+ {
+ /* query the driver provider */
+ dwSize = sizeof(FILETIME);
+ if (RegQueryValueEx(hKey,
+ L"DriverDateData",
+ NULL,
+ &dwType,
+ (LPBYTE)&DriverDate,
+ &dwSize) == ERROR_SUCCESS &&
+ dwType == REG_BINARY &&
+ dwSize == sizeof(FILETIME) &&
+ FileTimeToSystemTime(&DriverDate,
+ &SystemTime) &&
+ SystemTimeToTzSpecificLocalTime(NULL,
+ &SystemTime,
+ &LocalTime) &&
+ GetDateFormat(LOCALE_USER_DEFAULT,
+ DATE_SHORTDATE,
+ &LocalTime,
+ NULL,
+ szBuffer,
+ BufferSize) != 0)
+ {
+ Ret = TRUE;
+ }
+
+ RegCloseKey(hKey);
+ }
+
+ if (!Ret)
+ {
+ /* unable to query the information */
+ if (LoadString(hDllInstance,
+ IDS_UNKNOWN,
+ szBuffer,
+ BufferSize))
+ {
+ Ret = TRUE;
+ }
+ }
+
+ return Ret;
+}
+
+
+
+BOOL
IsDeviceHidden(IN DEVINST DevInst,
IN HMACHINE hMachine,
OUT BOOL *IsHidden)
_____
Modified: trunk/reactos/lib/devmgr/precomp.h
--- trunk/reactos/lib/devmgr/precomp.h 2005-12-27 16:19:07 UTC (rev
20372)
+++ trunk/reactos/lib/devmgr/precomp.h 2005-12-27 17:15:51 UTC (rev
20373)
@@ -2,6 +2,7 @@
#define __DEVMGR_H
#include <windows.h>
+#include <regstr.h>
#include <setupapi.h>
#include <cfgmgr32.h>
#include <commctrl.h>
@@ -257,6 +258,24 @@
IN DWORD BufferSize);
BOOL
+GetDriverProviderString(IN HDEVINFO DeviceInfoSet,
+ IN PSP_DEVINFO_DATA DeviceInfoData,
+ OUT LPWSTR szBuffer,
+ IN DWORD BufferSize);
+
+BOOL
+GetDriverVersionString(IN HDEVINFO DeviceInfoSet,
+ IN PSP_DEVINFO_DATA DeviceInfoData,
+ OUT LPWSTR szBuffer,
+ IN DWORD BufferSize);
+
+BOOL
+GetDriverDateString(IN HDEVINFO DeviceInfoSet,
+ IN PSP_DEVINFO_DATA DeviceInfoData,
+ OUT LPWSTR szBuffer,
+ IN DWORD BufferSize);
+
+BOOL
IsDeviceHidden(IN DEVINST DevInst,
IN HMACHINE hMachine,
OUT BOOL *IsHidden);