Bonjour,
J'essaie d'utiliser depuis 2h une fonctions qui est normalement dans Sddl.h (ConvertStringSecurityDescriptorToSecurityDescriptor) mais plusieurs erreurs :

C:\Users\Yohann\Desktop\injector\main.cpp|63|error: 'szSD' was not declared in this scope|
C:\Users\Yohann\Desktop\injector\main.cpp|63|error: 'SDDL_REVISION_1' was not declared in this scope|
Je ne comprend pas pourquoi pourtant bien mis Sddl.h...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
#include <windows.h>
#include <wchar.h>
#include <math.h>
#include <time.h>
#include <Sddl.h>
 
using namespace std;
 
BOOL CreateMyDACL(SECURITY_ATTRIBUTES * pSA)
{
     // Define the SDDL for the DACL. This example sets
     // the following access:
     //     Built-in guests are denied all access.
     //     Anonymous logon is denied all access.
     //     Authenticated users are allowed
     //     read/write/execute access.
     //     Administrators are allowed full control.
     // Modify these values as needed to generate the proper
     // DACL for your application.
     TCHAR * szSD = TEXT("D:")       // Discretionary ACL
        TEXT("(D;OICI;GA;;;BG)")     // Deny access to
                                     // built-in guests
        TEXT("(D;OICI;GA;;;AN)")     // Deny access to
                                     // anonymous logon
        TEXT("(A;OICI;GRGWGX;;;AU)") // Allow
                                     // read/write/execute
                                     // to authenticated
                                     // users
        TEXT("(A;OICI;GA;;;BA)");    // Allow full control
                                     // to administrators
 
    if (NULL == pSA)
        return FALSE;
 
     return ConvertStringSecurityDescriptorToSecurityDescriptor(
                szSD,
                SDDL_REVISION_1,
                &(pSA->lpSecurityDescriptor),
                NULL);
}
 
int main(void)
{
    /*if(OpenClipboard(GetForegroundWindow()))
    {
        HANDLE pText = GetClipboardData(CF_UNICODETEXT);
 
            if(pText)
            {
                char *pchData = (char*)GlobalLock(pText);
                char *strData = pchData;
                GlobalUnlock(pText);
                CloseClipboard();
                cout <<strData;
            }
    }*/
    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,GetCurrentProcessId());
    SECURITY_ATTRIBUTES sa;
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
    sa.lpSecurityDescriptor =
    sa.bInheritHandle = FALSE;
    if (!ConvertStringSecurityDescriptorToSecurityDescriptor(szSD, SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL))
        wcout<<"erreur convertstring..."<<endl;
    if (!SetKernelObjectSecurity(hProcess, DACL_SECURITY_INFORMATION, sa.lpSecurityDescriptor))
        wcout<<"false"<<endl;
    Sleep(20000);
}
Merci