1
|
1 /*
|
|
2 * Module definitions
|
|
3 *
|
|
4 * Copyright 1995 Alexandre Julliard
|
|
5 */
|
|
6
|
|
7 #ifndef __WINE_MODULE_H
|
|
8 #define __WINE_MODULE_H
|
|
9
|
|
10 #include "windef.h"
|
|
11 #include "pe_image.h"
|
|
12
|
|
13
|
|
14 typedef struct {
|
|
15 BYTE type;
|
|
16 BYTE flags;
|
|
17 BYTE segnum;
|
|
18 WORD offs WINE_PACKED;
|
|
19 } ET_ENTRY;
|
|
20
|
|
21 typedef struct {
|
|
22 WORD first; /* ordinal */
|
|
23 WORD last; /* ordinal */
|
|
24 WORD next; /* bundle */
|
|
25 } ET_BUNDLE;
|
|
26
|
|
27
|
|
28 /* In-memory segment table */
|
|
29 typedef struct
|
|
30 {
|
|
31 WORD filepos; /* Position in file, in sectors */
|
|
32 WORD size; /* Segment size on disk */
|
|
33 WORD flags; /* Segment flags */
|
|
34 WORD minsize; /* Min. size of segment in memory */
|
|
35 HANDLE16 hSeg; /* Selector or handle (selector - 1) */
|
|
36 /* of segment in memory */
|
|
37 } SEGTABLEENTRY;
|
|
38
|
|
39
|
|
40 /* Self-loading modules contain this structure in their first segment */
|
|
41
|
|
42 #include "pshpack1.h"
|
|
43
|
|
44 typedef struct
|
|
45 {
|
|
46 WORD version; /* Must be "A0" (0x3041) */
|
|
47 WORD reserved;
|
|
48 FARPROC16 BootApp; /* startup procedure */
|
|
49 FARPROC16 LoadAppSeg; /* procedure to load a segment */
|
|
50 FARPROC16 reserved2;
|
|
51 FARPROC16 MyAlloc; /* memory allocation procedure,
|
|
52 * wine must write this field */
|
|
53 FARPROC16 EntryAddrProc;
|
|
54 FARPROC16 ExitProc; /* exit procedure */
|
|
55 WORD reserved3[4];
|
|
56 FARPROC16 SetOwner; /* Set Owner procedure, exported by wine */
|
|
57 } SELFLOADHEADER;
|
|
58
|
|
59 /* Parameters for LoadModule() */
|
|
60 typedef struct
|
|
61 {
|
|
62 HGLOBAL16 hEnvironment; /* Environment segment */
|
|
63 SEGPTR cmdLine WINE_PACKED; /* Command-line */
|
|
64 SEGPTR showCmd WINE_PACKED; /* Code for ShowWindow() */
|
|
65 SEGPTR reserved WINE_PACKED;
|
|
66 } LOADPARAMS16;
|
|
67
|
|
68 typedef struct
|
|
69 {
|
|
70 LPSTR lpEnvAddress;
|
|
71 LPSTR lpCmdLine;
|
|
72 UINT16 *lpCmdShow;
|
|
73 DWORD dwReserved;
|
|
74 } LOADPARAMS;
|
|
75
|
|
76 #include "poppack.h"
|
|
77
|
|
78 /* internal representation of 32bit modules. per process. */
|
|
79 typedef enum {
|
|
80 MODULE32_PE = 1,
|
|
81 MODULE32_ELF,
|
|
82 MODULE32_ELFDLL
|
|
83 } MODULE32_TYPE;
|
|
84
|
|
85 typedef struct _wine_modref
|
|
86 {
|
|
87 struct _wine_modref *next;
|
|
88 struct _wine_modref *prev;
|
|
89 MODULE32_TYPE type;
|
|
90 union {
|
|
91 PE_MODREF pe;
|
|
92 ELF_MODREF elf;
|
|
93 } binfmt;
|
|
94
|
|
95 HMODULE module;
|
|
96
|
|
97 int nDeps;
|
|
98 struct _wine_modref **deps;
|
|
99
|
|
100 int flags;
|
|
101 int refCount;
|
|
102
|
|
103 char *filename;
|
|
104 char *modname;
|
|
105 char *short_filename;
|
|
106 char *short_modname;
|
|
107 } WINE_MODREF;
|
|
108
|
|
109 #define WINE_MODREF_INTERNAL 0x00000001
|
|
110 #define WINE_MODREF_NO_DLL_CALLS 0x00000002
|
|
111 #define WINE_MODREF_PROCESS_ATTACHED 0x00000004
|
|
112 #define WINE_MODREF_LOAD_AS_DATAFILE 0x00000010
|
|
113 #define WINE_MODREF_DONT_RESOLVE_REFS 0x00000020
|
|
114 #define WINE_MODREF_MARKER 0x80000000
|
|
115
|
|
116
|
|
117
|
|
118 /* Resource types */
|
|
119 typedef struct resource_typeinfo_s NE_TYPEINFO;
|
|
120 typedef struct resource_nameinfo_s NE_NAMEINFO;
|
|
121
|
|
122 #define NE_SEG_TABLE(pModule) \
|
|
123 ((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->seg_table))
|
|
124
|
|
125 #define NE_MODULE_TABLE(pModule) \
|
|
126 ((WORD *)((char *)(pModule) + (pModule)->modref_table))
|
|
127
|
|
128 #define NE_MODULE_NAME(pModule) \
|
|
129 (((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName)
|
|
130
|
7386
|
131 struct modref_list_t;
|
|
132
|
|
133 typedef struct modref_list_t
|
|
134 {
|
|
135 WINE_MODREF* wm;
|
|
136 struct modref_list_t *next;
|
|
137 struct modref_list_t *prev;
|
|
138 } modref_list;
|
|
139
|
|
140
|
1
|
141 /* module.c */
|
|
142 extern FARPROC MODULE_GetProcAddress( HMODULE hModule, LPCSTR function, WIN_BOOL snoop );
|
|
143 extern WINE_MODREF *MODULE32_LookupHMODULE( HMODULE hModule );
|
|
144 extern WINE_MODREF *MODULE_FindModule( LPCSTR path );
|
|
145
|
|
146 /* resource.c */
|
|
147 extern INT WINAPI AccessResource(HMODULE,HRSRC);
|
|
148
|
|
149 #endif /* __WINE_MODULE_H */
|