in the code below during the dll_process_attach part i can log text to the server console without a problem, on the other hand if i do the same thing during the dll_process_detach the server will crash.
does anyone know of a way to log to the console during the shutdown/detach process without crashing the server?
i’m using the AddInLogMessageText() function to log text to the console.
also, does any one know a way to get the task name that the add-in has attached to? i’d like to replace the in the message with the actual task name?
thanks
raymond
BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
{
int x;
STATUS error = NOERROR;
switch( dwReason )
{
case DLL_PROCESS_ATTACH:
InitializeCriticalSection( &gCriticalSection );
gHandlerProc = ( EMHANDLER ) MakeProcInstance( ( FARPROC ) EMHandlerProc, hInstance );
sprintf( gTextBuffer, "%s: Version %s Attached to <taskname> Task and Started\n", ProgramName, ProgramVersion );
ConsoleLog( gTextBuffer );
break;
case DLL_PROCESS_DETACH:
CleanUp();
FreeProcInstance( gHandlerProc );
for ( x = 0; ExtensionHookTable[x].m_Name != NULL; x += 1 )
{
error = DeregisterEntry( x );
if ( error )
break;
}
DeleteCriticalSection( &gCriticalSection );
printf( "%s: Version %s Detached from <taskname> Task and Ended\n", ProgramName, ProgramVersion );
break;
}
return( TRUE );
UNREFERENCED_PARAMETER( lpReserved );
}