Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b00cbead
Commit
b00cbead
authored
Dec 10, 1998
by
Jean-Claude Cote
Committed by
Alexandre Julliard
Dec 10, 1998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added implementation of the VARIANT APIs.
parent
f3836f5f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
4417 additions
and
124 deletions
+4417
-124
oleauto.h
include/oleauto.h
+690
-2
winerror.h
include/winerror.h
+4
-0
Makefile.in
ole/Makefile.in
+2
-1
typelib.c
ole/typelib.c
+6
-6
variant.c
ole/variant.c
+3600
-0
oleaut32.spec
relay32/oleaut32.spec
+115
-115
No files found.
include/oleauto.h
View file @
b00cbead
#ifndef __WINE_OLEAUTO_H
#define __WINE_OLEAUTO_H
#include <ole.h>
BSTR16
WINAPI
SysAllocString16
(
LPOLESTR16
);
BSTR32
WINAPI
SysAllocString32
(
LPOLESTR32
);
#define SysAllocString WINELIB_NAME(SysAllocString)
...
...
@@ -20,8 +22,694 @@ int WINAPI SysStringLen16(BSTR16);
int
WINAPI
SysStringLen32
(
BSTR32
);
#define SysStringLen WINELIB_NAME(SysStringLen)
typedef
char
OLECHAR
;
typedef
void
ITypeLib
;
typedef
ITypeLib
*
LPTYPELIB
;
#endif
/*
* Data types for Variants.
*/
/*
* 0 == FALSE and -1 == TRUE
*/
typedef
short
VARIANT_BOOL
;
#define VARIANT_TRUE 0xFFFF
#define VARIANT_FALSE 0x0000
typedef
double
DATE
;
typedef
LONG
SCODE
;
enum
VARENUM
{
VT_EMPTY
=
0
,
VT_NULL
=
1
,
VT_I2
=
2
,
VT_I4
=
3
,
VT_R4
=
4
,
VT_R8
=
5
,
VT_CY
=
6
,
VT_DATE
=
7
,
VT_BSTR
=
8
,
VT_DISPATCH
=
9
,
VT_ERROR
=
10
,
VT_BOOL
=
11
,
VT_VARIANT
=
12
,
VT_UNKNOWN
=
13
,
VT_DECIMAL
=
14
,
VT_I1
=
16
,
VT_UI1
=
17
,
VT_UI2
=
18
,
VT_UI4
=
19
,
VT_I8
=
20
,
VT_UI8
=
21
,
VT_INT
=
22
,
VT_UINT
=
23
,
VT_VOID
=
24
,
VT_HRESULT
=
25
,
VT_PTR
=
26
,
VT_SAFEARRAY
=
27
,
VT_CARRAY
=
28
,
VT_USERDEFINED
=
29
,
VT_LPSTR
=
30
,
VT_LPWSTR
=
31
,
VT_FILETIME
=
64
,
VT_BLOB
=
65
,
VT_STREAM
=
66
,
VT_STORAGE
=
67
,
VT_STREAMED_OBJECT
=
68
,
VT_STORED_OBJECT
=
69
,
VT_BLOB_OBJECT
=
70
,
VT_CF
=
71
,
VT_CLSID
=
72
,
VT_VECTOR
=
0x1000
,
VT_ARRAY
=
0x2000
,
VT_BYREF
=
0x4000
,
VT_RESERVED
=
0x8000
,
VT_ILLEGAL
=
0xffff
,
VT_ILLEGALMASKED
=
0xfff
,
VT_TYPEMASK
=
0xfff
};
/* the largest valide type
*/
#define VT_MAXVALIDTYPE VT_CLSID
/*
* Declarations of the VARIANT structure and the VARIANT APIs.
*/
/* S_OK : Success.
* DISP_E_BADVARTYPE : The variant type vt in not a valid type of variant.
* DISP_E_OVERFLOW : The data pointed to by pvarSrc does not fit in the destination type.
* DISP_E_TYPEMISMATCH : The variant type vt is not a valid type of variant.
* E_INVALIDARG : One argument is invalid.
* E_OUTOFMEMORY : Memory could not be allocated for the conversion.
* DISP_E_ARRAYISLOCKED : The variant contains an array that is locked.
*/
typedef
struct
tagVARIANT
VARIANT
;
typedef
struct
tagVARIANT
VARIANTARG
;
struct
tagVARIANT
{
VARTYPE
vt
;
WORD
wReserved1
;
WORD
wReserved2
;
WORD
wReserved3
;
union
{
/* By value.
*/
CHAR
cVal
;
USHORT
uiVal
;
ULONG
ulVal
;
INT32
intVal
;
UINT32
uintVal
;
BYTE
bVal
;
short
iVal
;
long
lVal
;
float
fltVal
;
double
dblVal
;
VARIANT_BOOL
boolVal
;
SCODE
scode
;
DATE
date
;
BSTR32
bstrVal
;
/*
DECIMAL decVal;
CY cyVal;
IUnknown* punkVal;
IDispatch* pdispVal;
SAFEARRAY* parray;
*/
/* By reference
*/
CHAR
*
pcVal
;
USHORT
*
puiVal
;
ULONG
*
pulVal
;
INT32
*
pintVal
;
UINT32
*
puintVal
;
BYTE
*
pbVal
;
short
*
piVal
;
long
*
plVal
;
float
*
pfltVal
;
double
*
pdblVal
;
VARIANT_BOOL
*
pboolVal
;
SCODE
*
pscode
;
DATE
*
pdate
;
BSTR32
*
pbstrVal
;
VARIANT
*
pvarVal
;
PVOID
byref
;
/*
DECIMAL* pdecVal;
CY* pcyVal;
IUnknown** ppunkVal;
IDispatch** ppdispVal;
SAFEARRAY** pparray;
*/
}
u
;
};
/* These are macros that help accessing the VARIANT date type.
*/
#define V_UNION(A, B) ((A)->u.B)
#define V_VT(A) ((A)->vt)
#define V_ISBYREF(A) (V_VT(A)&VT_BYREF)
#define V_ISARRAY(A) (V_VT(A)&VT_ARRAY)
#define V_ISVECTOR(A) (V_VT(A)&VT_VECTOR)
#define V_NONE(A) V_I2(A)
#define V_UI1(A) V_UNION(A, bVal)
#define V_UI1REF(A) V_UNION(A, pbVal)
#define V_I2(A) V_UNION(A, iVal)
#define V_I2REF(A) V_UNION(A, piVal)
#define V_I4(A) V_UNION(A, lVal)
#define V_I4REF(A) V_UNION(A, plVal)
#define V_R4(A) V_UNION(A, fltVal)
#define V_R4REF(A) V_UNION(A, pfltVal)
#define V_R8(A) V_UNION(A, dblVal)
#define V_R8REF(A) V_UNION(A, pdblVal)
#define V_I1(A) V_UNION(A, cVal)
#define V_I1REF(A) V_UNION(A, pcVal)
#define V_UI2(A) V_UNION(A, uiVal)
#define V_UI2REF(A) V_UNION(A, puiVal)
#define V_UI4(A) V_UNION(A, ulVal)
#define V_UI4REF(A) V_UNION(A, pulVal)
#define V_INT(A) V_UNION(A, intVal)
#define V_INTREF(A) V_UNION(A, pintVal)
#define V_UINT(A) V_UNION(A, uintVal)
#define V_UINTREF(A) V_UNION(A, puintVal)
#define V_CY(A) V_UNION(A, cyVal)
#define V_CYREF(A) V_UNION(A, pcyVal)
#define V_DATE(A) V_UNION(A, date)
#define V_DATEREF(A) V_UNION(A, pdate)
#define V_BSTR(A) V_UNION(A, bstrVal)
#define V_BSTRREF(A) V_UNION(A, pbstrVal)
#define V_DISPATCH(A) V_UNION(A, pdispVal)
#define V_DISPATCHREF(A) V_UNION(A, ppdispVal)
#define V_ERROR(A) V_UNION(A, scode)
#define V_ERRORREF(A) V_UNION(A, pscode)
#define V_BOOL(A) V_UNION(A, boolVal)
#define V_BOOLREF(A) V_UNION(A, pboolVal)
#define V_UNKNOWN(A) V_UNION(A, punkVal)
#define V_UNKNOWNREF(A) V_UNION(A, ppunkVal)
#define V_VARIANTREF(A) V_UNION(A, pvarVal)
#define V_ARRAY(A) V_UNION(A, parray)
#define V_ARRAYREF(A) V_UNION(A, pparray)
#define V_BYREF(A) V_UNION(A, byref)
#define V_DECIMAL(A) V_UNION(A, decVal)
#define V_DECIMALREF(A) V_UNION(A, pdecVal)
/*
* VARIANT API
*/
void
VariantInit32
(
VARIANTARG
*
pvarg
);
#define VariantInit WINELIB_NAME(VariantInit)
HRESULT
VariantClear32
(
VARIANTARG
*
pvarg
);
#define VariantClear WINELIB_NAME(VariantClear)
HRESULT
VariantCopy32
(
VARIANTARG
*
pvargDest
,
VARIANTARG
*
pvargSrc
);
#define VariantCopy WINELIB_NAME(VariantCopy)
HRESULT
VariantCopyInd32
(
VARIANT
*
pvargDest
,
VARIANTARG
*
pvargSrc
);
#define VariantCopyInd WINELIB_NAME(VariantCopyInd)
HRESULT
VariantChangeType32
(
VARIANTARG
*
pvargDest
,
VARIANTARG
*
pvargSrc
,
USHORT
wFlags
,
VARTYPE
vt
);
#define VariantChangeType WINELIB_NAME(VariantChangeType)
HRESULT
VariantChangeTypeEx32
(
VARIANTARG
*
pvargDest
,
VARIANTARG
*
pvargSrc
,
LCID
lcid
,
USHORT
wFlags
,
VARTYPE
vt
);
#define VariantChangeTypeEx WINELIB_NAME(VariantChangeTypeEx)
/*
* These flags are used for the VariantChangeType and VariantChangeTypeEx APIs.
*/
/*
* This one is of general use.
*/
#define VARIANT_NOVALUEPROP 0x1
/*
* This one is used for conversions of VT_BOOL to VT_BSTR,
* the API will convert to "True"|"False" instead of "-1"|"0".
*/
#define VARIANT_ALPHABOOL 0x2
/*
* This one is used for conversions to or from a VT_BSTR string,
* it passes LOCALE_NOUSEROVERRIDE to the core (low-level) coercion routines.
* This means it will use the system default locale settings instead of custom
* local settings.
*/
#define VARIANT_NOUSEROVERRIDE 0x4
/*
* VARTYPE Coercion API
*/
/* Omits the date portion and return only the time value.
*/
#define VAR_TIMEVALUEONLY ((DWORD)0x00000001)
/* Omits the time portion and return only the date value.
*/
#define VAR_DATEVALUEONLY ((DWORD)0x00000002)
HRESULT
VarUI1FromI232
(
short
sIn
,
BYTE
*
pbOut
);
#define VarUI1FromI2 WINELIB_NAME(VarUI1FromI2)
HRESULT
VarUI1FromI432
(
LONG
lIn
,
BYTE
*
pbOut
);
#define VarUI1FromI4 WINELIB_NAME(VarUI1FromI4)
HRESULT
VarUI1FromR432
(
FLOAT
fltIn
,
BYTE
*
pbOut
);
#define VarUI1FromR4 WINELIB_NAME(VarUI1FromR4)
HRESULT
VarUI1FromR832
(
double
dblIn
,
BYTE
*
pbOut
);
#define VarUI1FromR8 WINELIB_NAME(VarUI1FromR8)
HRESULT
VarUI1FromDate32
(
DATE
dateIn
,
BYTE
*
pbOut
);
#define VarUI1FromDate WINELIB_NAME(VarUI1FromDate)
HRESULT
VarUI1FromBool32
(
VARIANT_BOOL
boolIn
,
BYTE
*
pbOut
);
#define VarUI1FromBool WINELIB_NAME(VarUI1FromBool)
HRESULT
VarUI1FromI132
(
CHAR
cIn
,
BYTE
*
pbOut
);
#define VarUI1FromI1 WINELIB_NAME(VarUI1FromI1)
HRESULT
VarUI1FromUI232
(
USHORT
uiIn
,
BYTE
*
pbOut
);
#define VarUI1FromUI2 WINELIB_NAME(VarUI1FromUI2)
HRESULT
VarUI1FromUI432
(
ULONG
ulIn
,
BYTE
*
pbOut
);
#define VarUI1FromUI4 WINELIB_NAME(VarUI1FromUI4)
HRESULT
VarUI1FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
BYTE
*
pbOut
);
#define VarUI1FromStr WINELIB_NAME(VarUI1FromStr)
/*
HRESULT VarUI1FromDec32(DECIMAL*pdecIn, BYTE*pbOut);
#define VarUI1FromDec WINELIB_NAME(VarUI1FromDec)
HRESULT VarUI1FromDisp32(IDispatch* pdispIn, LCID lcid, BYTE* pbOut);
#define VarUI1FromDisp WINELIB_NAME(VarUI1FromDisp)
HRESULT VarUI1FromCy32(CY cyIn, BYTE* pbOut);
#define VarUI1FromCy WINELIB_NAME(VarUI1FromCy)
*/
HRESULT
VarI2FromUI132
(
BYTE
bIn
,
short
*
psOut
);
#define VarI2FromUI1 WINELIB_NAME(VarI2FromUI1)
HRESULT
VarI2FromI432
(
LONG
lIn
,
short
*
psOut
);
#define VarI2FromI4 WINELIB_NAME(VarI2FromI4)
HRESULT
VarI2FromR432
(
FLOAT
fltIn
,
short
*
psOut
);
#define VarI2FromR4 WINELIB_NAME(VarI2FromR4)
HRESULT
VarI2FromR832
(
double
dblIn
,
short
*
psOut
);
#define VarI2FromR8 WINELIB_NAME(VarI2FromR8)
HRESULT
VarI2FromDate32
(
DATE
dateIn
,
short
*
psOut
);
#define VarI2FromDate WINELIB_NAME(VarI2FromDate)
HRESULT
VarI2FromBool32
(
VARIANT_BOOL
boolIn
,
short
*
psOut
);
#define VarI2FromBool WINELIB_NAME(VarI2FromBool)
HRESULT
VarI2FromI132
(
CHAR
cIn
,
short
*
psOut
);
#define VarI2FromI1 WINELIB_NAME(VarI2FromI1)
HRESULT
VarI2FromUI232
(
USHORT
uiIn
,
short
*
psOut
);
#define VarI2FromUI2 WINELIB_NAME(VarI2FromUI2)
HRESULT
VarI2FromUI432
(
ULONG
ulIn
,
short
*
psOut
);
#define VarI2FromUI4 WINELIB_NAME(VarI2FromUI4)
HRESULT
VarI2FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
short
*
psOut
);
#define VarI2FromStr WINELIB_NAME(VarI2FromStr)
/*
HRESULT VarI2FromDec32(DECIMAL*pdecIn, short*psOut);
#define VarI2FromDec WINELIB_NAME(VarI2FromDec)
HRESULT VarI2FromDisp32(IDispatch* pdispIn, LCID lcid, short* psOut);
#define VarI2FromDisp WINELIB_NAME(VarI2FromDisp)
HRESULT VarI2FromCy32(CY cyIn, short* psOut);
#define VarI2FromCy WINELIB_NAME(VarI2FromCy)
*/
HRESULT
VarI4FromUI132
(
BYTE
bIn
,
LONG
*
plOut
);
#define VarI4FromUI1 WINELIB_NAME(VarI4FromUI1)
HRESULT
VarI4FromI232
(
short
sIn
,
LONG
*
plOut
);
#define VarI4FromI2 WINELIB_NAME(VarI4FromI2)
HRESULT
VarI4FromR432
(
FLOAT
fltIn
,
LONG
*
plOut
);
#define VarI4FromR4 WINELIB_NAME(VarI4FromR4)
HRESULT
VarI4FromR832
(
double
dblIn
,
LONG
*
plOut
);
#define VarI4FromR8 WINELIB_NAME(VarI4FromR8)
HRESULT
VarI4FromDate32
(
DATE
dateIn
,
LONG
*
plOut
);
#define VarI4FromDate WINELIB_NAME(VarI4FromDate)
HRESULT
VarI4FromBool32
(
VARIANT_BOOL
boolIn
,
LONG
*
plOut
);
#define VarI4FromBool WINELIB_NAME(VarI4FromBool)
HRESULT
VarI4FromI132
(
CHAR
cIn
,
LONG
*
plOut
);
#define VarI4FromI1 WINELIB_NAME(VarI4FromI1)
HRESULT
VarI4FromUI232
(
USHORT
uiIn
,
LONG
*
plOut
);
#define VarI4FromUI2 WINELIB_NAME(VarI4FromUI2)
HRESULT
VarI4FromUI432
(
ULONG
ulIn
,
LONG
*
plOut
);
#define VarI4FromUI4 WINELIB_NAME(VarI4FromUI4)
HRESULT
VarI4FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
LONG
*
plOut
);
#define VarI4FromStr WINELIB_NAME(VarI4FromStr)
/*
HRESULT VarI4FromCy32(CY cyIn, LONG* plOut);
#define VarI4FromCy WINELIB_NAME(VarI4FromCy)
HRESULT VarI4FromDec32(DECIMAL*pdecIn, LONG*plOut);
#define VarI4FromDec WINELIB_NAME(VarI4FromDec)
HRESULT VarI4FromDisp32(IDispatch* pdispIn, LCID lcid, LONG* plOut);
#define VarI4FromDisp WINELIB_NAME(VarI4FromDisp)
*/
HRESULT
VarR4FromUI132
(
BYTE
bIn
,
FLOAT
*
pfltOut
);
#define VarR4FromUI1 WINELIB_NAME(VarR4FromUI1)
HRESULT
VarR4FromI232
(
short
sIn
,
FLOAT
*
pfltOut
);
#define VarR4FromI2 WINELIB_NAME(VarR4FromI2)
HRESULT
VarR4FromI432
(
LONG
lIn
,
FLOAT
*
pfltOut
);
#define VarR4FromI4 WINELIB_NAME(VarR4FromI4)
HRESULT
VarR4FromR832
(
double
dblIn
,
FLOAT
*
pfltOut
);
#define VarR4FromR8 WINELIB_NAME(VarR4FromR8)
HRESULT
VarR4FromDate32
(
DATE
dateIn
,
FLOAT
*
pfltOut
);
#define VarR4FromDate WINELIB_NAME(VarR4FromDate)
HRESULT
VarR4FromBool32
(
VARIANT_BOOL
boolIn
,
FLOAT
*
pfltOut
);
#define VarR4FromBool WINELIB_NAME(VarR4FromBool)
HRESULT
VarR4FromI132
(
CHAR
cIn
,
FLOAT
*
pfltOut
);
#define VarR4FromI1 WINELIB_NAME(VarR4FromI1)
HRESULT
VarR4FromUI232
(
USHORT
uiIn
,
FLOAT
*
pfltOut
);
#define VarR4FromUI2 WINELIB_NAME(VarR4FromUI2)
HRESULT
VarR4FromUI432
(
ULONG
ulIn
,
FLOAT
*
pfltOut
);
#define VarR4FromUI4 WINELIB_NAME(VarR4FromUI4)
HRESULT
VarR4FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
FLOAT
*
pfltOut
);
#define VarR4FromStr WINELIB_NAME(VarR4FromStr)
/*
HRESULT VarR4FromDec32(DECIMAL*pdecIn, FLOAT*pfltOut);
#define VarR4FromDec WINELIB_NAME(VarR4FromDec)
HRESULT VarR4FromDisp32(IDispatch* pdispIn, LCID lcid, FLOAT* pfltOut);
#define VarR4FromDisp WINELIB_NAME(VarR4FromDisp)
HRESULT VarR4FromCy32(CY cyIn, FLOAT* pfltOut);
#define VarR4FromCy WINELIB_NAME(VarR4FromCy)
*/
HRESULT
VarR8FromUI132
(
BYTE
bIn
,
double
*
pdblOut
);
#define VarR8FromUI1 WINELIB_NAME(VarR8FromUI1)
HRESULT
VarR8FromI232
(
short
sIn
,
double
*
pdblOut
);
#define VarR8FromI2 WINELIB_NAME(VarR8FromI2)
HRESULT
VarR8FromI432
(
LONG
lIn
,
double
*
pdblOut
);
#define VarR8FromI4 WINELIB_NAME(VarR8FromI4)
HRESULT
VarR8FromR432
(
FLOAT
fltIn
,
double
*
pdblOut
);
#define VarR8FromR4 WINELIB_NAME(VarR8FromR4)
HRESULT
VarR8FromDate32
(
DATE
dateIn
,
double
*
pdblOut
);
#define VarR8FromDate WINELIB_NAME(VarR8FromDate)
HRESULT
VarR8FromBool32
(
VARIANT_BOOL
boolIn
,
double
*
pdblOut
);
#define VarR8FromBool WINELIB_NAME(VarR8FromBool)
HRESULT
VarR8FromI132
(
CHAR
cIn
,
double
*
pdblOut
);
#define VarR8FromI1 WINELIB_NAME(VarR8FromI1)
HRESULT
VarR8FromUI232
(
USHORT
uiIn
,
double
*
pdblOut
);
#define VarR8FromUI2 WINELIB_NAME(VarR8FromUI2)
HRESULT
VarR8FromUI432
(
ULONG
ulIn
,
double
*
pdblOut
);
#define VarR8FromUI4 WINELIB_NAME(VarR8FromUI4)
HRESULT
VarR8FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
double
*
pdblOut
);
#define VarR8FromStr WINELIB_NAME(VarR8FromStr)
/*
HRESULT VarR8FromDec32(DECIMAL*pdecIn, double*pdblOut);
#define VarR8FromDec WINELIB_NAME(VarR8FromDec)
HRESULT VarR8FromCy32(CY cyIn, double* pdblOut);
#define VarR8FromCy WINELIB_NAME(VarR8FromCy)
HRESULT VarR8FromDisp32(IDispatch* pdispIn, LCID lcid, double* pdblOut);
#define VarR8FromDisp WINELIB_NAME(VarR8FromDisp)
*/
HRESULT
VarDateFromUI132
(
BYTE
bIn
,
DATE
*
pdateOut
);
#define VarDateFromUI1 WINELIB_NAME(VarDateFromUI1)
HRESULT
VarDateFromI232
(
short
sIn
,
DATE
*
pdateOut
);
#define VarDateFromI2 WINELIB_NAME(VarDateFromI2)
HRESULT
VarDateFromI432
(
LONG
lIn
,
DATE
*
pdateOut
);
#define VarDateFromI4 WINELIB_NAME(VarDateFromI4)
HRESULT
VarDateFromR432
(
FLOAT
fltIn
,
DATE
*
pdateOut
);
#define VarDateFromR4 WINELIB_NAME(VarDateFromR4)
HRESULT
VarDateFromR832
(
double
dblIn
,
DATE
*
pdateOut
);
#define VarDateFromR8 WINELIB_NAME(VarDateFromR8)
HRESULT
VarDateFromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
DATE
*
pdateOut
);
#define VarDateFromStr WINELIB_NAME(VarDateFromStr)
HRESULT
VarDateFromI132
(
CHAR
cIn
,
DATE
*
pdateOut
);
#define VarDateFromI1 WINELIB_NAME(VarDateFromI1)
HRESULT
VarDateFromUI232
(
USHORT
uiIn
,
DATE
*
pdateOut
);
#define VarDateFromUI2 WINELIB_NAME(VarDateFromUI2)
HRESULT
VarDateFromUI432
(
ULONG
ulIn
,
DATE
*
pdateOut
);
#define VarDateFromUI4 WINELIB_NAME(VarDateFromUI4)
HRESULT
VarDateFromBool32
(
VARIANT_BOOL
boolIn
,
DATE
*
pdateOut
);
#define VarDateFromBool WINELIB_NAME(VarDateFromBool)
/*
HRESULT VarDateFromDec32(DECIMAL*pdecIn, DATE*pdateOut);
#define VarDateFromDec WINELIB_NAME(VarDateFromDec)
HRESULT VarDateFromDisp32(IDispatch* pdispIn, LCID lcid, DATE* pdateOut);
#define VarDateFromDisp WINELIB_NAME(VarDateFromDisp)
HRESULT VarDateFromCy32(CY cyIn, DATE* pdateOut);
#define VarDateFromCy WINELIB_NAME(VarDateFromCy)
HRESULT VarCyFromUI132(BYTE bIn, CY* pcyOut);
#define VarCyFromUI1 WINELIB_NAME(VarCyFromUI1)
HRESULT VarCyFromI232(short sIn, CY* pcyOut);
#define VarCyFromI2 WINELIB_NAME(VarCyFromI2)
HRESULT VarCyFromI432(LONG lIn, CY* pcyOut);
#define VarCyFromI4 WINELIB_NAME(VarCyFromI4)
HRESULT VarCyFromR432(FLOAT fltIn, CY* pcyOut);
#define VarCyFromR4 WINELIB_NAME(VarCyFromR4)
HRESULT VarCyFromR832(double dblIn, CY* pcyOut);
#define VarCyFromR8 WINELIB_NAME(VarCyFromR8)
HRESULT VarCyFromDate32(DATE dateIn, CY* pcyOut);
#define VarCyFromDate WINELIB_NAME(VarCyFromDate)
HRESULT VarCyFromStr32(OLECHAR32* strIn, LCID lcid, ULONG dwFlags, CY* pcyOut);
#define VarCyFromStr WINELIB_NAME(VarCyFromStr)
HRESULT VarCyFromDisp32(IDispatch* pdispIn, LCID lcid, CY* pcyOut);
#define VarCyFromDisp WINELIB_NAME(VarCyFromDisp)
HRESULT VarCyFromBool32(VARIANT_BOOL boolIn, CY* pcyOut);
#define VarCyFromBool WINELIB_NAME(VarCyFromBool)
HRESULT VarCyFromI132(CHAR cIn, CY*pcyOut);
#define VarCyFromI1 WINELIB_NAME(VarCyFromI1)
HRESULT VarCyFromUI232(USHORT uiIn, CY*pcyOut);
#define VarCyFromUI2 WINELIB_NAME(VarCyFromUI2)
HRESULT VarCyFromUI432(ULONG ulIn, CY*pcyOut);
#define VarCyFromUI4 WINELIB_NAME(VarCyFromUI4)
HRESULT VarCyFromDec32(DECIMAL*pdecIn, CY*pcyOut);
#define VarCyFromDec WINELIB_NAME(VarCyFromDec)
*/
HRESULT
VarBstrFromUI132
(
BYTE
bVal
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromUI1 WINELIB_NAME(VarBstrFromUI1)
HRESULT
VarBstrFromI232
(
short
iVal
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromI2 WINELIB_NAME(VarBstrFromI2)
HRESULT
VarBstrFromI432
(
LONG
lIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromI4 WINELIB_NAME(VarBstrFromI4)
HRESULT
VarBstrFromR432
(
FLOAT
fltIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromR4 WINELIB_NAME(VarBstrFromR4)
HRESULT
VarBstrFromR832
(
double
dblIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromR8 WINELIB_NAME(VarBstrFromR8)
HRESULT
VarBstrFromDate32
(
DATE
dateIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromDate WINELIB_NAME(VarBstrFromDate)
HRESULT
VarBstrFromBool32
(
VARIANT_BOOL
boolIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromBool WINELIB_NAME(VarBstrFromBool)
HRESULT
VarBstrFromI132
(
CHAR
cIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromI1 WINELIB_NAME(VarBstrFromI1)
HRESULT
VarBstrFromUI232
(
USHORT
uiIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromUI2 WINELIB_NAME(VarBstrFromUI2)
HRESULT
VarBstrFromUI432
(
ULONG
ulIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
);
#define VarBstrFromUI4 WINELIB_NAME(VarBstrFromUI4)
/*
HRESULT VarBstrFromDec32(DECIMAL*pdecIn, LCID lcid, ULONG dwFlags, BSTR32*pbstrOut);
#define VarBstrFromDec WINELIB_NAME(VarBstrFromDec)
HRESULT VarBstrFromCy32(CY cyIn, LCID lcid, ULONG dwFlags, BSTR32* pbstrOut);
#define VarBstrFromCy WINELIB_NAME(VarBstrFromCy)
HRESULT VarBstrFromDisp32(IDispatch* pdispIn, LCID lcid, ULONG dwFlags, BSTR32* pbstrOut);
#define VarBstrFromDisp WINELIB_NAME(VarBstrFromDisp)
*/
HRESULT
VarBoolFromUI132
(
BYTE
bIn
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromUI1 WINELIB_NAME(VarBoolFromUI1)
HRESULT
VarBoolFromI232
(
short
sIn
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromI2 WINELIB_NAME(VarBoolFromI2)
HRESULT
VarBoolFromI432
(
LONG
lIn
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromI4 WINELIB_NAME(VarBoolFromI4)
HRESULT
VarBoolFromR432
(
FLOAT
fltIn
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromR4 WINELIB_NAME(VarBoolFromR4)
HRESULT
VarBoolFromR832
(
double
dblIn
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromR8 WINELIB_NAME(VarBoolFromR8)
HRESULT
VarBoolFromDate32
(
DATE
dateIn
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromDate WINELIB_NAME(VarBoolFromDate)
HRESULT
VarBoolFromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromStr WINELIB_NAME(VarBoolFromStr)
HRESULT
VarBoolFromI132
(
CHAR
cIn
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromI1 WINELIB_NAME(VarBoolFromI1)
HRESULT
VarBoolFromUI232
(
USHORT
uiIn
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromUI2 WINELIB_NAME(VarBoolFromUI2)
HRESULT
VarBoolFromUI432
(
ULONG
ulIn
,
VARIANT_BOOL
*
pboolOut
);
#define VarBoolFromUI4 WINELIB_NAME(VarBoolFromUI4)
/*
HRESULT VarBoolFromDec32(DECIMAL*pdecIn, VARIANT_BOOL*pboolOut);
#define VarBoolFromDec WINELIB_NAME(VarBoolFromDec)
HRESULT VarBoolFromCy32(CY cyIn, VARIANT_BOOL* pboolOut);
#define VarBoolFromCy WINELIB_NAME(VarBoolFromCy)
HRESULT VarBoolFromDisp32(IDispatch* pdispIn, LCID lcid, VARIANT_BOOL* pboolOut);
#define VarBoolFromDisp WINELIB_NAME(VarBoolFromDisp)
*/
HRESULT
VarI1FromUI132
(
BYTE
bIn
,
CHAR
*
pcOut
);
#define VarI1FromUI1 WINELIB_NAME(VarI1FromUI1)
HRESULT
VarI1FromI232
(
short
uiIn
,
CHAR
*
pcOut
);
#define VarI1FromI2 WINELIB_NAME(VarI1FromI2)
HRESULT
VarI1FromI432
(
LONG
lIn
,
CHAR
*
pcOut
);
#define VarI1FromI4 WINELIB_NAME(VarI1FromI4)
HRESULT
VarI1FromR432
(
FLOAT
fltIn
,
CHAR
*
pcOut
);
#define VarI1FromR4 WINELIB_NAME(VarI1FromR4)
HRESULT
VarI1FromR832
(
double
dblIn
,
CHAR
*
pcOut
);
#define VarI1FromR8 WINELIB_NAME(VarI1FromR8)
HRESULT
VarI1FromDate32
(
DATE
dateIn
,
CHAR
*
pcOut
);
#define VarI1FromDate WINELIB_NAME(VarI1FromDate)
HRESULT
VarI1FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
CHAR
*
pcOut
);
#define VarI1FromStr WINELIB_NAME(VarI1FromStr)
HRESULT
VarI1FromBool32
(
VARIANT_BOOL
boolIn
,
CHAR
*
pcOut
);
#define VarI1FromBool WINELIB_NAME(VarI1FromBool)
HRESULT
VarI1FromUI232
(
USHORT
uiIn
,
CHAR
*
pcOut
);
#define VarI1FromUI2 WINELIB_NAME(VarI1FromUI2)
HRESULT
VarI1FromUI432
(
ULONG
ulIn
,
CHAR
*
pcOut
);
#define VarI1FromUI4 WINELIB_NAME(VarI1FromUI4)
/*
HRESULT VarI1FromDec32(DECIMAL*pdecIn, CHAR*pcOut);
#define VarI1FromDec WINELIB_NAME(VarI1FromDec)
HRESULT VarI1FromDisp32(IDispatch*pdispIn, LCID lcid, CHAR*pcOut);
#define VarI1FromDisp WINELIB_NAME(VarI1FromDisp)
HRESULT VarI1FromCy32(CY cyIn, CHAR*pcOut);
#define VarI1FromCy WINELIB_NAME(VarI1FromCy)
*/
HRESULT
VarUI2FromUI132
(
BYTE
bIn
,
USHORT
*
puiOut
);
#define VarUI2FromUI1 WINELIB_NAME(VarUI2FromUI1)
HRESULT
VarUI2FromI232
(
short
uiIn
,
USHORT
*
puiOut
);
#define VarUI2FromI2 WINELIB_NAME(VarUI2FromI2)
HRESULT
VarUI2FromI432
(
LONG
lIn
,
USHORT
*
puiOut
);
#define VarUI2FromI4 WINELIB_NAME(VarUI2FromI4)
HRESULT
VarUI2FromR432
(
FLOAT
fltIn
,
USHORT
*
puiOut
);
#define VarUI2FromR4 WINELIB_NAME(VarUI2FromR4)
HRESULT
VarUI2FromR832
(
double
dblIn
,
USHORT
*
puiOut
);
#define VarUI2FromR8 WINELIB_NAME(VarUI2FromR8)
HRESULT
VarUI2FromDate32
(
DATE
dateIn
,
USHORT
*
puiOut
);
#define VarUI2FromDate WINELIB_NAME(VarUI2FromDate)
HRESULT
VarUI2FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
USHORT
*
puiOut
);
#define VarUI2FromStr WINELIB_NAME(VarUI2FromStr)
HRESULT
VarUI2FromBool32
(
VARIANT_BOOL
boolIn
,
USHORT
*
puiOut
);
#define VarUI2FromBool WINELIB_NAME(VarUI2FromBool)
HRESULT
VarUI2FromI132
(
CHAR
cIn
,
USHORT
*
puiOut
);
#define VarUI2FromI1 WINELIB_NAME(VarUI2FromI1)
HRESULT
VarUI2FromUI432
(
ULONG
ulIn
,
USHORT
*
puiOut
);
#define VarUI2FromUI4 WINELIB_NAME(VarUI2FromUI4)
/*
HRESULT VarUI2FromDec32(DECIMAL*pdecIn, USHORT*puiOut);
#define VarUI2FromDec WINELIB_NAME(VarUI2FromDec)
HRESULT VarUI2FromCy32(CY cyIn, USHORT*puiOut);
#define VarUI2FromCy WINELIB_NAME(VarUI2FromCy)
HRESULT VarUI2FromDisp32(IDispatch*pdispIn, LCID lcid, USHORT*puiOut);
#define VarUI2FromDisp WINELIB_NAME(VarUI2FromDisp)
*/
HRESULT
VarUI4FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
ULONG
*
pulOut
);
#define VarUI4FromStr WINELIB_NAME(VarUI4FromStr)
HRESULT
VarUI4FromUI132
(
BYTE
bIn
,
ULONG
*
pulOut
);
#define VarUI4FromUI1 WINELIB_NAME(VarUI4FromUI1)
HRESULT
VarUI4FromI232
(
short
uiIn
,
ULONG
*
pulOut
);
#define VarUI4FromI2 WINELIB_NAME(VarUI4FromI2)
HRESULT
VarUI4FromI432
(
LONG
lIn
,
ULONG
*
pulOut
);
#define VarUI4FromI4 WINELIB_NAME(VarUI4FromI4)
HRESULT
VarUI4FromR432
(
FLOAT
fltIn
,
ULONG
*
pulOut
);
#define VarUI4FromR4 WINELIB_NAME(VarUI4FromR4)
HRESULT
VarUI4FromR832
(
double
dblIn
,
ULONG
*
pulOut
);
#define VarUI4FromR8 WINELIB_NAME(VarUI4FromR8)
HRESULT
VarUI4FromDate32
(
DATE
dateIn
,
ULONG
*
pulOut
);
#define VarUI4FromDate WINELIB_NAME(VarUI4FromDate)
HRESULT
VarUI4FromBool32
(
VARIANT_BOOL
boolIn
,
ULONG
*
pulOut
);
#define VarUI4FromBool WINELIB_NAME(VarUI4FromBool)
HRESULT
VarUI4FromI132
(
CHAR
cIn
,
ULONG
*
pulOut
);
#define VarUI4FromI1 WINELIB_NAME(VarUI4FromI1)
HRESULT
VarUI4FromUI232
(
USHORT
uiIn
,
ULONG
*
pulOut
);
#define VarUI4FromUI2 WINELIB_NAME(VarUI4FromUI2)
/*
HRESULT VarUI4FromDec32(DECIMAL*pdecIn, ULONG*pulOut);
#define VarUI4FromDec WINELIB_NAME(VarUI4FromDec)
HRESULT VarUI4FromDisp32(IDispatch*pdispIn, LCID lcid, ULONG*pulOut);
#define VarUI4FromDisp WINELIB_NAME(VarUI4FromDisp)
HRESULT VarUI4FromCy32(CY cyIn, ULONG*pulOut);
#define VarUI4FromCy WINELIB_NAME(VarUI4FromCy)
HRESULT VarDecFromUI132(BYTE bIn, DECIMAL*pdecOut);
#define VarDecFromUI1 WINELIB_NAME(VarDecFromUI1)
HRESULT VarDecFromI232(short uiIn, DECIMAL*pdecOut);
#define VarDecFromI2 WINELIB_NAME(VarDecFromI2)
HRESULT VarDecFromI432(LONG lIn, DECIMAL*pdecOut);
#define VarDecFromI4 WINELIB_NAME(VarDecFromI4)
HRESULT VarDecFromR432(FLOAT fltIn, DECIMAL*pdecOut);
#define VarDecFromR4 WINELIB_NAME(VarDecFromR4)
HRESULT VarDecFromR832(double dblIn, DECIMAL*pdecOut);
#define VarDecFromR8 WINELIB_NAME(VarDecFromR8)
HRESULT VarDecFromDate32(DATE dateIn, DECIMAL*pdecOut);
#define VarDecFromDate WINELIB_NAME(VarDecFromDate)
HRESULT VarDecFromStr32(OLECHAR32*strIn, LCID lcid, ULONG dwFlags, DECIMAL*pdecOut);
#define VarDecFromStr WINELIB_NAME(VarDecFromStr)
HRESULT VarDecFromBool32(VARIANT_BOOL boolIn, DECIMAL*pdecOut);
#define VarDecFromBool WINELIB_NAME(VarDecFromBool)
HRESULT VarDecFromI132(CHAR cIn, DECIMAL*pdecOut);
#define VarDecFromI1 WINELIB_NAME(VarDecFromI1)
HRESULT VarDecFromUI232(USHORT uiIn, DECIMAL*pdecOut);
#define VarDecFromUI2 WINELIB_NAME(VarDecFromUI2)
HRESULT VarDecFromUI432(ULONG ulIn, DECIMAL*pdecOut);
#define VarDecFromUI4 WINELIB_NAME(VarDecFromUI4)
HRESULT VarDecFromCy32(CY cyIn, DECIMAL*pdecOut);
#define VarDecFromCy WINELIB_NAME(VarDecFromCy)
HRESULT VarDecFromDisp32(IDispatch*pdispIn, LCID lcid, DECIMAL*pdecOut);
#define VarDecFromDisp WINELIB_NAME(VarDecFromDisp)
*/
#define VarUI4FromUI4( in, pOut ) ( *(pOut) = (in) )
#define VarI4FromI4( in, pOut ) ( *(pOut) = (in) )
#define VarUI1FromInt32 VarUI1FromI432
#define VarUI1FromUint32 VarUI1FromUI432
#define VarI2FromInt32 VarI2FromI432
#define VarI2FromUint32 VarI2FromUI432
#define VarI4FromInt32 VarI4FromI432
#define VarI4FromUint32 VarI4FromUI432
#define VarR4FromInt32 VarR4FromI432
#define VarR4FromUint32 VarR4FromUI432
#define VarR8FromInt32 VarR8FromI432
#define VarR8FromUint32 VarR8FromUI432
#define VarDateFromInt32 VarDateFromI432
#define VarDateFromUint32 VarDateFromUI432
#define VarCyFromInt32 VarCyFromI432
#define VarCyFromUint32 VarCyFromUI432
#define VarBstrFromInt32 VarBstrFromI432
#define VarBstrFromUint32 VarBstrFromUI432
#define VarBoolFromInt32 VarBoolFromI432
#define VarBoolFromUint32 VarBoolFromUI432
#define VarI1FromInt32 VarI1FromI432
#define VarI1FromUint32 VarI1FromUI432
#define VarUI2FromInt32 VarUI2FromI432
#define VarUI2FromUint32 VarUI2FromUI432
#define VarUI4FromInt32 VarUI4FromI432
#define VarUI4FromUint32 VarUI4FromUI432
#define VarDecFromInt32 VarDecFromI432
#define VarDecFromUint32 VarDecFromUI432
#define VarIntFromUI132 VarI4FromUI132
#define VarIntFromI232 VarI4FromI232
#define VarIntFromI432 VarI4FromI432
#define VarIntFromR432 VarI4FromR432
#define VarIntFromR832 VarI4FromR832
#define VarIntFromDate32 VarI4FromDate32
#define VarIntFromCy32 VarI4FromCy32
#define VarIntFromStr32 VarI4FromStr32
#define VarIntFromDisp32 VarI4FromDisp32
#define VarIntFromBool32 VarI4FromBool32
#define VarIntFromI132 VarI4FromI132
#define VarIntFromUI232 VarI4FromUI232
#define VarIntFromUI432 VarI4FromUI432
#define VarIntFromDec32 VarI4FromDec32
#define VarIntFromUint32 VarI4FromUI432
#define VarUintFromUI132 VarUI4FromUI132
#define VarUintFromI232 VarUI4FromI232
#define VarUintFromI432 VarUI4FromI432
#define VarUintFromR432 VarUI4FromR432
#define VarUintFromR832 VarUI4FromR832
#define VarUintFromDate32 VarUI4FromDate32
#define VarUintFromCy32 VarUI4FromCy32
#define VarUintFromStr32 VarUI4FromStr32
#define VarUintFromDisp32 VarUI4FromDisp32
#define VarUintFromBool32 VarUI4FromBool32
#define VarUintFromI132 VarUI4FromI132
#define VarUintFromUI232 VarUI4FromUI232
#define VarUintFromUI432 VarUI4FromUI432
#define VarUintFromDec32 VarUI4FromDec32
#define VarUintFromInt32 VarUI4FromI432
#endif
/*__WINE_OLEAUTO_H*/
include/winerror.h
View file @
b00cbead
...
...
@@ -85,6 +85,10 @@ extern int WIN32_LastError;
#define NOERROR 0
#define S_OK 0
#define DISP_E_BADVARTYPE 0x80020008L
#define DISP_E_OVERFLOW 0x8002000AL
#define DISP_E_TYPEMISMATCH 0x80020005L
#define E_UNEXPECTED 0x8000FFFF
...
...
ole/Makefile.in
View file @
b00cbead
...
...
@@ -17,7 +17,8 @@ C_SRCS = \
oleobj.c
\
olesvr.c
\
storage.c
\
typelib.c
typelib.c
\
variant.c
all
:
$(MODULE).o
...
...
ole/typelib.c
View file @
b00cbead
...
...
@@ -97,7 +97,7 @@ QueryPathOfRegTypeLib32(
/******************************************************************************
* LoadTypeLib [TYPELIB.3] Loads and registers a type library
* NOTES
* Docs: OLECHAR FAR* szFile
* Docs: OLECHAR
32
FAR* szFile
* Docs: iTypeLib FAR* FAR* pptLib
*
* RETURNS
...
...
@@ -116,7 +116,7 @@ HRESULT WINAPI LoadTypeLib(
* LoadTypeLib32 [OLEAUT32.161]
* Loads and registers a type library
* NOTES
* Docs: OLECHAR FAR* szFile
* Docs: OLECHAR
32
FAR* szFile
* Docs: iTypeLib FAR* FAR* pptLib
*
* RETURNS
...
...
@@ -137,8 +137,8 @@ HRESULT WINAPI LoadTypeLib32(
* Adds information about a type library to the System Registry
* NOTES
* Docs: ITypeLib FAR * ptlib
* Docs: OLECHAR FAR* szFullPath
* Docs: OLECHAR FAR* szHelpDir
* Docs: OLECHAR
32
FAR* szFullPath
* Docs: OLECHAR
32
FAR* szHelpDir
*
* RETURNS
* Success: S_OK
...
...
@@ -146,8 +146,8 @@ HRESULT WINAPI LoadTypeLib32(
*/
HRESULT
WINAPI
RegisterTypeLib32
(
ITypeLib
*
ptlib
,
/*[in] Pointer to the library*/
OLECHAR
*
szFullPath
,
/*[in] full Path of the library*/
OLECHAR
*
szHelpDir
)
/*[in] dir to the helpfile for the library, may be NULL*/
OLECHAR
32
*
szFullPath
,
/*[in] full Path of the library*/
OLECHAR
32
*
szHelpDir
)
/*[in] dir to the helpfile for the library, may be NULL*/
{
FIXME
(
ole
,
"(%p,%s,%s): stub
\n
"
,
ptlib
,
szFullPath
,
szHelpDir
);
return
S_OK
;
/* FIXME: pretend everything is OK */
}
...
...
ole/variant.c
0 → 100644
View file @
b00cbead
/*
* VARIANT
*
* Copyright 1998 Jean-Claude Cote
*
* NOTES
* This implements the low-level and hi-level APIs for manipulating VARIANTs.
* The low-level APIs are used to do data coercion between different data types.
* The hi-level APIs are built on top of these low-level APIs and handle
* initialization, copying, destroying and changing the type of VARIANTs.
*
* TODO:
* - The Variant APIs are do not support international languages, currency
* types, number formating and calendar. They only support U.S. English format.
* - The Variant APIs do not the following types: IUknown, IDispatch, DECIMAL and SafeArray.
* The prototypes for these are commented out in the oleauto.h file. They need
* to be implemented and cases need to be added to the switches of the existing APIs.
* - The parsing of date for the VarDateFromStr still needs to be done. I'm currently
* working on this.
*/
#include "oleauto.h"
#include "heap.h"
#include "debug.h"
#include "winerror.h"
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
static
const
char
CHAR_MAX
=
127
;
static
const
char
CHAR_MIN
=
-
128
;
static
const
BYTE
UI1_MAX
=
255
;
static
const
BYTE
UI1_MIN
=
0
;
static
const
unsigned
short
UI2_MAX
=
65535
;
static
const
unsigned
short
UI2_MIN
=
0
;
static
const
short
I2_MAX
=
32767
;
static
const
short
I2_MIN
=
-
32768
;
static
const
unsigned
long
UI4_MAX
=
4294967295
;
static
const
unsigned
long
UI4_MIN
=
0
;
static
const
long
I4_MAX
=
2147483647
;
static
const
long
I4_MIN
=
-
2147483648
.
0
;
static
const
DATE
DATE_MIN
=
-
657434
;
static
const
DATE
DATE_MAX
=
2958465
;
/* This mask is used to set a flag in wReserved1 of
* the VARIANTARG structure. The flag indicates if
* the API function is using an inner variant or not.
*/
#define PROCESSING_INNER_VARIANT 0x0001
/* General use buffer.
*/
#define BUFFER_MAX 1024
static
char
pBuffer
[
BUFFER_MAX
];
/******************************************************************************
* SizeOfVariantData [INTERNAL]
*
* This function finds the size of the data referenced by a Variant based
* the type "vt" of the Variant.
*/
static
int
SizeOfVariantData
(
VARIANT
*
parg
)
{
int
size
=
0
;
switch
(
parg
->
vt
&
VT_TYPEMASK
)
{
case
(
VT_I2
):
size
=
sizeof
(
short
);
break
;
case
(
VT_INT
):
size
=
sizeof
(
int
);
break
;
case
(
VT_I4
):
size
=
sizeof
(
long
);
break
;
case
(
VT_UI1
):
size
=
sizeof
(
BYTE
);
break
;
case
(
VT_UI2
):
size
=
sizeof
(
unsigned
short
);
break
;
case
(
VT_UINT
):
size
=
sizeof
(
unsigned
int
);
break
;
case
(
VT_UI4
):
size
=
sizeof
(
unsigned
long
);
break
;
case
(
VT_R4
):
size
=
sizeof
(
float
);
break
;
case
(
VT_R8
):
size
=
sizeof
(
double
);
break
;
case
(
VT_DATE
):
size
=
sizeof
(
DATE
);
break
;
case
(
VT_BOOL
):
size
=
sizeof
(
VARIANT_BOOL
);
break
;
case
(
VT_BSTR
):
size
=
sizeof
(
void
*
);
break
;
case
(
VT_CY
):
case
(
VT_DISPATCH
):
case
(
VT_UNKNOWN
):
case
(
VT_DECIMAL
):
default:
FIXME
(
ole
,
"Add size information for type vt=%d
\n
"
,
parg
->
vt
&
VT_TYPEMASK
);
break
;
}
return
size
;
}
/******************************************************************************
* StringDupAtoBstr [INTERNAL]
*
*/
static
BSTR32
StringDupAtoBstr
(
char
*
strIn
)
{
BSTR32
bstr
=
NULL
;
OLECHAR32
*
pNewString
=
NULL
;
pNewString
=
HEAP_strdupAtoW
(
GetProcessHeap
(),
0
,
strIn
);
bstr
=
SysAllocString32
(
pNewString
);
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
return
bstr
;
}
/******************************************************************************
* round [INTERNAL]
*
* Round the double value to the nearest integer value.
*/
static
double
round
(
double
d
)
{
double
decimals
=
0
.
0
;
unsigned
long
integerValue
=
0
.
0
;
double
roundedValue
=
0
.
0
;
BOOL32
bEvenNumber
=
FALSE
;
int
nSign
=
0
;
/* Save the sign of the number
*/
nSign
=
d
>=
0
.
0
?
1
:
-
1
;
d
=
fabs
(
d
);
/* Remove the decimals.
*/
integerValue
=
(
unsigned
long
)
d
;
/* Set the Even flag. This is used to round the number when
* the decimals are exactly 1/2. If the integer part is
* odd the number is rounded up. If the integer part
* is even the number is rounded down. Using this method
* numbers are rounded up|down half the time.
*/
bEvenNumber
=
((
integerValue
%
2
)
==
0
)
?
TRUE
:
FALSE
;
/* Remove the integral part of the number.
*/
decimals
=
d
-
integerValue
;
/* Note: Ceil returns the smallest integer that is greater that x.
* and floor returns the largest integer that is less than or equal to x.
*/
if
(
decimals
>
0
.
5
)
{
/* If the decimal part is greater than 1/2
*/
roundedValue
=
ceil
(
d
);
}
else
if
(
decimals
<
0
.
5
)
{
/* If the decimal part is smaller than 1/2
*/
roundedValue
=
floor
(
d
);
}
else
{
/* the decimals are exactly 1/2 so round according to
* the bEvenNumber flag.
*/
if
(
bEvenNumber
)
{
roundedValue
=
floor
(
d
);
}
else
{
roundedValue
=
ceil
(
d
);
}
}
return
roundedValue
*
nSign
;
}
/******************************************************************************
* RemoveCharacterFromString [INTERNAL]
*
* Removes any of the characters in "strOfCharToRemove" from the "str" argument.
*/
static
void
RemoveCharacterFromString
(
LPSTR
str
,
LPSTR
strOfCharToRemove
)
{
LPSTR
pNewString
=
NULL
;
LPSTR
strToken
=
NULL
;
/* Check if we have a valid argument
*/
if
(
str
!=
NULL
)
{
pNewString
=
strdup
(
str
);
str
[
0
]
=
'\0'
;
strToken
=
strtok
(
pNewString
,
strOfCharToRemove
);
while
(
strToken
!=
NULL
)
{
strcat
(
str
,
strToken
);
strToken
=
strtok
(
NULL
,
strOfCharToRemove
);
}
free
(
pNewString
);
}
return
;
}
/******************************************************************************
* GetValidRealString [INTERNAL]
*
* Checks if the string is of proper format to be converted to a real value.
*/
static
BOOL32
IsValidRealString
(
LPSTR
strRealString
)
{
/* Real values that have a decimal point are required to either have
* digits before or after the decimal point. We will assume that
* we do not have any digits at either position. If we do encounter
* some we will disable this flag.
*/
BOOL32
bDigitsRequired
=
TRUE
;
/* Processed fields in the string representation of the real number.
*/
BOOL32
bWhiteSpaceProcessed
=
FALSE
;
BOOL32
bFirstSignProcessed
=
FALSE
;
BOOL32
bFirstDigitsProcessed
=
FALSE
;
BOOL32
bDecimalPointProcessed
=
FALSE
;
BOOL32
bSecondDigitsProcessed
=
FALSE
;
BOOL32
bExponentProcessed
=
FALSE
;
BOOL32
bSecondSignProcessed
=
FALSE
;
BOOL32
bThirdDigitsProcessed
=
FALSE
;
/* Assume string parameter "strRealString" is valid and try to disprove it.
*/
BOOL32
bValidRealString
=
TRUE
;
/* Used to count the number of tokens in the "strRealString".
*/
LPSTR
strToken
=
NULL
;
int
nTokens
=
0
;
LPSTR
pChar
=
NULL
;
/* Check if we have a valid argument
*/
if
(
strRealString
==
NULL
)
{
bValidRealString
=
FALSE
;
}
if
(
bValidRealString
==
TRUE
)
{
/* Make sure we only have ONE token in the string.
*/
strToken
=
strtok
(
strRealString
,
" "
);
while
(
strToken
!=
NULL
)
{
nTokens
++
;
strToken
=
strtok
(
NULL
,
" "
);
}
if
(
nTokens
!=
1
)
{
bValidRealString
=
FALSE
;
}
}
/* Make sure this token contains only valid characters.
* The string argument to atof has the following form:
* [whitespace] [sign] [digits] [.digits] [ {d | D | e | E }[sign]digits]
* Whitespace consists of space and|or <TAB> characters, which are ignored.
* Sign is either plus '+' or minus '-'.
* Digits are one or more decimal digits.
* Note: If no digits appear before the decimal point, at least one must
* appear after the decimal point.
* The decimal digits may be followed by an exponent.
* An Exponent consists of an introductory letter ( D, d, E, or e) and
* an optionally signed decimal integer.
*/
pChar
=
strRealString
;
while
(
bValidRealString
==
TRUE
&&
*
pChar
!=
'\0'
)
{
switch
(
*
pChar
)
{
/* If whitespace...
*/
case
' '
:
case
'\t'
:
if
(
bWhiteSpaceProcessed
||
bFirstSignProcessed
||
bFirstDigitsProcessed
||
bDecimalPointProcessed
||
bSecondDigitsProcessed
||
bExponentProcessed
||
bSecondSignProcessed
||
bThirdDigitsProcessed
)
{
bValidRealString
=
FALSE
;
}
break
;
/* If sign...
*/
case
'+'
:
case
'-'
:
if
(
bFirstSignProcessed
==
FALSE
)
{
if
(
bFirstDigitsProcessed
||
bDecimalPointProcessed
||
bSecondDigitsProcessed
||
bExponentProcessed
||
bSecondSignProcessed
||
bThirdDigitsProcessed
)
{
bValidRealString
=
FALSE
;
}
bWhiteSpaceProcessed
=
TRUE
;
bFirstSignProcessed
=
TRUE
;
}
else
if
(
bSecondSignProcessed
==
FALSE
)
{
/* Note: The exponent must be present in
* order to accept the second sign...
*/
if
(
bExponentProcessed
==
FALSE
||
bThirdDigitsProcessed
||
bDigitsRequired
)
{
bValidRealString
=
FALSE
;
}
bFirstSignProcessed
=
TRUE
;
bWhiteSpaceProcessed
=
TRUE
;
bFirstDigitsProcessed
=
TRUE
;
bDecimalPointProcessed
=
TRUE
;
bSecondDigitsProcessed
=
TRUE
;
bSecondSignProcessed
=
TRUE
;
}
break
;
/* If decimals...
*/
case
'0'
:
case
'1'
:
case
'2'
:
case
'3'
:
case
'4'
:
case
'5'
:
case
'6'
:
case
'7'
:
case
'8'
:
case
'9'
:
if
(
bFirstDigitsProcessed
==
FALSE
)
{
if
(
bDecimalPointProcessed
||
bSecondDigitsProcessed
||
bExponentProcessed
||
bSecondSignProcessed
||
bThirdDigitsProcessed
)
{
bValidRealString
=
FALSE
;
}
bFirstSignProcessed
=
TRUE
;
bWhiteSpaceProcessed
=
TRUE
;
/* We have found some digits before the decimal point
* so disable the "Digits required" flag.
*/
bDigitsRequired
=
FALSE
;
}
else
if
(
bSecondDigitsProcessed
==
FALSE
)
{
if
(
bExponentProcessed
||
bSecondSignProcessed
||
bThirdDigitsProcessed
)
{
bValidRealString
=
FALSE
;
}
bFirstSignProcessed
=
TRUE
;
bWhiteSpaceProcessed
=
TRUE
;
bFirstDigitsProcessed
=
TRUE
;
bDecimalPointProcessed
=
TRUE
;
/* We have found some digits after the decimal point
* so disable the "Digits required" flag.
*/
bDigitsRequired
=
FALSE
;
}
else
if
(
bThirdDigitsProcessed
==
FALSE
)
{
/* Getting here means everything else should be processed.
* If we get anything else than a decimal following this
* digit it will be flagged by the other cases, so
* we do not really need to do anything in here.
*/
}
break
;
/* If DecimalPoint...
*/
case
'.'
:
if
(
bDecimalPointProcessed
||
bSecondDigitsProcessed
||
bExponentProcessed
||
bSecondSignProcessed
||
bThirdDigitsProcessed
)
{
bValidRealString
=
FALSE
;
}
bFirstSignProcessed
=
TRUE
;
bWhiteSpaceProcessed
=
TRUE
;
bFirstDigitsProcessed
=
TRUE
;
bDecimalPointProcessed
=
TRUE
;
break
;
/* If Exponent...
*/
case
'e'
:
case
'E'
:
case
'd'
:
case
'D'
:
if
(
bExponentProcessed
||
bSecondSignProcessed
||
bThirdDigitsProcessed
||
bDigitsRequired
)
{
bValidRealString
=
FALSE
;
}
bFirstSignProcessed
=
TRUE
;
bWhiteSpaceProcessed
=
TRUE
;
bFirstDigitsProcessed
=
TRUE
;
bDecimalPointProcessed
=
TRUE
;
bSecondDigitsProcessed
=
TRUE
;
bExponentProcessed
=
TRUE
;
break
;
default:
bValidRealString
=
FALSE
;
break
;
}
/* Process next character.
*/
pChar
++
;
}
/* If the required digits were not present we have an invalid
* string representation of a real number.
*/
if
(
bDigitsRequired
==
TRUE
)
{
bValidRealString
=
FALSE
;
}
return
bValidRealString
;
}
/******************************************************************************
* Coerce [INTERNAL]
*
* This function dispatches execution to the proper conversion API
* to do the necessary coercion.
*/
static
HRESULT
Coerce
(
VARIANTARG
*
pd
,
LCID
lcid
,
ULONG
dwFlags
,
VARIANTARG
*
ps
,
VARTYPE
vt
)
{
HRESULT
res
=
S_OK
;
unsigned
short
vtFrom
=
0
;
vtFrom
=
ps
->
vt
&
VT_TYPEMASK
;
/* Note: Since "long" and "int" values both have 4 bytes and are both signed integers
* "int" will be treated as "long" in the following code.
* The same goes for there unsigned versions.
*/
switch
(
vt
)
{
case
(
VT_EMPTY
):
res
=
VariantClear32
(
pd
);
break
;
case
(
VT_NULL
):
res
=
VariantClear32
(
pd
);
if
(
res
==
S_OK
)
{
pd
->
vt
=
VT_NULL
;
}
break
;
case
(
VT_I1
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_I2
):
res
=
VarI1FromI232
(
ps
->
u
.
iVal
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_INT
):
case
(
VT_I4
):
res
=
VarI1FromI432
(
ps
->
u
.
lVal
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_UI1
):
res
=
VarI1FromUI132
(
ps
->
u
.
bVal
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_UI2
):
res
=
VarI1FromUI232
(
ps
->
u
.
uiVal
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_UINT
):
case
(
VT_UI4
):
res
=
VarI1FromUI432
(
ps
->
u
.
ulVal
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_R4
):
res
=
VarI1FromR432
(
ps
->
u
.
fltVal
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_R8
):
res
=
VarI1FromR832
(
ps
->
u
.
dblVal
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_DATE
):
res
=
VarI1FromDate32
(
ps
->
u
.
date
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VarI1FromBool32
(
ps
->
u
.
boolVal
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_BSTR
):
res
=
VarI1FromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
cVal
)
);
break
;
case
(
VT_CY
):
/*res = VarI1FromCY32( ps->u.cyVal, &(pd->u.cVal) );*/
case
(
VT_DISPATCH
):
/*res = VarI1FromDisp32( ps->u.pdispVal, lcid, &(pd->u.cVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarI1From32( ps->u.lVal, &(pd->u.cVal) );*/
case
(
VT_DECIMAL
):
/*res = VarI1FromDec32( ps->u.decVal, &(pd->u.cVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_I2
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarI2FromI132
(
ps
->
u
.
cVal
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_I2
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_INT
):
case
(
VT_I4
):
res
=
VarI2FromI432
(
ps
->
u
.
lVal
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_UI1
):
res
=
VarI2FromUI132
(
ps
->
u
.
bVal
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_UI2
):
res
=
VarI2FromUI232
(
ps
->
u
.
uiVal
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_UINT
):
case
(
VT_UI4
):
res
=
VarI2FromUI432
(
ps
->
u
.
ulVal
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_R4
):
res
=
VarI2FromR432
(
ps
->
u
.
fltVal
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_R8
):
res
=
VarI2FromR832
(
ps
->
u
.
dblVal
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_DATE
):
res
=
VarI2FromDate32
(
ps
->
u
.
date
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VarI2FromBool32
(
ps
->
u
.
boolVal
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_BSTR
):
res
=
VarI2FromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
iVal
)
);
break
;
case
(
VT_CY
):
/*res = VarI2FromCY32( ps->u.cyVal, &(pd->u.iVal) );*/
case
(
VT_DISPATCH
):
/*res = VarI2FromDisp32( ps->u.pdispVal, lcid, &(pd->u.iVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarI2From32( ps->u.lVal, &(pd->u.iVal) );*/
case
(
VT_DECIMAL
):
/*res = VarI2FromDec32( ps->u.deiVal, &(pd->u.iVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_INT
):
case
(
VT_I4
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarI4FromI132
(
ps
->
u
.
cVal
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_I2
):
res
=
VarI4FromI232
(
ps
->
u
.
iVal
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_INT
):
case
(
VT_I4
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_UI1
):
res
=
VarI4FromUI132
(
ps
->
u
.
bVal
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_UI2
):
res
=
VarI4FromUI232
(
ps
->
u
.
uiVal
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_UINT
):
case
(
VT_UI4
):
res
=
VarI4FromUI432
(
ps
->
u
.
ulVal
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_R4
):
res
=
VarI4FromR432
(
ps
->
u
.
fltVal
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_R8
):
res
=
VarI4FromR832
(
ps
->
u
.
dblVal
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_DATE
):
res
=
VarI4FromDate32
(
ps
->
u
.
date
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VarI4FromBool32
(
ps
->
u
.
boolVal
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_BSTR
):
res
=
VarI4FromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
lVal
)
);
break
;
case
(
VT_CY
):
/*res = VarI4FromCY32( ps->u.cyVal, &(pd->u.lVal) );*/
case
(
VT_DISPATCH
):
/*res = VarI4FromDisp32( ps->u.pdispVal, lcid, &(pd->u.lVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarI4From32( ps->u.lVal, &(pd->u.lVal) );*/
case
(
VT_DECIMAL
):
/*res = VarI4FromDec32( ps->u.deiVal, &(pd->u.lVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_UI1
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarUI1FromI132
(
ps
->
u
.
cVal
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_I2
):
res
=
VarUI1FromI232
(
ps
->
u
.
iVal
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_INT
):
case
(
VT_I4
):
res
=
VarUI1FromI432
(
ps
->
u
.
lVal
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_UI1
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_UI2
):
res
=
VarUI1FromUI232
(
ps
->
u
.
uiVal
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_UINT
):
case
(
VT_UI4
):
res
=
VarUI1FromUI432
(
ps
->
u
.
ulVal
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_R4
):
res
=
VarUI1FromR432
(
ps
->
u
.
fltVal
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_R8
):
res
=
VarUI1FromR832
(
ps
->
u
.
dblVal
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_DATE
):
res
=
VarUI1FromDate32
(
ps
->
u
.
date
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VarUI1FromBool32
(
ps
->
u
.
boolVal
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_BSTR
):
res
=
VarUI1FromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bVal
)
);
break
;
case
(
VT_CY
):
/*res = VarUI1FromCY32( ps->u.cyVal, &(pd->u.bVal) );*/
case
(
VT_DISPATCH
):
/*res = VarUI1FromDisp32( ps->u.pdispVal, lcid, &(pd->u.bVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarUI1From32( ps->u.lVal, &(pd->u.bVal) );*/
case
(
VT_DECIMAL
):
/*res = VarUI1FromDec32( ps->u.deiVal, &(pd->u.bVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_UI2
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarUI2FromI132
(
ps
->
u
.
cVal
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_I2
):
res
=
VarUI2FromI232
(
ps
->
u
.
iVal
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_INT
):
case
(
VT_I4
):
res
=
VarUI2FromI432
(
ps
->
u
.
lVal
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_UI1
):
res
=
VarUI2FromUI132
(
ps
->
u
.
bVal
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_UI2
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_UINT
):
case
(
VT_UI4
):
res
=
VarUI2FromUI432
(
ps
->
u
.
ulVal
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_R4
):
res
=
VarUI2FromR432
(
ps
->
u
.
fltVal
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_R8
):
res
=
VarUI2FromR832
(
ps
->
u
.
dblVal
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_DATE
):
res
=
VarUI2FromDate32
(
ps
->
u
.
date
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VarUI2FromBool32
(
ps
->
u
.
boolVal
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_BSTR
):
res
=
VarUI2FromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
uiVal
)
);
break
;
case
(
VT_CY
):
/*res = VarUI2FromCY32( ps->u.cyVal, &(pd->u.uiVal) );*/
case
(
VT_DISPATCH
):
/*res = VarUI2FromDisp32( ps->u.pdispVal, lcid, &(pd->u.uiVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarUI2From32( ps->u.lVal, &(pd->u.uiVal) );*/
case
(
VT_DECIMAL
):
/*res = VarUI2FromDec32( ps->u.deiVal, &(pd->u.uiVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_UINT
):
case
(
VT_UI4
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarUI4FromI132
(
ps
->
u
.
cVal
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_I2
):
res
=
VarUI4FromI232
(
ps
->
u
.
iVal
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_INT
):
case
(
VT_I4
):
res
=
VarUI4FromI432
(
ps
->
u
.
lVal
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_UI1
):
res
=
VarUI4FromUI132
(
ps
->
u
.
bVal
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_UI2
):
res
=
VarUI4FromUI232
(
ps
->
u
.
uiVal
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_UI4
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_R4
):
res
=
VarUI4FromR432
(
ps
->
u
.
fltVal
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_R8
):
res
=
VarUI4FromR832
(
ps
->
u
.
dblVal
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_DATE
):
res
=
VarUI4FromDate32
(
ps
->
u
.
date
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VarUI4FromBool32
(
ps
->
u
.
boolVal
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_BSTR
):
res
=
VarUI4FromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
ulVal
)
);
break
;
case
(
VT_CY
):
/*res = VarUI4FromCY32( ps->u.cyVal, &(pd->u.ulVal) );*/
case
(
VT_DISPATCH
):
/*res = VarUI4FromDisp32( ps->u.pdispVal, lcid, &(pd->u.ulVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarUI4From32( ps->u.lVal, &(pd->u.ulVal) );*/
case
(
VT_DECIMAL
):
/*res = VarUI4FromDec32( ps->u.deiVal, &(pd->u.ulVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_R4
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarR4FromI132
(
ps
->
u
.
cVal
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_I2
):
res
=
VarR4FromI232
(
ps
->
u
.
iVal
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_INT
):
case
(
VT_I4
):
res
=
VarR4FromI432
(
ps
->
u
.
lVal
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_UI1
):
res
=
VarR4FromUI132
(
ps
->
u
.
bVal
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_UI2
):
res
=
VarR4FromUI232
(
ps
->
u
.
uiVal
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_UINT
):
case
(
VT_UI4
):
res
=
VarR4FromUI432
(
ps
->
u
.
ulVal
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_R4
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_R8
):
res
=
VarR4FromR832
(
ps
->
u
.
dblVal
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_DATE
):
res
=
VarR4FromDate32
(
ps
->
u
.
date
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VarR4FromBool32
(
ps
->
u
.
boolVal
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_BSTR
):
res
=
VarR4FromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
fltVal
)
);
break
;
case
(
VT_CY
):
/*res = VarR4FromCY32( ps->u.cyVal, &(pd->u.fltVal) );*/
case
(
VT_DISPATCH
):
/*res = VarR4FromDisp32( ps->u.pdispVal, lcid, &(pd->u.fltVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarR4From32( ps->u.lVal, &(pd->u.fltVal) );*/
case
(
VT_DECIMAL
):
/*res = VarR4FromDec32( ps->u.deiVal, &(pd->u.fltVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_R8
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarR8FromI132
(
ps
->
u
.
cVal
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_I2
):
res
=
VarR8FromI232
(
ps
->
u
.
iVal
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_INT
):
case
(
VT_I4
):
res
=
VarR8FromI432
(
ps
->
u
.
lVal
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_UI1
):
res
=
VarR8FromUI132
(
ps
->
u
.
bVal
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_UI2
):
res
=
VarR8FromUI232
(
ps
->
u
.
uiVal
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_UINT
):
case
(
VT_UI4
):
res
=
VarR8FromUI432
(
ps
->
u
.
ulVal
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_R4
):
res
=
VarR8FromR432
(
ps
->
u
.
fltVal
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_R8
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_DATE
):
res
=
VarR8FromDate32
(
ps
->
u
.
date
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VarR8FromBool32
(
ps
->
u
.
boolVal
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_BSTR
):
res
=
VarR8FromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
dblVal
)
);
break
;
case
(
VT_CY
):
/*res = VarR8FromCY32( ps->u.cyVal, &(pd->u.dblVal) );*/
case
(
VT_DISPATCH
):
/*res = VarR8FromDisp32( ps->u.pdispVal, lcid, &(pd->u.dblVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarR8From32( ps->u.lVal, &(pd->u.dblVal) );*/
case
(
VT_DECIMAL
):
/*res = VarR8FromDec32( ps->u.deiVal, &(pd->u.dblVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_DATE
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarDateFromI132
(
ps
->
u
.
cVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_I2
):
res
=
VarDateFromI232
(
ps
->
u
.
iVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_INT
):
res
=
VarDateFromInt32
(
ps
->
u
.
intVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_I4
):
res
=
VarDateFromI432
(
ps
->
u
.
lVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_UI1
):
res
=
VarDateFromUI132
(
ps
->
u
.
bVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_UI2
):
res
=
VarDateFromUI232
(
ps
->
u
.
uiVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_UINT
):
res
=
VarDateFromUint32
(
ps
->
u
.
uintVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_UI4
):
res
=
VarDateFromUI432
(
ps
->
u
.
ulVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_R4
):
res
=
VarDateFromR432
(
ps
->
u
.
fltVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_R8
):
res
=
VarDateFromR832
(
ps
->
u
.
dblVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_DATE
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_BOOL
):
res
=
VarDateFromBool32
(
ps
->
u
.
boolVal
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_BSTR
):
res
=
VarDateFromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
date
)
);
break
;
case
(
VT_CY
):
/*res = VarDateFromCY32( ps->u.cyVal, &(pd->u.date) );*/
case
(
VT_DISPATCH
):
/*res = VarDateFromDisp32( ps->u.pdispVal, lcid, &(pd->u.date) );*/
case
(
VT_UNKNOWN
):
/*res = VarDateFrom32( ps->u.lVal, &(pd->u.date) );*/
case
(
VT_DECIMAL
):
/*res = VarDateFromDec32( ps->u.deiVal, &(pd->u.date) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_BOOL
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarBoolFromI132
(
ps
->
u
.
cVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_I2
):
res
=
VarBoolFromI232
(
ps
->
u
.
iVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_INT
):
res
=
VarBoolFromInt32
(
ps
->
u
.
intVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_I4
):
res
=
VarBoolFromI432
(
ps
->
u
.
lVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_UI1
):
res
=
VarBoolFromUI132
(
ps
->
u
.
bVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_UI2
):
res
=
VarBoolFromUI232
(
ps
->
u
.
uiVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_UINT
):
res
=
VarBoolFromUint32
(
ps
->
u
.
uintVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_UI4
):
res
=
VarBoolFromUI432
(
ps
->
u
.
ulVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_R4
):
res
=
VarBoolFromR432
(
ps
->
u
.
fltVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_R8
):
res
=
VarBoolFromR832
(
ps
->
u
.
dblVal
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_DATE
):
res
=
VarBoolFromDate32
(
ps
->
u
.
date
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_BSTR
):
res
=
VarBoolFromStr32
(
ps
->
u
.
bstrVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
boolVal
)
);
break
;
case
(
VT_CY
):
/*res = VarBoolFromCY32( ps->u.cyVal, &(pd->u.boolVal) );*/
case
(
VT_DISPATCH
):
/*res = VarBoolFromDisp32( ps->u.pdispVal, lcid, &(pd->u.boolVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarBoolFrom32( ps->u.lVal, &(pd->u.boolVal) );*/
case
(
VT_DECIMAL
):
/*res = VarBoolFromDec32( ps->u.deiVal, &(pd->u.boolVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
case
(
VT_BSTR
):
switch
(
vtFrom
)
{
case
(
VT_I1
):
res
=
VarBstrFromI132
(
ps
->
u
.
cVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_I2
):
res
=
VarBstrFromI232
(
ps
->
u
.
iVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_INT
):
res
=
VarBstrFromInt32
(
ps
->
u
.
intVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_I4
):
res
=
VarBstrFromI432
(
ps
->
u
.
lVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_UI1
):
res
=
VarBstrFromUI132
(
ps
->
u
.
bVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_UI2
):
res
=
VarBstrFromUI232
(
ps
->
u
.
uiVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_UINT
):
res
=
VarBstrFromUint32
(
ps
->
u
.
uintVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_UI4
):
res
=
VarBstrFromUI432
(
ps
->
u
.
ulVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_R4
):
res
=
VarBstrFromR432
(
ps
->
u
.
fltVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_R8
):
res
=
VarBstrFromR832
(
ps
->
u
.
dblVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_DATE
):
res
=
VarBstrFromDate32
(
ps
->
u
.
date
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_BOOL
):
res
=
VarBstrFromBool32
(
ps
->
u
.
boolVal
,
lcid
,
dwFlags
,
&
(
pd
->
u
.
bstrVal
)
);
break
;
case
(
VT_BSTR
):
res
=
VariantCopy32
(
pd
,
ps
);
break
;
case
(
VT_CY
):
/*res = VarBstrFromCY32( ps->u.cyVal, lcid, dwFlags, &(pd->u.bstrVal) );*/
case
(
VT_DISPATCH
):
/*res = VarBstrFromDisp32( ps->u.pdispVal, lcid, lcid, dwFlags, &(pd->u.bstrVal) );*/
case
(
VT_UNKNOWN
):
/*res = VarBstrFrom32( ps->u.lVal, lcid, dwFlags, &(pd->u.bstrVal) );*/
case
(
VT_DECIMAL
):
/*res = VarBstrFromDec32( ps->u.deiVal, lcid, dwFlags, &(pd->u.bstrVal) );*/
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
break
;
default:
res
=
DISP_E_TYPEMISMATCH
;
FIXME
(
ole
,
"Coercion from %d to %d
\n
"
,
vtFrom
,
vt
);
break
;
}
return
res
;
}
/******************************************************************************
* ValidateVtRange [INTERNAL]
*
* Used internally by the hi-level Variant API to determine
* if the vartypes are valid.
*/
static
HRESULT
ValidateVtRange
(
VARTYPE
vt
)
{
/* if by value we must make sure it is in the
* range of the valid types.
*/
if
(
(
vt
&
VT_TYPEMASK
)
>
VT_MAXVALIDTYPE
)
{
return
DISP_E_BADVARTYPE
;
}
return
S_OK
;
}
/******************************************************************************
* ValidateVartype [INTERNAL]
*
* Used internally by the hi-level Variant API to determine
* if the vartypes are valid.
*/
static
HRESULT
ValidateVariantType
(
VARTYPE
vt
)
{
HRESULT
res
=
S_OK
;
/* check if we have a valid argument.
*/
if
(
vt
&
VT_BYREF
)
{
/* if by reference check that the type is in
* the valid range and that it is not of empty or null type
*/
if
(
(
vt
&
VT_TYPEMASK
)
==
VT_EMPTY
||
(
vt
&
VT_TYPEMASK
)
==
VT_NULL
||
(
vt
&
VT_TYPEMASK
)
>
VT_MAXVALIDTYPE
)
{
res
=
E_INVALIDARG
;
}
}
else
{
res
=
ValidateVtRange
(
vt
);
}
return
res
;
}
/******************************************************************************
* ValidateVt [INTERNAL]
*
* Used internally by the hi-level Variant API to determine
* if the vartypes are valid.
*/
static
HRESULT
ValidateVt
(
VARTYPE
vt
)
{
HRESULT
res
=
S_OK
;
/* check if we have a valid argument.
*/
if
(
vt
&
VT_BYREF
)
{
/* if by reference check that the type is in
* the valid range and that it is not of empty or null type
*/
if
(
(
vt
&
VT_TYPEMASK
)
==
VT_EMPTY
||
(
vt
&
VT_TYPEMASK
)
==
VT_NULL
||
(
vt
&
VT_TYPEMASK
)
>
VT_MAXVALIDTYPE
)
{
res
=
DISP_E_BADVARTYPE
;
}
}
else
{
res
=
ValidateVtRange
(
vt
);
}
return
res
;
}
/******************************************************************************
* VariantInit32 [OLEAUT32.8]
*
* Initializes the Variant. Unlike VariantClear it does not interpret the current
* contents of the Variant.
*/
void
VariantInit32
(
VARIANTARG
*
pvarg
)
{
TRACE
(
ole
,
"(%p),stub
\n
"
,
pvarg
);
pvarg
->
vt
=
VT_EMPTY
;
pvarg
->
wReserved1
=
0
;
pvarg
->
wReserved2
=
0
;
pvarg
->
wReserved3
=
0
;
return
;
}
/******************************************************************************
* VariantClear32 [OLEAUT32.9]
*
* This function clears the VARIANT by setting the vt field to VT_EMPTY. It also
* sets the wReservedX field to 0. The current contents of the VARIANT are
* freed. If the vt is VT_BSTR the string is freed. If VT_DISPATCH the object is
* released. If VT_ARRAY the array is freed.
*/
HRESULT
VariantClear32
(
VARIANTARG
*
pvarg
)
{
HRESULT
res
=
S_OK
;
TRACE
(
ole
,
"(%p),stub
\n
"
,
pvarg
);
res
=
ValidateVariantType
(
pvarg
->
vt
);
if
(
res
==
S_OK
)
{
if
(
!
(
pvarg
->
vt
&
VT_BYREF
)
)
{
switch
(
pvarg
->
vt
&
VT_TYPEMASK
)
{
case
(
VT_BSTR
):
SysFreeString32
(
pvarg
->
u
.
bstrVal
);
break
;
case
(
VT_DISPATCH
):
break
;
case
(
VT_VARIANT
):
break
;
case
(
VT_UNKNOWN
):
break
;
case
(
VT_SAFEARRAY
):
break
;
default:
break
;
}
}
/* Set the fields to empty.
*/
pvarg
->
wReserved1
=
0
;
pvarg
->
wReserved2
=
0
;
pvarg
->
wReserved3
=
0
;
pvarg
->
vt
=
VT_EMPTY
;
}
return
res
;
}
/******************************************************************************
* VariantCopy32 [OLEAUT32.10]
*
* Frees up the designation variant and makes a copy of the source.
*/
HRESULT
VariantCopy32
(
VARIANTARG
*
pvargDest
,
VARIANTARG
*
pvargSrc
)
{
HRESULT
res
=
S_OK
;
TRACE
(
ole
,
"(%p, %p),stub
\n
"
,
pvargDest
,
pvargSrc
);
res
=
ValidateVariantType
(
pvargSrc
->
vt
);
/* If the pointer are to the same variant we don't need
* to do anything.
*/
if
(
pvargDest
!=
pvargSrc
&&
res
==
S_OK
)
{
res
=
VariantClear32
(
pvargDest
);
if
(
res
==
S_OK
)
{
if
(
pvargSrc
->
vt
&
VT_BYREF
)
{
/* In the case of byreference we only need
* to copy the pointer.
*/
pvargDest
->
u
=
pvargSrc
->
u
;
pvargDest
->
vt
=
pvargSrc
->
vt
;
}
else
{
/* In the case of by value we need to
* copy the actuall value. In the case of
* VT_BSTR a copy of the string is made,
* if VT_ARRAY the entire array is copied
* if VT_DISPATCH or VT_IUNKNOWN AddReff is
* called to increment the object's reference count.
*/
switch
(
pvargSrc
->
vt
&
VT_TYPEMASK
)
{
case
(
VT_BSTR
):
pvargDest
->
u
.
bstrVal
=
SysAllocString32
(
pvargSrc
->
u
.
bstrVal
);
break
;
case
(
VT_DISPATCH
):
break
;
case
(
VT_VARIANT
):
break
;
case
(
VT_UNKNOWN
):
break
;
case
(
VT_SAFEARRAY
):
break
;
default:
pvargDest
->
u
=
pvargSrc
->
u
;
break
;
}
pvargDest
->
vt
=
pvargSrc
->
vt
;
}
}
}
return
res
;
}
/******************************************************************************
* VariantCopyInd32 [OLEAUT32.11]
*
* Frees up the destination variant and makes a copy of the source. If
* the source is of type VT_BYREF it performs the necessary indirections.
*/
HRESULT
VariantCopyInd32
(
VARIANT
*
pvargDest
,
VARIANTARG
*
pvargSrc
)
{
HRESULT
res
=
S_OK
;
TRACE
(
ole
,
"(%p, %p),stub
\n
"
,
pvargDest
,
pvargSrc
);
res
=
ValidateVariantType
(
pvargSrc
->
vt
);
if
(
res
!=
S_OK
)
return
res
;
if
(
pvargSrc
->
vt
&
VT_BYREF
)
{
VARIANTARG
varg
;
VariantInit32
(
&
varg
);
/* handle the in place copy.
*/
if
(
pvargDest
==
pvargSrc
)
{
/* we will use a copy of the source instead.
*/
res
=
VariantCopy32
(
&
varg
,
pvargSrc
);
pvargSrc
=
&
varg
;
}
if
(
res
==
S_OK
)
{
res
=
VariantClear32
(
pvargDest
);
if
(
res
==
S_OK
)
{
/* In the case of by reference we need
* to copy the date pointed to by the variant.
*/
/* Get the variant type.
*/
switch
(
pvargSrc
->
vt
&
VT_TYPEMASK
)
{
case
(
VT_BSTR
):
pvargDest
->
u
.
bstrVal
=
SysAllocString32
(
*
(
pvargSrc
->
u
.
pbstrVal
)
);
break
;
case
(
VT_DISPATCH
):
break
;
case
(
VT_VARIANT
):
{
/* Prevent from cycling. According to tests on
* VariantCopyInd in Windows and the documentation
* this API dereferences the inner Variants to only on depth.
* If the inner Variant itself contains an
* other inner variant the E_INVALIDARG error is
* returned.
*/
if
(
pvargSrc
->
wReserved1
&
PROCESSING_INNER_VARIANT
)
{
/* If we get here we are attempting to deference
* an inner variant that that is itself contained
* in an inner variant so report E_INVALIDARG error.
*/
res
=
E_INVALIDARG
;
}
else
{
/* Set the processing inner variant flag.
* We will set this flag in the inner variant
* that will be passed to the VariantCopyInd function.
*/
(
pvargSrc
->
u
.
pvarVal
)
->
wReserved1
|=
PROCESSING_INNER_VARIANT
;
/* Dereference the inner variant.
*/
res
=
VariantCopyInd32
(
pvargDest
,
pvargSrc
->
u
.
pvarVal
);
}
}
break
;
case
(
VT_UNKNOWN
):
break
;
case
(
VT_SAFEARRAY
):
break
;
default:
/* This is a by reference Variant which means that the union
* part of the Variant contains a pointer to some data of
* type "pvargSrc->vt & VT_TYPEMASK".
* We will deference this data in a generic fashion using
* the void pointer "Variant.u.byref".
* We will copy this data into the union of the destination
* Variant.
*/
memcpy
(
&
pvargDest
->
u
,
pvargSrc
->
u
.
byref
,
SizeOfVariantData
(
pvargSrc
)
);
break
;
}
pvargDest
->
vt
=
pvargSrc
->
vt
&
VT_TYPEMASK
;
}
}
/* this should not fail.
*/
VariantClear32
(
&
varg
);
}
else
{
res
=
VariantCopy32
(
pvargDest
,
pvargSrc
);
}
return
res
;
}
/******************************************************************************
* VariantChangeType32 [OLEAUT32.12]
*/
HRESULT
VariantChangeType32
(
VARIANTARG
*
pvargDest
,
VARIANTARG
*
pvargSrc
,
USHORT
wFlags
,
VARTYPE
vt
)
{
return
VariantChangeTypeEx32
(
pvargDest
,
pvargSrc
,
0
,
wFlags
,
vt
);
}
/******************************************************************************
* VariantChangeTypeEx32 [OLEAUT32.147]
*/
HRESULT
VariantChangeTypeEx32
(
VARIANTARG
*
pvargDest
,
VARIANTARG
*
pvargSrc
,
LCID
lcid
,
USHORT
wFlags
,
VARTYPE
vt
)
{
HRESULT
res
=
S_OK
;
VARIANTARG
varg
;
VariantInit32
(
&
varg
);
TRACE
(
ole
,
"(%p, %p, %ld, %u, %u),stub
\n
"
,
pvargDest
,
pvargSrc
,
lcid
,
wFlags
,
vt
);
/* validate our source argument.
*/
res
=
ValidateVariantType
(
pvargSrc
->
vt
);
/* validate the vartype.
*/
if
(
res
==
S_OK
)
{
res
=
ValidateVt
(
vt
);
}
/* if we are doing an in-place conversion make a copy of the source.
*/
if
(
res
==
S_OK
&&
pvargDest
==
pvargSrc
)
{
res
=
VariantCopy32
(
&
varg
,
pvargSrc
);
pvargSrc
=
&
varg
;
}
if
(
res
==
S_OK
)
{
/* free up the destination variant.
*/
res
=
VariantClear32
(
pvargDest
);
}
if
(
res
==
S_OK
)
{
if
(
pvargSrc
->
vt
&
VT_BYREF
)
{
/* Convert the source variant to a "byvalue" variant.
*/
VARIANTARG
Variant
;
VariantInit32
(
&
Variant
);
res
=
VariantCopyInd32
(
&
Variant
,
pvargSrc
);
if
(
res
==
S_OK
)
{
res
=
Coerce
(
pvargDest
,
lcid
,
wFlags
,
&
Variant
,
vt
);
/* this should not fail.
*/
VariantClear32
(
&
Variant
);
}
}
else
{
/* Use the current "byvalue" source variant.
*/
res
=
Coerce
(
pvargDest
,
lcid
,
wFlags
,
pvargSrc
,
vt
);
}
}
/* this should not fail.
*/
VariantClear32
(
&
varg
);
return
res
;
}
/******************************************************************************
* VarUI1FromI232 [OLEAUT32.130]
*/
HRESULT
VarUI1FromI232
(
short
sIn
,
BYTE
*
pbOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
sIn
,
pbOut
);
/* Check range of value.
*/
if
(
sIn
<
UI1_MIN
||
sIn
>
UI1_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pbOut
=
(
BYTE
)
sIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI1FromI432 [OLEAUT32.131]
*/
HRESULT
VarUI1FromI432
(
LONG
lIn
,
BYTE
*
pbOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
lIn
,
pbOut
);
/* Check range of value.
*/
if
(
lIn
<
UI1_MIN
||
lIn
>
UI1_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pbOut
=
(
BYTE
)
lIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI1FromR432 [OLEAUT32.132]
*/
HRESULT
VarUI1FromR432
(
FLOAT
fltIn
,
BYTE
*
pbOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
fltIn
,
pbOut
);
/* Check range of value.
*/
fltIn
=
round
(
fltIn
);
if
(
fltIn
<
UI1_MIN
||
fltIn
>
UI1_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pbOut
=
(
BYTE
)
fltIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI1FromR832 [OLEAUT32.133]
*/
HRESULT
VarUI1FromR832
(
double
dblIn
,
BYTE
*
pbOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dblIn
,
pbOut
);
/* Check range of value.
*/
dblIn
=
round
(
dblIn
);
if
(
dblIn
<
UI1_MIN
||
dblIn
>
UI1_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pbOut
=
(
BYTE
)
dblIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI1FromDate32 [OLEAUT32.135]
*/
HRESULT
VarUI1FromDate32
(
DATE
dateIn
,
BYTE
*
pbOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dateIn
,
pbOut
);
/* Check range of value.
*/
dateIn
=
round
(
dateIn
);
if
(
dateIn
<
UI1_MIN
||
dateIn
>
UI1_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pbOut
=
(
BYTE
)
dateIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI1FromBool32 [OLEAUT32.138]
*/
HRESULT
VarUI1FromBool32
(
VARIANT_BOOL
boolIn
,
BYTE
*
pbOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
boolIn
,
pbOut
);
*
pbOut
=
(
BYTE
)
boolIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI1FromI132 [OLEAUT32.237]
*/
HRESULT
VarUI1FromI132
(
CHAR
cIn
,
BYTE
*
pbOut
)
{
TRACE
(
ole
,
"( %c, %p ), stub
\n
"
,
cIn
,
pbOut
);
*
pbOut
=
cIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI1FromUI232 [OLEAUT32.238]
*/
HRESULT
VarUI1FromUI232
(
USHORT
uiIn
,
BYTE
*
pbOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
pbOut
);
/* Check range of value.
*/
if
(
uiIn
>
UI1_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pbOut
=
(
BYTE
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI1FromUI432 [OLEAUT32.239]
*/
HRESULT
VarUI1FromUI432
(
ULONG
ulIn
,
BYTE
*
pbOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
ulIn
,
pbOut
);
/* Check range of value.
*/
if
(
ulIn
>
UI1_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pbOut
=
(
BYTE
)
ulIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI1FromStr32 [OLEAUT32.54]
*/
HRESULT
VarUI1FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
BYTE
*
pbOut
)
{
double
dValue
=
0
.
0
;
LPSTR
pNewString
=
NULL
;
TRACE
(
ole
,
"( %p, 0x%08lx, 0x%08lx, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
pbOut
);
/* Check if we have a valid argument
*/
pNewString
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
strIn
);
RemoveCharacterFromString
(
pNewString
,
","
);
if
(
IsValidRealString
(
pNewString
)
==
FALSE
)
{
return
DISP_E_TYPEMISMATCH
;
}
/* Convert the valid string to a floating point number.
*/
dValue
=
atof
(
pNewString
);
/* We don't need the string anymore so free it.
*/
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
/* Check range of value.
*/
dValue
=
round
(
dValue
);
if
(
dValue
<
UI1_MIN
||
dValue
>
UI1_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pbOut
=
(
BYTE
)
dValue
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromUI132 [OLEAUT32.48]
*/
HRESULT
VarI2FromUI132
(
BYTE
bIn
,
short
*
psOut
)
{
TRACE
(
ole
,
"( 0x%08x, %p ), stub
\n
"
,
bIn
,
psOut
);
*
psOut
=
(
short
)
bIn
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromI432 [OLEAUT32.49]
*/
HRESULT
VarI2FromI432
(
LONG
lIn
,
short
*
psOut
)
{
TRACE
(
ole
,
"( %lx, %p ), stub
\n
"
,
lIn
,
psOut
);
/* Check range of value.
*/
if
(
lIn
<
I2_MIN
||
lIn
>
I2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
psOut
=
(
short
)
lIn
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromR432 [OLEAUT32.50]
*/
HRESULT
VarI2FromR432
(
FLOAT
fltIn
,
short
*
psOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
fltIn
,
psOut
);
/* Check range of value.
*/
fltIn
=
round
(
fltIn
);
if
(
fltIn
<
I2_MIN
||
fltIn
>
I2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
psOut
=
(
short
)
fltIn
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromR832 [OLEAUT32.51]
*/
HRESULT
VarI2FromR832
(
double
dblIn
,
short
*
psOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dblIn
,
psOut
);
/* Check range of value.
*/
dblIn
=
round
(
dblIn
);
if
(
dblIn
<
I2_MIN
||
dblIn
>
I2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
psOut
=
(
short
)
dblIn
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromDate32 [OLEAUT32.53]
*/
HRESULT
VarI2FromDate32
(
DATE
dateIn
,
short
*
psOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dateIn
,
psOut
);
/* Check range of value.
*/
dateIn
=
round
(
dateIn
);
if
(
dateIn
<
I2_MIN
||
dateIn
>
I2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
psOut
=
(
short
)
dateIn
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromBool32 [OLEAUT32.56]
*/
HRESULT
VarI2FromBool32
(
VARIANT_BOOL
boolIn
,
short
*
psOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
boolIn
,
psOut
);
*
psOut
=
(
short
)
boolIn
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromI132 [OLEAUT32.48]
*/
HRESULT
VarI2FromI132
(
CHAR
cIn
,
short
*
psOut
)
{
TRACE
(
ole
,
"( %c, %p ), stub
\n
"
,
cIn
,
psOut
);
*
psOut
=
(
short
)
cIn
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromUI232 [OLEAUT32.206]
*/
HRESULT
VarI2FromUI232
(
USHORT
uiIn
,
short
*
psOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
psOut
);
/* Check range of value.
*/
if
(
uiIn
>
I2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
psOut
=
(
short
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromUI432 [OLEAUT32.49]
*/
HRESULT
VarI2FromUI432
(
ULONG
ulIn
,
short
*
psOut
)
{
TRACE
(
ole
,
"( %lx, %p ), stub
\n
"
,
ulIn
,
psOut
);
/* Check range of value.
*/
if
(
ulIn
<
I2_MIN
||
ulIn
>
I2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
psOut
=
(
short
)
ulIn
;
return
S_OK
;
}
/******************************************************************************
* VarI2FromStr32 [OLEAUT32.54]
*/
HRESULT
VarI2FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
short
*
psOut
)
{
double
dValue
=
0
.
0
;
LPSTR
pNewString
=
NULL
;
TRACE
(
ole
,
"( %p, 0x%08lx, 0x%08lx, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
psOut
);
/* Check if we have a valid argument
*/
pNewString
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
strIn
);
RemoveCharacterFromString
(
pNewString
,
","
);
if
(
IsValidRealString
(
pNewString
)
==
FALSE
)
{
return
DISP_E_TYPEMISMATCH
;
}
/* Convert the valid string to a floating point number.
*/
dValue
=
atof
(
pNewString
);
/* We don't need the string anymore so free it.
*/
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
/* Check range of value.
*/
dValue
=
round
(
dValue
);
if
(
dValue
<
I2_MIN
||
dValue
>
I2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
psOut
=
(
short
)
dValue
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromUI132 [OLEAUT32.58]
*/
HRESULT
VarI4FromUI132
(
BYTE
bIn
,
LONG
*
plOut
)
{
TRACE
(
ole
,
"( %X, %p ), stub
\n
"
,
bIn
,
plOut
);
*
plOut
=
(
LONG
)
bIn
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromR432 [OLEAUT32.60]
*/
HRESULT
VarI4FromR432
(
FLOAT
fltIn
,
LONG
*
plOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
fltIn
,
plOut
);
/* Check range of value.
*/
fltIn
=
round
(
fltIn
);
if
(
fltIn
<
I4_MIN
||
fltIn
>
I4_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
plOut
=
(
LONG
)
fltIn
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromR832 [OLEAUT32.61]
*/
HRESULT
VarI4FromR832
(
double
dblIn
,
LONG
*
plOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dblIn
,
plOut
);
/* Check range of value.
*/
dblIn
=
round
(
dblIn
);
if
(
dblIn
<
I4_MIN
||
dblIn
>
I4_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
plOut
=
(
LONG
)
dblIn
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromDate32 [OLEAUT32.63]
*/
HRESULT
VarI4FromDate32
(
DATE
dateIn
,
LONG
*
plOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dateIn
,
plOut
);
/* Check range of value.
*/
dateIn
=
round
(
dateIn
);
if
(
dateIn
<
I4_MIN
||
dateIn
>
I4_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
plOut
=
(
LONG
)
dateIn
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromBool32 [OLEAUT32.66]
*/
HRESULT
VarI4FromBool32
(
VARIANT_BOOL
boolIn
,
LONG
*
plOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
boolIn
,
plOut
);
*
plOut
=
(
LONG
)
boolIn
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromI132 [OLEAUT32.209]
*/
HRESULT
VarI4FromI132
(
CHAR
cIn
,
LONG
*
plOut
)
{
TRACE
(
ole
,
"( %c, %p ), stub
\n
"
,
cIn
,
plOut
);
*
plOut
=
(
LONG
)
cIn
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromUI232 [OLEAUT32.210]
*/
HRESULT
VarI4FromUI232
(
USHORT
uiIn
,
LONG
*
plOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
plOut
);
*
plOut
=
(
LONG
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromUI432 [OLEAUT32.211]
*/
HRESULT
VarI4FromUI432
(
ULONG
ulIn
,
LONG
*
plOut
)
{
TRACE
(
ole
,
"( %lx, %p ), stub
\n
"
,
ulIn
,
plOut
);
/* Check range of value.
*/
if
(
ulIn
<
I4_MIN
||
ulIn
>
I4_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
plOut
=
(
LONG
)
ulIn
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromI232 [OLEAUT32.59]
*/
HRESULT
VarI4FromI232
(
short
sIn
,
LONG
*
plOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
sIn
,
plOut
);
*
plOut
=
(
LONG
)
sIn
;
return
S_OK
;
}
/******************************************************************************
* VarI4FromStr32 [OLEAUT32.64]
*/
HRESULT
VarI4FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
LONG
*
plOut
)
{
double
dValue
=
0
.
0
;
LPSTR
pNewString
=
NULL
;
TRACE
(
ole
,
"( %p, 0x%08lx, 0x%08lx, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
plOut
);
/* Check if we have a valid argument
*/
pNewString
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
strIn
);
RemoveCharacterFromString
(
pNewString
,
","
);
if
(
IsValidRealString
(
pNewString
)
==
FALSE
)
{
return
DISP_E_TYPEMISMATCH
;
}
/* Convert the valid string to a floating point number.
*/
dValue
=
atof
(
pNewString
);
/* We don't need the string anymore so free it.
*/
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
/* Check range of value.
*/
dValue
=
round
(
dValue
);
if
(
dValue
<
I4_MIN
||
dValue
>
I4_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
plOut
=
(
LONG
)
dValue
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromUI132 [OLEAUT32.68]
*/
HRESULT
VarR4FromUI132
(
BYTE
bIn
,
FLOAT
*
pfltOut
)
{
TRACE
(
ole
,
"( %X, %p ), stub
\n
"
,
bIn
,
pfltOut
);
*
pfltOut
=
(
FLOAT
)
bIn
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromI232 [OLEAUT32.69]
*/
HRESULT
VarR4FromI232
(
short
sIn
,
FLOAT
*
pfltOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
sIn
,
pfltOut
);
*
pfltOut
=
(
FLOAT
)
sIn
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromI432 [OLEAUT32.70]
*/
HRESULT
VarR4FromI432
(
LONG
lIn
,
FLOAT
*
pfltOut
)
{
TRACE
(
ole
,
"( %lx, %p ), stub
\n
"
,
lIn
,
pfltOut
);
*
pfltOut
=
(
FLOAT
)
lIn
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromR832 [OLEAUT32.71]
*/
HRESULT
VarR4FromR832
(
double
dblIn
,
FLOAT
*
pfltOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dblIn
,
pfltOut
);
/* Check range of value.
*/
if
(
dblIn
<
-
(
FLT_MAX
)
||
dblIn
>
FLT_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pfltOut
=
(
FLOAT
)
dblIn
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromDate32 [OLEAUT32.73]
*/
HRESULT
VarR4FromDate32
(
DATE
dateIn
,
FLOAT
*
pfltOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dateIn
,
pfltOut
);
/* Check range of value.
*/
if
(
dateIn
<
-
(
FLT_MAX
)
||
dateIn
>
FLT_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pfltOut
=
(
FLOAT
)
dateIn
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromBool32 [OLEAUT32.76]
*/
HRESULT
VarR4FromBool32
(
VARIANT_BOOL
boolIn
,
FLOAT
*
pfltOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
boolIn
,
pfltOut
);
*
pfltOut
=
(
FLOAT
)
boolIn
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromI132 [OLEAUT32.213]
*/
HRESULT
VarR4FromI132
(
CHAR
cIn
,
FLOAT
*
pfltOut
)
{
TRACE
(
ole
,
"( %c, %p ), stub
\n
"
,
cIn
,
pfltOut
);
*
pfltOut
=
(
FLOAT
)
cIn
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromUI232 [OLEAUT32.214]
*/
HRESULT
VarR4FromUI232
(
USHORT
uiIn
,
FLOAT
*
pfltOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
pfltOut
);
*
pfltOut
=
(
FLOAT
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromUI432 [OLEAUT32.215]
*/
HRESULT
VarR4FromUI432
(
ULONG
ulIn
,
FLOAT
*
pfltOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
ulIn
,
pfltOut
);
*
pfltOut
=
(
FLOAT
)
ulIn
;
return
S_OK
;
}
/******************************************************************************
* VarR4FromStr32 [OLEAUT32.74]
*/
HRESULT
VarR4FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
FLOAT
*
pfltOut
)
{
double
dValue
=
0
.
0
;
LPSTR
pNewString
=
NULL
;
TRACE
(
ole
,
"( %p, %ld, %ld, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
pfltOut
);
/* Check if we have a valid argument
*/
pNewString
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
strIn
);
RemoveCharacterFromString
(
pNewString
,
","
);
if
(
IsValidRealString
(
pNewString
)
==
FALSE
)
{
return
DISP_E_TYPEMISMATCH
;
}
/* Convert the valid string to a floating point number.
*/
dValue
=
atof
(
pNewString
);
/* We don't need the string anymore so free it.
*/
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
/* Check range of value.
*/
if
(
dValue
<
-
(
FLT_MAX
)
||
dValue
>
FLT_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pfltOut
=
(
FLOAT
)
dValue
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromUI132 [OLEAUT32.68]
*/
HRESULT
VarR8FromUI132
(
BYTE
bIn
,
double
*
pdblOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
bIn
,
pdblOut
);
*
pdblOut
=
(
double
)
bIn
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromI232 [OLEAUT32.69]
*/
HRESULT
VarR8FromI232
(
short
sIn
,
double
*
pdblOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
sIn
,
pdblOut
);
*
pdblOut
=
(
double
)
sIn
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromI432 [OLEAUT32.70]
*/
HRESULT
VarR8FromI432
(
LONG
lIn
,
double
*
pdblOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
lIn
,
pdblOut
);
*
pdblOut
=
(
double
)
lIn
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromR432 [OLEAUT32.81]
*/
HRESULT
VarR8FromR432
(
FLOAT
fltIn
,
double
*
pdblOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
fltIn
,
pdblOut
);
*
pdblOut
=
(
double
)
fltIn
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromDate32 [OLEAUT32.83]
*/
HRESULT
VarR8FromDate32
(
DATE
dateIn
,
double
*
pdblOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dateIn
,
pdblOut
);
*
pdblOut
=
(
double
)
dateIn
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromBool32 [OLEAUT32.86]
*/
HRESULT
VarR8FromBool32
(
VARIANT_BOOL
boolIn
,
double
*
pdblOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
boolIn
,
pdblOut
);
*
pdblOut
=
(
double
)
boolIn
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromI132 [OLEAUT32.217]
*/
HRESULT
VarR8FromI132
(
CHAR
cIn
,
double
*
pdblOut
)
{
TRACE
(
ole
,
"( %c, %p ), stub
\n
"
,
cIn
,
pdblOut
);
*
pdblOut
=
(
double
)
cIn
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromUI232 [OLEAUT32.218]
*/
HRESULT
VarR8FromUI232
(
USHORT
uiIn
,
double
*
pdblOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
pdblOut
);
*
pdblOut
=
(
double
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromUI432 [OLEAUT32.219]
*/
HRESULT
VarR8FromUI432
(
ULONG
ulIn
,
double
*
pdblOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
ulIn
,
pdblOut
);
*
pdblOut
=
(
double
)
ulIn
;
return
S_OK
;
}
/******************************************************************************
* VarR8FromStr32 [OLEAUT32.84]
*/
HRESULT
VarR8FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
double
*
pdblOut
)
{
double
dValue
=
0
.
0
;
LPSTR
pNewString
=
NULL
;
TRACE
(
ole
,
"( %p, %ld, %ld, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
pdblOut
);
/* Check if we have a valid argument
*/
pNewString
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
strIn
);
RemoveCharacterFromString
(
pNewString
,
","
);
if
(
IsValidRealString
(
pNewString
)
==
FALSE
)
{
return
DISP_E_TYPEMISMATCH
;
}
/* Convert the valid string to a floating point number.
*/
dValue
=
atof
(
pNewString
);
/* We don't need the string anymore so free it.
*/
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
*
pdblOut
=
dValue
;
return
S_OK
;
}
/******************************************************************************
* VarDateFromUI132 [OLEAUT32.]
*/
HRESULT
VarDateFromUI132
(
BYTE
bIn
,
DATE
*
pdateOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
bIn
,
pdateOut
);
*
pdateOut
=
(
DATE
)
bIn
;
return
S_OK
;
}
/******************************************************************************
* VarDateFromI232 [OLEAUT32.222]
*/
HRESULT
VarDateFromI232
(
short
sIn
,
DATE
*
pdateOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
sIn
,
pdateOut
);
*
pdateOut
=
(
DATE
)
sIn
;
return
S_OK
;
}
/******************************************************************************
* VarDateFromI432 [OLEAUT32.90]
*/
HRESULT
VarDateFromI432
(
LONG
lIn
,
DATE
*
pdateOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
lIn
,
pdateOut
);
if
(
lIn
<
DATE_MIN
||
lIn
>
DATE_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pdateOut
=
(
DATE
)
lIn
;
return
S_OK
;
}
/******************************************************************************
* VarDateFromR432 [OLEAUT32.91]
*/
HRESULT
VarDateFromR432
(
FLOAT
fltIn
,
DATE
*
pdateOut
)
{
unsigned
long
test
=
0
;
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
fltIn
,
pdateOut
);
test
=
(
unsigned
long
)
fltIn
;
if
(
test
<
DATE_MIN
||
test
>
DATE_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pdateOut
=
(
DATE
)
fltIn
;
return
S_OK
;
}
/******************************************************************************
* VarDateFromR832 [OLEAUT32.92]
*/
HRESULT
VarDateFromR832
(
double
dblIn
,
DATE
*
pdateOut
)
{
unsigned
long
test
=
0
;
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dblIn
,
pdateOut
);
test
=
(
unsigned
long
)
dblIn
;
if
(
test
<
DATE_MIN
||
test
>
DATE_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pdateOut
=
(
DATE
)
dblIn
;
return
S_OK
;
}
/******************************************************************************
* VarDateFromStr32 [OLEAUT32.94]
* The string representing the date is composed of two parts, a date and time.
*
* The format of the time is has follows:
* hh[:mm][:ss][AM|PM]
* Whitespace can be inserted anywhere between these tokens. A whitespace consists
* of space and/or tab characters, which are ignored.
*
* The formats for the date part are has follows:
* mm/[dd/][yy]yy
* [dd/]mm/[yy]yy
* [yy]yy/mm/dd
* January dd[,] [yy]yy
* dd January [yy]yy
* [yy]yy January dd
* Whitespace can be inserted anywhere between these tokens.
*
* The formats for the date and time string are has follows.
* date[whitespace][time]
* [time][whitespace]date
*
* These are the only characters allowed in a string representing a date and time:
* [A-Z] [a-z] [0-9] ':' '-' '/' ',' ' ' '\t'
*/
HRESULT
VarDateFromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
DATE
*
pdateOut
)
{
HRESULT
ret
=
S_OK
;
FIXME
(
ole
,
"( %p, %lx, %lx, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
pdateOut
);
return
ret
;
}
/******************************************************************************
* VarDateFromI132 [OLEAUT32.221]
*/
HRESULT
VarDateFromI132
(
CHAR
cIn
,
DATE
*
pdateOut
)
{
TRACE
(
ole
,
"( %c, %p ), stub
\n
"
,
cIn
,
pdateOut
);
*
pdateOut
=
(
DATE
)
cIn
;
return
S_OK
;
}
/******************************************************************************
* VarDateFromUI232 [OLEAUT32.222]
*/
HRESULT
VarDateFromUI232
(
USHORT
uiIn
,
DATE
*
pdateOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
pdateOut
);
if
(
uiIn
>
DATE_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pdateOut
=
(
DATE
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarDateFromUI432 [OLEAUT32.223]
*/
HRESULT
VarDateFromUI432
(
ULONG
ulIn
,
DATE
*
pdateOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
ulIn
,
pdateOut
);
if
(
ulIn
<
DATE_MIN
||
ulIn
>
DATE_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pdateOut
=
(
DATE
)
ulIn
;
return
S_OK
;
}
/******************************************************************************
* VarDateFromBool32 [OLEAUT32.96]
*/
HRESULT
VarDateFromBool32
(
VARIANT_BOOL
boolIn
,
DATE
*
pdateOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
boolIn
,
pdateOut
);
*
pdateOut
=
(
DATE
)
boolIn
;
return
S_OK
;
}
/******************************************************************************
* VarBstrFromUI132 [OLEAUT32.108]
*/
HRESULT
VarBstrFromUI132
(
BYTE
bVal
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
TRACE
(
ole
,
"( %d, %ld, %ld, %p ), stub
\n
"
,
bVal
,
lcid
,
dwFlags
,
pbstrOut
);
sprintf
(
pBuffer
,
"%d"
,
bVal
);
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
return
S_OK
;
}
/******************************************************************************
* VarBstrFromI232 [OLEAUT32.109]
*/
HRESULT
VarBstrFromI232
(
short
iVal
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
TRACE
(
ole
,
"( %d, %ld, %ld, %p ), stub
\n
"
,
iVal
,
lcid
,
dwFlags
,
pbstrOut
);
sprintf
(
pBuffer
,
"%d"
,
iVal
);
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
return
S_OK
;
}
/******************************************************************************
* VarBstrFromI432 [OLEAUT32.110]
*/
HRESULT
VarBstrFromI432
(
LONG
lIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
TRACE
(
ole
,
"( %ld, %ld, %ld, %p ), stub
\n
"
,
lIn
,
lcid
,
dwFlags
,
pbstrOut
);
sprintf
(
pBuffer
,
"%ld"
,
lIn
);
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
return
S_OK
;
}
/******************************************************************************
* VarBstrFromR432 [OLEAUT32.111]
*/
HRESULT
VarBstrFromR432
(
FLOAT
fltIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
TRACE
(
ole
,
"( %f, %ld, %ld, %p ), stub
\n
"
,
fltIn
,
lcid
,
dwFlags
,
pbstrOut
);
sprintf
(
pBuffer
,
"%.7g"
,
fltIn
);
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
return
S_OK
;
}
/******************************************************************************
* VarBstrFromR832 [OLEAUT32.112]
*/
HRESULT
VarBstrFromR832
(
double
dblIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
TRACE
(
ole
,
"( %f, %ld, %ld, %p ), stub
\n
"
,
dblIn
,
lcid
,
dwFlags
,
pbstrOut
);
sprintf
(
pBuffer
,
"%.15g"
,
dblIn
);
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
return
S_OK
;
}
/******************************************************************************
* VarBstrFromDate32 [OLEAUT32.114]
*
* The date is implemented using an 8 byte floating-point number.
* Days are represented by whole numbers increments starting with 0.00 has
* being December 30 1899, midnight.
* The hours are expressed as the fractional part of the number.
* December 30 1899 at midnight = 0.00
* January 1 1900 at midnight = 2.00
* January 4 1900 at 6 AM = 5.25
* January 4 1900 at noon = 5.50
* December 29 1899 at midnight = -1.00
* December 18 1899 at midnight = -12.00
* December 18 1899 at 6AM = -12.25
* December 18 1899 at 6PM = -12.75
* December 19 1899 at midnight = -11.00
* The tm structure is as follows:
* struct tm {
* int tm_sec; seconds after the minute - [0,59]
* int tm_min; minutes after the hour - [0,59]
* int tm_hour; hours since midnight - [0,23]
* int tm_mday; day of the month - [1,31]
* int tm_mon; months since January - [0,11]
* int tm_year; years since 1900
* int tm_wday; days since Sunday - [0,6]
* int tm_yday; days since January 1 - [0,365]
* int tm_isdst; daylight savings time flag
* };
*/
HRESULT
VarBstrFromDate32
(
DATE
dateIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
/* If the date is not after the 1900 return an error because
* the tm structure does not allow such dates.
*/
if
(
dateIn
>=
1
.
0
)
{
double
decimalPart
=
0
.
0
;
double
wholePart
=
0
.
0
;
struct
tm
TM
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
wholePart
=
(
double
)
(
long
)
dateIn
;
decimalPart
=
fmod
(
dateIn
,
wholePart
);
if
(
!
(
lcid
&
VAR_TIMEVALUEONLY
)
)
{
int
nDay
=
0
;
int
leapYear
=
0
;
/* find in what year the day in the "wholePart" falls into.
*/
TM
.
tm_year
=
(
int
)
(
wholePart
/
365
.
25
);
/* determine if this is a leap year.
*/
if
(
(
TM
.
tm_year
%
4
)
==
0
)
leapYear
=
1
;
/* find what day of that year does the "wholePart" corresponds to.
* the day is [1-366]
*/
nDay
=
(
int
)
(
wholePart
-
(
TM
.
tm_year
*
365
.
25
)
);
TM
.
tm_yday
=
nDay
-
1
;
/* find which mount this day corresponds to.
*/
if
(
nDay
<=
31
)
{
TM
.
tm_mday
=
nDay
;
TM
.
tm_mon
=
0
;
}
else
if
(
nDay
<=
(
59
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
31
;
TM
.
tm_mon
=
1
;
}
else
if
(
nDay
<=
(
90
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
59
+
leapYear
);
TM
.
tm_mon
=
2
;
}
else
if
(
nDay
<=
(
120
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
90
+
leapYear
);
TM
.
tm_mon
=
3
;
}
else
if
(
nDay
<=
(
151
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
120
+
leapYear
);
TM
.
tm_mon
=
4
;
}
else
if
(
nDay
<=
(
181
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
151
+
leapYear
);
TM
.
tm_mon
=
5
;
}
else
if
(
nDay
<=
(
212
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
181
+
leapYear
);
TM
.
tm_mon
=
6
;
}
else
if
(
nDay
<=
(
243
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
212
+
leapYear
);
TM
.
tm_mon
=
7
;
}
else
if
(
nDay
<=
(
273
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
243
+
leapYear
);
TM
.
tm_mon
=
8
;
}
else
if
(
nDay
<=
(
304
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
273
+
leapYear
);
TM
.
tm_mon
=
9
;
}
else
if
(
nDay
<=
(
334
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
304
+
leapYear
);
TM
.
tm_mon
=
10
;
}
else
if
(
nDay
<=
(
365
+
leapYear
)
)
{
TM
.
tm_mday
=
nDay
-
(
334
+
leapYear
);
TM
.
tm_mon
=
11
;
}
}
if
(
!
(
lcid
&
VAR_DATEVALUEONLY
)
)
{
/* find the number of seconds in this day.
* fractional part times, hours, minutes, seconds.
*/
TM
.
tm_hour
=
(
int
)
(
decimalPart
*
24
);
TM
.
tm_min
=
(
int
)
(
(
(
decimalPart
*
24
)
-
TM
.
tm_hour
)
*
60
);
TM
.
tm_sec
=
(
int
)
(
(
(
decimalPart
*
24
*
60
)
-
(
TM
.
tm_hour
*
60
)
-
TM
.
tm_min
)
*
60
);
}
if
(
lcid
&
VAR_DATEVALUEONLY
)
strftime
(
pBuffer
,
BUFFER_MAX
,
"%x"
,
&
TM
);
else
if
(
lcid
&
VAR_TIMEVALUEONLY
)
strftime
(
pBuffer
,
BUFFER_MAX
,
"%X"
,
&
TM
);
else
strftime
(
pBuffer
,
100
,
"%x %X"
,
&
TM
);
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
}
else
{
FIXME
(
ole
,
"( %f, %ld, %ld, %p ), stub
\n
"
,
dateIn
,
lcid
,
dwFlags
,
pbstrOut
);
return
E_INVALIDARG
;
}
return
S_OK
;
}
/******************************************************************************
* VarBstrFromBool32 [OLEAUT32.116]
*/
HRESULT
VarBstrFromBool32
(
VARIANT_BOOL
boolIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
TRACE
(
ole
,
"( %d, %ld, %ld, %p ), stub
\n
"
,
boolIn
,
lcid
,
dwFlags
,
pbstrOut
);
if
(
boolIn
==
VARIANT_FALSE
)
{
sprintf
(
pBuffer
,
"False"
);
}
else
{
sprintf
(
pBuffer
,
"True"
);
}
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
return
S_OK
;
}
/******************************************************************************
* VarBstrFromI132 [OLEAUT32.229]
*/
HRESULT
VarBstrFromI132
(
CHAR
cIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
TRACE
(
ole
,
"( %c, %ld, %ld, %p ), stub
\n
"
,
cIn
,
lcid
,
dwFlags
,
pbstrOut
);
sprintf
(
pBuffer
,
"%d"
,
cIn
);
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
return
S_OK
;
}
/******************************************************************************
* VarBstrFromUI232 [OLEAUT32.230]
*/
HRESULT
VarBstrFromUI232
(
USHORT
uiIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
TRACE
(
ole
,
"( %d, %ld, %ld, %p ), stub
\n
"
,
uiIn
,
lcid
,
dwFlags
,
pbstrOut
);
sprintf
(
pBuffer
,
"%d"
,
uiIn
);
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
return
S_OK
;
}
/******************************************************************************
* VarBstrFromUI432 [OLEAUT32.231]
*/
HRESULT
VarBstrFromUI432
(
ULONG
ulIn
,
LCID
lcid
,
ULONG
dwFlags
,
BSTR32
*
pbstrOut
)
{
TRACE
(
ole
,
"( %ld, %ld, %ld, %p ), stub
\n
"
,
ulIn
,
lcid
,
dwFlags
,
pbstrOut
);
sprintf
(
pBuffer
,
"%ld"
,
ulIn
);
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
return
S_OK
;
}
/******************************************************************************
* VarBoolFromUI132 [OLEAUT32.118]
*/
HRESULT
VarBoolFromUI132
(
BYTE
bIn
,
VARIANT_BOOL
*
pboolOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
bIn
,
pboolOut
);
if
(
bIn
==
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
return
S_OK
;
}
/******************************************************************************
* VarBoolFromI232 [OLEAUT32.119]
*/
HRESULT
VarBoolFromI232
(
short
sIn
,
VARIANT_BOOL
*
pboolOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
sIn
,
pboolOut
);
if
(
sIn
==
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
return
S_OK
;
}
/******************************************************************************
* VarBoolFromI432 [OLEAUT32.120]
*/
HRESULT
VarBoolFromI432
(
LONG
lIn
,
VARIANT_BOOL
*
pboolOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
lIn
,
pboolOut
);
if
(
lIn
==
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
return
S_OK
;
}
/******************************************************************************
* VarBoolFromR432 [OLEAUT32.121]
*/
HRESULT
VarBoolFromR432
(
FLOAT
fltIn
,
VARIANT_BOOL
*
pboolOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
fltIn
,
pboolOut
);
if
(
fltIn
==
0
.
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
return
S_OK
;
}
/******************************************************************************
* VarBoolFromR832 [OLEAUT32.122]
*/
HRESULT
VarBoolFromR832
(
double
dblIn
,
VARIANT_BOOL
*
pboolOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dblIn
,
pboolOut
);
if
(
dblIn
==
0
.
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
return
S_OK
;
}
/******************************************************************************
* VarBoolFromDate32 [OLEAUT32.123]
*/
HRESULT
VarBoolFromDate32
(
DATE
dateIn
,
VARIANT_BOOL
*
pboolOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dateIn
,
pboolOut
);
if
(
dateIn
==
0
.
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
return
S_OK
;
}
/******************************************************************************
* VarBoolFromStr32 [OLEAUT32.125]
*/
HRESULT
VarBoolFromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
VARIANT_BOOL
*
pboolOut
)
{
HRESULT
ret
=
S_OK
;
char
*
pNewString
=
NULL
;
TRACE
(
ole
,
"( %p, %ld, %ld, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
pboolOut
);
pNewString
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
strIn
);
if
(
pNewString
==
NULL
||
strlen
(
pNewString
)
==
0
)
{
ret
=
DISP_E_TYPEMISMATCH
;
}
if
(
ret
==
S_OK
)
{
if
(
strncasecmp
(
pNewString
,
"True"
,
strlen
(
pNewString
)
)
==
0
)
{
*
pboolOut
=
VARIANT_TRUE
;
}
else
if
(
strncasecmp
(
pNewString
,
"False"
,
strlen
(
pNewString
)
)
==
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
/* Try converting the string to a floating point number.
*/
double
dValue
=
0
.
0
;
HRESULT
res
=
VarR8FromStr32
(
strIn
,
lcid
,
dwFlags
,
&
dValue
);
if
(
res
!=
S_OK
)
{
ret
=
DISP_E_TYPEMISMATCH
;
}
else
if
(
dValue
==
0
.
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
return
ret
;
}
/******************************************************************************
* VarBoolFromI132 [OLEAUT32.233]
*/
HRESULT
VarBoolFromI132
(
CHAR
cIn
,
VARIANT_BOOL
*
pboolOut
)
{
TRACE
(
ole
,
"( %c, %p ), stub
\n
"
,
cIn
,
pboolOut
);
if
(
cIn
==
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
return
S_OK
;
}
/******************************************************************************
* VarBoolFromUI232 [OLEAUT32.234]
*/
HRESULT
VarBoolFromUI232
(
USHORT
uiIn
,
VARIANT_BOOL
*
pboolOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
pboolOut
);
if
(
uiIn
==
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
return
S_OK
;
}
/******************************************************************************
* VarBoolFromUI432 [OLEAUT32.235]
*/
HRESULT
VarBoolFromUI432
(
ULONG
ulIn
,
VARIANT_BOOL
*
pboolOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
ulIn
,
pboolOut
);
if
(
ulIn
==
0
)
{
*
pboolOut
=
VARIANT_FALSE
;
}
else
{
*
pboolOut
=
VARIANT_TRUE
;
}
return
S_OK
;
}
/******************************************************************************
* VarI1FromUI132 [OLEAUT32.244]
*/
HRESULT
VarI1FromUI132
(
BYTE
bIn
,
CHAR
*
pcOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
bIn
,
pcOut
);
/* Check range of value.
*/
if
(
bIn
>
CHAR_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pcOut
=
(
CHAR
)
bIn
;
return
S_OK
;
}
/******************************************************************************
* VarI1FromI232 [OLEAUT32.245]
*/
HRESULT
VarI1FromI232
(
short
uiIn
,
CHAR
*
pcOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
pcOut
);
if
(
uiIn
>
CHAR_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pcOut
=
(
CHAR
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarI1FromI432 [OLEAUT32.246]
*/
HRESULT
VarI1FromI432
(
LONG
lIn
,
CHAR
*
pcOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
lIn
,
pcOut
);
if
(
lIn
<
CHAR_MIN
||
lIn
>
CHAR_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pcOut
=
(
CHAR
)
lIn
;
return
S_OK
;
}
/******************************************************************************
* VarI1FromR432 [OLEAUT32.247]
*/
HRESULT
VarI1FromR432
(
FLOAT
fltIn
,
CHAR
*
pcOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
fltIn
,
pcOut
);
fltIn
=
round
(
fltIn
);
if
(
fltIn
<
CHAR_MIN
||
fltIn
>
CHAR_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pcOut
=
(
CHAR
)
fltIn
;
return
S_OK
;
}
/******************************************************************************
* VarI1FromR832 [OLEAUT32.248]
*/
HRESULT
VarI1FromR832
(
double
dblIn
,
CHAR
*
pcOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dblIn
,
pcOut
);
dblIn
=
round
(
dblIn
);
if
(
dblIn
<
CHAR_MIN
||
dblIn
>
CHAR_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pcOut
=
(
CHAR
)
dblIn
;
return
S_OK
;
}
/******************************************************************************
* VarI1FromDate32 [OLEAUT32.249]
*/
HRESULT
VarI1FromDate32
(
DATE
dateIn
,
CHAR
*
pcOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dateIn
,
pcOut
);
dateIn
=
round
(
dateIn
);
if
(
dateIn
<
CHAR_MIN
||
dateIn
>
CHAR_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pcOut
=
(
CHAR
)
dateIn
;
return
S_OK
;
}
/******************************************************************************
* VarI1FromStr32 [OLEAUT32.251]
*/
HRESULT
VarI1FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
CHAR
*
pcOut
)
{
double
dValue
=
0
.
0
;
LPSTR
pNewString
=
NULL
;
TRACE
(
ole
,
"( %p, %ld, %ld, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
pcOut
);
/* Check if we have a valid argument
*/
pNewString
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
strIn
);
RemoveCharacterFromString
(
pNewString
,
","
);
if
(
IsValidRealString
(
pNewString
)
==
FALSE
)
{
return
DISP_E_TYPEMISMATCH
;
}
/* Convert the valid string to a floating point number.
*/
dValue
=
atof
(
pNewString
);
/* We don't need the string anymore so free it.
*/
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
/* Check range of value.
*/
dValue
=
round
(
dValue
);
if
(
dValue
<
CHAR_MIN
||
dValue
>
CHAR_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pcOut
=
(
CHAR
)
dValue
;
return
S_OK
;
}
/******************************************************************************
* VarI1FromBool32 [OLEAUT32.253]
*/
HRESULT
VarI1FromBool32
(
VARIANT_BOOL
boolIn
,
CHAR
*
pcOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
boolIn
,
pcOut
);
*
pcOut
=
(
CHAR
)
boolIn
;
return
S_OK
;
}
/******************************************************************************
* VarI1FromUI232 [OLEAUT32.254]
*/
HRESULT
VarI1FromUI232
(
USHORT
uiIn
,
CHAR
*
pcOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
pcOut
);
if
(
uiIn
>
CHAR_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pcOut
=
(
CHAR
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarI1FromUI432 [OLEAUT32.255]
*/
HRESULT
VarI1FromUI432
(
ULONG
ulIn
,
CHAR
*
pcOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
ulIn
,
pcOut
);
if
(
ulIn
>
CHAR_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pcOut
=
(
CHAR
)
ulIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromUI132 [OLEAUT32.257]
*/
HRESULT
VarUI2FromUI132
(
BYTE
bIn
,
USHORT
*
puiOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
bIn
,
puiOut
);
*
puiOut
=
(
USHORT
)
bIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromI232 [OLEAUT32.258]
*/
HRESULT
VarUI2FromI232
(
short
uiIn
,
USHORT
*
puiOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
puiOut
);
if
(
uiIn
<
UI2_MIN
)
{
return
DISP_E_OVERFLOW
;
}
*
puiOut
=
(
USHORT
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromI432 [OLEAUT32.259]
*/
HRESULT
VarUI2FromI432
(
LONG
lIn
,
USHORT
*
puiOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
lIn
,
puiOut
);
if
(
lIn
<
UI2_MIN
||
lIn
>
UI2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
puiOut
=
(
USHORT
)
lIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromR432 [OLEAUT32.260]
*/
HRESULT
VarUI2FromR432
(
FLOAT
fltIn
,
USHORT
*
puiOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
fltIn
,
puiOut
);
fltIn
=
round
(
fltIn
);
if
(
fltIn
<
UI2_MIN
||
fltIn
>
UI2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
puiOut
=
(
USHORT
)
fltIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromR832 [OLEAUT32.261]
*/
HRESULT
VarUI2FromR832
(
double
dblIn
,
USHORT
*
puiOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dblIn
,
puiOut
);
dblIn
=
round
(
dblIn
);
if
(
dblIn
<
UI2_MIN
||
dblIn
>
UI2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
puiOut
=
(
USHORT
)
dblIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromDate32 [OLEAUT32.262]
*/
HRESULT
VarUI2FromDate32
(
DATE
dateIn
,
USHORT
*
puiOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dateIn
,
puiOut
);
dateIn
=
round
(
dateIn
);
if
(
dateIn
<
UI2_MIN
||
dateIn
>
UI2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
puiOut
=
(
USHORT
)
dateIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromStr32 [OLEAUT32.264]
*/
HRESULT
VarUI2FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
USHORT
*
puiOut
)
{
double
dValue
=
0
.
0
;
LPSTR
pNewString
=
NULL
;
TRACE
(
ole
,
"( %p, %ld, %ld, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
puiOut
);
/* Check if we have a valid argument
*/
pNewString
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
strIn
);
RemoveCharacterFromString
(
pNewString
,
","
);
if
(
IsValidRealString
(
pNewString
)
==
FALSE
)
{
return
DISP_E_TYPEMISMATCH
;
}
/* Convert the valid string to a floating point number.
*/
dValue
=
atof
(
pNewString
);
/* We don't need the string anymore so free it.
*/
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
/* Check range of value.
*/
dValue
=
round
(
dValue
);
if
(
dValue
<
UI2_MIN
||
dValue
>
UI2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
puiOut
=
(
USHORT
)
dValue
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromBool32 [OLEAUT32.266]
*/
HRESULT
VarUI2FromBool32
(
VARIANT_BOOL
boolIn
,
USHORT
*
puiOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
boolIn
,
puiOut
);
*
puiOut
=
(
USHORT
)
boolIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromI132 [OLEAUT32.267]
*/
HRESULT
VarUI2FromI132
(
CHAR
cIn
,
USHORT
*
puiOut
)
{
TRACE
(
ole
,
"( %c, %p ), stub
\n
"
,
cIn
,
puiOut
);
*
puiOut
=
(
USHORT
)
cIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI2FromUI432 [OLEAUT32.268]
*/
HRESULT
VarUI2FromUI432
(
ULONG
ulIn
,
USHORT
*
puiOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
ulIn
,
puiOut
);
if
(
ulIn
<
UI2_MIN
||
ulIn
>
UI2_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
puiOut
=
(
USHORT
)
ulIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromStr32 [OLEAUT32.277]
*/
HRESULT
VarUI4FromStr32
(
OLECHAR32
*
strIn
,
LCID
lcid
,
ULONG
dwFlags
,
ULONG
*
pulOut
)
{
double
dValue
=
0
.
0
;
LPSTR
pNewString
=
NULL
;
TRACE
(
ole
,
"( %p, %ld, %ld, %p ), stub
\n
"
,
strIn
,
lcid
,
dwFlags
,
pulOut
);
/* Check if we have a valid argument
*/
pNewString
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
strIn
);
RemoveCharacterFromString
(
pNewString
,
","
);
if
(
IsValidRealString
(
pNewString
)
==
FALSE
)
{
return
DISP_E_TYPEMISMATCH
;
}
/* Convert the valid string to a floating point number.
*/
dValue
=
atof
(
pNewString
);
/* We don't need the string anymore so free it.
*/
HeapFree
(
GetProcessHeap
(),
0
,
pNewString
);
/* Check range of value.
*/
dValue
=
round
(
dValue
);
if
(
dValue
<
UI4_MIN
||
dValue
>
UI4_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pulOut
=
(
ULONG
)
dValue
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromUI132 [OLEAUT32.270]
*/
HRESULT
VarUI4FromUI132
(
BYTE
bIn
,
ULONG
*
pulOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
bIn
,
pulOut
);
*
pulOut
=
(
USHORT
)
bIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromI232 [OLEAUT32.271]
*/
HRESULT
VarUI4FromI232
(
short
uiIn
,
ULONG
*
pulOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
pulOut
);
if
(
uiIn
<
UI4_MIN
)
{
return
DISP_E_OVERFLOW
;
}
*
pulOut
=
(
ULONG
)
uiIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromI432 [OLEAUT32.272]
*/
HRESULT
VarUI4FromI432
(
LONG
lIn
,
ULONG
*
pulOut
)
{
TRACE
(
ole
,
"( %ld, %p ), stub
\n
"
,
lIn
,
pulOut
);
if
(
lIn
<
UI4_MIN
)
{
return
DISP_E_OVERFLOW
;
}
*
pulOut
=
(
ULONG
)
lIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromR432 [OLEAUT32.273]
*/
HRESULT
VarUI4FromR432
(
FLOAT
fltIn
,
ULONG
*
pulOut
)
{
fltIn
=
round
(
fltIn
);
if
(
fltIn
<
UI4_MIN
||
fltIn
>
UI4_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pulOut
=
(
ULONG
)
fltIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromR832 [OLEAUT32.274]
*/
HRESULT
VarUI4FromR832
(
double
dblIn
,
ULONG
*
pulOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dblIn
,
pulOut
);
dblIn
=
round
(
dblIn
);
if
(
dblIn
<
UI4_MIN
||
dblIn
>
UI4_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pulOut
=
(
ULONG
)
dblIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromDate32 [OLEAUT32.275]
*/
HRESULT
VarUI4FromDate32
(
DATE
dateIn
,
ULONG
*
pulOut
)
{
TRACE
(
ole
,
"( %f, %p ), stub
\n
"
,
dateIn
,
pulOut
);
dateIn
=
round
(
dateIn
);
if
(
dateIn
<
UI4_MIN
||
dateIn
>
UI4_MAX
)
{
return
DISP_E_OVERFLOW
;
}
*
pulOut
=
(
ULONG
)
dateIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromBool32 [OLEAUT32.279]
*/
HRESULT
VarUI4FromBool32
(
VARIANT_BOOL
boolIn
,
ULONG
*
pulOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
boolIn
,
pulOut
);
*
pulOut
=
(
ULONG
)
boolIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromI132 [OLEAUT32.280]
*/
HRESULT
VarUI4FromI132
(
CHAR
cIn
,
ULONG
*
pulOut
)
{
TRACE
(
ole
,
"( %c, %p ), stub
\n
"
,
cIn
,
pulOut
);
*
pulOut
=
(
ULONG
)
cIn
;
return
S_OK
;
}
/******************************************************************************
* VarUI4FromUI232 [OLEAUT32.281]
*/
HRESULT
VarUI4FromUI232
(
USHORT
uiIn
,
ULONG
*
pulOut
)
{
TRACE
(
ole
,
"( %d, %p ), stub
\n
"
,
uiIn
,
pulOut
);
*
pulOut
=
(
ULONG
)
uiIn
;
return
S_OK
;
}
relay32/oleaut32.spec
View file @
b00cbead
...
...
@@ -8,11 +8,11 @@ type win32
5 stdcall SysReAllocStringLen(ptr ptr long) SysReAllocStringLen32
6 stdcall SysFreeString(wstr) SysFreeString32
7 stdcall SysStringLen(wstr) SysStringLen32
8 st
ub VariantInit
9 st
ub VariantClear
10 st
ub VariantCopy
11 st
ub VariantCopyInd
12 st
ub VariantChangeType
8 st
dcall VariantInit(ptr) VariantInit32
9 st
dcall VariantClear(ptr) VariantClear32
10 st
dcall VariantCopy(ptr ptr) VariantCopy32
11 st
dcall VariantCopyInd(ptr ptr) VariantCopyInd32
12 st
dcall VariantChangeType(ptr ptr) VariantChangeType32
13 stub VariantTimeToDosDateTime
14 stub DosDateTimeToVariantTime
15 stub SafeArrayCreate
...
...
@@ -44,51 +44,51 @@ type win32
41 stub OACreateTypeLib2
46 stub VarParseNumFromStr
47 stub VarNumFromParseNum
48 st
ub VarI2FromUI1
49 st
ub VarI2FromI4
50 st
ub VarI2FromR4
51 st
ub VarI2FromR8
48 st
dcall VarI2FromUI1(long ptr) VarI2FromUI132
49 st
dcall VarI2FromI4(long ptr) VarI2FromI432
50 st
dcall VarI2FromR4(long ptr) VarI2FromR432
51 st
dcall VarI2FromR8(double ptr) VarI2FromR832
52 stub VarI2FromCy
53 st
ub VarI2FromDate
54 st
ub VarI2FromStr
53 st
dcall VarI2FromDate(long ptr) VarI2FromDate32
54 st
dcall VarI2FromStr(wstr long long ptr) VarI2FromStr32
55 stub VarI2FromDisp
56 st
ub VarI2FromBool
58 st
ub VarI4FromUI1
59 st
ub VarI4FromI
2
60 st
ub VarI4FromR4
61 st
ub VarI4FromR8
56 st
dcall VarI2FromBool(long ptr) VarI2FromBool32
58 st
dcall VarI4FromUI1(long ptr) VarI4FromUI132
59 st
dcall VarI4FromI2(long ptr) VarI4FromI23
2
60 st
dcall VarI4FromR4(long ptr) VarI4FromR432
61 st
dcall VarI4FromR8(double ptr) VarI4FromR832
62 stub VarI4FromCy
63 st
ub VarI4FromDate
64 st
ub VarI4FromStr
63 st
dcall VarI4FromDate(long ptr) VarI4FromDate32
64 st
dcall VarI4FromStr(wstr long long ptr) VarI4FromStr32
65 stub VarI4FromDisp
66 st
ub VarI4FromBool
68 st
ub VarR4FromUI1
69 st
ub VarR4FromI
2
70 st
ub VarR4FromI4
71 st
ub VarR4FromR8
66 st
dcall VarI4FromBool(long ptr) VarI4FromBool32
68 st
dcall VarR4FromUI1(long ptr) VarR4FromUI132
69 st
dcall VarR4FromI2(long ptr) VarR4FromI23
2
70 st
dcall VarR4FromI4(long ptr) VarR4FromI432
71 st
dcall VarR4FromR8(double ptr) VarR4FromR832
72 stub VarR4FromCy
73 st
ub VarR4FromDate
74 st
ub VarR4FromStr
73 st
dcall VarR4FromDate(long ptr) VarR4FromDate32
74 st
dcall VarR4FromStr(wstr long long ptr) VarR4FromStr32
75 stub VarR4FromDisp
76 st
ub VarR4FromBool
78 st
ub VarR8FromUI1
79 st
ub VarR8FromI
2
80 st
ub VarR8FromI4
81 st
ub VarR8FromR4
76 st
dcall VarR4FromBool(long ptr) VarR4FromBool32
78 st
dcall VarR8FromUI1(long ptr) VarR8FromUI132
79 st
dcall VarR8FromI2(long ptr) VarR8FromI23
2
80 st
dcall VarR8FromI4(long ptr) VarR8FromI432
81 st
dcall VarR8FromR4(long ptr) VarR8FromR432
82 stub VarR8FromCy
83 st
ub VarR8FromDate
84 st
ub VarR8FromStr
83 st
dcall VarR8FromDate(long ptr) VarR8FromDate32
84 st
dcall VarR8FromStr(wstr long long ptr) VarR8FromStr32
85 stub VarR8FromDisp
86 st
ub VarR8FromBool
88 st
ub VarDateFromUI1
89 st
ub VarDateFromI
2
90 st
ub VarDateFromI4
91 st
ub VarDateFromR4
92 st
ub VarDateFromR8
86 st
dcall VarR8FromBool(long ptr) VarR8FromBool32
88 st
dcall VarDateFromUI1(long ptr) VarDateFromUI132
89 st
dcall VarDateFromI2(long ptr) VarDateFromI23
2
90 st
dcall VarDateFromI4(long ptr) VarDateFromI432
91 st
dcall VarDateFromR4(long ptr) VarDateFromR432
92 st
dcall VarDateFromR8(double ptr) VarDateFromR832
93 stub VarDateFromCy
94 st
ub VarDateFromStr
94 st
dcall VarDateFromStr(wstr long long ptr) VarDateFromStr32
95 stub VarDateFromDisp
96 st
ub VarDateFromBool
96 st
dcall VarDateFromBool(long ptr) VarDateFromBool32
98 stub VarCyFromUI1
99 stub VarCyFromI2
100 stub VarCyFromI4
...
...
@@ -98,35 +98,35 @@ type win32
104 stub VarCyFromStr
105 stub VarCyFromDisp
106 stub VarCyFromBool
108 st
ub VarBstrFromUI1
109 st
ub VarBstrFromI
2
110 st
ub VarBstrFromI4
111 st
ub VarBstrFromR4
112 st
ub VarBstrFromR8
108 st
dcall VarBstrFromUI1(long long long ptr) VarBstrFromUI132
109 st
dcall VarBstrFromI2(long long long ptr) VarBstrFromI23
2
110 st
dcall VarBstrFromI4(long long long ptr) VarBstrFromI432
111 st
dcall VarBstrFromR4(long long long ptr) VarBstrFromR432
112 st
dcall VarBstrFromR8(double long long ptr) VarBstrFromR832
113 stub VarBstrFromCy
114 st
ub VarBstrFromDate
114 st
dcall VarBstrFromDate(long long long ptr) VarBstrFromDate32
115 stub VarBstrFromDisp
116 st
ub VarBstrFromBool
118 st
ub VarBoolFromUI1
119 st
ub VarBoolFromI
2
120 st
ub VarBoolFromI4
121 st
ub VarBoolFromR4
122 st
ub VarBoolFromR8
123 st
ub VarBoolFromDate
116 st
dcall VarBstrFromBool(long long long ptr) VarBstrFromBool32
118 st
dcall VarBoolFromUI1(long ptr) VarBoolFromUI132
119 st
dcall VarBoolFromI2(long ptr) VarBoolFromI23
2
120 st
dcall VarBoolFromI4(long ptr) VarBoolFromI432
121 st
dcall VarBoolFromR4(long ptr) VarBoolFromR432
122 st
dcall VarBoolFromR8(double ptr) VarBoolFromR832
123 st
dcall VarBoolFromDate(long ptr) VarBoolFromDate32
124 stub VarBoolFromCy
125 st
ub VarBoolFromStr
125 st
dcall VarBoolFromStr(wstr long long ptr) VarBoolFromStr32
126 stub VarBoolFromDisp
130 st
ub VarUI1FromI
2
131 st
ub VarUI1FromI4
132 st
ub VarUI1FromR4
133 st
ub VarUI1FromR8
130 st
dcall VarUI1FromI2(long ptr) VarUI1FromI23
2
131 st
dcall VarUI1FromI4(long ptr) VarUI1FromI432
132 st
dcall VarUI1FromR4(long ptr) VarUI1FromR432
133 st
dcall VarUI1FromR8(double ptr) VarUI1FromR832
134 stub VarUI1FromCy
135 st
ub VarUI1FromDate
136 st
ub VarUI1FromStr
135 st
dcall VarUI1FromDate(long ptr) VarUI1FromDate32
136 st
dcall VarUI1FromStr(wstr long long ptr) VarUI1FromStr32
137 stub VarUI1FromDisp
138 st
ub VarUI1FromBool
138 st
dcall VarUI1FromBool(long ptr) VarUI1FromBool32
146 stub DispCallFunc
147 st
ub VariantChangeTypeEx
147 st
dcall VariantChangeTypeEx(ptr ptr) VariantChangeTypeEx32
148 stub SafeArrayPtrOfIndex
149 stub SysStringByteLen
150 stub SysAllocStringByteLen
...
...
@@ -158,82 +158,82 @@ type win32
201 stub SetErrorInfo
202 stub CreateErrorInfo
205 stub VarI2FromI1
206 st
ub VarI2FromUI
2
207 st
ub VarI2FromUI4
206 st
dcall VarI2FromUI2(long ptr) VarI2FromUI23
2
207 st
dcall VarI2FromUI4(long ptr) VarI2FromUI432
208 stub VarI2FromDec
209 st
ub VarI4FromI1
210 st
ub VarI4FromUI
2
211 st
ub VarI4FromUI4
209 st
dcall VarI4FromI1(long ptr) VarI4FromI132
210 st
dcall VarI4FromUI2(long ptr) VarI4FromUI23
2
211 st
dcall VarI4FromUI4(long ptr) VarI4FromUI432
212 stub VarI4FromDec
213 st
ub VarR4FromI1
214 st
ub VarR4FromUI
2
215 st
ub VarR4FromUI4
213 st
dcall VarR4FromI1(long ptr) VarR4FromI132
214 st
dcall VarR4FromUI2(long ptr) VarR4FromUI23
2
215 st
dcall VarR4FromUI4(long ptr) VarR4FromUI432
216 stub VarR4FromDec
217 st
ub VarR8FromI1
218 st
ub VarR8FromUI
2
219 st
ub VarR8FromUI4
217 st
dcall VarR8FromI1(long ptr) VarR8FromI132
218 st
dcall VarR8FromUI2(long ptr) VarR8FromUI23
2
219 st
dcall VarR8FromUI4(long ptr) VarR8FromUI432
220 stub VarR8FromDec
221 st
ub VarDateFromI1
222 st
ub VarDateFromUI
2
223 st
ub VarDateFromUI4
221 st
dcall VarDateFromI1(long ptr) VarDateFromI132
222 st
dcall VarDateFromUI2(long ptr) VarDateFromUI23
2
223 st
dcall VarDateFromUI4(long ptr) VarDateFromUI432
224 stub VarDateFromDec
225 stub VarCyFromI1
226 stub VarCyFromUI2
227 stub VarCyFromUI4
228 stub VarCyFromDec
229 st
ub VarBstrFromI1
230 st
ub VarBstrFromUI
2
231 st
ub VarBstrFromUI4
229 st
dcall VarBstrFromI1(long long long ptr) VarBstrFromI132
230 st
dcall VarBstrFromUI2(long long long ptr) VarBstrFromUI23
2
231 st
dcall VarBstrFromUI4(long long long ptr) VarBstrFromUI432
232 stub VarBstrFromDec
233 st
ub VarBoolFromI1
234 st
ub VarBoolFromUI
2
235 st
ub VarBoolFromUI4
233 st
dcall VarBoolFromI1(long ptr) VarBoolFromI132
234 st
dcall VarBoolFromUI2(long ptr) VarBoolFromUI23
2
235 st
dcall VarBoolFromUI4(long ptr) VarBoolFromUI432
236 stub VarBoolFromDec
237 st
ub VarUI1FromI1
238 st
ub VarUI1FromUI
2
239 st
ub VarUI1FromUI4
237 st
dcall VarUI1FromI1(long ptr) VarUI1FromI132
238 st
dcall VarUI1FromUI2(long ptr) VarUI1FromUI23
2
239 st
dcall VarUI1FromUI4(long ptr) VarUI1FromUI432
240 stub VarUI1FromDec
241 stub VarDecFromI1
242 stub VarDecFromUI2
243 stub VarDecFromUI4
244 st
ub VarI1FromUI1
245 st
ub VarI1FromI
2
246 st
ub VarI1FromI4
247 st
ub VarI1FromR4
248 st
ub VarI1FromR8
249 st
ub VarI1FromDate
244 st
dcall VarI1FromUI1(long ptr) VarI1FromUI132
245 st
dcall VarI1FromI2(long ptr) VarI1FromI23
2
246 st
dcall VarI1FromI4(long ptr) VarI1FromI432
247 st
dcall VarI1FromR4(long ptr) VarI1FromR432
248 st
dcall VarI1FromR8(double ptr) VarI1FromR832
249 st
dcall VarI1FromDate(long ptr) VarI1FromDate32
250 stub VarI1FromCy
251 st
ub VarI1FromStr
251 st
dcall VarI1FromStr(wstr long long ptr) VarI1FromStr32
252 stub VarI1FromDisp
253 st
ub VarI1FromBool
254 st
ub VarI1FromUI
2
255 st
ub VarI1FromUI4
253 st
dcall VarI1FromBool(long ptr) VarI1FromBool32
254 st
dcall VarI1FromUI2(long ptr) VarI1FromUI23
2
255 st
dcall VarI1FromUI4(long ptr) VarI1FromUI432
256 stub VarI1FromDec
257 st
ub VarUI2FromUI1
258 st
ub VarUI2FromI
2
259 st
ub VarUI2FromI4
260 st
ub VarUI2FromR4
261 st
ub VarUI2FromR8
262 st
ub VarUI2FromDate
257 st
dcall VarUI2FromUI1(long ptr) VarUI2FromUI132
258 st
dcall VarUI2FromI2(long ptr) VarUI2FromI23
2
259 st
dcall VarUI2FromI4(long ptr) VarUI2FromI432
260 st
dcall VarUI2FromR4(long ptr) VarUI2FromR432
261 st
dcall VarUI2FromR8(double ptr) VarUI2FromR832
262 st
dcall VarUI2FromDate(long ptr) VarUI2FromDate32
263 stub VarUI2FromCy
264 st
ub VarUI2FromStr
264 st
dcall VarUI2FromStr(wstr long long ptr) VarUI2FromStr32
265 stub VarUI2FromDisp
266 st
ub VarUI2FromBool
267 st
ub VarUI2FromI1
268 st
ub VarUI2FromUI4
266 st
dcall VarUI2FromBool(long ptr) VarUI2FromBool32
267 st
dcall VarUI2FromI1(long ptr) VarUI2FromI132
268 st
dcall VarUI2FromUI4(long ptr) VarUI2FromUI432
269 stub VarUI2FromDec
270 st
ub VarUI4FromUI1
271 st
ub VarUI4FromI
2
272 st
ub VarUI4FromI4
273 st
ub VarUI4FromR4
274 st
ub VarUI4FromR8
275 st
ub VarUI4FromDate
270 st
dcall VarUI4FromUI1(long ptr) VarUI4FromUI132
271 st
dcall VarUI4FromI2(long ptr) VarUI4FromI23
2
272 st
dcall VarUI4FromI4(long ptr) VarUI4FromI432
273 st
dcall VarUI4FromR4(long ptr) VarUI4FromR432
274 st
dcall VarUI4FromR8(double ptr) VarUI4FromR832
275 st
dcall VarUI4FromDate(long ptr) VarUI4FromDate32
276 stub VarUI4FromCy
277 st
ub VarUI4FromStr
277 st
dcall VarUI4FromStr(wstr long long ptr) VarUI4FromStr32
278 stub VarUI4FromDisp
279 st
ub VarUI4FromBool
280 st
ub VarUI4FromI1
281 st
ub VarUI4FromUI
2
279 st
dcall VarUI4FromBool(long ptr) VarUI4FromBool32
280 st
dcall VarUI4FromI1(long ptr) VarUI4FromI132
281 st
dcall VarUI4FromUI2(long ptr) VarUI4FromUI23
2
282 stub VarUI4FromDec
283 stub BSTR_UserSize
284 stub BSTR_UserMarshal
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment