elevation_service_idl.idl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. import "oaidl.idl";
  5. import "ocidl.idl";
  6. typedef enum ProtectionLevel {
  7. // No validation: This never validates anything.
  8. NONE = 0,
  9. // Path validation: This will validate that the data is being decrypted by an
  10. // executable whose NT path matches the executable that originally encrypted
  11. // it. This should only be used for executables in trusted paths e.g.
  12. // C:\Program Files, otherwise anyone could pretend to be your executable.
  13. PATH_VALIDATION = 1,
  14. } ProtectionLevel;
  15. [
  16. object,
  17. oleautomation,
  18. uuid(A949CB4E-C4F9-44C4-B213-6BF8AA9AC69C),
  19. helpstring("IElevator Interface"),
  20. pointer_default(unique)
  21. ]
  22. interface IElevator : IUnknown
  23. {
  24. // Elevators are exposed as methods on IElevator, and provide High Integrity
  25. // actions. Any changes to add or change a method in IElevator will require a
  26. // security review.
  27. //
  28. // Runs the Chrome Recovery CRX elevated.
  29. //
  30. // @param crx_path Path for the recovery CRX.
  31. // @param browser_appid Omaha AppID for the version of Chrome being recovered.
  32. // @param browser_version Version of Chrome for the recovery CRX.
  33. // @param session_id Omaha Session Id.
  34. // @param caller_proc_id The process id of the calling process.
  35. // @param proc_handle The process handle valid in the calling process context.
  36. HRESULT RunRecoveryCRXElevated([in, string] const WCHAR* crx_path,
  37. [in, string] const WCHAR* browser_appid,
  38. [in, string] const WCHAR* browser_version,
  39. [in, string] const WCHAR* session_id,
  40. [in] DWORD caller_proc_id,
  41. [out] ULONG_PTR* proc_handle);
  42. // Encrypts data with both caller and SYSTEM context DPAPI.
  43. //
  44. // @param protection_level the protection level to encrypt data at.
  45. // @param plaintext The plaintext data to encrypt.
  46. // @param ciphertext The ciphertext of the encrypted data. It is the
  47. // responsibility of the caller to free this memory using
  48. // SysFreeString.
  49. // @param last_error The result of calling GetLastError if the operation
  50. // failed.
  51. // @return S_OK on success. Any other value on failure.
  52. HRESULT EncryptData([in] ProtectionLevel protection_level,
  53. [in] const BSTR plaintext,
  54. [out] BSTR* ciphertext,
  55. [out] DWORD* last_error);
  56. // Decrypts data with both caller and SYSTEM context DPAPI.
  57. //
  58. // This will only decrypt data that was encrypted via a paired EncryptData
  59. // call from same application, with identity determined by the protection
  60. // level of the original encrypt call.
  61. //
  62. // @param ciphertext The ciphertext data to decrypt.
  63. // @param plaintext The plaintext of the decrypted data. It is the
  64. // responsibility of the caller to free this memory using
  65. // SysFreeString.
  66. // @param last_error The result of calling GetLastError if the operation
  67. // failed.
  68. // @return S_OK on success. Any other value on failure.
  69. HRESULT DecryptData([in] const BSTR ciphertext,
  70. [out] BSTR* plaintext,
  71. [out] DWORD* last_error);
  72. };
  73. // The interfaces below are all IElevator with unique IIDs. IElevator is
  74. // registered with unique IIDs for the various flavors of Chrome and Chromium.
  75. // This allows the different flavors of Chrome/Chromium to co-exist without side
  76. // effects.
  77. [
  78. object,
  79. oleautomation,
  80. uuid(B88C45B9-8825-4629-B83E-77CC67D9CEED),
  81. helpstring("IElevatorChromium Interface"),
  82. pointer_default(unique)
  83. ]
  84. interface IElevatorChromium : IElevator
  85. {
  86. };
  87. [
  88. object,
  89. oleautomation,
  90. uuid(463ABECF-410D-407F-8AF5-0DF35A005CC8),
  91. helpstring("IElevatorChrome Interface"),
  92. pointer_default(unique)
  93. ]
  94. interface IElevatorChrome : IElevator
  95. {
  96. };
  97. [
  98. object,
  99. oleautomation,
  100. uuid(A2721D66-376E-4D2F-9F0F-9070E9A42B5F),
  101. helpstring("IElevatorChromeBeta Interface"),
  102. pointer_default(unique)
  103. ]
  104. interface IElevatorChromeBeta : IElevator
  105. {
  106. };
  107. [
  108. object,
  109. oleautomation,
  110. uuid(BB2AA26B-343A-4072-8B6F-80557B8CE571),
  111. helpstring("IElevatorChromeDev Interface"),
  112. pointer_default(unique)
  113. ]
  114. interface IElevatorChromeDev : IElevator
  115. {
  116. };
  117. [
  118. object,
  119. oleautomation,
  120. uuid(4F7CE041-28E9-484F-9DD0-61A8CACEFEE4),
  121. helpstring("IElevatorChromeCanary Interface"),
  122. pointer_default(unique)
  123. ]
  124. interface IElevatorChromeCanary : IElevator
  125. {
  126. };
  127. [
  128. uuid(0014D784-7012-4A79-8AB6-ADDB8193A06E),
  129. version(1.0),
  130. helpstring("Elevator 1.0 Type Library")
  131. ]
  132. library ElevatorLib {
  133. importlib("stdole2.tlb");
  134. interface IElevator;
  135. interface IElevatorChromium;
  136. interface IElevatorChrome;
  137. interface IElevatorChromeBeta;
  138. interface IElevatorChromeDev;
  139. interface IElevatorChromeCanary;
  140. };