Module: wine Branch: master Commit: 35ae4703c4e92f97a32ee28cfdb11375427bf790 URL: https://gitlab.winehq.org/wine/wine/-/commit/35ae4703c4e92f97a32ee28cfdb1137...
Author: Jacek Caban jacek@codeweavers.com Date: Sat Jul 30 15:30:32 2022 +0200
ntdll: Introduce RtlSetLastWin32Error for unixlibs that additionally sets 32-bit error on wow64.
---
dlls/ntdll/unix/env.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 17450b5ab4c..105038a34cb 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -2390,3 +2390,19 @@ ULONG WINAPI RtlNtStatusToDosError( NTSTATUS status )
return map_status( status ); } + +/********************************************************************** + * RtlSetLastWin32Error (ntdll.so) + */ +void WINAPI RtlSetLastWin32Error( DWORD err ) +{ + TEB *teb = NtCurrentTeb(); +#ifdef _WIN64 + if (teb->WowTebOffset) + { + TEB32 *teb32 = (TEB32 *)((char *)teb + teb->WowTebOffset); + teb32->LastErrorValue = err; + } +#endif + teb->LastErrorValue = err; +}