void CTaskDialog::LayoutControls(void) { // layout controls int cx_buttons = 0; int cx_width = CalculateDialogWidth(cx_buttons); int cy_height = 0; int x = cx_margin; int y = cy_margin; // add content area { if (config_.pszMainInstruction != 0 || config_.pszMainIcon != 0) y += cy_spacing + AddMainInstruction(x, y, cx_width - cx_margin - cx_margin); if (config_.pszContent != 0) y += cy_spacing + AddContent(x, y, cx_width - cx_margin - cx_margin); if (config_.cRadioButtons != 0) y += cy_spacing + AddRadioButtons(x, y, cx_width - cx_margin - cx_margin); if (HasFlag(TDF_SHOW_PROGRESS_BAR)) y += cy_spacing + AddProgressBar(x, y, cx_width - cx_margin - cx_margin); cy_height = y; } { y = AddFrame(0, 0, cx_width, cy_height); y += AddDividingLine(0, y, cx_width); y += cy_spacing; } // add row of buttons { y += cy_spacing + AddButtons(cx_margin + cx_width - cx_buttons, y, cx_width); } // add verification text if (config_.pszVerificationText != 0) { y += cy_spacing + AddVerificationCheckBox(cx_margin, y, cx_width - cx_margin - cx_margin); } // add footer area if (config_.pszFooter != 0 || config_.pszFooterIcon != 0) { y += cy_spacing + AddFooterDividingLine(0, y, cx_width); y += cy_spacing + AddFooter(cx_margin, y, cx_width - cx_margin - cy_margin); } y += cy_margin - cy_spacing; y += ::GetSystemMetrics(SM_CYCAPTION); // update dialog dimension RECT rect = { 0, 0, cx_width, y }; SetWindowPos(0, &rect, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); }
void FGenericCrashContext::SerializeContentToBuffer() { // Must conform against: // https://www.securecoding.cert.org/confluence/display/seccode/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers AddHeader(); BeginSection( TEXT( "RuntimeProperties" ) ); AddCrashProperty( TEXT( "Version" ), (int32)ECrashDescVersions::VER_2_AddedNewProperties ); // ProcessId will be used by the crash report client to get more information about the crashed process. // It should be enough to open the process, get the memory stats, a list of loaded modules etc. // It means that the crashed process needs to be alive as long as the crash report client is working on the process. // Proposal, not implemented yet. AddCrashProperty( TEXT( "ProcessId" ), FPlatformProcess::GetCurrentProcessId() ); AddCrashProperty( TEXT( "IsInternalBuild" ), (int32)NCachedCrashContextProperties::bIsInternalBuild ); AddCrashProperty( TEXT( "IsPerforceBuild" ), (int32)NCachedCrashContextProperties::bIsPerforceBuild ); AddCrashProperty( TEXT( "IsSourceDistribution" ), (int32)NCachedCrashContextProperties::bIsSourceDistribution ); // Added 'editor/game open time till crash' // Add common crash properties. AddCrashProperty( TEXT( "GameName" ), FApp::GetGameName() ); AddCrashProperty(TEXT("ExecutableName"), *NCachedCrashContextProperties::ExecutableName); AddCrashProperty( TEXT( "BuildConfiguration" ), EBuildConfigurations::ToString( FApp::GetBuildConfiguration() ) ); AddCrashProperty(TEXT("PlatformName"), *NCachedCrashContextProperties::PlatformName); AddCrashProperty(TEXT("PlatformNameIni"), *NCachedCrashContextProperties::PlatformNameIni); AddCrashProperty( TEXT( "EngineMode" ), FPlatformMisc::GetEngineMode() ); AddCrashProperty( TEXT( "EngineVersion" ), *GEngineVersion.ToString() ); AddCrashProperty( TEXT( "CommandLine" ), FCommandLine::IsInitialized() ? FCommandLine::Get() : TEXT("") ); AddCrashProperty( TEXT( "LanguageLCID" ), FInternationalization::Get().GetCurrentCulture()->GetLCID() ); AddCrashProperty(TEXT("DefaultLocale"), *NCachedCrashContextProperties::DefaultLocale); AddCrashProperty( TEXT( "IsUE4Release" ), (int32)NCachedCrashContextProperties::bIsUE4Release); // Remove periods from user names to match AutoReporter user names // The name prefix is read by CrashRepository.AddNewCrash in the website code const bool bSendUserName = NCachedCrashContextProperties::bIsInternalBuild; AddCrashProperty( TEXT( "UserName" ), bSendUserName ? *NCachedCrashContextProperties::UserName.Replace( TEXT( "." ), TEXT( "" ) ) : TEXT( "" ) ); AddCrashProperty(TEXT("BaseDir"), *NCachedCrashContextProperties::BaseDir); AddCrashProperty(TEXT("RootDir"), *NCachedCrashContextProperties::RootDir); AddCrashProperty(TEXT("MachineId"), *NCachedCrashContextProperties::MachineIdStr); AddCrashProperty(TEXT("EpicAccountId"), *NCachedCrashContextProperties::EpicAccountId); AddCrashProperty( TEXT( "CallStack" ), TEXT( "" ) ); AddCrashProperty( TEXT( "SourceContext" ), TEXT( "" ) ); AddCrashProperty( TEXT( "UserDescription" ), TEXT( "" ) ); AddCrashProperty( TEXT( "ErrorMessage" ), (const TCHAR*)GErrorMessage ); // GErrorMessage may be broken. // Add misc stats. AddCrashProperty(TEXT("MiscNumberOfCores"), NCachedCrashContextProperties::NumberOfCores); AddCrashProperty(TEXT("MiscNumberOfCoresIncludingHyperthreads"), NCachedCrashContextProperties::NumberOfCoresIncludingHyperthreads); AddCrashProperty( TEXT( "MiscIs64bitOperatingSystem" ), (int32)FPlatformMisc::Is64bitOperatingSystem() ); AddCrashProperty(TEXT("MiscCPUVendor"), *NCachedCrashContextProperties::CPUVendor); AddCrashProperty(TEXT("MiscCPUBrand"), *NCachedCrashContextProperties::CPUBrand); AddCrashProperty(TEXT("MiscPrimaryGPUBrand"), *NCachedCrashContextProperties::PrimaryGPUBrand); AddCrashProperty(TEXT("MiscOSVersionMajor"), *NCachedCrashContextProperties::OsVersion); AddCrashProperty(TEXT("MiscOSVersionMinor"), *NCachedCrashContextProperties::OsSubVersion); AddCrashProperty( TEXT( "CrashDumpMode" ), NCachedCrashContextProperties::CrashDumpMode ); // @TODO yrx 2014-10-08 Move to the crash report client. /*if( CanUseUnsafeAPI() ) { uint64 AppDiskTotalNumberOfBytes = 0; uint64 AppDiskNumberOfFreeBytes = 0; FPlatformMisc::GetDiskTotalAndFreeSpace( FPlatformProcess::BaseDir(), AppDiskTotalNumberOfBytes, AppDiskNumberOfFreeBytes ); AddCrashProperty( TEXT( "MiscAppDiskTotalNumberOfBytes" ), AppDiskTotalNumberOfBytes ); AddCrashProperty( TEXT( "MiscAppDiskNumberOfFreeBytes" ), AppDiskNumberOfFreeBytes ); }*/ // FPlatformMemory::GetConstants is called in the GCreateMalloc, so we can assume it is always valid. { // Add memory stats. const FPlatformMemoryConstants& MemConstants = FPlatformMemory::GetConstants(); AddCrashProperty( TEXT( "MemoryStatsTotalPhysical" ), (uint64)MemConstants.TotalPhysical ); AddCrashProperty( TEXT( "MemoryStatsTotalVirtual" ), (uint64)MemConstants.TotalVirtual ); AddCrashProperty( TEXT( "MemoryStatsPageSize" ), (uint64)MemConstants.PageSize ); AddCrashProperty( TEXT( "MemoryStatsTotalPhysicalGB" ), MemConstants.TotalPhysicalGB ); } AddCrashProperty( TEXT( "MemoryStatsAvailablePhysical" ), (uint64)CrashMemoryStats.AvailablePhysical ); AddCrashProperty( TEXT( "MemoryStatsAvailableVirtual" ), (uint64)CrashMemoryStats.AvailableVirtual ); AddCrashProperty( TEXT( "MemoryStatsUsedPhysical" ), (uint64)CrashMemoryStats.UsedPhysical ); AddCrashProperty( TEXT( "MemoryStatsPeakUsedPhysical" ), (uint64)CrashMemoryStats.PeakUsedPhysical ); AddCrashProperty( TEXT( "MemoryStatsUsedVirtual" ), (uint64)CrashMemoryStats.UsedVirtual ); AddCrashProperty( TEXT( "MemoryStatsPeakUsedVirtual" ), (uint64)CrashMemoryStats.PeakUsedVirtual ); AddCrashProperty( TEXT( "MemoryStatsbIsOOM" ), (int32)FPlatformMemory::bIsOOM ); AddCrashProperty( TEXT( "MemoryStatsOOMAllocationSize"), (uint64)FPlatformMemory::OOMAllocationSize ); AddCrashProperty( TEXT( "MemoryStatsOOMAllocationAlignment"), (int32)FPlatformMemory::OOMAllocationAlignment ); //Architecture //CrashedModuleName //LoadedModules EndSection( TEXT( "RuntimeProperties" ) ); // Add platform specific properties. BeginSection( TEXT("PlatformProperties") ); AddPlatformSpecificProperties(); EndSection( TEXT( "PlatformProperties" ) ); AddFooter(); }
void FGenericCrashContext::SerializeContentToBuffer() { // Must conform against: // https://www.securecoding.cert.org/confluence/display/seccode/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers AddHeader(); BeginSection( *RuntimePropertiesTag ); AddCrashProperty( TEXT( "CrashVersion" ), (int32)ECrashDescVersions::VER_3_CrashContext ); AddCrashProperty( TEXT( "CrashGUID" ), *NCachedCrashContextProperties::CrashGUID ); AddCrashProperty( TEXT( "ProcessId" ), FPlatformProcess::GetCurrentProcessId() ); AddCrashProperty( TEXT( "IsInternalBuild" ), NCachedCrashContextProperties::bIsInternalBuild ); AddCrashProperty( TEXT( "IsPerforceBuild" ), NCachedCrashContextProperties::bIsPerforceBuild ); AddCrashProperty( TEXT( "IsSourceDistribution" ), NCachedCrashContextProperties::bIsSourceDistribution ); AddCrashProperty( TEXT( "SecondsSinceStart" ), NCachedCrashContextProperties::SecondsSinceStart ); // Add common crash properties. AddCrashProperty( TEXT( "GameName" ), *NCachedCrashContextProperties::GameName ); AddCrashProperty( TEXT( "ExecutableName" ), *NCachedCrashContextProperties::ExecutableName ); AddCrashProperty( TEXT( "BuildConfiguration" ), EBuildConfigurations::ToString( FApp::GetBuildConfiguration() ) ); AddCrashProperty( TEXT( "PlatformName" ), *NCachedCrashContextProperties::PlatformName ); AddCrashProperty( TEXT( "PlatformNameIni" ), *NCachedCrashContextProperties::PlatformNameIni ); AddCrashProperty( TEXT( "EngineMode" ), FPlatformMisc::GetEngineMode() ); AddCrashProperty( TEXT( "EngineVersion" ), *GEngineVersion.ToString() ); AddCrashProperty( TEXT( "CommandLine" ), FCommandLine::IsInitialized() ? FCommandLine::Get() : TEXT( "" ) ); AddCrashProperty( TEXT( "LanguageLCID" ), FInternationalization::Get().GetCurrentCulture()->GetLCID() ); AddCrashProperty( TEXT( "AppDefaultLocale" ), *NCachedCrashContextProperties::DefaultLocale ); AddCrashProperty( TEXT( "IsUE4Release" ), NCachedCrashContextProperties::bIsUE4Release ); // Remove periods from user names to match AutoReporter user names // The name prefix is read by CrashRepository.AddNewCrash in the website code const bool bSendUserName = NCachedCrashContextProperties::bIsInternalBuild; AddCrashProperty( TEXT( "UserName" ), bSendUserName ? *NCachedCrashContextProperties::UserName.Replace( TEXT( "." ), TEXT( "" ) ) : TEXT( "" ) ); AddCrashProperty( TEXT( "BaseDir" ), *NCachedCrashContextProperties::BaseDir ); AddCrashProperty( TEXT( "RootDir" ), *NCachedCrashContextProperties::RootDir ); AddCrashProperty( TEXT( "MachineId" ), *NCachedCrashContextProperties::MachineIdStr ); AddCrashProperty( TEXT( "EpicAccountId" ), *NCachedCrashContextProperties::EpicAccountId ); AddCrashProperty( TEXT( "CallStack" ), TEXT( "" ) ); AddCrashProperty( TEXT( "SourceContext" ), TEXT( "" ) ); AddCrashProperty( TEXT( "UserDescription" ), TEXT( "" ) ); AddCrashProperty( TEXT( "ErrorMessage" ), (const TCHAR*)GErrorMessage ); // GErrorMessage may be broken. AddCrashProperty( TEXT( "CrashDumpMode" ), NCachedCrashContextProperties::CrashDumpMode ); // Add misc stats. AddCrashProperty( TEXT( "Misc.NumberOfCores" ), NCachedCrashContextProperties::NumberOfCores ); AddCrashProperty( TEXT( "Misc.NumberOfCoresIncludingHyperthreads" ), NCachedCrashContextProperties::NumberOfCoresIncludingHyperthreads ); AddCrashProperty( TEXT( "Misc.Is64bitOperatingSystem" ), (int32)FPlatformMisc::Is64bitOperatingSystem() ); AddCrashProperty( TEXT( "Misc.CPUVendor" ), *NCachedCrashContextProperties::CPUVendor ); AddCrashProperty( TEXT( "Misc.CPUBrand" ), *NCachedCrashContextProperties::CPUBrand ); AddCrashProperty( TEXT( "Misc.PrimaryGPUBrand" ), *NCachedCrashContextProperties::PrimaryGPUBrand ); AddCrashProperty( TEXT( "Misc.OSVersionMajor" ), *NCachedCrashContextProperties::OsVersion ); AddCrashProperty( TEXT( "Misc.OSVersionMinor" ), *NCachedCrashContextProperties::OsSubVersion ); // #YRX_Crash: 2015-07-21 Move to the crash report client. /*{ uint64 AppDiskTotalNumberOfBytes = 0; uint64 AppDiskNumberOfFreeBytes = 0; FPlatformMisc::GetDiskTotalAndFreeSpace( FPlatformProcess::BaseDir(), AppDiskTotalNumberOfBytes, AppDiskNumberOfFreeBytes ); AddCrashProperty( TEXT( "Misc.AppDiskTotalNumberOfBytes" ), AppDiskTotalNumberOfBytes ); AddCrashProperty( TEXT( "Misc.AppDiskNumberOfFreeBytes" ), AppDiskNumberOfFreeBytes ); }*/ // FPlatformMemory::GetConstants is called in the GCreateMalloc, so we can assume it is always valid. { // Add memory stats. const FPlatformMemoryConstants& MemConstants = FPlatformMemory::GetConstants(); AddCrashProperty( TEXT( "MemoryStats.TotalPhysical" ), (uint64)MemConstants.TotalPhysical ); AddCrashProperty( TEXT( "MemoryStats.TotalVirtual" ), (uint64)MemConstants.TotalVirtual ); AddCrashProperty( TEXT( "MemoryStats.PageSize" ), (uint64)MemConstants.PageSize ); AddCrashProperty( TEXT( "MemoryStats.TotalPhysicalGB" ), MemConstants.TotalPhysicalGB ); } AddCrashProperty( TEXT( "MemoryStats.AvailablePhysical" ), (uint64)CrashMemoryStats.AvailablePhysical ); AddCrashProperty( TEXT( "MemoryStats.AvailableVirtual" ), (uint64)CrashMemoryStats.AvailableVirtual ); AddCrashProperty( TEXT( "MemoryStats.UsedPhysical" ), (uint64)CrashMemoryStats.UsedPhysical ); AddCrashProperty( TEXT( "MemoryStats.PeakUsedPhysical" ), (uint64)CrashMemoryStats.PeakUsedPhysical ); AddCrashProperty( TEXT( "MemoryStats.UsedVirtual" ), (uint64)CrashMemoryStats.UsedVirtual ); AddCrashProperty( TEXT( "MemoryStats.PeakUsedVirtual" ), (uint64)CrashMemoryStats.PeakUsedVirtual ); AddCrashProperty( TEXT( "MemoryStats.bIsOOM" ), (int32)FPlatformMemory::bIsOOM ); AddCrashProperty( TEXT( "MemoryStats.OOMAllocationSize"), (uint64)FPlatformMemory::OOMAllocationSize ); AddCrashProperty( TEXT( "MemoryStats.OOMAllocationAlignment"), (int32)FPlatformMemory::OOMAllocationAlignment ); //Architecture //CrashedModuleName //LoadedModules EndSection( *RuntimePropertiesTag ); // Add platform specific properties. BeginSection( *PlatformPropertiesTag ); AddPlatformSpecificProperties(); EndSection( *PlatformPropertiesTag ); AddFooter(); }