Package com.sun.jna.platform.win32

Examples of com.sun.jna.platform.win32.LMAccess$GROUP_INFO_0


    }
   
    public void testDuplicateToken() {
      HANDLEByReference phToken = new HANDLEByReference();
      HANDLEByReference phTokenDup = new HANDLEByReference();
      HANDLE processHandle = Kernel32.INSTANCE.GetCurrentProcess();
        assertTrue(Advapi32.INSTANCE.OpenProcessToken(processHandle,
            WinNT.TOKEN_DUPLICATE | WinNT.TOKEN_QUERY, phToken));
        assertTrue(Advapi32.INSTANCE.DuplicateToken(phToken.getValue(),
            WinNT.SECURITY_IMPERSONATION_LEVEL.SecurityImpersonation, phTokenDup));
      assertTrue(Kernel32.INSTANCE.CloseHandle(phTokenDup.getValue()));
View Full Code Here


    }
   
    public void testDuplicateTokenEx() {
      HANDLEByReference hExistingToken = new HANDLEByReference();
      HANDLEByReference phNewToken = new HANDLEByReference();
      HANDLE processHandle = Kernel32.INSTANCE.GetCurrentProcess();
      assertTrue(Advapi32.INSTANCE.OpenProcessToken(processHandle,
          WinNT.TOKEN_DUPLICATE | WinNT.TOKEN_QUERY, hExistingToken));
      assertTrue(Advapi32.INSTANCE.DuplicateTokenEx(hExistingToken.getValue(),
          WinNT.GENERIC_READ, null, SECURITY_IMPERSONATION_LEVEL.SecurityAnonymous,
          TOKEN_TYPE.TokenPrimary, phNewToken));
View Full Code Here

      assertTrue(Kernel32.INSTANCE.CloseHandle(hExistingToken.getValue()));
    }
   
    public void testGetTokenOwnerInformation() {
      HANDLEByReference phToken = new HANDLEByReference();
      HANDLE processHandle = Kernel32.INSTANCE.GetCurrentProcess();
        assertTrue(Advapi32.INSTANCE.OpenProcessToken(processHandle,
            WinNT.TOKEN_DUPLICATE | WinNT.TOKEN_QUERY, phToken));
        IntByReference tokenInformationLength = new IntByReference();
        assertFalse(Advapi32.INSTANCE.GetTokenInformation(phToken.getValue(),
            WinNT.TOKEN_INFORMATION_CLASS.TokenOwner, null, 0, tokenInformationLength));
View Full Code Here

        assertTrue(Kernel32.INSTANCE.CloseHandle(phToken.getValue()));
    }
   
    public void testGetTokenUserInformation() {
      HANDLEByReference phToken = new HANDLEByReference();
      HANDLE processHandle = Kernel32.INSTANCE.GetCurrentProcess();
        assertTrue(Advapi32.INSTANCE.OpenProcessToken(processHandle,
            WinNT.TOKEN_DUPLICATE | WinNT.TOKEN_QUERY, phToken));
        IntByReference tokenInformationLength = new IntByReference();
        assertFalse(Advapi32.INSTANCE.GetTokenInformation(phToken.getValue(),
            WinNT.TOKEN_INFORMATION_CLASS.TokenUser, null, 0, tokenInformationLength));
View Full Code Here

        assertTrue(Kernel32.INSTANCE.CloseHandle(phToken.getValue()));
    }  
   
    public void testGetTokenGroupsInformation() {
      HANDLEByReference phToken = new HANDLEByReference();
      HANDLE processHandle = Kernel32.INSTANCE.GetCurrentProcess();
        assertTrue(Advapi32.INSTANCE.OpenProcessToken(processHandle,
            WinNT.TOKEN_DUPLICATE | WinNT.TOKEN_QUERY, phToken));
        IntByReference tokenInformationLength = new IntByReference();
        assertFalse(Advapi32.INSTANCE.GetTokenInformation(phToken.getValue(),
            WinNT.TOKEN_INFORMATION_CLASS.TokenGroups, null, 0, tokenInformationLength));
View Full Code Here

      String convertedSidString = convertedSidStringPtr.getValue().getWideString(0);
      assertEquals(EVERYONE, convertedSidString);
    }
   
    public void testOpenEventLog() {
      HANDLE h = Advapi32.INSTANCE.OpenEventLog(null, "Application");
      assertNotNull(h);
      assertFalse(h.equals(WinBase.INVALID_HANDLE_VALUE));
      assertTrue(Advapi32.INSTANCE.CloseEventLog(h));
    }
View Full Code Here

      assertTrue(Advapi32.INSTANCE.CloseEventLog(h));
    }
   
    public void testRegisterEventSource() {
      // the Security event log is reserved
      HANDLE h = Advapi32.INSTANCE.RegisterEventSource(null, "Security");
      assertNull(h);
      assertEquals(W32Errors.ERROR_ACCESS_DENIED, Kernel32.INSTANCE.GetLastError());
    }
View Full Code Here

            }
        } catch (Win32Exception e) {
            return;
        }

      HANDLE h = Advapi32.INSTANCE.RegisterEventSource(null, jnaEventSource);     
      IntByReference before = new IntByReference();
      assertTrue(Advapi32.INSTANCE.GetNumberOfEventLogRecords(h, before));
      assertNotNull(h);
      String s[] = { "JNA", "Event" };
      Memory m = new Memory(4);
      m.setByte(0, (byte) 1);
      m.setByte(1, (byte) 2);
      m.setByte(2, (byte) 3);
      m.setByte(3, (byte) 4);
      assertTrue(Advapi32.INSTANCE.ReportEvent(h, WinNT.EVENTLOG_ERROR_TYPE, 0, 0, null, 2, 4, s, m));
      IntByReference after = new IntByReference();
      assertTrue(Advapi32.INSTANCE.GetNumberOfEventLogRecords(h, after));
      assertTrue(before.getValue() < after.getValue());
      assertFalse(h.equals(WinBase.INVALID_HANDLE_VALUE));
      assertTrue(Advapi32.INSTANCE.DeregisterEventSource(h));
      Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, jnaEventSourceRegistryPath);
    }
View Full Code Here

      assertTrue(Advapi32.INSTANCE.DeregisterEventSource(h));
      Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, jnaEventSourceRegistryPath);
    }
   
    public void testGetNumberOfEventLogRecords() {
      HANDLE h = Advapi32.INSTANCE.OpenEventLog(null, "Application");
      assertFalse(h.equals(WinBase.INVALID_HANDLE_VALUE));
      IntByReference n = new IntByReference();
      assertTrue(Advapi32.INSTANCE.GetNumberOfEventLogRecords(h, n));
      assertTrue(n.getValue() >= 0);
      assertTrue(Advapi32.INSTANCE.CloseEventLog(h));
    }
View Full Code Here

        enableButton = new JButton("Enable");
        enableButton.setMnemonic('e');
        enableButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                HRESULT hResult;
                hResult = LibDwmApi.INSTANCE.DwmEnableComposition(LibDwmApi.DWM_EC_ENABLECOMPOSITION);
                System.out.println("DwmEnableComposition hResult=" + hResult.intValue());
                dumpStatus();
            }
        });

        disableButton = new JButton("Disable");
        disableButton.setMnemonic('d');
        disableButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                HRESULT hResult;
                hResult = LibDwmApi.INSTANCE.DwmEnableComposition(LibDwmApi.DWM_EC_DISABLECOMPOSITION);
                System.out.println("DwmEnableComposition hResult=" + hResult.intValue());
                dumpStatus();
            }
        });

        contentPane = new JPanel();
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.LMAccess$GROUP_INFO_0

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.