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
990f08dc
Commit
990f08dc
authored
Aug 21, 2018
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Aug 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
odbccp32: Implement SQLValidDSN/W.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
04413abc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
6 deletions
+80
-6
odbccp32.c
dlls/odbccp32/odbccp32.c
+19
-6
misc.c
dlls/odbccp32/tests/misc.c
+61
-0
No files found.
dlls/odbccp32/odbccp32.c
View file @
990f08dc
...
...
@@ -29,6 +29,7 @@
#include "winbase.h"
#include "winreg.h"
#include "winnls.h"
#include "sqlext.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
...
...
@@ -1514,18 +1515,30 @@ BOOL WINAPI SQLSetConfigMode(UWORD wConfigMode)
BOOL
WINAPI
SQLValidDSNW
(
LPCWSTR
lpszDSN
)
{
static
const
WCHAR
invalid
[]
=
{
'['
,
']'
,
'{'
,
'}'
,
'('
,
')'
,
','
,
';'
,
'?'
,
'*'
,
'='
,
'!'
,
'@'
,
'\\'
,
0
};
clear_errors
();
FIXME
(
"%s
\n
"
,
debugstr_w
(
lpszDSN
));
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
FALSE
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
lpszDSN
));
if
(
strlenW
(
lpszDSN
)
>
SQL_MAX_DSN_LENGTH
||
strpbrkW
(
lpszDSN
,
invalid
)
!=
NULL
)
{
return
FALSE
;
}
return
TRUE
;
}
BOOL
WINAPI
SQLValidDSN
(
LPCSTR
lpszDSN
)
{
static
const
char
*
invalid
=
"[]{}(),;?*=!@
\\
"
;
clear_errors
();
FIXME
(
"%s
\n
"
,
debugstr_a
(
lpszDSN
));
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
FALSE
;
TRACE
(
"%s
\n
"
,
debugstr_a
(
lpszDSN
));
if
(
strlen
(
lpszDSN
)
>
SQL_MAX_DSN_LENGTH
||
strpbrk
(
lpszDSN
,
invalid
)
!=
NULL
)
{
return
FALSE
;
}
return
TRUE
;
}
BOOL
WINAPI
SQLWriteDSNToIniW
(
LPCWSTR
lpszDSN
,
LPCWSTR
lpszDriver
)
...
...
dlls/odbccp32/tests/misc.c
View file @
990f08dc
...
...
@@ -682,6 +682,65 @@ static void test_SQLGetInstalledDrivers(void)
SQLRemoveDriver
(
"Wine test"
,
TRUE
,
NULL
);
}
static
void
test_SQLValidDSN
(
void
)
{
static
const
char
*
invalid
=
"[]{}(),;?*=!@
\\
"
;
char
str
[
10
];
int
i
;
BOOL
ret
;
strcpy
(
str
,
"wine10"
);
for
(
i
=
0
;
i
<
strlen
(
invalid
);
i
++
)
{
str
[
4
]
=
invalid
[
i
];
ret
=
SQLValidDSN
(
str
);
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
}
/* Too large */
ret
=
SQLValidDSN
(
"Wine123456789012345678901234567890"
);
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
/* Valid with a space */
ret
=
SQLValidDSN
(
"Wine Vinegar"
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
/* Max DSN name value */
ret
=
SQLValidDSN
(
"12345678901234567890123456789012"
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
}
static
void
test_SQLValidDSNW
(
void
)
{
static
const
WCHAR
invalid
[]
=
{
'['
,
']'
,
'{'
,
'}'
,
'('
,
')'
,
','
,
';'
,
'?'
,
'*'
,
'='
,
'!'
,
'@'
,
'\\'
,
0
};
static
const
WCHAR
value
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'1'
,
'0'
,
0
};
static
const
WCHAR
too_large
[]
=
{
'W'
,
'i'
,
'n'
,
'e'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
0
};
static
const
WCHAR
with_space
[]
=
{
'W'
,
'i'
,
'n'
,
'e'
,
' '
,
'V'
,
'i'
,
'n'
,
'e'
,
'g'
,
'a'
,
'r'
,
0
};
static
const
WCHAR
max_dsn
[]
=
{
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
0
};
WCHAR
str
[
10
];
int
i
;
BOOL
ret
;
lstrcpyW
(
str
,
value
);
for
(
i
=
0
;
i
<
lstrlenW
(
invalid
);
i
++
)
{
str
[
4
]
=
invalid
[
i
];
ret
=
SQLValidDSNW
(
str
);
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
}
ret
=
SQLValidDSNW
(
too_large
);
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
ret
=
SQLValidDSNW
(
with_space
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
ret
=
SQLValidDSNW
(
max_dsn
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
}
START_TEST
(
misc
)
{
test_SQLConfigMode
();
...
...
@@ -693,4 +752,6 @@ START_TEST(misc)
test_SQLInstallDriverEx
();
test_SQLInstallTranslatorEx
();
test_SQLGetInstalledDrivers
();
test_SQLValidDSN
();
test_SQLValidDSNW
();
}
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