Get rid of USER32 functions in KERNEL32.
[wine/multimedia.git] / include / pe_image.h
blob43b39c60d50e2d1e95bf7dba0c3e6d4ec42cd0f8
1 #ifndef __WINE_PE_IMAGE_H
2 #define __WINE_PE_IMAGE_H
4 #include "windef.h"
5 #include "winbase.h"
7 #define PE_HEADER(module) \
8 ((IMAGE_NT_HEADERS*)((LPBYTE)(module) + \
9 (((IMAGE_DOS_HEADER*)(module))->e_lfanew)))
11 #define PE_SECTIONS(module) \
12 ((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \
13 PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
15 #define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field)
17 /* modreference used for attached processes
18 * all section are calculated here, relocations etc.
20 typedef struct {
21 PIMAGE_IMPORT_DESCRIPTOR pe_import;
22 PIMAGE_EXPORT_DIRECTORY pe_export;
23 PIMAGE_RESOURCE_DIRECTORY pe_resource;
24 int tlsindex;
25 } PE_MODREF;
27 struct _wine_modref;
28 extern int PE_unloadImage(HMODULE hModule);
29 extern FARPROC PE_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName, BOOL snoop);
30 extern BOOL PE_EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG);
31 extern BOOL PE_EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG);
32 extern BOOL PE_EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,LONG);
33 extern BOOL PE_EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,LONG);
34 extern BOOL PE_EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,ENUMRESLANGPROCA,LONG);
35 extern BOOL PE_EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,ENUMRESLANGPROCW,LONG);
36 extern HRSRC PE_FindResourceExW(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD,BOOL);
37 extern DWORD PE_SizeofResource(HMODULE,HRSRC);
38 extern struct _wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD);
39 extern void PE_UnloadLibrary(struct _wine_modref *);
40 extern HGLOBAL PE_LoadResource(struct _wine_modref *wm,HRSRC);
41 extern HMODULE PE_LoadImage( HANDLE hFile, LPCSTR filename );
42 extern struct _wine_modref *PE_CreateModule( HMODULE hModule, LPCSTR filename,
43 DWORD flags, BOOL builtin );
44 extern void PE_InitTls(void);
45 extern BOOL PE_InitDLL(struct _wine_modref *wm, DWORD type, LPVOID lpReserved);
47 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY,LPCSTR,DWORD,BOOL);
48 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,BOOL);
50 typedef DWORD CALLBACK(*DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
52 typedef struct {
53 WORD popl WINE_PACKED; /* 0x8f 0x05 */
54 DWORD addr_popped WINE_PACKED;/* ... */
55 BYTE pushl1 WINE_PACKED; /* 0x68 */
56 DWORD newret WINE_PACKED; /* ... */
57 BYTE pushl2 WINE_PACKED; /* 0x68 */
58 DWORD origfun WINE_PACKED; /* original function */
59 BYTE ret1 WINE_PACKED; /* 0xc3 */
60 WORD addesp WINE_PACKED; /* 0x83 0xc4 */
61 BYTE nrofargs WINE_PACKED; /* nr of arguments to add esp, */
62 BYTE pushl3 WINE_PACKED; /* 0x68 */
63 DWORD oldret WINE_PACKED; /* Filled out from popl above */
64 BYTE ret2 WINE_PACKED; /* 0xc3 */
65 } ELF_STDCALL_STUB;
67 typedef struct {
68 void* dlhandle;
69 ELF_STDCALL_STUB *stubs;
70 } ELF_MODREF;
72 extern struct _wine_modref *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags);
73 extern void ELF_UnloadLibrary(struct _wine_modref *);
74 extern FARPROC ELF_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName);
76 #endif /* __WINE_PE_IMAGE_H */