Top Description Inners Constructors Methods
com.sun.jna.platform.win32

public abstract Class Advapi32Util

extends Object
Class Inheritance
Static Imports
com.sun.jna.platform.win32.WinBase.CREATE_FOR_DIR, .WinBase.CREATE_FOR_IMPORT, .WinNT.DACL_SECURITY_INFORMATION, .WinNT.FILE_ALL_ACCESS, .WinNT.FILE_GENERIC_EXECUTE, .WinNT.FILE_GENERIC_READ, .WinNT.FILE_GENERIC_WRITE, .WinNT.GENERIC_EXECUTE, .WinNT.GENERIC_READ, .WinNT.GENERIC_WRITE, .WinNT.GROUP_SECURITY_INFORMATION, .WinNT.OWNER_SECURITY_INFORMATION, .WinNT.PROTECTED_DACL_SECURITY_INFORMATION, .WinNT.PROTECTED_SACL_SECURITY_INFORMATION, .WinNT.SACL_SECURITY_INFORMATION, .WinNT.SE_DACL_PROTECTED, .WinNT.SE_SACL_PROTECTED, .WinNT.STANDARD_RIGHTS_READ, .WinNT.TOKEN_ADJUST_PRIVILEGES, .WinNT.TOKEN_DUPLICATE, .WinNT.TOKEN_IMPERSONATE, .WinNT.TOKEN_QUERY, .WinNT.UNPROTECTED_DACL_SECURITY_INFORMATION, .WinNT.UNPROTECTED_SACL_SECURITY_INFORMATION

Advapi32 utility API.
Author
dblock[at]dblock.org

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static class
public static class
public static class
Advapi32Util.EventLogIterator

An iterator for Event Log entries.

public static class
Advapi32Util.EventLogRecord

An event log record.

public static enum
Advapi32Util.EventLogType

Event log types.

public static class
public static class
Advapi32Util.Privilege

Convenience class to enable certain Windows process privileges

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if has access, otherwise false
accessCheck
(File
the file to check
file
,
Advapi32Util.AccessCheckPermission
the permission to check for the file
permissionToCheck
)

Checks if the current process has the given permission for the file.

public static int

Returns:

the aligned size
alignOnDWORD
(int
size to align
cbAcl
)

Align cbAcl on a DWORD

public static void
backupEncryptedFile(File
The encrypted file or directory to backup.
src
,
File
The directory where the backup will be saved.
destDir
)

Backup an encrypted file or folder without decrypting it.

public static String

Returns:

String SID.
convertSidToStringSid
(WinNT.PSID
SID bytes.
sid
)

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

public static byte[]

Returns:

SID bytes.
convertStringSidToSid
(String
String SID.
sidString
)

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

public static void
decryptFile(File
The file or directory to decrypt.
file
)

Decrypts an encrypted file or directory.

public static void
disableEncryption(File
The directory for which to enable or disable encryption.
directory
,
boolean
TRUE to disable encryption. FALSE to enable it.
disable
)

Disables or enables encryption of the specified directory and the files in it.

public static void
encryptFile(File
The file or directory to encrypt.
file
)

Encrypts a file or directory.

public static int

Returns:

The status of the file.
fileEncryptionStatus
(File
The file to check the status for.
file
)

Checks the encryption status of a file.

public static Advapi32Util.Account

Returns:

A structure containing the account SID;
getAccountByName
(String
Specifies the account name.
accountName
)

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

public static Advapi32Util.Account

Returns:

A structure containing the account SID.
getAccountByName
(String
Name of the system.
systemName
,
String
Account name.
accountName
)

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

public static Advapi32Util.Account

Returns:

Account.
getAccountBySid
(WinNT.PSID
SID.
sid
)

Get the account by SID on the local system.

public static Advapi32Util.Account

Returns:

Account.
getAccountBySid
(String
Name of the system.
systemName
,
WinNT.PSID
SID.
sid
)

Get the account by SID.

public static Advapi32Util.Account

Returns:

Account.
getAccountBySid
(String
SID.
sidString
)

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

public static Advapi32Util.Account

Returns:

Account.
getAccountBySid
(String
System name.
systemName
,
String
SID.
sidString
)

Get an account name from a string SID.

public static int

Returns:

size of the ACE
getAceSize
(int
length of the sid
sidLength
)

Helper function to calculate the size of an ACE for a given PSID size

public static Advapi32Util.Account[]

Returns:

An array of groups.
getCurrentUserGroups
()

Return the group memberships of the currently logged on user.

public static String

Returns:

A environment block
getEnvironmentBlock
(Map<String, String>
Environment variables
environment
)

Converts a map of environment variables to an environment block suitable for Advapi32#CreateProcessAsUser.

public static WinNT.ACE_HEADER[]

Returns:

list of ACEs in the DACL of the referenced file
getFileSecurity
(String
path to the file
fileName
,
boolean
if true compatible ACEs are merged if possible
compact
)

public static WinNT.SECURITY_DESCRIPTOR_RELATIVE

Returns:

The file's Security Descriptor in self relative format.
getFileSecurityDescriptor
(File
File object containing a path to a file system object.
file
,
boolean
Get the SACL. See Advapi32#GetNamedSecurityInfo for process privilege requirements in getting the SACL.
getSACL
)

Gets a file's Security Descriptor.

private static Memory
getSecurityDescriptorForFile(final String absoluteFilePath)

public static Memory

Returns:

Memory containing the self relative security descriptor
getSecurityDescriptorForObject
(final String
A pointer to a null-terminated string that specifies the name of the object from which to retrieve security information. For descriptions of the string formats for the different object types, see SE_OBJECT_TYPE in AccCtrl.SE_OBJECT_TYPE
absoluteObjectPath
,
int
Object type referred to by the path. See AccCtrl.SE_OBJECT_TYPE for valid definitions.
objectType
,
boolean
Get SACL of the object. See Advapi32#GetNamedSecurityInfo for process privilege requirements in getting the SACL.
getSACL
)

Get a self relative security descriptor for the given object type.

public static Advapi32Util.Account

Returns:

Token user.
getTokenAccount
(WinNT.HANDLE
Token.
hToken
)

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

public static Advapi32Util.Account[]

Returns:

Token groups.
getTokenGroups
(WinNT.HANDLE
Token.
hToken
)

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

public static Advapi32Util.Account

Returns:

Token primary group.
getTokenPrimaryGroup
(WinNT.HANDLE
Token.
hToken
)

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

public static String

Returns:

A user name.
getUserName
()

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

public static boolean

Returns:

true if the current process has elevated perissions, false otherwise.
isCurrentProcessElevated
()

Reports whether the current process is running with elevated permissions.

public static boolean

Returns:

True if the SID is of the well-known type, false otherwise.
isWellKnownSid
(String
String representation of a SID.
sidString
,
int
Member of the WELL_KNOWN_SID_TYPE enumeration to compare with the SID at pSid.
wellKnownSidType
)

Compares a SID to a well known SID and returns TRUE if they match.

public static boolean

Returns:

True if the SID is of the well-known type, false otherwise.
isWellKnownSid
(byte[]
Byte representation of a SID.
sidBytes
,
int
Member of the WELL_KNOWN_SID_TYPE enumeration to compare with the SID at pSid.
wellKnownSidType
)

Compares a SID to a well known SID and returns TRUE if they match.

public static void
registryCloseKey(WinReg.HKEY
Registry key.
hKey
)

Close the registry key

public static boolean

Returns:

True if the key was created, false otherwise.
registryCreateKey
(WinReg.HKEY
Parent key.
hKey
,
String
Key name.
keyName
)

Create a registry key.

public static boolean

Returns:

True if the key was created, false otherwise.
registryCreateKey
(WinReg.HKEY
Parent key.
hKey
,
String
Key name.
keyName
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Create a registry key.

public static boolean

Returns:

True if the key was created, false otherwise.
registryCreateKey
(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
parentPath
,
String
Key name.
keyName
)

Create a registry key.

public static boolean

Returns:

True if the key was created, false otherwise.
registryCreateKey
(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
parentPath
,
String
Key name.
keyName
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_CREATE_SUB_KEY. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Create a registry key.

public static void
registryDeleteKey(WinReg.HKEY
Parent key.
hKey
,
String
Name of the key to delete.
keyName
)

Delete a registry key.

public static void
registryDeleteKey(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Name of the key to delete.
keyName
)

Delete a registry key.

public static void
registryDeleteKey(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Name of the key to delete.
keyName
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ and WinNT.KEY_WRITE. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Delete a registry key.

public static void
registryDeleteValue(WinReg.HKEY
Parent key.
hKey
,
String
Name of the value to delete.
valueName
)

Delete a registry value.

public static void
registryDeleteValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Name of the value to delete.
valueName
)

Delete a registry value.

public static void
registryDeleteValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Name of the value to delete.
valueName
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ and WinNT.KEY_WRITE. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Delete a registry value.

public static byte[]

Returns:

String value.
registryGetBinaryValue
(WinReg.HKEY
Root key.
root
,
String
Registry path.
key
,
String
Name of the value to retrieve.
value
)

Get a registry REG_BINARY value.

public static byte[]

Returns:

String value.
registryGetBinaryValue
(WinReg.HKEY
Root key.
root
,
String
Registry path.
key
,
String
Name of the value to retrieve.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Get a registry REG_BINARY value.

public static byte[]

Returns:

String value.
registryGetBinaryValue
(WinReg.HKEY
Parent Key.
hKey
,
String
Name of the value to retrieve.
value
)

Get a registry REG_BINARY value.

public static String

Returns:

String value.
registryGetExpandableStringValue
(WinReg.HKEY
Root key.
root
,
String
Registry path.
key
,
String
Name of the value to retrieve.
value
)

Get a registry REG_EXPAND_SZ value.

public static String

Returns:

String value.
registryGetExpandableStringValue
(WinReg.HKEY
Root key.
root
,
String
Registry path.
key
,
String
Name of the value to retrieve.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Get a registry REG_EXPAND_SZ value.

public static String

Returns:

String value.
registryGetExpandableStringValue
(WinReg.HKEY
Parent Key.
hKey
,
String
Name of the value to retrieve.
value
)

Get a registry REG_EXPAND_SZ value.

public static int

Returns:

Integer value.
registryGetIntValue
(WinReg.HKEY
Root key.
root
,
String
Registry key path.
key
,
String
Name of the value to retrieve.
value
)

Get a registry DWORD value.

public static int

Returns:

Integer value.
registryGetIntValue
(WinReg.HKEY
Root key.
root
,
String
Registry key path.
key
,
String
Name of the value to retrieve.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Get a registry DWORD value.

public static int

Returns:

Integer value.
registryGetIntValue
(WinReg.HKEY
Parent key.
hKey
,
String
Name of the value to retrieve.
value
)

Get a registry DWORD value.

public static WinReg.HKEYByReference

Returns:

HKEYByReference.
registryGetKey
(WinReg.HKEY
Root key.
root
,
String
Path to a registry key.
keyPath
,
int
Access level (e.g. WinNT.KEY_READ)
samDesired
)

Get a registry key, the caller is responsible to close the key after use.

public static String[]

Returns:

Array of registry key names.
registryGetKeys
(WinReg.HKEY
Registry key.
hKey
)

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

public static String[]

Returns:

Array of registry key names.
registryGetKeys
(WinReg.HKEY
Root key.
root
,
String
Path to a registry key.
keyPath
)

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

public static String[]

Returns:

Array of registry key names.
registryGetKeys
(WinReg.HKEY
Root key.
root
,
String
Path to a registry key.
keyPath
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

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

public static long

Returns:

Integer value.
registryGetLongValue
(WinReg.HKEY
Root key.
root
,
String
Registry key path.
key
,
String
Name of the value to retrieve.
value
)

Get a registry QWORD value.

public static long

Returns:

Integer value.
registryGetLongValue
(WinReg.HKEY
Root key.
root
,
String
Registry key path.
key
,
String
Name of the value to retrieve.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Get a registry QWORD value.

public static long

Returns:

Integer value.
registryGetLongValue
(WinReg.HKEY
Parent key.
hKey
,
String
Name of the value to retrieve.
value
)

Get a registry QWORD value.

public static String[]

Returns:

String value.
registryGetStringArray
(WinReg.HKEY
Root key.
root
,
String
Registry path.
key
,
String
Name of the value to retrieve.
value
)

Get a registry REG_MULTI_SZ value.

public static String[]

Returns:

String value.
registryGetStringArray
(WinReg.HKEY
Root key.
root
,
String
Registry path.
key
,
String
Name of the value to retrieve.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Get a registry REG_MULTI_SZ value.

public static String[]

Returns:

String value.
registryGetStringArray
(WinReg.HKEY
Parent Key.
hKey
,
String
Name of the value to retrieve.
value
)

Get a registry REG_MULTI_SZ value.

public static String

Returns:

String value.
registryGetStringValue
(WinReg.HKEY
Root key.
root
,
String
Registry path.
key
,
String
Name of the value to retrieve.
value
)

Get a registry REG_SZ value.

public static String

Returns:

String value.
registryGetStringValue
(WinReg.HKEY
Root key.
root
,
String
Registry path.
key
,
String
Name of the value to retrieve.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Get a registry REG_SZ value.

public static String

Returns:

String value.
registryGetStringValue
(WinReg.HKEY
Parent Key.
hKey
,
String
Name of the value to retrieve.
value
)

Get a registry REG_SZ value.

public static Object

Returns:

Object value.
registryGetValue
(WinReg.HKEY
Root key.
hkKey
,
String
Registry key path.
subKey
,
String
Name of the value to retrieve or null for the default value.
lpValueName
)

Get a registry value and returns a java object depending on the value type.

public static TreeMap<String, Object>

Returns:

Table of values.
registryGetValues
(WinReg.HKEY
Registry key.
hKey
)

Get a table of registry values.

public static TreeMap<String, Object>

Returns:

Table of values.
registryGetValues
(WinReg.HKEY
Registry root.
root
,
String
Regitry key path.
keyPath
)

Get a table of registry values.

public static TreeMap<String, Object>

Returns:

Table of values.
registryGetValues
(WinReg.HKEY
Registry root.
root
,
String
Regitry key path.
keyPath
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Get a table of registry values.

public static boolean

Returns:

True if the key exists.
registryKeyExists
(WinReg.HKEY
HKEY_LOCAL_MACHINE, etc.
root
,
String
Path to the registry key.
key
)

Checks whether a registry key exists.

public static boolean

Returns:

True if the key exists.
registryKeyExists
(WinReg.HKEY
HKEY_LOCAL_MACHINE, etc.
root
,
String
Path to the registry key.
key
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Checks whether a registry key exists.

public static WinReg.HKEYByReference
registryLoadAppKey(String
Path to the file
fileName
,
int
Access mask that specifies the desired access rights to the
samDesired
,
int
If this parameter is REG_PROCESS_APPKEY, the hive cannot be loaded again while it is loaded by the caller. This prevents access to this registry hive by another caller.
dwOptions
)

Loads the specified registry hive as an application hive.

public static Advapi32Util.InfoKey

Returns:

A InfoKey value object.
registryQueryInfoKey
(WinReg.HKEY
Current registry key.
hKey
,
int
security descriptor
lpcbSecurityDescriptor
)

Queries the information about a specified key.

public static Advapi32Util.EnumKey

Returns:

A InfoKey value object.
registryRegEnumKey
(WinReg.HKEY
Current registry key.
hKey
,
int dwIndex)

Queries the information about a specified key.

public static void
registrySetBinaryValue(WinReg.HKEY
Parent key.
hKey
,
String
Value name.
name
,
byte[]
Data to write to registry.
data
)

Set a binary value in registry.

public static void
registrySetBinaryValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
byte[]
Data to write to registry.
data
)

Set a binary value in registry.

public static void
registrySetBinaryValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
byte[]
Data to write to registry.
data
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ and WinNT.KEY_WRITE. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Set a binary value in registry.

public static void
registrySetExpandableStringValue(WinReg.HKEY
Parent key.
hKey
,
String
Value name.
name
,
String
Value to write to registry.
value
)

Set an expandable string value in registry.

public static void
registrySetExpandableStringValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
String
Value to write to registry.
value
)

Set a string value in registry.

public static void
registrySetExpandableStringValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
String
Value to write to registry.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ and WinNT.KEY_WRITE. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Set a string value in registry.

public static void
registrySetIntValue(WinReg.HKEY
Parent key.
hKey
,
String
Value name.
name
,
int
Value to write to registry.
value
)

Set an integer value in registry.

public static void
registrySetIntValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
int
Value to write to registry.
value
)

Set an integer value in registry.

public static void
registrySetIntValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
int
Value to write to registry.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ and WinNT.KEY_WRITE. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Set an integer value in registry.

public static void
registrySetLongValue(WinReg.HKEY
Parent key.
hKey
,
String
Value name.
name
,
long
Value to write to registry.
value
)

Set a long value in registry.

public static void
registrySetLongValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
long
Value to write to registry.
value
)

Set a long value in registry.

public static void
registrySetLongValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
long
Value to write to registry.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ and WinNT.KEY_WRITE. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Set a long value in registry.

public static void
registrySetStringArray(WinReg.HKEY
Parent key.
hKey
,
String
Name.
name
,
String[]
Array of strings to write to registry.
arr
)

Set a string array value in registry.

public static void
registrySetStringArray(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
String[]
Array of strings to write to registry.
arr
)

Set a string array value in registry.

public static void
registrySetStringArray(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
String[]
Array of strings to write to registry.
arr
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ and WinNT.KEY_WRITE. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Set a string array value in registry.

public static void
registrySetStringValue(WinReg.HKEY
Parent key.
hKey
,
String
Value name.
name
,
String
Value to write to registry.
value
)

Set a string value in registry.

public static void
registrySetStringValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
String
Value to write to registry.
value
)

Set a string value in registry.

public static void
registrySetStringValue(WinReg.HKEY
Root key.
root
,
String
Path to an existing registry key.
keyPath
,
String
Value name.
name
,
String
Value to write to registry.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ and WinNT.KEY_WRITE. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Set a string value in registry.

public static boolean

Returns:

True if the value exists.
registryValueExists
(WinReg.HKEY
HKEY_LOCAL_MACHINE, etc.
root
,
String
Registry key path.
key
,
String
Value name.
value
)

Checks whether a registry value exists.

public static boolean

Returns:

True if the value exists.
registryValueExists
(WinReg.HKEY
HKEY_LOCAL_MACHINE, etc.
root
,
String
Registry key path.
key
,
String
Value name.
value
,
int
Registry key security and access rights to be requested in addition to WinNT.KEY_READ. (e.g WinNT.KEY_WOW64_32KEY or WinNT.KEY_WOW64_64KEY to force 32bit or 64bit registry access.)
samDesiredExtra
)

Checks whether a registry value exists.

pack-priv static String[]

Returns:

An array of strings corresponding to the strings in the buffer.
regMultiSzBufferToStringArray
(Memory
A buffer containing strings delimited by a null character, ending with two null characters.
data
)

Convert the null-delimited buffer of strings returned from registry values of type WinNT#REG_MULTI_SZ to an array of strings.

public static void
setFileSecurityDescriptor(File
File object containing a path to a file system object.
file
,
WinNT.SECURITY_DESCRIPTOR_RELATIVE
The security descriptor to set.
securityDescriptor
,
boolean
Set the owner. See Advapi32#SetNamedSecurityInfo for process privilege requirements in setting the owner.
setOwner
,
boolean
Set the group.
setGroup
,
boolean
Set the DACL.
setDACL
,
boolean
Set the SACL. See Advapi32#SetNamedSecurityInfo for process privilege requirements in setting the SACL.
setSACL
,
boolean
Set DACL protected status as contained within securityDescriptor.control.
setDACLProtectedStatus
,
boolean
Set SACL protected status as contained within securityDescriptor.control. *
setSACLProtectedStatus
)

Sets a file's Security Descriptor.

public static void
setSecurityDescriptorForObject(final String
A pointer to a null-terminated string that specifies the name of the object from which to retrieve security information. For descriptions of the string formats for the different object types, see AccCtrl.SE_OBJECT_TYPE.
absoluteObjectPath
,
int
Object type referred to by the path. See AccCtrl.SE_OBJECT_TYPE for valid definitions.
objectType
,
WinNT.SECURITY_DESCRIPTOR_RELATIVE
A security descriptor to set.
securityDescriptor
,
boolean
Set the owner. The owner is extracted from securityDescriptor and must be valid, otherwise IllegalArgumentException is throw. See Advapi32#SetNamedSecurityInfo for process privilege requirements in getting the OWNER.
setOwner
,
boolean
Set the group. The group is extracted from securityDescriptor and must be valid, otherwise IllegalArgumentException is throw.
setGroup
,
boolean
Set the DACL. The DACL is extracted from securityDescriptor and must be valid, otherwise IllegalArgumentException is throw.
setDACL
,
boolean
Set the SACL. The SACL is extracted from securityDescriptor and must be valid, otherwise IllegalArgumentException is throw. See Advapi32#SetNamedSecurityInfo for process privilege requirements in getting the SACL.
setSACL
,
boolean
Set DACL protected status as contained within securityDescriptor.control.
setDACLProtectedStatus
,
boolean
Set SACL protected status as contained within securityDescriptor.control.
setSACLProtectedStatus
)

Set a self relative security descriptor for the given object type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait