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.

165 lines
5.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: main.cxx
  8. //
  9. //--------------------------------------------------------------------------
  10. // test routine for create/delete
  11. #include "rpc.h"
  12. #include "rpcndr.h"
  13. #include <stdio.h>
  14. // copied from Catalin's test-------------------
  15. RPC_DISPATCH_TABLE nstest01_v1_0_DispatchTable =
  16. {
  17. 2,
  18. nstest01_table
  19. };
  20. extern RPC_DISPATCH_TABLE nstest01_v1_0_DispatchTable;
  21. static const RPC_SERVER_INTERFACE nstest01___RpcServerInterface =
  22. {
  23. sizeof(RPC_SERVER_INTERFACE),
  24. {{0xdeadbeef,0x6b56,0x11d0,{0xbb,0xd7,0x00,0xc0,0x4f,0xd7,0xcf,0xc9}},{1,0}},
  25. {{0xdeadbeef,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}},
  26. &nstest01_v1_0_DispatchTable,
  27. 0,
  28. 0,
  29. 0,
  30. 0,
  31. 0
  32. };
  33. RPC_IF_HANDLE nstest01_v1_0_s_ifspec = (RPC_IF_HANDLE)& nstest01___RpcServerInterface;
  34. //------------------------------------
  35. void __cdecl main(int argc, char *argv[])
  36. {
  37. RPC_STATUS status;
  38. /* RPC_IF_HANDLE intf;
  39. RPC_BINDING_VECTOR bv;
  40. UUID_VECTOR ov;
  41. hIfSpec = nstest01_v1_0_s_ifspec;
  42. status = RpcServerRegisterIf( nstest01_v1_0_s_ifspec,
  43. NULL,
  44. NULL);
  45. printf("RpcServerRegisterIf returned 0x%x\n", status);
  46. if (MSG_OK != status){
  47. dwExitCode = (DWORD)status;
  48. break;
  49. }
  50. else
  51. fRegistered = 1;
  52. }
  53. else
  54. hIfSpec = NULL;
  55. // BindingVec
  56. if( TEST_OPT_VALID_BIND == pTestOpt->m_nBindingVec ) {
  57. printf("CallingRpcServerUseProtseq...\n");
  58. status = RpcServerUseProtseq( pszProtSeq[pTestOpt->m_nProtSeq],
  59. cMaxCalls, // max concurrent calls
  60. pszSecurity); // Security descriptor
  61. printf("RpcServerUseProtseq returned 0x%x\n", status);
  62. if (MSG_OK != status){
  63. dwExitCode = ERROR_MSG_USE_PROTSEQ;
  64. break;
  65. }
  66. status = RpcServerInqBindings(&pBindingVector);
  67. printf("RpcServerInqBindings returned 0x%x\n", status);
  68. if (MSG_OK != status){
  69. dwExitCode = (DWORD)status;
  70. break;
  71. }
  72. status = RpcServerInqBindings(&pbkBindingVector);
  73. printf("RpcServerInqBindings returned 0x%x\n", status);
  74. if (MSG_OK != status){
  75. dwExitCode = (DWORD)status;
  76. break;
  77. }
  78. if( hIfSpec ){
  79. status = RpcEpRegister(hIfSpec,
  80. pBindingVector,
  81. pUuidVect,
  82. "");
  83. printf("RpcEpRegister returned 0x%x\n", status);
  84. if (MSG_OK != status){
  85. dwExitCode = (DWORD)status;
  86. break;
  87. }
  88. else
  89. fEndpoint = 1;
  90. }
  91. }
  92. else
  93. pBindingVector = NULL;
  94. if( NULL != pBindingVector ){
  95. status = RpcBindingReset( pBindingVector->BindingH[0] );
  96. printf("RpcBindingReset returned 0x%x\n", status);
  97. }
  98. status = RpcServerRegisterIf(nstest01_v1_0_s_ifspec, NULL, NULL);
  99. // too many hoops
  100. */
  101. // create an entry
  102. status = RpcNsMgmtEntryCreate(RPC_C_NS_SYNTAX_DEFAULT, L"/.:/ns_test_08");
  103. printf("Create returned Status = 0x%x\n", status);
  104. // delete an entry
  105. status = RpcNsMgmtEntryDelete(RPC_C_NS_SYNTAX_DEFAULT, L"/.:/ns_test_08");
  106. printf("Delete returned Status = 0x%x\n", status);
  107. // create an entry
  108. status = RpcNsMgmtEntryCreate(RPC_C_NS_SYNTAX_DEFAULT, L"/.:/ns_test_08");
  109. printf("Create returned Status = 0x%x\n", status);
  110. // export to it
  111. status = RpcNsBindingExport(RPC_C_NS_SYNTAX_DEFAULT, L"/.:/ns_test_08",
  112. intf, bv, ov);
  113. printf("Export returned Status = 0x%x\n", status);
  114. // delete it
  115. status = RpcNsMgmtEntryDelete(RPC_C_NS_SYNTAX_DEFAULT, L"/.:/ns_test_08");
  116. printf("Delete returned Status = 0x%x\n", status);
  117. // create an entry
  118. status = RpcNsMgmtEntryCreate(RPC_C_NS_SYNTAX_DEFAULT, L"/.:/ns_test_08");
  119. printf("Create returned Status = 0x%x\n", status);
  120. // export to the group entry
  121. // delete the entry
  122. status = RpcNsMgmtEntryDelete(RPC_C_NS_SYNTAX_DEFAULT, L"/.:/ns_test_08");
  123. printf("Delete returned Status = 0x%x\n", status);
  124. // create an entry
  125. status = RpcNsMgmtEntryCreate(RPC_C_NS_SYNTAX_DEFAULT, L"/.:/ns_test_08");
  126. printf("Create returned Status = 0x%x\n", status);
  127. // export it as profile entry
  128. // delete the entry
  129. status = RpcNsMgmtEntryDelete(RPC_C_NS_SYNTAX_DEFAULT, L"/.:/ns_test_08");
  130. printf("Delete returned Status = 0x%x\n", status);
  131. }