Package com.sun.jna.platform.win32.WinNT

Examples of com.sun.jna.platform.win32.WinNT.HANDLE


      assertTrue(Advapi32.INSTANCE.CloseEventLog(h));
      assertTrue(Advapi32.INSTANCE.CloseEventLog(hBackup));
    }
   
    public void testReadEventLog() {
      HANDLE h = Advapi32.INSTANCE.OpenEventLog(null, "Application");
      IntByReference pnBytesRead = new IntByReference();
      IntByReference pnMinNumberOfBytesNeeded = new IntByReference();
      Memory buffer = new Memory(1);
      assertFalse(Advapi32.INSTANCE.ReadEventLog(h,
          WinNT.EVENTLOG_SEQUENTIAL_READ | WinNT.EVENTLOG_BACKWARDS_READ,
View Full Code Here


      assertTrue(pnMinNumberOfBytesNeeded.getValue() > 0);
      assertTrue(Advapi32.INSTANCE.CloseEventLog(h));
    }
   
    public void testReadEventLogEntries() {
      HANDLE h = Advapi32.INSTANCE.OpenEventLog(null, "Application");
      IntByReference pnBytesRead = new IntByReference();
      IntByReference pnMinNumberOfBytesNeeded = new IntByReference();
      Memory buffer = new Memory(1024 * 64);
      // shorten test, avoid iterating through all events
      int maxReads = 3;      
View Full Code Here

        assertTrue("Error closing event log",
                   Advapi32.INSTANCE.CloseEventLog(h));     
    }
   
    public void testGetOldestEventLogRecord() {
      HANDLE h = Advapi32.INSTANCE.OpenEventLog(null, "Application");
      IntByReference oldestRecord = new IntByReference();
      assertTrue(Advapi32.INSTANCE.GetOldestEventLogRecord(h, oldestRecord));
      assertTrue(oldestRecord.getValue() >= 0);
      assertTrue(Advapi32.INSTANCE.CloseEventLog(h));
    }
View Full Code Here

      assertEquals(W32Errors.ERROR_INVALID_HANDLE, Kernel32.INSTANCE.GetLastError());
    }
   
    public void testCreateProcessAsUser() {
      HANDLEByReference hToken = new HANDLEByReference();
      HANDLE processHandle = Kernel32.INSTANCE.GetCurrentProcess();
      assertTrue(Advapi32.INSTANCE.OpenProcessToken(processHandle,
          WinNT.TOKEN_DUPLICATE | WinNT.TOKEN_QUERY, hToken));
     
      assertFalse(Advapi32.INSTANCE.CreateProcessAsUser(hToken.getValue(), null, "InvalidCmdLine.jna",
          null, null, false, 0, null, null, new WinBase.STARTUPINFO(),
View Full Code Here

    PHYSICAL_MONITOR[] physMons = new PHYSICAL_MONITOR[monitorCount];
    Dxva2.INSTANCE.GetPhysicalMonitorsFromHMONITOR(hMonitor, monitorCount, physMons);
   
    for (int i = 0; i < monitorCount; i++)
    {
      HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
      System.out.println("Monitor " + i + " - " + new String(physMons[i].szPhysicalMonitorDescription));
   
      enumeratePhysicalMonitor(hPhysicalMonitor);
    }
   
View Full Code Here

   */
  public static Account[] getCurrentUserGroups() {
    HANDLEByReference phToken = new HANDLEByReference();
    try {
      // open thread or process token
      HANDLE threadHandle = Kernel32.INSTANCE.GetCurrentThread();
      if (!Advapi32.INSTANCE.OpenThreadToken(threadHandle,
          TOKEN_DUPLICATE | TOKEN_QUERY, true, phToken)) {
        if (W32Errors.ERROR_NO_TOKEN != Kernel32.INSTANCE
            .GetLastError()) {
          throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
        }
        HANDLE processHandle = Kernel32.INSTANCE.GetCurrentProcess();
        if (!Advapi32.INSTANCE.OpenProcessToken(processHandle,
            TOKEN_DUPLICATE | TOKEN_QUERY, phToken)) {
          throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
        }
      }
View Full Code Here

                int w = bounds.width;
                int h = bounds.height;
                int ww = win.getWidth();
                int wh = win.getHeight();
                HDC screenDC = user.GetDC(null);
                HANDLE oldBitmap = null;
                try {
                    if (memDC == null) {
                        memDC = gdi.CreateCompatibleDC(screenDC);
                    }
                    if (hBitmap == null || !win.getSize().equals(bitmapSize)) {
View Full Code Here

   * Hangup a connection by name
   * @param connName the connection name
   * @throws Ras32Exception errors
   */
  public static void hangupRasConnection(String connName) throws Ras32Exception {
    HANDLE hrasConn = getRasConnection(connName);
    if (hrasConn == null) return;
    int err = Rasapi32.INSTANCE.RasHangUp(hrasConn);
    if (err != WinError.ERROR_SUCCESS) throw new Ras32Exception(err);
  }
View Full Code Here

        assertEquals("Mismatched names", expected, actual);
    }

    public void testWaitForSingleObject() {
    HANDLE handle = Kernel32.INSTANCE.CreateEvent(null, false, false, null);

    // handle runs into timeout since it is not triggered
    // WAIT_TIMEOUT = 0x00000102
    assertEquals(WinError.WAIT_TIMEOUT, Kernel32.INSTANCE.WaitForSingleObject(
        handle, 1000));
View Full Code Here

    Kernel32.INSTANCE.CloseHandle(handle);
  }

    public void testResetEvent() {
    HANDLE handle = Kernel32.INSTANCE.CreateEvent(null, true, false, null);

    // set the event to the signaled state
    Kernel32.INSTANCE.SetEvent(handle);

    // This should return successfully
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.WinNT.HANDLE

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.