Release 970101
[wine] / win32 / process.c
1 /*
2  * Win32 kernel functions
3  *
4  * Copyright 1995 Martin von Loewis
5  */
6
7 #include <stdio.h>
8 #include <string.h>
9 #include <unistd.h>
10 #include "windows.h"
11 #include "winerror.h"
12 #include "heap.h"
13 #include "handle32.h"
14 #include "stddebug.h"
15 #include "debug.h"
16
17 /***********************************************************************
18  *           CreateMutexA    (KERNEL32.52)
19  */
20 HANDLE32 CreateMutexA (SECURITY_ATTRIBUTES *sa, BOOL on, const char *a)
21 {
22         return 0;
23 }
24
25 /***********************************************************************
26  *           ReleaseMutex    (KERNEL32.435)
27  */
28 BOOL ReleaseMutex (HANDLE32 h)
29 {
30         return 0;
31 }
32
33 /***********************************************************************
34  *           CreateEventA    (KERNEL32.43)
35  */
36 HANDLE32 CreateEventA (SECURITY_ATTRIBUTES *sa, BOOL au, BOOL on, const char
37 *name)
38 {
39         return 0;
40 }
41 /***********************************************************************
42  *           SetEvent    (KERNEL32.487)
43  */
44 BOOL SetEvent (HANDLE32 h)
45 {
46         return 0;
47 }
48 /***********************************************************************
49  *           ResetEvent    (KERNEL32.439)
50  */
51 BOOL ResetEvent (HANDLE32 h)
52 {
53         return 0;
54 }
55 /***********************************************************************
56  *           WaitForSingleObject    (KERNEL32.561)
57  */
58 DWORD WaitForSingleObject(HANDLE32 h, DWORD a)
59 {
60         return 0;
61 }
62 /***********************************************************************
63  *           DuplicateHandle    (KERNEL32.78)
64  */
65 BOOL DuplicateHandle(HANDLE32 a, HANDLE32 b, HANDLE32 c, HANDLE32 * d, DWORD e, BOOL f, DWORD g)
66 {
67         *d = b;
68         return 1;
69 }
70
71
72 /***********************************************************************
73  *           LoadLibraryA         (KERNEL32.365)
74  * copied from LoadLibrary
75  * This does not currently support built-in libraries
76  */
77 HINSTANCE32 LoadLibrary32A(LPCSTR libname)
78 {
79         HINSTANCE32 handle;
80         dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname);
81         handle = LoadModule( libname, (LPVOID)-1 );
82         if (handle == (HINSTANCE32) -1)
83         {
84                 char buffer[256];
85                 strcpy( buffer, libname );
86                 strcat( buffer, ".dll" );
87                 handle = LoadModule( buffer, (LPVOID)-1 );
88         }
89         /* Obtain module handle and call initialization function */
90 #ifndef WINELIB
91         if (handle >= (HINSTANCE32)32) PE_InitializeDLLs( GetExePtr(handle));
92 #endif
93         return handle;
94 }
95
96 /***********************************************************************
97  *           LoadLibrary32W         (KERNEL32.368)
98  */
99 HINSTANCE32 LoadLibrary32W(LPCWSTR libnameW)
100 {
101     LPSTR libnameA = HEAP_strdupWtoA( GetProcessHeap(), 0, libnameW );
102     HINSTANCE32 ret = LoadLibrary32A( libnameA );
103     HeapFree( GetProcessHeap(), 0, libnameA );
104     return ret;
105 }
106
107 /***********************************************************************
108  *           FreeLibrary
109  */
110 BOOL FreeLibrary32(HINSTANCE32 hLibModule)
111 {
112         fprintf(stderr,"FreeLibrary: empty stub\n");
113         return TRUE;
114 }
115
116 /**********************************************************************
117  *          GetProcessAffinityMask
118  */
119 BOOL GetProcessAffinityMask(HANDLE32 hProcess, LPDWORD lpProcessAffinityMask,
120   LPDWORD lpSystemAffinityMask)
121 {
122         dprintf_task(stddeb,"GetProcessAffinityMask(%x,%lx,%lx)\n",
123                 hProcess,(lpProcessAffinityMask?*lpProcessAffinityMask:0),
124                 (lpSystemAffinityMask?*lpSystemAffinityMask:0));
125         /* It is definitely important for a process to know on what processor
126            it is running :-) */
127         if(lpProcessAffinityMask)
128                 *lpProcessAffinityMask=1;
129         if(lpSystemAffinityMask)
130                 *lpSystemAffinityMask=1;
131         return TRUE;
132 }
133
134 /**********************************************************************
135  *           SetThreadAffinityMask
136  */
137 BOOL SetThreadAffinityMask(HANDLE32 hThread, DWORD dwThreadAffinityMask)
138 {
139         dprintf_task(stddeb,"SetThreadAffinityMask(%x,%lx)\n",hThread,
140                 dwThreadAffinityMask);
141         /* FIXME: We let it fail */
142         return 1;
143 }