Version 5.3.2

This commit is contained in:
ufrisk
2023-02-18 19:32:44 +01:00
parent a1a517924c
commit 842f73c8df
3 changed files with 13 additions and 22 deletions
+1
View File
@@ -34,6 +34,7 @@ public class VmmExample {
long[] physmem_prefetch = {0x1000, 0x10000, 0x20000};
vmm.memPrefetchPages(physmem_prefetch);
byte[] physmem_read = vmm.memRead(0x1000, 0x100);
byte[] physmem_read_withflags = vmm.memRead(0x1000, 0x100, IVmm.FLAG_NOCACHE | IVmm.FLAG_ZEROPAD_ON_FAIL);
//vmm.memWrite(0x400, physmem_read);
// physical memory scatter efficient read/write
+8 -18
View File
@@ -237,9 +237,7 @@ public class VmmImpl implements IVmm
public void prepareWrite(long va, byte[] data) {
if(this.hS == null) { throw new VmmException(); }
Pointer pb = new Memory(data.length);
pb.write(0, data, 0, data.length);
boolean f = VmmNative.INSTANCE.VMMDLL_Scatter_PrepareWrite(pb, va, pb, data.length);
boolean f = VmmNative.INSTANCE.VMMDLL_Scatter_PrepareWrite(hS, va, data, data.length);
if(!f) { throw new VmmException(); }
}
@@ -258,13 +256,10 @@ public class VmmImpl implements IVmm
public byte[] read(long va, int size) {
if(this.hS == null) { throw new VmmException(); }
IntByReference pcbRead = new IntByReference();
Pointer pb = new Memory(size);
boolean f = VmmNative.INSTANCE.VMMDLL_Scatter_Read(hS, va, size, pb, pcbRead);
byte[] pbResult = new byte[size];
boolean f = VmmNative.INSTANCE.VMMDLL_Scatter_Read(hS, va, size, pbResult, pcbRead);
if(!f) { throw new VmmException(); }
size = Math.min(size, pcbRead.getValue());
byte[] result = new byte[size];
pb.read(0, result, 0, size);
return result;
return pbResult;
}
public void close() {
@@ -295,20 +290,15 @@ public class VmmImpl implements IVmm
public byte[] _memRead(int pid, long va, int size, int flags)
{
IntByReference pcbRead = new IntByReference();
Pointer pb = new Memory(size);
boolean f = VmmNative.INSTANCE.VMMDLL_MemReadEx(hVMM, pid, va, pb, size, pcbRead, flags);
byte[] pbResult = new byte[size];
boolean f = VmmNative.INSTANCE.VMMDLL_MemReadEx(hVMM, pid, va, pbResult, size, pcbRead, flags);
if(!f) { throw new VmmException(); }
size = Math.min(size, pcbRead.getValue());
byte[] result = new byte[size];
pb.read(0, result, 0, size);
return result;
return pbResult;
}
public void _memWrite(int pid, long va, byte[] data)
{
Pointer pb = new Memory(data.length);
pb.write(0, data, 0, data.length);
boolean f = VmmNative.INSTANCE.VMMDLL_MemWrite(hVMM, pid, va, pb, data.length);
boolean f = VmmNative.INSTANCE.VMMDLL_MemWrite(hVMM, pid, va, data, data.length);
if(!f) { throw new VmmException(); }
}
+4 -4
View File
@@ -82,18 +82,18 @@ interface VmmNative extends Library {
boolean VMMDLL_MemReadEx(Pointer hVMM, int dwPID, long qwA, Pointer pb, int cb, IntByReference pcbReadOpt, int flags);
boolean VMMDLL_MemReadEx(Pointer hVMM, int dwPID, long qwA, byte[] pb, int cb, IntByReference pcbReadOpt, int flags);
boolean VMMDLL_MemPrefetchPages(Pointer hVMM, int dwPID, long[] pPrefetchAddresses, int cPrefetchAddresses);
boolean VMMDLL_MemWrite(Pointer hVMM, int dwPID, long qwA, Pointer pb, int cb);
boolean VMMDLL_MemWrite(Pointer hVMM, int dwPID, long qwA, byte[] pb, int cb);
boolean VMMDLL_MemVirt2Phys(Pointer hVMM, int dwPID, long qwVA, LongByReference pqwPA);
Pointer VMMDLL_Scatter_Initialize(Pointer hVMM, int dwPID, int flags);
boolean VMMDLL_Scatter_Prepare(Pointer hS, long va, int cb);
boolean VMMDLL_Scatter_PrepareWrite(Pointer hS, long va, Pointer pb, int cb);
boolean VMMDLL_Scatter_PrepareWrite(Pointer hS, long va, byte[] pb, int cb);
boolean VMMDLL_Scatter_Execute(Pointer hS);
boolean VMMDLL_Scatter_Read(Pointer hS, long va, int cb, Pointer pb, IntByReference pcbRead);
boolean VMMDLL_Scatter_Read(Pointer hS, long va, int cb, byte[] pb, IntByReference pcbRead);
boolean VMMDLL_Scatter_Clear(Pointer hS, int pid, int flags);
void VMMDLL_Scatter_CloseHandle(Pointer hS);