Several bug fixes in save_key().
This commit is contained in:
parent
2c655f5e6e
commit
6b34fedc8c
@ -181,10 +181,12 @@ static void save_key( HKEY hkey, const char *filename )
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
|
char *p;
|
||||||
|
char *name = HeapAlloc( GetProcessHeap(), 0, strlen(filename) + 20 );
|
||||||
|
|
||||||
char *name = xmalloc( strlen(filename) + 10 );
|
if (!name) return;
|
||||||
char *p = strrchr( name, '/' );
|
strcpy( name, filename );
|
||||||
if (p) p++;
|
if ((p = strrchr( name, '/' ))) p++;
|
||||||
else p = name;
|
else p = name;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
@ -193,9 +195,11 @@ static void save_key( HKEY hkey, const char *filename )
|
|||||||
handle = FILE_CreateFile( name, GENERIC_WRITE, 0, NULL,
|
handle = FILE_CreateFile( name, GENERIC_WRITE, 0, NULL,
|
||||||
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, -1 );
|
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, -1 );
|
||||||
if (handle != INVALID_HANDLE_VALUE) break;
|
if (handle != INVALID_HANDLE_VALUE) break;
|
||||||
if ((ret = GetLastError()) != ERROR_FILE_EXISTS) return;
|
if ((ret = GetLastError()) != ERROR_FILE_EXISTS) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (handle != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
req->hkey = hkey;
|
req->hkey = hkey;
|
||||||
req->file = handle;
|
req->file = handle;
|
||||||
ret = server_call_noerr( REQ_SAVE_REGISTRY );
|
ret = server_call_noerr( REQ_SAVE_REGISTRY );
|
||||||
@ -208,6 +212,8 @@ static void save_key( HKEY hkey, const char *filename )
|
|||||||
unlink( name );
|
unlink( name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
HeapFree( GetProcessHeap(), 0, name );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user