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.

168 lines
4.7 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. ConfSet.c
  5. Abstract:
  6. This file contains the RpcXlate code to handle the NetConfigSet API.
  7. Author:
  8. John Rogers (JohnRo) 21-Oct-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. 21-Oct-1992 JohnRo
  14. Created for RAID 9357: server mgr: can't add to alerts list on
  15. downlevel.
  16. 24-Nov-1992 JohnRo
  17. RAID 3578: Lan Server 2.0 returns NERR_InternalError for this API.
  18. --*/
  19. // These must be included first:
  20. #include <windef.h> // IN, DWORD, etc.
  21. #include <lmcons.h> // LM20_ equates, NET_API_STATUS, etc.
  22. // These may be included in any order:
  23. #include <apinums.h> // API_ equates.
  24. #include <lmconfig.h> // LPCONFIG_INFO_0, etc.
  25. #include <lmerr.h> // NO_ERROR, NERR_, and ERROR_ equates.
  26. #include <netdebug.h> // NetpKdPrint(()), FORMAT_ equates, etc.
  27. #include <prefix.h> // PREFIX_ equates.
  28. #include <remdef.h> // REM16_, REM32_, REMSmb_ equates.
  29. #include <rx.h> // RxRemoteApi().
  30. #include <rxpdebug.h> // IF_DEBUG().
  31. #include <rxconfig.h> // My prototype.
  32. #include <tstr.h> // STRSIZE().
  33. NET_API_STATUS
  34. RxNetConfigSet (
  35. IN LPTSTR UncServerName,
  36. IN LPTSTR Reserved1 OPTIONAL,
  37. IN LPTSTR Component,
  38. IN DWORD Level,
  39. IN DWORD Reserved2,
  40. IN LPBYTE Buf,
  41. IN DWORD Reserved3
  42. )
  43. /*++
  44. Routine Description:
  45. RxNetConfigSet performs the same function as NetConfigSet,
  46. except that the server name is known to refer to a downlevel server.
  47. Arguments:
  48. (Same as NetConfigSet, except UncServerName must not be null, and
  49. must not refer to the local computer.)
  50. Return Value:
  51. (Same as NetConfigSet.)
  52. --*/
  53. {
  54. NET_API_STATUS ApiStatus;
  55. LPCONFIG_INFO_0 ConfigStruct = (LPVOID) Buf;
  56. DWORD BufferSize;
  57. //
  58. // Error check DLL stub and the app.
  59. //
  60. NetpAssert(UncServerName != NULL);
  61. if (Component == NULL) {
  62. ApiStatus = ERROR_INVALID_PARAMETER;
  63. goto Cleanup;
  64. }
  65. if (Level != 0) {
  66. ApiStatus = ERROR_INVALID_LEVEL;
  67. goto Cleanup;
  68. }
  69. if ( (ConfigStruct->cfgi0_key) == NULL ) {
  70. ApiStatus = ERROR_INVALID_PARAMETER;
  71. goto Cleanup;
  72. }
  73. //
  74. // RFirth says we should be paranoid and make sure MBZ (must be zero)
  75. // parameters really are. OK with me. --JR
  76. //
  77. if (Reserved1 != NULL) {
  78. ApiStatus = ERROR_INVALID_PARAMETER;
  79. goto Cleanup;
  80. } else if (Reserved2 != 0) {
  81. ApiStatus = ERROR_INVALID_PARAMETER;
  82. goto Cleanup;
  83. } else if (Reserved3 != 0) {
  84. ApiStatus = ERROR_INVALID_PARAMETER;
  85. goto Cleanup;
  86. }
  87. IF_DEBUG(CONFIG) {
  88. NetpKdPrint(( PREFIX_NETAPI "RxNetConfigSet: starting, server="
  89. FORMAT_LPTSTR ", component=" FORMAT_LPTSTR ".\n",
  90. UncServerName, Component ));
  91. }
  92. //
  93. // Compute buffer size.
  94. //
  95. BufferSize = sizeof(CONFIG_INFO_0)
  96. + STRSIZE( ConfigStruct->cfgi0_key );
  97. if ( (ConfigStruct->cfgi0_data) != NULL ) {
  98. BufferSize += STRSIZE( ConfigStruct->cfgi0_data );
  99. }
  100. //
  101. // Actually remote the API, using the already converted data.
  102. //
  103. ApiStatus = RxRemoteApi(
  104. API_WConfigSet, // API number
  105. UncServerName, // Required, with \\name.
  106. REMSmb_NetConfigSet_P, // parm desc
  107. REM16_configset_info_0, // data desc 16
  108. REM32_configset_info_0, // data desc 32
  109. REMSmb_configset_info_0, // data desc SMB
  110. NULL, // no aux data desc 16
  111. NULL, // no aux data desc 32
  112. NULL, // no aux data desc SMB
  113. 0, // Flags: normal
  114. // rest of API's arguments, in 32-bit LM 2.x format:
  115. // parm desc is "zzWWsTD"
  116. Reserved1, // z
  117. Component, // z
  118. Level, // W
  119. Reserved2, // W
  120. Buf, // s
  121. BufferSize, // T
  122. Reserved3 ); // D
  123. //
  124. // IBM LAN Server 2.0 returns NERR_InternalError. Change this to
  125. // something more descriptive.
  126. //
  127. if (ApiStatus == NERR_InternalError) {
  128. ApiStatus = ERROR_NOT_SUPPORTED;
  129. }
  130. Cleanup:
  131. return (ApiStatus);
  132. } // RxNetConfigSet