fix incorrect GetLongPathName usage exposed by Eric's filename patches (resend)

Mike McCormack mike at codeweavers.com
Wed Jan 28 10:18:42 CST 2004


GetLongPathName no longer makes a full path name.  The previous patch 
had a problem with winelib appilications.

Mike


ChangeLog:
* fix incorrect GetLongPathName usage exposed by Eric's filename patches

-------------- next part --------------
Index: dlls/kernel/process.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/process.c,v
retrieving revision 1.42
diff -u -r1.42 process.c
--- dlls/kernel/process.c	20 Jan 2004 21:51:27 -0000	1.42
+++ dlls/kernel/process.c	28 Jan 2004 15:16:07 -0000
@@ -1138,12 +1138,13 @@
     RTL_USER_PROCESS_PARAMETERS *params;
     UNICODE_STRING image_str, cmdline_str, desktop, title;
     NTSTATUS status;
-    WCHAR buffer[MAX_PATH];
+    WCHAR longname[MAX_PATH], fullname[MAX_PATH], *dummy;
 
-    if (GetLongPathNameW( filename, buffer, MAX_PATH ))
-        RtlInitUnicodeString( &image_str, buffer );
-    else
-        RtlInitUnicodeString( &image_str, filename );
+    if(!GetLongPathNameW( filename, longname, MAX_PATH ))
+        strncpyW(longname, filename, MAX_PATH);
+    if(!GetFullPathNameW( longname, MAX_PATH, fullname, &dummy ))
+        strncpyW(longname, filename, MAX_PATH);
+    RtlInitUnicodeString( &image_str, fullname );
 
     RtlInitUnicodeString( &cmdline_str, cmdline );
     if (startup->lpDesktop) RtlInitUnicodeString( &desktop, startup->lpDesktop );


More information about the wine-patches mailing list