StrOut: Dynamically Allocated Strings with [out] Attribute

This sample demonstrates how to allocate memory at a server for a two-dimensional object (an array of pointers) and pass it back to the client as an [out]-only parameter. The client then frees the memory. This technique allows the stub to call the server without knowing in advance how much data will be returned.

This program also allows the user to compile either for UNICODE or ANSI.

Main Files

File Description
Strout.idl Interface definition language file
Strout.acf Attribute configuration file
Client.c Client main program
Server.c Server main program
Common.h Common header file for all the files
Remote.c Remote procedures
Makefile Nmake file to build 32-bit client and server applications, for ANSI characters
Makefile.uni Nmake file to build 32-bit client and server applications, for UNICODE characters

Building SDK Samples

This sample uses the following keywords:

_tcscmp; _tcscpy; _tcslen; _tprintf; cleanupserver; commandlinetoargvw; defined; exit; exit_if_fail; free; getcommandline; getenvironmentstrings; getremoteenv; malloc; midl_user_allocate; midl_user_free; ndrclientinitializenew; ndrconvert; ndrfcshort; ndrfreebuffer; ndrgetbuffer; ndrpointerbuffersize; ndrpointerfree; ndrpointermarshall; ndrpointerunmarshall; ndrsendreceive; ndrserverinitializenew; rpcbindingfromstringbinding; rpcexcept; rpcexceptioncode; rpcmgmtstopserverlistening; rpcraiseexception; rpcserverlisten; rpcserverregisterif; rpcserverunregisterif; rpcserveruseprotseqep; rpcstringbindingcompose; shutdown; strout_sample_getremoteenv; strout_sample_shutdown; text; usage