|
Hi,
My application writes into a particular location in Registry
Eg. RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run",
0, KEY_ALL_ACCESS, &h_Key); //Open a particular registry key
//Write to that registry key.
I need to restrict this activity to only Administrator..
Can I have a code snippet which allows this only for Administrator.
Thanks.
Venkat
|
|
|
|
|
|
Thanks.. But I am getting a compilation error even after including "shlobj.h"
|
|
|
|
|
venkat.kupunaram wrote: I am getting a compilation error
My telescope is missing. Can you tell me what exactly the error is?
|
|
|
|
|
I am using VC++6.0
error C2065: 'IsUserAnAdmin' : undeclared identifier
|
|
|
|
|
The function information of IsUserAnAdmin() says - "Shell32.DLL version 5.0 or higher will be required" to make use of this call, which means earlier versions won't have this function exported at all.
See here[^]. You'll need the latest SDK (or the SDK which is latest enough and has version 5.0 or higher of Shell32.DLL) to use this call.
|
|
|
|
|
I am using File version 6.0.3790.4184.. But still I am getting a compilation error.
|
|
|
|
|
Do you have the Feb 2003 version of the Platform SDK?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Rajesh R Subramanian wrote: My telescope is missing. Can you tell me the what exactly the error is?
Nope. Go back home and get the telescope.
BTW: Eventually MFC appeared in your profile
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Nope. Go back home and get the telescope. [Poke tongue]
Sorry, but I see the question was not "very urgent", so I could ask the OP to take some time to let me know more of the error.
CPallini wrote: BTW: Eventually MFC appeared in your profile [Big Grin]
|
|
|
|
|
Rajesh R Subramanian wrote: Sorry, but I see the question was not "very urgent", so I could ask the OP to take some time to let me know more of the error.
You're wrong: "very urgent" it's the default.
"Plz plz very urgent" is the courtesy form.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
"Attack of the Urgent Monkeys"
BTW, we're dangerously close to hijack this thread.
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Use BOOL IsUserAnAdmin(VOID);
Perform writing to the registry only if this function returns true.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
This api is giving a compilation error in VC++6.0
|
|
|
|
|
Here is the code for IsUserAdmin
<code>
BOOL IsUserAdmin(VOID)
{
BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup);
if(b)
{
if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
b = FALSE;
}
FreeSid(AdministratorsGroup);
}
</code>
<div class="ForumSig">Somethings seem HARD to do, until we know how to do them.
;-)_AnShUmAn_
</div>
|
|
|
|
|
Thanks.. But I written a user define function and written the above code.. I am getting a compilation error at CheckTokenMembership...
|
|
|
|
|
You should do the following:
Header: Declared in Winbase.h; include Windows.h.
Library: Use Advapi32.lib
And look for Advapi32.dll. Check out MSDN for more details
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
If you can speak Chinese,you can go to"www.csdn.net" .He will help you !
|
|
|
|
|
Hai all,
I need your help to retrieve the information shown in Local area connection status dilog in vc++ or c++.
The informations are uploaded and downloaded packets,Duration.
Thanks
|
|
|
|
|
This article might be of some help.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
HI All,
Im new to MFC.I have done a Dialoged based GUI(Im using Bitmap Buttons).I need to use UP and DOWN keyboard event for that buttons.Help me.Very Urgent.........
Thanks & Regards
Anitha
|
|
|
|
|
Is it for selection change? Please explain your purpose
|
|
|
|
|
yes, i need for selection change.
|
|
|
|
|
is it just for selection process, No need to up and down key event.Do u want to do somthing when it selected?
|
|
|
|