' PBXA64/PBXB64 DPAPI declarations for crypt32.dll/dpapi.h.
#IF NOT %DEF(PBX_DPAPI_PBI)
#DEFINE PBX_DPAPI_PBI
#INCLUDE ONCE "Legacy/Platform/win_types.inc"

%EQUATE `CRYPTPROTECT_UI_FORBIDDEN = &H00000001
%EQUATE `CRYPTPROTECT_LOCAL_MACHINE = &H00000004
%EQUATE `CRYPTPROTECT_CRED_SYNC = &H00000008
%EQUATE `CRYPTPROTECT_AUDIT = &H00000010
%EQUATE `CRYPTPROTECT_NO_RECOVERY = &H00000020
%EQUATE `CRYPTPROTECT_VERIFY_PROTECTION = &H00000040
%EQUATE `CRYPTPROTECT_CRED_REGENERATE = &H00000080
%EQUATE `CRYPTPROTECTMEMORY_BLOCK_SIZE = 16
%EQUATE `CRYPTPROTECTMEMORY_SAME_PROCESS = &H00
%EQUATE `CRYPTPROTECTMEMORY_CROSS_PROCESS = &H01
%EQUATE `CRYPTPROTECTMEMORY_SAME_LOGON = &H02

TYPE DATA_BLOB
    cbData AS DWORD
    pbData AS QUAD
END TYPE

DECLARE FUNCTION CryptProtectData LIB "crypt32.dll" ALIAS "CryptProtectData" (BYVAL pDataIn AS QUAD, BYVAL szDataDescr AS WSTRING, BYVAL pOptionalEntropy AS QUAD, BYVAL pvReserved AS QUAD, BYVAL pPromptStruct AS QUAD, BYVAL dwFlags AS DWORD, BYVAL pDataOut AS QUAD) AS LONG
DECLARE FUNCTION CryptUnprotectData LIB "crypt32.dll" ALIAS "CryptUnprotectData" (BYVAL pDataIn AS QUAD, BYVAL ppszDataDescr AS QUAD, BYVAL pOptionalEntropy AS QUAD, BYVAL pvReserved AS QUAD, BYVAL pPromptStruct AS QUAD, BYVAL dwFlags AS DWORD, BYVAL pDataOut AS QUAD) AS LONG
DECLARE FUNCTION CryptProtectMemory LIB "crypt32.dll" ALIAS "CryptProtectMemory" (BYVAL pDataIn AS QUAD, BYVAL cbDataIn AS DWORD, BYVAL dwFlags AS DWORD) AS LONG
DECLARE FUNCTION CryptUnprotectMemory LIB "crypt32.dll" ALIAS "CryptUnprotectMemory" (BYVAL pDataIn AS QUAD, BYVAL cbDataIn AS DWORD, BYVAL dwFlags AS DWORD) AS LONG

#ENDIF
