The x64 context menu changes CurrentDirectory

Things you’d like to miss in the future...
Post Reply
zakoul
Posts: 152
Joined: 11 Dec 2019 10:44

The x64 context menu changes CurrentDirectory

Post 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
Attachments
2025-04-12_095422.jpg
2025-04-12_095422.jpg (22.52 KiB) Viewed 373 times
2025-04-12_094543.jpg
2025-04-12_094543.jpg (19.93 KiB) Viewed 375 times
CurrentDirectory.zip
(1.02 KiB) Downloaded 51 times

admin
Site Admin
Posts: 64241
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: The x64 context menu changes CurrentDirectory

Post by admin »

Interesting. This issue will disappear with the upcoming 64-bit version.
FAQ | XY News RSS | XY X - Forum users with the Windows version and screen scaling percentage in the Location field of their profiles get priority support.

zakoul
Posts: 152
Joined: 11 Dec 2019 10:44

Re: The x64 context menu changes CurrentDirectory

Post by zakoul »

Where can I find out details about XY x64 and when approximately to expect it?

phred
Posts: 480
Joined: 26 Dec 2021 02:10
Location: XY 64bit on Windows 10 at 100% from Boston USA

Re: The x64 context menu changes CurrentDirectory

Post by phred »


Post Reply