' ########################################################################################
' Microsoft Windows
' File: srv.inc
' Contents: Open Data Services
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
'// Avoid double inclusion
#IF NOT %DEF(PBX_srv_PBI)
#DEFINE PBX_srv_PBI
%EQUATE `SRV_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
#INCLUDE ONCE "Legacy/Data/odbcss.inc"
'// ODS uses pack(4) on all CPU types
'#pragma pack(4)
'//------------------------------------------------------------
'// Formats of data types
'#if !defined(DBTYPEDEFS) // Do not conflict with DBLIB definitions
'#if !defined(MAXNUMERICLEN) // Do not conflict with ODBC definitions
'#define DBTYPEDEFS
'typedef unsigned char DBBOOL;
'typedef unsigned char DBBYTE;
'typedef unsigned char DBTINYINT;
'typedef short DBSMALLINT;
'typedef unsigned short DBUSMALLINT;
'typedef long DBINT;
'typedef char DBCHAR;
'typedef unsigned char DBBINARY;
'typedef unsigned char DBBIT;
'typedef double DBFLT8;
'typedef struct srv_datetime
'{ // Format for SRVDATETIME
' long dtdays; // number of days since 1/1/1900
' unsigned long dttime; // number 300th second since mid
'} DBDATETIME;
'typedef struct srv_money
'{ // Format for SRVMONEY
' long mnyhigh;
' unsigned long mnylow;
'} DBMONEY;
'typedef float DBFLT4;
'typedef long DBMONEY4;
'typedef struct dbdatetime4
'{ // Format for SRVDATETIM4
' unsigned short numdays; // number of days since 1/1/1900
' unsigned short nummins; // number of minutes sicne midnight
'} DBDATETIM4;
'#define MAXNUMERICLEN 16
'typedef struct dbnumeric
'{ // Format for SRVNUMERIC,SRVNUMERICN,SRVDECIMAL,SRVDECIMALN
' BYTE precision;
' BYTE scale;
' BYTE sign;
' BYTE val[MAXNUMERICLEN];
'} DBNUMERIC;
'typedef DBNUMERIC DBDECIMAL;
'#endif // #if !defined(MAXNUMERICLEN)
'#endif // #if !defined( DBTYPEDEFS )
'//------------------------------------------------------------
'// Constants used by APIs
'// Type Tokens
%EQUATE `SRV_TDS_NULL = &H1f
%EQUATE `SRV_TDS_TEXT = &H23
%EQUATE `SRV_TDS_GUID = &H24
%EQUATE `SRV_TDS_VARBINARY = &H25
%EQUATE `SRV_TDS_INTN = &H26
%EQUATE `SRV_TDS_VARCHAR = &H27
%EQUATE `SRV_TDS_BINARY = &H2d
%EQUATE `SRV_TDS_IMAGE = &H22
%EQUATE `SRV_TDS_CHAR = &H2f
%EQUATE `SRV_TDS_INT1 = &H30
%EQUATE `SRV_TDS_BIT = &H32
%EQUATE `SRV_TDS_INT2 = &H34
%EQUATE `SRV_TDS_DECIMAL = &H37
%EQUATE `SRV_TDS_INT4 = &H38
%EQUATE `SRV_TDS_DATETIM4 = &H3a
%EQUATE `SRV_TDS_FLT4 = &H3b
%EQUATE `SRV_TDS_MONEY = &H3c
%EQUATE `SRV_TDS_DATETIME = &H3d
%EQUATE `SRV_TDS_FLT8 = &H3e
%EQUATE `SRV_TDS_NUMERIC = &H3f
%EQUATE `SRV_TDS_SSVARIANT = &H62
%EQUATE `SRV_TDS_NTEXT = &H63
%EQUATE `SRV_TDS_BITN = &H68
%EQUATE `SRV_TDS_DECIMALN = &H6a
%EQUATE `SRV_TDS_NUMERICN = &H6c
%EQUATE `SRV_TDS_FLTN = &H6d
%EQUATE `SRV_TDS_MONEYN = &H6e
%EQUATE `SRV_TDS_DATETIMN = &H6f
%EQUATE `SRV_TDS_MONEY4 = &H7a
%EQUATE `SRV_TDS_INT8 = &H7f
%EQUATE `SRV_TDS_BIGVARBINARY = &HA5
%EQUATE `SRV_TDS_BIGVARCHAR = &HA7
%EQUATE `SRV_TDS_BIGBINARY = &HAD
%EQUATE `SRV_TDS_BIGCHAR = &HAF
%EQUATE `SRV_TDS_NVARCHAR = &He7
%EQUATE `SRV_TDS_NCHAR = &Hef
'// Datatypes
'// Also: values of symbol parameter to srv_symbol when type = SRV_DATATYPE
%EQUATE `SRVNULL = %SRV_TDS_NULL
%EQUATE `SRVTEXT = %SRV_TDS_TEXT
%EQUATE `SRVGUID = %SRV_TDS_GUID
%EQUATE `SRVVARBINARY = %SRV_TDS_VARBINARY
%EQUATE `SRVINTN = %SRV_TDS_INTN
%EQUATE `SRVVARCHAR = %SRV_TDS_VARCHAR
%EQUATE `SRVBINARY = %SRV_TDS_BINARY
%EQUATE `SRVIMAGE = %SRV_TDS_IMAGE
%EQUATE `SRVCHAR = %SRV_TDS_CHAR
%EQUATE `SRVINT1 = %SRV_TDS_INT1
%EQUATE `SRVBIT = %SRV_TDS_BIT
%EQUATE `SRVINT2 = %SRV_TDS_INT2
%EQUATE `SRVDECIMAL = %SRV_TDS_DECIMAL
%EQUATE `SRVINT4 = %SRV_TDS_INT4
%EQUATE `SRVDATETIM4 = %SRV_TDS_DATETIM4
%EQUATE `SRVFLT4 = %SRV_TDS_FLT4
%EQUATE `SRVMONEY = %SRV_TDS_MONEY
%EQUATE `SRVDATETIME = %SRV_TDS_DATETIME
%EQUATE `SRVFLT8 = %SRV_TDS_FLT8
%EQUATE `SRVNUMERIC = %SRV_TDS_NUMERIC
%EQUATE `SRVSSVARIANT = %SRV_TDS_SSVARIANT
%EQUATE `SRVNTEXT = %SRV_TDS_NTEXT
%EQUATE `SRVBITN = %SRV_TDS_BITN
%EQUATE `SRVDECIMALN = %SRV_TDS_DECIMALN
%EQUATE `SRVNUMERICN = %SRV_TDS_NUMERICN
%EQUATE `SRVFLTN = %SRV_TDS_FLTN
%EQUATE `SRVMONEYN = %SRV_TDS_MONEYN
%EQUATE `SRVDATETIMN = %SRV_TDS_DATETIMN
%EQUATE `SRVMONEY4 = %SRV_TDS_MONEY4
%EQUATE `SRVINT8 = %SRV_TDS_INT8
%EQUATE `SRVBIGVARBINARY = %SRV_TDS_BIGVARBINARY
%EQUATE `SRVBIGVARCHAR = %SRV_TDS_BIGVARCHAR
%EQUATE `SRVBIGBINARY = %SRV_TDS_BIGBINARY
%EQUATE `SRVBIGCHAR = %SRV_TDS_BIGCHAR
%EQUATE `SRVNVARCHAR = %SRV_TDS_NVARCHAR
%EQUATE `SRVNCHAR = %SRV_TDS_NCHAR
'// values for srv_symbol type parameter
%EQUATE `SRV_ERROR = 0
%EQUATE `SRV_DONE = 1
%EQUATE `SRV_DATATYPE = 2
%EQUATE `SRV_EVENT = 4
'// values for srv_symbol symbol parameter, when type = SRV_ERROR
%EQUATE `SRV_ENO_OS_ERR = 0
%EQUATE `SRV_INFO = 1
%EQUATE `SRV_FATAL_PROCESS = 10
%EQUATE `SRV_FATAL_SERVER = 19
'// Types of server events
'// Also: values for srv_symbol symbol parameter, when type = SRV_EVENT
%EQUATE `SRV_CONTINUE = 0
%EQUATE `SRV_LANGUAGE = 1
%EQUATE `SRV_CONNECT = 2
%EQUATE `SRV_RPC = 3
%EQUATE `SRV_RESTART = 4
%EQUATE `SRV_DISCONNECT = 5
%EQUATE `SRV_ATTENTION = 6
%EQUATE `SRV_SLEEP = 7
%EQUATE `SRV_START = 8
%EQUATE `SRV_STOP = 9
%EQUATE `SRV_EXIT = 10
%EQUATE `SRV_CANCEL = 11
%EQUATE `SRV_SETUP = 12
%EQUATE `SRV_CLOSE = 13
%EQUATE `SRV_PRACK = 14
%EQUATE `SRV_PRERROR = 15
%EQUATE `SRV_ATTENTION_ACK = 16
%EQUATE `SRV_CONNECT_V7 = 16 ' // TDS type for TDS 7 clients. Overloaded with SRV_ATTENTION_ACK
%EQUATE `SRV_SKIP = 17
%EQUATE `SRV_TRANSMGR = 18
%EQUATE `SRV_PRELOGIN = 19
%EQUATE `SRV_OLEDB = 20
%EQUATE `SRV_INTERNAL_HANDLER = 99
%EQUATE `SRV_PROGRAMMER_DEFINED = 100
'// values for srv_sfield field parameter
%EQUATE `SRV_SERVERNAME = 0
%EQUATE `SRV_VERSION = 6
'// Length to indicate string is null terminated
%EQUATE `SRV_NULLTERM = -1
'// values of msgtype parameter to srv_sendmsg
%EQUATE `SRV_MSG_INFO = 1
%EQUATE `SRV_MSG_ERROR = 2
'// values of status parameter to srv_senddone
'// Also: values for symbol parameters to srv_symbol when type = SRV_DONE
%EQUATE `SRV_DONE_FINAL = &H0000
%EQUATE `SRV_DONE_MORE = &H0001
%EQUATE `SRV_DONE_ERROR = &H0002
%EQUATE `SRV_DONE_COUNT = &H0010
%EQUATE `SRV_DONE_RPC_IN_BATCH = &H0080
'// return values of srv_paramstatus
%EQUATE `SRV_PARAMRETURN = &H0001
%EQUATE `SRV_PARAMDEFAULT = &H0002
%EQUATE `SRV_PARAMSORTORDER = &H0004
'// return values of srv_rpcoptions
%EQUATE `SRV_RECOMPILE = &H0001
%EQUATE `SRV_NOMETADATA = &H0002
'// values of field parameter to srv_pfield
'//%SRV_LANGUAGE 1 already defined above
'//%SRV_EVENT 4 already defined above
%EQUATE `SRV_SPID = 10
%EQUATE `SRV_NETSPID = 11
%EQUATE `SRV_TYPE = 12
%EQUATE `SRV_STATUS = 13
%EQUATE `SRV_RMTSERVER = 14
%EQUATE `SRV_HOST = 15
%EQUATE `SRV_USER = 16
%EQUATE `SRV_PWD = 17
%EQUATE `SRV_CPID = 18
%EQUATE `SRV_APPLNAME = 19
%EQUATE `SRV_TDS = 20
%EQUATE `SRV_CLIB = 21
%EQUATE `SRV_LIBVERS = 22
%EQUATE `SRV_ROWSENT = 23
%EQUATE `SRV_BCPFLAG = 24
%EQUATE `SRV_NATLANG = 25
%EQUATE `SRV_PIPEHANDLE = 26
%EQUATE `SRV_NETWORK_MODULE = 27
%EQUATE `SRV_NETWORK_VERSION = 28
%EQUATE `SRV_NETWORK_CONNECTION = 29
%EQUATE `SRV_LSECURE = 30
%EQUATE `SRV_SAXP = 31
%EQUATE `SRV_UNICODE_USER = 33
%EQUATE `SRV_UNICODE_PWD = 35
%EQUATE `SRV_SPROC_CODEPAGE = 36
%EQUATE `SRV_MSGLCID = 37
%EQUATE `SRV_INSTANCENAME = 38
%EQUATE `SRV_HASHPWD = 39
%EQUATE `SRV_UNICODE_CURRENTLOGIN = 40
'// return value of SRV_TDSVERSION macro
%EQUATE `SRV_TDS_NONE = 0
%EQUATE `SRV_TDS_2_0 = 1
%EQUATE `SRV_TDS_3_4 = 2
%EQUATE `SRV_TDS_4_2 = 3
%EQUATE `SRV_TDS_6_0 = 4
%EQUATE `SRV_TDS_7_0 = 5
'// Return values from APIs
'typedef int SRVRETCODE; // SUCCEED or FAIL
'#ifndef ODBCVER
'typedef int RETCODE;
'#endif
'#if !defined( SUCCEED )
'%SUCCEED = 1 // Successful return value
'#endif
'#if !defined( FAIL )
'%FAIL = 0 // Unsuccessful return value
'#endif
%EQUATE `SRV_DUPLICATE_HANDLER = 2 ' // additional return value for srv_pre/post_handle
'//------------------------------------------------
'//PreDeclare structures
'//
'struct srv_server;
'typedef struct srv_server SRV_SERVER;
'struct srv_config;
'typedef struct srv_config SRV_CONFIG;
'struct CXPData;
'typedef struct CXPData SRV_PROC;
'//------------------------------------------------
'//------------------------------------------------
'// ODS MACROs & APIs
'// Describing and sending a result set
DECLARE FUNCTION srv_describe CDECL LIB "opends60.dll" ALIAS "srv_describe" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL colnumber AS LONG ' int colnumber , BYREF column_name AS ASCIIZ ' DBCHAR * column_name , BYVAL namelen AS LONG ' int namelen , BYVAL desttype AS LONG ' DBINT desttype , BYVAL destlen AS LONG ' DBINT destlen , BYVAL srctype AS LONG ' DBINT srctype , BYVAL srclen AS LONG ' DBINT srclen , BYREF srcdata AS ANY ' void * srcdata ) AS LONG ' int
DECLARE FUNCTION srv_setutype CDECL LIB "opends60.dll" ALIAS "srv_setutype" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL column AS LONG ' int column , BYVAL user_type AS LONG ' DBINT user_type ) AS LONG ' int
DECLARE FUNCTION srv_setcoldata CDECL LIB "opends60.dll" ALIAS "srv_setcoldata" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL column AS LONG ' int column , BYREF data AS ANY ' void * data ) AS LONG ' int
DECLARE FUNCTION srv_setcollen CDECL LIB "opends60.dll" ALIAS "srv_setcollen" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL column AS LONG ' int column , BYVAL len AS LONG ' int len ) AS LONG ' int
DECLARE FUNCTION srv_sendrow CDECL LIB "opends60.dll" ALIAS "srv_sendrow" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS LONG ' int
DECLARE FUNCTION srv_senddone CDECL LIB "opends60.dll" ALIAS "srv_senddone" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL status AS WORD ' DBUSMALLINT status , BYVAL info AS WORD ' DBUSMALLINT info , BYVAL count AS LONG ' DBINT count ) AS LONG ' int
'// Dealing with Extended Procedure parameters
DECLARE FUNCTION srv_rpcparams CDECL LIB "opends60.dll" ALIAS "srv_rpcparams" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS LONG ' int
DECLARE FUNCTION srv_paraminfo CDECL LIB "opends60.dll" ALIAS "srv_paraminfo" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL n AS LONG ' int n , BYREF pbType AS BYTE ' BYTE * pbType , BYREF pcbMaxLen AS QUAD ' ULONG * pcbMaxLen , BYREF pcbActualLen AS QUAD ' ULONG * pcbActualLen , BYVAL pbData AS BYTE PTR ' BYTE * pbData , BYREF pfNull AS LONG ' BOOL * pfNull ) AS LONG ' int
DECLARE FUNCTION srv_paramsetoutput CDECL LIB "opends60.dll" ALIAS "srv_paramsetoutput" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL n AS LONG ' int n , BYVAL pbData AS BYTE PTR ' BYTE * pbData , BYVAL cbLen AS QUAD ' ULONG cbLen , BYVAL fNull AS LONG ' BOOL fNull ) AS LONG ' int
DECLARE FUNCTION srv_paramdata CDECL LIB "opends60.dll" ALIAS "srv_paramdata" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL n AS LONG ' int n ) AS QUAD ' void*
DECLARE FUNCTION srv_paramlen CDECL LIB "opends60.dll" ALIAS "srv_paramlen" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL n AS LONG ' int n ) AS LONG ' int
DECLARE FUNCTION srv_parammaxlen CDECL LIB "opends60.dll" ALIAS "srv_parammaxlen" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL n AS LONG ' int n ) AS LONG ' int
DECLARE FUNCTION srv_paramtype CDECL LIB "opends60.dll" ALIAS "srv_paramtype" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL n AS LONG ' int n ) AS LONG ' int
DECLARE FUNCTION srv_paramset CDECL LIB "opends60.dll" ALIAS "srv_paramset" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL n AS LONG ' int n , BYREF data AS ANY ' void * data , BYVAL len AS LONG ' int len ) AS LONG ' int
DECLARE FUNCTION srv_paramname CDECL LIB "opends60.dll" ALIAS "srv_paramname" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL m AS LONG ' int n , BYREF len AS LONG ' int * len ) AS QUAD ' char*
DECLARE FUNCTION srv_paramnumber CDECL LIB "opends60.dll" ALIAS "srv_paramnumber" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYREF name AS ASCIIZ ' DBCHAR * name , BYVAL namelen AS LONG ' int namelen ) AS LONG ' int
'//--------------------------------------------------------------
'//--------------------------------------------------------------
'// The rest of these APIs are still supported, in SQL Server 7.0,
'// but may not be supported after SQL Server 7.0
'// MACROs
'#define SRV_GETSERVER(a) srv_getserver ( a )
'#define SRV_GOT_ATTENTION(a) srv_got_attention ( a )
'#define SRV_TDSVERSION(a) srv_tdsversion ( a )
DECLARE FUNCTION srv_getserver CDECL LIB "opends60.dll" ALIAS "srv_getserver" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS QUAD ' SRV_SERVER*
DECLARE FUNCTION srv_got_attention CDECL LIB "opends60.dll" ALIAS "srv_got_attention" ( BYVAL srvproc AS QUAD ) AS LONG ' SRV_PROC * srvproc
'// Memory
DECLARE FUNCTION srv_alloc CDECL LIB "opends60.dll" ALIAS "srv_alloc" ( BYVAL ulSize AS LONG ' long int ulSize ) AS QUAD ' void*
DECLARE FUNCTION srv_bmove CDECL LIB "opends60.dll" ALIAS "srv_bmove" ( BYREF from AS ANY ' void* from , BYREF to AS ANY ' void* to , BYVAL count AS LONG ' long int count ) AS LONG ' int
DECLARE FUNCTION srv_bzero CDECL LIB "opends60.dll" ALIAS "srv_bzero" ( BYREF location AS ANY ' void* location , BYVAL count AS LONG ' long int count ) AS LONG ' int
DECLARE FUNCTION srv_free CDECL LIB "opends60.dll" ALIAS "srv_free" ( BYVAL ptr AS QUAD ' void * ptr ) AS LONG ' int
DECLARE FUNCTION srv_convert CDECL LIB "opends60.dll" ALIAS "srv_convert" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL srctype AS LONG ' int srctype , BYREF src AS ANY ' void * src , BYVAL srclen AS LONG ' DBINT srclen , BYVAL desttype AS LONG ' int desttype , BYREF dest AS ANY ' void * dest , BYVAL destlen AS LONG ' DBINT destlen ) AS LONG ' int
DECLARE FUNCTION srv_getuserdata CDECL LIB "opends60.dll" ALIAS "srv_getuserdata" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS QUAD ' void*
DECLARE FUNCTION srv_getbindtoken CDECL LIB "opends60.dll" ALIAS "srv_getbindtoken" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYREF token_buf AS ASCIIZ ' char* token_buf ) AS LONG ' int
DECLARE FUNCTION srv_getdtcxact CDECL LIB "opends60.dll" ALIAS "srv_getdtcxact" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYREF ppv AS ANY ' void ** ppv ) AS LONG ' int
'typedef int (* EventHandler)(void *);
DECLARE FUNCTION srv_impersonate_client CDECL LIB "opends60.dll" ALIAS "srv_impersonate_client" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS LONG ' int
DECLARE FUNCTION srv_langcpy CDECL LIB "opends60.dll" ALIAS "srv_langcpy" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL start AS LONG ' long start , BYVAL nbytes AS LONG ' long nbytes , BYREF buffer AS ASCIIZ ' char* buffer ) AS LONG ' long
DECLARE FUNCTION srv_langlen CDECL LIB "opends60.dll" ALIAS "srv_langlen" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS LONG ' long
DECLARE FUNCTION srv_langptr CDECL LIB "opends60.dll" ALIAS "srv_langptr" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS QUAD ' void*
DECLARE FUNCTION srv_log CDECL LIB "opends60.dll" ALIAS "srv_log" ( BYVAL server AS QUAD ' SRV_SERVER * server , BYVAL datestamp AS LONG ' BOOL datestamp , BYREF msg AS ASCIIZ ' char * msg , BYVAL msglen AS LONG ' int msglen ) AS LONG ' int
DECLARE FUNCTION srv_paramstatus CDECL LIB "opends60.dll" ALIAS "srv_paramstatus" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL n AS LONG ' int n ) AS LONG ' int
DECLARE FUNCTION srv_pfieldex CDECL LIB "opends60.dll" ALIAS "srv_pfieldex" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL field AS LONG ' int field , BYREF len AS LONG ' int * len ) AS QUAD ' void*
DECLARE FUNCTION srv_pfield CDECL LIB "opends60.dll" ALIAS "srv_pfield" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL field AS LONG ' int field , BYREF len AS LONG ' int * len ) AS QUAD ' char*
DECLARE FUNCTION srv_returnval CDECL LIB "opends60.dll" ALIAS "srv_returnval" ( BYREF valuename AS ASCIIZ ' char * valuename , BYVAL len AS LONG ' int len , BYVAL status AS BYTE ' BYTE status , BYVAL type AS LONG ' long int type , BYVAL maxlen AS LONG ' long int maxlen , BYVAL datalen AS LONG ' long int datalen , BYREF value AS ANY ' void * value ) AS LONG ' int
DECLARE FUNCTION srv_revert_to_self CDECL LIB "opends60.dll" ALIAS "srv_revert_to_self" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS LONG ' int
DECLARE FUNCTION srv_rpcdb CDECL LIB "opends60.dll" ALIAS "srv_rpcdb" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL len AS LONG ' int * len ) AS QUAD ' char*
DECLARE FUNCTION srv_rpcname CDECL LIB "opends60.dll" ALIAS "srv_rpcname" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL len AS LONG ' int * len ) AS QUAD ' char*
DECLARE FUNCTION srv_rpcnumber CDECL LIB "opends60.dll" ALIAS "srv_rpcnumber" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS LONG ' int
DECLARE FUNCTION srv_rpcoptions CDECL LIB "opends60.dll" ALIAS "srv_rpcoptions" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS WORD ' USHORT
DECLARE FUNCTION srv_rpcowner CDECL LIB "opends60.dll" ALIAS "srv_rpcowner" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL len AS LONG ' int * len ) AS QUAD ' char*
DECLARE FUNCTION srv_wsendmsg CDECL LIB "opends60.dll" ALIAS "srv_wsendmsg" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL msgnum AS LONG ' long int msgnum , BYVAL msgclass AS BYTE ' BYTE msgclass , BYREF message AS WSTRINGZ ' WCHAR * message // message text , BYVAL msglen AS LONG ' int msglen // length of message text ) AS LONG ' int
DECLARE FUNCTION srv_sendmsg CDECL LIB "opends60.dll" ALIAS "srv_sendmsg" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL msgtype AS LONG ' int msgtype , BYVAL msgnum AS LONG ' long int msgnum , BYVAL msgclass AS BYTE ' BYTE msgclass , BYVAL state AS BYTE ' BYTE state , BYREF rpcname AS ASCIIZ ' char * rpcname , BYVAL rpcnamelen AS LONG ' int rpcnamelen , BYVAL linenum AS WORD ' USHORT linenum , BYREF message AS ASCIIZ ' char * message , BYVAL msglen AS LONG ' int msglen ) AS LONG ' int
DECLARE FUNCTION srv_sendstatus CDECL LIB "opends60.dll" ALIAS "srv_sendstatus" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL status AS LONG ' long int status ) AS LONG ' int
DECLARE FUNCTION srv_setuserdata CDECL LIB "opends60.dll" ALIAS "srv_setuserdata" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYREF ptr AS ANY ' void * ptr ) AS LONG ' int
DECLARE FUNCTION srv_sfield CDECL LIB "opends60.dll" ALIAS "srv_sfield" ( BYVAL server AS QUAD ' SRV_SERVER * server , BYVAL field AS LONG ' int field , BYREF len AS LONG ' int * len ) AS QUAD ' char*
DECLARE FUNCTION srv_symbol CDECL LIB "opends60.dll" ALIAS "srv_symbol" ( BYVAL type AS LONG ' int type , BYVAL symbol AS LONG ' int symbol , BYREF len AS LONG ' int * len ) AS QUAD ' char*
DECLARE FUNCTION srv_tdsversion CDECL LIB "opends60.dll" ALIAS "srv_tdsversion" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS LONG ' int
DECLARE FUNCTION srv_willconvert CDECL LIB "opends60.dll" ALIAS "srv_willconvert" ( BYVAL srctype AS LONG ) AS LONG ' int srctype , BYVAL desttype AS LONG ' int desttype
DECLARE FUNCTION srv_terminatethread CDECL LIB "opends60.dll" ALIAS "srv_terminatethread" ( BYVAL srvproc AS QUAD ) AS LONG 'SRV_PROC * srvproc int
DECLARE FUNCTION srv_sendstatistics CDECL LIB "opends60.dll" ALIAS "srv_sendstatistics" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS LONG ' int
DECLARE FUNCTION srv_clearstatistics CDECL LIB "opends60.dll" ALIAS "srv_clearstatistics" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc ) AS LONG ' int
DECLARE FUNCTION srv_message_handler CDECL LIB "opends60.dll" ALIAS "srv_message_handler" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL errornum AS LONG ' int errornum , BYVAL severity AS BYTE ' BYTE severity , BYVAL state AS BYTE ' BYTE state , BYVAL oserrnum AS LONG ' int oserrnum , BYREF errtext AS ASCIIZ ' char * errtext , BYVAL errtextlen AS LONG ' int errtextlen , BYREF oserrtext AS ASCIIZ ' char * oserrtext , BYVAL oserrtextlen AS LONG ' int oserrtextlen ) AS LONG ' int
DECLARE FUNCTION srv_pre_handle CDECL LIB "opends60.dll" ALIAS "srv_pre_handle" ( BYVAL server AS QUAD ' SRV_SERVER * server , BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL event AS LONG ' long int event , BYVAL handler AS QUAD ' EventHandler handler , BYVAL remove AS LONG ' BOOL remove ) AS LONG ' int
DECLARE FUNCTION srv_post_handle CDECL LIB "opends60.dll" ALIAS "srv_post_handle" ( BYVAL server AS QUAD ' SRV_SERVER * server , BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL event AS LONG ' long int event , BYVAL handler AS QUAD ' EventHandler handler , BYVAL remove AS LONG ' BOOL remove ) AS LONG ' int
DECLARE FUNCTION srv_IgnoreAnsiToOem CDECL LIB "opends60.dll" ALIAS "srv_IgnoreAnsiToOem" ( BYVAL srvproc AS QUAD ' SRV_PROC * srvproc , BYVAL bTF AS LONG ' BOOL bTF ) AS LONG ' int
'#pragma pack()
%EQUATE `SS_MAJOR_VERSION = 7
%EQUATE `SS_MINOR_VERSION = 00
%EQUATE `SS_LEVEL_VERSION = 0000
$SS_MINIMUM_VERSION = "7.00.00.0000"
'#define ODS_VERSION ((SS_MAJOR_VERSION << 24) | (SS_MINOR_VERSION << 16))
%EQUATE `ODS_VERSION = 7000000
'//////////////////////////////////////////////////////////////////
'// Suggested implementation of __GetXpVersion
'//
'//__declspec(dllexport) ULONG __GetXpVersion()
'// {
'// return ODS_VERSION;
'// }
'//////////////////////////////////////////////////////////////////
#ENDIF
