Juan Lang : crypt32: Allow updating data messages with no content.

Alexandre Julliard julliard at winehq.org
Fri Feb 11 11:16:33 CST 2011


Module: wine
Branch: master
Commit: 2910cf9660d4e6a3791289286d364ea1a22d343c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2910cf9660d4e6a3791289286d364ea1a22d343c

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Feb 10 11:58:17 2011 -0800

crypt32: Allow updating data messages with no content.

---

 dlls/crypt32/msg.c       |   21 ++++++++-------------
 dlls/crypt32/tests/msg.c |    1 -
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index ee80f1a..97860e5 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -277,20 +277,15 @@ static BOOL CDataEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
         }
         else
         {
-            msg->base.state = MsgStateFinalized;
-            if (!cbData)
-                SetLastError(E_INVALIDARG);
-            else
-            {
-                CRYPT_DATA_BLOB blob = { cbData, (LPBYTE)pbData };
+            CRYPT_DATA_BLOB blob = { cbData, (LPBYTE)pbData };
 
-                /* non-streamed data messages don't allow non-final updates,
-                 * don't bother checking whether data already exist, they can't.
-                 */
-                ret = CryptEncodeObjectEx(X509_ASN_ENCODING, X509_OCTET_STRING,
-                 &blob, CRYPT_ENCODE_ALLOC_FLAG, NULL, &msg->bare_content,
-                 &msg->bare_content_len);
-            }
+            msg->base.state = MsgStateFinalized;
+            /* non-streamed data messages don't allow non-final updates,
+             * don't bother checking whether data already exist, they can't.
+             */
+            ret = CryptEncodeObjectEx(X509_ASN_ENCODING, X509_OCTET_STRING,
+             &blob, CRYPT_ENCODE_ALLOC_FLAG, NULL, &msg->bare_content,
+             &msg->bare_content_len);
         }
     }
     return ret;
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 95a0a29..de55d6b 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -394,7 +394,6 @@ static void test_data_msg_update(void)
      NULL);
     /* Starting with Vista, can update a message with no data. */
     ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
-    todo_wine
     ok(ret || broken(!ret), "CryptMsgUpdate failed: %08x\n", GetLastError());
     if (ret)
     {




More information about the wine-cvs mailing list