Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

pe_image.h

00001 #ifndef __WINE_PE_IMAGE_H
00002 #define __WINE_PE_IMAGE_H
00003 
00004 #include "winnt.h"
00005 #include "winbase.h"
00006 
00007 #define PE_HEADER(module) \
00008     ((IMAGE_NT_HEADERS*)((LPBYTE)(module) + \
00009                          (((IMAGE_DOS_HEADER*)(module))->e_lfanew)))
00010 
00011 #define PE_SECTIONS(module) \
00012     ((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \
00013                            PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
00014 
00015 #define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field)
00016 
00017 /* modreference used for attached processes
00018  * all section are calculated here, relocations etc.
00019  */
00020 typedef struct {
00021         PIMAGE_IMPORT_DESCRIPTOR        pe_import;
00022         PIMAGE_EXPORT_DIRECTORY pe_export;
00023         PIMAGE_RESOURCE_DIRECTORY       pe_resource;
00024         int                             tlsindex;
00025 } PE_MODREF;
00026 
00027 struct _wine_modref;
00028 extern int PE_unloadImage(HMODULE hModule);
00029 extern FARPROC PE_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName, WIN_BOOL snoop);
00030 extern WIN_BOOL PE_EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG);
00031 extern WIN_BOOL PE_EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG);
00032 extern WIN_BOOL PE_EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,LONG);
00033 extern WIN_BOOL PE_EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,LONG);
00034 extern WIN_BOOL PE_EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,ENUMRESLANGPROCA,LONG);
00035 extern WIN_BOOL PE_EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,ENUMRESLANGPROCW,LONG);
00036 extern HRSRC PE_FindResourceExW(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD);
00037 extern DWORD PE_SizeofResource(HMODULE,HRSRC);
00038 extern struct _wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD);
00039 extern void PE_UnloadLibrary(struct _wine_modref *);
00040 extern HGLOBAL PE_LoadResource(struct _wine_modref *wm,HRSRC);
00041 extern HMODULE PE_LoadImage( int hFile, LPCSTR filename, WORD *version );
00042 extern struct _wine_modref *PE_CreateModule( HMODULE hModule, LPCSTR filename,
00043                                              DWORD flags, WIN_BOOL builtin );
00044 extern WIN_BOOL PE_CreateProcess( HANDLE hFile, LPCSTR filename, LPCSTR cmd_line, LPCSTR env, 
00045                               LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
00046                               WIN_BOOL inherit, DWORD flags, LPSTARTUPINFOA startup,
00047                               LPPROCESS_INFORMATION info );
00048 
00049 extern void PE_InitTls(void);
00050 extern WIN_BOOL PE_InitDLL(struct _wine_modref *wm, DWORD type, LPVOID lpReserved);
00051 
00052 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY,LPCSTR,DWORD,WIN_BOOL);
00053 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,WIN_BOOL);
00054 
00055 typedef DWORD CALLBACK (*DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
00056 
00057 typedef struct {
00058         WORD    popl    WINE_PACKED;    /* 0x8f 0x05 */
00059         DWORD   addr_popped WINE_PACKED;/* ...  */
00060         BYTE    pushl1  WINE_PACKED;    /* 0x68 */
00061         DWORD   newret WINE_PACKED;     /* ...  */
00062         BYTE    pushl2  WINE_PACKED;    /* 0x68 */
00063         DWORD   origfun WINE_PACKED;    /* original function */
00064         BYTE    ret1    WINE_PACKED;    /* 0xc3 */
00065         WORD    addesp  WINE_PACKED;    /* 0x83 0xc4 */
00066         BYTE    nrofargs WINE_PACKED;   /* nr of arguments to add esp, */
00067         BYTE    pushl3  WINE_PACKED;    /* 0x68 */
00068         DWORD   oldret  WINE_PACKED;    /* Filled out from popl above  */
00069         BYTE    ret2    WINE_PACKED;    /* 0xc3 */
00070 } ELF_STDCALL_STUB;
00071 
00072 typedef struct {
00073         void*                   dlhandle;
00074         ELF_STDCALL_STUB        *stubs;
00075 } ELF_MODREF;
00076 
00077 extern struct _wine_modref *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags);
00078 extern void ELF_UnloadLibrary(struct _wine_modref *);
00079 extern FARPROC ELF_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName);
00080 
00081 #endif /* __WINE_PE_IMAGE_H */

Generated on Tue Dec 20 10:14:22 2005 for vlc-0.8.4a by  doxygen 1.4.2