Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-971 Moved ClassRecovery class files to subpackage so they would not appear in script manager window.

ghidra007224f15b20a1f
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/RecoverClassesFromRTTIScript.java b/Ghidra/Features/Decompiler/ghidra_scripts/RecoverClassesFromRTTIScript.java
index ac9b0ef1f8..c2cf196418 100644
--- a/Ghidra/Features/Decompiler/ghidra_scripts/RecoverClassesFromRTTIScript.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/RecoverClassesFromRTTIScript.java
@@ -44,6 +44,7 @@ import java.io.PrintWriter;
import java.util.*;
import java.util.stream.Collectors;
+import classrecovery.*;
import ghidra.app.decompiler.DecompInterface;
import ghidra.app.plugin.core.analysis.DecompilerFunctionAnalyzer;
import ghidra.app.script.GhidraScript;
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/DecompilerScriptUtils.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/DecompilerScriptUtils.java
similarity index 92%
rename from Ghidra/Features/Decompiler/ghidra_scripts/DecompilerScriptUtils.java
rename to Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/DecompilerScriptUtils.java
index e25970eda7..6ab0834396 100644
--- a/Ghidra/Features/Decompiler/ghidra_scripts/DecompilerScriptUtils.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/DecompilerScriptUtils.java
@@ -13,6 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package classrecovery;
+/* ###
+ * 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.
+ */
+//DO NOT RUN. THIS IS NOT A SCRIPT! THIS IS A CLASS THAT IS USED BY SCRIPTS.
import ghidra.app.decompiler.*;
import ghidra.framework.options.ToolOptions;
import ghidra.framework.plugintool.PluginTool;
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/EditStructureUtils.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/EditStructureUtils.java
similarity index 94%
rename from Ghidra/Features/Decompiler/ghidra_scripts/EditStructureUtils.java
rename to Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/EditStructureUtils.java
index b2ff78adf2..ed8b8ced60 100644
--- a/Ghidra/Features/Decompiler/ghidra_scripts/EditStructureUtils.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/EditStructureUtils.java
@@ -13,6 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package classrecovery;
+/* ###
+ * 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.
+ */
+//DO NOT RUN. THIS IS NOT A SCRIPT! THIS IS A CLASS THAT IS USED BY SCRIPTS.
import java.util.*;
import ghidra.program.model.data.*;
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/ExtraScriptUtils.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/ExtraScriptUtils.java
similarity index 98%
rename from Ghidra/Features/Decompiler/ghidra_scripts/ExtraScriptUtils.java
rename to Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/ExtraScriptUtils.java
index e935fc3b8f..8a3db2fae5 100644
--- a/Ghidra/Features/Decompiler/ghidra_scripts/ExtraScriptUtils.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/ExtraScriptUtils.java
@@ -13,6 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package classrecovery;
+/* ###
+ * 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.
+ */
+//DO NOT RUN. THIS IS NOT A SCRIPT! THIS IS A CLASS THAT IS USED BY SCRIPTS.
import java.util.*;
import ghidra.app.cmd.function.CreateFunctionCmd;
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/RTTIClassRecoverer.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIClassRecoverer.java
similarity index 92%
rename from Ghidra/Features/Decompiler/ghidra_scripts/RTTIClassRecoverer.java
rename to Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIClassRecoverer.java
index 35c3779ef5..68c7f69066 100644
--- a/Ghidra/Features/Decompiler/ghidra_scripts/RTTIClassRecoverer.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIClassRecoverer.java
@@ -13,6 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package classrecovery;
+/* ###
+ * 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.
+ */
+//DO NOT RUN. THIS IS NOT A SCRIPT! THIS IS A CLASS THAT IS USED BY SCRIPTS.
import java.util.*;
import ghidra.app.util.NamespaceUtils;
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/RTTIGccClassRecoverer.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIGccClassRecoverer.java
similarity index 98%
rename from Ghidra/Features/Decompiler/ghidra_scripts/RTTIGccClassRecoverer.java
rename to Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIGccClassRecoverer.java
index 2907e11656..f5644b7180 100644
--- a/Ghidra/Features/Decompiler/ghidra_scripts/RTTIGccClassRecoverer.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIGccClassRecoverer.java
@@ -13,6 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package classrecovery;
+/* ###
+ * 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.
+ */
+//DO NOT RUN. THIS IS NOT A SCRIPT! THIS IS A CLASS THAT IS USED BY SCRIPTS.
import java.util.*;
import java.util.stream.Collectors;
@@ -47,7 +64,7 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {
List<RecoveredClass> singleInheritedGccClasses = new ArrayList<RecoveredClass>();
List<RecoveredClass> multiInheritedGccClasses = new ArrayList<RecoveredClass>();
- RTTIGccClassRecoverer(Program program, ProgramLocation location, PluginTool tool,
+ public RTTIGccClassRecoverer(Program program, ProgramLocation location, PluginTool tool,
FlatProgramAPI api, boolean createBookmarks, boolean useShortTemplates,
boolean nameVfunctions,
TaskMonitor monitor) {
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/RTTIWindowsClassRecoverer.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIWindowsClassRecoverer.java
similarity index 99%
rename from Ghidra/Features/Decompiler/ghidra_scripts/RTTIWindowsClassRecoverer.java
rename to Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIWindowsClassRecoverer.java
index 527f2e9dd3..5f75f288c6 100644
--- a/Ghidra/Features/Decompiler/ghidra_scripts/RTTIWindowsClassRecoverer.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RTTIWindowsClassRecoverer.java
@@ -13,6 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package classrecovery;
+/* ###
+ * 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.
+ */
+//DO NOT RUN. THIS IS NOT A SCRIPT! THIS IS A CLASS THAT IS USED BY SCRIPTS.
import java.util.*;
import ghidra.app.plugin.core.decompile.actions.FillOutStructureCmd;
@@ -65,7 +82,7 @@ public class RTTIWindowsClassRecoverer extends RTTIClassRecoverer {
boolean isPDBLoaded;
- RTTIWindowsClassRecoverer(Program program, ProgramLocation location, PluginTool tool,
+ public RTTIWindowsClassRecoverer(Program program, ProgramLocation location, PluginTool tool,
FlatProgramAPI api, boolean createBookmarks, boolean useShortTemplates,
boolean nameVFunctions, boolean isPDBLoaded,
TaskMonitor monitor) throws CancelledException {
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/RecoveredClass.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClass.java
similarity index 96%
rename from Ghidra/Features/Decompiler/ghidra_scripts/RecoveredClass.java
rename to Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClass.java
index 4a497a1807..16f0b588a2 100644
--- a/Ghidra/Features/Decompiler/ghidra_scripts/RecoveredClass.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClass.java
@@ -13,6 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package classrecovery;
+/* ###
+ * 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.
+ */
+//DO NOT RUN. THIS IS NOT A SCRIPT! THIS IS A CLASS THAT IS USED BY SCRIPTS.
import java.util.*;
import java.util.Map.Entry;
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/RecoveredClassUtils.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassUtils.java
similarity index 99%
rename from Ghidra/Features/Decompiler/ghidra_scripts/RecoveredClassUtils.java
rename to Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassUtils.java
index 3e24f35320..19cbb4e621 100644
--- a/Ghidra/Features/Decompiler/ghidra_scripts/RecoveredClassUtils.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassUtils.java
@@ -13,6 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package classrecovery;
+/* ###
+ * 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.
+ */
+//DO NOT RUN. THIS IS NOT A SCRIPT! THIS IS A CLASS THAT IS USED BY SCRIPTS.
import java.util.*;
import java.util.stream.Collectors;
@@ -4299,7 +4316,7 @@ public class RecoveredClassUtils {
}
}
- // align the structure then add it to the data type manager
+ // pack the structure then add it to the data type manager
vftableStruct.setPackingEnabled(true);
vftableStruct = (Structure) dataTypeManager.addDataType(vftableStruct,
DataTypeConflictHandler.DEFAULT_HANDLER);