vxd loading is broken last months
Vitaly Lipatov
lav at etersoft.ru
Sun Jun 17 02:42:52 CDT 2007
В сообщении от 17 июня 2007 Dan Kegel написал(a):
> Vitaly Lipatov wrote:
> > INT21_CreateMagicDeviceHandle in winedos/int21.c uses the same dummy file
> > magic with open file with unix path from wine_get_server_dir().
> > I guess we could use NtCreateFile on unix path before.
> > Now we need select correct place for such dummy files inside wine disk
> > tree...
>
> Yeah. Evan has been sitting on a patch to fix this for a week
> now. Evan, I'd say it's time to post your minimal test and
> the fix, even if things are broken.
> - Dan
JFYI: I have a patch to fix this via use temp dir, not server dir:
--- dlls/kernel32/vxd.c 9 Apr 2007 12:37:34 -0000 1.5
+++ dlls/kernel32/vxd.c 16 Jun 2007 14:29:49 -0000
@@ -91,7 +91,7 @@ static CRITICAL_SECTION vxd_section = {
/* create a file handle to represent a VxD, by opening a dummy file in the
wineserver directory */
static HANDLE open_vxd_handle( LPCWSTR name )
{
- const char *dir = wine_get_server_dir();
+ WCHAR path[MAX_PATH];
int len;
HANDLE ret;
NTSTATUS status;
@@ -99,17 +99,16 @@ static HANDLE open_vxd_handle( LPCWSTR n
UNICODE_STRING nameW;
IO_STATUS_BLOCK io;
- len = MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, NULL, 0 );
- nameW.Length = (len + 1 + strlenW( name )) * sizeof(WCHAR);
- nameW.MaximumLength = nameW.Length + sizeof(WCHAR);
- if (!(nameW.Buffer = HeapAlloc( GetProcessHeap(), 0, nameW.Length )))
+ len = GetTempPathW(sizeof(path), path);
+ path[len-1] = '\\';
+ /* Lav: Possible stack overflow */
+ strcpyW( path + len, name );
+
+ if (!RtlDosPathNameToNtPathName_U( path, &nameW, NULL, NULL ))
{
- SetLastError( ERROR_NOT_ENOUGH_MEMORY );
- return 0;
+ SetLastError( ERROR_PATH_NOT_FOUND );
+ return INVALID_HANDLE_VALUE;
}
- MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer, len );
- nameW.Buffer[len-1] = '/';
- strcpyW( nameW.Buffer + len, name );
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
--
Lav
Виталий Липатов
Россия, Санкт-Петербург. www.etersoft.ru
GNU! ALT Linux Team! WINE! WIKI! LaTeX! LyX!
More information about the wine-devel
mailing list