Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
461c09e5
Commit
461c09e5
authored
Feb 10, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 11, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oledb32: Add a table of init properties, support Persist Security Info switch in init string.
parent
6b5a18f6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
15 deletions
+75
-15
datainit.c
dlls/oledb32/datainit.c
+72
-13
database.c
dlls/oledb32/tests/database.c
+3
-2
No files found.
dlls/oledb32/datainit.c
View file @
461c09e5
...
...
@@ -289,30 +289,89 @@ static void free_dbpropset(ULONG count, DBPROPSET *propset)
CoTaskMemFree
(
propset
);
}
struct
dbproperty
{
const
WCHAR
*
name
;
DBPROPID
id
;
DBPROPOPTIONS
options
;
VARTYPE
type
;
};
static
const
WCHAR
datasourceW
[]
=
{
'D'
,
'a'
,
't'
,
'a'
,
' '
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
0
};
static
const
WCHAR
persistsiW
[]
=
{
'P'
,
'e'
,
'r'
,
's'
,
'i'
,
's'
,
't'
,
' '
,
'S'
,
'e'
,
'c'
,
'u'
,
'r'
,
'i'
,
't'
,
'y'
,
' '
,
'I'
,
'n'
,
'f'
,
'o'
,
0
};
static
const
struct
dbproperty
dbproperties
[]
=
{
{
datasourceW
,
DBPROP_INIT_DATASOURCE
,
DBPROPOPTIONS_REQUIRED
,
VT_BSTR
},
{
persistsiW
,
DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO
,
DBPROPOPTIONS_OPTIONAL
,
VT_BOOL
}
};
static
HRESULT
set_dbpropset
(
BSTR
name
,
BSTR
value
,
DBPROPSET
**
propset
)
{
static
const
WCHAR
datasourceW
[]
=
{
'D'
,
'a'
,
't'
,
'a'
,
' '
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
0
};
VARIANT
src
,
dest
;
int
min
,
max
,
n
;
HRESULT
hr
;
min
=
0
;
max
=
sizeof
(
dbproperties
)
/
sizeof
(
struct
dbproperty
)
-
1
;
while
(
min
<=
max
)
{
int
r
;
n
=
(
min
+
max
)
/
2
;
r
=
strcmpW
(
dbproperties
[
n
].
name
,
name
);
if
(
!
r
)
break
;
if
(
r
<
0
)
min
=
n
+
1
;
else
max
=
n
-
1
;
}
if
(
min
>
max
)
{
*
propset
=
NULL
;
FIXME
(
"unsupported property %s
\n
"
,
debugstr_w
(
name
));
return
E_FAIL
;
}
if
(
!
strcmpW
(
datasourceW
,
name
))
VariantInit
(
&
dest
);
V_VT
(
&
src
)
=
VT_BSTR
;
V_BSTR
(
&
src
)
=
value
;
hr
=
VariantChangeType
(
&
dest
,
&
src
,
0
,
dbproperties
[
n
].
type
);
if
(
FAILED
(
hr
))
{
ERR
(
"failed to init property %s value as type %d
\n
"
,
debugstr_w
(
name
),
dbproperties
[
n
].
type
);
return
hr
;
}
*
propset
=
CoTaskMemAlloc
(
sizeof
(
DBPROPSET
));
if
(
!*
propset
)
{
VariantClear
(
&
dest
);
return
E_OUTOFMEMORY
;
}
(
*
propset
)
->
rgProperties
=
CoTaskMemAlloc
(
sizeof
(
DBPROP
));
if
(
!
(
*
propset
)
->
rgProperties
)
{
VariantClear
(
&
dest
);
CoTaskMemFree
(
*
propset
);
return
E_OUTOFMEMORY
;
}
(
*
propset
)
->
cProperties
=
1
;
(
*
propset
)
->
guidPropertySet
=
DBPROPSET_DBINIT
;
(
*
propset
)
->
rgProperties
[
0
].
dwPropertyID
=
DBPROP_INIT_DATASOURCE
;
(
*
propset
)
->
rgProperties
[
0
].
dwOptions
=
DBPROPOPTIONS_REQUIRED
;
(
*
propset
)
->
rgProperties
[
0
].
dwPropertyID
=
dbproperties
[
n
].
id
;
(
*
propset
)
->
rgProperties
[
0
].
dwOptions
=
dbproperties
[
n
].
options
;
(
*
propset
)
->
rgProperties
[
0
].
dwStatus
=
0
;
memset
(
&
(
*
propset
)
->
rgProperties
[
0
].
colid
,
0
,
sizeof
(
DBID
));
V_VT
(
&
(
*
propset
)
->
rgProperties
[
0
].
vValue
)
=
VT_BSTR
;
V_BSTR
(
&
(
*
propset
)
->
rgProperties
[
0
].
vValue
)
=
SysAllocString
(
value
);
(
*
propset
)
->
rgProperties
[
0
].
vValue
=
dest
;
return
S_OK
;
}
else
{
*
propset
=
NULL
;
FIXME
(
"unsupported property %s
\n
"
,
debugstr_w
(
name
));
return
E_FAIL
;
}
}
/*** IDataInitialize methods ***/
...
...
dlls/oledb32/tests/database.c
View file @
461c09e5
...
...
@@ -59,12 +59,13 @@ static void test_database(void)
{
static
WCHAR
initstring_jet
[]
=
{
'P'
,
'r'
,
'o'
,
'v'
,
'i'
,
'd'
,
'e'
,
'r'
,
'='
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'.'
,
'J'
,
'e'
,
't'
,
'.'
,
'O'
,
'L'
,
'E'
,
'D'
,
'B'
,
'.'
,
'4'
,
'.'
,
'0'
,
';'
,
'D'
,
'a'
,
't'
,
'a'
,
' '
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
'='
,
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
';'
,
0
};
'D'
,
'a'
,
't'
,
'a'
,
' '
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
'='
,
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
';'
,
'P'
,
'e'
,
'r'
,
's'
,
'i'
,
's'
,
't'
,
' '
,
'S'
,
'e'
,
'c'
,
'u'
,
'r'
,
'i'
,
't'
,
'y'
,
' '
,
'I'
,
'n'
,
'f'
,
'o'
,
'='
,
'F'
,
'a'
,
'l'
,
's'
,
'e'
,
';'
,
0
};
static
WCHAR
initstring_default
[]
=
{
'D'
,
'a'
,
't'
,
'a'
,
' '
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
'='
,
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
';'
,
0
};
IDataInitialize
*
datainit
=
NULL
;
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_MSDAINITIALIZE
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDataInitialize
,(
void
**
)
&
datainit
);
hr
=
CoCreateInstance
(
&
CLSID_MSDAINITIALIZE
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDataInitialize
,
(
void
**
)
&
datainit
);
if
(
FAILED
(
hr
))
{
win_skip
(
"Unable to load oledb library
\n
"
);
...
...
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