annotate loader/wine/module.h @ 25101:10a3f5b4ee20

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