kk aw wrote: > Unfortunately FUserName is still blank. I must be missing something.
Sorry, I missunderstood your question, if you just want to extract the username from NTLM message #3 you could do that Q&D like below. NtlmMsg below includes a unicode username "Zaphod". BTW: The NTLM message #3 you posted has an empty username. uses OverbyteIcsNtlmMsgs, OverbyteIcsMimeUtils; const NtlmMsg = 'TlRMTVNTUAADAAAAGAAYAHIAAAAYABgAigAAABQAFABAAAAADAAMAFQAAAAS'#13#10 + 'ABIAYAAAAAAAAACiAAAAAYIAAFUAUgBTAEEALQBNAEkATgBPAFIAWgBhAHAA'#13#10 + 'aABvAGQATABJAEcASABUAEMASQBUAFkArYfKbe/jRoW5xDxHeoxC1gBmfWiS'#13#10 + '5+iX4OAN4xBKG/IFPwfH3agtPEia6YnhsADT'; function UCS2ToString(const S: String): String; begin if Length(S) < 2 then Result := '' else begin SetLength(Result, Length(S)); if WideCharToMultiByte(CP_ACP, 0, @S[1], Length(S), @Result[1], Length(Result), nil, nil) = 0 then RaiseLastOSError else SetLength(Result, StrLen(PChar(Result))); end; end; procedure TForm1.Button1Click(Sender: TObject); type PNTLM_Message3 = ^TNTLM_Message3; var Msg3 : TNTLM_Message3; S1, S2 : String; begin S1 := Base64Decode(NtlmMsg); Msg3 := PNTLM_Message3(@S1[1])^; if Msg3.MsgType = 3 then begin S2 := Copy(S1, Msg3.User.Offset + 1, Msg3.User.Length); ShowMessage('Username=' + UCS2ToString(S2)); end; end; Length and Flag checks skipped in this sample, function UCS2ToString converts unicode to ansi using current system code page, which is not reliable. More info: http://www.innovation.ch/personal/ronald/ntlm.html -- Arno Garrels _______________________________________________ Delphi mailing list -> Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi