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
b8ebbbee
Commit
b8ebbbee
authored
Nov 03, 2020
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Nov 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
serialui: Use wide-char string literals.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c56bddf9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
30 deletions
+14
-30
confdlg.c
dlls/serialui/confdlg.c
+7
-19
confdlg.c
dlls/serialui/tests/confdlg.c
+7
-11
No files found.
dlls/serialui/confdlg.c
View file @
b8ebbbee
...
...
@@ -46,8 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(comm);
static
HMODULE
SERIALUI_hModule
;
static
const
WCHAR
comW
[]
=
{
'c'
,
'o'
,
'm'
,
0
};
/***********************************************************************
* DllMain [Internal] Initializes the internal 'SERIALUI.DLL'.
*
...
...
@@ -463,13 +461,7 @@ DWORD WINAPI drvCommConfigDialogA(LPCSTR lpszName, HWND hWndParent, LPCOMMCONFIG
return
r
;
}
static
const
WCHAR
lpszCommKey
[]
=
{
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'S'
,
'e'
,
't'
,
'\\'
,
'S'
,
'e'
,
'r'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
'\\'
,
'C'
,
'l'
,
'a'
,
's'
,
's'
,
'\\'
,
'P'
,
'o'
,
'r'
,
't'
,
's'
,
0
};
static
const
WCHAR
lpszDCB
[]
=
{
'D'
,
'C'
,
'B'
,
0
};
static
const
WCHAR
lpszCommKey
[]
=
L"System
\\
CurrentControlSet
\\
Services
\\
Class
\\
Ports"
;
/***********************************************************************
* drvSetDefaultCommConfigW (SERIALUI.@)
...
...
@@ -484,7 +476,6 @@ BOOL WINAPI drvSetDefaultCommConfigW(
HKEY
hKeyReg
=
0
,
hKeyPort
=
0
;
WCHAR
szKeyName
[
100
];
DWORD
r
,
dwDCBSize
;
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'\\'
,
'%'
,
's'
,
0
};
TRACE
(
"%p %p %x
\n
"
,
lpszDevice
,
lpCommConfig
,
dwSize
);
...
...
@@ -498,13 +489,12 @@ BOOL WINAPI drvSetDefaultCommConfigW(
if
(
r
!=
ERROR_SUCCESS
)
return
FALSE
;
swprintf
(
szKeyName
,
ARRAY_SIZE
(
szKeyName
),
fmt
,
lpszCommKey
,
lpszDevice
);
swprintf
(
szKeyName
,
ARRAY_SIZE
(
szKeyName
),
L"%s
\\
%s"
,
lpszCommKey
,
lpszDevice
);
r
=
RegCreateKeyW
(
hKeyReg
,
szKeyName
,
&
hKeyPort
);
if
(
r
==
ERROR_SUCCESS
)
{
dwDCBSize
=
sizeof
(
DCB
);
r
=
RegSetValueExW
(
hKeyPort
,
lpszDCB
,
0
,
REG_BINARY
,
(
LPBYTE
)
&
lpCommConfig
->
dcb
,
dwDCBSize
);
r
=
RegSetValueExW
(
hKeyPort
,
L"DCB"
,
0
,
REG_BINARY
,
(
BYTE
*
)
&
lpCommConfig
->
dcb
,
dwDCBSize
);
TRACE
(
"write key r=%d
\n
"
,
r
);
RegCloseKey
(
hKeyPort
);
}
...
...
@@ -539,7 +529,6 @@ DWORD WINAPI drvGetDefaultCommConfigW(
HKEY
hKeyReg
,
hKeyPort
;
WCHAR
szKeyName
[
100
];
DWORD
r
,
dwSize
,
dwType
;
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'\\'
,
'%'
,
's'
,
0
};
TRACE
(
"(%s, %p, %p) *lpdwSize: %u
\n
"
,
debugstr_w
(
lpszDevice
),
lpCommConfig
,
lpdwSize
,
lpdwSize
?
*
lpdwSize
:
0
);
...
...
@@ -553,11 +542,11 @@ DWORD WINAPI drvGetDefaultCommConfigW(
}
/* only "com1" - "com9" is allowed */
r
=
ARRAY_SIZE
(
comW
);
/* len of "com\0" */
r
=
ARRAY_SIZE
(
L"com"
);
lstrcpynW
(
szKeyName
,
lpszDevice
,
r
);
/* simulate a lstrcmpnW */
r
--
;
if
(
lstrcmpiW
(
szKeyName
,
comW
)
||
if
(
lstrcmpiW
(
szKeyName
,
L"com"
)
||
(
lpszDevice
[
r
]
<
'1'
)
||
(
lpszDevice
[
r
]
>
'9'
)
||
lpszDevice
[
r
+
1
])
{
return
ERROR_BADKEY
;
}
...
...
@@ -571,14 +560,13 @@ DWORD WINAPI drvGetDefaultCommConfigW(
r
=
RegConnectRegistryW
(
NULL
,
HKEY_LOCAL_MACHINE
,
&
hKeyReg
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
swprintf
(
szKeyName
,
ARRAY_SIZE
(
szKeyName
),
fmt
,
lpszCommKey
,
lpszDevice
);
swprintf
(
szKeyName
,
ARRAY_SIZE
(
szKeyName
),
L"%s
\\
%s"
,
lpszCommKey
,
lpszDevice
);
r
=
RegOpenKeyW
(
hKeyReg
,
szKeyName
,
&
hKeyPort
);
if
(
r
==
ERROR_SUCCESS
)
{
dwSize
=
sizeof
(
DCB
);
dwType
=
0
;
r
=
RegQueryValueExW
(
hKeyPort
,
lpszDCB
,
NULL
,
&
dwType
,
(
LPBYTE
)
&
lpCommConfig
->
dcb
,
&
dwSize
);
r
=
RegQueryValueExW
(
hKeyPort
,
L"DCB"
,
NULL
,
&
dwType
,
(
BYTE
*
)
&
lpCommConfig
->
dcb
,
&
dwSize
);
RegCloseKey
(
hKeyPort
);
if
((
r
!=
ERROR_SUCCESS
)
||
(
dwType
!=
REG_BINARY
)
||
(
dwSize
!=
sizeof
(
DCB
)))
{
...
...
dlls/serialui/tests/confdlg.c
View file @
b8ebbbee
...
...
@@ -42,10 +42,6 @@ static const CHAR emptyA[] = "";
static
const
CHAR
fmt_comA
[]
=
"com%d"
;
static
const
CHAR
str_colonA
[]
=
":"
;
static
const
WCHAR
com1W
[]
=
{
'c'
,
'o'
,
'm'
,
'1'
,
0
};
static
const
WCHAR
emptyW
[]
=
{
0
};
static
const
WCHAR
str_colonW
[]
=
{
':'
,
0
};
/* ################# */
static
LPCSTR
load_functions
(
void
)
...
...
@@ -202,7 +198,7 @@ static void test_drvCommConfigDialogW(void)
ZeroMemory
(
pCC
,
sizeof
(
pCC
));
SetLastError
(
0xdeadbeef
);
res
=
pCommConfigDialogW
(
emptyW
,
NULL
,
pCC
);
res
=
pCommConfigDialogW
(
L""
,
NULL
,
pCC
);
ok
(
res
==
ERROR_INSUFFICIENT_BUFFER
,
"returned %u with %u (expected ERROR_INSUFFICIENT_BUFFER)
\n
"
,
res
,
GetLastError
());
...
...
@@ -211,7 +207,7 @@ static void test_drvCommConfigDialogW(void)
ZeroMemory
(
pCC
,
sizeof
(
pCC
));
pCC
[
0
].
dwSize
=
sizeof
(
COMMCONFIG
);
SetLastError
(
0xdeadbeef
);
res
=
pCommConfigDialogW
(
emptyW
,
NULL
,
pCC
);
res
=
pCommConfigDialogW
(
L""
,
NULL
,
pCC
);
ok
(
res
==
ERROR_BADKEY
,
"returned %u with %u (expected ERROR_BADKEY)
\n
"
,
res
,
GetLastError
());
...
...
@@ -334,7 +330,7 @@ static void test_drvGetDefaultCommConfigW(void)
len
=
sizeof
(
COMMCONFIG
)
-
1
;
ZeroMemory
(
pCC
,
sizeof
(
pCC
));
SetLastError
(
0xdeadbeef
);
res
=
pGetDefaultCommConfigW
(
com1W
,
pCC
,
&
len
);
res
=
pGetDefaultCommConfigW
(
L"com1"
,
pCC
,
&
len
);
if
(
res
==
ERROR_CALL_NOT_IMPLEMENTED
)
{
win_skip
(
"*W not implemented
\n
"
);
return
;
...
...
@@ -366,7 +362,7 @@ static void test_drvGetDefaultCommConfigW(void)
/* a name with a colon is invalid */
if
(
res
==
ERROR_SUCCESS
)
{
lstrcatA
(
bufferA
,
str_colonA
);
lstrcatW
(
bufferW
,
str_colonW
);
lstrcatW
(
bufferW
,
L":"
);
len
=
sizeof
(
pCC
);
ZeroMemory
(
pCC
,
sizeof
(
pCC
));
res
=
pGetDefaultCommConfigW
(
bufferW
,
pCC
,
&
len
);
...
...
@@ -380,7 +376,7 @@ static void test_drvGetDefaultCommConfigW(void)
len
=
sizeof
(
pCC
);
ZeroMemory
(
pCC
,
sizeof
(
pCC
));
SetLastError
(
0xdeadbeef
);
res
=
pGetDefaultCommConfigW
(
emptyW
,
pCC
,
&
len
);
res
=
pGetDefaultCommConfigW
(
L""
,
pCC
,
&
len
);
ok
(
res
==
ERROR_BADKEY
,
"returned %u with %u and %u for %s (expected ERROR_BADKEY)
\n
"
,
res
,
GetLastError
(),
len
,
emptyA
);
...
...
@@ -397,14 +393,14 @@ static void test_drvGetDefaultCommConfigW(void)
len
=
sizeof
(
pCC
);
SetLastError
(
0xdeadbeef
);
res
=
pGetDefaultCommConfigW
(
com1W
,
NULL
,
&
len
);
res
=
pGetDefaultCommConfigW
(
L"com1"
,
NULL
,
&
len
);
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"returned %u with %u and %u (expected ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
(),
len
);
SetLastError
(
0xdeadbeef
);
res
=
pGetDefaultCommConfigW
(
com1W
,
pCC
,
NULL
);
res
=
pGetDefaultCommConfigW
(
L"com1"
,
pCC
,
NULL
);
ok
(
res
==
ERROR_INVALID_PARAMETER
,
"returned %u with %u (expected ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
());
...
...
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