REMOTE.C
资源名称:MSDN_VC98.zip [点击查看]
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:4k
源码类别:
Windows编程
开发平台:
Visual C++
- /*************************************************************************
- Copyright Microsoft Corp. 1992-1996
- Remote Machine strout sample
- FILE : remote.c
- PURPOSE : The remote procedures that will be called from the client.
- COMMENTS : These procedures will be linked into the server side of
- the application.
- *************************************************************************/
- #include "strout.h" //Generated by the MIDL compiler
- #include "common.h" //Common definitions for all files
- /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
- /* Procedure : void GetRemoteEnv(unsigned long, str **) */
- /* Desc. : This procedure get the environment variables from */
- /* the server and reuturns a pointer to an array of */
- /* pointer to the environment strings */
- /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
- void GetRemoteEnv(unsigned long *nNumLines, str **psEnvironmentBlock)
- {
- int nIdx = 0; // Loop counter
- TCHAR
- *pcTemp, // Temporary pointer to the environment block
- *pcEnv; // Pointer to the environment block
- // Get pointer to environment block
- pcEnv = (TCHAR *) GetEnvironmentStrings();
- // First count how many lines, must know how much memory to allocate
- *nNumLines = 0; // Initialize number of lines to 0
- pcTemp = pcEnv; // Set tempptr equal to envptr
- while (*pcTemp != NULL_CHAR)
- {
- // Don't count the lines that starts with IGNORE_CHAR
- if(*pcTemp != IGNORE_CHAR)
- {
- (*nNumLines)++; // Increase the number of lines
- }
- // Increment the string pointer. Each line ends in