advapi32 topic

Advanced Base API Library

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

Functions

ChangeServiceConfig2(int hService, int dwInfoLevel, Pointer<NativeType> lpInfo) int advapi32
BOOL ChangeServiceConfig2W( [in] SC_HANDLE hService, [in] DWORD dwInfoLevel, [in, optional] LPVOID lpInfo );
CloseServiceHandle(int hSCObject) int advapi32
Closes a handle to a service control manager or service object.
ControlService(int hService, int dwControl, Pointer<SERVICE_STATUS> lpServiceStatus) int advapi32
Sends a control code to a service.
ControlServiceEx(int hService, int dwControl, int dwInfoLevel, Pointer<NativeType> pControlParams) int advapi32
Sends a control code to a service.
CredDelete(Pointer<Utf16> TargetName, int Type, int Flags) int advapi32
The CredDelete function deletes a credential from the user's credential set. The credential set used is the one associated with the logon session of the current token. The token must not have the user's SID disabled.
CredFree(Pointer<NativeType> Buffer) → void advapi32
The CredFree function frees a buffer returned by any of the credentials management functions.
CredRead(Pointer<Utf16> TargetName, int Type, int Flags, Pointer<Pointer<CREDENTIAL>> Credential) int advapi32
The CredRead function reads a credential from the user's credential set. The credential set used is the one associated with the logon session of the current token. The token must not have the user's SID disabled.
CredWrite(Pointer<CREDENTIAL> Credential, int Flags) int advapi32
The CredWrite function creates a new credential or modifies an existing credential in the user's credential set. The new credential is associated with the logon session of the current token. The token must not have the user's security identifier (SID) disabled.
DecryptFile(Pointer<Utf16> lpFileName, int dwReserved) int advapi32
Decrypts an encrypted file or directory.
DeleteService(int hService) int advapi32
Marks the specified service for deletion from the service control manager database.
EncryptFile(Pointer<Utf16> lpFileName) int advapi32
Encrypts a file or directory. All data streams in a file are encrypted. All new files created in an encrypted directory are encrypted.
EnumDependentServices(int hService, int dwServiceState, Pointer<ENUM_SERVICE_STATUS> lpServices, int cbBufSize, Pointer<Uint32> pcbBytesNeeded, Pointer<Uint32> lpServicesReturned) int advapi32
Retrieves the name and status of each service that depends on the specified service; that is, the specified service must be running before the dependent services can run.
EnumServicesStatus(int hSCManager, int dwServiceType, int dwServiceState, Pointer<ENUM_SERVICE_STATUS> lpServices, int cbBufSize, Pointer<Uint32> pcbBytesNeeded, Pointer<Uint32> lpServicesReturned, Pointer<Uint32> lpResumeHandle) int advapi32
Enumerates services in the specified service control manager database. The name and status of each service are provided.
EnumServicesStatusEx(int hSCManager, int InfoLevel, int dwServiceType, int dwServiceState, Pointer<Uint8> lpServices, int cbBufSize, Pointer<Uint32> pcbBytesNeeded, Pointer<Uint32> lpServicesReturned, Pointer<Uint32> lpResumeHandle, Pointer<Utf16> pszGroupName) int advapi32
Enumerates services in the specified service control manager database. The name and status of each service are provided, along with additional data based on the specified information level.
FileEncryptionStatus(Pointer<Utf16> lpFileName, Pointer<Uint32> lpStatus) int advapi32
Retrieves the encryption status of the specified file.
GetCurrentProcessToken() int advapi32
Retrieves a pseudo-handle that you can use as a shorthand way to refer to the access token associated with a process.
GetCurrentThreadEffectiveToken() int advapi32
Retrieves a pseudo-handle that you can use as a shorthand way to refer to the impersonation token that was assigned to the current thread.
GetCurrentThreadToken() int advapi32
Retrieves a pseudo-handle that you can use as a shorthand way to refer to the impersonation token that was assigned to the current thread.
GetServiceDisplayName(int hSCManager, Pointer<Utf16> lpServiceName, Pointer<Utf16> lpDisplayName, Pointer<Uint32> lpcchBuffer) int advapi32
Retrieves the display name of the specified service.
GetServiceKeyName(int hSCManager, Pointer<Utf16> lpDisplayName, Pointer<Utf16> lpServiceName, Pointer<Uint32> lpcchBuffer) int advapi32
Retrieves the service name of the specified service.
GetTokenInformation(int TokenHandle, int TokenInformationClass, Pointer<NativeType> TokenInformation, int TokenInformationLength, Pointer<Uint32> ReturnLength) int advapi32
The GetTokenInformation function retrieves a specified type of information about an access token. The calling process must have appropriate access rights to obtain the information.
GetUserName(Pointer<Utf16> lpBuffer, Pointer<Uint32> pcbBuffer) int advapi32
Retrieves the name of the user associated with the current thread.
InitiateShutdown(Pointer<Utf16> lpMachineName, Pointer<Utf16> lpMessage, int dwGracePeriod, int dwShutdownFlags, int dwReason) int advapi32
Initiates a shutdown and restart of the specified computer, and restarts any applications that have been registered for restart.
NotifyBootConfigStatus(int BootAcceptable) int advapi32
Reports the boot status to the service control manager. It is used by boot verification programs. This function can be called only by a process running in the LocalSystem or Administrator's account.
NotifyServiceStatusChange(int hService, int 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(int ProcessHandle, int DesiredAccess, Pointer<IntPtr> TokenHandle) int advapi32
The OpenProcessToken function opens the access token associated with a process.
OpenSCManager(Pointer<Utf16> lpMachineName, Pointer<Utf16> lpDatabaseName, int dwDesiredAccess) int advapi32
Establishes a connection to the service control manager on the specified computer and opens the specified service control manager database.
OpenService(int hSCManager, Pointer<Utf16> lpServiceName, int dwDesiredAccess) int advapi32
Opens an existing service.
OpenThreadToken(int ThreadHandle, int DesiredAccess, int OpenAsSelf, Pointer<IntPtr> TokenHandle) int advapi32
The OpenThreadToken function opens the access token associated with a thread.
QueryServiceConfig(int hService, Pointer<QUERY_SERVICE_CONFIG> lpServiceConfig, int cbBufSize, Pointer<Uint32> pcbBytesNeeded) int advapi32
Retrieves the configuration parameters of the specified service. Optional configuration parameters are available using the QueryServiceConfig2 function.
QueryServiceConfig2(int hService, int dwInfoLevel, Pointer<Uint8> lpBuffer, int cbBufSize, Pointer<Uint32> pcbBytesNeeded) int advapi32
Retrieves the optional configuration parameters of the specified service.
QueryServiceDynamicInformation(int hServiceStatus, int dwInfoLevel, Pointer<Pointer<NativeType>> ppDynamicInfo) int advapi32
Retrieves dynamic information related to the current service start.
QueryServiceObjectSecurity(int hService, int dwSecurityInformation, Pointer<NativeType> lpSecurityDescriptor, int cbBufSize, Pointer<Uint32> pcbBytesNeeded) int advapi32
The QueryServiceObjectSecurity function retrieves a copy of the security descriptor associated with a service object. You can also use the GetNamedSecurityInfo function to retrieve a security descriptor.
QueryServiceStatus(int hService, Pointer<SERVICE_STATUS> lpServiceStatus) int advapi32
Retrieves the current status of the specified service.
QueryServiceStatusEx(int hService, int InfoLevel, Pointer<Uint8> lpBuffer, int cbBufSize, Pointer<Uint32> pcbBytesNeeded) int advapi32
Retrieves the current status of the specified service based on the specified information level.
RegCloseKey(int hKey) int advapi32
Closes a handle to the specified registry key.
RegConnectRegistry(Pointer<Utf16> lpMachineName, int hKey, Pointer<IntPtr> phkResult) int advapi32
Establishes a connection to a predefined registry key on another computer.
RegCopyTree(int hKeySrc, Pointer<Utf16> lpSubKey, int hKeyDest) int advapi32
Copies the specified registry key, along with its values and subkeys, to the specified destination key.
RegCreateKey(int hKey, Pointer<Utf16> lpSubKey, Pointer<IntPtr> phkResult) int advapi32
Creates the specified registry key. If the key already exists in the registry, the function opens it.
RegCreateKeyEx(int hKey, Pointer<Utf16> lpSubKey, int Reserved, Pointer<Utf16> lpClass, int dwOptions, int samDesired, Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes, Pointer<IntPtr> phkResult, Pointer<Uint32> lpdwDisposition) int advapi32
Creates the specified registry key. If the key already exists, the function opens it. Note that key names are not case sensitive.
RegCreateKeyTransacted(int hKey, Pointer<Utf16> lpSubKey, int Reserved, Pointer<Utf16> lpClass, int dwOptions, int samDesired, Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes, Pointer<IntPtr> phkResult, Pointer<Uint32> lpdwDisposition, int hTransaction, Pointer<NativeType> pExtendedParemeter) int advapi32
Establishes a connection to a predefined registry key on another computer.
RegDeleteKey(int hKey, Pointer<Utf16> lpSubKey) int advapi32
Deletes a subkey and its values. Note that key names are not case sensitive.
RegDeleteKeyEx(int hKey, Pointer<Utf16> lpSubKey, int samDesired, int Reserved) int advapi32
Deletes a subkey and its values from the specified platform-specific view of the registry. Note that key names are not case sensitive.
RegDeleteKeyTransacted(int hKey, Pointer<Utf16> lpSubKey, int samDesired, int Reserved, int hTransaction, Pointer<NativeType> pExtendedParameter) int advapi32
Deletes a subkey and its values from the specified platform-specific view of the registry as a transacted operation. Note that key names are not case sensitive.
RegDeleteKeyValue(int hKey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpValueName) int advapi32
Removes the specified value from the specified registry key and subkey.
RegDeleteTree(int hKey, Pointer<Utf16> lpSubKey) int advapi32
Deletes the subkeys and values of the specified key recursively.
RegDeleteValue(int hKey, Pointer<Utf16> lpValueName) int advapi32
Removes a named value from the specified registry key. Note that value names are not case sensitive.
RegDisablePredefinedCache() int advapi32
Disables handle caching of the predefined registry handle for HKEY_CURRENT_USER for the current process. This function does not work on a remote computer.
RegDisablePredefinedCacheEx() int advapi32
Disables handle caching for all predefined registry handles for the current process.
RegDisableReflectionKey(int hBase) int advapi32
Disables registry reflection for the specified key. Disabling reflection for a key does not affect reflection of any subkeys.
RegEnableReflectionKey(int hBase) int advapi32
Restores registry reflection for the specified disabled key. Restoring reflection for a key does not affect reflection of any subkeys.
RegEnumKey(int hKey, int dwIndex, Pointer<Utf16> lpName, int cchName) int advapi32
Enumerates the subkeys of the specified open registry key. The function retrieves the name of one subkey each time it is called.
RegEnumKeyEx(int hKey, int dwIndex, Pointer<Utf16> lpName, Pointer<Uint32> lpcchName, Pointer<Uint32> lpReserved, Pointer<Utf16> lpClass, Pointer<Uint32> lpcchClass, Pointer<FILETIME> lpftLastWriteTime) int advapi32
Enumerates the subkeys of the specified open registry key. The function retrieves information about one subkey each time it is called.
RegEnumValue(int hKey, int dwIndex, Pointer<Utf16> lpValueName, Pointer<Uint32> lpcchValueName, Pointer<Uint32> lpReserved, Pointer<Uint32> lpType, Pointer<Uint8> lpData, Pointer<Uint32> lpcbData) int advapi32
Enumerates the values for the specified open registry key. The function copies one indexed value name and data block for the key each time it is called.
RegFlushKey(int hKey) int advapi32
Writes all the attributes of the specified open registry key into the registry.
RegGetValue(int hkey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpValue, int dwFlags, Pointer<Uint32> pdwType, Pointer<NativeType> pvData, Pointer<Uint32> pcbData) int advapi32
Retrieves the type and data for the specified registry value.
RegisterServiceCtrlHandler(Pointer<Utf16> lpServiceName, Pointer<NativeFunction<LPHANDLER_FUNCTION>> lpHandlerProc) int advapi32
Registers a function to handle service control requests.
RegisterServiceCtrlHandlerEx(Pointer<Utf16> lpServiceName, Pointer<NativeFunction<LPHANDLER_FUNCTION_EX>> lpHandlerProc, Pointer<NativeType> lpContext) int advapi32
Registers a function to handle extended service control requests.
RegLoadAppKey(Pointer<Utf16> lpFile, Pointer<IntPtr> phkResult, int samDesired, int dwOptions, int Reserved) int advapi32
Loads the specified registry hive as an application hive.
RegLoadKey(int hKey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpFile) int advapi32
Creates a subkey under HKEY_USERS or HKEY_LOCAL_MACHINE and loads the data from the specified registry hive into that subkey.
RegLoadMUIString(int hKey, Pointer<Utf16> pszValue, Pointer<Utf16> pszOutBuf, int cbOutBuf, Pointer<Uint32> pcbData, int Flags, Pointer<Utf16> pszDirectory) int advapi32
Loads the specified string from the specified key and subkey.
RegNotifyChangeKeyValue(int hKey, int bWatchSubtree, int dwNotifyFilter, int hEvent, int fAsynchronous) int advapi32
Notifies the caller about changes to the attributes or contents of a specified registry key.
RegOpenCurrentUser(int samDesired, Pointer<IntPtr> phkResult) int advapi32
Retrieves a handle to the HKEY_CURRENT_USER key for the user the current thread is impersonating.
RegOpenKey(int hKey, Pointer<Utf16> lpSubKey, Pointer<IntPtr> phkResult) int advapi32
Opens the specified registry key.
RegOpenKeyEx(int hKey, Pointer<Utf16> lpSubKey, int ulOptions, int samDesired, Pointer<IntPtr> phkResult) int advapi32
Opens the specified registry key. Note that key names are not case sensitive.
RegOpenKeyTransacted(int hKey, Pointer<Utf16> lpSubKey, int ulOptions, int samDesired, Pointer<IntPtr> phkResult, int hTransaction, Pointer<NativeType> pExtendedParemeter) int advapi32
Opens the specified registry key and associates it with a transaction. Note that key names are not case sensitive.
RegOpenUserClassesRoot(int hToken, int dwOptions, int samDesired, Pointer<IntPtr> phkResult) int advapi32
Retrieves a handle to the HKEY_CLASSES_ROOT key for a specified user. The user is identified by an access token.
RegOverridePredefKey(int hKey, int hNewHKey) int advapi32
Maps a predefined registry key to the specified registry key.
RegQueryInfoKey(int hKey, Pointer<Utf16> lpClass, Pointer<Uint32> lpcchClass, Pointer<Uint32> lpReserved, Pointer<Uint32> lpcSubKeys, Pointer<Uint32> lpcbMaxSubKeyLen, Pointer<Uint32> lpcbMaxClassLen, Pointer<Uint32> lpcValues, Pointer<Uint32> lpcbMaxValueNameLen, Pointer<Uint32> lpcbMaxValueLen, Pointer<Uint32> lpcbSecurityDescriptor, Pointer<FILETIME> lpftLastWriteTime) int advapi32
Retrieves information about the specified registry key.
RegQueryMultipleValues(int hKey, Pointer<VALENT> val_list, int num_vals, Pointer<Utf16> lpValueBuf, Pointer<Uint32> ldwTotsize) int advapi32
Retrieves the type and data for a list of value names associated with an open registry key.
RegQueryReflectionKey(int hBase, Pointer<Int32> bIsReflectionDisabled) int advapi32
Determines whether reflection has been disabled or enabled for the specified key.
RegQueryValue(int hKey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpData, Pointer<Int32> lpcbData) int advapi32
Retrieves the data associated with the default or unnamed value of a specified registry key. The data must be a null-terminated string.
RegQueryValueEx(int hKey, Pointer<Utf16> lpValueName, Pointer<Uint32> lpReserved, Pointer<Uint32> lpType, Pointer<Uint8> lpData, Pointer<Uint32> lpcbData) int advapi32
Retrieves the type and data for the specified value name associated with an open registry key. To ensure that any string values (REG_SZ, REG_MULTI_SZ, and REG_EXPAND_SZ) returned are null-terminated, use the RegGetValue function.
RegRenameKey(int hKey, Pointer<Utf16> lpSubKeyName, Pointer<Utf16> lpNewKeyName) int advapi32
Changes the name of the specified registry key.
RegReplaceKey(int hKey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpNewFile, Pointer<Utf16> lpOldFile) int 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(int hKey, Pointer<Utf16> lpFile, int dwFlags) int advapi32
Reads the registry information in a specified file and copies it over the specified key. This registry information may be in the form of a key and multiple levels of subkeys.
RegSaveKey(int hKey, Pointer<Utf16> lpFile, Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes) int advapi32
Saves the specified key and all of its subkeys and values to a new file, in the standard format.
RegSaveKeyEx(int hKey, Pointer<Utf16> lpFile, Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes, int Flags) int advapi32
Saves the specified key and all of its subkeys and values to a registry file, in the specified format.
RegSetKeyValue(int hKey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpValueName, int dwType, Pointer<NativeType> lpData, int cbData) int advapi32
Sets the data for the specified value in the specified registry key and subkey.
RegSetValue(int hKey, Pointer<Utf16> lpSubKey, int dwType, Pointer<Utf16> lpData, int cbData) int advapi32
Sets the data for the default or unnamed value of a specified registry key. The data must be a text string.
RegSetValueEx(int hKey, Pointer<Utf16> lpValueName, int Reserved, int dwType, Pointer<Uint8> lpData, int cbData) int advapi32
Sets the data and type of a specified value under a registry key.
RegUnLoadKey(int hKey, Pointer<Utf16> lpSubKey) int advapi32
Unloads the specified registry key and its subkeys from the registry.
SetServiceObjectSecurity(int hService, int dwSecurityInformation, Pointer<NativeType> lpSecurityDescriptor) int advapi32
The SetServiceObjectSecurity function sets the security descriptor of a service object.
SetServiceStatus(int hServiceStatus, Pointer<SERVICE_STATUS> lpServiceStatus) int advapi32
Updates the service control manager's status information for the calling service.
SetThreadToken(Pointer<IntPtr> Thread, int Token) int advapi32
The SetThreadToken function assigns an impersonation token to a thread. The function can also cause a thread to stop using an impersonation token.
StartService(int hService, int dwNumServiceArgs, Pointer<Pointer<Utf16>> lpServiceArgVectors) int advapi32
Starts a service.
StartServiceCtrlDispatcher(Pointer<SERVICE_TABLE_ENTRY> lpServiceStartTable) int 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.