2 * Support for the Unix part of builtin dlls
4 * Copyright 2019 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifdef __WINE_PE_BUILD
26 #define WIN32_NO_STATUS
30 #include "wine/unixlib.h"
32 static NTSTATUS (WINAPI
*p__wine_unix_call
)( unixlib_handle_t
, unsigned int, void * );
34 static void load_func( void **func
, const char *name
, void *def
)
38 HMODULE module
= GetModuleHandleW( L
"ntdll.dll" );
39 void *proc
= GetProcAddress( module
, name
);
40 InterlockedExchangePointer( func
, proc
? proc
: def
);
43 #define LOAD_FUNC(name) load_func( (void **)&p ## name, #name, fallback ## name )
45 static NTSTATUS __cdecl
fallback__wine_unix_call( unixlib_handle_t handle
, unsigned int code
, void *args
)
47 return STATUS_DLL_NOT_FOUND
;
50 NTSTATUS WINAPI
__wine_unix_call( unixlib_handle_t handle
, unsigned int code
, void *args
)
52 LOAD_FUNC( __wine_unix_call
);
53 return p__wine_unix_call( handle
, code
, args
);
56 #endif /* __WINE_PE_BUILD */