<div dir="ltr">Hi George,<div style>(consider subscribing to wine-devel so your emails don't get stuck in moderation.)</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, May 11, 2013 at 7:43 AM, George Stephanos <span dir="ltr"><<a href="mailto:gaf.stephanos@gmail.com" target="_blank">gaf.stephanos@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As instructed, I added a few lines to the already written tests that<br>
confirm my claim.<br>
<br>
Part of the research of the registry merging project was to determine<br>
where the implementation is going to be written: advapi32, ntdll or<br>
the server itself. The server choice was dismissed since HKCR isn't<br>
stored and rather fetched live. These tests prove that advapi32 calls<br>
that reference HKCR are either pointed there to \REGISTRY\MACHINE or<br>
\REGISTRY\USER and hence, that the merge is to be done in advapi32.<br>
<br>
<a href="http://newtestbot.winehq.org/JobDetails.pl?Key=976" target="_blank">http://newtestbot.winehq.org/JobDetails.pl?Key=976</a><br>
---<br>
�dlls/advapi32/tests/registry.c | 18 ++++++++++++++++++<br>
�1 file changed, 18 insertions(+)<br>
<br>
diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c<br>
index b2483a7..8437e4d 100644<br>
--- a/dlls/advapi32/tests/registry.c<br>
+++ b/dlls/advapi32/tests/registry.c<br>
@@ -43,6 +43,7 @@ static DWORD (WINAPI *pRegDeleteTreeA)(HKEY,LPCSTR);<br>
�static DWORD (WINAPI *pRegDeleteKeyExA)(HKEY,LPCSTR,REGSAM,DWORD);<br>
�static BOOL (WINAPI *pIsWow64Process)(HANDLE,PBOOL);<br>
�static NTSTATUS (WINAPI * pNtDeleteKey)(HANDLE);<br>
+static NTSTATUS (WINAPI * pNtQueryKey)(HANDLE,int,PVOID,ULONG,PULONG);<br>
�static NTSTATUS (WINAPI * pRtlFormatCurrentUserKeyPath)(UNICODE_STRING*);<br>
�static NTSTATUS (WINAPI * pRtlFreeUnicodeString)(PUNICODE_STRING);<br>
<br>
@@ -136,6 +137,7 @@ static void InitFunctionPtrs(void)<br>
� � �pRtlFormatCurrentUserKeyPath = (void *)GetProcAddress( hntdll, "RtlFormatCurrentUserKeyPath" );<br>
� � �pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");<br>
� � �pNtDeleteKey = (void *)GetProcAddress( hntdll, "NtDeleteKey" );<br>
+ � �pNtQueryKey = (void *)GetProcAddress( hntdll, "NtQueryKey" );<br>
�}<br>
<br>
�/* delete key and all its subkeys */<br>
@@ -2104,6 +2106,7 @@ static void test_classesroot(void)<br>
� � �DWORD type = REG_SZ;<br>
� � �static CHAR buffer[8];<br>
� � �LONG res;<br>
+ � �void *buf = malloc(300*sizeof(wchar_t));<br></blockquote><div><br></div><div style>You could just allocate a buffer on the stack. 300 is probably overkill, 100 looks like it would do it. You want to use WCHAR rather than wchar_t.�</div>
<div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
� � �/* create a key in the user's classes */<br>
� � �if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Classes\\WineTestCls", &hkey ))<br>
@@ -2132,6 +2135,9 @@ static void test_classesroot(void)<br>
� � � � �RegCloseKey( hkey );<br>
� � � � �return;<br>
� � �}<br>
+ � �pNtQueryKey( hkcr, 3 /*KeyNameInformation*/, buf, 500*sizeof(wchar_t), (ULONG*)&res );<br></blockquote><div><br></div><div style>Not that this will actually overflow, but you specify 500, but only allocated 300. A straightforward way to accomplish agreement is to use sizeof(buf) / sizeof(buf[0]) as the size, if it's not dynamically allocated.</div>
<div style>�</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ � �ok( wcsncmp((wchar_t*)buf+2, L"\\REGISTRY\\USER", 14) == 0,<br>
+ � � � �"key not from \\REGISTRY\\USER\n");<br></blockquote><div><br></div><div style>Using L"" constructs isn't portable, you'll need to declare these the tedious way you'll find in other Wine tests:</div>
<div style>static const WCHAR reg_user[] = { '\\','R',''E,'G','I','S','T','R',Y',</div><div style>etc. Then you can use the sizeof(reg_user) / sizeof(reg_user[0]) trick to specify the length.</div>
<div style>I think Alexandre will object to using msvcrt functions (wcsncmp in this case), but I don't have a straightforward alternative yet.</div><div style><br></div><div style>Welcome to Wine development :)</div><div style>
--Juan</div></div></div></div>