Search in sources :

Example 46 with DWORD

use of com.sun.jna.platform.win32.WinDef.DWORD in project jna by java-native-access.

the class RunningObjectTable method Revoke.

@Override
public HRESULT Revoke(DWORD dwRegister) {
    final int vTableId = 4;
    WinNT.HRESULT hr = (WinNT.HRESULT) this._invokeNativeObject(vTableId, new Object[] { this.getPointer(), dwRegister }, WinNT.HRESULT.class);
    return hr;
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) WinNT(com.sun.jna.platform.win32.WinNT) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT)

Example 47 with DWORD

use of com.sun.jna.platform.win32.WinDef.DWORD in project jna by java-native-access.

the class RunningObjectTable method Register.

// The magic number values for (vTableId) below, are worked out by
// counting the number of methods in the full interface (0 indexed), as this
// inherits IUnknown, which has 3 methods, we start here at 3.
@Override
public HRESULT Register(DWORD grfFlags, Pointer punkObject, Pointer pmkObjectName, DWORDByReference pdwRegister) {
    final int vTableId = 3;
    WinNT.HRESULT hr = (WinNT.HRESULT) this._invokeNativeObject(vTableId, new Object[] { this.getPointer(), grfFlags, punkObject, pmkObjectName, pdwRegister }, WinNT.HRESULT.class);
    return hr;
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) WinNT(com.sun.jna.platform.win32.WinNT) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT)

Example 48 with DWORD

use of com.sun.jna.platform.win32.WinDef.DWORD in project jna by java-native-access.

the class RunningObjectTable method NoteChangeTime.

@Override
public HRESULT NoteChangeTime(DWORD dwRegister, FILETIME pfiletime) {
    final int vTableId = 7;
    WinNT.HRESULT hr = (WinNT.HRESULT) this._invokeNativeObject(vTableId, new Object[] { this.getPointer(), dwRegister, pfiletime }, WinNT.HRESULT.class);
    return hr;
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) WinNT(com.sun.jna.platform.win32.WinNT) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT)

Example 49 with DWORD

use of com.sun.jna.platform.win32.WinDef.DWORD in project jna by java-native-access.

the class W32Service method addShutdownPrivilegeToProcess.

private void addShutdownPrivilegeToProcess() {
    HANDLEByReference hToken = new HANDLEByReference();
    LUID luid = new LUID();
    Advapi32.INSTANCE.OpenProcessToken(Kernel32.INSTANCE.GetCurrentProcess(), WinNT.TOKEN_ADJUST_PRIVILEGES, hToken);
    Advapi32.INSTANCE.LookupPrivilegeValue("", WinNT.SE_SHUTDOWN_NAME, luid);
    TOKEN_PRIVILEGES tp = new TOKEN_PRIVILEGES(1);
    tp.Privileges[0] = new LUID_AND_ATTRIBUTES(luid, new DWORD(WinNT.SE_PRIVILEGE_ENABLED));
    Advapi32.INSTANCE.AdjustTokenPrivileges(hToken.getValue(), false, tp, tp.size(), null, new IntByReference());
}
Also used : TOKEN_PRIVILEGES(com.sun.jna.platform.win32.WinNT.TOKEN_PRIVILEGES) IntByReference(com.sun.jna.ptr.IntByReference) LUID(com.sun.jna.platform.win32.WinNT.LUID) LUID_AND_ATTRIBUTES(com.sun.jna.platform.win32.WinNT.LUID_AND_ATTRIBUTES) DWORD(com.sun.jna.platform.win32.WinDef.DWORD) HANDLEByReference(com.sun.jna.platform.win32.WinNT.HANDLEByReference)

Example 50 with DWORD

use of com.sun.jna.platform.win32.WinDef.DWORD in project jna by java-native-access.

the class EnumMoniker_Test method Clone.

@Test
public void Clone() {
    // GetRunningObjectTable
    PointerByReference pprot = new PointerByReference();
    HRESULT hr = Ole32.INSTANCE.GetRunningObjectTable(new DWORD(0), pprot);
    COMUtils.checkRC(hr);
    IRunningObjectTable rot = new RunningObjectTable(pprot.getValue());
    // EnumRunning
    PointerByReference ppenumMoniker = new PointerByReference();
    hr = rot.EnumRunning(ppenumMoniker);
    COMUtils.checkRC(hr);
    IEnumMoniker iterator1 = new EnumMoniker(ppenumMoniker.getValue());
    // iterator1.Reset
    hr = iterator1.Reset();
    COMUtils.checkRC(hr);
    // iterator1.Next
    PointerByReference rgelt1 = new PointerByReference();
    ULONGByReference pceltFetched1 = new ULONGByReference();
    hr = iterator1.Next(new ULONG(1), rgelt1, pceltFetched1);
    COMUtils.checkRC(hr);
    // iterator1.Clone
    PointerByReference ppenum = new PointerByReference();
    hr = iterator1.Clone(ppenum);
    COMUtils.checkRC(hr);
    IEnumMoniker iterator2 = new EnumMoniker(ppenum.getValue());
    // iterator2.Next
    PointerByReference rgelt2 = new PointerByReference();
    ULONGByReference pceltFetched2 = new ULONGByReference();
    hr = iterator2.Next(new ULONG(1), rgelt2, pceltFetched2);
    COMUtils.checkRC(hr);
    assertNotEquals(rgelt1.getValue(), rgelt2.getValue());
    // iterator1.Next
    rgelt1 = new PointerByReference();
    pceltFetched1 = new ULONGByReference();
    hr = iterator1.Next(new ULONG(1), rgelt1, pceltFetched1);
    COMUtils.checkRC(hr);
    assertEquals(rgelt1.getValue(), rgelt2.getValue());
}
Also used : ULONG(com.sun.jna.platform.win32.WinDef.ULONG) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference) DWORD(com.sun.jna.platform.win32.WinDef.DWORD) ULONGByReference(com.sun.jna.platform.win32.WinDef.ULONGByReference) Test(org.junit.Test)

Aggregations

DWORD (com.sun.jna.platform.win32.WinDef.DWORD)56 PointerByReference (com.sun.jna.ptr.PointerByReference)23 HANDLE (com.sun.jna.platform.win32.WinNT.HANDLE)17 File (java.io.File)17 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)16 Test (org.junit.Test)15 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)11 Memory (com.sun.jna.Memory)9 ULONG (com.sun.jna.platform.win32.WinDef.ULONG)9 ULONGByReference (com.sun.jna.platform.win32.WinDef.ULONGByReference)7 HANDLEByReference (com.sun.jna.platform.win32.WinNT.HANDLEByReference)7 GENERIC_MAPPING (com.sun.jna.platform.win32.WinNT.GENERIC_MAPPING)6 UINT_PTR (com.sun.jna.platform.win32.WinDef.UINT_PTR)5 TOKEN_PRIVILEGES (com.sun.jna.platform.win32.WinNT.TOKEN_PRIVILEGES)5 IntByReference (com.sun.jna.ptr.IntByReference)5 APPBARDATA (com.sun.jna.platform.win32.ShellAPI.APPBARDATA)4 WinNT (com.sun.jna.platform.win32.WinNT)4 Pointer (com.sun.jna.Pointer)3 SC_HANDLE (com.sun.jna.platform.win32.Winsvc.SC_HANDLE)3 BufferedWriter (java.io.BufferedWriter)3