From 1b6a04ca5504955c571d1c97504fb45ea0befee4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 8 Jan 2024 01:21:28 +0400 Subject: Initial vendor packages Signed-off-by: Valentin Popov --- vendor/winapi/src/um/dpapi.rs | 100 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 vendor/winapi/src/um/dpapi.rs (limited to 'vendor/winapi/src/um/dpapi.rs') diff --git a/vendor/winapi/src/um/dpapi.rs b/vendor/winapi/src/um/dpapi.rs new file mode 100644 index 0000000..42f5824 --- /dev/null +++ b/vendor/winapi/src/um/dpapi.rs @@ -0,0 +1,100 @@ +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Data Protection API Prototypes and Definitions +use shared::minwindef::{BOOL, BYTE, DWORD, LPVOID}; +use shared::windef::HWND; +use um::wincrypt::DATA_BLOB; +use um::winnt::{LPCWSTR, LPWSTR, PSID, PVOID}; +pub const szFORCE_KEY_PROTECTION: &'static str = "ForceKeyProtection"; +pub const dwFORCE_KEY_PROTECTION_DISABLED: DWORD = 0x0; +pub const dwFORCE_KEY_PROTECTION_USER_SELECT: DWORD = 0x1; +pub const dwFORCE_KEY_PROTECTION_HIGH: DWORD = 0x2; +STRUCT!{struct CRYPTPROTECT_PROMPTSTRUCT { + cbSize: DWORD, + dwPromptFlags: DWORD, + hwndApp: HWND, + szPrompt: LPCWSTR, +}} +pub type PCRYPTPROTECT_PROMPTSTRUCT = *mut CRYPTPROTECT_PROMPTSTRUCT; +pub const CRYPTPROTECT_PROMPT_ON_UNPROTECT: DWORD = 0x1; +pub const CRYPTPROTECT_PROMPT_ON_PROTECT: DWORD = 0x2; +pub const CRYPTPROTECT_PROMPT_RESERVED: DWORD = 0x04; +pub const CRYPTPROTECT_PROMPT_STRONG: DWORD = 0x08; +pub const CRYPTPROTECT_PROMPT_REQUIRE_STRONG: DWORD = 0x10; +pub const CRYPTPROTECT_UI_FORBIDDEN: DWORD = 0x1; +pub const CRYPTPROTECT_LOCAL_MACHINE: DWORD = 0x4; +pub const CRYPTPROTECT_CRED_SYNC: DWORD = 0x8; +pub const CRYPTPROTECT_AUDIT: DWORD = 0x10; +pub const CRYPTPROTECT_NO_RECOVERY: DWORD = 0x20; +pub const CRYPTPROTECT_VERIFY_PROTECTION: DWORD = 0x40; +pub const CRYPTPROTECT_CRED_REGENERATE: DWORD = 0x80; +pub const CRYPTPROTECT_FIRST_RESERVED_FLAGVAL: DWORD = 0x0FFFFFFF; +pub const CRYPTPROTECT_LAST_RESERVED_FLAGVAL: DWORD = 0xFFFFFFFF; +extern "system" { + pub fn CryptProtectData( + pDataIn: *mut DATA_BLOB, + szDataDescr: LPCWSTR, + pOptionalEntropy: *mut DATA_BLOB, + pvReserved: PVOID, + pPromptStruct: *mut CRYPTPROTECT_PROMPTSTRUCT, + dwFlags: DWORD, + pDataOut: *mut DATA_BLOB, + ) -> BOOL; + pub fn CryptUnprotectData( + pDataIn: *mut DATA_BLOB, + ppszDataDescr: *mut LPWSTR, + pOptionalEntropy: *mut DATA_BLOB, + pvReserved: PVOID, + pPromptStruct: *mut CRYPTPROTECT_PROMPTSTRUCT, + dwFlags: DWORD, + pDataOut: *mut DATA_BLOB, + ) -> BOOL; + pub fn CryptProtectDataNoUI( + pDataIn: *mut DATA_BLOB, + szDataDescr: LPCWSTR, + pOptionalEntropy: *mut DATA_BLOB, + pvReserved: PVOID, + pPromptStruct: *mut CRYPTPROTECT_PROMPTSTRUCT, + dwFlags: DWORD, + pbOptionalPassword: *const BYTE, + cbOptionalPassword: DWORD, + pDataOut: *mut DATA_BLOB, + ) -> BOOL; + pub fn CryptUnprotectDataNoUI( + pDataIn: *mut DATA_BLOB, + ppszDataDescr: *mut LPWSTR, + pOptionalEntropy: *mut DATA_BLOB, + pvReserved: PVOID, + pPromptStruct: *mut CRYPTPROTECT_PROMPTSTRUCT, + dwFlags: DWORD, + pbOptionalPassword: *const BYTE, + cbOptionalPassword: DWORD, + pDataOut: *mut DATA_BLOB, + ) -> BOOL; + pub fn CryptUpdateProtectedState( + pOldSid: PSID, + pwszOldPassword: LPCWSTR, + dwFlags: DWORD, + pdwSuccessCount: *mut DWORD, + pdwFailureCount: *mut DWORD, + ) -> BOOL; +} +pub const CRYPTPROTECTMEMORY_BLOCK_SIZE: DWORD = 16; +pub const CRYPTPROTECTMEMORY_SAME_PROCESS: DWORD = 0x00; +pub const CRYPTPROTECTMEMORY_CROSS_PROCESS: DWORD = 0x01; +pub const CRYPTPROTECTMEMORY_SAME_LOGON: DWORD = 0x02; +extern "system" { + pub fn CryptProtectMemory( + pDataIn: LPVOID, + cbDataIn: DWORD, + dwFlags: DWORD, + ) -> BOOL; + pub fn CryptUnprotectMemory( + pDataIn: LPVOID, + cbDataIn: DWORD, + dwFlags: DWORD, + ) -> BOOL; +} -- cgit v1.2.3