Use only winapi functions in _convert_winnt_registry_to_wine_format.

This commit is contained in:
Juergen Schmied 2002-05-09 19:38:06 +00:00 committed by Alexandre Julliard
parent c5d30535fb
commit 7c68252560
1 changed files with 13 additions and 11 deletions

View File

@ -948,6 +948,7 @@ static int _nt_dump_nk(LPSTR key_name,char *base,nt_nk *nk,FILE *f,int level)
DWORD *vl; DWORD *vl;
LPSTR new_key_name = NULL; LPSTR new_key_name = NULL;
TRACE("%s\n", key_name);
if (nk->SubBlockId != NT_REG_KEY_BLOCK_ID) { if (nk->SubBlockId != NT_REG_KEY_BLOCK_ID) {
ERR("unknown node id 0x%04x, please report!\n", nk->SubBlockId); ERR("unknown node id 0x%04x, please report!\n", nk->SubBlockId);
@ -1333,25 +1334,26 @@ error1:
/* convert winnt native registry file to wine format [Internal] */ /* convert winnt native registry file to wine format [Internal] */
static LPSTR _convert_winnt_registry_to_wine_format(LPCSTR fn,int level) static LPSTR _convert_winnt_registry_to_wine_format(LPCSTR fn,int level)
{ {
int fd;
FILE *f; FILE *f;
DOS_FULL_NAME full_name;
void *base; void *base;
LPSTR ret = NULL; LPSTR ret = NULL;
struct stat st; HANDLE hFile;
HANDLE hMapping;
nt_regf *regf; nt_regf *regf;
nt_hbin *hbin; nt_hbin *hbin;
nt_hbin_sub *hbin_sub; nt_hbin_sub *hbin_sub;
nt_nk *nk; nt_nk *nk;
if (!DOSFS_GetFullName( fn, 0, &full_name )) return NULL; TRACE("%s\n", fn);
/* map the registry into the memory */ hFile = CreateFileA( fn, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
if ((fd = open(full_name.long_name, O_RDONLY | O_NONBLOCK)) == -1) return NULL; if ( hFile == INVALID_HANDLE_VALUE ) return NULL;
if ((fstat(fd, &st) == -1)) goto error1; hMapping = CreateFileMappingA( hFile, NULL, PAGE_READONLY|SEC_COMMIT, 0, 0, NULL );
if (!st.st_size) goto error1; if (!hMapping) goto error1;
if ((base = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED) goto error1; base = MapViewOfFile( hMapping, FILE_MAP_READ, 0, 0, 0 );
CloseHandle( hMapping );
if (!base) goto error1;
/* control signature */ /* control signature */
if (*(LPDWORD)base != NT_REG_HEADER_BLOCK_ID) { if (*(LPDWORD)base != NT_REG_HEADER_BLOCK_ID) {
@ -1389,9 +1391,9 @@ static LPSTR _convert_winnt_registry_to_wine_format(LPCSTR fn,int level)
fclose(f); fclose(f);
error: error:
munmap(base,st.st_size); UnmapViewOfFile( base );
error1: error1:
close(fd); CloseHandle(hFile);
return ret; return ret;
} }