Modified: trunk/reactos/include/idl/pnp.idl
Modified: trunk/reactos/include/wine/cfgmgr32.h
Modified: trunk/reactos/lib/cfgmgr32/cfgmgr32.def
Modified: trunk/reactos/lib/setupapi/cfgmgr.c
Modified: trunk/reactos/lib/setupapi/setupapi.spec
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
--- trunk/reactos/include/idl/pnp.idl 2005-07-19 14:11:53 UTC (rev 16644)
+++ trunk/reactos/include/idl/pnp.idl 2005-07-19 15:57:30 UTC (rev 16645)
@@ -24,4 +24,29 @@
CONFIGRET PNP_ValidateDeviceInstance(handle_t BindingHandle,
[in, string] wchar_t *DeviceInstance,
[in] DWORD Flags);
+
+ CONFIGRET PNP_GetRootDeviceInstance(handle_t BindingHandle,
+ [out, string, size_is(Length)] wchar_t *DeviceInstance,
+ [in] DWORD Length);
+
+// cpp_quote("#define PNP_DEVICE_PARENT 1")
+// cpp_quote("#define PNP_DEVICE_CHILD 2")
+// cpp_quote("#define PNP_DEVICE_SIBLING 3")
+// CONFIGRET PNP_GetRelatedDeviceInstance(handle_t BindingHandle,
+// [in] DWORD Relationship,
+// [in, string] wchar_t *DeviceId,
+// [out, string, size_is(Length)] wchar_t *RelatedDeviceId,
+// [in] DWORD Length,
+// [in] DWORD Flags);
+
+ CONFIGRET PNP_GetDepth(handle_t BindingHandle,
+ [in, string] wchar_t *DeviceInstance,
+ [out] unsigned long *Depth,
+ [in] DWORD Flags);
+
+ CONFIGRET PNP_GetDeviceStatus(handle_t BindingHandle,
+ [in, string] wchar_t *DeviceInstance,
+ [out] unsigned long *Status,
+ [out] unsigned long *Problem,
+ [in] DWORD Flags);
}
--- trunk/reactos/include/wine/cfgmgr32.h 2005-07-19 14:11:53 UTC (rev 16644)
+++ trunk/reactos/include/wine/cfgmgr32.h 2005-07-19 15:57:30 UTC (rev 16645)
@@ -81,6 +81,8 @@
CONFIGRET WINAPI CM_Enumerate_Classes_Ex( ULONG, LPGUID, ULONG, HMACHINE );
CONFIGRET WINAPI CM_Get_Child( PDEVINST, DEVINST, ULONG );
CONFIGRET WINAPI CM_Get_Child_Ex( PDEVINST, DEVINST, ULONG, HMACHINE );
+CONFIGRET WINAPI CM_Get_Depth( PULONG, DEVINST, ULONG );
+CONFIGRET WINAPI CM_Get_Depth_Ex( PULONG, DEVINST, ULONG, HMACHINE );
CONFIGRET WINAPI CM_Get_Device_IDA( DEVINST, PCHAR, ULONG, ULONG );
CONFIGRET WINAPI CM_Get_Device_IDW( DEVINST, PWCHAR, ULONG, ULONG );
#define CM_Get_Device_ID WINELIB_NAME_AW(CM_Get_Device_ID)
@@ -101,6 +103,8 @@
#define CM_Get_Device_ID_List_Size_Ex WINELIB_NAME_AW(CM_Get_Device_ID_List_Size_Ex)
CONFIGRET WINAPI CM_Get_Device_ID_Size( PULONG, DEVINST, ULONG );
CONFIGRET WINAPI CM_Get_Device_ID_Size_Ex( PULONG, DEVINST, ULONG, HMACHINE );
+CONFIGRET WINAPI CM_Get_DevNode_Status( PULONG, PULONG, DEVINST, ULONG );
+CONFIGRET WINAPI CM_Get_DevNode_Status_Ex( PULONG, PULONG, DEVINST, ULONG, HMACHINE );
CONFIGRET WINAPI CM_Get_Global_State( PULONG, ULONG );
CONFIGRET WINAPI CM_Get_Global_State_Ex( PULONG, ULONG, HMACHINE );
CONFIGRET WINAPI CM_Get_Parent( PDEVINST, DEVINST, ULONG );
--- trunk/reactos/lib/cfgmgr32/cfgmgr32.def 2005-07-19 14:11:53 UTC (rev 16644)
+++ trunk/reactos/lib/cfgmgr32/cfgmgr32.def 2005-07-19 15:57:30 UTC (rev 16645)
@@ -79,18 +79,18 @@
;CM_Get_Class_NameW
;CM_Get_Class_Name_ExA
;CM_Get_Class_Name_ExW
-;CM_Get_Depth
-;CM_Get_Depth_Ex
+CM_Get_Depth@12=SETUPAPI.CM_Get_Depth
+CM_Get_Depth_Ex@16=SETUPAPI.CM_Get_Depth_Ex
CM_Get_DevNode_Registry_PropertyA@24=SETUPAPI.CM_Get_DevNode_Registry_PropertyA
CM_Get_DevNode_Registry_PropertyW@24=SETUPAPI.CM_Get_DevNode_Registry_PropertyW
CM_Get_DevNode_Registry_Property_ExA@28=SETUPAPI.CM_Get_DevNode_Registry_Property_ExA
CM_Get_DevNode_Registry_Property_ExW@28=SETUPAPI.CM_Get_DevNode_Registry_Property_ExW
-;CM_Get_DevNode_Status
-;CM_Get_DevNode_Status_Ex
-;CM_Get_Device_IDA
-;CM_Get_Device_IDW
-;CM_Get_Device_ID_ExA
-;CM_Get_Device_ID_ExW
+CM_Get_DevNode_Status@16=SETUPAPI.CM_Get_DevNode_Status
+CM_Get_DevNode_Status_Ex@20=SETUPAPI.CM_Get_DevNode_Status_Ex
+CM_Get_Device_IDA@16=SETUPAPI.CM_Get_Device_IDA
+CM_Get_Device_IDW@16=SETUPAPI.CM_Get_Device_IDW
+CM_Get_Device_ID_ExA@20=SETUPAPI.CM_Get_Device_ID_ExA
+CM_Get_Device_ID_ExW@20=SETUPAPI.CM_Get_Device_ID_ExW
CM_Get_Device_ID_ListA@16=SETUPAPI.CM_Get_Device_ID_ListA
CM_Get_Device_ID_ListW@16=SETUPAPI.CM_Get_Device_ID_ListW
CM_Get_Device_ID_List_ExA@20=SETUPAPI.CM_Get_Device_ID_List_ExA
@@ -99,8 +99,8 @@
CM_Get_Device_ID_List_SizeW@12=SETUPAPI.CM_Get_Device_ID_List_SizeW
CM_Get_Device_ID_List_Size_ExA@16=SETUPAPI.CM_Get_Device_ID_List_Size_ExA
CM_Get_Device_ID_List_Size_ExW@16=SETUPAPI.CM_Get_Device_ID_List_Size_ExA
-;CM_Get_Device_ID_Size
-;CM_Get_Device_ID_Size_Ex
+CM_Get_Device_ID_Size@12=SETUPAPI.CM_Get_Device_ID_Size
+CM_Get_Device_ID_Size_Ex@16=SETUPAPI.CM_Get_Device_ID_Size_Ex
;CM_Get_Device_Interface_AliasA
;CM_Get_Device_Interface_AliasW
;CM_Get_Device_Interface_Alias_ExA
@@ -115,8 +115,8 @@
;CM_Get_Device_Interface_List_Size_ExW
;CM_Get_First_Log_Conf
;CM_Get_First_Log_Conf_Ex
-;CM_Get_Global_State
-;CM_Get_Global_State_Ex
+CM_Get_Global_State@8=SETUPAPI.CM_Get_Global_State
+CM_Get_Global_State_Ex@12=SETUPAPI.CM_Get_Global_State_Ex
;CM_Get_HW_Prof_FlagsA
;CM_Get_HW_Prof_FlagsW
;CM_Get_HW_Prof_Flags_ExA
@@ -144,6 +144,7 @@
;CM_Intersect_Range_List
;CM_Invert_Range_List
;CM_Is_Dock_Station_Present
+;CM_Is_Dock_Station_Present_Ex
CM_Locate_DevNodeA@12=SETUPAPI.CM_Locate_DevNodeA
CM_Locate_DevNodeW@12=SETUPAPI.CM_Locate_DevNodeW
CM_Locate_DevNode_ExA@16=SETUPAPI.CM_Locate_DevNode_ExA
--- trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-19 14:11:53 UTC (rev 16644)
+++ trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-19 15:57:30 UTC (rev 16645)
@@ -251,12 +251,124 @@
CONFIGRET WINAPI CM_Get_Child_Ex(
PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
{
+#if 0
+ WCHAR szRelatedDevInst[MAX_DEVICE_ID_LEN];
+ RPC_BINDING_HANDLE BindingHandle = NULL;
+ HSTRING_TABLE StringTable = NULL;
+ LPWSTR lpDevInst;
+ DWORD dwIndex;
+ CONFIGRET ret;
+
+ TRACE("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
+
+ if (pdnDevInst == NULL)
+ return CR_INVALID_POINTER;
+
+ if (dnDevInst == 0)
+ return CR_INVALID_DEVINST;
+
+ if (ulFlags != 0)
+ return CR_INVALID_FLAG;
+
+ *pdnDevInst = -1;
+
+ if (hMachine != NULL)
+ {
+ BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+ if (BindingHandle == NULL)
+ return CR_FAILURE;
+
+ StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
+ if (StringTable == 0)
+ return CR_FAILURE;
+ }
+ else
+ {
+ if (!PnpGetLocalHandles(&BindingHandle, &StringTable))
+ return CR_FAILURE;
+ }
+
+ lpDevInst = StringTableStringFromId(StringTable, dnDevInst);
+ if (lpDevInst == NULL)
+ return CR_INVALID_DEVNODE;
+
+ ret = PNP_GetRelatedDeviceInstance(BindingHandle,
+ PNP_DEVICE_CHILD,
+ lpDevInst,
+ szRelatedDevInst,
+ MAX_DEVICE_ID_LEN,
+ 0);
+ if (ret != CR_SUCCESS)
+ return ret;
+
+ TRACE("szRelatedDevInst: %s\n", debugstr_w(szRelatedDevInst));
+
+ dwIndex = StringTableAddString(StringTable, szRelatedDevInst, 1);
+ if (dwIndex == -1)
+ return CR_FAILURE;
+
+ *pdnDevInst = dwIndex;
+
+ return CR_SUCCESS;
+#endif
FIXME("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
return CR_FAILURE;
}
/***********************************************************************
+ * CM_Get_Depth [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Depth(
+ PULONG pulDepth, DEVINST dnDevInst, ULONG ulFlags)
+{
+ TRACE("%p %lx %lx\n",
+ pulDepth, dnDevInst, ulFlags);
+ return CM_Get_Depth_Ex(pulDepth, dnDevInst, ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Get_Depth_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_Depth_Ex(
+ PULONG pulDepth, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
+{
+ RPC_BINDING_HANDLE BindingHandle = NULL;
+ HSTRING_TABLE StringTable = NULL;
+ LPWSTR lpDevInst;
+
+ TRACE("%p %lx %lx %lx\n",
+ pulDepth, dnDevInst, ulFlags, hMachine);
+
+ if (hMachine != NULL)
+ {
+ BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+ if (BindingHandle == NULL)
+ return CR_FAILURE;
+
+ StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
+ if (StringTable == 0)
+ return CR_FAILURE;
+ }
+ else
+ {
+ if (!PnpGetLocalHandles(&BindingHandle, &StringTable))
+ return CR_FAILURE;
+ }
+
+ lpDevInst = StringTableStringFromId(StringTable, dnDevInst);
+ if (lpDevInst == NULL)
+ return CR_INVALID_DEVNODE;
+
+ return PNP_GetDepth(BindingHandle,
+ lpDevInst,
+ pulDepth,
+ ulFlags);
+}
+
+
+/***********************************************************************
* CM_Get_Device_IDA [SETUPAPI.@]
*/
CONFIGRET WINAPI CM_Get_Device_IDA(
@@ -322,9 +434,7 @@
dnDevInst,
Buffer,
&BufferLen))
- {
return CR_FAILURE;
- }
return CR_SUCCESS;
}
@@ -434,7 +544,7 @@
CONFIGRET WINAPI CM_Get_Device_ID_Size(
PULONG pulLen, DEVINST dnDevInst, ULONG ulFlags)
{
- TRACE("%p %p %lx\n", pulLen, dnDevInst, ulFlags);
+ TRACE("%p %lx %lx\n", pulLen, dnDevInst, ulFlags);
return CM_Get_Device_ID_Size_Ex(pulLen, dnDevInst, ulFlags, NULL);
}
@@ -448,7 +558,7 @@
HSTRING_TABLE StringTable = NULL;
LPWSTR DeviceId;
- TRACE("%p %p %lx %lx\n", pulLen, dnDevInst, ulFlags, hMachine);
+ TRACE("%p %lx %lx %lx\n", pulLen, dnDevInst, ulFlags, hMachine);
if (hMachine != NULL)
{
@@ -476,6 +586,63 @@
/***********************************************************************
+ * CM_Get_DevNode_Status [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Get_DevNode_Status(
+ PULONG pulStatus, PULONG pulProblemNumber, DEVINST dnDevInst,
+ ULONG ulFlags)
+{
+ TRACE("%p %p %lx %lx\n",
+ pulStatus, pulProblemNumber, dnDevInst, ulFlags);
+ return CM_Get_DevNode_Status_Ex(pulStatus, pulProblemNumber, dnDevInst,
+ ulFlags, NULL);
+}
+
+
+/***********************************************************************
+ * CM_Get_DevNode_Status_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI
+CM_Get_DevNode_Status_Ex(
+ PULONG pulStatus, PULONG pulProblemNumber, DEVINST dnDevInst,
+ ULONG ulFlags, HMACHINE hMachine)
+{
+ RPC_BINDING_HANDLE BindingHandle = NULL;
+ HSTRING_TABLE StringTable = NULL;
+ LPWSTR lpDevInst;
+
+ TRACE("%p %p %lx %lx %lx\n",
+ pulStatus, pulProblemNumber, dnDevInst, ulFlags, hMachine);
+
+ if (hMachine != NULL)
+ {
+ BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+ if (BindingHandle == NULL)
+ return CR_FAILURE;
+
+ StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
+ if (StringTable == 0)
+ return CR_FAILURE;
+ }
+ else
+ {
+ if (!PnpGetLocalHandles(&BindingHandle, &StringTable))
+ return CR_FAILURE;
+ }
+
+ lpDevInst = StringTableStringFromId(StringTable, dnDevInst);
+ if (lpDevInst == NULL)
+ return CR_INVALID_DEVNODE;
+
+ return PNP_GetDeviceStatus(BindingHandle,
+ lpDevInst,
+ pulStatus,
+ pulProblemNumber,
+ ulFlags);
+}
+
+
+/***********************************************************************
* CM_Get_Global_State [SETUPAPI.@]
*/
CONFIGRET WINAPI CM_Get_Global_State(
@@ -535,6 +702,66 @@
CONFIGRET WINAPI CM_Get_Parent_Ex(
PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
{
+#if 0
+ WCHAR szRelatedDevInst[MAX_DEVICE_ID_LEN];
+ RPC_BINDING_HANDLE BindingHandle = NULL;
+ HSTRING_TABLE StringTable = NULL;
+ LPWSTR lpDevInst;
+ DWORD dwIndex;
+ CONFIGRET ret;
+
+ TRACE("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
+
+ if (pdnDevInst == NULL)
+ return CR_INVALID_POINTER;
+
+ if (dnDevInst == 0)
+ return CR_INVALID_DEVINST;
+
+ if (ulFlags != 0)
+ return CR_INVALID_FLAG;
+
+ *pdnDevInst = -1;
+
+ if (hMachine != NULL)
+ {
+ BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+ if (BindingHandle == NULL)
+ return CR_FAILURE;
+
+ StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
+ if (StringTable == 0)
+ return CR_FAILURE;
+ }
+ else
+ {
+ if (!PnpGetLocalHandles(&BindingHandle, &StringTable))
+ return CR_FAILURE;
+ }
+
+ lpDevInst = StringTableStringFromId(StringTable, dnDevInst);
+ if (lpDevInst == NULL)
+ return CR_INVALID_DEVNODE;
+
+ ret = PNP_GetRelatedDeviceInstance(BindingHandle,
+ PNP_DEVICE_PARENT,
+ lpDevInst,
+ szRelatedDevInst,
+ MAX_DEVICE_ID_LEN,
+ 0);
+ if (ret != CR_SUCCESS)
+ return ret;
+
+ TRACE("szRelatedDevInst: %s\n", debugstr_w(szRelatedDevInst));
+
+ dwIndex = StringTableAddString(StringTable, szRelatedDevInst, 1);
+ if (dwIndex == -1)
+ return CR_FAILURE;
+
+ *pdnDevInst = dwIndex;
+
+ return CR_SUCCESS;
+#endif
FIXME("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
return CR_FAILURE;
}
@@ -557,6 +784,66 @@
CONFIGRET WINAPI CM_Get_Sibling_Ex(
PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
{
+#if 0
+ WCHAR szRelatedDevInst[MAX_DEVICE_ID_LEN];
+ RPC_BINDING_HANDLE BindingHandle = NULL;
+ HSTRING_TABLE StringTable = NULL;
+ LPWSTR lpDevInst;
+ DWORD dwIndex;
+ CONFIGRET ret;
+
+ TRACE("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
+
+ if (pdnDevInst == NULL)
+ return CR_INVALID_POINTER;
+
+ if (dnDevInst == 0)
+ return CR_INVALID_DEVINST;
+
+ if (ulFlags != 0)
+ return CR_INVALID_FLAG;
+
+ *pdnDevInst = -1;
+
+ if (hMachine != NULL)
+ {
+ BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+ if (BindingHandle == NULL)
+ return CR_FAILURE;
+
+ StringTable = ((PMACHINE_INFO)hMachine)->StringTable;
+ if (StringTable == 0)
+ return CR_FAILURE;
+ }
+ else
+ {
+ if (!PnpGetLocalHandles(&BindingHandle, &StringTable))
+ return CR_FAILURE;
+ }
+
+ lpDevInst = StringTableStringFromId(StringTable, dnDevInst);
+ if (lpDevInst == NULL)
+ return CR_INVALID_DEVNODE;
+
+ ret = PNP_GetRelatedDeviceInstance(BindingHandle,
+ PNP_DEVICE_SIBLING,
+ lpDevInst,
+ szRelatedDevInst,
+ MAX_DEVICE_ID_LEN,
+ 0);
+ if (ret != CR_SUCCESS)
+ return ret;
+
+ TRACE("szRelatedDevInst: %s\n", debugstr_w(szRelatedDevInst));
+
+ dwIndex = StringTableAddString(StringTable, szRelatedDevInst, 1);
+ if (dwIndex == -1)
+ return CR_FAILURE;
+
+ *pdnDevInst = dwIndex;
+
+ return CR_SUCCESS;
+#endif
FIXME("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
return CR_FAILURE;
}
@@ -678,15 +965,20 @@
return CR_FAILURE;
}
- if (pDeviceID != NULL && wcslen(pDeviceID) != 0)
+ if (pDeviceID != NULL && lstrlenW(pDeviceID) != 0)
{
lstrcpyW(DeviceIdBuffer, pDeviceID);
}
else
{
/* Get the root device ID */
- lstrcpyW(DeviceIdBuffer, L"HTREE\\ROOT\\0");
+ rc = PNP_GetRootDeviceInstance(BindingHandle,
+ DeviceIdBuffer,
+ MAX_DEVICE_ID_LEN);
+ if (rc != CR_SUCCESS)
+ return CR_FAILURE;
}
+ TRACE("DeviceIdBuffer: %s\n", debugstr_w(DeviceIdBuffer));
/* Validate the device ID */
rc = PNP_ValidateDeviceInstance(BindingHandle,
--- trunk/reactos/lib/setupapi/setupapi.spec 2005-07-19 14:11:53 UTC (rev 16644)
+++ trunk/reactos/lib/setupapi/setupapi.spec 2005-07-19 15:57:30 UTC (rev 16645)
@@ -63,14 +63,14 @@
@ stub CM_Get_Class_NameW
@ stub CM_Get_Class_Name_ExA
@ stub CM_Get_Class_Name_ExW
-@ stub CM_Get_Depth
-@ stub CM_Get_Depth_Ex
+@ stdcall CM_Get_Depth(ptr long long)
+@ stdcall CM_Get_Depth_Ex(ptr long long long)
@ stub CM_Get_DevNode_Registry_PropertyA
@ stub CM_Get_DevNode_Registry_PropertyW
@ stub CM_Get_DevNode_Registry_Property_ExA
@ stub CM_Get_DevNode_Registry_Property_ExW
-@ stub CM_Get_DevNode_Status
-@ stub CM_Get_DevNode_Status_Ex
+@ stdcall CM_Get_DevNode_Status(ptr ptr long long)
+@ stdcall CM_Get_DevNode_Status_Ex(ptr ptr long long long)
@ stdcall CM_Get_Device_IDA(long str long long)
@ stdcall CM_Get_Device_IDW(long wstr long long)
@ stdcall CM_Get_Device_ID_ExA(long str long long long)
--- trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-07-19 14:11:53 UTC (rev 16644)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-07-19 15:57:30 UTC (rev 16645)
@@ -52,6 +52,7 @@
{NULL, NULL}
};
+static WCHAR szRootDeviceId[] = L"HTREE\\ROOT\\0";
/* FUNCTIONS *****************************************************************/
@@ -98,13 +99,13 @@
void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
{
- return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+ return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}
void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
{
- HeapFree(GetProcessHeap(), 0, ptr);
+ HeapFree(GetProcessHeap(), 0, ptr);
}
@@ -176,6 +177,126 @@
}
+CONFIGRET
+PNP_GetRootDeviceInstance(handle_t BindingHandle,
+ wchar_t *DeviceInstance,
+ unsigned long Length)
+{
+ CONFIGRET ret = CR_SUCCESS;
+
+ DPRINT("PNP_GetRootDeviceInstance() called\n");
+
+ if (Length < lstrlenW(szRootDeviceId) + 1)
+ {
+ ret = CR_BUFFER_SMALL;
+ goto Done;
+ }
+
+ lstrcpyW(DeviceInstance,
+ szRootDeviceId);
+
+Done:
+ DPRINT("PNP_GetRootDeviceInstance() done (returns %lx)\n", ret);
+
+ return ret;
+}
+
+
+#if 0
+CONFIGRET
+PNP_GetRelatedDeviceInstance(handle_t BindingHandle,
+ unsigned long Relationship,
+ wchar_t *DeviceId,
+ wchar_t *RelatedDeviceId,
+ unsigned long Length,
+ unsigned long Flags)
+{
+ CONFIGRET ret = CR_SUCCESS;
+
+ DPRINT1("PNP_GetRelatedDeviceInstance() called\n");
+ DPRINT1(" Relationship %ld\n", Relationship);
+ DPRINT1(" DeviceId %S\n", DeviceId);
+
+ lstrcpyW(RelatedDeviceId,
+ szRootDeviceId);
+
+//Done:
+ DPRINT1("PNP_GetRelatedDeviceInstance() done (returns %lx)\n", ret);
+
+ return ret;
+}
+#endif
+
+
+CONFIGRET
+PNP_GetDepth(handle_t BindingHandle,
+ wchar_t *DeviceInstance,
+ unsigned long *Depth,
+ DWORD Flags)
+{
+ PLUGPLAY_CONTROL_DEPTH_DATA PlugPlayData;
+ CONFIGRET ret = CR_SUCCESS;
+ NTSTATUS Status;
+
+ DPRINT1("PNP_GetDepth() called\n");
+
+ RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
+ DeviceInstance);
+
+ Status = NtPlugPlayControl(PlugPlayControlGetDeviceDepth,
+ (PVOID)&PlugPlayData,
+ sizeof(PLUGPLAY_CONTROL_DEPTH_DATA));
+ if (NT_SUCCESS(Status))
+ {
+ *Depth = PlugPlayData.Depth;
+ }
+ else
+ {
+ ret = CR_FAILURE; /* FIXME */
+ }
+
+ DPRINT1("PNP_GetDepth() done (returns %lx)\n", ret);
+
+ return ret;
+}
+
+
+CONFIGRET
+PNP_GetDeviceStatus(handle_t BindingHandle,
+ wchar_t *DeviceInstance,
+ unsigned long *pStatus,
+ unsigned long *pProblem,
+ DWORD Flags)
+{
+ PLUGPLAY_CONTROL_STATUS_DATA PlugPlayData;
+ CONFIGRET ret = CR_SUCCESS;
+ NTSTATUS Status;
+
+ DPRINT1("PNP_GetDeviceStatus() called\n");
+
+ RtlInitUnicodeString(&PlugPlayData.DeviceInstance,
+ DeviceInstance);
+ PlugPlayData.Operation = 0; /* Get status */
+
+ Status = NtPlugPlayControl(PlugPlayControlDeviceStatus,
+ (PVOID)&PlugPlayData,
+ sizeof(PLUGPLAY_CONTROL_STATUS_DATA));
+ if (NT_SUCCESS(Status))
+ {
+ *pStatus = PlugPlayData.DeviceStatus;
+ *pProblem = PlugPlayData.DeviceProblem;
+ }
+ else
+ {
+ ret = CR_FAILURE; /* FIXME */
+ }
+
+ DPRINT1("PNP_GetDeviceStatus() done (returns %lx)\n", ret);
+
+ return ret;
+}
+
+
static DWORD WINAPI
PnpEventThread(LPVOID lpParameter)
{