| 92 | |
| 93 | _IRQL_requires_max_(APC_LEVEL) |
| 94 | BOOLEAN SecureProcessMemory(PEPROCESS Process,__in_data_source(USER_MODE) PVOID UserAddress, SIZE_T Size, ULONG ProtectRights, OUT PHANDLE SecureHandle) |
| 95 | { |
| 96 | if (!Process || !SecureHandle) |
| 97 | return FALSE; |
| 98 | |
| 99 | if (Process == PsGetCurrentProcess()) |
| 100 | return SecureMemory(UserAddress, Size, ProtectRights, SecureHandle); |
| 101 | |
| 102 | KAPC_STATE ApcState; |
| 103 | KeStackAttachProcess(Process, &ApcState); |
| 104 | |
| 105 | HANDLE hSecure = NULL; |
| 106 | BOOLEAN Result = SecureMemory(UserAddress, Size, ProtectRights, &hSecure); |
| 107 | |
| 108 | KeUnstackDetachProcess(&ApcState); |
| 109 | |
| 110 | *SecureHandle = hSecure; |
| 111 | return Result; |
| 112 | } |
| 113 | |
| 114 | _IRQL_requires_max_(APC_LEVEL) |
| 115 | VOID UnsecureMemory(HANDLE SecureHandle) |
no test coverage detected