Commit a812374a authored by Alexandre Julliard's avatar Alexandre Julliard

winecrt0: Preserve last error when loading debug functions.

parent b4a1d80a
...@@ -50,9 +50,11 @@ static void load_func( void **func, const char *name, void *def ) ...@@ -50,9 +50,11 @@ static void load_func( void **func, const char *name, void *def )
{ {
if (!*func) if (!*func)
{ {
DWORD err = GetLastError();
HMODULE module = GetModuleHandleA( "ntdll.dll" ); HMODULE module = GetModuleHandleA( "ntdll.dll" );
void *proc = GetProcAddress( module, name ); void *proc = GetProcAddress( module, name );
InterlockedExchangePointer( func, proc ? proc : def ); InterlockedExchangePointer( func, proc ? proc : def );
SetLastError( err );
} }
} }
#define LOAD_FUNC(name) load_func( (void **)&p ## name, #name, fallback ## name ) #define LOAD_FUNC(name) load_func( (void **)&p ## name, #name, fallback ## name )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment