use of com.sun.jna.platform.win32.WinDef.DWORD in project jna by java-native-access.
the class RunningObjectTable_Test method NoteChangeTime.
@Test
public void NoteChangeTime() {
PointerByReference pprot = new PointerByReference();
HRESULT hr = Ole32.INSTANCE.GetRunningObjectTable(new DWORD(0), pprot);
COMUtils.checkRC(hr);
IRunningObjectTable rot = new RunningObjectTable(pprot.getValue());
//Can't yet be tested as IMoniker is not fully implemented,
// so we can't register an object, and hence can't get a registration key
//rot.NoteChangeTime(dwRegister, pfiletime);
}
use of com.sun.jna.platform.win32.WinDef.DWORD in project jna by java-native-access.
the class RunningObjectTable_Test method GetObject.
@Test
public void GetObject() {
PointerByReference pprot = new PointerByReference();
HRESULT hr = Ole32.INSTANCE.GetRunningObjectTable(new DWORD(0), pprot);
COMUtils.checkRC(hr);
IRunningObjectTable rot = new RunningObjectTable(pprot.getValue());
PointerByReference ppenumMoniker = new PointerByReference();
hr = rot.EnumRunning(ppenumMoniker);
COMUtils.checkRC(hr);
IEnumMoniker iterator = new EnumMoniker(ppenumMoniker.getValue());
iterator.Reset();
PointerByReference rgelt = new PointerByReference();
ULONGByReference pceltFetched = new ULONGByReference();
hr = iterator.Next(new ULONG(1), rgelt, pceltFetched);
while (WinNT.S_OK.equals(hr) && pceltFetched.getValue().intValue() > 0) {
Moniker moniker = new Moniker(rgelt.getValue());
PointerByReference ppbc = new PointerByReference();
Ole32.INSTANCE.CreateBindCtx(new DWORD(), ppbc);
String name = moniker.GetDisplayName(ppbc.getValue(), moniker.getPointer());
PointerByReference ppunkObject = new PointerByReference();
hr = rot.GetObject(moniker.getPointer(), ppunkObject);
COMUtils.checkRC(hr);
IUnknown unk = new Unknown(ppunkObject.getValue());
PointerByReference ppvObject = new PointerByReference();
hr = unk.QueryInterface(new REFIID(IUnknown.IID_IUNKNOWN), ppvObject);
assertEquals(0, hr.intValue());
assertNotNull(ppvObject.getValue());
moniker.Release();
hr = iterator.Next(new ULONG(1), rgelt, pceltFetched);
}
}
use of com.sun.jna.platform.win32.WinDef.DWORD in project jna by java-native-access.
the class RunningObjectTable_Test method GetRunningObjectTable.
@Test
public void GetRunningObjectTable() {
PointerByReference pprot = new PointerByReference();
HRESULT hr = Ole32.INSTANCE.GetRunningObjectTable(new DWORD(0), pprot);
COMUtils.checkRC(hr);
assertNotNull(pprot.getValue());
}
use of com.sun.jna.platform.win32.WinDef.DWORD in project jna by java-native-access.
the class Advapi32Util method registryGetIntValue.
/**
* Get a registry DWORD value.
*
* @param root
* Root key.
* @param key
* Registry key path.
* @param value
* Name of the value to retrieve.
* @return Integer value.
*/
public static int registryGetIntValue(HKEY root, String key, String value) {
HKEYByReference phkKey = new HKEYByReference();
int rc = Advapi32.INSTANCE.RegOpenKeyEx(root, key, 0, WinNT.KEY_READ, phkKey);
if (rc != W32Errors.ERROR_SUCCESS) {
throw new Win32Exception(rc);
}
try {
return registryGetIntValue(phkKey.getValue(), value);
} finally {
rc = Advapi32.INSTANCE.RegCloseKey(phkKey.getValue());
if (rc != W32Errors.ERROR_SUCCESS) {
throw new Win32Exception(rc);
}
}
}
Aggregations