sample:
/*****************************************************************
NAME: xp_sendmymsg
*****************************************************************/
// This is an extended procedure DLL built with Open Data
// The Transact-SQL script xp_sendmymsg.sql installs and exercises the extended
// stored procedure.
// send XP main
RETCODE __declspec(dllexport) xp_sendmymsg(SRV_PROC *pSrvProc)
{
BYTE bType;
ULONG cbMaxLen;
ULONG cbActualLen;
BOOL fNull;
char* target;
int eventID;
char* str;
STS status;
static io_type io = channel;
// get the number of input parameters. There should be three.
if (srv_rpcparams(pSrvProc) != 3)
{
// Send error message and return
//
printUsage (pSrvProc);
return (XP_ERROR);
}
//Retrieve 1st input parameter (io handle name)
if (srv_paraminfo(pSrvProc, 1, &bType, &cbMaxLen, &cbActualLen,
NULL, &fNull) == FAIL)
{
printError (pSrvProc, "srv_paraminfo failed 1");
return (XP_ERROR);
}
// If there's data, then allocate memory and get it.
if (fNull == 0)
{
target = (char *) malloc(cbActualLen+1);
if (target == NULL)
{
printError (pSrvProc, "Memory allocation error 1");
return (XP_ERROR);
}