Allright. I changed the strings in the declaration to intptr. This is what I'm using to call the function. The function is still working but it's still giving me that memory error and not giving me the return value.
Dim pCommand As IntPtr
pCommand = Marshal.StringToCoTaskMemAnsi("10.1.0.100 REBOOT")
Dim encodedBytes As Byte() = Encoding.UTF8.GetBytes("10.1.0.100 REBOOT")
Marshal.Copy(encodedBytes, 0, pCommand, encodedBytes.Length)
Dim pReply As New IntPtr
pReply = Marshal.StringToCoTaskMemAnsi("")
Dim encodedBytes2 As Byte() = Encoding.UTF8.GetBytes("")
Marshal.Copy(encodedBytes2, 0, pReply, encodedBytes2.Length)
Dim pSaveFile As IntPtr
pSaveFile = Marshal.StringToCoTaskMemAnsi("")
Dim encodedBytes3 As Byte() = Encoding.UTF8.GetBytes("")
Marshal.Copy(encodedBytes3, 0, pSaveFile, encodedBytes3.Length)
Dim pKeyFile As New IntPtr
pKeyFile = Marshal.StringToCoTaskMemAnsi(strKeyFile)
Dim encodedBytes4 As Byte() = Encoding.UTF8.GetBytes(strKeyFile)
Marshal.Copy(encodedBytes4, 0, pKeyFile, encodedBytes4.Length)
Dim pKeyPhrase As IntPtr
pKeyPhrase = Marshal.StringToCoTaskMemAnsi(strPass)
Dim encodedBytes5 As Byte() = Encoding.UTF8.GetBytes(strPass)
Marshal.Copy(encodedBytes5, 0, pKeyPhrase, encodedBytes5.Length)
Dim px As New IntPtr
px = Marshal.StringToCoTaskMemAnsi("")
Dim encodedBytes6 As Byte() = Encoding.UTF8.GetBytes("")
Marshal.Copy(encodedBytes6, 0, px, encodedBytes6.Length)
Try
Dim i As String = SendCommand(pCommand, Convert.ToByte("200"), 100, 0, 0, 3, px, pKeyFile, pKeyPhrase, px, pReply, 65535)
MsgBox("good")
Catch ex As Exception
MsgBox(ex.Message)
End Try