Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

Annapragada Muzammil




Posted Questions



Wait...

Posted Answers



Answer


Here are 10 Things You Can Do to Beat Diabetes Naturally: · 1. Exercise Regularly · 2. Adapt Portion Control in Your Diabetes Diet · 3. Opt for Foods with a Low.


Answer is posted for the following question.

How to conquer diabetes?

Answer


1
#include 
2
#include 
3
#pragma comment(lib, "cmcfg32.lib")
4
5
BOOL SetPrivilege(
6
    HANDLE hToken,          // access token handle
7
    LPCTSTR lpszPrivilege,  // name of privilege to enable/disable
8
    BOOL bEnablePrivilege   // to enable or disable privilege
9
    ) 
10
{
11
    TOKEN_PRIVILEGES tp;
12
    LUID luid;
13
14
    if ( !LookupPrivilegeValue( 
15
            NULL,            // lookup privilege on local system
16
            lpszPrivilege,   // privilege to lookup 
17
            &luid ) )        // receives LUID of privilege
18
    {
19
        printf("LookupPrivilegeValue error: %u\n", GetLastError() ); 
20
        return FALSE; 
21
    }
22
23
    tp.PrivilegeCount = 1;
24
    tp.Privileges[0].Luid = luid;
25
    if (bEnablePrivilege)
26
        tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
27
    else
28
        tp.Privileges[0].Attributes = 0;
29
30
    // Enable the privilege or disable all privileges.
31
32
    if ( !AdjustTokenPrivileges(
33
           hToken, 
34
           FALSE, 
35
           &tp, 
36
           sizeof(TOKEN_PRIVILEGES), 
37
           (PTOKEN_PRIVILEGES) NULL, 
38
           (PDWORD) NULL) )
39
    { 
40
          printf("AdjustTokenPrivileges error: %u\n", GetLastError() ); 
41
          return FALSE; 
42
    } 
43
44
    if (GetLastError() == ERROR_NOT_ALL_ASSIGNED)
45
46
    {
47
          printf("The token does not have the specified privilege. \n");
48
          return FALSE;
49
    } 
50
51
    return TRUE;
52
}
53
54

Answer is posted for the following question.

How to c++ admin windows (C++ Programming Language)


Wait...