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;
}
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;
}
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;
}
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());
}
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());
}
Aggregations