| 131 | |
| 132 | _IRQL_requires_max_(APC_LEVEL) |
| 133 | BOOLEAN SecureProcessMemory( |
| 134 | PEPROCESS Process, |
| 135 | __in_data_source(USER_MODE) PVOID UserAddress, |
| 136 | SIZE_T Size, |
| 137 | ULONG ProtectRights, |
| 138 | OUT PHANDLE SecureHandle |
| 139 | ) { |
| 140 | if (!Process || !SecureHandle) return FALSE; |
| 141 | if (Process == PsGetCurrentProcess()) |
| 142 | return SecureMemory(UserAddress, Size, ProtectRights, SecureHandle); |
| 143 | |
| 144 | HANDLE hSecure = NULL; |
| 145 | KAPC_STATE ApcState; |
| 146 | KeStackAttachProcess(Process, &ApcState); |
| 147 | BOOLEAN Result = SecureMemory(UserAddress, Size, ProtectRights, &hSecure); |
| 148 | KeUnstackDetachProcess(&ApcState); |
| 149 | |
| 150 | *SecureHandle = hSecure; |
| 151 | return Result; |
| 152 | } |
| 153 | |
| 154 | _IRQL_requires_max_(APC_LEVEL) |
| 155 | VOID UnsecureMemory(HANDLE SecureHandle) { |
no test coverage detected