--- trunk/reactos/lib/devmgr/hwpage.c 2005-12-01 10:52:16 UTC (rev 19794)
+++ trunk/reactos/lib/devmgr/hwpage.c 2005-12-01 14:29:46 UTC (rev 19795)
@@ -41,6 +41,7 @@
{
struct _HWCLASSDEVINFO *ClassDevInfo;
SP_DEVINFO_DATA DevInfoData;
+ BOOL HideDevice;
} HWDEVINFO, *PHWDEVINFO;
typedef struct _HWCLASSDEVINFO
@@ -281,7 +282,7 @@
ClassDevInfo->hDevInfo = SetupDiGetClassDevs(&ClassDevInfo->Guid,
NULL,
hpd->hWnd,
- DIGCF_PRESENT);
+ DIGCF_PRESENT | DIGCF_PROFILE);
if (ClassDevInfo->hDevInfo != INVALID_HANDLE_VALUE)
{
DWORD MemberIndex = 0;
@@ -295,6 +296,8 @@
MemberIndex++,
&DevInfoData))
{
+ BOOL HideDevice = FALSE;
+
if (ClassDevInfo->HwDevInfo != NULL)
{
PHWDEVINFO HwNewDevInfo = HeapReAlloc(GetProcessHeap(),
@@ -325,9 +328,15 @@
}
}
+ /* Find out if the device should be hidden by default */
+ IsDeviceHidden(DevInfoData.DevInst,
+ NULL,
+ &HideDevice);
+
/* save all information for the current device */
ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount].ClassDevInfo = ClassDevInfo;
- ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount++].DevInfoData = DevInfoData;
+ ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount].DevInfoData = DevInfoData;
+ ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount++].HideDevice = HideDevice;
}
}
@@ -362,7 +371,8 @@
LVITEM li;
/* get the device name */
- if (GetDeviceDescriptionString(ClassDevInfo->hDevInfo,
+ if (!HwDevInfo->HideDevice &&
+ GetDeviceDescriptionString(ClassDevInfo->hDevInfo,
&HwDevInfo->DevInfoData,
szBuffer,
sizeof(szBuffer) / sizeof(szBuffer[0])))
--- trunk/reactos/lib/devmgr/misc.c 2005-12-01 10:52:16 UTC (rev 19794)
+++ trunk/reactos/lib/devmgr/misc.c 2005-12-01 14:29:46 UTC (rev 19795)
@@ -97,32 +97,42 @@
static INT
AllocAndLoadStringsCat(OUT LPWSTR *lpTarget,
IN HINSTANCE hInst,
- IN UINT uID1,
- IN UINT uID2)
+ IN UINT *uID,
+ IN UINT nIDs)
{
- INT ln;
+ INT ln = 0;
+ UINT i;
- ln = LengthOfStrResource(hInst,
- uID1);
- ln += LengthOfStrResource(hInst,
- uID2);
- if (ln++ > 0)
+ for (i = 0;
+ i != nIDs;
+ i++)
{
+ ln += LengthOfStrResource(hInst,
+ uID[i]);
+ }
+
+ if (ln != 0)
+ {
(*lpTarget) = (LPWSTR)LocalAlloc(LMEM_FIXED,
- ln * sizeof(WCHAR));
+ (ln + 1) * sizeof(WCHAR));
if ((*lpTarget) != NULL)
{
- INT Ret, Ret2 = 0;
- if (!(Ret = LoadStringW(hInst, uID1, *lpTarget, ln)))
+ LPWSTR s = *lpTarget;
+ INT Ret = 0;
+
+ for (i = 0;
+ i != nIDs;
+ i++)
{
- LocalFree((HLOCAL)(*lpTarget));
+ if (!(Ret = LoadStringW(hInst, uID[i], s, ln)))
+ {
+ LocalFree((HLOCAL)(*lpTarget));
+ }
+
+ s += Ret;
}
- else if (!(Ret2 = LoadStringW(hInst, uID2, *lpTarget + Ret, ln - Ret)))
- {
- LocalFree((HLOCAL)(*lpTarget));
- Ret = 0;
- }
- return Ret + Ret2;
+
+ return s - *lpTarget;
}
}
return 0;
@@ -141,7 +151,7 @@
if (AllocAndLoadString(&lpFormat,
hInstance,
- uID) > 0)
+ uID) != 0)
{
va_start(lArgs, lpTarget);
/* let's use FormatMessage to format it because it has the ability to allocate
@@ -164,8 +174,8 @@
DWORD
LoadAndFormatStringsCat(IN HINSTANCE hInstance,
- IN UINT uID1,
- IN UINT uID2,
+ IN UINT *uID,
+ IN UINT nIDs,
OUT LPWSTR *lpTarget,
...)
{
@@ -175,8 +185,8 @@
if (AllocAndLoadStringsCat(&lpFormat,
hInstance,
- uID1,
- uID2) > 0)
+ uID,
+ nIDs) != 0)
{
va_start(lArgs, lpTarget);
/* let's use FormatMessage to format it because it has the ability to allocate
@@ -458,10 +468,15 @@
else
{
LPWSTR szProblem;
+ UINT StringIDs[] =
+ {
+ MessageId,
+ IDS_DEVCODE,
+ };
if (LoadAndFormatStringsCat(hDllInstance,
- MessageId,
- IDS_DEVCODE,
+ StringIDs,
+ sizeof(StringIDs) / sizeof(StringIDs[0]),
&szProblem,
ProblemNumber))
{
@@ -493,6 +508,41 @@
BOOL
+IsDeviceHidden(IN DEVINST DevInst,
+ IN HANDLE hMachine,
+ OUT BOOL *IsHidden)
+{
+ CONFIGRET cr;
+ 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);
+ }
+
+ if (cr == CR_SUCCESS)
+ {
+ *IsHidden = ((Status & DN_NO_SHOW_IN_DM) != 0);
+ Ret = TRUE;
+ }
+
+ return Ret;
+}
+
+
+BOOL
GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData,
OUT LPWSTR szBuffer,
IN DWORD BufferSize)
--- trunk/reactos/lib/devmgr/precomp.h 2005-12-01 10:52:16 UTC (rev 19794)
+++ trunk/reactos/lib/devmgr/precomp.h 2005-12-01 14:29:46 UTC (rev 19795)
@@ -199,8 +199,8 @@
DWORD
LoadAndFormatStringsCat(IN HINSTANCE hInstance,
- IN UINT uID1,
- IN UINT uID2,
+ IN UINT *uID,
+ IN UINT nIDs,
OUT LPWSTR *lpTarget,
...);
@@ -232,6 +232,11 @@
IN DWORD BufferSize);
BOOL
+IsDeviceHidden(IN DEVINST DevInst,
+ IN HANDLE hMachine,
+ OUT BOOL *IsHidden);
+
+BOOL
GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData,
OUT LPWSTR szBuffer,
IN DWORD BufferSize);