cmd: DIR command outputs free space for the path.
[wine.git] / dlls / winecrt0 / delay_load.c
blob3044fa4431f69bd925feb5f83a34c9d5740bc775
1 /*
2 * Support for delayed imports
4 * Copyright 2005 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 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "delayloadhandler.h"
26 WINBASEAPI void *WINAPI DelayLoadFailureHook( LPCSTR name, LPCSTR function );
27 WINBASEAPI void *WINAPI ResolveDelayLoadedAPI( void* base, const IMAGE_DELAYLOAD_DESCRIPTOR* desc,
28 PDELAYLOAD_FAILURE_DLL_CALLBACK dllhook,
29 PDELAYLOAD_FAILURE_SYSTEM_ROUTINE syshook,
30 IMAGE_THUNK_DATA* addr, ULONG flags );
32 static inline void *image_base(void)
34 #ifdef __WINE_PE_BUILD
35 extern IMAGE_DOS_HEADER __ImageBase;
36 return (void *)&__ImageBase;
37 #else
38 extern IMAGE_NT_HEADERS __wine_spec_nt_header;
39 return (void *)((__wine_spec_nt_header.OptionalHeader.ImageBase + 0xffff) & ~0xffff);
40 #endif
43 FARPROC WINAPI __delayLoadHelper2( const IMAGE_DELAYLOAD_DESCRIPTOR *descr, IMAGE_THUNK_DATA *addr )
45 return ResolveDelayLoadedAPI( image_base(), descr, NULL, DelayLoadFailureHook, addr, 0 );