Using Pinvoke with Char*

So I had a c++ .dll that I wanted to use in my program. I was told that

this was the header

extern “C” __declspec(dllimport)void  getPassword(char *inputString, char *outputString);

After much reading/researching/testing I finally got this to work.

Imports System.Runtime.InteropServices
Imports System.Text

<DllImport(“c:\\Password.dll”)> _
Public Shared Sub getPassword(ByVal inputString As StringBuilder, ByVal outputString As StringBuilder)

Dim input As String = “testing”
Dim result As New StringBuilder
Dim send As New StringBuilder(input)

getPassword(send, result)

The trick was using the StringBuilders for the Char*

OWA keeps asking for credentials microsoft exchange 2003

I don’t know why it kept asking the user for credentials, it was only doing it on a cellular modem connection wifi would work just fine. When I had the user start using a https:// connection it became rock solid. So the solution use SSL. Weird.