Alexander Morozov : setupapi: SetupDiGetDeviceRegistryProperty should return ERROR_INSUFFICIENT_BUFFER when buffer size is insufficient .
Alexandre Julliard
julliard at winehq.org
Thu Apr 17 14:43:42 CDT 2008
Module: wine
Branch: master
Commit: 85861a4999e724bdb24ffa8a7262d329fb8fe035
URL: http://source.winehq.org/git/wine.git/?a=commit;h=85861a4999e724bdb24ffa8a7262d329fb8fe035
Author: Alexander Morozov <amorozov at etersoft.ru>
Date: Thu Apr 17 20:28:09 2008 +0400
setupapi: SetupDiGetDeviceRegistryProperty should return ERROR_INSUFFICIENT_BUFFER when buffer size is insufficient.
---
dlls/setupapi/devinst.c | 16 ++++++++--------
dlls/setupapi/tests/devinst.c | 2 --
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index bf952ef..25fa0b5 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -3118,14 +3118,14 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(
LONG l = RegQueryValueExA(devInfo->key, PropertyMap[Property].nameA,
NULL, PropertyRegDataType, PropertyBuffer, &size);
- if (RequiredSize)
- *RequiredSize = size;
- if (!PropertyBuffer)
- ; /* do nothing, ret is already FALSE, last error is already set */
+ if (l == ERROR_MORE_DATA || !PropertyBufferSize)
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
else if (!l)
ret = TRUE;
else
SetLastError(l);
+ if (RequiredSize)
+ *RequiredSize = size;
}
return ret;
}
@@ -3174,14 +3174,14 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(
LONG l = RegQueryValueExW(devInfo->key, PropertyMap[Property].nameW,
NULL, PropertyRegDataType, PropertyBuffer, &size);
- if (RequiredSize)
- *RequiredSize = size;
- if (!PropertyBuffer)
- ; /* do nothing, ret is already FALSE, last error is already set */
+ if (l == ERROR_MORE_DATA || !PropertyBufferSize)
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
else if (!l)
ret = TRUE;
else
SetLastError(l);
+ if (RequiredSize)
+ *RequiredSize = size;
}
return ret;
}
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 6edfd2d..b55565d 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -923,7 +923,6 @@ static void testDeviceRegistryPropertyA()
SetLastError(0xdeadbeef);
ret = pSetupDiGetDeviceRegistryPropertyA(set, &devInfo, SPDRP_FRIENDLYNAME,
NULL, NULL, 0, &size);
- todo_wine
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"Expected ERROR_INSUFFICIENT_BUFFER, got %08x\n", GetLastError());
ok(buflen == size, "Unexpected size: %d\n", size);
@@ -1018,7 +1017,6 @@ static void testDeviceRegistryPropertyW()
SetLastError(0xdeadbeef);
ret = pSetupDiGetDeviceRegistryPropertyW(set, &devInfo, SPDRP_FRIENDLYNAME,
NULL, NULL, 0, &size);
- todo_wine
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"Expected ERROR_INSUFFICIENT_BUFFER, got %08x\n", GetLastError());
ok(buflen == size, "Unexpected size: %d\n", size);
More information about the wine-cvs
mailing list