Problem in Vista - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

Problem in Vista

Hi!

I have developed an MSI on Windows XP SP2, using Visual studio 6.0. I am using AI 6.4.1 and building an enterprise project.
It is working fine on all Operating Systems except Vista (Ultimate edition).

On Vista (Ultimate edition), the problem occurs when I am creating shortcuts programmatically and saving the .LNK file in following folder to make them show in "Start Menu":
C:\Documents and Settings\All Users\Start Menu\Programs\MyApp

When i ran MSI as administrator (on right click, chossing option "Run As Administrator") it works fine. But, I can not ask user to right click MSI and run it as administrator.

I would like to run MSI, just by double clicking it.

Note: I know, I could try Media->Bootstrapper->security->Execution level->"Require Administrator", but it will make .exe instead of MSI, and, coz of some reasons, i don't want .exe file for my setup.

Code to create Shortcut:

Code: Select all

HRESULT CreateShortcut(LPCSTR pszShortcutFile, LPCSTR pszArgs, LPCSTR pszDir, LPCSTR pszLink, LPSTR pszDesc, int iconIndex)
{
    HRESULT hres;
    IShellLink *psl;
	// Create an IShellLink object and get a pointer to the IShellLink
	// interface (returned from CoCreateInstance).
    hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
                            IID_IShellLink, (void **)&psl);
    if (SUCCEEDED(hres))
    {
       IPersistFile *ppf;       
	   // Query IShellLink for the IPersistFile interface for
	   // saving the shortcut in persistent storage.
       hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf);
	   if (SUCCEEDED(hres))
	   {   
	        WORD wsz[MAX_PATH];   // buffer for Unicode string
	   		// Set the path to the shortcut target.
			// This is the name of the item that the shortcut points to.
			// Target :
          	hres = psl->SetPath(pszShortcutFile);
			// Sets the command-line arguments for a shell link object. 
			hres = psl->SetArguments(pszArgs);
			if(iconIndex != -1)
			   hres = psl->SetIconLocation(pszShortcutFile, iconIndex);
			// Set the  folder  that  contains the original item or some 
			// related files. Sometimes, programs need to use files from 
			// other locations. You may need to specify the folder where 
			// these files are located so that the programs can find them.
			// Start in :
			hres = psl->SetWorkingDirectory(pszDir);			
			if (!SUCCEEDED(hres))
				AfxMessageBox("SetPath failed!");

            // Set the description of the shortcut.
          	hres = psl->SetDescription(pszDesc);

			if (!SUCCEEDED(hres))
				AfxMessageBox("SetDescription failed!");

	     	// Ensure that the string consists of ANSI characters.
	     	int retvalue = MultiByteToWideChar(CP_ACP, 0, pszLink, -1, wsz, MAX_PATH);

          	// Save the shortcut via the IPersistFile::Save member function.
			hres = ppf->Save(wsz, FALSE);
			if (!SUCCEEDED(hres))
				AfxMessageBox("Save failed!");

            // Release the pointer to IPersistFile.
          	ppf->Release();
       }
       // Release the pointer to IShellLink.
       psl->Release();
    }
    return hres;
}


So, plz help me to sort the problem.

Regards,
Vicky
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem in Vista

Hi Vicky,

Please note that on Vista custom actions which affect the system should run as "Deferred with no Impersonation" in order to have full privileges. If the problem persists even when using this option for your custom action please send us the AIP you are using to support at advancedinstaller dot com so we can investigate it.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

Re: Problem in Vista

Dear Cosmin!

Thanks for ur quick reply. If, I'll go for 'Deferred with no impersonation' then I've to make two MSIs, one for XP and second for Vista. But, i want to make only one MSI which will work on both operating systems. Plz give me suggestions to do that. i am coding for customAction.dll on Win-XP(with SP2) using Visual Studio 6.0.

One thing more, 'Deferred with no impersonation' is disabled in my .aip. I am calling my custom action on "InstallFinalize".

Regards,
Vicky
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem in Vista

Hi Vicky,

Please note that "Deferred with no Impersonation" custom actions work on both XP and Vista. Therefore, you can use only one installation package.
'Deferred with no impersonation' is disabled in my .aip. I am calling my custom action on "InstallFinalize"
Please note that deferred custom actions can be scheduled only between "InstallInitialize" and "InstallFinalize". Therefore, you can move your custom action under the "InstallIIS" standard action in order to make it deferred.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

Re: Problem in Vista

Hi Cosmin!

I have changed all custom actions to 'Deferred with no impersonation', but, problem persists.
I am doing following things by using BATCH (.bat) File:
1: Register/Unregister DLL, by using command regsvr32.
2: Remove directory, by using command "rmdir /s /q dirName".
3: Copy directory, by using command "XCOPY /C /E /Y /I dirname".

Does anyone of the above create problem? But, batch file is working fine when i opt "Run As Administrator" on Vista.


Regards,
Vicky
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem in Vista

Hi Vicky,

I'm not sure why you are encountering this behavior. Can you please send us the AIP you are using and the custom action with the problem to support at advancedinstaller dot com so we can investigate them?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

Re: Problem in Vista

Hi Cosmin!

I've send you mail regarding this issue.

Regards,
Vicky
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem in Vista

Hi Vicky,

Does the log show which custom action fails?

I investigated the code called by the "CustomAction.dll_8" custom action and it writes into files on the C: drive. This is usually a problem on Vista when the package doesn't have Administrator privileges.

A solution would be to write into a file from a per-user location, like the Temp folder or Application Data. Another solution would be to set the custom action as deferred and pass the property it uses through the "Action Data" field. In this case you will be able to access the value of the property through the CustomActionData property.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

Re: Problem in Vista

Hi Cosmin!

I think the problem is not with "CustomAction.dll_8" i.e fn CheckForPrerequisits which fires on CostFinalize. I have faced problem in "CustomAction.dll_2" i.e. fn CopyAndRegisterBean which fires on InstallIIS.

In "CustomAction.dll_2", I am using a batch file to perform number of things, and this batch file does not get executed properly.


Regards,
Vicky
vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

Re: Problem in Vista

Hi Cosmin!

Can i make my MSI with Administrator privileges for Vista, on windows-XP using Visual Studio 6.0?

Regards,
Vicky
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem in Vista

Hi Vicky,
Can i make my MSI with Administrator privileges for Vista, on windows-XP using Visual Studio 6.0?
In order to always launch the MSI with Administrator privileges you can use a bootstrapper which requires an execution level.

However, the "CustomAction.dll_2" custom action uses installer properties. Since deferred custom actions cannot access installer properties, you can try this approach:
- add the properties you need in the "Action Data" field, separated by a pipe character ("|")
- in the custom action parse the "CustomActionData" property in order to get the values of the properties from the Action Data field.

For example, if the Action Data field is set to:

Code: Select all

[APPDIR]|[JRE_VERSION]
then the CustomActionData property may look like this:

Code: Select all

C:\MyFolder|1.6.0
The value of the CustomActionData property can be parsed by using the strtok function. This way your custom action can run as deferred and still access installer properties.

As a side-note, you can try using the ShellExecute function to launch the BAT file.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

Re: Problem in Vista

Hi Cosmin!

Thanks for ur reply.

I know,i can go to bootstrapper->security level to execute my MSI with administrator privileges, but, it will create an .exe instaed of .MSI, which i don't want. Is there other way to do this?

One thing more, I have installed MSI on vista from command line;
==> msiexec/i mymsi.msi /l*v setup.log
It hangs on "CustomAction.dll_2" i.e. fn CopyAndRegisterBean which fires on InstallIIS, and, i used process explorer to find out, if anything weird is happening. I came to know that it is doing XCOPY which i've fired from my batch file.

XCOPY is trying to copy , a directory from "c:\program files\myfolder" to "c:\program files\folder_x\folder_y\".
I am attaching .log file with this post. Hope this could be helpful.

Regards,
Vicky
Attachments
setup_log.zip
(205.52 KiB) Downloaded 493 times
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem in Vista

Hi Vicky,

I investigated the log you sent and the installation is canceled before it reaches the "CustomAction.dll_2" custom action. I noticed that most of your custom actions use installer properties and try to write into locations which require Administrator privileges. Therefore, a solution would be to schedule them as "Deferred with no impersonation" and use the "Action Data" field to pass the properties to them.
I know,i can go to bootstrapper->security level to execute my MSI with administrator privileges, but, it will create an .exe instaed of .MSI, which i don't want. Is there other way to do this?
I'm not sure if there is another way for running the custom actions with full Administrator privileges. The only options we know are:
- an EXE bootstrapper which requests an execution level
- custom actions which don't use impersonation
- "Run As Administrator" option in Windows

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

Re: Problem in Vista

Hi Cosmin!


I am fetching a property "VERIFYREADYDLGCHECKBOX_299_PROP" of a checkbox in "CustomAction.dll_2" which is 'Deferred with no impersonation', fires on InstallIIS. But, i am reading this property using following code:

Code: Select all

TCHAR szBackup [50];
DWORD cchValue = sizeof(szBackup)/sizeof(TCHAR);
//DWORD cchValue;
if (MsiGetProperty(hModule, "VERIFYREADYDLGCHECKBOX_299_PROP", szBackup, &cchValue)== ERROR_SUCCESS)
{ -- code-- }


Does 'Deferred with no impersonation' not allow me to read this sort of properties too? If yes , then, what will be the solution?

Regards,
Vicky
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem in Vista

Hi Vicky,
Does 'Deferred with no impersonation' not allow me to read this sort of properties too?
Yes, please note that I explained this in one of my previous posts:
http://www.advancedinstaller.com/forums ... 061#p19341

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”