-2

I'm having problem with this code

Checking digital signature programmatically from Delphi

CertCount is always = 0

if (not ImageEnumerateCertificates(hExe, CERT_SECTION_TYPE_ANY, CertCount, nil, 0)) or (CertCount <> 1) then exit

I tried with "C:\Program Files (x86)\Windows Sidebar\sidebar.exe" and "C:\Windows\SysWOW64\calc.exe"

Community
  • 1
  • 1
Atak_Snajpera
  • 619
  • 9
  • 24

1 Answers1

2

That is to be expected. These system executables do not have digital signatures, at least not of the form that this API can enumerate. For its own executables Microsoft uses its own private mechanisms to secure their identity.

You can verify this by right clicking on these files and selecting the Properties action from the context menu. You will find that the dialog does not include a page listing digital signatures.

The code provided in the answer to which you link is, I believe, functioning correctly and as designed.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490