Windows API Core Functions
This section provides documentation for the core functions in the Windows API, which are fundamental to building Windows applications. These functions cover a wide range of operating system services, including process and thread management, memory management, file system operations, and inter-process communication.
-
CreateProcess
BOOL CreateProcess(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFO lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
Creates a new process and its primary thread. The new process runs in the security context of the calling process.
-
ExitProcess
VOID ExitProcess(UINT uExitCode);
Terminates the calling process and all of its threads.
-
GetCurrentProcessId
DWORD GetCurrentProcessId(void);
Retrieves the process identifier of the calling process.
-
CreateThread
HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
Creates a thread to execute within the virtual address space of the calling process.
-
ExitThread
VOID ExitThread(DWORD dwExitCode);
Terminates the calling thread.
-
VirtualAlloc
LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
Reserves, commits, or changes the state of a region of pages in the virtual address space of the calling process.
-
VirtualFree
BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
Releases, frees, and optionally uncommits a region of pages within the virtual address space of the calling process.
-
HeapAlloc
LPVOID HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes);
Allocates a block of memory from the specified heap. The allocated memory is uninitialized.
-
CreateFile
HANDLE CreateFile(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
Creates or opens a file or I/O device.
-
ReadFile
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
Reads data from a file or overlapping I/O device.
-
WriteFile
BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
Writes data to a file or I/O device.
-
CloseHandle
BOOL CloseHandle(HANDLE hObject);
Closes an open object handle.
-
CreatePipe
BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize);
Creates an unnamed pipe, a unidirectional data-streaming facility between two threads.
-
CreateMutex
HANDLE CreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName);
Creates or opens a named or unnamed mutex object.
Explore the detailed documentation for each function to understand its parameters, return values, and usage examples.
Note: This documentation is for historical reference. For the latest Windows API information, please refer to the official Microsoft Developer Network (MSDN) resources.