Class TypeLibraryService
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.type.TypeLibraryService
The type library service (TLS) is responsible for managing (loading and unloading) native code
type libraries (
typelibs
). There is one TLS per JEB engines context. It can be retrieved
via IEnginesContext.getTypeLibraryService()
.
This class is thread-safe.
Positive UUIDs (range [0, 0x80000000[) is reserved for internal use. External users may use negative UUIDs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
reserved for internal usestatic final int
reserved for internal usestatic final int
reserved for internal usestatic final int
reserved for internal usestatic final int
reserved for internal usestatic final int
static final int
static final int
static final int
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new TLS.TypeLibraryService
(File folder) Create a new TLS with an initial folder. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a typelib folder to this TLS.findConstantsByName
(String name, ProcessorType procType, int groupId) Find constants by name in the currently loaded typelibs.Find the first integer constant by name in the currently loaded typelibs.findRoutineByName
(String name, ProcessorType procType) Convenience method.findRoutineByName
(String name, ProcessorType procType, int groupId) Find a routine by simple name in the currently loaded typelibs.findTypeBySignature
(String signature, ProcessorType procType) Find a type by signature in the currently loaded typelibs.findTypeBySignature
(String signature, ProcessorType procType, int groupId) Find a type by signature in the currently loaded typelibs.Get the list of available type library entries.Get the list of loaded type libraries.Get the list of entries that specify a loaded typelib.Get the list of entries that specify an unloaded typelib.static String
groupIdToName
(int id) boolean
load
(TypeLibraryEntry entry) Load the provided type library into this TLS.boolean
load
(ProcessorType processorType, int groupId) Load all type libraries matching the given processor and group.boolean
load
(ProcessorType processorType, int groupId, int maxCount) Load type libraries matching the given processor and group.boolean
loadExternal
(ITypeLibrary typelib) Load the provided external (not backed by a file managed by this TLS) typelib object.boolean
loadSingle
(ProcessorType processorType, int groupId) Load the highest priority type library matching the given processor type and group.void
rescan()
void
rescan
(boolean deleteOldEntries) Rescan the type library folders to register/unregister additional/removed typelib binary files.boolean
unload
(ITypeLibrary typelib) Unload a type library.boolean
Unload a type library.int
Unload all type libraries.
-
Field Details
-
GROUPID_TYPELIB_UNKNOWN
public static final int GROUPID_TYPELIB_UNKNOWN- See Also:
-
GROUPID_TYPELIB_POSIX
public static final int GROUPID_TYPELIB_POSIX- See Also:
-
GROUPID_TYPELIB_LINUX
public static final int GROUPID_TYPELIB_LINUX- See Also:
-
GROUPID_TYPELIB_LINUX_ANDROID
public static final int GROUPID_TYPELIB_LINUX_ANDROID- See Also:
-
GROUPID_TYPELIB_WINDOWS
public static final int GROUPID_TYPELIB_WINDOWS- See Also:
-
GROUPID_TYPELIB_WIN32
public static final int GROUPID_TYPELIB_WIN32- See Also:
-
GROUPID_TYPELIB_WINDDK
public static final int GROUPID_TYPELIB_WINDDK- See Also:
-
GROUPID_TYPELIB_EFI
public static final int GROUPID_TYPELIB_EFI- See Also:
-
GROUPID_TYPELIB_TEST
public static final int GROUPID_TYPELIB_TESTreserved for internal use- See Also:
-
GROUPID_TYPELIB_TEST1
public static final int GROUPID_TYPELIB_TEST1reserved for internal use- See Also:
-
GROUPID_TYPELIB_TEST2
public static final int GROUPID_TYPELIB_TEST2reserved for internal use- See Also:
-
GROUPID_TYPELIB_TEST3
public static final int GROUPID_TYPELIB_TEST3reserved for internal use- See Also:
-
GROUPID_TYPELIB_TEST4
public static final int GROUPID_TYPELIB_TEST4reserved for internal use- See Also:
-
TYPELIB_FILE_EXTENSION
- See Also:
-
-
Constructor Details
-
TypeLibraryService
public TypeLibraryService()Create a new TLS. At least one folder must be added usingaddFolder(File, boolean)
. -
TypeLibraryService
Create a new TLS with an initial folder. The folder will be scanned.- Parameters:
folder
-
-
-
Method Details
-
addFolder
Add a typelib folder to this TLS.- Parameters:
folder
-doRescan
- if true,rescan()
will be invoked after the folder addition
-
rescan
public void rescan() -
rescan
public void rescan(boolean deleteOldEntries) Rescan the type library folders to register/unregister additional/removed typelib binary files.- Parameters:
deleteOldEntries
-
-
getAvailables
Get the list of available type library entries. An available typelib is not necessarily loaded. Refer toTypeLibraryEntry
for additional details about the state of a given typelib.- Returns:
-
getLoadedTypeLibraries
Get the list of loaded type libraries. More type libraries may be available, eg non-loaded ones.- Returns:
-
getLoadedTypeLibraryEntries
Get the list of entries that specify a loaded typelib.- Returns:
-
getNotLoadedTypeLibraryEntries
Get the list of entries that specify an unloaded typelib.- Returns:
-
load
Load the provided type library into this TLS.- Parameters:
entry
-- Returns:
-
loadSingle
Load the highest priority type library matching the given processor type and group.- Parameters:
processorType
-groupId
-- Returns:
- success indicator
-
load
Load all type libraries matching the given processor and group.- Parameters:
processorType
-groupId
-- Returns:
- success indicator if one or more typelib was loaded
-
load
Load type libraries matching the given processor and group.- Parameters:
processorType
- mandatorygroupId
- mandatorymaxCount
-- Returns:
- success indicator if one or more typelib was loaded
-
loadExternal
Load the provided external (not backed by a file managed by this TLS) typelib object.- Parameters:
typelib
-- Returns:
-
unload
Unload a type library.- Parameters:
typelib
- a type library- Returns:
- true if the typelib was previously loaded and is now unloaded; false otherwise
-
unload
Unload a type library.- Parameters:
e
- a typelib entry- Returns:
- true if the typelib was previously loaded and is now unloaded; false otherwise
-
unloadAll
public int unloadAll()Unload all type libraries.- Returns:
- the number of typelibs that were unloaded
-
findRoutineByName
Convenience method.- Parameters:
name
- routine nameprocType
- optional- Returns:
-
findRoutineByName
Find a routine by simple name in the currently loaded typelibs. Convenience routine.- Parameters:
name
- routine nameprocType
- optionalgroupId
- optional (0 if none/unknown)- Returns:
-
findTypeBySignature
Find a type by signature in the currently loaded typelibs. Convenience routine.- Parameters:
signature
-procType
- optional- Returns:
-
findTypeBySignature
Find a type by signature in the currently loaded typelibs. Convenience routine.- Parameters:
signature
-procType
- optionalgroupId
- optional (0 if none/unknown)- Returns:
-
groupIdToName
-
findConstantsByName
Find constants by name in the currently loaded typelibs. Convenience routine.- Parameters:
name
- constant nameprocType
- optionalgroupId
- optional (0 if none/unknown)- Returns:
-
findFirstIntegerConstantByName
Find the first integer constant by name in the currently loaded typelibs. Convenience routine.- Parameters:
name
- constant name- Returns:
- a constant, null if none
-