-#if 0
-#pragma mark -
-#pragma mark == MFC Support ==
-#endif
-
-//===========================================================================================================================
-// MFCDLLProcessAttach
-//===========================================================================================================================
-
-DEBUG_LOCAL OSStatus MFCDLLProcessAttach( HINSTANCE inInstance )
-{
- wchar_t resource[MAX_PATH];
- OSStatus err;
- _AFX_THREAD_STATE * threadState;
- AFX_MODULE_STATE * previousModuleState;
- BOOL ok;
- int res;
- CWinApp * app;
-
- app = NULL;
-
- // Simulate what is done in dllmodul.cpp.
-
- threadState = AfxGetThreadState();
- check( threadState );
- previousModuleState = threadState->m_pPrevModuleState;
-
- ok = AfxWinInit( inInstance, NULL, TEXT( "" ), 0 );
- require_action( ok, exit, err = kUnknownErr );
-
- app = AfxGetApp();
- require_action( ok, exit, err = kNotInitializedErr );
-
- // Before we load the resources, let's load the error string
-
- // errorMessage.LoadString( IDS_REINSTALL );
- // errorCaption.LoadString( IDS_REINSTALL_CAPTION );
-
- // Load Resources
-
- res = PathForResource( inInstance, L"ExplorerPluginResources.dll", resource, MAX_PATH );
-
- err = translate_errno( res != 0, kUnknownErr, kUnknownErr );
- require_noerr( err, exit );
-
- g_nonLocalizedResources = LoadLibrary( resource );
- translate_errno( g_nonLocalizedResources, GetLastError(), kUnknownErr );
- require_noerr( err, exit );
-
- g_nonLocalizedResourcesName = resource;
-
- res = PathForResource( inInstance, L"ExplorerPluginLocalized.dll", resource, MAX_PATH );
- err = translate_errno( res != 0, kUnknownErr, kUnknownErr );
- require_noerr( err, exit );
-
- g_localizedResources = LoadLibrary( resource );
- translate_errno( g_localizedResources, GetLastError(), kUnknownErr );
- require_noerr( err, exit );
-
- AfxSetResourceHandle( g_localizedResources );
-
- ok = app->InitInstance();
- require_action( ok, exit, err = kUnknownErr );
-
- threadState->m_pPrevModuleState = previousModuleState;
- threadState = NULL;
- AfxInitLocalData( inInstance );
- err = kNoErr;
-
-exit:
- if( err )
- {
- if( app )
- {
- app->ExitInstance();
- }
- AfxWinTerm();
- }
- if( threadState )
- {
- threadState->m_pPrevModuleState = previousModuleState;
- }
- return( err );
-}
-
-//===========================================================================================================================
-// MFCDLLProcessDetach
-//===========================================================================================================================
-
-DEBUG_LOCAL void MFCDLLProcessDetach( HINSTANCE inInstance )
-{
- CWinApp * app;
-
- // Simulate what is done in dllmodul.cpp.
-
- app = AfxGetApp();
- if( app )
- {
- app->ExitInstance();
- }
-
-#if( DEBUG )
- if( AfxGetModuleThreadState()->m_nTempMapLock != 0 )
- {
- dlog( kDebugLevelWarning, "Warning: Temp map lock count non-zero (%ld).\n", AfxGetModuleThreadState()->m_nTempMapLock );
- }
-#endif
-
- AfxLockTempMaps();
- AfxUnlockTempMaps( -1 );
-
- // Terminate the library before destructors are called.
-
- AfxWinTerm();
- AfxTermLocalData( inInstance, TRUE );
-}
-
-//===========================================================================================================================
-// MFCDLLFinalize
-//===========================================================================================================================
-
-DEBUG_LOCAL void MFCDLLThreadDetach( HINSTANCE inInstance )
-{
- // Simulate what is done in dllmodul.cpp.
-
-#if( DEBUG )
- if( AfxGetModuleThreadState()->m_nTempMapLock != 0 )
- {
- dlog( kDebugLevelWarning, "Warning: Temp map lock count non-zero (%ld).\n", AfxGetModuleThreadState()->m_nTempMapLock );
- }
-#endif
-
- AfxLockTempMaps();
- AfxUnlockTempMaps( -1 );
- AfxTermThread( inInstance );
-}