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
7833f307
Commit
7833f307
authored
Oct 19, 2010
by
Juan Lang
Committed by
Alexandre Julliard
Oct 20, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Correct Unicode quoting of BMP strings.
parent
bf70d355
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
11 deletions
+44
-11
str.c
dlls/crypt32/str.c
+39
-6
str.c
dlls/crypt32/tests/str.c
+5
-5
No files found.
dlls/crypt32/str.c
View file @
7833f307
...
...
@@ -73,12 +73,12 @@ DWORD WINAPI CertRDNValueToStrA(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue,
if
(
pValue
->
cbData
&&
isspace
(
pValue
->
pbData
[
pValue
->
cbData
-
1
]))
needsQuotes
=
TRUE
;
for
(
i
=
0
;
i
<
pValue
->
cbData
;
i
++
)
{
{
if
(
is_quotable_char
(
pValue
->
pbData
[
i
]))
needsQuotes
=
TRUE
;
if
(
pValue
->
pbData
[
i
]
==
'"'
)
len
+=
1
;
}
}
if
(
needsQuotes
)
len
+=
2
;
if
(
!
psz
||
!
csz
)
...
...
@@ -158,7 +158,7 @@ DWORD WINAPI CertRDNValueToStrA(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue,
DWORD
WINAPI
CertRDNValueToStrW
(
DWORD
dwValueType
,
PCERT_RDN_VALUE_BLOB
pValue
,
LPWSTR
psz
,
DWORD
csz
)
{
DWORD
ret
=
0
,
len
,
i
;
DWORD
ret
=
0
,
len
,
i
,
strLen
;
BOOL
needsQuotes
=
FALSE
;
TRACE
(
"(%d, %p, %p, %d)
\n
"
,
dwValueType
,
pValue
,
psz
,
csz
);
...
...
@@ -175,19 +175,18 @@ DWORD WINAPI CertRDNValueToStrW(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue,
case
CERT_RDN_GRAPHIC_STRING
:
case
CERT_RDN_VISIBLE_STRING
:
case
CERT_RDN_GENERAL_STRING
:
case
CERT_RDN_BMP_STRING
:
len
=
pValue
->
cbData
;
if
(
pValue
->
cbData
&&
isspace
(
pValue
->
pbData
[
0
]))
needsQuotes
=
TRUE
;
if
(
pValue
->
cbData
&&
isspace
(
pValue
->
pbData
[
pValue
->
cbData
-
1
]))
needsQuotes
=
TRUE
;
for
(
i
=
0
;
i
<
pValue
->
cbData
;
i
++
)
{
{
if
(
is_quotable_char
(
pValue
->
pbData
[
i
]))
needsQuotes
=
TRUE
;
if
(
pValue
->
pbData
[
i
]
==
'"'
)
len
+=
1
;
}
}
if
(
needsQuotes
)
len
+=
2
;
if
(
!
psz
||
!
csz
)
...
...
@@ -209,6 +208,40 @@ DWORD WINAPI CertRDNValueToStrW(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue,
ret
=
ptr
-
psz
;
}
break
;
case
CERT_RDN_BMP_STRING
:
strLen
=
len
=
pValue
->
cbData
/
sizeof
(
WCHAR
);
if
(
pValue
->
cbData
&&
isspace
(
pValue
->
pbData
[
0
]))
needsQuotes
=
TRUE
;
if
(
pValue
->
cbData
&&
isspace
(
pValue
->
pbData
[
strLen
-
1
]))
needsQuotes
=
TRUE
;
for
(
i
=
0
;
i
<
strLen
;
i
++
)
{
if
(
is_quotable_char
(((
LPCWSTR
)
pValue
->
pbData
)[
i
]))
needsQuotes
=
TRUE
;
if
(((
LPCWSTR
)
pValue
->
pbData
)[
i
]
==
'"'
)
len
+=
1
;
}
if
(
needsQuotes
)
len
+=
2
;
if
(
!
psz
||
!
csz
)
ret
=
len
;
else
{
WCHAR
*
ptr
=
psz
;
if
(
needsQuotes
)
*
ptr
++
=
'"'
;
for
(
i
=
0
;
i
<
strLen
&&
ptr
-
psz
<
csz
;
ptr
++
,
i
++
)
{
*
ptr
=
((
LPCWSTR
)
pValue
->
pbData
)[
i
];
if
(((
LPCWSTR
)
pValue
->
pbData
)[
i
]
==
'"'
&&
ptr
-
psz
<
csz
-
1
)
*
(
++
ptr
)
=
'"'
;
}
if
(
needsQuotes
&&
ptr
-
psz
<
csz
)
*
ptr
++
=
'"'
;
ret
=
ptr
-
psz
;
}
break
;
default:
FIXME
(
"string type %d unimplemented
\n
"
,
dwValueType
);
}
...
...
dlls/crypt32/tests/str.c
View file @
7833f307
...
...
@@ -570,7 +570,7 @@ static void test_CertNameToStrW(void)
blob
.
pbData
=
encodedQuotedCN
;
blob
.
cbData
=
sizeof
(
encodedQuotedCN
);
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
quotedCN_W
,
TRU
E
);
FALS
E
);
blob
.
pbData
=
encodedMultipleAttrCN
;
blob
.
cbData
=
sizeof
(
encodedMultipleAttrCN
);
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
multipleAttrCN_W
,
...
...
@@ -583,17 +583,17 @@ static void test_CertNameToStrW(void)
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
equalCN_W
,
FALSE
);
blob
.
pbData
=
encodedLessThanCN
;
blob
.
cbData
=
sizeof
(
encodedLessThanCN
);
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
lessThanCN_W
,
TRU
E
);
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
lessThanCN_W
,
FALS
E
);
blob
.
pbData
=
encodedGreaterThanCN
;
blob
.
cbData
=
sizeof
(
encodedGreaterThanCN
);
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
greaterThanCN_W
,
TRU
E
);
FALS
E
);
blob
.
pbData
=
encodedHashCN
;
blob
.
cbData
=
sizeof
(
encodedHashCN
);
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
hashCN_W
,
TRU
E
);
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
hashCN_W
,
FALS
E
);
blob
.
pbData
=
encodedSemiCN
;
blob
.
cbData
=
sizeof
(
encodedSemiCN
);
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
semiCN_W
,
TRU
E
);
test_NameToStrConversionW
(
&
blob
,
CERT_X500_NAME_STR
,
semiCN_W
,
FALS
E
);
}
struct
StrToNameA
...
...
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