从c#导出VirtualChannelGetInstance函数

时间:2015-06-15 11:19:31

标签: c# virtual-channel wtsapi32

我想从C#导出此函数:

HRESULT VCAPITYPE VirtualChannelGetInstance(
 _In_    REFIID refiid,
 _Inout_ ULONG  *pNumObjs,
 _Out_   VOID   **ppObjArray
);

我尝试过以下代码:

public static uint VirtualChannelGetInstance(IntPtr refiid, ref uint pNumObjs, ref IntPtr[] ppObjArray)  
{
      MessageBox.Show("VirtualChannelGetInstance ");
      return 0; 
}

问题是当调用来自C#的导出函数时,我总是得到nullreference异常。可能有什么问题?

1 个答案:

答案 0 :(得分:0)

我通过更改VirtualChannelGetInstance声明来实现此目的:

public static uint VirtualChannelGetInstance(Guid refiid, ref ulong pNumObjs, void** ppObjArray)