# ctaGetContextInfoEx

Obtains extended context information.

#### Prototype

DWORD ctaGetContextInfoEx ( CTAHD ctahd, CTA_CONTEXT_INFOEX * info)

Argument | Description
ctahd | Context handle.
info | Pointer to the CTA_CONTEXT_INFOEX structure: typedef struct { CTAQUEUEHD ctaqueuehd; /* Natural Access queue handle */ unsigned userid; /* Userid passed back in events */ char contextname[CTA_CONTEXT_NAME_LEN]; /* Context name */ char* svcnames; /* Returned service names */ /* terminated by 0, with an */ /* extra 0 at the end */ unsigned size; /* Size of svcnames buffer */ } CTA_CONTEXT_INFOEX;

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | Invalid info or ctahd parameter.
CTAERR_NOT_IMPLEMENTED | This function is not available in the execution mode associated with the specified context.
CTAERR_NOT_INITIALIZED | Natural Access is not initialized. Call ctaInitialize first.
CTAERR_SVR_COMM | Server communication error.

#### Details

ctaGetContextInfoEx obtains extended information including a list of services opened on the context specified by the ctahd parameter.

#### See also

ctaGetContextInfo

#### Example

int DemoContextInfoEx(CTAHD ctahd)
{
DWORD ret;
unsigned i;
char* p;
CTA_CONTEXT_INFOEX info;
info.svcnames = (char*) malloc(1024);
info.size = 1024;
ret = ctaGetContextInfoEx(ctahd,&info);
if ( ret != SUCCESS )
{
free(info.svcnames);
return ret;
}
printf("Context name: %s \n", info.contextname);
p = info.svcnames;
for (i = 0; i < info.size; i++)
{
if (*(info.svcnames + i) == 0)
{
if (*(info.svcnames + i + 1) == 0 ||
i == 0)
break;
printf("Service: %s\n",p);
p = info.svcnames + i + 1;
}
}
free(info.svcnames);
return SUCCESS;
}