https://bugs.winehq.org/show_bug.cgi?id=56842
Bug ID: 56842 Summary: Run the absolute path exe file and use the current process to retrieve the working directory as Linux working directory, not Windows working directory. ( GetCurrentDirectoryW -->NtCurrentTeb() -->Peb -->ProcessParameters -->CurrentDirectory DosPath) Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: zmtong1988@gmail.com Distribution: ---
1. Running the desktop lnk file will use SetCurrentDirectoryW() to set the current entry working directory, while GetCurrentDirectoryW() obtains the normal Windows working directory.
1) While processing the lnk file, parse the shell: IPersistStream_fnLoad Working Dir ->L "C: \ \ Program Files (x86) \ \ test \"
2) SHELL_execute -->dir=L "C: \ \ Program Files (x86) \ \ test \"
3) Set working directory: SetCurrentDirectoryW() -->L "C: \ \ Program Files (x86) \ \ test \"
4) Get working directory GetCurrentDirectoryW() ->us=&NtCurrentTeb() ->Peb ->ProcessParameters ->CurrentDirectory DosPath
The working directory obtained is L "C: \ \ Program Files (x86) \ \ test \ ".
At this point, the application obtains the working directory of the current process through GetCurrentDirectoryW(), which is the normal windwos working directory.
2. Run the absolute path exe and use GetCurrentDirectoryW() to obtain the current process directory, which is the working directory for running Linux.
1) SHELL_execute -->dir=(null)
2) GetCurrentDirectoryW() -->L "Z: \ \ home \ \ work \ \ desktop\ Retrieve the working directory of a running command process (for example, when I open a terminal on the desktop to run a command, the working directory obtained is: L "Z: \ \ home \ \ work \ \ desktop \ ).
At this point, the application obtains the working directory of the current process as the Linux working directory through GetCurrentDirectoryW().
The file we need to load is in the Windows working directory, not in the current process's working directory, which prevents us from finding the corresponding file in the working directory.