source: trunk/include/win/module.h@ 796

Last change on this file since 796 was 796, checked in by phaller, 26 years ago

Fix: header fixes for src/shell32/new

File size: 9.4 KB
Line 
1/* $Id: module.h,v 1.3 1999-09-02 17:39:35 phaller Exp $ */
2
3/*
4 * Module definitions
5 *
6 * Copyright 1995 Alexandre Julliard
7 */
8
9#ifndef __WINE_MODULE_H
10#define __WINE_MODULE_H
11
12#include "windef.h"
13//#include "dosexe.h"
14#include "pe_image.h"
15
16#ifndef __WIN32OS2__
17 /* In-memory module structure. See 'Windows Internals' p. 219 */
18typedef struct _NE_MODULE
19{
20 WORD magic; /* 00 'NE' signature */
21 WORD count; /* 02 Usage count */
22 WORD entry_table; /* 04 Near ptr to entry table */
23 HMODULE16 next; /* 06 Selector to next module */
24 WORD dgroup_entry; /* 08 Near ptr to segment entry for DGROUP */
25 WORD fileinfo; /* 0a Near ptr to file info (OFSTRUCT) */
26 WORD flags; /* 0c Module flags */
27 WORD dgroup; /* 0e Logical segment for DGROUP */
28 WORD heap_size; /* 10 Initial heap size */
29 WORD stack_size; /* 12 Initial stack size */
30 WORD ip; /* 14 Initial ip */
31 WORD cs; /* 16 Initial cs (logical segment) */
32 WORD sp; /* 18 Initial stack pointer */
33 WORD ss; /* 1a Initial ss (logical segment) */
34 WORD seg_count; /* 1c Number of segments in segment table */
35 WORD modref_count; /* 1e Number of module references */
36 WORD nrname_size; /* 20 Size of non-resident names table */
37 WORD seg_table; /* 22 Near ptr to segment table */
38 WORD res_table; /* 24 Near ptr to resource table */
39 WORD name_table; /* 26 Near ptr to resident names table */
40 WORD modref_table; /* 28 Near ptr to module reference table */
41 WORD import_table; /* 2a Near ptr to imported names table */
42 DWORD nrname_fpos; /* 2c File offset of non-resident names table */
43 WORD moveable_entries; /* 30 Number of moveable entries in entry table*/
44 WORD alignment; /* 32 Alignment shift count */
45 WORD truetype; /* 34 Set to 2 if TrueType font */
46 BYTE os_flags; /* 36 Operating system flags */
47 BYTE misc_flags; /* 37 Misc. flags */
48 HANDLE16 dlls_to_init; /* 38 List of DLLs to initialize */
49 HANDLE16 nrname_handle; /* 3a Handle to non-resident name table */
50 WORD min_swap_area; /* 3c Min. swap area size */
51 WORD expected_version; /* 3e Expected Windows version */
52 /* From here, these are extra fields not present in normal Windows */
53 HMODULE module32; /* 40 PE module handle for Win32 modules */
54 HMODULE16 self; /* 44 Handle for this module */
55 WORD self_loading_sel; /* 46 Selector used for self-loading apps. */
56 LPDOSTASK lpDosTask;
57 LPVOID dos_image; /* pointer to DOS memory (for DOS apps) */
58 LPVOID hRsrcMap; /* HRSRC 16->32 map (for 32-bit modules) */
59} NE_MODULE;
60#endif
61
62typedef struct {
63 BYTE type;
64 BYTE flags;
65 BYTE segnum;
66 WORD offs WINE_PACKED;
67} ET_ENTRY;
68
69typedef struct {
70 WORD first; /* ordinal */
71 WORD last; /* ordinal */
72 WORD next; /* bundle */
73} ET_BUNDLE;
74
75
76 /* In-memory segment table */
77typedef struct
78{
79 WORD filepos; /* Position in file, in sectors */
80 WORD size; /* Segment size on disk */
81 WORD flags; /* Segment flags */
82 WORD minsize; /* Min. size of segment in memory */
83 HANDLE16 hSeg; /* Selector or handle (selector - 1) */
84 /* of segment in memory */
85} SEGTABLEENTRY;
86
87
88 /* Self-loading modules contain this structure in their first segment */
89
90#include "pshpack1.h"
91
92typedef struct
93{
94 WORD version; /* Must be "A0" (0x3041) */
95 WORD reserved;
96 FARPROC16 BootApp; /* startup procedure */
97 FARPROC16 LoadAppSeg; /* procedure to load a segment */
98 FARPROC16 reserved2;
99 FARPROC16 MyAlloc; /* memory allocation procedure,
100 * wine must write this field */
101 FARPROC16 EntryAddrProc;
102 FARPROC16 ExitProc; /* exit procedure */
103 WORD reserved3[4];
104 FARPROC16 SetOwner; /* Set Owner procedure, exported by wine */
105} SELFLOADHEADER;
106
107 /* Parameters for LoadModule() */
108typedef struct
109{
110 HGLOBAL16 hEnvironment; /* Environment segment */
111 SEGPTR cmdLine WINE_PACKED; /* Command-line */
112 SEGPTR showCmd WINE_PACKED; /* Code for ShowWindow() */
113 SEGPTR reserved WINE_PACKED;
114} LOADPARAMS16;
115
116typedef struct
117{
118 LPSTR lpEnvAddress;
119 LPSTR lpCmdLine;
120 UINT16 *lpCmdShow;
121 DWORD dwReserved;
122} LOADPARAMS;
123
124#include "poppack.h"
125
126/* internal representation of 32bit modules. per process. */
127typedef enum {
128 MODULE32_PE = 1,
129 MODULE32_ELF,
130 MODULE32_ELFDLL,
131 MODULE32_BI
132} MODULE32_TYPE;
133
134typedef struct _wine_modref
135{
136 struct _wine_modref *next;
137 struct _wine_modref *prev;
138 MODULE32_TYPE type;
139 union {
140 PE_MODREF pe;
141 ELF_MODREF elf;
142 } binfmt;
143
144 HMODULE module;
145
146 int nDeps;
147 struct _wine_modref **deps;
148
149 int flags;
150 int refCount;
151
152 char *modname;
153 char *shortname;
154 char *longname;
155} WINE_MODREF;
156
157#define WINE_MODREF_INTERNAL 0x00000001
158#define WINE_MODREF_NO_DLL_CALLS 0x00000002
159#define WINE_MODREF_PROCESS_ATTACHED 0x00000004
160#define WINE_MODREF_LOAD_AS_DATAFILE 0x00000010
161#define WINE_MODREF_DONT_RESOLVE_REFS 0x00000020
162#define WINE_MODREF_MARKER 0x80000000
163
164
165#ifndef __WIN32OS2__
166/* Resource types */
167typedef struct resource_typeinfo_s NE_TYPEINFO;
168typedef struct resource_nameinfo_s NE_NAMEINFO;
169
170#define NE_SEG_TABLE(pModule) \
171 ((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->seg_table))
172
173#define NE_MODULE_TABLE(pModule) \
174 ((WORD *)((char *)(pModule) + (pModule)->modref_table))
175
176#define NE_MODULE_NAME(pModule) \
177 (((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName)
178#endif
179
180/* module.c */
181extern FARPROC MODULE_GetProcAddress( HMODULE hModule, LPCSTR function, BOOL snoop );
182extern WINE_MODREF *MODULE32_LookupHMODULE( HMODULE hModule );
183extern BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved );
184extern void MODULE_DllProcessDetach( BOOL bForceDetach, LPVOID lpReserved );
185extern void MODULE_DllThreadAttach( LPVOID lpReserved );
186extern void MODULE_DllThreadDetach( LPVOID lpReserved );
187extern WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags );
188extern BOOL MODULE_FreeLibrary( WINE_MODREF *wm );
189extern WINE_MODREF *MODULE_FindModule( LPCSTR path );
190extern HMODULE MODULE_CreateDummyModule( const OFSTRUCT *ofs, LPCSTR modName );
191extern FARPROC16 MODULE_GetWndProcEntry16( const char *name );
192extern FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE hmodule, LPCSTR name );
193extern SEGPTR WINAPI HasGPHandler16( SEGPTR address );
194
195/* resource.c */
196extern INT WINAPI AccessResource(HMODULE,HRSRC);
197
198#ifndef __WIN32OS2__
199/* loader/ne/module.c */
200extern NE_MODULE *NE_GetPtr( HMODULE16 hModule );
201extern void NE_DumpModule( HMODULE16 hModule );
202extern void NE_WalkModules(void);
203extern void NE_RegisterModule( NE_MODULE *pModule );
204extern WORD NE_GetOrdinal( HMODULE16 hModule, const char *name );
205extern FARPROC16 NE_GetEntryPoint( HMODULE16 hModule, WORD ordinal );
206extern FARPROC16 NE_GetEntryPointEx( HMODULE16 hModule, WORD ordinal, BOOL16 snoop );
207extern BOOL16 NE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, WORD offset );
208extern HANDLE NE_OpenFile( NE_MODULE *pModule );
209extern HINSTANCE16 MODULE_LoadModule16( LPCSTR name, BOOL implicit );
210extern BOOL NE_CreateProcess( HFILE hFile, OFSTRUCT *ofs, LPCSTR cmd_line, LPCSTR env,
211 LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
212 BOOL inherit, LPSTARTUPINFOA startup,
213 LPPROCESS_INFORMATION info );
214
215/* loader/ne/resource.c */
216extern HGLOBAL16 WINAPI NE_DefResourceHandler(HGLOBAL16,HMODULE16,HRSRC16);
217extern BOOL NE_InitResourceHandler( HMODULE16 hModule );
218extern HRSRC16 NE_FindResource( NE_MODULE *pModule, LPCSTR name, LPCSTR type );
219extern INT16 NE_AccessResource( NE_MODULE *pModule, HRSRC16 hRsrc );
220extern DWORD NE_SizeofResource( NE_MODULE *pModule, HRSRC16 hRsrc );
221extern HGLOBAL16 NE_LoadResource( NE_MODULE *pModule, HRSRC16 hRsrc );
222extern BOOL16 NE_FreeResource( NE_MODULE *pModule, HGLOBAL16 handle );
223extern NE_TYPEINFO *NE_FindTypeSection( LPBYTE pResTab, NE_TYPEINFO *pTypeInfo, LPCSTR typeId );
224extern NE_NAMEINFO *NE_FindResourceFromType( LPBYTE pResTab, NE_TYPEINFO *pTypeInfo, LPCSTR resId );
225
226/* loader/ne/segment.c */
227extern BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum );
228extern BOOL NE_LoadAllSegments( NE_MODULE *pModule );
229extern void NE_FixupPrologs( NE_MODULE *pModule );
230extern void NE_InitializeDLLs( HMODULE16 hModule );
231extern BOOL NE_CreateSegments( NE_MODULE *pModule );
232extern HINSTANCE16 NE_CreateInstance( NE_MODULE *pModule, HINSTANCE16 *prev,
233 BOOL lib_only );
234
235/* loader/ne/convert.c */
236HGLOBAL16 NE_LoadPEResource( NE_MODULE *pModule, WORD type, LPVOID bits, DWORD size );
237
238/* if1632/builtin.c */
239extern BOOL BUILTIN_Init(void);
240extern HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL force );
241extern LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd );
242
243/* relay32/builtin.c */
244extern HMODULE BUILTIN32_LoadImage(LPCSTR name, OFSTRUCT *ofs);
245extern WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR name, DWORD flags, DWORD *err);
246extern void BUILTIN32_UnloadLibrary(WINE_MODREF *wm);
247
248/* if1632/builtin.c */
249extern HMODULE16 (*fnBUILTIN_LoadModule)(LPCSTR name, BOOL force);
250#endif
251
252#endif /* __WINE_MODULE_H */
Note: See TracBrowser for help on using the repository browser.