## com.sun.jna.platform.win32
Class Advapi32Util

    java.lang.Object
      com.sun.jna.platform.win32.Advapi32Util

    public abstract class Advapi32Util

extends java.lang.Object

Advapi32 utility API.

Nested Class Summary
`static class` `Advapi32Util.Account` An account.
`static class` `Advapi32Util.Group` A group.

Constructor Summary
`Advapi32Util()`

Method Summary
`static java.lang.String` `convertSidToStringSid(WinNT.PSID sid)` Convert a security identifier (SID) to a string format suitable for display, storage, or transmission.
`static byte[]` `convertStringSidToSid(java.lang.String sid)` Convert a string representation of a security identifier (SID) to a binary format.
`static Advapi32Util.Account` `getAccountByName(java.lang.String accountName)` Retrieves a security identifier (SID) for the account on the current system.
`static Advapi32Util.Account` `getAccountByName(java.lang.String systemName, java.lang.String accountName)` Retrieves a security identifier (SID) for a given account.
`static Advapi32Util.Account` `getAccountBySid(java.lang.String sidString)` Get an account name from a string SID on the local machine.
`static Advapi32Util.Account` `getAccountBySid(java.lang.String systemName, java.lang.String sidString)` Get an account name from a string SID.
`static Advapi32Util.Account` `getAccountBySid(java.lang.String systemName, WinNT.PSID sid)` Get the account by SID.
`static Advapi32Util.Account` `getAccountBySid(WinNT.PSID sid)` Get the account by SID on the local system.
`static Advapi32Util.Group[]` `getCurrentUserGroups()` Return the group memberships of the currently logged on user.
`static Advapi32Util.Account` `getTokenAccount(W32API.HANDLE hToken)` This function returns the information about the user who owns a security token,
`static Advapi32Util.Group[]` `getTokenGroups(W32API.HANDLE hToken)` This function returns the groups associated with a security token, such as a user token.
`static java.lang.String` `getUserName()` Retrieves the name of the user associated with the current thread.
`static void` `registryCreateKey(WinReg.HKEY hKey, java.lang.String keyName)` Create a registry key.
`static void` `registryCreateKey(WinReg.HKEY root, java.lang.String parentPath, java.lang.String keyName)` Create a registry key.
`static void` `registryDeleteKey(WinReg.HKEY hKey, java.lang.String keyName)` Delete a registry key.
`static void` `registryDeleteKey(WinReg.HKEY root, java.lang.String keyPath, java.lang.String keyName)` Delete a registry key.
`static void` `registryDeleteValue(WinReg.HKEY hKey, java.lang.String valueName)` Delete a registry value.
`static void` `registryDeleteValue(WinReg.HKEY root, java.lang.String keyPath, java.lang.String valueName)` Delete a registry value.
`static int` `registryGetIntValue(WinReg.HKEY root, java.lang.String key, java.lang.String value)` Get a registry DWORD value.
`static java.lang.String[]` `registryGetKeys(WinReg.HKEY hKey)` Get names of the registry key's sub-keys.
`static java.lang.String[]` `registryGetKeys(WinReg.HKEY root, java.lang.String keyPath)` Get names of the registry key's sub-keys.
`static java.lang.String` `registryGetStringValue(WinReg.HKEY root, java.lang.String key, java.lang.String value)` Get a registry REG_SZ value.
`static java.util.TreeMap<java.lang.String,java.lang.Object>` `registryGetValues(WinReg.HKEY hKey)` Get a table of registry values.
`static java.util.TreeMap<java.lang.String,java.lang.Object>` `registryGetValues(WinReg.HKEY root, java.lang.String keyPath)` Get a table of registry values.
`static boolean` `registryKeyExists(WinReg.HKEY root, java.lang.String key)` Checks whether a registry key exists.
`static void` `registrySetIntValue(WinReg.HKEY hKey, java.lang.String name, int value)` Set an integer value in registry.
`static void` `registrySetIntValue(WinReg.HKEY root, java.lang.String keyPath, java.lang.String name, int value)` Set an integer value in registry.
`static void` `registrySetStringValue(WinReg.HKEY hKey, java.lang.String name, java.lang.String value)` Set a string value in registry.
`static void` `registrySetStringValue(WinReg.HKEY root, java.lang.String keyPath, java.lang.String name, java.lang.String value)` Set a string value in registry.
`static boolean` `registryValueExists(WinReg.HKEY root, java.lang.String key, java.lang.String value)` Checks whether a registry value exists.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Advapi32Util

    public Advapi32Util()

Method Detail

### getUserName

    public static java.lang.String getUserName()

  Retrieves the name of the user associated with the current thread.

  Returns:
    A user name.

### getAccountByName

    public static Advapi32Util.Account getAccountByName(java.lang.String accountName)

  Retrieves a security identifier (SID) for the account on the current system.

  Parameters:
    `accountName` - Specifies the account name.
  Returns:
    A structure containing the account SID;

### getAccountByName

    public static Advapi32Util.Account getAccountByName(java.lang.String systemName,
                                                        java.lang.String accountName)

  Retrieves a security identifier (SID) for a given account.

  Parameters:
    `systemName` - Name of the system.
    `accountName` - Account name.
  Returns:
    A structure containing the account SID.

### getAccountBySid

    public static Advapi32Util.Account getAccountBySid(WinNT.PSID sid)

  Get the account by SID on the local system.

  Parameters:
    `sid` - SID.
  Returns:
    Account.

### getAccountBySid

    public static Advapi32Util.Account getAccountBySid(java.lang.String systemName,
                                                       WinNT.PSID sid)

  Get the account by SID.

  Parameters:
    `systemName` - Name of the system.
    `sid` - SID.
  Returns:
    Account.

### convertSidToStringSid

    public static java.lang.String convertSidToStringSid(WinNT.PSID sid)

  Convert a security identifier (SID) to a string format suitable for display, storage, or transmission.

  Parameters:
    `sid` - SID bytes.
  Returns:
    String SID.

### convertStringSidToSid

    public static byte[] convertStringSidToSid(java.lang.String sid)

  Convert a string representation of a security identifier (SID) to a binary format.

  Parameters:
    `sid` - String SID.
  Returns:
    SID bytes.

### getAccountBySid

    public static Advapi32Util.Account getAccountBySid(java.lang.String sidString)

  Get an account name from a string SID on the local machine.

  Parameters:
    `sidString` - SID.
  Returns:
    Account.

### getAccountBySid

    public static Advapi32Util.Account getAccountBySid(java.lang.String systemName,
                                                       java.lang.String sidString)

  Get an account name from a string SID.

  Parameters:
    `systemName` - System name.
    `sidString` - SID.
  Returns:
    Account.

### getTokenGroups

    public static Advapi32Util.Group[] getTokenGroups(W32API.HANDLE hToken)

  This function returns the groups associated with a security token, such as a user token.

  Parameters:
    `hToken` - Token.
  Returns:
    Token groups.

### getTokenAccount

    public static Advapi32Util.Account getTokenAccount(W32API.HANDLE hToken)

  This function returns the information about the user who owns a security token,

  Parameters:
    `hToken` - Token.
  Returns:
    Token user.

### getCurrentUserGroups

    public static Advapi32Util.Group[] getCurrentUserGroups()

  Return the group memberships of the currently logged on user.

  Returns:
    An array of groups.

### registryKeyExists

    public static boolean registryKeyExists(WinReg.HKEY root,
                                            java.lang.String key)

  Checks whether a registry key exists.

  Parameters:
    `root` - HKEY_LOCAL_MACHINE, etc.
    `key` - Path to the registry key.
  Returns:
    True if the key exists.

### registryValueExists

    public static boolean registryValueExists(WinReg.HKEY root,
                                              java.lang.String key,
                                              java.lang.String value)

  Checks whether a registry value exists.

  Parameters:
    `root` - HKEY_LOCAL_MACHINE, etc.
    `key` - Registry key path.
    `value` - Value name.
  Returns:
    True if the value exists.

### registryGetStringValue

    public static java.lang.String registryGetStringValue(WinReg.HKEY root,
                                                          java.lang.String key,
                                                          java.lang.String value)

  Get a registry REG_SZ value.

  Parameters:
    `root` - Root key.
    `key` - Registry path.
    `value` - Name of the value to retrieve.
  Returns:
    String value.

### registryGetIntValue

    public static int registryGetIntValue(WinReg.HKEY root,
                                          java.lang.String key,
                                          java.lang.String value)

  Get a registry DWORD value.

  Parameters:
    `root` - Root key.
    `key` - Registry key path.
    `value` - Name of the value to retrieve.
  Returns:
    Integer value.

### registryCreateKey

    public static void registryCreateKey(WinReg.HKEY hKey,
                                         java.lang.String keyName)

  Create a registry key.

  Parameters:
    `hKey` - Parent key.
    `keyName` - Key name.

### registryCreateKey

    public static void registryCreateKey(WinReg.HKEY root,
                                         java.lang.String parentPath,
                                         java.lang.String keyName)

  Create a registry key.

  Parameters:
    `root` - Root key.
    `parentPath` - Path to an existing registry key.
    `keyName` - Key name.

### registrySetIntValue

    public static void registrySetIntValue(WinReg.HKEY hKey,
                                           java.lang.String name,
                                           int value)

  Set an integer value in registry.

  Parameters:
    `hKey` - Parent key.
    `name` - Name.
    `value` - Value.

### registrySetIntValue

    public static void registrySetIntValue(WinReg.HKEY root,
                                           java.lang.String keyPath,
                                           java.lang.String name,
                                           int value)

  Set an integer value in registry.

  Parameters:
    `root` - Root key.
    `keyPath` - Path to an existing registry key.
    `name` - Name.
    `value` - Value.

### registrySetStringValue

    public static void registrySetStringValue(WinReg.HKEY hKey,
                                              java.lang.String name,
                                              java.lang.String value)

  Set a string value in registry.

  Parameters:
    `hKey` - Parent key.
    `name` - Name.
    `value` - Value.

### registrySetStringValue

    public static void registrySetStringValue(WinReg.HKEY root,
                                              java.lang.String keyPath,
                                              java.lang.String name,
                                              java.lang.String value)

  Set a string value in registry.

  Parameters:
    `root` - Root key.
    `keyPath` - Path to an existing registry key.
    `name` - Name.
    `value` - Value.

### registryDeleteKey

    public static void registryDeleteKey(WinReg.HKEY hKey,
                                         java.lang.String keyName)

  Delete a registry key.

  Parameters:
    `hKey` - Parent key.
    `keyName` - Name of the key to delete.

### registryDeleteKey

    public static void registryDeleteKey(WinReg.HKEY root,
                                         java.lang.String keyPath,
                                         java.lang.String keyName)

  Delete a registry key.

  Parameters:
    `root` - Root key.
    `keyPath` - Path to an existing registry key.
    `keyName` - Name of the key to delete.

### registryDeleteValue

    public static void registryDeleteValue(WinReg.HKEY hKey,
                                           java.lang.String valueName)

  Delete a registry value.

  Parameters:
    `hKey` - Parent key.
    `valueName` - Name of the value to delete.

### registryDeleteValue

    public static void registryDeleteValue(WinReg.HKEY root,
                                           java.lang.String keyPath,
                                           java.lang.String valueName)

  Delete a registry value.

  Parameters:
    `root` - Root key.
    `keyPath` - Path to an existing registry key.
    `valueName` - Name of the value to delete.

### registryGetKeys

    public static java.lang.String[] registryGetKeys(WinReg.HKEY hKey)

  Get names of the registry key's sub-keys.

  Parameters:
    `hKey` - Registry key.
  Returns:
    Array of registry key names.

### registryGetKeys

    public static java.lang.String[] registryGetKeys(WinReg.HKEY root,
                                                     java.lang.String keyPath)

  Get names of the registry key's sub-keys.

  Parameters:
    `root` - Root key.
    `keyPath` - Path to a registry key.
  Returns:
    Array of registry key names.

### registryGetValues

    public static java.util.TreeMap<java.lang.String,java.lang.Object> registryGetValues(WinReg.HKEY hKey)

  Get a table of registry values.

  Parameters:
    `hKey` - Registry key.
  Returns:
    Table of values.

### registryGetValues

    public static java.util.TreeMap<java.lang.String,java.lang.Object> registryGetValues(WinReg.HKEY root,
                                                                                         java.lang.String keyPath)

  Get a table of registry values.

  Parameters:
    `root` - Registry root.
    `keyPath` - Regitry key path.
  Returns:
    Table of values.