Community Forums
Results 1 to 4 of 4

Thread: Is (FILE_LOCKED, "path_name") is not determining that the file is locked

  1. #1
    Join Date
    Mar 2007

    Is (FILE_LOCKED, "path_name") is not determining that the file is locked


    I'm running InstallShield 12 ( InstallScript) and am trying to determine
    if application is running during unistall.

    The fullpath to the application is "c:\\test\\application.exe"
    During uninstall the following code returns 0 even when "application.exe" is running.

    nResult = Is( FILE_LOCKED, "c:\\test\\application.exe" );

    0 means that "application.exe" is not locked, while I do see it running and
    it is not uninstalled by the InstallShield.

    What can be the problem ?

  2. #2
    Join Date
    Jun 2004
    Might be the quotes around your path? The documentation for the 'Is' function says:

    "Note that if the path or filename is enclosed in quotation marks, Is will fail. To ensure that the path or filename is not enclosed in quotation marks, call LongPathToQuote(szIsData, FALSE) before calling Is."

    Just my two cents. I have similar code for my install & uninstall, looks something like:

    szTempPath = TARGETDIR ^ "appexe.exe";

    if(Is(FILE_LOCKED, szTempPath) == TRUE)then
    MessageBox("App is running, close it and try again", WARNING);
    //app is not running, carry on

  3. #3
    Join Date
    Jun 2017

    Is (FILE_LOCKED, "path_name") is not always correct

    If you look at the info here:

    FILE_LOCKED—Is the file locked? Note that Is returns TRUE if the file is not accessible because of insufficient privileges.
    (I see that it returns TRUE when UAC is enabled on windows)

    Question> Is it possible to know if sufficient privileges are there before calling this function?

  4. #4
    Join Date
    Jun 2017
    Is(FILE_LOCKED, szTempPath)
    This returns correct result only if the installer has sufficient permissions.

    Is there a way to find out of if sufficient permissions are available, before invoking is(File_Locked,...);

    For example:
    > I face this issue when UAC is enabled on windows, and i want to do something like: (FILE_LOCKED,"c:\\program files\\ProductName\\appname.exe")
    >> this returns TRUE if I dont run the installer as admin.

    any suggestions?

Posting Permissions

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