CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    How to know if exe was run from a zip archive?

    I need to know if my program was run from a ZIP archive. Is it possible to do so?

  2. #2
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: How to know if exe was run from a zip archive?

    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
    Regards,
    Ramkrishna Pawar

  3. #3
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: How to know if exe was run from a zip archive?

    if you can somehow know that the exe that run that process is a zip program.
    There are too many different zip programs.

    I need to know if my program was run from a ZIP archive.
    Why ?

  4. #4
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: How to know if exe 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...
    Nobody cares how it works as long as it works

  5. #5
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: How to know if exe was run from a zip archive?

    Quote Originally Posted by zerver View Post
    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?

    Quote Originally Posted by Skizmo
    Why ?
    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 Krishnaa
    may be you can find that out by looking at parent process
    I don't think there're any parent processes, or maybe actually Windows Explorer is the one.

    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.

  6. #6
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: How to know if exe was run from a zip archive?

    Quote Originally Posted by ahmd View Post
    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.
    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...
    Nobody cares how it works as long as it works

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured