~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/krnl386.exe16/kernel16_private.h

Version: ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Kernel 16-bit private definitions
  3  *
  4  * Copyright 1995 Alexandre Julliard
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #ifndef __WINE_KERNEL16_PRIVATE_H
 22 #define __WINE_KERNEL16_PRIVATE_H
 23 
 24 #include "wine/winbase16.h"
 25 #include "winreg.h"
 26 #include "winternl.h"
 27 
 28 #include "pshpack1.h"
 29 
 30 /* In-memory module structure. See 'Windows Internals' p. 219 */
 31 typedef struct _NE_MODULE
 32 {
 33     WORD      ne_magic;         /* 00 'NE' signature */
 34     WORD      count;            /* 02 Usage count (ne_ver/ne_rev on disk) */
 35     WORD      ne_enttab;        /* 04 Near ptr to entry table */
 36     HMODULE16 next;             /* 06 Selector to next module (ne_cbenttab on disk) */
 37     WORD      dgroup_entry;     /* 08 Near ptr to segment entry for DGROUP (ne_crc on disk) */
 38     WORD      fileinfo;         /* 0a Near ptr to file info (OFSTRUCT) (ne_crc on disk) */
 39     WORD      ne_flags;         /* 0c Module flags */
 40     WORD      ne_autodata;      /* 0e Logical segment for DGROUP */
 41     WORD      ne_heap;          /* 10 Initial heap size */
 42     WORD      ne_stack;         /* 12 Initial stack size */
 43     DWORD     ne_csip;          /* 14 Initial cs:ip */
 44     DWORD     ne_sssp;          /* 18 Initial ss:sp */
 45     WORD      ne_cseg;          /* 1c Number of segments in segment table */
 46     WORD      ne_cmod;          /* 1e Number of module references */
 47     WORD      ne_cbnrestab;     /* 20 Size of non-resident names table */
 48     WORD      ne_segtab;        /* 22 Near ptr to segment table */
 49     WORD      ne_rsrctab;       /* 24 Near ptr to resource table */
 50     WORD      ne_restab;        /* 26 Near ptr to resident names table */
 51     WORD      ne_modtab;        /* 28 Near ptr to module reference table */
 52     WORD      ne_imptab;        /* 2a Near ptr to imported names table */
 53     DWORD     ne_nrestab;       /* 2c File offset of non-resident names table */
 54     WORD      ne_cmovent;       /* 30 Number of moveable entries in entry table*/
 55     WORD      ne_align;         /* 32 Alignment shift count */
 56     WORD      ne_cres;          /* 34 # of resource segments */
 57     BYTE      ne_exetyp;        /* 36 Operating system flags */
 58     BYTE      ne_flagsothers;   /* 37 Misc. flags */
 59     HANDLE16  dlls_to_init;     /* 38 List of DLLs to initialize (ne_pretthunks on disk) */
 60     HANDLE16  nrname_handle;    /* 3a Handle to non-resident name table (ne_psegrefbytes on disk) */
 61     WORD      ne_swaparea;      /* 3c Min. swap area size */
 62     WORD      ne_expver;        /* 3e Expected Windows version */
 63     /* From here, these are extra fields not present in normal Windows */
 64     HMODULE   module32;         /* PE module handle for Win32 modules */
 65     HMODULE   owner32;          /* PE module containing this one for 16-bit builtins */
 66     HMODULE16 self;             /* Handle for this module */
 67     WORD      self_loading_sel; /* Selector used for self-loading apps. */
 68     LPVOID    rsrc32_map;       /* HRSRC 16->32 map (for 32-bit modules) */
 69     LPCVOID   mapping;          /* mapping of the binary file */
 70     SIZE_T    mapping_size;     /* size of the file mapping */
 71 } NE_MODULE;
 72 
 73 typedef struct
 74 {
 75     BYTE type;
 76     BYTE flags;
 77     BYTE segnum;
 78     WORD offs;
 79 } ET_ENTRY;
 80 
 81 typedef struct
 82 {
 83     WORD first; /* ordinal */
 84     WORD last;  /* ordinal */
 85     WORD next;  /* bundle */
 86 } ET_BUNDLE;
 87 
 88 
 89   /* In-memory segment table */
 90 typedef struct
 91 {
 92     WORD      filepos;   /* Position in file, in sectors */
 93     WORD      size;      /* Segment size on disk */
 94     WORD      flags;     /* Segment flags */
 95     WORD      minsize;   /* Min. size of segment in memory */
 96     HANDLE16  hSeg;      /* Selector or handle (selector - 1) of segment in memory */
 97 } SEGTABLEENTRY;
 98 
 99 /* this structure is always located at offset 0 of the DGROUP segment */
100 typedef struct
101 {
102     WORD null;        /* Always 0 */
103     DWORD old_ss_sp;  /* Stack pointer; used by SwitchTaskTo() */
104     WORD heap;        /* Pointer to the local heap information (if any) */
105     WORD atomtable;   /* Pointer to the local atom table (if any) */
106     WORD stacktop;    /* Top of the stack */
107     WORD stackmin;    /* Lowest stack address used so far */
108     WORD stackbottom; /* Bottom of the stack */
109 } INSTANCEDATA;
110 
111 /* relay entry points */
112 
113 typedef struct
114 {
115     WORD   pushw_bp;               /* pushw %bp */
116     BYTE   pushl;                  /* pushl $target */
117     void  *target;
118     WORD   call;                   /* call CALLFROM16 */
119     short  callfrom16;
120 } ENTRYPOINT16;
121 
122 typedef struct
123 {
124     BYTE   pushl;                  /* pushl $relay */
125     void  *relay;
126     BYTE   lcall;                  /* lcall __FLATCS__:glue */
127     void  *glue;
128     WORD   flatcs;
129     WORD   ret[5];                 /* return sequence */
130     WORD   movl;                   /* movl arg_types[1],arg_types[0](%esi) */
131     DWORD  arg_types[2];           /* type of each argument */
132 } CALLFROM16;
133 
134 /* THHOOK Kernel Data Structure */
135 typedef struct _THHOOK
136 {
137     HANDLE16   hGlobalHeap;         /* 00 (handle BURGERMASTER) */
138     WORD       pGlobalHeap;         /* 02 (selector BURGERMASTER) */
139     HMODULE16  hExeHead;            /* 04 hFirstModule */
140     HMODULE16  hExeSweep;           /* 06 (unused) */
141     HANDLE16   TopPDB;              /* 08 (handle of KERNEL PDB) */
142     HANDLE16   HeadPDB;             /* 0A (first PDB in list) */
143     HANDLE16   TopSizePDB;          /* 0C (unused) */
144     HTASK16    HeadTDB;             /* 0E hFirstTask */
145     HTASK16    CurTDB;              /* 10 hCurrentTask */
146     HTASK16    LoadTDB;             /* 12 (unused) */
147     HTASK16    LockTDB;             /* 14 hLockedTask */
148 } THHOOK;
149 
150 extern LONG __wine_call_from_16(void);
151 extern void __wine_call_from_16_regs(void);
152 
153 extern THHOOK *pThhook;
154 
155 #include "poppack.h"
156 
157 #define NE_SEG_TABLE(pModule) \
158     ((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->ne_segtab))
159 
160 #define NE_MODULE_NAME(pModule) \
161     (((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName)
162 
163 #define NE_GET_DATA(pModule,offset,size) \
164     ((const void *)(((offset)+(size) <= pModule->mapping_size) ? \
165                     (const char *)pModule->mapping + (offset) : NULL))
166 
167 #define NE_READ_DATA(pModule,buffer,offset,size) \
168     (((offset)+(size) <= pModule->mapping_size) ? \
169      (memcpy( buffer, (const char *)pModule->mapping + (offset), (size) ), TRUE) : FALSE)
170 
171 #define CURRENT_STACK16 ((STACK16FRAME*)MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved)))
172 #define CURRENT_DS      (CURRENT_STACK16->ds)
173 
174 /* push bytes on the 16-bit stack of a thread; return a segptr to the first pushed byte */
175 static inline SEGPTR stack16_push( int size )
176 {
177     STACK16FRAME *frame = CURRENT_STACK16;
178     memmove( (char*)frame - size, frame, sizeof(*frame) );
179     NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved - size;
180     return (SEGPTR)((char *)NtCurrentTeb()->WOW32Reserved + sizeof(*frame));
181 }
182 
183 /* pop bytes from the 16-bit stack of a thread */
184 static inline void stack16_pop( int size )
185 {
186     STACK16FRAME *frame = CURRENT_STACK16;
187     memmove( (char*)frame + size, frame, sizeof(*frame) );
188     NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved + size;
189 }
190 
191 /* dosmem.c */
192 extern BOOL   DOSMEM_Init(void);
193 extern BOOL   DOSMEM_InitDosMemory(void);
194 extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
195 extern LPVOID DOSMEM_MapDosToLinear(UINT);   /* linear DOS to Wine */
196 extern UINT   DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
197 extern BOOL   DOSMEM_MapDosLayout(void);
198 extern LPVOID DOSMEM_AllocBlock(UINT size, WORD* p);
199 extern BOOL   DOSMEM_FreeBlock(void* ptr);
200 extern UINT   DOSMEM_ResizeBlock(void* ptr, UINT size, BOOL exact);
201 extern UINT   DOSMEM_Available(void);
202 
203 /* global16.c */
204 extern HGLOBAL16 GLOBAL_CreateBlock( UINT16 flags, void *ptr, DWORD size,
205                                      HGLOBAL16 hOwner, unsigned char selflags );
206 extern BOOL16 GLOBAL_FreeBlock( HGLOBAL16 handle );
207 extern BOOL16 GLOBAL_MoveBlock( HGLOBAL16 handle, void *ptr, DWORD size );
208 extern HGLOBAL16 GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL16 hOwner, unsigned char selflags );
209 
210 /* instr.c */
211 extern DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT86 *context );
212 extern LONG CALLBACK INSTR_vectored_handler( EXCEPTION_POINTERS *ptrs );
213 
214 /* ne_module.c */
215 extern NE_MODULE *NE_GetPtr( HMODULE16 hModule );
216 extern WORD NE_GetOrdinal( HMODULE16 hModule, const char *name );
217 extern FARPROC16 WINAPI NE_GetEntryPoint( HMODULE16 hModule, WORD ordinal );
218 extern FARPROC16 NE_GetEntryPointEx( HMODULE16 hModule, WORD ordinal, BOOL16 snoop );
219 extern BOOL16 NE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, WORD offset );
220 extern DWORD NE_StartTask(void);
221 
222 /* ne_segment.c */
223 extern BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum );
224 extern BOOL NE_LoadAllSegments( NE_MODULE *pModule );
225 extern BOOL NE_CreateSegment( NE_MODULE *pModule, int segnum );
226 extern BOOL NE_CreateAllSegments( NE_MODULE *pModule );
227 extern HINSTANCE16 NE_GetInstance( NE_MODULE *pModule );
228 extern void NE_InitializeDLLs( HMODULE16 hModule );
229 extern void NE_DllProcessAttach( HMODULE16 hModule );
230 extern void NE_CallUserSignalProc( HMODULE16 hModule, UINT16 code );
231 
232 /* selector.c */
233 extern WORD SELECTOR_AllocBlock( const void *base, DWORD size, unsigned char flags );
234 extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size );
235 extern void SELECTOR_FreeBlock( WORD sel );
236 #define IS_SELECTOR_32BIT(sel) \
237    (wine_ldt_is_system(sel) || (wine_ldt_copy.flags[LOWORD(sel) >> 3] & WINE_LDT_FLAGS_32BIT))
238 
239 /* relay16.c */
240 extern int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT86 *context );
241 
242 /* snoop16.c */
243 extern void SNOOP16_RegisterDLL(HMODULE16,LPCSTR);
244 extern FARPROC16 SNOOP16_GetProcAddress16(HMODULE16,DWORD,FARPROC16);
245 extern int SNOOP16_ShowDebugmsgSnoop(const char *dll,int ord,const char *fname);
246 
247 /* syslevel.c */
248 extern VOID SYSLEVEL_CheckNotLevel( INT level );
249 
250 /* task.c */
251 extern void TASK_CreateMainTask(void);
252 extern HTASK16 TASK_SpawnTask( NE_MODULE *pModule, WORD cmdShow,
253                                LPCSTR cmdline, BYTE len, HANDLE *hThread );
254 extern void TASK_ExitTask(void);
255 extern HTASK16 TASK_GetTaskFromThread( DWORD thread );
256 extern TDB *TASK_GetCurrent(void);
257 extern void TASK_InstallTHHook( THHOOK *pNewThook );
258 
259 extern BOOL WOWTHUNK_Init(void);
260 
261 extern WORD DOSMEM_0000H;
262 extern WORD DOSMEM_BiosDataSeg;
263 extern WORD DOSMEM_BiosSysSeg;
264 extern DWORD CallTo16_DataSelector;
265 extern DWORD CallTo16_TebSelector;
266 extern SEGPTR CALL32_CBClient_RetAddr;
267 extern SEGPTR CALL32_CBClientEx_RetAddr;
268 
269 struct tagSYSLEVEL;
270 
271 struct kernel_thread_data
272 {
273     WORD                stack_sel;      /* 16-bit stack selector */
274     WORD                htask16;        /* Win16 task handle */
275     DWORD               sys_count[4];   /* syslevel mutex entry counters */
276     struct tagSYSLEVEL *sys_mutex[4];   /* syslevel mutex pointers */
277     void               *pad[45];        /* change this if you add fields! */
278 };
279 
280 static inline struct kernel_thread_data *kernel_get_thread_data(void)
281 {
282     return (struct kernel_thread_data *)NtCurrentTeb()->SystemReserved1;
283 }
284 
285 #define DEFINE_REGS_ENTRYPOINT( name, args ) \
286     __ASM_GLOBAL_FUNC( name, \
287                        ".byte 0x68\n\t"  /* pushl $__regs_func */       \
288                        ".long " __ASM_NAME("__regs_") #name "-.-11\n\t" \
289                        ".byte 0x6a," #args "\n\t" /* pushl $args */     \
290                        "call " __ASM_NAME("__wine_call_from_regs") "\n\t" \
291                        "ret $(4*" #args ")" ) /* fake ret to make copy protections happy */
292 
293 #endif  /* __WINE_KERNEL16_PRIVATE_H */
294 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.