advapi32 topic

Advanced Base API Library

Implements Windows API functions related to the Windows registry, services, user accounts and applications.

Functions

ChangeServiceConfig2(SC_HANDLE hService, SERVICE_CONFIG dwInfoLevel, Pointer<NativeType>? lpInfo) Win32Result<bool> advapi32
Changes the optional configuration parameters of a service.
CloseServiceHandle(SC_HANDLE hSCObject) Win32Result<bool> advapi32
Closes a handle to a service control manager or service object.
CloseTrace(PROCESSTRACE_HANDLE traceHandle) WIN32_ERROR advapi32
Closes a trace processing session that was created with OpenTrace.
ControlService(SC_HANDLE hService, int dwControl, Pointer<SERVICE_STATUS> lpServiceStatus) Win32Result<bool> advapi32
Sends a control code to a service.
ControlServiceEx(SC_HANDLE hService, int dwControl, int dwInfoLevel, Pointer<NativeType> pControlParams) Win32Result<bool> advapi32
Sends a control code to a service.
CredDelete(PCWSTR targetName, CRED_TYPE type) Win32Result<bool> advapi32
Deletes a credential from the user's credential set.
CredFree(Pointer<NativeType> buffer) → void advapi32
Frees a buffer returned by any of the credentials management functions.
CredRead(PCWSTR targetName, CRED_TYPE type, Pointer<Pointer<CREDENTIAL>> credential) Win32Result<bool> advapi32
Reads a credential from the user's credential set.
CredWrite(Pointer<CREDENTIAL> credential, int flags) Win32Result<bool> advapi32
Creates a new credential or modifies an existing credential in the user's credential set.
DecryptFile(PCWSTR lpFileName) Win32Result<bool> advapi32
Decrypts an encrypted file or directory.
DeleteService(SC_HANDLE hService) Win32Result<bool> advapi32
Marks the specified service for deletion from the service control manager database.
EncryptFile(PCWSTR lpFileName) Win32Result<bool> advapi32
Encrypts a file or directory.
EnumDependentServices(SC_HANDLE hService, ENUM_SERVICE_STATE dwServiceState, Pointer<ENUM_SERVICE_STATUS>? lpServices, int cbBufSize, Pointer<Uint32> pcbBytesNeeded, Pointer<Uint32> lpServicesReturned) Win32Result<bool> advapi32
Retrieves the name and status of each service that depends on the specified service.
EnumServicesStatus(SC_HANDLE hSCManager, ENUM_SERVICE_TYPE dwServiceType, ENUM_SERVICE_STATE dwServiceState, Pointer<ENUM_SERVICE_STATUS>? lpServices, int cbBufSize, Pointer<Uint32> pcbBytesNeeded, Pointer<Uint32> lpServicesReturned, Pointer<Uint32>? lpResumeHandle) Win32Result<bool> advapi32
Enumerates services in the specified service control manager database.
EnumServicesStatusEx(SC_HANDLE hSCManager, SC_ENUM_TYPE infoLevel, ENUM_SERVICE_TYPE dwServiceType, ENUM_SERVICE_STATE dwServiceState, Pointer<Uint8>? lpServices, int cbBufSize, Pointer<Uint32> pcbBytesNeeded, Pointer<Uint32> lpServicesReturned, Pointer<Uint32>? lpResumeHandle, PCWSTR? pszGroupName) Win32Result<bool> advapi32
Enumerates services in the specified service control manager database.
FileEncryptionStatus(PCWSTR lpFileName, Pointer<Uint32> lpStatus) Win32Result<bool> advapi32
Retrieves the encryption status of the specified file.
GetServiceDisplayName(SC_HANDLE hSCManager, PCWSTR lpServiceName, PWSTR? lpDisplayName, Pointer<Uint32> lpcchBuffer) Win32Result<bool> advapi32
Retrieves the display name of the specified service.
GetServiceKeyName(SC_HANDLE hSCManager, PCWSTR lpDisplayName, PWSTR? lpServiceName, Pointer<Uint32> lpcchBuffer) Win32Result<bool> advapi32
Retrieves the service name of the specified service.
GetTokenInformation(HANDLE tokenHandle, TOKEN_INFORMATION_CLASS tokenInformationClass, Pointer<NativeType>? tokenInformation, int tokenInformationLength, Pointer<Uint32> returnLength) Win32Result<bool> advapi32
Retrieves a specified type of information about an access token.
GetUserName(PWSTR? lpBuffer, Pointer<Uint32> pcbBuffer) Win32Result<bool> advapi32
Retrieves the name of the user associated with the current thread.
InitiateShutdown(PCWSTR? lpMachineName, PCWSTR? lpMessage, int dwGracePeriod, SHUTDOWN_FLAGS dwShutdownFlags, SHUTDOWN_REASON dwReason) int advapi32
Initiates a shutdown and restart of the specified computer, and restarts any applications that have been registered for restart.
NotifyBootConfigStatus(bool bootAcceptable) Win32Result<bool> advapi32
Reports the boot status to the service control manager.
NotifyServiceStatusChange(SC_HANDLE hService, SERVICE_NOTIFY dwNotifyMask, Pointer<SERVICE_NOTIFY_2> pNotifyBuffer) int advapi32
Enables an application to receive notification when the specified service is created or deleted or when its status changes.
OpenProcessToken(HANDLE processHandle, TOKEN_ACCESS_MASK desiredAccess, Pointer<Pointer<NativeType>> tokenHandle) Win32Result<bool> advapi32
Opens the access token associated with a process.
OpenSCManager(PCWSTR? lpMachineName, PCWSTR? lpDatabaseName, int dwDesiredAccess) Win32Result<SC_HANDLE> advapi32
Establishes a connection to the service control manager on the specified computer and opens the specified service control manager database.
OpenService(SC_HANDLE hSCManager, PCWSTR lpServiceName, int dwDesiredAccess) Win32Result<SC_HANDLE> advapi32
Opens an existing service.
OpenThreadToken(HANDLE threadHandle, TOKEN_ACCESS_MASK desiredAccess, bool openAsSelf, Pointer<Pointer<NativeType>> tokenHandle) Win32Result<bool> advapi32
Opens the access token associated with a thread.
QueryServiceConfig(SC_HANDLE hService, Pointer<QUERY_SERVICE_CONFIG>? lpServiceConfig, int cbBufSize, Pointer<Uint32> pcbBytesNeeded) Win32Result<bool> advapi32
Retrieves the configuration parameters of the specified service.
QueryServiceConfig2(SC_HANDLE hService, SERVICE_CONFIG dwInfoLevel, Pointer<Uint8>? lpBuffer, int cbBufSize, Pointer<Uint32> pcbBytesNeeded) Win32Result<bool> advapi32
Retrieves the optional configuration parameters of the specified service.
QueryServiceDynamicInformation(SERVICE_STATUS_HANDLE hServiceStatus, int dwInfoLevel, Pointer<Pointer<NativeType>> ppDynamicInfo) Win32Result<bool> advapi32
Retrieves dynamic information related to the current service start.
QueryServiceObjectSecurity(SC_HANDLE hService, int dwSecurityInformation, PSECURITY_DESCRIPTOR? lpSecurityDescriptor, int cbBufSize, Pointer<Uint32> pcbBytesNeeded) Win32Result<bool> advapi32
Retrieves a copy of the security descriptor associated with a service object.
QueryServiceStatus(SC_HANDLE hService, Pointer<SERVICE_STATUS> lpServiceStatus) Win32Result<bool> advapi32
Retrieves the current status of the specified service.
QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE infoLevel, Pointer<Uint8>? lpBuffer, int cbBufSize, Pointer<Uint32> pcbBytesNeeded) Win32Result<bool> advapi32
Retrieves the current status of the specified service based on the specified information level.
RegCloseKey(HKEY hKey) WIN32_ERROR advapi32
Closes a handle to the specified registry key.
RegConnectRegistry(PCWSTR? lpMachineName, HKEY hKey, Pointer<Pointer<NativeType>> phkResult) WIN32_ERROR advapi32
Establishes a connection to a predefined registry key on another computer.
RegCopyTree(HKEY hKeySrc, PCWSTR? lpSubKey, HKEY hKeyDest) WIN32_ERROR advapi32
Copies the specified registry key, along with its values and subkeys, to the specified destination key.
RegCreateKey(HKEY hKey, PCWSTR? lpSubKey, Pointer<Pointer<NativeType>> phkResult) WIN32_ERROR advapi32
Creates the specified registry key.
RegCreateKeyEx(HKEY hKey, PCWSTR lpSubKey, PCWSTR? lpClass, REG_OPEN_CREATE_OPTIONS dwOptions, REG_SAM_FLAGS samDesired, Pointer<SECURITY_ATTRIBUTES>? lpSecurityAttributes, Pointer<Pointer<NativeType>> phkResult, Pointer<Uint32>? lpdwDisposition) WIN32_ERROR advapi32
Creates the specified registry key.
RegCreateKeyTransacted(HKEY hKey, PCWSTR lpSubKey, PCWSTR? lpClass, REG_OPEN_CREATE_OPTIONS dwOptions, REG_SAM_FLAGS samDesired, Pointer<SECURITY_ATTRIBUTES>? lpSecurityAttributes, Pointer<Pointer<NativeType>> phkResult, Pointer<Uint32>? lpdwDisposition, HANDLE hTransaction) WIN32_ERROR advapi32
Creates the specified registry key and associates it with a transaction.
RegDeleteKey(HKEY hKey, PCWSTR lpSubKey) WIN32_ERROR advapi32
Deletes a subkey and its values.
RegDeleteKeyEx(HKEY hKey, PCWSTR lpSubKey, int samDesired) WIN32_ERROR advapi32
Deletes a subkey and its values from the specified platform-specific view of the registry.
RegDeleteKeyTransacted(HKEY hKey, PCWSTR lpSubKey, int samDesired, HANDLE hTransaction) WIN32_ERROR advapi32
Deletes a subkey and its values from the specified platform-specific view of the registry as a transacted operation.
RegDeleteKeyValue(HKEY hKey, PCWSTR? lpSubKey, PCWSTR? lpValueName) WIN32_ERROR advapi32
Removes the specified value from the specified registry key and subkey.
RegDeleteTree(HKEY hKey, PCWSTR? lpSubKey) WIN32_ERROR advapi32
Deletes the subkeys and values of the specified key recursively.
RegDeleteValue(HKEY hKey, PCWSTR? lpValueName) WIN32_ERROR advapi32
Removes a named value from the specified registry key.
RegDisablePredefinedCache() WIN32_ERROR advapi32
Disables handle caching of the predefined registry handle for HKEY_CURRENT_USER for the current process.
RegDisablePredefinedCacheEx() WIN32_ERROR advapi32
Disables handle caching for all predefined registry handles for the current process.
RegDisableReflectionKey(HKEY hBase) WIN32_ERROR advapi32
Disables registry reflection for the specified key.
RegEnableReflectionKey(HKEY hBase) WIN32_ERROR advapi32
Restores registry reflection for the specified disabled key.
RegEnumKey(HKEY hKey, int dwIndex, PWSTR? lpName, int cchName) WIN32_ERROR advapi32
Enumerates the subkeys of the specified open registry key.
RegEnumKeyEx(HKEY hKey, int dwIndex, PWSTR? lpName, Pointer<Uint32> lpcchName, PWSTR? lpClass, Pointer<Uint32>? lpcchClass, Pointer<FILETIME>? lpftLastWriteTime) WIN32_ERROR advapi32
Enumerates the subkeys of the specified open registry key.
RegEnumValue(HKEY hKey, int dwIndex, PWSTR? lpValueName, Pointer<Uint32> lpcchValueName, Pointer<Uint32>? lpType, Pointer<Uint8>? lpData, Pointer<Uint32>? lpcbData) WIN32_ERROR advapi32
Enumerates the values for the specified open registry key.
RegFlushKey(HKEY hKey) WIN32_ERROR advapi32
Writes all the attributes of the specified open registry key into the registry.
RegGetValue(HKEY hkey, PCWSTR? lpSubKey, PCWSTR? lpValue, REG_ROUTINE_FLAGS dwFlags, Pointer<Uint32>? pdwType, Pointer<NativeType>? pvData, Pointer<Uint32>? pcbData) WIN32_ERROR advapi32
Retrieves the type and data for the specified registry value.
RegisterServiceCtrlHandler(PCWSTR lpServiceName, Pointer<NativeFunction<LPHANDLER_FUNCTION>> lpHandlerProc) Win32Result<SERVICE_STATUS_HANDLE> advapi32
Registers a function to handle service control requests.
RegisterServiceCtrlHandlerEx(PCWSTR lpServiceName, Pointer<NativeFunction<LPHANDLER_FUNCTION_EX>> lpHandlerProc, Pointer<NativeType>? lpContext) Win32Result<SERVICE_STATUS_HANDLE> advapi32
Registers a function to handle extended service control requests.
RegLoadAppKey(PCWSTR lpFile, Pointer<Pointer<NativeType>> phkResult, int samDesired, int dwOptions) WIN32_ERROR advapi32
Loads the specified registry hive as an application hive.
RegLoadKey(HKEY hKey, PCWSTR? lpSubKey, PCWSTR lpFile) WIN32_ERROR advapi32
Creates a subkey under HKEY_USERS or HKEY_LOCAL_MACHINE and loads the data from the specified registry hive into that subkey.
RegLoadMUIString(HKEY hKey, PCWSTR? pszValue, PWSTR? pszOutBuf, int cbOutBuf, Pointer<Uint32>? pcbData, int flags, PCWSTR? pszDirectory) WIN32_ERROR advapi32
Loads the specified string from the specified key and subkey.
RegNotifyChangeKeyValue(HKEY hKey, bool bWatchSubtree, REG_NOTIFY_FILTER dwNotifyFilter, HANDLE? hEvent, bool fAsynchronous) WIN32_ERROR advapi32
Notifies the caller about changes to the attributes or contents of a specified registry key.
RegOpenCurrentUser(int samDesired, Pointer<Pointer<NativeType>> phkResult) WIN32_ERROR advapi32
Retrieves a handle to the HKEY_CURRENT_USER key for the user the current thread is impersonating.
RegOpenKey(HKEY hKey, PCWSTR? lpSubKey, Pointer<Pointer<NativeType>> phkResult) WIN32_ERROR advapi32
Opens the specified registry key.
RegOpenKeyEx(HKEY hKey, PCWSTR? lpSubKey, int? ulOptions, REG_SAM_FLAGS samDesired, Pointer<Pointer<NativeType>> phkResult) WIN32_ERROR advapi32
Opens the specified registry key.
RegOpenKeyTransacted(HKEY hKey, PCWSTR? lpSubKey, int? ulOptions, REG_SAM_FLAGS samDesired, Pointer<Pointer<NativeType>> phkResult, HANDLE hTransaction) WIN32_ERROR advapi32
Opens the specified registry key and associates it with a transaction.
RegOpenUserClassesRoot(HANDLE hToken, int samDesired, Pointer<Pointer<NativeType>> phkResult) WIN32_ERROR advapi32
Retrieves a handle to the HKEY_CLASSES_ROOT key for a specified user.
RegOverridePredefKey(HKEY hKey, HKEY? hNewHKey) WIN32_ERROR advapi32
Maps a predefined registry key to the specified registry key.
RegQueryInfoKey(HKEY hKey, PWSTR? lpClass, Pointer<Uint32>? lpcchClass, Pointer<Uint32>? lpcSubKeys, Pointer<Uint32>? lpcbMaxSubKeyLen, Pointer<Uint32>? lpcbMaxClassLen, Pointer<Uint32>? lpcValues, Pointer<Uint32>? lpcbMaxValueNameLen, Pointer<Uint32>? lpcbMaxValueLen, Pointer<Uint32>? lpcbSecurityDescriptor, Pointer<FILETIME>? lpftLastWriteTime) WIN32_ERROR advapi32
Retrieves information about the specified registry key.
RegQueryMultipleValues(HKEY hKey, Pointer<VALENT> val_list, int num_vals, PWSTR? lpValueBuf, Pointer<Uint32>? ldwTotsize) WIN32_ERROR advapi32
Retrieves the type and data for a list of value names associated with an open registry key.
RegQueryReflectionKey(HKEY hBase, Pointer<Int32> bIsReflectionDisabled) WIN32_ERROR advapi32
Determines whether reflection has been disabled or enabled for the specified key.
RegQueryValue(HKEY hKey, PCWSTR? lpSubKey, PWSTR? lpData, Pointer<Int32>? lpcbData) WIN32_ERROR advapi32
Retrieves the data associated with the default or unnamed value of a specified registry key.
RegQueryValueEx(HKEY hKey, PCWSTR? lpValueName, Pointer<Uint32>? lpType, Pointer<Uint8>? lpData, Pointer<Uint32>? lpcbData) WIN32_ERROR advapi32
Retrieves the type and data for the specified value name associated with an open registry key.
RegRenameKey(HKEY hKey, PCWSTR? lpSubKeyName, PCWSTR lpNewKeyName) WIN32_ERROR advapi32
Changes the name of the specified registry key.
RegReplaceKey(HKEY hKey, PCWSTR? lpSubKey, PCWSTR lpNewFile, PCWSTR lpOldFile) WIN32_ERROR advapi32
Replaces the file backing a registry key and all its subkeys with another file, so that when the system is next started, the key and subkeys will have the values stored in the new file.
RegRestoreKey(HKEY hKey, PCWSTR lpFile, REG_RESTORE_KEY_FLAGS dwFlags) WIN32_ERROR advapi32
Reads the registry information in a specified file and copies it over the specified key.
RegSaveKey(HKEY hKey, PCWSTR lpFile, Pointer<SECURITY_ATTRIBUTES>? lpSecurityAttributes) WIN32_ERROR advapi32
Saves the specified key and all of its subkeys and values to a new file, in the standard format.
RegSaveKeyEx(HKEY hKey, PCWSTR lpFile, Pointer<SECURITY_ATTRIBUTES>? lpSecurityAttributes, REG_SAVE_FORMAT flags) WIN32_ERROR advapi32
Saves the specified key and all of its subkeys and values to a registry file, in the specified format.
RegSetKeyValue(HKEY hKey, PCWSTR? lpSubKey, PCWSTR? lpValueName, int dwType, Pointer<NativeType>? lpData, int cbData) WIN32_ERROR advapi32
Sets the data for the specified value in the specified registry key and subkey.
RegSetValue(HKEY hKey, PCWSTR? lpSubKey, REG_VALUE_TYPE dwType, PCWSTR? lpData, int cbData) WIN32_ERROR advapi32
Sets the data for the default or unnamed value of a specified registry key.
RegSetValueEx(HKEY hKey, PCWSTR? lpValueName, REG_VALUE_TYPE dwType, Pointer<Uint8>? lpData, int cbData) WIN32_ERROR advapi32
Sets the data and type of a specified value under a registry key.
RegUnLoadKey(HKEY hKey, PCWSTR? lpSubKey) WIN32_ERROR advapi32
Unloads the specified registry key and its subkeys from the registry.
SetServiceObjectSecurity(SC_HANDLE hService, OBJECT_SECURITY_INFORMATION dwSecurityInformation, PSECURITY_DESCRIPTOR lpSecurityDescriptor) Win32Result<bool> advapi32
Sets the security descriptor of a service object.
SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, Pointer<SERVICE_STATUS> lpServiceStatus) Win32Result<bool> advapi32
Updates the service control manager's status information for the calling service.
SetThreadToken(Pointer<Pointer<NativeType>>? thread, HANDLE? token) Win32Result<bool> advapi32
Assigns an impersonation token to a thread.
StartService(SC_HANDLE hService, int dwNumServiceArgs, Pointer<Pointer<Utf16>>? lpServiceArgVectors) Win32Result<bool> advapi32
Starts a service.
StartServiceCtrlDispatcher(Pointer<SERVICE_TABLE_ENTRY> lpServiceStartTable) Win32Result<bool> advapi32
Connects the main thread of a service process to the service control manager, which causes the thread to be the service control dispatcher thread for the calling process.