I just completed my application development efforts on a D2D1 application using Visual Studio 2010 IDE in C++. I was exploring different ways of creating a package from this and used the built-in Visual Studio installer/setup. The setup project compiled smoothly and an install file was created. I was also able to successfully install the application according to my requirements. However, when I install it in the default location (which would be my preferred location – C:\Program Files(x86)), the application refuses to launch. Here is the debugging I was able to do so far:
- Installed in C:\Program Files(x86): Application does not launch normally.
- Installed in C:\Program Files(x86): Application launches when “Run as administrator”
- Installed in a location other than %ProgramFiles% or %ProgramFiles(x86)%: Application launches normally without having to “Run as administrator”.
I have tried cornering the error cases, but don’t have anything conclusive or convincing so far, which is why I am seeking the experts help here. What I have done further:
-
Used Dependency Walker x86 version to figure out where/what the dll calls are through the profiler. It did not provide me with anything concrete – depends.exe believes my application has delay-load dependent modules GPSVC.dll and IESHIMS.dll and I am fairly certain that I don’t need those. The profiler also indicates a CRT 0xC0000417 error – but it is difficult for me to say if it is related at all.
-
I do have a manifest defined for my visual styles as a pragma. Removing this did not help.
-
If this helps – my C++ project manifest file options in the Linker settings looks like this:
- Generate Manifest – Yes
- Allow Isolation -Yes
- Enable UAC – Yes
- UAC Execution level – As invoker
- UAC Bypass UI Protection – No
-
I have converted all CRT functions to it’s secure version (sprintf -> sprintf_s) as recommended by MSDN documentation. Is this even related here?
-
I have tried simply copying the .exe to %ProgramFiles(x86)%. It did not help – so it appears that my installer is not the one creating the problem.
-
I use _dupenv_s in several places within the code to retrieve %COMSPEC% , %TEMP% etc.
Any pointers to how I can proceed further with the debug is highly appreciated. I did read around about this and some experts suggest incorrect string handling or large or invalid directory names; but I don’t see that as relevant in my case since the issue is unique to launching the application normally under %ProgramFiles(x86)% .
Other details:
* OS Windows 7 – 64 bit, Vista with latest SP – 32 bit
* Visual Studio Professional 2010, C++ Project with .Net client profile target
Visual Studio Installer; Target platform 32 bit
* Nature of application – Direct2D based
Pardon me if I did not use the correct technical terms. I am a novice in application deployment.
That is correct Viswanathan, you cannot write to Program Files/Program Files(x86) if you are not running from an elevated process.
If your application needs to write custom settings in a file when it is launched you should create a dedicated folder for it under CommonAppDataFolder