[UMPNPMGR]

PNP_GetDeviceList and PNP_GetDeviceListSize:
- Do not return CR_CALL_NOT_IMPLEMENTED by default.
- pulLength is counted in characters, not in bytes!
- Use the correct Relations value for PowerRelations.

[NDK]
Add the PowerRelations value to a comment.

[DEVMGR]
CM_Get_Device_ID_List_Size_ExW and CM_Get_Device_ID_List_ExW count the buffer length in characters, not in bytes!

svn path=/trunk/; revision=73796
This commit is contained in:
Eric Kohl 2017-02-13 22:59:40 +00:00
parent afde7ef918
commit 8c77497afc
3 changed files with 17 additions and 22 deletions

View file

@ -489,7 +489,7 @@ PNP_GetDeviceList(
DWORD ulFlags)
{
PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA PlugPlayData;
CONFIGRET ret = CR_CALL_NOT_IMPLEMENTED;
CONFIGRET ret = CR_SUCCESS;
NTSTATUS Status;
DPRINT("PNP_GetDeviceList() called\n");
@ -501,9 +501,7 @@ PNP_GetDeviceList(
return CR_INVALID_POINTER;
// if (Buffer == NULL)
// return
*pulLength = 0;
// return CR_INVALID_POINTER;
if (ulFlags &
(CM_GETIDLIST_FILTER_BUSRELATIONS |
@ -519,8 +517,7 @@ PNP_GetDeviceList(
}
else if (ulFlags & CM_GETIDLIST_FILTER_POWERRELATIONS)
{
/* FIXME */
PlugPlayData.Relations = 0;
PlugPlayData.Relations = 2;
}
else if (ulFlags & CM_GETIDLIST_FILTER_REMOVALRELATIONS)
{
@ -531,7 +528,7 @@ PNP_GetDeviceList(
PlugPlayData.Relations = 0;
}
PlugPlayData.BufferSize = *pulLength;
PlugPlayData.BufferSize = *pulLength * sizeof(WCHAR);
PlugPlayData.Buffer = Buffer;
Status = NtPlugPlayControl(PlugPlayControlQueryDeviceRelations,
@ -539,7 +536,7 @@ PNP_GetDeviceList(
sizeof(PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA));
if (NT_SUCCESS(Status))
{
*pulLength = PlugPlayData.BufferSize;
*pulLength = PlugPlayData.BufferSize / sizeof(WCHAR);
}
else
{
@ -548,15 +545,15 @@ PNP_GetDeviceList(
}
else if (ulFlags & CM_GETIDLIST_FILTER_SERVICE)
{
ret = CR_CALL_NOT_IMPLEMENTED;
}
else if (ulFlags & CM_GETIDLIST_FILTER_ENUMERATOR)
{
ret = CR_CALL_NOT_IMPLEMENTED;
}
else /* CM_GETIDLIST_FILTER_NONE */
{
ret = CR_CALL_NOT_IMPLEMENTED;
}
return ret;
@ -573,7 +570,7 @@ PNP_GetDeviceListSize(
DWORD ulFlags)
{
PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA PlugPlayData;
CONFIGRET ret = CR_CALL_NOT_IMPLEMENTED;
CONFIGRET ret = CR_SUCCESS;
NTSTATUS Status;
DPRINT("PNP_GetDeviceListSize() called\n");
@ -600,8 +597,7 @@ PNP_GetDeviceListSize(
}
else if (ulFlags & CM_GETIDLIST_FILTER_POWERRELATIONS)
{
/* FIXME */
PlugPlayData.Relations = 0;
PlugPlayData.Relations = 2;
}
else if (ulFlags & CM_GETIDLIST_FILTER_REMOVALRELATIONS)
{
@ -620,7 +616,7 @@ PNP_GetDeviceListSize(
sizeof(PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA));
if (NT_SUCCESS(Status))
{
*pulLength = PlugPlayData.BufferSize;
*pulLength = PlugPlayData.BufferSize / sizeof(WCHAR);
}
else
{
@ -629,15 +625,15 @@ PNP_GetDeviceListSize(
}
else if (ulFlags & CM_GETIDLIST_FILTER_SERVICE)
{
ret = CR_CALL_NOT_IMPLEMENTED;
}
else if (ulFlags & CM_GETIDLIST_FILTER_ENUMERATOR)
{
ret = CR_CALL_NOT_IMPLEMENTED;
}
else /* CM_GETIDLIST_FILTER_NONE */
{
ret = CR_CALL_NOT_IMPLEMENTED;
}
return ret;

View file

@ -1339,7 +1339,6 @@ DisplayDeviceRelations(
ULONG ulLength = 0;
LPWSTR pszBuffer = NULL, pszStr;
INT index = 0, len;
CONFIGRET ret;
ret = CM_Get_Device_ID_List_Size_ExW(&ulLength,
@ -1351,7 +1350,7 @@ DisplayDeviceRelations(
pszBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
ulLength);
ulLength * sizeof(WCHAR));
if (pszBuffer == NULL)
return;

View file

@ -466,7 +466,7 @@ typedef struct _PLUGPLAY_CONTROL_DEPTH_DATA
typedef struct _PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA
{
UNICODE_STRING DeviceInstance;
ULONG Relations; // 0:EjectRelations, 1:RemovalRelations, 3:BusRelations
ULONG Relations; // 0:EjectRelations, 1:RemovalRelations, 2:PowerRelations, 3:BusRelations
ULONG BufferSize;
PWCHAR Buffer;
} PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA, *PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA;