Annotation of mstools/samples/memory/nmmemcli.c, revision 1.1.1.3

1.1.1.3 ! root        1: /******************************************************************************\
        !             2: *       This is a part of the Microsoft Source Code Samples. 
        !             3: *       Copyright (C) 1993 Microsoft Corporation.
        !             4: *       All rights reserved. 
        !             5: *       This source code is only intended as a supplement to 
        !             6: *       Microsoft Development Tools and/or WinHelp documentation.
        !             7: *       See these sources for detailed information regarding the 
        !             8: *       Microsoft samples programs.
        !             9: \******************************************************************************/
        !            10: 
1.1       root       11: #include <stdio.h>
                     12: #include <stdlib.h>
                     13: #include <stdarg.h>
                     14: #include <windows.h>
                     15: #include <string.h>
                     16: #include <winbase.h>
                     17: 
                     18: extern HWND ghwndMain;
                     19: 
                     20: HANDLE OpenMap(char MapName[30]);
                     21: void ErrorOut(char errstring[30]);
                     22: 
                     23: /************************************************************************
                     24:  * void ErrorOut(char errstring[30])
                     25:  *
                     26:  * Purpose: Print out an meainful error code by means of
1.1.1.3 ! root       27:  *        GetLastError and printf
1.1       root       28:  *
                     29:  * Inputs:  errstring - the action that failed, passed by the
1.1.1.3 ! root       30:  *                    calling proc.
1.1       root       31:  *
                     32:  * Returns: none
                     33:  *
                     34:  * Calls:   GetLastError
                     35:  *
                     36: \************************************************************************/
                     37: 
                     38: 
                     39: void ErrorOut(char errstring[30])
                     40: {
                     41: DWORD Error;
                     42: CHAR  str[80];
                     43: 
                     44: Error= GetLastError();
                     45: wsprintf((LPSTR) str, "Error on %s = %d\n", errstring, Error);
                     46: MessageBox(ghwndMain, (LPSTR)str, "Error", MB_OK);
                     47: }
                     48: 
                     49: /*************************************************************************
                     50:  * HANDLE OpenMap(char *MapName[30])
                     51:  *
                     52:  * Purpose: Open the mapping object pointed to by MapName
                     53:  *
                     54:  * Inputs: none
                     55:  *
                     56:  * Returns: handle to mapped object or NULL if failure
                     57:  *
                     58:  * Calls: OpenFileMapping, ErrorOut
                     59:  *
                     60:  * History:
1.1.1.2   root       61:  * 09-13-91 Pete Gray   Created.
1.1       root       62:  *
                     63: \*************************************************************************/
                     64: 
                     65: HANDLE OpenMap(char MapName[30])
                     66: {
                     67: HANDLE hAMap;
                     68: //char MapNameH[30]="MapName1";
                     69: 
                     70: hAMap= OpenFileMapping(FILE_MAP_READ | FILE_MAP_WRITE,
                     71:                        TRUE,
1.1.1.3 ! root       72:                        MapName);
1.1       root       73: 
                     74: if (hAMap == NULL)
                     75:   {
                     76:   ErrorOut("OpenFileMapping");
                     77:   return(NULL);
                     78:   }
                     79: else
                     80:   return(hAMap);
                     81: 
                     82: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.