From: <ha...@us...> - 2003-05-20 02:50:43
|
Update of /cvsroot/decaldev/source/DenAgent In directory sc8-pr-cvs1:/tmp/cvs-serv14327 Modified Files: TrayWnd.cpp Log Message: should fix injecting multiple times Index: TrayWnd.cpp =================================================================== RCS file: /cvsroot/decaldev/source/DenAgent/TrayWnd.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TrayWnd.cpp 15 May 2003 06:13:05 -0000 1.6 --- TrayWnd.cpp 20 May 2003 02:50:39 -0000 1.7 *************** *** 24,29 **** // This is for our windows enumeration process ! bool g_bFirstEnum; ! BOOL CALLBACK EnumerationCallbackProc( HWND, LPARAM ); ///////////////////////////////////////////////////////////////////////////// --- 24,30 ---- // This is for our windows enumeration process ! std::list< HWND > injectList; ! bool g_bFirstEnum; ! BOOL CALLBACK EnumerationCallbackProc( HWND, LPARAM ); ///////////////////////////////////////////////////////////////////////////// *************** *** 168,171 **** --- 169,173 ---- { g_bFirstEnum = true; + injectList.clear(); ::EnumWindows( EnumerationCallbackProc, (LPARAM) _T("ZoneLobbyWindow") ); } *************** *** 181,189 **** } - // if this isn't the first call and the passed hwnd is the first HWND we got, exit enumeration else if( shFirst == hwnd ) return FALSE; TCHAR szClassName[64]; memset( szClassName, 0, sizeof( szClassName ) / sizeof( szClassName[0] ) ); --- 183,201 ---- } else + { + // if this isn't the first call and the passed hwnd is the first HWND we got, exit enumeration if( shFirst == hwnd ) return FALSE; + // check if we've already injected + for( std::list<HWND>::iterator i = injectList.begin(); i != injectList.end(); i++ ) + { + // yes, continue enumeration + if( *i == hwnd ) + return TRUE; + } + } + TCHAR szClassName[64]; memset( szClassName, 0, sizeof( szClassName ) / sizeof( szClassName[0] ) ); *************** *** 233,237 **** HMODULE hLib = (HMODULE) ForceLibraryNow( dwProcessId, szDllPath ); ! if( hLib == NULL ) { DWORD dwError = GetLastError(); --- 245,251 ---- HMODULE hLib = (HMODULE) ForceLibraryNow( dwProcessId, szDllPath ); ! if( hLib != NULL ) ! injectList.push_back( hwnd ); ! else { DWORD dwError = GetLastError(); |