mono-api-wapi.html
Windows Compatibility API
Mono implements a small subset of the Win32 API for some
file system interaction, I/O, thread and process operations.
On Windows, Mono uses directly the services provided by the
operating system. On other operating system it uses its own
implementation (referred to as the "io-layer" or "wapi").
Windows Compatibility API
BindIoCompletionCallback
Prototype: BindIoCompletionCallback
CloseHandle
gboolean CloseHandle(gpointer handle)
Parameters
handle: The handle to release
Remarks
Closes and invalidates
handle, releasing any resources it
consumes. When the last handle to a temporary or non-persistent
object is closed, that object can be deleted. Closing the same
handle twice is an error.
Return value: %TRUE on success, %FALSE otherwise.
closesocket
Prototype: closesocket
CopyFile
gboolean CopyFile (const gunichar2 *name, const gunichar2 *dest_name,
gboolean fail_if_exists)
Parameters
name: a pointer to a NULL-terminated unicode string, that names
Remarks
the file to be copied.
dest_name: a pointer to a NULL-terminated unicode string, that is the
new name for the file.
fail_if_exists: if TRUE and dest_name exists, the copy will fail.
Copies file
name to
dest_name
Return value: %TRUE on success, %FALSE otherwise.
CreateDirectory
gboolean CreateDirectory (const gunichar2 *name,
WapiSecurityAttributes *security)
Parameters
name: a pointer to a NULL-terminated unicode string, that names
Remarks
the directory to be created.
security: ignored for now
Creates directory
name
Return value: %TRUE on success, %FALSE otherwise.
CreateEvent
gpointer CreateEvent(WapiSecurityAttributes *security G_GNUC_UNUSED,
gboolean manual, gboolean initial,
const gunichar2 *name G_GNUC_UNUSED)
Parameters
security: Ignored for now.manual: Specifies whether the new event handle has manual or auto
Remarks
reset behaviour.
initial: Specifies whether the new event handle is initially
signalled or not.
name:Pointer to a string specifying the name of this name, or
%NULL. Currently ignored.
Creates a new event handle.
An event handle is signalled with SetEvent(). If the new handle is
a manual reset event handle, it remains signalled until it is reset
with ResetEvent(). An auto reset event remains signalled until a
single thread has waited for it, at which time the event handle is
automatically reset to unsignalled.
Return value: A new handle, or %NULL on error.
CreateFile
gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
guint32 sharemode, WapiSecurityAttributes *security,
guint32 createmode, guint32 attrs,
gpointer template G_GNUC_UNUSED)
Parameters
name: a pointer to a NULL-terminated unicode string, that names
Remarks
the file or other object to create.
fileaccess: specifies the file access mode
sharemode: whether the file should be shared. This parameter is
currently ignored.
security: Ignored for now.
createmode: specifies whether to create a new file, whether to
overwrite an existing file, whether to truncate the file, etc.
attrs: specifies file attributes and flags. On win32 attributes
are characteristics of the file, not the handle, and are ignored
when an existing file is opened. Flags give the library hints on
how to process a file to optimise performance.
template: the handle of an open %GENERIC_READ file that specifies
attributes to apply to a newly created file, ignoring
attrs.
Normally this parameter is NULL. This parameter is ignored when an
existing file is opened.
Creates a new file handle. This only applies to normal files:
pipes are handled by CreatePipe(), and console handles are created
with GetStdHandle().
Return value: the new handle, or %INVALID_HANDLE_VALUE on error.
CreateMutex
gpointer CreateMutex(WapiSecurityAttributes *security G_GNUC_UNUSED, gboolean owned,
const gunichar2 *name)
Parameters
security: Ignored for now.owned: If %TRUE, the mutex is created with the calling thread
Remarks
already owning the mutex.
name:Pointer to a string specifying the name of this mutex, or
%NULL.
Creates a new mutex handle. A mutex is signalled when no thread
owns it. A thread acquires ownership of the mutex by waiting for
it with WaitForSingleObject() or WaitForMultipleObjects(). A
thread relinquishes ownership with ReleaseMutex().
A thread that owns a mutex can specify the same mutex in repeated
wait function calls without blocking. The thread must call
ReleaseMutex() an equal number of times to release the mutex.
Return value: A new handle, or %NULL on error.
CreatePipe
Prototype: CreatePipe
CreateProcess
Prototype: CreateProcess
CreateProcessWithLogonW
Prototype: CreateProcessWithLogonW
CreateSemaphore
gpointer CreateSemaphore(WapiSecurityAttributes *security G_GNUC_UNUSED, gint32 initial, gint32 max, const gunichar2 *name)
Parameters
security: Ignored for now.initial: The initial count for the semaphore. The value must be
Remarks
greater than or equal to zero, and less than or equal to
max.
max: The maximum count for this semaphore. The value must be
greater than zero.
name: Pointer to a string specifying the name of this semaphore,
or %NULL. Currently ignored.
Creates a new semaphore handle. A semaphore is signalled when its
count is greater than zero, and unsignalled otherwise. The count
is decreased by one whenever a wait function releases a thread that
was waiting for the semaphore. The count is increased by calling
ReleaseSemaphore().
Return value: a new handle, or NULL
CreateThread
Prototype: CreateThread
DeleteCriticalSection
void DeleteCriticalSection(WapiCriticalSection *section)
Parameters
section: The critical section to delete.
Remarks
Releases all resources owned by critical section
section.
DeleteFile
gboolean DeleteFile(const gunichar2 *name)
Parameters
name: a pointer to a NULL-terminated unicode string, that names
Remarks
the file to be deleted.
Deletes file
name.
Return value: %TRUE on success, %FALSE otherwise.
DuplicateHandle
Prototype: DuplicateHandle
EnterCriticalSection
Prototype: EnterCriticalSection
EnumProcesses
Prototype: EnumProcesses
EnumProcessModules
Prototype: EnumProcessModules
errno_to_WSA
Prototype: errno_to_WSA
ExitThread
Prototype: ExitThread
FileTimeToSystemTime
gboolean FileTimeToSystemTime(const WapiFileTime *file_time,
WapiSystemTime *system_time)
Parameters
file_time: Points to a %WapiFileTime structure that contains the
Remarks
number of ticks to convert.
system_time: Points to a %WapiSystemTime structure to receive the
broken-out time.
Converts a tick count into broken-out time values.
Return value: %TRUE on success, %FALSE otherwise.
FindClose
gboolean FindClose (gpointer handle)
Parameters
wapi_handle: the find handle to close.
Remarks
Closes find handle
wapi_handle
Return value: %TRUE on success, %FALSE otherwise.
FindFirstFile
Prototype: FindFirstFile
FindNextFile
Prototype: FindNextFile
FlushFileBuffers
gboolean FlushFileBuffers(gpointer handle)
Parameters
handle: Handle to open file. The handle must have
Remarks
%GENERIC_WRITE access.
Flushes buffers of the file and causes all unwritten data to
be written.
Return value: %TRUE on success, %FALSE otherwise.
FormatMessage
Prototype: FormatMessage
GetCurrentDirectory
extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer)
Parameters
length: size of the bufferbuffer: pointer to buffer that recieves path
Remarks
Retrieves the current directory for the current process.
Return value: number of characters in buffer on success, zero on failure
GetCurrentProcess
Prototype: GetCurrentProcess
GetCurrentProcessId
Prototype: GetCurrentProcessId
GetCurrentThread
Prototype: GetCurrentThread
GetCurrentThreadId
gsize
GetCurrentThreadId (void)
Remarks
Looks up the thread ID of the current thread. This ID can be
passed to OpenThread() to create a new handle on this thread.
Return value: the thread ID. NB this is defined as DWORD (ie 32
bit) in the MS API, but we need to cope with 64 bit IDs for s390x
and amd64. This doesn't really break the API, it just embraces and
extends it on 64bit platforms :)
GetDiskFreeSpaceEx
Prototype: GetDiskFreeSpaceEx
GetDriveType
Prototype: GetDriveType
GetExitCodeProcess
Prototype: GetExitCodeProcess
GetExitCodeThread
Prototype: GetExitCodeThread
GetFileAttributesEx
gboolean GetFileAttributesEx (const gunichar2 *name, WapiGetFileExInfoLevels level, gpointer info)
Parameters
name: a pointer to a NULL-terminated unicode filename.level: must be GetFileExInfoStandardinfo: pointer to a WapiFileAttributesData structure
Remarks
Gets attributes, size and filetimes for
name;
Return value: %TRUE on success, %FALSE on failure
GetFileAttributes
guint32 GetFileAttributes (const gunichar2 *name)
Parameters
name: a pointer to a NULL-terminated unicode filename.
Remarks
Gets the attributes for
name;
Return value: %INVALID_FILE_ATTRIBUTES on failure
GetFileSize
guint32 GetFileSize(gpointer handle, guint32 *highsize)
Parameters
handle: The file handle to query. The handle must have
Remarks
%GENERIC_READ or %GENERIC_WRITE access.
highsize: If non-%NULL, the high 32 bits of the file size are
stored here.
Retrieves the size of the file
handle.
If the library is compiled without large file support,
highsize
has its value set to zero on a successful return.
Return value: On success, the low 32 bits of the file size. If
highsize is non-%NULL then the high 32 bits of the file size are
stored here. On failure %INVALID_FILE_SIZE is returned.
GetFileTime
gboolean GetFileTime(gpointer handle, WapiFileTime *create_time,
WapiFileTime *last_access, WapiFileTime *last_write)
Parameters
handle: The file handle to query. The handle must have
Remarks
%GENERIC_READ access.
create_time: Points to a %WapiFileTime structure to receive the
number of ticks since the epoch that file was created. May be
%NULL.
last_access: Points to a %WapiFileTime structure to receive the
number of ticks since the epoch when file was last accessed. May be
%NULL.
last_write: Points to a %WapiFileTime structure to receive the
number of ticks since the epoch when file was last written to. May
be %NULL.
Finds the number of ticks since the epoch that the file referenced
by
handle was created, last accessed and last modified. A tick is
a 100 nanosecond interval. The epoch is Midnight, January 1 1601
GMT.
Create time isn't recorded on POSIX file systems or reported by
stat(2), so that time is guessed by returning the oldest of the
other times.
Return value: %TRUE on success, %FALSE otherwise.
GetFileType
WapiFileType GetFileType(gpointer handle)
Parameters
handle: The file handle to test.
Remarks
Finds the type of file
handle.
Return value: %FILE_TYPE_UNKNOWN - the type of the file
handle is
unknown. %FILE_TYPE_DISK -
handle is a disk file.
%FILE_TYPE_CHAR -
handle is a character device, such as a console.
%FILE_TYPE_PIPE -
handle is a named or anonymous pipe.
GetFileVersionInfo
Prototype: GetFileVersionInfo
GetFileVersionInfoSize
Prototype: GetFileVersionInfoSize
GetLastError
guint32 GetLastError(void)
Remarks
Retrieves the last error that occurred in the calling thread.
Return value: The error code for the last error that happened on
the calling thread.
GetLogicalDriveStrings
Prototype: GetLogicalDriveStrings
GetModuleBaseName
Prototype: GetModuleBaseName
GetModuleFileNameEx
Prototype: GetModuleFileNameEx
GetModuleInformation
Prototype: GetModuleInformation
GetPriorityClass
Prototype: GetPriorityClass
GetProcessId
Prototype: GetProcessId
GetProcessTimes
Prototype: GetProcessTimes
GetProcessWorkingSetSize
Prototype: GetProcessWorkingSetSize
GetStdHandle
static mono_mutex_t stdhandle_mutex;
gpointer GetStdHandle(WapiStdHandle stdhandle)
Parameters
stdhandle: specifies the file descriptor
Remarks
Returns a handle for stdin, stdout, or stderr. Always returns the
same handle for the same
stdhandle.
Return value: the handle, or %INVALID_HANDLE_VALUE on error
GetSystemInfo
Prototype: GetSystemInfo
GetTempPath
Prototype: GetTempPath
GetThreadContext
Prototype: GetThreadContext
GetTickCount
Prototype: GetTickCount
ImpersonateLoggedOnUser
Prototype: ImpersonateLoggedOnUser
InitializeCriticalSectionAndSpinCount
gboolean InitializeCriticalSectionAndSpinCount(WapiCriticalSection *section,
guint32 spincount G_GNUC_UNUSED)
Parameters
section: The critical section to initialise.spincount: The spin count for this critical section. Not
Remarks
currently used.
Initialises a critical section and sets the spin count. This
implementation just calls InitializeCriticalSection().
Return value: %TRUE on success, %FALSE otherwise. (%FALSE never
happens).
InitializeCriticalSection
void InitializeCriticalSection(WapiCriticalSection *section)
Parameters
section: The critical section to initialise
Remarks
Initialises a critical section.
ioctlsocket
Prototype: ioctlsocket
LeaveCriticalSection
Prototype: LeaveCriticalSection
LockFile
Prototype: LockFile
MoveFile
gboolean MoveFile (const gunichar2 *name, const gunichar2 *dest_name)
Parameters
name: a pointer to a NULL-terminated unicode string, that names
Remarks
the file to be moved.
dest_name: a pointer to a NULL-terminated unicode string, that is the
new name for the file.
Renames file
name to
dest_name.
MoveFile sets ERROR_ALREADY_EXISTS if the destination exists, except
when it is the same file as the source. In that case it silently succeeds.
Return value: %TRUE on success, %FALSE otherwise.
OpenEvent
Prototype: OpenEvent
OpenMutex
Prototype: OpenMutex
OpenProcess
Prototype: OpenProcess
OpenSemaphore
Prototype: OpenSemaphore
OpenThread
Prototype: OpenThread
PulseEvent
gboolean PulseEvent(gpointer handle)
Parameters
handle: The event handle.
Remarks
Sets the event handle
handle to the signalled state, and then
resets it to unsignalled after informing any waiting threads.
If
handle is a manual reset event, all waiting threads that can be
released immediately are released.
handle is then reset. If
handle is an auto reset event, one waiting thread is released even
if multiple threads are waiting.
Return value: %TRUE on success, %FALSE otherwise. (Currently only
ever returns %TRUE).
QueryPerformanceCounter
Prototype: QueryPerformanceCounter
QueryPerformanceFrequency
Prototype: QueryPerformanceFrequency
QueueUserAPC
Prototype: QueueUserAPC
ReadFile
gboolean ReadFile(gpointer handle, gpointer buffer, guint32 numbytes,
guint32 *bytesread, WapiOverlapped *overlapped)
Parameters
handle: The file handle to read from. The handle must have
Remarks
%GENERIC_READ access.
buffer: The buffer to store read data in
numbytes: The maximum number of bytes to read
bytesread: The actual number of bytes read is stored here. This
value can be zero if the handle is positioned at the end of the
file.
overlapped: points to a required %WapiOverlapped structure if
handle has the %FILE_FLAG_OVERLAPPED option set, should be NULL
otherwise.
If
handle does not have the %FILE_FLAG_OVERLAPPED option set, this
function reads up to
numbytes bytes from the file from the current
file position, and stores them in
buffer. If there are not enough
bytes left in the file, just the amount available will be read.
The actual number of bytes read is stored in
bytesread.
If
handle has the %FILE_FLAG_OVERLAPPED option set, the current
file position is ignored and the read position is taken from data
in the
overlapped structure.
Return value: %TRUE if the read succeeds (even if no bytes were
read due to an attempt to read past the end of the file), %FALSE on
error.
ReleaseMutex
gboolean ReleaseMutex(gpointer handle)
Parameters
handle: The mutex handle.
Remarks
Releases ownership if the mutex handle
handle.
Return value: %TRUE on success, %FALSE otherwise. This function
fails if the calling thread does not own the mutex
handle.
ReleaseSemaphore
gboolean ReleaseSemaphore(gpointer handle, gint32 count, gint32 *prevcount)
Parameters
handle: The semaphore handle to release.count: The amount by which the semaphore's count should be
Remarks
increased.
prevcount: Pointer to a location to store the previous count of
the semaphore, or %NULL.
Increases the count of semaphore
handle by
count.
Return value: %TRUE on success, %FALSE otherwise.
RemoveDirectory
gboolean RemoveDirectory (const gunichar2 *name)
Parameters
name: a pointer to a NULL-terminated unicode string, that names
Remarks
the directory to be removed.
Removes directory
name
Return value: %TRUE on success, %FALSE otherwise.
ReplaceFile
Prototype: ReplaceFile
ResetEvent
gboolean ResetEvent(gpointer handle)
Parameters
handle: The event handle.
Remarks
Resets the event handle
handle to the unsignalled state.
Return value: %TRUE on success, %FALSE otherwise. (Currently only
ever returns %TRUE).
ResumeThread
Prototype: ResumeThread
RevertToSelf
Prototype: RevertToSelf
SetCriticalSectionSpinCount
guint32 SetCriticalSectionSpinCount(WapiCriticalSection *section G_GNUC_UNUSED, guint32 spincount G_GNUC_UNUSED)
Parameters
section: The critical section to setspincount: The new spin count for this critical section. Not
Remarks
currently used.
Sets the spin count for the critical section
section. The spin
count is currently ignored, and set to zero.
Return value: The previous spin count. (Currently always zero).
SetCurrentDirectory
extern gboolean SetCurrentDirectory (const gunichar2 *path)
Parameters
path: path to new directory
Remarks
Changes the directory path for the current process.
Return value: %TRUE on success, %FALSE on failure.
SetEndOfFile
gboolean SetEndOfFile(gpointer handle)
Parameters
handle: The file handle to set. The handle must have
Remarks
%GENERIC_WRITE access.
Moves the end-of-file position to the current position of the file
pointer. This function is used to truncate or extend a file.
Return value: %TRUE on success, %FALSE otherwise.
SetEvent
gboolean SetEvent(gpointer handle)
Parameters
handle: The event handle
Remarks
Sets the event handle
handle to the signalled state.
If
handle is a manual reset event, it remains signalled until it
is reset with ResetEvent(). An auto reset event remains signalled
until a single thread has waited for it, at which time
handle is
automatically reset to unsignalled.
Return value: %TRUE on success, %FALSE otherwise. (Currently only
ever returns %TRUE).
SetFileAttributes
extern gboolean SetFileAttributes (const gunichar2 *name, guint32 attrs)
Parameters
name: name of fileattrs: attributes to set
Remarks
Changes the attributes on a named file.
Return value: %TRUE on success, %FALSE on failure.
SetFilePointer
guint32 SetFilePointer(gpointer handle, gint32 movedistance,
gint32 *highmovedistance, WapiSeekMethod method)
Parameters
handle: The file handle to set. The handle must have
Remarks
%GENERIC_READ or %GENERIC_WRITE access.
movedistance: Low 32 bits of a signed value that specifies the
number of bytes to move the file pointer.
highmovedistance: Pointer to the high 32 bits of a signed value
that specifies the number of bytes to move the file pointer, or
%NULL.
method: The starting point for the file pointer move.
Sets the file pointer of an open file.
The distance to move the file pointer is calculated from
movedistance and
highmovedistance: If
highmovedistance is %NULL,
movedistance is the 32-bit signed value; otherwise,
movedistance
is the low 32 bits and
highmovedistance a pointer to the high 32
bits of a 64 bit signed value. A positive distance moves the file
pointer forward from the position specified by
method; a negative
distance moves the file pointer backward.
If the library is compiled without large file support,
highmovedistance is ignored and its value is set to zero on a
successful return.
Return value: On success, the low 32 bits of the new file pointer.
If
highmovedistance is not %NULL, the high 32 bits of the new file
pointer are stored there. On failure, %INVALID_SET_FILE_POINTER.
SetFileTime
gboolean SetFileTime(gpointer handle, const WapiFileTime *create_time,
const WapiFileTime *last_access,
const WapiFileTime *last_write)
Parameters
handle: The file handle to set. The handle must have
Remarks
%GENERIC_WRITE access.
create_time: Points to a %WapiFileTime structure that contains the
number of ticks since the epoch that the file was created. May be
%NULL.
last_access: Points to a %WapiFileTime structure that contains the
number of ticks since the epoch when the file was last accessed.
May be %NULL.
last_write: Points to a %WapiFileTime structure that contains the
number of ticks since the epoch when the file was last written to.
May be %NULL.
Sets the number of ticks since the epoch that the file referenced
by
handle was created, last accessed or last modified. A tick is
a 100 nanosecond interval. The epoch is Midnight, January 1 1601
GMT.
Create time isn't recorded on POSIX file systems, and is ignored.
Return value: %TRUE on success, %FALSE otherwise.
SetLastError
void SetLastError(guint32 code)
Parameters
code: The error code.
Remarks
Sets the error code in the calling thread.
SetPriorityClass
Prototype: SetPriorityClass
SetProcessWorkingSetSize
Prototype: SetProcessWorkingSetSize
ShellExecuteEx
Prototype: ShellExecuteEx
SignalObjectAndWait
guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
guint32 timeout, gboolean alertable)
Parameters
signal_handle: An object to signalwait: An object to wait fortimeout: The maximum time in milliseconds to wait foralertable: Specifies whether the function returnes when the system
Remarks
queues an I/O completion routine or an APC for the calling thread.
Atomically signals
signal and waits for
wait to become signalled,
or
timeout ms elapses. If
timeout is zero, the object's state is
tested and the function returns immediately. If
timeout is
%INFINITE, the function waits forever.
signal can be a semaphore, mutex or event object.
If
alertable is %TRUE and the system queues an I/O completion
routine or an APC for the calling thread, the function returns and
the thread calls the completion routine or APC function. If
%FALSE, the function does not return, and the thread does not call
the completion routine or APC function. A completion routine is
queued when the ReadFileEx() or WriteFileEx() function in which it
was specified has completed. The calling thread is the thread that
initiated the read or write operation. An APC is queued when
QueueUserAPC() is called. Currently completion routines and APC
functions are not supported.
Return value: %WAIT_ABANDONED -
wait is a mutex that was not
released by the owning thread when it exited. Ownershop of the
mutex object is granted to the calling thread and the mutex is set
to nonsignalled. %WAIT_IO_COMPLETION - the wait was ended by one
or more user-mode asynchronous procedure calls queued to the
thread. %WAIT_OBJECT_0 - The state of
wait is signalled.
%WAIT_TIMEOUT - The
timeout interval elapsed and
wait's state is
still not signalled. %WAIT_FAILED - an error occurred.
SleepEx
guint32
SleepEx (guint32 ms, gboolean alertable)
Parameters
ms: The time in milliseconds to suspend foralertable: if TRUE, the wait can be interrupted by an APC call
Remarks
Suspends execution of the current thread for
ms milliseconds. A
value of zero causes the thread to relinquish its time slice. A
value of %INFINITE causes an infinite delay.
SuspendThread
Prototype: SuspendThread
TerminateProcess
Prototype: TerminateProcess
TlsAlloc
Prototype: TlsAlloc
TlsFree
Prototype: TlsFree
TlsGetValue
Prototype: TlsGetValue
TlsSetValue
Prototype: TlsSetValue
TransmitFile
Prototype: TransmitFile
TryEnterCriticalSection
gboolean TryEnterCriticalSection(WapiCriticalSection *section)
Parameters
section: The critical section to try and enter
Remarks
Attempts to enter a critical section without blocking. If
successful the calling thread takes ownership of the critical
section.
A thread can recursively call EnterCriticalSection() and
TryEnterCriticalSection(), but must call LeaveCriticalSection() an
equal number of times.
Return value: %TRUE if the thread successfully locked the critical
section, %FALSE otherwise.
UnlockFile
Prototype: UnlockFile
VerLanguageName
Prototype: VerLanguageName
VerQueryValue
Prototype: VerQueryValue
WaitForInputIdle
guint32 WaitForInputIdle(gpointer handle, guint32 timeout)
Parameters
handle: a handle to the process to wait fortimeout: the maximum time in milliseconds to wait for
Remarks
This function returns when either
handle process is waiting
for input, or
timeout ms elapses. If
timeout is zero, the
process state is tested and the function returns immediately.
If
timeout is %INFINITE, the function waits forever.
Return value: 0 -
handle process is waiting for input.
%WAIT_TIMEOUT - The
timeout interval elapsed and
handle process is not waiting for input. %WAIT_FAILED - an error
occurred.
WaitForMultipleObjectsEx
guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
gboolean waitall, guint32 timeout,
gboolean alertable)
Parameters
numobjects: The number of objects in handles. The maximum allowed
Remarks
is %MAXIMUM_WAIT_OBJECTS.
handles: An array of object handles. Duplicates are not allowed.
waitall: If %TRUE, this function waits until all of the handles
are signalled. If %FALSE, this function returns when any object is
signalled.
timeout: The maximum time in milliseconds to wait for.
alertable: if TRUE, the wait can be interrupted by an APC call
This function returns when either one or more of
handles is
signalled, or
timeout ms elapses. If
timeout is zero, the state
of each item of
handles is tested and the function returns
immediately. If
timeout is %INFINITE, the function waits forever.
Return value: %WAIT_OBJECT_0 to %WAIT_OBJECT_0 +
numobjects - 1 -
if
waitall is %TRUE, indicates that all objects are signalled. If
waitall is %FALSE, the return value minus %WAIT_OBJECT_0 indicates
the first index into
handles of the objects that are signalled.
%WAIT_ABANDONED_0 to %WAIT_ABANDONED_0 +
numobjects - 1 - if
waitall is %TRUE, indicates that all objects are signalled, and at
least one object is an abandoned mutex object (See
WaitForSingleObject() for a description of abandoned mutexes.) If
waitall is %FALSE, the return value minus %WAIT_ABANDONED_0
indicates the first index into
handles of an abandoned mutex.
%WAIT_TIMEOUT - The
timeout interval elapsed and no objects in
handles are signalled. %WAIT_FAILED - an error occurred.
%WAIT_IO_COMPLETION - the wait was ended by an APC.
WaitForMultipleObjects
Prototype: WaitForMultipleObjects
WaitForSingleObjectEx
guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
gboolean alertable)
Parameters
handle: an object to wait fortimeout: the maximum time in milliseconds to wait foralertable: if TRUE, the wait can be interrupted by an APC call
Remarks
This function returns when either
handle is signalled, or
timeout
ms elapses. If
timeout is zero, the object's state is tested and
the function returns immediately. If
timeout is %INFINITE, the
function waits forever.
Return value: %WAIT_ABANDONED -
handle is a mutex that was not
released by the owning thread when it exited. Ownership of the
mutex object is granted to the calling thread and the mutex is set
to nonsignalled. %WAIT_OBJECT_0 - The state of
handle is
signalled. %WAIT_TIMEOUT - The
timeout interval elapsed and
handle's state is still not signalled. %WAIT_FAILED - an error
occurred. %WAIT_IO_COMPLETION - the wait was ended by an APC.
WaitForSingleObject
Prototype: WaitForSingleObject
WriteFile
gboolean WriteFile(gpointer handle, gconstpointer buffer, guint32 numbytes,
guint32 *byteswritten, WapiOverlapped *overlapped)
Parameters
handle: The file handle to write to. The handle must have
Remarks
%GENERIC_WRITE access.
buffer: The buffer to read data from.
numbytes: The maximum number of bytes to write.
byteswritten: The actual number of bytes written is stored here.
If the handle is positioned at the file end, the length of the file
is extended. This parameter may be %NULL.
overlapped: points to a required %WapiOverlapped structure if
handle has the %FILE_FLAG_OVERLAPPED option set, should be NULL
otherwise.
If
handle does not have the %FILE_FLAG_OVERLAPPED option set, this
function writes up to
numbytes bytes from
buffer to the file at
the current file position. If
handle is positioned at the end of
the file, the file is extended. The actual number of bytes written
is stored in
byteswritten.
If
handle has the %FILE_FLAG_OVERLAPPED option set, the current
file position is ignored and the write position is taken from data
in the
overlapped structure.
Return value: %TRUE if the write succeeds, %FALSE on error.
WSACleanup
Prototype: WSACleanup
WSAGetLastError
Prototype: WSAGetLastError
WSAIoctl
Prototype: WSAIoctl
WSARecv
Prototype: WSARecv
WSASend
Prototype: WSASend
WSASetLastError
Prototype: WSASetLastError
WSAStartup
Prototype: WSAStartup
Extended APIs
The extended APIs provide access to a few internals of the
WAPI stack that are not exposed through the standard Win32
APIs.
mono_once
Prototype: mono_once
wapi_clear_interruption
Prototype: wapi_clear_interruption
wapi_current_thread_desc
Prototype: wapi_current_thread_desc
wapi_interrupt_thread
Prototype: wapi_interrupt_thread
wapi_self_interrupt
Prototype: wapi_self_interrupt
wapi_thread_clear_wait_handle
void
wapi_thread_clear_wait_handle (gpointer handle)
Remarks
Clear the wait handle of the current thread.