Skip to main content


com.sun.jna.platform.win32
Interface Advapi32

All Superinterfaces:
com.sun.jna.AltCallingConvention, com.sun.jna.Library, com.sun.jna.win32.StdCall, com.sun.jna.win32.StdCallLibrary, W32API

public interface Advapi32
extends W32API

Advapi32.dll Interface.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.jna.platform.win32.W32API
W32API.DWORD, W32API.HANDLE, W32API.HANDLEByReference, W32API.HBITMAP, W32API.HDC, W32API.HICON, W32API.HINSTANCE, W32API.HMODULE, W32API.HRESULT, W32API.HRGN, W32API.HWND, W32API.LONG, W32API.LONG_PTR, W32API.LPARAM, W32API.LRESULT, W32API.SIZE_T, W32API.SSIZE_T, W32API.UINT_PTR, W32API.ULONG_PTR, W32API.WORD, W32API.WPARAM
 
Nested classes/interfaces inherited from interface com.sun.jna.win32.StdCallLibrary
com.sun.jna.win32.StdCallLibrary.StdCallCallback
 
Nested classes/interfaces inherited from interface com.sun.jna.Library
com.sun.jna.Library.Handler
 
Field Summary
static Advapi32 INSTANCE
           
 
Fields inherited from interface com.sun.jna.platform.win32.W32API
HWND_BROADCAST, INVALID_HANDLE_VALUE
 
Fields inherited from interface com.sun.jna.win32.StdCallLibrary
FUNCTION_MAPPER, STDCALL_CONVENTION
 
Fields inherited from interface com.sun.jna.Library
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER
 
Method Summary
 boolean ConvertSidToStringSid(WinNT.PSID Sid, com.sun.jna.ptr.PointerByReference StringSid)
          Convert a security identifier (SID) to a string format suitable for display, storage, or transmission.
 boolean ConvertStringSidToSid(java.lang.String StringSid, WinNT.PSIDByReference Sid)
          Convert a string-format security identifier (SID) into a valid, functional SID.
 boolean DuplicateToken(W32API.HANDLE ExistingTokenHandle, int ImpersonationLevel, W32API.HANDLEByReference DuplicateTokenHandle)
          The DuplicateToken function creates a new access token that duplicates one already in existence.
 int GetLengthSid(WinNT.PSID pSid)
          Returns the length, in bytes, of a valid security identifier (SID).
 boolean GetTokenInformation(W32API.HANDLE tokenHandle, int tokenInformationClass, com.sun.jna.Structure tokenInformation, int tokenInformationLength, com.sun.jna.ptr.IntByReference returnLength)
          Retrieves a specified type of information about an access token.
 boolean GetUserNameW(char[] buffer, com.sun.jna.ptr.IntByReference len)
          Retrieves the name of the user associated with the current thread.
 boolean ImpersonateLoggedOnUser(W32API.HANDLE hToken)
          The ImpersonateLoggedOnUser function lets the calling thread impersonate the security context of a logged-on user.
 boolean IsValidSid(WinNT.PSID pSid)
          The IsValidSid function validates a security identifier (SID) by verifying that the revision number is within a known range, and that the number of subauthorities is less than the maximum.
 boolean LogonUser(java.lang.String lpszUsername, java.lang.String lpszDomain, java.lang.String lpszPassword, int logonType, int logonProvider, W32API.HANDLEByReference phToken)
          The LogonUser function attempts to log a user on to the local computer.
 boolean LookupAccountName(java.lang.String lpSystemName, java.lang.String lpAccountName, WinNT.PSID Sid, com.sun.jna.ptr.IntByReference cbSid, char[] ReferencedDomainName, com.sun.jna.ptr.IntByReference cchReferencedDomainName, com.sun.jna.ptr.PointerByReference peUse)
          Accepts the name of a system and anaccount as input and retrieves a security identifier (SID) for the account and the name of the domain on which the account was found.
 boolean LookupAccountSid(java.lang.String lpSystemName, WinNT.PSID Sid, char[] lpName, com.sun.jna.ptr.IntByReference cchName, char[] ReferencedDomainName, com.sun.jna.ptr.IntByReference cchReferencedDomainName, com.sun.jna.ptr.PointerByReference peUse)
          Retrieves the name of the account for this SID and the name of the first domain on which this SID is found.
 boolean OpenProcessToken(W32API.HANDLE ProcessHandle, int DesiredAccess, W32API.HANDLEByReference TokenHandle)
          The OpenProcessToken function opens the access token associated with a process.
 boolean OpenThreadToken(W32API.HANDLE ThreadHandle, int DesiredAccess, boolean OpenAsSelf, W32API.HANDLEByReference TokenHandle)
          The OpenThreadToken function opens the access token associated with a thread.
 int RegCloseKey(WinReg.HKEY hKey)
          The RegCloseKey function releases a handle to the specified registry key.
 int RegCreateKeyEx(WinReg.HKEY hKey, java.lang.String lpSubKey, int Reserved, java.lang.String lpClass, int dwOptions, int samDesired, WinNT.SECURITY_ATTRIBUTES lpSecurityAttributes, WinReg.HKEYByReference phkResult, com.sun.jna.ptr.IntByReference lpdwDisposition)
           
 int RegDeleteKey(WinReg.HKEY hKey, java.lang.String name)
           
 int RegDeleteValue(WinReg.HKEY hKey, java.lang.String lpValueName)
          The RegDeleteValue function removes a named value from the specified registry key.
 int RegEnumKeyEx(WinReg.HKEY hKey, int dwIndex, char[] lpName, com.sun.jna.ptr.IntByReference lpcName, com.sun.jna.ptr.IntByReference reserved, char[] lpClass, com.sun.jna.ptr.IntByReference lpcClass, WinBase.FILETIME lpftLastWriteTime)
          The RegEnumKeyEx function enumerates subkeys of the specified open registry key.
 int RegEnumValue(WinReg.HKEY hKey, int dwIndex, char[] lpValueName, com.sun.jna.ptr.IntByReference lpcchValueName, com.sun.jna.ptr.IntByReference reserved, com.sun.jna.ptr.IntByReference lpType, byte[] lpData, com.sun.jna.ptr.IntByReference lpcbData)
          The RegEnumValue function enumerates the values for the specified open registry key.
 int RegOpenKeyEx(WinReg.HKEY hKey, java.lang.String lpSubKey, int ulOptions, int samDesired, WinReg.HKEYByReference phkResult)
          The RegOpenKeyEx function opens the specified registry key.
 int RegQueryInfoKey(WinReg.HKEY hKey, char[] lpClass, com.sun.jna.ptr.IntByReference lpcClass, com.sun.jna.ptr.IntByReference lpReserved, com.sun.jna.ptr.IntByReference lpcSubKeys, com.sun.jna.ptr.IntByReference lpcMaxSubKeyLen, com.sun.jna.ptr.IntByReference lpcMaxClassLen, com.sun.jna.ptr.IntByReference lpcValues, com.sun.jna.ptr.IntByReference lpcMaxValueNameLen, com.sun.jna.ptr.IntByReference lpcMaxValueLen, com.sun.jna.ptr.IntByReference lpcbSecurityDescriptor, WinBase.FILETIME lpftLastWriteTime)
          The RegQueryInfoKey function retrieves information about the specified registry key.
 int RegQueryValueEx(WinReg.HKEY hKey, java.lang.String lpValueName, int lpReserved, com.sun.jna.ptr.IntByReference lpType, byte[] lpData, com.sun.jna.ptr.IntByReference lpcbData)
           
 int RegQueryValueEx(WinReg.HKEY hKey, java.lang.String lpValueName, int lpReserved, com.sun.jna.ptr.IntByReference lpType, char[] lpData, com.sun.jna.ptr.IntByReference lpcbData)
          The RegQueryValueEx function retrieves the type and data for a specified value name associated with an open registry key.
 int RegQueryValueEx(WinReg.HKEY hKey, java.lang.String lpValueName, int lpReserved, com.sun.jna.ptr.IntByReference lpType, com.sun.jna.ptr.IntByReference lpData, com.sun.jna.ptr.IntByReference lpcbData)
           
 int RegSetValueEx(WinReg.HKEY hKey, java.lang.String lpValueName, int Reserved, int dwType, byte[] lpData, int cbData)
           
 int RegSetValueEx(WinReg.HKEY hKey, java.lang.String lpValueName, int Reserved, int dwType, char[] lpData, int cbData)
          The RegSetValueEx function sets the data and type of a specified value under a registry key.
 boolean RevertToSelf()
          The RevertToSelf function terminates the impersonation of a client application.
 

Field Detail

INSTANCE

static final Advapi32 INSTANCE
Method Detail

GetUserNameW

boolean GetUserNameW(char[] buffer,
                     com.sun.jna.ptr.IntByReference len)
Retrieves the name of the user associated with the current thread. http://msdn.microsoft.com/en-us/library/ms724432(VS.85).aspx

Parameters:
buffer - Buffer to receive the user's logon name.
len - On input, the size of the buffer, on output the number of characters copied into the buffer, including the terminating null character.
Returns:
True if succeeded.

LookupAccountName

boolean LookupAccountName(java.lang.String lpSystemName,
                          java.lang.String lpAccountName,
                          WinNT.PSID Sid,
                          com.sun.jna.ptr.IntByReference cbSid,
                          char[] ReferencedDomainName,
                          com.sun.jna.ptr.IntByReference cchReferencedDomainName,
                          com.sun.jna.ptr.PointerByReference peUse)
Accepts the name of a system and anaccount as input and retrieves a security identifier (SID) for the account and the name of the domain on which the account was found. http://msdn.microsoft.com/en-us/library/aa379159(VS.85).aspx

Parameters:
lpSystemName - Specifies the name of the system.
lpAccountName - Specifies the account name.
Sid - Receives the SID structure that corresponds to the account name pointed to by the lpAccountName parameter.
cbSid - On input, this value specifies the size, in bytes, of the Sid buffer. If the function fails because the buffer is too small or if cbSid is zero, this variable receives the required buffer size.
ReferencedDomainName - Receives the name of the domain where the account name is found.
cchReferencedDomainName - On input, this value specifies the size, in TCHARs, of the ReferencedDomainName buffer. If the function fails because the buffer is too small, this variable receives the required buffer size, including the terminating null character.
peUse - SID_NAME_USE enumerated type that indicates the type of the account when the function returns.
Returns:
True if the function was successful, False otherwise.

LookupAccountSid

boolean LookupAccountSid(java.lang.String lpSystemName,
                         WinNT.PSID Sid,
                         char[] lpName,
                         com.sun.jna.ptr.IntByReference cchName,
                         char[] ReferencedDomainName,
                         com.sun.jna.ptr.IntByReference cchReferencedDomainName,
                         com.sun.jna.ptr.PointerByReference peUse)
Retrieves the name of the account for this SID and the name of the first domain on which this SID is found.

Parameters:
lpSystemName - Specifies the target computer.
Sid - The SID to look up.
lpName - Buffer that receives a null-terminated string that contains the account name that corresponds to the lpSid parameter.
cchName - On input, specifies the size, in TCHARs, of the lpName buffer. If the function fails because the buffer is too small or if cchName is zero, cchName receives the required buffer size, including the terminating null character.
ReferencedDomainName - Pointer to a buffer that receives a null-terminated string that contains the name of the domain where the account name was found.
cchReferencedDomainName - On input, specifies the size, in TCHARs, of the lpReferencedDomainName buffer. If the function fails because the buffer is too small or if cchReferencedDomainName is zero, cchReferencedDomainName receives the required buffer size, including the terminating null character.
peUse - Pointer to a variable that receives a SID_NAME_USE value that indicates the type of the account.
Returns:
If the function succeeds, the function returns nonzero. If the function fails, it returns zero. To get extended error information, call GetLastError.

ConvertSidToStringSid

boolean ConvertSidToStringSid(WinNT.PSID Sid,
                              com.sun.jna.ptr.PointerByReference StringSid)
Convert a security identifier (SID) to a string format suitable for display, storage, or transmission. http://msdn.microsoft.com/en-us/library/aa376399(VS.85).aspx

Parameters:
Sid - The SID structure to be converted.
StringSid - Pointer to a variable that receives a pointer to a null-terminated SID string. To free the returned buffer, call the LocalFree function.
Returns:
True if the function was successful, False otherwise.

ConvertStringSidToSid

boolean ConvertStringSidToSid(java.lang.String StringSid,
                              WinNT.PSIDByReference Sid)
Convert a string-format security identifier (SID) into a valid, functional SID. http://msdn.microsoft.com/en-us/library/aa376402(VS.85).aspx

Parameters:
StringSid - The string-format SID to convert.
Sid - Receives a pointer to the converted SID.
Returns:
True if the function was successful, False otherwise.

GetLengthSid

int GetLengthSid(WinNT.PSID pSid)
Returns the length, in bytes, of a valid security identifier (SID). http://msdn.microsoft.com/en-us/library/aa446642(VS.85).aspx

Parameters:
pSid - A pointer to the SID structure whose length is returned.
Returns:
Length of the SID.

IsValidSid

boolean IsValidSid(WinNT.PSID pSid)
The IsValidSid function validates a security identifier (SID) by verifying that the revision number is within a known range, and that the number of subauthorities is less than the maximum.

Parameters:
pSid - Pointer to the SID structure to validate. This parameter cannot be NULL.
Returns:
If the SID structure is valid, the return value is nonzero. If the SID structure is not valid, the return value is zero. There is no extended error information for this function; do not call GetLastError.

LogonUser

boolean LogonUser(java.lang.String lpszUsername,
                  java.lang.String lpszDomain,
                  java.lang.String lpszPassword,
                  int logonType,
                  int logonProvider,
                  W32API.HANDLEByReference phToken)
The LogonUser function attempts to log a user on to the local computer. The local computer is the computer from which LogonUser was called. You cannot use LogonUser to log on to a remote computer. You specify the user with a user name and domain, and authenticate the user with a plaintext password. If the function succeeds, you receive a handle to a token that represents the logged-on user. You can then use this token handle to impersonate the specified user or, in most cases, to create a process that runs in the context of the specified user.

Parameters:
lpszUsername - A pointer to a null-terminated string that specifies the name of the user. This is the name of the user account to log on to. If you use the user principal name (UPN) format, user@DNS_domain_name, the lpszDomain parameter must be NULL.
lpszDomain - A pointer to a null-terminated string that specifies the name of the domain or server whose account database contains the lpszUsername account. If this parameter is NULL, the user name must be specified in UPN format. If this parameter is ".", the function validates the account using only the local account database.
lpszPassword - A pointer to a null-terminated string that specifies the plaintext password for the user account specified by lpszUsername.
logonType - The type of logon operation to perform.
logonProvider - Specifies the logon provider.
phToken - A pointer to a handle variable that receives a handle to a token that represents the specified user.
Returns:
If the function succeeds, the function returns nonzero. If the function fails, it returns zero. To get extended error information, call GetLastError.

OpenThreadToken

boolean OpenThreadToken(W32API.HANDLE ThreadHandle,
                        int DesiredAccess,
                        boolean OpenAsSelf,
                        W32API.HANDLEByReference TokenHandle)
The OpenThreadToken function opens the access token associated with a thread.

Parameters:
ThreadHandle - Handle to the thread whose access token is opened.
DesiredAccess - Specifies an access mask that specifies the requested types of access to the access token. These requested access types are reconciled against the token's discretionary access control list (DACL) to determine which accesses are granted or denied.
OpenAsSelf - Indicates whether the access check is to be made against the security context of the thread calling the OpenThreadToken function or against the security context of the process for the calling thread.
TokenHandle - Pointer to a variable that receives the handle to the newly opened access token.
Returns:
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.

OpenProcessToken

boolean OpenProcessToken(W32API.HANDLE ProcessHandle,
                         int DesiredAccess,
                         W32API.HANDLEByReference TokenHandle)
The OpenProcessToken function opens the access token associated with a process.

Parameters:
ProcessHandle - Handle to the process whose access token is opened. The process must have the PROCESS_QUERY_INFORMATION access permission.
DesiredAccess - Specifies an access mask that specifies the requested types of access to the access token. These requested access types are compared with the discretionary access control list (DACL) of the token to determine which accesses are granted or denied.
TokenHandle - Pointer to a handle that identifies the newly opened access token when the function returns.
Returns:
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.

DuplicateToken

boolean DuplicateToken(W32API.HANDLE ExistingTokenHandle,
                       int ImpersonationLevel,
                       W32API.HANDLEByReference DuplicateTokenHandle)
The DuplicateToken function creates a new access token that duplicates one already in existence.

Parameters:
ExistingTokenHandle - Handle to an access token opened with TOKEN_DUPLICATE access.
ImpersonationLevel - Specifies a SECURITY_IMPERSONATION_LEVEL enumerated type that supplies the impersonation level of the new token.
DuplicateTokenHandle - Pointer to a variable that receives a handle to the duplicate token. This handle has TOKEN_IMPERSONATE and TOKEN_QUERY access to the new token.
Returns:
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.

GetTokenInformation

boolean GetTokenInformation(W32API.HANDLE tokenHandle,
                            int tokenInformationClass,
                            com.sun.jna.Structure tokenInformation,
                            int tokenInformationLength,
                            com.sun.jna.ptr.IntByReference returnLength)
Retrieves a specified type of information about an access token. The calling process must have appropriate access rights to obtain the information.

Parameters:
tokenHandle - Handle to an access token from which information is retrieved. If TokenInformationClass specifies TokenSource, the handle must have TOKEN_QUERY_SOURCE access. For all other TokenInformationClass values, the handle must have TOKEN_QUERY access.
tokenInformationClass - Specifies a value from the TOKEN_INFORMATION_CLASS enumerated type to identify the type of information the function retrieves.
tokenInformation - Pointer to a buffer the function fills with the requested information. The structure put into this buffer depends upon the type of information specified by the TokenInformationClass parameter.
tokenInformationLength - Specifies the size, in bytes, of the buffer pointed to by the TokenInformation parameter. If TokenInformation is NULL, this parameter must be zero.
returnLength - Pointer to a variable that receives the number of bytes needed for the buffer pointed to by the TokenInformation parameter. If this value is larger than the value specified in the TokenInformationLength parameter, the function fails and stores no data in the buffer.
Returns:
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.

ImpersonateLoggedOnUser

boolean ImpersonateLoggedOnUser(W32API.HANDLE hToken)
The ImpersonateLoggedOnUser function lets the calling thread impersonate the security context of a logged-on user. The user is represented by a token handle.

Parameters:
hToken - Handle to a primary or impersonation access token that represents a logged-on user. This can be a token handle returned by a call to LogonUser, CreateRestrictedToken, DuplicateToken, DuplicateTokenEx, OpenProcessToken, or OpenThreadToken functions. If hToken is a primary token, it must have TOKEN_QUERY and TOKEN_DUPLICATE access. If hToken is an impersonation token, it must have TOKEN_QUERY and TOKEN_IMPERSONATE access.
Returns:
If the function succeeds, the return value is nonzero.

RevertToSelf

boolean RevertToSelf()
The RevertToSelf function terminates the impersonation of a client application.

Returns:
If the function succeeds, the return value is nonzero.

RegOpenKeyEx

int RegOpenKeyEx(WinReg.HKEY hKey,
                 java.lang.String lpSubKey,
                 int ulOptions,
                 int samDesired,
                 WinReg.HKEYByReference phkResult)
The RegOpenKeyEx function opens the specified registry key. Note that key names are not case sensitive.

Parameters:
hKey - Handle to an open key.
lpSubKey - Pointer to a null-terminated string containing the name of the subkey to open.
ulOptions - Reserved; must be zero.
samDesired - Access mask that specifies the desired access rights to the key. The function fails if the security descriptor of the key does not permit the requested access for the calling process.
phkResult - Pointer to a variable that receives a handle to the opened key. If the key is not one of the predefined registry keys, call the RegCloseKey function after you have finished using the handle.
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.

RegQueryValueEx

int RegQueryValueEx(WinReg.HKEY hKey,
                    java.lang.String lpValueName,
                    int lpReserved,
                    com.sun.jna.ptr.IntByReference lpType,
                    char[] lpData,
                    com.sun.jna.ptr.IntByReference lpcbData)
The RegQueryValueEx function retrieves the type and data for a specified value name associated with an open registry key.

Parameters:
hKey - Handle to an open key. The key must have been opened with the KEY_QUERY_VALUE access right.
lpValueName - Pointer to a null-terminated string containing the name of the value to query. If lpValueName is NULL or an empty string, "", the function retrieves the type and data for the key's unnamed or default value, if any.
lpReserved - Reserved; must be NULL.
lpType - Pointer to a variable that receives a code indicating the type of data stored in the specified value.
lpData - Pointer to a buffer that receives the value's data. This parameter can be NULL if the data is not required. If the data is a string, the function checks for a terminating null character. If one is not found, the string is stored with a null terminator if the buffer is large enough to accommodate the extra character. Otherwise, the string is stored as is.
lpcbData - Pointer to a variable that specifies the size of the buffer pointed to by the lpData parameter, in bytes. When the function returns, this variable contains the size of the data copied to lpData. The lpcbData parameter can be NULL only if lpData is NULL. If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, this size includes any terminating null character or characters. If the buffer specified by lpData parameter is not large enough to hold the data, the function returns ERROR_MORE_DATA and stores the required buffer size in the variable pointed to by lpcbData. In this case, the contents of the lpData buffer are undefined. If lpData is NULL, and lpcbData is non-NULL, the function returns ERROR_SUCCESS and stores the size of the data, in bytes, in the variable pointed to by lpcbData. This enables an application to determine the best way to allocate a buffer for the value's data.
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.

RegQueryValueEx

int RegQueryValueEx(WinReg.HKEY hKey,
                    java.lang.String lpValueName,
                    int lpReserved,
                    com.sun.jna.ptr.IntByReference lpType,
                    byte[] lpData,
                    com.sun.jna.ptr.IntByReference lpcbData)

RegQueryValueEx

int RegQueryValueEx(WinReg.HKEY hKey,
                    java.lang.String lpValueName,
                    int lpReserved,
                    com.sun.jna.ptr.IntByReference lpType,
                    com.sun.jna.ptr.IntByReference lpData,
                    com.sun.jna.ptr.IntByReference lpcbData)

RegCloseKey

int RegCloseKey(WinReg.HKEY hKey)
The RegCloseKey function releases a handle to the specified registry key.

Parameters:
hKey - Handle to the open key to be closed. The handle must have been opened by the RegCreateKeyEx, RegOpenKeyEx, or RegConnectRegistry function.
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.

RegDeleteValue

int RegDeleteValue(WinReg.HKEY hKey,
                   java.lang.String lpValueName)
The RegDeleteValue function removes a named value from the specified registry key. Note that value names are not case sensitive.

Parameters:
hKey - Handle to an open key. The key must have been opened with the KEY_SET_VALUE access right.
lpValueName - Pointer to a null-terminated string that names the value to remove. If this parameter is NULL or an empty string, the value set by the RegSetValue function is removed.
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.

RegSetValueEx

int RegSetValueEx(WinReg.HKEY hKey,
                  java.lang.String lpValueName,
                  int Reserved,
                  int dwType,
                  char[] lpData,
                  int cbData)
The RegSetValueEx function sets the data and type of a specified value under a registry key.

Parameters:
hKey - Handle to an open key. The key must have been opened with the KEY_SET_VALUE access right.
lpValueName - Pointer to a string containing the name of the value to set. If a value with this name is not already present in the key, the function adds it to the key. If lpValueName is NULL or an empty string, "", the function sets the type and data for the key's unnamed or default value.
Reserved - Reserved; must be zero.
dwType - Type of data pointed to by the lpData parameter.
lpData - Pointer to a buffer containing the data to be stored with the specified value name.
cbData - Size of the information pointed to by the lpData parameter, in bytes. If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ, cbData must include the size of the terminating null character or characters.
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.

RegSetValueEx

int RegSetValueEx(WinReg.HKEY hKey,
                  java.lang.String lpValueName,
                  int Reserved,
                  int dwType,
                  byte[] lpData,
                  int cbData)

RegCreateKeyEx

int RegCreateKeyEx(WinReg.HKEY hKey,
                   java.lang.String lpSubKey,
                   int Reserved,
                   java.lang.String lpClass,
                   int dwOptions,
                   int samDesired,
                   WinNT.SECURITY_ATTRIBUTES lpSecurityAttributes,
                   WinReg.HKEYByReference phkResult,
                   com.sun.jna.ptr.IntByReference lpdwDisposition)
Parameters:
hKey -
lpSubKey -
Reserved -
lpClass -
dwOptions -
samDesired -
lpSecurityAttributes -
phkResult -
lpdwDisposition -
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.

RegDeleteKey

int RegDeleteKey(WinReg.HKEY hKey,
                 java.lang.String name)
Parameters:
hKey -
name -
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.

RegEnumKeyEx

int RegEnumKeyEx(WinReg.HKEY hKey,
                 int dwIndex,
                 char[] lpName,
                 com.sun.jna.ptr.IntByReference lpcName,
                 com.sun.jna.ptr.IntByReference reserved,
                 char[] lpClass,
                 com.sun.jna.ptr.IntByReference lpcClass,
                 WinBase.FILETIME lpftLastWriteTime)
The RegEnumKeyEx function enumerates subkeys of the specified open registry key. The function retrieves information about one subkey each time it is called.

Parameters:
hKey - Handle to an open key. The key must have been opened with the KEY_ENUMERATE_SUB_KEYS access right.
dwIndex - Index of the subkey to retrieve. This parameter should be zero for the first call to the RegEnumKeyEx function and then incremented for subsequent calls. Because subkeys are not ordered, any new subkey will have an arbitrary index. This means that the function may return subkeys in any order.
lpName - Pointer to a buffer that receives the name of the subkey, including the terminating null character. The function copies only the name of the subkey, not the full key hierarchy, to the buffer.
lpcName - Pointer to a variable that specifies the size of the buffer specified by the lpName parameter, in TCHARs. This size should include the terminating null character. When the function returns, the variable pointed to by lpcName contains the number of characters stored in the buffer. The count returned does not include the terminating null character.
reserved - Reserved; must be NULL.
lpClass - Pointer to a buffer that receives the null-terminated class string of the enumerated subkey. This parameter can be NULL.
lpcClass - Pointer to a variable that specifies the size of the buffer specified by the lpClass parameter, in TCHARs. The size should include the terminating null character. When the function returns, lpcClass contains the number of characters stored in the buffer. The count returned does not include the terminating null character. This parameter can be NULL only if lpClass is NULL.
lpftLastWriteTime - Pointer to a variable that receives the time at which the enumerated subkey was last written.
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.

RegEnumValue

int RegEnumValue(WinReg.HKEY hKey,
                 int dwIndex,
                 char[] lpValueName,
                 com.sun.jna.ptr.IntByReference lpcchValueName,
                 com.sun.jna.ptr.IntByReference reserved,
                 com.sun.jna.ptr.IntByReference lpType,
                 byte[] lpData,
                 com.sun.jna.ptr.IntByReference lpcbData)
The RegEnumValue function 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.

Parameters:
hKey - Handle to an open key. The key must have been opened with the KEY_QUERY_VALUE access right.
dwIndex - Index of the value to be retrieved. This parameter should be zero for the first call to the RegEnumValue function and then be incremented for subsequent calls. Because values are not ordered, any new value will have an arbitrary index. This means that the function may return values in any order.
lpValueName - Pointer to a buffer that receives the name of the value, including the terminating null character.
lpcchValueName - Pointer to a variable that specifies the size of the buffer pointed to by the lpValueName parameter, in TCHARs. This size should include the terminating null character. When the function returns, the variable pointed to by lpcValueName contains the number of characters stored in the buffer. The count returned does not include the terminating null character.
reserved - Reserved; must be NULL.
lpType - Pointer to a variable that receives a code indicating the type of data stored in the specified value.
lpData - Pointer to a buffer that receives the data for the value entry. This parameter can be NULL if the data is not required.
lpcbData - Pointer to a variable that specifies the size of the buffer pointed to by the lpData parameter, in bytes.
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.

RegQueryInfoKey

int RegQueryInfoKey(WinReg.HKEY hKey,
                    char[] lpClass,
                    com.sun.jna.ptr.IntByReference lpcClass,
                    com.sun.jna.ptr.IntByReference lpReserved,
                    com.sun.jna.ptr.IntByReference lpcSubKeys,
                    com.sun.jna.ptr.IntByReference lpcMaxSubKeyLen,
                    com.sun.jna.ptr.IntByReference lpcMaxClassLen,
                    com.sun.jna.ptr.IntByReference lpcValues,
                    com.sun.jna.ptr.IntByReference lpcMaxValueNameLen,
                    com.sun.jna.ptr.IntByReference lpcMaxValueLen,
                    com.sun.jna.ptr.IntByReference lpcbSecurityDescriptor,
                    WinBase.FILETIME lpftLastWriteTime)
The RegQueryInfoKey function retrieves information about the specified registry key.

Parameters:
hKey - A handle to an open key. The key must have been opened with the KEY_QUERY_VALUE access right.
lpClass - A pointer to a buffer that receives the null-terminated class string of the key. This parameter can be ignored. This parameter can be NULL.
lpcClass - A pointer to a variable that specifies the size of the buffer pointed to by the lpClass parameter, in characters.
lpReserved - Reserved; must be NULL.
lpcSubKeys - A pointer to a variable that receives the number of subkeys that are contained by the specified key. This parameter can be NULL.
lpcMaxSubKeyLen - A pointer to a variable that receives the size of the key's subkey with the longest name, in characters, not including the terminating null character. This parameter can be NULL.
lpcMaxClassLen - A pointer to a variable that receives the size of the longest string that specifies a subkey class, in characters. The count returned does not include the terminating null character. This parameter can be NULL.
lpcValues - A pointer to a variable that receives the number of values that are associated with the key. This parameter can be NULL.
lpcMaxValueNameLen - A pointer to a variable that receives the size of the key's longest value name, in characters. The size does not include the terminating null character. This parameter can be NULL.
lpcMaxValueLen - A pointer to a variable that receives the size of the longest data component among the key's values, in bytes. This parameter can be NULL.
lpcbSecurityDescriptor - A pointer to a variable that receives the size of the key's security descriptor, in bytes. This parameter can be NULL.
lpftLastWriteTime - A pointer to a FILETIME structure that receives the last write time. This parameter can be NULL.
Returns:
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h.


 
 
Close
loading
Please Confirm
Close