agent_utils_win.cc (783B)
1 // Copyright 2022 The Chromium Authors. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include <windows.h> 6 7 #include "content_analysis/sdk/result_codes.h" 8 9 namespace content_analysis { 10 namespace sdk { 11 12 #define ERR_TO_RC(ERR, RC) case ERR: return ResultCode::RC; 13 14 ResultCode ErrorToResultCode(DWORD err) { 15 switch (err) { 16 ERR_TO_RC(ERROR_SUCCESS, OK); 17 ERR_TO_RC(ERROR_ACCESS_DENIED, ERR_AGENT_ALREADY_EXISTS); 18 ERR_TO_RC(ERROR_BROKEN_PIPE, ERR_BROKEN_PIPE); 19 ERR_TO_RC(ERROR_INVALID_NAME, ERR_INVALID_CHANNEL_NAME); 20 ERR_TO_RC(ERROR_MORE_DATA, ERR_MORE_DATA); 21 ERR_TO_RC(ERROR_IO_PENDING, ERR_IO_PENDING); 22 default: 23 return ResultCode::ERR_UNEXPECTED; 24 } 25 } 26 27 } // namespace sdk 28 } // namespace content_analysis