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.

150 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 1991-1992 Microsoft Corporation
  3. Module Name:
  4. WksGtOld.c
  5. Abstract:
  6. This file contains RxpWkstaGetOldInfo().
  7. Author:
  8. John Rogers (JohnRo) 15-Aug-1991
  9. Environment:
  10. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  11. Requires ANSI C extensions: slash-slash comments, long external names.
  12. Revision History:
  13. 15-Aug-1991 JohnRo
  14. Implement downlevel NetWksta APIs.
  15. 11-Nov-1991 JohnRo
  16. Moved some code from RxNetWkstaGetInfo to RxpWkstaGetOldInfo, so it
  17. can be shared by RxNetWkstaUserEnum.
  18. 22-May-1992 JohnRo
  19. RAID 7243: Avoid 64KB requests (Winball servers only HAVE 64KB!)
  20. Use PREFIX_ equates.
  21. --*/
  22. // These must be included first:
  23. #include <windef.h> // IN, DWORD, etc.
  24. #include <lmcons.h> // LM20_ equates, NET_API_STATUS, etc.
  25. // These may be included in any order:
  26. #include <apinums.h> // API_ equates.
  27. #include <dlwksta.h> // NetpIsOldWkstaInfoLevel().
  28. #include <lmerr.h> // ERROR_ and NERR_ equates.
  29. #include <netdebug.h> // DBGSTATIC, NetpKdPrint(()), FORMAT_ equates.
  30. #include <prefix.h> // PREFIX_ equates.
  31. #include <rap.h> // LPDESC.
  32. #include <remdef.h> // REM16_, REM32_, REMSmb_ equates.
  33. #include <rx.h> // RxRemoteApi().
  34. #include <rxpdebug.h> // IF_DEBUG().
  35. #include <rxwksta.h> // My prototype.
  36. #include <strucinf.h> // NetpWkstaStructureInfo().
  37. NET_API_STATUS
  38. RxpWkstaGetOldInfo (
  39. IN LPTSTR UncServerName,
  40. IN DWORD Level,
  41. OUT LPBYTE *BufPtr
  42. )
  43. /*++
  44. Routine Description:
  45. RxpWkstaGetOldInfo does a WkstaGetInfo to a downlevel server for an
  46. old info level.
  47. Arguments:
  48. (Same as NetWkstaGetInfo, except UncServerName must not be null, and
  49. must not refer to the local computer.)
  50. Return Value:
  51. (Same as NetWkstaGetInfo.)
  52. --*/
  53. {
  54. DWORD BufSize;
  55. LPDESC DataDesc16, DataDesc32, DataDescSmb;
  56. NET_API_STATUS Status;
  57. DWORD TotalAvail;
  58. IF_DEBUG(WKSTA) {
  59. NetpKdPrint(( PREFIX_NETAPI "RxpWkstaGetOldInfo: starting, server="
  60. FORMAT_LPTSTR ", lvl=" FORMAT_DWORD ".\n",
  61. UncServerName, Level));
  62. }
  63. //
  64. // Error check caller.
  65. //
  66. NetpAssert(UncServerName != NULL);
  67. if ( !NetpIsOldWkstaInfoLevel( Level )) {
  68. return (ERROR_INVALID_LEVEL);
  69. }
  70. if (BufPtr == NULL) {
  71. return (ERROR_INVALID_PARAMETER);
  72. }
  73. *BufPtr = NULL; // assume error; it makes error handlers easy to code.
  74. // This also forces possible GP fault before we allocate memory.
  75. //
  76. // Learn about info level.
  77. //
  78. Status = NetpWkstaStructureInfo (
  79. Level, // level to learn about
  80. PARMNUM_ALL, // No parmnum with this.
  81. TRUE, // Need native sizes.
  82. & DataDesc16,
  83. & DataDesc32,
  84. & DataDescSmb,
  85. & BufSize, // max buffer size
  86. NULL, // don't need fixed size.
  87. NULL // don't need string size.
  88. );
  89. if (Status != NERR_Success) {
  90. return (Status);
  91. }
  92. //
  93. // Actually remote the API, which will get back the (old) info level
  94. // data in native format.
  95. //
  96. Status = RxRemoteApi(
  97. API_WWkstaGetInfo, // API number
  98. UncServerName, // Required, with \\name.
  99. REMSmb_NetWkstaGetInfo_P, // parm desc
  100. DataDesc16,
  101. DataDesc32,
  102. DataDescSmb,
  103. NULL, // no aux data desc 16
  104. NULL, // no aux data desc 32
  105. NULL, // no aux data desc SMB
  106. ALLOCATE_RESPONSE, // flags: alloc buffer for us.
  107. // rest of API's arguments, in 32-bit LM 2.x format:
  108. Level,
  109. BufPtr, // alloc buffer & set this ptr
  110. BufSize,
  111. & TotalAvail); // total size
  112. NetpAssert( Status != ERROR_MORE_DATA );
  113. NetpAssert( Status != NERR_BufTooSmall );
  114. return (Status);
  115. } // RxpWkstaGetOldInfo