public abstract class Advapi32Util
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Advapi32Util.Account
An account.
|
| Constructor and Description |
|---|
Advapi32Util() |
| Modifier and Type | Method and Description |
|---|---|
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 sidString)
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.Account[] |
getCurrentUserGroups()
Return the group memberships of the currently logged on user.
|
static Advapi32Util.Account |
getTokenAccount(WinNT.HANDLE hToken)
This function returns the information about the user who owns a security token,
|
static Advapi32Util.Account[] |
getTokenGroups(WinNT.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 boolean |
isWellKnownSid(byte[] sidBytes,
int wellKnownSidType)
Compares a SID to a well known SID and returns TRUE if they match.
|
static boolean |
isWellKnownSid(java.lang.String sidString,
int wellKnownSidType)
Compares a SID to a well known SID and returns TRUE if they match.
|
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.
|
public static java.lang.String getUserName()
public static Advapi32Util.Account getAccountByName(java.lang.String accountName)
accountName - Specifies the account name.public static Advapi32Util.Account getAccountByName(java.lang.String systemName, java.lang.String accountName)
systemName - Name of the system.accountName - Account name.public static Advapi32Util.Account getAccountBySid(WinNT.PSID sid)
sid - SID.public static Advapi32Util.Account getAccountBySid(java.lang.String systemName, WinNT.PSID sid)
systemName - Name of the system.sid - SID.public static java.lang.String convertSidToStringSid(WinNT.PSID sid)
sid - SID bytes.public static byte[] convertStringSidToSid(java.lang.String sidString)
sidString - String SID.public static boolean isWellKnownSid(java.lang.String sidString,
int wellKnownSidType)
sidString - String representation of a SID.wellKnownSidType - Member of the WELL_KNOWN_SID_TYPE enumeration to compare with the SID at pSid.public static boolean isWellKnownSid(byte[] sidBytes,
int wellKnownSidType)
sidBytes - Byte representation of a SID.wellKnownSidType - Member of the WELL_KNOWN_SID_TYPE enumeration to compare with the SID at pSid.public static Advapi32Util.Account getAccountBySid(java.lang.String sidString)
sidString - SID.public static Advapi32Util.Account getAccountBySid(java.lang.String systemName, java.lang.String sidString)
systemName - System name.sidString - SID.public static Advapi32Util.Account[] getTokenGroups(WinNT.HANDLE hToken)
hToken - Token.public static Advapi32Util.Account getTokenAccount(WinNT.HANDLE hToken)
hToken - Token.public static Advapi32Util.Account[] getCurrentUserGroups()
public static boolean registryKeyExists(WinReg.HKEY root, java.lang.String key)
root - HKEY_LOCAL_MACHINE, etc.key - Path to the registry key.public static boolean registryValueExists(WinReg.HKEY root, java.lang.String key, java.lang.String value)
root - HKEY_LOCAL_MACHINE, etc.key - Registry key path.value - Value name.public static java.lang.String registryGetStringValue(WinReg.HKEY root, java.lang.String key, java.lang.String value)
root - Root key.key - Registry path.value - Name of the value to retrieve.public static int registryGetIntValue(WinReg.HKEY root, java.lang.String key, java.lang.String value)
root - Root key.key - Registry key path.value - Name of the value to retrieve.public static void registryCreateKey(WinReg.HKEY hKey, java.lang.String keyName)
hKey - Parent key.keyName - Key name.public static void registryCreateKey(WinReg.HKEY root, java.lang.String parentPath, java.lang.String keyName)
root - Root key.parentPath - Path to an existing registry key.keyName - Key name.public static void registrySetIntValue(WinReg.HKEY hKey, java.lang.String name, int value)
hKey - Parent key.name - Name.value - Value.public static void registrySetIntValue(WinReg.HKEY root, java.lang.String keyPath, java.lang.String name, int value)
root - Root key.keyPath - Path to an existing registry key.name - Name.value - Value.public static void registrySetStringValue(WinReg.HKEY hKey, java.lang.String name, java.lang.String value)
hKey - Parent key.name - Name.value - Value.public static void registrySetStringValue(WinReg.HKEY root, java.lang.String keyPath, java.lang.String name, java.lang.String value)
root - Root key.keyPath - Path to an existing registry key.name - Name.value - Value.public static void registryDeleteKey(WinReg.HKEY hKey, java.lang.String keyName)
hKey - Parent key.keyName - Name of the key to delete.public static void registryDeleteKey(WinReg.HKEY root, java.lang.String keyPath, java.lang.String keyName)
root - Root key.keyPath - Path to an existing registry key.keyName - Name of the key to delete.public static void registryDeleteValue(WinReg.HKEY hKey, java.lang.String valueName)
hKey - Parent key.valueName - Name of the value to delete.public static void registryDeleteValue(WinReg.HKEY root, java.lang.String keyPath, java.lang.String valueName)
root - Root key.keyPath - Path to an existing registry key.valueName - Name of the value to delete.public static java.lang.String[] registryGetKeys(WinReg.HKEY hKey)
hKey - Registry key.public static java.lang.String[] registryGetKeys(WinReg.HKEY root, java.lang.String keyPath)
root - Root key.keyPath - Path to a registry key.public static java.util.TreeMap<java.lang.String,java.lang.Object> registryGetValues(WinReg.HKEY hKey)
hKey - Registry key.public static java.util.TreeMap<java.lang.String,java.lang.Object> registryGetValues(WinReg.HKEY root, java.lang.String keyPath)
root - Registry root.keyPath - Regitry key path.