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.

123 lines
3.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2001
  5. //
  6. // File: signtool.h
  7. //
  8. // Contents: The SignTool console tool
  9. //
  10. // History: 4/30/2001 SCoyne Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #define MAX_RES_LEN 2048
  14. // Type definitions:
  15. enum COMMAND
  16. {
  17. CommandNone=0,
  18. CatDb,
  19. Sign,
  20. SignWizard,
  21. Timestamp,
  22. Verify,
  23. };
  24. enum CATDBSELECT
  25. {
  26. NoCatDb=0,
  27. FullAutoCatDb,
  28. SystemCatDb,
  29. DefaultCatDb,
  30. GuidCatDb
  31. };
  32. enum POLICY_CHOICE
  33. {
  34. SystemDriver=0,
  35. DefaultAuthenticode,
  36. GuidActionID
  37. };
  38. enum CATDB_COMMAND
  39. {
  40. UpdateCat=0,
  41. AddUniqueCat,
  42. RemoveCat
  43. };
  44. typedef struct _InputInfo {
  45. COMMAND Command;
  46. WCHAR **rgwszFileNames;
  47. DWORD NumFiles;
  48. CATDBSELECT CatDbSelect;
  49. GUID PolicyGuid;
  50. GUID CatDbGuid;
  51. CATDB_COMMAND CatDbCommand;
  52. CRYPT_HASH_BLOB SHA1;
  53. BOOL OpenMachineStore;
  54. POLICY_CHOICE Policy;
  55. BOOL Quiet;
  56. BOOL TSWarn;
  57. BOOL Verbose;
  58. BOOL HelpRequest;
  59. BOOL fIsWow64Process;
  60. DWORD dwPlatform;
  61. DWORD dwMajorVersion;
  62. DWORD dwMinorVersion;
  63. DWORD dwBuildNumber;
  64. WCHAR *wszCatFile;
  65. WCHAR *wszCertFile;
  66. WCHAR *wszContainerName;
  67. WCHAR *wszCSP;
  68. WCHAR *wszDescription;
  69. WCHAR *wszDescURL;
  70. WCHAR *wszEKU;
  71. #ifdef SIGNTOOL_LIST
  72. WCHAR *wszListFileName;
  73. WCHAR *wszListFileContents;
  74. #endif
  75. WCHAR *wszIssuerName;
  76. WCHAR *wszPassword;
  77. WCHAR *wszRootName;
  78. WCHAR *wszStoreName;
  79. WCHAR *wszSubjectName;
  80. WCHAR *wszTemplateName;
  81. WCHAR *wszTimeStampURL;
  82. WCHAR *wszVersion;
  83. } INPUTINFO;
  84. // Function prototypes:
  85. void PrintUsage(INPUTINFO *InputInfo);
  86. BOOL ParseInputs(int argc, WCHAR **targv, INPUTINFO *InputInfo);
  87. int SignTool_CatDb(INPUTINFO *InputInfo);
  88. int SignTool_Sign(INPUTINFO *InputInfo);
  89. int SignTool_SignWizard(INPUTINFO *InputInfo);
  90. int SignTool_Timestamp(INPUTINFO *InputInfo);
  91. int SignTool_Verify(INPUTINFO *InputInfo);
  92. // Error Functions:
  93. #ifdef SIGNTOOL_DEBUG
  94. #define ResErr if (gDebug) wprintf(L"%hs (%u):\n", __FILE__, __LINE__); Res_Err
  95. #define ResFormatErr if (gDebug) wprintf(L"%hs (%u):\n", __FILE__, __LINE__); ResFormat_Err
  96. #define FormatErrRet if (gDebug) wprintf(L"%hs (%u):\n", __FILE__, __LINE__); Format_ErrRet
  97. #else
  98. #define ResErr Res_Err
  99. #define ResFormatErr ResFormat_Err
  100. #define FormatErrRet Format_ErrRet
  101. #endif
  102. void ResOut(DWORD dwRes);
  103. void Res_Err(DWORD dwRes);
  104. void ResFormatOut(DWORD dwRes, ...);
  105. void ResFormat_Err(DWORD dwRes, ...);
  106. void Format_ErrRet(WCHAR *wszFunc, DWORD dwErr);
  107. // Helper Functions:
  108. BOOL GUIDFromWStr(GUID *guid, LPWSTR str);