Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windows.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <stddef.h>
  8. #include <wincrypt.h>
  9. #include <imagehlp.h>
  10. #define MemAlloc malloc
  11. #define MemFree free
  12. #ifdef SIGN_DEBUG
  13. #define SIGN_DBGP(x) printf x
  14. #else // SIGN_DEBUG
  15. #define SIGN_DBGP(x)
  16. #endif // SIGN_DEBUG
  17. #include "../inc/pubblob.h" // needed by certvfy.inc
  18. #include "../inc/certvfy.inc" // VerifyFile()
  19. RTL_CRITICAL_SECTION VfyLock;
  20. /*****************************************************************************/
  21. void _cdecl main(int argc, char *argv[])
  22. {
  23. WCHAR szSourceFile[ MAX_PATH + 1];
  24. DWORD dwBc;
  25. if ( argc != 2 ) {
  26. printf( "Usage: %s PE_File_Name\n", argv[0] );
  27. exit(1);
  28. }
  29. RtlMultiByteToUnicodeN( szSourceFile, sizeof(szSourceFile), &dwBc,
  30. argv[1], (strlen(argv[1]) + 1) );
  31. RtlInitializeCriticalSection( &VfyLock );
  32. if( !VerifyFile( szSourceFile, &VfyLock ) ) {
  33. printf("Error verifying file!\n");
  34. exit(1);
  35. }
  36. printf("Verification successful.\n");
  37. exit(0);
  38. }