Moved a bunch of definitions out of module.h into a new

kernel16_private.h header.
This commit is contained in:
Alexandre Julliard 2005-05-16 19:44:54 +00:00
parent b5c63ed491
commit 4776085c9c
18 changed files with 155 additions and 124 deletions

View File

@ -42,6 +42,7 @@
#include "wine/unicode.h"
#include "wine/winbase16.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"

View File

@ -26,6 +26,7 @@
#include "wine/server.h"
#include "ntstatus.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(debugstr);

View File

@ -41,6 +41,7 @@
#include "ntstatus.h"
#include "toolhelp.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"
#include "winerror.h"

View File

@ -30,9 +30,9 @@
#include "wine/winuser16.h"
#include "excpt.h"
#include "thread.h"
#include "module.h"
#include "wine/debug.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/exception.h"
WINE_DEFAULT_DEBUG_CHANNEL(int);

View File

@ -0,0 +1,124 @@
/*
* Kernel 16-bit private definitions
*
* Copyright 1995 Alexandre Julliard
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_KERNEL16_PRIVATE_H
#define __WINE_KERNEL16_PRIVATE_H
#include "wine/winbase16.h"
#include "winreg.h"
#include "winternl.h"
#include "module.h"
#include "pshpack1.h"
/* this structure is always located at offset 0 of the DGROUP segment */
typedef struct
{
WORD null; /* Always 0 */
DWORD old_ss_sp; /* Stack pointer; used by SwitchTaskTo() */
WORD heap; /* Pointer to the local heap information (if any) */
WORD atomtable; /* Pointer to the local atom table (if any) */
WORD stacktop; /* Top of the stack */
WORD stackmin; /* Lowest stack address used so far */
WORD stackbottom; /* Bottom of the stack */
} INSTANCEDATA;
/* THHOOK Kernel Data Structure */
typedef struct _THHOOK
{
HANDLE16 hGlobalHeap; /* 00 (handle BURGERMASTER) */
WORD pGlobalHeap; /* 02 (selector BURGERMASTER) */
HMODULE16 hExeHead; /* 04 hFirstModule */
HMODULE16 hExeSweep; /* 06 (unused) */
HANDLE16 TopPDB; /* 08 (handle of KERNEL PDB) */
HANDLE16 HeadPDB; /* 0A (first PDB in list) */
HANDLE16 TopSizePDB; /* 0C (unused) */
HTASK16 HeadTDB; /* 0E hFirstTask */
HTASK16 CurTDB; /* 10 hCurrentTask */
HTASK16 LoadTDB; /* 12 (unused) */
HTASK16 LockTDB; /* 14 hLockedTask */
} THHOOK;
extern THHOOK *pThhook;
#include "poppack.h"
#define NE_SEG_TABLE(pModule) \
((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->seg_table))
#define NE_MODULE_NAME(pModule) \
(((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName)
#define CURRENT_STACK16 ((STACK16FRAME*)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved))
#define CURRENT_DS (CURRENT_STACK16->ds)
/* push bytes on the 16-bit stack of a thread; return a segptr to the first pushed byte */
static inline SEGPTR stack16_push( int size )
{
STACK16FRAME *frame = CURRENT_STACK16;
memmove( (char*)frame - size, frame, sizeof(*frame) );
NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved - size;
return (SEGPTR)((char *)NtCurrentTeb()->WOW32Reserved + sizeof(*frame));
}
/* pop bytes from the 16-bit stack of a thread */
static inline void stack16_pop( int size )
{
STACK16FRAME *frame = CURRENT_STACK16;
memmove( (char*)frame + size, frame, sizeof(*frame) );
NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved + size;
}
/* ne_module.c */
extern NE_MODULE *NE_GetPtr( HMODULE16 hModule );
extern WORD NE_GetOrdinal( HMODULE16 hModule, const char *name );
extern FARPROC16 WINAPI NE_GetEntryPoint( HMODULE16 hModule, WORD ordinal );
extern FARPROC16 NE_GetEntryPointEx( HMODULE16 hModule, WORD ordinal, BOOL16 snoop );
extern BOOL16 NE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, WORD offset );
extern HANDLE NE_OpenFile( NE_MODULE *pModule );
extern DWORD NE_StartTask(void);
/* ne_segment.c */
extern BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum );
extern BOOL NE_LoadAllSegments( NE_MODULE *pModule );
extern BOOL NE_CreateSegment( NE_MODULE *pModule, int segnum );
extern BOOL NE_CreateAllSegments( NE_MODULE *pModule );
extern HINSTANCE16 NE_GetInstance( NE_MODULE *pModule );
extern void NE_InitializeDLLs( HMODULE16 hModule );
extern void NE_DllProcessAttach( HMODULE16 hModule );
extern void NE_CallUserSignalProc( HMODULE16 hModule, UINT16 code );
/* selector.c */
extern WORD SELECTOR_AllocBlock( const void *base, DWORD size, unsigned char flags );
extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size );
extern void SELECTOR_FreeBlock( WORD sel );
#define IS_SELECTOR_32BIT(sel) \
(wine_ldt_is_system(sel) || (wine_ldt_copy.flags[LOWORD(sel) >> 3] & WINE_LDT_FLAGS_32BIT))
/* task.c */
extern void TASK_CreateMainTask(void);
extern HTASK16 TASK_SpawnTask( NE_MODULE *pModule, WORD cmdShow,
LPCSTR cmdline, BYTE len, HANDLE *hThread );
extern void TASK_ExitTask(void);
extern HTASK16 TASK_GetTaskFromThread( DWORD thread );
extern TDB *TASK_GetCurrent(void);
extern void TASK_InstallTHHook( THHOOK *pNewThook );
#endif /* __WINE_KERNEL16_PRIVATE_H */

View File

@ -39,10 +39,10 @@
#include "wine/winbase16.h"
#include "wine/library.h"
#include "module.h"
#include "wincon.h"
#include "toolhelp.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "console_private.h"
extern void LOCALE_InitRegistry(void);

View File

@ -21,9 +21,6 @@
#ifndef __WINE_KERNEL_PRIVATE_H
#define __WINE_KERNEL_PRIVATE_H
#include "wine/winbase16.h"
#include "thread.h"
HANDLE WINAPI OpenConsoleW(LPCWSTR, DWORD, BOOL, DWORD);
BOOL WINAPI VerifyConsoleIoHandle(HANDLE);
HANDLE WINAPI DuplicateConsoleHandle(HANDLE, DWORD, BOOL, DWORD);
@ -47,26 +44,6 @@ static inline HANDLE console_handle_unmap(HANDLE h)
return h != INVALID_HANDLE_VALUE ? (HANDLE)((DWORD)h ^ 3) : INVALID_HANDLE_VALUE;
}
#define CURRENT_STACK16 ((STACK16FRAME*)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved))
#define CURRENT_DS (CURRENT_STACK16->ds)
/* push bytes on the 16-bit stack of a thread; return a segptr to the first pushed byte */
static inline SEGPTR stack16_push( int size )
{
STACK16FRAME *frame = CURRENT_STACK16;
memmove( (char*)frame - size, frame, sizeof(*frame) );
NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved - size;
return (SEGPTR)((char *)NtCurrentTeb()->WOW32Reserved + sizeof(*frame));
}
/* pop bytes from the 16-bit stack of a thread */
static inline void stack16_pop( int size )
{
STACK16FRAME *frame = CURRENT_STACK16;
memmove( (char*)frame + size, frame, sizeof(*frame) );
NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved + size;
}
extern HMODULE kernel32_handle;
/* Size of per-process table of DOS handles */
@ -88,36 +65,32 @@ extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen );
extern DWORD INSTR_EmulateInstruction( EXCEPTION_RECORD *rec, CONTEXT86 *context );
extern void INSTR_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum );
/* return values for MODULE_GetBinaryType */
enum binary_type
{
BINARY_UNKNOWN,
BINARY_PE_EXE,
BINARY_PE_DLL,
BINARY_WIN16,
BINARY_OS216,
BINARY_DOS,
BINARY_UNIX_EXE,
BINARY_UNIX_LIB
};
/* module.c */
extern WCHAR *MODULE_get_dll_load_path( LPCWSTR module );
extern enum binary_type MODULE_GetBinaryType( HANDLE hfile, void **res_start, void **res_end );
extern BOOL NLS_IsUnicodeOnlyLcid(LCID);
extern WORD SELECTOR_AllocBlock( const void *base, DWORD size, unsigned char flags );
extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size );
extern void SELECTOR_FreeBlock( WORD sel );
#define IS_SELECTOR_32BIT(sel) \
(wine_ldt_is_system(sel) || (wine_ldt_copy.flags[LOWORD(sel) >> 3] & WINE_LDT_FLAGS_32BIT))
extern HANDLE VXD_Open( LPCWSTR filename, DWORD access, LPSECURITY_ATTRIBUTES sa );
/* this structure is always located at offset 0 of the DGROUP segment */
#include "pshpack1.h"
typedef struct
{
WORD null; /* Always 0 */
DWORD old_ss_sp; /* Stack pointer; used by SwitchTaskTo() */
WORD heap; /* Pointer to the local heap information (if any) */
WORD atomtable; /* Pointer to the local atom table (if any) */
WORD stacktop; /* Top of the stack */
WORD stackmin; /* Lowest stack address used so far */
WORD stackbottom; /* Bottom of the stack */
} INSTANCEDATA;
#include "poppack.h"
extern WORD DOSMEM_0000H;
extern WORD DOSMEM_BiosDataSeg;
extern WORD DOSMEM_BiosSysSeg;
/* msdos/dosmem.c */
/* dosmem.c */
extern BOOL DOSMEM_Init(void);
extern WORD DOSMEM_AllocSelector(WORD);
extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */

View File

@ -35,9 +35,9 @@
#include <string.h>
#include "wine/winbase16.h"
#include "wownt32.h"
#include "module.h"
#include "toolhelp.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(local);

View File

@ -35,10 +35,10 @@
#include "windef.h"
#include "wine/winbase16.h"
#include "wownt32.h"
#include "module.h"
#include "toolhelp.h"
#include "excpt.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/exception.h"
#include "wine/debug.h"

View File

@ -37,7 +37,7 @@
#include "wownt32.h"
#include "wine/library.h"
#include "kernel_private.h"
#include "module.h"
#include "kernel16_private.h"
#include "toolhelp.h"
#include "wine/debug.h"

View File

@ -29,8 +29,8 @@
#include "windef.h"
#include "winbase.h"
#include "wine/winbase16.h"
#include "module.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/unicode.h"
#include "wine/library.h"
#include "wine/debug.h"

View File

@ -36,7 +36,7 @@
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "wine/unicode.h"
#include "module.h"
#include "kernel16_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(resource);

View File

@ -31,7 +31,7 @@
#include "wine/winbase16.h"
#include "wine/library.h"
#include "kernel_private.h"
#include "module.h"
#include "kernel16_private.h"
#include "toolhelp.h"
#include "wine/debug.h"

View File

@ -29,6 +29,7 @@
#include "wine/winuser16.h"
#include "wownt32.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(system);

View File

@ -38,11 +38,11 @@
#include "wine/winbase16.h"
#include "thread.h"
#include "module.h"
#include "winternl.h"
#include "wine/server.h"
#include "toolhelp.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"

View File

@ -42,8 +42,8 @@
#include "wine/debug.h"
#include "wine/library.h"
#include "module.h"
#include "kernel_private.h"
#include "kernel16_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(thunk);

View File

@ -33,8 +33,8 @@
#include "thread.h"
#include "winreg.h"
#include "winternl.h"
#include "module.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/exception.h"
#include "wine/debug.h"

View File

@ -100,36 +100,8 @@ typedef struct
/* of segment in memory */
} SEGTABLEENTRY;
/* THHOOK Kernel Data Structure */
typedef struct _THHOOK
{
HANDLE16 hGlobalHeap; /* 00 (handle BURGERMASTER) */
WORD pGlobalHeap; /* 02 (selector BURGERMASTER) */
HMODULE16 hExeHead; /* 04 hFirstModule */
HMODULE16 hExeSweep; /* 06 (unused) */
HANDLE16 TopPDB; /* 08 (handle of KERNEL PDB) */
HANDLE16 HeadPDB; /* 0A (first PDB in list) */
HANDLE16 TopSizePDB; /* 0C (unused) */
HTASK16 HeadTDB; /* 0E hFirstTask */
HTASK16 CurTDB; /* 10 hCurrentTask */
HTASK16 LoadTDB; /* 12 (unused) */
HTASK16 LockTDB; /* 14 hLockedTask */
} THHOOK;
extern THHOOK *pThhook;
#include <poppack.h>
/* Resource types */
#define NE_SEG_TABLE(pModule) \
((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->seg_table))
#define NE_MODULE_NAME(pModule) \
(((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName)
enum loadorder_type
{
LOADORDER_INVALID = 0, /* Must be 0 */
@ -138,54 +110,12 @@ enum loadorder_type
LOADORDER_NTYPES
};
/* return values for MODULE_GetBinaryType */
enum binary_type
{
BINARY_UNKNOWN,
BINARY_PE_EXE,
BINARY_PE_DLL,
BINARY_WIN16,
BINARY_OS216,
BINARY_DOS,
BINARY_UNIX_EXE,
BINARY_UNIX_LIB
};
/* module.c */
extern NTSTATUS MODULE_DllThreadAttach( LPVOID lpReserved );
extern enum binary_type MODULE_GetBinaryType( HANDLE hfile, void **res_start, void **res_end );
/* ne_module.c */
extern NE_MODULE *NE_GetPtr( HMODULE16 hModule );
extern WORD NE_GetOrdinal( HMODULE16 hModule, const char *name );
extern FARPROC16 WINAPI NE_GetEntryPoint( HMODULE16 hModule, WORD ordinal );
extern FARPROC16 NE_GetEntryPointEx( HMODULE16 hModule, WORD ordinal, BOOL16 snoop );
extern BOOL16 NE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, WORD offset );
extern HANDLE NE_OpenFile( NE_MODULE *pModule );
extern DWORD NE_StartTask(void);
/* resource16.c */
extern HGLOBAL16 WINAPI NE_DefResourceHandler(HGLOBAL16,HMODULE16,HRSRC16);
/* ne_segment.c */
extern BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum );
extern BOOL NE_LoadAllSegments( NE_MODULE *pModule );
extern BOOL NE_CreateSegment( NE_MODULE *pModule, int segnum );
extern BOOL NE_CreateAllSegments( NE_MODULE *pModule );
extern HINSTANCE16 NE_GetInstance( NE_MODULE *pModule );
extern void NE_InitializeDLLs( HMODULE16 hModule );
extern void NE_DllProcessAttach( HMODULE16 hModule );
extern void NE_CallUserSignalProc( HMODULE16 hModule, UINT16 code );
/* task.c */
extern void TASK_CreateMainTask(void);
extern HTASK16 TASK_SpawnTask( NE_MODULE *pModule, WORD cmdShow,
LPCSTR cmdline, BYTE len, HANDLE *hThread );
extern void TASK_ExitTask(void);
extern HTASK16 TASK_GetTaskFromThread( DWORD thread );
extern TDB *TASK_GetCurrent(void);
extern void TASK_InstallTHHook( THHOOK *pNewThook );
/* loadorder.c */
extern void MODULE_GetLoadOrderW( enum loadorder_type plo[], const WCHAR *app_name,
const WCHAR *path );