2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis
18 /***********************************************************************
19 * CreateMutexA (KERNEL32.52)
21 HANDLE32
CreateMutexA (SECURITY_ATTRIBUTES
*sa
, BOOL32 on
, const char *a
)
26 /***********************************************************************
27 * ReleaseMutex (KERNEL32.435)
29 BOOL32
ReleaseMutex (HANDLE32 h
)
34 /***********************************************************************
35 * CreateEventA (KERNEL32.43)
37 HANDLE32
CreateEventA (SECURITY_ATTRIBUTES
*sa
, BOOL32 au
, BOOL32 on
, const char
42 /***********************************************************************
43 * SetEvent (KERNEL32.487)
45 BOOL32
SetEvent (HANDLE32 h
)
49 /***********************************************************************
50 * ResetEvent (KERNEL32.439)
52 BOOL32
ResetEvent (HANDLE32 h
)
56 /***********************************************************************
57 * WaitForSingleObject (KERNEL32.561)
59 DWORD
WaitForSingleObject(HANDLE32 h
, DWORD a
)
63 /***********************************************************************
64 * DuplicateHandle (KERNEL32.78)
66 BOOL32
DuplicateHandle(HANDLE32 a
, HANDLE32 b
, HANDLE32 c
, HANDLE32
* d
, DWORD e
, BOOL32 f
, DWORD g
)
73 /***********************************************************************
74 * LoadLibraryA (KERNEL32.365)
75 * copied from LoadLibrary
76 * This does not currently support built-in libraries
78 HINSTANCE32
LoadLibrary32A(LPCSTR libname
)
81 dprintf_module( stddeb
, "LoadLibrary: (%08x) %s\n", (int)libname
, libname
);
82 handle
= LoadModule16( libname
, (LPVOID
)-1 );
83 if (handle
== (HINSTANCE32
) -1)
86 strcpy( buffer
, libname
);
87 strcat( buffer
, ".dll" );
88 handle
= LoadModule16( buffer
, (LPVOID
)-1 );
90 /* Obtain module handle and call initialization function */
92 if (handle
>= (HINSTANCE32
)32) PE_InitializeDLLs( GetExePtr(handle
));
97 /***********************************************************************
98 * LoadLibrary32W (KERNEL32.368)
100 HINSTANCE32
LoadLibrary32W(LPCWSTR libnameW
)
102 LPSTR libnameA
= HEAP_strdupWtoA( GetProcessHeap(), 0, libnameW
);
103 HINSTANCE32 ret
= LoadLibrary32A( libnameA
);
104 HeapFree( GetProcessHeap(), 0, libnameA
);
108 /***********************************************************************
111 BOOL32
FreeLibrary32(HINSTANCE32 hLibModule
)
113 fprintf(stderr
,"FreeLibrary: empty stub\n");
117 /**********************************************************************
118 * GetProcessAffinityMask
120 BOOL32
GetProcessAffinityMask(HANDLE32 hProcess
, LPDWORD lpProcessAffinityMask
,
121 LPDWORD lpSystemAffinityMask
)
123 dprintf_task(stddeb
,"GetProcessAffinityMask(%x,%lx,%lx)\n",
124 hProcess
,(lpProcessAffinityMask
?*lpProcessAffinityMask
:0),
125 (lpSystemAffinityMask
?*lpSystemAffinityMask
:0));
126 /* It is definitely important for a process to know on what processor
128 if(lpProcessAffinityMask
)
129 *lpProcessAffinityMask
=1;
130 if(lpSystemAffinityMask
)
131 *lpSystemAffinityMask
=1;
135 /**********************************************************************
136 * SetThreadAffinityMask
138 BOOL32
SetThreadAffinityMask(HANDLE32 hThread
, DWORD dwThreadAffinityMask
)
140 dprintf_task(stddeb
,"SetThreadAffinityMask(%x,%lx)\n",hThread
,
141 dwThreadAffinityMask
);
142 /* FIXME: We let it fail */