kernel32: Fix VxD open code for the new NtCreateFile syntax for Unix files.

This commit is contained in:
Alexandre Julliard 2007-06-18 12:53:27 +02:00
parent b16dbf46da
commit 8e53a00282
1 changed files with 6 additions and 3 deletions

View File

@ -91,6 +91,7 @@ static CRITICAL_SECTION vxd_section = { &critsect_debug, -1, 0, 0, 0, 0 };
/* create a file handle to represent a VxD, by opening a dummy file in the wineserver directory */ /* create a file handle to represent a VxD, by opening a dummy file in the wineserver directory */
static HANDLE open_vxd_handle( LPCWSTR name ) static HANDLE open_vxd_handle( LPCWSTR name )
{ {
static const WCHAR prefixW[] = {'\\','?','?','\\','u','n','i','x'};
const char *dir = wine_get_server_dir(); const char *dir = wine_get_server_dir();
int len; int len;
HANDLE ret; HANDLE ret;
@ -100,14 +101,16 @@ static HANDLE open_vxd_handle( LPCWSTR name )
IO_STATUS_BLOCK io; IO_STATUS_BLOCK io;
len = MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, NULL, 0 ); len = MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, NULL, 0 );
nameW.Length = (len + 1 + strlenW( name )) * sizeof(WCHAR); nameW.Length = sizeof(prefixW) + (len + strlenW( name )) * sizeof(WCHAR);
nameW.MaximumLength = nameW.Length + sizeof(WCHAR); nameW.MaximumLength = nameW.Length + sizeof(WCHAR);
if (!(nameW.Buffer = HeapAlloc( GetProcessHeap(), 0, nameW.Length ))) if (!(nameW.Buffer = HeapAlloc( GetProcessHeap(), 0, nameW.MaximumLength )))
{ {
SetLastError( ERROR_NOT_ENOUGH_MEMORY ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return 0; return 0;
} }
MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer, len ); memcpy( nameW.Buffer, prefixW, sizeof(prefixW) );
MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + sizeof(prefixW)/sizeof(WCHAR), len );
len += sizeof(prefixW) / sizeof(WCHAR);
nameW.Buffer[len-1] = '/'; nameW.Buffer[len-1] = '/';
strcpyW( nameW.Buffer + len, name ); strcpyW( nameW.Buffer + len, name );