G
Guest
hi,
I import a funtion fromm dll file:
dll function header :
DWORD WINAPI
Enumerate(
HANDLE hWDMHandle,
PNDIS_STATUS pNStatus,
PWCHAR pBuffer,
PUINT pBufferSize
)
in C# should be:
[DllImport("MyAPIdll", SetLastError=true)]
private static extern unsafe ulong Enumerate (
IntPtr g_hPCASIMHandle,
ulong* pNStatus,
void* pBuffer,
uint* pBufferSize);
und aufgerufen:
[CSHARP]
byte[] buf = new byte[2024];
uint iBytesRead = 0;
ulong ioResult;
ulong ndis_status;
uint buffsize;
unsafe
{
// create a void pointer to buf
fixed (void* pBuffer = buf)
{
ioResult=Enumerate(this.m_iHandle,
&ndis_status,pBuffer,&buffsize);
}
So how can i read buf or convert it to string ?
I import a funtion fromm dll file:
dll function header :
DWORD WINAPI
Enumerate(
HANDLE hWDMHandle,
PNDIS_STATUS pNStatus,
PWCHAR pBuffer,
PUINT pBufferSize
)
in C# should be:
[DllImport("MyAPIdll", SetLastError=true)]
private static extern unsafe ulong Enumerate (
IntPtr g_hPCASIMHandle,
ulong* pNStatus,
void* pBuffer,
uint* pBufferSize);
und aufgerufen:
[CSHARP]
byte[] buf = new byte[2024];
uint iBytesRead = 0;
ulong ioResult;
ulong ndis_status;
uint buffsize;
unsafe
{
// create a void pointer to buf
fixed (void* pBuffer = buf)
{
ioResult=Enumerate(this.m_iHandle,
&ndis_status,pBuffer,&buffsize);
}
So how can i read buf or convert it to string ?