Why CryptCATAdminCalcHashFromFileHandle fails with a seemingly unexpected error code

CryptCATAdminCalcHashFromFileHandle can fail when evaluating a file path to an executable while setting the last error code to 0x800700c1.  It’s an HRESULT instead of just an error code, but the relevant portion of the error code is 0xc1 (193L).  That is the error code for ERROR_BAD_EXE_FORMAT.  In some cases, this will happen even though the…


Steps to sign a file using Signtool.exe

You may have a situation where you need to sign a file which may be an a. .exe b. .cab c. .cat d. .ocx e. .dll f. .stl Using the CryptoAPI “signtool.exe”, the files can be digitally signed. Digitally signing a file essentially involves two steps. 1. Obtaining a code signing certificate that has an…

2

SetWindowHookEx API with WH_JOURNALRECORD. This API fails with access denied (Error 5).

A while ago I came across a problem in which  SetWindowHookEx API with WH_JOURNALRECORD was failing with Access denied on Windows Vista. If you have the same problem you can do what I tried. 1)      Create and Embed an Application Manifest with Your Application. o   In our case we would need manifest with <requestedExecutionLevel level=”requireAdministrator”…