سؤال

During my innosetup application installation, I am registering a dll (which is used for windows right click context menu and icon overlays, something similar to dropbox/tortoise cvs) and performing some other stuffs also. Till now, I am insalling the application only for the administrator user. The dll will write the information in HKCR, HKLM. Now, I plan to support installation for other non-admin users too (standard user).

I tried several things like below,

  • changed the privilegerequired from Admin to none.
  • changed all registry updates from HKLM to HKCU.

But, if I try to install the application, the dll registration failed due to unable to write on HKCR. So, I planned to register dll only for the admin user. And for other normal users, plan to skip the dll registration and do the other stuff. But I can't find out, how to identify the current users is a admin user. Can any one let me know the following things,

  • can we identify whether the current login user is a admin/power user or not?
  • can we register dll (writing HKCR) with out admin rights?

Thanks for your reply.

هل كانت مفيدة؟

المحلول

You can check whether the current user is admin or power user:

[Code]
function IsRegularUser(): Boolean;
begin
    Result := not (IsAdminLoggedOn or IsPowerUserLoggedOn);
end;

نصائح أخرى

If you are installing things to HKLM, then you are already installing for all users, not just the administrator user. So you shouldn't change that.

The correct thing to do in an installer is to never write to HKCU. (For best results, also never write to HKCR -- write to HKLM\Software\Classes instead.)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top