Class VariantFFM
java.lang.Object
oshi.ffm.ForeignFunctions
oshi.ffm.windows.WindowsForeignFunctions
oshi.ffm.windows.com.VariantFFM
FFM representation of the Windows VARIANT structure used in COM/OLE automation.
VARIANT is a tagged union that can hold different types of data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longOffset of the data union.static final StructLayoutThe memory layout of a VARIANT structure (24 bytes on 64-bit).static final longSize of a VARIANT in bytes.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longOffset of the vt field.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic MemorySegmentAllocates and initializes an empty VARIANT.static intclear(MemorySegment variant) Clears a VARIANT, releasing any resources.static booleangetBoolVal(MemorySegment variant) Gets the boolean value from a VARIANT (VT_BOOL).static StringgetBstrVal(MemorySegment variant, Arena arena) Gets the BSTR value from a VARIANT.static bytegetByteVal(MemorySegment variant) Gets the byte value from a VARIANT (VT_I1, VT_UI1).static doublegetDoubleVal(MemorySegment variant) Gets the double value from a VARIANT (VT_R8).static floatgetFloatVal(MemorySegment variant) Gets the float value from a VARIANT (VT_R4).static intgetIntVal(MemorySegment variant) Gets the integer value from a VARIANT (VT_I4, VT_INT, VT_UI4, VT_UINT).static longgetLongVal(MemorySegment variant) Gets the long value from a VARIANT (VT_I8, VT_UI8).static shortgetShortVal(MemorySegment variant) Gets the short value from a VARIANT (VT_I2, VT_UI2, VT_BOOL).static intgetVt(MemorySegment variant) Gets the variant type (vt field).Methods inherited from class WindowsForeignFunctions
checkSuccess, isSuccess, readAnsiString, readWideString, setupTokenPrivileges, toWideStringMethods inherited from class ForeignFunctions
downcall, getByteArrayFromNativePointer, getErrno, getStringFromNativePointer, getStructFromNativePointer, lib, libraryLookup
-
Field Details
-
VT_EMPTY
public static final int VT_EMPTY- See Also:
-
VT_NULL
public static final int VT_NULL- See Also:
-
VT_I2
public static final int VT_I2- See Also:
-
VT_I4
public static final int VT_I4- See Also:
-
VT_R4
public static final int VT_R4- See Also:
-
VT_R8
public static final int VT_R8- See Also:
-
VT_CY
public static final int VT_CY- See Also:
-
VT_DATE
public static final int VT_DATE- See Also:
-
VT_BSTR
public static final int VT_BSTR- See Also:
-
VT_DISPATCH
public static final int VT_DISPATCH- See Also:
-
VT_ERROR
public static final int VT_ERROR- See Also:
-
VT_BOOL
public static final int VT_BOOL- See Also:
-
VT_VARIANT
public static final int VT_VARIANT- See Also:
-
VT_UNKNOWN
public static final int VT_UNKNOWN- See Also:
-
VT_DECIMAL
public static final int VT_DECIMAL- See Also:
-
VT_I1
public static final int VT_I1- See Also:
-
VT_UI1
public static final int VT_UI1- See Also:
-
VT_UI2
public static final int VT_UI2- See Also:
-
VT_UI4
public static final int VT_UI4- See Also:
-
VT_I8
public static final int VT_I8- See Also:
-
VT_UI8
public static final int VT_UI8- See Also:
-
VT_INT
public static final int VT_INT- See Also:
-
VT_UINT
public static final int VT_UINT- See Also:
-
VT_VOID
public static final int VT_VOID- See Also:
-
VT_HRESULT
public static final int VT_HRESULT- See Also:
-
VT_PTR
public static final int VT_PTR- See Also:
-
VT_SAFEARRAY
public static final int VT_SAFEARRAY- See Also:
-
VT_CARRAY
public static final int VT_CARRAY- See Also:
-
VT_USERDEFINED
public static final int VT_USERDEFINED- See Also:
-
VT_LPSTR
public static final int VT_LPSTR- See Also:
-
VT_LPWSTR
public static final int VT_LPWSTR- See Also:
-
VT_ARRAY
public static final int VT_ARRAY- See Also:
-
VT_BYREF
public static final int VT_BYREF- See Also:
-
LAYOUT
The memory layout of a VARIANT structure (24 bytes on 64-bit). Layout: vt (2) + wReserved1 (2) + wReserved2 (2) + wReserved3 (2) + data (16) -
SIZE
public static final long SIZESize of a VARIANT in bytes. -
VT_OFFSET
public static final long VT_OFFSETOffset of the vt field.- See Also:
-
DATA_OFFSET
public static final long DATA_OFFSETOffset of the data union.- See Also:
-
-
Method Details
-
allocate
Allocates and initializes an empty VARIANT.- Parameters:
arena- the arena for memory allocation- Returns:
- a memory segment containing the initialized VARIANT
-
getVt
Gets the variant type (vt field).- Parameters:
variant- the VARIANT memory segment- Returns:
- the variant type
-
getBstrVal
Gets the BSTR value from a VARIANT.- Parameters:
variant- the VARIANT memory segmentarena- the arena for string conversion- Returns:
- the string value, or empty string if null
-
getIntVal
Gets the integer value from a VARIANT (VT_I4, VT_INT, VT_UI4, VT_UINT).- Parameters:
variant- the VARIANT memory segment- Returns:
- the integer value
-
getLongVal
Gets the long value from a VARIANT (VT_I8, VT_UI8).- Parameters:
variant- the VARIANT memory segment- Returns:
- the long value
-
getShortVal
Gets the short value from a VARIANT (VT_I2, VT_UI2, VT_BOOL).- Parameters:
variant- the VARIANT memory segment- Returns:
- the short value
-
getByteVal
Gets the byte value from a VARIANT (VT_I1, VT_UI1).- Parameters:
variant- the VARIANT memory segment- Returns:
- the byte value
-
getDoubleVal
Gets the double value from a VARIANT (VT_R8).- Parameters:
variant- the VARIANT memory segment- Returns:
- the double value
-
getFloatVal
Gets the float value from a VARIANT (VT_R4).- Parameters:
variant- the VARIANT memory segment- Returns:
- the float value
-
getBoolVal
Gets the boolean value from a VARIANT (VT_BOOL). In COM, VARIANT_TRUE is -1 and VARIANT_FALSE is 0.- Parameters:
variant- the VARIANT memory segment- Returns:
- the boolean value
-
clear
Clears a VARIANT, releasing any resources.- Parameters:
variant- the VARIANT to clear- Returns:
- HRESULT
-