windows.ch

Declarations

Public Only
Publictypealias INT_PTR
type INT_PTR = i64
Publictypealias PINT_PTR
type PINT_PTR = *INT_PTR
Publictypealias UINT_PTR
type UINT_PTR = u64
Publictypealias PUINT_PTR
type PUINT_PTR = *UINT_PTR
Publictypealias LONG_PTR
type LONG_PTR = i64
Publictypealias PLONG_PTR
type PLONG_PTR = *LONG_PTR
Publictypealias ULONG_PTR
type ULONG_PTR = u64
Publictypealias PULONG_PTR
type PULONG_PTR = *ULONG_PTR
Publictypealias usize
type usize = u64
TODO: verify these
Publictypealias UINT
type UINT = uint
Publictypealias HANDLE
type HANDLE = *void
@brief Windows handle type.
Publictypealias HMODULE
type HMODULE = HANDLE
@brief Module handle.
Publictypealias HINSTANCE
type HINSTANCE = HANDLE
@brief Instance handle.
Publictypealias FARPROC
type FARPROC = *void
@brief Pointer to procedure.
Publictypealias HKEY
type HKEY = HANDLE
@brief Handle to Registry Key.
Publictypealias BOOL
type BOOL = int
@brief Boolean: nonzero is TRUE, zero is FALSE.
Publictypealias BYTE
type BYTE = uchar
@brief Unsigned 8-bit integer.
Publictypealias WORD
type WORD = ushort
@brief 16-bit unsigned integer.
Publictypealias DWORD
type DWORD = ulong
@brief 32-bit unsigned integer.
Publictypealias LONG
type LONG = int32_t
@brief Signed 32-bit integer.
Publictypealias LONGLONG
type LONGLONG = i64
@brief 64-bit signed integer.
Publictypealias ULONGLONG
type ULONGLONG = u64
@brief 64-bit unsigned integer.
Publictypealias SIZE_T
type SIZE_T = usize
@brief Pointer-sized unsigned integer.
Publictypealias LPVOID
type LPVOID = *void
@brief Generic pointer.
Publictypealias PVOID
type PVOID = *void
@brief Pointer to void
Publictypealias LPCVOID
type LPCVOID = *void
@brief Pointer to constant data.
Publictypealias LPSTR
type LPSTR = *char
@brief Pointer to CHAR string.
Publictypealias LPCSTR
type LPCSTR = *char
@brief Pointer to constant CHAR string.
Publictypealias LPWSTR
type LPWSTR = *ushort
@brief Pointer to WCHAR string.
Publictypealias LPCWSTR
type LPCWSTR = *ushort
@brief Pointer to constant WCHAR string.
Publictypealias LPDWORD
type LPDWORD = *DWORD
@brief Pointer to DWORD.
Publicunion LARGE_INTEGER
union LARGE_INTEGER
@struct LARGE_INTEGER @brief 64-bit signed integer value. Can be accessed as a whole or parts.
Publicunion _ULARGE_INTEGER
union _ULARGE_INTEGER
@struct ULARGE_INTEGER @brief 64-bit unsigned integer value. Can be accessed as a whole or parts.
Publictypealias ULARGE_INTEGER
type ULARGE_INTEGER = _ULARGE_INTEGER
Publictypealias PULARGE_INTEGER
type PULARGE_INTEGER = *ULARGE_INTEGER
Publicstruct SECURITY_ATTRIBUTES
struct SECURITY_ATTRIBUTES
@struct SECURITY_ATTRIBUTES @brief Security attributes for object creation.
Publicstruct OVERLAPPED
struct OVERLAPPED
@struct OVERLAPPED @brief Overlapped I/O structure.
Publicstruct SYSTEMTIME
struct SYSTEMTIME
@struct SYSTEMTIME @brief Date and time in human-readable form.
Publicstruct FILETIME
struct FILETIME
@struct FILETIME @brief 64-bit value representing 100-nanosecond intervals since January 1, 1601.
Publicstruct WIN32_FIND_DATAA
struct WIN32_FIND_DATAA
@struct WIN32_FIND_DATAA @brief Data returned by FindFirstFileA/FindNextFileA.
Publicstruct STARTUPINFOA
struct STARTUPINFOA
--- Added missing STARTUPINFOA and PROCESS_INFORMATION structs ---
Publicstruct PROCESS_INFORMATION
struct PROCESS_INFORMATION
@struct PROCESS_INFORMATION @brief Contains information about a newly created process and its primary thread.
Publicfunction GetLastError
func GetLastError() : DWORD
@brief Retrieves the calling thread's last-error code value.

Returns

The calling thread's last-error code.

Publicfunction SetLastError
func SetLastError(dwErrCode : DWORD) : void
@brief Sets the calling thread's last-error code value.

Parameters

  • dwErrCode The new error code.
Publicfunction CreateFileA
func CreateFileA(lpFileName : LPCSTR, dwDesiredAccess : DWORD, dwShareMode : DWORD, lpSecurityAttributes : *SECURITY_ATTRIBUTES, dwCreationDisposition : DWORD, dwFlagsAndAttributes : DWORD, hTemplateFile : HANDLE) : HANDLE
@brief Creates or opens a file or I/O device.

Parameters

  • lpFileName Path to file or device. @param dwDesiredAccess Access mode flags. @param dwShareMode Share mode flags. @param lpSecurityAttributes Optional security attributes. @param dwCreationDisposition Action to take on files that exist or do not exist. @param dwFlagsAndAttributes File attributes and flags. @param hTemplateFile Handle to template file. @return Handle to the file or device, or INVALID_HANDLE_VALUE on error.
  • dwDesiredAccess Access mode flags. @param dwShareMode Share mode flags. @param lpSecurityAttributes Optional security attributes. @param dwCreationDisposition Action to take on files that exist or do not exist. @param dwFlagsAndAttributes File attributes and flags. @param hTemplateFile Handle to template file. @return Handle to the file or device, or INVALID_HANDLE_VALUE on error.
  • dwShareMode Share mode flags. @param lpSecurityAttributes Optional security attributes. @param dwCreationDisposition Action to take on files that exist or do not exist. @param dwFlagsAndAttributes File attributes and flags. @param hTemplateFile Handle to template file. @return Handle to the file or device, or INVALID_HANDLE_VALUE on error.
  • lpSecurityAttributes Optional security attributes. @param dwCreationDisposition Action to take on files that exist or do not exist. @param dwFlagsAndAttributes File attributes and flags. @param hTemplateFile Handle to template file. @return Handle to the file or device, or INVALID_HANDLE_VALUE on error.
  • dwCreationDisposition Action to take on files that exist or do not exist. @param dwFlagsAndAttributes File attributes and flags. @param hTemplateFile Handle to template file. @return Handle to the file or device, or INVALID_HANDLE_VALUE on error.
  • dwFlagsAndAttributes File attributes and flags. @param hTemplateFile Handle to template file. @return Handle to the file or device, or INVALID_HANDLE_VALUE on error.
  • hTemplateFile Handle to template file. @return Handle to the file or device, or INVALID_HANDLE_VALUE on error.

Returns

Handle to the file or device, or INVALID_HANDLE_VALUE on error.

Publicfunction ReadFile
func ReadFile(hFile : HANDLE, lpBuffer : LPVOID, nNumberOfBytesToRead : DWORD, lpNumberOfBytesRead : *DWORD, lpOverlapped : *OVERLAPPED) : BOOL
@brief Reads data from a file, starting at the position indicated by the file pointer.

Parameters

  • hFile Handle to file. @param lpBuffer Buffer to receive data. @param nNumberOfBytesToRead Number of bytes to read. @param lpNumberOfBytesRead Out param for number of bytes read. @param lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.
  • lpBuffer Buffer to receive data. @param nNumberOfBytesToRead Number of bytes to read. @param lpNumberOfBytesRead Out param for number of bytes read. @param lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.
  • nNumberOfBytesToRead Number of bytes to read. @param lpNumberOfBytesRead Out param for number of bytes read. @param lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.
  • lpNumberOfBytesRead Out param for number of bytes read. @param lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.
  • lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction WriteFile
func WriteFile(hFile : HANDLE, lpBuffer : LPCVOID, nNumberOfBytesToWrite : DWORD, lpNumberOfBytesWritten : *DWORD, lpOverlapped : *OVERLAPPED) : BOOL
@brief Writes data to a file at the position indicated by the file pointer.

Parameters

  • hFile Handle to file. @param lpBuffer Buffer containing data to write. @param nNumberOfBytesToWrite Number of bytes to write. @param lpNumberOfBytesWritten Out param for number of bytes written. @param lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.
  • lpBuffer Buffer containing data to write. @param nNumberOfBytesToWrite Number of bytes to write. @param lpNumberOfBytesWritten Out param for number of bytes written. @param lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.
  • nNumberOfBytesToWrite Number of bytes to write. @param lpNumberOfBytesWritten Out param for number of bytes written. @param lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.
  • lpNumberOfBytesWritten Out param for number of bytes written. @param lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.
  • lpOverlapped Optional overlapped structure. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction CloseHandle
func CloseHandle(hObject : HANDLE) : BOOL
@brief Closes an open object handle.

Parameters

  • hObject Handle to be closed. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction CopyFileA
func CopyFileA(lpExistingFileName : LPCSTR, lpNewFileName : LPCSTR, bFailIfExists : BOOL) : BOOL
@brief Copies an existing file to a new file.

Parameters

  • lpExistingFileName Name of the existing file. @param lpNewFileName Name of the new file. @param bFailIfExists If TRUE and the new file exists, the function fails. If FALSE and the new file exists, the function overwrites it. @return Nonzero on success, zero on failure.
  • lpNewFileName Name of the new file. @param bFailIfExists If TRUE and the new file exists, the function fails. If FALSE and the new file exists, the function overwrites it. @return Nonzero on success, zero on failure.
  • bFailIfExists If TRUE and the new file exists, the function fails. If FALSE and the new file exists, the function overwrites it. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction MoveFileA
func MoveFileA(lpExistingFileName : LPCSTR, lpNewFileName : LPCSTR) : BOOL
@brief Moves an existing file or directory, including its children.

Parameters

  • lpExistingFileName The current name of the file or directory. @param lpNewFileName The new name for the file or directory. @return Nonzero on success, zero on failure.
  • lpNewFileName The new name for the file or directory. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction GetFileSizeEx
func GetFileSizeEx(hFile : HANDLE, lpFileSize : *LARGE_INTEGER) : BOOL
@brief Retrieves the size of the specified file.

Parameters

  • hFile Handle to the file. @param lpFileSize Out param for the file size (64-bit). @return Nonzero on success, zero on failure.
  • lpFileSize Out param for the file size (64-bit). @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction SetFilePointerEx
func SetFilePointerEx(hFile : HANDLE, liDistanceToMove : LARGE_INTEGER, lpNewFilePointer : *LARGE_INTEGER, dwMoveMethod : DWORD) : BOOL
@brief Sets the file pointer of the specified file.

Parameters

  • hFile Handle to the file. @param liDistanceToMove The number of bytes to move the file pointer. @param lpNewFilePointer Optional out param for the new file pointer. @param dwMoveMethod The starting point for the file pointer move (FILE_BEGIN, FILE_CURRENT, FILE_END). @return Nonzero on success, zero on failure.
  • liDistanceToMove The number of bytes to move the file pointer. @param lpNewFilePointer Optional out param for the new file pointer. @param dwMoveMethod The starting point for the file pointer move (FILE_BEGIN, FILE_CURRENT, FILE_END). @return Nonzero on success, zero on failure.
  • lpNewFilePointer Optional out param for the new file pointer. @param dwMoveMethod The starting point for the file pointer move (FILE_BEGIN, FILE_CURRENT, FILE_END). @return Nonzero on success, zero on failure.
  • dwMoveMethod The starting point for the file pointer move (FILE_BEGIN, FILE_CURRENT, FILE_END). @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction GetFileAttributesA
func GetFileAttributesA(lpFileName : LPCSTR) : DWORD
@brief Retrieves file system attributes for a specified file or directory.

Parameters

  • lpFileName The name of the file or directory. @return The attributes of the file or directory, or INVALID_FILE_ATTRIBUTES on failure.

Returns

The attributes of the file or directory, or INVALID_FILE_ATTRIBUTES on failure.

Publicfunction SetFileAttributesA
func SetFileAttributesA(lpFileName : LPCSTR, dwFileAttributes : DWORD) : BOOL
@brief Sets the attributes for a file or directory.

Parameters

  • lpFileName The name of the file or directory. @param dwFileAttributes The file attributes to set. @return Nonzero on success, zero on failure.
  • dwFileAttributes The file attributes to set. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction GetFullPathNameA
func GetFullPathNameA(lpFileName : LPCSTR, nBufferLength : DWORD, lpBuffer : LPSTR, lpFilePart : *LPSTR) : DWORD
@brief Retrieves the full path and file name of the specified file.

Parameters

  • lpFileName The name of the file. @param nBufferLength The size of the buffer for the path. @param lpBuffer Buffer that receives the null-terminated path. @param lpFilePart Optional out param pointer that receives the address of the file name component in the path. @return Length of the string copied to lpBuffer (excluding null terminator), or 0 on failure.
  • nBufferLength The size of the buffer for the path. @param lpBuffer Buffer that receives the null-terminated path. @param lpFilePart Optional out param pointer that receives the address of the file name component in the path. @return Length of the string copied to lpBuffer (excluding null terminator), or 0 on failure.
  • lpBuffer Buffer that receives the null-terminated path. @param lpFilePart Optional out param pointer that receives the address of the file name component in the path. @return Length of the string copied to lpBuffer (excluding null terminator), or 0 on failure.
  • lpFilePart Optional out param pointer that receives the address of the file name component in the path. @return Length of the string copied to lpBuffer (excluding null terminator), or 0 on failure.

Returns

Length of the string copied to lpBuffer (excluding null terminator), or 0 on failure.

Publicfunction GetCurrentDirectoryA
func GetCurrentDirectoryA(nBufferLength : DWORD, lpBuffer : LPSTR) : DWORD
@brief Retrieves the current directory for the current process.

Parameters

  • nBufferLength The length of the buffer for the current directory string, in characters. @param lpBuffer Pointer to the buffer that receives the null-terminated current directory string. @return If successful, the return value specifies the length of the string written to the buffer, not including the terminating null character. If fails, returns 0.
  • lpBuffer Pointer to the buffer that receives the null-terminated current directory string. @return If successful, the return value specifies the length of the string written to the buffer, not including the terminating null character. If fails, returns 0.

Returns

If successful, the return value specifies the length of the string written to the buffer, not including the terminating null character. If fails, returns 0.

Publicfunction SetCurrentDirectoryA
func SetCurrentDirectoryA(lpPathName : LPCSTR) : BOOL
@brief Changes the current directory for the current process.

Parameters

  • lpPathName The path to the new current directory. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction LoadLibraryA
func LoadLibraryA(lpLibFileName : LPCSTR) : HMODULE
@brief Loads the specified module into the address space of the calling process.

Parameters

  • lpLibFileName Path to the module. @return Handle to the module, or NULL on failure.

Returns

Handle to the module, or NULL on failure.

Publicfunction FreeLibrary
func FreeLibrary(hLibModule : HMODULE) : BOOL
@brief Frees the loaded dynamic-link library (DLL) module and, if necessary, decrements its reference count.

Parameters

  • hLibModule A handle to the loaded library module. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction GetProcAddress
func GetProcAddress(hModule : HMODULE, lpProcName : LPCSTR) : FARPROC
@brief Retrieves the address of an exported function or variable from the specified DLL.

Parameters

  • hModule Handle to the DLL module. @param lpProcName Name of the function or variable. @return FARPROC pointer to the function or variable, or NULL on failure.
  • lpProcName Name of the function or variable. @return FARPROC pointer to the function or variable, or NULL on failure.

Returns

FARPROC pointer to the function or variable, or NULL on failure.

Publicfunction VirtualAlloc
func VirtualAlloc(lpAddress : LPVOID, dwSize : SIZE_T, flAllocationType : DWORD, flProtect : DWORD) : LPVOID
@brief Allocates memory in the virtual address space of the calling process.

Parameters

  • lpAddress Desired starting address (optional). @param dwSize Size of the region. @param flAllocationType Allocation type flags. @param flProtect Memory protection flags. @return Pointer to the allocated memory, or NULL on failure.
  • dwSize Size of the region. @param flAllocationType Allocation type flags. @param flProtect Memory protection flags. @return Pointer to the allocated memory, or NULL on failure.
  • flAllocationType Allocation type flags. @param flProtect Memory protection flags. @return Pointer to the allocated memory, or NULL on failure.
  • flProtect Memory protection flags. @return Pointer to the allocated memory, or NULL on failure.

Returns

Pointer to the allocated memory, or NULL on failure.

Publicfunction VirtualFree
func VirtualFree(lpAddress : LPVOID, dwSize : SIZE_T, dwFreeType : DWORD) : BOOL
@brief Frees memory that was allocated by VirtualAlloc.

Parameters

  • lpAddress Base address of the region. @param dwSize Must be 0 if MEM_RELEASE is used. @param dwFreeType Memory free type flags. @return Nonzero on success, zero on failure.
  • dwSize Must be 0 if MEM_RELEASE is used. @param dwFreeType Memory free type flags. @return Nonzero on success, zero on failure.
  • dwFreeType Memory free type flags. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction Sleep
func Sleep(dwMilliseconds : DWORD) : void
@brief Causes the calling thread to sleep for a specified interval.

Parameters

  • dwMilliseconds Time-out interval, in milliseconds.
Publicfunction ExitProcess
func ExitProcess(uExitCode : UINT) : void
@brief Terminates the calling process and returns an exit code.

Parameters

  • uExitCode The exit code for the process.
Publicfunction MessageBoxA
func MessageBoxA(hWnd : HANDLE, lpText : LPCSTR, lpCaption : LPCSTR, uType : DWORD) : int
@brief Displays a modal dialog box that contains a system icon, a set of buttons, and a brief application-generated message, optionally including a title.

Parameters

  • hWnd Handle to owner window. @param lpText Message to display. @param lpCaption Dialog box title. @param uType Dialog box style and button flags. @return Button identifier the user clicked.
  • lpText Message to display. @param lpCaption Dialog box title. @param uType Dialog box style and button flags. @return Button identifier the user clicked.
  • lpCaption Dialog box title. @param uType Dialog box style and button flags. @return Button identifier the user clicked.
  • uType Dialog box style and button flags. @return Button identifier the user clicked.

Returns

Button identifier the user clicked.

Publicfunction FindFirstFileA
func FindFirstFileA(lpFileName : LPCSTR, lpFindFileData : *WIN32_FIND_DATAA) : HANDLE
@brief Begins a file search.

Parameters

  • lpFileName Path with wildcards. @param lpFindFileData Out param for find data. @return Search handle or INVALID_HANDLE_VALUE on error.
  • lpFindFileData Out param for find data. @return Search handle or INVALID_HANDLE_VALUE on error.

Returns

Search handle or INVALID_HANDLE_VALUE on error.

Publicfunction FindNextFileA
func FindNextFileA(hFindFile : HANDLE, lpFindFileData : *WIN32_FIND_DATAA) : BOOL
@brief Continues a file search.

Parameters

  • hFindFile Handle from FindFirstFileA. @param lpFindFileData Out param for next data. @return Nonzero on success, zero on failure/end.
  • lpFindFileData Out param for next data. @return Nonzero on success, zero on failure/end.

Returns

Nonzero on success, zero on failure/end.

Publicfunction FindClose
func FindClose(hFindFile : HANDLE) : BOOL
@brief Closes a search handle.

Parameters

  • hFindFile Handle to close. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction CreateDirectoryA
func CreateDirectoryA(lpPathName : LPCSTR, lpSecurityAttributes : *SECURITY_ATTRIBUTES) : BOOL
@brief Creates a directory.

Parameters

  • lpPathName Path to the directory. @param lpSecurityAttributes Optional security attributes. @return Nonzero on success, zero on failure.
  • lpSecurityAttributes Optional security attributes. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction RemoveDirectoryA
func RemoveDirectoryA(lpPathName : LPCSTR) : BOOL
@brief Removes an existing empty directory.

Parameters

  • lpPathName Path to the directory. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction DeleteFileA
func DeleteFileA(lpFileName : LPCSTR) : BOOL
@brief Deletes an existing file.

Parameters

  • lpFileName Path to the file. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction GetStdHandle
func GetStdHandle(nStdHandle : DWORD) : HANDLE
@brief Retrieves a handle to the specified standard device (standard input, standard output, or standard error).

Parameters

  • nStdHandle The standard device (STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, or STD_ERROR_HANDLE). @return Handle to the specified device, or INVALID_HANDLE_VALUE on error.

Returns

Handle to the specified device, or INVALID_HANDLE_VALUE on error.

Publicfunction GetSystemTime
func GetSystemTime(lpSystemTime : *SYSTEMTIME) : void
@brief Retrieves the current system date and time in Coordinated Universal Time (UTC).

Parameters

  • lpSystemTime Pointer to a SYSTEMTIME structure to receive the current system date and time.
Publicfunction GetLocalTime
func GetLocalTime(lpLocalTime : *SYSTEMTIME) : void
@brief Retrieves the current local date and time.

Parameters

  • lpLocalTime Pointer to a SYSTEMTIME structure to receive the current local date and time.
Publicfunction FileTimeToSystemTime
func FileTimeToSystemTime(lpFileTime : *FILETIME, lpSystemTime : *SYSTEMTIME) : BOOL
@brief Converts a file time to system time format.

Parameters

  • lpFileTime Pointer to a FILETIME structure containing the file time to be converted. @param lpSystemTime Pointer to a SYSTEMTIME structure to receive the converted system time. @return Nonzero on success, zero on failure.
  • lpSystemTime Pointer to a SYSTEMTIME structure to receive the converted system time. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction SystemTimeToFileTime
func SystemTimeToFileTime(lpSystemTime : *SYSTEMTIME, lpFileTime : *FILETIME) : BOOL
@brief Converts a system time to file time format.

Parameters

  • lpSystemTime Pointer to a SYSTEMTIME structure containing the system time to be converted. @param lpFileTime Pointer to a FILETIME structure to receive the converted file time. @return Nonzero on success, zero on failure.
  • lpFileTime Pointer to a FILETIME structure to receive the converted file time. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction GetCurrentProcessId
func GetCurrentProcessId() : DWORD
@brief Retrieves the process identifier of the calling process.

Returns

The process identifier of the calling process.

Publicfunction GetCurrentThreadId
func GetCurrentThreadId() : DWORD
@brief Retrieves the thread identifier of the calling thread.

Returns

The thread identifier of the calling thread.

Publicfunction CreateProcessA
func CreateProcessA(lpApplicationName : LPCSTR, lpCommandLine : LPSTR, lpProcessAttributes : *SECURITY_ATTRIBUTES, lpThreadAttributes : *SECURITY_ATTRIBUTES, bInheritHandles : BOOL, dwCreationFlags : DWORD, lpEnvironment : LPVOID, lpCurrentDirectory : LPCSTR, lpStartupInfo : *STARTUPINFOA, lpProcessInformation : *PROCESS_INFORMATION) : BOOL
@brief Creates a new process and its primary thread.

Parameters

  • lpApplicationName Module name (optional, use NULL and set lpCommandLine). @param lpCommandLine Command line to execute (mutable because the function might modify it). @param lpProcessAttributes Security attributes for the process (optional). @param lpThreadAttributes Security attributes for the thread (optional). @param bInheritHandles If TRUE, handles from the calling process are inherited. @param dwCreationFlags Flags controlling priority class and creation (e.g., CREATE_NEW_CONSOLE). @param lpEnvironment Environment block for the new process (optional). @param lpCurrentDirectory Full path to the current directory for the process (optional). @param lpStartupInfo Pointer to a STARTUPINFOA structure. @param lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.
  • lpCommandLine Command line to execute (mutable because the function might modify it). @param lpProcessAttributes Security attributes for the process (optional). @param lpThreadAttributes Security attributes for the thread (optional). @param bInheritHandles If TRUE, handles from the calling process are inherited. @param dwCreationFlags Flags controlling priority class and creation (e.g., CREATE_NEW_CONSOLE). @param lpEnvironment Environment block for the new process (optional). @param lpCurrentDirectory Full path to the current directory for the process (optional). @param lpStartupInfo Pointer to a STARTUPINFOA structure. @param lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.
  • lpProcessAttributes Security attributes for the process (optional). @param lpThreadAttributes Security attributes for the thread (optional). @param bInheritHandles If TRUE, handles from the calling process are inherited. @param dwCreationFlags Flags controlling priority class and creation (e.g., CREATE_NEW_CONSOLE). @param lpEnvironment Environment block for the new process (optional). @param lpCurrentDirectory Full path to the current directory for the process (optional). @param lpStartupInfo Pointer to a STARTUPINFOA structure. @param lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.
  • lpThreadAttributes Security attributes for the thread (optional). @param bInheritHandles If TRUE, handles from the calling process are inherited. @param dwCreationFlags Flags controlling priority class and creation (e.g., CREATE_NEW_CONSOLE). @param lpEnvironment Environment block for the new process (optional). @param lpCurrentDirectory Full path to the current directory for the process (optional). @param lpStartupInfo Pointer to a STARTUPINFOA structure. @param lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.
  • bInheritHandles If TRUE, handles from the calling process are inherited. @param dwCreationFlags Flags controlling priority class and creation (e.g., CREATE_NEW_CONSOLE). @param lpEnvironment Environment block for the new process (optional). @param lpCurrentDirectory Full path to the current directory for the process (optional). @param lpStartupInfo Pointer to a STARTUPINFOA structure. @param lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.
  • dwCreationFlags Flags controlling priority class and creation (e.g., CREATE_NEW_CONSOLE). @param lpEnvironment Environment block for the new process (optional). @param lpCurrentDirectory Full path to the current directory for the process (optional). @param lpStartupInfo Pointer to a STARTUPINFOA structure. @param lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.
  • lpEnvironment Environment block for the new process (optional). @param lpCurrentDirectory Full path to the current directory for the process (optional). @param lpStartupInfo Pointer to a STARTUPINFOA structure. @param lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.
  • lpCurrentDirectory Full path to the current directory for the process (optional). @param lpStartupInfo Pointer to a STARTUPINFOA structure. @param lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.
  • lpStartupInfo Pointer to a STARTUPINFOA structure. @param lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.
  • lpProcessInformation Pointer to a PROCESS_INFORMATION structure receiving identification information about the new process. @return Nonzero on success, zero on failure.

Returns

Nonzero on success, zero on failure.

Publicfunction RegOpenKeyExA
func RegOpenKeyExA(hKey : HKEY, lpSubKey : LPCSTR, ulOptions : DWORD, samDesired : DWORD, phkResult : *HKEY) : LONG
@brief Opens the specified registry key.

Parameters

  • hKey A handle to an open registry key (e.g., HKEY_LOCAL_MACHINE) or predefined handle. @param lpSubKey The name of the registry subkey to be opened. @param ulOptions Reserved, must be zero. @param samDesired A mask that specifies the desired access rights to the key. (e.g., KEY_READ) @param phkResult Out param pointer that receives a handle to the opened key. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • lpSubKey The name of the registry subkey to be opened. @param ulOptions Reserved, must be zero. @param samDesired A mask that specifies the desired access rights to the key. (e.g., KEY_READ) @param phkResult Out param pointer that receives a handle to the opened key. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • ulOptions Reserved, must be zero. @param samDesired A mask that specifies the desired access rights to the key. (e.g., KEY_READ) @param phkResult Out param pointer that receives a handle to the opened key. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • samDesired A mask that specifies the desired access rights to the key. (e.g., KEY_READ) @param phkResult Out param pointer that receives a handle to the opened key. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • phkResult Out param pointer that receives a handle to the opened key. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.

Returns

ERROR_SUCCESS (0) if successful, or a nonzero error code.

Publicfunction RegCloseKey
func RegCloseKey(hKey : HKEY) : LONG
@brief Closes a handle to the specified registry key.

Parameters

  • hKey Handle to the open key to be closed. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.

Returns

ERROR_SUCCESS (0) if successful, or a nonzero error code.

Publicfunction RegQueryValueExA
func RegQueryValueExA(hKey : HKEY, lpValueName : LPCSTR, lpReserved : LPDWORD, lpType : LPDWORD, lpData : LPVOID, lpcbData : LPDWORD) : LONG
@brief Retrieves the type and data for the specified value name associated with an open registry key.

Parameters

  • hKey Handle to an open registry key. @param lpValueName The name of the registry value. If NULL or empty, retrieves type/data for the key's unnamed/default value. @param lpReserved Reserved, must be NULL. @param lpType Optional out param pointer receiving the value's type code (e.g., REG_SZ). @param lpData Optional out param buffer receiving the value's data. @param lpcbData In/Out param pointer specifying size of lpData buffer / receiving size of data written. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • lpValueName The name of the registry value. If NULL or empty, retrieves type/data for the key's unnamed/default value. @param lpReserved Reserved, must be NULL. @param lpType Optional out param pointer receiving the value's type code (e.g., REG_SZ). @param lpData Optional out param buffer receiving the value's data. @param lpcbData In/Out param pointer specifying size of lpData buffer / receiving size of data written. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • lpReserved Reserved, must be NULL. @param lpType Optional out param pointer receiving the value's type code (e.g., REG_SZ). @param lpData Optional out param buffer receiving the value's data. @param lpcbData In/Out param pointer specifying size of lpData buffer / receiving size of data written. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • lpType Optional out param pointer receiving the value's type code (e.g., REG_SZ). @param lpData Optional out param buffer receiving the value's data. @param lpcbData In/Out param pointer specifying size of lpData buffer / receiving size of data written. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • lpData Optional out param buffer receiving the value's data. @param lpcbData In/Out param pointer specifying size of lpData buffer / receiving size of data written. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • lpcbData In/Out param pointer specifying size of lpData buffer / receiving size of data written. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.

Returns

ERROR_SUCCESS (0) if successful, or a nonzero error code.

Publicfunction RegSetValueExA
func RegSetValueExA(hKey : HKEY, lpValueName : LPCSTR, Reserved : DWORD, dwType : DWORD, lpData : *BYTE, cbData : DWORD) : LONG
@brief Sets the data and type for a specified value under a registry key.

Parameters

  • hKey Handle to an open registry key. @param lpValueName The name of the value to be set. @param Reserved Reserved, must be zero. @param dwType The type of data to be stored (e.g., REG_SZ). @param lpData The data to be stored. @param cbData The size of the information stored in lpData, in bytes. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • lpValueName The name of the value to be set. @param Reserved Reserved, must be zero. @param dwType The type of data to be stored (e.g., REG_SZ). @param lpData The data to be stored. @param cbData The size of the information stored in lpData, in bytes. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • Reserved Reserved, must be zero. @param dwType The type of data to be stored (e.g., REG_SZ). @param lpData The data to be stored. @param cbData The size of the information stored in lpData, in bytes. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • dwType The type of data to be stored (e.g., REG_SZ). @param lpData The data to be stored. @param cbData The size of the information stored in lpData, in bytes. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • lpData The data to be stored. @param cbData The size of the information stored in lpData, in bytes. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.
  • cbData The size of the information stored in lpData, in bytes. @return ERROR_SUCCESS (0) if successful, or a nonzero error code.

Returns

ERROR_SUCCESS (0) if successful, or a nonzero error code.

Publicfunction _mkdir
func _mkdir(path : LPCSTR) : int
@brief Creates a directory (C runtime).

Parameters

  • path Path to the directory (ANSI string). @return 0 on success, -1 on failure (sets errno).

Returns

0 on success, -1 on failure (sets errno).

Publicfunction _rmdir
func _rmdir(path : LPCSTR) : int
@brief Removes a directory (CRT).

Parameters

  • path Path to the directory (ANSI string). @return 0 on success, -1 on failure (sets errno).

Returns

0 on success, -1 on failure (sets errno).

Publicfunction _chdir
func _chdir(path : LPCSTR) : int
@brief Changes the current working directory (CRT).

Parameters

  • path New working directory (ANSI string). @return 0 on success, -1 on failure (sets errno).

Returns

0 on success, -1 on failure (sets errno).

Publicfunction _getcwd
func _getcwd(buffer : LPSTR, maxlen : int) : LPSTR
@brief Gets the current working directory (CRT).

Parameters

  • buffer Buffer to receive path (ANSI string). @param maxlen Maximum length of the buffer. @return Pointer to buffer on success, NULL on failure.
  • maxlen Maximum length of the buffer. @return Pointer to buffer on success, NULL on failure.

Returns

Pointer to buffer on success, NULL on failure.