Source code of Windows XP (NT5)
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.

88 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. rpcep.cpp
  5. Abstract:
  6. dump all registered interfaces on the local RPC endpoint mapper
  7. Author:
  8. Charlie Wickham (charlwi) 10-Feb-2000
  9. Revision History:
  10. --*/
  11. #include <stdio.h>
  12. #include <errno.h>
  13. #include <rpc.h>
  14. CHAR blanks[] = " ";
  15. int __cdecl
  16. main( int argc, char *argv[])
  17. {
  18. RPC_STATUS status;
  19. RPC_EP_INQ_HANDLE inquiryContext;
  20. DWORD numBlanks;
  21. status = RpcMgmtEpEltInqBegin(NULL,
  22. RPC_C_EP_ALL_ELTS,
  23. (RPC_IF_ID *)NULL,
  24. 0,
  25. NULL,
  26. &inquiryContext);
  27. if (status != RPC_S_OK) {
  28. printf( "RpcMgmtEpEltInqBegin() failed with %d\n", status);
  29. return status;
  30. }
  31. do {
  32. RPC_IF_ID ifId;
  33. RPC_BINDING_HANDLE bindingHandle;
  34. unsigned char * annotation;
  35. unsigned char * localBinding;
  36. status = RpcMgmtEpEltInqNext(inquiryContext,
  37. &ifId,
  38. &bindingHandle,
  39. NULL,
  40. &annotation);
  41. if ( status == RPC_X_NO_MORE_ENTRIES ) {
  42. break;
  43. } else if (status != RPC_S_OK) {
  44. printf( "RpcMgmtEpEltInqNext() failed with %d\n", status);
  45. break;
  46. }
  47. status = RpcBindingToStringBinding( bindingHandle, &localBinding );
  48. printf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
  49. ifId.Uuid.Data1, ifId.Uuid.Data2, ifId.Uuid.Data3,
  50. ifId.Uuid.Data4[0], ifId.Uuid.Data4[1], ifId.Uuid.Data4[2], ifId.Uuid.Data4[3],
  51. ifId.Uuid.Data4[4], ifId.Uuid.Data4[5], ifId.Uuid.Data4[6], ifId.Uuid.Data4[7]
  52. );
  53. numBlanks = sizeof(blanks) - ( strlen( (const char *)localBinding ) + 2 );
  54. printf(" [%s]%*.s\"%s\"\n", localBinding, numBlanks, blanks, annotation );
  55. RpcBindingFree( &bindingHandle );
  56. RpcStringFree( &localBinding );
  57. } while ( TRUE );
  58. status = RpcMgmtEpEltInqDone( &inquiryContext );
  59. if (status != RPC_S_OK) {
  60. printf( "RpcMgmtEpEltInqDone() failed with %d\n", status);
  61. }
  62. return 0;
  63. }
  64. /* end rpcep.cpp */