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.

148 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. getaddr.c
  5. Abstract:
  6. This module contains the code to support NPGetAddressByName.
  7. Author:
  8. Yi-Hsin Sung (yihsins) 18-Apr-94
  9. Glenn A. Curtis (glennc) 18-Jul-95
  10. Revision History:
  11. yihsins Created
  12. glennc Modified 18-Jul-95
  13. --*/
  14. #ifndef QFE_BUILD
  15. #include <nw.h>
  16. #include <winsock.h>
  17. #include <wsipx.h>
  18. #include <nspapi.h>
  19. #include <nspapip.h>
  20. #include <wsnwlink.h>
  21. #include <svcguid.h>
  22. #include <nwsap.h>
  23. #include <align.h>
  24. #include <nwmisc.h>
  25. #define WSOCK_VER_REQD 0x0101
  26. DWORD
  27. NwrGetService(
  28. IN LPWSTR Reserved,
  29. IN WORD nSapType,
  30. IN LPWSTR lpServiceName,
  31. IN DWORD dwProperties,
  32. OUT LPBYTE lpServiceInfo,
  33. IN DWORD dwBufferLength,
  34. OUT LPDWORD lpdwBytesNeeded
  35. )
  36. /*++
  37. Routine Description:
  38. This routine calls NwGetService to, in turn, get the service info.
  39. Arguments:
  40. Reserved - unused
  41. nSapType - SAP type
  42. lpServiceName - service name
  43. dwProperties - specifys the properties of the service info needed
  44. lpServiceInfo - on output, contains the SERVICE_INFO
  45. dwBufferLength - size of buffer pointed by lpServiceInfo
  46. lpdwBytesNeeded - if the buffer pointed by lpServiceInfo is not large
  47. enough, this will contain the bytes needed on output
  48. Return Value:
  49. Win32 error.
  50. --*/
  51. {
  52. return NwGetService( Reserved,
  53. nSapType,
  54. lpServiceName,
  55. dwProperties,
  56. lpServiceInfo,
  57. dwBufferLength,
  58. lpdwBytesNeeded );
  59. }
  60. DWORD
  61. NwrSetService(
  62. IN LPWSTR Reserved,
  63. IN DWORD dwOperation,
  64. IN LPSERVICE_INFO lpServiceInfo,
  65. IN WORD nSapType
  66. )
  67. /*++
  68. Routine Description:
  69. This routine registers or deregisters the service info.
  70. Arguments:
  71. Reserved - unused
  72. dwOperation - SERVICE_REGISTER or SERVICE_DEREGISTER
  73. lpServiceInfo - contains the service information
  74. nSapType - SAP type
  75. Return Value:
  76. Win32 error.
  77. --*/
  78. {
  79. DWORD err = NO_ERROR;
  80. UNREFERENCED_PARAMETER( Reserved );
  81. //
  82. // Check if all parameters passed in are valid
  83. //
  84. if ( (lpServiceInfo->lpServiceName == NULL) || (wcslen( lpServiceInfo->lpServiceName ) > SAP_OBJECT_NAME_MAX_LENGTH-1) )
  85. {
  86. return ERROR_INVALID_PARAMETER;
  87. }
  88. switch ( dwOperation )
  89. {
  90. case SERVICE_REGISTER:
  91. err = NwRegisterService( lpServiceInfo, nSapType, NwDoneEvent );
  92. break;
  93. case SERVICE_DEREGISTER:
  94. err = NwDeregisterService( lpServiceInfo, nSapType );
  95. break;
  96. default:
  97. err = ERROR_INVALID_PARAMETER;
  98. break;
  99. }
  100. return err;
  101. }
  102. #endif