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.

140 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. rxlgenum.c
  5. Abstract:
  6. Routines in this module implement the down-level remoted NetLogon
  7. functions exported in NT
  8. Contains RxNetLogon routines:
  9. RxNetLogonEnum
  10. Author:
  11. Richard Firth (rfirth) 20-May-1991
  12. Environment:
  13. Win-32/flat address space
  14. Notes:
  15. Routines in this module assume that caller-supplied parameters have
  16. already been verified. No effort is made to further check the veracity
  17. of parms. Any actions causing exceptions must be trapped at a higher
  18. level. This applies to ALL parameters - strings, pointers, buffers, etc.
  19. Revision History:
  20. 20-May-1991 RFirth
  21. Created
  22. 13-Sep-1991 JohnRo
  23. Made changes as suggested by PC-LINT.
  24. 05-Dec-1991 RFirth
  25. Enum returns in TotalEntries (or EntriesLeft) the number of items to
  26. be enumerated BEFORE this call. Used to be number left after this call
  27. --*/
  28. #include "downlevl.h"
  29. #include <rxlgenum.h>
  30. NET_API_STATUS
  31. RxNetLogonEnum(
  32. IN LPTSTR ServerName,
  33. IN DWORD Level,
  34. OUT LPBYTE* Buffer,
  35. IN DWORD PrefMaxLen,
  36. OUT LPDWORD EntriesRead,
  37. OUT LPDWORD EntriesLeft,
  38. IN OUT LPDWORD ResumeHandle OPTIONAL
  39. )
  40. /*++
  41. Routine Description:
  42. description-of-function.
  43. Arguments:
  44. ServerName - Where the NetLogonEnum API will be remoted
  45. Level - Of info to return - 0 or 2
  46. Buffer - Pointer to pointer to returned buffer
  47. PrefMaxLen - Caller's preferred maximum returned buffer size
  48. EntriesRead - Pointer to returned number of items in Buffer
  49. EntriesLeft - Pointer to returned number of items left to enumerate at server
  50. ResumeHandle- Handle used for subsequent enumerations
  51. Return Value:
  52. NET_API_STATUS
  53. Success - NERR_Success
  54. Failure -
  55. --*/
  56. {
  57. LPDESC pDesc16, pDesc32, pDescSmb;
  58. LPBYTE bufptr;
  59. DWORD entries_read, total_entries;
  60. NET_API_STATUS rc;
  61. UNREFERENCED_PARAMETER(PrefMaxLen);
  62. UNREFERENCED_PARAMETER(ResumeHandle);
  63. *Buffer = NULL;
  64. *EntriesRead = *EntriesLeft = 0;
  65. switch (Level) {
  66. case 0:
  67. pDesc16 = REM16_user_logon_info_0;
  68. pDesc32 = REM32_user_logon_info_0;
  69. pDescSmb = REMSmb_user_logon_info_0;
  70. break;
  71. case 2:
  72. pDesc16 = REM16_user_logon_info_2;
  73. pDesc32 = REM32_user_logon_info_2;
  74. pDescSmb = REMSmb_user_logon_info_2;
  75. break;
  76. default:
  77. return ERROR_INVALID_LEVEL;
  78. }
  79. bufptr = NULL;
  80. rc = RxRemoteApi(API_WLogonEnum,
  81. ServerName,
  82. REMSmb_NetLogonEnum_P,
  83. pDesc16,
  84. pDesc32,
  85. pDescSmb,
  86. NULL, NULL, NULL,
  87. ALLOCATE_RESPONSE,
  88. Level,
  89. &bufptr,
  90. 65535,
  91. &entries_read,
  92. &total_entries
  93. );
  94. if (rc) {
  95. if (bufptr) {
  96. (void) NetApiBufferFree(bufptr);
  97. }
  98. } else {
  99. *EntriesRead = entries_read;
  100. *EntriesLeft = total_entries;
  101. *Buffer = bufptr;
  102. }
  103. return rc;
  104. }