home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2000 May / MICD_2000_05.iso / CBuilder5 / INSTALL / DATA1.CAB / Program_Built_Files / Include / wabcode.h < prev    next >
C/C++ Source or Header  |  2000-02-01  |  9KB  |  216 lines

  1. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  2. /*
  3.  *  WABCODE.H
  4.  *
  5.  *  Status Codes returned by WAB routines
  6.  *
  7.  *  Copyright 1993-1998 Microsoft Corporation. All Rights Reserved.
  8.  */
  9.  
  10. #if !defined(MAPICODE_H) && !defined(WABCODE_H)
  11. #define WABCODE_H
  12.  
  13. /* Define S_OK and ITF_* */
  14.  
  15. #ifdef WIN32
  16. #include <objerror.h>
  17. #endif
  18.  
  19. /*
  20.  *  WAB Status codes follow the style of OLE 2.0 sCodes as defined in the
  21.  *  OLE 2.0 Programmer's Reference and header file scode.h (Windows 3.x)
  22.  *  or objerror.h (Windows NT 3.5 and Windows 95).
  23.  *
  24.  */
  25.  
  26. /*  On Windows 3.x, status codes have 32-bit values as follows:
  27.  *
  28.  *   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  29.  *   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
  30.  *  +-+---------------------+-------+-------------------------------+
  31.  *  |S|       Context       | Facil |               Code            |
  32.  *  +-+---------------------+-------+-------------------------------+
  33.  *
  34.  *  where
  35.  *
  36.  *      S - is the severity code
  37.  *
  38.  *          0 - SEVERITY_SUCCESS
  39.  *          1 - SEVERITY_ERROR
  40.  *
  41.  *      Context - context info
  42.  *
  43.  *      Facility - is the facility code
  44.  *
  45.  *          0x0 - FACILITY_NULL     generally useful errors ([SE]_*)
  46.  *          0x1 - FACILITY_RPC      remote procedure call errors (RPC_E_*)
  47.  *          0x2 - FACILITY_DISPATCH late binding dispatch errors
  48.  *          0x3 - FACILITY_STORAGE  storage errors (STG_E_*)
  49.  *          0x4 - FACILITY_ITF      interface-specific errors
  50.  *
  51.  *      Code - is the facility's status code
  52.  *
  53.  *
  54.  */
  55.  
  56. /*
  57.  *  On Windows NT 3.5 and Windows 95, scodes are 32-bit values
  58.  *  laid out as follows:
  59.  *
  60.  *    3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  61.  *    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
  62.  *   +-+-+-+-+-+---------------------+-------------------------------+
  63.  *   |S|R|C|N|r|    Facility         |               Code            |
  64.  *   +-+-+-+-+-+---------------------+-------------------------------+
  65.  *
  66.  *   where
  67.  *
  68.  *      S - Severity - indicates success/fail
  69.  *
  70.  *          0 - Success
  71.  *          1 - Fail (COERROR)
  72.  *
  73.  *      R - reserved portion of the facility code, corresponds to NT's
  74.  *          second severity bit.
  75.  *
  76.  *      C - reserved portion of the facility code, corresponds to NT's
  77.  *          C field.
  78.  *
  79.  *      N - reserved portion of the facility code. Used to indicate a
  80.  *          mapped NT status value.
  81.  *
  82.  *      r - reserved portion of the facility code. Reserved for internal
  83.  *          use. Used to indicate HRESULT values that are not status
  84.  *          values, but are instead message ids for display strings.
  85.  *
  86.  *      Facility - is the facility code
  87.  *          FACILITY_NULL                    0x0
  88.  *          FACILITY_RPC                     0x1
  89.  *          FACILITY_DISPATCH                0x2
  90.  *          FACILITY_STORAGE                 0x3
  91.  *          FACILITY_ITF                     0x4
  92.  *          FACILITY_WIN32                   0x7
  93.  *          FACILITY_WINDOWS                 0x8
  94.  *
  95.  *      Code - is the facility's status code
  96.  *
  97.  */
  98.  
  99.  
  100.  
  101.  
  102. /*
  103.  *  We can't use OLE 2.0 macros to build sCodes because the definition has
  104.  *  changed and we wish to conform to the new definition.
  105.  */
  106. #define MAKE_MAPI_SCODE(sev,fac,code) \
  107.     ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
  108.  
  109. /* The following two macros are used to build OLE 2.0 style sCodes */
  110.  
  111. #define MAKE_MAPI_E( err )  (MAKE_MAPI_SCODE( 1, FACILITY_ITF, err ))
  112. #define MAKE_MAPI_S( warn ) (MAKE_MAPI_SCODE( 0, FACILITY_ITF, warn ))
  113.  
  114. #ifdef  SUCCESS_SUCCESS
  115. #undef  SUCCESS_SUCCESS
  116. #endif
  117. #define SUCCESS_SUCCESS     0L
  118.  
  119. /* General errors (used by more than one WAB object) */
  120.  
  121. #define MAPI_E_CALL_FAILED                              E_FAIL
  122. #define MAPI_E_NOT_ENOUGH_MEMORY                        E_OUTOFMEMORY
  123. #define MAPI_E_INVALID_PARAMETER                        E_INVALIDARG
  124. #define MAPI_E_INTERFACE_NOT_SUPPORTED                  E_NOINTERFACE
  125. #define MAPI_E_NO_ACCESS                                E_ACCESSDENIED
  126.  
  127. #define MAPI_E_NO_SUPPORT                               MAKE_MAPI_E( 0x102 )
  128. #define MAPI_E_BAD_CHARWIDTH                            MAKE_MAPI_E( 0x103 )
  129. #define MAPI_E_STRING_TOO_LONG                          MAKE_MAPI_E( 0x105 )
  130. #define MAPI_E_UNKNOWN_FLAGS                            MAKE_MAPI_E( 0x106 )
  131. #define MAPI_E_INVALID_ENTRYID                          MAKE_MAPI_E( 0x107 )
  132. #define MAPI_E_INVALID_OBJECT                           MAKE_MAPI_E( 0x108 )
  133. #define MAPI_E_OBJECT_CHANGED                           MAKE_MAPI_E( 0x109 )
  134. #define MAPI_E_OBJECT_DELETED                           MAKE_MAPI_E( 0x10A )
  135. #define MAPI_E_BUSY                                     MAKE_MAPI_E( 0x10B )
  136. #define MAPI_E_NOT_ENOUGH_DISK                          MAKE_MAPI_E( 0x10D )
  137. #define MAPI_E_NOT_ENOUGH_RESOURCES                     MAKE_MAPI_E( 0x10E )
  138. #define MAPI_E_NOT_FOUND                                MAKE_MAPI_E( 0x10F )
  139. #define MAPI_E_VERSION                                  MAKE_MAPI_E( 0x110 )
  140. #define MAPI_E_LOGON_FAILED                             MAKE_MAPI_E( 0x111 )
  141. #define MAPI_E_SESSION_LIMIT                            MAKE_MAPI_E( 0x112 )
  142. #define MAPI_E_USER_CANCEL                              MAKE_MAPI_E( 0x113 )
  143. #define MAPI_E_UNABLE_TO_ABORT                          MAKE_MAPI_E( 0x114 )
  144. #define MAPI_E_NETWORK_ERROR                            MAKE_MAPI_E( 0x115 )
  145. #define MAPI_E_DISK_ERROR                               MAKE_MAPI_E( 0x116 )
  146. #define MAPI_E_TOO_COMPLEX                              MAKE_MAPI_E( 0x117 )
  147. #define MAPI_E_BAD_COLUMN                               MAKE_MAPI_E( 0x118 )
  148. #define MAPI_E_EXTENDED_ERROR                           MAKE_MAPI_E( 0x119 )
  149. #define MAPI_E_COMPUTED                                 MAKE_MAPI_E( 0x11A )
  150. #define MAPI_E_CORRUPT_DATA                             MAKE_MAPI_E( 0x11B )
  151. #define MAPI_E_UNCONFIGURED                             MAKE_MAPI_E( 0x11C )
  152. #define MAPI_E_FAILONEPROVIDER                          MAKE_MAPI_E( 0x11D )
  153.  
  154. /* WAB base function and status object specific errors and warnings */
  155.  
  156. #define MAPI_E_END_OF_SESSION                           MAKE_MAPI_E( 0x200 )
  157. #define MAPI_E_UNKNOWN_ENTRYID                          MAKE_MAPI_E( 0x201 )
  158. #define MAPI_E_MISSING_REQUIRED_COLUMN                  MAKE_MAPI_E( 0x202 )
  159. #define MAPI_W_NO_SERVICE                               MAKE_MAPI_S( 0x203 )
  160.  
  161. /* Property specific errors and warnings */
  162.  
  163. #define MAPI_E_BAD_VALUE                                MAKE_MAPI_E( 0x301 )
  164. #define MAPI_E_INVALID_TYPE                             MAKE_MAPI_E( 0x302 )
  165. #define MAPI_E_TYPE_NO_SUPPORT                          MAKE_MAPI_E( 0x303 )
  166. #define MAPI_E_UNEXPECTED_TYPE                          MAKE_MAPI_E( 0x304 )
  167. #define MAPI_E_TOO_BIG                                  MAKE_MAPI_E( 0x305 )
  168. #define MAPI_E_DECLINE_COPY                             MAKE_MAPI_E( 0x306 )
  169. #define MAPI_E_UNEXPECTED_ID                            MAKE_MAPI_E( 0x307 )
  170.  
  171. #define MAPI_W_ERRORS_RETURNED                          MAKE_MAPI_S( 0x380 )
  172.  
  173. /* Table specific errors and warnings */
  174.  
  175. #define MAPI_E_UNABLE_TO_COMPLETE                       MAKE_MAPI_E( 0x400 )
  176. #define MAPI_E_TIMEOUT                                  MAKE_MAPI_E( 0x401 )
  177. #define MAPI_E_TABLE_EMPTY                              MAKE_MAPI_E( 0x402 )
  178. #define MAPI_E_TABLE_TOO_BIG                            MAKE_MAPI_E( 0x403 )
  179.  
  180. #define MAPI_E_INVALID_BOOKMARK                         MAKE_MAPI_E( 0x405 )
  181.  
  182. #define MAPI_W_POSITION_CHANGED                         MAKE_MAPI_S( 0x481 )
  183. #define MAPI_W_APPROX_COUNT                             MAKE_MAPI_S( 0x482 )
  184.  
  185. #define MAPI_W_PARTIAL_COMPLETION                         MAKE_MAPI_S( 0x680 )
  186.  
  187. /* Address Book specific errors and warnings */
  188.  
  189. #define MAPI_E_AMBIGUOUS_RECIP                          MAKE_MAPI_E( 0x700 )
  190.  
  191.  
  192. /* Miscellaneous errors */
  193. #define MAPI_E_COLLISION                                MAKE_MAPI_E( 0x604 )
  194. #define MAPI_E_NOT_INITIALIZED                          MAKE_MAPI_E( 0x605 )
  195. #define MAPI_E_FOLDER_CYCLE                             MAKE_MAPI_E( 0x60B )
  196.  
  197. /* The range 0x0800 to 0x08FF is reserved */
  198.  
  199. /* Obsolete typing shortcut that will go away eventually. */
  200. #ifndef MakeResult
  201. #define MakeResult(_s)  ResultFromScode(_s)
  202. #endif
  203.  
  204. /* We expect these to eventually be defined by OLE, but for now,
  205.  * here they are.  When OLE defines them they can be much more
  206.  * efficient than these, but these are "proper" and don't make
  207.  * use of any hidden tricks.
  208.  */
  209. #ifndef HR_SUCCEEDED
  210. #define HR_SUCCEEDED(_hr) SUCCEEDED((SCODE)(_hr))
  211. #define HR_FAILED(_hr) FAILED((SCODE)(_hr))
  212. #endif
  213.  
  214. #endif  /* WABCODE_H */
  215. #pragma option pop /*P_O_Pop*/
  216.