adapter::Guid adapter::Guid::NewGuid() { uuid_t uuid; uuid_generate_random(uuid); return Guid(uuid); }
Guid BinaryUtils::ReadGuid(interop::InteropInputStream* stream) { int64_t most = stream->ReadInt64(); int64_t least = stream->ReadInt64(); return Guid(most, least); }
CssmDLPolyData::operator Guid () const { assert(mFormat == CSSM_DB_ATTRIBUTE_FORMAT_BLOB); if (mData.Length != Guid::stringRepLength + 1) CssmError::throwMe(CSSMERR_DL_DATABASE_CORRUPT); return Guid(reinterpret_cast<const char *>(mData.Data)); }
bool OcxTypeInfo::CanUnload() const { RLOG("OcxTypeInfo::CanUnload(" << name << ", " << Guid(coclass_guid) << ")"); RDUMP(object_count); RDUMP(refcount); RDUMP(lock_count); return object_count == 0 && refcount <= 2 && lock_count <= 0; }
STDMETHODIMP VirtualBoxErrorInfo::GetGUID (GUID *guid) { Bstr iid; HRESULT rc = COMGETTER(InterfaceID) (iid.asOutParam()); if (SUCCEEDED(rc)) *guid = Guid(iid).ref(); return rc; }
OsPowerSchemePersonality::Type toType(Guid OsPowerSchemePersonality) { if (OsPowerSchemePersonality == Guid(GUID_HIGH_PERFORMANCE_MODE)) { return OsPowerSchemePersonality::HighPerformance; } else if (OsPowerSchemePersonality == Guid(GUID_POWER_SAVER_MODE)) { return OsPowerSchemePersonality::PowerSaver; } else if (OsPowerSchemePersonality == Guid(GUID_BALANCED_MODE)) { return OsPowerSchemePersonality::Balanced; } else { return OsPowerSchemePersonality::Invalid; } }
STDMETHODIMP CConvertGuid::GuidToGuid32String(BSTR bstrGuid, BSTR *pbstrGuidStr) { if (NULL == pbstrGuidStr) return E_POINTER; *pbstrGuidStr = NULL; CIID Guid(bstrGuid, CIID::INITCIID_InitFromGuid); return GuidToGuid32String(Guid, pbstrGuidStr); }
adapter::Guid adapter::Guid::Parse(char const* s) { if (s == NULL) return Guid::Null(); uuid_t id; return (uuid_parse(s, id) == 0) ? Guid(id) : Guid::Null(); }
/** * Loads changes made from a resource @param The path to the directory of the resource. Load uses ../Directory/GetName for the full path. */ void Resource::LoadMeta(IniFileStream & aFileStream) { if (aFileStream.BindSection("Resource")) { IniString metaID = aFileStream.GetString(ResourceDatabase::META_ID_TOKEN); if (!IniString::IsBadValue(metaID)) { m_UniqueID = Guid(metaID.GetValue()); } } }
std::vector<Guid> SupportedPolicyList::parseBufferForPolicyGuids(const DptfBuffer& buffer) { UInt32 guidCount = buffer.size() / sizeof(AcpiEsifGuid); AcpiEsifGuid* acpiEsifGuid = reinterpret_cast<AcpiEsifGuid*>(buffer.get()); std::vector<Guid> guids; for (UInt32 i = 0; i < guidCount; i++) { UInt8 guidByteArray[GuidSize] = { 0 }; esif_ccb_memcpy(guidByteArray, &acpiEsifGuid[i].uuid, GuidSize); guids.push_back(Guid(guidByteArray)); } return guids; }
OcxTypeInfo::OcxTypeInfo(const GUID& coclass_guid, /*const GUID& dispatch_guid,*/ const GUID& event_guid, New new_fn, String name, const char* help, int ver, bool is_control) : coclass_guid(coclass_guid), /*dispatch_guid(dispatch_guid),*/ event_guid(event_guid) , new_fn(new_fn), name(name), help(help), ver(ver), is_control(is_control) , object_count(0) , refcount(1) , lock_count(0) #ifndef _USRDLL , registration(0) #endif { RLOG("OcxTypeInfo ctr (" << name << ", " << Guid(coclass_guid) << ")"); OcxTypeLib::Get().Add(*this); }
int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVirtualBox, IN_GUID aId, IProgress **aProgress) { #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) /* create a progress object */ ComObjPtr<Progress> progress; progress.createObject(); ComPtr<IHost> host; int rc = VINF_SUCCESS; HRESULT hr = pVirtualBox->COMGETTER(Host)(host.asOutParam()); if (SUCCEEDED(hr)) { Bstr ifname; ComPtr<IHostNetworkInterface> iface; if (FAILED(host->FindHostNetworkInterfaceById(Guid(aId).toUtf16().raw(), iface.asOutParam()))) return VERR_INVALID_PARAMETER; iface->COMGETTER(Name)(ifname.asOutParam()); if (ifname.isEmpty()) return VERR_INTERNAL_ERROR; rc = progress->init(pVirtualBox, host, Bstr("Removing host network interface").raw(), FALSE /* aCancelable */); if (SUCCEEDED(rc)) { progress.queryInterfaceTo(aProgress); rc = NetIfAdpCtl(Utf8Str(ifname).c_str(), "remove", NULL, NULL); if (RT_FAILURE(rc)) progress->i_notifyComplete(E_FAIL, COM_IIDOF(IHostNetworkInterface), HostNetworkInterface::getStaticComponentName(), "Failed to execute '" VBOXNETADPCTL_NAME "' (exit status: %d)", rc); else progress->i_notifyComplete(S_OK); } } else { progress->i_notifyComplete(hr); rc = VERR_INTERNAL_ERROR; } return rc; #else NOREF(pVirtualBox); NOREF(aId); NOREF(aProgress); return VERR_NOT_IMPLEMENTED; #endif }
HRESULT OcxObject::InternalQueryInterface(const GUID& iid, void **ppv) { #if LOG_QUERIES >= 2 OCXLOG("OcxObject::InternalQueryInterface -> " << GetInterfaceName(iid)); #endif int i; IUnknown *punk; if(iid == IID_IUnknown) punk = static_cast<IUnknown *>(&inner_unknown); else if((i = interface_map.Find(iid)) >= 0) punk = interface_map[i]; else { *ppv = 0; #if LOG_QUERIES >= 1 String name; if(ocx_info) name = ocx_info->GetName(); else name = "<unknown object>"; #endif LOGQUERY("\t\tcast ERROR: " << name << " -> "<< GetInterfaceName(iid) << ", " << Guid(iid)); #if LOG_QUERIES >= 3 OCXLOG("\tGUID = " << Format(iid)); for(int i = 0; i < interface_map.GetCount(); i++) { const GUID& imid = interface_map.GetKey(i); String n = GetInterfaceName(imid); if(n.GetLength() < 30) n.Cat(' ', 30 - n.GetLength()); OCXLOG("\t\t\t" << n << " - " << Format(imid)); } #endif return E_NOINTERFACE; } punk->AddRef(); *ppv = punk; #if LOG_QUERIES >= 2 String name; if(ocx_info) name = ocx_info->GetName(); else name = "<unknown object>"; OCXLOG("\t\tcast OK: " << name << " -> " << GetInterfaceName(iid)); #endif return S_OK; }
/** * Notification from VM process about USB device detaching progress. * * This is in an interface for SessionMachine::DetachUSBDevice(), which is * an internal worker used by Console::DetachUSBDevice() from the VM process. * * @param aMachine The machine which is sending the notification. * @param aId The UUID of the USB device is concerns. * @param aDone \a false for the pre-action notification (necessary * for advancing the device state to avoid confusing * the guest). * \a true for the post-action notification. The device * will be subjected to all filters except those of * of \a Machine. * * @returns COM status code. * * @remarks When \a aDone is \a true this method may end up doing IPC to other * VMs when running filters. In these cases it will temporarily * abandon its locks. */ HRESULT USBProxyService::detachDeviceFromVM(SessionMachine *aMachine, IN_GUID aId, bool aDone) { LogFlowThisFunc(("aMachine=%p{%s} aId={%RTuuid} aDone=%RTbool\n", aMachine, aMachine->getName().c_str(), Guid(aId).raw(), aDone)); // get a list of all running machines while we're outside the lock // (getOpenedMachines requests locks which are incompatible with the lock of the machines list) SessionMachinesList llOpenedMachines; mHost->parent()->getOpenedMachines(llOpenedMachines); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); ComObjPtr<HostUSBDevice> pHostDevice = findDeviceById(aId); ComAssertRet(!pHostDevice.isNull(), E_FAIL); AutoWriteLock devLock(pHostDevice COMMA_LOCKVAL_SRC_POS); /* * Work the state machine. */ LogFlowThisFunc(("id={%RTuuid} state=%s aDone=%RTbool name={%s}\n", pHostDevice->getId().raw(), pHostDevice->getStateName(), aDone, pHostDevice->getName().c_str())); bool fRunFilters = false; HRESULT hrc = pHostDevice->onDetachFromVM(aMachine, aDone, &fRunFilters); /* * Run filters if necessary. */ if ( SUCCEEDED(hrc) && fRunFilters) { Assert(aDone && pHostDevice->getUnistate() == kHostUSBDeviceState_HeldByProxy && pHostDevice->getMachine().isNull()); devLock.release(); alock.release(); HRESULT hrc2 = runAllFiltersOnDevice(pHostDevice, llOpenedMachines, aMachine); ComAssertComRC(hrc2); } return hrc; }
Guid zDBBinaryReader::ToGuid(int offset) { CHECK_DISPOSED(m_disposed); return Guid(ToBytes(0, 16)); }
adapter::Guid const& adapter::Guid::Null() { static Guid zeroGuid = Guid(); return zeroGuid; }
/** * Request capture of a specific device. * * This is in an interface for SessionMachine::CaptureUSBDevice(), which is * an internal worker used by Console::AttachUSBDevice() from the VM process. * * When the request is completed, SessionMachine::onUSBDeviceAttach() will * be called for the given machine object. * * * @param aMachine The machine to attach the device to. * @param aId The UUID of the USB device to capture and attach. * * @returns COM status code and error info. * * @remarks This method may operate synchronously as well as asynchronously. In the * former case it will temporarily abandon locks because of IPC. */ HRESULT USBProxyService::captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId) { ComAssertRet(aMachine, E_INVALIDARG); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* * Translate the device id into a device object. */ ComObjPtr<HostUSBDevice> pHostDevice = findDeviceById(aId); if (pHostDevice.isNull()) return setError(E_INVALIDARG, tr("The USB device with UUID {%RTuuid} is not currently attached to the host"), Guid(aId).raw()); /* * Try to capture the device */ alock.release(); return pHostDevice->requestCaptureForVM(aMachine, true /* aSetError */); }
/** * Called to copy over the progress information from @a pOtherProgress. * * @param pOtherProgress The source of the information. * @param fEarly Early copy. * * @note The caller owns the write lock and as cleared mptrOtherProgress * already (or we might recurse forever)! */ void ProgressProxy::copyProgressInfo(IProgress *pOtherProgress, bool fEarly) { HRESULT hrc; LogFlowThisFunc(("\n")); NOREF(fEarly); /* * No point in doing this if the progress object was canceled already. */ if (!mCanceled) { /* Detect if the other progress object was canceled. */ BOOL fCanceled; hrc = pOtherProgress->COMGETTER(Canceled)(&fCanceled); if (FAILED(hrc)) fCanceled = FALSE; if (fCanceled) { LogFlowThisFunc(("Canceled\n")); mCanceled = TRUE; if (m_pfnCancelCallback) m_pfnCancelCallback(m_pvCancelUserArg); } else { /* Has it completed? */ BOOL fCompleted; hrc = pOtherProgress->COMGETTER(Completed)(&fCompleted); if (FAILED(hrc)) fCompleted = TRUE; Assert(fCompleted || fEarly); if (fCompleted) { /* Check the result. */ LONG hrcResult; hrc = pOtherProgress->COMGETTER(ResultCode)(&hrcResult); if (FAILED(hrc)) hrcResult = hrc; if (SUCCEEDED((HRESULT)hrcResult)) LogFlowThisFunc(("Succeeded\n")); else { /* Get the error information. */ ComPtr<IVirtualBoxErrorInfo> ptrErrorInfo; hrc = pOtherProgress->COMGETTER(ErrorInfo)(ptrErrorInfo.asOutParam()); if (SUCCEEDED(hrc) && !ptrErrorInfo.isNull()) { Bstr bstrIID; hrc = ptrErrorInfo->COMGETTER(InterfaceID)(bstrIID.asOutParam()); AssertComRC(hrc); if (FAILED(hrc)) bstrIID.setNull(); Bstr bstrComponent; hrc = ptrErrorInfo->COMGETTER(Component)(bstrComponent.asOutParam()); AssertComRC(hrc); if (FAILED(hrc)) bstrComponent = "failed"; Bstr bstrText; hrc = ptrErrorInfo->COMGETTER(Text)(bstrText.asOutParam()); AssertComRC(hrc); if (FAILED(hrc)) bstrText = "<failed>"; Utf8Str strText(bstrText); LogFlowThisFunc(("Got ErrorInfo(%s); hrcResult=%Rhrc\n", strText.c_str(), hrcResult)); Progress::notifyComplete((HRESULT)hrcResult, Guid(bstrIID).ref(), Utf8Str(bstrComponent).c_str(), "%s", strText.c_str()); } else { LogFlowThisFunc(("ErrorInfo failed with hrc=%Rhrc; hrcResult=%Rhrc\n", hrc, hrcResult)); Progress::notifyComplete((HRESULT)hrcResult, COM_IIDOF(IProgress), "ProgressProxy", tr("No error info")); } } } else LogFlowThisFunc(("Not completed\n")); } } else LogFlowThisFunc(("Already canceled\n")); /* * Did cancelable state change (point of no return)? */ if (mCancelable && !mCompleted && !mCanceled) { BOOL fCancelable; hrc = pOtherProgress->COMGETTER(Cancelable)(&fCancelable); AssertComRC(hrc); if (SUCCEEDED(hrc) && !fCancelable) { LogFlowThisFunc(("point-of-no-return reached\n")); mCancelable = FALSE; } } }
void TestLightmass() { UE_LOG(LogLightmass, Display, TEXT("\n\n")); UE_LOG(LogLightmass, Display, TEXT("===============================================================================================")); UE_LOG(LogLightmass, Display, TEXT("Running \"unit test\". This will take several seconds, and will end with an assertion.")); UE_LOG(LogLightmass, Display, TEXT("This is on purpose, as it's testing the callstack gathering...")); UE_LOG(LogLightmass, Display, TEXT("===============================================================================================")); UE_LOG(LogLightmass, Display, TEXT("\n\n")); void* Buf = FMemory::Malloc(1024); TArray<int32> TestArray; TestArray.Add(5); TArray<int32> ArrayCopy = TestArray; FVector4 TestVectorA(1, 0, 0, 1); FVector4 TestVectorB(1, 1, 1, 1); FVector4 TestVector = TestVectorA + TestVectorB; FString TestString = FString::Printf(TEXT("Copy has %d, Vector is [%.2f, %.2f, %.2f, %.2f]\n"), ArrayCopy[0], TestVector.X, TestVector.Y, TestVector.Z, TestVector.W); wprintf(*TestString); FMemory::Free(Buf); struct FAlignTester { uint8 A; FMatrix M1; uint8 B; FMatrix M2; uint8 C; FVector4 V; }; FAlignTester AlignTest; checkf(((PTRINT)(&FMatrix::Identity) & 15) == 0, TEXT("Identity matrix unaligned")); checkf(((PTRINT)(&AlignTest.M1) & 15) == 0, TEXT("First matrix unaligned")); checkf(((PTRINT)(&AlignTest.M2) & 15) == 0, TEXT("Second matrix unaligned")); checkf(((PTRINT)(&AlignTest.V) & 15) == 0, TEXT("Vector unaligned")); FGuid Guid(1, 2, 3, 4); UE_LOG(LogLightmass, Display, TEXT("Guid is %s"), *Guid.ToString()); TMap<FString, int32> TestMap; TestMap.Add(FString(TEXT("Five")), 5); TestMap.Add(TEXT("Ten"), 10); UE_LOG(LogLightmass, Display, TEXT("Map[Five] = %d, Map[Ten] = %d"), TestMap.FindRef(TEXT("Five")), TestMap.FindRef(FString(TEXT("Ten")))); FMatrix TestMatrix(FVector(0, 0, 0.1f), FVector(0, 1.0f, 0), FVector(0.9f, 0, 0), FVector(0, 0, 0)); UE_LOG(LogLightmass, Display, TEXT("Mat=\n [%0.2f, %0.2f, %0.2f, %0.2f]\n [%0.2f, %0.2f, %0.2f, %0.2f]\n [%0.2f, %0.2f, %0.2f, %0.2f]\n [%0.2f, %0.2f, %0.2f, %0.2f]"), TestMatrix.M[0][0], TestMatrix.M[0][1], TestMatrix.M[0][2], TestMatrix.M[0][3], TestMatrix.M[1][0], TestMatrix.M[1][1], TestMatrix.M[1][2], TestMatrix.M[1][3], TestMatrix.M[2][0], TestMatrix.M[2][1], TestMatrix.M[2][2], TestMatrix.M[2][3], TestMatrix.M[3][0], TestMatrix.M[3][1], TestMatrix.M[3][2], TestMatrix.M[3][3] ); TestMatrix = TestMatrix.GetTransposed(); UE_LOG(LogLightmass, Display, TEXT("Transposed Mat=\n [%0.2f, %0.2f, %0.2f, %0.2f]\n [%0.2f, %0.2f, %0.2f, %0.2f]\n [%0.2f, %0.2f, %0.2f, %0.2f]\n [%0.2f, %0.2f, %0.2f, %0.2f]"), TestMatrix.M[0][0], TestMatrix.M[0][1], TestMatrix.M[0][2], TestMatrix.M[0][3], TestMatrix.M[1][0], TestMatrix.M[1][1], TestMatrix.M[1][2], TestMatrix.M[1][3], TestMatrix.M[2][0], TestMatrix.M[2][1], TestMatrix.M[2][2], TestMatrix.M[2][3], TestMatrix.M[3][0], TestMatrix.M[3][1], TestMatrix.M[3][2], TestMatrix.M[3][3] ); TestMatrix = TestMatrix.GetTransposed().InverseFast(); UE_LOG(LogLightmass, Display, TEXT("Inverted Mat=\n [%0.2f, %0.2f, %0.2f, %0.2f]\n [%0.2f, %0.2f, %0.2f, %0.2f]\n [%0.2f, %0.2f, %0.2f, %0.2f]\n [%0.2f, %0.2f, %0.2f, %0.2f]"), TestMatrix.M[0][0], TestMatrix.M[0][1], TestMatrix.M[0][2], TestMatrix.M[0][3], TestMatrix.M[1][0], TestMatrix.M[1][1], TestMatrix.M[1][2], TestMatrix.M[1][3], TestMatrix.M[2][0], TestMatrix.M[2][1], TestMatrix.M[2][2], TestMatrix.M[2][3], TestMatrix.M[3][0], TestMatrix.M[3][1], TestMatrix.M[3][2], TestMatrix.M[3][3] ); UE_LOG(LogLightmass, Display, TEXT("sizeof FDirectionalLight = %d, FLight = %d, FDirectionalLightData = %d"), sizeof(FDirectionalLight), sizeof(FLight), sizeof(FDirectionalLightData)); TOctree<float, FTestOctreeSemantics> TestOctree(FVector4(0), 10.0f); TestOctree.AddElement(5); // kDOP test TkDOPTree<FTestCollisionDataProvider, uint16> TestkDOP; FTestCollisionDataProvider TestDataProvider(TestkDOP); FHitResult TestResult; FkDOPBuildCollisionTriangle<uint16> TestTri(0, FVector4(0,0,0,0), FVector4(1,1,1,0), FVector4(2,2,2,0), INDEX_NONE, INDEX_NONE, INDEX_NONE, false, true); TArray<FkDOPBuildCollisionTriangle<uint16> > TestTriangles; TestTriangles.Add(TestTri); TestkDOP.Build(TestTriangles); UE_LOG(LogLightmass, Display, TEXT("\nStarting a thread")); FTestRunnable* TestRunnable = new FTestRunnable; // create a thread with the test runnable, and let it auto-delete itself FRunnableThread* TestThread = FRunnableThread::Create(TestRunnable, TEXT("TestRunnable")); double Start = FPlatformTime::Seconds(); UE_LOG(LogLightmass, Display, TEXT("\nWaiting 4 seconds"), Start); FPlatformProcess::Sleep(4.0f); UE_LOG(LogLightmass, Display, TEXT("%.2f seconds have passed, killing thread"), FPlatformTime::Seconds() - Start); // wait for thread to end double KillStart = FPlatformTime::Seconds(); TestRunnable->Stop(); TestThread->WaitForCompletion(); delete TestThread; delete TestRunnable; UE_LOG(LogLightmass, Display, TEXT("It took %.2f seconds to kill the thread [should be < 1 second]"), FPlatformTime::Seconds() - KillStart); UE_LOG(LogLightmass, Display, TEXT("\n\n")); checkf(5 == 2, TEXT("And boom goes the dynamite\n")); }
EsifDataGuid::operator Guid(void) const { return Guid(m_guid); }
EsifDataGuid::EsifDataGuid(void) { initialize(Guid()); }
Guid Guid::createInvalid() { return Guid(); }