Annotation of mstools/ole20/samples/ole2ui/dllfuncs.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * DLLFUNCS.C
        !             3:  *
        !             4:  * Contains entry and exit points for the DLL implementation
        !             5:  * of the OLE 2.0 User Interface Support Library.           
        !             6:  *
        !             7:  * This file is not needed if we are linking the static library
        !             8:  * version of this library.
        !             9:  *
        !            10:  * Copyright (c)1992 Microsoft Corporation, All Right Reserved
        !            11:  */
        !            12:  
        !            13: #define STRICT  1
        !            14: #include "ole2ui.h"
        !            15: #include "common.h"
        !            16: 
        !            17: OLEDBGDATA
        !            18: 
        !            19: 
        !            20: /*
        !            21:  * LibMain
        !            22:  *
        !            23:  * Purpose:
        !            24:  *  DLL-specific entry point called from LibEntry.  Initializes
        !            25:  *  the DLL's heap and registers the GizmoBar GizmoBar.
        !            26:  *
        !            27:  * Parameters:
        !            28:  *  hInst           HINSTANCE instance of the DLL.
        !            29:  *  wDataSeg        WORD segment selector of the DLL's data segment.
        !            30:  *  wHeapSize       WORD byte count of the heap.
        !            31:  *  lpCmdLine       LPSTR to command line used to start the module.
        !            32:  *
        !            33:  * Return Value:
        !            34:  *  HANDLE          Instance handle of the DLL.
        !            35:  *
        !            36:  */
        !            37: 
        !            38: #ifdef WIN32
        !            39: 
        !            40: extern  BOOL WINAPI _CRT_INIT(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved);
        !            41: extern  _cexit(void);
        !            42: int CALLBACK WEP(int);
        !            43: 
        !            44: extern  BOOL __stdcall LibMain
        !            45: (                       
        !            46:     HINSTANCE hInst,                    
        !            47:     ULONG Reason,                    
        !            48:     PCONTEXT Context                 
        !            49: )
        !            50: {
        !            51:     UNREFERENCED_PARAMETER(Context);
        !            52:     if (Reason == DLL_PROCESS_DETACH) {
        !            53: 
        !            54:         _cexit(); // BUGBUG32  replace with call to CRT_INIT when it's fixed
        !            55: 
        !            56:         WEP(0);
        !            57:         return TRUE;
        !            58:     }
        !            59:     else if (Reason != DLL_PROCESS_ATTACH)
        !            60:         return TRUE;
        !            61: 
        !            62:     if (!_CRT_INIT(hInst,Reason,NULL))
        !            63:          return FALSE;
        !            64: 
        !            65:     OleUIInitialize(hInst);
        !            66: 
        !            67:         return TRUE;
        !            68: 
        !            69: }
        !            70: 
        !            71: #else
        !            72: 
        !            73: int FAR PASCAL LibMain(HINSTANCE hInst, WORD wDataSeg
        !            74:                           , WORD cbHeapSize, LPSTR lpCmdLine)
        !            75:     {
        !            76:     OleDbgOut2("LibMain: OLE2UI.DLL loaded\r\n");
        !            77:     
        !            78: // TODO:
        !            79: //  Once we get the DLL and LIB versions of this library working, we need
        !            80: //  to take this call to OleUIInitialize (and OleUIUninitialize below) out
        !            81: //  because it is the app's responsibility to call these    
        !            82:     
        !            83:     OleUIInitialize(hInst);
        !            84: 
        !            85:     //All done...
        !            86:     if (0!=cbHeapSize)
        !            87:         UnlockData(0);
        !            88: 
        !            89:     return (int)hInst;
        !            90:     }
        !            91: 
        !            92: #endif
        !            93: 
        !            94: /*
        !            95:  * WEP
        !            96:  *
        !            97:  * Purpose:
        !            98:  *  Required DLL Exit function.
        !            99:  *
        !           100:  * Parameters:
        !           101:  *  bSystemExit     BOOL indicating if the system is being shut
        !           102:  *                  down or the DLL has just been unloaded.
        !           103:  *
        !           104:  * Return Value:
        !           105:  *  void
        !           106:  *
        !           107:  */
        !           108: int CALLBACK EXPORT WEP(int bSystemExit)
        !           109: {
        !           110:     OleUIUnInitialize();
        !           111:     return 0;
        !           112: }
        !           113: 
        !           114: 
        !           115: 
        !           116: 
        !           117: 

unix.superglobalmegacorp.com

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