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
71f3a225
Commit
71f3a225
authored
Sep 27, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add CRYPT_STRING_BINARY mode for CryptBinaryToStringW().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
78af6e34
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
base64.c
dlls/crypt32/base64.c
+23
-2
base64.c
dlls/crypt32/tests/base64.c
+1
-4
No files found.
dlls/crypt32/base64.c
View file @
71f3a225
...
...
@@ -88,7 +88,6 @@ static BOOL EncodeBinaryToBinaryA(const BYTE *pbBinary,
memcpy
(
pszString
,
pbBinary
,
cbBinary
);
}
else
*
pcchString
=
cbBinary
;
return
ret
;
...
...
@@ -294,6 +293,26 @@ BOOL WINAPI CryptBinaryToStringA(const BYTE *pbBinary,
return
encoder
(
pbBinary
,
cbBinary
,
dwFlags
,
pszString
,
pcchString
);
}
static
BOOL
EncodeBinaryToBinaryW
(
const
BYTE
*
in_buf
,
DWORD
in_len
,
DWORD
flags
,
WCHAR
*
out_buf
,
DWORD
*
out_len
)
{
BOOL
ret
=
TRUE
;
if
(
out_buf
)
{
if
(
*
out_len
<
in_len
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
ret
=
FALSE
;
}
else
if
(
in_len
)
memcpy
(
out_buf
,
in_buf
,
in_len
);
}
else
*
out_len
=
in_len
;
return
ret
;
}
static
LONG
encodeBase64W
(
const
BYTE
*
in_buf
,
int
in_len
,
LPCWSTR
sep
,
WCHAR
*
out_buf
,
DWORD
*
out_len
)
{
...
...
@@ -472,13 +491,15 @@ BOOL WINAPI CryptBinaryToStringW(const BYTE *pbBinary,
switch
(
dwFlags
&
0x0fffffff
)
{
case
CRYPT_STRING_BINARY
:
encoder
=
EncodeBinaryToBinaryW
;
break
;
case
CRYPT_STRING_BASE64
:
case
CRYPT_STRING_BASE64HEADER
:
case
CRYPT_STRING_BASE64REQUESTHEADER
:
case
CRYPT_STRING_BASE64X509CRLHEADER
:
encoder
=
BinaryToBase64W
;
break
;
case
CRYPT_STRING_BINARY
:
case
CRYPT_STRING_HEX
:
case
CRYPT_STRING_HEXASCII
:
case
CRYPT_STRING_HEXADDR
:
...
...
dlls/crypt32/tests/base64.c
View file @
71f3a225
...
...
@@ -284,17 +284,14 @@ static void test_CryptBinaryToString(void)
strLen
=
0
;
ret
=
CryptBinaryToStringW
(
tests
[
i
].
toEncode
,
tests
[
i
].
toEncodeLen
,
CRYPT_STRING_BINARY
,
NULL
,
&
strLen
);
todo_wine
{
ok
(
ret
,
"CryptBinaryToStringW failed: %d
\n
"
,
GetLastError
());
ok
(
strLen
==
tests
[
i
].
toEncodeLen
,
"Unexpected required length %u.
\n
"
,
strLen
);
}
strLen2
=
strLen
;
strW
=
heap_alloc
(
strLen
);
ret
=
CryptBinaryToStringW
(
tests
[
i
].
toEncode
,
tests
[
i
].
toEncodeLen
,
CRYPT_STRING_BINARY
,
strW
,
&
strLen2
);
todo_wine
ok
(
ret
,
"CryptBinaryToStringW failed: %d
\n
"
,
GetLastError
());
ok
(
strLen
==
strLen2
,
"Expected length %u, got %u
\n
"
,
strLen
,
strLen2
);
todo_wine
ok
(
!
memcmp
(
strW
,
tests
[
i
].
toEncode
,
tests
[
i
].
toEncodeLen
),
"Unexpected value
\n
"
);
heap_free
(
strW
);
...
...
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