I need to register a dll with Delphi (xe2) in Windows XP, but when running the method windows opens a "Run As" window where it needs to indicate the user who will perform the action. Even my user being an admin on the machine.
I used the following method to register the DLL:
procedure TForm1.ExecAdmin(Programa, Parametros: string);
var sei: TShellExecuteInfo;
begin
ZeroMemory(@sei, SizeOf(sei));
sei.cbSize := SizeOf(TShellExecuteInfo);
sei.Wnd := Application.Handle;
sei.fMask := SEE_MASK_FLAG_DDEWAIT or SEE_MASK_FLAG_NO_UI;
sei.lpVerb := PChar('runas');
sei.lpFile := PChar(Programa);
if Parametros <> '' then
sei.lpParameters := PChar(Parametros);
sei.nShow := SW_SHOWNORMAL;
ShellExecuteEx(@sei);
end;
The method call:
ExecAdmin('regsvr32.exe', '/s c:/sistema/msxml5.dll');
Questions:
a) Need Administrator privilege to register dll? b) How to run the method silently, without displaying the user checkbox?