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.

143 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. delcont.c
  5. Abstract:
  6. Delete Win32 Crypto Container.
  7. Author:
  8. Keith Moore (keithmo) 19-Feb-1998
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. //
  14. // Private constants.
  15. //
  16. #define TEST_HRESULT(api) \
  17. if( FAILED(result) ) { \
  18. \
  19. printf( \
  20. "%s:%lu failed, error %08lx\n", \
  21. api, \
  22. __LINE__, \
  23. result \
  24. ); \
  25. \
  26. goto cleanup; \
  27. \
  28. } else
  29. //
  30. // Private types.
  31. //
  32. //
  33. // Private globals.
  34. //
  35. #ifdef _NO_TRACING_
  36. DECLARE_DEBUG_PRINTS_OBJECT()
  37. #endif
  38. //
  39. // Private prototypes.
  40. //
  41. //
  42. // Public functions.
  43. //
  44. INT
  45. __cdecl
  46. main(
  47. INT argc,
  48. CHAR * argv[]
  49. )
  50. {
  51. HRESULT result;
  52. DWORD flags;
  53. PSTR container;
  54. //
  55. // Initialize debug stuff.
  56. //
  57. #ifdef _NO_TRACING_
  58. CREATE_DEBUG_PRINT_OBJECT( "delcont" );
  59. #endif
  60. //
  61. // Validate the arguments.
  62. //
  63. flags = 0;
  64. container = argv[1];
  65. if( container != NULL ) {
  66. if( _stricmp( container, "-m" ) == 0 ) {
  67. flags = CRYPT_MACHINE_KEYSET;
  68. container = argv[2];
  69. }
  70. }
  71. if( !container ){
  72. printf(
  73. "use: delcont [-m] container_name\n"
  74. "\n"
  75. " -m : Delete a machine keyset. Note: This is a very dangerous\n"
  76. " option that can leave IIS in an unusable state requiring\n"
  77. " reinstallation. Use at your own risk.\n"
  78. );
  79. return 1;
  80. }
  81. //
  82. // Initialize the crypto package.
  83. //
  84. result = IISCryptoInitialize();
  85. TEST_HRESULT( "IISCryptoInitialize()" );
  86. //
  87. // Delete the container.
  88. //
  89. result = IISCryptoDeleteContainerByName(
  90. container,
  91. flags
  92. );
  93. TEST_HRESULT( "IISDeleteContainerByName()" );
  94. cleanup:
  95. (VOID)IISCryptoTerminate();
  96. return 0;
  97. } // main
  98. //
  99. // Private functions.
  100. //