Is there a way to remove unused variables from a struct?
See the question and my original answer on StackOverflowOf course it can work, in the end, it's just an opaque array of bytes, but you must make sure the whole structure size is the same and matches the current hardware/software context, so, just define it like this for an x86 process:
[StructLayout(LayoutKind.Explicit, Size = 716)] // size is 716 for x86
internal struct X86Context
{
[FieldOffset(0)]
internal uint ContextFlags;
[FieldOffset(184)]
internal IntPtr Eip;
}