/[cvs]/joko/Uni/BSArch/03/win32/utils_proc.c
ViewVC logotype

Annotation of /joko/Uni/BSArch/03/win32/utils_proc.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Thu Jun 15 22:58:58 2006 UTC (18 years, 3 months ago) by joko
Branch: MAIN
File MIME type: text/plain
refactoring

1 joko 1.1 /* $Id: min_shell.c,v 1.5 2006/06/15 22:15:10 joko Exp $ */
2    
3     #include <windows.h>
4    
5     BOOL os_start_process(char * filename, BOOL background) {
6    
7     STARTUPINFO si;
8     PROCESS_INFORMATION pi;
9    
10     //printf("start_process: '%s'\n", filename);
11    
12     // initialize structures
13     ZeroMemory(&si,sizeof(si));
14     si.cb = sizeof(STARTUPINFO);
15     ZeroMemory(&pi,sizeof(pi));
16    
17     // actually do something now...
18     CreateProcess(
19     NULL, filename,
20     NULL, NULL, FALSE, 0,
21     NULL, NULL,
22     &si,
23     &pi
24     );
25     check_alert_error("CreateProcess");
26    
27     // 1. background mode
28     if (background) {
29     // TODO: background process bookkeeping
30    
31     // 2. normal (blocking) mode
32     } else {
33     long status;
34     status = WaitForSingleObject(pi.hProcess, INFINITE);
35    
36     // close process and thread handles.
37     CloseHandle(pi.hProcess);
38     CloseHandle(pi.hThread);
39    
40     // check for and handle errors
41     if (status == WAIT_FAILED) {
42     check_alert_error("WaitForSingleObject");
43     return FALSE;
44     }
45     }
46    
47     return TRUE;
48    
49     }

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed