[DllImport("rapi.dll")]
public static extern void CeRapiInitEx(ref RAPIINIT pRapiInit);
[StructLayout(LayoutKind.Sequential)]
public struct RAPIINIT
{
public int cbsize;
public IntPtr heRapiInit;
public UInt32 hrRapiInit;
};
HRESULT translates to void (NOT int or anything else some idiot has written down) for c# function prototypes. Any HRESULT other than "OK" will cause the runtime to throw an exception.
function info on msdn at http://msdn.microsoft.com/en-us/library/aa458381.aspx
Please add some!
RAPIINIT r = new RAPIINIT();
r.cbsize = Marshal.SizeOf(r);
CeRapiInitEx(ref r);
//r.hrRapiInit==0 indicates succes