It is definitely valid to call CryptDecrypt multiple times with the same key. Calls with Final = FALSE change the internal state of the key, calls with Final = TRUE restore the initial state. Subsequent calls with Final = TRUE should return the same result.

Your testcase fails because CryptDecrypt changes the value of dwLen, which you do not restore before calling the function again.

Regards,
Daniel


2013/6/27 Qian Hong <fracting@gmail.com>
Hello,

I was investigating Bug 33898 [1] hardly and get a partial result, I
have a special test case demonstrate the behavior of Aliwangwang [2],
however, I failed to expand the special case to a common test case. My
attempting is shown in [3]. The hack in [3] works for Aliwangwang, but
the test case in [3] doesn't fully pass on Windows as I expected [4].

I'm not sure if there is an APP bug rather than Wine bug here, is it
valid to call multiple CryptDecrypt with only one CryptDeriveKey
called? If true, is it correct to assume the second CryptDecrypt call
should behavior identical as the first one?
If there is a Wine bug here, what is the right way to write a common
test case for it?

Any hints on this bug is great appreciated!

Thanks very much!

[1] http://bugs.winehq.org/show_bug.cgi?id=33898
[2] http://bugs.winehq.org/attachment.cgi?id=44996
[3] http://bugs.winehq.org/attachment.cgi?id=44997&action=diff
[4] https://testbot.winehq.org/JobDetails.pl?Key=26138

--
Regards,
Qian Hong

-
http://www.winehq.org