Ok hook types
This commit is contained in:
parent
cde5c7c313
commit
947165067c
|
@ -8,7 +8,7 @@ undefined FUN_00401320(void); // 00401320 // FUN_00401320 // cdecl
|
|||
undefined r3_windowUnlockCursor(void); // 004013a0 // r3_windowUnlockCursor // cdecl
|
||||
|
||||
// 004025e0
|
||||
long r3_windowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
||||
long __stdcall r3_windowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
||||
|
||||
{
|
||||
long lVar1;
|
||||
|
|
|
@ -133,7 +133,8 @@ public class FunctionDumper {
|
|||
|
||||
// Extract calling convention from Ghidra function
|
||||
String callingConventionName = externalFunction.getCallingConventionName();
|
||||
FunctionDatabase.CallingConvention callingConvention = FunctionDatabase.CallingConvention.fromString(callingConventionName);
|
||||
FunctionDatabase.CallingConvention callingConvention = FunctionDatabase.CallingConvention
|
||||
.fromString(callingConventionName);
|
||||
script.println("Detected calling convention: " + callingConventionName + " -> " + callingConvention);
|
||||
|
||||
try (PrintWriter writer2 = new PrintWriter(f4, "UTF-8")) {
|
||||
|
@ -212,7 +213,8 @@ public class FunctionDumper {
|
|||
|
||||
// Extract calling convention from Ghidra function
|
||||
String callingConventionName = function.getCallingConventionName();
|
||||
FunctionDatabase.CallingConvention callingConvention = FunctionDatabase.CallingConvention.fromString(callingConventionName);
|
||||
FunctionDatabase.CallingConvention callingConvention = FunctionDatabase.CallingConvention
|
||||
.fromString(callingConventionName);
|
||||
script.println("Detected calling convention: " + callingConventionName + " -> " + callingConvention);
|
||||
|
||||
// Handle forceFixType flag
|
||||
|
@ -290,6 +292,17 @@ public class FunctionDumper {
|
|||
List<Function> externalFunctionCalls = new ArrayList<>();
|
||||
HashMap<String, String> replacementMap = new HashMap<>();
|
||||
|
||||
String newFunctionName = sanitizedFunctionName;
|
||||
if (callingConvention != FunctionDatabase.CallingConvention.Stdcall ||
|
||||
callingConvention != FunctionDatabase.CallingConvention.Fastcall) {
|
||||
newFunctionName = callingConventionName + " " + newFunctionName;
|
||||
}
|
||||
|
||||
String originalFunctionName = function.getName();
|
||||
if (newFunctionName != originalFunctionName) {
|
||||
replacementMap.put(originalFunctionName, newFunctionName);
|
||||
}
|
||||
|
||||
DecompileResults decompRes = RemanConfig.INSTANCE.decompCache.getOrInsert(function);
|
||||
try (PrintWriter writer2 = new PrintWriter(f0, "UTF-8")) {
|
||||
writer2.println("// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! ");
|
||||
|
@ -316,11 +329,6 @@ public class FunctionDumper {
|
|||
// Parse preliminary line tokens
|
||||
for (int i = 0; i < line.getNumTokens(); i++) {
|
||||
ClangToken token = line.getToken(i);
|
||||
// Remove some of the calling conventions, keep __stdcall/fastcall
|
||||
if (token.getText().equals("__cdecl") || token.getText().equals("__thiscall")) {
|
||||
// Remove function declaration
|
||||
continue;
|
||||
}
|
||||
if (!token.getText().isEmpty())
|
||||
tokens.add(token);
|
||||
}
|
||||
|
@ -421,7 +429,7 @@ public class FunctionDumper {
|
|||
String proto = externalFunction.getSignature().getPrototypeString(false);
|
||||
String name = externalFunction.getName();
|
||||
proto = proto.replace(name, Utils.sanitizeIdentifier(name));
|
||||
|
||||
|
||||
// Add calling convention information to the comment
|
||||
String callingConv = externalFunction.getCallingConventionName();
|
||||
FunctionDatabase.CallingConvention conv = FunctionDatabase.CallingConvention.fromString(callingConv);
|
||||
|
|
Loading…
Reference in New Issue