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
a94e8088
Commit
a94e8088
authored
Oct 02, 2009
by
Huw Davies
Committed by
Alexandre Julliard
Oct 02, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oledb32: Implement conversions to DBTYPE_BYREF | DBTYPE_WSTR.
parent
8349b134
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
0 deletions
+110
-0
convert.c
dlls/oledb32/convert.c
+21
-0
convert.c
dlls/oledb32/tests/convert.c
+89
-0
No files found.
dlls/oledb32/convert.c
View file @
a94e8088
...
...
@@ -129,6 +129,7 @@ static int get_length(DBTYPE type)
case
DBTYPE_BSTR
:
return
sizeof
(
BSTR
);
case
DBTYPE_WSTR
:
case
DBTYPE_BYREF
|
DBTYPE_WSTR
:
return
0
;
default:
FIXME
(
"Unhandled type %04x
\n
"
,
type
);
...
...
@@ -312,6 +313,26 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
return
hr
;
}
case
DBTYPE_BYREF
|
DBTYPE_WSTR
:
{
BSTR
b
;
WCHAR
**
d
=
dst
;
DBLENGTH
bstr_len
;
hr
=
IDataConvert_DataConvert
(
iface
,
src_type
,
DBTYPE_BSTR
,
src_len
,
&
bstr_len
,
src
,
&
b
,
sizeof
(
BSTR
),
src_status
,
dst_status
,
precision
,
scale
,
flags
);
if
(
hr
!=
S_OK
)
return
hr
;
bstr_len
=
SysStringLen
(
b
)
*
sizeof
(
WCHAR
);
*
dst_len
=
bstr_len
;
/* Doesn't include size for '\0' */
*
d
=
CoTaskMemAlloc
(
bstr_len
+
sizeof
(
WCHAR
));
if
(
*
d
)
memcpy
(
*
d
,
b
,
bstr_len
+
sizeof
(
WCHAR
));
else
hr
=
E_OUTOFMEMORY
;
SysFreeString
(
b
);
return
hr
;
}
default:
FIXME
(
"Unimplemented conversion %04x -> %04x
\n
"
,
src_type
,
dst_type
);
return
E_NOTIMPL
;
...
...
dlls/oledb32/tests/convert.c
View file @
a94e8088
...
...
@@ -1023,6 +1023,94 @@ static void test_converttowstr(void)
IDataConvert_Release
(
convert
);
}
static
void
test_converttobyrefwstr
(
void
)
{
IDataConvert
*
convert
;
HRESULT
hr
;
WCHAR
*
dst
;
BYTE
src
[
20
];
DBSTATUS
dst_status
;
DBLENGTH
dst_len
;
static
const
WCHAR
ten
[]
=
{
'1'
,
'0'
,
0
};
static
const
WCHAR
fourthreetwoone
[]
=
{
'4'
,
'3'
,
'2'
,
'1'
,
0
};
BSTR
b
;
hr
=
CoCreateInstance
(
&
CLSID_OLEDB_CONVERSIONLIBRARY
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDataConvert
,
(
void
**
)
&
convert
);
if
(
FAILED
(
hr
))
{
win_skip
(
"Unable to load oledb conversion library
\n
"
);
return
;
}
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_EMPTY
,
DBTYPE_BYREF
|
DBTYPE_WSTR
,
0
,
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
0
,
"got %d
\n
"
,
dst_len
);
ok
(
dst
[
0
]
==
0
,
"got %04x
\n
"
,
dst
[
0
]);
CoTaskMemFree
(
dst
);
dst
=
(
void
*
)
0x12345678
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_NULL
,
DBTYPE_BYREF
|
DBTYPE_WSTR
,
0
,
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
DB_E_UNSUPPORTEDCONVERSION
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_E_BADACCESSOR
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
0
,
"got %d
\n
"
,
dst_len
);
ok
(
dst
==
(
void
*
)
0x12345678
,
"got %p
\n
"
,
dst
);
*
(
short
*
)
src
=
4321
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_I2
,
DBTYPE_BYREF
|
DBTYPE_WSTR
,
0
,
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
8
,
"got %d
\n
"
,
dst_len
);
ok
(
!
lstrcmpW
(
dst
,
fourthreetwoone
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
CoTaskMemFree
(
dst
);
*
(
short
*
)
src
=
4321
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_I2
,
DBTYPE_BYREF
|
DBTYPE_WSTR
,
0
,
&
dst_len
,
src
,
&
dst
,
0
,
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
8
,
"got %d
\n
"
,
dst_len
);
ok
(
!
lstrcmpW
(
dst
,
fourthreetwoone
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
CoTaskMemFree
(
dst
);
b
=
SysAllocString
(
ten
);
*
(
BSTR
*
)
src
=
b
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BSTR
,
DBTYPE_BYREF
|
DBTYPE_WSTR
,
0
,
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
4
,
"got %d
\n
"
,
dst_len
);
ok
(
!
lstrcmpW
(
b
,
dst
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
CoTaskMemFree
(
dst
);
SysFreeString
(
b
);
memcpy
(
src
,
ten
,
sizeof
(
ten
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_WSTR
,
DBTYPE_BYREF
|
DBTYPE_WSTR
,
2
,
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
2
,
"got %d
\n
"
,
dst_len
);
ok
(
dst
[
0
]
==
'1'
,
"got %02x
\n
"
,
dst
[
0
]);
ok
(
dst
[
1
]
==
0
,
"got %02x
\n
"
,
dst
[
1
]);
CoTaskMemFree
(
dst
);
memcpy
(
src
,
ten
,
sizeof
(
ten
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_WSTR
,
DBTYPE_BYREF
|
DBTYPE_WSTR
,
4
,
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
4
,
"got %d
\n
"
,
dst_len
);
ok
(
!
lstrcmpW
(
ten
,
dst
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
CoTaskMemFree
(
dst
);
memcpy
(
src
,
ten
,
sizeof
(
ten
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_WSTR
,
DBTYPE_BYREF
|
DBTYPE_WSTR
,
0
,
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
DBDATACONVERT_LENGTHFROMNTS
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
4
,
"got %d
\n
"
,
dst_len
);
ok
(
!
lstrcmpW
(
ten
,
dst
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
CoTaskMemFree
(
dst
);
IDataConvert_Release
(
convert
);
}
START_TEST
(
convert
)
{
OleInitialize
(
NULL
);
...
...
@@ -1032,5 +1120,6 @@ START_TEST(convert)
test_converttoi4
();
test_converttobstr
();
test_converttowstr
();
test_converttobyrefwstr
();
OleUninitialize
();
}
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