in my project i'm currently working on i stumbled upon this problem:
I want to create a Instance of the Class "ApiID". I got the Code from Reflector, as you can see the .dll (not my Project) imports is from ummanaged code, which i don't have access to.
[StructLayout(LayoutKind.Sequential, Size=0x10), CLSCompliant(false), NativeCppClass, DebugInfoInPDB, MiscellaneousBits(0x40)]
public struct ApiId
{
private long <alignment member>;
public static unsafe void <MarshalCopy>(ApiId* idPtr1, ApiId* idPtr2)
{
ApiId.{ctor}(idPtr1, (ApiId modopt(IsConst)* modopt(IsImplicitlyDereferenced)) idPtr2);
}
public static unsafe void <MarshalDestroy>(ApiId* idPtr1)
{
ApiId.{dtor}(idPtr1);
}
}
My C#-Code looks like this:
var _apiId = new ApiId();
long vlue = 0x0000000041403070;
typeof(ApiId).GetField("<alignment member>", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(_apiId, vlue);
The Code Runs succesfully, but the Field does not change and stays 0... what am I doing wrong? greetings