1c2c66affSColin Finck #include <win32k.h> 2c2c66affSColin Finck 3c2c66affSColin Finck /* 4c2c66affSColin Finck * @implemented 5*fe11f7a2SKatayama Hirofumi MZ * https://learn.microsoft.com/en-us/windows/win32/api/winddi/nf-winddi-enggetlasterror 6c2c66affSColin Finck */ 7c2c66affSColin Finck ULONG 8c2c66affSColin Finck APIENTRY EngGetLastError(VOID)9c2c66affSColin FinckEngGetLastError(VOID) 10c2c66affSColin Finck { 11c2c66affSColin Finck PTEB pTeb = NtCurrentTeb(); 12bf7e7c23SSerge Gautherie return (pTeb ? pTeb->LastErrorValue : ERROR_SUCCESS); 13c2c66affSColin Finck } 14c2c66affSColin Finck 15c2c66affSColin Finck /* 16c2c66affSColin Finck * @implemented 17*fe11f7a2SKatayama Hirofumi MZ * https://learn.microsoft.com/en-us/windows/win32/api/winddi/nf-winddi-engsetlasterror 18567b0700SKatayama Hirofumi MZ * Win: UserSetLastError 19c2c66affSColin Finck */ 20c2c66affSColin Finck VOID 21c2c66affSColin Finck APIENTRY EngSetLastError(_In_ ULONG iError)22c2c66affSColin FinckEngSetLastError(_In_ ULONG iError) 23c2c66affSColin Finck { 24c2c66affSColin Finck PTEB pTeb = NtCurrentTeb(); 25c2c66affSColin Finck if (pTeb) 26c2c66affSColin Finck pTeb->LastErrorValue = iError; 27c2c66affSColin Finck } 28c2c66affSColin Finck 29c2c66affSColin Finck VOID 30c2c66affSColin Finck FASTCALL SetLastNtError(_In_ NTSTATUS Status)31bf7e7c23SSerge GautherieSetLastNtError(_In_ NTSTATUS Status) 32c2c66affSColin Finck { 33c2c66affSColin Finck EngSetLastError(RtlNtStatusToDosError(Status)); 34c2c66affSColin Finck } 35