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
1d19c2b7
Commit
1d19c2b7
authored
Apr 22, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 23, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Install data sources in the InstallODBC custom action.
parent
33c025b7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
0 deletions
+63
-0
action.c
dlls/msi/action.c
+49
-0
msidefs.h
include/msidefs.h
+6
-0
odbcinst.h
include/odbcinst.h
+8
-0
No files found.
dlls/msi/action.c
View file @
1d19c2b7
...
...
@@ -4483,6 +4483,44 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param )
return
r
;
}
static
UINT
ITERATE_InstallODBCDataSource
(
MSIRECORD
*
rec
,
LPVOID
param
)
{
LPWSTR
attrs
;
LPCWSTR
desc
,
driver
;
WORD
request
=
ODBC_ADD_SYS_DSN
;
INT
registration
;
DWORD
len
;
UINT
r
=
ERROR_SUCCESS
;
static
const
WCHAR
attrs_fmt
[]
=
{
'D'
,
'S'
,
'N'
,
'='
,
'%'
,
's'
,
0
};
desc
=
MSI_RecordGetString
(
rec
,
3
);
driver
=
MSI_RecordGetString
(
rec
,
4
);
registration
=
MSI_RecordGetInteger
(
rec
,
5
);
if
(
registration
==
msidbODBCDataSourceRegistrationPerMachine
)
request
=
ODBC_ADD_SYS_DSN
;
else
if
(
registration
==
msidbODBCDataSourceRegistrationPerUser
)
request
=
ODBC_ADD_DSN
;
len
=
lstrlenW
(
attrs_fmt
)
+
lstrlenW
(
desc
)
+
1
+
1
;
attrs
=
msi_alloc
(
len
*
sizeof
(
WCHAR
));
if
(
!
attrs
)
return
ERROR_OUTOFMEMORY
;
sprintfW
(
attrs
,
attrs_fmt
,
desc
);
attrs
[
len
-
1
]
=
'\0'
;
if
(
!
SQLConfigDataSourceW
(
NULL
,
request
,
driver
,
attrs
))
{
ERR
(
"Failed to install SQL data source!
\n
"
);
r
=
ERROR_FUNCTION_FAILED
;
}
msi_free
(
attrs
);
return
r
;
}
static
UINT
ACTION_InstallODBC
(
MSIPACKAGE
*
package
)
{
UINT
rc
;
...
...
@@ -4496,6 +4534,10 @@ static UINT ACTION_InstallODBC( MSIPACKAGE *package )
'S'
,
'E'
,
'L'
,
'E'
,
'C'
,
'T'
,
' '
,
'*'
,
' '
,
'F'
,
'R'
,
'O'
,
'M'
,
' '
,
'O'
,
'D'
,
'B'
,
'C'
,
'T'
,
'r'
,
'a'
,
'n'
,
's'
,
'l'
,
'a'
,
't'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
source_query
[]
=
{
'S'
,
'E'
,
'L'
,
'E'
,
'C'
,
'T'
,
' '
,
'*'
,
' '
,
'F'
,
'R'
,
'O'
,
'M'
,
' '
,
'O'
,
'D'
,
'B'
,
'C'
,
'D'
,
'a'
,
't'
,
'a'
,
'S'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
0
};
rc
=
MSI_DatabaseOpenViewW
(
package
->
db
,
driver_query
,
&
view
);
if
(
rc
!=
ERROR_SUCCESS
)
return
ERROR_SUCCESS
;
...
...
@@ -4510,6 +4552,13 @@ static UINT ACTION_InstallODBC( MSIPACKAGE *package )
rc
=
MSI_IterateRecords
(
view
,
NULL
,
ITERATE_InstallODBCTranslator
,
package
);
msiobj_release
(
&
view
->
hdr
);
rc
=
MSI_DatabaseOpenViewW
(
package
->
db
,
source_query
,
&
view
);
if
(
rc
!=
ERROR_SUCCESS
)
return
ERROR_SUCCESS
;
rc
=
MSI_IterateRecords
(
view
,
NULL
,
ITERATE_InstallODBCDataSource
,
package
);
msiobj_release
(
&
view
->
hdr
);
return
rc
;
}
...
...
include/msidefs.h
View file @
1d19c2b7
...
...
@@ -168,6 +168,12 @@ enum msidbComponentAttributes
msidbComponentAttributes64bit
=
0x00000100
};
enum
msidbODBCDataSourceRegistration
{
msidbODBCDataSourceRegistrationPerMachine
=
0x00000000
,
msidbODBCDataSourceRegistrationPerUser
=
0x00000001
};
enum
msidbRegistryRoot
{
msidbRegistryRootClassesRoot
=
0
,
...
...
include/odbcinst.h
View file @
1d19c2b7
...
...
@@ -34,6 +34,14 @@ extern "C" {
#define ODBC_CONFIG_DRIVER 3
#define ODBC_CONFIG_DRIVER_MAX 100
#define ODBC_ADD_DSN 1
#define ODBC_CONFIG_DSN 2
#define ODBC_REMOVE_DSN 3
#define ODBC_ADD_SYS_DSN 4
#define ODBC_CONFIG_SYS_DSN 5
#define ODBC_REMOVE_SYS_DSN 6
#define ODBC_REMOVE_DEFAULT_DSN 7
/* Mode values for SQLSetConfigMode/SQLGetConfigMode */
#define ODBC_BOTH_DSN 0
#define ODBC_USER_DSN 1
...
...
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