advapi32 registry test, fail gracefully when no permissions

James Hawkins truiken at gmail.com
Fri Apr 15 22:45:31 CDT 2005


On 4/14/05, Jakob Eriksson <jakov at vmlinux.org> wrote:
> 
> ERROR_PRIVILEGE_NOT_HELD returned for NT4 here:
> 
> http://test.winehq.org/data/200504141000/nt4_IDWASEMPTY/advapi32:registry.txt
> 
> 
> Index: dlls/advapi32/tests/registry.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/advapi32/tests/registry.c,v
> retrieving revision 1.18
> diff -u -r1.18 registry.c
> --- dlls/advapi32/tests/registry.c      13 Apr 2005 14:40:58 -0000      1.18
> +++ dlls/advapi32/tests/registry.c      14 Apr 2005 18:35:54 -0000
> @@ -357,6 +357,7 @@
>     DWORD ret;
> 
>     ret = RegSaveKey(hkey_main, "saved_key", NULL);
> +    if (ERROR_PRIVILEGE_NOT_HELD == ret) return;
>     ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
> }
> 
> @@ -366,6 +367,7 @@
>     HKEY hkHandle;
> 
>     ret = RegLoadKey(HKEY_LOCAL_MACHINE, "Test", "saved_key");
> +    if (ERROR_PRIVILEGE_NOT_HELD == ret) return;
>     ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
> 
>     ret = RegOpenKey(HKEY_LOCAL_MACHINE, "Test", &hkHandle);

I have a better fix for this to send in.  As the test stands now, it
doesn't pass on any windows machines because you have to manually set
the backup and restore privileges.  The patch I have sets these
permissions then unsets them after the tests are run.

-- 
James Hawkins




More information about the wine-patches mailing list