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.

128 lines
2.4 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. main.cpp
  5. Abstract:
  6. This file contains the unit test for the Security objects.
  7. Revision History:
  8. Davide Massarenti (Dmassare) 03/22/2000
  9. created
  10. ******************************************************************************/
  11. #include "StdAfx.h"
  12. #include <initguid.h>
  13. #include "HelpServiceTypeLib.h"
  14. #include "HelpServiceTypeLib_i.c"
  15. ////////////////////////////////////////////////////////////////////////////////
  16. static HRESULT CreateGroup()
  17. {
  18. __HCP_FUNC_ENTRY( "CreateGroup" );
  19. HRESULT hr;
  20. CPCHAccounts acc;
  21. __MPC_EXIT_IF_METHOD_FAILS(hr, acc.CreateGroup( L"TEST_GROUP1", L"This is a test group." ));
  22. hr = S_OK;
  23. __HCP_FUNC_CLEANUP;
  24. __HCP_FUNC_EXIT(hr)
  25. }
  26. static HRESULT CreateUser()
  27. {
  28. __HCP_FUNC_ENTRY( "CreateUser" );
  29. HRESULT hr;
  30. CPCHAccounts acc;
  31. __MPC_EXIT_IF_METHOD_FAILS(hr, acc.CreateUser( L"TEST_USER1", L"This is a long password;;;;", L"Test User", L"This is a test user." ));
  32. hr = S_OK;
  33. __HCP_FUNC_CLEANUP;
  34. __HCP_FUNC_EXIT(hr)
  35. }
  36. static HRESULT DestroyUser()
  37. {
  38. __HCP_FUNC_ENTRY( "DestroyUser" );
  39. HRESULT hr;
  40. CPCHAccounts acc;
  41. __MPC_EXIT_IF_METHOD_FAILS(hr, acc.DeleteUser( L"TEST_USER1" ));
  42. hr = S_OK;
  43. __HCP_FUNC_CLEANUP;
  44. __HCP_FUNC_EXIT(hr)
  45. }
  46. static HRESULT DestroyGroup()
  47. {
  48. __HCP_FUNC_ENTRY( "DestroyGroup" );
  49. HRESULT hr;
  50. CPCHAccounts acc;
  51. __MPC_EXIT_IF_METHOD_FAILS(hr, acc.DeleteGroup( L"TEST_GROUP1" ));
  52. hr = S_OK;
  53. __HCP_FUNC_CLEANUP;
  54. __HCP_FUNC_EXIT(hr)
  55. }
  56. ////////////////////////////////////////////////////////////////////////////////
  57. static HRESULT RunTests( int argc, WCHAR **argv )
  58. {
  59. __HCP_FUNC_ENTRY( "RunTests" );
  60. HRESULT hr;
  61. __MPC_EXIT_IF_METHOD_FAILS(hr, CreateGroup());
  62. __MPC_EXIT_IF_METHOD_FAILS(hr, CreateUser ());
  63. __MPC_EXIT_IF_METHOD_FAILS(hr, DestroyUser ());
  64. __MPC_EXIT_IF_METHOD_FAILS(hr, DestroyGroup());
  65. hr = S_OK;
  66. __HCP_FUNC_CLEANUP;
  67. __HCP_FUNC_EXIT(hr);
  68. }
  69. int __cdecl wmain( int argc, WCHAR **argv, WCHAR **envp)
  70. {
  71. HRESULT hr;
  72. if(SUCCEEDED(hr = ::CoInitializeEx( NULL, COINIT_MULTITHREADED )))
  73. {
  74. hr = RunTests( argc, argv );
  75. ::CoUninitialize();
  76. }
  77. return FAILED(hr) ? 10 : 0;
  78. }