2 * Kernel32 undocumented and private functions definition
4 * Copyright 2003 Eric Pouech
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_KERNEL_PRIVATE_H
22 #define __WINE_KERNEL_PRIVATE_H
24 #include "wine/winbase16.h"
27 HANDLE WINAPI OpenConsoleW(LPCWSTR, DWORD, BOOL, DWORD);
28 BOOL WINAPI VerifyConsoleIoHandle(HANDLE);
29 HANDLE WINAPI DuplicateConsoleHandle(HANDLE, DWORD, BOOL, DWORD);
30 BOOL WINAPI CloseConsoleHandle(HANDLE handle);
31 HANDLE WINAPI GetConsoleInputWaitHandle(void);
33 static inline BOOL is_console_handle(HANDLE h)
35 return h != INVALID_HANDLE_VALUE && ((DWORD)h & 3) == 3;
38 /* map a real wineserver handle onto a kernel32 console handle */
39 static inline HANDLE console_handle_map(HANDLE h)
41 return h != INVALID_HANDLE_VALUE ? (HANDLE)((DWORD)h ^ 3) : INVALID_HANDLE_VALUE;
44 /* map a kernel32 console handle onto a real wineserver handle */
45 static inline HANDLE console_handle_unmap(HANDLE h)
47 return h != INVALID_HANDLE_VALUE ? (HANDLE)((DWORD)h ^ 3) : INVALID_HANDLE_VALUE;
50 #define CURRENT_STACK16 ((STACK16FRAME*)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved))
51 #define CURRENT_DS (CURRENT_STACK16->ds)
53 /* push bytes on the 16-bit stack of a thread; return a segptr to the first pushed byte */
54 static inline SEGPTR stack16_push( int size )
56 STACK16FRAME *frame = CURRENT_STACK16;
57 memmove( (char*)frame - size, frame, sizeof(*frame) );
58 NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved - size;
59 return (SEGPTR)((char *)NtCurrentTeb()->WOW32Reserved + sizeof(*frame));
62 /* pop bytes from the 16-bit stack of a thread */
63 static inline void stack16_pop( int size )
65 STACK16FRAME *frame = CURRENT_STACK16;
66 memmove( (char*)frame + size, frame, sizeof(*frame) );
67 NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved + size;
70 extern HMODULE kernel32_handle;
72 /* Size of per-process table of DOS handles */
73 #define DOS_TABLE_SIZE 256
74 extern HANDLE dos_handles[DOS_TABLE_SIZE];
76 extern const WCHAR *DIR_Windows;
77 extern const WCHAR *DIR_System;
79 extern void PTHREAD_Init(void);
80 extern BOOL WOWTHUNK_Init(void);
82 extern VOID SYSLEVEL_CheckNotLevel( INT level );
84 extern void FILE_SetDosError(void);
85 extern WCHAR *FILE_name_AtoW( LPCSTR name, BOOL alloc );
86 extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen );
88 extern DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context );
89 extern void INSTR_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum );
91 extern WCHAR *MODULE_get_dll_load_path( LPCWSTR module );
93 extern BOOL NLS_IsUnicodeOnlyLcid(LCID);
95 extern WORD SELECTOR_AllocBlock( const void *base, DWORD size, unsigned char flags );
96 extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size );
97 extern void SELECTOR_FreeBlock( WORD sel );
98 #define IS_SELECTOR_32BIT(sel) \
99 (wine_ldt_is_system(sel) || (wine_ldt_copy.flags[LOWORD(sel) >> 3] & WINE_LDT_FLAGS_32BIT))
101 extern HANDLE VXD_Open( LPCWSTR filename, DWORD access, LPSECURITY_ATTRIBUTES sa );
103 /* this structure is always located at offset 0 of the DGROUP segment */
104 #include "pshpack1.h"
107 WORD null; /* Always 0 */
108 DWORD old_ss_sp; /* Stack pointer; used by SwitchTaskTo() */
109 WORD heap; /* Pointer to the local heap information (if any) */
110 WORD atomtable; /* Pointer to the local atom table (if any) */
111 WORD stacktop; /* Top of the stack */
112 WORD stackmin; /* Lowest stack address used so far */
113 WORD stackbottom; /* Bottom of the stack */
116 extern WORD DOSMEM_0000H;
117 extern WORD DOSMEM_BiosDataSeg;
118 extern WORD DOSMEM_BiosSysSeg;
121 extern BOOL DOSMEM_Init(void);
122 extern WORD DOSMEM_AllocSelector(WORD);
123 extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
124 extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
125 extern UINT DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
126 extern void load_winedos(void);
128 extern struct winedos_exports
131 void* (*AllocDosBlock)(UINT size, UINT16* pseg);
132 BOOL (*FreeDosBlock)(void* ptr);
133 UINT (*ResizeDosBlock)(void *ptr, UINT size, BOOL exact);
135 void (WINAPI *EmulateInterruptPM)( CONTEXT86 *context, BYTE intnum );
136 void (WINAPI *CallBuiltinHandler)( CONTEXT86 *context, BYTE intnum );
137 DWORD (WINAPI *inport)( int port, int size );
138 void (WINAPI *outport)( int port, int size, DWORD val );
139 void (* BiosTick)(WORD timer);