My suggestion is that you ask the user for an admin domain\\name and password at that point, thus allowing them to continue. This is where the experimentation comes in. My first suggestion is to try the following code:
Code: Select all
lbResult := LogonUser(PChar(szUser), PChar(szDomain), PChar(szPassword),
{LOGON32_LOGON_NETWORK {} LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, hToken);
// nLastError := GetLastError;
if lbResult then
lbResult := ImpersonateLoggedOnUser(hToken);
if not lbResult then
Report('User "' + szDomain + '\\' + szUser + '" logon failed - cancelling.', true);
This is what I use in my backup app to access remote shares. The app takes on the rights of the user temporarily, and doing this may allow them to continue the install without trouble. Alternatively, if that doesn't work, how about you do this, or use the RunAs methods to re-run the installer as admin in a "pre-unpacked" state? Then it could just carry on.
This would all give a much smoother end-user experience.
Hopefully this will get into an update, along with my previous suggestion of being able to test for power-user status which is actually all that is needed to do a basic app install.
Thanks,
Matthew