I need to know if my program was run from a ZIP archive. Is it possible to do so?
Printable View
I need to know if my program was run from a ZIP archive. Is it possible to do so?
may be you can find that out by looking at parent process, if you can somehow know that the exe that run that process is a zip program.
http://www.codeproject.com/KB/threads/ParentPID.asp
There are too many different zip programs.Quote:
if you can somehow know that the exe that run that process is a zip program.
Why ?Quote:
I need to know if my program was run from a ZIP archive.
If your exe is located in the windows temp folder, it might indicate it was extracted there by a zip tool. But I would not rely on this to make any important decisions regarding how my exe should behave...
Yeah, but how can you tell that the directory is temp?
The program puts itself into Windows auto run key if user selects so, thus it'd be desirable for the exe to be located in the permanent folder. Unfortunately many people run it right from the ZIP file.Quote:
Originally Posted by Skizmo
I don't think there're any parent processes, or maybe actually Windows Explorer is the one.Quote:
Originally Posted by Krishnaa
I thought maybe the file/folder it was put in will have the FILE_ATTRIBUTE_COMPRESSED or FILE_ATTRIBUTE_ENCRYPTED, or some special attribute. But that doesn't seem to be the case.
GetTempPath http://msdn.microsoft.com/en-us/libr...92(VS.85).aspx
I suggest you simply don't put it in autorun if the folder is temporary...