GP-3207: Fix JNA/COM interface priority (dbgeng/model)

This commit is contained in:
Dan 2023-03-16 15:07:43 -04:00
parent 628642461c
commit 70e0170e03
69 changed files with 589 additions and 762 deletions

View File

@ -16,10 +16,12 @@
package agent.dbgeng.impl.dbgeng;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.IID;
import com.sun.jna.platform.win32.Guid.REFIID;
import com.sun.jna.platform.win32.WinDef.ULONG;
import com.sun.jna.platform.win32.WinNT.HRESULT;
@ -35,28 +37,33 @@ public abstract class DbgEngUtil {
private DbgEngUtil() {
}
public record Preferred<T> (REFIID refiid, Class<? extends T> cls) {
public Preferred(IID iid, Class<? extends T> cls) {
this(new REFIID(iid), cls);
}
}
public static interface InterfaceSupplier {
HRESULT get(REFIID refiid, PointerByReference pClient);
}
@SuppressWarnings("unchecked")
public static <I> I tryPreferredInterfaces(Class<I> cls,
Map<REFIID, ? extends Class<?>> preferred, InterfaceSupplier supplier) {
public static <I, T> I tryPreferredInterfaces(Class<I> cls, List<Preferred<T>> preferred,
InterfaceSupplier supplier) {
PointerByReference ppClient = new PointerByReference();
for (Map.Entry<REFIID, ? extends Class<?>> ent : preferred.entrySet()) {
for (Preferred<T> pref : preferred) {
try {
COMUtils.checkRC(supplier.get(ent.getKey(), ppClient));
COMUtils.checkRC(supplier.get(pref.refiid, ppClient));
if (ppClient.getValue() == null) {
continue;
}
Object impl =
ent.getValue().getConstructor(Pointer.class).newInstance(ppClient.getValue());
Method instanceFor = cls.getMethod("instanceFor", ent.getValue());
T impl = pref.cls.getConstructor(Pointer.class).newInstance(ppClient.getValue());
Method instanceFor = cls.getMethod("instanceFor", pref.cls);
Object instance = instanceFor.invoke(null, impl);
return (I) instance;
}
catch (COMException e) {
Msg.debug(DbgEngUtil.class, e + " (" + ent.getValue() + ")");
Msg.debug(DbgEngUtil.class, e + " (" + pref.cls + ")");
// TODO: Only try next on E_NOINTERFACE?
// Try next
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgeng.impl.dbgeng.advanced;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugAdvanced;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.advanced.*;
import ghidra.comm.util.BitmaskUniverse;
import ghidra.util.datastruct.WeakValueHashMap;
@ -42,11 +43,10 @@ public interface DebugAdvancedInternal extends DebugAdvanced {
return DbgEngUtil.lazyWeakCache(CACHE, advanced, DebugAdvancedImpl3::new);
}
Map<REFIID, Class<? extends WrapIDebugAdvanced>> PREFERRED_ADVANCED_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugAdvanced3.IID_IDEBUG_ADVANCED3), WrapIDebugAdvanced3.class),
Map.entry(new REFIID(IDebugAdvanced2.IID_IDEBUG_ADVANCED2), WrapIDebugAdvanced2.class),
Map.entry(new REFIID(IDebugAdvanced.IID_IDEBUG_ADVANCED), WrapIDebugAdvanced.class));
List<Preferred<WrapIDebugAdvanced>> PREFERRED_ADVANCED_IIDS = List.of(
new Preferred<>(IDebugAdvanced3.IID_IDEBUG_ADVANCED3, WrapIDebugAdvanced3.class),
new Preferred<>(IDebugAdvanced2.IID_IDEBUG_ADVANCED2, WrapIDebugAdvanced2.class),
new Preferred<>(IDebugAdvanced.IID_IDEBUG_ADVANCED, WrapIDebugAdvanced.class));
static DebugAdvancedInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugAdvancedInternal.class,

View File

@ -15,14 +15,15 @@
*/
package agent.dbgeng.impl.dbgeng.breakpoint;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugBreakpoint;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.impl.dbgeng.control.DebugControlInternal;
import agent.dbgeng.jna.dbgeng.breakpoint.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -42,14 +43,10 @@ public interface DebugBreakpointInternal extends DebugBreakpoint {
return DbgEngUtil.lazyWeakCache(CACHE, bp, DebugBreakpointImpl3::new);
}
Map<REFIID, Class<? extends WrapIDebugBreakpoint>> PREFERRED_BREAKPOINT_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugBreakpoint3.IID_IDEBUG_BREAKPOINT3),
WrapIDebugBreakpoint3.class),
Map.entry(new REFIID(IDebugBreakpoint2.IID_IDEBUG_BREAKPOINT2),
WrapIDebugBreakpoint2.class),
Map.entry(new REFIID(IDebugBreakpoint.IID_IDEBUG_BREAKPOINT),
WrapIDebugBreakpoint.class));
List<Preferred<WrapIDebugBreakpoint>> PREFERRED_BREAKPOINT_IIDS = List.of(
new Preferred<>(IDebugBreakpoint3.IID_IDEBUG_BREAKPOINT3, WrapIDebugBreakpoint3.class),
new Preferred<>(IDebugBreakpoint2.IID_IDEBUG_BREAKPOINT2, WrapIDebugBreakpoint2.class),
new Preferred<>(IDebugBreakpoint.IID_IDEBUG_BREAKPOINT, WrapIDebugBreakpoint.class));
static DebugBreakpointInternal tryPreferredInterfaces(DebugControlInternal control,
InterfaceSupplier supplier) {

View File

@ -15,14 +15,15 @@
*/
package agent.dbgeng.impl.dbgeng.client;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugClient;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.impl.dbgeng.control.DebugControlInternal;
import agent.dbgeng.jna.dbgeng.client.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -66,15 +67,14 @@ public interface DebugClientInternal extends DebugClient {
return DbgEngUtil.lazyWeakCache(CACHE, client, DebugClientImpl7::new);
}
Map<REFIID, Class<? extends WrapIDebugClient>> PREFERRED_CLIENT_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugClient7.IID_IDEBUG_CLIENT7), WrapIDebugClient7.class),
Map.entry(new REFIID(IDebugClient6.IID_IDEBUG_CLIENT6), WrapIDebugClient6.class),
Map.entry(new REFIID(IDebugClient5.IID_IDEBUG_CLIENT5), WrapIDebugClient5.class),
Map.entry(new REFIID(IDebugClient4.IID_IDEBUG_CLIENT4), WrapIDebugClient4.class),
Map.entry(new REFIID(IDebugClient3.IID_IDEBUG_CLIENT3), WrapIDebugClient3.class),
Map.entry(new REFIID(IDebugClient2.IID_IDEBUG_CLIENT2), WrapIDebugClient2.class),
Map.entry(new REFIID(IDebugClient.IID_IDEBUG_CLIENT), WrapIDebugClient.class));
List<Preferred<WrapIDebugClient>> PREFERRED_CLIENT_IIDS = List.of(
new Preferred<>(IDebugClient7.IID_IDEBUG_CLIENT7, WrapIDebugClient7.class),
new Preferred<>(IDebugClient6.IID_IDEBUG_CLIENT6, WrapIDebugClient6.class),
new Preferred<>(IDebugClient5.IID_IDEBUG_CLIENT5, WrapIDebugClient5.class),
new Preferred<>(IDebugClient4.IID_IDEBUG_CLIENT4, WrapIDebugClient4.class),
new Preferred<>(IDebugClient3.IID_IDEBUG_CLIENT3, WrapIDebugClient3.class),
new Preferred<>(IDebugClient2.IID_IDEBUG_CLIENT2, WrapIDebugClient2.class),
new Preferred<>(IDebugClient.IID_IDEBUG_CLIENT, WrapIDebugClient.class));
static DebugClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugClientInternal.class, PREFERRED_CLIENT_IIDS,

View File

@ -15,14 +15,15 @@
*/
package agent.dbgeng.impl.dbgeng.control;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugControl;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.breakpoint.IDebugBreakpoint;
import agent.dbgeng.jna.dbgeng.control.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -58,15 +59,14 @@ public interface DebugControlInternal extends DebugControl {
return DbgEngUtil.lazyWeakCache(CACHE, control, DebugControlImpl7::new);
}
Map<REFIID, Class<? extends WrapIDebugControl>> PREFERRED_CONTROL_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugControl7.IID_IDEBUG_CONTROL7), WrapIDebugControl7.class),
Map.entry(new REFIID(IDebugControl6.IID_IDEBUG_CONTROL6), WrapIDebugControl6.class),
Map.entry(new REFIID(IDebugControl5.IID_IDEBUG_CONTROL5), WrapIDebugControl5.class),
Map.entry(new REFIID(IDebugControl4.IID_IDEBUG_CONTROL4), WrapIDebugControl4.class),
Map.entry(new REFIID(IDebugControl3.IID_IDEBUG_CONTROL3), WrapIDebugControl3.class),
Map.entry(new REFIID(IDebugControl2.IID_IDEBUG_CONTROL2), WrapIDebugControl2.class),
Map.entry(new REFIID(IDebugControl.IID_IDEBUG_CONTROL), WrapIDebugControl.class));
List<Preferred<WrapIDebugControl>> PREFERRED_CONTROL_IIDS = List.of(
new Preferred<>(IDebugControl7.IID_IDEBUG_CONTROL7, WrapIDebugControl7.class),
new Preferred<>(IDebugControl6.IID_IDEBUG_CONTROL6, WrapIDebugControl6.class),
new Preferred<>(IDebugControl5.IID_IDEBUG_CONTROL5, WrapIDebugControl5.class),
new Preferred<>(IDebugControl4.IID_IDEBUG_CONTROL4, WrapIDebugControl4.class),
new Preferred<>(IDebugControl3.IID_IDEBUG_CONTROL3, WrapIDebugControl3.class),
new Preferred<>(IDebugControl2.IID_IDEBUG_CONTROL2, WrapIDebugControl2.class),
new Preferred<>(IDebugControl.IID_IDEBUG_CONTROL, WrapIDebugControl.class));
static DebugControlInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugControlInternal.class, PREFERRED_CONTROL_IIDS,

View File

@ -15,14 +15,15 @@
*/
package agent.dbgeng.impl.dbgeng.dataspaces;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugDataSpaces;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.dataspaces.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -45,16 +46,11 @@ public interface DebugDataSpacesInternal extends DebugDataSpaces {
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugDataSpacesImpl4::new);
}
Map<REFIID, Class<? extends WrapIDebugDataSpaces>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugDataSpaces4.IID_IDEBUG_DATA_SPACES4),
WrapIDebugDataSpaces4.class),
Map.entry(new REFIID(IDebugDataSpaces3.IID_IDEBUG_DATA_SPACES3),
WrapIDebugDataSpaces3.class),
Map.entry(new REFIID(IDebugDataSpaces2.IID_IDEBUG_DATA_SPACES2),
WrapIDebugDataSpaces2.class),
Map.entry(new REFIID(IDebugDataSpaces.IID_IDEBUG_DATA_SPACES),
WrapIDebugDataSpaces.class));
List<Preferred<WrapIDebugDataSpaces>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugDataSpaces4.IID_IDEBUG_DATA_SPACES4, WrapIDebugDataSpaces4.class),
new Preferred<>(IDebugDataSpaces3.IID_IDEBUG_DATA_SPACES3, WrapIDebugDataSpaces3.class),
new Preferred<>(IDebugDataSpaces2.IID_IDEBUG_DATA_SPACES2, WrapIDebugDataSpaces2.class),
new Preferred<>(IDebugDataSpaces.IID_IDEBUG_DATA_SPACES, WrapIDebugDataSpaces.class));
static DebugDataSpacesInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugDataSpacesInternal.class,

View File

@ -15,14 +15,15 @@
*/
package agent.dbgeng.impl.dbgeng.registers;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugRegisters;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.registers.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -37,12 +38,9 @@ public interface DebugRegistersInternal extends DebugRegisters {
return DbgEngUtil.lazyWeakCache(CACHE, registers, DebugRegistersImpl2::new);
}
Map<REFIID, Class<? extends WrapIDebugRegisters>> PREFERRED_REGISTERS_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugRegisters2.IID_IDEBUG_REGISTERS2),
WrapIDebugRegisters2.class),
Map.entry(new REFIID(IDebugRegisters.IID_IDEBUG_REGISTERS),
WrapIDebugRegisters.class));
List<Preferred<WrapIDebugRegisters>> PREFERRED_REGISTERS_IIDS = List.of(
new Preferred<>(IDebugRegisters2.IID_IDEBUG_REGISTERS2, WrapIDebugRegisters2.class),
new Preferred<>(IDebugRegisters.IID_IDEBUG_REGISTERS, WrapIDebugRegisters.class));
static DebugRegistersInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugRegistersInternal.class,

View File

@ -15,15 +15,16 @@
*/
package agent.dbgeng.impl.dbgeng.symbols;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.*;
import agent.dbgeng.dbgeng.DebugModule.DebugModuleName;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.symbols.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -50,13 +51,12 @@ public interface DebugSymbolsInternal extends DebugSymbols {
return DbgEngUtil.lazyWeakCache(CACHE, symbols, DebugSymbolsImpl5::new);
}
Map<REFIID, Class<? extends WrapIDebugSymbols>> PREFFERED_SYMBOLS_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugSymbols5.IID_IDEBUG_SYMBOLS5), WrapIDebugSymbols5.class),
Map.entry(new REFIID(IDebugSymbols4.IID_IDEBUG_SYMBOLS4), WrapIDebugSymbols4.class),
Map.entry(new REFIID(IDebugSymbols3.IID_IDEBUG_SYMBOLS3), WrapIDebugSymbols3.class),
Map.entry(new REFIID(IDebugSymbols2.IID_IDEBUG_SYMBOLS2), WrapIDebugSymbols2.class),
Map.entry(new REFIID(IDebugSymbols.IID_IDEBUG_SYMBOLS), WrapIDebugSymbols.class));
List<Preferred<WrapIDebugSymbols>> PREFFERED_SYMBOLS_IIDS = List.of(
new Preferred<>(IDebugSymbols5.IID_IDEBUG_SYMBOLS5, WrapIDebugSymbols5.class),
new Preferred<>(IDebugSymbols4.IID_IDEBUG_SYMBOLS4, WrapIDebugSymbols4.class),
new Preferred<>(IDebugSymbols3.IID_IDEBUG_SYMBOLS3, WrapIDebugSymbols3.class),
new Preferred<>(IDebugSymbols2.IID_IDEBUG_SYMBOLS2, WrapIDebugSymbols2.class),
new Preferred<>(IDebugSymbols.IID_IDEBUG_SYMBOLS, WrapIDebugSymbols.class));
static DebugSymbolsInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugSymbolsInternal.class, PREFFERED_SYMBOLS_IIDS,

View File

@ -15,14 +15,15 @@
*/
package agent.dbgeng.impl.dbgeng.sysobj;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugSystemObjects;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.sysobj.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -45,16 +46,15 @@ public interface DebugSystemObjectsInternal extends DebugSystemObjects {
return DbgEngUtil.lazyWeakCache(CACHE, sysobj, DebugSystemObjectsImpl4::new);
}
Map<REFIID, Class<? extends WrapIDebugSystemObjects>> PREFERRED_SYSTEM_OBJECTS_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugSystemObjects4.IID_IDEBUG_SYSTEM_OBJECTS4),
WrapIDebugSystemObjects4.class),
Map.entry(new REFIID(IDebugSystemObjects3.IID_IDEBUG_SYSTEM_OBJECTS3),
WrapIDebugSystemObjects3.class),
Map.entry(new REFIID(IDebugSystemObjects2.IID_IDEBUG_SYSTEM_OBJECTS2),
WrapIDebugSystemObjects2.class),
Map.entry(new REFIID(IDebugSystemObjects.IID_IDEBUG_SYSTEM_OBJECTS),
WrapIDebugSystemObjects.class));
List<Preferred<WrapIDebugSystemObjects>> PREFERRED_SYSTEM_OBJECTS_IIDS = List.of(
new Preferred<>(IDebugSystemObjects4.IID_IDEBUG_SYSTEM_OBJECTS4,
WrapIDebugSystemObjects4.class),
new Preferred<>(IDebugSystemObjects3.IID_IDEBUG_SYSTEM_OBJECTS3,
WrapIDebugSystemObjects3.class),
new Preferred<>(IDebugSystemObjects2.IID_IDEBUG_SYSTEM_OBJECTS2,
WrapIDebugSystemObjects2.class),
new Preferred<>(IDebugSystemObjects.IID_IDEBUG_SYSTEM_OBJECTS,
WrapIDebugSystemObjects.class));
static DebugSystemObjectsInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugSystemObjectsInternal.class,

View File

@ -1,29 +0,0 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package agent.dbgmodel.dbgmodel.err;
/**
* The base exception for checked {@code dbgmodel.dll} wrapper-related errors.
*/
public class DbgModelException extends Exception {
public DbgModelException() {
super();
}
public DbgModelException(String message) {
super(message);
}
}

View File

@ -1,29 +0,0 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package agent.dbgmodel.dbgmodel.err;
/**
* The base exception for unchecked {@code dbgmodel.dll} wrapper-related errors.
*/
public class DbgModelRuntimeException extends RuntimeException {
public DbgModelRuntimeException() {
super();
}
public DbgModelRuntimeException(String message) {
super(message);
}
}

View File

@ -1,88 +0,0 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package agent.dbgmodel.impl.dbgmodel;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.function.Function;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import com.sun.jna.platform.win32.WinDef.ULONG;
import com.sun.jna.platform.win32.WinNT.HRESULT;
import com.sun.jna.platform.win32.COM.*;
import com.sun.jna.ptr.PointerByReference;
import agent.dbgmodel.dbgmodel.err.DbgModelRuntimeException;
import ghidra.util.Msg;
public abstract class DbgModelUtil {
public static final ULONG DEBUG_ANY_ID = new ULONG(-1);
private DbgModelUtil() {
}
public static interface InterfaceSupplier {
HRESULT get(REFIID refiid, PointerByReference pClient);
}
@SuppressWarnings("unchecked")
public static <I> I tryPreferredInterfaces(Class<I> cls,
Map<REFIID, ? extends Class<?>> preferred, InterfaceSupplier supplier) {
PointerByReference ppClient = new PointerByReference();
for (Map.Entry<REFIID, ? extends Class<?>> ent : preferred.entrySet()) {
try {
COMUtils.checkRC(supplier.get(ent.getKey(), ppClient));
if (ppClient.getValue() == null) {
continue;
}
Object impl =
ent.getValue().getConstructor(Pointer.class).newInstance(ppClient.getValue());
Method instanceFor = cls.getMethod("instanceFor", ent.getValue());
Object instance = instanceFor.invoke(null, impl);
return (I) instance;
}
catch (COMException e) {
Msg.debug(DbgModelUtil.class, e + " (" + ent.getValue() + ")");
// TODO: Only try next on E_NOINTERFACE?
// Try next
}
catch (Exception e) {
throw new AssertionError("INTERNAL: Unexpected exception", e);
}
}
throw new DbgModelRuntimeException("None of the preferred interfaces are supported");
}
public static <T extends Unknown, U> U lazyWeakCache(Map<Pointer, U> cache, T unk,
Function<T, U> forNew) {
synchronized (cache) {
U present = cache.get(unk.getPointer());
if (present != null) {
unk.Release();
return present;
}
U absent = forNew.apply(unk);
cache.put(unk.getPointer(), absent);
return absent;
}
}
public static void dbgline() {
System.out.println(new Exception().getStackTrace()[1]);
System.out.flush();
}
}

View File

@ -15,14 +15,16 @@
*/
package agent.dbgmodel.impl.dbgmodel;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import com.sun.jna.platform.win32.COM.IUnknown;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.UnknownEx;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.WrapIUnknownEx;
import ghidra.util.datastruct.WeakValueHashMap;
@ -30,15 +32,14 @@ public interface UnknownExInternal extends UnknownEx {
Map<Pointer, UnknownExInternal> CACHE = new WeakValueHashMap<>();
static UnknownExInternal instanceFor(WrapIUnknownEx data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, UnknownExImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, UnknownExImpl::new);
}
Map<REFIID, Class<? extends WrapIUnknownEx>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IUnknown.IID_IUNKNOWN), WrapIUnknownEx.class));
List<Preferred<WrapIUnknownEx>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IUnknown.IID_IUNKNOWN, WrapIUnknownEx.class));
static UnknownExInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(UnknownExInternal.class,
return DbgEngUtil.tryPreferredInterfaces(UnknownExInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.bridge;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.bridge.HostDataModelAccess;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.bridge.IHostDataModelAccess;
import agent.dbgmodel.jna.dbgmodel.bridge.WrapIHostDataModelAccess;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface HostDataModelAccessInternal extends HostDataModelAccess {
Map<Pointer, HostDataModelAccessInternal> CACHE = new WeakValueHashMap<>();
static HostDataModelAccessInternal instanceFor(WrapIHostDataModelAccess data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, HostDataModelAccessImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, HostDataModelAccessImpl::new);
}
Map<REFIID, Class<? extends WrapIHostDataModelAccess>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IHostDataModelAccess.IID_IHOST_DATA_MODEL_ACCESS),
WrapIHostDataModelAccess.class));
List<Preferred<WrapIHostDataModelAccess>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IHostDataModelAccess.IID_IHOST_DATA_MODEL_ACCESS,
WrapIHostDataModelAccess.class));
static HostDataModelAccessInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(HostDataModelAccessInternal.class,
return DbgEngUtil.tryPreferredInterfaces(HostDataModelAccessInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.concept.ComparableConcept;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.concept.IComparableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIComparableConcept;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface ComparableConceptInternal extends ComparableConcept {
Map<Pointer, ComparableConceptInternal> CACHE = new WeakValueHashMap<>();
static ComparableConceptInternal instanceFor(WrapIComparableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ComparableConceptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, ComparableConceptImpl::new);
}
Map<REFIID, Class<? extends WrapIComparableConcept>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IComparableConcept.IID_ICOMPARABLE_CONCEPT),
WrapIComparableConcept.class));
List<Preferred<WrapIComparableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IComparableConcept.IID_ICOMPARABLE_CONCEPT, WrapIComparableConcept.class));
static ComparableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ComparableConceptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(ComparableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.concept.DataModelConcept;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.concept.IDataModelConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIDataModelConcept;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DataModelConceptInternal extends DataModelConcept {
Map<Pointer, DataModelConceptInternal> CACHE = new WeakValueHashMap<>();
static DataModelConceptInternal instanceFor(WrapIDataModelConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelConceptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelConceptImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelConcept>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelConcept.IID_IDATA_MODEL_CONCEPT),
WrapIDataModelConcept.class));
List<Preferred<WrapIDataModelConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelConcept.IID_IDATA_MODEL_CONCEPT, WrapIDataModelConcept.class));
static DataModelConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelConceptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.concept.DynamicConceptProviderConcept;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.concept.IDynamicConceptProviderConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIDynamicConceptProviderConcept;
import ghidra.util.datastruct.WeakValueHashMap;
@ -32,19 +33,16 @@ public interface DynamicConceptProviderConceptInternal extends DynamicConceptPro
static DynamicConceptProviderConceptInternal instanceFor(
WrapIDynamicConceptProviderConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DynamicConceptProviderConceptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DynamicConceptProviderConceptImpl::new);
}
Map<REFIID, Class<? extends WrapIDynamicConceptProviderConcept>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(
new REFIID(
IDynamicConceptProviderConcept.IID_IDYNAMIC_CONCEPT_PROVIDER_CONCEPT),
WrapIDynamicConceptProviderConcept.class));
List<Preferred<WrapIDynamicConceptProviderConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDynamicConceptProviderConcept.IID_IDYNAMIC_CONCEPT_PROVIDER_CONCEPT,
WrapIDynamicConceptProviderConcept.class));
static DynamicConceptProviderConceptInternal tryPreferredInterfaces(
InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DynamicConceptProviderConceptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DynamicConceptProviderConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.concept.DynamicKeyProviderConcept;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.concept.IDynamicKeyProviderConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIDynamicKeyProviderConcept;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DynamicKeyProviderConceptInternal extends DynamicKeyProviderCon
Map<Pointer, DynamicKeyProviderConceptInternal> CACHE = new WeakValueHashMap<>();
static DynamicKeyProviderConceptInternal instanceFor(WrapIDynamicKeyProviderConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DynamicKeyProviderConceptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DynamicKeyProviderConceptImpl::new);
}
Map<REFIID, Class<? extends WrapIDynamicKeyProviderConcept>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDynamicKeyProviderConcept.IID_IDYNAMIC_KEY_PROVIDER_CONCEPT),
WrapIDynamicKeyProviderConcept.class));
List<Preferred<WrapIDynamicKeyProviderConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDynamicKeyProviderConcept.IID_IDYNAMIC_KEY_PROVIDER_CONCEPT,
WrapIDynamicKeyProviderConcept.class));
static DynamicKeyProviderConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DynamicKeyProviderConceptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DynamicKeyProviderConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.concept.EquatableConcept;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.concept.IEquatableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIEquatableConcept;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface EquatableConceptInternal extends EquatableConcept {
Map<Pointer, EquatableConceptInternal> CACHE = new WeakValueHashMap<>();
static EquatableConceptInternal instanceFor(WrapIEquatableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, EquatableConceptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, EquatableConceptImpl::new);
}
Map<REFIID, Class<? extends WrapIEquatableConcept>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IEquatableConcept.IID_IEQUATABLE_CONCEPT),
WrapIEquatableConcept.class));
List<Preferred<WrapIEquatableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IEquatableConcept.IID_IEQUATABLE_CONCEPT, WrapIEquatableConcept.class));
static EquatableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(EquatableConceptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(EquatableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.concept.IndexableConcept;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.concept.IIndexableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIIndexableConcept;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface IndexableConceptInternal extends IndexableConcept {
Map<Pointer, IndexableConceptInternal> CACHE = new WeakValueHashMap<>();
static IndexableConceptInternal instanceFor(WrapIIndexableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, IndexableConceptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, IndexableConceptImpl::new);
}
Map<REFIID, Class<? extends WrapIIndexableConcept>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IIndexableConcept.IID_IINDEXABLE_CONCEPT),
WrapIIndexableConcept.class));
List<Preferred<WrapIIndexableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IIndexableConcept.IID_IINDEXABLE_CONCEPT, WrapIIndexableConcept.class));
static IndexableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(IndexableConceptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(IndexableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.concept.IterableConcept;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.concept.IIterableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIIterableConcept;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface IterableConceptInternal extends IterableConcept {
Map<Pointer, IterableConceptInternal> CACHE = new WeakValueHashMap<>();
static IterableConceptInternal instanceFor(WrapIIterableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, IterableConceptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, IterableConceptImpl::new);
}
Map<REFIID, Class<? extends WrapIIterableConcept>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IIterableConcept.IID_IITERABLE_CONCEPT),
WrapIIterableConcept.class));
List<Preferred<WrapIIterableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IIterableConcept.IID_IITERABLE_CONCEPT, WrapIIterableConcept.class));
static IterableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(IterableConceptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(IterableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.concept.PreferredRuntimeTypeConcept;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.concept.IPreferredRuntimeTypeConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIPreferredRuntimeTypeConcept;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface PreferredRuntimeTypeConceptInternal extends PreferredRuntimeTyp
Map<Pointer, PreferredRuntimeTypeConceptInternal> CACHE = new WeakValueHashMap<>();
static PreferredRuntimeTypeConceptInternal instanceFor(WrapIPreferredRuntimeTypeConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, PreferredRuntimeTypeConceptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, PreferredRuntimeTypeConceptImpl::new);
}
Map<REFIID, Class<? extends WrapIPreferredRuntimeTypeConcept>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IPreferredRuntimeTypeConcept.IID_IPREFERRED_RUNTIME_TYPE_CONCEPT),
WrapIPreferredRuntimeTypeConcept.class));
List<Preferred<WrapIPreferredRuntimeTypeConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IPreferredRuntimeTypeConcept.IID_IPREFERRED_RUNTIME_TYPE_CONCEPT,
WrapIPreferredRuntimeTypeConcept.class));
static PreferredRuntimeTypeConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(PreferredRuntimeTypeConceptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(PreferredRuntimeTypeConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.concept.StringDisplayableConcept;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.concept.IStringDisplayableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIStringDisplayableConcept;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface StringDisplayableConceptInternal extends StringDisplayableConce
Map<Pointer, StringDisplayableConceptInternal> CACHE = new WeakValueHashMap<>();
static StringDisplayableConceptInternal instanceFor(WrapIStringDisplayableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, StringDisplayableConceptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, StringDisplayableConceptImpl::new);
}
Map<REFIID, Class<? extends WrapIStringDisplayableConcept>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IStringDisplayableConcept.IID_ISTRING_DISPLAYABLE_CONCEPT),
WrapIStringDisplayableConcept.class));
List<Preferred<WrapIStringDisplayableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IStringDisplayableConcept.IID_ISTRING_DISPLAYABLE_CONCEPT,
WrapIStringDisplayableConcept.class));
static StringDisplayableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(StringDisplayableConceptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(StringDisplayableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.DataModelManager1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface DataModelManagerInternal extends DataModelManager1 {
Map<Pointer, DataModelManagerInternal> CACHE = new WeakValueHashMap<>();
static DataModelManagerInternal instanceFor(WrapIDataModelManager1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl1::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl1::new);
}
static DataModelManagerInternal instanceFor(WrapIDataModelManager2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl2::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl2::new);
}
Map<REFIID, Class<? extends WrapIDataModelManager1>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelManager2.IID_IDATA_MODEL_MANAGER2),
WrapIDataModelManager2.class),
Map.entry(new REFIID(IDataModelManager1.IID_IDATA_MODEL_MANAGER),
WrapIDataModelManager1.class));
List<Preferred<WrapIDataModelManager1>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelManager2.IID_IDATA_MODEL_MANAGER2, WrapIDataModelManager2.class),
new Preferred<>(IDataModelManager1.IID_IDATA_MODEL_MANAGER, WrapIDataModelManager1.class));
static DataModelManagerInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelManagerInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelManagerInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.DataModelNameBinder;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelNameBinder;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelNameBinder;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelNameBinderInternal extends DataModelNameBinder {
Map<Pointer, DataModelNameBinderInternal> CACHE = new WeakValueHashMap<>();
static DataModelNameBinderInternal instanceFor(WrapIDataModelNameBinder data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelNameBinderImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelNameBinderImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelNameBinder>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelNameBinder.IID_IDATA_MODEL_NAME_BINDER),
WrapIDataModelNameBinder.class));
List<Preferred<WrapIDataModelNameBinder>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelNameBinder.IID_IDATA_MODEL_NAME_BINDER,
WrapIDataModelNameBinder.class));
static DataModelNameBinderInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelNameBinderInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelNameBinderInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptClient;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptClient;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptClient;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptClientInternal extends DataModelScriptClient {
Map<Pointer, DataModelScriptClientInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptClientInternal instanceFor(WrapIDataModelScriptClient data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptClientImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptClientImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptClient>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelScriptClient.IID_IDATA_MODEL_SCRIPT_CLIENT),
WrapIDataModelScriptClient.class));
List<Preferred<WrapIDataModelScriptClient>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScriptClient.IID_IDATA_MODEL_SCRIPT_CLIENT,
WrapIDataModelScriptClient.class));
static DataModelScriptClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptClientInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptClientInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptHostContext;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptHostContext;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptHostContext;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptHostContextInternal extends DataModelScriptHostC
Map<Pointer, DataModelScriptHostContextInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptHostContextInternal instanceFor(WrapIDataModelScriptHostContext data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptHostContextImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptHostContextImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptHostContext>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelScriptHostContext.IID_IDATA_MODEL_SCRIPT_HOST_CONTEXT),
WrapIDataModelScriptHostContext.class));
List<Preferred<WrapIDataModelScriptHostContext>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScriptHostContext.IID_IDATA_MODEL_SCRIPT_HOST_CONTEXT,
WrapIDataModelScriptHostContext.class));
static DataModelScriptHostContextInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptHostContextInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptHostContextInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScript;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScript;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScript;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptInternal extends DataModelScript {
Map<Pointer, DataModelScriptInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptInternal instanceFor(WrapIDataModelScript data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScript>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelScript.IID_IDATA_MODEL_SCRIPT),
WrapIDataModelScript.class));
List<Preferred<WrapIDataModelScript>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScript.IID_IDATA_MODEL_SCRIPT,
WrapIDataModelScript.class));
static DataModelScriptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptManager;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptManager;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptManager;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptManagerInternal extends DataModelScriptManager {
Map<Pointer, DataModelScriptManagerInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptManagerInternal instanceFor(WrapIDataModelScriptManager data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptManagerImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptManagerImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptManager>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelScriptManager.IID_IDATA_MODEL_SCRIPT_MANAGER),
WrapIDataModelScriptManager.class));
List<Preferred<WrapIDataModelScriptManager>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScriptManager.IID_IDATA_MODEL_SCRIPT_MANAGER,
WrapIDataModelScriptManager.class));
static DataModelScriptManagerInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptManagerInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptManagerInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptProviderEnumerator;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptProviderEnumerator;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptProviderEnumerator;
import ghidra.util.datastruct.WeakValueHashMap;
@ -33,19 +34,17 @@ public interface DataModelScriptProviderEnumeratorInternal
static DataModelScriptProviderEnumeratorInternal instanceFor(
WrapIDataModelScriptProviderEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderEnumeratorImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderEnumeratorImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptProviderEnumerator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(
new REFIID(
IDataModelScriptProviderEnumerator.IID_IDATA_MODEL_SCRIPT_PROVIDER_ENUMERATOR),
WrapIDataModelScriptProviderEnumerator.class));
List<Preferred<WrapIDataModelScriptProviderEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(
IDataModelScriptProviderEnumerator.IID_IDATA_MODEL_SCRIPT_PROVIDER_ENUMERATOR,
WrapIDataModelScriptProviderEnumerator.class));
static DataModelScriptProviderEnumeratorInternal tryPreferredInterfaces(
InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptProviderEnumeratorInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptProviderEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptProvider;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptProvider;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptProvider;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptProviderInternal extends DataModelScriptProvider
Map<Pointer, DataModelScriptProviderInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptProviderInternal instanceFor(WrapIDataModelScriptProvider data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptProvider>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelScriptProvider.IID_IDATA_MODEL_SCRIPT_PROVIDER),
WrapIDataModelScriptProvider.class));
List<Preferred<WrapIDataModelScriptProvider>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScriptProvider.IID_IDATA_MODEL_SCRIPT_PROVIDER,
WrapIDataModelScriptProvider.class));
static DataModelScriptProviderInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptProviderInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptProviderInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptTemplateEnumerator;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptTemplateEnumerator;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptTemplateEnumerator;
import ghidra.util.datastruct.WeakValueHashMap;
@ -33,18 +34,17 @@ public interface DataModelScriptTemplateEnumeratorInternal
static DataModelScriptTemplateEnumeratorInternal instanceFor(
WrapIDataModelScriptTemplateEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateEnumeratorImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateEnumeratorImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptTemplateEnumerator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(
IDataModelScriptTemplateEnumerator.IID_IDATA_MODEL_SCRIPT_TEMPLATE_ENUMERATOR),
WrapIDataModelScriptTemplateEnumerator.class));
List<Preferred<WrapIDataModelScriptTemplateEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(
IDataModelScriptTemplateEnumerator.IID_IDATA_MODEL_SCRIPT_TEMPLATE_ENUMERATOR,
WrapIDataModelScriptTemplateEnumerator.class));
static DataModelScriptTemplateEnumeratorInternal tryPreferredInterfaces(
InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptTemplateEnumeratorInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptTemplateEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptTemplate;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptTemplate;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptTemplate;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptTemplateInternal extends DataModelScriptTemplate
Map<Pointer, DataModelScriptTemplateInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptTemplateInternal instanceFor(WrapIDataModelScriptTemplate data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptTemplate>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelScriptTemplate.IID_IDATA_MODEL_SCRIPT_TEMPLATE),
WrapIDataModelScriptTemplate.class));
List<Preferred<WrapIDataModelScriptTemplate>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScriptTemplate.IID_IDATA_MODEL_SCRIPT_TEMPLATE,
WrapIDataModelScriptTemplate.class));
static DataModelScriptTemplateInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptTemplateInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptTemplateInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugBreakpointEnumerator;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugBreakpointEnumerator;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugBreakpointEnumerator;
import ghidra.util.datastruct.WeakValueHashMap;
@ -33,20 +34,19 @@ public interface DataModelScriptDebugBreakpointEnumeratorInternal
static DataModelScriptDebugBreakpointEnumeratorInternal instanceFor(
WrapIDataModelScriptDebugBreakpointEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data,
return DbgEngUtil.lazyWeakCache(CACHE, data,
DataModelScriptDebugBreakpointEnumeratorImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptDebugBreakpointEnumerator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(
new REFIID(
IDataModelScriptDebugBreakpointEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT_ENUMERATOR),
List<Preferred<WrapIDataModelScriptDebugBreakpointEnumerator>> PREFERRED_DATA_SPACES_IIDS =
List.of(
new Preferred<>(
IDataModelScriptDebugBreakpointEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT_ENUMERATOR,
WrapIDataModelScriptDebugBreakpointEnumerator.class));
static DataModelScriptDebugBreakpointEnumeratorInternal tryPreferredInterfaces(
InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(
return DbgEngUtil.tryPreferredInterfaces(
DataModelScriptDebugBreakpointEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugBreakpoint;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugBreakpoint;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugBreakpoint;
import ghidra.util.datastruct.WeakValueHashMap;
@ -32,19 +33,18 @@ public interface DataModelScriptDebugBreakpointInternal extends DataModelScriptD
static DataModelScriptDebugBreakpointInternal instanceFor(
WrapIDataModelScriptDebugBreakpoint data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugBreakpointImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugBreakpointImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptDebugBreakpoint>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(
new REFIID(
IDataModelScriptDebugBreakpoint.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT),
List<Preferred<WrapIDataModelScriptDebugBreakpoint>> PREFERRED_DATA_SPACES_IIDS =
List.of(
new Preferred<>(
IDataModelScriptDebugBreakpoint.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT,
WrapIDataModelScriptDebugBreakpoint.class));
static DataModelScriptDebugBreakpointInternal tryPreferredInterfaces(
InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugBreakpointInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugBreakpointInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugClient;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugClient;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugClient;
import ghidra.util.datastruct.WeakValueHashMap;
@ -32,17 +33,15 @@ public interface DataModelScriptDebugClientInternal extends DataModelScriptDebug
static DataModelScriptDebugClientInternal instanceFor(
WrapIDataModelScriptDebugClient data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugClientImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugClientImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptDebugClient>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(
new REFIID(IDataModelScriptDebugClient.IID_IDATA_MODEL_SCRIPT_DEBUG_CLIENT),
WrapIDataModelScriptDebugClient.class));
List<Preferred<WrapIDataModelScriptDebugClient>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScriptDebugClient.IID_IDATA_MODEL_SCRIPT_DEBUG_CLIENT,
WrapIDataModelScriptDebugClient.class));
static DataModelScriptDebugClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugClientInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugClientInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebug1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -30,18 +31,17 @@ public interface DataModelScriptDebugInternal extends DataModelScriptDebug1 {
Map<Pointer, DataModelScriptDebugInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptDebugInternal instanceFor(WrapIDataModelScriptDebug data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptDebug>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDataModelScriptDebug2.IID_IDATA_MODEL_SCRIPT_DEBUG2),
WrapIDataModelScriptDebug.class),
Map.entry(new REFIID(IDataModelScriptDebug.IID_IDATA_MODEL_SCRIPT_DEBUG),
WrapIDataModelScriptDebug.class));
List<Preferred<WrapIDataModelScriptDebug>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScriptDebug2.IID_IDATA_MODEL_SCRIPT_DEBUG2,
WrapIDataModelScriptDebug.class),
new Preferred<>(IDataModelScriptDebug.IID_IDATA_MODEL_SCRIPT_DEBUG,
WrapIDataModelScriptDebug.class));
static DataModelScriptDebugInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugStackFrame;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugStackFrame;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugStackFrame;
import ghidra.util.datastruct.WeakValueHashMap;
@ -32,19 +33,16 @@ public interface DataModelScriptDebugStackFrameInternal extends DataModelScriptD
static DataModelScriptDebugStackFrameInternal instanceFor(
WrapIDataModelScriptDebugStackFrame data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackFrameImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackFrameImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptDebugStackFrame>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(
new REFIID(
IDataModelScriptDebugStackFrame.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK_FRAME),
WrapIDataModelScriptDebugStackFrame.class));
List<Preferred<WrapIDataModelScriptDebugStackFrame>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScriptDebugStackFrame.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK_FRAME,
WrapIDataModelScriptDebugStackFrame.class));
static DataModelScriptDebugStackFrameInternal tryPreferredInterfaces(
InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugStackFrameInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugStackFrameInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugStack;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugStack;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugStack;
import ghidra.util.datastruct.WeakValueHashMap;
@ -32,17 +33,15 @@ public interface DataModelScriptDebugStackInternal extends DataModelScriptDebugS
static DataModelScriptDebugStackInternal instanceFor(
WrapIDataModelScriptDebugStack data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptDebugStack>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(
new REFIID(IDataModelScriptDebugStack.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK),
WrapIDataModelScriptDebugStack.class));
List<Preferred<WrapIDataModelScriptDebugStack>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDataModelScriptDebugStack.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK,
WrapIDataModelScriptDebugStack.class));
static DataModelScriptDebugStackInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugStackInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugStackInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugVariableSetEnumerator;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugVariableSetEnumerator;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugVariableSetEnumerator;
import ghidra.util.datastruct.WeakValueHashMap;
@ -34,20 +35,19 @@ public interface DataModelScriptDebugVariableSetEnumeratorInternal
static DataModelScriptDebugVariableSetEnumeratorInternal instanceFor(
WrapIDataModelScriptDebugVariableSetEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data,
return DbgEngUtil.lazyWeakCache(CACHE, data,
DataModelScriptDebugVariableSetEnumeratorImpl::new);
}
Map<REFIID, Class<? extends WrapIDataModelScriptDebugVariableSetEnumerator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(
new REFIID(
IDataModelScriptDebugVariableSetEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_VARIABLE_SET_ENUMERATOR),
List<Preferred<WrapIDataModelScriptDebugVariableSetEnumerator>> PREFERRED_DATA_SPACES_IIDS =
List.of(
new Preferred<>(
IDataModelScriptDebugVariableSetEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_VARIABLE_SET_ENUMERATOR,
WrapIDataModelScriptDebugVariableSetEnumerator.class));
static DataModelScriptDebugVariableSetEnumeratorInternal tryPreferredInterfaces(
InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(
return DbgEngUtil.tryPreferredInterfaces(
DataModelScriptDebugVariableSetEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostBase;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.X_IDebugHostBaseClass;
import agent.dbgmodel.jna.dbgmodel.debughost.X_WrapIDebugHostBaseClass;
import ghidra.util.datastruct.WeakValueHashMap;
@ -32,16 +33,15 @@ public interface DebugHostBaseClassInternal extends DebugHostBase {
Map<Pointer, X_DebugHostBaseClassInternal> CACHE = new WeakValueHashMap<>();
static X_DebugHostBaseClassInternal instanceFor(X_WrapIDebugHostBaseClass data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new);
}
Map<REFIID, Class<? extends X_WrapIDebugHostBaseClass>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS),
X_WrapIDebugHostBaseClass.class));
List<Preferred<X_WrapIDebugHostBaseClass>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS,
X_WrapIDebugHostBaseClass.class));
static X_DebugHostBaseClassInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class,
return DbgEngUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostConstant;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostConstant;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostConstant;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostConstantInternal extends DebugHostConstant {
Map<Pointer, DebugHostConstantInternal> CACHE = new WeakValueHashMap<>();
static DebugHostConstantInternal instanceFor(WrapIDebugHostConstant data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostConstantImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostConstantImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostConstant>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostConstant.IID_IDEBUG_HOST_CONSTANT),
WrapIDebugHostConstant.class));
List<Preferred<WrapIDebugHostConstant>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostConstant.IID_IDEBUG_HOST_CONSTANT,
WrapIDebugHostConstant.class));
static DebugHostConstantInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostConstantInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostConstantInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostContext;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostContext;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostContext;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostContextInternal extends DebugHostContext {
Map<Pointer, DebugHostContextInternal> CACHE = new WeakValueHashMap<>();
static DebugHostContextInternal instanceFor(WrapIDebugHostContext data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostContextImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostContextImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostContext>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostContext.IID_IDEBUG_HOST_CONTEXT),
WrapIDebugHostContext.class));
List<Preferred<WrapIDebugHostContext>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostContext.IID_IDEBUG_HOST_CONTEXT,
WrapIDebugHostContext.class));
static DebugHostContextInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostContextInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostContextInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostData;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostData;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostData;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface DebugHostDataInternal extends DebugHostData {
Map<Pointer, DebugHostDataInternal> CACHE = new WeakValueHashMap<>();
static DebugHostDataInternal instanceFor(WrapIDebugHostData data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostDataImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostDataImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostData>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostData.IID_IDEBUG_HOST_DATA), WrapIDebugHostData.class));
List<Preferred<WrapIDebugHostData>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostData.IID_IDEBUG_HOST_DATA, WrapIDebugHostData.class));
static DebugHostDataInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostDataInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostDataInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostErrorSink;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostErrorSink;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostErrorSink;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostErrorSinkInternal extends DebugHostErrorSink {
Map<Pointer, DebugHostErrorSinkInternal> CACHE = new WeakValueHashMap<>();
static DebugHostErrorSinkInternal instanceFor(WrapIDebugHostErrorSink data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostErrorSinkImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostErrorSinkImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostErrorSink>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostErrorSink.IID_IDEBUG_HOST_ERROR_SINK),
WrapIDebugHostErrorSink.class));
List<Preferred<WrapIDebugHostErrorSink>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostErrorSink.IID_IDEBUG_HOST_ERROR_SINK,
WrapIDebugHostErrorSink.class));
static DebugHostErrorSinkInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostErrorSinkInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostErrorSinkInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostEvaluator1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,21 @@ public interface DebugHostEvaluatorInternal extends DebugHostEvaluator1 {
Map<Pointer, DebugHostEvaluatorInternal> CACHE = new WeakValueHashMap<>();
static DebugHostEvaluatorInternal instanceFor(WrapIDebugHostEvaluator1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl1::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl1::new);
}
static DebugHostEvaluatorInternal instanceFor(WrapIDebugHostEvaluator2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl2::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl2::new);
}
Map<REFIID, Class<? extends WrapIDebugHostEvaluator1>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostEvaluator2.IID_IDEBUG_HOST_EVALUATOR2),
WrapIDebugHostEvaluator2.class),
Map.entry(new REFIID(IDebugHostEvaluator1.IID_IDEBUG_HOST_EVALUATOR),
WrapIDebugHostEvaluator1.class));
List<Preferred<WrapIDebugHostEvaluator1>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostEvaluator2.IID_IDEBUG_HOST_EVALUATOR2,
WrapIDebugHostEvaluator2.class),
new Preferred<>(IDebugHostEvaluator1.IID_IDEBUG_HOST_EVALUATOR,
WrapIDebugHostEvaluator1.class));
static DebugHostEvaluatorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostEvaluatorInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostEvaluatorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostExtensability;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostExtensability;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostExtensability;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostExtensabilityInternal extends DebugHostExtensability {
Map<Pointer, DebugHostExtensabilityInternal> CACHE = new WeakValueHashMap<>();
static DebugHostExtensabilityInternal instanceFor(WrapIDebugHostExtensability data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostExtensabilityImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostExtensabilityImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostExtensability>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostExtensability.IID_IDEBUG_HOST_EXTENSABILITY),
WrapIDebugHostExtensability.class));
List<Preferred<WrapIDebugHostExtensability>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostExtensability.IID_IDEBUG_HOST_EXTENSABILITY,
WrapIDebugHostExtensability.class));
static DebugHostExtensabilityInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostExtensabilityInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostExtensabilityInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostField;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostField;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostField;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DebugHostFieldInternal extends DebugHostField {
Map<Pointer, DebugHostFieldInternal> CACHE = new WeakValueHashMap<>();
static DebugHostFieldInternal instanceFor(WrapIDebugHostField data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostFieldImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostFieldImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostField>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostField.IID_IDEBUG_HOST_FIELD),
WrapIDebugHostField.class));
List<Preferred<WrapIDebugHostField>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostField.IID_IDEBUG_HOST_FIELD, WrapIDebugHostField.class));
static DebugHostFieldInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostFieldInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostFieldInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHost;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHost;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHost;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface DebugHostInternal extends DebugHost {
Map<Pointer, DebugHostInternal> CACHE = new WeakValueHashMap<>();
static DebugHostInternal instanceFor(WrapIDebugHost data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHost>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHost.IID_IDEBUG_HOST), WrapIDebugHost.class));
List<Preferred<WrapIDebugHost>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHost.IID_IDEBUG_HOST, WrapIDebugHost.class));
static DebugHostInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostMemory1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface DebugHostMemoryInternal extends DebugHostMemory1 {
Map<Pointer, DebugHostMemoryInternal> CACHE = new WeakValueHashMap<>();
static DebugHostMemoryInternal instanceFor(WrapIDebugHostMemory1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl1::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl1::new);
}
static DebugHostMemoryInternal instanceFor(WrapIDebugHostMemory2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl2::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl2::new);
}
Map<REFIID, Class<? extends WrapIDebugHostMemory1>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostMemory2.IID_IDEBUG_HOST_MEMORY2),
WrapIDebugHostMemory2.class),
Map.entry(new REFIID(IDebugHostMemory1.IID_IDEBUG_HOST_MEMORY),
WrapIDebugHostMemory1.class));
List<Preferred<WrapIDebugHostMemory1>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostMemory2.IID_IDEBUG_HOST_MEMORY2, WrapIDebugHostMemory2.class),
new Preferred<>(IDebugHostMemory1.IID_IDEBUG_HOST_MEMORY, WrapIDebugHostMemory1.class));
static DebugHostMemoryInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostMemoryInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostMemoryInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostModule1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface DebugHostModuleInternal extends DebugHostModule1 {
Map<Pointer, DebugHostModuleInternal> CACHE = new WeakValueHashMap<>();
static DebugHostModuleInternal instanceFor(WrapIDebugHostModule1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl1::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl1::new);
}
static DebugHostModuleInternal instanceFor(WrapIDebugHostModule2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl2::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl2::new);
}
Map<REFIID, Class<? extends WrapIDebugHostModule1>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostModule2.IID_IDEBUG_HOST_MODULE2),
WrapIDebugHostModule2.class),
Map.entry(new REFIID(IDebugHostModule1.IID_IDEBUG_HOST_MODULE),
WrapIDebugHostModule1.class));
List<Preferred<WrapIDebugHostModule1>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostModule2.IID_IDEBUG_HOST_MODULE2, WrapIDebugHostModule2.class),
new Preferred<>(IDebugHostModule1.IID_IDEBUG_HOST_MODULE, WrapIDebugHostModule1.class));
static DebugHostModuleInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostModuleInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostModuleInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostModuleSignature;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostModuleSignature;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostModuleSignature;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostModuleSignatureInternal extends DebugHostModuleSignatu
Map<Pointer, DebugHostModuleSignatureInternal> CACHE = new WeakValueHashMap<>();
static DebugHostModuleSignatureInternal instanceFor(WrapIDebugHostModuleSignature data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostModuleSignatureImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostModuleSignatureImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostModuleSignature>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostModuleSignature.IID_IDEBUG_HOST_MODULE_SIGNATURE),
WrapIDebugHostModuleSignature.class));
List<Preferred<WrapIDebugHostModuleSignature>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostModuleSignature.IID_IDEBUG_HOST_MODULE_SIGNATURE,
WrapIDebugHostModuleSignature.class));
static DebugHostModuleSignatureInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostModuleSignatureInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostModuleSignatureInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostPublic;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostPublic;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostPublic;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DebugHostPublicInternal extends DebugHostPublic {
Map<Pointer, DebugHostPublicInternal> CACHE = new WeakValueHashMap<>();
static DebugHostPublicInternal instanceFor(WrapIDebugHostPublic data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostPublicImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostPublicImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostPublic>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostPublic.IID_IDEBUG_HOST_PUBLIC),
WrapIDebugHostPublic.class));
List<Preferred<WrapIDebugHostPublic>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostPublic.IID_IDEBUG_HOST_PUBLIC, WrapIDebugHostPublic.class));
static DebugHostPublicInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostPublicInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostPublicInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostScriptHost;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostScriptHost;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostScriptHost;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostScriptHostInternal extends DebugHostScriptHost {
Map<Pointer, DebugHostScriptHostInternal> CACHE = new WeakValueHashMap<>();
static DebugHostScriptHostInternal instanceFor(WrapIDebugHostScriptHost data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostScriptHostImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostScriptHostImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostScriptHost>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostScriptHost.IID_IDEBUG_HOST_SCRIPT_HOST),
WrapIDebugHostScriptHost.class));
List<Preferred<WrapIDebugHostScriptHost>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostScriptHost.IID_IDEBUG_HOST_SCRIPT_HOST,
WrapIDebugHostScriptHost.class));
static DebugHostScriptHostInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostScriptHostInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostScriptHostInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostStatus;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostStatus;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostStatus;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DebugHostStatusInternal extends DebugHostStatus {
Map<Pointer, DebugHostStatusInternal> CACHE = new WeakValueHashMap<>();
static DebugHostStatusInternal instanceFor(WrapIDebugHostStatus data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostStatusImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostStatusImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostStatus>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostStatus.IID_IDEBUG_HOST_STATUS),
WrapIDebugHostStatus.class));
List<Preferred<WrapIDebugHostStatus>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostStatus.IID_IDEBUG_HOST_STATUS, WrapIDebugHostStatus.class));
static DebugHostStatusInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostStatusInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostStatusInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostSymbolEnumerator;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostSymbolEnumerator;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostSymbolEnumerator;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostSymbolEnumeratorInternal extends DebugHostSymbolEnumer
Map<Pointer, DebugHostSymbolEnumeratorInternal> CACHE = new WeakValueHashMap<>();
static DebugHostSymbolEnumeratorInternal instanceFor(WrapIDebugHostSymbolEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolEnumeratorImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolEnumeratorImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostSymbolEnumerator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostSymbolEnumerator.IID_IDEBUG_HOST_SYMBOL_ENUMERATOR),
WrapIDebugHostSymbolEnumerator.class));
List<Preferred<WrapIDebugHostSymbolEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostSymbolEnumerator.IID_IDEBUG_HOST_SYMBOL_ENUMERATOR,
WrapIDebugHostSymbolEnumerator.class));
static DebugHostSymbolEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostSymbolEnumeratorInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostSymbolEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostSymbol1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface DebugHostSymbolInternal extends DebugHostSymbol1 {
Map<Pointer, DebugHostSymbolInternal> CACHE = new WeakValueHashMap<>();
static DebugHostSymbolInternal instanceFor(WrapIDebugHostSymbol1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl1::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl1::new);
}
static DebugHostSymbolInternal instanceFor(WrapIDebugHostSymbol2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl2::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl2::new);
}
Map<REFIID, Class<? extends WrapIDebugHostSymbol1>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostSymbol2.IID_IDEBUG_HOST_SYMBOL2),
WrapIDebugHostSymbol2.class),
Map.entry(new REFIID(IDebugHostSymbol1.IID_IDEBUG_HOST_SYMBOL),
WrapIDebugHostSymbol1.class));
List<Preferred<WrapIDebugHostSymbol1>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostSymbol2.IID_IDEBUG_HOST_SYMBOL2, WrapIDebugHostSymbol2.class),
new Preferred<>(IDebugHostSymbol1.IID_IDEBUG_HOST_SYMBOL, WrapIDebugHostSymbol1.class));
static DebugHostSymbolInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostSymbolInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostSymbolInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostSymbols;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostSymbols;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostSymbols;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DebugHostSymbolsInternal extends DebugHostSymbols {
Map<Pointer, DebugHostSymbolsInternal> CACHE = new WeakValueHashMap<>();
static DebugHostSymbolsInternal instanceFor(WrapIDebugHostSymbols data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolsImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolsImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostSymbols>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostSymbols.IID_IDEBUG_HOST_SYMBOLS),
WrapIDebugHostSymbols.class));
List<Preferred<WrapIDebugHostSymbols>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostSymbols.IID_IDEBUG_HOST_SYMBOLS, WrapIDebugHostSymbols.class));
static DebugHostSymbolsInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostSymbolsInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostSymbolsInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostType1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -30,20 +31,19 @@ public interface DebugHostTypeInternal extends DebugHostType1 {
Map<Pointer, DebugHostTypeInternal> CACHE = new WeakValueHashMap<>();
static DebugHostTypeInternal instanceFor(WrapIDebugHostType1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl1::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl1::new);
}
static DebugHostTypeInternal instanceFor(WrapIDebugHostType2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl2::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl2::new);
}
Map<REFIID, Class<? extends WrapIDebugHostType1>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostType2.IID_IDEBUG_HOST_TYPE2), WrapIDebugHostType2.class),
Map.entry(new REFIID(IDebugHostType1.IID_IDEBUG_HOST_TYPE), WrapIDebugHostType1.class));
List<Preferred<WrapIDebugHostType1>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostType2.IID_IDEBUG_HOST_TYPE2, WrapIDebugHostType2.class),
new Preferred<>(IDebugHostType1.IID_IDEBUG_HOST_TYPE, WrapIDebugHostType1.class));
static DebugHostTypeInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostTypeInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostTypeInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostTypeSignature;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostTypeSignature;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostTypeSignature;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostTypeSignatureInternal extends DebugHostTypeSignature {
Map<Pointer, DebugHostTypeSignatureInternal> CACHE = new WeakValueHashMap<>();
static DebugHostTypeSignatureInternal instanceFor(WrapIDebugHostTypeSignature data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostTypeSignatureImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostTypeSignatureImpl::new);
}
Map<REFIID, Class<? extends WrapIDebugHostTypeSignature>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IDebugHostTypeSignature.IID_IDEBUG_HOST_TYPE_SIGNATURE),
WrapIDebugHostTypeSignature.class));
List<Preferred<WrapIDebugHostTypeSignature>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IDebugHostTypeSignature.IID_IDEBUG_HOST_TYPE_SIGNATURE,
WrapIDebugHostTypeSignature.class));
static DebugHostTypeSignatureInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostTypeSignatureInternal.class,
return DbgEngUtil.tryPreferredInterfaces(DebugHostTypeSignatureInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.debughost.DebugHostBaseClass;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.X_IDebugHostBaseClass;
import agent.dbgmodel.jna.dbgmodel.debughost.X_WrapIDebugHostBaseClass;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface X_DebugHostBaseClassInternal extends DebugHostBaseClass {
Map<Pointer, X_DebugHostBaseClassInternal> CACHE = new WeakValueHashMap<>();
static X_DebugHostBaseClassInternal instanceFor(X_WrapIDebugHostBaseClass data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new);
}
Map<REFIID, Class<? extends X_WrapIDebugHostBaseClass>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS),
X_WrapIDebugHostBaseClass.class));
List<Preferred<X_WrapIDebugHostBaseClass>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS,
X_WrapIDebugHostBaseClass.class));
static X_DebugHostBaseClassInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class,
return DbgEngUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.main.KeyEnumerator;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.main.IKeyEnumerator;
import agent.dbgmodel.jna.dbgmodel.main.WrapIKeyEnumerator;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface KeyEnumeratorInternal extends KeyEnumerator {
Map<Pointer, KeyEnumeratorInternal> CACHE = new WeakValueHashMap<>();
static KeyEnumeratorInternal instanceFor(WrapIKeyEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, KeyEnumeratorImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, KeyEnumeratorImpl::new);
}
Map<REFIID, Class<? extends WrapIKeyEnumerator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IKeyEnumerator.IID_IKEY_ENUMERATOR), WrapIKeyEnumerator.class));
List<Preferred<WrapIKeyEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IKeyEnumerator.IID_IKEY_ENUMERATOR, WrapIKeyEnumerator.class));
static KeyEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(KeyEnumeratorInternal.class,
return DbgEngUtil.tryPreferredInterfaces(KeyEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.main.KeyStore;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.main.IKeyStore;
import agent.dbgmodel.jna.dbgmodel.main.WrapIKeyStore;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface KeyStoreInternal extends KeyStore {
Map<Pointer, KeyStoreInternal> CACHE = new WeakValueHashMap<>();
static KeyStoreInternal instanceFor(WrapIKeyStore data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, KeyStoreImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, KeyStoreImpl::new);
}
Map<REFIID, Class<? extends WrapIKeyStore>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IKeyStore.IID_IKEY_STORE), WrapIKeyStore.class));
List<Preferred<WrapIKeyStore>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IKeyStore.IID_IKEY_STORE, WrapIKeyStore.class));
static KeyStoreInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(KeyStoreInternal.class,
return DbgEngUtil.tryPreferredInterfaces(KeyStoreInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.main.ModelIterator;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.main.IModelIterator;
import agent.dbgmodel.jna.dbgmodel.main.WrapIModelIterator;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface ModelIteratorInternal extends ModelIterator {
Map<Pointer, ModelIteratorInternal> CACHE = new WeakValueHashMap<>();
static ModelIteratorInternal instanceFor(WrapIModelIterator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelIteratorImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, ModelIteratorImpl::new);
}
Map<REFIID, Class<? extends WrapIModelIterator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IModelIterator.IID_IMODEL_ITERATOR), WrapIModelIterator.class));
List<Preferred<WrapIModelIterator>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IModelIterator.IID_IMODEL_ITERATOR, WrapIModelIterator.class));
static ModelIteratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelIteratorInternal.class,
return DbgEngUtil.tryPreferredInterfaces(ModelIteratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.main.ModelKeyReference1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.main.*;
import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface ModelKeyReferenceInternal extends ModelKeyReference1 {
Map<Pointer, ModelKeyReferenceInternal> CACHE = new WeakValueHashMap<>();
static ModelKeyReferenceInternal instanceFor(WrapIModelKeyReference1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl1::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl1::new);
}
static ModelKeyReferenceInternal instanceFor(WrapIModelKeyReference2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl2::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl2::new);
}
Map<REFIID, Class<? extends WrapIModelKeyReference1>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IModelKeyReference2.IID_IMODEL_REFERENCE2),
WrapIModelKeyReference2.class),
Map.entry(new REFIID(IModelKeyReference.IID_IMODEL_REFERENCE),
WrapIModelKeyReference1.class));
List<Preferred<WrapIModelKeyReference1>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IModelKeyReference2.IID_IMODEL_REFERENCE2, WrapIModelKeyReference2.class),
new Preferred<>(IModelKeyReference.IID_IMODEL_REFERENCE, WrapIModelKeyReference1.class));
static ModelKeyReferenceInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelKeyReferenceInternal.class,
return DbgEngUtil.tryPreferredInterfaces(ModelKeyReferenceInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.main.ModelMethod;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.main.IModelMethod;
import agent.dbgmodel.jna.dbgmodel.main.WrapIModelMethod;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface ModelMethodInternal extends ModelMethod {
Map<Pointer, ModelMethodInternal> CACHE = new WeakValueHashMap<>();
static ModelMethodInternal instanceFor(WrapIModelMethod data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelMethodImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, ModelMethodImpl::new);
}
Map<REFIID, Class<? extends WrapIModelMethod>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IModelMethod.IID_IMODEL_METHOD), WrapIModelMethod.class));
List<Preferred<WrapIModelMethod>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IModelMethod.IID_IMODEL_METHOD, WrapIModelMethod.class));
static ModelMethodInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelMethodInternal.class,
return DbgEngUtil.tryPreferredInterfaces(ModelMethodInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.main.ModelObject;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.main.IModelObject;
import agent.dbgmodel.jna.dbgmodel.main.WrapIModelObject;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface ModelObjectInternal extends ModelObject {
Map<Pointer, ModelObjectInternal> CACHE = new WeakValueHashMap<>();
static ModelObjectInternal instanceFor(WrapIModelObject data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelObjectImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, ModelObjectImpl::new);
}
Map<REFIID, Class<? extends WrapIModelObject>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IModelObject.IID_IMODEL_OBJECT), WrapIModelObject.class));
List<Preferred<WrapIModelObject>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IModelObject.IID_IMODEL_OBJECT, WrapIModelObject.class));
static ModelObjectInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelObjectInternal.class,
return DbgEngUtil.tryPreferredInterfaces(ModelObjectInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.main.ModelPropertyAccessor;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.main.IModelPropertyAccessor;
import agent.dbgmodel.jna.dbgmodel.main.WrapIModelPropertyAccessor;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface ModelPropertyAccessorInternal extends ModelPropertyAccessor {
Map<Pointer, ModelPropertyAccessorInternal> CACHE = new WeakValueHashMap<>();
static ModelPropertyAccessorInternal instanceFor(WrapIModelPropertyAccessor data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelPropertyAccessorImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, ModelPropertyAccessorImpl::new);
}
Map<REFIID, Class<? extends WrapIModelPropertyAccessor>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IModelPropertyAccessor.IID_IMODEL_PROPERTY_ACCESSOR),
WrapIModelPropertyAccessor.class));
List<Preferred<WrapIModelPropertyAccessor>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IModelPropertyAccessor.IID_IMODEL_PROPERTY_ACCESSOR,
WrapIModelPropertyAccessor.class));
static ModelPropertyAccessorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelPropertyAccessorInternal.class,
return DbgEngUtil.tryPreferredInterfaces(ModelPropertyAccessorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}

View File

@ -15,14 +15,15 @@
*/
package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgmodel.dbgmodel.main.RawEnumerator;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.main.IRawEnumerator;
import agent.dbgmodel.jna.dbgmodel.main.WrapIRawEnumerator;
import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface RawEnumeratorInternal extends RawEnumerator {
Map<Pointer, RawEnumeratorInternal> CACHE = new WeakValueHashMap<>();
static RawEnumeratorInternal instanceFor(WrapIRawEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, RawEnumeratorImpl::new);
return DbgEngUtil.lazyWeakCache(CACHE, data, RawEnumeratorImpl::new);
}
Map<REFIID, Class<? extends WrapIRawEnumerator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries(
Map.entry(new REFIID(IRawEnumerator.IID_IRAW_ENUMERATOR), WrapIRawEnumerator.class));
List<Preferred<WrapIRawEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
new Preferred<>(IRawEnumerator.IID_IRAW_ENUMERATOR, WrapIRawEnumerator.class));
static RawEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(RawEnumeratorInternal.class,
return DbgEngUtil.tryPreferredInterfaces(RawEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier);
}
}