annotate loader/wine/pe_image.h @ 34266:a6a1c973de4e

vo direct3d: fix crash in osd drawing code The crash occurred when the video window was minimized and the OSD should be drawn. This caused the OSD textures creation to fail and later the OSD drawing code would assume they exist and cause the crash. When the video window is minimized a size change event with the new size 0x0 is reported. This is now handled by deferring the textures recreation. If the OSD should be drawn in the meantime it will be checked if the OSD textures have been allocated. This commit is done with the permission of the vo direct3d maintainer. This is based on patches from Roger Pack (rogerdpack2 (gmail)) and Patrick Dinh (patrickdinh33 (yahoo)).
author al
date Sat, 19 Nov 2011 14:04:11 +0000
parents 437b251e4194
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26045
a8ea87c71d18 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25794
diff changeset
1 #ifndef MPLAYER_PE_IMAGE_H
a8ea87c71d18 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25794
diff changeset
2 #define MPLAYER_PE_IMAGE_H
1
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
25794
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 24422
diff changeset
27 struct wine_modref;
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
28 int PE_unloadImage(HMODULE hModule);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
29 FARPROC PE_FindExportedFunction(struct wine_modref *wm, LPCSTR funcName, WIN_BOOL snoop);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
30 WIN_BOOL PE_EnumResourceTypesA(HMODULE, ENUMRESTYPEPROCA, LONG);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
31 WIN_BOOL PE_EnumResourceTypesW(HMODULE, ENUMRESTYPEPROCW, LONG);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
32 WIN_BOOL PE_EnumResourceNamesA(HMODULE, LPCSTR, ENUMRESNAMEPROCA, LONG);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
33 WIN_BOOL PE_EnumResourceNamesW(HMODULE, LPCWSTR, ENUMRESNAMEPROCW, LONG);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
34 WIN_BOOL PE_EnumResourceLanguagesA(HMODULE, LPCSTR, LPCSTR, ENUMRESLANGPROCA, LONG);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
35 WIN_BOOL PE_EnumResourceLanguagesW(HMODULE, LPCWSTR, LPCWSTR, ENUMRESLANGPROCW, LONG);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
36 HRSRC PE_FindResourceExW(struct wine_modref*, LPCWSTR, LPCWSTR, WORD);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
37 DWORD PE_SizeofResource(HMODULE, HRSRC);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
38 struct wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
39 void PE_UnloadLibrary(struct wine_modref *);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
40 HGLOBAL PE_LoadResource(struct wine_modref *wm, HRSRC);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
41 HMODULE PE_LoadImage(int hFile, LPCSTR filename, WORD *version);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
42 struct wine_modref *PE_CreateModule(HMODULE hModule, LPCSTR filename,
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
43 DWORD flags, WIN_BOOL builtin);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
44 WIN_BOOL PE_CreateProcess(HANDLE hFile, LPCSTR filename, LPCSTR cmd_line, LPCSTR env,
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
45 LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
46 WIN_BOOL inherit, DWORD flags, LPSTARTUPINFOA startup,
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
47 LPPROCESS_INFORMATION info);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
49 void PE_InitTls(void);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
50 WIN_BOOL PE_InitDLL(struct wine_modref *wm, DWORD type, LPVOID lpReserved);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
52 PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY, LPCSTR, DWORD, WIN_BOOL);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
53 PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY, LPCWSTR, DWORD, WIN_BOOL);
1
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
30539
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
57 typedef struct WINE_PACKED {
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
58 WORD popl; /* 0x8f 0x05 */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
59 DWORD addr_popped; /* ... */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
60 BYTE pushl1; /* 0x68 */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
61 DWORD newret; /* ... */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
62 BYTE pushl2; /* 0x68 */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
63 DWORD origfun; /* original function */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
64 BYTE ret1; /* 0xc3 */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
65 WORD addesp; /* 0x83 0xc4 */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
66 BYTE nrofargs; /* nr of arguments to add esp, */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
67 BYTE pushl3; /* 0x68 */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
68 DWORD oldret; /* Filled out from popl above */
437b251e4194 Directly mark structs as WINE_PACKED where all members are marked as packed.
diego
parents: 28051
diff changeset
69 BYTE ret2; /* 0xc3 */
1
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
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
77 struct wine_modref *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
78 void ELF_UnloadLibrary(struct wine_modref *);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26045
diff changeset
79 FARPROC ELF_FindExportedFunction(struct wine_modref *wm, LPCSTR funcName);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80
26045
a8ea87c71d18 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25794
diff changeset
81 #endif /* MPLAYER_PE_IMAGE_H */