G
Guest
hey all
i need to convert an unmanaged c++ dll and header to c#, ive done the header
structures but having problems with pinvoke signatures
method 1:
typedef int (_stdcall *pOmniConnect) (char * IpAddress,
unsigned int Port,
unsigned int Timeout,
unsigned char EncryptionKey[16],
HWND NotifyWindow);
IpAddress - ip as ascii string
Port - udp port as int
Timeout - in seconds 0-60
EncryptionKey - 16 byte binary of encryption key. formed from 2, 8 byte hex
inputs as a single 16 byte binary
NotifyWindow - window handle that gets reponses
ive converted that into
[DllImport("HAI_NetLib.dll", EntryPoint="_OmniConnect")]
private static extern int OmniConnect([MarshalAs(UnmanagedType.LPStr)]
string ipAddress, int port, int timeOut, [MarshalAs(UnmanagedType.LPStr)]
Byte encryptionKey, IntPtr hwnd);
when i test it i get
'the exception unknown software exception (0x0eedfade) occurred in the
application at location 0x77e649d3.'
ive tried changing UnmanagedType and even tried StringBuilder ipAddress, but
doesnt seem to work.
any ideas?
thanks
i need to convert an unmanaged c++ dll and header to c#, ive done the header
structures but having problems with pinvoke signatures
method 1:
typedef int (_stdcall *pOmniConnect) (char * IpAddress,
unsigned int Port,
unsigned int Timeout,
unsigned char EncryptionKey[16],
HWND NotifyWindow);
IpAddress - ip as ascii string
Port - udp port as int
Timeout - in seconds 0-60
EncryptionKey - 16 byte binary of encryption key. formed from 2, 8 byte hex
inputs as a single 16 byte binary
NotifyWindow - window handle that gets reponses
ive converted that into
[DllImport("HAI_NetLib.dll", EntryPoint="_OmniConnect")]
private static extern int OmniConnect([MarshalAs(UnmanagedType.LPStr)]
string ipAddress, int port, int timeOut, [MarshalAs(UnmanagedType.LPStr)]
Byte encryptionKey, IntPtr hwnd);
when i test it i get
'the exception unknown software exception (0x0eedfade) occurred in the
application at location 0x77e649d3.'
ive tried changing UnmanagedType and even tried StringBuilder ipAddress, but
doesnt seem to work.
any ideas?
thanks