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.

61 lines
1.6 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windows.h>
  5. #include <winsock2.h>
  6. #include <wsipx.h>
  7. #include <svcguid.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <rpc.h>
  11. #include <rpcdce.h>
  12. #define BUFFSIZE 3000
  13. _cdecl
  14. main(int argc, char **argv)
  15. {
  16. DWORD dwBufSize = BUFFSIZE;
  17. WCHAR Buffer[BUFFSIZE];
  18. DWORD ret;
  19. DWORD iter;
  20. WSADATA wsaData;
  21. LPWSANAMESPACE_INFO lpnspBuffer = (LPWSANAMESPACE_INFO) Buffer;
  22. WSAStartup(MAKEWORD(1, 1), &wsaData);
  23. ret = WSAEnumNameSpaceProviders( &dwBufSize,
  24. lpnspBuffer );
  25. if ( ret == SOCKET_ERROR )
  26. {
  27. printf("Error: WSAEnumNameSpaceProviders returned 0x%X\n", ret );
  28. printf(" GetLastError returned 0x%X\n", GetLastError() );
  29. WSACleanup();
  30. return -1;
  31. }
  32. printf( "\nWSAEnumNameSpaceProviders returned %d entries . . .\n\n", ret );
  33. for ( iter = 0; iter < ret; iter++ )
  34. {
  35. printf( "NSProviderId : %x\n",
  36. lpnspBuffer[iter].NSProviderId );
  37. printf( "dwNameSpace : %d\n",
  38. lpnspBuffer[iter].dwNameSpace );
  39. printf( "fActive : %S\n",
  40. lpnspBuffer[iter].fActive ? L"TRUE" : L"FALSE" );
  41. printf( "dwVersion : %x\n",
  42. lpnspBuffer[iter].dwVersion );
  43. printf( "lpszIdentifier : %S\n\n",
  44. lpnspBuffer[iter].lpszIdentifier );
  45. }
  46. WSACleanup();
  47. return(0);
  48. }