示例#1
0
文件: urtl.c 项目: conioh/os-design
BOOLEAN
VectorTest(
    IN PCH Arguments[],
    IN PCH Variables[],
    IN PCH Parameters[]
    )
{

    PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
    NTSTATUS st;

    DbgPrint("VectorTest:++\n");

    ProcessParameters = RtlAllocateHeap(MyHeap, 0, 2048);
    ProcessParameters->MaximumLength = 2048;

    st = RtlVectorsToProcessParameters(
            Arguments,
            Variables,
            Parameters,
            ProcessParameters
            );

    DumpIt(ProcessParameters);

    DbgPrint("VectorTest:--\n");

    return TRUE;
}
bool UParticleSystemAuditCommandlet::DumpSimpleSet(TSet<FString>& InSet, const TCHAR* InShortFilename, const TCHAR* InObjectClassName)
{
	if (InSet.Num() > 0)
	{
		check(InShortFilename != NULL);
		check(InObjectClassName != NULL);

		FArchive* OutputStream = GetOutputFile(InShortFilename);
		if (OutputStream != NULL)
		{
			UE_LOG(LogParticleSystemAuditCommandlet, Log, TEXT("Dumping '%s' results..."), InShortFilename);
			OutputStream->Logf(TEXT("%s,..."), InObjectClassName);
			for (TSet<FString>::TIterator DumpIt(InSet); DumpIt; ++DumpIt)
			{
				FString ObjName = *DumpIt;
				OutputStream->Logf(TEXT("%s"), *ObjName);
			}

			OutputStream->Close();
			delete OutputStream;
		}
		else
		{
			return false;
		}
	}
	return true;
}
示例#3
0
void CHttpEventHandler::DumpRespBody(RHTTPTransaction& aTrans)
	{
	MHTTPDataSupplier* body = aTrans.Response().Body();
	TPtrC8 dataChunk;
	TBool isLast = body->GetNextDataPart(dataChunk);
	DumpIt(dataChunk);
	if (isLast)
		iTest->Console()->Printf(_L("Got last data chunk.\n"));
	}
示例#4
0
/**
 * Dumps the debug information in a file.
 *
 * @returns 0 on success, exit code on failure.
 * @param   file    The filename.
 * @param   dips    The dips to load and use.
 */
static int DumpFile( const char *file, char **dips )
{
    int             rc = 1;
    dig_fhandle     fh;

    /*
     * Open the file
     */
    fh = DIGCliOpen( file, DIG_READ );
    if( fh == DIG_NIL_HANDLE ) {
        return( ErrorMsg( "Failed to open '%s'\n", file ) );
    }

    /*
     * Init DIP, create a process and load the file into the process.
     */
    if( InitDIP( dips ) ) {
        process_info    *proc = DIPCreateProcess();

        if( proc != NULL ) {
            int         prty;
            mod_handle  mh = 0;

            for( prty = DIPPriority( 0 ); prty != 0; prty = DIPPriority( prty ) ) {
                DIGCliSeek( fh, 0, DIG_ORG );
                mh = DIPLoadInfo( fh, 0, prty );
                if( mh != NO_MOD ) {
                    break;
                }
            }
            if( mh != NO_MOD ) {
                DIPMapInfo( mh, NULL );
                InfoMsg( "DIP opened '%s' at prty=%d, mh=%lx\n", file, prty, (long)mh );

                /*
                 * Enumerate the debug info.
                 */
                rc = DumpIt( file, mh, proc );

                /*
                 * Cleanup.
                 */
                DIPUnloadInfo( mh );
            } else {
                ErrorMsg( "DIP failed to open '%s'.\n", file);
            }
            DIPDestroyProcess( proc );
        }
        TermDIP();
    }
    DIGCliClose( fh );
    return( rc );
}
/**
 *	Extract the UE engine version from the crash dump
 *
 *	@param	InFileHandle		The handle to the opened crash dump file.
 *	@param	InMiniDumpHeader	The header from the crash dump
 *	@param	OutEngineVersion	The engine version if successfully extracted
 *
 *	@return	bool				true if successfully extracted, false if not
 */
bool ExtractEngineVersion_Windows(HANDLE InFileHandle, MINIDUMP_HEADER& InMiniDumpHeader, int32& OutEngineVersion, FString& OutPlatform)
{
	bool bResult = false;

	// Read the directories
	MINIDUMP_DIRECTORY ModuleListDirectory;
	FMemory::Memzero(&ModuleListDirectory, sizeof(MINIDUMP_DIRECTORY));
	int32 ModuleListStreamIdx = -1;

	bool bFailed = false;
	LONG StreamOffset = InMiniDumpHeader.StreamDirectoryRva;
	for (ULONG StreamIdx = 0; (StreamIdx < InMiniDumpHeader.NumberOfStreams) && !bFailed; StreamIdx++)
	{
		SetFilePointer(InFileHandle, StreamOffset, NULL, FILE_BEGIN);

		MINIDUMP_DIRECTORY MDDirectory;
		DWORD NumByteToRead = sizeof(MINIDUMP_DIRECTORY);
		DWORD NumBytesRead = 0;
		if (ReadFile(InFileHandle, &MDDirectory, NumByteToRead, &NumBytesRead, NULL) == TRUE)
		{
			switch (MDDirectory.StreamType)
			{
			// Reserved. Do not use this enumeration value.
			case UnusedStream:
			case ReservedStream0:
			case ReservedStream1:
				break;

			// * The stream contains thread information and stack. For more information, see MINIDUMP_THREAD_LIST.
			case ThreadListStream:
				break;

			// * The stream contains module information with the base, size and version info. For more information, see MINIDUMP_MODULE_LIST.
			case ModuleListStream:
				ModuleListStreamIdx = StreamIdx;
				FMemory::Memcpy(&ModuleListDirectory, &MDDirectory, sizeof(MINIDUMP_DIRECTORY));
				break;

			// The stream contains memory allocation information. For more information, see MINIDUMP_MEMORY_LIST.
			case MemoryListStream:
				break;

			// * The stream contains exception information with the code. For more information, see MINIDUMP_EXCEPTION_STREAM.
			case ExceptionStream:
				break;

			// * The stream contains general system information. For more information, see MINIDUMP_SYSTEM_INFO.
			case SystemInfoStream:
				break;

			// The stream contains extended thread information. For more information, see MINIDUMP_THREAD_EX_LIST.
			case ThreadExListStream:
				break;

			// The stream contains memory allocation information. For more information, see MINIDUMP_MEMORY64_LIST.
			case Memory64ListStream:
				break;

			// The stream contains an ANSI string used for documentation purposes.
			case CommentStreamA:
				break;

			// The stream contains a Unicode string used for documentation purposes.
			case CommentStreamW:
				break;

			// The stream contains high-level information about the active operating system handles. For more information, see MINIDUMP_HANDLE_DATA_STREAM.
			case HandleDataStream:
				break;

			// The stream contains function table information. For more information, see MINIDUMP_FUNCTION_TABLE_STREAM.
			case FunctionTableStream:
				break;

			// The stream contains module information for the unloaded modules. For more information, see MINIDUMP_UNLOADED_MODULE_LIST.
			case UnloadedModuleListStream:
				break;

			// The stream contains miscellaneous information. For more information, see MINIDUMP_MISC_INFO or MINIDUMP_MISC_INFO_2.
			case MiscInfoStream:
				break;

			// The stream contains memory region description information. It corresponds to the information that would be returned for the process from the 
			// VirtualQuery function. For more information, see MINIDUMP_MEMORY_INFO_LIST.
			case MemoryInfoListStream:
				break;

			// * The stream contains thread state information. For more information, see MINIDUMP_THREAD_INFO_LIST.
			case ThreadInfoListStream:
				break;

			// This stream contains operation list information. For more information, see MINIDUMP_HANDLE_OPERATION_LIST.
			case HandleOperationListStream:
				break;

			// Any value greater than this value will not be used by the system and can be used to represent application-defined data streams. For more information, see MINIDUMP_USER_STREAM.
			case LastReservedStream:
			default:
				break;
			}
		}
		else
		{
			bFailed = true;
		}

		StreamOffset += sizeof(MINIDUMP_DIRECTORY);
	}

	if (ModuleListStreamIdx != -1)
	{
		// We found the module list stream. Parse that...
		// Prep the file pointer to the right location
		SetFilePointer(InFileHandle, ModuleListDirectory.Location.Rva, NULL, FILE_BEGIN);

		ULONG32 NumberOfModules = 0;
		DWORD NumByteToRead = sizeof(ULONG32);
		DWORD NumBytesRead = 0;

		if (ReadFile(InFileHandle, &NumberOfModules, NumByteToRead, &NumBytesRead, NULL) == TRUE)
		{
			//@todo. This is excess as we really only care about the executable module... clean this up.
			TMap<FString, MINIDUMP_MODULE> MDModulesMap;
			TArray<MINIDUMP_MODULE> MDModules;
			MDModules.Empty(NumberOfModules);
			MDModules.AddZeroed(NumberOfModules);

			bool bFailed = false;
			for (uint32 ModuleIdx = 0; (ModuleIdx < NumberOfModules) && !bFailed; ModuleIdx++)
			{
				NumByteToRead = sizeof(MINIDUMP_MODULE);
				NumBytesRead = 0;
				if (ReadFile(InFileHandle, &(MDModules[ModuleIdx]), NumByteToRead, &NumBytesRead, NULL) == FALSE)
				{
					bFailed = true;
				}
			}

			if (bFailed == false)
			{
				for (uint32 NameIdx = 0; (NameIdx < (uint32)MDModules.Num()) && !bFailed; NameIdx++)
				{
					MINIDUMP_MODULE& Module = MDModules[NameIdx];
					SetFilePointer(InFileHandle, Module.ModuleNameRva, NULL, FILE_BEGIN);

					WCHAR TempBuffer[8192];
					ULONG32 NameLength;
					NumByteToRead = sizeof(ULONG32);
					NumBytesRead = 0;
					if (ReadFile(InFileHandle, &NameLength, NumByteToRead, &NumBytesRead, NULL) == TRUE)
					{
						if ((NameLength / 2) < 8192)
						{
							NumByteToRead = NameLength;
							NumBytesRead = 0;
							if (ReadFile(InFileHandle, &TempBuffer, NumByteToRead, &NumBytesRead, NULL) == TRUE)
							{
								TempBuffer[NameLength/2] = 0;
								FString ModuleName = TempBuffer;
								MDModulesMap.Add(ModuleName, Module);
							}
							else
							{
								bFailed = true;
							}
						}
						else
						{
							bFailed = true;
						}
					}
					else
					{
						bFailed = true;
					}
				}
			}

			if (bFailed == false)
			{
				// Find the executable module...
				for (TMap<FString,MINIDUMP_MODULE>::TIterator DumpIt(MDModulesMap); DumpIt; ++DumpIt)
				{
					FString& ModuleName = DumpIt.Key();
					MINIDUMP_MODULE& Module = DumpIt.Value();

					//@todo. We need to be able to determine other UE4 executables like SlateViewer...
					//@todo rocket Game suffix! We need another way to discover game executables

					FString GameExeName = TEXT("Game.exe");

					FString Win64GameDirName(TEXT("Game\\Binaries\\Win64\\"));
					FString Win64UE4ExeName(TEXT("Binaries\\Win64\\UE4"));

					FString Win32GameDirName(TEXT("Game\\Binaries\\Win32\\"));
					FString Win32UE4ExeName(TEXT("Binaries\\Win32\\UE4"));
					FString UE4ExeName = TEXT(".exe");

					bool bIsOurExecutable = false;
					if ((ModuleName.Contains(Win64GameDirName) && ModuleName.EndsWith(GameExeName)) || 
						(ModuleName.Contains(Win64UE4ExeName) && ModuleName.EndsWith(UE4ExeName)))
					{
						bIsOurExecutable = true;
						OutPlatform = TEXT("Win64");
					}

					if ((ModuleName.Contains(Win32GameDirName) && ModuleName.EndsWith(GameExeName)) ||
						(ModuleName.Contains(Win32UE4ExeName) && ModuleName.EndsWith(UE4ExeName)))
					{
						bIsOurExecutable = true;
						OutPlatform = TEXT("Win32");
					}

					if (bIsOurExecutable == true)
					{
						int32 VerA = (Module.VersionInfo.dwProductVersionMS & 0xFFFF0000) >> 16;
						int32 VerB = (Module.VersionInfo.dwProductVersionMS & 0x0000FFFF);
						int32 VerC = (Module.VersionInfo.dwProductVersionLS & 0xFFFF0000) >> 16;
						int32 VerD = (Module.VersionInfo.dwProductVersionLS & 0x0000FFFF);

						if (VerD == 0)
						{
							// Format is #.#.ENGINEVERSION.#
							OutEngineVersion = VerC;
						}
						else
						{
							// Format is #.#.HIChangeList.LOWChangeList
							OutEngineVersion = (VerC << 16) | VerD;
						}

						bResult = true;
					}
				}
			}