Results 1 to 3 of 3

Thread: CryptoAPI-Functions are missing ?

  1. #1
    Guest

    Angry

    hi,
    I have a little problem with the CryptoApi (or better with advapi.dll) shipped with WindowsNT

    When I try to access to the functions "CryptDuplicateKey" and "CryptDuplicateHash" I allways get an error, that the entrypoint was not found.
    So these functions are described at the msdn I think, that they must be there (somewhere)

    So, have anyone an idea, how they are accessed correctly or if they are not implemented ? (or any other good idea)

    thx, Robert

  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Not sure

    If you tell me your Declare statement I can cross reference it against the MSDN documentation. Basically the info I have here tells me that these methods are from advapi32.lib which I guess would translate to advapi32.dll.

    IN case it helps, here is the documentation for one of the C functions...


    Code:
    CryptDuplicateHash
    The CryptDuplicateHash function is used to make an exact copy of a hash including its state.
    
    BOOL WINAPI CryptDuplicateHash(
      HCRYPTHASH hHash,    // in
      DWORD *pdwReserved,  // in
      DWORD dwFlags,       // in
      HCRYPTHASH *phHash   // out
    );
     
    Parameters
    hHash 
    Handle of the hash to be duplicated. 
    pdwReserved 
    Reserved for future use and must always be zero. 
    dwFlags 
    Reserved for future use and must always be zero. 
    phHash 
    Address of the handle of the duplicated hash. 
    Return Values
    If the function succeeds, the return value is TRUE. 
    
    If the function fails, the return value is FALSE. For extended error information, call GetLastError.
    
    The error code prefaced by "NTE" is generated by the particular CSP you are using. Some possible error codes follow.
    
    Value Meaning 
    ERROR_CALL_NOT
    _IMPLEMENTED Because this is a new function, existing CSPs cannot implement it. This error is returned if the CSP does not support this function. 
    ERROR_INVALID
    _PARAMETER One of the parameters contains an invalid value. This is most often an invalid pointer. 
    NTE_BAD_HASH The handle to the original hash is not valid. 
    
    
    Remarks
    CryptDuplicateHash makes a copy of a hash and the exact state of the hash. This function might be used if a calling application needed to generate two hashes, but both hashes had to start with some common data hashed. A hash might be created, the common data hashed, a duplicate made with the CryptDuplicateHash function, and then the data unique to each hash would be added.
    
    CryptDestroyHash must be called to destroy any hashes that are created with CryptDuplicateHash. Destroying the original hash does not cause the duplicate hash to be destroyed. Once a duplicate hash is made, it is separate from the original hash. There is no shared state between the two hashes.
    Cheers
    Paul Lewis

  3. #3
    Guest

    so, here's the declaration :

    Private Declare Function CryptDuplicateHash Lib "advapi32.dll" (ByRef hHash As Long, ByRef pdwReserved As Long, ByVal dwFlags As Long, ByRef phHash As Long) As Long

    as far as i understand the msdn, it should be the right way to access it.

    I think, that the function has an another name in the advapi32.dll

    thx,
    Robert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width