Class UnmanglerService
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.mangling.UnmanglerService
The service offers access to a set of
IManglingEngine for a INativeCodeUnit.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intItanium C++ ABI mangling engine.static final intMSVC C mangling engine.static final intMSVC C++ mangling engine.static final intMSVC C++ mangling engine, version 2. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRegisteredEngine(int manglingEngineId) Get a registered mangling engine.booleanimportUnmangledRoutineName(INativeMethodItem routine, String mangledName, IUnmangledRoutine unmangledRoutine, boolean changeRoutineName) Applies unmangled routine declaration to a native routine item.booleanimportUnmangledRoutinePrototype(INativeMethodItem routine, IUnmangledRoutine unmangledRoutine) Applies unmangled routine declaration to a native routine item.booleanregisterEngine(int manglingEngineId) Register a mangling engine.Unmangle a mangled string.unmangleData(String mangledName, boolean returnFirstResult) Unmangle a mangled string representing a data.unmangleRoutine(String mangledName, boolean returnFirstResult) Unmangle a mangled string representing a routine.voidUnregister all mangling engines.booleanunregisterEngine(int manglingEngineId) Unregister a mangling engine.
-
Field Details
-
MANGLING_ENGINE_MSVC
public static final int MANGLING_ENGINE_MSVCMSVC C mangling engine.- See Also:
-
MANGLING_ENGINE_MSVCPP
public static final int MANGLING_ENGINE_MSVCPPMSVC C++ mangling engine.- See Also:
-
MANGLING_ENGINE_MSVCPP_V2
public static final int MANGLING_ENGINE_MSVCPP_V2MSVC C++ mangling engine, version 2.- See Also:
-
MANGLING_ENGINE_CXXA
public static final int MANGLING_ENGINE_CXXAItanium C++ ABI mangling engine.- See Also:
-
-
Constructor Details
-
UnmanglerService
Create an unmangler service.- Parameters:
codeUnit- native code unit
-
-
Method Details
-
getRegisteredEngine
Get a registered mangling engine.- Parameters:
manglingEngineId- mangling engine identifier- Returns:
- engine, or null if none is registered for the identifier
-
registerEngine
public boolean registerEngine(int manglingEngineId) Register a mangling engine.- Parameters:
manglingEngineId- mangling engine identifier- Returns:
- true if the engine was registered
-
unregisterEngine
public boolean unregisterEngine(int manglingEngineId) Unregister a mangling engine.- Parameters:
manglingEngineId- mangling engine identifier- Returns:
- true if an engine was removed
-
unregisterAllEngines
public void unregisterAllEngines()Unregister all mangling engines. -
importUnmangledRoutineName
public boolean importUnmangledRoutineName(INativeMethodItem routine, String mangledName, IUnmangledRoutine unmangledRoutine, boolean changeRoutineName) Applies unmangled routine declaration to a native routine item. This method only takes care of applying the name-related changes, i.e. setting the new routine name and the related attributes.See
importUnmangledRoutinePrototype(INativeMethodItem, IUnmangledRoutine).- Parameters:
routine- routine item to updatemangledName- the mangled declaration for this routineunmangledRoutine- the unmangled declaration for this routine (computed from the mangled name)changeRoutineName- if true the name of the routine will be changed, otherwise it will be kept as-is and only the attributes will be set- Returns:
- true if the import was successfully done, false otherwise
-
importUnmangledRoutinePrototype
public boolean importUnmangledRoutinePrototype(INativeMethodItem routine, IUnmangledRoutine unmangledRoutine) Applies unmangled routine declaration to a native routine item. This method only takes care of applying the prototype change.important:
- only strict C prototypes are applied
- mangled prototypes usually do not contain attributes, such as noreturn. Therefore the typelib prototype should be preferred to this one, if existing.
See
importUnmangledRoutineName(INativeMethodItem, String, IUnmangledRoutine, boolean).- Parameters:
routine- routine item to updateunmangledRoutine- unmangled declaration for this routine- Returns:
- true if the import was successfully done, false otherwise (e.g. because the prototype application failed)
-
unmangleRoutine
Unmangle a mangled string representing a routine.- Parameters:
mangledName- mangled routine namereturnFirstResult- if true the first engine to provide a result will have the last word, otherwise a result is returned only if all engines agree (or provide no result)- Returns:
- unmangled string if the given string can be unmangled as a routine, null otherwise
-
unmangleData
Unmangle a mangled string representing a data.- Parameters:
mangledName- mangled data namereturnFirstResult- if true the first engine to provide a result will have the last word, otherwise a result is returned only if all engines agree (or provide no result)- Returns:
- unmangled string if the given string can be unmangled as a data, null otherwise
-
unmangle
Unmangle a mangled string.- Parameters:
mangledName- mangled namereturnFirstResult- if true the first engine to provide a result will have the last word, otherwise a result is returned only if all engines agree (or provide no result)- Returns:
- unmangled string if the given string can be unmangled, null otherwise
-