Author: mjansen
Date: Sun Nov 13 18:11:14 2016
New Revision: 73228
URL:
http://svn.reactos.org/svn/reactos?rev=73228&view=rev
Log:
[ADVAPI32][ADVAPI32_APITEST] Fix incorrect parameter output uncovered by CORE-12333
#comment Please retest!
Modified:
trunk/reactos/dll/win32/advapi32/reg/reg.c
trunk/rostests/apitests/advapi32/RegQueryValueExW.c
Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Sun Nov 13 18:11:14 2016
@@ -4147,10 +4147,16 @@
if (!NT_SUCCESS(status) && status != STATUS_BUFFER_OVERFLOW)
{
// NT: Valid handles with inexistant/null values or invalid (but not NULL)
handles sets type to REG_NONE
- if ((status == STATUS_OBJECT_NAME_NOT_FOUND) ||(status == STATUS_INVALID_HANDLE
&& hkey))
+ // On windows these conditions are likely to be side effects of the
implementation...
+ if (status == STATUS_INVALID_HANDLE && hkey)
{
if (type) *type = REG_NONE;
if (count) *count = 0;
+ }
+ else if (status == STATUS_OBJECT_NAME_NOT_FOUND)
+ {
+ if (type) *type = REG_NONE;
+ if (data == NULL && count) *count = 0;
}
goto done;
}
Modified: trunk/rostests/apitests/advapi32/RegQueryValueExW.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/RegQuer…
==============================================================================
--- trunk/rostests/apitests/advapi32/RegQueryValueExW.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/RegQueryValueExW.c [iso-8859-1] Sun Nov 13 18:11:14
2016
@@ -303,6 +303,20 @@
ok(size == 46, "Expected size = 46, size is: %ld", size);
ok(!wcscmp(data23, string22W), "Expected same string! data23: %S, string22W:
%S", data23, string22W);
+ /* Ask for a var that doesnt exist. */
+ SetLastError(0xdeadbeef);
+ size = sizeof(data23);
+ memset(data23, 0, sizeof(data23));
+ type = 666;
+ ret = RegQueryValueExW(hkey_main, L"XXXXXYYYYYZZZZZZ", NULL, &type,
(LPBYTE)data23, &size);
+ ok(ret == ERROR_FILE_NOT_FOUND, "RegQueryValueExW returned: %lx\n", ret);
+ ok(GetLastError() == 0xdeadbeef, "RegQueryValueExW returned: %lx\n",
GetLastError());
+ /* 2k3 leaves garbage */
+ ok(type == REG_NONE || broken(type != REG_NONE && type != 666),
"Expected REG_NONE, Type is: %ld\n", type);
+ ok(size == 46, "Expected size = 46, size is: %ld", size);
+ ok(!wcscmp(data23,L""), "Expected same string! data23: %S,
''", data23);
+
+
RegCloseKey(hkey_main);
RegCloseKey(subkey);