]> icculus.org git repositories - taylor/freespace2.git/blob - src/io/sw_error.hpp
Initial revision
[taylor/freespace2.git] / src / io / sw_error.hpp
1 /****************************************************************************
2
3     MODULE:             SW_Error.HPP
4         Tab settings:   5 9
5         Copyright 1995, 1996, Microsoft Corporation,    All Rights Reserved.
6
7     PURPOSE:            Header for Error Codes
8     
9         FUNCTIONS:
10
11         Author(s):      Name:
12         ----------      ----------------
13                 MEA             Manolito E. Adan
14
15         Revision History:
16         -----------------
17         Version Date            Author  Comments
18         -------     ------      -----   -------------------------------------------
19         1.0     22-Jan-96       MEA     original
20
21 ****************************************************************************/
22 #ifndef SW_Error_SEEN
23 #define SW_Error_SEEN
24
25 #include <winerror.h>
26 #include <windows.h>
27 #include <mmsystem.h>
28
29 /*
30 typedef struct _SF_ERROR {
31         HRESULT HCode;                  // HRESULT code
32         ULONG   ulDriverCode;   // Error code from device driver
33 } SF_ERROR, *PSF_ERROR;
34 */
35
36
37 //---------------------------------------------------------------------------
38 // Error Status Codes
39 //---------------------------------------------------------------------------
40 /*
41  *  On Windows NT 3.5 and Windows 95, scodes are 32-bit values
42  *  laid out as follows:
43  *  
44  *    3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
45  *    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
46  *   +-+-+-+-+-+---------------------+-------------------------------+
47  *   |S|R|C|N|r|    Facility         |               Code            |
48  *   +-+-+-+-+-+---------------------+-------------------------------+
49  *  
50  *   where
51  *  
52  *      S - Severity - indicates success/fail
53  *  
54  *          0 - Success
55  *          1 - Fail (COERROR)
56  *  
57  *      R - reserved portion of the facility code, corresponds to NT's
58  *          second severity bit.
59  *  
60  *      C - reserved portion of the facility code, corresponds to NT's
61  *          C field.
62  *  
63  *      N - reserved portion of the facility code. Used to indicate a
64  *          mapped NT status value.
65  *  
66  *      r - reserved portion of the facility code. Reserved for internal
67  *          use. Used to indicate HRESULT values that are not status
68  *          values, but are instead message ids for display strings.
69  *  
70  *      Facility - is the facility code
71  *          FACILITY_NULL                    0x0
72  *          FACILITY_RPC                     0x1
73  *          FACILITY_DISPATCH                0x2
74  *          FACILITY_STORAGE                 0x3
75  *          FACILITY_ITF                     0x4
76  *          FACILITY_WIN32                   0x7
77  *          FACILITY_WINDOWS                 0x8
78  *  
79  *      Code - is the facility's status code
80  *  
81  */
82
83 // SWForce Errors
84 #define MAKE_FF_SCODE(sev,fac,code) \
85     ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
86
87 #define MAKE_FF_E( err )  (MAKE_FF_SCODE( 1, FACILITY_ITF, err ))
88 #define MAKE_FF_S( warn ) (MAKE_FF_SCODE( 0, FACILITY_ITF, warn ))
89
90 #define DINPUT_DRIVER_ERR_BASE  0x500
91
92 #define SUCCESS                                 0x00                                                                            // successful
93 #define SFERR_INVALID_OBJECT            MAKE_FF_E(DINPUT_DRIVER_ERR_BASE + 1)   // Invalid object ID
94 #define SFERR_INVALID_PARAM                     DIERR_INVALIDPARAM                                              // Invalid parameters
95 #define SFERR_NO_SUPPORT                        DIERR_UNSUPPORTED                                               // Function not supported
96 #define SFERR_INVALID_DEVICE            DIERR_DEVICENOTREG                                              // Device not found
97 #define SFERR_FFDEVICE_MEMORY           DIERR_DEVICEFULL                                                // Out of download RAM
98 #define SFERR_END_OF_LIST                       MAKE_FF_S(DINPUT_DRIVER_ERR_BASE + 6)   // End of the list
99 #define SFERR_DEVICE_NACK                       MAKE_FF_E(DINPUT_DRIVER_ERR_BASE + 7)   // Device NACK received
100 #define SFERR_INVALID_STRUCT_SIZE       DIERR_INVALIDPARAM                                              // Invalid structure passed
101 #define SFERR_EFFECT_NOT_IN_DEVICE      DIERR_NOTDOWNLOADED                                     // Effect was not downloaded, so
102                                                                                                                                                         // cannot unload.
103 #define SFERR_RAW_OUT_DATAEVENT_CREATION        MAKE_FF_E(DINPUT_DRIVER_ERR_BASE + 10)  // Could not create Event
104 #define SFERR_RAW_OUT_THREAD_CREATION           MAKE_FF_E(DINPUT_DRIVER_ERR_BASE + 11)  // Could not create a thread
105 #define SFERR_EFFECT_STATUS_BUSY DIERR_EFFECTPLAYING                                                            // Device busy playing Effect
106 #define SFERR_OUT_OF_FF_MEMORY          DIERR_OUTOFMEMORY                                                               // FF system has run out of memory
107                                                                                                                                                                         //  cannot create new Effect
108 #define SFERR_SYSTEM_INIT                       MAKE_FF_E(DINPUT_DRIVER_ERR_BASE + 14)  // Could not create SWForce
109 #define SFERR_DRIVER_ERROR              MAKE_FF_E(DINPUT_DRIVER_ERR_BASE + 15)  // Driver error detected
110 #define SFERR_NON_FF_DEVICE             MAKE_FF_E(DINPUT_DRIVER_ERR_BASE + 16)  // This is a non-FF device, driver not found
111 #define SFERR_INVALID_HAL_OBJECT        MAKE_FF_E(DINPUT_DRIVER_ERR_BASE + 17)  // HAL cannot emulate this object
112 #define SFERR_INVALID_MEMBER_VALUE      DIERR_INVALIDPARAM                                              // Data structure has invalid member value
113
114 // VFX_ error codes
115 #define VFX_ERR_BASE                                            DINPUT_DRIVER_ERR_BASE + 100
116 #define VFX_ERR_FILE_NOT_FOUND                          HRESULT_FROM_WIN32(MMIOERR_FILENOTFOUND)
117 #define VFX_ERR_FILE_OUT_OF_MEMORY                      DIERR_OUTOFMEMORY
118 #define VFX_ERR_FILE_CANNOT_OPEN                        HRESULT_FROM_WIN32(MMIOERR_CANNOTOPEN)
119 #define VFX_ERR_FILE_CANNOT_CLOSE                       HRESULT_FROM_WIN32(MMIOERR_CANNOTCLOSE)
120 #define VFX_ERR_FILE_CANNOT_READ                        HRESULT_FROM_WIN32(MMIOERR_CANNOTREAD)
121 #define VFX_ERR_FILE_CANNOT_WRITE                       HRESULT_FROM_WIN32(MMIOERR_CANNOTWRITE)
122 #define VFX_ERR_FILE_CANNOT_SEEK                        HRESULT_FROM_WIN32(MMIOERR_CANNOTSEEK)
123 #define VFX_ERR_FILE_UNKNOWN_ERROR                      MAKE_FF_E(VFX_ERR_BASE + 8)
124 #define VFX_ERR_FILE_BAD_FORMAT                         MAKE_FF_E(VFX_ERR_BASE + 9)
125 #define VFX_ERR_FILE_ACCESS_DENIED                      HRESULT_FROM_WIN32(MMIOERR_ACCESSDENIED)
126 #define VFX_ERR_FILE_SHARING_VIOLATION          HRESULT_FROM_WIN32(MMIOERR_SHARINGVIOLATION)
127 #define VFX_ERR_FILE_NETWORK_ERROR                      HRESULT_FROM_WIN32(MMIOERR_NETWORKERROR)
128 #define VFX_ERR_FILE_TOO_MANY_OPEN_FILES        HRESULT_FROM_WIN32(MMIOERR_TOOMANYOPENFILES)
129 #define VFX_ERR_FILE_INVALID                            HRESULT_FROM_WIN32(MMIOERR_INVALIDFILE)
130 #define VFX_ERR_FILE_END_OF_FILE                        MAKE_FF_E(VFX_ERR_BASE + 15)
131
132 // SideWinder Driver Error codes
133 #define SWDEV_ERR_BASE                                          DINPUT_DRIVER_ERR_BASE + 200
134 #define SWDEV_ERR_INVALID_ID                            MAKE_FF_E(SWDEV_ERR_BASE + 1)  // Invalid Download ID
135 #define SWDEV_ERR_INVALID_PARAM                         MAKE_FF_E(SWDEV_ERR_BASE + 2)  // Invalid Download Parameter
136 #define SWDEV_ERR_CHECKSUM                                      MAKE_FF_E(SWDEV_ERR_BASE + 3)  // Invalid Checksum in COMM Packet
137 #define SWDEV_ERR_TYPE_FULL                                     MAKE_FF_E(SWDEV_ERR_BASE + 4)  // No More RAM space for Effect Type
138 #define SWDEV_ERR_UNKNOWN_CMD                           MAKE_FF_E(SWDEV_ERR_BASE + 5)  // Unrecognized Device command
139 #define SWDEV_ERR_PLAYLIST_FULL                         MAKE_FF_E(SWDEV_ERR_BASE + 6)  // Play List is full, cannot play any more Effects
140 #define SWDEV_ERR_PROCESSLIST_FULL                      MAKE_FF_E(SWDEV_ERR_BASE + 7)  // Process List is full, cannot download 
141
142
143 #endif // of ifndef SW_Error_SEEN
144