Subject Problem with isc_service_attach
Author

I need to retrieve the connected users but can't get isc_service_attach to work in Fb2.5 - I have a set of api calls working with Firebird 1.5 api but am failing at the first hurdle with Firebird 2 service api. I am using Delhpi XE5, Firebird 2.5 64bit on Win 8.1 with the ibase.h from FB2.5 \include. I must be doing something really stupid, but can't see it. If anyone could point it out to me I would be very grateful. Code snippet below. Thank you in advance.


Type

{$IFDEF WIN64}

ISC_LONG = Integer;

{$ELSE}

ISC_LONG = Longint;

{$ENDIF}

ISC_STATUS = ISC_LONG;

ISC_STATUS_VECTOR = array[0..19] of ISC_STATUS;

Tisc_svc_handle = Pointer;

Pisc_svc_handle = ^Tisc_svc_handle;


Var

SPB : array[0..127] of Char;

SPBLength : Short;

SvcHandle : Pisc_svc_handle;

Status_Vector: ISC_STATUS_VECTOR;


begin


fillchar(SPB, sizeof(SPB), #0);

SPB[0] := char(isc_spb_version) ;

SPB[1] := char(isc_spb_current_version) ;

SPBLength := 2;

BuildPBString(SPB, SPBLength, isc_spb_user_name, 'sysdba');

BuildPBString(SPB, SPBLength, isc_spb_password, 'masterke');


SvcHandle := nil;


isc_service_attach( @Status_Vector, 0, Pchar('service_mgr'), @SvcHandle, SPBLength, @SPB );


// SPB Data

//SPB = (#2, #2, #$1C, #6, 'S', 'Y', 'S', 'D', 'B', 'A', #$1D, #8, 'm', 'a', 's', 't', 'e', 'r', 'k', 'e', #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0, #0)


// isc_spb_version = 2

// isc_spb_current_version = 2

// isc_spb_user_name = 28

// isc_spb_password =29


end;