- Several kernel.spec return type mismatch fixes
- [GS]etSelectorBase Win32s offset support by Ulrich Weigand (thanks v.m. !!) - Move AppToWine/WineToApp macros as W32S_APP2WINE etc. to ldt.h - LocalNotify() basic support - Fixes for local heap handling with heap handles created by Virtual*()
This commit is contained in:
parent
94632fcd68
commit
a00b49f068
|
@ -12,13 +12,13 @@ file krnl386.exe
|
||||||
5 pascal16 LocalAlloc(word word) LocalAlloc16
|
5 pascal16 LocalAlloc(word word) LocalAlloc16
|
||||||
6 pascal16 LocalReAlloc(word word word) LocalReAlloc16
|
6 pascal16 LocalReAlloc(word word word) LocalReAlloc16
|
||||||
7 pascal16 LocalFree(word) LocalFree16
|
7 pascal16 LocalFree(word) LocalFree16
|
||||||
8 pascal16 LocalLock(word) LocalLock16
|
8 pascal LocalLock(word) LocalLock16
|
||||||
9 pascal16 LocalUnlock(word) LocalUnlock16
|
9 pascal16 LocalUnlock(word) LocalUnlock16
|
||||||
10 pascal16 LocalSize(word) LocalSize16
|
10 pascal16 LocalSize(word) LocalSize16
|
||||||
11 pascal16 LocalHandle(word) LocalHandle16
|
11 pascal16 LocalHandle(word) LocalHandle16
|
||||||
12 pascal16 LocalFlags(word) LocalFlags16
|
12 pascal16 LocalFlags(word) LocalFlags16
|
||||||
13 pascal16 LocalCompact(word) LocalCompact16
|
13 pascal16 LocalCompact(word) LocalCompact16
|
||||||
14 pascal16 LocalNotify(long) LocalNotify
|
14 pascal LocalNotify(long) LocalNotify
|
||||||
15 pascal16 GlobalAlloc(word long) GlobalAlloc16
|
15 pascal16 GlobalAlloc(word long) GlobalAlloc16
|
||||||
16 pascal16 GlobalReAlloc(word long word) GlobalReAlloc16
|
16 pascal16 GlobalReAlloc(word long word) GlobalReAlloc16
|
||||||
17 pascal16 GlobalFree(word) GlobalFree16
|
17 pascal16 GlobalFree(word) GlobalFree16
|
||||||
|
@ -38,7 +38,7 @@ file krnl386.exe
|
||||||
31 pascal16 PostEvent(word) PostEvent
|
31 pascal16 PostEvent(word) PostEvent
|
||||||
32 pascal16 SetPriority(word s_word) SetPriority
|
32 pascal16 SetPriority(word s_word) SetPriority
|
||||||
33 pascal16 LockCurrentTask(word) LockCurrentTask
|
33 pascal16 LockCurrentTask(word) LockCurrentTask
|
||||||
34 pascal SetTaskQueue(word word) SetTaskQueue
|
34 pascal16 SetTaskQueue(word word) SetTaskQueue
|
||||||
35 pascal16 GetTaskQueue(word) GetTaskQueue
|
35 pascal16 GetTaskQueue(word) GetTaskQueue
|
||||||
36 pascal GetCurrentTask() WIN16_GetCurrentTask
|
36 pascal GetCurrentTask() WIN16_GetCurrentTask
|
||||||
37 pascal GetCurrentPDB() GetCurrentPDB
|
37 pascal GetCurrentPDB() GetCurrentPDB
|
||||||
|
@ -188,8 +188,8 @@ file krnl386.exe
|
||||||
183 equate __0000H 0
|
183 equate __0000H 0
|
||||||
184 pascal GlobalDOSAlloc(long) GlobalDOSAlloc
|
184 pascal GlobalDOSAlloc(long) GlobalDOSAlloc
|
||||||
185 pascal16 GlobalDOSFree(word) GlobalDOSFree
|
185 pascal16 GlobalDOSFree(word) GlobalDOSFree
|
||||||
186 pascal GetSelectorBase(word) GetSelectorBase
|
186 pascal GetSelectorBase(word) WIN16_GetSelectorBase
|
||||||
187 pascal16 SetSelectorBase(word long) SetSelectorBase
|
187 pascal16 SetSelectorBase(word long) WIN16_SetSelectorBase
|
||||||
188 pascal GetSelectorLimit(word) GetSelectorLimit
|
188 pascal GetSelectorLimit(word) GetSelectorLimit
|
||||||
189 pascal16 SetSelectorLimit(word long) SetSelectorLimit
|
189 pascal16 SetSelectorLimit(word long) SetSelectorLimit
|
||||||
190 equate __E000H 0
|
190 equate __E000H 0
|
||||||
|
|
|
@ -156,6 +156,7 @@ static const CALLBACKS_TABLE CALLBACK_EmulatorTable =
|
||||||
(void *)CallTo16_word_lwww, /* CallWordBreakProc */
|
(void *)CallTo16_word_lwww, /* CallWordBreakProc */
|
||||||
(void *)CallTo16_word_ww, /* CallBootAppProc */
|
(void *)CallTo16_word_ww, /* CallBootAppProc */
|
||||||
(void *)CallTo16_word_www, /* CallLoadAppSegProc */
|
(void *)CallTo16_word_www, /* CallLoadAppSegProc */
|
||||||
|
(void *)CallTo16_word_www, /* CallLocalNotifyFunc */
|
||||||
(void *)CallTo16_word_, /* CallSystemTimerProc */
|
(void *)CallTo16_word_, /* CallSystemTimerProc */
|
||||||
(void *)CallTo16_word_www, /* CallResourceHandlerProc */
|
(void *)CallTo16_word_www, /* CallResourceHandlerProc */
|
||||||
(void *)CallTo16_word_wwwl, /* CallPostAppMessageProc */
|
(void *)CallTo16_word_wwwl, /* CallPostAppMessageProc */
|
||||||
|
|
|
@ -36,6 +36,7 @@ typedef struct
|
||||||
INT16, INT16 );
|
INT16, INT16 );
|
||||||
VOID (CALLBACK *CallBootAppProc)( FARPROC16, HANDLE16, HFILE16 );
|
VOID (CALLBACK *CallBootAppProc)( FARPROC16, HANDLE16, HFILE16 );
|
||||||
WORD (CALLBACK *CallLoadAppSegProc)( FARPROC16, HANDLE16, HFILE16, WORD );
|
WORD (CALLBACK *CallLoadAppSegProc)( FARPROC16, HANDLE16, HFILE16, WORD );
|
||||||
|
WORD (CALLBACK *CallLocalNotifyFunc)( FARPROC16, WORD, HLOCAL16, WORD );
|
||||||
VOID (CALLBACK *CallSystemTimerProc)( FARPROC16 );
|
VOID (CALLBACK *CallSystemTimerProc)( FARPROC16 );
|
||||||
HGLOBAL16 (CALLBACK *CallResourceHandlerProc)( FARPROC16, HGLOBAL16, HMODULE16, HRSRC16 );
|
HGLOBAL16 (CALLBACK *CallResourceHandlerProc)( FARPROC16, HGLOBAL16, HMODULE16, HRSRC16 );
|
||||||
BOOL16 (CALLBACK *CallPostAppMessageProc)( FARPROC16, HTASK16, UINT16, WPARAM16, LPARAM );
|
BOOL16 (CALLBACK *CallPostAppMessageProc)( FARPROC16, HTASK16, UINT16, WPARAM16, LPARAM );
|
||||||
|
|
|
@ -67,6 +67,11 @@ extern ldt_copy_entry ldt_copy[LDT_SIZE];
|
||||||
#define PTR_SEG_OFF_TO_HUGEPTR(seg,off) \
|
#define PTR_SEG_OFF_TO_HUGEPTR(seg,off) \
|
||||||
PTR_SEG_OFF_TO_SEGPTR( (seg) + (HIWORD(off) << __AHSHIFT), LOWORD(off) )
|
PTR_SEG_OFF_TO_SEGPTR( (seg) + (HIWORD(off) << __AHSHIFT), LOWORD(off) )
|
||||||
|
|
||||||
|
#define W32S_APPLICATION() (PROCESS_Current()->flags & PDB32_WIN32S_PROC)
|
||||||
|
#define W32S_OFFSET 0x10000
|
||||||
|
#define W32S_APP2WINE(addr, offset) ((addr)? (DWORD)(addr) + (DWORD)(offset) : 0)
|
||||||
|
#define W32S_WINE2APP(addr, offset) ((addr)? (DWORD)(addr) - (DWORD)(offset) : 0)
|
||||||
|
|
||||||
extern unsigned char ldt_flags_copy[LDT_SIZE];
|
extern unsigned char ldt_flags_copy[LDT_SIZE];
|
||||||
|
|
||||||
#define LDT_FLAGS_TYPE 0x03 /* Mask for segment type */
|
#define LDT_FLAGS_TYPE 0x03 /* Mask for segment type */
|
||||||
|
|
|
@ -6616,7 +6616,7 @@ UINT16 WINAPI GetCommEventMask(INT16,UINT16);
|
||||||
HBRUSH16 WINAPI GetControlBrush(HWND16,HDC16,UINT16);
|
HBRUSH16 WINAPI GetControlBrush(HWND16,HDC16,UINT16);
|
||||||
VOID WINAPI GetCodeInfo(FARPROC16,SEGINFO*);
|
VOID WINAPI GetCodeInfo(FARPROC16,SEGINFO*);
|
||||||
HFONT16 WINAPI GetCurLogFont(HDC16);
|
HFONT16 WINAPI GetCurLogFont(HDC16);
|
||||||
HANDLE16 WINAPI GetCurrentPDB(void);
|
DWORD WINAPI GetCurrentPDB(void);
|
||||||
DWORD WINAPI GetCurrentPosition(HDC16);
|
DWORD WINAPI GetCurrentPosition(HDC16);
|
||||||
HTASK16 WINAPI GetCurrentTask(void);
|
HTASK16 WINAPI GetCurrentTask(void);
|
||||||
DWORD WINAPI GetDCHook(HDC16,FARPROC16*);
|
DWORD WINAPI GetDCHook(HDC16,FARPROC16*);
|
||||||
|
|
|
@ -1426,13 +1426,15 @@ DWORD WINAPI WIN16_GetCurrentTask(void)
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetCurrentPDB (KERNEL.37)
|
* GetCurrentPDB (KERNEL.37)
|
||||||
|
*
|
||||||
|
* UNDOC: returns PSP of KERNEL in high word
|
||||||
*/
|
*/
|
||||||
HANDLE16 WINAPI GetCurrentPDB(void)
|
DWORD WINAPI GetCurrentPDB(void)
|
||||||
{
|
{
|
||||||
TDB *pTask;
|
TDB *pTask;
|
||||||
|
|
||||||
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return 0;
|
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return 0;
|
||||||
return pTask->hPDB;
|
return MAKELONG(pTask->hPDB, 0); /* FIXME */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1596,6 +1598,9 @@ WORD WINAPI SetSigHandler( FARPROC16 newhandler, FARPROC16* oldhandler,
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GlobalNotify (KERNEL.154)
|
* GlobalNotify (KERNEL.154)
|
||||||
|
*
|
||||||
|
* Note that GlobalNotify does _not_ return the old NotifyProc
|
||||||
|
* -- contrary to LocalNotify !!
|
||||||
*/
|
*/
|
||||||
VOID WINAPI GlobalNotify( FARPROC16 proc )
|
VOID WINAPI GlobalNotify( FARPROC16 proc )
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "stackframe.h"
|
#include "stackframe.h"
|
||||||
#include "toolhelp.h"
|
#include "toolhelp.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "callback.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -44,6 +45,12 @@ typedef struct
|
||||||
#define LOCAL_ARENA_FREE 0
|
#define LOCAL_ARENA_FREE 0
|
||||||
#define LOCAL_ARENA_FIXED 1
|
#define LOCAL_ARENA_FIXED 1
|
||||||
|
|
||||||
|
/* LocalNotify() msgs */
|
||||||
|
|
||||||
|
#define LN_OUTOFMEM 0
|
||||||
|
#define LN_MOVE 1
|
||||||
|
#define LN_DISCARD 2
|
||||||
|
|
||||||
/* Layout of a handle entry table
|
/* Layout of a handle entry table
|
||||||
*
|
*
|
||||||
* WORD count of entries
|
* WORD count of entries
|
||||||
|
@ -426,24 +433,29 @@ BOOL16 WINAPI LocalInit( HANDLE16 selector, WORD start, WORD end )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* LOCAL_GrowHeap
|
* LOCAL_GrowHeap
|
||||||
*/
|
*/
|
||||||
static void LOCAL_GrowHeap( HANDLE16 ds )
|
static BOOL16 LOCAL_GrowHeap( HANDLE16 ds )
|
||||||
{
|
{
|
||||||
HANDLE16 hseg = GlobalHandle16( ds );
|
HANDLE16 hseg;
|
||||||
LONG oldsize = GlobalSize16( hseg );
|
LONG oldsize;
|
||||||
LONG end;
|
LONG end;
|
||||||
LOCALHEAPINFO *pHeapInfo;
|
LOCALHEAPINFO *pHeapInfo;
|
||||||
WORD freeArena, lastArena;
|
WORD freeArena, lastArena;
|
||||||
LOCALARENA *pArena, *pLastArena;
|
LOCALARENA *pArena, *pLastArena;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
|
hseg = GlobalHandle16( ds );
|
||||||
|
/* maybe mem allocated by Virtual*() ? */
|
||||||
|
if (!hseg) return FALSE;
|
||||||
|
|
||||||
|
oldsize = GlobalSize16( hseg );
|
||||||
/* if nothing can be gained, return */
|
/* if nothing can be gained, return */
|
||||||
if (oldsize > 0xfff0) return;
|
if (oldsize > 0xfff0) return FALSE;
|
||||||
hseg = GlobalReAlloc16( hseg, 0x10000, GMEM_FIXED );
|
hseg = GlobalReAlloc16( hseg, 0x10000, GMEM_FIXED );
|
||||||
ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
|
ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
|
||||||
pHeapInfo = LOCAL_GetHeap( ds );
|
pHeapInfo = LOCAL_GetHeap( ds );
|
||||||
if (pHeapInfo == NULL) {
|
if (pHeapInfo == NULL) {
|
||||||
ERR(local, "Heap not found\n" );
|
ERR(local, "Heap not found\n" );
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
end = GlobalSize16( hseg );
|
end = GlobalSize16( hseg );
|
||||||
lastArena = (end - sizeof(LOCALARENA)) & ~3;
|
lastArena = (end - sizeof(LOCALARENA)) & ~3;
|
||||||
|
@ -478,6 +490,7 @@ static void LOCAL_GrowHeap( HANDLE16 ds )
|
||||||
|
|
||||||
TRACE(local, "Heap expanded\n" );
|
TRACE(local, "Heap expanded\n" );
|
||||||
LOCAL_PrintHeap( ds );
|
LOCAL_PrintHeap( ds );
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -715,6 +728,9 @@ WORD LOCAL_Compact( HANDLE16 ds, UINT16 minfree, UINT16 flags )
|
||||||
movesize - ARENA_HEADER_SIZE );
|
movesize - ARENA_HEADER_SIZE );
|
||||||
/* Free the old location */
|
/* Free the old location */
|
||||||
LOCAL_FreeArena(ds, movearena);
|
LOCAL_FreeArena(ds, movearena);
|
||||||
|
if (pInfo->notify)
|
||||||
|
Callbacks->CallLocalNotifyFunc(pInfo->notify, LN_MOVE,
|
||||||
|
(WORD)((char *)pEntry - ptr), pEntry->addr);
|
||||||
/* Update handle table entry */
|
/* Update handle table entry */
|
||||||
pEntry->addr = finalarena + ARENA_HEADER_SIZE + sizeof(HLOCAL16) ;
|
pEntry->addr = finalarena + ARENA_HEADER_SIZE + sizeof(HLOCAL16) ;
|
||||||
}
|
}
|
||||||
|
@ -751,9 +767,11 @@ WORD LOCAL_Compact( HANDLE16 ds, UINT16 minfree, UINT16 flags )
|
||||||
TRACE(local, "Discarding handle %04x (block %04x).\n",
|
TRACE(local, "Discarding handle %04x (block %04x).\n",
|
||||||
(char *)pEntry - ptr, pEntry->addr);
|
(char *)pEntry - ptr, pEntry->addr);
|
||||||
LOCAL_FreeArena(ds, ARENA_HEADER(pEntry->addr));
|
LOCAL_FreeArena(ds, ARENA_HEADER(pEntry->addr));
|
||||||
|
if (pInfo->notify)
|
||||||
|
Callbacks->CallLocalNotifyFunc(pInfo->notify, LN_DISCARD,
|
||||||
|
(char *)pEntry - ptr, pEntry->flags);
|
||||||
pEntry->addr = 0;
|
pEntry->addr = 0;
|
||||||
pEntry->flags = (LMEM_DISCARDED >> 8);
|
pEntry->flags = (LMEM_DISCARDED >> 8);
|
||||||
/* Call localnotify proc */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
table = *(WORD *)pEntry;
|
table = *(WORD *)pEntry;
|
||||||
|
@ -814,6 +832,9 @@ static HLOCAL16 LOCAL_GetBlock( HANDLE16 ds, WORD size, WORD flags )
|
||||||
size += ARENA_HEADER_SIZE;
|
size += ARENA_HEADER_SIZE;
|
||||||
size = LALIGN( MAX( size, sizeof(LOCALARENA) ) );
|
size = LALIGN( MAX( size, sizeof(LOCALARENA) ) );
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
notify_done:
|
||||||
|
#endif
|
||||||
/* Find a suitable free block */
|
/* Find a suitable free block */
|
||||||
arena = LOCAL_FindFreeBlock( ds, size );
|
arena = LOCAL_FindFreeBlock( ds, size );
|
||||||
if (arena == 0) {
|
if (arena == 0) {
|
||||||
|
@ -823,7 +844,15 @@ static HLOCAL16 LOCAL_GetBlock( HANDLE16 ds, WORD size, WORD flags )
|
||||||
}
|
}
|
||||||
if (arena == 0) {
|
if (arena == 0) {
|
||||||
/* still no space: try to grow the segment */
|
/* still no space: try to grow the segment */
|
||||||
LOCAL_GrowHeap( ds );
|
if (!(LOCAL_GrowHeap( ds )))
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
/* FIXME: doesn't work correctly yet */
|
||||||
|
if ((pInfo->notify) && (Callbacks->CallLocalNotifyFunc(pInfo->notify, LN_OUTOFMEM, ds - 20, size))) /* FIXME: "size" correct ? (should indicate bytes needed) */
|
||||||
|
goto notify_done;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
|
ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
|
||||||
pInfo = LOCAL_GetHeap( ds );
|
pInfo = LOCAL_GetHeap( ds );
|
||||||
arena = LOCAL_FindFreeBlock( ds, size );
|
arena = LOCAL_FindFreeBlock( ds, size );
|
||||||
|
@ -839,6 +868,12 @@ static HLOCAL16 LOCAL_GetBlock( HANDLE16 ds, WORD size, WORD flags )
|
||||||
ERR(local, "not enough space in local heap "
|
ERR(local, "not enough space in local heap "
|
||||||
"%04x for %d bytes\n", ds, size );
|
"%04x for %d bytes\n", ds, size );
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
if ((pInfo->notify) &&
|
||||||
|
/* FIXME: "size" correct ? (should indicate bytes needed) */
|
||||||
|
(Callbacks->CallLocalNotifyFunc(pInfo->notify, LN_OUTOFMEM, ds, size)))
|
||||||
|
goto notify_done;
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1563,6 +1598,21 @@ UINT16 WINAPI LocalCompact16( UINT16 minfree )
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* LocalNotify (KERNEL.14)
|
* LocalNotify (KERNEL.14)
|
||||||
|
*
|
||||||
|
* Installs a callback function that is called for local memory events
|
||||||
|
* Callback function prototype is
|
||||||
|
* BOOL16 NotifyFunc(WORD wMsg, HLOCAL16 hMem, WORD wArg)
|
||||||
|
* wMsg:
|
||||||
|
* - LN_OUTOFMEM
|
||||||
|
* NotifyFunc seems to be responsible for allocating some memory,
|
||||||
|
* returns TRUE for success.
|
||||||
|
* wArg = number of bytes needed additionally
|
||||||
|
* - LN_MOVE
|
||||||
|
* hMem = handle; wArg = old mem location
|
||||||
|
* - LN_DISCARD
|
||||||
|
* NotifyFunc seems to be strongly encouraged to return TRUE,
|
||||||
|
* otherwise LogError() gets called.
|
||||||
|
* hMem = handle; wArg = flags
|
||||||
*/
|
*/
|
||||||
FARPROC16 WINAPI LocalNotify( FARPROC16 func )
|
FARPROC16 WINAPI LocalNotify( FARPROC16 func )
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "miscemu.h"
|
#include "miscemu.h"
|
||||||
#include "selectors.h"
|
#include "selectors.h"
|
||||||
#include "stackframe.h"
|
#include "stackframe.h"
|
||||||
|
#include "process.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -301,6 +302,17 @@ void WINAPI LongPtrAdd( DWORD ptr, DWORD add )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetSelectorBase (KERNEL.186)
|
* GetSelectorBase (KERNEL.186)
|
||||||
*/
|
*/
|
||||||
|
DWORD WINAPI WIN16_GetSelectorBase( WORD sel )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Note: For Win32s processes, the whole linear address space is
|
||||||
|
* shifted by 0x10000 relative to the OS linear address space.
|
||||||
|
* See the comment in msdos/vxd.c.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DWORD base = GetSelectorBase( sel );
|
||||||
|
return W32S_WINE2APP( base, W32S_APPLICATION() ? W32S_OFFSET : 0 );
|
||||||
|
}
|
||||||
DWORD WINAPI GetSelectorBase( WORD sel )
|
DWORD WINAPI GetSelectorBase( WORD sel )
|
||||||
{
|
{
|
||||||
DWORD base = GET_SEL_BASE(sel);
|
DWORD base = GET_SEL_BASE(sel);
|
||||||
|
@ -315,6 +327,18 @@ DWORD WINAPI GetSelectorBase( WORD sel )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetSelectorBase (KERNEL.187)
|
* SetSelectorBase (KERNEL.187)
|
||||||
*/
|
*/
|
||||||
|
DWORD WINAPI WIN16_SetSelectorBase( WORD sel, DWORD base )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Note: For Win32s processes, the whole linear address space is
|
||||||
|
* shifted by 0x10000 relative to the OS linear address space.
|
||||||
|
* See the comment in msdos/vxd.c.
|
||||||
|
*/
|
||||||
|
|
||||||
|
SetSelectorBase( sel,
|
||||||
|
W32S_APP2WINE( base, W32S_APPLICATION() ? W32S_OFFSET : 0 ) );
|
||||||
|
return sel;
|
||||||
|
}
|
||||||
WORD WINAPI SetSelectorBase( WORD sel, DWORD base )
|
WORD WINAPI SetSelectorBase( WORD sel, DWORD base )
|
||||||
{
|
{
|
||||||
ldt_entry entry;
|
ldt_entry entry;
|
||||||
|
|
|
@ -109,6 +109,17 @@ static WORD WINAPI CALLBACK_CallLoadAppSegProc( FARPROC16 proc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* CALLBACK_CallLocalNotifyFunc
|
||||||
|
*/
|
||||||
|
static WORD WINAPI CALLBACK_CallLocalNotifyFunc( FARPROC16 proc,
|
||||||
|
WORD wMsg, HLOCAL16 hMem,
|
||||||
|
WORD wArg )
|
||||||
|
{
|
||||||
|
return proc( wMsg, hMem, wArg );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* CALLBACK_CallSystemTimerProc
|
* CALLBACK_CallSystemTimerProc
|
||||||
*/
|
*/
|
||||||
|
@ -262,6 +273,7 @@ static const CALLBACKS_TABLE CALLBACK_WinelibTable =
|
||||||
CALLBACK_CallWordBreakProc, /* CallWordBreakProc */
|
CALLBACK_CallWordBreakProc, /* CallWordBreakProc */
|
||||||
CALLBACK_CallBootAppProc, /* CallBootAppProc */
|
CALLBACK_CallBootAppProc, /* CallBootAppProc */
|
||||||
CALLBACK_CallLoadAppSegProc, /* CallLoadAppSegProc */
|
CALLBACK_CallLoadAppSegProc, /* CallLoadAppSegProc */
|
||||||
|
CALLBACK_CallLocalNotifyFunc, /* CallLocalNotifyFunc */
|
||||||
CALLBACK_CallSystemTimerProc, /* CallSystemTimerProc */
|
CALLBACK_CallSystemTimerProc, /* CallSystemTimerProc */
|
||||||
CALLBACK_CallResourceHandlerProc, /* CallResourceHandlerProc */
|
CALLBACK_CallResourceHandlerProc, /* CallResourceHandlerProc */
|
||||||
NULL, /* CallPostAppMessageProc */
|
NULL, /* CallPostAppMessageProc */
|
||||||
|
|
40
msdos/dpmi.c
40
msdos/dpmi.c
|
@ -486,9 +486,7 @@ void WINAPI INT_Int31Handler( CONTEXT *context )
|
||||||
* shifted by 0x10000 relative to the OS linear address space.
|
* shifted by 0x10000 relative to the OS linear address space.
|
||||||
* See the comment in msdos/vxd.c.
|
* See the comment in msdos/vxd.c.
|
||||||
*/
|
*/
|
||||||
DWORD offset = PROCESS_Current()->flags & PDB32_WIN32S_PROC ? 0x10000 : 0;
|
DWORD offset = W32S_APPLICATION() ? W32S_OFFSET : 0;
|
||||||
#define AppToWine(addr) ((addr)? ((DWORD)(addr)) + offset : 0)
|
|
||||||
#define WineToApp(addr) ((addr)? ((DWORD)(addr)) - offset : 0)
|
|
||||||
|
|
||||||
DWORD dw;
|
DWORD dw;
|
||||||
BYTE *ptr;
|
BYTE *ptr;
|
||||||
|
@ -603,16 +601,16 @@ void WINAPI INT_Int31Handler( CONTEXT *context )
|
||||||
if ((dw >= base) && (dw < base + 0x110000)) dw -= base;
|
if ((dw >= base) && (dw < base + 0x110000)) dw -= base;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
CX_reg(context) = HIWORD(WineToApp(dw));
|
CX_reg(context) = HIWORD(W32S_WINE2APP(dw, offset));
|
||||||
DX_reg(context) = LOWORD(WineToApp(dw));
|
DX_reg(context) = LOWORD(W32S_WINE2APP(dw, offset));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0007: /* Set selector base address */
|
case 0x0007: /* Set selector base address */
|
||||||
TRACE(int31, "set selector base address (0x%04x,0x%08lx)\n",
|
TRACE(int31, "set selector base address (0x%04x,0x%08lx)\n",
|
||||||
BX_reg(context),
|
BX_reg(context),
|
||||||
AppToWine(MAKELONG(DX_reg(context),CX_reg(context))));
|
W32S_APP2WINE(MAKELONG(DX_reg(context),CX_reg(context)), offset));
|
||||||
dw = AppToWine(MAKELONG(DX_reg(context), CX_reg(context)));
|
dw = W32S_APP2WINE(MAKELONG(DX_reg(context), CX_reg(context)), offset);
|
||||||
#ifdef MZ_SUPPORTED
|
#ifdef MZ_SUPPORTED
|
||||||
/* well, what else could we possibly do? */
|
/* well, what else could we possibly do? */
|
||||||
if (pModule && pModule->lpDosTask) {
|
if (pModule && pModule->lpDosTask) {
|
||||||
|
@ -657,7 +655,7 @@ void WINAPI INT_Int31Handler( CONTEXT *context )
|
||||||
{
|
{
|
||||||
ldt_entry entry;
|
ldt_entry entry;
|
||||||
LDT_GetEntry( SELECTOR_TO_ENTRY( BX_reg(context) ), &entry );
|
LDT_GetEntry( SELECTOR_TO_ENTRY( BX_reg(context) ), &entry );
|
||||||
entry.base = WineToApp(entry.base);
|
entry.base = W32S_WINE2APP(entry.base, offset);
|
||||||
|
|
||||||
/* FIXME: should use ES:EDI for 32-bit clients */
|
/* FIXME: should use ES:EDI for 32-bit clients */
|
||||||
LDT_EntryToBytes( PTR_SEG_OFF_TO_LIN( ES_reg(context),
|
LDT_EntryToBytes( PTR_SEG_OFF_TO_LIN( ES_reg(context),
|
||||||
|
@ -671,7 +669,7 @@ void WINAPI INT_Int31Handler( CONTEXT *context )
|
||||||
ldt_entry entry;
|
ldt_entry entry;
|
||||||
LDT_BytesToEntry( PTR_SEG_OFF_TO_LIN( ES_reg(context),
|
LDT_BytesToEntry( PTR_SEG_OFF_TO_LIN( ES_reg(context),
|
||||||
DI_reg(context) ), &entry );
|
DI_reg(context) ), &entry );
|
||||||
entry.base = AppToWine(entry.base);
|
entry.base = W32S_APP2WINE(entry.base, offset);
|
||||||
|
|
||||||
LDT_SetEntry( SELECTOR_TO_ENTRY( BX_reg(context) ), &entry );
|
LDT_SetEntry( SELECTOR_TO_ENTRY( BX_reg(context) ), &entry );
|
||||||
}
|
}
|
||||||
|
@ -784,31 +782,31 @@ void WINAPI INT_Int31Handler( CONTEXT *context )
|
||||||
AX_reg(context) = 0x8012; /* linear memory not available */
|
AX_reg(context) = 0x8012; /* linear memory not available */
|
||||||
SET_CFLAG(context);
|
SET_CFLAG(context);
|
||||||
} else {
|
} else {
|
||||||
BX_reg(context) = SI_reg(context) = HIWORD(WineToApp(ptr));
|
BX_reg(context) = SI_reg(context) = HIWORD(W32S_WINE2APP(ptr, offset));
|
||||||
CX_reg(context) = DI_reg(context) = LOWORD(WineToApp(ptr));
|
CX_reg(context) = DI_reg(context) = LOWORD(W32S_WINE2APP(ptr, offset));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0502: /* Free memory block */
|
case 0x0502: /* Free memory block */
|
||||||
TRACE(int31, "free memory block (0x%08lx)\n",
|
TRACE(int31, "free memory block (0x%08lx)\n",
|
||||||
AppToWine(MAKELONG(DI_reg(context),SI_reg(context))));
|
W32S_APP2WINE(MAKELONG(DI_reg(context),SI_reg(context)), offset));
|
||||||
DPMI_xfree( (void *)AppToWine(MAKELONG(DI_reg(context),
|
DPMI_xfree( (void *)W32S_APP2WINE(MAKELONG(DI_reg(context),
|
||||||
SI_reg(context))) );
|
SI_reg(context)), offset) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0503: /* Resize memory block */
|
case 0x0503: /* Resize memory block */
|
||||||
TRACE(int31, "resize memory block (0x%08lx,%ld)\n",
|
TRACE(int31, "resize memory block (0x%08lx,%ld)\n",
|
||||||
AppToWine(MAKELONG(DI_reg(context),SI_reg(context))),
|
W32S_APP2WINE(MAKELONG(DI_reg(context),SI_reg(context)), offset),
|
||||||
MAKELONG(CX_reg(context),BX_reg(context)));
|
MAKELONG(CX_reg(context),BX_reg(context)));
|
||||||
if (!(ptr = (BYTE *)DPMI_xrealloc(
|
if (!(ptr = (BYTE *)DPMI_xrealloc(
|
||||||
(void *)AppToWine(MAKELONG(DI_reg(context),SI_reg(context))),
|
(void *)W32S_APP2WINE(MAKELONG(DI_reg(context),SI_reg(context)), offset),
|
||||||
MAKELONG(CX_reg(context),BX_reg(context)))))
|
MAKELONG(CX_reg(context),BX_reg(context)))))
|
||||||
{
|
{
|
||||||
AX_reg(context) = 0x8012; /* linear memory not available */
|
AX_reg(context) = 0x8012; /* linear memory not available */
|
||||||
SET_CFLAG(context);
|
SET_CFLAG(context);
|
||||||
} else {
|
} else {
|
||||||
BX_reg(context) = SI_reg(context) = HIWORD(WineToApp(ptr));
|
BX_reg(context) = SI_reg(context) = HIWORD(W32S_WINE2APP(ptr, offset));
|
||||||
CX_reg(context) = DI_reg(context) = LOWORD(WineToApp(ptr));
|
CX_reg(context) = DI_reg(context) = LOWORD(W32S_WINE2APP(ptr, offset));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -855,8 +853,8 @@ void WINAPI INT_Int31Handler( CONTEXT *context )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BX_reg(context) = HIWORD(WineToApp(ptr));
|
BX_reg(context) = HIWORD(W32S_WINE2APP(ptr, offset));
|
||||||
CX_reg(context) = LOWORD(WineToApp(ptr));
|
CX_reg(context) = LOWORD(W32S_WINE2APP(ptr, offset));
|
||||||
RESET_CFLAG(context);
|
RESET_CFLAG(context);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -868,6 +866,4 @@ void WINAPI INT_Int31Handler( CONTEXT *context )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef AppToWine
|
|
||||||
#undef WineToApp
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ void WINAPI INT_Int41Handler( CONTEXT *context )
|
||||||
/* Protected-mode debugger services */
|
/* Protected-mode debugger services */
|
||||||
switch ( AX_reg(context) )
|
switch ( AX_reg(context) )
|
||||||
{
|
{
|
||||||
|
case 0x4f:
|
||||||
case 0x50:
|
case 0x50:
|
||||||
case 0x150:
|
case 0x150:
|
||||||
case 0x51:
|
case 0x51:
|
||||||
|
|
117
msdos/vxd.c
117
msdos/vxd.c
|
@ -459,9 +459,6 @@ void VXD_APM ( CONTEXT *context )
|
||||||
|
|
||||||
void VXD_Win32s( CONTEXT *context )
|
void VXD_Win32s( CONTEXT *context )
|
||||||
{
|
{
|
||||||
#define AppToWine(addr) ((addr)? ((LPBYTE)(addr)) + 0x10000 : NULL)
|
|
||||||
#define WineToApp(addr) ((addr)? ((DWORD) (addr)) - 0x10000 : 0)
|
|
||||||
|
|
||||||
switch (AX_reg(context))
|
switch (AX_reg(context))
|
||||||
{
|
{
|
||||||
case 0x0000: /* Get Version */
|
case 0x0000: /* Get Version */
|
||||||
|
@ -570,7 +567,7 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mark process as Win32s, so that subsequent DPMI calls
|
* Mark process as Win32s, so that subsequent DPMI calls
|
||||||
* will perform the AppToWine/WineToApp address shift.
|
* will perform the W32S_APP2WINE/W32S_WINE2APP address shift.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PROCESS_Current()->flags |= PDB32_WIN32S_PROC;
|
PROCESS_Current()->flags |= PDB32_WIN32S_PROC;
|
||||||
|
@ -682,7 +679,7 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct Win32sModule *moduleTable =
|
struct Win32sModule *moduleTable =
|
||||||
(struct Win32sModule *)AppToWine(EDX_reg(context));
|
(struct Win32sModule *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
struct Win32sModule *module = moduleTable + ECX_reg(context);
|
struct Win32sModule *module = moduleTable + ECX_reg(context);
|
||||||
|
|
||||||
IMAGE_NT_HEADERS *nt_header = PE_HEADER(module->baseAddr);
|
IMAGE_NT_HEADERS *nt_header = PE_HEADER(module->baseAddr);
|
||||||
|
@ -774,7 +771,7 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: 1 if OK
|
* Output: EAX: 1 if OK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TRACE(vxd, "UnMapModule: %lx\n", (DWORD)AppToWine(EDX_reg(context)));
|
TRACE(vxd, "UnMapModule: %lx\n", (DWORD)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET));
|
||||||
|
|
||||||
/* As we didn't map anything, there's nothing to unmap ... */
|
/* As we didn't map anything, there's nothing to unmap ... */
|
||||||
|
|
||||||
|
@ -797,9 +794,9 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
DWORD *retv = (DWORD *)AppToWine(stack[0]);
|
DWORD *retv = (DWORD *)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
LPVOID base = (LPVOID) AppToWine(stack[1]);
|
LPVOID base = (LPVOID) W32S_APP2WINE(stack[1], W32S_OFFSET);
|
||||||
DWORD size = stack[2];
|
DWORD size = stack[2];
|
||||||
DWORD type = stack[3];
|
DWORD type = stack[3];
|
||||||
DWORD prot = stack[4];
|
DWORD prot = stack[4];
|
||||||
|
@ -822,8 +819,8 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
|
|
||||||
result = (DWORD)VirtualAlloc(base, size, type, prot);
|
result = (DWORD)VirtualAlloc(base, size, type, prot);
|
||||||
|
|
||||||
if (WineToApp(result))
|
if (W32S_WINE2APP(result, W32S_OFFSET))
|
||||||
*retv = WineToApp(result),
|
*retv = W32S_WINE2APP(result, W32S_OFFSET),
|
||||||
EAX_reg(context) = STATUS_SUCCESS;
|
EAX_reg(context) = STATUS_SUCCESS;
|
||||||
else
|
else
|
||||||
*retv = 0,
|
*retv = 0,
|
||||||
|
@ -846,9 +843,9 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
DWORD *retv = (DWORD *)AppToWine(stack[0]);
|
DWORD *retv = (DWORD *)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
LPVOID base = (LPVOID) AppToWine(stack[1]);
|
LPVOID base = (LPVOID) W32S_APP2WINE(stack[1], W32S_OFFSET);
|
||||||
DWORD size = stack[2];
|
DWORD size = stack[2];
|
||||||
DWORD type = stack[3];
|
DWORD type = stack[3];
|
||||||
DWORD result;
|
DWORD result;
|
||||||
|
@ -883,12 +880,12 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
DWORD *retv = (DWORD *)AppToWine(stack[0]);
|
DWORD *retv = (DWORD *)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
LPVOID base = (LPVOID) AppToWine(stack[1]);
|
LPVOID base = (LPVOID) W32S_APP2WINE(stack[1], W32S_OFFSET);
|
||||||
DWORD size = stack[2];
|
DWORD size = stack[2];
|
||||||
DWORD new_prot = stack[3];
|
DWORD new_prot = stack[3];
|
||||||
DWORD *old_prot = (DWORD *)AppToWine(stack[4]);
|
DWORD *old_prot = (DWORD *)W32S_APP2WINE(stack[4], W32S_OFFSET);
|
||||||
DWORD result;
|
DWORD result;
|
||||||
|
|
||||||
TRACE(vxd, "VirtualProtect(%lx, %lx, %lx, %lx, %lx)\n",
|
TRACE(vxd, "VirtualProtect(%lx, %lx, %lx, %lx, %lx)\n",
|
||||||
|
@ -920,11 +917,11 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
DWORD *retv = (DWORD *)AppToWine(stack[0]);
|
DWORD *retv = (DWORD *)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
LPVOID base = (LPVOID) AppToWine(stack[1]);
|
LPVOID base = (LPVOID) W32S_APP2WINE(stack[1], W32S_OFFSET);
|
||||||
LPMEMORY_BASIC_INFORMATION info =
|
LPMEMORY_BASIC_INFORMATION info =
|
||||||
(LPMEMORY_BASIC_INFORMATION)AppToWine(stack[2]);
|
(LPMEMORY_BASIC_INFORMATION)W32S_APP2WINE(stack[2], W32S_OFFSET);
|
||||||
DWORD len = stack[3];
|
DWORD len = stack[3];
|
||||||
DWORD result;
|
DWORD result;
|
||||||
|
|
||||||
|
@ -1003,11 +1000,11 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *) AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *) W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
HANDLE32 *retv = (HANDLE32 *)AppToWine(stack[0]);
|
HANDLE32 *retv = (HANDLE32 *)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
DWORD flags1 = stack[1];
|
DWORD flags1 = stack[1];
|
||||||
DWORD atom = stack[2];
|
DWORD atom = stack[2];
|
||||||
LARGE_INTEGER *size = (LARGE_INTEGER *)AppToWine(stack[3]);
|
LARGE_INTEGER *size = (LARGE_INTEGER *)W32S_APP2WINE(stack[3], W32S_OFFSET);
|
||||||
DWORD protect = stack[4];
|
DWORD protect = stack[4];
|
||||||
DWORD flags2 = stack[5];
|
DWORD flags2 = stack[5];
|
||||||
HFILE32 hFile = HFILE16_TO_HFILE32(stack[6]);
|
HFILE32 hFile = HFILE16_TO_HFILE32(stack[6]);
|
||||||
|
@ -1056,8 +1053,8 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *) AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
HANDLE32 *retv = (HANDLE32 *)AppToWine(stack[0]);
|
HANDLE32 *retv = (HANDLE32 *)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
DWORD protect = stack[1];
|
DWORD protect = stack[1];
|
||||||
DWORD atom = stack[2];
|
DWORD atom = stack[2];
|
||||||
|
|
||||||
|
@ -1099,9 +1096,9 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
HANDLE32 handle = stack[0];
|
HANDLE32 handle = stack[0];
|
||||||
DWORD *id = (DWORD *)AppToWine(stack[1]);
|
DWORD *id = (DWORD *)W32S_APP2WINE(stack[1], W32S_OFFSET);
|
||||||
|
|
||||||
TRACE(vxd, "NtCloseSection(%lx, %lx)\n", (DWORD)handle, (DWORD)id);
|
TRACE(vxd, "NtCloseSection(%lx, %lx)\n", (DWORD)handle, (DWORD)id);
|
||||||
|
|
||||||
|
@ -1122,7 +1119,7 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
HANDLE32 handle = stack[0];
|
HANDLE32 handle = stack[0];
|
||||||
|
|
||||||
TRACE(vxd, "NtDupSection(%lx)\n", (DWORD)handle);
|
TRACE(vxd, "NtDupSection(%lx)\n", (DWORD)handle);
|
||||||
|
@ -1153,19 +1150,20 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD * stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD * stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
HANDLE32 SectionHandle = stack[0];
|
HANDLE32 SectionHandle = stack[0];
|
||||||
DWORD ProcessHandle = stack[1]; /* ignored */
|
DWORD ProcessHandle = stack[1]; /* ignored */
|
||||||
DWORD * BaseAddress = (DWORD *)AppToWine(stack[2]);
|
DWORD * BaseAddress = (DWORD *)W32S_APP2WINE(stack[2], W32S_OFFSET);
|
||||||
DWORD ZeroBits = stack[3];
|
DWORD ZeroBits = stack[3];
|
||||||
DWORD CommitSize = stack[4];
|
DWORD CommitSize = stack[4];
|
||||||
LARGE_INTEGER *SectionOffset = (LARGE_INTEGER *)AppToWine(stack[5]);
|
LARGE_INTEGER *SectionOffset = (LARGE_INTEGER *)W32S_APP2WINE(stack[5], W32S_OFFSET);
|
||||||
DWORD * ViewSize = (DWORD *)AppToWine(stack[6]);
|
DWORD * ViewSize = (DWORD *)W32S_APP2WINE(stack[6], W32S_OFFSET);
|
||||||
DWORD InheritDisposition = stack[7];
|
DWORD InheritDisposition = stack[7];
|
||||||
DWORD AllocationType = stack[8];
|
DWORD AllocationType = stack[8];
|
||||||
DWORD Protect = stack[9];
|
DWORD Protect = stack[9];
|
||||||
|
|
||||||
LPBYTE address = (LPBYTE)(BaseAddress? AppToWine(*BaseAddress) : 0);
|
LPBYTE address = (LPBYTE)(BaseAddress?
|
||||||
|
W32S_APP2WINE(*BaseAddress, W32S_OFFSET) : 0);
|
||||||
DWORD access = 0, result;
|
DWORD access = 0, result;
|
||||||
|
|
||||||
switch (Protect & ~(PAGE_GUARD|PAGE_NOCACHE))
|
switch (Protect & ~(PAGE_GUARD|PAGE_NOCACHE))
|
||||||
|
@ -1196,9 +1194,9 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
|
|
||||||
TRACE(vxd, "NtMapViewOfSection: result=%lx\n", result);
|
TRACE(vxd, "NtMapViewOfSection: result=%lx\n", result);
|
||||||
|
|
||||||
if (WineToApp(result))
|
if (W32S_WINE2APP(result, W32S_OFFSET))
|
||||||
{
|
{
|
||||||
if (BaseAddress) *BaseAddress = WineToApp(result);
|
if (BaseAddress) *BaseAddress = W32S_WINE2APP(result, W32S_OFFSET);
|
||||||
EAX_reg(context) = STATUS_SUCCESS;
|
EAX_reg(context) = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1217,9 +1215,9 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
DWORD ProcessHandle = stack[0]; /* ignored */
|
DWORD ProcessHandle = stack[0]; /* ignored */
|
||||||
LPBYTE BaseAddress = (LPBYTE)AppToWine(stack[1]);
|
LPBYTE BaseAddress = (LPBYTE)W32S_APP2WINE(stack[1], W32S_OFFSET);
|
||||||
|
|
||||||
TRACE(vxd, "NtUnmapViewOfSection(%lx, %lx)\n",
|
TRACE(vxd, "NtUnmapViewOfSection(%lx, %lx)\n",
|
||||||
ProcessHandle, (DWORD)BaseAddress);
|
ProcessHandle, (DWORD)BaseAddress);
|
||||||
|
@ -1243,13 +1241,13 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
DWORD ProcessHandle = stack[0]; /* ignored */
|
DWORD ProcessHandle = stack[0]; /* ignored */
|
||||||
DWORD *BaseAddress = (DWORD *)AppToWine(stack[1]);
|
DWORD *BaseAddress = (DWORD *)W32S_APP2WINE(stack[1], W32S_OFFSET);
|
||||||
DWORD *ViewSize = (DWORD *)AppToWine(stack[2]);
|
DWORD *ViewSize = (DWORD *)W32S_APP2WINE(stack[2], W32S_OFFSET);
|
||||||
DWORD *unknown = (DWORD *)AppToWine(stack[3]);
|
DWORD *unknown = (DWORD *)W32S_APP2WINE(stack[3], W32S_OFFSET);
|
||||||
|
|
||||||
LPBYTE address = (LPBYTE)(BaseAddress? AppToWine(*BaseAddress) : 0);
|
LPBYTE address = (LPBYTE)(BaseAddress? W32S_APP2WINE(*BaseAddress, W32S_OFFSET) : 0);
|
||||||
DWORD size = ViewSize? *ViewSize : 0;
|
DWORD size = ViewSize? *ViewSize : 0;
|
||||||
|
|
||||||
TRACE(vxd, "NtFlushVirtualMemory(%lx, %lx, %lx, %lx)\n",
|
TRACE(vxd, "NtFlushVirtualMemory(%lx, %lx, %lx, %lx)\n",
|
||||||
|
@ -1350,9 +1348,9 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
DWORD *retv = (DWORD *)AppToWine(stack[0]);
|
DWORD *retv = (DWORD *)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
LPVOID base = (LPVOID) AppToWine(stack[1]);
|
LPVOID base = (LPVOID) W32S_APP2WINE(stack[1], W32S_OFFSET);
|
||||||
DWORD size = stack[2];
|
DWORD size = stack[2];
|
||||||
DWORD result;
|
DWORD result;
|
||||||
|
|
||||||
|
@ -1384,9 +1382,9 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: EAX: NtStatus
|
* Output: EAX: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *stack = (DWORD *)AppToWine(EDX_reg(context));
|
DWORD *stack = (DWORD *)W32S_APP2WINE(EDX_reg(context), W32S_OFFSET);
|
||||||
DWORD *retv = (DWORD *)AppToWine(stack[0]);
|
DWORD *retv = (DWORD *)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
LPVOID base = (LPVOID) AppToWine(stack[1]);
|
LPVOID base = (LPVOID) W32S_APP2WINE(stack[1], W32S_OFFSET);
|
||||||
DWORD size = stack[2];
|
DWORD size = stack[2];
|
||||||
DWORD result;
|
DWORD result;
|
||||||
|
|
||||||
|
@ -1424,8 +1422,8 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* FIXME: What about other OSes ?
|
* FIXME: What about other OSes ?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ECX_reg(context) = WineToApp(0x00000000);
|
ECX_reg(context) = W32S_WINE2APP(0x00000000, W32S_OFFSET);
|
||||||
EDX_reg(context) = WineToApp(0xbfffffff);
|
EDX_reg(context) = W32S_WINE2APP(0xbfffffff, W32S_OFFSET);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1448,7 +1446,7 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Win32sMemoryInfo *info =
|
struct Win32sMemoryInfo *info =
|
||||||
(struct Win32sMemoryInfo *)AppToWine(ESI_reg(context));
|
(struct Win32sMemoryInfo *)W32S_APP2WINE(ESI_reg(context), W32S_OFFSET);
|
||||||
|
|
||||||
FIXME(vxd, "KGlobalMemStat(%lx)\n", (DWORD)info);
|
FIXME(vxd, "KGlobalMemStat(%lx)\n", (DWORD)info);
|
||||||
|
|
||||||
|
@ -1485,7 +1483,7 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
{
|
{
|
||||||
DWORD *stack = PTR_SEG_OFF_TO_LIN(LOWORD(EDX_reg(context)),
|
DWORD *stack = PTR_SEG_OFF_TO_LIN(LOWORD(EDX_reg(context)),
|
||||||
HIWORD(EDX_reg(context)));
|
HIWORD(EDX_reg(context)));
|
||||||
LPVOID base = (LPVOID)AppToWine(stack[0]);
|
LPVOID base = (LPVOID)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
DWORD size = stack[1];
|
DWORD size = stack[1];
|
||||||
DWORD type = stack[2];
|
DWORD type = stack[2];
|
||||||
DWORD prot = stack[3];
|
DWORD prot = stack[3];
|
||||||
|
@ -1502,12 +1500,13 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
|
|
||||||
result = (DWORD)VirtualAlloc(base, size, type, prot);
|
result = (DWORD)VirtualAlloc(base, size, type, prot);
|
||||||
|
|
||||||
if (WineToApp(result))
|
if (W32S_WINE2APP(result, W32S_OFFSET))
|
||||||
EDX_reg(context) = WineToApp(result),
|
EDX_reg(context) = W32S_WINE2APP(result, W32S_OFFSET),
|
||||||
EAX_reg(context) = STATUS_SUCCESS;
|
EAX_reg(context) = STATUS_SUCCESS;
|
||||||
else
|
else
|
||||||
EDX_reg(context) = 0,
|
EDX_reg(context) = 0,
|
||||||
EAX_reg(context) = STATUS_NO_MEMORY; /* FIXME */
|
EAX_reg(context) = STATUS_NO_MEMORY; /* FIXME */
|
||||||
|
TRACE(vxd, "VirtualAlloc16: returning base %lx\n", EDX_reg(context));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1526,7 +1525,7 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
{
|
{
|
||||||
DWORD *stack = PTR_SEG_OFF_TO_LIN(LOWORD(EDX_reg(context)),
|
DWORD *stack = PTR_SEG_OFF_TO_LIN(LOWORD(EDX_reg(context)),
|
||||||
HIWORD(EDX_reg(context)));
|
HIWORD(EDX_reg(context)));
|
||||||
LPVOID base = (LPVOID)AppToWine(stack[0]);
|
LPVOID base = (LPVOID)W32S_APP2WINE(stack[0], W32S_OFFSET);
|
||||||
DWORD size = stack[1];
|
DWORD size = stack[1];
|
||||||
DWORD type = stack[2];
|
DWORD type = stack[2];
|
||||||
DWORD result;
|
DWORD result;
|
||||||
|
@ -1556,7 +1555,7 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
* Output: NtStatus
|
* Output: NtStatus
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DWORD *ptr = (DWORD *)AppToWine(ECX_reg(context));
|
DWORD *ptr = (DWORD *)W32S_APP2WINE(ECX_reg(context), W32S_OFFSET);
|
||||||
BOOL32 set = EDX_reg(context);
|
BOOL32 set = EDX_reg(context);
|
||||||
|
|
||||||
TRACE(vxd, "FWorkingSetSize(%lx, %lx)\n", (DWORD)ptr, (DWORD)set);
|
TRACE(vxd, "FWorkingSetSize(%lx, %lx)\n", (DWORD)ptr, (DWORD)set);
|
||||||
|
@ -1575,7 +1574,5 @@ void VXD_Win32s( CONTEXT *context )
|
||||||
VXD_BARF( context, "W32S" );
|
VXD_BARF( context, "W32S" );
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef AppToWine
|
|
||||||
#undef WineToApp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue