Leaked source code of windows server 2003
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.

162 lines
5.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2001
  5. //
  6. // File: signtooldebug.cpp
  7. //
  8. // Contents: The SignTool console tool debug functions
  9. //
  10. // History: 4/30/2001 SCoyne Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include <windows.h>
  14. #include <unicode.h>
  15. #include <stdio.h>
  16. #include "signtool.h"
  17. #ifdef SIGNTOOL_DEBUG
  18. void PrintInputInfo(INPUTINFO *InputInfo)
  19. {
  20. wprintf(L"+Parsed Input Info\n");
  21. wprintf(L"|--Command = ");
  22. switch (InputInfo->Command)
  23. {
  24. case CommandNone:
  25. wprintf(L"CommandNone\n");
  26. break;
  27. case CatDb:
  28. wprintf(L"CatDb\n");
  29. break;
  30. case Sign:
  31. wprintf(L"Sign\n");
  32. break;
  33. case SignWizard:
  34. wprintf(L"SignWizard\n");
  35. break;
  36. case Timestamp:
  37. wprintf(L"Timestamp\n");
  38. break;
  39. case Verify:
  40. wprintf(L"Verify\n");
  41. break;
  42. default:
  43. wprintf(L"Unrecognized\n");
  44. }
  45. wprintf(L"|--CatDbSelect = ");
  46. switch (InputInfo->CatDbSelect)
  47. {
  48. case NoCatDb:
  49. wprintf(L"NoCatDb\n");
  50. break;
  51. case FullAutoCatDb:
  52. wprintf(L"FullAutoCatDb\n");
  53. break;
  54. case SystemCatDb:
  55. wprintf(L"SystemCatDb\n");
  56. break;
  57. case DefaultCatDb:
  58. wprintf(L"DefaultCatDb\n");
  59. break;
  60. case GuidCatDb:
  61. wprintf(L"GuidCatDb\n");
  62. break;
  63. default:
  64. wprintf(L"Invalid (%d)\n", (int)InputInfo->CatDbSelect);
  65. }
  66. wprintf(L"|--Number of Files = %d\n", InputInfo->NumFiles);
  67. wprintf(L"|-+FileNames\n");
  68. for (DWORD i=0; i<InputInfo->NumFiles; i++)
  69. {
  70. wprintf(L"| |--FileName #%d = %s\n", i, InputInfo->rgwszFileNames[i]);
  71. }
  72. wprintf(L"|--Catalog File = %s\n", InputInfo->wszCatFile);
  73. wprintf(L"|--Cert File = %s\n", InputInfo->wszCertFile);
  74. wprintf(L"|--Cert Template Name = %s\n", InputInfo->wszTemplateName);
  75. wprintf(L"|--CSP = %s\n", InputInfo->wszCSP);
  76. wprintf(L"|--Description = %s\n", InputInfo->wszDescription);
  77. wprintf(L"|--Description URL = %s\n", InputInfo->wszDescURL);
  78. #ifdef SIGNTOOL_LIST
  79. wprintf(L"|--File List = %s\n", InputInfo->wszListFileName);
  80. #endif
  81. wprintf(L"|--Policy Guid = ");
  82. wprintf(L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}\n",
  83. InputInfo->PolicyGuid.Data1, InputInfo->PolicyGuid.Data2,
  84. InputInfo->PolicyGuid.Data3, InputInfo->PolicyGuid.Data4[0],
  85. InputInfo->PolicyGuid.Data4[1], InputInfo->PolicyGuid.Data4[2],
  86. InputInfo->PolicyGuid.Data4[3], InputInfo->PolicyGuid.Data4[4],
  87. InputInfo->PolicyGuid.Data4[5], InputInfo->PolicyGuid.Data4[6],
  88. InputInfo->PolicyGuid.Data4[7]);
  89. wprintf(L"|--Catalog DB Guid = ");
  90. wprintf(L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}\n",
  91. InputInfo->CatDbGuid.Data1, InputInfo->CatDbGuid.Data2,
  92. InputInfo->CatDbGuid.Data3, InputInfo->CatDbGuid.Data4[0],
  93. InputInfo->CatDbGuid.Data4[1], InputInfo->CatDbGuid.Data4[2],
  94. InputInfo->CatDbGuid.Data4[3], InputInfo->CatDbGuid.Data4[4],
  95. InputInfo->CatDbGuid.Data4[5], InputInfo->CatDbGuid.Data4[6],
  96. InputInfo->CatDbGuid.Data4[7]);
  97. wprintf(L"|--Key Usage = %s\n", InputInfo->wszEKU);
  98. wprintf(L"|--Issuer = %s\n", InputInfo->wszIssuerName);
  99. wprintf(L"|--Key Container Name = %s\n", InputInfo->wszContainerName);
  100. wprintf(L"|--Password = %s\n", InputInfo->wszPassword);
  101. wprintf(L"|--Policy = ");
  102. switch (InputInfo->Policy)
  103. {
  104. case SystemDriver:
  105. wprintf(L"System Driver\n");
  106. break;
  107. case DefaultAuthenticode:
  108. wprintf(L"Default Authenticode\n");
  109. break;
  110. case GuidActionID:
  111. wprintf(L"Guid ActionID\n");
  112. break;
  113. default:
  114. wprintf(L"Invalid (%d)\n", (int)InputInfo->Policy);
  115. }
  116. wprintf(L"|--Root Name = %s\n", InputInfo->wszRootName);
  117. wprintf(L"|--SHA1 Hash = ");
  118. for (DWORD b=0; b<InputInfo->SHA1.cbData; b++)
  119. {
  120. wprintf(L"%02X", InputInfo->SHA1.pbData[b]);
  121. }
  122. wprintf(L"\n|--Cert Store Name = %s\n", InputInfo->wszStoreName);
  123. wprintf(L"|--Open Machine Store = ");
  124. if (InputInfo->OpenMachineStore)
  125. wprintf(L"TRUE\n");
  126. else
  127. wprintf(L"FALSE\n");
  128. wprintf(L"|--Subject Name = %s\n", InputInfo->wszSubjectName);
  129. wprintf(L"|--Timestamp URL = %s\n", InputInfo->wszTimeStampURL);
  130. wprintf(L"|-+OS Version = %s\n", InputInfo->wszVersion);
  131. wprintf(L"| |--Platform = %u\n", InputInfo->dwPlatform);
  132. wprintf(L"| |--Major Version = %u\n", InputInfo->dwMajorVersion);
  133. wprintf(L"| |--Minor Version = %u\n", InputInfo->dwMinorVersion);
  134. wprintf(L"| |--Build Number = %u\n", InputInfo->dwBuildNumber);
  135. wprintf(L"|--Help Request = ");
  136. if (InputInfo->HelpRequest)
  137. wprintf(L"TRUE\n");
  138. else
  139. wprintf(L"FALSE\n");
  140. wprintf(L"|--Quiet = ");
  141. if (InputInfo->Quiet)
  142. wprintf(L"TRUE\n");
  143. else
  144. wprintf(L"FALSE\n");
  145. wprintf(L"|--TSWarn = ");
  146. if (InputInfo->TSWarn)
  147. wprintf(L"TRUE\n");
  148. else
  149. wprintf(L"FALSE\n");
  150. wprintf(L"|--Verbose = ");
  151. if (InputInfo->Verbose)
  152. wprintf(L"TRUE\n");
  153. else
  154. wprintf(L"FALSE\n");
  155. }
  156. #endif // SIGNTOOL_DEBUG