2003-06-21 04:07:10 +02:00
|
|
|
/*
|
|
|
|
* Kernel32 undocumented and private functions definition
|
|
|
|
*
|
|
|
|
* Copyright 2003 Eric Pouech
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-06-21 04:07:10 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_KERNEL_PRIVATE_H
|
|
|
|
#define __WINE_KERNEL_PRIVATE_H
|
|
|
|
|
2008-12-08 16:05:17 +01:00
|
|
|
#include "wine/server.h"
|
|
|
|
|
2005-06-06 22:00:14 +02:00
|
|
|
struct tagSYSLEVEL;
|
|
|
|
|
|
|
|
struct kernel_thread_data
|
|
|
|
{
|
|
|
|
UINT code_page; /* thread code page */
|
|
|
|
WORD stack_sel; /* 16-bit stack selector */
|
|
|
|
WORD htask16; /* Win16 task handle */
|
|
|
|
DWORD sys_count[4]; /* syslevel mutex entry counters */
|
|
|
|
struct tagSYSLEVEL *sys_mutex[4]; /* syslevel mutex pointers */
|
2008-10-30 15:39:50 +01:00
|
|
|
void *pad[44]; /* change this if you add fields! */
|
2005-06-06 22:00:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct kernel_thread_data *kernel_get_thread_data(void)
|
|
|
|
{
|
|
|
|
return (struct kernel_thread_data *)NtCurrentTeb()->SystemReserved1;
|
|
|
|
}
|
|
|
|
|
2004-03-11 23:46:27 +01:00
|
|
|
HANDLE WINAPI OpenConsoleW(LPCWSTR, DWORD, BOOL, DWORD);
|
2003-06-21 04:07:10 +02:00
|
|
|
BOOL WINAPI VerifyConsoleIoHandle(HANDLE);
|
|
|
|
HANDLE WINAPI DuplicateConsoleHandle(HANDLE, DWORD, BOOL, DWORD);
|
|
|
|
BOOL WINAPI CloseConsoleHandle(HANDLE handle);
|
|
|
|
HANDLE WINAPI GetConsoleInputWaitHandle(void);
|
|
|
|
|
|
|
|
static inline BOOL is_console_handle(HANDLE h)
|
|
|
|
{
|
2005-09-12 17:14:06 +02:00
|
|
|
return h != INVALID_HANDLE_VALUE && ((UINT_PTR)h & 3) == 3;
|
2003-06-21 04:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* map a real wineserver handle onto a kernel32 console handle */
|
|
|
|
static inline HANDLE console_handle_map(HANDLE h)
|
|
|
|
{
|
2005-09-12 17:14:06 +02:00
|
|
|
return h != INVALID_HANDLE_VALUE ? (HANDLE)((UINT_PTR)h ^ 3) : INVALID_HANDLE_VALUE;
|
2003-06-21 04:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* map a kernel32 console handle onto a real wineserver handle */
|
2008-12-08 16:05:17 +01:00
|
|
|
static inline obj_handle_t console_handle_unmap(HANDLE h)
|
2003-06-21 04:07:10 +02:00
|
|
|
{
|
2008-12-08 16:05:17 +01:00
|
|
|
return wine_server_obj_handle( h != INVALID_HANDLE_VALUE ? (HANDLE)((UINT_PTR)h ^ 3) : INVALID_HANDLE_VALUE );
|
2003-06-21 04:07:10 +02:00
|
|
|
}
|
|
|
|
|
2004-02-12 01:00:55 +01:00
|
|
|
extern HMODULE kernel32_handle;
|
|
|
|
|
2003-06-24 04:32:01 +02:00
|
|
|
/* Size of per-process table of DOS handles */
|
|
|
|
#define DOS_TABLE_SIZE 256
|
|
|
|
extern HANDLE dos_handles[DOS_TABLE_SIZE];
|
|
|
|
|
2004-05-14 23:43:18 +02:00
|
|
|
extern const WCHAR *DIR_Windows;
|
|
|
|
extern const WCHAR *DIR_System;
|
2009-07-07 11:42:03 +02:00
|
|
|
extern const WCHAR *DIR_SysWow64;
|
2004-05-13 22:21:25 +02:00
|
|
|
|
2003-09-18 06:39:13 +02:00
|
|
|
extern VOID SYSLEVEL_CheckNotLevel( INT level );
|
|
|
|
|
2004-05-01 07:25:07 +02:00
|
|
|
extern void FILE_SetDosError(void);
|
2004-05-13 22:21:25 +02:00
|
|
|
extern WCHAR *FILE_name_AtoW( LPCSTR name, BOOL alloc );
|
|
|
|
extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen );
|
2004-05-01 07:25:07 +02:00
|
|
|
|
2007-05-18 16:37:23 +02:00
|
|
|
extern DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT86 *context );
|
2005-08-27 12:18:03 +02:00
|
|
|
extern LONG CALLBACK INSTR_vectored_handler( EXCEPTION_POINTERS *ptrs );
|
2003-11-13 22:04:01 +01:00
|
|
|
|
2005-05-16 21:44:54 +02:00
|
|
|
/* return values for MODULE_GetBinaryType */
|
2009-08-12 15:43:08 +02:00
|
|
|
#define BINARY_UNKNOWN 0x00
|
|
|
|
#define BINARY_PE 0x01
|
|
|
|
#define BINARY_WIN16 0x02
|
|
|
|
#define BINARY_OS216 0x03
|
|
|
|
#define BINARY_DOS 0x04
|
|
|
|
#define BINARY_UNIX_EXE 0x05
|
|
|
|
#define BINARY_UNIX_LIB 0x06
|
|
|
|
#define BINARY_TYPE_MASK 0x0f
|
|
|
|
#define BINARY_FLAG_DLL 0x10
|
2005-05-16 21:44:54 +02:00
|
|
|
|
|
|
|
/* module.c */
|
2004-03-26 00:41:04 +01:00
|
|
|
extern WCHAR *MODULE_get_dll_load_path( LPCWSTR module );
|
2009-08-12 15:43:08 +02:00
|
|
|
extern DWORD MODULE_GetBinaryType( HANDLE hfile, void **res_start, void **res_end );
|
2004-03-26 00:41:04 +01:00
|
|
|
|
2003-12-01 23:47:28 +01:00
|
|
|
extern BOOL NLS_IsUnicodeOnlyLcid(LCID);
|
|
|
|
|
2004-05-01 07:25:07 +02:00
|
|
|
extern HANDLE VXD_Open( LPCWSTR filename, DWORD access, LPSECURITY_ATTRIBUTES sa );
|
|
|
|
|
2005-05-10 17:22:09 +02:00
|
|
|
extern WORD DOSMEM_0000H;
|
|
|
|
extern WORD DOSMEM_BiosDataSeg;
|
|
|
|
extern WORD DOSMEM_BiosSysSeg;
|
|
|
|
|
2005-05-16 21:44:54 +02:00
|
|
|
/* dosmem.c */
|
2005-05-10 17:22:09 +02:00
|
|
|
extern BOOL DOSMEM_Init(void);
|
|
|
|
extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
|
|
|
|
extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
|
|
|
|
extern UINT DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
|
2006-01-25 13:19:11 +01:00
|
|
|
extern BOOL load_winedos(void);
|
2005-05-10 17:22:09 +02:00
|
|
|
|
2005-06-14 13:42:34 +02:00
|
|
|
/* environ.c */
|
|
|
|
extern void ENV_CopyStartupInformation(void);
|
|
|
|
|
|
|
|
/* computername.c */
|
|
|
|
extern void COMPUTERNAME_Init(void);
|
|
|
|
|
|
|
|
/* locale.c */
|
|
|
|
extern void LOCALE_Init(void);
|
|
|
|
extern void LOCALE_InitRegistry(void);
|
|
|
|
|
|
|
|
/* oldconfig.c */
|
|
|
|
extern void convert_old_config(void);
|
|
|
|
|
2005-05-10 17:22:09 +02:00
|
|
|
extern struct winedos_exports
|
|
|
|
{
|
|
|
|
/* for global16.c */
|
|
|
|
void* (*AllocDosBlock)(UINT size, UINT16* pseg);
|
|
|
|
BOOL (*FreeDosBlock)(void* ptr);
|
|
|
|
UINT (*ResizeDosBlock)(void *ptr, UINT size, BOOL exact);
|
|
|
|
/* for instr.c */
|
2007-12-23 13:55:12 +01:00
|
|
|
BOOL (WINAPI *EmulateInterruptPM)( CONTEXT86 *context, BYTE intnum );
|
2005-05-10 17:22:09 +02:00
|
|
|
void (WINAPI *CallBuiltinHandler)( CONTEXT86 *context, BYTE intnum );
|
|
|
|
DWORD (WINAPI *inport)( int port, int size );
|
|
|
|
void (WINAPI *outport)( int port, int size, DWORD val );
|
|
|
|
void (* BiosTick)(WORD timer);
|
|
|
|
} winedos;
|
2003-11-13 22:04:01 +01:00
|
|
|
|
2005-12-02 15:55:48 +01:00
|
|
|
/* returns directory handle for named objects */
|
|
|
|
extern HANDLE get_BaseNamedObjects_handle(void);
|
|
|
|
|
2008-12-27 19:47:46 +01:00
|
|
|
/* Register functions */
|
|
|
|
|
|
|
|
#ifdef __i386__
|
2009-01-06 12:49:38 +01:00
|
|
|
#define DEFINE_REGS_ENTRYPOINT( name, args ) \
|
2008-12-27 19:47:46 +01:00
|
|
|
__ASM_GLOBAL_FUNC( name, \
|
2009-01-06 12:51:18 +01:00
|
|
|
".byte 0x68\n\t" /* pushl $__regs_func */ \
|
|
|
|
".long " __ASM_NAME("__regs_") #name "-.-11\n\t" \
|
|
|
|
".byte 0x6a," #args "\n\t" /* pushl $args */ \
|
2009-08-12 14:35:43 +02:00
|
|
|
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
|
|
|
|
"ret $(4*" #args ")" ) /* fake ret to make copy protections happy */
|
2008-12-27 19:47:46 +01:00
|
|
|
#endif
|
|
|
|
|
2003-06-21 04:07:10 +02:00
|
|
|
#endif
|