Alexandre Julliard : winedos:
Fix the device open code for the new NtCreateFile syntax for Unix
files.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 18 08:05:03 CDT 2007
Module: wine
Branch: master
Commit: b8d1560ac30ef3ea49de62210bb03d3bfeeaa4ad
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b8d1560ac30ef3ea49de62210bb03d3bfeeaa4ad
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jun 18 12:53:40 2007 +0200
winedos: Fix the device open code for the new NtCreateFile syntax for Unix files.
---
dlls/winedos/int21.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c
index c4b8f4f..7e080e0 100644
--- a/dlls/winedos/int21.c
+++ b/dlls/winedos/int21.c
@@ -845,6 +845,7 @@ static BOOL INT21_SetCurrentDirectory( CONTEXT86 *context )
*/
static HANDLE INT21_CreateMagicDeviceHandle( LPCWSTR name )
{
+ static const WCHAR prefixW[] = {'\\','?','?','\\','u','n','i','x'};
const char *dir = wine_get_server_dir();
int len;
HANDLE ret;
@@ -854,14 +855,16 @@ static HANDLE INT21_CreateMagicDeviceHandle( LPCWSTR name )
IO_STATUS_BLOCK io;
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);
- if (!(nameW.Buffer = HeapAlloc( GetProcessHeap(), 0, nameW.Length )))
+ if (!(nameW.Buffer = HeapAlloc( GetProcessHeap(), 0, nameW.MaximumLength )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
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] = '/';
strcpyW( nameW.Buffer + len, name );
More information about the wine-cvs
mailing list