Release 960506
[wine.git] / win32 / process.c
blob4ed4c7e0870f20f74f4753b5a13cd02849d335fc
1 /*
2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis
5 */
7 #include <stdio.h>
8 #include <string.h>
9 #include <unistd.h>
10 #include "windows.h"
11 #include "winerror.h"
12 #include "kernel32.h"
13 #include "handle32.h"
14 #include "stddebug.h"
15 #include "debug.h"
17 static HANDLE32 ProcessHeap = 0; /* FIXME: should be in process database */
19 /***********************************************************************
20 * ExitProcess (KERNEL32.100)
23 void ExitProcess(DWORD status)
25 exit(status);
28 /***********************************************************************
29 * CreateMutexA (KERNEL32.52)
31 HANDLE32 CreateMutexA (SECURITY_ATTRIBUTES *sa, BOOL on, const char *a)
33 return 0;
36 /***********************************************************************
37 * ReleaseMutex (KERNEL32.435)
39 BOOL ReleaseMutex (HANDLE32 h)
41 return 0;
44 /***********************************************************************
45 * CreateEventA (KERNEL32.43)
47 HANDLE32 CreateEventA (SECURITY_ATTRIBUTES *sa, BOOL au, BOOL on, const char
48 *name)
50 return 0;
52 /***********************************************************************
53 * SetEvent (KERNEL32.487)
55 BOOL SetEvent (HANDLE32 h)
57 return 0;
59 /***********************************************************************
60 * ResetEvent (KERNEL32.439)
62 BOOL ResetEvent (HANDLE32 h)
64 return 0;
66 /***********************************************************************
67 * WaitForSingleObject (KERNEL32.561)
69 DWORD WaitForSingleObject(HANDLE32 h, DWORD a)
71 return 0;
73 /***********************************************************************
74 * DuplicateHandle (KERNEL32.78)
76 BOOL DuplicateHandle(HANDLE32 a, HANDLE32 b, HANDLE32 c, HANDLE32 * d, DWORD e, BOOL f, DWORD g)
78 *d = b;
79 return 1;
81 /***********************************************************************
82 * GetCurrentProcess (KERNEL32.198)
84 HANDLE32 GetCurrentProcess(void)
86 return 0;
89 /***********************************************************************
90 * GetProcessHeap (KERNEL32.259)
92 HANDLE32 GetProcessHeap(void)
94 if (!ProcessHeap) ProcessHeap = HeapCreate( 0, 0x10000, 0 );
95 return ProcessHeap;
98 /***********************************************************************
99 * LoadLibraryA (KERNEL32.365)
100 * copied from LoadLibrary
101 * This does not currently support built-in libraries
103 HANDLE32 LoadLibraryA(char *libname)
105 HANDLE handle;
106 dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname);
107 handle = LoadModule( libname, (LPVOID)-1 );
108 if (handle == (HANDLE) -1)
110 char buffer[256];
111 strcpy( buffer, libname );
112 strcat( buffer, ".dll" );
113 handle = LoadModule( buffer, (LPVOID)-1 );
115 /* Obtain module handle and call initialization function */
116 #ifndef WINELIB
117 if (handle >= (HANDLE)32) PE_InitializeDLLs( GetExePtr(handle));
118 #endif
119 return handle;
123 #ifndef WINELIB
124 /***********************************************************************
125 * WIN32_GetProcAddress
127 void* WIN32_GetProcAddress(HANDLE32 hModule, char* function)
129 dprintf_module( stddeb, "WIN32_GetProcAddress(%08x,%s)\n",
130 hModule, function);
131 return PE_GetProcAddress(GetExePtr(hModule),function);
133 #endif /* WINELIB */
135 /**********************************************************************
136 * GetProcessAffinityMask
138 BOOL GetProcessAffinityMask(HANDLE32 hProcess, LPDWORD lpProcessAffinityMask,
139 LPDWORD lpSystemAffinityMask)
141 dprintf_task(stddeb,"GetProcessAffinityMask(%x,%x,%x)\n",
142 hProcess,(lpProcessAffinityMask?*lpProcessAffinityMask:0),
143 (lpSystemAffinityMask?*lpSystemAffinityMask:0));
144 /* It is definitely important for a process to know on what processor
145 it is running :-) */
146 if(lpProcessAffinityMask)
147 *lpProcessAffinityMask=1;
148 if(lpSystemAffinityMask)
149 *lpSystemAffinityMask=1;
150 return TRUE;
153 /**********************************************************************
154 * SetThreadAffinityMask
156 BOOL SetThreadAffinityMask(HANDLE32 hThread, DWORD dwThreadAffinityMask)
158 dprintf_task(stddeb,"SetThreadAffinityMask(%x,%x)\n",hThread,
159 dwThreadAffinityMask);
160 /* FIXME: We let it fail */
161 return 1;