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.

81 lines
1.9 KiB

  1. #include <winsock2.h>
  2. #include <ws2spi.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include "..\setup.h"
  6. INT
  7. InstallNT5Provider()
  8. {
  9. INT ReturnCode;
  10. BOOL ReturnValue = FALSE;
  11. DWORD NameSpaceId;
  12. NameSpaceId = NS_NTDS;
  13. ReturnCode = WSCInstallNameSpace( gProviderName,
  14. gProviderPath,
  15. NameSpaceId,
  16. 0,
  17. &gProviderId );
  18. return ReturnCode;
  19. }
  20. int __cdecl main(int argc, char**argv)
  21. {
  22. DWORD NameSpaceId;
  23. WORD ReturnCode;
  24. DWORD LastError;
  25. WORD wVersionRequested;
  26. WSADATA wsaData;
  27. WORD err;
  28. wVersionRequested = MAKEWORD( 1, 1 );
  29. err = WSAStartup( wVersionRequested, &wsaData );
  30. if ( err != 0 )
  31. {
  32. //
  33. // Tell the user that we couldn't find a useable WinSock DLL.
  34. //
  35. fprintf( stderr, "Winsock DLL couldn't be found\n" );
  36. return( -1 );
  37. }
  38. //
  39. // Confirm that the WinSock DLL supports 1.1.
  40. // Note that if the DLL supports versions greater
  41. // than 2.0 in addition to 1.1, it will still return
  42. // 2.0 in wVersion since that is the version we
  43. // requested.
  44. //
  45. if ( LOBYTE( wsaData.wVersion ) != 1 ||
  46. HIBYTE( wsaData.wVersion ) != 1 )
  47. {
  48. //
  49. // Tell the user that we couldn't find a useable WinSock DLL.
  50. //
  51. fprintf( stderr, "Winsock DLL couldn't be found\n" );
  52. WSACleanup();
  53. return( -1 );
  54. }
  55. //
  56. // Install the providers for this test
  57. //
  58. if( ( ReturnCode = InstallNT5Provider() ) != ERROR_SUCCESS )
  59. {
  60. fprintf( stderr,
  61. "NT5 Uninstall failed; error code = %d \n",
  62. ReturnCode);
  63. return( -1 );
  64. }
  65. return( 0 );
  66. }