winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2007
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
5 participants
856 discussions
Start a n
N
ew thread
Juan Lang : crypt32: Add an update function, use it to implement CryptMsgUpdate.
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: 5db6b1cc962d0ab8c3bb6e9f05ef534437c91af3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5db6b1cc962d0ab8c3bb6e9f0…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:51:47 2007 -0700 crypt32: Add an update function, use it to implement CryptMsgUpdate. --- dlls/crypt32/msg.c | 13 +++++++++++-- dlls/crypt32/tests/msg.c | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index 3c28230..5368515 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -32,11 +32,15 @@ typedef void (*CryptMsgCloseFunc)(HCRYPTMSG msg); typedef BOOL (*CryptMsgGetParamFunc)(HCRYPTMSG hCryptMsg, DWORD dwParamType, DWORD dwIndex, void *pvData, DWORD *pcbData); +typedef BOOL (*CryptMsgUpdateFunc)(HCRYPTMSG hCryptMsg, const BYTE *pbData, + DWORD cbData, BOOL fFinal); + typedef struct _CryptMsgBase { LONG ref; DWORD open_flags; CryptMsgCloseFunc close; + CryptMsgUpdateFunc update; CryptMsgGetParamFunc get_param; } CryptMsgBase; @@ -171,8 +175,13 @@ BOOL WINAPI CryptMsgClose(HCRYPTMSG hCryptMsg) BOOL WINAPI CryptMsgUpdate(HCRYPTMSG hCryptMsg, const BYTE *pbData, DWORD cbData, BOOL fFinal) { - FIXME("(%p, %p, %d, %d): stub\n", hCryptMsg, pbData, cbData, fFinal); - return TRUE; + CryptMsgBase *msg = (CryptMsgBase *)hCryptMsg; + BOOL ret = FALSE; + + TRACE("(%p, %p, %d, %d)\n", hCryptMsg, pbData, cbData, fFinal); + if (msg && msg->update) + ret = msg->update(hCryptMsg, pbData, cbData, fFinal); + return ret; } BOOL WINAPI CryptMsgGetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType, diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 9d7c3c6..df5e83f 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -314,6 +314,7 @@ static void test_data_msg_update(void) "Expected CRYPT_E_MSG_ERROR, got %x\n", GetLastError()); /* Updating it with final = TRUE succeeds */ ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); + todo_wine ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); /* Any subsequent update will fail, as the last was final */ SetLastError(0xdeadbeef); @@ -354,6 +355,7 @@ static void test_data_msg_update(void) ok(!ret && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", GetLastError()); ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); + todo_wine ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); CryptMsgClose(msg); }
1
0
0
0
Juan Lang : crypt32: Add a get param function, use it to implement CryptMsgGetParam.
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: d5e784bdaf7641eafd3bed773f708f39a1eea8e0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d5e784bdaf7641eafd3bed773…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:49:55 2007 -0700 crypt32: Add a get param function, use it to implement CryptMsgGetParam. --- dlls/crypt32/msg.c | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index ebd7b65..3c28230 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -29,11 +29,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt); */ typedef void (*CryptMsgCloseFunc)(HCRYPTMSG msg); +typedef BOOL (*CryptMsgGetParamFunc)(HCRYPTMSG hCryptMsg, DWORD dwParamType, + DWORD dwIndex, void *pvData, DWORD *pcbData); + typedef struct _CryptMsgBase { - LONG ref; - DWORD open_flags; - CryptMsgCloseFunc close; + LONG ref; + DWORD open_flags; + CryptMsgCloseFunc close; + CryptMsgGetParamFunc get_param; } CryptMsgBase; static inline void CryptMsgBase_Init(CryptMsgBase *msg, DWORD dwFlags) @@ -174,7 +178,12 @@ BOOL WINAPI CryptMsgUpdate(HCRYPTMSG hCryptMsg, const BYTE *pbData, BOOL WINAPI CryptMsgGetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType, DWORD dwIndex, void *pvData, DWORD *pcbData) { - FIXME("(%p, %d, %d, %p, %p): stub\n", hCryptMsg, dwParamType, dwIndex, + CryptMsgBase *msg = (CryptMsgBase *)hCryptMsg; + BOOL ret = FALSE; + + TRACE("(%p, %d, %d, %p, %p)\n", hCryptMsg, dwParamType, dwIndex, pvData, pcbData); - return FALSE; + if (msg && msg->get_param) + ret = msg->get_param(hCryptMsg, dwParamType, dwIndex, pvData, pcbData); + return ret; }
1
0
0
0
Juan Lang : crypt32: Stub CryptMsgOpenToEncode for data messages.
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: fa0f5bd066b6514a14e877fad9dd7836ef5f4ae0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fa0f5bd066b6514a14e877fad…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:49:06 2007 -0700 crypt32: Stub CryptMsgOpenToEncode for data messages. --- dlls/crypt32/msg.c | 27 +++++++++++++++++++++++++++ dlls/crypt32/tests/msg.c | 3 --- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index f806838..ebd7b65 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -42,6 +42,30 @@ static inline void CryptMsgBase_Init(CryptMsgBase *msg, DWORD dwFlags) msg->open_flags = dwFlags; } +typedef struct _CDataEncodeMsg +{ + CryptMsgBase base; +} CDataEncodeMsg; + +static HCRYPTMSG CDataEncodeMsg_Open(DWORD dwFlags, const void *pvMsgEncodeInfo, + LPSTR pszInnerContentObjID, PCMSG_STREAM_INFO pStreamInfo) +{ + CDataEncodeMsg *msg; + + if (pvMsgEncodeInfo) + { + SetLastError(E_INVALIDARG); + return NULL; + } + FIXME("semi-stub\n"); + msg = CryptMemAlloc(sizeof(CDataEncodeMsg)); + if (msg) + { + CryptMsgBase_Init((CryptMsgBase *)msg, dwFlags); + } + return (HCRYPTMSG)msg; +} + static inline const char *MSG_TYPE_STR(DWORD type) { switch (type) @@ -76,6 +100,9 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags, switch (dwMsgType) { case CMSG_DATA: + msg = CDataEncodeMsg_Open(dwFlags, pvMsgEncodeInfo, + pszInnerContentObjID, pStreamInfo); + break; case CMSG_SIGNED: case CMSG_ENVELOPED: case CMSG_HASHED: diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 1895f82..9d7c3c6 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -275,7 +275,6 @@ static void test_msg_close(void) ret = CryptMsgClose((HCRYPTMSG)1); msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL, NULL); - todo_wine ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError()); ret = CryptMsgClose(msg); ok(ret, "CryptMsgClose failed: %x\n", GetLastError()); @@ -290,13 +289,11 @@ static void test_data_msg_open(void) SetLastError(0xdeadbeef); msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, &hashInfo, NULL, NULL); - todo_wine { ok(!msg && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", GetLastError()); msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL, NULL); ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError()); - } CryptMsgClose(msg); }
1
0
0
0
Juan Lang : crypt32: Test CryptMsgGetParam for data messages opened to encode.
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: e829833986de44ee1ab950594589243dce6815c0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e829833986de44ee1ab950594…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:46:55 2007 -0700 crypt32: Test CryptMsgGetParam for data messages opened to encode. --- dlls/crypt32/tests/msg.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 2b0b3fe..1895f82 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -361,10 +361,48 @@ static void test_data_msg_update(void) CryptMsgClose(msg); } +static void test_data_msg_get_param(void) +{ + HCRYPTMSG msg; + DWORD size; + BOOL ret; + + msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL, + NULL); + + /* Content and bare content are always gettable */ + size = 0; + ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0, NULL, &size); + todo_wine { + ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError()); + size = 0; + ret = CryptMsgGetParam(msg, CMSG_BARE_CONTENT_PARAM, 0, NULL, &size); + ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError()); + /* But for this type of message, the signer and hash aren't applicable, + * and the type isn't available. + */ + size = 0; + SetLastError(0xdeadbeef); + ret = CryptMsgGetParam(msg, CMSG_ENCODED_SIGNER, 0, NULL, &size); + ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE, + "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size); + ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE, + "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError()); + ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, NULL, &size); + ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE, + "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError()); + } + + CryptMsgClose(msg); +} + static void test_data_msg(void) { test_data_msg_open(); test_data_msg_update(); + test_data_msg_get_param(); } START_TEST(msg)
1
0
0
0
Juan Lang : crypt32: Test CryptMsgUpdate for data messages opened to encode .
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: bd05e2abe33d042675b56a3d066a3762463e15ca URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bd05e2abe33d042675b56a3d0…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:46:33 2007 -0700 crypt32: Test CryptMsgUpdate for data messages opened to encode. --- dlls/crypt32/tests/msg.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 62 insertions(+), 0 deletions(-) diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 8bebdb9..2b0b3fe 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -300,9 +300,71 @@ static void test_data_msg_open(void) CryptMsgClose(msg); } +static const BYTE msgData[] = { 1, 2, 3, 4 }; + +static void test_data_msg_update(void) +{ + HCRYPTMSG msg; + BOOL ret; + + msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL, + NULL); + /* Can't update a message that wasn't opened detached with final = FALSE */ + SetLastError(0xdeadbeef); + ret = CryptMsgUpdate(msg, NULL, 0, FALSE); + todo_wine + ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR, + "Expected CRYPT_E_MSG_ERROR, got %x\n", GetLastError()); + /* Updating it with final = TRUE succeeds */ + ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); + ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); + /* Any subsequent update will fail, as the last was final */ + SetLastError(0xdeadbeef); + ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); + todo_wine + ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR, + "Expected CRYPT_E_MSG_ERROR, got %x\n", GetLastError()); + CryptMsgClose(msg); + + msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL, + NULL); + /* Can't update a message with no data */ + SetLastError(0xdeadbeef); + ret = CryptMsgUpdate(msg, NULL, 0, TRUE); + todo_wine { + ok(!ret && GetLastError() == E_INVALIDARG, + "Expected E_INVALIDARG, got %x\n", GetLastError()); + /* Curiously, a valid update will now fail as well, presumably because of + * the last (invalid, but final) update. + */ + ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); + ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR, + "Expected CRYPT_E_MSG_ERROR, got %x\n", GetLastError()); + } + CryptMsgClose(msg); + + msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, CMSG_DETACHED_FLAG, + CMSG_DATA, NULL, NULL, NULL); + /* Dont appear to be able to update CMSG-DATA with non-final updates */ + SetLastError(0xdeadbeef); + ret = CryptMsgUpdate(msg, NULL, 0, FALSE); + todo_wine + ok(!ret && GetLastError() == E_INVALIDARG, + "Expected E_INVALIDARG, got %x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE); + todo_wine + ok(!ret && GetLastError() == E_INVALIDARG, + "Expected E_INVALIDARG, got %x\n", GetLastError()); + ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); + ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); + CryptMsgClose(msg); +} + static void test_data_msg(void) { test_data_msg_open(); + test_data_msg_update(); } START_TEST(msg)
1
0
0
0
Juan Lang : crypt32: Test CryptMsgOpenToEncode for data messages.
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: a581855d263ad259ba63e19856a55a8b0cd420a0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a581855d263ad259ba63e1985…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:46:08 2007 -0700 crypt32: Test CryptMsgOpenToEncode for data messages. --- dlls/crypt32/tests/msg.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 035a40c..8bebdb9 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -281,6 +281,30 @@ static void test_msg_close(void) ok(ret, "CryptMsgClose failed: %x\n", GetLastError()); } +static void test_data_msg_open(void) +{ + HCRYPTMSG msg; + CMSG_HASHED_ENCODE_INFO hashInfo = { 0 }; + + /* The data message type takes no additional info */ + SetLastError(0xdeadbeef); + msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, &hashInfo, + NULL, NULL); + todo_wine { + ok(!msg && GetLastError() == E_INVALIDARG, + "Expected E_INVALIDARG, got %x\n", GetLastError()); + msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL, + NULL); + ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError()); + } + CryptMsgClose(msg); +} + +static void test_data_msg(void) +{ + test_data_msg_open(); +} + START_TEST(msg) { /* Basic parameter checking tests */ @@ -288,4 +312,7 @@ START_TEST(msg) test_msg_open_to_decode(); test_msg_get_param(); test_msg_close(); + + /* Message-type specific tests */ + test_data_msg(); }
1
0
0
0
Juan Lang : crypt32: Add base message type and use it to implement CryptMsgDuplicate and CryptMsgClose .
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: b790a09efbd02369b2e3bf0db8a946a15e0a502c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b790a09efbd02369b2e3bf0db…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:45:29 2007 -0700 crypt32: Add base message type and use it to implement CryptMsgDuplicate and CryptMsgClose. --- dlls/crypt32/msg.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 40 insertions(+), 2 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index a25affa..f806838 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -24,6 +24,24 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt); +/* Called when a message's ref count reaches zero. Free any message-specific + * data here. + */ +typedef void (*CryptMsgCloseFunc)(HCRYPTMSG msg); + +typedef struct _CryptMsgBase +{ + LONG ref; + DWORD open_flags; + CryptMsgCloseFunc close; +} CryptMsgBase; + +static inline void CryptMsgBase_Init(CryptMsgBase *msg, DWORD dwFlags) +{ + msg->ref = 1; + msg->open_flags = dwFlags; +} + static inline const char *MSG_TYPE_STR(DWORD type) { switch (type) @@ -89,13 +107,33 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, HCRYPTMSG WINAPI CryptMsgDuplicate(HCRYPTMSG hCryptMsg) { - FIXME("(%p): stub\n", hCryptMsg); + TRACE("(%p)\n", hCryptMsg); + + if (hCryptMsg) + { + CryptMsgBase *msg = (CryptMsgBase *)hCryptMsg; + + InterlockedIncrement(&msg->ref); + } return hCryptMsg; } BOOL WINAPI CryptMsgClose(HCRYPTMSG hCryptMsg) { - FIXME("(%p): stub\n", hCryptMsg); + TRACE("(%p)\n", hCryptMsg); + + if (hCryptMsg) + { + CryptMsgBase *msg = (CryptMsgBase *)hCryptMsg; + + if (InterlockedDecrement(&msg->ref) == 0) + { + TRACE("freeing %p\n", msg); + if (msg->close) + msg->close(msg); + CryptMemFree(msg); + } + } return TRUE; }
1
0
0
0
Juan Lang : crypt32: Add basic parameter checking to CryptMsgOpenTo*.
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: 1c837f16ace9217bcad618149c85d6932542fde6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1c837f16ace9217bcad618149…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:44:33 2007 -0700 crypt32: Add basic parameter checking to CryptMsgOpenTo*. --- dlls/crypt32/msg.c | 49 ++++++++++++++++++++++++++++++++++++++++++++- dlls/crypt32/tests/msg.c | 7 ------ 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index d00d68e..a25affa 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -24,13 +24,52 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt); +static inline const char *MSG_TYPE_STR(DWORD type) +{ + switch (type) + { +#define _x(x) case (x): return #x + _x(CMSG_DATA); + _x(CMSG_SIGNED); + _x(CMSG_ENVELOPED); + _x(CMSG_SIGNED_AND_ENVELOPED); + _x(CMSG_HASHED); + _x(CMSG_ENCRYPTED); +#undef _x + default: + return wine_dbg_sprintf("unknown (%d)", type); + } +} + HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags, DWORD dwMsgType, const void *pvMsgEncodeInfo, LPSTR pszInnerContentObjID, PCMSG_STREAM_INFO pStreamInfo) { - FIXME("(%08x, %08x, %08x, %p, %s, %p): stub\n", dwMsgEncodingType, dwFlags, + HCRYPTMSG msg = NULL; + + TRACE("(%08x, %08x, %08x, %p, %s, %p)\n", dwMsgEncodingType, dwFlags, dwMsgType, pvMsgEncodeInfo, debugstr_a(pszInnerContentObjID), pStreamInfo); - return NULL; + + if (GET_CMSG_ENCODING_TYPE(dwMsgEncodingType) != PKCS_7_ASN_ENCODING) + { + SetLastError(E_INVALIDARG); + return NULL; + } + switch (dwMsgType) + { + case CMSG_DATA: + case CMSG_SIGNED: + case CMSG_ENVELOPED: + case CMSG_HASHED: + FIXME("unimplemented for type %s\n", MSG_TYPE_STR(dwMsgType)); + break; + case CMSG_SIGNED_AND_ENVELOPED: + case CMSG_ENCRYPTED: + /* defined but invalid, fall through */ + default: + SetLastError(CRYPT_E_INVALID_MSG_TYPE); + } + return msg; } HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, @@ -39,6 +78,12 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, { FIXME("(%08x, %08x, %08x, %08lx, %p, %p): stub\n", dwMsgEncodingType, dwFlags, dwMsgType, hCryptProv, pRecipientInfo, pStreamInfo); + + if (GET_CMSG_ENCODING_TYPE(dwMsgEncodingType) != PKCS_7_ASN_ENCODING) + { + SetLastError(E_INVALIDARG); + return NULL; + } return NULL; } diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index acdbeca..035a40c 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -43,19 +43,16 @@ static void test_msg_open_to_encode(void) /* Bad encodings */ SetLastError(0xdeadbeef); msg = CryptMsgOpenToEncode(0, 0, 0, NULL, NULL, NULL); - todo_wine { ok(!msg && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", GetLastError()); SetLastError(0xdeadbeef); msg = CryptMsgOpenToEncode(X509_ASN_ENCODING, 0, 0, NULL, NULL, NULL); ok(!msg && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", GetLastError()); - } /* Bad message types */ SetLastError(0xdeadbeef); msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, 0, NULL, NULL, NULL); - todo_wine { ok(!msg && GetLastError() == CRYPT_E_INVALID_MSG_TYPE, "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError()); SetLastError(0xdeadbeef); @@ -73,7 +70,6 @@ static void test_msg_open_to_encode(void) NULL, NULL); ok(!msg && GetLastError() == CRYPT_E_INVALID_MSG_TYPE, "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError()); - } } static void test_msg_open_to_decode(void) @@ -83,13 +79,11 @@ static void test_msg_open_to_decode(void) SetLastError(0xdeadbeef); msg = CryptMsgOpenToDecode(0, 0, 0, 0, NULL, NULL); - todo_wine ok(!msg && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", GetLastError()); /* Bad encodings */ SetLastError(0xdeadbeef); - todo_wine { msg = CryptMsgOpenToDecode(X509_ASN_ENCODING, 0, 0, 0, NULL, NULL); ok(!msg && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", GetLastError()); @@ -97,7 +91,6 @@ static void test_msg_open_to_decode(void) msg = CryptMsgOpenToDecode(X509_ASN_ENCODING, 0, CMSG_DATA, 0, NULL, NULL); ok(!msg && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", GetLastError()); - } /* The message type can be explicit... */ msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, 0, NULL,
1
0
0
0
Juan Lang : crypt32: Add basic tests for CryptMsg functions.
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: 3de0e4ac48bedb67c0402ad8ad1de38521eecc83 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3de0e4ac48bedb67c0402ad8a…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:43:17 2007 -0700 crypt32: Add basic tests for CryptMsg functions. --- dlls/crypt32/tests/Makefile.in | 1 + dlls/crypt32/tests/msg.c | 298 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 299 insertions(+), 0 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=3de0e4ac48bedb67c0402…
1
0
0
0
Juan Lang : crypt32: Don't return fake HCRYPTMSG from CryptMsgOpenTo*.
by Alexandre Julliard
29 Jun '07
29 Jun '07
Module: wine Branch: master Commit: 6c054f057b75cf0257d78d50f70db5eafb5fc658 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6c054f057b75cf0257d78d50f…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Thu Jun 28 16:41:43 2007 -0700 crypt32: Don't return fake HCRYPTMSG from CryptMsgOpenTo*. --- dlls/crypt32/msg.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index 2377ae2..d00d68e 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -30,7 +30,7 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags, { FIXME("(%08x, %08x, %08x, %p, %s, %p): stub\n", dwMsgEncodingType, dwFlags, dwMsgType, pvMsgEncodeInfo, debugstr_a(pszInnerContentObjID), pStreamInfo); - return (HCRYPTMSG)1; + return NULL; } HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, @@ -39,7 +39,7 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, { FIXME("(%08x, %08x, %08x, %08lx, %p, %p): stub\n", dwMsgEncodingType, dwFlags, dwMsgType, hCryptProv, pRecipientInfo, pStreamInfo); - return (HCRYPTMSG)2; + return NULL; } HCRYPTMSG WINAPI CryptMsgDuplicate(HCRYPTMSG hCryptMsg)
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
86
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Results per page:
10
25
50
100
200