Page 1 of 1

The x64 context menu changes CurrentDirectory

Posted: 12 Apr 2025 05:57
by zakoul
If you use the 64-bit context menu in XYplorer, the result of the 'GetCurrentDirectory' function changes to 'C:/Program Files (x86)/XYplorer'.

Code on masm64 for Visual Studio 2022:

Code: Select all

ExitProcess PROTO
MessageBoxW PROTO
GetCurrentDirectoryW PROTO

.data
caption		db "C", 0, "u", 0, "r", 0, "r", 0, "e", 0, "n", 0, "t", 0, "D", 0, "i", 0, "r", 0, "e", 0, "c", 0, "t", 0, "o", 0, "r", 0, "y", 0, ":", 0, 0, 0
Buffer    db 520 dup(0)

.code
main PROC

	push rbp
	mov rbp, rsp
	sub rsp, 20h

  	mov ecx, 520
  	lea rdx, Buffer
  	call GetCurrentDirectoryW

	xor rcx, rcx
	lea rdx, Buffer
	lea r8, caption
	xor r9, r9
	call MessageBoxW

	mov rcx, 0
	call ExitProcess

main ENDP

END
The finished compiled file is in the attachment.
If you run 'CurrentDirectory.exe' by double-clicking the mouse, the correct path of 'CurrentDirectory.exe' file location will be displayed.
But if you open this file through the x64 context menu, the path will be 'C:\Program Files (x86)\XYplorer', which should not be the case.

Opening a file via 64-bit context menu:
Image
The file is located in the 'D:App\MSVS\ASM\CurrentDirectory\x64\Release' directory, and the GetCurrentDirectory function returns 'C:\Program Files (x86)\XYplorer'.

If the file is launched by double-clicking or via the 32-bit context menu, the GetCurrentDirectory function returns the correct value:
Image

Re: The x64 context menu changes CurrentDirectory

Posted: 12 Apr 2025 10:14
by admin
Interesting. This issue will disappear with the upcoming 64-bit version.

Re: The x64 context menu changes CurrentDirectory

Posted: 12 Apr 2025 12:44
by zakoul
Where can I find out details about XY x64 and when approximately to expect it?

Re: The x64 context menu changes CurrentDirectory

Posted: 12 Apr 2025 13:29
by phred