Search in sources :

Example 6 with FILETIME

use of com.sun.jna.platform.win32.WinBase.FILETIME in project jna by java-native-access.

the class Kernel32Test method testGetSystemTimes.

public void testGetSystemTimes() {
    Kernel32 kernel = Kernel32.INSTANCE;
    FILETIME lpIdleTime = new FILETIME();
    FILETIME lpKernelTime = new FILETIME();
    FILETIME lpUserTime = new FILETIME();
    boolean succ = kernel.GetSystemTimes(lpIdleTime, lpKernelTime, lpUserTime);
    assertTrue(succ);
    long idleTime = lpIdleTime.toDWordLong().longValue();
    long kernelTime = lpKernelTime.toDWordLong().longValue();
    long userTime = lpUserTime.toDWordLong().longValue();
    // All should be >= 0.  kernel includes idle.
    assertTrue(idleTime >= 0);
    assertTrue(kernelTime >= idleTime);
    assertTrue(userTime >= 0);
}
Also used : FILETIME(com.sun.jna.platform.win32.WinBase.FILETIME)

Example 7 with FILETIME

use of com.sun.jna.platform.win32.WinBase.FILETIME in project jna by java-native-access.

the class Advapi32Test method testRegQueryInfoKey.

public void testRegQueryInfoKey() {
    IntByReference lpcClass = new IntByReference();
    IntByReference lpcSubKeys = new IntByReference();
    IntByReference lpcMaxSubKeyLen = new IntByReference();
    IntByReference lpcValues = new IntByReference();
    IntByReference lpcMaxClassLen = new IntByReference();
    IntByReference lpcMaxValueNameLen = new IntByReference();
    IntByReference lpcMaxValueLen = new IntByReference();
    IntByReference lpcbSecurityDescriptor = new IntByReference();
    FILETIME lpftLastWriteTime = new FILETIME();
    assertEquals(W32Errors.ERROR_SUCCESS, Advapi32.INSTANCE.RegQueryInfoKey(WinReg.HKEY_LOCAL_MACHINE, null, lpcClass, null, lpcSubKeys, lpcMaxSubKeyLen, lpcMaxClassLen, lpcValues, lpcMaxValueNameLen, lpcMaxValueLen, lpcbSecurityDescriptor, lpftLastWriteTime));
    assertTrue(lpcSubKeys.getValue() > 0);
}
Also used : IntByReference(com.sun.jna.ptr.IntByReference) FILETIME(com.sun.jna.platform.win32.WinBase.FILETIME)

Aggregations

FILETIME (com.sun.jna.platform.win32.WinBase.FILETIME)6 SYSTEMTIME (com.sun.jna.platform.win32.WinBase.SYSTEMTIME)2 Memory (com.sun.jna.Memory)1 FILE_BASIC_INFO (com.sun.jna.platform.win32.WinBase.FILE_BASIC_INFO)1 DWORD (com.sun.jna.platform.win32.WinDef.DWORD)1 WinNT (com.sun.jna.platform.win32.WinNT)1 HANDLE (com.sun.jna.platform.win32.WinNT.HANDLE)1 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)1 IntByReference (com.sun.jna.ptr.IntByReference)1 File (java.io.File)1 FileTime (java.nio.file.attribute.FileTime)1 Date (java.util.Date)1