public class

UnmanglerService

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.asm.mangling.UnmanglerService

Class Overview

The service offers access to a set of IManglingEngine for a INativeCodeUnit.

Summary

Constants
int MANGLING_ENGINE_CXXA
int MANGLING_ENGINE_MSVC
int MANGLING_ENGINE_MSVCPP
int MANGLING_ENGINE_MSVCPP_V2
Public Constructors
UnmanglerService(INativeCodeUnit<?> codeUnit)
Public Methods
boolean importUnmangledRoutineName(INativeMethodItem routine, String mangledName, IUnmangledRoutine unmangledRoutine, boolean changeRoutineName)
Applies unmangled routine declaration to a native routine item.
boolean importUnmangledRoutinePrototype(INativeMethodItem routine, IUnmangledRoutine unmangledRoutine)
Applies unmangled routine declaration to a native routine item.
void registerEngine(int manglingEngineId)
IUnmangledData unmangle(String mangledName, boolean returnFirstResult)
Unmangle a mangled string.
IUnmangledData unmangleData(String mangledName, boolean returnFirstResult)
Unmangle a mangled string representing a data.
IUnmangledRoutine unmangleRoutine(String mangledName, boolean returnFirstResult)
Unmangle a mangled string representing a routine.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int MANGLING_ENGINE_CXXA

Constant Value: 4 (0x00000004)

public static final int MANGLING_ENGINE_MSVC

Constant Value: 1 (0x00000001)

public static final int MANGLING_ENGINE_MSVCPP

Constant Value: 2 (0x00000002)

public static final int MANGLING_ENGINE_MSVCPP_V2

Constant Value: 3 (0x00000003)

Public Constructors

public UnmanglerService (INativeCodeUnit<?> codeUnit)

Public Methods

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 UnmanglerService#importUnmangledRoutinePrototype(INativeCodeUnit, INativeMethodItem, IUnmangledRoutine).

Parameters
mangledName the mangled declaration for this routine
unmangledRoutine 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

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 UnmanglerService#importUnmangledRoutineName(INativeMethodItem, IUnmangledRoutine).

Returns
  • true if the import was successfully done, false otherwise (e.g. because the prototype application failed)

public void registerEngine (int manglingEngineId)

public IUnmangledData unmangle (String mangledName, boolean returnFirstResult)

Unmangle a mangled string.

Parameters
returnFirstResult 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

public IUnmangledData unmangleData (String mangledName, boolean returnFirstResult)

Unmangle a mangled string representing a data.

Parameters
returnFirstResult 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

public IUnmangledRoutine unmangleRoutine (String mangledName, boolean returnFirstResult)

Unmangle a mangled string representing a routine.

Parameters
returnFirstResult 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