Alexandre Julliard : kernel32: Store the initial directory as a full path in the process parameters.

Alexandre Julliard julliard at winehq.org
Fri Dec 21 07:28:26 CST 2007


Module: wine
Branch: master
Commit: a4269c8eed130acd3a767ca36da80265e0340a8a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a4269c8eed130acd3a767ca36da80265e0340a8a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Dec 21 12:42:28 2007 +0100

kernel32: Store the initial directory as a full path in the process parameters.

---

 dlls/kernel32/process.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index d770fd7..4a97ec3 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -1175,7 +1175,7 @@ static RTL_USER_PROCESS_PARAMETERS *create_user_params( LPCWSTR filename, LPCWST
                                                         const STARTUPINFOW *startup )
 {
     RTL_USER_PROCESS_PARAMETERS *params;
-    UNICODE_STRING image_str, cmdline_str, curdir_str, desktop, title, runtime;
+    UNICODE_STRING image_str, cmdline_str, curdir_str, desktop, title, runtime, newdir;
     NTSTATUS status;
     WCHAR buffer[MAX_PATH];
 
@@ -1186,7 +1186,17 @@ static RTL_USER_PROCESS_PARAMETERS *create_user_params( LPCWSTR filename, LPCWST
     RtlInitUnicodeString( &image_str, buffer );
 
     RtlInitUnicodeString( &cmdline_str, cmdline );
-    if (cur_dir) RtlInitUnicodeString( &curdir_str, cur_dir );
+    newdir.Buffer = NULL;
+    if (cur_dir)
+    {
+        if (RtlDosPathNameToNtPathName_U( cur_dir, &newdir, NULL, NULL ))
+        {
+            /* skip \??\ prefix */
+            curdir_str.Buffer = newdir.Buffer + 4;
+            curdir_str.Length = newdir.Length - 4 * sizeof(WCHAR);
+        }
+        else cur_dir = NULL;
+    }
     if (startup->lpDesktop) RtlInitUnicodeString( &desktop, startup->lpDesktop );
     if (startup->lpTitle) RtlInitUnicodeString( &title, startup->lpTitle );
     if (startup->lpReserved2 && startup->cbReserved2)
@@ -1203,6 +1213,7 @@ static RTL_USER_PROCESS_PARAMETERS *create_user_params( LPCWSTR filename, LPCWST
                                          startup->lpDesktop ? &desktop : NULL,
                                          NULL, 
                                          (startup->lpReserved2 && startup->cbReserved2) ? &runtime : NULL );
+    RtlFreeUnicodeString( &newdir );
     if (status != STATUS_SUCCESS)
     {
         SetLastError( RtlNtStatusToDosError(status) );




More information about the wine-cvs mailing list