hi

i have written a program that edits registry........now the application works fine for computer administrator but doesnot work for limited user how i can programatically make it possible that my application always run with administrative right irrespective with user account right once the program has been properly installed by the computer administrator for everyone ................ my target operating system is XP................

Any help in this regard will be helpfull

I believe that this post might give the right direction on how to proceed with what you're looking for.

It outlines the use of restricted vs unrestricted tokens in the UAC. Now, I don't believe XP uses UAC (User Account Control) as I think it's a Vista/7 thing but I would imagine that the process would be similar even under a different umbrella.

This post may get you closer as it indicates a method of impersonating Administrator in XP but appears to have some drawbacks (such as the user needing to know the administrator password, in which case why not just have them log in as administrator to begin with).

Unfortunately, I haven't been able to find much on running at administrator level in XP but I have found lots on setting permission tokens in Vista/7... Sorry.

Hope this helps anyway :) Mark as solved if it does.

commented: Words!!! +10

Good suggestion by Lasiphur. The class WindowsIdentity - is used to obtain a Windows account token through a call to the unmanaged Win32 LogonUser function, and use that token to impersonate another user.

I'd suggest you to read - Windows Impersonation using C# article.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.