From 7930ce1287a02d63289d68ee3e1e1b9e42e03322 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 23 Apr 2004 00:07:34 +0000 Subject: [PATCH] Use NtOpenFile instead of FILE_CreateFile to open Unix files. --- misc/registry.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/misc/registry.c b/misc/registry.c index 2a837e8166f..18c675791b9 100644 --- a/misc/registry.c +++ b/misc/registry.c @@ -1199,9 +1199,27 @@ static int _get_reg_type(const WCHAR* windir) /* load the registry file in wine format [Internal] */ static void load_wine_registry(HKEY hkey,LPCSTR fn) { + WCHAR *buffer; HANDLE file; - if ((file = FILE_CreateFile( fn, GENERIC_READ, 0, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, 0 ))) + DWORD len; + UNICODE_STRING name; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + + len = MultiByteToWideChar( CP_UNIXCP, 0, fn, -1, NULL, 0 ); + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return; + MultiByteToWideChar( CP_UNIXCP, 0, fn, -1, buffer, len ); + RtlInitUnicodeString( &name, buffer ); + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.ObjectName = &name; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + if (!NtOpenFile( &file, GENERIC_READ, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT )) { SERVER_START_REQ( load_registry ) { @@ -1212,6 +1230,7 @@ static void load_wine_registry(HKEY hkey,LPCSTR fn) SERVER_END_REQ; CloseHandle( file ); } + HeapFree( GetProcessHeap(), 0, buffer ); } /* generate and return the name of the tmp file and associated stream [Internal] */ -- 2.11.4.GIT