File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed
Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -476,7 +476,7 @@ JNIHook_Init(JavaVM *jvm)
476476
477477 // Force AllowRedefinitionToAddDeleteMethods
478478 auto jvm_flag_type_result = VMType::from_static (" JVMFlag" );
479- if (!jvm_flag_type_result) {
479+ if (!jvm_flag_type_result && !(jvm_flag_type_result = VMType::from_static ( " Flag " )) ) {
480480 LOG (" Failed to parse VMStructs\n " );
481481 return JNIHOOK_ERR_UNKNOWN;
482482 }
@@ -496,7 +496,7 @@ JNIHook_Init(JavaVM *jvm)
496496 auto flags_buf = *(unsigned char **)flagsField; // flagTable
497497 auto numFlags = *numFlagsField;
498498 for (size_t i = 0 ; i < numFlags; ++i) {
499- auto flag = VMType::from_instance (" JVMFlag " , &flags_buf[i * jvm_flag_size]);
499+ auto flag = VMType::from_instance (jvm_flag_type. get_type_name (). c_str () , &flags_buf[i * jvm_flag_size]);
500500 auto name_addr = flag->get_field <void *>(" _name" ).value ();
501501 auto name = (char *)*name_addr;
502502 LOG (" FLAG: %s\n " , name);
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ std::optional<VMType> VMType::from_static(const char *typeName)
8181
8282 VMType vmtype;
8383 vmtype.instance = NULL ;
84+ vmtype.type_name = std::string (typeName);
8485 vmtype.type_entry = type.value ();
8586 vmtype.fields = fields;
8687
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ class VMTypes {
8080
8181class VMType {
8282private:
83+ std::string type_name;
8384 VMTypeEntry *type_entry;
8485 std::optional<std::reference_wrapper<VMTypes::struct_entry_t >> fields;
8586 void *instance; // pointer to instantiated VM type
@@ -119,6 +120,11 @@ class VMType {
119120 return reinterpret_cast <T *>(fieldAddress.value ());
120121 }
121122
123+ const std::string &get_type_name ()
124+ {
125+ return this ->type_name ;
126+ }
127+
122128 inline void *get_instance ()
123129 {
124130 return this ->instance ;
You can’t perform that action at this time.
0 commit comments