Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error using CryptCreateHash

236 views
Skip to first unread message

Perro Flaco

unread,
Dec 28, 2005, 7:43:32 AM12/28/05
to
Hi everybody!

I've got a problem with the following piece of code:

if(CryptCreateHash(
hCryptProv,
CALG_MD5,
0,
0,
&hHash))
{
printf("An empty hash object has been created. \n");
} else {
MyHandleError("Error during CryptBeginHash (aqui)!\n");
}

When I run it, I got the following error code: 57. I found the
definition of this error code in Windows:

ERROR_ADAP_HDW_ERR
57 A network adapter hardware error occurred.

This code works with no error in XP Professional, but I've got this
error in XP Embedded. Any suggestion?

Thanks in advanced!

David Jones

unread,
Dec 28, 2005, 9:54:20 AM12/28/05
to
Perro Flaco wrote:

> Hi everybody!
>
> I've got a problem with the following piece of code:
>
> if(CryptCreateHash(
> hCryptProv,
> CALG_MD5,
> 0,
> 0,
> &hHash))
> {
> printf("An empty hash object has been created. \n");
> } else {
> MyHandleError("Error during CryptBeginHash (aqui)!\n");
> }
>

Are you sure CryptAcquireContext succeeded and gave you a valid
hCryptProv?

Does the cryptographic provider support MD5? In the embedded
version of the OS, I think you can pick and choose which
components go in the platform (since many embedded systems
don't have enough room for and don't really need a lot of
standard desktop features), so you should definitely make
sure MD5 support is included in your platform build.

> When I run it, I got the following error code: 57. I found the
> definition of this error code in Windows:
>
> ERROR_ADAP_HDW_ERR
> 57 A network adapter hardware error occurred.
>
> This code works with no error in XP Professional, but I've got this
> error in XP Embedded. Any suggestion?
>
> Thanks in advanced!
>

Are you sure it wasn't 0x57? That is ERROR_INVALID_PARAMETER
("The parameter is incorrect."), which makes a lot more sense
than a network adapter hardware error in this context.

Note: If you are using MS Visual C++ 6, you can use "err, hr"
in a watch window to give you the symbolic error code instead
of the number so you don't have to worry whether you're reading
hex or decimal.

David

0 new messages