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.

242 lines
6.1 KiB

  1. //=================================================================
  2. //
  3. // SvrApiApi.h
  4. //
  5. // Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved
  6. //
  7. //=================================================================
  8. #ifndef _SVRAPIAPI_H_
  9. #define _SVRAPIAPI_H_
  10. #include <lmaccess.h>
  11. #include <lmapibuf.h>
  12. #include <lmserver.h>
  13. #include <lmerr.h>
  14. #include <ntsecapi.h>
  15. #include <stack>
  16. #include <comdef.h>
  17. #include <dsrole.h>
  18. #include <dsgetdc.h>
  19. /******************************************************************************
  20. * #includes to Register this class with the CResourceManager.
  21. *****************************************************************************/
  22. #include "DllWrapperBase.h"
  23. extern const GUID g_guidSvrApiApi;
  24. extern const TCHAR g_tstrSvrApi[];
  25. /******************************************************************************
  26. * Function pointer typedefs. Add new functions here as required.
  27. *****************************************************************************/
  28. typedef NET_API_STATUS (NET_API_FUNCTION *PFN_SVRAPI_NET_SHARE_ENUM)
  29. (
  30. char FAR *servername,
  31. short level,
  32. char FAR *bufptr,
  33. unsigned short prefmaxlen,
  34. unsigned short FAR *entriesread,
  35. unsigned short FAR *totalentries
  36. );
  37. typedef NET_API_STATUS (NET_API_FUNCTION *PFN_SVRAPI_NET_SHARE_GET_INFO)
  38. (
  39. char FAR *servername,
  40. char FAR *netname,
  41. short level,
  42. char FAR *bufptr,
  43. unsigned short buflen,
  44. unsigned short FAR *totalavail
  45. );
  46. typedef NET_API_STATUS (NET_API_FUNCTION *PFN_SVRAPI_NET_SERVER_GET_INFO)
  47. (
  48. char FAR *servername,
  49. short level,
  50. char FAR *bufptr,
  51. unsigned short buflen,
  52. unsigned short FAR *totalavail
  53. );
  54. typedef NET_API_STATUS (NET_API_FUNCTION *PFN_SVRAPI_NET_SHARE_ENUM_STICKY)
  55. (
  56. IN LPTSTR servername,
  57. IN DWORD level,
  58. OUT LPBYTE *bufptr,
  59. IN DWORD prefmaxlen,
  60. OUT LPDWORD entriesread,
  61. OUT LPDWORD totalentries,
  62. IN OUT LPDWORD resume_handle
  63. );
  64. typedef NET_API_STATUS (NET_API_FUNCTION *PFN_SVRAPI_NET_SHARE_SET_INFO)
  65. (
  66. IN const char FAR * servername,
  67. IN const char FAR * netname,
  68. IN short level,
  69. IN const char FAR* buf,
  70. IN unsigned short cbBuffer,
  71. IN short sParmNum
  72. );
  73. typedef NET_API_STATUS (NET_API_FUNCTION *PFN_SVRAPI_NET_SHARE_ADD)
  74. (
  75. IN const char FAR * servername,
  76. IN short level,
  77. IN const char FAR * buf,
  78. unsigned short cbBuffer
  79. );
  80. typedef NET_API_STATUS (NET_API_FUNCTION *PFN_SVRAPI_NET_SHARE_DEL)
  81. (
  82. IN LPTSTR servername,
  83. IN LPTSTR netname,
  84. IN DWORD reserved
  85. );
  86. typedef NET_API_STATUS (NET_API_FUNCTION *PFN_SVRAPI_NET_SHARE_DEL_STICKY)
  87. (
  88. IN LPTSTR servername,
  89. IN LPTSTR netname,
  90. IN DWORD reserved
  91. );
  92. typedef NET_API_STATUS (NET_API_FUNCTION *PFN_SVRAPI_NET_SHARE_CHECK)
  93. (
  94. IN LPTSTR servername,
  95. IN LPTSTR device,
  96. OUT LPDWORD type
  97. );
  98. /******************************************************************************
  99. * Wrapper class for Kernel32 load/unload, for registration with CResourceManager.
  100. ******************************************************************************/
  101. class CSvrApiApi : public CDllWrapperBase
  102. {
  103. private:
  104. // Member variables (function pointers) pointing to kernel32 functions.
  105. // Add new functions here as required.
  106. PFN_SVRAPI_NET_SHARE_ENUM m_pfnNetShareEnum;
  107. PFN_SVRAPI_NET_SHARE_GET_INFO m_pfnNetShareGetInfo;
  108. PFN_SVRAPI_NET_SERVER_GET_INFO m_pfnNetServerGetInfo;
  109. PFN_SVRAPI_NET_SHARE_SET_INFO m_pfnNetShareSetInfo;
  110. PFN_SVRAPI_NET_SHARE_ADD m_pfnNetShareAdd;
  111. PFN_SVRAPI_NET_SHARE_DEL m_pfnNetShareDel;
  112. #ifdef NTONLY
  113. PFN_SVRAPI_NET_SHARE_ENUM_STICKY m_pfnNetShareEnumSticky;
  114. PFN_SVRAPI_NET_SHARE_DEL_STICKY m_pfnNetShareDelSticky;
  115. PFN_SVRAPI_NET_SHARE_CHECK m_pfnNetShareCheck;
  116. #endif
  117. public:
  118. // Constructor and destructor:
  119. CSvrApiApi(LPCTSTR a_tstrWrappedDllName);
  120. ~CSvrApiApi();
  121. // Inherrited initialization function.
  122. virtual bool Init();
  123. // Member functions wrapping kernel32 functions.
  124. // Add new functions here as required:
  125. NET_API_STATUS NET_API_FUNCTION NetShareEnum
  126. (
  127. char FAR *a_servername,
  128. short a_level,
  129. char FAR *a_bufptr,
  130. unsigned short a_prefmaxlen,
  131. unsigned short FAR *a_entriesread,
  132. unsigned short FAR *a_totalentries
  133. );
  134. NET_API_STATUS NET_API_FUNCTION NetShareGetInfo
  135. (
  136. char FAR *a_servername,
  137. char FAR *a_netname,
  138. short a_level,
  139. char FAR *a_bufptr,
  140. unsigned short a_buflen,
  141. unsigned short FAR *a_totalavail
  142. );
  143. NET_API_STATUS NET_API_FUNCTION NetServerGetInfo
  144. (
  145. char FAR *a_servername,
  146. short a_level,
  147. char FAR *a_bufptr,
  148. unsigned short a_buflen,
  149. unsigned short FAR *a_totalavail
  150. );
  151. NET_API_STATUS NET_API_FUNCTION NetShareSetInfo
  152. (
  153. const char FAR *a_servername,
  154. const char FAR *a_netname,
  155. short a_level,
  156. const char FAR *a_buf,
  157. unsigned short a_cbBuffer,
  158. short a_sParmNum
  159. );
  160. NET_API_STATUS NET_API_FUNCTION NetShareAdd
  161. (
  162. const char FAR *a_servername,
  163. short a_level,
  164. const char FAR *a_buf,
  165. unsigned short a_cbBuffer
  166. );
  167. NET_API_STATUS NET_API_FUNCTION NetShareDel
  168. (
  169. LPTSTR a_servername,
  170. LPTSTR a_netname,
  171. DWORD a_reserved
  172. );
  173. #ifdef NTONLY
  174. NET_API_STATUS NET_API_FUNCTION NetShareEnumSticky
  175. (
  176. LPTSTR a_servername,
  177. DWORD a_level,
  178. LPBYTE *a_bufptr,
  179. DWORD a_prefmaxlen,
  180. LPDWORD a_entriesread,
  181. LPDWORD a_totalentries,
  182. LPDWORD a_resume_handle
  183. );
  184. NET_API_STATUS NET_API_FUNCTION NetShareDelSticky
  185. (
  186. LPTSTR a_servername,
  187. LPTSTR a_netname,
  188. DWORD a_reserved
  189. );
  190. NET_API_STATUS NET_API_FUNCTION NetShareCheck
  191. (
  192. LPTSTR a_servername,
  193. LPTSTR a_device,
  194. LPDWORD a_type
  195. );
  196. #endif
  197. };
  198. #endif