¿Cómo hacer la autenticación NTLM usando Indy 10 en Delphi 7?

Quiero realizar la autenticación NTLM con componentes de Indy 10 en Delphi 7. Aquí está mi código fuente:

 uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs ,StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdHTTP,IdAuthenticationSSPI , IdAuthentication , IdAuthenticationDigest , IdHeaderList;

procedure TForm1.Button1Click(Sender: TObject);
begin
   Memo1.Lines.add(   IdHTTP1.Get('http://www.google.co.in'));
end;

procedure TForm1.IdHTTP1ProxyAuthorization(Sender: TObject;
      Authentication: TIdAuthentication; var Handled: Boolean);
var
   UserName: string;
   UserNameLen: Dword;
begin
   Authentication.Username := 'xxxxx';
   Authentication.Password := 'xxxx';
   Handled := False;  // Tried setting it to True , No Changes in error
End;


 procedure TForm1.IdHTTP1SelectProxyAuthorization(Sender: TObject;
     var AuthenticationClass: TIdAuthenticationClass;
    AuthInfo: TIdHeaderList);
 begin
   // First check for NTLM authentication, as you do not need to
  // set username and password because Indy will automatically   
  // handle passing your Windows Domain username and
  // password to the proxy server
  if (pos('Proxy-Authenticate: NTLM', idHTTP1.Response.RawHeaders.Text)>0) then
  begin
    idHTTP1.ProxyParams.Clear;
    idHTTP1.ProxyParams.BasicAuthentication := false;
   // Set the authentication class to NTLM
    //idhttp1.auth
     AuthenticationClass := TIdSSPINTLMAuthentication;
  end
  else
  begin
    // Next check for Basic
    if (pos('Proxy-Authenticate: Basic', idHTTP1.Response.RawHeaders.Text)>0) then
    begin
      AuthenticationClass := TIdBasicAuthentication;
      idHTTP1.ProxyParams.BasicAuthentication := true;
   end
   else
   begin
      // Then Digest
      if (pos('Proxy-Authenticate: Digest', idHTTP1.Response.RawHeaders.Text)>0) then
         AuthenticationClass := TIdDigestAuthentication
   end;
   end;
   idHTTP1.ProxyParams.ProxyUsername := 'xxxx';
   idHTTP1.ProxyParams.ProxyPassword := 'xxxx';
  end;

Según lo que leí en Internet, también modifiqué el código fuente de IdHttp.pas a lo siguiente:

 function TIdCustomHTTP.DoOnProxyAuthorization(ARequest: TIdHTTPRequest; AResponse: TIdHTTPResponse):      Boolean;
var
   i: Integer;
   S: string;
   Auth: TIdAuthenticationClass;
begin
   Inc(FAuthProxyRetries);
   if not Assigned(ProxyParams.Authentication) then
   begin
     // Find which Authentication method is supported from us.
      i := 0;
     while i < AResponse.ProxyAuthenticate.Count do
     begin
        S := AResponse.ProxyAuthenticate[i];
     try
        Auth := FindAuthClass(Fetch(S));
        break;
     except
     end;
     inc(i);
   end;

   if i = AResponse.ProxyAuthenticate.Count then
   begin
      result := false;
     exit;
   end;

   if Assigned(FOnSelectProxyAuthorization) then
   begin
      OnSelectProxyAuthorization(self, Auth, AResponse.ProxyAuthenticate);
   end;

   {    ProxyParams.Authentication := Auth.Create;
   end;

   result := Assigned(OnProxyAuthorization);

  // Clear password and reset autorization if previous failed
   if (AResponse.FResponseCode = 407) then begin
       ProxyParams.ProxyPassword := '';
       ProxyParams.Authentication.Reset;
    end; }
    /// *** Changes Start **** ////
    if Assigned(Auth) then
   begin
      ProxyParams.Authentication := Auth.Create;
    end;
  end;

  result := Assigned(ProxyParams.Authentication)  and  Assigned(OnProxyAuthorization);

  // Clear password and reset autorization if previous failed
  if ((AResponse.FResponseCode = 407) and
      (not (ProxyParams.Authentication is TIdSSPINTLMAuthentication))) then
  begin
     ProxyParams.ProxyPassword := '';
     if Assigned(ProxyParams.Authentication) then
     begin
       ProxyParams.Authentication.Reset;
     end;
  End;
   //// **** Changes end *** /////
  if Result then
  begin
   with ProxyParams.Authentication do
   begin
     Username := ProxyParams.ProxyUsername;
     Password := ProxyParams.ProxyPassword;

    AuthParams := AResponse.ProxyAuthenticate;
  end;

result := false;

repeat
  case ProxyParams.Authentication.Next of
    wnAskTheProgram: // Ask the user porgram to supply us with authorization information
      begin
        if Assigned(OnProxyAuthorization) then
        begin
          ProxyParams.Authentication.Username := ProxyParams.ProxyUsername;
          ProxyParams.Authentication.Password := ProxyParams.ProxyPassword;

          OnProxyAuthorization(self, ProxyParams.Authentication, result);

          if result then begin
            ProxyParams.ProxyUsername := ProxyParams.Authentication.Username;
            ProxyParams.ProxyPassword := ProxyParams.Authentication.Password;
          end
          else begin
            break;
          end;
        end;
      end;
    wnDoRequest:
      begin
        result := true;
        break;
      end;
    wnFail:
      begin
        result := False;
        Break;
      end;
  end;
until false;
// *** Changes start *** ///
If Result then
begin
  Response.KeepAlive := ProxyParams.Authentication.KeepAlive;
end;
///*** Changes End *** ///

fin; fin;

Todavía estoy recibiendo un error de autorización de proxy 407. ¿Puede alguien guiarme en lo que estoy haciendo mal?

Gracias por adelantado

Respuestas a la pregunta(1)

Su respuesta a la pregunta