Updated documentation to reflect renamed header.
[wine] / include / pe_image.h
1 #ifndef __WINE_PE_IMAGE_H
2 #define __WINE_PE_IMAGE_H
3
4 #include "windef.h"
5 #include "winbase.h"
6 #include "peexe.h"
7 /* modreference used for attached processes
8  * all section are calculated here, relocations etc.
9  */
10 typedef struct {
11         PIMAGE_IMPORT_DESCRIPTOR        pe_import;
12         PIMAGE_EXPORT_DIRECTORY pe_export;
13         PIMAGE_RESOURCE_DIRECTORY       pe_resource;
14         int                             tlsindex;
15 } PE_MODREF;
16
17 struct _wine_modref;
18 extern int PE_unloadImage(HMODULE hModule);
19 extern FARPROC PE_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName, BOOL snoop);
20 extern BOOL PE_EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG);
21 extern BOOL PE_EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG);
22 extern BOOL PE_EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,LONG);
23 extern BOOL PE_EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,LONG);
24 extern BOOL PE_EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,ENUMRESLANGPROCA,LONG);
25 extern BOOL PE_EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,ENUMRESLANGPROCW,LONG);
26 extern HRSRC PE_FindResourceExW(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD);
27 extern DWORD PE_SizeofResource(HMODULE,HRSRC);
28 extern struct _wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD, DWORD *);
29 extern void PE_UnloadLibrary(struct _wine_modref *);
30 extern HGLOBAL PE_LoadResource(struct _wine_modref *wm,HRSRC);
31 extern HMODULE PE_LoadImage( HFILE hFile, OFSTRUCT *ofs, LPCSTR *modName );
32 extern struct _wine_modref *PE_CreateModule( HMODULE hModule, OFSTRUCT *ofs, 
33                                              DWORD flags, BOOL builtin );
34 extern BOOL PE_CreateProcess( HFILE hFile, OFSTRUCT *ofs, LPCSTR cmd_line, LPCSTR env, 
35                               LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
36                               BOOL inherit, DWORD flags, LPSTARTUPINFOA startup,
37                               LPPROCESS_INFORMATION info );
38
39 extern void PE_InitTls(void);
40 extern BOOL PE_InitDLL(struct _wine_modref *wm, DWORD type, LPVOID lpReserved);
41
42 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY,LPCSTR,DWORD,BOOL);
43 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,BOOL);
44
45 typedef DWORD (CALLBACK*DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
46
47 typedef struct {
48         WORD    popl    WINE_PACKED;    /* 0x8f 0x05 */
49         DWORD   addr_popped WINE_PACKED;/* ...  */
50         BYTE    pushl1  WINE_PACKED;    /* 0x68 */
51         DWORD   newret WINE_PACKED;     /* ...  */
52         BYTE    pushl2  WINE_PACKED;    /* 0x68 */
53         DWORD   origfun WINE_PACKED;    /* original function */
54         BYTE    ret1    WINE_PACKED;    /* 0xc3 */
55         WORD    addesp  WINE_PACKED;    /* 0x83 0xc4 */
56         BYTE    nrofargs WINE_PACKED;   /* nr of arguments to add esp, */
57         BYTE    pushl3  WINE_PACKED;    /* 0x68 */
58         DWORD   oldret  WINE_PACKED;    /* Filled out from popl above  */
59         BYTE    ret2    WINE_PACKED;    /* 0xc3 */
60 } ELF_STDCALL_STUB;
61
62 typedef struct {
63         void*                   dlhandle;
64         ELF_STDCALL_STUB        *stubs;
65 } ELF_MODREF;
66
67 extern struct _wine_modref *ELF_CreateDummyModule(LPCSTR,LPCSTR);
68 extern struct _wine_modref *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags, DWORD *err);
69 extern void ELF_UnloadLibrary(struct _wine_modref *);
70 extern FARPROC ELF_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName);
71
72 #endif /* __WINE_PE_IMAGE_H */