Solved

Rpc binding vector

Posted on 1998-03-31
3
309 Views
Last Modified: 2006-11-17
In microsoft rpc Rpc_Binding_vector  is a data structure, defined in header  rpcdce.h. It contains two elements, 1. count  showing number of binding handles in binding handle array 2. array of binding handles
In include file rpcdce.h the array size has been given as 1.
My doubt is it any way possible for a binding vector to have more than one binding handle ? if yes how?
0
Comment
Question by:sudhir033198
  • 3
3 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 20 total points
ID: 1257967
Of course it is!
Example comming...

0
 
LVL 11

Expert Comment

by:alexo
ID: 1257968
Let's take the following structure as an example:

    struct X
    {
        long count;
        int elements[1];
    };

The thing to remember is that the difference between "real macho" languages like C and wimpy Wirth languages is that in C it is legal, moral and accepted to lie to the compiler.
C allows accessing out-of-bounds array elements.  The following code is legal:

    struct X x;
    x.elements[0] = x.elements[42] = x.elements[-1000];

The compiler will happily generate code to access the n'th element, whatever n is.
So, the tricky part is allocating enough elements.  Static and automatic allocations will not work (obviously) but then, there's malloc().

Let's write a function that will return a pointer to a dynamically allocated structure with n elements (modulo typing errors):

    struct X * AllocateStruct(int n)
    {
        struct X *p = (struct X *) malloc(sizeof(long) + n * sizeof(int));
        p->count = n;
        return p;
    }

And use it thus:

    struct X *px;
    px = AllocateStruct(100);
    /* Do some stuff involving px */
    free(px);

OK?
0
 
LVL 11

Expert Comment

by:alexo
ID: 1257969
Hello???
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now