Reimplemented winsock asynchronous DNS services. No longer use a
[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 HMODULE PE_LoadLibraryExA(LPCSTR,HFILE,DWORD);
29 extern HGLOBAL PE_LoadResource(struct _wine_modref *wm,HRSRC);
30 extern HMODULE PE_LoadImage( HFILE hFile, OFSTRUCT *ofs, LPCSTR *modName );
31 extern struct _wine_modref *PE_CreateModule( HMODULE hModule, OFSTRUCT *ofs, 
32                                              DWORD flags, BOOL builtin );
33 extern BOOL PE_CreateProcess( HFILE hFile, OFSTRUCT *ofs, LPCSTR cmd_line, LPCSTR env, 
34                               LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
35                               BOOL inherit, LPSTARTUPINFOA startup,
36                               LPPROCESS_INFORMATION info );
37
38 extern void PE_InitTls(void);
39 extern void PE_InitDLL(struct _wine_modref *wm, DWORD type, LPVOID lpReserved);
40
41 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY,LPCSTR,DWORD,BOOL);
42 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,BOOL);
43
44 typedef DWORD (CALLBACK*DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
45
46 typedef struct {
47         WORD    popl    WINE_PACKED;    /* 0x8f 0x05 */
48         DWORD   addr_popped WINE_PACKED;/* ...  */
49         BYTE    pushl1  WINE_PACKED;    /* 0x68 */
50         DWORD   newret WINE_PACKED;     /* ...  */
51         BYTE    pushl2  WINE_PACKED;    /* 0x68 */
52         DWORD   origfun WINE_PACKED;    /* original function */
53         BYTE    ret1    WINE_PACKED;    /* 0xc3 */
54         WORD    addesp  WINE_PACKED;    /* 0x83 0xc4 */
55         BYTE    nrofargs WINE_PACKED;   /* nr of arguments to add esp, */
56         BYTE    pushl3  WINE_PACKED;    /* 0x68 */
57         DWORD   oldret  WINE_PACKED;    /* Filled out from popl above  */
58         BYTE    ret2    WINE_PACKED;    /* 0xc3 */
59 } ELF_STDCALL_STUB;
60
61 typedef struct {
62         void*                   dlhandle;
63         ELF_STDCALL_STUB        *stubs;
64 } ELF_MODREF;
65
66 extern struct _wine_modref *ELF_CreateDummyModule(LPCSTR,LPCSTR);
67 extern HMODULE ELF_LoadLibraryExA(LPCSTR,HFILE,DWORD);
68 extern FARPROC ELF_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName);
69
70 #endif /* __WINE_PE_IMAGE_H */