{"id":20329005,"url":"https://github.com/affix/windows-api-function-cheatsheets","last_synced_at":"2026-03-09T10:01:42.764Z","repository":{"id":231192831,"uuid":"630356126","full_name":"affix/windows-api-function-cheatsheets","owner":"affix","description":"A comprehensive reference of Windows system calls, including functions for file operations, process management, memory management, thread management, dynamic-link library (DLL) management, synchronization, interprocess communication, Unicode string manipulation, error handling, Winsock networking operations, and registry operations.","archived":false,"fork":false,"pushed_at":"2023-04-19T01:26:26.000Z","size":40,"stargazers_count":5,"open_issues_count":0,"forks_count":55,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T11:47:21.062Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/affix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-04-20T07:55:26.000Z","updated_at":"2025-01-10T21:47:19.000Z","dependencies_parsed_at":"2024-04-03T00:14:30.035Z","dependency_job_id":"39e912b3-0c4f-4e18-92b4-617c983b02b0","html_url":"https://github.com/affix/windows-api-function-cheatsheets","commit_stats":null,"previous_names":["affix/windows-api-function-cheatsheets"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/affix/windows-api-function-cheatsheets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affix%2Fwindows-api-function-cheatsheets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affix%2Fwindows-api-function-cheatsheets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affix%2Fwindows-api-function-cheatsheets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affix%2Fwindows-api-function-cheatsheets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/affix","download_url":"https://codeload.github.com/affix/windows-api-function-cheatsheets/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affix%2Fwindows-api-function-cheatsheets/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30290907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T20:09:03.136Z","updated_at":"2026-03-09T10:01:42.739Z","avatar_url":"https://github.com/affix.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Windows API Cheatsheet\n\n- snowcra5h@icloud.com\n- https://twitter.com/snowcra5h\n\n---\n\n### File Operations\n[CreateFile](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea)\n```c\nHANDLE CreateFile(\n  LPCTSTR lpFileName,\n  DWORD dwDesiredAccess,\n  DWORD dwShareMode,\n  LPSECURITY_ATTRIBUTES lpSecurityAttributes,\n  DWORD dwCreationDisposition,\n  DWORD dwFlagsAndAttributes,\n  HANDLE hTemplateFile\n); // Opens an existing file or creates a new file.\n```\n[ReadFile](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfile)\n```c\nBOOL ReadFile(\n  HANDLE hFile,\n  LPVOID lpBuffer,\n  DWORD nNumberOfBytesToRead,\n  LPDWORD lpNumberOfBytesRead,\n  LPOVERLAPPED lpOverlapped\n); // Reads data from the specified file.\n```\n[WriteFile](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-writefile)\n```c\nBOOL WriteFile(\n  HANDLE hFile,\n  LPCVOID lpBuffer,\n  DWORD nNumberOfBytesToWrite,\n  LPDWORD lpNumberOfBytesWritten,\n  LPOVERLAPPED lpOverlapped\n); // Writes data to the specified file.\n```\n[CloseHandle](https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-closehandle)\n```c\nBOOL CloseHandle(\n  HANDLE hObject\n); // Closes an open handle.\n```\n\n### Process Management\n[CreateProcess](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa)\n```c\nHANDLE CreateProcess(\n  LPCTSTR lpApplicationName,\n  LPTSTR lpCommandLine,\n  LPSECURITY_ATTRIBUTES lpProcessAttributes,\n  LPSECURITY_ATTRIBUTES lpThreadAttributes,\n  BOOL bInheritHandles,\n  DWORD dwCreationFlags,\n  LPVOID lpEnvironment,\n  LPCTSTR lpCurrentDirectory,\n  LPSTARTUPINFO lpStartupInfo,\n  LPPROCESS_INFORMATION lpProcessInformation\n); // Creates a new process.\n```\n[WaitForSingleObject](https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitforsingleobject)\n```c\nDWORD WaitForSingleObject(\n  HANDLE hHandle,\n  DWORD dwMilliseconds\n); // Waits for the specified object to become signaled.\n```\n[TerminateProcess](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminateprocess)\n```c\nBOOL TerminateProcess(\n  HANDLE hProcess,\n  UINT uExitCode\n); // Terminates the specified process.\n```\n\n### Memory Management\n[VirtualAlloc](https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc)\n```c\nLPVOID VirtualAlloc(\n  LPVOID lpAddress,\n  SIZE_T dwSize,                // Shellcode must be between 0x1 and 0x10000 bytes (page size)\n  DWORD flAllocationType,       // #define MEM_COMMIT 0x00001000\n  DWORD flProtect               // #define PAGE_EXECUTE_READWRITE 0x00000040  \n); // Reserves, commits, or changes the state of a region of memory within the virtual address space of the calling process.\n```\ntags: #DEP\n\n[VirtualFree](https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualfree)\n```c\nBOOL VirtualFree(\n  LPVOID lpAddress,\n  SIZE_T dwSize,\n  DWORD dwFreeType\n); // Releases, decommits, or releases and decommits a region of memory within the virtual address space of the calling process.\n```\n\n### Thread Management\n[CreateThread](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread)\n```c\nHANDLE CreateThread(\n  LPSECURITY_ATTRIBUTES lpThreadAttributes,\n  SIZE_T dwStackSize,\n  LPTHREAD_START_ROUTINE lpStartAddress,\n  LPVOID lpParameter,\n  DWORD dwCreationFlags,\n  LPDWORD lpThreadId\n); // Creates a thread to execute within the virtual address space of the calling process.\n```\n[ExitThread](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitthread)\n```c\nVOID ExitThread(\n  DWORD dwExitCode\n); // Terminates the calling thread and returns the exit code to the operating system.\n```\n[GetExitCodeThread](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getexitcodethread)\n```c\nBOOL GetExitCodeThread(\n  HANDLE hThread,\n  LPDWORD lpExitCode\n); // Retrieves the termination status of the specified thread.\n```\n[ResumeThread](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-resumethread)\n```c\nDWORD ResumeThread(\n  HANDLE hThread\n); // Decrements a thread's suspend count. When the suspend count is decremented to zero, the execution of the thread is resumed.\n```\n[SuspendThread](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-suspendthread)\n```c\nDWORD SuspendThread(\n  HANDLE hThread\n); // Suspends the specified thread.\n```\n[TerminateThread](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminatethread)\n```c\nBOOL TerminateThread(\n  HANDLE hThread,\n  DWORD dwExitCode\n); // Terminates the specified thread.\n```\n[CloseHandle](https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-closehandle)\n```c\nBOOL CloseHandle(\n  HANDLE hObject\n); // Closes an open handle.\n```\n\n### Dynamic-Link Library (DLL) Management\n[LoadLibrary](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya)\n```c\nHMODULE LoadLibrary(\n  LPCTSTR lpFileName\n); // Loads a dynamic-link library (DLL) module into the address space of the calling process.\n```\n[GetProcAddress](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getprocaddress)\n```c\nFARPROC GetProcAddress(\n  HMODULE hModule,\n  LPCSTR lpProcName\n); // Retrieves the address of an exported function or variable from the specified DLL.\n```\n[FreeLibrary](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-freelibrary)\n```c\nBOOL FreeLibrary(\n  HMODULE hModule\n); // Frees the loaded DLL module and, if necessary, decrements its reference count.\n```\n\n### Synchronization\n[CreateMutex](https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createmutexa)\n```c\nHANDLE CreateMutex(\n  LPSECURITY_ATTRIBUTES lpMutexAttributes,\n  BOOL bInitialOwner,\n  LPCTSTR lpName\n); // Creates a named or unnamed mutex object.\n```\n[CreateSemaphore](https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createsemaphorea)\n```c\nHANDLE CreateSemaphore(\n  LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,\n  LONG lInitialCount,\n  LONG lMaximumCount,\n  LPCTSTR lpName\n); // Creates a named or unnamed semaphore object.\n```\n[ReleaseMutex](https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-releasemutex)\n```c\nBOOL ReleaseMutex(\n  HANDLE hMutex\n); // Releases ownership of the specified mutex object.\n```\n[ReleaseSemaphore](https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-releasesemaphore)\n```c\nBOOL ReleaseSemaphore(\n  HANDLE hSemaphore,\n  LONG lReleaseCount,\n  LPLONG lpPreviousCount\n); // Increases the count of the specified semaphore object by a specified amount.\n```\n\n### Interprocess Communication\n[CreatePipe](https://docs.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createpipe)\n```c\nBOOL CreatePipe(\n  PHANDLE hReadPipe,\n  PHANDLE hWritePipe,\n  LPSECURITY_ATTRIBUTES lpPipeAttributes,\n  DWORD nSize\n); // Creates an anonymous pipe and returns handles to the read and write ends of the pipe.\n```\n[CreateNamedPipe](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createnamedpipea)\n```c\nHANDLE CreateNamedPipe(\n  LPCTSTR lpName,\n  DWORD dwOpenMode,\n  DWORD dwPipeMode,\n  DWORD nMaxInstances,\n  DWORD nOutBufferSize,\n  DWORD nInBufferSize,\n  DWORD nDefaultTimeOut,\n  LPSECURITY_ATTRIBUTES lpSecurityAttributes\n); // Creates a named pipe and returns a handle for subsequent pipe operations.\n```\n[ConnectNamedPipe](https://docs.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-connectnamedpipe)\n```c\nBOOL ConnectNamedPipe(\n  HANDLE hNamedPipe,\n  LPOVERLAPPED lpOverlapped\n); // Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe.\n```\n[DisconnectNamedPipe](https://docs.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-disconnectnamedpipe)\n```c\nBOOL DisconnectNamedPipe(\n  HANDLE hNamedPipe\n); // Disconnects the server end of a named pipe instance from a client process.\n```\n[CreateFileMapping](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createfilemappinga)\n```c\nHANDLE CreateFileMapping(\n  HANDLE hFile,\n  LPSECURITY_ATTRIBUTES lpFileMappingAttributes,\n  DWORD flProtect,\n  DWORD dwMaximumSizeHigh,\n  DWORD dwMaximumSizeLow,\n  LPCTSTR lpName\n); // Creates or opens a named or unnamed file mapping object for a specified file.\n```\n[MapViewOfFile](https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffile)\n```c\nLPVOID MapViewOfFile(\n  HANDLE hFileMappingObject,\n  DWORD dwDesiredAccess,\n  DWORD dwFileOffsetHigh,\n  DWORD dwFileOffsetLow,\n  SIZE_T dwNumberOfBytesToMap\n); // Maps a view of a file mapping into the address space of the calling process.\n```\n[UnmapViewOfFile](https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-unmapviewoffile)\n```c\nBOOL UnmapViewOfFile(\n  LPCVOID lpBaseAddress\n); // Unmaps a mapped view of a file from the calling process's address space.\n```\n[CloseHandle](https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-closehandle)\n```c\nBOOL CloseHandle(\n  HANDLE hObject\n); // Closes an open handle.\n```\n\n### Winsock Cheat Sheet\n[WSAStartup](https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsastartup)\n```c\nint WSAStartup(\n    WORD wVersionRequired, \n    LPWSADATA lpWSAData\n); // Initializes the Winsock library for an application. Must be called before any other Winsock functions.\n```\n[WSACleanup](https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsacleanup)\n```c\nint WSACleanup(\n    void\n); // Terminates the use of the Winsock library. Must be called once per each successful WSAStartup call.\n```\n[socket](https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket)\n```c\nSOCKET socket(\n    int af, \n    int type, \n    int protocol\n); // Creates a new socket for network communication.\n```\n[bind](https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind)\n```c\nint bind(\n    SOCKET s, \n    const struct sockaddr *name, \n    int namelen\n); // Binds a socket to a specific local address and port.\n```\n[listen](https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-listen)\n```c\nint listen(\n    SOCKET s, \n    int backlog\n); // Sets a socket to listen for incoming connections.\n```\n[accept](https://learn.microsoft.com/en-us/windows/win32/api/Winsock2/nf-winsock2-accept)\n```c\nSOCKET accept(\n    SOCKET s, \n    struct sockaddr *addr, \n    int *addrlen\n); // Accepts a new incoming connection on a listening socket.\n```\n[connect](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect)\n```c\nint connect(\n    SOCKET s, \n    const struct sockaddr *name, \n    int namelen\n); // Initiates a connection on a socket to a remote address.\n```\n[send](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send)\n```c\nint send(\n    SOCKET s, \n    const char *buf, \n    int len, \n    int flags\n); // Sends data on a connected socket.\n```\n[recv](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recv)\n```c\nint recv(\n    SOCKET s, \n    char *buf, \n    int len, \n    int flags\n); // Receives data from a connected socket.\n```\n[closesocket](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-closesocket)\n```c\nint closesocket(\n    SOCKET s\n); //Closes a socket and frees its resources.\n```\n\n### Registry Operations\n[RegOpenKeyExW](https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regopenkeyexw)\n```c\nLONG RegOpenKeyExW(\n    HKEY hKey, \n    LPCWTSTR lpSubKey, \n    DWORD ulOptions, \n    REGSAM samDesired, \n    PHKEY phkResult\n); // Opens the specified registry key.\n```\n[RegQueryValueExW](https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvaluew)\n```c\nLONG RegQueryValueExW(\n    HKEY hKey, \n    LPCWTSTR lpValueName, \n    LPDWORD lpReserved, \n    LPDWORD lpType, \n    LPBYTE lpData, \n    LPDWORD lpcbData\n); // Retrieves the type and data of the specified value name associated with an open registry key.\n```\n[RegSetValueExW](https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetvalueexw)\n```c\nLONG RegSetValueEx(\n    HKEY hKey, \n    LPCWTSTR lpValueName, \n    DWORD Reserved, \n    DWORD dwType, \n    const BYTE *lpData, \n    DWORD cbData\n); // Sets the data and type of the specified value name associated with an open registry key.\n```\n[RegCloseKey](https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regclosekey)\n```c\nLONG RegCloseKey(\n    HKEY hKey\n); // Closes a handle to the specified registry key.\n```\n\n### Error Handling\n[WSAGetLastError](https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsagetlasterror)\n```c\nint WSAGetLastError(\n    void\n); // Returns the error status for the last Windows Sockets operation that failed.\n```\n[WSASetLastError](https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsasetlasterror)\n```c\nvoid WSASetLastError(\n    int iError\n); // Sets the error status for the last Windows Sockets operation.\n```\n[WSAGetOverlappedResult](https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsagetoverlappedresult)\n```c\nBOOL WSAGetOverlappedResult(\n    SOCKET s, \n    LPWSAOVERLAPPED lpOverlapped, \n    LPDWORD lpcbTransfer, \n    BOOL fWait, \n    LPDWORD lpdwFlags\n); // Determines the results of an overlapped operation on the specified socket.\n```\n[WSAIoctl](https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaioctl)\n```c\nint WSAIoctl(\n    SOCKET s, \n    DWORD dwIoControlCode, \n    LPVOID lpvInBuffer, \n    DWORD cbInBuffer, \n    LPVOID lpvOutBuffer, \n    DWORD cbOutBuffer, \n    LPDWORD lpcbBytesReturned, \n    LPWSAOVERLAPPED lpOverlapped, \n    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine\n); // Controls the mode of a socket.\n```\n[WSACreateEvent](https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsacreateevent)\n```c\nWSAEVENT WSACreateEvent(\n    void\n); // Creates a new event object.\n```\n[WSASetEvent](https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasetevent)\n```c\nBOOL WSASetEvent(\n    WSAEVENT hEvent\n); // Sets the state of the specified event object to signaled.\n```\n[WSAResetEvent](https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaresetevent)\n```c\nBOOL WSAResetEvent(\n    WSAEVENT hEvent\n); // Sets the state of the specified event object to nonsignaled.\n```\n[WSACloseEvent](https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsacloseevent)\n```c\nBOOL WSACloseEvent(\n    WSAEVENT hEvent\n); // Closes an open event object handle.\n```\n[WSAWaitForMultipleEvents](https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsawaitformultipleevents)\n```c\nDWORD WSAWaitForMultipleEvents(\n    DWORD cEvents, \n    const WSAEVENT *lphEvents, \n    BOOL fWaitAll, \n    DWORD dwTimeout, \n    BOOL fAlertable\n); // Waits for multiple event objects and returns when the specified events are signaled or the time-out interval elapses.\n```\n\n---\n\n## Unicode String Functions\n```c\n#include \u003cwchar.h\u003e // for wide character string routines\n```\n\n### String Length\n```c\nsize_t wcslen(\n    const wchar_t *str\n); // Returns the length of the given wide string.\n```\n\n### String Copy\n[wcscpy]\n```c\nwchar_t *wcscpy(\n    wchar_t *dest, \n    const wchar_t *src\n); // Copies the wide string from src to dest.\n```\n[wcsncpy]\n```c\nwchar_t *wcsncpy(\n    wchar_t *dest, \n    const wchar_t *src, \n    size_t count\n); // Copies at most count characters from the wide string src to dest.\n```\n\n### String Concatenation\n[wcscat]\n```c\nwchar_t *wcscat(\n    wchar_t *dest, \n    const wchar_t *src\n); // Appends the wide string src to the end of the wide string dest.\n```\n[wcsncat]\n```c\nwchar_t *wcsncat(\n    wchar_t *dest, \n    const wchar_t *src, \n    size_t count\n); // Appends at most count characters from the wide string src to the end of the wide string dest.\n```\n\n### String Comparison\n[wcscmp]\n```c\nint wcscmp(\n    const wchar_t *str1, \n    const wchar_t *str2\n); // Compares two wide strings lexicographically.\n```\n[wcsncmp]\n```c\nint wcsncmp(\n    const wchar_t *str1, \n    const wchar_t *str2, \n    size_t count\n); // Compares up to count characters of two wide strings lexicographically.\n```\n[_wcsicmp]\n```c\nint _wcsicmp(\n    const wchar_t *str1, \n    const wchar_t *str2\n); // Compares two wide strings lexicographically, ignoring case.\n```\n[_wcsnicmp]\n```c\nint _wcsnicmp(\n    const wchar_t *str1, \n    const wchar_t *str2, \n    size_t count\n); // Compares up to count characters of two wide strings lexicographically, ignoring case.\n```\n\n### String Search\n[wcschr]\n```c\nwchar_t *wcschr(\n    const wchar_t *str, \n    wchar_t c\n); // Finds the first occurrence of the wide character c in the wide string str.\n```\n[wcsrchr]\n```c\nwchar_t *wcsrchr(\n    const wchar_t *str, \n    wchar_t c\n); // Finds the last occurrence of the wide character c in the wide string str.\n```\n[wcspbrk]\n```c\nwchar_t *wcspbrk(\n    const wchar_t *str1, \n    const wchar_t *str2\n); // Finds the first occurrence in the wide string str1 of any character from the wide string str2.\n```\n[wcsstr]\n```c\nwchar_t *wcsstr(\n    const wchar_t *str1, \n    const wchar_t *str2\n); // Finds the first occurrence of the wide string str2 in the wide string str1.\n```\n[wcstok]\n```c\nwchar_t *wcstok(\n    wchar_t *str, \n    const wchar_t *delimiters\n); // Splits the wide string str into tokens based on the delimiters.\n```\n\n### Character Classification and Conversion\n[towupper]\n```c\nwint_t towupper(\n    wint_t c\n); // Converts a wide character to uppercase.\n```\n[towlower]\n```c\nwint_t towlower(\n    wint_t c\n); // Converts a wide character to lowercase.\n```\n[iswalpha]\n```c\nint iswalpha(\n    wint_t c\n); // Checks if the wide character is an alphabetic character.\n```\n[iswdigit]\n```c\nint iswdigit(\n    wint_t c\n); // Checks if the wide character is a decimal digit.\n```\n[iswalnum]\n```c\nint iswalnum(\n    wint_t c\n); // Checks if the wide character is an alphanumeric character.\n```\n[iswspace]\n```c\nint iswspace(\n    wint_t c\n); // Checks if the wide character is a whitespace character.\n```\n[iswxdigit]\n```c\nint iswxdigit(\n    wint_t c\n); // Checks if the wide character is a valid hexadecimal digit.\n```\n\n--- \n\n## Win32 Structs Cheat Sheet\n### Common Structs\n[**`SYSTEM_INFO`**](https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info)\n```cpp\n#include \u003csysinfoapi.h\u003e\n// Contains information about the current computer system, including the architecture and type of the processor, the number of processors, and the page size.\ntypedef struct _SYSTEM_INFO {\n    union {\n        DWORD dwOemId;\n        struct {\n            WORD wProcessorArchitecture;\n            WORD wReserved;\n        } DUMMYSTRUCTNAME;\n    } DUMMYUNIONNAME;\n    DWORD dwPageSize;\n    LPVOID lpMinimumApplicationAddress;\n    LPVOID lpMaximumApplicationAddress;\n    DWORD_PTR dwActiveProcessorMask;\n    DWORD dwNumberOfProcessors;\n    DWORD dwProcessorType;\n    DWORD dwAllocationGranularity;\n    WORD wProcessorLevel;\n    WORD wProcessorRevision;\n} SYSTEM_INFO;\n```\n[**`FILETIME`**](https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime)\n```cpp\n#include \u003cminwinbase.h\u003e\n// Represents the number of 100-nanosecond intervals since January 1, 1601 (UTC). Used for file and system time.\ntypedef struct _FILETIME {\n    DWORD dwLowDateTime;\n    DWORD dwHighDateTime;\n} FILETIME;\n```\n[**`STARTUPINFO`**](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa)\n```cpp\n#include \u003cprocessthreadsapi.h\u003e\n// Specifies the window station, desktop, standard handles, and appearance of the main window for a process at creation time.\ntypedef struct _STARTUPINFOA {\n    DWORD  cb;\n    LPSTR  lpReserved;\n    LPSTR  lpDesktop;\n    LPSTR  lpTitle;\n    DWORD  dwX;\n    DWORD  dwY;\n    DWORD  dwXSize;\n    DWORD  dwYSize;\n    DWORD  dwXCountChars;\n    DWORD  dwYCountChars;\n    DWORD  dwFillAttribute;\n    DWORD  dwFlags;\n    WORD   wShowWindow;\n    WORD   cbReserved2;\n    LPBYTE lpReserved2;\n    HANDLE hStdInput;\n    HANDLE hStdOutput;\n    HANDLE hStdError;\n} STARTUPINFOA, *LPSTARTUPINFOA;\n```\n[**`PROCESS_INFORMATION`**](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-process_information)\n```cpp\n#include \u003cprocessthreadsapi.h\u003e\n// Contains information about a newly created process and its primary thread.\ntypedef struct _PROCESS_INFORMATION {\n    HANDLE hProcess;\n    HANDLE hThread;\n    DWORD  dwProcessId;\n    DWORD  dwThreadId;\n} PROCESS_INFORMATION, *LPPROCESS_INFORMATION;\n```\n[**`SECURITY_ATTRIBUTES`**](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa379560(v=vs.85))\n```cpp\n// Determines whether the handle can be inherited by child processes and specifies a security descriptor for a new object.\ntypedef struct _SECURITY_ATTRIBUTES {\n    DWORD  nLength;\n    LPVOID lpSecurityDescriptor;\n    BOOL   bInheritHandle;\n} SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;\n```\n[**`OVERLAPPED`**](https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-overlapped)\n```cpp\n#inluce \u003cminwinbase.h\u003e\n// Contains information used in asynchronous (also known as overlapped) input and output (I/O) operations.\ntypedef struct _OVERLAPPED {\n    ULONG_PTR Internal;\n    ULONG_PTR InternalHigh;\n    union {\n        struct {\n            DWORD Offset;\n            DWORD OffsetHigh;\n        } DUMMYSTRUCTNAME;\n        PVOID Pointer;\n    } DUMMYUNIONNAME;\n    HANDLE hEvent;\n} OVERLAPPED, *LPOVERLAPPED;\n```\n[**`GUID`**](https://docs.microsoft.com/en-us/windows/win32/api/guiddef/ns-guiddef-guid)\n```cpp\n#include \u003cguiddef.h\u003e\n// Represents a globally unique identifier (GUID), used to identify objects, interfaces, and other items.\ntypedef struct _GUID {\n    unsigned long  Data1;\n    unsigned short Data2;\n    unsigned short Data3;\n    unsigned char  Data4[8];\n} GUID;\n```\n[**`MEMORY_BASIC_INFORMATION`**](https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-memory_basic_information)\n```cpp\n#include \u003cwinnt.h\u003e\n// Contains information about a range of pages in the virtual address space of a process.\ntypedef struct _MEMORY_BASIC_INFORMATION {\n    PVOID  BaseAddress;\n    PVOID  AllocationBase;\n    DWORD  AllocationProtect;\n    SIZE_T RegionSize;\n    DWORD  State;\n    DWORD  Protect;\n    DWORD  Type;\n} MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;\n```\n[**`SYSTEMTIME`**](https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime)\n```cpp\n#include \u003cminwinbase.h\u003e\n// Specifies a date and time, using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.\ntypedef struct _SYSTEMTIME {\n    WORD wYear;\n    WORD wMonth;\n    WORD wDayOfWeek;\n    WORD wDay;\n    WORD wHour;\n    WORD wMinute;\n    WORD wSecond;\n    WORD wMilliseconds;\n} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;\n```\n[**`COORD`**](https://docs.microsoft.com/en-us/windows/console/coord-str)\n```cpp\n// Defines the coordinates of a character cell in a console screen buffer, where the origin (0,0) is at the top-left corner.\ntypedef struct _COORD {\n    SHORT X;\n    SHORT Y;\n} COORD, *PCOORD;\n```\n[**`SMALL_RECT`**](https://docs.microsoft.com/en-us/windows/console/small-rect-str)\n```cpp\n//  Defines the coordinates of the upper left and lower right corners of a rectangle.\ntypedef struct _SMALL_RECT {\n    SHORT Left;\n    SHORT Top;\n    SHORT Right;\n    SHORT Bottom;\n} SMALL_RECT;\n```\n[**`CONSOLE_SCREEN_BUFFER_INFO`**](https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str)\n```cpp\n// Contains information about a console screen buffer.\ntypedef struct _CONSOLE_SCREEN_BUFFER_INFO {\n    COORD      dwSize;\n    COORD      dwCursorPosition;\n    WORD       wAttributes;\n    SMALL_RECT srWindow;\n    COORD      dwMaximumWindowSize;\n} CONSOLE_SCREEN_BUFFER_INFO, *PCONSOLE_SCREEN_BUFFER_INFO;\n```\n[**`WSADATA`**](https://docs.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-wsadata)\n```cpp\n#include \u003cwinsock.h\u003e\n// Contains information about the Windows Sockets implementation.\ntypedef struct WSAData {\n    WORD           wVersion;\n    WORD           wHighVersion;\n    unsigned short iMaxSockets;\n    unsigned short iMaxUdpDg;\n    char FAR       *lpVendorInfo;\n    char           szDescription[WSADESCRIPTION_LEN+1];\n    char           szSystemStatus[WSASYS_STATUS_LEN+1];\n} WSADATA, *LPWSADATA;\n```\n[**`CRITICAL_SECTION`**]([struct RTL_CRITICAL_SECTION (nirsoft.net)](https://www.nirsoft.net/kernel_struct/vista/RTL_CRITICAL_SECTION.html))\n```c++\n// Represents a critical section object, which is used to provide synchronization access to a shared resource.\ntypedef struct _RTL_CRITICAL_SECTION {\n    PRTL_CRITICAL_SECTION_DEBUG DebugInfo;\n    LONG LockCount;\n    LONG RecursionCount;\n    HANDLE OwningThread;\n    HANDLE LockSemaphore;\n    ULONG_PTR SpinCount;\n} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;\n```\n[**`WSAPROTOCOL_INFO`**](https://docs.microsoft.com/en-us/windows/win32/api/winsock2/ns-winsock2-wsaprotocol_infoa)\n```c++\n#include \u003cwinsock2.h\u003e\n// Contains Windows Sockets protocol information.\ntypedef struct _WSAPROTOCOL_INFOA {\n    DWORD          dwServiceFlags1;\n    DWORD          dwServiceFlags2;\n    DWORD          dwServiceFlags3;\n    DWORD          dwServiceFlags4;\n    DWORD          dwProviderFlags;\n    GUID           ProviderId;\n    DWORD          dwCatalogEntryId;\n    WSAPROTOCOLCHAIN ProtocolChain;\n    int            iVersion;\n    int            iAddressFamily;\n    int            iMaxSockAddr;\n    int            iMinSockAddr;\n    int            iSocketType;\n    int            iProtocol;\n    int            iProtocolMaxOffset;\n    int            iNetworkByteOrder;\n    int            iSecurityScheme;\n    DWORD          dwMessageSize;\n    DWORD          dwProviderReserved;\n    CHAR           szProtocol[WSAPROTOCOL_LEN+1];\n} WSAPROTOCOL_INFOA, *LPWSAPROTOCOL_INFOA;\n```\n[**`MSGHDR`**](https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/ns-ws2tcpip-_msghdr)\n```c++\n#include \u003cws2def.h\u003e\n// Contains message information for use with the `sendmsg` and `recvmsg` functions.\ntypedef struct _WSAMSG {\n    LPSOCKADDR       name;\n    INT              namelen;\n    LPWSABUF         lpBuffers;\n    ULONG            dwBufferCount;\n    WSABUF           Control;\n    ULONG            dwFlags;\n} WSAMSG, *PWSAMSG, *LPWSAMSG;\n```\n\n### Win32 Sockets Structs Cheat Sheet (winsock.h)\n[**`SOCKADDR`**](https://docs.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-sockaddr)\n```cpp\n// A generic socket address structure used for compatibility with various address families.\ntypedef struct sockaddr {\n    u_short sa_family;\n    char    sa_data[14];\n} SOCKADDR, *PSOCKADDR, *LPSOCKADDR;\n```\n[**`SOCKADDR_IN`**](https://docs.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-sockaddr_in)\n```cpp\n// Represents an IPv4 socket address, containing the IPv4 address, port number, and address family.\ntypedef struct sockaddr_in {\n    short          sin_family;\n    u_short        sin_port;\n    struct in_addr sin_addr;\n    char           sin_zero[8];\n} SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;\n```\n[**`LINGER`**](https://docs.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-linger)\n```cpp\n// Used to set the socket option SO_LINGER, which determines the action taken when unsent data is queued on a socket and a `closesocket` is performed.\ntypedef struct linger {\n    u_short l_onoff;\n    u_short l_linger;\n} LINGER, *PLINGER, *LPLINGER;\n```\n[**`TIMEVAL`**](https://docs.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-timeval)\n```cpp\n// Represents a time interval, used with the `select` function to specify a timeout period.\ntypedef struct timeval {\n    long tv_sec;\n    long tv_usec;\n} TIMEVAL, *PTIMEVAL, *LPTIMEVAL;\n```\n[**`FD_SET`**](https://docs.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-fd_set)\n```cpp\n// Represents a set of sockets used with the `select` function to check for socket events.\ntypedef struct fd_set {\n    u_int fd_count;\n    SOCKET fd_array[FD_SETSIZE];\n} fd_set, *Pfd_set, *LPfd_set;\n```\n\n### Win32 Sockets Structs Cheat Sheet (winsock2.h)\n[**`IN_ADDR`**](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/ns-winsock2-in_addr)\n```cpp\n// Represents an IPv4 address.\ntypedef struct in_addr {\n    union {\n        struct {\n            u_char s_b1, s_b2, s_b3, s_b4;\n        } S_un_b;\n        struct {\n            u_short s_w1, s_w2;\n        } S_un_w;\n        u_long S_addr;\n    } S_un;\n} IN_ADDR, *PIN_ADDR, *LPIN_ADDR;\n```\n\n### Win32 Sockets Structs Cheat Sheet (ws2def.h)\n[**`ADDRINFO`**](https://learn.microsoft.com/en-us/windows/win32/api/ws2def/ns-ws2def-addrinfow)\n```cpp\n#include \u003cws2def.h\u003e\n// Contains information about an address for use with the `getaddrinfo` function, and is used to build a linked list of addresses.\ntypedef struct addrinfoW {\n    int             ai_flags;\n    int             ai_family;\n    int             ai_socktype;\n    int             ai_protocol;\n    size_t          ai_addrlen;\n    PWSTR           *ai_canonname;\n    struct sockaddr *ai_addr;\n    struct addrinfo *ai_next;\n} ADDRINFOW, *PADDRINFOW;\n```\n[**`WSABUF`**](https://learn.microsoft.com/en-us/windows/win32/api/ws2def/ns-ws2def-wsabuf)\n```cpp\n#include \u003cws2def.h\u003e\n// Contains a pointer to a buffer and its length. Used for scatter/gather I/O operations.\ntypedef struct _WSABUF {\n    ULONG len;\n    __field_bcount(len) CHAR FAR *buf;\n} WSABUF, FAR * LPWSABUF;\n```\n[**`SOCKADDR_IN6`**](https://docs.microsoft.com/en-us/windows/win32/api/ws2ipdef/ns-ws2ipdef-sockaddr_in6)\n```cpp\n#include \u003cws2ipdef.h\u003e\n// Represents an IPv6 socket address, containing the IPv6 address, port number, flow info, and address family.\ntypedef struct sockaddr_in6 {\n    short          sin6_family;\n    u_short        sin6_port;\n    u_long         sin6_flowinfo;\n    struct in6_addr sin6_addr;\n    u_long         sin6_scope_id;\n} SOCKADDR_IN6, *PSOCKADDR_IN6, *LPSOCKADDR_IN6;\n```\n[**`IN6_ADDR`**](https://learn.microsoft.com/en-us/windows/win32/api/in6addr/ns-in6addr-in6_addr)\n```cpp\n#include \u003cin6addr.h\u003e\n// Represents an IPv6 address.\ntypedef struct in6_addr {\n    union {\n        u_char Byte[16];\n        u_short Word[8];\n    } u;\n} IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faffix%2Fwindows-api-function-cheatsheets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faffix%2Fwindows-api-function-cheatsheets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faffix%2Fwindows-api-function-cheatsheets/lists"}