Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6243825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:12:46+00:00 2026-05-24T12:12:46+00:00

Possible Duplicate: Delphi: Prompt for UAC elevation when needed My application written in Delphi

  • 0

Possible Duplicate:
Delphi: Prompt for UAC elevation when needed

My application written in Delphi 7 for Windows 7 requires administrator privileges for some functionality. How can I elevate it to Administrator from source code?

I check the user rights with this code:

function IsUserAdmin : boolean;
const CAdminSia : TSidIdentifierAuthority = (value: (0, 0, 0, 0, 0, 5));
var sid : PSid;
    ctm : function (token: dword; sid: pointer; var isMember: bool) : bool; stdcall;
    b1  : bool;
begin
  result := false;
  ctm := GetProcAddress(LoadLibrary('advapi32.dll'), 'CheckTokenMembership');
  if (@ctm <> nil) and AllocateAndInitializeSid(CAdminSia, 2, $20, $220, 0, 0, 0, 0, 0, 0, sid) then
  begin
    result := ctm(0, sid, b1) and b1;
    FreeSid(sid);
  end;
end;

If the application started as administrator, then it returns True; if not, then False.
Now if I have False as the result I want to automatically elevate the program to Administrator.

I tried with manifest elevate to administrator, but if I start the application, then I see a UAC prompt and if I answer “No”, then application will not run at all.

Any chance for help?

I need administrator rights for raw access to the physical drive.

EDIT:

I also tried to disable UAC only for this application (ParamStr(0)) also from code (after pressing “Disable UAC for this application” button).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:12:47+00:00Added an answer on May 24, 2026 at 12:12 pm

    Processes receive their token at startup and then cannot change them. Thus if you want an app that appears to elevate for some subset of its functionality, that functionality must involve a new process. What you cannot do is elevate an existing process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What Web Application Framework for Delphi is recommended? We have a Delphi
Possible Duplicate: Filetype association with application (C#) I'm writing a C# Windows app to
Possible Duplicate: What's wrong with Delphi's “with” I am have a problem debugging code
Possible Duplicate: Parsing text in C Say I have written to a text file
Possible Duplicate: Delphi, How to get all local IPs? What's the easiest & quickest
Possible Duplicate: Standard URL encode function? I need to transofrm a Delphi string (like
Possible Duplicate: Is there some ninja trick to make a variable constant after its
Possible Duplicate: How does one escape characters in Delphi string In Delphi a string
Possible Duplicate: Embarcadero D2010 hide welcome page I have Delphi 2010. How do I
Possible Duplicate: How to also prepare for 64-bits when migrating to Delphi 2010 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.