- Code/Resource
- Windows Develop
- Linux-Unix program
- Internet-Socket-Network
- Web Server
- Browser Client
- Ftp Server
- Ftp Client
- Browser Plugins
- Proxy Server
- Email Server
- Email Client
- WEB Mail
- Firewall-Security
- Telnet Server
- Telnet Client
- ICQ-IM-Chat
- Search Engine
- Sniffer Package capture
- Remote Control
- xml-soap-webservice
- P2P
- WEB(ASP,PHP,...)
- TCP/IP Stack
- SNMP
- Grid Computing
- SilverLight
- DNS
- Cluster Service
- Network Security
- Communication-Mobile
- Game Program
- Editor
- Multimedia program
- Graph program
- Compiler program
- Compress-Decompress algrithms
- Crypt_Decrypt algrithms
- Mathimatics-Numerical algorithms
- MultiLanguage
- Disk/Storage
- Java Develop
- assembly language
- Applications
- Other systems
- Database system
- Embeded-SCM Develop
- FlashMX/Flex
- source in ebook
- Delphi VCL
- OS Develop
- MiddleWare
- MPI
- MacOS develop
- LabView
- ELanguage
- Software/Tools
- E-Books
- Artical/Document
REPASCU.C
Package: MSDN_VC98.zip [view]
Upload User: bangxh
Upload Date: 2007-01-31
Package Size: 42235k
Code Size: 4k
Category:
Windows Develop
Development Platform:
Visual C++
- /****************************************************************************
- Microsoft RPC Version 2.0
- Copyright Microsoft Corp. 1992, 1993, 1994- 1996
- repas Example
- FILE: repasu.c
- PURPOSE: Utility functions used by both client and server
- sides of the RPC distributed application.
- This sample demonstrates the transmit_as example.
- A doubly-linked list is transmitted over the network
- as a sized array.
- RELATED: repass.c - server main
- repasp.c - remote procedures
- repasc.c - client main
- FUNCTIONS: CHAR_STRING_to_local - convert CHAR_STRING to WCHAR_STRING
- CHAR_STRING_from_local - convert WCHAR_STRING to CHAR_STRING
- CHAR_STRING_free_inst - free WCHAR_STRING memory
- CHAR_STRING_free_local - free CHAR_STRING memory
- midl_user_allocate - user-supplied memory allocator
- midl_user_free - user-supplied routine to free memory
- COMMENTS: This sample program generates a client and server can share
- an interface, but one side can use a different representation
- than the other.
- The client side in this example does all operations using
- character strings, and the server side does all operations
- using UNICODE strings. Two procedures are provided, one
- defined with ASCII strings, one with UNICODE strings.
- The wire format reflects these definitions, yet the client
- and server see pure ASCII and pure UNICODE respectively.
- The [represent_as] attribute (used in the client and server
- side acf files) requires the four user-supplied functions
- whose names start with the name of the transmitted type
- (in the client side's case: WCHAR_STRING)
- The [in, out] attributes applied to remote procedure
- parameters require the two user-supplied functions
- midl_user_allocate and midl_user_free.
- The other functions are utilities that are used to
- build or display the data structures.
- ****************************************************************************/
- #include <stdlib.h>
- #include <stdio.h>
- #include "repasc.h" // header file generated by MIDL compiler for client
- void __RPC_USER
- WCHAR_STRING_from_local(
- CHAR_STRING __RPC_FAR * pLocal,
- WCHAR_STRING __RPC_FAR * __RPC_FAR * pWire )
- {
- WCHAR_STRING * pWireString;
- pWireString = midl_user_allocate( sizeof( WCHAR_STRING ) );
- *pWire = pWireString;
- mbstowcs( *pWireString, *pLocal, STRING_SIZE );
- }
- void __RPC_USER
- WCHAR_STRING_to_local(
- WCHAR_STRING __RPC_FAR * pWire,
- CHAR_STRING __RPC_FAR * pLocal )
- {
- wcstombs( *pLocal, *pWire, STRING_SIZE );
- }
- void __RPC_USER
- WCHAR_STRING_free_inst(
- WCHAR_STRING __RPC_FAR * pWire)
- {
- midl_user_free( pWire );
- }
- void __RPC_USER
- WCHAR_STRING_free_local(
- CHAR_STRING __RPC_FAR * pLocal)
- {
- midl_user_free( pLocal );
- }
- /***************************************************************************/
- void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
- {
- return(malloc(len));
- }
- void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
- {
- free(ptr);
- }
- /***************************************************************************/
- /* end file repascu.c */