advapi32/tests: Add tests for RegSetValueExW and RegQueryValueExW.

Jactry Zeng jactry92 at gmail.com
Mon Jul 10 04:17:34 CDT 2017


Hi Alexandre,
2017-07-10 16:58 GMT+08:00 Alexandre Julliard <julliard at winehq.org>:
>
> I don't see how this is different from the existing tests.

Do you mean https://source.winehq.org/git/wine.git/blob/
a94938819280aa52fbc545911ca70a6c3a83ab49:/dlls/advapi32/
tests/registry.c#l1771 ?

The difference is here set an empty string and a zero length
for RegSetValueExW:

+    ret = RegSetValueExW(hkey_main, name4W, 0, REG_SZ, (const BYTE
*)emptyW, lstrlenW(emptyW));

Later RegQueryValueExW will get a zero length and it will not set buffer[0]
as NULL:

+    ret = RegQueryValueExW(hkey_main, name4W, 0, &type, (LPBYTE)buffer,
&len);
+    ok(ret == ERROR_SUCCESS, "RegQueryValueExW failed: %d, GLE=%d\n", ret,
GetLastError());
+    ok(len == 0, "got wrong length: %d\n", len);
+    ok(type == REG_SZ, "got type %d\n", type);
+    ok(!lstrcmpW(buffer, string1W), "got wrong string: %s\n",
wine_dbgstr_w(buffer));

I found this because of a notepad bug. It can be reproduced by:
1. $ wine notepad;
2. Open 'page setup' dialog in menu 'File';
3. Clear string in 'Header' and 'Footer' and then enter it;
4. Restart notepad and open 'page setup' dialog again.
'Header' and 'Footer' will be set as a font name, it is from another
registry key of notepad 'lfFaceName'.

-- 
Regards,
Jactry Zeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20170710/9812fc5d/attachment.html>


More information about the wine-devel mailing list