[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)]
public struct XEDPARSE
{
public int x64; // use 64-bit instructions
public UInt64 cip; //instruction pointer (for relative addressing)
public int dest_size; //destination size (returned by XEDParse)
public int cbUnknown;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = XEDPARSE_MAXASMSIZE)]
public string dest; //destination buffer
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = XEDPARSE_MAXBUFSIZE)]
public string instr; //instruction text
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = XEDPARSE_MAXBUFSIZE)]
public string error; //error text (in case of an error)
};
[DllImport("XEDParse.dll", EntryPoint = "XEDParseAssemble",CallingConvention = CallingConvention.Cdecl)]
static extern int XEDParseAssemble(ref XEDPARSE xedparse);
void Test()
{
XEDPARSE parse = new XEDPARSE();
parse.x64 = 0;
parse.cip = 0;
parse.instr = @"mov esp, ebp";
int result=XEDParseAssemble(ref parse);
;
}