Windows API Reference

System Services

System Services

This section provides an overview and detailed reference for core Windows system services. These services are fundamental to the operation of the Windows operating system, enabling applications to interact with hardware, manage resources, and ensure system stability.

Service Management

Manage the lifecycle and configuration of Windows services.

OpenSCManager

Establishes a connection to the service control manager on the local computer or a specified computer.

SC_HANDLE OpenSCManager( LPCTSTR lpMachineName, LPCTSTR lpDatabaseName, DWORD dwDesiredAccess );
  • Parameters:
  • lpMachineName: The name of the target computer.
  • lpDatabaseName: The name of the service database to open.
  • dwDesiredAccess: An array of access rights.

Learn more: OpenSCManager documentation

CreateService

Creates a service entry in the service control manager's database.

SC_HANDLE CreateService( SC_HANDLE hSCManager, LPCTSTR lpServiceName, LPCTSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCTSTR lpBinaryPathName, LPCTSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCTSTR lpDependencies, LPCTSTR lpServiceStartName, LPCTSTR lpPassword );

Learn more: CreateService documentation

StartService

Starts a service.

BOOL StartService( SC_HANDLE hService, DWORD dwNumServiceArgs, LPCSTR *lpServiceArgVectors );

Learn more: StartService documentation

Process and Thread Management

Create, manage, and monitor processes and threads.

CreateProcess

Creates a new process and its primary thread.

BOOL CreateProcess( LPCTSTR lpApplicationName, LPTSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCTSTR lpCurrentDirectory, LPSTARTUPINFO lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation );

Learn more: CreateProcess documentation

OpenProcess

Opens an existing local process object.

HANDLE OpenProcess( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId );

Learn more: OpenProcess documentation

Memory Management

Allocate, deallocate, and manipulate memory.

VirtualAlloc

Reserves, commits, or changes the state of a region of pages in the virtual address space of the calling process.

LPVOID VirtualAlloc( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect );

Learn more: VirtualAlloc documentation

VirtualFree

Commits, decommits, or releases a region of pages in the virtual address space of the calling process.

BOOL VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType );

Learn more: VirtualFree documentation

File and I/O Management

Interact with the file system and manage I/O operations.

CreateFile

Creates or opens a handle to the specified file or device.

HANDLE CreateFile( LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile );

Learn more: CreateFile documentation

ReadFile

Reads data from a file or input/output (I/O) device.

BOOL ReadFile( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped );

Learn more: ReadFile documentation

Registry Access

Read from and write to the Windows registry.

RegOpenKeyEx

Opens an existing key in the registry.

LONG RegOpenKeyEx( HKEY hKey, LPCTSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult );

Learn more: RegOpenKeyEx documentation

Security and Access Control

Manage security descriptors, access tokens, and other security-related objects.

AdjustTokenPrivileges

Enables or disables locally unique privileges for the specified access token.

BOOL AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength );

Learn more: AdjustTokenPrivileges documentation