I have a little problem with marshaling.
I have a structure :
public class virConnectCredential
public virConnectCredentialType type;
public IntPtr prompt;
public IntPtr challenge;
public IntPtr defresult;
public IntPtr result;
public uint resultlen;
the "result" member is a string. I have made the choice to pass strings between native and managed via IntPtr.
This structure is passed to a function via an IntPtr (In and Out). The goal is to fill the "result" member of the structure Like this :
private static int AuthCallback(IntPtr creds, UInt32 ncred, IntPtr cbdata)
virConnectCredential vcc = (virConnectCredential)Marshal.PtrToStructure(creds, typeof(virConnectCredential));
// Put toto in the result member
View Complete Post