int irc_recv_nosuchnick(void* data) { struct irc_msgdata *msgdata = (struct irc_msgdata *) data; char* params[2]; if(irc_parse_paramlist(msgdata->msg, params, 2) != 2) { slog(LOG_WARNING, "Recibido mensaje ERR_NOSUCHNICK (401) mal formado: %s", msgdata->msg); return OK; } if(!strncmp(params[1], msgdata->clientdata->call_user, MAX_NICK_LEN) && msgdata->clientdata->call_status == call_outgoing) { errorText("No se puede realizar la llamada: el usuario %s no existe.", params[1]); msgdata->clientdata->call_status = call_none; close(msgdata->clientdata->call_socket); signal(SIGALRM, SIG_IGN); } else { errorText("El usuario %s no existe", params[1]); } return OK; }
int CGMSKModemLibUsb::writeData(const unsigned char* data, unsigned int length) { wxASSERT(m_dev != NULL); wxASSERT(data != NULL); wxASSERT(length > 0U && length <= DV_FRAME_LENGTH_BYTES); unsigned char* buffer = const_cast<unsigned char*>(data); if (length > GMSK_MODEM_DATA_LENGTH) { int len1 = m_usbControlMsg(m_dev, 0x40, PUT_DATA, 0, 0, (char*)buffer, GMSK_MODEM_DATA_LENGTH, USB_TIMEOUT); if (len1 < 0) { if (len1 == -19) { // -ENODEV wxString errorText(m_usbStrerror(), wxConvLocal); wxLogMessage(wxT("PUT_DATA, ret: %d, err=%s"), len1, errorText.c_str()); return len1; } return 0; } if (len1 < int(GMSK_MODEM_DATA_LENGTH)) return len1; // Give libUSB some recovery time ::wxMilliSleep(3UL); int len2 = m_usbControlMsg(m_dev, 0x40, PUT_DATA, 0, 0, (char*)(buffer + GMSK_MODEM_DATA_LENGTH), length - GMSK_MODEM_DATA_LENGTH, USB_TIMEOUT); if (len2 < 0) { if (len2 == -19) { // -ENODEV wxString errorText(m_usbStrerror(), wxConvLocal); wxLogMessage(wxT("PUT_DATA, ret: %d, err=%s"), len2, errorText.c_str()); return len2; } return int(GMSK_MODEM_DATA_LENGTH); } return len2 + int(GMSK_MODEM_DATA_LENGTH); } else { int len = m_usbControlMsg(m_dev, 0x40, PUT_DATA, 0, 0, (char*)buffer, length, USB_TIMEOUT); if (len < 0) { if (len == -19) { // -ENODEV wxString errorText(m_usbStrerror(), wxConvLocal); wxLogMessage(wxT("PUT_DATA, ret: %d, err=%s"), len, errorText.c_str()); return len; } return 0; } return len; } }
void VcsCommand::run(QFutureInterface<void> &future) { // Check that the binary path is not empty if (binaryPath().isEmpty()) { emit errorText(tr("Unable to start process, binary is empty")); return; } QString stdOut; QString stdErr; if (d->m_progressParser) d->m_progressParser->setFuture(&future); else future.setProgressRange(0, 1); const int count = d->m_jobs.size(); d->m_lastExecExitCode = -1; d->m_lastExecSuccess = true; for (int j = 0; j < count; j++) { const Internal::VcsCommandPrivate::Job &job = d->m_jobs.at(j); const int timeOutSeconds = job.timeout; Utils::SynchronousProcessResponse resp = runVcs( job.arguments, timeOutSeconds >= 0 ? timeOutSeconds * 1000 : -1, job.exitCodeInterpreter); stdOut += resp.stdOut; stdErr += resp.stdErr; d->m_lastExecExitCode = resp.exitCode; d->m_lastExecSuccess = resp.result == Utils::SynchronousProcessResponse::Finished; if (!d->m_lastExecSuccess) break; } if (!d->m_aborted) { if (!d->m_progressiveOutput) { emit output(stdOut); if (!stdErr.isEmpty()) emit errorText(stdErr); } emit finished(d->m_lastExecSuccess, d->m_lastExecExitCode, cookie()); if (d->m_lastExecSuccess) emit success(cookie()); future.setProgressValue(future.progressMaximum()); } if (d->m_progressParser) d->m_progressParser->setFuture(0); // As it is used asynchronously, we need to delete ourselves this->deleteLater(); }
void CChildView::OnPaint() { CPaintDC dc(this); // device context for painting FlickerFree::CMemDC pDC(&dc); try { m_mfcHandler.draw(pDC); m_mfcHandler2.draw(pDC); } catch (...) { CString errorText(EXCEPTION_MSG); AfxMessageBox(errorText); this->GetParentFrame()->PostMessage(WM_CLOSE); } //dc.FillRect(CRect(10, 10, 555, 555), (CBrush*) GetStockObject(BLACK_BRUSH)); //pDC->LineTo(pt); /* CRect rtlp; CBrush cbrush; rtlp.left = 0; rtlp.top = 0; rtlp.right = 555; rtlp.bottom = 555; cbrush.CreateSolidBrush(RGB(255,0,0)); dc.FillRect(rtlp, &(cbrush));*/ // Do not call CWnd::OnPaint() for painting messages }
/******************************************************************************* * Presenta un mensaje protegido por semaforos al usuario. * * * * Parámetros: * * -Nombre de usuario. * -Mensaje. * -Tipo de mensaje. * -Proceso que llama. * * * Retorno: * * -void * * * *******************************************************************************/ void interfaceText(char *username, char *message, int type, int main_thread){ if(!main_thread){ gdk_threads_enter(); } switch(type){ case MSG_TEXT: messageText(message); break; case ERROR_TEXT: errorText(message); break; case PRIVATE_TEXT: privateText(username, message); break; case PUBLIC_TEXT: publicText(username, message); break; default: break; } if(!main_thread){ gdk_threads_leave(); } }
int irc_nickcollision(void *data) { struct irc_msgdata *msgdata = (struct irc_msgdata *) data; errorText("El nick que has escogido (%s) está en uso. Elige otro con el comando \"/nick tunuevonick\"", msgdata->clientdata->nick); return OK; }
int CGMSKModemLibUsb::readData(unsigned char* data, unsigned int length, bool& end) { wxASSERT(data != NULL); wxASSERT(length > 0U); end = false; int ret = io(0xC0, GET_DATA, 0, 0, (char*)data, GMSK_MODEM_DATA_LENGTH, USB_TIMEOUT); if (ret < 0) { wxString errorText(m_usbStrerror(), wxConvLocal); wxLogMessage(wxT("GET_DATA, ret: %d, err=%s"), ret, errorText.c_str()); if (ret == -19) // -ENODEV return ret; return 0; } else if (ret == 0) { char status; int ret = io(0xC0, GET_AD_STATUS, 0, 0, &status, 1, USB_TIMEOUT); if (ret < 0) { wxString error(m_usbStrerror(), wxConvLocal); wxLogMessage(wxT("LAST_FRAME, ret: %d, err=%s"), ret, error.c_str()); if (ret == -19) // -ENODEV return ret; return 0; } if ((status & LAST_FRAME) == LAST_FRAME) end = true; } return ret; }
CPixelBufferView::EffectPtr CPixelBufferView::CreateEffectFromResource(const TCHAR* resourceName) { HRESULT result = S_OK; HRSRC shaderResourceInfo = FindResource(GetModuleHandle(nullptr), resourceName, _T("TEXTFILE")); assert(shaderResourceInfo != nullptr); HGLOBAL shaderResourceHandle = LoadResource(GetModuleHandle(nullptr), shaderResourceInfo); DWORD shaderResourceSize = SizeofResource(GetModuleHandle(nullptr), shaderResourceInfo); const char* shaderData = reinterpret_cast<const char*>(LockResource(shaderResourceHandle)); EffectPtr effect; Framework::Win32::CComPtr<ID3DXBuffer> errors; result = D3DXCreateEffect(m_device, shaderData, shaderResourceSize, nullptr, nullptr, 0, nullptr, &effect, &errors); if(!errors.IsEmpty()) { std::string errorText(reinterpret_cast<const char*>(errors->GetBufferPointer()), reinterpret_cast<const char*>(errors->GetBufferPointer()) + errors->GetBufferSize()); OutputDebugStringA("Failed to compile shader:\r\n"); OutputDebugStringA(errorText.c_str()); } assert(SUCCEEDED(result)); UnlockResource(shaderResourceHandle); return effect; }
void VcsCommand::bufferedError(const QString &text) { if (!(d->m_flags & VcsBasePlugin::SuppressStdErrInLogWindow)) VcsOutputWindow::appendError(text); if (d->m_progressiveOutput) emit errorText(text); }
int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here try { m_mfcHandler.setParameters(40, CPoint(60, 20)); m_engine.setParameters(&m_mfcHandler, 3, 3, 3); m_engine.newGame(); m_mfcHandler2.setParameters(60, CPoint(500, 20)); m_engine2.setParameters(&m_mfcHandler2, 5, 4, 3); m_engine2.newGame(); } catch (...) { CString errorText(EXCEPTION_MSG); AfxMessageBox(errorText); this->GetParentFrame()->PostMessage(WM_CLOSE); return -1; } return 0; }
void displayErrorDialog(const Common::Error &error, const char *extraText) { Common::String errorText(extraText); errorText += " "; errorText += _(error.getDesc()); GUI::MessageDialog alert(errorText); alert.runModal(); }
static void errorAndQuit(const char* errorStr){ errorConf error; errorInit(&error, ERROR_TEXT, CFG_LANGUAGE_EN); errorText(&error, errorStr); errorDisp(&error); exit(0); }
void ProvisioningAttrList::validateAttribute(const char* pKey, eAttributeType type, bool ignoreMissing) { UtlContainable* attribute; UtlString utlKey(pKey); attribute = dynamic_cast<const UtlHashMap*>(mpData)->findValue(&utlKey); if (attribute == NULL) { if (ignoreMissing) { // If it is missing, just return return; } else { UtlString errorText("Missing attribute: '"); errorText += pKey; errorText += "'"; throw errorText; } } switch (type) { case ProvisioningAttrList::INT: if (UtlString(attribute->getContainableType()) != "UtlInt") { UtlString errorText("Attribute '"); errorText += pKey; errorText += "' must be of type: INT"; throw errorText; } break; case ProvisioningAttrList::BOOL: if (UtlString(attribute->getContainableType()) != "UtlBool") { UtlString errorText("Attribute: '"); errorText += pKey; errorText += "' must be of type: BOOL"; throw errorText; } break; case ProvisioningAttrList::STRING: if (UtlString(attribute->getContainableType()) != "UtlString") { UtlString errorText("Attribute: '"); errorText += pKey; errorText += "' must be of type: STRING"; throw errorText; } break; } }
QString Job::errorString() const { if (!errorText().isEmpty()) { return errorText(); } if (archive()) { if (archive()->error() == NoPlugin) { return i18n("No suitable plugin found. Ark does not seem to support this file type."); } if (archive()->error() == FailedPlugin) { return i18n("Failed to load a suitable plugin. Make sure any executables needed to handle the archive type are installed."); } } return QString(); }
Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); QString path = QDir::currentPath() + QString( "/Persons.sqlite" ); try { m_database.setDatabaseName( path ); } catch ( const EmptyArgumentError &e ) { QString errorText( e.what() ); QMessageBox::information( this, tr( "Error" ), errorText ); } catch ( const FileError &e ) { QString errorText( e.what() ); QMessageBox::information( this, tr( "Error" ), errorText ); } catch( ... ) { QString errorText( "Unknown expection" ); QMessageBox::information( this, tr( "Error" ), errorText ); } }
bool CGMSKModemLibUsb::setPTT(bool on) { char c; int ret = io(0x40, SET_PTT, on ? PTT_ON : PTT_OFF, 0, &c, 0, USB_TIMEOUT); if (ret < 0) { wxString errorText(m_usbStrerror(), wxConvLocal); wxLogMessage(wxT("SET_PTT, ret: %d, err=%s"), ret, errorText.c_str()); return false; } return true; }
QString PlayerActionJob::errorString() const { if (error() == Denied) { return i18n("The media player '%1' cannot perform the action '%2'.", m_controller->name(), operationName()); } else if (error() == Failed) { return i18n("Attempting to perform the action '%1' failed with the message '%2'.", operationName(), errorText()); } else if (error() == MissingArgument) { return i18n("The argument '%1' for the action '%2' is missing or of the wrong type.", operationName(), errorText()); } else if (error() == UnknownOperation) { return i18n("The operation '%1' is unknown.", operationName()); } return i18n("Unknown error."); }
void newText (const char *msg) { char irc_msg[MAX_IRC_MSG]; if (!msg) { slog(LOG_ERR, "Se ha colado un mensaje NULL desde la interfaz"); return; } slog(LOG_DEBUG, "Recibido el mensaje \"%s\" desde interfaz para ser procesado", msg); if(!client->connected && !_is_server_message(msg)) { errorText("No estás conectado a ningún servidor."); return; } if (*msg != '/') { if (!client->in_channel) { errorText("No perteneces a ningún canal al que enviar el mensaje"); } else { /* Mandamos al servidor el mensaje para los usuarios del canal. */ irc_send_message(snd_qid, client->serv_sock, "PRIVMSG %s :%s", client->chan, msg); privateText(client->nick, msg); } } else { snprintf(irc_msg, MAX_IRC_MSG, "%s\r\n", msg + 1); irc_user_msgprocess(irc_msg, client); } }
void connectToFavServ(int favserv) { struct serv_info serv; if(serv_get_number(favserv, &serv) != OK) { errorText("No hemos podido recuperar el servidor número %d", favserv); return; } setServidor(serv.servname); setPuerto(serv.port); connectToServer(serv.servname, serv.port); }
TRISTATE CGMSKModemLibUsb::getPTT() { char status; int rc = io(0xC0, GET_AD_STATUS, 0, 0, &status, 1, USB_TIMEOUT); if (rc <= 0) { wxString errorText(m_usbStrerror(), wxConvLocal); wxLogMessage(wxT("GET_PTT, ret: %d, err=%s"), rc, errorText.c_str()); return STATE_UNKNOWN; } if ((status & PTT_OnOff) == PTT_OnOff) return STATE_TRUE; else return STATE_FALSE; }
void Dialog::on_savePushButton_clicked() { QString nickName = ui->nickNameLineEdit->text(); QString firstName = ui->firstNameLineEdit->text(); QString lastName = ui->lastNameLineEdit->text(); QString phoneNumber = ui->phoneNumberLineEdit->text(); QString email = ui->emailLineEdit->text(); Person person( nickName, firstName, lastName, phoneNumber, email ); try { m_database.savePerson( person ); } catch ( const LogicError &e ) { QString errorText( e.what() ); QMessageBox::information( this, tr( "Error" ), errorText ); } catch ( const FileError &e ) { QString errorText( e.what() ); QMessageBox::information( this, tr( "Error" ), errorText ); } catch( ... ) { QString errorText( "Unknown expection" ); QMessageBox::information( this, tr( "Error" ), errorText ); } }
int irc_needmoreparams(void *data) { struct irc_msgdata *msgdata = (struct irc_msgdata *) data; char *params[2]; if (irc_parse_paramlist(msgdata->msg, params, 2) < 2) { slog(LOG_ERR, "Respuesta ERR_NEEDMOREPARAMS mal formada: %s", msgdata->msg); return OK; } errorText("Se necesitan más parámetros para el comando %s", params[1]); return OK; }
void CChildView::OnLButtonDown(UINT nFlags, CPoint point) { try { m_mfcHandler.onLButtonDown(nFlags, point); m_mfcHandler2.onLButtonDown(nFlags, point); Invalidate(); UpdateWindow(); } catch (...) { CString errorText(EXCEPTION_MSG); AfxMessageBox(errorText); this->GetParentFrame()->PostMessage(WM_CLOSE); } CWnd::OnLButtonDown(nFlags, point); }
TRISTATE CGMSKModemLibUsb::hasSpace() { if (m_broken) return STATE_TRUE; char space; int rc = io(0xC0, GET_REMAINSPACE, 0, 0, &space, 1, USB_TIMEOUT); if (rc != 1) { wxString errorText(m_usbStrerror(), wxConvLocal); wxLogMessage(wxT("GET_REMAINSPACE, ret: %d, err=%s"), rc, errorText.c_str()); return STATE_UNKNOWN; } if (space > 0) return STATE_TRUE; else return STATE_FALSE; }
void SvnJobBase::internalJobFailed( ThreadWeaver::Job* job ) { if( internalJob() == job ) { setError( 255 ); QString msg = internalJob()->errorMessage(); if( !msg.isEmpty() ) setErrorText( i18n( "Error executing Job:\n%1", msg ) ); outputMessage(errorText()); kDebug(9510) << "Job failed"; if( m_status != VcsJob::JobCanceled ) { m_status = KDevelop::VcsJob::JobFailed; } emitResult(); } if( m_status == VcsJob::JobCanceled ) { deleteLater(); } }
bool AutomaticLoginSettings::setAutoLoginUser(const QString& username) { KAuth::Action saveAction(QString("org.kde.kcontrol.kcmsddm.save")); saveAction.setHelperId("org.kde.kcontrol.kcmsddm"); QVariantMap args; args["sddm.conf"] = SDDM_CONFIG_FILE; args["sddm.conf/Autologin/User"] = username; saveAction.setHelperId("org.kde.kcontrol.kcmsddm"); saveAction.setArguments(args); auto job = saveAction.execute(); if (!job->exec()) { qDebug() << "fail" << job->errorText(); return false; } m_autoLoginUser = username; return true; }
void CChildView::OnRButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default try { Coordinate coord; if (m_mfcHandler.getBoardSquareByScreenCoord(point, coord)) { m_engine.setParameters(&m_mfcHandler, 6, 5, 3); m_engine.newGame(); m_engine2.newGame(); Invalidate(); UpdateWindow(); } } catch (...) { CString errorText(EXCEPTION_MSG); AfxMessageBox(errorText); this->GetParentFrame()->PostMessage(WM_CLOSE); } CWnd::OnRButtonDown(nFlags, point); }
void GitCommand::run() { if (Git::Constants::debug) qDebug() << "GitCommand::run" << m_workingDirectory << m_jobs.size(); QProcess process; if (!m_workingDirectory.isEmpty()) process.setWorkingDirectory(m_workingDirectory); process.setEnvironment(m_environment); QByteArray stdOut; QByteArray stdErr; QString error; const int count = m_jobs.size(); int exitCode = -1; bool ok = true; for (int j = 0; j < count; j++) { if (Git::Constants::debug) qDebug() << "GitCommand::run" << j << '/' << count << m_jobs.at(j).arguments; process.start(m_binaryPath, m_basicArguments + m_jobs.at(j).arguments); if(!process.waitForStarted()) { ok = false; error += QString::fromLatin1("Error: \"%1\" could not be started: %2").arg(m_binaryPath, process.errorString()); break; } process.closeWriteChannel(); const int timeOutSeconds = m_jobs.at(j).timeout; if (!Utils::SynchronousProcess::readDataFromProcess(process, timeOutSeconds * 1000, &stdOut, &stdErr)) { Utils::SynchronousProcess::stopProcess(process); ok = false; error += msgTimeout(timeOutSeconds); break; } error += QString::fromLocal8Bit(stdErr); exitCode = process.exitCode(); switch (m_reportTerminationMode) { case NoReport: break; case ReportStdout: stdOut += msgTermination(exitCode, m_binaryPath, m_jobs.at(j).arguments).toUtf8(); break; case ReportStderr: error += msgTermination(exitCode, m_binaryPath, m_jobs.at(j).arguments); break; } } // Special hack: Always produce output for diff if (ok && stdOut.isEmpty() && m_jobs.front().arguments.at(0) == QLatin1String("diff")) { stdOut += "No difference to HEAD"; } else { // @TODO: Remove, see below if (ok && m_jobs.front().arguments.at(0) == QLatin1String("status")) removeColorCodes(&stdOut); } if (ok && !stdOut.isEmpty()) emit outputData(stdOut); if (!error.isEmpty()) emit errorText(error); emit finished(ok, exitCode, m_cookie); if (ok) emit success(); // As it is used asynchronously, we need to delete ourselves this->deleteLater(); }
void Command::run() { // Check that the binary path is not empty if (binaryPath().trimmed().isEmpty()) { emit errorText(tr("Unable to start process, binary is empty")); return; } const unsigned processFlags = unixTerminalDisabled() ? unsigned(Utils::SynchronousProcess::UnixTerminalDisabled) : unsigned(0); const QSharedPointer<QProcess> process = Utils::SynchronousProcess::createProcess(processFlags); if (!workingDirectory().isEmpty()) process->setWorkingDirectory(workingDirectory()); process->setProcessEnvironment(processEnvironment()); QByteArray stdOut; QByteArray stdErr; QString error; const int count = d->m_jobs.size(); int exitCode = -1; bool ok = true; for (int j = 0; j < count; j++) { process->start(binaryPath(), d->m_jobs.at(j).arguments); if (!process->waitForStarted()) { ok = false; error += QString::fromLatin1("Error: \"%1\" could not be started: %2") .arg(binaryPath(), process->errorString()); break; } process->closeWriteChannel(); const int timeOutSeconds = d->m_jobs.at(j).timeout; if (!Utils::SynchronousProcess::readDataFromProcess(*process, timeOutSeconds * 1000, &stdOut, &stdErr, false)) { Utils::SynchronousProcess::stopProcess(*process); ok = false; error += msgTimeout(timeOutSeconds); break; } error += QString::fromLocal8Bit(stdErr); exitCode = process->exitCode(); switch (reportTerminationMode()) { case NoReport: break; case ReportStdout: stdOut += msgTermination(exitCode, binaryPath(), d->m_jobs.at(j).arguments).toUtf8(); break; case ReportStderr: error += msgTermination(exitCode, binaryPath(), d->m_jobs.at(j).arguments); break; } } // Special hack: Always produce output for diff if (ok && stdOut.isEmpty() && d->m_jobs.front().arguments.at(0) == QLatin1String("diff")) { stdOut += "No difference to HEAD"; } else { // @TODO: Remove, see below if (ok && d->m_jobs.front().arguments.at(0) == QLatin1String("status")) removeColorCodes(&stdOut); } d->m_lastExecSuccess = ok; d->m_lastExecExitCode = exitCode; if (ok && !stdOut.isEmpty()) emit outputData(stdOut); if (!error.isEmpty()) emit errorText(error); emit finished(ok, exitCode, cookie()); if (ok) emit success(cookie()); // As it is used asynchronously, we need to delete ourselves this->deleteLater(); }
// Convert a failure type into a string wstring FunctionTracer::HResult2String(HRESULT hrError) { switch (hrError) { CHECK_CASE_FOR_CONSTANT(VSS_E_BAD_STATE ); CHECK_CASE_FOR_CONSTANT(VSS_E_UNEXPECTED ); CHECK_CASE_FOR_CONSTANT(VSS_E_PROVIDER_ALREADY_REGISTERED ); CHECK_CASE_FOR_CONSTANT(VSS_E_PROVIDER_NOT_REGISTERED); CHECK_CASE_FOR_CONSTANT(VSS_E_PROVIDER_VETO ); CHECK_CASE_FOR_CONSTANT(VSS_E_PROVIDER_IN_USE); CHECK_CASE_FOR_CONSTANT(VSS_E_OBJECT_NOT_FOUND); CHECK_CASE_FOR_CONSTANT(VSS_S_ASYNC_PENDING ); CHECK_CASE_FOR_CONSTANT(VSS_S_ASYNC_FINISHED); CHECK_CASE_FOR_CONSTANT(VSS_S_ASYNC_CANCELLED); CHECK_CASE_FOR_CONSTANT(VSS_E_VOLUME_NOT_SUPPORTED ); CHECK_CASE_FOR_CONSTANT(VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER ); CHECK_CASE_FOR_CONSTANT(VSS_E_OBJECT_ALREADY_EXISTS ); CHECK_CASE_FOR_CONSTANT(VSS_E_UNEXPECTED_PROVIDER_ERROR ); CHECK_CASE_FOR_CONSTANT(VSS_E_INVALID_XML_DOCUMENT ); CHECK_CASE_FOR_CONSTANT(VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED ); CHECK_CASE_FOR_CONSTANT(VSS_E_FLUSH_WRITES_TIMEOUT ); CHECK_CASE_FOR_CONSTANT(VSS_E_HOLD_WRITES_TIMEOUT ); CHECK_CASE_FOR_CONSTANT(VSS_E_UNEXPECTED_WRITER_ERROR ); CHECK_CASE_FOR_CONSTANT(VSS_E_SNAPSHOT_SET_IN_PROGRESS ); CHECK_CASE_FOR_CONSTANT(VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED ); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITER_INFRASTRUCTURE ); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITER_NOT_RESPONDING ); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITER_ALREADY_SUBSCRIBED ); CHECK_CASE_FOR_CONSTANT(VSS_E_UNSUPPORTED_CONTEXT ); CHECK_CASE_FOR_CONSTANT(VSS_E_VOLUME_IN_USE ); CHECK_CASE_FOR_CONSTANT(VSS_E_MAXIMUM_DIFFAREA_ASSOCIATIONS_REACHED ); CHECK_CASE_FOR_CONSTANT(VSS_E_INSUFFICIENT_STORAGE ); CHECK_CASE_FOR_CONSTANT(VSS_E_NO_SNAPSHOTS_IMPORTED ); CHECK_CASE_FOR_CONSTANT(VSS_S_SOME_SNAPSHOTS_NOT_IMPORTED ); CHECK_CASE_FOR_CONSTANT(VSS_E_MAXIMUM_NUMBER_OF_REMOTE_MACHINES_REACHED ); CHECK_CASE_FOR_CONSTANT(VSS_E_REMOTE_SERVER_UNAVAILABLE ); CHECK_CASE_FOR_CONSTANT(VSS_E_REMOTE_SERVER_UNSUPPORTED ); CHECK_CASE_FOR_CONSTANT(VSS_E_REVERT_IN_PROGRESS ); CHECK_CASE_FOR_CONSTANT(VSS_E_REVERT_VOLUME_LOST ); CHECK_CASE_FOR_CONSTANT(VSS_E_REBOOT_REQUIRED ); CHECK_CASE_FOR_CONSTANT(VSS_E_TRANSACTION_FREEZE_TIMEOUT ); CHECK_CASE_FOR_CONSTANT(VSS_E_TRANSACTION_THAW_TIMEOUT ); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITERERROR_INCONSISTENTSNAPSHOT ); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITERERROR_OUTOFRESOURCES); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITERERROR_TIMEOUT ); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITERERROR_RETRYABLE); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITERERROR_NONRETRYABLE); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITERERROR_RECOVERY_FAILED ); CHECK_CASE_FOR_CONSTANT(VSS_E_BREAK_REVERT_ID_FAILED); CHECK_CASE_FOR_CONSTANT(VSS_E_LEGACY_PROVIDER); CHECK_CASE_FOR_CONSTANT(VSS_E_MISSING_DISK ); CHECK_CASE_FOR_CONSTANT(VSS_E_MISSING_HIDDEN_VOLUME ); CHECK_CASE_FOR_CONSTANT(VSS_E_MISSING_VOLUME ); CHECK_CASE_FOR_CONSTANT(VSS_E_AUTORECOVERY_FAILED ); CHECK_CASE_FOR_CONSTANT(VSS_E_DYNAMIC_DISK_ERROR ); CHECK_CASE_FOR_CONSTANT(VSS_E_NONTRANSPORTABLE_BCD ); CHECK_CASE_FOR_CONSTANT(VSS_E_CANNOT_REVERT_DISKID ); CHECK_CASE_FOR_CONSTANT(VSS_E_RESYNC_IN_PROGRESS ); CHECK_CASE_FOR_CONSTANT(VSS_E_CLUSTER_ERROR ); CHECK_CASE_FOR_CONSTANT(VSS_E_ASRERROR_DISK_ASSIGNMENT_FAILED ); CHECK_CASE_FOR_CONSTANT(VSS_E_ASRERROR_DISK_RECREATION_FAILED ); CHECK_CASE_FOR_CONSTANT(VSS_E_ASRERROR_NO_ARCPATH ); CHECK_CASE_FOR_CONSTANT(VSS_E_ASRERROR_MISSING_DYNDISK ); CHECK_CASE_FOR_CONSTANT(VSS_E_ASRERROR_SHARED_CRIDISK ); CHECK_CASE_FOR_CONSTANT(VSS_E_ASRERROR_DATADISK_RDISK0 ); CHECK_CASE_FOR_CONSTANT(VSS_E_ASRERROR_RDISK0_TOOSMALL ); CHECK_CASE_FOR_CONSTANT(VSS_E_ASRERROR_CRITICAL_DISKS_TOO_SMALL ); CHECK_CASE_FOR_CONSTANT(VSS_E_WRITER_STATUS_NOT_AVAILABLE ); CHECK_CASE_FOR_CONSTANT(VSS_E_UNSELECTED_VOLUME ); CHECK_CASE_FOR_CONSTANT(VSS_E_SNAPSHOT_NOT_IN_SET ); CHECK_CASE_FOR_CONSTANT(VSS_E_NESTED_VOLUME_LIMIT ); // Regular COM errors CHECK_CASE_FOR_CONSTANT(S_OK); CHECK_CASE_FOR_CONSTANT(S_FALSE); CHECK_CASE_FOR_CONSTANT(E_UNEXPECTED); CHECK_CASE_FOR_CONSTANT(E_OUTOFMEMORY); default: break; } PWCHAR pwszBuffer = NULL; DWORD dwRet = ::FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, hrError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&pwszBuffer, 0, NULL); // No message found for this error. Just return <Unknown> if (dwRet == 0) return wstring(L"<Unknown error code>"); // Convert the message into wstring wstring errorText(pwszBuffer); LocalFree(pwszBuffer); return errorText; }