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.
https://bugs.winehq.org/show_bug.cgi?id=56842
Maotong Zhang zmtong1988@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |9.11
https://bugs.winehq.org/show_bug.cgi?id=56842
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #1 from Alexandre Julliard julliard@winehq.org --- It works the same way on Windows if you run the app from the command line.
https://bugs.winehq.org/show_bug.cgi?id=56842
--- Comment #2 from Maotong Zhang zmtong1988@gmail.com --- (In reply to Alexandre Julliard from comment #1)
It works the same way on Windows if you run the app from the command line.
Yes, I run them all from the command line. First : wine xxx.lnk Second : wine xxx.exe
https://bugs.winehq.org/show_bug.cgi?id=56842
--- Comment #3 from Maotong Zhang zmtong1988@gmail.com --- Created attachment 76651 --> https://bugs.winehq.org/attachment.cgi?id=76651 Test GetCurrentDirectoryW() obtain the working directory
I wrote a test program that uses GetCurrentDirectoryW() to retrieve the current process working directory and display it. Working directory: L "C: \ \ Program Files (x86) \ \ test \ " Test file: 1、exe: get-directory.exe 2、Lnk: get directory.lnk (shortcut to "C: \ \ Program Files (x86) \ \ test \ \ get-directory.exe" ) 3、Place 2 test files in the " C: \ \ Program Files (x86) \ \ test \ \ "directory and run them Run file: 1、Run WINEPREFIX=/home/work/test wine get-directory.exe, Display the working directory of the current Linux terminal process. 2、Run WINEPREFIX=/home/work/test wine get-directory.lnk , Display the working directory as "C: \ Program Files (x86) \ test", which is the working directory of Windows
https://bugs.winehq.org/show_bug.cgi?id=56842
Maotong Zhang zmtong1988@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID |---
--- Comment #4 from Maotong Zhang zmtong1988@gmail.com --- (In reply to Alexandre Julliard from comment #1)
It works the same way on Windows if you run the app from the command line.
Thank you. The running effect of Windows is indeed the same. Do we need to handle it. What do I need to do to fix this.
https://bugs.winehq.org/show_bug.cgi?id=56842
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- There's nothing to fix. If your app depends on the current directory being set from the lnk file, then it has to be run from the lnk file and not from the command line.
https://bugs.winehq.org/show_bug.cgi?id=56842
--- Comment #6 from Maotong Zhang zmtong1988@gmail.com --- (In reply to Alexandre Julliard from comment #5)
There's nothing to fix. If your app depends on the current directory being set from the lnk file, then it has to be run from the lnk file and not from the command line.
Understood,Thank you very much!
https://bugs.winehq.org/show_bug.cgi?id=56842
--- Comment #7 from Austin English austinenglish@gmail.com --- Closing.
https://bugs.winehq.org/show_bug.cgi?id=56842
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #8 from Austin English austinenglish@gmail.com --- Actually closing.