mapicode.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?php
  2. /*
  3. * Copyright 2005 - 2016 Zarafa and its licensors
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Affero General Public License, version 3,
  7. * as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Affero General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Affero General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. */
  18. ?>
  19. <?php
  20. /**
  21. * Status codes returned by MAPI functions
  22. *
  23. *
  24. */
  25. /* From winerror.h */
  26. //
  27. // Success codes
  28. //
  29. define('S_OK', 0x00000000);
  30. define('S_FALSE', 0x00000001);
  31. define('SEVERITY_ERROR', 1);
  32. /* from winerror.h */
  33. /**
  34. * Function to make a error
  35. */
  36. function make_mapi_e($code)
  37. {
  38. return (int) mapi_make_scode(1, $code);
  39. }
  40. /**
  41. * Function to make a warning
  42. */
  43. function make_mapi_s($code)
  44. {
  45. return (int) mapi_make_scode(0, $code);
  46. }
  47. /* From mapicode.h */
  48. /*
  49. * On Windows NT 3.5 and Windows 95, scodes are 32-bit values
  50. * laid out as follows:
  51. *
  52. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  53. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  54. * +-+-+-+-+-+---------------------+-------------------------------+
  55. * |S|R|C|N|r| Facility | Code |
  56. * +-+-+-+-+-+---------------------+-------------------------------+
  57. *
  58. * where
  59. *
  60. * S - Severity - indicates success/fail
  61. *
  62. * 0 - Success
  63. * 1 - Fail (COERROR)
  64. *
  65. * R - reserved portion of the facility code, corresponds to NT's
  66. * second severity bit.
  67. *
  68. * C - reserved portion of the facility code, corresponds to NT's
  69. * C field.
  70. *
  71. * N - reserved portion of the facility code. Used to indicate a
  72. * mapped NT status value.
  73. *
  74. * r - reserved portion of the facility code. Reserved for internal
  75. * use. Used to indicate HRESULT values that are not status
  76. * values, but are instead message ids for display strings.
  77. *
  78. * Facility - is the facility code
  79. * FACILITY_NULL 0x0
  80. * FACILITY_RPC 0x1
  81. * FACILITY_DISPATCH 0x2
  82. * FACILITY_STORAGE 0x3
  83. * FACILITY_ITF 0x4
  84. * FACILITY_WIN32 0x7
  85. * FACILITY_WINDOWS 0x8
  86. *
  87. * Code - is the facility's status code
  88. *
  89. */
  90. define('NOERROR' ,0);
  91. // The following codes don't use make_mapi_e because they are in the 0x000FF000 range,
  92. // but we cannot use the HEX value as would make most sense as that would break in 64-bit PHP
  93. // (KC server will return a negative value, but PHP would convert this define into a positive
  94. // value). Hence we declare the value exactly as we need it as integer and bypass the
  95. // 32/64-bit hell.
  96. define('MAPI_E_CALL_FAILED' ,(int)-2147467259); // 0x80004005
  97. define('MAPI_E_NOT_ENOUGH_MEMORY' ,(int)-2147024882); // 0x8007000E
  98. define('MAPI_E_INVALID_PARAMETER' ,(int)-2147024809); // 0x80070057
  99. define('MAPI_E_INTERFACE_NOT_SUPPORTED' ,(int)-2147467262); // 0x80004002
  100. define('MAPI_E_NO_ACCESS' ,(int)-2147024891); // 0x80070005
  101. define('MAPI_E_NO_SUPPORT' ,make_mapi_e(0x102));
  102. define('MAPI_E_BAD_CHARWIDTH' ,make_mapi_e(0x103));
  103. define('MAPI_E_STRING_TOO_LONG' ,make_mapi_e(0x105));
  104. define('MAPI_E_UNKNOWN_FLAGS' ,make_mapi_e(0x106));
  105. define('MAPI_E_INVALID_ENTRYID' ,make_mapi_e(0x107));
  106. define('MAPI_E_INVALID_OBJECT' ,make_mapi_e(0x108));
  107. define('MAPI_E_OBJECT_CHANGED' ,make_mapi_e(0x109));
  108. define('MAPI_E_OBJECT_DELETED' ,make_mapi_e(0x10A));
  109. define('MAPI_E_BUSY' ,make_mapi_e(0x10B));
  110. define('MAPI_E_NOT_ENOUGH_DISK' ,make_mapi_e(0x10D));
  111. define('MAPI_E_NOT_ENOUGH_RESOURCES' ,make_mapi_e(0x10E));
  112. define('MAPI_E_NOT_FOUND' ,make_mapi_e(0x10F));
  113. define('MAPI_E_VERSION' ,make_mapi_e(0x110));
  114. define('MAPI_E_LOGON_FAILED' ,make_mapi_e(0x111));
  115. define('MAPI_E_SESSION_LIMIT' ,make_mapi_e(0x112));
  116. define('MAPI_E_USER_CANCEL' ,make_mapi_e(0x113));
  117. define('MAPI_E_UNABLE_TO_ABORT' ,make_mapi_e(0x114));
  118. define('MAPI_E_NETWORK_ERROR' ,make_mapi_e(0x115));
  119. define('MAPI_E_DISK_ERROR' ,make_mapi_e(0x116));
  120. define('MAPI_E_TOO_COMPLEX' ,make_mapi_e(0x117));
  121. define('MAPI_E_BAD_COLUMN' ,make_mapi_e(0x118));
  122. define('MAPI_E_EXTENDED_ERROR' ,make_mapi_e(0x119));
  123. define('MAPI_E_COMPUTED' ,make_mapi_e(0x11A));
  124. define('MAPI_E_CORRUPT_DATA' ,make_mapi_e(0x11B));
  125. define('MAPI_E_UNCONFIGURED' ,make_mapi_e(0x11C));
  126. define('MAPI_E_FAILONEPROVIDER' ,make_mapi_e(0x11D));
  127. define('MAPI_E_UNKNOWN_CPID' ,make_mapi_e(0x11E));
  128. define('MAPI_E_UNKNOWN_LCID' ,make_mapi_e(0x11F));
  129. /* Flavors of E_ACCESSDENIED, used at logon */
  130. define('MAPI_E_PASSWORD_CHANGE_REQUIRED' ,make_mapi_e(0x120));
  131. define('MAPI_E_PASSWORD_EXPIRED' ,make_mapi_e(0x121));
  132. define('MAPI_E_INVALID_WORKSTATION_ACCOUNT' ,make_mapi_e(0x122));
  133. define('MAPI_E_INVALID_ACCESS_TIME' ,make_mapi_e(0x123));
  134. define('MAPI_E_ACCOUNT_DISABLED' ,make_mapi_e(0x124));
  135. /* MAPI base function and status object specific errors and warnings */
  136. define('MAPI_E_END_OF_SESSION' ,make_mapi_e(0x200));
  137. define('MAPI_E_UNKNOWN_ENTRYID' ,make_mapi_e(0x201));
  138. define('MAPI_E_MISSING_REQUIRED_COLUMN' ,make_mapi_e(0x202));
  139. define('MAPI_W_NO_SERVICE' ,make_mapi_s(0x203));
  140. /* Property specific errors and warnings */
  141. define('MAPI_E_BAD_VALUE' ,make_mapi_e(0x301));
  142. define('MAPI_E_INVALID_TYPE' ,make_mapi_e(0x302));
  143. define('MAPI_E_TYPE_NO_SUPPORT' ,make_mapi_e(0x303));
  144. define('MAPI_E_UNEXPECTED_TYPE' ,make_mapi_e(0x304));
  145. define('MAPI_E_TOO_BIG' ,make_mapi_e(0x305));
  146. define('MAPI_E_DECLINE_COPY' ,make_mapi_e(0x306));
  147. define('MAPI_E_UNEXPECTED_ID' ,make_mapi_e(0x307));
  148. define('MAPI_W_ERRORS_RETURNED' ,make_mapi_s(0x380));
  149. /* Table specific errors and warnings */
  150. define('MAPI_E_UNABLE_TO_COMPLETE' ,make_mapi_e(0x400));
  151. define('MAPI_E_TIMEOUT' ,make_mapi_e(0x401));
  152. define('MAPI_E_TABLE_EMPTY' ,make_mapi_e(0x402));
  153. define('MAPI_E_TABLE_TOO_BIG' ,make_mapi_e(0x403));
  154. define('MAPI_E_INVALID_BOOKMARK' ,make_mapi_e(0x405));
  155. define('MAPI_W_POSITION_CHANGED' ,make_mapi_s(0x481));
  156. define('MAPI_W_APPROX_COUNT' ,make_mapi_s(0x482));
  157. /* Transport specific errors and warnings */
  158. define('MAPI_E_WAIT' ,make_mapi_e(0x500));
  159. define('MAPI_E_CANCEL' ,make_mapi_e(0x501));
  160. define('MAPI_E_NOT_ME' ,make_mapi_e(0x502));
  161. define('MAPI_W_CANCEL_MESSAGE' ,make_mapi_s(0x580));
  162. /* Message Store, Folder, and Message specific errors and warnings */
  163. define('MAPI_E_CORRUPT_STORE' ,make_mapi_e(0x600));
  164. define('MAPI_E_NOT_IN_QUEUE' ,make_mapi_e(0x601));
  165. define('MAPI_E_NO_SUPPRESS' ,make_mapi_e(0x602));
  166. define('MAPI_E_COLLISION' ,make_mapi_e(0x604));
  167. define('MAPI_E_NOT_INITIALIZED' ,make_mapi_e(0x605));
  168. define('MAPI_E_NON_STANDARD' ,make_mapi_e(0x606));
  169. define('MAPI_E_NO_RECIPIENTS' ,make_mapi_e(0x607));
  170. define('MAPI_E_SUBMITTED' ,make_mapi_e(0x608));
  171. define('MAPI_E_HAS_FOLDERS' ,make_mapi_e(0x609));
  172. define('MAPI_E_HAS_MESSAGES' ,make_mapi_e(0x60A));
  173. define('MAPI_E_FOLDER_CYCLE' ,make_mapi_e(0x60B));
  174. define('MAPI_E_STORE_FULL' ,make_mapi_e(0x60C));
  175. define('MAPI_W_PARTIAL_COMPLETION' ,make_mapi_s(0x680));
  176. /* Address Book specific errors and warnings */
  177. define('MAPI_E_AMBIGUOUS_RECIP' ,make_mapi_e(0x700));
  178. /* ICS errors and warnings */
  179. define('SYNC_E_UNKNOWN_FLAGS', MAPI_E_UNKNOWN_FLAGS);
  180. define('SYNC_E_INVALID_PARAMETER', MAPI_E_INVALID_PARAMETER);
  181. define('SYNC_E_ERROR', MAPI_E_CALL_FAILED);
  182. define('SYNC_E_OBJECT_DELETED', make_mapi_e(0x800));
  183. define('SYNC_E_IGNORE', make_mapi_e(0x801));
  184. define('SYNC_E_CONFLICT', make_mapi_e(0x802));
  185. define('SYNC_E_NO_PARENT', make_mapi_e(0x803));
  186. define('SYNC_E_INCEST', make_mapi_e(0x804));
  187. define('SYNC_E_UNSYNCHRONIZED', make_mapi_e(0x805));
  188. define('SYNC_W_PROGRESS', make_mapi_s(0x820));
  189. define('SYNC_W_CLIENT_CHANGE_NEWER', make_mapi_s(0x821));
  190. ?>