mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Implement CM_Get_Child_Ex, CM_Get_Parent_Ex, CM_Get_Sibling_Ex and CM_Set_DevNode_Problem[_Ex].
- Clean-up indentation. svn path=/trunk/; revision=16704
This commit is contained in:
parent
8b127ceac1
commit
b244520c5a
6 changed files with 236 additions and 138 deletions
|
@ -29,15 +29,15 @@ interface pnp
|
||||||
[out, string, size_is(Length)] wchar_t *DeviceInstance,
|
[out, string, size_is(Length)] wchar_t *DeviceInstance,
|
||||||
[in] DWORD Length);
|
[in] DWORD Length);
|
||||||
|
|
||||||
// cpp_quote("#define PNP_DEVICE_PARENT 1")
|
cpp_quote("#define PNP_DEVICE_PARENT 1")
|
||||||
// cpp_quote("#define PNP_DEVICE_CHILD 2")
|
cpp_quote("#define PNP_DEVICE_CHILD 2")
|
||||||
// cpp_quote("#define PNP_DEVICE_SIBLING 3")
|
cpp_quote("#define PNP_DEVICE_SIBLING 3")
|
||||||
// CONFIGRET PNP_GetRelatedDeviceInstance(handle_t BindingHandle,
|
CONFIGRET PNP_GetRelatedDeviceInstance(handle_t BindingHandle,
|
||||||
// [in] DWORD Relationship,
|
[in] DWORD Relationship,
|
||||||
// [in, string] wchar_t *DeviceId,
|
[in, string] wchar_t *DeviceId,
|
||||||
// [out, string, size_is(Length)] wchar_t *RelatedDeviceId,
|
[out, string, size_is(Length)] wchar_t *RelatedDeviceId,
|
||||||
// [in] DWORD Length,
|
[in] DWORD Length,
|
||||||
// [in] DWORD Flags);
|
[in] DWORD Flags);
|
||||||
|
|
||||||
CONFIGRET PNP_GetDepth(handle_t BindingHandle,
|
CONFIGRET PNP_GetDepth(handle_t BindingHandle,
|
||||||
[in, string] wchar_t *DeviceInstance,
|
[in, string] wchar_t *DeviceInstance,
|
||||||
|
@ -49,4 +49,9 @@ interface pnp
|
||||||
[out] unsigned long *Status,
|
[out] unsigned long *Status,
|
||||||
[out] unsigned long *Problem,
|
[out] unsigned long *Problem,
|
||||||
[in] DWORD Flags);
|
[in] DWORD Flags);
|
||||||
|
|
||||||
|
CONFIGRET PNP_SetDeviceProblem(handle_t BindingHandle,
|
||||||
|
[in, string] wchar_t *DeviceInstance,
|
||||||
|
[in] unsigned long Problem,
|
||||||
|
[in] DWORD Flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,15 @@ DECL_WINELIB_CFGMGR32_TYPE_AW(DEVINSTID)
|
||||||
#define CM_LOCATE_DEVINST_NOVALIDATION CM_LOCATE_DEVNODE_NOVALIDATION
|
#define CM_LOCATE_DEVINST_NOVALIDATION CM_LOCATE_DEVNODE_NOVALIDATION
|
||||||
#define CM_LOCATE_DEVINST_BITS CM_LOCATE_DEVNODE_BITS
|
#define CM_LOCATE_DEVINST_BITS CM_LOCATE_DEVNODE_BITS
|
||||||
|
|
||||||
|
/* ulFlags for CM_Set_DevNode_Problem[_Ex] */
|
||||||
|
#define CM_SET_DEVNODE_PROBLEM_NORMAL 0x00000000
|
||||||
|
#define CM_SET_DEVNODE_PROBLEM_OVERRIDE 0x00000001
|
||||||
|
#define CM_SET_DEVNODE_PROBLEM_BITS 0x00000001
|
||||||
|
|
||||||
|
#define CM_SET_DEVINST_PROBLEM_NORMAL CM_SET_DEVNODE_PROBLEM_NORMAL
|
||||||
|
#define CM_SET_DEVINST_PROBLEM_OVERRIDE CM_SET_DEVNODE_PROBLEM_OVERRIDE
|
||||||
|
#define CM_SET_DEVINST_PROBLEM_BITS CM_SET_DEVNODE_PROBLEM_BITS
|
||||||
|
|
||||||
|
|
||||||
CONFIGRET WINAPI CM_Connect_MachineA( PCSTR, PHMACHINE );
|
CONFIGRET WINAPI CM_Connect_MachineA( PCSTR, PHMACHINE );
|
||||||
CONFIGRET WINAPI CM_Connect_MachineW( PCWSTR, PHMACHINE );
|
CONFIGRET WINAPI CM_Connect_MachineW( PCWSTR, PHMACHINE );
|
||||||
|
@ -141,5 +150,7 @@ CONFIGRET WINAPI CM_Open_Class_Key_ExA(LPGUID, LPCSTR, REGSAM, REGDISPOSITION, P
|
||||||
CONFIGRET WINAPI CM_Open_Class_Key_ExW(LPGUID, LPCWSTR, REGSAM, REGDISPOSITION, PHKEY, ULONG, HMACHINE);
|
CONFIGRET WINAPI CM_Open_Class_Key_ExW(LPGUID, LPCWSTR, REGSAM, REGDISPOSITION, PHKEY, ULONG, HMACHINE);
|
||||||
#define CM_Open_Class_Key_Ex WINELIB_NAME_AW(CM_Open_Class_Key_Ex)
|
#define CM_Open_Class_Key_Ex WINELIB_NAME_AW(CM_Open_Class_Key_Ex)
|
||||||
|
|
||||||
|
CONFIGRET WINAPI CM_Set_DevNode_Problem( DEVINST, ULONG, ULONG );
|
||||||
|
CONFIGRET WINAPI CM_Set_DevNode_Problem_Ex( DEVINST, ULONG, ULONG, HMACHINE );
|
||||||
|
|
||||||
#endif /* _CFGMGR32_H_ */
|
#endif /* _CFGMGR32_H_ */
|
||||||
|
|
|
@ -251,7 +251,6 @@ CONFIGRET WINAPI CM_Get_Child(
|
||||||
CONFIGRET WINAPI CM_Get_Child_Ex(
|
CONFIGRET WINAPI CM_Get_Child_Ex(
|
||||||
PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
|
PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
WCHAR szRelatedDevInst[MAX_DEVICE_ID_LEN];
|
WCHAR szRelatedDevInst[MAX_DEVICE_ID_LEN];
|
||||||
RPC_BINDING_HANDLE BindingHandle = NULL;
|
RPC_BINDING_HANDLE BindingHandle = NULL;
|
||||||
HSTRING_TABLE StringTable = NULL;
|
HSTRING_TABLE StringTable = NULL;
|
||||||
|
@ -310,9 +309,6 @@ CONFIGRET WINAPI CM_Get_Child_Ex(
|
||||||
*pdnDevInst = dwIndex;
|
*pdnDevInst = dwIndex;
|
||||||
|
|
||||||
return CR_SUCCESS;
|
return CR_SUCCESS;
|
||||||
#endif
|
|
||||||
FIXME("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
|
|
||||||
return CR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -322,8 +318,7 @@ CONFIGRET WINAPI CM_Get_Child_Ex(
|
||||||
CONFIGRET WINAPI CM_Get_Depth(
|
CONFIGRET WINAPI CM_Get_Depth(
|
||||||
PULONG pulDepth, DEVINST dnDevInst, ULONG ulFlags)
|
PULONG pulDepth, DEVINST dnDevInst, ULONG ulFlags)
|
||||||
{
|
{
|
||||||
TRACE("%p %lx %lx\n",
|
TRACE("%p %lx %lx\n", pulDepth, dnDevInst, ulFlags);
|
||||||
pulDepth, dnDevInst, ulFlags);
|
|
||||||
return CM_Get_Depth_Ex(pulDepth, dnDevInst, ulFlags, NULL);
|
return CM_Get_Depth_Ex(pulDepth, dnDevInst, ulFlags, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,7 +733,6 @@ CONFIGRET WINAPI CM_Get_Parent(
|
||||||
CONFIGRET WINAPI CM_Get_Parent_Ex(
|
CONFIGRET WINAPI CM_Get_Parent_Ex(
|
||||||
PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
|
PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
WCHAR szRelatedDevInst[MAX_DEVICE_ID_LEN];
|
WCHAR szRelatedDevInst[MAX_DEVICE_ID_LEN];
|
||||||
RPC_BINDING_HANDLE BindingHandle = NULL;
|
RPC_BINDING_HANDLE BindingHandle = NULL;
|
||||||
HSTRING_TABLE StringTable = NULL;
|
HSTRING_TABLE StringTable = NULL;
|
||||||
|
@ -797,9 +791,6 @@ CONFIGRET WINAPI CM_Get_Parent_Ex(
|
||||||
*pdnDevInst = dwIndex;
|
*pdnDevInst = dwIndex;
|
||||||
|
|
||||||
return CR_SUCCESS;
|
return CR_SUCCESS;
|
||||||
#endif
|
|
||||||
FIXME("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
|
|
||||||
return CR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -820,7 +811,6 @@ CONFIGRET WINAPI CM_Get_Sibling(
|
||||||
CONFIGRET WINAPI CM_Get_Sibling_Ex(
|
CONFIGRET WINAPI CM_Get_Sibling_Ex(
|
||||||
PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
|
PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
WCHAR szRelatedDevInst[MAX_DEVICE_ID_LEN];
|
WCHAR szRelatedDevInst[MAX_DEVICE_ID_LEN];
|
||||||
RPC_BINDING_HANDLE BindingHandle = NULL;
|
RPC_BINDING_HANDLE BindingHandle = NULL;
|
||||||
HSTRING_TABLE StringTable = NULL;
|
HSTRING_TABLE StringTable = NULL;
|
||||||
|
@ -879,9 +869,6 @@ CONFIGRET WINAPI CM_Get_Sibling_Ex(
|
||||||
*pdnDevInst = dwIndex;
|
*pdnDevInst = dwIndex;
|
||||||
|
|
||||||
return CR_SUCCESS;
|
return CR_SUCCESS;
|
||||||
#endif
|
|
||||||
FIXME("%p %lx %lx %lx\n", pdnDevInst, dnDevInst, ulFlags, hMachine);
|
|
||||||
return CR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1035,3 +1022,60 @@ CONFIGRET WINAPI CM_Locate_DevNode_ExW(
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* CM_Set_DevNode_Problem [SETUPAPI.@]
|
||||||
|
*/
|
||||||
|
CONFIGRET WINAPI CM_Set_DevNode_Problem(
|
||||||
|
DEVINST dnDevInst, ULONG ulProblem, ULONG ulFlags)
|
||||||
|
{
|
||||||
|
TRACE("%lx %lx %lx\n", dnDevInst, ulProblem, ulFlags);
|
||||||
|
return CM_Set_DevNode_Problem_Ex(dnDevInst, ulProblem, ulFlags, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* CM_Set_DevNode_Problem_Ex [SETUPAPI.@]
|
||||||
|
*/
|
||||||
|
CONFIGRET WINAPI CM_Set_DevNode_Problem_Ex(
|
||||||
|
DEVINST dnDevInst, ULONG ulProblem, ULONG ulFlags, HMACHINE hMachine)
|
||||||
|
{
|
||||||
|
RPC_BINDING_HANDLE BindingHandle = NULL;
|
||||||
|
HSTRING_TABLE StringTable = NULL;
|
||||||
|
LPWSTR lpDevInst;
|
||||||
|
CONFIGRET rc = CR_SUCCESS;
|
||||||
|
|
||||||
|
TRACE("%lx %lx %lx %lx\n", dnDevInst, ulProblem, ulFlags, hMachine);
|
||||||
|
|
||||||
|
if (dnDevInst == 0)
|
||||||
|
return CR_INVALID_DEVNODE;
|
||||||
|
|
||||||
|
if (ulFlags & ~CM_SET_DEVNODE_PROBLEM_BITS)
|
||||||
|
return CR_INVALID_FLAG;
|
||||||
|
|
||||||
|
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_SetDeviceProblem(BindingHandle,
|
||||||
|
lpDevInst,
|
||||||
|
ulProblem,
|
||||||
|
ulFlags);
|
||||||
|
}
|
||||||
|
|
|
@ -170,8 +170,8 @@
|
||||||
@ stub CM_Reset_Children_Marks_Ex
|
@ stub CM_Reset_Children_Marks_Ex
|
||||||
@ stub CM_Run_Detection
|
@ stub CM_Run_Detection
|
||||||
@ stub CM_Run_Detection_Ex
|
@ stub CM_Run_Detection_Ex
|
||||||
@ stub CM_Set_DevNode_Problem
|
@ stdcall CM_Set_DevNode_Problem(long long long)
|
||||||
@ stub CM_Set_DevNode_Problem_Ex
|
@ stdcall CM_Set_DevNode_Problem_Ex(long long long long)
|
||||||
@ stub CM_Set_DevNode_Registry_PropertyA
|
@ stub CM_Set_DevNode_Registry_PropertyA
|
||||||
@ stub CM_Set_DevNode_Registry_PropertyW
|
@ stub CM_Set_DevNode_Registry_PropertyW
|
||||||
@ stub CM_Set_DevNode_Registry_Property_ExA
|
@ stub CM_Set_DevNode_Registry_Property_ExA
|
||||||
|
|
|
@ -202,7 +202,6 @@ Done:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
CONFIGRET
|
CONFIGRET
|
||||||
PNP_GetRelatedDeviceInstance(handle_t BindingHandle,
|
PNP_GetRelatedDeviceInstance(handle_t BindingHandle,
|
||||||
unsigned long Relationship,
|
unsigned long Relationship,
|
||||||
|
@ -211,21 +210,40 @@ PNP_GetRelatedDeviceInstance(handle_t BindingHandle,
|
||||||
unsigned long Length,
|
unsigned long Length,
|
||||||
unsigned long Flags)
|
unsigned long Flags)
|
||||||
{
|
{
|
||||||
|
PLUGPLAY_CONTROL_RELATED_DEVICE_DATA PlugPlayData;
|
||||||
CONFIGRET ret = CR_SUCCESS;
|
CONFIGRET ret = CR_SUCCESS;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT1("PNP_GetRelatedDeviceInstance() called\n");
|
DPRINT("PNP_GetRelatedDeviceInstance() called\n");
|
||||||
DPRINT1(" Relationship %ld\n", Relationship);
|
DPRINT(" Relationship %ld\n", Relationship);
|
||||||
DPRINT1(" DeviceId %S\n", DeviceId);
|
DPRINT(" DeviceId %S\n", DeviceId);
|
||||||
|
|
||||||
lstrcpyW(RelatedDeviceId,
|
RtlInitUnicodeString(&PlugPlayData.TargetDeviceInstance,
|
||||||
szRootDeviceId);
|
DeviceId);
|
||||||
|
|
||||||
//Done:
|
PlugPlayData.Relation = Relationship;
|
||||||
DPRINT1("PNP_GetRelatedDeviceInstance() done (returns %lx)\n", ret);
|
|
||||||
|
PlugPlayData.RelatedDeviceInstance.Length = 0;
|
||||||
|
PlugPlayData.RelatedDeviceInstance.MaximumLength = Length;
|
||||||
|
PlugPlayData.RelatedDeviceInstance.Buffer = RelatedDeviceId;
|
||||||
|
|
||||||
|
Status = NtPlugPlayControl(PlugPlayControlGetRelatedDevice,
|
||||||
|
(PVOID)&PlugPlayData,
|
||||||
|
sizeof(PLUGPLAY_CONTROL_RELATED_DEVICE_DATA));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* FIXME: Map Status to ret */
|
||||||
|
ret = CR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("PNP_GetRelatedDeviceInstance() done (returns %lx)\n", ret);
|
||||||
|
if (ret == 0)
|
||||||
|
{
|
||||||
|
DPRINT("RelatedDevice: %wZ\n", &PlugPlayData.RelatedDeviceInstance);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
CONFIGRET
|
CONFIGRET
|
||||||
|
@ -297,6 +315,24 @@ PNP_GetDeviceStatus(handle_t BindingHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CONFIGRET
|
||||||
|
PNP_SetDeviceProblem(handle_t BindingHandle,
|
||||||
|
wchar_t *DeviceInstance,
|
||||||
|
unsigned long Problem,
|
||||||
|
DWORD Flags)
|
||||||
|
{
|
||||||
|
CONFIGRET ret = CR_SUCCESS;
|
||||||
|
|
||||||
|
DPRINT1("PNP_SetDeviceProblem() called\n");
|
||||||
|
|
||||||
|
/* FIXME */
|
||||||
|
|
||||||
|
DPRINT1("PNP_SetDeviceProblem() done (returns %lx)\n", ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static DWORD WINAPI
|
static DWORD WINAPI
|
||||||
PnpEventThread(LPVOID lpParameter)
|
PnpEventThread(LPVOID lpParameter)
|
||||||
{
|
{
|
||||||
|
@ -316,6 +352,7 @@ PnpEventThread(LPVOID lpParameter)
|
||||||
|
|
||||||
/* Wait for the next pnp event */
|
/* Wait for the next pnp event */
|
||||||
Status = NtGetPlugPlayEvent(0, 0, PnpEvent, PnpEventSize);
|
Status = NtGetPlugPlayEvent(0, 0, PnpEvent, PnpEventSize);
|
||||||
|
|
||||||
/* Resize the buffer for the PnP event if it's too small. */
|
/* Resize the buffer for the PnP event if it's too small. */
|
||||||
if (Status == STATUS_BUFFER_TOO_SMALL)
|
if (Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
|
@ -325,6 +362,7 @@ PnpEventThread(LPVOID lpParameter)
|
||||||
return ERROR_OUTOFMEMORY;
|
return ERROR_OUTOFMEMORY;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtPlugPlayEvent() failed (Status %lx)\n", Status);
|
DPRINT("NtPlugPlayEvent() failed (Status %lx)\n", Status);
|
||||||
|
|
Loading…
Reference in a new issue