Go to the documentation of this file.00001 #ifndef DN_COMMON_H_
00002 #define DN_COMMON_H_
00003
00039 #ifndef _DN_EXP_COMMON
00040 #define _DN_EXP_COMMON
00041 #endif
00042
00043 #ifndef _DN_USE_VARIANT_API
00044 #define _DN_USE_VARIANT_API (1)
00045 #endif
00046
00047 #ifndef _DN_USE_BSTR_API
00048 #define _DN_USE_BSTR_API (1)
00049 #endif
00050
00056 #define FORMAT_DATE2BSTR "%Y/%m/%d %H:%M:%S"
00057
00058 #ifndef _HRESULT_DEFINED
00059 #define _HRESULT_DEFINED
00060
00061 typedef int32_t HRESULT;
00062
00063 #endif
00064
00065 #ifndef _WINERROR_
00066
00071 #define SUCCEEDED(hr) ((HRESULT)hr >= 0)
00072
00077 #define FAILED(hr) ((HRESULT)hr < 0)
00078
00083 #define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc)
00084
00089 #define S_OK ((HRESULT)0L)
00090
00095 #define S_FALSE ((HRESULT)1L)
00096
00101 #define E_NOTIMPL _HRESULT_TYPEDEF_(0x80004001L)
00102
00107 #define E_FAIL _HRESULT_TYPEDEF_(0x80004005L)
00108
00113 #define E_ACCESSDENIED _HRESULT_TYPEDEF_(0x80070005L)
00114
00119 #define E_HANDLE _HRESULT_TYPEDEF_(0x80070006L)
00120
00125 #define E_OUTOFMEMORY _HRESULT_TYPEDEF_(0x8007000EL)
00126
00131 #define E_INVALIDARG _HRESULT_TYPEDEF_(0x80070057L)
00132
00137 #define E_UNEXPECTED _HRESULT_TYPEDEF_(0x8000FFFFL)
00138
00143 #define DISP_E_TYPEMISMATCH _HRESULT_TYPEDEF_(0x80020005L)
00144
00149 #define DISP_E_BADVARTYPE _HRESULT_TYPEDEF_(0x80020008L)
00150
00155 #define DISP_E_OVERFLOW _HRESULT_TYPEDEF_(0x8002000AL)
00156
00161 #define DISP_E_BADINDEX _HRESULT_TYPEDEF_(0x8002000BL)
00162
00163 #endif
00164
00169 #define E_TIMEOUT _HRESULT_TYPEDEF_(0x80000900L)
00170
00175 #define E_NOT_CONNECTED _HRESULT_TYPEDEF_(0x80000902L)
00176
00181 #define E_MAX_OBJECT _HRESULT_TYPEDEF_(0x80000905L)
00182
00187 #define E_ALREADY_REGISTER _HRESULT_TYPEDEF_(0x80000906L)
00188
00193 #define E_TOO_MUCH_DATA _HRESULT_TYPEDEF_(0x80000909L)
00194
00199 #define E_MAX_CONNECT _HRESULT_TYPEDEF_(0x8000090BL)
00200
00205 #define OSERR2HRESULT(err) (((err) & 0x0000FFFF) | 0x80910000)
00206
00207 #ifndef __wtypes_h__
00208
00213 enum VARENUM
00214 {
00215 VT_EMPTY = 0,
00216 VT_NULL = 1,
00217 VT_I2 = 2,
00218 VT_I4 = 3,
00219 VT_R4 = 4,
00220 VT_R8 = 5,
00221 VT_CY = 6,
00222 VT_DATE = 7,
00223 VT_BSTR = 8,
00224 VT_ERROR = 10,
00225 VT_BOOL = 11,
00226 VT_VARIANT = 12,
00227 VT_UI1 = 17,
00228 VT_UI2 = 18,
00229 VT_UI4 = 19,
00230 VT_I8 = 20,
00231 VT_UI8 = 21,
00232 VT_ARRAY = 0x2000,
00233 };
00234
00235 #if (!defined(_WCHAR_H) && (!defined(_INC_WCHAR)))
00236 #include <wchar.h>
00237 #endif
00238
00239 typedef wchar_t *BSTR;
00240
00245 typedef union tagCY
00246 {
00247 struct
00248 {
00249 unsigned long Lo;
00250 long Hi;
00251 } DUMMYSTRUCTNAME;
00252 int64_t int64;
00253 } CY;
00254
00255 #if (!defined(_TIME_H) && (!defined(_INC_WCHAR)))
00256 #include <time.h>
00257 #endif
00258
00259 typedef time_t DATE;
00260
00261 typedef int16_t VARIANT_BOOL;
00262
00267 #define VARIANT_TRUE ((VARIANT_BOOL)-1)
00268
00273 #define VARIANT_FALSE ((VARIANT_BOOL) 0)
00274
00275 #endif
00276
00277 #ifndef __oaidl_h__
00278
00283 typedef struct SAFEARRAYBOUND
00284 {
00285 uint32_t cElements;
00286 int32_t lLbound;
00287 } SAFEARRAYBOUND;
00288
00293 typedef struct SAFEARRAY
00294 {
00295 uint16_t cDims;
00296 uint16_t vt;
00297 uint32_t cbElements;
00298 void* pvData;
00299 SAFEARRAYBOUND rgsabound[1];
00300 } SAFEARRAY;
00301
00306 typedef struct VARIANT
00307 {
00308 uint16_t vt;
00309 union
00310 {
00311 int16_t iVal;
00312 int32_t lVal;
00313 int64_t llVal;
00314 float fltVal;
00315 double dblVal;
00316 CY cyVal;
00317 DATE date;
00318 BSTR bstrVal;
00319 int32_t scode;
00320 VARIANT_BOOL boolVal;
00321 uint8_t bVal;
00322 uint16_t uiVal;
00323 uint32_t ulVal;
00324 uint64_t ullVal;
00325 SAFEARRAY* parray;
00326 };
00327 } VARIANT;
00328
00329 #endif
00330
00331 #ifdef __cplusplus
00332 extern "C"
00333 {
00334 #endif
00335
00336 #ifndef _OLEAUTO_H_
00337
00344 _DN_EXP_COMMON BSTR
00345 SysAllocString(const wchar_t *sz);
00346
00354 _DN_EXP_COMMON BSTR
00355 SysAllocStringLen(const wchar_t *pch, uint16_t cch);
00356
00362 _DN_EXP_COMMON void
00363 SysFreeString(BSTR bstr);
00364
00370 _DN_EXP_COMMON uint16_t
00371 SysStringLen(BSTR bstr);
00372
00381 _DN_EXP_COMMON SAFEARRAY*
00382 SafeArrayCreateVector(uint16_t vt, int32_t lLbound, uint32_t cElements);
00383
00389 _DN_EXP_COMMON HRESULT
00390 SafeArrayDestroy(SAFEARRAY *psa);
00391
00397 _DN_EXP_COMMON uint16_t
00398 SafeArrayGetDim(SAFEARRAY *psa);
00399
00405 _DN_EXP_COMMON uint32_t
00406 SafeArrayGetElemsize(SAFEARRAY *psa);
00407
00415 _DN_EXP_COMMON HRESULT
00416 SafeArrayGetLBound(SAFEARRAY *psa, uint16_t nDim, int32_t *plLbound);
00417
00425 _DN_EXP_COMMON HRESULT
00426 SafeArrayGetUBound(SAFEARRAY *psa, uint16_t nDim, int32_t *plUbound);
00427
00434 _DN_EXP_COMMON HRESULT
00435 SafeArrayGetVartype(SAFEARRAY *psa, uint16_t *pvt);
00436
00444 _DN_EXP_COMMON HRESULT
00445 SafeArrayAccessData(SAFEARRAY *psa, void **ppvData);
00446
00453 _DN_EXP_COMMON HRESULT
00454 SafeArrayUnaccessData(SAFEARRAY *psa);
00455
00462 _DN_EXP_COMMON void
00463 VariantInit(VARIANT *pvarg);
00464
00471 _DN_EXP_COMMON void
00472 VariantClear(VARIANT *pvarg);
00473
00474 #if (_DN_USE_VARIANT_API)
00475
00481 _DN_EXP_COMMON HRESULT
00482 VariantCopy(VARIANT *pvargDest, const VARIANT *pvargSrc);
00483
00493 _DN_EXP_COMMON HRESULT
00494 VariantChangeType(VARIANT *pvargDest, VARIANT *pvarSrc, uint16_t wFlags,
00495 uint16_t vt);
00496 #endif
00497 #endif
00498
00499 #if (_DN_USE_VARIANT_API)
00500
00508 _DN_EXP_COMMON uint32_t
00509 ChangeVarType(VARIANT varSrc, uint16_t vt, void *pDest, uint32_t dwSize);
00510
00519 _DN_EXP_COMMON HRESULT
00520 GetOptionValue(BSTR bstrSrc, BSTR bstrKey, uint16_t vt, VARIANT *pvarDest);
00521 #endif
00522
00523 #if (_DN_USE_BSTR_API)
00524
00529 _DN_EXP_COMMON wchar_t*
00530 ConvertMultiByte2WideChar(const char* chSrc);
00531
00537 _DN_EXP_COMMON char*
00538 ConvertWideChar2MultiByte(const wchar_t* chSrc);
00539 #endif
00540
00541 #ifdef __cplusplus
00542 }
00543 #endif
00544
00545 #endif