Unable to create folder

Got a problem you cannot solve? Try here.
JonMRobertson
Posts: 8
Joined: Wed Feb 18, 2009 4:53 pm

Unable to create folder

Postby JonMRobertson » Tue Dec 02, 2014 2:26 pm

I can't get my installer to create a folder. CREATE FOLDER executes without any success/fail feedback that I'm aware of. Nothing is written to the log. I've tried using the DLL method described at viewtopic.php?p=738, and the result value is EXTERNALEXCEPTION.

I change $APPDATA$ to reference our application specific folder:

Code: Select all

Get Common Folder Location System->Application Data Directory into APPDATA
Set Variable APPDATA to $APPDATA$MedEvolve


Here's the CREATE FOLDER code snippet:

Code: Select all

  if Variable SUCCESS not Equals ERROR
    if Variable SUCCESS not Equals CANCEL
      MessageBox: ProgramData, $APPDATA$
      Create Folder $APPDATA$
    end
  end

Here's the DLL code snippet:

Code: Select all

  MessageBox: ProgramData, $APPDATA$
  Set Variable DIRRESULT to
  Call DLL Function $WINSYSDIR$\kernel32.dll->CreateDirectoryA (get result into variable DIRRESULT)
  MessageBox: DirResult, $DIRRESULT$

In both scenarios, the message box contains the expected folder name:

C:\ProgramData\MedEvolve

I'm using 9R2 and testing in Windows 8.1. I have not tested in earlier versions of Windows because I need this to work in all versions.

To further complicate testing, when I run the install via the IDE, I often see this message:

---------------------------
Windows Installer Error Notification
---------------------------
The following error occured while applying changes to system:
This installation is forbidden by system policy. Contact your system administrator

Please review your installation commands.
---------------------------

I have no idea why this occurs. The installer never gives this error when I run it outside of the IDE. My Windows account has admin rights. I've set Windows 8 UAC settings as low as I can. The installer is configured to Always Elevate. Note this is not the configuration that I want to use in the end, but rather where I am while troubleshooting this issue and trying to find a solution. If I open an elevated command prompt, I can MD C:\ProgramData\MedEvolve and successfully create the folder.

Any suggestions?

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Unable to create folder

Postby FrancescoT » Wed Dec 03, 2014 11:57 am

Dear User,

the Create folder command is a Windows Installer command (Purple Command = deferred execution) and due of this, you should call it before the Apply Install execution ... otherwise the folder will be never created.
http://www.installaware.com/forum/viewtopic.php?f=2&t=4338

Unfortunately IA 9 doesn't include any Native Engine functionality, that it could be used to force the immediate execution of a Window Installer command.

With the most recent OSes (if UAC is enabled) an Admin account is never an effective Admin account. You need to elevate the process always, otherwise any modification to restricted system areas it will fail. In your case, I suppose you should elevate the IA IDE process as well.

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

JonMRobertson
Posts: 8
Joined: Wed Feb 18, 2009 4:53 pm

Re: Unable to create folder

Postby JonMRobertson » Wed Dec 03, 2014 3:07 pm

Thanks for the explanation. I only wanted to create the folder if the install was successful. However, I was not aware of this limitation. I'll adjust accordingly.

Regarding UAC, I'm well aware of the implications and restrictions imposed by UAC. Prior to Vista, our application was very non-UAC friendly. I went through every project, including our services, and changed them so that could run with least user privilege.

The error that I mentioned when running the installer from the IA IDE occurs while running the IDE elevated.

Jon

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Unable to create folder

Postby FrancescoT » Thu Dec 04, 2014 9:22 am

Dear Jon,

in all honesty I am not able to replicate your behavior with elevating the IA IDE ... however, I can only use our latest IA version currently.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 133 guests