示例#1
0
bool FUTestBed::RunTestbed(FUTestSuite* headTestSuite)
{
	if (headTestSuite == NULL) return false;

	testPassed = testFailed = 0;

	RunTestSuite(headTestSuite);

	if (isVerbose)
	{
		fileOut.WriteLine("---------------------------------");
		fileOut.WriteLine("Tests passed: %u.", (uint32) testPassed);
		fileOut.WriteLine("Tests failed: %u.", (uint32) testFailed);
		fileOut.WriteLine("");
		fileOut.Flush();

#ifdef _WIN32
		char sz[1024];
		snprintf(sz, 1024, "Testbed score: [%zu/%zu]", testPassed, testFailed + testPassed);
		sz[1023] = 0;

		size_t returnCode = IDOK;
		returnCode = MessageBox(NULL, TO_FSTRING(sz).c_str(), FC("Testbed"), MB_OKCANCEL);
		if (returnCode == IDCANCEL)
		{
			const fm::string filenameUtf8 = FUStringConversion::ToString(filename);
			snprintf(sz, 1024, "write %s ", filenameUtf8.c_str());
			sz[1023] = 0;
			system(sz);
			return false;
		}
#endif
	}
	return true;
}
示例#2
0
文件: main.c 项目: Alois-xx/EasyHook
NTSTATUS DriverEntry(
	IN PDRIVER_OBJECT		InDriverObject,
	IN PUNICODE_STRING		InRegistryPath)
{
    UNREFERENCED_PARAMETER(InRegistryPath);

    NTSTATUS						Status;    
	PDEVICE_OBJECT					DeviceObject = NULL;

	/*
		Create device...
	*/
    if (!NT_SUCCESS(Status = IoCreateDevice(
		InDriverObject,
		0,								// DeviceExtensionSize
		NULL,
		0x893D,							// DeviceType
		0,								// DeviceCharacteristics
		TRUE,							// Exclusive
		&DeviceObject					// [OUT]
		)))
		goto ERROR_ABORT;


    InDriverObject->MajorFunction[IRP_MJ_CREATE] = TestDriverDispatchCreate;
    InDriverObject->MajorFunction[IRP_MJ_CLOSE] = TestDriverDispatchClose;
    InDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = TestDriverDispatchDeviceControl;
    InDriverObject->DriverUnload = TestDriverUnload;

    // run test code...
	return RunTestSuite();

ERROR_ABORT:

	/*
		Rollback in case of errors...
	*/
	if (DeviceObject != NULL)
		IoDeleteDevice(DeviceObject);

	return Status;
}