???????this???????????????
????CInterface *pInterface = new CInterface;
????DWORD base_proc = (*((DWORD *)(pInterface))); //??????
????DWORD f1 = *(( DWORD *)base_proc); //??1??
????DWORD f2 = *(( DWORD *)(base_proc + 4)); //??2??
????DWORD f3 = *(( DWORD *)(base_proc + 8)); //??????
???????????????SAFEARRAY ????????У???????C#?С?
??????????C#???????????????????????????????С???????楨?й?????й?????????????????????????
???????????к???????
//??? ???????? this??? ?????????? ????
delegate void testcall(int pthis?? int pfun?? int param);
byte[] codetest = {
// 0xCC??
0x8B?? 0x5C?? 0x24?? 0x0C?? //mov ebx??[esp+0Ch] ?????????? @@
0x8B?? 0x44?? 0x24?? 0x08?? //mov eax??[esp+08h] ???????
0x8B?? 0x4C?? 0x24?? 0x04?? //mov ecx??[esp+04h] this ???
0x53?? //push ebx ??????? @@
0xFF?? 0xD0?? //call eax
0xC3 // ret
};
??????д??????????????????????????????????????????????????????????????????????????????????á??????????????????д???????????????????????????????????????????????????????VC?У?ALT+8???????????????????ɡ?
????????????У??????????????????????????????β?????????????
????????@@?????????????????????????????
?????????д????????棬????????У???????????????????
????????????????ε??????????????????
????VirtualAlloc??????????????????????????氡
????Marshal.Copy(codetest?? 0?? handle?? codetest.Length);
????testcall Customer = Marshal.GetDelegateForFunctionPointer(handle?? typeof(testcall)) as testcall;
????int bb = 22;
????Customer (fun[0]?? fun[4]?? bb);
?????????????????????????????????????
????3. ??
??????????????????в???????δ?????????????????????????????????????????????????????????????????????? int?????????У????????????????????????????????????漰????????????顢???????Щ?????????????????鷳????????????????????????????????????
???????ж??????????????????????????????????push???????????????????????push?????????????????????????????????????
?????????????????????????????????????????(?????????????)?????????д??????????????????????????β?????????????????????????Щ????????????????????????????????????????????????飬??????????????C#?к????char???飬??????д????????????????????????????С??????????
????????????
????????????
???????????ж??????????????????VB???C#???WPF???????3D????????????????????????????????
????????????????????????????????????????????????????
????????????????????????????á?
??????????????????????????òο???????????????????
????http://topic.csdn.net/u/20090225/15/a6bc50ad-9721-4749-b189-dc4a4bc045a1.html