|
From: David C. <dc...@ag...> - 2013-06-24 20:11:38
|
Is the CA immediate or deferred? A quick test (printf("%d\n", IsUserAnAdmin());) on my Win7 system shows IsUserAnAdmin (I am) returns false in a normal cmd shell. But if I elevate, then it's true. (This implies your CA is immediate).
Dave
________________________________
From: Lukas Haase <luk...@gm...>
To: wix...@li...
Sent: Monday, June 24, 2013 11:17 AM
Subject: [WiX-users] Custom Action ALWAYS with admin rights
Hi,
I have a custom action in a DLL. If I check admin rights in the DLL with
IsUserAnAdmin it returns FALSE!
The wxs file makes sure that installation can only run with admin privs:
<Condition Message="This installation requires admin privileges">
Privileged
</Condition>
The custom action is included via:
<Binary Id='UpdateInstall' SourceFile='UpdateInstall.dll' />
<InstallExecuteSequence>
<Custom Action='UpdateInstall' After='InstallFinalize'>NOT
Installed</Custom>
</InstallExecuteSequence>
The UpdateInstall.dll exports UpdateInstall just as:
[...]
extern "C" UINT __stdcall UpdateInstall(MSIHANDLE hInstall)
{
if(IsUserAnAdmin())
MsiMessageBox(hInstall, "admin privs", 0);
else
MsiMessageBox(hInstall, "NO admin privs!!", 0);
}
Thanks,
Luke
|