summaryrefslogtreecommitdiffstats
path: root/ceee/ie/broker/broker_rpc_utils.cc
blob: ad93c6424d479098909ccbc1fbba6ad744244413 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Utilities shared by both Broker RPC client and server.

#include "ceee/ie/broker/broker_rpc_utils.h"

#include "base/win_util.h"
#include "ceee/common/process_utils_win.h"

// Local interprocess communication only.
const wchar_t kRpcProtocol[] = L"ncalrpc";

std::wstring GetRpcEndPointAddress() {
  std::wstring end_point;
  bool running_as_admin = false;
  // CEEE running as regular user and CEEE running as elevated user will start
  // different broker processes. So make end points names different to connect
  // to appropriate one.
  process_utils_win::IsCurrentProcessUacElevated(&running_as_admin);
  if (running_as_admin)
    end_point += L"ADMIN-";
  std::wstring sid;
  win_util::GetUserSidString(&sid);
  end_point += sid;
  end_point += L"-B4630D08-4621-41A1-A8D0-F1E98DA460D6";
  return end_point;
}

void  __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) {
  return malloc(len);
}

void __RPC_USER midl_user_free(void __RPC_FAR * ptr) {
  free(ptr);
}