Moved standard syslevel APIs declaration to winbase.h.
Use exported syslevel function wherever possible. Moved SEGPTR declaration to windef16.h.
This commit is contained in:
parent
3606dc5584
commit
ab687979fd
|
@ -389,8 +389,8 @@ owner kernel32
|
|||
477 stub WOAFullScreen
|
||||
478 stub WOATerminateProcess
|
||||
479 pascal KERNEL_479(long) VWin32_EventSet # ???
|
||||
480 pascal16 _EnterWin16Lock() SYSLEVEL_EnterWin16Lock
|
||||
481 pascal16 _LeaveWin16Lock() SYSLEVEL_LeaveWin16Lock
|
||||
480 pascal16 _EnterWin16Lock() _EnterWin16Lock
|
||||
481 pascal16 _LeaveWin16Lock() _LeaveWin16Lock
|
||||
482 pascal LoadSystemLibrary32(str) LoadLibrary32_16 # FIXME!
|
||||
483 pascal MapProcessHandle(long) MapProcessHandle
|
||||
484 pascal SetProcessDWORD(long s_word long) SetProcessDword
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "winerror.h"
|
||||
#include "winnls.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "syslevel.h"
|
||||
#include "server.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
|
@ -222,9 +221,11 @@ VOID WINAPI VWin32_EventDestroy(HANDLE event)
|
|||
*/
|
||||
VOID WINAPI VWin32_EventWait(HANDLE event)
|
||||
{
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
DWORD mutex_count;
|
||||
|
||||
ReleaseThunkLock( &mutex_count );
|
||||
WaitForSingleObject( event, INFINITE );
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
RestoreThunkLock( mutex_count );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "module.h"
|
||||
#include "selectors.h"
|
||||
#include "stackframe.h"
|
||||
#include "syslevel.h"
|
||||
#include "task.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(thunk);
|
||||
|
@ -1134,7 +1133,9 @@ void WINAPI K32Thk1632Prolog( CONTEXT86 *context )
|
|||
context->Ebp, context->Esp, NtCurrentTeb()->cur_stack);
|
||||
}
|
||||
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
/* entry_point is never used again once the entry point has
|
||||
been called. Thus we re-use it to hold the Win16Lock count */
|
||||
ReleaseThunkLock(&CURRENT_STACK16->entry_point);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -1144,7 +1145,7 @@ void WINAPI K32Thk1632Epilog( CONTEXT86 *context )
|
|||
{
|
||||
LPBYTE code = (LPBYTE)context->Eip - 13;
|
||||
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
RestoreThunkLock(CURRENT_STACK16->entry_point);
|
||||
|
||||
/* We undo the SYSTHUNK hack if necessary. See K32Thk1632Prolog. */
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "file.h"
|
||||
#include "heap.h"
|
||||
#include "miscemu.h"
|
||||
#include "syslevel.h"
|
||||
#include "stackframe.h"
|
||||
#include "builtin16.h"
|
||||
#include "debugtools.h"
|
||||
|
@ -315,6 +314,7 @@ DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags
|
|||
{
|
||||
HMODULE hModule;
|
||||
DOS_FULL_NAME full_name;
|
||||
DWORD mutex_count;
|
||||
|
||||
/* if the file can not be found, call LoadLibraryExA anyway, since it might be
|
||||
a buildin module. This case is handled in MODULE_LoadLibraryExA */
|
||||
|
@ -323,10 +323,9 @@ DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags
|
|||
strcpy ( full_name.short_name, lpszLibFile );
|
||||
}
|
||||
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
ReleaseThunkLock( &mutex_count );
|
||||
hModule = LoadLibraryExA( full_name.short_name, (HANDLE)hFile, dwFlags );
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
|
||||
RestoreThunkLock( mutex_count );
|
||||
return (DWORD)hModule;
|
||||
}
|
||||
|
||||
|
@ -344,11 +343,11 @@ DWORD WINAPI GetProcAddress32W16( DWORD hModule, LPCSTR lpszProc )
|
|||
DWORD WINAPI FreeLibrary32W16( DWORD hLibModule )
|
||||
{
|
||||
BOOL retv;
|
||||
DWORD mutex_count;
|
||||
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
ReleaseThunkLock( &mutex_count );
|
||||
retv = FreeLibrary( (HMODULE)hLibModule );
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
|
||||
RestoreThunkLock( mutex_count );
|
||||
return (DWORD)retv;
|
||||
}
|
||||
|
||||
|
@ -361,11 +360,12 @@ static DWORD WOW_CallProc32W16( BOOL Ex )
|
|||
DWORD nrofargs, argconvmask;
|
||||
FARPROC proc32;
|
||||
DWORD *args, ret;
|
||||
DWORD mutex_count;
|
||||
VA_LIST16 valist;
|
||||
int i;
|
||||
int aix;
|
||||
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
ReleaseThunkLock( &mutex_count );
|
||||
|
||||
VA_START16( valist );
|
||||
nrofargs = VA_ARG16( valist, DWORD );
|
||||
|
@ -446,8 +446,7 @@ static DWORD WOW_CallProc32W16( BOOL Ex )
|
|||
TRACE("returns %08lx\n",ret);
|
||||
HeapFree( GetProcessHeap(), 0, args );
|
||||
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
|
||||
RestoreThunkLock( mutex_count );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -432,12 +432,6 @@ static void save_context( CONTEXT *context, const SIGCONTEXT *sigcontext )
|
|||
}
|
||||
#endif /* linux */
|
||||
|
||||
if (!fs)
|
||||
{
|
||||
fs = SYSLEVEL_EmergencyTeb;
|
||||
__set_fs(fs);
|
||||
ERR("fallback to emergency TEB\n");
|
||||
}
|
||||
__set_fs(fs);
|
||||
|
||||
context->Eax = EAX_sig(sigcontext);
|
||||
|
|
|
@ -135,9 +135,6 @@ BOOL WINAPI USER_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
/* Load the graphics driver */
|
||||
if (!load_driver()) return FALSE;
|
||||
|
||||
/* Initialize window handling (critical section) */
|
||||
WIN_Init();
|
||||
|
||||
/* Initialize system colors and metrics*/
|
||||
SYSMETRICS_Init();
|
||||
SYSCOLOR_Init();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "winbase.h"
|
||||
#include "wine/windef16.h"
|
||||
|
||||
/***********************************************************************
|
||||
* GetWin32sDirectory
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "windef.h"
|
||||
#include "wine/windef16.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(dll);
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "wine/winestring.h"
|
||||
#include "heap.h"
|
||||
#include "winemm.h"
|
||||
#include "syslevel.h"
|
||||
#include "selectors.h"
|
||||
#include "module.h"
|
||||
#include "debugtools.h"
|
||||
|
|
|
@ -13,10 +13,9 @@
|
|||
#include "winuser.h"
|
||||
#include "winemm.h"
|
||||
#include "services.h"
|
||||
#include "syslevel.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(mmtime)
|
||||
DEFAULT_DEBUG_CHANNEL(mmtime);
|
||||
|
||||
/*
|
||||
* FIXME
|
||||
|
@ -383,10 +382,8 @@ DWORD WINAPI timeGetTime(void)
|
|||
/* FIXME: releasing the win16 lock here is a temporary hack (I hope)
|
||||
* that lets mciavi.drv run correctly
|
||||
*/
|
||||
if ( _ConfirmWin16Lock() ) {
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
}
|
||||
|
||||
DWORD count;
|
||||
ReleaseThunkLock(&count);
|
||||
RestoreThunkLock(count);
|
||||
return MULTIMEDIA_MMTimeStart()->mmSysTimeMS;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "file.h"
|
||||
#include "heap.h"
|
||||
#include "msdos.h"
|
||||
#include "syslevel.h"
|
||||
#include "server.h"
|
||||
#include "options.h"
|
||||
#include "debugtools.h"
|
||||
|
@ -1501,7 +1500,7 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
|
|||
LPCSTR short_name, long_name;
|
||||
int count;
|
||||
|
||||
SYSLEVEL_EnterWin16Lock();
|
||||
_EnterWin16Lock();
|
||||
|
||||
/* Check the cached directory */
|
||||
if (!(info.dir && info.path == path && info.short_mask == short_mask
|
||||
|
@ -1538,7 +1537,7 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
|
|||
memset( &info, '\0', sizeof(info) );
|
||||
}
|
||||
|
||||
SYSLEVEL_LeaveWin16Lock();
|
||||
_LeaveWin16Lock();
|
||||
|
||||
return count;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "winbase.h"
|
||||
#include "wine/windef16.h" /* for SEGPTR */
|
||||
|
||||
extern HANDLE SystemHeap;
|
||||
extern HANDLE SegptrHeap;
|
||||
|
|
|
@ -10,32 +10,9 @@
|
|||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
typedef struct tagSYSLEVEL
|
||||
{
|
||||
CRITICAL_SECTION crst;
|
||||
INT level;
|
||||
} SYSLEVEL;
|
||||
|
||||
extern WORD SYSLEVEL_Win16CurrentTeb;
|
||||
extern WORD SYSLEVEL_EmergencyTeb;
|
||||
|
||||
void SYSLEVEL_Init(void);
|
||||
VOID WINAPI SYSLEVEL_EnterWin16Lock(void);
|
||||
VOID WINAPI SYSLEVEL_LeaveWin16Lock(void);
|
||||
VOID SYSLEVEL_ReleaseWin16Lock(void);
|
||||
VOID SYSLEVEL_RestoreWin16Lock(void);
|
||||
VOID SYSLEVEL_CheckNotLevel( INT level );
|
||||
|
||||
VOID WINAPI GetpWin16Lock(SYSLEVEL **lock);
|
||||
SEGPTR WINAPI GetpWin16Lock16(void);
|
||||
DWORD WINAPI _ConfirmWin16Lock(void);
|
||||
|
||||
VOID WINAPI _CreateSysLevel(SYSLEVEL *lock, INT level);
|
||||
VOID WINAPI _EnterSysLevel(SYSLEVEL *lock);
|
||||
VOID WINAPI _LeaveSysLevel(SYSLEVEL *lock);
|
||||
DWORD WINAPI _ConfirmSysLevel(SYSLEVEL *lock);
|
||||
|
||||
VOID WINAPI ReleaseThunkLock(DWORD *mutex_count);
|
||||
VOID WINAPI RestoreThunkLock(DWORD mutex_count);
|
||||
|
||||
#endif /* __WINE_SYSLEVEL_H */
|
||||
|
|
|
@ -174,7 +174,6 @@ typedef struct
|
|||
#define UNC_IN_BEGINPAINT 0x0020
|
||||
|
||||
/* Window functions */
|
||||
extern void WIN_Init( void );
|
||||
extern void WIN_LockWnds( void );
|
||||
extern void WIN_UnlockWnds( void );
|
||||
extern int WIN_SuspendWndsLock( void );
|
||||
|
|
|
@ -1476,8 +1476,6 @@ BOOL WINAPI LookupPrivilegeValueW(LPCWSTR,LPCWSTR,LPVOID);
|
|||
BOOL WINAPI MakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD);
|
||||
HMODULE WINAPI MapHModuleSL(WORD);
|
||||
WORD WINAPI MapHModuleLS(HMODULE);
|
||||
SEGPTR WINAPI MapLS(LPVOID);
|
||||
LPVOID WINAPI MapSL(SEGPTR);
|
||||
LPVOID WINAPI MapViewOfFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
|
||||
LPVOID WINAPI MapViewOfFileEx(HANDLE,DWORD,DWORD,DWORD,DWORD,LPVOID);
|
||||
BOOL WINAPI MoveFileA(LPCSTR,LPCSTR);
|
||||
|
@ -1599,7 +1597,6 @@ BOOL WINAPI TlsFree(DWORD);
|
|||
LPVOID WINAPI TlsGetValue(DWORD);
|
||||
BOOL WINAPI TlsSetValue(DWORD,LPVOID);
|
||||
BOOL WINAPI TransmitCommChar(HANDLE,CHAR);
|
||||
VOID WINAPI UnMapLS(SEGPTR);
|
||||
BOOL WINAPI UnlockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
|
||||
BOOL WINAPI UnmapViewOfFile(LPVOID);
|
||||
LPVOID WINAPI VirtualAlloc(LPVOID,DWORD,DWORD,DWORD);
|
||||
|
@ -1875,6 +1872,25 @@ INT WINAPI lstrcmpiW(LPCWSTR,LPCWSTR);
|
|||
#define ZeroMemory RtlZeroMemory
|
||||
#define CopyMemory RtlCopyMemory
|
||||
|
||||
/* undocumented functions */
|
||||
|
||||
typedef struct tagSYSLEVEL
|
||||
{
|
||||
CRITICAL_SECTION crst;
|
||||
INT level;
|
||||
} SYSLEVEL;
|
||||
|
||||
VOID WINAPI GetpWin16Lock(SYSLEVEL**);
|
||||
DWORD WINAPI MapLS(LPVOID);
|
||||
LPVOID WINAPI MapSL(DWORD);
|
||||
VOID WINAPI ReleaseThunkLock(DWORD*);
|
||||
VOID WINAPI RestoreThunkLock(DWORD);
|
||||
VOID WINAPI UnMapLS(DWORD);
|
||||
DWORD WINAPI _ConfirmWin16Lock(void);
|
||||
DWORD WINAPI _ConfirmSysLevel(SYSLEVEL*);
|
||||
VOID WINAPI _EnterSysLevel(SYSLEVEL*);
|
||||
VOID WINAPI _LeaveSysLevel(SYSLEVEL*);
|
||||
|
||||
/* a few optimizations for i386/gcc */
|
||||
|
||||
#if defined(__i386__) && defined(__GNUC__)
|
||||
|
|
|
@ -234,14 +234,6 @@ typedef FLOAT *LPFLOAT;
|
|||
typedef BOOL *PBOOL;
|
||||
typedef BOOL *LPBOOL;
|
||||
|
||||
/* Special case: a segmented pointer is just a pointer in the user's code. */
|
||||
|
||||
#ifdef __WINE__
|
||||
typedef DWORD SEGPTR;
|
||||
#else
|
||||
typedef void* SEGPTR;
|
||||
#endif /* __WINE__ */
|
||||
|
||||
/* Handle types that exist both in Win16 and Win32. */
|
||||
|
||||
#ifdef STRICT
|
||||
|
|
|
@ -78,6 +78,7 @@ INT16 WINAPI GetInstanceData16(HINSTANCE16,WORD,INT16);
|
|||
BOOL16 WINAPI GetModuleName16(HINSTANCE16,LPSTR,INT16);
|
||||
INT16 WINAPI GetModuleUsage16(HINSTANCE16);
|
||||
UINT16 WINAPI GetNumTasks16(void);
|
||||
SEGPTR WINAPI GetpWin16Lock16(void);
|
||||
DWORD WINAPI GetSelectorLimit16(WORD);
|
||||
FARPROC16 WINAPI GetSetKernelDOSProc16(FARPROC16 DosProc);
|
||||
HINSTANCE16 WINAPI GetTaskDS16(void);
|
||||
|
@ -117,6 +118,9 @@ VOID WINAPI SwitchStackTo16(WORD,WORD,WORD);
|
|||
BOOL16 WINAPI WaitEvent16(HTASK16);
|
||||
VOID WINAPI WriteOutProfiles16(void);
|
||||
VOID WINAPI hmemcpy16(LPVOID,LPCVOID,LONG);
|
||||
VOID WINAPI _CreateSysLevel(SYSLEVEL*,INT);
|
||||
VOID WINAPI _EnterWin16Lock(void);
|
||||
VOID WINAPI _LeaveWin16Lock(void);
|
||||
|
||||
|
||||
INT16 WINAPI AccessResource16(HINSTANCE16,HRSRC16);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
typedef short INT16;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short BOOL16;
|
||||
typedef DWORD SEGPTR;
|
||||
|
||||
typedef UINT16 HANDLE16;
|
||||
typedef HANDLE16 *LPHANDLE16;
|
||||
|
|
|
@ -153,7 +153,7 @@ typedef struct WSAData {
|
|||
char szSystemStatus[WSASYS_STATUS_LEN+1];
|
||||
WORD iMaxSockets;
|
||||
WORD iMaxUdpDg;
|
||||
SEGPTR lpVendorInfo;
|
||||
char *lpVendorInfo;
|
||||
} WSADATA, *LPWSADATA;
|
||||
|
||||
#include "poppack.h"
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "heap.h"
|
||||
#include "neexe.h"
|
||||
#include "process.h"
|
||||
#include "syslevel.h"
|
||||
#include "selectors.h"
|
||||
#include "debugtools.h"
|
||||
#include "callback.h"
|
||||
|
@ -798,9 +797,10 @@ HINSTANCE16 WINAPI WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
|
|||
|
||||
if (ret == 21) /* 32-bit module */
|
||||
{
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
DWORD count;
|
||||
ReleaseThunkLock( &count );
|
||||
ret = WinExec( lpCmdLine, nCmdShow );
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
RestoreThunkLock( count );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1452,11 +1452,11 @@ HMODULE WINAPI LoadLibraryW(LPCWSTR libnameW)
|
|||
HMODULE WINAPI LoadLibrary32_16( LPCSTR libname )
|
||||
{
|
||||
HMODULE hModule;
|
||||
DWORD count;
|
||||
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
ReleaseThunkLock( &count );
|
||||
hModule = LoadLibraryA( libname );
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
|
||||
RestoreThunkLock( count );
|
||||
return hModule;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "global.h"
|
||||
#include "process.h"
|
||||
#include "snoop.h"
|
||||
#include "syslevel.h"
|
||||
#include "builtin16.h"
|
||||
#include "stackframe.h"
|
||||
#include "debugtools.h"
|
||||
|
@ -1120,7 +1119,7 @@ static void NE_InitProcess(void)
|
|||
SEGTABLEENTRY *pSegTable = NE_SEG_TABLE( pModule );
|
||||
WORD sp;
|
||||
|
||||
SYSLEVEL_EnterWin16Lock();
|
||||
_EnterWin16Lock();
|
||||
|
||||
if ( pModule->count > 0 )
|
||||
{
|
||||
|
@ -1197,7 +1196,7 @@ static void NE_InitProcess(void)
|
|||
ExitThread( LOWORD(context.Eax) );
|
||||
}
|
||||
|
||||
SYSLEVEL_LeaveWin16Lock();
|
||||
_LeaveWin16Lock();
|
||||
ExitThread( hInstance );
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "thread.h"
|
||||
#include "toolhelp.h"
|
||||
#include "winnt.h"
|
||||
#include "winsock.h"
|
||||
#include "syslevel.h"
|
||||
#include "winsock.h"
|
||||
#include "debugtools.h"
|
||||
#include "services.h"
|
||||
#include "server.h"
|
||||
|
@ -336,9 +336,9 @@ BOOL TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, TEB *teb, LPCSTR cmdline,
|
|||
|
||||
/* Add the task to the linked list */
|
||||
|
||||
SYSLEVEL_EnterWin16Lock();
|
||||
_EnterWin16Lock();
|
||||
TASK_LinkTask( hTask );
|
||||
SYSLEVEL_LeaveWin16Lock();
|
||||
_LeaveWin16Lock();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -384,12 +384,12 @@ void TASK_ExitTask(void)
|
|||
DWORD lockCount;
|
||||
|
||||
/* Enter the Win16Lock to protect global data structures */
|
||||
SYSLEVEL_EnterWin16Lock();
|
||||
_EnterWin16Lock();
|
||||
|
||||
pTask = (TDB *)GlobalLock16( GetCurrentTask() );
|
||||
if ( !pTask )
|
||||
{
|
||||
SYSLEVEL_LeaveWin16Lock();
|
||||
_LeaveWin16Lock();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -486,7 +486,7 @@ void TASK_Reschedule(void)
|
|||
enum { MODE_YIELD, MODE_SLEEP, MODE_WAKEUP } mode;
|
||||
DWORD lockCount;
|
||||
|
||||
SYSLEVEL_EnterWin16Lock();
|
||||
_EnterWin16Lock();
|
||||
|
||||
/* Check what we need to do */
|
||||
hOldTask = GetCurrentTask();
|
||||
|
@ -521,7 +521,7 @@ void TASK_Reschedule(void)
|
|||
else
|
||||
{
|
||||
/* nothing to do */
|
||||
SYSLEVEL_LeaveWin16Lock();
|
||||
_LeaveWin16Lock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ void TASK_Reschedule(void)
|
|||
if ( mode == MODE_YIELD && hNewTask && hNewTask == hCurrentTask )
|
||||
{
|
||||
TRACE("returning to the current task (%04x)\n", hCurrentTask );
|
||||
SYSLEVEL_LeaveWin16Lock();
|
||||
_LeaveWin16Lock();
|
||||
|
||||
/* Allow Win32 threads to thunk down even while a Win16 task is
|
||||
in a tight PeekMessage() or Yield() loop ... */
|
||||
|
@ -600,7 +600,7 @@ void TASK_Reschedule(void)
|
|||
RestoreThunkLock( lockCount );
|
||||
}
|
||||
|
||||
SYSLEVEL_LeaveWin16Lock();
|
||||
_LeaveWin16Lock();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "debugtools.h"
|
||||
#include "gdi.h"
|
||||
#include "tweak.h"
|
||||
#include "syslevel.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(gdi);
|
||||
|
||||
|
@ -178,7 +177,7 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] =
|
|||
|
||||
HBITMAP hPseudoStockBitmap; /* 1x1 bitmap for memory DCs */
|
||||
|
||||
static SYSLEVEL GDI_level;
|
||||
static SYSLEVEL GDI_level = { CRITICAL_SECTION_INIT, 3 };
|
||||
static WORD GDI_HeapSel;
|
||||
|
||||
|
||||
|
@ -327,8 +326,6 @@ BOOL GDI_Init(void)
|
|||
HPALETTE16 hpalette;
|
||||
HINSTANCE16 instance;
|
||||
|
||||
_CreateSysLevel( &GDI_level, 3 );
|
||||
|
||||
/* create GDI heap */
|
||||
if ((instance = LoadLibrary16( "GDI.EXE" )) < 32) return FALSE;
|
||||
GDI_HeapSel = GlobalHandleToSel16( instance );
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "heap.h"
|
||||
#include "task.h"
|
||||
#include "ldt.h"
|
||||
#include "syslevel.h"
|
||||
#include "thread.h"
|
||||
#include "winerror.h"
|
||||
#include "server.h"
|
||||
|
@ -211,9 +210,6 @@ static BOOL process_init( char *argv[] )
|
|||
SERVER_END_REQ;
|
||||
if (!ret) return FALSE;
|
||||
|
||||
/* Remember TEB selector of initial process for emergency use */
|
||||
SYSLEVEL_EmergencyTeb = NtCurrentTeb()->teb_sel;
|
||||
|
||||
/* Create the system and process heaps */
|
||||
if (!HEAP_CreateSystemHeap()) return FALSE;
|
||||
current_process.heap = HeapCreate( HEAP_GROWABLE, 0, 0 );
|
||||
|
@ -227,9 +223,6 @@ static BOOL process_init( char *argv[] )
|
|||
/* Initialize the critical sections */
|
||||
InitializeCriticalSection( ¤t_process.crit_section );
|
||||
|
||||
/* Initialize syslevel handling */
|
||||
SYSLEVEL_Init();
|
||||
|
||||
/* Parse command line arguments */
|
||||
OPTIONS_ParseOptions( argv );
|
||||
|
||||
|
@ -456,7 +449,7 @@ void PROCESS_InitWine( int argc, char *argv[] )
|
|||
main_exe_name[0] = 0;
|
||||
CloseHandle( main_exe_file );
|
||||
main_exe_file = INVALID_HANDLE_VALUE;
|
||||
SYSLEVEL_EnterWin16Lock();
|
||||
_EnterWin16Lock();
|
||||
|
||||
found:
|
||||
/* allocate main thread stack */
|
||||
|
@ -846,7 +839,8 @@ void WINAPI ExitProcess( DWORD status )
|
|||
*/
|
||||
void WINAPI ExitProcess16( WORD status )
|
||||
{
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
DWORD count;
|
||||
ReleaseThunkLock( &count );
|
||||
ExitProcess( status );
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "file.h" /* for DOSFS_UnixTimeToFileTime */
|
||||
#include "thread.h"
|
||||
#include "winerror.h"
|
||||
#include "syslevel.h"
|
||||
#include "server.h"
|
||||
|
||||
|
||||
|
@ -154,12 +153,11 @@ DWORD WINAPI WaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
|
|||
*/
|
||||
DWORD WINAPI WIN16_WaitForSingleObject( HANDLE handle, DWORD timeout )
|
||||
{
|
||||
DWORD retval;
|
||||
DWORD retval, mutex_count;
|
||||
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
ReleaseThunkLock( &mutex_count );
|
||||
retval = WaitForSingleObject( handle, timeout );
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
|
||||
RestoreThunkLock( mutex_count );
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -169,12 +167,11 @@ DWORD WINAPI WIN16_WaitForSingleObject( HANDLE handle, DWORD timeout )
|
|||
DWORD WINAPI WIN16_WaitForMultipleObjects( DWORD count, const HANDLE *handles,
|
||||
BOOL wait_all, DWORD timeout )
|
||||
{
|
||||
DWORD retval;
|
||||
DWORD retval, mutex_count;
|
||||
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
ReleaseThunkLock( &mutex_count );
|
||||
retval = WaitForMultipleObjects( count, handles, wait_all, timeout );
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
|
||||
RestoreThunkLock( mutex_count );
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -186,13 +183,11 @@ DWORD WINAPI WIN16_WaitForMultipleObjectsEx( DWORD count,
|
|||
BOOL wait_all, DWORD timeout,
|
||||
BOOL alertable )
|
||||
{
|
||||
DWORD retval;
|
||||
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
retval = WaitForMultipleObjectsEx( count, handles,
|
||||
wait_all, timeout, alertable );
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
DWORD retval, mutex_count;
|
||||
|
||||
ReleaseThunkLock( &mutex_count );
|
||||
retval = WaitForMultipleObjectsEx( count, handles, wait_all, timeout, alertable );
|
||||
RestoreThunkLock( mutex_count );
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,28 +15,11 @@
|
|||
|
||||
DEFAULT_DEBUG_CHANNEL(win32);
|
||||
|
||||
static SYSLEVEL Win16Mutex;
|
||||
static SEGPTR segpWin16Mutex;
|
||||
static SYSLEVEL Win16Mutex = { CRITICAL_SECTION_INIT, 1 };
|
||||
|
||||
/* Global variable to save current TEB while in 16-bit code */
|
||||
WORD SYSLEVEL_Win16CurrentTeb = 0;
|
||||
|
||||
/* TEB of initial process for emergency use */
|
||||
WORD SYSLEVEL_EmergencyTeb = 0;
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* SYSLEVEL_Init
|
||||
*/
|
||||
void SYSLEVEL_Init(void)
|
||||
{
|
||||
SYSLEVEL **w16Mutex = SEGPTR_ALLOC(sizeof(SYSLEVEL *));
|
||||
|
||||
*w16Mutex = &Win16Mutex;
|
||||
segpWin16Mutex = SEGPTR_GET(w16Mutex);
|
||||
|
||||
_CreateSysLevel( &Win16Mutex, 1 );
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* GetpWin16Lock (KERNEL32.93)
|
||||
|
@ -51,6 +34,13 @@ VOID WINAPI GetpWin16Lock(SYSLEVEL **lock)
|
|||
*/
|
||||
SEGPTR WINAPI GetpWin16Lock16(void)
|
||||
{
|
||||
static SEGPTR segpWin16Mutex;
|
||||
if (!segpWin16Mutex)
|
||||
{
|
||||
SYSLEVEL **w16Mutex = SEGPTR_ALLOC(sizeof(SYSLEVEL *));
|
||||
*w16Mutex = &Win16Mutex;
|
||||
segpWin16Mutex = SEGPTR_GET(w16Mutex);
|
||||
}
|
||||
return segpWin16Mutex;
|
||||
}
|
||||
|
||||
|
@ -157,20 +147,21 @@ VOID WINAPI _CheckNotSysLevel(SYSLEVEL *lock)
|
|||
|
||||
|
||||
/************************************************************************
|
||||
* SYSLEVEL_EnterWin16Lock [KERNEL.480]
|
||||
* _EnterWin16Lock [KERNEL.480]
|
||||
*/
|
||||
VOID WINAPI SYSLEVEL_EnterWin16Lock(VOID)
|
||||
VOID WINAPI _EnterWin16Lock(void)
|
||||
{
|
||||
_EnterSysLevel(&Win16Mutex);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* SYSLEVEL_LeaveWin16Lock [KERNEL.481]
|
||||
* _LeaveWin16Lock [KERNEL.481]
|
||||
*/
|
||||
VOID WINAPI SYSLEVEL_LeaveWin16Lock(VOID)
|
||||
VOID WINAPI _LeaveWin16Lock(void)
|
||||
{
|
||||
_LeaveSysLevel(&Win16Mutex);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* _ConfirmWin16Lock (KERNEL32.96)
|
||||
*/
|
||||
|
@ -200,25 +191,6 @@ VOID WINAPI RestoreThunkLock(DWORD mutex_count)
|
|||
_EnterSysLevel(&Win16Mutex);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* SYSLEVEL_ReleaseWin16Lock
|
||||
*/
|
||||
VOID SYSLEVEL_ReleaseWin16Lock(VOID)
|
||||
{
|
||||
/* entry_point is never used again once the entry point has
|
||||
been called. Thus we re-use it to hold the Win16Lock count */
|
||||
|
||||
ReleaseThunkLock(&CURRENT_STACK16->entry_point);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* SYSLEVEL_RestoreWin16Lock
|
||||
*/
|
||||
VOID SYSLEVEL_RestoreWin16Lock(VOID)
|
||||
{
|
||||
RestoreThunkLock(CURRENT_STACK16->entry_point);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* SYSLEVEL_CheckNotLevel
|
||||
*/
|
||||
|
@ -235,4 +207,3 @@ VOID SYSLEVEL_CheckNotLevel( INT level )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -478,9 +478,9 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
|
|||
|
||||
/* Enter Win16 Mutex */
|
||||
if ( UsePIC )
|
||||
fprintf( outfile, "\tcall " PREFIX "SYSLEVEL_EnterWin16Lock@PLT\n" );
|
||||
fprintf( outfile, "\tcall " PREFIX "_EnterWin16Lock@PLT\n" );
|
||||
else
|
||||
fprintf( outfile, "\tcall " PREFIX "SYSLEVEL_EnterWin16Lock\n" );
|
||||
fprintf( outfile, "\tcall " PREFIX "_EnterWin16Lock\n" );
|
||||
|
||||
/* Print debugging info */
|
||||
if (debugging)
|
||||
|
@ -574,9 +574,9 @@ static void BuildCallTo16Core( FILE *outfile, int short_ret, int reg_func )
|
|||
|
||||
/* Leave Win16 Mutex */
|
||||
if ( UsePIC )
|
||||
fprintf( outfile, "\tcall " PREFIX "SYSLEVEL_LeaveWin16Lock@PLT\n" );
|
||||
fprintf( outfile, "\tcall " PREFIX "_LeaveWin16Lock@PLT\n" );
|
||||
else
|
||||
fprintf( outfile, "\tcall " PREFIX "SYSLEVEL_LeaveWin16Lock\n" );
|
||||
fprintf( outfile, "\tcall " PREFIX "_LeaveWin16Lock\n" );
|
||||
|
||||
/* Get return value */
|
||||
fprintf( outfile, "\tpopl %%eax\n" );
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "winerror.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/winuser16.h"
|
||||
#include "syslevel.h"
|
||||
#include "module.h"
|
||||
#include "queue.h"
|
||||
#include "task.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "winerror.h"
|
||||
#include "mdi.h"
|
||||
#include "local.h"
|
||||
#include "syslevel.h"
|
||||
#include "stackframe.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
|
@ -51,16 +50,7 @@ static WORD wDragWidth = 4;
|
|||
static WORD wDragHeight= 3;
|
||||
|
||||
/* thread safeness */
|
||||
static SYSLEVEL WIN_SysLevel;
|
||||
|
||||
/***********************************************************************
|
||||
* WIN_Init
|
||||
*/
|
||||
void WIN_Init( void )
|
||||
{
|
||||
/* Initialisation of the critical section for thread safeness */
|
||||
_CreateSysLevel( &WIN_SysLevel, 2 );
|
||||
}
|
||||
static SYSLEVEL WIN_SysLevel = { CRITICAL_SECTION_INIT, 2 };
|
||||
|
||||
/***********************************************************************
|
||||
* WIN_LockWnds
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "wine/winbase16.h"
|
||||
#include "heap.h"
|
||||
#include "ldt.h"
|
||||
#include "syslevel.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(win);
|
||||
|
||||
|
@ -36,8 +35,10 @@ BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand,
|
|||
DWORD dwData )
|
||||
{
|
||||
BOOL ret;
|
||||
DWORD mutex_count;
|
||||
|
||||
/* We might call WinExec() */
|
||||
SYSLEVEL_ReleaseWin16Lock();
|
||||
ReleaseThunkLock( &mutex_count );
|
||||
|
||||
if (!(ret = WinHelpA( hWnd, lpHelpFile, wCommand, (DWORD)PTR_SEG_TO_LIN(dwData) )))
|
||||
{
|
||||
|
@ -49,7 +50,7 @@ BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand,
|
|||
}
|
||||
}
|
||||
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
RestoreThunkLock( mutex_count );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue