예제 #1
0
DWORD GetRawReportSize()
{
	DWORD result = 0;

	result = lstrlen( g_sysInfoString ) + 1;
	result += lstrlen( g_memInfoString ) + 1;
	result += lstrlen( g_versionInfoString ) + 1;

	for ( int i=0;i<g_stackTraceCount;i++){		
		result += lstrlen( g_stackTrace[i] ) + 1;	
	}


	for (DWORD j=0; j<g_systemProcessListCount;j++ ) {				
		char tmp[1024];
		wsprintf( tmp, "%s, PID: %d", 
			g_systemProcessNameList[j],
			g_systemProcessList[j] );					
		result += lstrlen( tmp ) + 1;	
	}

	for (int j=0;j<g_systemTotalModuleCount;j++){
		result += lstrlen( g_processModuleInfoList[j].name ) + 1;
	}

	const char* faultReason = GetFaultReason( g_BlackBoxUIExPtrs );
	const char* registerString = GetRegisterString( g_BlackBoxUIExPtrs );

	result += lstrlen( faultReason ) + 1;
	result += lstrlen( registerString ) + 1;

	return result;
}
예제 #2
0
파일: CrashDlg.cpp 프로젝트: xahgo/tama
// CCrashDlg message handlers
BOOL CCrashDlg :: OnInitDialog ( )
{
    CDialog::OnInitDialog ( ) ;
    
    ASSERT ( NULL != m_pExptPtrs ) ;
    
    LPCTSTR szStr = GetFaultReason ( m_pExptPtrs ) ;
    
    m_cFaultReason.SetWindowText ( szStr ) ;
    
    szStr = GetRegisterString ( m_pExptPtrs ) ;
    
    m_cRegisters.SetWindowText ( szStr ) ;
    
    szStr = GetFirstStackTraceString ( GSTSO_MODULE     |
                                        GSTSO_SYMBOL    |
                                        GSTSO_SRCLINE    ,
                                       m_pExptPtrs        ) ;
    while ( NULL != szStr )
    {
        m_cCallStackList.AddString ( szStr ) ;
        szStr = GetNextStackTraceString ( GSTSO_MODULE     |
                                            GSTSO_SYMBOL   |
                                            GSTSO_SRCLINE   ,
                                          m_pExptPtrs        ) ;
    }
    
    if ( FALSE == IsMiniDumpFunctionAvailable ( ) )
    {
        m_cMiniDumpBtn.EnableWindow ( FALSE ) ;
    }
    return ( FALSE ) ;
}
예제 #3
0
HGLOBAL GenerateRawReport()
{
	HGLOBAL result = NULL;

	const char* faultReason = GetFaultReason( g_BlackBoxUIExPtrs );
	const char* registerString = GetRegisterString( g_BlackBoxUIExPtrs );	
	
	int reportSize = GetRawReportSize();
	char rptSizeStr[25];
	wsprintf( rptSizeStr, "%d", reportSize );

	char* reportBuf = NULL;

	result = GlobalAlloc( GHND, reportSize + lstrlen(rptSizeStr)+1 );
	if ( NULL != result ) {
		reportBuf = (char*) GlobalLock( result );
	}
	else {		
		return result;
	}


	
	char* tmp = reportBuf;
	if ( NULL == result ) {
		lstrcpy( tmp, rptSizeStr );
		tmp[lstrlen(rptSizeStr)] = '\n';
		tmp += lstrlen(rptSizeStr)+1;
	}

	int index = 0;
	lstrcpy( tmp, g_sysInfoString );
	index = lstrlen( g_sysInfoString );
	tmp[index] = '\n';
	tmp += index+1;	

	lstrcpy( tmp, g_versionInfoString );
	index = lstrlen( g_versionInfoString );
	tmp[index] = '\n';
	tmp += index+1;	
	

	lstrcpy( tmp, g_memInfoString );
	index = lstrlen( g_memInfoString );
	tmp[index] = '\n';
	tmp += index+1;	

	lstrcpy( tmp, registerString );
	index = lstrlen( registerString );
	tmp[index] = '\n';
	tmp += index+1;	

	lstrcpy( tmp, faultReason );
	index = lstrlen( faultReason );
	tmp[index] = '\n';
	tmp += index+1;	
	
	


	for ( int i=0;i<g_stackTraceCount;i++){		
		lstrcpy( tmp, g_stackTrace[i] );
		index = lstrlen( g_stackTrace[i] );
		tmp[index] = '\n';
		tmp += index+1;
	}

	for ( DWORD j=0; j<g_systemProcessListCount;j++ ) {				
		char processID[1024];
		wsprintf( processID, "%s, PID: %d", 
			g_systemProcessNameList[j],
			g_systemProcessList[j] );					
		
		lstrcpy( tmp, processID );
		index = lstrlen( processID );
		
		tmp[index] = '\n';
		tmp += index+1;
		
		bool first = true;
		for (DWORD k=0;k<g_systemTotalModuleCount;k++){
			if ( g_processModuleInfoList[k].index == j ) {
				lstrcpy( tmp, g_processModuleInfoList[k].name );
				index = lstrlen( g_processModuleInfoList[k].name );
				tmp[index] = '\n';
				tmp += index+1;

				first = false;
			}
			else if (!first) {
				break;
			}
		}
	}
	
	if ( NULL != result ) {
		GlobalUnlock( result );
	}

	return result;
}
예제 #4
0
LRESULT CALLBACK BlackBoxUI_DlgProc(HWND hBlackBoxUIDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
	LRESULT result = FALSE;

	switch (message)
	{
		
		case WM_CTLCOLORSTATIC: {
			//HWND label = ::GetDlgItem( hBlackBoxUIDlg, IDC_INTRO );

			//HDC hdcStatic = (HDC) wParam;   // handle to display context 
			HWND hwndStatic = (HWND) lParam;
			
			if ( (GetDlgCtrlID(hwndStatic) == IDC_INTRO) || 
					(GetDlgCtrlID(hwndStatic) == IDC_INTRO2) || 
					(GetDlgCtrlID(hwndStatic) == IDC_BUG_LBL) ) {
				HBRUSH br = CreateSolidBrush( RGB(255,255,255) );
				result = (LRESULT)br;
			}			
		}
		break;

		case WM_INITDIALOG: {
			if ( g_BlackBoxUIExPtrs == NULL ) {
				result = FALSE;
			}
			else {
				HICON icon = (HICON)LoadImage( g_BlackBoxUIHInstance, 
											MAKEINTRESOURCE(IDI_BUG),
											IMAGE_ICON,
											0, 0, 
											LR_DEFAULTSIZE );

				HWND label = ::GetDlgItem( hBlackBoxUIDlg, IDC_INTRO );
				SetWindowText( label, g_errorLable );

				SendMessage( hBlackBoxUIDlg, WM_SETICON, ICON_BIG, (LPARAM)icon );

				HWND stackTraceHWnd = ::GetDlgItem( hBlackBoxUIDlg, IDC_STACKTRACE );
				HWND exceptionLabelHWnd = ::GetDlgItem( hBlackBoxUIDlg, IDC_EXCEPTION );

				SetWindowText( exceptionLabelHWnd, GetFaultReason( g_BlackBoxUIExPtrs ) );

				HWND registersLabelHWnd = ::GetDlgItem( hBlackBoxUIDlg, IDC_REGISTER );

				SetWindowText( registersLabelHWnd, GetRegisterString( g_BlackBoxUIExPtrs ) );
				

				int incr = 85;

				for ( int i=0;i<g_stackTraceCount;i++){
					SendMessage( stackTraceHWnd,  LB_ADDSTRING, 0, (LPARAM)g_stackTrace[i] );

					UpdateInitDlgProgress( incr  );
					incr += 2;
				}			
				
				
				DestroyWindow( g_initDlg );
			}
			result = TRUE;
		}
		break;

		case WM_COMMAND: {
			switch ( LOWORD(wParam) ) {
				case IDOK : case IDCANCEL : {
					EndDialog( hBlackBoxUIDlg, LOWORD(wParam) );
					return TRUE;
				}
				break;

				case IDC_ABOUT : {
					DialogBox( g_BlackBoxUIHInstance, 
								(LPCTSTR)IDD_ABOUT_BLACKBOX, 
								hBlackBoxUIDlg, 
								(DLGPROC)AboutBlackBox_DlgProc);
				}
				break;

				case IDC_MACHINE_INFO : {
					DialogBox( g_BlackBoxUIHInstance, 
								(LPCTSTR)IDD_MACHINE_INFO_DLG, 
								hBlackBoxUIDlg, 
								(DLGPROC)MachineInfo_DlgProc);
				}
				break;

				case IDC_MACHINE_STATE : {
					DialogBox( g_BlackBoxUIHInstance, 
								(LPCTSTR)IDD_MACHINESTATE_DLG, 
								hBlackBoxUIDlg, 
								(DLGPROC)MachineState_DlgProc);
				}
				break;

				case IDC_SEND : {
					SetCursor( LoadCursor(NULL, IDC_WAIT) );
					if ( OnSendData( hBlackBoxUIDlg ) ) {
						MessageBox( hBlackBoxUIDlg, "Successfully sent Crash Information", "Bug Trapper", MB_OK | MB_ICONINFORMATION );
					}
					else {
						MessageBox( hBlackBoxUIDlg, "Failed to send Crash Information.\nPlease save the information to a file\nand then send this to [email protected]", "Bug Trapper", MB_OK | MB_ICONERROR );
						HWND saveToFileBtn = ::GetDlgItem( hBlackBoxUIDlg, IDC_SAVE_TO_FILE );

						::SetActiveWindow( saveToFileBtn );
						SetFocus( saveToFileBtn );						
					}
					SetCursor( LoadCursor(NULL, IDC_ARROW) );
				}
				break;
				
				case IDC_MAILTO : {
					SetCursor( LoadCursor(NULL, IDC_WAIT) );
					
					::ShellExecute( NULL, NULL, g_mailToAddress, NULL, NULL, SW_NORMAL );

					SetCursor( LoadCursor(NULL, IDC_ARROW) );
				}
				break;

				case IDC_SUBMIT_NEW_VCF_BUG : {
					SetCursor( LoadCursor(NULL, IDC_WAIT) );

					::ShellExecute( NULL, NULL, g_submitBugURL, NULL, NULL, SW_NORMAL );

					SetCursor( LoadCursor(NULL, IDC_ARROW) );
				}
				break;
				
				case IDC_COPY_TO_CLIPBOARD : {
					SetCursor( LoadCursor(NULL, IDC_WAIT) );

					OnCopyToClipboardData( hBlackBoxUIDlg );

					SetCursor( LoadCursor(NULL, IDC_ARROW) );
				}
				break;

				case IDC_SAVE_TO_FILE : {
					SetCursor( LoadCursor(NULL, IDC_WAIT) );

					OnSaveDataToFile( hBlackBoxUIDlg );

					SetCursor( LoadCursor(NULL, IDC_ARROW) );
				}
				break;
			}			
		}
		break;
	}

    return result;
}