wine/scheduler/process.c
Alexandre Julliard c7c217b31c Release 980413
Sun Apr 12 12:22:23 1997  Andreas Mohr <100.30936@germany.net>

	* [files/drive.c]
	Fixed "no free space" problem with partition sizes between 1 and 2 GB
	(cluster_sectors may not exceed 0x40).

	* [windows/msgbox.c] [if1632/user.spec] [include/windows.h]
	Implemented MessageBoxIndirect16, corrected MSGBOXPARAMS16.

	* [loader/task.c]
	DOS environment strings may never exceed 127 chars
	-> truncate Unix environment strings if necessary.

Sun Apr 12 02:51:44 1998  Dimitrie O. Paun  <dimi@mail.cs.toronto.edu>

	* [files/*.c]
	All fprintf statements were converted to appropriate debug
	messages.

	* [tools/find_debug_channels]
	Updated comments at the beginning of the file.

Sat Apr 11 15:27:21 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [loader/module.c] [loader/task.c] [scheduler/process.c]
	Moved some code around to prepare the ground for CreateProcess().

	* [memory/environ.c] [loader/task.c]
	Moved Win32 environment strings functions to environ.c.
	Unified Win16 and Win32 environment management.

	* [scheduler/handle.c] [scheduler/k32obj.c] [scheduler/*.c]
	Implemented handle inheritance and DuplicateHandle().

	* [scheduler/thread.c]
	Create a 16-bit stack for all threads.

	* [windows/dialog.c]
	Implemented DIALOGEX resource format.

Fri Apr 10 20:21:51 1998  Marcus Meissner <marcus@mud.de>

	* [configure.in][include/acconfig.h][*/*][multimedia/*]
	Cleaned up the OSS detection stuff, added some more checks for
	headerfiles/functions.
	Removed a lot of OS specific #ifdefs.
	Lots of dependend multimedia cleanups.

	* [loader/pe_image.c]
	Enhanced comment, added missing reference count increase.

	* [ole/compobj.c]
	Replaced broken StringFromGUID2 by working one.

	* [misc/winsock.c]
	SO_LINGER uses unsigned 16 bit in Win16 and Win32, but unsigned
	int (32bit) for UNIX.

	* [memory/global.c]
	Allow realloc for lockcount 1 too.

Fri Apr 10 15:27:34 1998  Morten Welinder  <terra@diku.dk>

	* [graphics/x11drv/text.c]
	Handle control characters in trace.  Ignore terminating newline.

	* [multimedia/init.c]
	(MULTIMEDIA_Init): Correct allocations.

	* [tools/examine-relay]
 	Tidy up.

	* [windows/syscolor.c]
	Change highlight colour from lightblue to lightgray.  This
	looks correct for menus.

Fri Apr 10 01:49:58 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [configure.in] [Make.rules.in]
	Add check for c2man before using it.

Fri Apr 10 02:59:21 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [DEVELOPERS-HINTS]
	Simple description of adding API calls.

	* [include/wintypes.h] [include/windows.h]
	Get rid of Winelib16, avoid declaring some illegal functions in
	Winelib, add prototypes for some enhanced metafile functions, fix
	GetTextExtentPoint32 declarations.

	* [relay32/gdi32.spec] [objects/enhmetafile.c]
	Cosmetic and functional improvements.

	* [include/wincon.h] [programs/view/*]
	Fixes, improved compatibility with native compilers.

Thu Apr  9 15:48:49 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [win32/kernel32.c]
	Implemented FT_Thunk / FT_Prolog / FT_Exit / FT_PrologPrime.
	Fixed Common32ThkLS thunk function.

	* [tools/build.c] [relay32/relay386.c] [if1632/relay.c]
	Changed relay code to allow register functions to modify stack layout.

	* [memory/selector.c]
	Implemented AllocMappedBuffer / FreeMappedBuffer.

	* [relay32/kernel32.spec] [if1632/kernel.spec] [win32/ordinals.c]
	Added names for undocumented functions.

	* [loader/module.c]
	Bugfix: LoadLibrary16 should *not* silently load 32-bit DLL.

Thu Apr  9 03:54:58 1998  Jim Peterson <jspeter@birch.ee.vt.edu>

	* [windows/keyboard.c]
	Fix an erroneous test in TranslateAccelerator{16,32} for the end
	of the accelerator table.

Thu Apr  8 20:36:28 1998  Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> 

	* [misc/crtdll.c]
	Implement getenv.

	* [misc/commdlg.c]
	Make Get[Save/Open]FileName work in most situations.

	* [misc/lstr.c]
	Use wvsprintf32A instead of vsprintf in FormatMessage32X

	* [misc/version]
	Make NT3.50 a recognised version

	* [graphics/x11drv/graphics.c]
	Change the algorithme to draw arcs

	* [loader/resource.c]
	Return an empty buffer in LoadString32A if no resource found.

	* [win32/code_page.c]
	Try harder to get the right size in MultiByteToWideChar.

	* [win32/process.c]
	Call WinExec32 for CreateProcess32A.

	* [windows/user.c]
	Install default Int0 Handler in InitApp().

Thu Apr  8 19:29:48 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [misc/imagelist.c]
	Preliminary fix for drawing selected images.
	Various improvements.

	* [controls/progress.c][include/progress.c][include/commctrl.h]
	Added progress bar messages and styles for IE4.01 (dll version 4.72)
	compatibility.
	Fixed led size problem.

	* [controls/updown.c][include/commctrl.h]
	Added UDM_GETRANGE32 and UDM_SETRANGE32.

	* [objects/oembitmaps.c][include/windows.h][include/bitmaps/*]
	Added Win95 icons and fixed Win95 cursor and restore button bug.
	Now they should be visible. Sorry!!!

	* [relay32/comctl32.spec]
	Added most missing function names.

Tue Apr  6 18:48:36 1998  Matthew Becker <mbecker@glasscity.net>

	* [objects/font.c] [if1632/gdi.spec]
	GetOutlineTextMetrics: stub

	* [objects/text.c]
	GetTextCharset should just call GetTextCharsetInfo.

	* [misc/mpr.c] [relay32/mpr.spec]
	WNetCachePassword: stub

	* [scheduler/thread.c] [relay32/user32.spec]
	AttachThreadInput: stub
	Updated documentation.

	* [objects/palette.c]
	Updated documentation.

Tue Mar 31 17:06:30 1998  James Juran <jrj120@psu.edu>

	* [*/*.c]
	Finished fixing USER32 ordinal numbers in function documentation.

Mon Mar 30 20:27:38 1998  Morten Welinder  <terra@diku.dk>

	* [misc/debugstr.c] [include/debugstr.h]
	Moved _dumpstr from relay32/relay386.c.  Improved control
	character handling.

	* [msdos/int21.c]
	Implement 215E00 -- get machine name.

	* [windows/winpos.c]
	SetWindowPos32: Make an extra sync when mapping managed
	windows.  This makes sure the reconfigure event has been
	handled.  See Mshearts' what's-your-name window.

Mon Mar 30 01:13:50 1998  Alexander V. Lukyanov <lav@long.yar.ru>

	* [Makefile.in]
	Install includes from TOPSRCDIR.
1998-04-13 12:21:30 +00:00

671 lines
18 KiB
C

/*
* Win32 processes
*
* Copyright 1996, 1998 Alexandre Julliard
*/
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "process.h"
#include "module.h"
#include "file.h"
#include "heap.h"
#include "task.h"
#include "ldt.h"
#include "thread.h"
#include "winerror.h"
#include "pe_image.h"
#include "task.h"
#include "debug.h"
/* Process self-handle */
#define PROCESS_SELF ((HANDLE32)0x7fffffff)
static BOOL32 PROCESS_Signaled( K32OBJ *obj, DWORD thread_id );
static BOOL32 PROCESS_Satisfied( K32OBJ *obj, DWORD thread_id );
static void PROCESS_AddWait( K32OBJ *obj, DWORD thread_id );
static void PROCESS_RemoveWait( K32OBJ *obj, DWORD thread_id );
static void PROCESS_Destroy( K32OBJ *obj );
const K32OBJ_OPS PROCESS_Ops =
{
PROCESS_Signaled, /* signaled */
PROCESS_Satisfied, /* satisfied */
PROCESS_AddWait, /* add_wait */
PROCESS_RemoveWait, /* remove_wait */
NULL, /* read */
NULL, /* write */
PROCESS_Destroy /* destroy */
};
/***********************************************************************
* PROCESS_Current
*/
PDB32 *PROCESS_Current(void)
{
return THREAD_Current()->process;
}
/***********************************************************************
* PROCESS_GetPtr
*
* Get a process from a handle, incrementing the PDB refcount.
*/
PDB32 *PROCESS_GetPtr( HANDLE32 handle, DWORD access )
{
PDB32 *pdb = PROCESS_Current();
if (handle == PROCESS_SELF)
{
K32OBJ_IncCount( &pdb->header );
return pdb;
}
return (PDB32 *)HANDLE_GetObjPtr( pdb, handle, K32OBJ_PROCESS, access );
}
/***********************************************************************
* PROCESS_IdToPDB
*
* Convert a process id to a PDB, making sure it is valid.
*/
PDB32 *PROCESS_IdToPDB( DWORD id )
{
PDB32 *pdb;
if (!id) return PROCESS_Current();
pdb = PROCESS_ID_TO_PDB( id );
if (!K32OBJ_IsValid( &pdb->header, K32OBJ_PROCESS ))
{
SetLastError( ERROR_INVALID_PARAMETER );
return NULL;
}
return pdb;
}
/***********************************************************************
* PROCESS_BuildEnvDB
*
* Build the env DB for the initial process
*/
static BOOL32 PROCESS_BuildEnvDB( PDB32 *pdb )
{
/* Allocate the env DB (FIXME: should not be on the system heap) */
if (!(pdb->env_db = HeapAlloc(SystemHeap,HEAP_ZERO_MEMORY,sizeof(ENVDB))))
return FALSE;
InitializeCriticalSection( &pdb->env_db->section );
/* Allocate the standard handles */
pdb->env_db->hStdin = FILE_DupUnixHandle( 0 );
pdb->env_db->hStdout = FILE_DupUnixHandle( 1 );
pdb->env_db->hStderr = FILE_DupUnixHandle( 2 );
FILE_SetFileType( pdb->env_db->hStdin, FILE_TYPE_CHAR );
FILE_SetFileType( pdb->env_db->hStdout, FILE_TYPE_CHAR );
FILE_SetFileType( pdb->env_db->hStderr, FILE_TYPE_CHAR );
/* Build the environment strings */
return ENV_BuildEnvironment( pdb );
}
/***********************************************************************
* PROCESS_InheritEnvDB
*/
static BOOL32 PROCESS_InheritEnvDB( PDB32 *pdb, LPCSTR cmd_line, LPCSTR env )
{
if (!(pdb->env_db = HeapAlloc(pdb->heap, HEAP_ZERO_MEMORY, sizeof(ENVDB))))
return FALSE;
InitializeCriticalSection( &pdb->env_db->section );
/* Copy the parent environment */
if (!ENV_InheritEnvironment( pdb, env )) return FALSE;
/* Copy the command line */
if (!(pdb->env_db->cmd_line = HEAP_strdupA( pdb->heap, 0, cmd_line )))
return FALSE;
/* Inherit the standard handles */
pdb->env_db->hStdin = pdb->parent->env_db->hStdin;
pdb->env_db->hStdout = pdb->parent->env_db->hStdout;
pdb->env_db->hStderr = pdb->parent->env_db->hStderr;
return TRUE;
}
/***********************************************************************
* PROCESS_FreePDB
*
* Free a PDB and all associated storage.
*/
static void PROCESS_FreePDB( PDB32 *pdb )
{
pdb->header.type = K32OBJ_UNKNOWN;
if (pdb->handle_table) HANDLE_CloseAll( pdb, NULL );
ENV_FreeEnvironment( pdb );
if (pdb->heap && (pdb->heap != pdb->system_heap)) HeapDestroy( pdb->heap );
if (pdb->load_done_evt) K32OBJ_DecCount( pdb->load_done_evt );
if (pdb->event) K32OBJ_DecCount( pdb->event );
DeleteCriticalSection( &pdb->crit_section );
HeapFree( SystemHeap, 0, pdb );
}
/***********************************************************************
* PROCESS_CreatePDB
*
* Allocate and fill a PDB structure.
* Runs in the context of the parent process.
*/
static PDB32 *PROCESS_CreatePDB( PDB32 *parent )
{
PDB32 *pdb = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, sizeof(PDB32) );
if (!pdb) return NULL;
pdb->header.type = K32OBJ_PROCESS;
pdb->header.refcount = 1;
pdb->exit_code = 0x103; /* STILL_ACTIVE */
pdb->threads = 1;
pdb->running_threads = 1;
pdb->ring0_threads = 1;
pdb->system_heap = SystemHeap;
pdb->parent = parent;
pdb->group = pdb;
pdb->priority = 8; /* Normal */
pdb->heap = pdb->system_heap; /* will be changed later on */
InitializeCriticalSection( &pdb->crit_section );
/* Allocate the events */
if (!(pdb->event = EVENT_Create( TRUE, FALSE ))) goto error;
if (!(pdb->load_done_evt = EVENT_Create( TRUE, FALSE ))) goto error;
/* Create the handle table */
if (!HANDLE_CreateTable( pdb, TRUE )) goto error;
return pdb;
error:
PROCESS_FreePDB( pdb );
return NULL;
}
/***********************************************************************
* PROCESS_Init
*/
BOOL32 PROCESS_Init(void)
{
extern BOOL32 VIRTUAL_Init(void);
extern BOOL32 THREAD_InitDone;
PDB32 *pdb;
THDB *thdb;
/* Initialize virtual memory management */
if (!VIRTUAL_Init()) return FALSE;
/* Create the system and SEGPTR heaps */
if (!(SystemHeap = HeapCreate( HEAP_GROWABLE, 0x10000, 0 ))) return FALSE;
if (!(SegptrHeap = HeapCreate( HEAP_WINE_SEGPTR, 0, 0 ))) return FALSE;
/* Create the initial process and thread structures */
if (!(pdb = PROCESS_CreatePDB( NULL ))) return FALSE;
if (!(thdb = THREAD_Create( pdb, 0, FALSE, NULL, NULL ))) return FALSE;
SET_CUR_THREAD( thdb );
THREAD_InitDone = TRUE;
/* Create the environment DB of the first process */
if (!PROCESS_BuildEnvDB( pdb )) return FALSE;
return TRUE;
}
/***********************************************************************
* PROCESS_Create
*
* Create a new process database and associated info.
*/
PDB32 *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
HINSTANCE16 hInstance, HINSTANCE16 hPrevInstance,
UINT32 cmdShow )
{
DWORD size, commit;
THDB *thdb = NULL;
PDB32 *parent = PROCESS_Current();
PDB32 *pdb = PROCESS_CreatePDB( parent );
if (!pdb) return NULL;
/* Create the heap */
if (pModule->module32)
{
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapReserve;
commit = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapCommit;
}
else
{
size = 0x10000;
commit = 0;
}
if (!(pdb->heap = HeapCreate( HEAP_GROWABLE, size, commit ))) goto error;
pdb->heap_list = pdb->heap;
/* Inherit the env DB from the parent */
if (!PROCESS_InheritEnvDB( pdb, cmd_line, env )) goto error;
/* Create the main thread */
if (pModule->module32)
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfStackReserve;
else
size = 0;
if (!(thdb = THREAD_Create( pdb, size, FALSE, NULL, NULL ))) goto error;
/* Create a Win16 task for this process */
pdb->task = TASK_Create( thdb, pModule, hInstance, hPrevInstance, cmdShow);
if (!pdb->task) goto error;
return pdb;
error:
if (thdb) K32OBJ_DecCount( &thdb->header );
PROCESS_FreePDB( pdb );
return NULL;
}
/***********************************************************************
* PROCESS_Signaled
*/
static BOOL32 PROCESS_Signaled( K32OBJ *obj, DWORD thread_id )
{
PDB32 *pdb = (PDB32 *)obj;
assert( obj->type == K32OBJ_PROCESS );
return K32OBJ_OPS( pdb->event )->signaled( pdb->event, thread_id );
}
/***********************************************************************
* PROCESS_Satisfied
*
* Wait on this object has been satisfied.
*/
static BOOL32 PROCESS_Satisfied( K32OBJ *obj, DWORD thread_id )
{
PDB32 *pdb = (PDB32 *)obj;
assert( obj->type == K32OBJ_PROCESS );
return K32OBJ_OPS( pdb->event )->satisfied( pdb->event, thread_id );
}
/***********************************************************************
* PROCESS_AddWait
*
* Add thread to object wait queue.
*/
static void PROCESS_AddWait( K32OBJ *obj, DWORD thread_id )
{
PDB32 *pdb = (PDB32 *)obj;
assert( obj->type == K32OBJ_PROCESS );
return K32OBJ_OPS( pdb->event )->add_wait( pdb->event, thread_id );
}
/***********************************************************************
* PROCESS_RemoveWait
*
* Remove thread from object wait queue.
*/
static void PROCESS_RemoveWait( K32OBJ *obj, DWORD thread_id )
{
PDB32 *pdb = (PDB32 *)obj;
assert( obj->type == K32OBJ_PROCESS );
return K32OBJ_OPS( pdb->event )->remove_wait( pdb->event, thread_id );
}
/***********************************************************************
* PROCESS_Destroy
*/
static void PROCESS_Destroy( K32OBJ *ptr )
{
PDB32 *pdb = (PDB32 *)ptr;
assert( ptr->type == K32OBJ_PROCESS );
/* Free everything */
ptr->type = K32OBJ_UNKNOWN;
PROCESS_FreePDB( pdb );
}
/***********************************************************************
* ExitProcess (KERNEL32.100)
*/
void WINAPI ExitProcess( DWORD status )
{
PDB32 *pdb = PROCESS_Current();
SYSTEM_LOCK();
/* FIXME: should kill all running threads of this process */
pdb->exit_code = status;
EVENT_Set( pdb->event );
if (pdb->console) FreeConsole();
SYSTEM_UNLOCK();
__RESTORE_ES; /* Necessary for Pietrek's showseh example program */
TASK_KillCurrentTask( status );
}
/***********************************************************************
* GetCurrentProcess (KERNEL32.198)
*/
HANDLE32 WINAPI GetCurrentProcess(void)
{
return 0x7fffffff;
}
/*********************************************************************
* OpenProcess (KERNEL32.543)
*/
HANDLE32 WINAPI OpenProcess( DWORD access, BOOL32 inherit, DWORD id )
{
PDB32 *pdb = PROCESS_ID_TO_PDB(id);
if (!K32OBJ_IsValid( &pdb->header, K32OBJ_PROCESS ))
{
SetLastError( ERROR_INVALID_HANDLE );
return 0;
}
return HANDLE_Alloc( PROCESS_Current(), &pdb->header, access, inherit );
}
/***********************************************************************
* GetCurrentProcessId (KERNEL32.199)
*/
DWORD WINAPI GetCurrentProcessId(void)
{
PDB32 *pdb = PROCESS_Current();
return PDB_TO_PROCESS_ID( pdb );
}
/***********************************************************************
* GetProcessHeap (KERNEL32.259)
*/
HANDLE32 WINAPI GetProcessHeap(void)
{
PDB32 *pdb = PROCESS_Current();
return pdb->heap ? pdb->heap : SystemHeap;
}
/***********************************************************************
* GetThreadLocale (KERNEL32.295)
*/
LCID WINAPI GetThreadLocale(void)
{
return PROCESS_Current()->locale;
}
/***********************************************************************
* SetPriorityClass (KERNEL32.503)
*/
BOOL32 WINAPI SetPriorityClass( HANDLE32 hprocess, DWORD priorityclass )
{
PDB32 *pdb = PROCESS_GetPtr( hprocess, PROCESS_SET_INFORMATION );
if (!pdb) return FALSE;
switch (priorityclass)
{
case NORMAL_PRIORITY_CLASS:
pdb->priority = 0x00000008;
break;
case IDLE_PRIORITY_CLASS:
pdb->priority = 0x00000004;
break;
case HIGH_PRIORITY_CLASS:
pdb->priority = 0x0000000d;
break;
case REALTIME_PRIORITY_CLASS:
pdb->priority = 0x00000018;
break;
default:
fprintf(stderr,"SetPriorityClass: unknown priority class %ld\n",priorityclass);
break;
}
K32OBJ_DecCount( &pdb->header );
return TRUE;
}
/***********************************************************************
* GetPriorityClass (KERNEL32.250)
*/
DWORD WINAPI GetPriorityClass(HANDLE32 hprocess)
{
PDB32 *pdb = PROCESS_GetPtr( hprocess, PROCESS_QUERY_INFORMATION );
DWORD ret = 0;
if (pdb)
{
switch (pdb->priority)
{
case 0x00000008:
ret = NORMAL_PRIORITY_CLASS;
break;
case 0x00000004:
ret = IDLE_PRIORITY_CLASS;
break;
case 0x0000000d:
ret = HIGH_PRIORITY_CLASS;
break;
case 0x00000018:
ret = REALTIME_PRIORITY_CLASS;
break;
default:
fprintf(stderr,"GetPriorityClass: unknown priority %ld\n",pdb->priority);
}
K32OBJ_DecCount( &pdb->header );
}
return ret;
}
/***********************************************************************
* GetStdHandle (KERNEL32.276)
*
* FIXME: These should be allocated when a console is created, or inherited
* from the parent.
*/
HANDLE32 WINAPI GetStdHandle( DWORD std_handle )
{
HFILE32 hFile;
int fd;
PDB32 *pdb = PROCESS_Current();
switch(std_handle)
{
case STD_INPUT_HANDLE:
if (pdb->env_db->hStdin) return pdb->env_db->hStdin;
fd = 0;
break;
case STD_OUTPUT_HANDLE:
if (pdb->env_db->hStdout) return pdb->env_db->hStdout;
fd = 1;
break;
case STD_ERROR_HANDLE:
if (pdb->env_db->hStderr) return pdb->env_db->hStderr;
fd = 2;
break;
default:
SetLastError( ERROR_INVALID_PARAMETER );
return INVALID_HANDLE_VALUE32;
}
hFile = FILE_DupUnixHandle( fd );
if (hFile != HFILE_ERROR32)
{
FILE_SetFileType( hFile, FILE_TYPE_CHAR );
switch(std_handle)
{
case STD_INPUT_HANDLE: pdb->env_db->hStdin = hFile; break;
case STD_OUTPUT_HANDLE: pdb->env_db->hStdout = hFile; break;
case STD_ERROR_HANDLE: pdb->env_db->hStderr = hFile; break;
}
}
return hFile;
}
/***********************************************************************
* SetStdHandle (KERNEL32.506)
*/
BOOL32 WINAPI SetStdHandle( DWORD std_handle, HANDLE32 handle )
{
PDB32 *pdb = PROCESS_Current();
/* FIXME: should we close the previous handle? */
switch(std_handle)
{
case STD_INPUT_HANDLE:
pdb->env_db->hStdin = handle;
return TRUE;
case STD_OUTPUT_HANDLE:
pdb->env_db->hStdout = handle;
return TRUE;
case STD_ERROR_HANDLE:
pdb->env_db->hStderr = handle;
return TRUE;
}
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
/***********************************************************************
* GetProcessVersion (KERNEL32)
*/
DWORD WINAPI GetProcessVersion( DWORD processid )
{
TDB *pTask;
PDB32 *pdb = PROCESS_IdToPDB( processid );
if (!pdb) return 0;
if (!(pTask = (TDB *)GlobalLock16( pdb->task ))) return 0;
return (pTask->version&0xff) | (((pTask->version >>8) & 0xff)<<16);
}
/***********************************************************************
* GetProcessFlags (KERNEL32)
*/
DWORD WINAPI GetProcessFlags( DWORD processid )
{
PDB32 *pdb = PROCESS_IdToPDB( processid );
if (!pdb) return 0;
return pdb->flags;
}
/***********************************************************************
* SetProcessWorkingSetSize (KERNEL32)
*/
BOOL32 WINAPI SetProcessWorkingSetSize(HANDLE32 hProcess,DWORD minset,
DWORD maxset)
{
fprintf(stderr,"SetProcessWorkingSetSize(0x%08x,%ld,%ld), STUB!\n",
hProcess,minset,maxset
);
return TRUE;
}
/***********************************************************************
* GetProcessWorkingSetSize (KERNEL32)
*/
BOOL32 WINAPI GetProcessWorkingSetSize(HANDLE32 hProcess,LPDWORD minset,
LPDWORD maxset)
{
fprintf(stderr,"SetProcessWorkingSetSize(0x%08x,%p,%p), STUB!\n",
hProcess,minset,maxset
);
/* 32 MB working set size */
if (minset) *minset = 32*1024*1024;
if (maxset) *maxset = 32*1024*1024;
return TRUE;
}
/***********************************************************************
* SetProcessShutdownParameters (KERNEL32)
*/
BOOL32 WINAPI SetProcessShutdownParameters(DWORD level,DWORD flags)
{
fprintf(stderr,"SetProcessShutdownParameters(%ld,0x%08lx), STUB!\n",
level,flags
);
return TRUE;
}
/***********************************************************************
* ReadProcessMemory (KERNEL32)
* FIXME: check this, if we ever run win32 binaries in different addressspaces
* ... and add a sizecheck
*/
BOOL32 WINAPI ReadProcessMemory( HANDLE32 hProcess, LPCVOID lpBaseAddress,
LPVOID lpBuffer, DWORD nSize,
LPDWORD lpNumberOfBytesRead )
{
memcpy(lpBuffer,lpBaseAddress,nSize);
if (lpNumberOfBytesRead) *lpNumberOfBytesRead = nSize;
return TRUE;
}
/***********************************************************************
* WriteProcessMemory (KERNEL32)
* FIXME: check this, if we ever run win32 binaries in different addressspaces
* ... and add a sizecheck
*/
BOOL32 WINAPI WriteProcessMemory(HANDLE32 hProcess, LPVOID lpBaseAddress,
LPVOID lpBuffer, DWORD nSize,
LPDWORD lpNumberOfBytesWritten )
{
memcpy(lpBaseAddress,lpBuffer,nSize);
if (lpNumberOfBytesWritten) *lpNumberOfBytesWritten = nSize;
return TRUE;
}
/***********************************************************************
* ConvertToGlobalHandle (KERNEL32)
* FIXME: this is not correctly implemented...
*/
HANDLE32 WINAPI ConvertToGlobalHandle(HANDLE32 h)
{
fprintf(stderr,"ConvertToGlobalHandle(%d),stub!\n",h);
return h;
}
/***********************************************************************
* RegisterServiceProcess (KERNEL32)
*
* A service process calls this function to ensure that it continues to run
* even after a user logged off.
*/
DWORD RegisterServiceProcess(DWORD dwProcessId, DWORD dwType)
{
/* I don't think that Wine needs to do anything in that function */
return 1; /* success */
}