How do you read RPC_PROTSEQ_VECTOR

the structure of RPC_PROTSEQ_VECTOR is:

1
2
3
4
typedef struct _RPC_PROTSEQ_VECTOR {
  unsigned long Count;
  unsigned char *Protseq[1];
} RPC_PROTSEQ_VECTOR;


How do I read the data?
How do I display a list of available protocol sequences?
After quickly doing an experiment, I conclude that you simply access as many array elements as Count says.

1
2
3
4
5
6
7
8
9
10
RPC_PROTSEQ_VECTORA *pData = NULL;
RPC_STATUS r = RpcNetworkInqProtseqsA(&pData);
if (r == RPC_S_OK)
{
    for (int i = 0; i < pData->Count; ++i)
    {
        std::cout << pData->Protseq[i] << std::endl;
    }
    RpcProtseqVectorFree(&pData);
}
Last edited on
Thanks for the reply!
A couple issues though.

Although pData->Count returns a 5 (5 protocols available), pData->Protseq[i] simply returns 'n' which I believe is the first character of the protocol sequence.

fyi the environment I am working in does not allow for 'std::cout'. I have to convert everything to a char* or a wchar_t* to output it. Could this be my problem.

For instance, my code looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
	RPC_PROTSEQ_VECTOR *ProtSeqVector = NULL;
	status = RpcNetworkInqProtseqs(&ProtSeqVector);
	if(status==RPC_S_OK)		RhinoApp().Print("RpcNetworkInqProtseqs = SUCCESS!!!\n");
	if(status==RPC_S_NO_PROTSEQS)	RhinoApp().Print("RpcNetworkInqProtseqs = No supported protocol sequences.\n");

	int pCount = ProtSeqVector->Count;
	for (int i = 0; i < pCount; ++i)	
    {
    RhinoApp().Print("Protseq = ");
    RhinoApp().Print((char*)ProtSeqVector->Protseq[i]);
    RhinoApp().Print("\n");
    }


And it returns this:

RpcNetworkInqProtseqs = SUCCESS!!!
Protseq = n
Protseq = n
Protseq = n
Protseq = n
Protseq = n
RpcBindingFromStringBinding = The protocol sequence is not valid.

Each of those 'n' should be a different RPC Protocol sequence like "ncacn_ip_tcp".
Last edited on
You must do 2 things:

1. You must read my reply in this thread: http://www.cplusplus.com/forum/general/56526/
2. You must re-read my code above and carefully note the letter "A" at the end of RPC_PROTSEQ_VECTORA and at the end of RpcNetworkInqProtseqsA().

If you did #1 then it should be obvious now that you can change the ending "A" for an ending "W" and obtain wide strings instead of ANSI strings if so you desire.
Got it. I added the 'A' and it worked!

I noticed the 'A' before but assumed that was predetermined in one of my header files.
I also don't understand why there is no reference to RPC_PROTSEQ_VECTORA on the MSDN.

I am swimming in the deep end and your help is appreciated!!!

RPC people are hard to find so I was hoping I could turn your attention to another question I have:

http://cplusplus.com/forum/general/58121/

Thanks.
eb
webJose:

Forget the last post!!!

When tweeking my code I accidentally generated an error which referenced ''RpcStringBindingComposeW' so as per your instructions (sort of) I went back into my code and added 'A' to my other RPC function calls (RpcStringBindingCompose, RpcStringBindingParse and RpcBindingFromStringBinding) and changed all my RPC_WSTR types to RPC_CSTR and SUCCESS!!!

Thanks again!!!!!!!!
Topic archived. No new replies allowed.