ADO Database Delphi

Title: MS SQL Extended Stored Procedures Tutorial (Part 5)
Question: Now that we have defined a XP DLL template in Part 4 we will use it to rewrite xp_ValidateUser from Part 2 into a vastly more readable and maintable unit.
Compare the code in this article to that in Part 2.
Copy the DLL to the Server and install with
sp_addextendedproc 'xp_ValidateUser2','xp_ValidateSSPI_Temp.dll'
That concludes the basics of writing Extended Stored Procedures for MS SQL Server. Have fun playing with and harnessing the power and flexibility of XP's
Answer:
library xp_ValidateSSPI_Temp;
uses SysUtils,Classes,ValLogonW2000,MsOdsApi,MahMsSqlXP;
{$R *.res}
// ==================================================================
// It is highly recommended that all Microsoft SQL Server 7.0
// and greater Extended Stored Procedure DLLs implement
// and export __GetXpVersion.
// ==================================================================
function _GetXpVersion : longword; cdecl;
begin
Result := ODS_VERSION;
end;
// ===================================================================
// Main MS SQL Function Entry Point
// ===================================================================
function xp_ValidateUser2(ASrvProc : SRV_PROC) : SRVRETCODE; cdecl;
var oXProc : TXpStoredProc;
iResult : SRVRETCODE;
iError : integer;
begin
oXProc := TXpStoredProc.Create(ASrvProc,'xp_ValidateUser2',
['User','Domain','Password'],
['Valid']);
if not oXProc.Errors then begin
if LogonUserSSPI(oXProc.Params[0],oXProc.Params[1],
oXProc.Params[2],iError) then
oXProc.AddResultRow(['Y'])
else
oXProc.AddResultRow(['N']);
iresult := oXProc.CreateResultSet;
end
else
iResult := XP_ERROR;
FreeAndNil(oXProc);
Result := iResult;
end;
// =============================================================================
// Export declarations
// =============================================================================
exports xp_ValidateUser2,
_GetXpVersion;
begin
end.