Author: ekohl
Date: Mon Feb 13 22:59:40 2017
New Revision: 73796
URL:
http://svn.reactos.org/svn/reactos?rev=73796&view=rev
Log:
[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!
Modified:
trunk/reactos/base/services/umpnpmgr/umpnpmgr.c
trunk/reactos/dll/win32/devmgr/properties/advprop.cpp
trunk/reactos/sdk/include/ndk/cmtypes.h
Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
==============================================================================
--- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Mon Feb 13 22:59:40 2017
@@ -489,7 +489,7 @@
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 @@
return CR_INVALID_POINTER;
// if (Buffer == NULL)
-// return
-
- *pulLength = 0;
+// return CR_INVALID_POINTER;
if (ulFlags &
(CM_GETIDLIST_FILTER_BUSRELATIONS |
@@ -519,19 +517,18 @@
}
else if (ulFlags & CM_GETIDLIST_FILTER_POWERRELATIONS)
{
- /* FIXME */
+ PlugPlayData.Relations = 2;
+ }
+ else if (ulFlags & CM_GETIDLIST_FILTER_REMOVALRELATIONS)
+ {
+ PlugPlayData.Relations = 1;
+ }
+ else if (ulFlags & CM_GETIDLIST_FILTER_EJECTRELATIONS)
+ {
PlugPlayData.Relations = 0;
}
- else if (ulFlags & CM_GETIDLIST_FILTER_REMOVALRELATIONS)
- {
- PlugPlayData.Relations = 1;
- }
- else if (ulFlags & CM_GETIDLIST_FILTER_EJECTRELATIONS)
- {
- PlugPlayData.Relations = 0;
- }
-
- PlugPlayData.BufferSize = *pulLength;
+
+ PlugPlayData.BufferSize = *pulLength * sizeof(WCHAR);
PlugPlayData.Buffer = Buffer;
Status = NtPlugPlayControl(PlugPlayControlQueryDeviceRelations,
@@ -539,7 +536,7 @@
sizeof(PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA));
if (NT_SUCCESS(Status))
{
- *pulLength = PlugPlayData.BufferSize;
+ *pulLength = PlugPlayData.BufferSize / sizeof(WCHAR);
}
else
{
@@ -548,15 +545,15 @@
}
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 @@
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 @@
}
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 @@
sizeof(PLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA));
if (NT_SUCCESS(Status))
{
- *pulLength = PlugPlayData.BufferSize;
+ *pulLength = PlugPlayData.BufferSize / sizeof(WCHAR);
}
else
{
@@ -629,15 +625,15 @@
}
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;
@@ -994,7 +990,7 @@
done:
- if(pulTransferLen)
+ if (pulTransferLen)
*pulTransferLen = (ret == CR_SUCCESS) ? *pulLength : 0;
if (hKey != NULL)
Modified: trunk/reactos/dll/win32/devmgr/properties/advprop.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/propertie…
==============================================================================
--- trunk/reactos/dll/win32/devmgr/properties/advprop.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/devmgr/properties/advprop.cpp [iso-8859-1] Mon Feb 13 22:59:40
2017
@@ -1339,7 +1339,6 @@
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 @@
pszBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
- ulLength);
+ ulLength * sizeof(WCHAR));
if (pszBuffer == NULL)
return;
Modified: trunk/reactos/sdk/include/ndk/cmtypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ndk/cmtypes.h?…
==============================================================================
--- trunk/reactos/sdk/include/ndk/cmtypes.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/ndk/cmtypes.h [iso-8859-1] Mon Feb 13 22:59:40 2017
@@ -466,7 +466,7 @@
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;