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

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

unix.superglobalmegacorp.com

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