Windows API - GetLastError woes

2006-08-28 Thread Esa Ilari Vuokko
Hi, My use case is in Win32-package, where we simply call a FFI imported call and on failures call GetLastError to get extended error code. GetLastError of course only works on same OS thread and contains sensible results only before next Windows API call. It's much like C/posix errno. So, we

Re: Windows API - GetLastError woes

2006-08-28 Thread Brian Hulley
Esa Ilari Vuokko wrote: Hi, My use case is in Win32-package, where we simply call a FFI imported call and on failures call GetLastError to get extended error code. GetLastError of course only works on same OS thread and contains sensible results only before next Windows API call. It's much

Re: Windows API - GetLastError woes

2006-08-28 Thread Esa Ilari Vuokko
Brian Hulley wrote: The only way to solve this problem seems to be to wrap all calls in C-functions that take care of reading GetLastError. Not that it's impossible, just very annoying. If there is no better solution, would it be possible on failure to somehow enter a critical section and

Re: Windows API - GetLastError woes

2006-08-28 Thread Neil Mitchell
Hi If there is no better solution, would it be possible on failure to somehow enter a critical section and repeat the call that caused the failure and then call get last error and exit the critical section so that normal calls would be fast but only failed calls would be slow? No. This isn't