- hide devices if necessary
- add some (not all!) missing device node status flags to w32api
Modified: trunk/reactos/lib/devmgr/advprop.c
Modified: trunk/reactos/lib/devmgr/hwpage.c
Modified: trunk/reactos/lib/devmgr/misc.c
Modified: trunk/reactos/lib/devmgr/precomp.h
Modified: trunk/reactos/w32api/include/setupapi.h
_____
Modified: trunk/reactos/lib/devmgr/advprop.c
--- trunk/reactos/lib/devmgr/advprop.c 2005-12-01 10:52:16 UTC (rev
19794)
+++ trunk/reactos/lib/devmgr/advprop.c 2005-12-01 14:29:46 UTC (rev
19795)
@@ -228,7 +228,7 @@
sizeof(DevAdvPropInfo->szDevName) /
sizeof(DevAdvPropInfo->szDevName[0])))
{
psh.dwSize = sizeof(PROPSHEETHEADER);
- psh.dwFlags = PSH_PROPTITLE;
+ psh.dwFlags = PSH_PROPTITLE;
psh.hwndParent = hWndParent;
psh.pszCaption = DevAdvPropInfo->szDevName;
_____
Modified: trunk/reactos/lib/devmgr/hwpage.c
--- 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])))
_____
Modified: trunk/reactos/lib/devmgr/misc.c
--- 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)
_____
Modified: trunk/reactos/lib/devmgr/precomp.h
--- 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);
_____
Modified: trunk/reactos/w32api/include/setupapi.h
--- trunk/reactos/w32api/include/setupapi.h 2005-12-01 10:52:16 UTC
(rev 19794)
+++ trunk/reactos/w32api/include/setupapi.h 2005-12-01 14:29:46 UTC
(rev 19795)
@@ -212,6 +212,13 @@
#define DMI_MASK 0x00000001
#define DMI_BKCOLOR 0x00000002
#define DMI_USERECT 0x00000004
+#define DN_NEEDS_LOCKING 0x02000000
+#define DN_ARM_WAKEUP 0x04000000
+#define DN_APM_ENUMERATOR 0x08000000
+#define DN_APM_DRIVER 0x10000000
+#define DN_SILENT_INSTALL 0x20000000
+#define DN_NO_SHOW_IN_DM 0x40000000
+#define DN_BOOT_LOG_PROB 0x80000000
#define DNF_DUPDESC 0x00000001
#define DNF_OLDDRIVER 0x00000002
#define DNF_EXCLUDEFROMLIST 0x00000004