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
8f005769
Commit
8f005769
authored
Dec 05, 2019
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Dec 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
odbccp32: Implement SQLConfigDataSource/W.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c05c4452
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
28 deletions
+101
-28
odbccp32.c
dlls/odbccp32/odbccp32.c
+97
-24
misc.c
dlls/odbccp32/tests/misc.c
+4
-4
No files found.
dlls/odbccp32/odbccp32.c
View file @
8f005769
...
...
@@ -68,6 +68,9 @@ static const WCHAR odbc_error_load_lib_failed[] = {'L','o','a','d',' ','L','i','
static
const
WCHAR
odbc_error_request_failed
[]
=
{
'R'
,
'e'
,
'q'
,
'u'
,
'e'
,
's'
,
't'
,
' '
,
'F'
,
'a'
,
'i'
,
'l'
,
'e'
,
'd'
,
0
};
static
const
WCHAR
odbc_error_invalid_keyword
[]
=
{
'I'
,
'n'
,
'v'
,
'a'
,
'l'
,
'i'
,
'd'
,
' '
,
'k'
,
'e'
,
'y'
,
'w'
,
'o'
,
'r'
,
'd'
,
' '
,
'v'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
static
BOOL
(
WINAPI
*
pConfigDSN
)(
HWND
hwnd
,
WORD
request
,
const
char
*
driver
,
const
char
*
attr
);
static
BOOL
(
WINAPI
*
pConfigDSNW
)(
HWND
hwnd
,
WORD
request
,
const
WCHAR
*
driver
,
const
WCHAR
*
attr
);
/* Push an error onto the error stack, taking care of ranges etc. */
static
void
push_error
(
int
code
,
LPCWSTR
msg
)
{
...
...
@@ -219,30 +222,6 @@ static BOOL SQLInstall_narrow(int mode, LPSTR buffer, LPCWSTR str, WORD str_leng
return
success
;
}
BOOL
WINAPI
SQLConfigDataSourceW
(
HWND
hwndParent
,
WORD
fRequest
,
LPCWSTR
lpszDriver
,
LPCWSTR
lpszAttributes
)
{
LPCWSTR
p
;
clear_errors
();
FIXME
(
"%p %d %s %s
\n
"
,
hwndParent
,
fRequest
,
debugstr_w
(
lpszDriver
),
debugstr_w
(
lpszAttributes
));
for
(
p
=
lpszAttributes
;
*
p
;
p
+=
lstrlenW
(
p
)
+
1
)
FIXME
(
"%s
\n
"
,
debugstr_w
(
p
));
return
TRUE
;
}
BOOL
WINAPI
SQLConfigDataSource
(
HWND
hwndParent
,
WORD
fRequest
,
LPCSTR
lpszDriver
,
LPCSTR
lpszAttributes
)
{
FIXME
(
"%p %d %s %s
\n
"
,
hwndParent
,
fRequest
,
debugstr_a
(
lpszDriver
),
debugstr_a
(
lpszAttributes
));
clear_errors
();
return
TRUE
;
}
static
HMODULE
load_config_driver
(
const
WCHAR
*
driver
)
{
static
WCHAR
reg_driver
[]
=
{
'd'
,
'r'
,
'i'
,
'v'
,
'e'
,
'r'
,
0
};
...
...
@@ -359,6 +338,100 @@ fail:
return
FALSE
;
}
BOOL
WINAPI
SQLConfigDataSourceW
(
HWND
hwnd
,
WORD
request
,
LPCWSTR
driver
,
LPCWSTR
attributes
)
{
HMODULE
mod
;
BOOL
ret
=
FALSE
;
TRACE
(
"%p, %d, %s, %s
\n
"
,
hwnd
,
request
,
debugstr_w
(
driver
),
debugstr_w
(
attributes
));
if
(
TRACE_ON
(
odbc
))
{
const
WCHAR
*
p
;
for
(
p
=
attributes
;
*
p
;
p
+=
lstrlenW
(
p
)
+
1
)
TRACE
(
"%s
\n
"
,
debugstr_w
(
p
));
}
clear_errors
();
mod
=
load_config_driver
(
driver
);
if
(
!
mod
)
return
FALSE
;
pConfigDSNW
=
(
void
*
)
GetProcAddress
(
mod
,
"ConfigDSNW"
);
if
(
pConfigDSNW
)
ret
=
pConfigDSNW
(
hwnd
,
request
,
driver
,
attributes
);
else
ERR
(
"Failed to find ConfigDSNW
\n
"
);
if
(
!
ret
)
push_error
(
ODBC_ERROR_REQUEST_FAILED
,
odbc_error_request_failed
);
FreeLibrary
(
mod
);
return
ret
;
}
BOOL
WINAPI
SQLConfigDataSource
(
HWND
hwnd
,
WORD
request
,
LPCSTR
driver
,
LPCSTR
attributes
)
{
HMODULE
mod
;
BOOL
ret
=
FALSE
;
WCHAR
*
driverW
;
TRACE
(
"%p, %d, %s, %s
\n
"
,
hwnd
,
request
,
debugstr_a
(
driver
),
debugstr_a
(
attributes
));
if
(
TRACE_ON
(
odbc
))
{
const
char
*
p
;
for
(
p
=
attributes
;
*
p
;
p
+=
lstrlenA
(
p
)
+
1
)
TRACE
(
"%s
\n
"
,
debugstr_a
(
p
));
}
clear_errors
();
driverW
=
heap_strdupAtoW
(
driver
);
if
(
!
driverW
)
{
push_error
(
ODBC_ERROR_OUT_OF_MEM
,
odbc_error_out_of_mem
);
return
FALSE
;
}
mod
=
load_config_driver
(
driverW
);
if
(
!
mod
)
{
heap_free
(
driverW
);
return
FALSE
;
}
pConfigDSN
=
(
void
*
)
GetProcAddress
(
mod
,
"ConfigDSN"
);
if
(
pConfigDSN
)
{
TRACE
(
"Calling ConfigDSN
\n
"
);
ret
=
pConfigDSN
(
hwnd
,
request
,
driver
,
attributes
);
}
else
{
pConfigDSNW
=
(
void
*
)
GetProcAddress
(
mod
,
"ConfigDSNW"
);
if
(
pConfigDSNW
)
{
WCHAR
*
attr
=
NULL
;
TRACE
(
"Calling ConfigDSNW
\n
"
);
attr
=
SQLInstall_strdup_multi
(
attributes
);
if
(
attr
)
ret
=
pConfigDSNW
(
hwnd
,
request
,
driverW
,
attr
);
heap_free
(
attr
);
}
}
if
(
!
ret
)
push_error
(
ODBC_ERROR_REQUEST_FAILED
,
odbc_error_request_failed
);
heap_free
(
driverW
);
FreeLibrary
(
mod
);
return
ret
;
}
BOOL
WINAPI
SQLConfigDriverW
(
HWND
hwnd
,
WORD
request
,
LPCWSTR
driver
,
LPCWSTR
args
,
LPWSTR
msg
,
WORD
msgmax
,
WORD
*
msgout
)
{
...
...
dlls/odbccp32/tests/misc.c
View file @
8f005769
...
...
@@ -751,10 +751,10 @@ static void test_SQLConfigDataSource(void)
BOOL
ret
;
ret
=
SQLConfigDataSource
(
0
,
ODBC_ADD_DSN
,
"SQL Server"
,
"DSN=WINEMQIS
\0
Database=MQIS
\0\0
"
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
todo_wine
ok
(
ret
,
"got %d
\n
"
,
ret
);
ret
=
SQLConfigDataSource
(
0
,
ODBC_REMOVE_DSN
,
"SQL Server"
,
"DSN=WINEMQIS
\0\0
"
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
todo_wine
ok
(
ret
,
"got %d
\n
"
,
ret
);
ret
=
SQLConfigDataSource
(
0
,
ODBC_REMOVE_DSN
,
"SQL Server"
,
"DSN=WINEMQIS
\0\0
"
);
if
(
!
ret
)
...
...
@@ -767,8 +767,8 @@ static void test_SQLConfigDataSource(void)
}
ret
=
SQLConfigDataSource
(
0
,
ODBC_ADD_DSN
,
"ODBC driver"
,
"DSN=ODBC data source
\0\0
"
);
todo_wine
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
todo_wine
check_error
(
ODBC_ERROR_COMPONENT_NOT_FOUND
);
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
check_error
(
ODBC_ERROR_COMPONENT_NOT_FOUND
);
}
START_TEST
(
misc
)
...
...
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