Obtains extended context information.
DWORD ctaGetContextInfoEx ( CTAHD ctahd, CTA_CONTEXT_INFOEX * info)
|
Argument |
Description |
|
ctahd |
Context handle. |
|
info |
Pointer to the CTA_CONTEXT_INFOEX structure: typedef struct |
|
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. |
ctaGetContextInfoEx obtains extended information including a list of services opened on the context specified by the ctahd parameter.
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;
}