home *** CD-ROM | disk | FTP | other *** search
- /*
- * RegIface.cpp
- * $Header: /BoundsChecker/Examples/BUGBNCHX/REGIFACE.CPP 3 4/09/97 9:26a Bob $
- *
- * Description:
- * Functions for registering and unregistering the Interface Test Object.
- *
- * Notes:
- * <implementation notes go here>
- *
- ***********************************************************************
- *
- * Nu-Mega Technologies, Inc.
- * P.O. Box 7780
- * Nashua, NH 03060
- *
- * (c) Copyright 1994, 1995 Nu-Mega Technologies, Inc.
- * ALL RIGHTS RESERVED.
- *
- ***********************************************************************
- *
- **********************************************************************/
- #include "stdafx.h"
-
- BOOL CallStdApiOnIfaceDll ( LPCTSTR szFuncName )
- {
- BOOL fRet = FALSE ;
-
- // Load the library and try to register it.
- HINSTANCE hDll = LoadLibrary ( _T ( "IFACEDLL.DLL" ) ) ;
- if ( NULL != hDll )
- {
-
- HRESULT (FAR* pfnStdApi) (void);
-
- pfnStdApi = (long(__cdecl *)(void))GetProcAddress ( hDll , szFuncName ) ;
- if ( NULL != pfnStdApi )
- {
- // Even though GetProcAddress didn't return NULL, an access violation
- // is still possible.
- #ifndef BCBVER
- __try
- {
- #else
- try
- {
- #endif
- HRESULT hrReg = pfnStdApi ( ) ;
- if ( ! FAILED ( hrReg ) )
- {
- fRet = TRUE ;
- }
- }
- __except ( EXCEPTION_EXECUTE_HANDLER )
- {
- }
- } // end if pfnStdApi != NULL
-
- FreeLibrary ( hDll ) ;
- } // end if hDLL != NULL
-
-
- // The one and only exit point from this function.
- return fRet ;
- }
-
-
-
- // Used to register the Interface Test object
- BOOL RegisterInterfaceTestObject ( )
- {
- return ( CallStdApiOnIfaceDll ( _T ( "DllRegisterServer" ) ) ) ;
- }
-
-
-
- // Used to un-register the Interface Test object
- BOOL UnregisterInterfaceTestObject ( )
- {
- return ( CallStdApiOnIfaceDll ( _T ( "DllUnregisterServer" ) ) ) ;
- }
-
-