Add FIXME for non-zero security attributes

Pavel Roskin proski at gnu.org
Mon Sep 22 10:43:08 CDT 2003


Hello!

winemine compiled and run under Windows 2000 doesn't save scores.  It
turns out RegCreateKeyEx() fails because it gets invalid security
attributes.  It's an input argument, but winemine doesn't initialize it
and doesn't use it afterwards.  Also, the last argument "disp" is not
used.

This error would have been found earlier if we had a FIXME for non-zero
security attributes.

The attached patch adds FIXME to all functions ignoring "sa" in
dlls/advapi32/registry.c except RegSaveKeyA() that uses RegSaveKeyW().

Also, programs/winemine/main.c is simplified to replace unused pointers
with NULL in SaveBoard().

-- 
Regards,
Pavel Roskin
-------------- next part --------------
--- dlls/advapi32/registry.c
+++ dlls/advapi32/registry.c
@@ -172,6 +172,7 @@ DWORD WINAPI RegCreateKeyExW( HKEY hkey,
     if (reserved) return ERROR_INVALID_PARAMETER;
     if (!(access & KEY_ACCESS_MASK) || (access & ~KEY_ACCESS_MASK)) return ERROR_ACCESS_DENIED;
     if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
+    if (sa) FIXME("Security attributes ignored: %p\n",sa);
 
     attr.Length = sizeof(attr);
     attr.RootDirectory = hkey;
@@ -205,6 +206,7 @@ DWORD WINAPI RegCreateKeyExA( HKEY hkey,
     if (!is_version_nt()) access = KEY_ALL_ACCESS;  /* Win95 ignores the access mask */
     else if (!(access & KEY_ACCESS_MASK) || (access & ~KEY_ACCESS_MASK)) return ERROR_ACCESS_DENIED;
     if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
+    if (sa) FIXME("Security attributes ignored: %p\n",sa);
 
     attr.Length = sizeof(attr);
     attr.RootDirectory = hkey;
@@ -1562,6 +1564,7 @@ LONG WINAPI RegSaveKeyW( HKEY hkey, LPCW
     HANDLE handle;
 
     TRACE( "(%p,%s,%p)\n", hkey, debugstr_w(file), sa );
+    if (sa) FIXME("Security attributes ignored: %p\n",sa);
 
     if (!file || !*file) return ERROR_INVALID_PARAMETER;
     if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
--- programs/winemine/main.c
+++ programs/winemine/main.c
@@ -384,17 +384,15 @@ void LoadBoard( BOARD *p_board )
 
 void SaveBoard( BOARD *p_board )
 {
-    DWORD disp;
     HKEY hkey;
-    SECURITY_ATTRIBUTES sa;
     unsigned i;
     char data[16];
     char key_name[8];
 
     if( RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                 "Software\\Wine\\WineMine", 0, NULL,
-                REG_OPTION_NON_VOLATILE, KEY_WRITE, &sa,
-                &hkey, &disp ) != ERROR_SUCCESS)
+                REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
+                &hkey, NULL ) != ERROR_SUCCESS)
         return;
 
     wsprintf( data, "%d", p_board->pos.x );


More information about the wine-patches mailing list