Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   Why does drag&drop cause the change of working directory? (https://forum.exetools.com/showthread.php?t=15070)

BlackWhite 06-11-2013 20:59

Why does drag&drop cause the change of working directory?
 
Recently, I found a very weird behavior of Windows XP:
When I drag a file to an exe and drop, that exe's working
directory will be automatically changed to
"c:\documents and settings\user name"
in stead of current directory that exe lies in.

If I input that exe's name and its required arguments
at console, the above behavior will not happen.

Does anyone know the reason.

Thanks.

wilson bibe 06-13-2013 13:47

If I understood your question, You can Drag and Drop any compatible files, but without any argumment in the file that you want to Drag, the properties or argummnets to run, are always defined by de Drop exe file when it was compiled, and not by the Drag file.
Regards

BlackWhite 06-13-2013 15:33

Quote:

Originally Posted by wilson bibe (Post 85233)
If I understood your question, You can Drag and Drop any compatible files, but without any argumment in the file that you want to Drag, the properties or argummnets to run, are always defined by de Drop exe file when it was compiled, and not by the Drag file.
Regards

At first, I really wondered that the changing of working directory
was caused by the exe itself.

But I finally found that the changing of working directory was nothing to do
with the exe file, nor with the argument file that I had dragged.

I proved the above conclusion by doing the following experiment:
1. Replace the first byte of that exe's entry point with 0CCh which
stands for int 3.
2. Run SoftICE and command "i3here on" so that it will trap the int 3
instruction
3. Run the exe mentioned above by dragging an argument file to it.
4. When SoftICE stops the exe at its entry point, I input some
instructions at stopped address like this to call GetCurrentDirectory():
sub esp, 100
push esp
push 100
call GetCurrentDirectoryA
int 3
5. After calling GetCurrentDirectory(), I check the returning value and
find that the working directory has been changed to
"c:\documents and settings\user name"


All times are GMT +8. The time now is 13:30.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX