The MASM Forum

General => The Campus => Topic started by: jj2007 on December 10, 2013, 09:01:36 AM

Title: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: jj2007 on December 10, 2013, 09:01:36 AM
Build this one:

include \masm32\include\masm32rt.inc

.data?
buffer   db MAX_PATH dup(?)

.code
start:
   invoke GetCurrentDirectory, MAX_PATH, addr buffer
   invoke GetCommandLine
   MsgBox 0, addr buffer, eax, MB_OK
   exit

end start


Then
1. launch it by selecting and hitting Enter
2. launch it by dragging a file over it

Only 2xExplorer  (http://netez.com/2xExplorer/)shows a decent behaviour.
Title: Re: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: dedndave on December 10, 2013, 09:39:24 AM
no pictures ?   :(

you're going to make me build that up, install 2x and freecommander ????
Title: Re: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: Evan on December 10, 2013, 11:29:31 AM
Quote from: jj2007 on December 10, 2013, 09:01:36 AM
Build this one:

include \masm32\include\masm32rt.inc

.data?
buffer   db MAX_PATH dup(?)

.code
start:
   invoke GetCurrentDirectory, MAX_PATH, addr buffer
   invoke GetCommandLine
   MsgBox 0, addr buffer, eax, MB_OK
   exit

end start


Then
1. launch it by selecting and hitting Enter
2. launch it by dragging a file over it

Only 2xExplorer  (http://netez.com/2xExplorer/)shows a decent behaviour.

Yeah umm naww it's okay I'll just keep writing lines that I know work.
Title: Re: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: Evan on December 10, 2013, 11:32:56 AM
Quote from: Evan on December 10, 2013, 11:29:31 AM
Quote from: jj2007 on December 10, 2013, 09:01:36 AM
Build this one:

include \masm32\include\masm32rt.inc

.data?
buffer   db MAX_PATH dup(?)

.code
start:
   invoke GetCurrentDirectory, MAX_PATH, addr buffer
   invoke GetCommandLine
   MsgBox 0, addr buffer, eax, MB_OK
   exit

end start


Then
1. launch it by selecting and hitting Enter
2. launch it by dragging a file over it

Only 2xExplorer  (http://netez.com/2xExplorer/)shows a decent behaviour.

Yeah umm naww it's okay I'll just keep writing lines that I know work.
I'm like flying or something I thought this was a thread I started sorry.
Title: Re: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: sinsi on December 10, 2013, 03:35:38 PM
Define "a decent behaviour"
Title: Re: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: jj2007 on December 10, 2013, 06:34:31 PM
Quote from: dedndave on December 10, 2013, 09:39:24 AM
you're going to make me build that up, install 2x and freecommander ????
Quote from: sinsi on December 10, 2013, 03:35:38 PM
Define "a decent behaviour"

Sorry, folks. Point is that FC and Windows Explorer surprised me with claiming that current folder (in my opinion C:\Masm32\Examples) was something crappy like C:\Users\jj\Documents

That was XP, now I'm on Win7-32, and it works as expected.

@Evan: This forum is not a playground. Post only if you have something substantial to contribute. There is the Romper room (http://masm32.com/board/index.php?board=20.0) if you want to play around. And, please, don't quote entire posts, and don't open new threads for every little question you may have. Open one thread, e.g. "Beginner's questions", and keep posting there.
Title: Re: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: sinsi on December 10, 2013, 06:58:55 PM
I think it has to do with Microsoft wanting a "docu-centric" approach, that the document is more important than the program.
Open a text file with notepad, the title bar is "document.txt - Notepad"
Title: Re: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: Magnum on December 11, 2013, 03:59:13 AM
I can not find lite version on the site.


2xExplorer is officially pronounced dead. You can still download it for free, but that's about it. xplorer² is the way to the future. It comes with a "pro" and a "lite" version. The lite version is free and much more powerful than 2xExplorer, and you should really give it a try!
Title: Re: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: jj2007 on December 11, 2013, 04:12:27 AM
Back to WinXP SP3 (open=simply open the exe, drag=drag a file over the exe):

Open FreeCommander        current dir: D:\Masm32\examples
Drag FreeCommander        current dir: D:\xxx\FreeCommander

Open WinXP Explorer        current dir: D:\Masm32\examples
Drag WinXP Explorer        current dir: C:\Documents and Settings\user

Open 2xExplorer        current dir: D:\Masm32\examples
Drag 2xExplorer        current dir: D:\Masm32\examples


Interesting that Win7 behaves better. Apparently they have learned something ;-)

This may be a minor issue, but the dragged files were always in the same folder; so why set the obscure path "C:\Documents and Settings\user" as current directory??

Applications assuming that a filename without path is sufficient may fail miserably, if they don't explicitly set the current folder based either on the commandline or on the executable's path. They will work on Win7 but fail on XP.

By the way, a simple batch file behaves exactly the same:
@echo off
echo %cd% && pause


Quote from: sinsi on December 10, 2013, 06:58:55 PM
I think it has to do with Microsoft wanting a "docu-centric" approach, that the document is more important than the program.

I would agree if Windows Explorer set the current dir to the folder of the document passed in the commandline. But it doesn't, on XP...
Title: Re: GetCurrentDirectory in Explorer, 2x, FreeCommander
Post by: Magnum on December 11, 2013, 06:18:50 AM
Works here.

C:\MASM32\SOURCE
Press any key to continue . . .