dn_common.h
Go to the documentation of this file.
1 #ifndef DN_COMMON_H_
2 #define DN_COMMON_H_
3 
39 #ifndef _DN_EXP_COMMON
40 #define _DN_EXP_COMMON
41 #endif /* _DN_EXP_COMMON */
42 
43 #ifndef _DN_USE_VARIANT_API
44 #define _DN_USE_VARIANT_API (1)
45 #endif
46 
47 #ifndef _DN_USE_BSTR_API
48 #define _DN_USE_BSTR_API (1)
49 #endif
50 
56 #define FORMAT_DATE2BSTR "%Y/%m/%d %H:%M:%S"
57 
58 #ifndef _HRESULT_DEFINED
59 #define _HRESULT_DEFINED
60 
61 typedef int32_t HRESULT;
62 
63 #endif /* _HRESULT_DEFINED */
64 
65 #ifndef _WINERROR_
66 
71 #define SUCCEEDED(hr) ((HRESULT)hr >= 0)
72 
77 #define FAILED(hr) ((HRESULT)hr < 0)
78 
83 #define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc)
84 
89 #define S_OK ((HRESULT)0L)
90 
95 #define S_FALSE ((HRESULT)1L)
96 
101 #define E_NOTIMPL _HRESULT_TYPEDEF_(0x80004001L)
102 
107 #define E_FAIL _HRESULT_TYPEDEF_(0x80004005L)
108 
113 #define E_ACCESSDENIED _HRESULT_TYPEDEF_(0x80070005L)
114 
119 #define E_HANDLE _HRESULT_TYPEDEF_(0x80070006L)
120 
125 #define E_OUTOFMEMORY _HRESULT_TYPEDEF_(0x8007000EL)
126 
131 #define E_INVALIDARG _HRESULT_TYPEDEF_(0x80070057L)
132 
137 #define E_UNEXPECTED _HRESULT_TYPEDEF_(0x8000FFFFL)
138 
143 #define DISP_E_TYPEMISMATCH _HRESULT_TYPEDEF_(0x80020005L)
144 
149 #define DISP_E_BADVARTYPE _HRESULT_TYPEDEF_(0x80020008L)
150 
155 #define DISP_E_OVERFLOW _HRESULT_TYPEDEF_(0x8002000AL)
156 
161 #define DISP_E_BADINDEX _HRESULT_TYPEDEF_(0x8002000BL)
162 
163 #endif /* _WINERROR_ */
164 
169 #define E_TIMEOUT _HRESULT_TYPEDEF_(0x80000900L)
170 
175 #define E_NOT_CONNECTED _HRESULT_TYPEDEF_(0x80000902L)
176 
181 #define E_MAX_OBJECT _HRESULT_TYPEDEF_(0x80000905L)
182 
187 #define E_ALREADY_REGISTER _HRESULT_TYPEDEF_(0x80000906L)
188 
193 #define E_TOO_MUCH_DATA _HRESULT_TYPEDEF_(0x80000909L)
194 
199 #define E_MAX_CONNECT _HRESULT_TYPEDEF_(0x8000090BL)
200 
205 #define OSERR2HRESULT(err) (((err) & 0x0000FFFF) | 0x80910000)
206 
207 #ifndef __wtypes_h__
208 
214 {
215  VT_EMPTY = 0,
216  VT_NULL = 1,
217  VT_I2 = 2,
218  VT_I4 = 3,
219  VT_R4 = 4,
220  VT_R8 = 5,
221  VT_CY = 6,
222  VT_DATE = 7,
223  VT_BSTR = 8,
224  VT_ERROR = 10,
225  VT_BOOL = 11,
226  VT_VARIANT = 12,
227  VT_UI1 = 17,
228  VT_UI2 = 18,
229  VT_UI4 = 19,
230  VT_I8 = 20,
231  VT_UI8 = 21,
232  VT_ARRAY = 0x2000,
233 };
234 
235 #if (!defined(_WCHAR_H) && (!defined(_INC_WCHAR)))
236 #include <wchar.h>
237 #endif
238 
239 typedef wchar_t *BSTR;
240 
245 typedef union tagCY
246 {
247  struct
248  {
249  unsigned long Lo;
250  long Hi;
251  } DUMMYSTRUCTNAME;
253 } CY;
254 
255 #if (!defined(_TIME_H) && (!defined(_INC_WCHAR)))
256 #include <time.h>
257 #endif
258 
259 typedef time_t DATE;
260 
262 
267 #define VARIANT_TRUE ((VARIANT_BOOL)-1)
268 
273 #define VARIANT_FALSE ((VARIANT_BOOL) 0)
274 
275 #endif /* __wtypes_h__ */
276 
277 #ifndef __oaidl_h__
278 
283 typedef struct SAFEARRAYBOUND
284 {
288 
293 typedef struct SAFEARRAY
294 {
298  void* pvData;
299  SAFEARRAYBOUND rgsabound[1];
300 } SAFEARRAY;
301 
306 typedef struct VARIANT
307 {
309  union
310  {
314  float fltVal;
315  double dblVal;
326  };
327 } VARIANT;
328 
329 #endif /* __oaidl_h__ */
330 
331 #ifdef __cplusplus
332 extern "C"
333 {
334 #endif
335 
336 #ifndef _OLEAUTO_H_
337 
345  SysAllocString(const wchar_t *sz);
346 
355  SysAllocStringLen(const wchar_t *pch, uint16_t cch);
356 
362  _DN_EXP_COMMON void
363  SysFreeString(BSTR bstr);
364 
371  SysStringLen(BSTR bstr);
372 
382  SafeArrayCreateVector(uint16_t vt, int32_t lLbound, uint32_t cElements);
383 
391 
399 
407 
416  SafeArrayGetLBound(SAFEARRAY *psa, uint16_t nDim, int32_t *plLbound);
417 
426  SafeArrayGetUBound(SAFEARRAY *psa, uint16_t nDim, int32_t *plUbound);
427 
436 
445  SafeArrayAccessData(SAFEARRAY *psa, void **ppvData);
446 
455 
462  _DN_EXP_COMMON void
463  VariantInit(VARIANT *pvarg);
464 
471  _DN_EXP_COMMON void
472  VariantClear(VARIANT *pvarg);
473 
474 #if (_DN_USE_VARIANT_API)
475 
482  VariantCopy(VARIANT *pvargDest, const VARIANT *pvargSrc);
483 
494  VariantChangeType(VARIANT *pvargDest, VARIANT *pvarSrc, uint16_t wFlags,
495  uint16_t vt);
496 #endif /* _DN_USE_VARIANT_API */
497 #endif /* _OLEAUTO_H_ */
498 
499 #if (_DN_USE_VARIANT_API)
500 
509  ChangeVarType(VARIANT varSrc, uint16_t vt, void *pDest, uint32_t dwSize);
510 
520  GetOptionValue(BSTR bstrSrc, BSTR bstrKey, uint16_t vt, VARIANT *pvarDest);
521 #endif /* _DN_USE_VARIANT_API */
522 
523 #if (_DN_USE_BSTR_API)
524 
529  _DN_EXP_COMMON wchar_t*
530  ConvertMultiByte2WideChar(const char* chSrc);
531 
537  _DN_EXP_COMMON char*
538  ConvertWideChar2MultiByte(const wchar_t* chSrc);
539 #endif /* _DN_USE_BSTR_API */
540 
541 #ifdef __cplusplus
542 }
543 #endif
544 
545 #endif /* DN_COMMON_H_ */
uint64_t ullVal
Definition: dn_common.h:324
_DN_EXP_COMMON uint16_t SafeArrayGetDim(SAFEARRAY *psa)
Gets and returns the dimension of SAFEARRAY.
Definition: dn_common.c:248
short int16_t
Definition: stdint.h:40
VARIANT_BOOL boolVal
Definition: dn_common.h:320
unsigned uint32_t
Definition: stdint.h:43
#define _DN_EXP_COMMON
Definition: dn_common.h:40
long long int64_t
Definition: stdint.h:44
_DN_EXP_COMMON HRESULT SafeArrayUnaccessData(SAFEARRAY *psa)
Unaccesses the SAFEARRAY.
Definition: dn_common.c:353
_DN_EXP_COMMON BSTR SysAllocStringLen(const wchar_t *pch, uint16_t cch)
Allocates and returns BSTR.
Definition: dn_common.c:77
uint8_t bVal
Definition: dn_common.h:321
_DN_EXP_COMMON uint32_t ChangeVarType(VARIANT varSrc, uint16_t vt, void *pDest, uint32_t dwSize)
Changes the variant to destination value with the indicated type.
uint32_t cElements
Definition: dn_common.h:285
_DN_EXP_COMMON HRESULT SafeArrayGetLBound(SAFEARRAY *psa, uint16_t nDim, int32_t *plLbound)
Gets the lower bound of SAFEARRAY.
Definition: dn_common.c:278
_DN_EXP_COMMON HRESULT SafeArrayGetVartype(SAFEARRAY *psa, uint16_t *pvt)
Gets the variant type of SAFEARRAY.
Definition: dn_common.c:318
wchar_t * BSTR
Definition: dn_common.h:239
unsigned short uint16_t
Definition: stdint.h:41
struct SAFEARRAYBOUND SAFEARRAYBOUND
int32_t lVal
Definition: dn_common.h:312
time_t DATE
Definition: dn_common.h:259
unsigned char uint8_t
Definition: stdint.h:39
BSTR bstrVal
Definition: dn_common.h:318
A type definition for the signed 64bit integer.
Definition: dn_common.h:245
int64_t llVal
Definition: dn_common.h:313
void * pvData
Definition: dn_common.h:298
uint32_t cbElements
Definition: dn_common.h:297
_DN_EXP_COMMON void SysFreeString(BSTR bstr)
Releases the memory of BSTR.
Definition: dn_common.c:104
CY cyVal
Definition: dn_common.h:316
_DN_EXP_COMMON HRESULT SafeArrayGetUBound(SAFEARRAY *psa, uint16_t nDim, int32_t *plUbound)
Gets the upper bound of SAFEARRAY.
Definition: dn_common.c:298
int32_t HRESULT
Definition: dn_common.h:61
_DN_EXP_COMMON uint32_t SafeArrayGetElemsize(SAFEARRAY *psa)
Gets and returns the size of an element.
Definition: dn_common.c:262
unsigned long long uint64_t
Definition: stdint.h:45
uint16_t vt
Definition: dn_common.h:296
unsigned long Lo
Definition: dn_common.h:249
_DN_EXP_COMMON HRESULT VariantCopy(VARIANT *pvargDest, const VARIANT *pvargSrc)
Copies the source variant to destination variant.
A type definition for the array.
Definition: dn_common.h:293
_DN_EXP_COMMON uint16_t SysStringLen(BSTR bstr)
Gets and returns the number of characters of BSTR.
Definition: dn_common.c:118
SAFEARRAY * parray
Definition: dn_common.h:325
uint16_t uiVal
Definition: dn_common.h:322
int32_t lLbound
Definition: dn_common.h:286
int64_t int64
Definition: dn_common.h:252
uint16_t vt
Definition: dn_common.h:308
union tagCY CY
_DN_EXP_COMMON void VariantInit(VARIANT *pvarg)
Initializes the VARIANT.
Definition: dn_common.c:368
_DN_EXP_COMMON HRESULT VariantChangeType(VARIANT *pvargDest, VARIANT *pvarSrc, uint16_t wFlags, uint16_t vt)
Changes the source variant to destination variant with the indicated type.
A type definition for the bound of SAFEARRAY.
Definition: dn_common.h:283
int16_t VARIANT_BOOL
Definition: dn_common.h:261
A type definition for the multi type variable.
Definition: dn_common.h:306
_DN_EXP_COMMON BSTR SysAllocString(const wchar_t *sz)
Allocates and returns BSTR.
Definition: dn_common.c:61
_DN_EXP_COMMON void VariantClear(VARIANT *pvarg)
Clears the VARIANT.
Definition: dn_common.c:382
int int32_t
Definition: stdint.h:42
_DN_EXP_COMMON HRESULT GetOptionValue(BSTR bstrSrc, BSTR bstrKey, uint16_t vt, VARIANT *pvarDest)
Searchs the key string from source string and sets the value to the destination variant with the indi...
uint32_t ulVal
Definition: dn_common.h:323
long Hi
Definition: dn_common.h:250
int32_t scode
Definition: dn_common.h:319
struct VARIANT VARIANT
float fltVal
Definition: dn_common.h:314
int16_t iVal
Definition: dn_common.h:311
struct SAFEARRAY SAFEARRAY
DATE date
Definition: dn_common.h:317
uint16_t cDims
Definition: dn_common.h:295
_DN_EXP_COMMON char * ConvertWideChar2MultiByte(const wchar_t *chSrc)
Converts wide string to string.
double dblVal
Definition: dn_common.h:315
struct tagCY::@3 DUMMYSTRUCTNAME
_DN_EXP_COMMON HRESULT SafeArrayDestroy(SAFEARRAY *psa)
Releases the memory of SAFEARRAY.
Definition: dn_common.c:212
VARENUM
Variant type.
Definition: dn_common.h:213
_DN_EXP_COMMON SAFEARRAY * SafeArrayCreateVector(uint16_t vt, int32_t lLbound, uint32_t cElements)
Allocates and returns SAFEARRAY.
Definition: dn_common.c:138
_DN_EXP_COMMON wchar_t * ConvertMultiByte2WideChar(const char *chSrc)
Converts string to wide string.
_DN_EXP_COMMON HRESULT SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Accesses the SAFEARRAY and gets the pointer of array data.
Definition: dn_common.c:336


bcap_core
Author(s): DENSO WAVE INCORPORATED
autogenerated on Mon Jun 10 2019 13:12:20