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.

68 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. GUID ServiceClassId = { /* 5b50962a-e5a5-11cf-a555-00c04fd8d4ac */
  14. 0x5b50962a,
  15. 0xe5a5,
  16. 0x11cf,
  17. {0xa5, 0x55, 0x00, 0xc0, 0x4f, 0xd8, 0xd4, 0xac}
  18. };
  19. WCHAR ServiceClassName[] = L"Winsock2 Example Class";
  20. _cdecl
  21. main(int argc, char **argv)
  22. {
  23. DWORD dwBufSize = BUFFSIZE;
  24. WCHAR Buffer[BUFFSIZE];
  25. DWORD ret;
  26. WSADATA wsaData;
  27. WSASERVICECLASSINFO ServiceClassInfo;
  28. WSANSCLASSINFO NSClassInfo;
  29. DWORD dwValue = 0x67676767;
  30. NSClassInfo.lpszName = SERVICE_TYPE_VALUE_OBJECTID;
  31. NSClassInfo.dwNameSpace = NS_ALL;
  32. NSClassInfo.dwValueType = REG_DWORD;
  33. NSClassInfo.dwValueSize = 4;
  34. NSClassInfo.lpValue = &dwValue;
  35. ServiceClassInfo.lpServiceClassId = &ServiceClassId;
  36. ServiceClassInfo.lpszServiceClassName = ServiceClassName;
  37. ServiceClassInfo.dwCount = 1;
  38. ServiceClassInfo.lpClassInfos = &NSClassInfo;
  39. WSAStartup( MAKEWORD(1, 1), &wsaData );
  40. ret = WSAInstallServiceClass( &ServiceClassInfo );
  41. if ( ret )
  42. {
  43. printf("Error: WSAInstallServiceClass returned 0x%X\n", ret );
  44. printf(" GetLastError returned 0x%X\n", GetLastError() );
  45. WSACleanup();
  46. return -1;
  47. }
  48. printf( "Service class was installed\n" );
  49. WSACleanup();
  50. return(0);
  51. }