| 1 | /** | 
 
 
 
 
 | 2 | * This file is part of the mingw-w64 runtime package. | 
 
 
 
 
 | 3 | * No warranty is given; refer to the file DISCLAIMER within this package. | 
 
 
 
 
 | 4 | */ | 
 
 
 
 
 | 5 |  | 
 
 
 
 
 | 6 | #ifndef __DPAPI_H__ | 
 
 
 
 
 | 7 | #define __DPAPI_H__ | 
 
 
 
 
 | 8 |  | 
 
 
 
 
 | 9 | #ifndef DPAPI_IMP | 
 
 
 
 
 | 10 | #define DPAPI_IMP DECLSPEC_IMPORT | 
 
 
 
 
 | 11 | #endif | 
 
 
 
 
 | 12 |  | 
 
 
 
 
 | 13 | #ifdef __cplusplus | 
 
 
 
 
 | 14 | extern "C" { | 
 
 
 
 
 | 15 | #endif | 
 
 
 
 
 | 16 |  | 
 
 
 
 
 | 17 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= _WIN32_WINNT_WIN10 | 
 
 
 
 
 | 18 |  | 
 
 
 
 
 | 19 | #define CRYPTPROTECT_DEFAULT_PROVIDER { 0xdf9d8cd0, 0x1501, 0x11d1,{ 0x8c, 0x7a, 0x00, 0xc0, 0x4f, 0xc2, 0x97, 0xeb } } | 
 
 
 
 
 | 20 |  | 
 
 
 
 
 | 21 | #define szFORCE_KEY_PROTECTION "ForceKeyProtection" | 
 
 
 
 
 | 22 |  | 
 
 
 
 
 | 23 | #define dwFORCE_KEY_PROTECTION_DISABLED 0x0 | 
 
 
 
 
 | 24 | #define dwFORCE_KEY_PROTECTION_USER_SELECT 0x1 | 
 
 
 
 
 | 25 | #define dwFORCE_KEY_PROTECTION_HIGH 0x2 | 
 
 
 
 
 | 26 |  | 
 
 
 
 
 | 27 | #define CRYPTPROTECT_PROMPT_ON_UNPROTECT 0x1 | 
 
 
 
 
 | 28 | #define CRYPTPROTECT_PROMPT_ON_PROTECT 0x2 | 
 
 
 
 
 | 29 | #define CRYPTPROTECT_PROMPT_RESERVED 0x04 | 
 
 
 
 
 | 30 | #define CRYPTPROTECT_PROMPT_STRONG 0x08 | 
 
 
 
 
 | 31 | #define CRYPTPROTECT_PROMPT_REQUIRE_STRONG 0x10 | 
 
 
 
 
 | 32 |  | 
 
 
 
 
 | 33 | #define CRYPTPROTECT_UI_FORBIDDEN 0x1 | 
 
 
 
 
 | 34 | #define CRYPTPROTECT_LOCAL_MACHINE 0x4 | 
 
 
 
 
 | 35 | #define CRYPTPROTECT_CRED_SYNC 0x8 | 
 
 
 
 
 | 36 | #define CRYPTPROTECT_AUDIT 0x10 | 
 
 
 
 
 | 37 | #define CRYPTPROTECT_NO_RECOVERY 0x20 | 
 
 
 
 
 | 38 | #define CRYPTPROTECT_VERIFY_PROTECTION 0x40 | 
 
 
 
 
 | 39 | #define CRYPTPROTECT_CRED_REGENERATE 0x80 | 
 
 
 
 
 | 40 |  | 
 
 
 
 
 | 41 | #define CRYPTPROTECT_FIRST_RESERVED_FLAGVAL 0x0fffffff | 
 
 
 
 
 | 42 | #define CRYPTPROTECT_LAST_RESERVED_FLAGVAL 0xffffffff | 
 
 
 
 
 | 43 |  | 
 
 
 
 
 | 44 | #ifndef CRYPTO_BLOBS_DEFINED | 
 
 
 
 
 | 45 | #define CRYPTO_BLOBS_DEFINED | 
 
 
 
 
 | 46 | typedef struct _CRYPTOAPI_BLOB { | 
 
 
 
 
 | 47 | DWORD cbData; | 
 
 
 
 
 | 48 | BYTE *pbData; | 
 
 
 
 
 | 49 | } CRYPT_INTEGER_BLOB,*PCRYPT_INTEGER_BLOB; | 
 
 
 
 
 | 50 |  | 
 
 
 
 
 | 51 | typedef CRYPT_INTEGER_BLOB CERT_BLOB,*PCERT_BLOB; | 
 
 
 
 
 | 52 | typedef CRYPT_INTEGER_BLOB CERT_NAME_BLOB,*PCERT_NAME_BLOB; | 
 
 
 
 
 | 53 | typedef CRYPT_INTEGER_BLOB CERT_RDN_VALUE_BLOB,*PCERT_RDN_VALUE_BLOB; | 
 
 
 
 
 | 54 | typedef CRYPT_INTEGER_BLOB CRL_BLOB,*PCRL_BLOB; | 
 
 
 
 
 | 55 | typedef CRYPT_INTEGER_BLOB CRYPT_ATTR_BLOB,*PCRYPT_ATTR_BLOB; | 
 
 
 
 
 | 56 | typedef CRYPT_INTEGER_BLOB CRYPT_DATA_BLOB,*PCRYPT_DATA_BLOB; | 
 
 
 
 
 | 57 | typedef CRYPT_INTEGER_BLOB CRYPT_DER_BLOB,*PCRYPT_DER_BLOB; | 
 
 
 
 
 | 58 | typedef CRYPT_INTEGER_BLOB CRYPT_DIGEST_BLOB,*PCRYPT_DIGEST_BLOB; | 
 
 
 
 
 | 59 | typedef CRYPT_INTEGER_BLOB CRYPT_HASH_BLOB,*PCRYPT_HASH_BLOB; | 
 
 
 
 
 | 60 | typedef CRYPT_INTEGER_BLOB CRYPT_OBJID_BLOB,*PCRYPT_OBJID_BLOB; | 
 
 
 
 
 | 61 | typedef CRYPT_INTEGER_BLOB CRYPT_UINT_BLOB,*PCRYPT_UINT_BLOB; | 
 
 
 
 
 | 62 | typedef CRYPT_INTEGER_BLOB DATA_BLOB,*PDATA_BLOB; | 
 
 
 
 
 | 63 | #endif | 
 
 
 
 
 | 64 |  | 
 
 
 
 
 | 65 | typedef struct _CRYPTPROTECT_PROMPTSTRUCT { | 
 
 
 
 
 | 66 | DWORD cbSize; | 
 
 
 
 
 | 67 | DWORD dwPromptFlags; | 
 
 
 
 
 | 68 | HWND hwndApp; | 
 
 
 
 
 | 69 | LPCWSTR szPrompt; | 
 
 
 
 
 | 70 | } CRYPTPROTECT_PROMPTSTRUCT,*PCRYPTPROTECT_PROMPTSTRUCT; | 
 
 
 
 
 | 71 |  | 
 
 
 
 
 | 72 | DPAPI_IMP WINBOOL WINAPI CryptProtectData (DATA_BLOB *pDataIn, LPCWSTR szDataDescr, DATA_BLOB *pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags, DATA_BLOB *pDataOut); | 
 
 
 
 
 | 73 | DPAPI_IMP WINBOOL WINAPI CryptUnprotectData (DATA_BLOB *pDataIn, LPWSTR *ppszDataDescr, DATA_BLOB *pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags, DATA_BLOB *pDataOut); | 
 
 
 
 
 | 74 |  | 
 
 
 
 
 | 75 | #if NTDDI_VERSION >= 0x06020000 | 
 
 
 
 
 | 76 | WINBOOL WINAPI CryptProtectDataNoUI (DATA_BLOB *pDataIn, LPCWSTR szDataDescr, DATA_BLOB *pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags, const BYTE *pbOptionalPassword, DWORD cbOptionalPassword, DATA_BLOB *pDataOut); | 
 
 
 
 
 | 77 | WINBOOL WINAPI CryptUnprotectDataNoUI (DATA_BLOB *pDataIn, LPWSTR *ppszDataDescr, DATA_BLOB *pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags, const BYTE *pbOptionalPassword, DWORD cbOptionalPassword, DATA_BLOB *pDataOut); | 
 
 
 
 
 | 78 | #endif | 
 
 
 
 
 | 79 | #if NTDDI_VERSION >= 0x06000000 | 
 
 
 
 
 | 80 | DPAPI_IMP WINBOOL WINAPI CryptUpdateProtectedState (PSID pOldSid, LPCWSTR pwszOldPassword, DWORD dwFlags, DWORD *pdwSuccessCount, DWORD *pdwFailureCount); | 
 
 
 
 
 | 81 | #endif | 
 
 
 
 
 | 82 |  | 
 
 
 
 
 | 83 | #endif | 
 
 
 
 
 | 84 |  | 
 
 
 
 
 | 85 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) | 
 
 
 
 
 | 86 |  | 
 
 
 
 
 | 87 | #define CRYPTPROTECTMEMORY_BLOCK_SIZE 16 | 
 
 
 
 
 | 88 |  | 
 
 
 
 
 | 89 | #define CRYPTPROTECTMEMORY_SAME_PROCESS 0x0 | 
 
 
 
 
 | 90 | #define CRYPTPROTECTMEMORY_CROSS_PROCESS 0x1 | 
 
 
 
 
 | 91 | #define CRYPTPROTECTMEMORY_SAME_LOGON 0x2 | 
 
 
 
 
 | 92 |  | 
 
 
 
 
 | 93 | DPAPI_IMP WINBOOL WINAPI CryptProtectMemory (LPVOID pDataIn, DWORD cbDataIn, DWORD dwFlags); | 
 
 
 
 
 | 94 | DPAPI_IMP WINBOOL WINAPI CryptUnprotectMemory (LPVOID pDataIn, DWORD cbDataIn, DWORD dwFlags); | 
 
 
 
 
 | 95 |  | 
 
 
 
 
 | 96 | #endif | 
 
 
 
 
 | 97 |  | 
 
 
 
 
 | 98 | #ifdef __cplusplus | 
 
 
 
 
 | 99 | } | 
 
 
 
 
 | 100 | #endif | 
 
 
 
 
 | 101 |  | 
 
 
 
 
 | 102 | #endif |