Class Advapi32FFM
java.lang.Object
oshi.ffm.ForeignFunctions
oshi.ffm.windows.WindowsForeignFunctions
oshi.ffm.windows.Advapi32FFM
-
Field Summary
FieldsFields inherited from class ForeignFunctions
CAPTURE_CALL_STATE, CAPTURED_STATE_LAYOUT, ERRNO_HANDLE, LIBRARY_ARENA, LINKER, NATIVE_LONG_SIZE, NATIVE_POINTER_SIZE, NATIVE_SIZE_T_SIZE, SYMBOL_LOOKUP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanAdjustTokenPrivileges(MemorySegment hToken, MemorySegment tkp) static booleanCloseEventLog(MemorySegment hEventLog) static booleanCloseServiceHandle(MemorySegment hSCObject) static booleanConvertSidToStringSid(MemorySegment Sid, MemorySegment StringSid) Converts a SID to a string format.static booleanConvertStringSidToSid(MemorySegment StringSid, MemorySegment Sid) Converts a string-format SID to a valid, functional SID.static booleanEnumServicesStatusEx(MemorySegment hSCManager, int infoLevel, int dwServiceType, int dwServiceState, MemorySegment lpServices, int cbBufSize, MemorySegment pcbBytesNeeded, MemorySegment lpServicesReturned, MemorySegment lpResumeHandle, MemorySegment pszGroupName) static booleanGetTokenInformation(MemorySegment hToken, int tokenInfoClass, MemorySegment tokenInfo, int tokenInfoLength, MemorySegment returnLength) static booleanLookupAccountSid(MemorySegment lpSystemName, MemorySegment lpSid, MemorySegment lpName, MemorySegment cchName, MemorySegment lpReferencedDomainName, MemorySegment cchReferencedDomainName, MemorySegment peUse) Retrieves the name of the account for the specified SID.static booleanLookupPrivilegeValue(String name, MemorySegment luid, Arena arena) static Optional<MemorySegment> OpenEventLog(Arena arena, String source) static Optional<MemorySegment> OpenEventLog(MemorySegment serverName, MemorySegment sourceName) static booleanOpenProcessToken(MemorySegment process, int desiredAccess, MemorySegment hTokenOut) static MemorySegmentOpenSCManager(MemorySegment lpMachineName, MemorySegment lpDatabaseName, int dwDesiredAccess) static booleanReadEventLog(MemorySegment hEventLog, int flags, MemorySegment buffer, int bufSize, MemorySegment bytesRead, MemorySegment minBytesNeeded) static intRegCloseKey(MemorySegment hKey) static intRegEnumKeyEx(MemorySegment hKey, int dwIndex, MemorySegment lpName, MemorySegment lpcchName, MemorySegment lpReserved, MemorySegment lpClass, MemorySegment lpcchClass, MemorySegment lpftLastWriteTime) static intRegOpenKeyEx(MemorySegment hKey, MemorySegment subKey, int options, int samDesired, MemorySegment phkResult) static intRegQueryInfoKey(MemorySegment hKey, MemorySegment lpClass, MemorySegment lpcchClass, MemorySegment lpReserved, MemorySegment lpcSubKeys, MemorySegment lpcMaxSubKeyLen, MemorySegment lpcMaxClassLen, MemorySegment lpcValues, MemorySegment lpcMaxValueNameLen, MemorySegment lpcMaxValueLen, MemorySegment lpcbSecurityDescriptor, MemorySegment lpftLastWriteTime) static intRegQueryValueEx(MemorySegment hKey, MemorySegment lpValueName, int reserved, MemorySegment lpType, MemorySegment lpData, MemorySegment lpcbData) Methods inherited from class WindowsForeignFunctions
checkSuccess, isSuccess, readAnsiString, readWideString, setupTokenPrivileges, toWideStringMethods inherited from class ForeignFunctions
downcall, getByteArrayFromNativePointer, getErrno, getStringFromNativePointer, getStructFromNativePointer, lib, libraryLookup
-
Field Details
-
TokenUser
public static final int TokenUser- See Also:
-
TokenPrimaryGroup
public static final int TokenPrimaryGroup- See Also:
-
-
Constructor Details
-
Advapi32FFM
public Advapi32FFM()
-
-
Method Details
-
AdjustTokenPrivileges
public static boolean AdjustTokenPrivileges(MemorySegment hToken, MemorySegment tkp) throws Throwable - Throws:
Throwable
-
CloseEventLog
- Throws:
Throwable
-
GetTokenInformation
public static boolean GetTokenInformation(MemorySegment hToken, int tokenInfoClass, MemorySegment tokenInfo, int tokenInfoLength, MemorySegment returnLength) throws Throwable - Throws:
Throwable
-
LookupPrivilegeValue
public static boolean LookupPrivilegeValue(String name, MemorySegment luid, Arena arena) throws Throwable - Throws:
Throwable
-
OpenEventLog
public static Optional<MemorySegment> OpenEventLog(MemorySegment serverName, MemorySegment sourceName) throws Throwable - Throws:
Throwable
-
OpenEventLog
-
OpenProcessToken
public static boolean OpenProcessToken(MemorySegment process, int desiredAccess, MemorySegment hTokenOut) throws Throwable - Throws:
Throwable
-
ReadEventLog
public static boolean ReadEventLog(MemorySegment hEventLog, int flags, MemorySegment buffer, int bufSize, MemorySegment bytesRead, MemorySegment minBytesNeeded) throws Throwable - Throws:
Throwable
-
RegCloseKey
- Throws:
Throwable
-
RegEnumKeyEx
public static int RegEnumKeyEx(MemorySegment hKey, int dwIndex, MemorySegment lpName, MemorySegment lpcchName, MemorySegment lpReserved, MemorySegment lpClass, MemorySegment lpcchClass, MemorySegment lpftLastWriteTime) throws Throwable - Throws:
Throwable
-
RegOpenKeyEx
public static int RegOpenKeyEx(MemorySegment hKey, MemorySegment subKey, int options, int samDesired, MemorySegment phkResult) throws Throwable - Throws:
Throwable
-
RegQueryInfoKey
public static int RegQueryInfoKey(MemorySegment hKey, MemorySegment lpClass, MemorySegment lpcchClass, MemorySegment lpReserved, MemorySegment lpcSubKeys, MemorySegment lpcMaxSubKeyLen, MemorySegment lpcMaxClassLen, MemorySegment lpcValues, MemorySegment lpcMaxValueNameLen, MemorySegment lpcMaxValueLen, MemorySegment lpcbSecurityDescriptor, MemorySegment lpftLastWriteTime) throws Throwable - Throws:
Throwable
-
RegQueryValueEx
public static int RegQueryValueEx(MemorySegment hKey, MemorySegment lpValueName, int reserved, MemorySegment lpType, MemorySegment lpData, MemorySegment lpcbData) throws Throwable - Throws:
Throwable
-
LookupAccountSid
public static boolean LookupAccountSid(MemorySegment lpSystemName, MemorySegment lpSid, MemorySegment lpName, MemorySegment cchName, MemorySegment lpReferencedDomainName, MemorySegment cchReferencedDomainName, MemorySegment peUse) throws Throwable Retrieves the name of the account for the specified SID.- Parameters:
lpSystemName- The name of the target computer (NULL for local)lpSid- The SID to look uplpName- Buffer to receive the account namecchName- Size of lpName bufferlpReferencedDomainName- Buffer to receive the domain namecchReferencedDomainName- Size of lpReferencedDomainName bufferpeUse- Receives a value indicating the type of the account- Returns:
- true if successful
- Throws:
Throwable
-
ConvertStringSidToSid
public static boolean ConvertStringSidToSid(MemorySegment StringSid, MemorySegment Sid) throws Throwable Converts a string-format SID to a valid, functional SID.On success, the caller is responsible for freeing the allocated SID buffer using
Kernel32FFM.LocalFree(MemorySegment)onSid.get(ADDRESS, 0)to avoid memory leaks.- Parameters:
StringSid- the string-format SID to convertSid- pointer to receive the allocated SID- Returns:
- true if successful
- Throws:
Throwable
-
ConvertSidToStringSid
public static boolean ConvertSidToStringSid(MemorySegment Sid, MemorySegment StringSid) throws Throwable Converts a SID to a string format.On success, the caller is responsible for freeing the allocated StringSid buffer using
Kernel32FFM.LocalFree(MemorySegment)to avoid memory leaks.- Parameters:
Sid- The SID to convert (input parameter)StringSid- Pointer to receive the newly allocated string SID pointer (output parameter). On success, contains a pointer that must be freed with LocalFree.- Returns:
- true if the conversion succeeded, false otherwise
- Throws:
Throwable
-
OpenSCManager
public static MemorySegment OpenSCManager(MemorySegment lpMachineName, MemorySegment lpDatabaseName, int dwDesiredAccess) throws Throwable - Throws:
Throwable
-
EnumServicesStatusEx
public static boolean EnumServicesStatusEx(MemorySegment hSCManager, int infoLevel, int dwServiceType, int dwServiceState, MemorySegment lpServices, int cbBufSize, MemorySegment pcbBytesNeeded, MemorySegment lpServicesReturned, MemorySegment lpResumeHandle, MemorySegment pszGroupName) throws Throwable - Throws:
Throwable
-
CloseServiceHandle
- Throws:
Throwable
-