관리되지 않는 함수를 호출하려고합니다. 나는에 의해 C++에서라고했습니다 이 날BYTE * C#의 배열
// ConsoleApplication5.cpp : main project file.
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <string>
using namespace System;
typedef int(*Funcs)(int, BYTE (*)[90], BYTE (*)[90]);
int main(array<System::String ^> ^args)
{
BYTE Input[] =
{
0x7f,0x06,0x02,0x66,0xd2,0x3e,0x4c,0x7f,0x50,0x0a,0x5a,0x3c,0xab,0x43,0x5d,0x51,0x47,0xe5,0 x94,0x49,0xbd,0xef,0xc2,0xe4
,0x6c,0xb1,0x3b,0x3d,0x7c,0x47,0x65,0x8f,0x67,0xa6,0xe8,0x6a,0xe9,0x0e,0xbd,0x93,0xad,0x4a, 0x31,0x68,0x82,0x02,0xe6,0x7e,0x01,0x36,0xa,
9,0x75,0xf7,0xa0,0xb9,0xe9,0x1b,0x09,0xba,0x19,0x8c,0x97,0x18,0x9c,0xcc,0xd8,0x87,0x0e,0x04 ,0xb3,0x7c,0xc2,0xbf,0x1e,0x42,0x3e,0x8b,0x64,0xf5,0x60,0x43,0x96,0xe7,0xf6,0x7d,0x54,0x84, 0x54,0x00
};
BYTE OutPut[90];
Funcs Funcis;
HMODULE x = LoadLibrary(L"E:\\Games\\Silkroad\\HackShield\\ehsvc.dll");
Funcis = (Funcs)GetProcAddress(x,"16");
Funcis(13,&Input,&OutPut);
FILE * pFile;
pFile = fopen ("myfile.bin", "wb");
fwrite (OutPut , sizeof(char), sizeof(OutPut), pFile);
fclose (pFile);
Console::Read();
}
을하지만 난으로 C#에서 호출 할 때 작업 테스트 프로젝트입니다 :
delegate int GetResponseD(int Code, byte[] Input, byte[] OutPut);
...
IntPtr hModule = LoadLibrary(@"###.dll");
IntPtr hFunc = GetProcAddress(hModule, "10");
GetResponseD Get = (GetResponseD)Marshal.GetDelegateForFunctionPointer(hFunc, typeof(GetResponseD));
GetResponse(13, Input, OutPut);
내가 첫 번째 바이트를 얻을에만
위임자의 매개 변수에 적절한'MarshaAs' 속성을 사용해 보셨습니까? – Corey
누가 C에서 두 개의 배열을 할당합니까? 발신자? – xanatos
Not Working Sorry – user2529018