// Writes a string to the pipe. Returns ERROR_SUCCESS if successful, else // returns GetLastError() of the write. This function does not return until // the entire message has been sent (or an error occurs). static DWORD WriteMessageToPipe(HANDLE pipe, const std::string& message) { if (message.empty()) { return ERROR_SUCCESS;
}
internal::ScopedOverlapped overlapped; if (!overlapped.is_valid()) { return GetLastError();
}
ResultCode ContentAnalysisEventWin::Init() { // TODO(rogerta): do some extra validation of the request? if (request()->request_token().empty()) { return ResultCode::ERR_MISSING_REQUEST_TOKEN;
}
// Prepare the response so that ALLOW verdicts are the default(). return UpdateResponse(*response(),
request()->tags_size() > 0 ? request()->tags(0) : std::string(),
ContentAnalysisResponse::Result::SUCCESS);
}
std::string ContentAnalysisEventWin::DebugString() const {
std::stringstream state;
state.setf(std::ios::boolalpha);
state << "ContentAnalysisEventWin{handle=" << hPipe_;
state << " pid=" << GetBrowserInfo().pid;
state << " rtoken=" << GetRequest().request_token();
state << " sent=" << response_sent_;
state << "}" << std::ends;
return state.str();
}
void ContentAnalysisEventWin::Shutdown() { if (hPipe_ != INVALID_HANDLE_VALUE) { // If no response has been sent yet, attempt to send it now. Otherwise // the client may be stuck waiting. After shutdown the agent will not // have any other chance to respond. if (!response_sent_) {
Send();
}
// This event does not own the pipe, so don't close it.
FlushFileBuffers(hPipe_);
hPipe_ = INVALID_HANDLE_VALUE;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.