这是我在这里的第一个问题,所以请不要对我太苛刻:)
我得到的是:
具有C#代码的混合模式C# dll,该代码反过来调用同一dll中的本机方法,这是我感兴趣的。
召唤:
int num3 = <Module>.fn_GetBitArray((byte*)(&$ArrayType$$$BY0DC@E), (byte*)(&$ArrayType$$$BY05E2), ref nHardwareType);作为IL
IL_0117: stind.i1
IL_0118: ldloca.s 9
IL_011a: ldloca.s 8
IL_011c: ldloca.s 7
IL_011e: call uint32 modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl) '<Module>'::fn_GetBitArray(uint8*, uint8*, uint32* modopt([mscorlib]System.Runtime.CompilerServices.IsImplicitlyDereferenced) )定义如下(ILSpy)
// <Module>
[SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.Unmanaged | MethodImplOptions.PreserveSig)]
public unsafe static extern uint fn_GetBitArray(byte*, byte*, uint*);我不确定如何从这里继续。当我在IDA中加载它时,我可以选择.NET加载器,在那里我可以看到所有的C#代码和调用,但不能看到“外部”函数的偏移量,然后我可以选择x86模式,但所有函数都是通过(sub_XXXXXXXX)编号的,所以我需要偏移量。
问:我如何找出这个调用是如何被解析的,以及如何检索目标函数?
PS:我非常确定它真的不是导入的,因为没有其他dll包含函数名称字符串(编写了一个快速工具来按十六进制模式进行搜索),并且所有导入都与其他内容相关。关于IL,ollydbg也把我搞得一团糟,正常的c/c++很好,但是(可能是次要问题)我如何在那里找到IL函数的名称?!
提前感谢您的宝贵时间
greetz WV
发布于 2016-03-23 17:08:52
在环顾四周后,解决方案很容易。是的,代码在不同的位置加载,但段偏移量是相同的。所以我使用了ILDASM并加载了dll,我的函数现在说:
.method public static pinvokeimpl(/* No map */)
uint32 modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl)
fn_GetBitArray(uint8* A_0,
uint8* A_1,
uint32* modopt([mscorlib]System.Runtime.CompilerServices.IsImplicitlyDereferenced) A_2) native unmanaged preservesig
{
.custom instance void [mscorlib]System.Security.SuppressUnmanagedCodeSecurityAttribute::.ctor() = ( 01 00 00 00 )
// Embedded native code
// Disassembly of native methods is not supported.
// Managed TargetRVA = 0x0003FD80
} // end of method 'Global Functions'::fn_GetBitArray所以我去IDA找到了0x1003FD80,多好啊^^
https://stackoverflow.com/questions/36157788
复制相似问题