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
656d960d
Commit
656d960d
authored
Jul 09, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Jul 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add a stub decode message implementation.
parent
e557d363
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
12 deletions
+46
-12
msg.c
dlls/crypt32/msg.c
+41
-2
msg.c
dlls/crypt32/tests/msg.c
+5
-10
No files found.
dlls/crypt32/msg.c
View file @
656d960d
...
...
@@ -244,11 +244,43 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags,
return
msg
;
}
typedef
struct
_CDecodeMsg
{
CryptMsgBase
base
;
DWORD
type
;
HCRYPTPROV
crypt_prov
;
}
CDecodeMsg
;
static
void
CDecodeMsg_Close
(
HCRYPTMSG
hCryptMsg
)
{
CDecodeMsg
*
msg
=
(
CDecodeMsg
*
)
hCryptMsg
;
if
(
msg
->
base
.
open_flags
&
CMSG_CRYPT_RELEASE_CONTEXT_FLAG
)
CryptReleaseContext
(
msg
->
crypt_prov
,
0
);
}
static
BOOL
CDecodeMsg_Update
(
HCRYPTMSG
hCryptMsg
,
const
BYTE
*
pbData
,
DWORD
cbData
,
BOOL
fFinal
)
{
FIXME
(
"(%p, %p, %d, %d): stub
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
);
return
FALSE
;
}
static
BOOL
CDecodeMsg_GetParam
(
HCRYPTMSG
hCryptMsg
,
DWORD
dwParamType
,
DWORD
dwIndex
,
void
*
pvData
,
DWORD
*
pcbData
)
{
FIXME
(
"(%p, %d, %d, %p, %p): stub
\n
"
,
hCryptMsg
,
dwParamType
,
dwIndex
,
pvData
,
pcbData
);
return
FALSE
;
}
HCRYPTMSG
WINAPI
CryptMsgOpenToDecode
(
DWORD
dwMsgEncodingType
,
DWORD
dwFlags
,
DWORD
dwMsgType
,
HCRYPTPROV
hCryptProv
,
PCERT_INFO
pRecipientInfo
,
PCMSG_STREAM_INFO
pStreamInfo
)
{
FIXME
(
"(%08x, %08x, %08x, %08lx, %p, %p): stub
\n
"
,
dwMsgEncodingType
,
CDecodeMsg
*
msg
;
TRACE
(
"(%08x, %08x, %08x, %08lx, %p, %p)
\n
"
,
dwMsgEncodingType
,
dwFlags
,
dwMsgType
,
hCryptProv
,
pRecipientInfo
,
pStreamInfo
);
if
(
GET_CMSG_ENCODING_TYPE
(
dwMsgEncodingType
)
!=
PKCS_7_ASN_ENCODING
)
...
...
@@ -256,7 +288,14 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags,
SetLastError
(
E_INVALIDARG
);
return
NULL
;
}
return
NULL
;
msg
=
CryptMemAlloc
(
sizeof
(
CDecodeMsg
));
if
(
msg
)
{
CryptMsgBase_Init
((
CryptMsgBase
*
)
msg
,
dwFlags
,
pStreamInfo
,
CDecodeMsg_Close
,
CDecodeMsg_GetParam
,
CDecodeMsg_Update
);
msg
->
type
=
dwMsgType
;
}
return
msg
;
}
HCRYPTMSG
WINAPI
CryptMsgDuplicate
(
HCRYPTMSG
hCryptMsg
)
...
...
dlls/crypt32/tests/msg.c
View file @
656d960d
...
...
@@ -95,7 +95,6 @@ static void test_msg_open_to_decode(void)
/* The message type can be explicit... */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_DATA
,
0
,
NULL
,
NULL
);
todo_wine
{
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
0
,
NULL
,
...
...
@@ -125,7 +124,6 @@ static void test_msg_open_to_decode(void)
CryptMsgClose
(
msg
);
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
1000
,
0
,
NULL
,
NULL
);
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
}
CryptMsgClose
(
msg
);
/* And even though the stream info parameter "must be set to NULL" for
...
...
@@ -133,7 +131,6 @@ static void test_msg_open_to_decode(void)
*/
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
0
,
NULL
,
&
streamInfo
);
todo_wine
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
}
...
...
@@ -154,7 +151,6 @@ static void test_msg_get_param(void)
/* Decoded messages */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
/* For decoded messages, the type is always available */
size
=
0
;
...
...
@@ -171,7 +167,6 @@ static void test_msg_get_param(void)
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_DATA
,
0
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
/* For explicitly typed messages, the type is known. */
size
=
sizeof
(
value
);
...
...
@@ -190,10 +185,10 @@ static void test_msg_get_param(void)
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENVELOPED
,
0
,
NULL
,
NULL
);
todo_wine
{
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
size
=
sizeof
(
value
);
ret
=
CryptMsgGetParam
(
msg
,
CMSG_TYPE_PARAM
,
0
,
(
LPBYTE
)
&
value
,
&
size
);
todo_wine
{
ok
(
ret
,
"CryptMsgGetParam failed: %x
\n
"
,
GetLastError
());
ok
(
value
==
CMSG_ENVELOPED
,
"Expected CMSG_ENVELOPED, got %d
\n
"
,
value
);
}
...
...
@@ -207,10 +202,10 @@ static void test_msg_get_param(void)
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
0
,
NULL
,
NULL
);
todo_wine
{
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
size
=
sizeof
(
value
);
ret
=
CryptMsgGetParam
(
msg
,
CMSG_TYPE_PARAM
,
0
,
(
LPBYTE
)
&
value
,
&
size
);
todo_wine
{
ok
(
ret
,
"CryptMsgGetParam failed: %x
\n
"
,
GetLastError
());
ok
(
value
==
CMSG_HASHED
,
"Expected CMSG_HASHED, got %d
\n
"
,
value
);
}
...
...
@@ -224,10 +219,10 @@ static void test_msg_get_param(void)
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_SIGNED
,
0
,
NULL
,
NULL
);
todo_wine
{
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
size
=
sizeof
(
value
);
ret
=
CryptMsgGetParam
(
msg
,
CMSG_TYPE_PARAM
,
0
,
(
LPBYTE
)
&
value
,
&
size
);
todo_wine
{
ok
(
ret
,
"CryptMsgGetParam failed: %x
\n
"
,
GetLastError
());
ok
(
value
==
CMSG_SIGNED
,
"Expected CMSG_SIGNED, got %d
\n
"
,
value
);
}
...
...
@@ -242,20 +237,20 @@ static void test_msg_get_param(void)
/* Explicitly typed messages get their types set, even if they're invalid */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_ENCRYPTED
,
0
,
NULL
,
NULL
);
todo_wine
{
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
size
=
sizeof
(
value
);
ret
=
CryptMsgGetParam
(
msg
,
CMSG_TYPE_PARAM
,
0
,
(
LPBYTE
)
&
value
,
&
size
);
todo_wine
{
ok
(
ret
,
"CryptMsgGetParam failed: %x
\n
"
,
GetLastError
());
ok
(
value
==
CMSG_ENCRYPTED
,
"Expected CMSG_ENCRYPTED, got %d
\n
"
,
value
);
}
CryptMsgClose
(
msg
);
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
1000
,
0
,
NULL
,
NULL
);
todo_wine
{
ok
(
msg
!=
NULL
,
"CryptMsgOpenToDecode failed: %x
\n
"
,
GetLastError
());
size
=
sizeof
(
value
);
ret
=
CryptMsgGetParam
(
msg
,
CMSG_TYPE_PARAM
,
0
,
(
LPBYTE
)
&
value
,
&
size
);
todo_wine
{
ok
(
ret
,
"CryptMsgGetParam failed: %x
\n
"
,
GetLastError
());
ok
(
value
==
1000
,
"Expected 1000, got %d
\n
"
,
value
);
}
...
...
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