Package com.sun.jna.platform.win32.WinDef

Examples of com.sun.jna.platform.win32.WinDef.HMODULE


        data.rc.bottom = User32.INSTANCE.GetSystemMetrics(User32.SM_CYFULLSCREEN);
        data.rc.right = User32.INSTANCE.GetSystemMetrics(User32.SM_CXFULLSCREEN);

        queryPos(data);

        UINT_PTR h = Shell32.INSTANCE.SHAppBarMessage(new DWORD(ShellAPI.ABM_SETPOS), data);

        assertNotNull(h);
        assertTrue(h.intValue() >= 0);

        removeAppBar();
View Full Code Here


        data.rc.bottom = RESIZE_HEIGHT;
        data.rc.right = User32.INSTANCE.GetSystemMetrics(User32.SM_CXFULLSCREEN);

        queryPos(data);

        UINT_PTR h = Shell32.INSTANCE.SHAppBarMessage(new DWORD(ShellAPI.ABM_SETPOS), data);

        assertNotNull(h);
        assertTrue(h.intValue() >= 0);

        removeAppBar();
View Full Code Here

      }
      assertTrue(luid != null);     
     
      // Re-enable it. That should succeed.
      tp = new WinNT.TOKEN_PRIVILEGES(1);
      tp.Privileges[0] = new WinNT.LUID_AND_ATTRIBUTES(luid, new DWORD(WinNT.SE_PRIVILEGE_ENABLED));
     
      assertTrue(Advapi32.INSTANCE.AdjustTokenPrivileges(hToken.getValue(), false, tp, 0, null, null));
      assertTrue(Kernel32.INSTANCE.CloseHandle(hToken.getValue()));
    }
View Full Code Here

      assertTrue(Advapi32.INSTANCE.RevertToSelf());
    }

    public void testMapGenericReadMask() {
        final GENERIC_MAPPING mapping = new GENERIC_MAPPING();
        mapping.genericRead = new DWORD(FILE_GENERIC_READ);
        mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE);
        mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE);
        mapping.genericAll = new DWORD(FILE_ALL_ACCESS);

        final DWORDByReference rights = new DWORDByReference(new DWORD(GENERIC_READ));
        Advapi32.INSTANCE.MapGenericMask(rights, mapping);

        assertEquals(FILE_GENERIC_READ, rights.getValue().intValue());
        assertTrue(GENERIC_READ != (rights.getValue().intValue() & GENERIC_READ));
    }
View Full Code Here

        assertTrue(GENERIC_READ != (rights.getValue().intValue() & GENERIC_READ));
    }

    public void testMapGenericWriteMask() {
        final GENERIC_MAPPING mapping = new GENERIC_MAPPING();
        mapping.genericRead = new DWORD(FILE_GENERIC_READ);
        mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE);
        mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE);
        mapping.genericAll = new DWORD(FILE_ALL_ACCESS);

        final DWORDByReference rights = new DWORDByReference(new DWORD(GENERIC_WRITE));
        Advapi32.INSTANCE.MapGenericMask(rights, mapping);

        assertEquals(FILE_GENERIC_WRITE, rights.getValue().intValue());
        assertTrue(GENERIC_WRITE != (rights.getValue().intValue() & GENERIC_WRITE));
    }
View Full Code Here

        assertTrue(GENERIC_WRITE != (rights.getValue().intValue() & GENERIC_WRITE));
    }

    public void testMapGenericExecuteMask() {
        final GENERIC_MAPPING mapping = new GENERIC_MAPPING();
        mapping.genericRead = new DWORD(FILE_GENERIC_READ);
        mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE);
        mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE);
        mapping.genericAll = new DWORD(FILE_ALL_ACCESS);

        final DWORDByReference rights = new DWORDByReference(new DWORD(GENERIC_EXECUTE));
        Advapi32.INSTANCE.MapGenericMask(rights, mapping);

        assertEquals(FILE_GENERIC_EXECUTE, rights.getValue().intValue());
        assertTrue(GENERIC_EXECUTE != (rights.getValue().intValue() & GENERIC_EXECUTE));
    }
View Full Code Here

        assertTrue(GENERIC_EXECUTE != (rights.getValue().intValue() & GENERIC_EXECUTE));
    }

    public void testMapGenericAllMask() {
        final GENERIC_MAPPING mapping = new GENERIC_MAPPING();
        mapping.genericRead = new DWORD(FILE_GENERIC_READ);
        mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE);
        mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE);
        mapping.genericAll = new DWORD(FILE_ALL_ACCESS);

        final DWORDByReference rights = new DWORDByReference(new DWORD(GENERIC_ALL));
        Advapi32.INSTANCE.MapGenericMask(rights, mapping);

        assertEquals(FILE_ALL_ACCESS, rights.getValue().intValue());
        assertTrue(GENERIC_ALL != (rights.getValue().intValue() & GENERIC_ALL));
    }
View Full Code Here

        assertTrue(GENERIC_ALL != (rights.getValue().intValue() & GENERIC_ALL));
    }

    public void testAccessCheck() {
        final GENERIC_MAPPING mapping = new GENERIC_MAPPING();
        mapping.genericRead = new DWORD(FILE_GENERIC_READ);
        mapping.genericWrite = new DWORD(FILE_GENERIC_WRITE);
        mapping.genericExecute = new DWORD(FILE_GENERIC_EXECUTE);
        mapping.genericAll = new DWORD(FILE_ALL_ACCESS);
        final Memory securityDescriptorMemoryPointer = new Memory(1);

        final PRIVILEGE_SET privileges = new PRIVILEGE_SET(1);
        privileges.PrivilegeCount = new DWORD(0);
        final DWORDByReference privilegeLength = new DWORDByReference(new DWORD(privileges.size()));
        final DWORDByReference grantedAccess = new DWORDByReference();
        final BOOLByReference result = new BOOLByReference();

        final boolean status = Advapi32.INSTANCE.AccessCheck(securityDescriptorMemoryPointer, null, new DWORD(FILE_GENERIC_READ), mapping, privileges, privilegeLength, grantedAccess, result);
        assertFalse(status);
        assertFalse(result.getValue().booleanValue());

        assertEquals(WinError.ERROR_INVALID_HANDLE, Kernel32.INSTANCE.GetLastError());
    }
View Full Code Here

   * Instantiates a new win32 window test.
   */
  public Win32WindowDemo() {
    // define new window class
    WString windowClass = new WString("MyWindowClass");
    HMODULE hInst = Kernel32.INSTANCE.GetModuleHandle("");

    WNDCLASSEX wClass = new WNDCLASSEX();
    wClass.hInstance = hInst;
    wClass.lpfnWndProc = Win32WindowDemo.this;
    wClass.lpszClassName = windowClass;
View Full Code Here

    private static HHOOK hhk;
    private static LowLevelKeyboardProc keyboardHook;

    public static void main(String[] args) {
        final User32 lib = User32.INSTANCE;
        HMODULE hMod = Kernel32.INSTANCE.GetModuleHandle(null);
        keyboardHook = new LowLevelKeyboardProc() {
            public LRESULT callback(int nCode, WPARAM wParam, KBDLLHOOKSTRUCT info) {
                if (nCode >= 0) {
                    switch(wParam.intValue()) {
                    case WinUser.WM_KEYUP:
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.WinDef.HMODULE

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.