annotate loader/wine/pe_image.h @ 9936:6d9531a5d95b

disable getch2 on windows when we can't read stdin (msys)
author faust3
date Sat, 19 Apr 2003 09:19:30 +0000
parents 174e2a58b4cd
children 67e6bb7dcac4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 #ifndef __WINE_PE_IMAGE_H
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 #define __WINE_PE_IMAGE_H
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 1
diff changeset
4 #include "winnt.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 #include "winbase.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 #define PE_HEADER(module) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 ((IMAGE_NT_HEADERS*)((LPBYTE)(module) + \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 (((IMAGE_DOS_HEADER*)(module))->e_lfanew)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 #define PE_SECTIONS(module) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 ((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 #define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 /* modreference used for attached processes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 * all section are calculated here, relocations etc.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 typedef struct {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 PIMAGE_IMPORT_DESCRIPTOR pe_import;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 PIMAGE_EXPORT_DIRECTORY pe_export;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 PIMAGE_RESOURCE_DIRECTORY pe_resource;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 int tlsindex;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 } PE_MODREF;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 struct _wine_modref;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 extern int PE_unloadImage(HMODULE hModule);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 extern FARPROC PE_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName, WIN_BOOL snoop);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 extern WIN_BOOL PE_EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 extern WIN_BOOL PE_EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 extern WIN_BOOL PE_EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,LONG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 extern WIN_BOOL PE_EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,LONG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 extern WIN_BOOL PE_EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,ENUMRESLANGPROCA,LONG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 extern WIN_BOOL PE_EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,ENUMRESLANGPROCW,LONG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 extern HRSRC PE_FindResourceExW(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 extern DWORD PE_SizeofResource(HMODULE,HRSRC);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 extern struct _wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 extern void PE_UnloadLibrary(struct _wine_modref *);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 extern HGLOBAL PE_LoadResource(struct _wine_modref *wm,HRSRC);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 extern HMODULE PE_LoadImage( int hFile, LPCSTR filename, WORD *version );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 extern struct _wine_modref *PE_CreateModule( HMODULE hModule, LPCSTR filename,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 DWORD flags, WIN_BOOL builtin );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 extern WIN_BOOL PE_CreateProcess( HANDLE hFile, LPCSTR filename, LPCSTR cmd_line, LPCSTR env,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 WIN_BOOL inherit, DWORD flags, LPSTARTUPINFOA startup,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 LPPROCESS_INFORMATION info );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 extern void PE_InitTls(void);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 extern WIN_BOOL PE_InitDLL(struct _wine_modref *wm, DWORD type, LPVOID lpReserved);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY,LPCSTR,DWORD,WIN_BOOL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,WIN_BOOL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 typedef DWORD CALLBACK (*DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 typedef struct {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 WORD popl WINE_PACKED; /* 0x8f 0x05 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 DWORD addr_popped WINE_PACKED;/* ... */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 BYTE pushl1 WINE_PACKED; /* 0x68 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 DWORD newret WINE_PACKED; /* ... */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 BYTE pushl2 WINE_PACKED; /* 0x68 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 DWORD origfun WINE_PACKED; /* original function */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 BYTE ret1 WINE_PACKED; /* 0xc3 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 WORD addesp WINE_PACKED; /* 0x83 0xc4 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 BYTE nrofargs WINE_PACKED; /* nr of arguments to add esp, */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 BYTE pushl3 WINE_PACKED; /* 0x68 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 DWORD oldret WINE_PACKED; /* Filled out from popl above */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 BYTE ret2 WINE_PACKED; /* 0xc3 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 } ELF_STDCALL_STUB;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 typedef struct {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 void* dlhandle;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 ELF_STDCALL_STUB *stubs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 } ELF_MODREF;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 extern struct _wine_modref *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 extern void ELF_UnloadLibrary(struct _wine_modref *);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 extern FARPROC ELF_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 #endif /* __WINE_PE_IMAGE_H */