Modifying Program Options

Feb 9, 2011 at 6:18am
Hello Everyone!

There are a lot of frame based programs, I don't know if the naming is correct, but what I have in mind is something like Internet Explorer...
How can I modify something in Internet Explorer options, say homepage or connection settings such that this option's existance is granted.

I've seen a program that does that, can I do that in c++?

Note: This is not restricted to ie, it was just an example...

Thank you!
Feb 10, 2011 at 8:43am
Internet Explorer keeps the settings in registry, so all you need to do is to change the HKLM\Software\Microsoft\Internet Explorer\ keys/values. (your c++ app needs administrator privileges to do that).
Feb 11, 2011 at 8:18am
I am not an admin and can do that manually... I need something to do so automatically.

How can c++ check wether I am an admin or not?
Feb 12, 2011 at 11:11am
Use this sample from MSDN:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
BOOL IsUserAdmin(VOID)
/*++ 
Routine Description: This routine returns TRUE if the caller's
process is a member of the Administrators local group. Caller is NOT
expected to be impersonating anyone and is expected to be able to
open its own process and process token. 
Arguments: None. 
Return Value: 
   TRUE - Caller has Administrators local group. 
   FALSE - Caller does not have Administrators local group. --
*/ 
{
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); 
}

return(b);
}


You need to link against advapi32.dll.
Topic archived. No new replies allowed.