daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
  2. public struct UserProfileData
  3. {
  4.     int userProfileRevision;
  5.     [MarshalAs(UnmanagedType.LPStr)]
  6.     public String firstName;
  7.     [MarshalAs(UnmanagedType.LPStr)]
  8.     public String lastName;
  9.     [MarshalAs(UnmanagedType.LPStr)]
  10.     public String memberids;
  11.     [MarshalAs(UnmanagedType.LPStr)]
  12.     public String emailAddress;
  13. }
  14.    
  15. typedef struct userProfile
  16. {
  17.     int profileRevision;
  18.     char *firstName;
  19.     char *lastName;
  20.     char *memberids;
  21.     char *emailAddress;
  22. } userProfile_t;
  23.    
  24. int getUserProfileData(userProfile_t *pUserProfile);
  25.    
  26. [StructLayout(LayoutKind.Sequential)]
  27. public struct UserProfileData
  28. {
  29.     int userProfileRevision;
  30.     public IntPtr firstName;
  31.     public IntPtr lastName;
  32.     public IntPtr memberids;
  33.     public IntPtr emailAddress;
  34. }
  35.    
  36. [DllImport(@"mydll.dll", CallingConvention=CallingConvention.???)]
  37. private static extern int getUserProfileData(out UserProfileData userProfile);
  38.    
  39. string firstName = Marshal.PtrToStringAnsi(userProfile.firstName);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top