function GetAuthBuf(InBuf: Pointer; InBufLength: integer; var OutBuf: Pointer; var OutBufLength: integer): boolean; stdcall; public unsafe class NTLM { [DllImport("NTLM.dll")] public static extern bool GetAuthBuf(byte[] InBuf, int InBufLength, out byte[] OutBuf, out int OutBufLength); NTLM() { } } byte[] chlbuf = new byte[] { 0x4e, .... 0x00}; byte[] OutBuf; int OutBufLength; if (!NTLM.GetAuthBuf(chlbuf, chlbuf.Length, out OutBuf, out OutBufLength)) return;