ErrorCode ComProxyXmlLiteWriter::WriteNode(ComPointer<IXmlReader> const& reader, bool writeDefaultAttributes) { HRESULT hr = writer_->WriteNode(reader.GetRawPointer(), writeDefaultAttributes); // The ToErrorCode method below has an option to accept S_FALSE as a success HRESULT value. This parameter must be set to true, or else // this method returns an error. // While XMLWriter normally returns S_OK as a success value, WriteNode does not. return ToErrorCode(hr, L"WriteNode", true, true); }
ErrorCode ComProxyXmlLiteWriter::SetOutput(wstring const & outputName, ComPointer<IUnknown> const & output) { auto hr = writer_->SetOutput(output.GetRawPointer()); auto error = ToErrorCode(hr, L"SetOutput", outputName, true, false); if (error.IsSuccess()) { outputName_ = outputName; } return error; }
void ComTestStoreService::CheckForReportFaultsAndDelays(ComPointer<IFabricStatefulServicePartition> partition, ApiFaultHelper::ComponentName compName, std::wstring operationName) { if (testStoreService_.ShouldFailOn(compName, operationName, ApiFaultHelper::ReportFaultPermanent)) { if (partition.GetRawPointer() != nullptr) { partition->ReportFault(FABRIC_FAULT_TYPE::FABRIC_FAULT_TYPE_PERMANENT); } }; if (testStoreService_.ShouldFailOn(compName, operationName, ApiFaultHelper::ReportFaultTransient)) { if (partition.GetRawPointer() != nullptr) { partition->ReportFault(FABRIC_FAULT_TYPE::FABRIC_FAULT_TYPE_TRANSIENT); } }; if (testStoreService_.ShouldFailOn(compName, operationName, ApiFaultHelper::Delay)) { ::Sleep(static_cast<DWORD>(ApiFaultHelper::Get().GetApiDelayInterval().TotalMilliseconds())); } }
ErrorCode ComProxyFabricTransportCallbackMessageHandler::HandleOneWay( wstring const & , MessageUPtr && message) { ComPointer<IFabricTransportMessage> msgCPointer = make_com<ComFabricTransportMessage, IFabricTransportMessage>(move(message)); auto hr = comImpl_->HandleOneWay( msgCPointer.GetRawPointer()); return ErrorCode::FromHResult(hr); }
ErrorCode ComProxyXmlLiteWriter::Create( ComPointer<IUnknown> const& output, __out ComProxyXmlLiteWriterUPtr & xmlLiteWriter, bool writeByteOrderMark, bool indent) { ComPointer<IXmlWriter> writer; #if !defined(PLATFORM_UNIX) auto hr = ::CreateXmlWriter( ::IID_IXmlWriter, writer.VoidInitializationAddress(), NULL); #else auto hr = ::CreateMemoryXmlWriter( ::IID_IXmlWriter, output.GetRawPointer(), writer.VoidInitializationAddress(), NULL); #endif auto error = ToErrorCode(hr, L"CreateXmlWriter", L"", true, false); if (!error.IsSuccess()) { return error; } if (writeByteOrderMark == false) { hr = writer->SetProperty(XmlWriterProperty_ByteOrderMark, FALSE); error = ToErrorCode(hr, L"SetProperty", L"", true, false); if (!error.IsSuccess()) { return error; } } if (indent) { hr = writer->SetProperty(XmlWriterProperty_Indent, TRUE); error = ToErrorCode(hr, L"SetProperty", L"", true, false); if (!error.IsSuccess()) { return error; } } xmlLiteWriter = move(make_unique<ComProxyXmlLiteWriter>(writer)); #if !defined(PLATFORM_UNIX) error = xmlLiteWriter->SetOutput(L"CustomOutput", output); if (!error.IsSuccess()) { return error; } #endif return ErrorCode(ErrorCodeValue::Success); }
HRESULT ComProxyStatefulService::ChangeRoleAsyncOperation::EndComAsyncOperation(IFabricAsyncOperationContext * context) { HRESULT hr; ComPointer<IFabricStringResult> stringResult; hr = owner_.service_->EndChangeRole(context, stringResult.InitializationAddress()); if(SUCCEEDED(hr)) { if (stringResult.GetRawPointer() != nullptr) { hr = StringUtility::LpcwstrToWstring(stringResult->get_String(), true /*acceptNull*/, 0 /*minSize*/, ParameterValidator::MaxEndpointSize, serviceLocation_); } else { serviceLocation_ = L""; } } return hr; }