ugfixes for IPX code and preliminary groundwork for other address
[wine.git] / include / pe_image.h
blobe9a4ca2f0023aab635ebd7ec6dbbab3a00c64cf7
1 #ifndef __WINE_PE_IMAGE_H
2 #define __WINE_PE_IMAGE_H
4 #include <sys/types.h>
5 #include "windows.h"
6 #include "winnt.h"
7 #include "peexe.h"
9 /* modreference used for attached processes
10 * all section are calculated here, relocations etc.
12 typedef struct {
13 PIMAGE_IMPORT_DESCRIPTOR pe_import;
14 PIMAGE_EXPORT_DIRECTORY pe_export;
15 PIMAGE_RESOURCE_DIRECTORY pe_resource;
16 PIMAGE_BASE_RELOCATION pe_reloc;
17 int flags;
18 #define PE_MODREF_PROCESS_ATTACHED 0x00000001
19 #define PE_MODREF_NO_DLL_CALLS 0x00000002
20 #define PE_MODREF_RELOCS_DONE 0x00000004
21 #define PE_MODREF_TLS_ALLOCED 0x00000008
22 #define PE_MODREF_INTERNAL 0x00000010
23 int tlsindex;
24 } PE_MODREF;
26 struct _PDB32;
27 struct _wine_modref;
28 extern int PE_unloadImage(HMODULE32 hModule);
29 extern FARPROC32 PE_FindExportedFunction(
30 struct _PDB32 *process,struct _wine_modref *wm, LPCSTR funcName, BOOL32 snoop
32 extern void my_wcstombs(char * result, u_short * source, int len);
33 extern BOOL32 PE_EnumResourceTypes32A(HMODULE32,ENUMRESTYPEPROC32A,LONG);
34 extern BOOL32 PE_EnumResourceTypes32W(HMODULE32,ENUMRESTYPEPROC32W,LONG);
35 extern BOOL32 PE_EnumResourceNames32A(HMODULE32,LPCSTR,ENUMRESNAMEPROC32A,LONG);
36 extern BOOL32 PE_EnumResourceNames32W(HMODULE32,LPCWSTR,ENUMRESNAMEPROC32W,LONG);
37 extern BOOL32 PE_EnumResourceLanguages32A(HMODULE32,LPCSTR,LPCSTR,ENUMRESLANGPROC32A,LONG);
38 extern BOOL32 PE_EnumResourceLanguages32W(HMODULE32,LPCWSTR,LPCWSTR,ENUMRESLANGPROC32W,LONG);
39 extern HRSRC32 PE_FindResourceEx32W(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD);
40 extern DWORD PE_SizeofResource32(HMODULE32,HRSRC32);
41 extern HMODULE32 PE_LoadLibraryEx32A(LPCSTR,struct _PDB32*,HFILE32,DWORD);
42 extern HGLOBAL32 PE_LoadResource32(struct _wine_modref *wm,HRSRC32);
43 extern HINSTANCE16 PE_CreateProcess( LPCSTR name, LPCSTR cmd_line,
44 LPCSTR env, LPSTARTUPINFO32A startup,
45 LPPROCESS_INFORMATION info );
47 struct _THDB; /* forward definition */
48 extern void PE_InitTls(struct _THDB*);
49 extern void PE_InitDLL(struct _wine_modref *wm, DWORD type, LPVOID lpReserved);
51 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,BOOL32);
53 typedef DWORD (CALLBACK*DLLENTRYPROC32)(HMODULE32,DWORD,LPVOID);
55 typedef struct {
56 WORD popl WINE_PACKED; /* 0x8f 0x05 */
57 DWORD addr_popped WINE_PACKED;/* ... */
58 BYTE pushl1 WINE_PACKED; /* 0x68 */
59 DWORD newret WINE_PACKED; /* ... */
60 BYTE pushl2 WINE_PACKED; /* 0x68 */
61 DWORD origfun WINE_PACKED; /* original function */
62 BYTE ret1 WINE_PACKED; /* 0xc3 */
63 WORD addesp WINE_PACKED; /* 0x83 0xc4 */
64 BYTE nrofargs WINE_PACKED; /* nr of arguments to add esp, */
65 BYTE pushl3 WINE_PACKED; /* 0x68 */
66 DWORD oldret WINE_PACKED; /* Filled out from popl above */
67 BYTE ret2 WINE_PACKED; /* 0xc3 */
68 } ELF_STDCALL_STUB;
70 typedef struct {
71 void* dlhandle;
72 ELF_STDCALL_STUB *stubs;
73 } ELF_MODREF;
75 extern struct _wine_modref *ELF_CreateDummyModule(LPCSTR,LPCSTR,struct _PDB32 *);
76 extern HMODULE32 ELF_LoadLibraryEx32A(LPCSTR,struct _PDB32*,HFILE32,DWORD);
77 extern FARPROC32 ELF_FindExportedFunction(struct _PDB32 *process,struct _wine_modref *wm, LPCSTR funcName);
79 #endif /* __WINE_PE_IMAGE_H */