4 * Copyright 1996, 1998 Alexandre Julliard
25 static BOOL32
PROCESS_Signaled( K32OBJ
*obj
, DWORD thread_id
);
26 static BOOL32
PROCESS_Satisfied( K32OBJ
*obj
, DWORD thread_id
);
27 static void PROCESS_AddWait( K32OBJ
*obj
, DWORD thread_id
);
28 static void PROCESS_RemoveWait( K32OBJ
*obj
, DWORD thread_id
);
29 static void PROCESS_Destroy( K32OBJ
*obj
);
31 const K32OBJ_OPS PROCESS_Ops
=
33 PROCESS_Signaled
, /* signaled */
34 PROCESS_Satisfied
, /* satisfied */
35 PROCESS_AddWait
, /* add_wait */
36 PROCESS_RemoveWait
, /* remove_wait */
39 PROCESS_Destroy
/* destroy */
43 /***********************************************************************
46 PDB32
*PROCESS_Current(void)
48 return THREAD_Current()->process
;
52 /***********************************************************************
55 * Get a process from a handle, incrementing the PDB refcount.
57 PDB32
*PROCESS_GetPtr( HANDLE32 handle
, DWORD access
, int *server_handle
)
59 return (PDB32
*)HANDLE_GetObjPtr( PROCESS_Current(), handle
,
60 K32OBJ_PROCESS
, access
, server_handle
);
64 /***********************************************************************
67 * Convert a process id to a PDB, making sure it is valid.
69 PDB32
*PROCESS_IdToPDB( DWORD id
)
73 if (!id
) return PROCESS_Current();
74 pdb
= PROCESS_ID_TO_PDB( id
);
75 if (!K32OBJ_IsValid( &pdb
->header
, K32OBJ_PROCESS
))
77 SetLastError( ERROR_INVALID_PARAMETER
);
85 /***********************************************************************
88 * Build the env DB for the initial process
90 static BOOL32
PROCESS_BuildEnvDB( PDB32
*pdb
)
92 /* Allocate the env DB (FIXME: should not be on the system heap) */
94 if (!(pdb
->env_db
= HeapAlloc(SystemHeap
,HEAP_ZERO_MEMORY
,sizeof(ENVDB
))))
96 InitializeCriticalSection( &pdb
->env_db
->section
);
98 /* Allocate the standard handles */
100 pdb
->env_db
->hStdin
= FILE_DupUnixHandle( 0 );
101 pdb
->env_db
->hStdout
= FILE_DupUnixHandle( 1 );
102 pdb
->env_db
->hStderr
= FILE_DupUnixHandle( 2 );
103 FILE_SetFileType( pdb
->env_db
->hStdin
, FILE_TYPE_CHAR
);
104 FILE_SetFileType( pdb
->env_db
->hStdout
, FILE_TYPE_CHAR
);
105 FILE_SetFileType( pdb
->env_db
->hStderr
, FILE_TYPE_CHAR
);
107 /* Build the command-line */
109 pdb
->env_db
->cmd_line
= HEAP_strdupA( SystemHeap
, 0, "kernel32" );
111 /* Build the environment strings */
113 return ENV_BuildEnvironment( pdb
);
117 /***********************************************************************
118 * PROCESS_InheritEnvDB
120 static BOOL32
PROCESS_InheritEnvDB( PDB32
*pdb
, LPCSTR cmd_line
, LPCSTR env
,
121 STARTUPINFO32A
*startup
)
123 if (!(pdb
->env_db
= HeapAlloc(pdb
->heap
, HEAP_ZERO_MEMORY
, sizeof(ENVDB
))))
125 InitializeCriticalSection( &pdb
->env_db
->section
);
127 /* Copy the parent environment */
129 if (!ENV_InheritEnvironment( pdb
, env
)) return FALSE
;
131 /* Copy the command line */
133 if (!(pdb
->env_db
->cmd_line
= HEAP_strdupA( pdb
->heap
, 0, cmd_line
)))
136 /* Remember startup info */
137 if (!(pdb
->env_db
->startup_info
=
138 HeapAlloc( pdb
->heap
, HEAP_ZERO_MEMORY
, sizeof(STARTUPINFO32A
) )))
140 *pdb
->env_db
->startup_info
= *startup
;
142 /* Inherit the standard handles */
143 if (pdb
->env_db
->startup_info
->dwFlags
& STARTF_USESTDHANDLES
)
145 pdb
->env_db
->hStdin
= pdb
->env_db
->startup_info
->hStdInput
;
146 pdb
->env_db
->hStdout
= pdb
->env_db
->startup_info
->hStdOutput
;
147 pdb
->env_db
->hStderr
= pdb
->env_db
->startup_info
->hStdError
;
151 pdb
->env_db
->hStdin
= pdb
->parent
->env_db
->hStdin
;
152 pdb
->env_db
->hStdout
= pdb
->parent
->env_db
->hStdout
;
153 pdb
->env_db
->hStderr
= pdb
->parent
->env_db
->hStderr
;
160 /***********************************************************************
163 * Free a PDB and all associated storage.
165 static void PROCESS_FreePDB( PDB32
*pdb
)
167 pdb
->header
.type
= K32OBJ_UNKNOWN
;
168 if (pdb
->handle_table
) HANDLE_CloseAll( pdb
, NULL
);
169 ENV_FreeEnvironment( pdb
);
170 if (pdb
->heap
&& (pdb
->heap
!= pdb
->system_heap
)) HeapDestroy( pdb
->heap
);
171 if (pdb
->load_done_evt
) K32OBJ_DecCount( pdb
->load_done_evt
);
172 if (pdb
->event
) K32OBJ_DecCount( pdb
->event
);
173 DeleteCriticalSection( &pdb
->crit_section
);
174 HeapFree( SystemHeap
, 0, pdb
);
178 /***********************************************************************
181 * Allocate and fill a PDB structure.
182 * Runs in the context of the parent process.
184 static PDB32
*PROCESS_CreatePDB( PDB32
*parent
)
186 PDB32
*pdb
= HeapAlloc( SystemHeap
, HEAP_ZERO_MEMORY
, sizeof(PDB32
) );
188 if (!pdb
) return NULL
;
189 pdb
->header
.type
= K32OBJ_PROCESS
;
190 pdb
->header
.refcount
= 1;
191 pdb
->exit_code
= 0x103; /* STILL_ACTIVE */
193 pdb
->running_threads
= 1;
194 pdb
->ring0_threads
= 1;
195 pdb
->system_heap
= SystemHeap
;
196 pdb
->parent
= parent
;
198 pdb
->priority
= 8; /* Normal */
199 pdb
->heap
= pdb
->system_heap
; /* will be changed later on */
201 InitializeCriticalSection( &pdb
->crit_section
);
203 /* Allocate the events */
205 if (!(pdb
->event
= EVENT_Create( TRUE
, FALSE
))) goto error
;
206 if (!(pdb
->load_done_evt
= EVENT_Create( TRUE
, FALSE
))) goto error
;
208 /* Create the handle table */
210 if (!HANDLE_CreateTable( pdb
, TRUE
)) goto error
;
215 PROCESS_FreePDB( pdb
);
220 /***********************************************************************
223 BOOL32
PROCESS_Init(void)
228 /* Initialize virtual memory management */
229 if (!VIRTUAL_Init()) return FALSE
;
231 /* Create the system and SEGPTR heaps */
232 if (!(SystemHeap
= HeapCreate( HEAP_GROWABLE
, 0x10000, 0 ))) return FALSE
;
233 if (!(SegptrHeap
= HeapCreate( HEAP_WINE_SEGPTR
, 0, 0 ))) return FALSE
;
235 /* Create the initial process and thread structures */
236 if (!(pdb
= PROCESS_CreatePDB( NULL
))) return FALSE
;
237 if (!(thdb
= THREAD_Create( pdb
, 0, FALSE
, NULL
, NULL
, NULL
, NULL
))) return FALSE
;
238 thdb
->unix_pid
= getpid();
240 /* Create the environment DB of the first process */
241 if (!PROCESS_BuildEnvDB( pdb
)) return FALSE
;
243 /* Initialize the first thread */
244 if (CLIENT_InitThread()) return FALSE
;
250 /***********************************************************************
253 * Create a new process database and associated info.
255 PDB32
*PROCESS_Create( NE_MODULE
*pModule
, LPCSTR cmd_line
, LPCSTR env
,
256 HINSTANCE16 hInstance
, HINSTANCE16 hPrevInstance
,
257 STARTUPINFO32A
*startup
, PROCESS_INFORMATION
*info
)
260 int server_thandle
, server_phandle
;
263 PDB32
*parent
= PROCESS_Current();
264 PDB32
*pdb
= PROCESS_CreatePDB( parent
);
267 if (!pdb
) return NULL
;
268 info
->hThread
= info
->hProcess
= INVALID_HANDLE_VALUE32
;
270 /* Create the heap */
272 if (pModule
->module32
)
274 size
= PE_HEADER(pModule
->module32
)->OptionalHeader
.SizeOfHeapReserve
;
275 commit
= PE_HEADER(pModule
->module32
)->OptionalHeader
.SizeOfHeapCommit
;
281 pdb
->flags
|= PDB32_WIN16_PROC
; /* This is a Win16 process */
283 if (!(pdb
->heap
= HeapCreate( HEAP_GROWABLE
, size
, commit
))) goto error
;
284 pdb
->heap_list
= pdb
->heap
;
286 /* Inherit the env DB from the parent */
288 if (!PROCESS_InheritEnvDB( pdb
, cmd_line
, env
, startup
)) goto error
;
290 /* Create the main thread */
292 if (pModule
->module32
)
293 size
= PE_HEADER(pModule
->module32
)->OptionalHeader
.SizeOfStackReserve
;
296 if (!(thdb
= THREAD_Create( pdb
, size
, FALSE
, &server_thandle
, &server_phandle
,
297 NULL
, NULL
))) goto error
;
298 if ((info
->hThread
= HANDLE_Alloc( parent
, &thdb
->header
, THREAD_ALL_ACCESS
,
299 FALSE
, server_thandle
)) == INVALID_HANDLE_VALUE32
)
301 if ((info
->hProcess
= HANDLE_Alloc( parent
, &pdb
->header
, PROCESS_ALL_ACCESS
,
302 FALSE
, server_phandle
)) == INVALID_HANDLE_VALUE32
)
304 info
->dwProcessId
= PDB_TO_PROCESS_ID(pdb
);
305 info
->dwThreadId
= THDB_TO_THREAD_ID(thdb
);
308 thdb
->unix_pid
= getpid(); /* FIXME: wrong here ... */
310 /* All Win16 'threads' have the same unix_pid, no matter by which thread
311 they were created ! */
312 pTask
= (TDB
*)GlobalLock16( parent
->task
);
313 thdb
->unix_pid
= pTask
? pTask
->thdb
->unix_pid
: THREAD_Current()->unix_pid
;
316 /* Create a Win16 task for this process */
318 if (startup
->dwFlags
& STARTF_USESHOWWINDOW
)
319 cmdShow
= startup
->wShowWindow
;
321 pdb
->task
= TASK_Create( thdb
, pModule
, hInstance
, hPrevInstance
, cmdShow
);
322 if (!pdb
->task
) goto error
;
327 if (info
->hThread
!= INVALID_HANDLE_VALUE32
) CloseHandle( info
->hThread
);
328 if (info
->hProcess
!= INVALID_HANDLE_VALUE32
) CloseHandle( info
->hProcess
);
329 if (thdb
) K32OBJ_DecCount( &thdb
->header
);
330 PROCESS_FreePDB( pdb
);
335 /***********************************************************************
338 static BOOL32
PROCESS_Signaled( K32OBJ
*obj
, DWORD thread_id
)
340 PDB32
*pdb
= (PDB32
*)obj
;
341 assert( obj
->type
== K32OBJ_PROCESS
);
342 return K32OBJ_OPS( pdb
->event
)->signaled( pdb
->event
, thread_id
);
346 /***********************************************************************
349 * Wait on this object has been satisfied.
351 static BOOL32
PROCESS_Satisfied( K32OBJ
*obj
, DWORD thread_id
)
353 PDB32
*pdb
= (PDB32
*)obj
;
354 assert( obj
->type
== K32OBJ_PROCESS
);
355 return K32OBJ_OPS( pdb
->event
)->satisfied( pdb
->event
, thread_id
);
359 /***********************************************************************
362 * Add thread to object wait queue.
364 static void PROCESS_AddWait( K32OBJ
*obj
, DWORD thread_id
)
366 PDB32
*pdb
= (PDB32
*)obj
;
367 assert( obj
->type
== K32OBJ_PROCESS
);
368 return K32OBJ_OPS( pdb
->event
)->add_wait( pdb
->event
, thread_id
);
372 /***********************************************************************
375 * Remove thread from object wait queue.
377 static void PROCESS_RemoveWait( K32OBJ
*obj
, DWORD thread_id
)
379 PDB32
*pdb
= (PDB32
*)obj
;
380 assert( obj
->type
== K32OBJ_PROCESS
);
381 return K32OBJ_OPS( pdb
->event
)->remove_wait( pdb
->event
, thread_id
);
385 /***********************************************************************
388 static void PROCESS_Destroy( K32OBJ
*ptr
)
390 PDB32
*pdb
= (PDB32
*)ptr
;
391 assert( ptr
->type
== K32OBJ_PROCESS
);
393 /* Free everything */
395 ptr
->type
= K32OBJ_UNKNOWN
;
396 PROCESS_FreePDB( pdb
);
400 /***********************************************************************
401 * ExitProcess (KERNEL32.100)
403 void WINAPI
ExitProcess( DWORD status
)
405 PDB32
*pdb
= PROCESS_Current();
406 TDB
*pTask
= (TDB
*)GlobalLock16( pdb
->task
);
407 if ( pTask
) pTask
->nEvents
++;
409 if ( pTask
&& pTask
->thdb
!= THREAD_Current() )
410 ExitThread( status
);
413 /* FIXME: should kill all running threads of this process */
414 pdb
->exit_code
= status
;
415 EVENT_Set( pdb
->event
);
416 if (pdb
->console
) FreeConsole();
419 __RESTORE_ES
; /* Necessary for Pietrek's showseh example program */
420 TASK_KillCurrentTask( status
);
424 /******************************************************************************
425 * TerminateProcess (KERNEL32.684)
427 BOOL32 WINAPI
TerminateProcess( HANDLE32 handle
, DWORD exit_code
)
431 PDB32
*pdb
= PROCESS_GetPtr( handle
, PROCESS_TERMINATE
, &server_handle
);
432 if (!pdb
) return FALSE
;
433 ret
= !CLIENT_TerminateProcess( server_handle
, exit_code
);
434 K32OBJ_DecCount( &pdb
->header
);
438 /***********************************************************************
439 * GetCurrentProcess (KERNEL32.198)
441 HANDLE32 WINAPI
GetCurrentProcess(void)
443 return CURRENT_PROCESS_PSEUDOHANDLE
;
447 /*********************************************************************
448 * OpenProcess (KERNEL32.543)
450 HANDLE32 WINAPI
OpenProcess( DWORD access
, BOOL32 inherit
, DWORD id
)
453 PDB32
*pdb
= PROCESS_ID_TO_PDB(id
);
454 if (!K32OBJ_IsValid( &pdb
->header
, K32OBJ_PROCESS
))
456 SetLastError( ERROR_INVALID_HANDLE
);
459 if ((server_handle
= CLIENT_OpenProcess( pdb
->server_pid
, access
, inherit
)) == -1)
461 SetLastError( ERROR_INVALID_HANDLE
);
464 return HANDLE_Alloc( PROCESS_Current(), &pdb
->header
, access
,
465 inherit
, server_handle
);
469 /***********************************************************************
470 * GetCurrentProcessId (KERNEL32.199)
472 DWORD WINAPI
GetCurrentProcessId(void)
474 PDB32
*pdb
= PROCESS_Current();
475 return PDB_TO_PROCESS_ID( pdb
);
479 /***********************************************************************
480 * GetProcessHeap (KERNEL32.259)
482 HANDLE32 WINAPI
GetProcessHeap(void)
484 PDB32
*pdb
= PROCESS_Current();
485 return pdb
->heap
? pdb
->heap
: SystemHeap
;
489 /***********************************************************************
490 * GetThreadLocale (KERNEL32.295)
492 LCID WINAPI
GetThreadLocale(void)
494 return PROCESS_Current()->locale
;
498 /***********************************************************************
499 * SetPriorityClass (KERNEL32.503)
501 BOOL32 WINAPI
SetPriorityClass( HANDLE32 hprocess
, DWORD priorityclass
)
503 PDB32
*pdb
= PROCESS_GetPtr( hprocess
, PROCESS_SET_INFORMATION
, NULL
);
504 if (!pdb
) return FALSE
;
505 switch (priorityclass
)
507 case NORMAL_PRIORITY_CLASS
:
508 pdb
->priority
= 0x00000008;
510 case IDLE_PRIORITY_CLASS
:
511 pdb
->priority
= 0x00000004;
513 case HIGH_PRIORITY_CLASS
:
514 pdb
->priority
= 0x0000000d;
516 case REALTIME_PRIORITY_CLASS
:
517 pdb
->priority
= 0x00000018;
520 WARN(process
,"Unknown priority class %ld\n",priorityclass
);
523 K32OBJ_DecCount( &pdb
->header
);
528 /***********************************************************************
529 * GetPriorityClass (KERNEL32.250)
531 DWORD WINAPI
GetPriorityClass(HANDLE32 hprocess
)
533 PDB32
*pdb
= PROCESS_GetPtr( hprocess
, PROCESS_QUERY_INFORMATION
, NULL
);
537 switch (pdb
->priority
)
540 ret
= NORMAL_PRIORITY_CLASS
;
543 ret
= IDLE_PRIORITY_CLASS
;
546 ret
= HIGH_PRIORITY_CLASS
;
549 ret
= REALTIME_PRIORITY_CLASS
;
552 WARN(process
,"Unknown priority %ld\n",pdb
->priority
);
554 K32OBJ_DecCount( &pdb
->header
);
560 /***********************************************************************
561 * GetStdHandle (KERNEL32.276)
563 * FIXME: These should be allocated when a console is created, or inherited
566 HANDLE32 WINAPI
GetStdHandle( DWORD std_handle
)
570 PDB32
*pdb
= PROCESS_Current();
574 case STD_INPUT_HANDLE
:
575 if (pdb
->env_db
->hStdin
) return pdb
->env_db
->hStdin
;
578 case STD_OUTPUT_HANDLE
:
579 if (pdb
->env_db
->hStdout
) return pdb
->env_db
->hStdout
;
582 case STD_ERROR_HANDLE
:
583 if (pdb
->env_db
->hStderr
) return pdb
->env_db
->hStderr
;
587 SetLastError( ERROR_INVALID_PARAMETER
);
588 return INVALID_HANDLE_VALUE32
;
590 hFile
= FILE_DupUnixHandle( fd
);
591 if (hFile
!= HFILE_ERROR32
)
593 FILE_SetFileType( hFile
, FILE_TYPE_CHAR
);
596 case STD_INPUT_HANDLE
: pdb
->env_db
->hStdin
= hFile
; break;
597 case STD_OUTPUT_HANDLE
: pdb
->env_db
->hStdout
= hFile
; break;
598 case STD_ERROR_HANDLE
: pdb
->env_db
->hStderr
= hFile
; break;
605 /***********************************************************************
606 * SetStdHandle (KERNEL32.506)
608 BOOL32 WINAPI
SetStdHandle( DWORD std_handle
, HANDLE32 handle
)
610 PDB32
*pdb
= PROCESS_Current();
611 /* FIXME: should we close the previous handle? */
614 case STD_INPUT_HANDLE
:
615 pdb
->env_db
->hStdin
= handle
;
617 case STD_OUTPUT_HANDLE
:
618 pdb
->env_db
->hStdout
= handle
;
620 case STD_ERROR_HANDLE
:
621 pdb
->env_db
->hStderr
= handle
;
624 SetLastError( ERROR_INVALID_PARAMETER
);
628 /***********************************************************************
629 * GetProcessVersion (KERNEL32)
631 DWORD WINAPI
GetProcessVersion( DWORD processid
)
634 PDB32
*pdb
= PROCESS_IdToPDB( processid
);
637 if (!(pTask
= (TDB
*)GlobalLock16( pdb
->task
))) return 0;
638 return (pTask
->version
&0xff) | (((pTask
->version
>>8) & 0xff)<<16);
641 /***********************************************************************
642 * GetProcessFlags (KERNEL32)
644 DWORD WINAPI
GetProcessFlags( DWORD processid
)
646 PDB32
*pdb
= PROCESS_IdToPDB( processid
);
651 /***********************************************************************
652 * SetProcessWorkingSetSize [KERNEL32.662]
653 * Sets the min/max working set sizes for a specified process.
656 * hProcess [I] Handle to the process of interest
657 * minset [I] Specifies minimum working set size
658 * maxset [I] Specifies maximum working set size
662 BOOL32 WINAPI
SetProcessWorkingSetSize(HANDLE32 hProcess
,DWORD minset
,
665 FIXME(process
,"(0x%08x,%ld,%ld): stub - harmless\n",hProcess
,minset
,maxset
);
666 if(( minset
== -1) && (maxset
== -1)) {
667 /* Trim the working set to zero */
668 /* Swap the process out of physical RAM */
673 /***********************************************************************
674 * GetProcessWorkingSetSize (KERNEL32)
676 BOOL32 WINAPI
GetProcessWorkingSetSize(HANDLE32 hProcess
,LPDWORD minset
,
679 FIXME(process
,"(0x%08x,%p,%p): stub\n",hProcess
,minset
,maxset
);
680 /* 32 MB working set size */
681 if (minset
) *minset
= 32*1024*1024;
682 if (maxset
) *maxset
= 32*1024*1024;
686 /***********************************************************************
687 * SetProcessShutdownParameters (KERNEL32)
689 BOOL32 WINAPI
SetProcessShutdownParameters(DWORD level
,DWORD flags
)
691 FIXME(process
,"(%ld,0x%08lx): stub\n",level
,flags
);
695 /***********************************************************************
696 * ReadProcessMemory (KERNEL32)
697 * FIXME: check this, if we ever run win32 binaries in different addressspaces
698 * ... and add a sizecheck
700 BOOL32 WINAPI
ReadProcessMemory( HANDLE32 hProcess
, LPCVOID lpBaseAddress
,
701 LPVOID lpBuffer
, DWORD nSize
,
702 LPDWORD lpNumberOfBytesRead
)
704 memcpy(lpBuffer
,lpBaseAddress
,nSize
);
705 if (lpNumberOfBytesRead
) *lpNumberOfBytesRead
= nSize
;
709 /***********************************************************************
710 * WriteProcessMemory (KERNEL32)
711 * FIXME: check this, if we ever run win32 binaries in different addressspaces
712 * ... and add a sizecheck
714 BOOL32 WINAPI
WriteProcessMemory(HANDLE32 hProcess
, LPVOID lpBaseAddress
,
715 LPVOID lpBuffer
, DWORD nSize
,
716 LPDWORD lpNumberOfBytesWritten
)
718 memcpy(lpBaseAddress
,lpBuffer
,nSize
);
719 if (lpNumberOfBytesWritten
) *lpNumberOfBytesWritten
= nSize
;
723 /***********************************************************************
724 * ConvertToGlobalHandle (KERNEL32)
725 * FIXME: this is not correctly implemented...
727 HANDLE32 WINAPI
ConvertToGlobalHandle(HANDLE32 h
)
729 FIXME(process
,"(%d): stub\n",h
);
733 /***********************************************************************
734 * RegisterServiceProcess (KERNEL32)
736 * A service process calls this function to ensure that it continues to run
737 * even after a user logged off.
739 DWORD WINAPI
RegisterServiceProcess(DWORD dwProcessId
, DWORD dwType
)
741 /* I don't think that Wine needs to do anything in that function */
742 return 1; /* success */
745 /***********************************************************************
746 * GetExitCodeProcess [KERNEL32.325]
748 * Gets termination status of specified process
755 * Should call SetLastError (but doesn't).
757 BOOL32 WINAPI
GetExitCodeProcess(
758 HANDLE32 hProcess
, /* [I] handle to the process */
759 LPDWORD lpExitCode
) /* [O] address to receive termination status */
763 struct get_process_info_reply info
;
765 if (!(process
= PROCESS_GetPtr( hProcess
, PROCESS_QUERY_INFORMATION
,
768 if (server_handle
!= -1)
770 CLIENT_GetProcessInfo( server_handle
, &info
);
771 if (lpExitCode
) *lpExitCode
= info
.exit_code
;
773 else if (lpExitCode
) *lpExitCode
= process
->exit_code
;
774 K32OBJ_DecCount( &process
->header
);
778 /***********************************************************************
779 * GetProcessHeaps [KERNEL32.376]
781 DWORD WINAPI
GetProcessHeaps(DWORD nrofheaps
,HANDLE32
*heaps
) {
782 FIXME(win32
,"(%ld,%p), incomplete implementation.\n",nrofheaps
,heaps
);
785 heaps
[0] = GetProcessHeap();
786 /* ... probably SystemHeap too ? */
789 /* number of available heaps */
793 /***********************************************************************
794 * PROCESS_SuspendOtherThreads
797 void PROCESS_SuspendOtherThreads(void)
804 pdb
= PROCESS_Current();
805 entry
= pdb
->thread_list
->next
;
808 if (entry
->thread
!= THREAD_Current() && !THREAD_IsWin16(entry
->thread
))
810 HANDLE32 handle
= HANDLE_Alloc( PROCESS_Current(),
811 &entry
->thread
->header
,
812 THREAD_ALL_ACCESS
, FALSE
, -1 );
813 SuspendThread(handle
);
816 if (entry
== pdb
->thread_list
) break;
823 /***********************************************************************
824 * PROCESS_ResumeOtherThreads
827 void PROCESS_ResumeOtherThreads(void)
834 pdb
= PROCESS_Current();
835 entry
= pdb
->thread_list
->next
;
838 if (entry
->thread
!= THREAD_Current() && !THREAD_IsWin16(entry
->thread
))
840 HANDLE32 handle
= HANDLE_Alloc( PROCESS_Current(),
841 &entry
->thread
->header
,
842 THREAD_ALL_ACCESS
, FALSE
, -1 );
843 ResumeThread(handle
);
846 if (entry
== pdb
->thread_list
) break;