pe_image.h
上传用户:kjfoods
上传日期:2020-07-06
资源大小:29949k
文件大小:3k
源码类别:

midi

开发平台:

Unix_Linux

  1. #ifndef __WINE_PE_IMAGE_H
  2. #define __WINE_PE_IMAGE_H
  3. #include "winnt.h"
  4. #include "winbase.h"
  5. #define PE_HEADER(module) 
  6.     ((IMAGE_NT_HEADERS*)((LPBYTE)(module) + 
  7.                          (((IMAGE_DOS_HEADER*)(module))->e_lfanew)))
  8. #define PE_SECTIONS(module) 
  9.     ((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + 
  10.                            PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
  11. #define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field)
  12. /* modreference used for attached processes
  13.  * all section are calculated here, relocations etc.
  14.  */
  15. typedef struct {
  16. PIMAGE_IMPORT_DESCRIPTOR pe_import;
  17. PIMAGE_EXPORT_DIRECTORY pe_export;
  18. PIMAGE_RESOURCE_DIRECTORY pe_resource;
  19. int tlsindex;
  20. } PE_MODREF;
  21. struct _wine_modref;
  22. extern int PE_unloadImage(HMODULE hModule);
  23. extern FARPROC PE_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName, WIN_BOOL snoop);
  24. extern WIN_BOOL PE_EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG);
  25. extern WIN_BOOL PE_EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG);
  26. extern WIN_BOOL PE_EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,LONG);
  27. extern WIN_BOOL PE_EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,LONG);
  28. extern WIN_BOOL PE_EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,ENUMRESLANGPROCA,LONG);
  29. extern WIN_BOOL PE_EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,ENUMRESLANGPROCW,LONG);
  30. extern HRSRC PE_FindResourceExW(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD);
  31. extern DWORD PE_SizeofResource(HMODULE,HRSRC);
  32. extern struct _wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD);
  33. extern void PE_UnloadLibrary(struct _wine_modref *);
  34. extern HGLOBAL PE_LoadResource(struct _wine_modref *wm,HRSRC);
  35. extern HMODULE PE_LoadImage( int hFile, LPCSTR filename, WORD *version );
  36. extern struct _wine_modref *PE_CreateModule( HMODULE hModule, LPCSTR filename,
  37.                                              DWORD flags, WIN_BOOL builtin );
  38. extern WIN_BOOL PE_CreateProcess( HANDLE hFile, LPCSTR filename, LPCSTR cmd_line, LPCSTR env, 
  39.                               LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
  40.                               WIN_BOOL inherit, DWORD flags, LPSTARTUPINFOA startup,
  41.                               LPPROCESS_INFORMATION info );
  42. extern void PE_InitTls(void);
  43. extern WIN_BOOL PE_InitDLL(struct _wine_modref *wm, DWORD type, LPVOID lpReserved);
  44. extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY,LPCSTR,DWORD,WIN_BOOL);
  45. extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,WIN_BOOL);
  46. typedef DWORD CALLBACK (*DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
  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. typedef struct {
  62. void* dlhandle;
  63. ELF_STDCALL_STUB *stubs;
  64. } ELF_MODREF;
  65. extern struct _wine_modref *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags);
  66. extern void ELF_UnloadLibrary(struct _wine_modref *);
  67. extern FARPROC ELF_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName);
  68. #endif /* __WINE_PE_IMAGE_H */