#172 CryptoAPI needs new functions


Mingw 1.1:

I see link errors when attempting to link an
application using CryptDuplicateHash() and
CryptDuplicateKey(). There are relatively new
functions, introduced only in Windows 98 and Windows
2000, and younger than most of the rest of CryptoAPI.
They are not declared in mingw 1.1's wincrypt.h.

bar.o: In function 'foo':
bar.c:749: undefined reference to `CryptDuplicateHash@16'
bar.o: In function `foo':
bar.c:779: undefined reference to `CryptDuplicateKey@16'


  • Danny Smith

    Danny Smith - 2002-08-12
    • assigned_to: earnie --> dannysmith
  • Danny Smith

    Danny Smith - 2002-08-12

    Logged In: YES

    Thanks for the report. I'll add the declarations to

    However, the functions are exported from advapi32.dll
    so you need to -ladvapi32 (the stubs are already there).


  • Mark Schreiber

    Mark Schreiber - 2002-08-13

    Logged In: YES

    Hmm. Odd. If -ladvapi32 is all that's needed, shouldn't
    this work?

    #include <windows.h>
    #include <wincrypt.h>

    int main (void)
    CryptGetUserKey(0, 0, 0);
    CryptDuplicateKey(0, 0, 0, 0);
    return 1;

    gcc test.c -Wall -ladvapi32

    test.c: In function `main':
    test.c:7: warning: implicit declaration of function
    undefined reference to `CryptDuplicateKey'

    There is no error regarding CryptGetUserKey() -- just

  • Danny Smith

    Danny Smith - 2002-08-13
    • status: open --> closed-fixed
  • Danny Smith

    Danny Smith - 2002-08-13

    Logged In: YES

    No. An implicit decalaration is not good enough. These
    are __stdcall functions and you need to tell the
    compiler that, else you'll run into stack problems.
    The __stdcall decorations are there to protect against
    such a mismatch.

    As I indicated earlier I have added those two functions
    to wincrypt.h


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks