Add method to find a PInvoke method
This commit is contained in:
parent
bff017a317
commit
60c98cc944
|
@ -382,6 +382,22 @@ namespace de4dot.blocks {
|
|||
return method != null && method.FullName == returnType + " " + method.DeclaringType.FullName + "::" + method.Name + parameters;
|
||||
}
|
||||
|
||||
public static bool hasPinvokeMethod(TypeDefinition type, string methodName) {
|
||||
return getPInvokeMethod(type, methodName) != null;
|
||||
}
|
||||
|
||||
public static MethodDefinition getPInvokeMethod(TypeDefinition type, string methodName) {
|
||||
if (type == null)
|
||||
return null;
|
||||
foreach (var method in type.Methods) {
|
||||
if (method.PInvokeInfo == null)
|
||||
continue;
|
||||
if (method.PInvokeInfo.EntryPoint == methodName)
|
||||
return method;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MethodDefinition getPInvokeMethod(TypeDefinition type, string dll, string funcName) {
|
||||
foreach (var method in type.Methods) {
|
||||
if (isPinvokeMethod(method, dll, funcName))
|
||||
|
|
Loading…
Reference in New Issue
Block a user