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.

913 lines
29 KiB

  1. //=================================================================
  2. //
  3. // NetApi32API.cpp
  4. //
  5. // Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved
  6. //
  7. //=================================================================
  8. #include "precomp.h"
  9. #include <cominit.h>
  10. #include <winerror.h>
  11. #include "NetApi32Api.h"
  12. #include "DllWrapperCreatorReg.h"
  13. // {EDC5C632-D027-11d2-911F-0060081A46FD}
  14. static const GUID g_guidNetApi32Api =
  15. {0xedc5c632, 0xd027, 0x11d2, { 0x91, 0x1f, 0x0, 0x60, 0x8, 0x1a, 0x46, 0xfd}};
  16. static const TCHAR g_tstrNetApi32[] = _T("NETAPI32.DLL");
  17. /******************************************************************************
  18. * Register this class with the CResourceManager.
  19. *****************************************************************************/
  20. CDllApiWraprCreatrReg<CNetApi32Api, &g_guidNetApi32Api, g_tstrNetApi32> MyRegisteredNetApi32Wrapper;
  21. /******************************************************************************
  22. * Constructor
  23. ******************************************************************************/
  24. CNetApi32Api::CNetApi32Api(LPCTSTR a_tstrWrappedDllName)
  25. : CDllWrapperBase(a_tstrWrappedDllName),
  26. m_pfnNetGroupEnum(NULL),
  27. m_pfnNetGroupGetInfo(NULL),
  28. m_pfnNetGroupSetInfo(NULL),
  29. m_pfnNetLocalGroupGetInfo(NULL),
  30. m_pfnNetLocalGroupSetInfo(NULL),
  31. m_pfnNetGroupGetUsers(NULL),
  32. m_pfnNetLocalGroupGetMembers(NULL),
  33. m_pfnNetLocalGroupEnum(NULL),
  34. m_pfnNetShareEnum(NULL),
  35. m_pfnNetShareGetInfo(NULL),
  36. m_pfnNetShareAdd(NULL),
  37. m_pfnNetShareEnumSticky(NULL),
  38. m_pfnNetShareSetInfo(NULL),
  39. m_pfnNetShareDel(NULL),
  40. m_pfnNetShareDelSticky(NULL),
  41. m_pfnNetShareCheck(NULL),
  42. m_pfnNetUserEnum(NULL),
  43. m_pfnNetUserGetInfo(NULL),
  44. m_pfnNetUserSetInfo(NULL),
  45. m_pfnNetApiBufferFree(NULL),
  46. m_pfnNetQueryDisplayInformation(NULL),
  47. m_pfnNetServerSetInfo(NULL),
  48. m_pfnNetServerGetInfo(NULL),
  49. m_pfnNetGetDCName(NULL),
  50. m_pfnNetWkstaGetInfo(NULL),
  51. m_pfnNetGetAnyDCName(NULL),
  52. m_pfnNetServerEnum(NULL),
  53. m_pfnNetUserModalsGet(NULL),
  54. m_pfnNetScheduleJobAdd(NULL),
  55. m_pfnNetScheduleJobDel(NULL),
  56. m_pfnNetScheduleJobEnum(NULL),
  57. m_pfnNetScheduleJobGetInfo(NULL),
  58. m_pfnNetUseGetInfo(NULL),
  59. // ******* BEGIN: NT 4 and over only *******
  60. m_pfnNetEnumerateTrustedDomains(NULL),
  61. #ifdef NTONLY
  62. m_pfnDsGetDcNameW(NULL),
  63. #else
  64. m_pfnDsGetDcNameA(NULL),
  65. #endif
  66. // ******* END: NT4 and over only ***********
  67. // ******* BEGIN: NT 5 and over only *******
  68. m_pfnDsRoleGetPrimaryDomainInformation(NULL),
  69. m_pfnDsRoleFreeMemory(NULL),
  70. m_pfnNetRenameMachineInDomain(NULL),
  71. m_pfnNetJoinDomain(NULL),
  72. m_pfnNetUnjoinDomain(NULL)
  73. // ******* END: NT5 and over only ***********
  74. {
  75. }
  76. /******************************************************************************
  77. * Destructor
  78. ******************************************************************************/
  79. CNetApi32Api::~CNetApi32Api()
  80. {
  81. }
  82. /******************************************************************************
  83. * Initialization function to check that we obtained function addresses.
  84. * Init should fail only if the minimum set of functions was not available;
  85. * functions added in later versions may or may not be present - it is the
  86. * client's responsibility in such cases to check, in their code, for the
  87. * version of the dll before trying to call such functions. Not doing so
  88. * when the function is not present will result in an AV.
  89. *
  90. * The Init function is called by the WrapperCreatorRegistation class.
  91. ******************************************************************************/
  92. bool CNetApi32Api::Init()
  93. {
  94. bool fRet = LoadLibrary();
  95. if(fRet)
  96. {
  97. m_pfnNetGroupEnum = (PFN_NETAPI32_NET_GROUP_ENUM)
  98. GetProcAddress("NetGroupEnum");
  99. m_pfnNetGroupGetInfo = (PFN_NETAPI32_NET_GROUP_GET_INFO)
  100. GetProcAddress("NetGroupGetInfo");
  101. m_pfnNetGroupSetInfo = (PFN_NETAPI32_NET_GROUP_SET_INFO)
  102. GetProcAddress("NetGroupSetInfo");
  103. m_pfnNetLocalGroupGetInfo = (PFN_NETAPI32_NET_LOCAL_GROUP_GET_INFO)
  104. GetProcAddress("NetLocalGroupGetInfo");
  105. m_pfnNetLocalGroupSetInfo = (PFN_NETAPI32_NET_LOCAL_GROUP_SET_INFO)
  106. GetProcAddress("NetLocalGroupSetInfo");
  107. m_pfnNetGroupGetUsers = (PFN_NETAPI32_NET_GROUP_GET_USERS)
  108. GetProcAddress("NetGroupGetUsers");
  109. m_pfnNetLocalGroupGetMembers = (PFN_NETAPI32_NET_LOCAL_GROUP_GET_MEMBERS)
  110. GetProcAddress("NetLocalGroupGetMembers");
  111. m_pfnNetLocalGroupEnum = (PFN_NETAPI32_NET_LOCAL_GROUP_ENUM)
  112. GetProcAddress("NetLocalGroupEnum");
  113. m_pfnNetShareEnum = (PFN_NETAPI32_NET_SHARE_ENUM)
  114. GetProcAddress("NetShareEnum");
  115. m_pfnNetShareGetInfo = (PFN_NETAPI32_NET_SHARE_GET_INFO)
  116. GetProcAddress("NetShareGetInfo");
  117. m_pfnNetShareAdd = (PFN_NETAPI32_NET_SHARE_ADD)
  118. GetProcAddress("NetShareAdd");
  119. m_pfnNetShareEnumSticky = (PFN_NETAPI32_NET_SHARE_ENUM_STICKY)
  120. GetProcAddress("NetShareEnumSticky");
  121. m_pfnNetShareSetInfo = (PFN_NETAPI32_NET_SHARE_SET_INFO)
  122. GetProcAddress("NetShareSetInfo");
  123. m_pfnNetShareDel = (PFN_NETAPI32_NET_SHARE_DEL)
  124. GetProcAddress("NetShareDel");
  125. m_pfnNetShareDelSticky = (PFN_NETAPI32_NET_SHARE_DEL_STICKY)
  126. GetProcAddress("NetShareDelSticky");
  127. m_pfnNetShareCheck = (PFN_NETAPI32_NET_SHARE_CHECK)
  128. GetProcAddress("NetShareCheck");
  129. m_pfnNetUserEnum = (PFN_NETAPI32_NET_USER_ENUM)
  130. GetProcAddress("NetUserEnum");
  131. m_pfnNetUserGetInfo = (PFN_NETAPI32_NET_USER_GET_INFO)
  132. GetProcAddress("NetUserGetInfo");
  133. m_pfnNetUserSetInfo = (PFN_NETAPI32_NET_USER_SET_INFO)
  134. GetProcAddress("NetUserSetInfo");
  135. m_pfnNetGroupEnum = (PFN_NETAPI32_NET_GROUP_ENUM)
  136. GetProcAddress("NetGroupEnum");
  137. m_pfnNetApiBufferFree = (PFN_NETAPI32_NET_API_BUFFER_FREE)
  138. GetProcAddress("NetApiBufferFree");
  139. m_pfnNetQueryDisplayInformation = (PFN_NETAPI32_NET_QUERY_DISPLAY_INFORMATION)
  140. GetProcAddress("NetQueryDisplayInformation");
  141. m_pfnNetServerSetInfo = (PFN_NETAPI32_NET_SERVER_SET_INFO)
  142. GetProcAddress("NetServerSetInfo");
  143. m_pfnNetServerGetInfo = (PFN_NETAPI32_NET_SERVER_GET_INFO)
  144. GetProcAddress("NetServerGetInfo");
  145. m_pfnNetGetDCName = (PFN_NETAPI32_NET_GET_DC_NAME)
  146. GetProcAddress("NetGetDCName");
  147. m_pfnNetWkstaGetInfo = (PFN_NETAPI32_NET_WKSTA_GET_INFO)
  148. GetProcAddress("NetWkstaGetInfo");
  149. m_pfnNetGetAnyDCName = (PFN_NETAPI32_NET_GET_ANY_DC_NAME)
  150. GetProcAddress("NetGetAnyDCName");
  151. m_pfnNetServerEnum = (PFN_NETAPI32_NET_SERVER_ENUM)
  152. GetProcAddress("NetServerEnum");
  153. m_pfnNetUserModalsGet = (PFN_NETAPI32_NET_USER_MODALS_GET)
  154. GetProcAddress("NetUserModalsGet");
  155. m_pfnNetScheduleJobAdd = (PFN_NETAPI32_NET_SCHEDULE_JOB_ADD)
  156. GetProcAddress("NetScheduleJobAdd");
  157. m_pfnNetScheduleJobDel = (PFN_NETAPI32_NET_SCHEDULE_JOB_DEL)
  158. GetProcAddress("NetScheduleJobDel");
  159. m_pfnNetScheduleJobEnum = (PFN_NETAPI32_NET_SCHEDULE_JOB_ENUM)
  160. GetProcAddress("NetScheduleJobEnum");
  161. m_pfnNetScheduleJobGetInfo = (PFN_NETAPI32_NET_SCHEDULE_JOB_GET_INFO)
  162. GetProcAddress("NetScheduleJobGetInfo");
  163. m_pfnNetUseGetInfo = (PFN_NETAPI32_NET_USE_GET_INFO)
  164. GetProcAddress("NetUseGetInfo");
  165. // ******* BEGIN: NT 4 and over only *******
  166. m_pfnNetEnumerateTrustedDomains = (PFN_NETAPI32_NET_ENUMERATE_TRUSTED_DOMAINS)
  167. GetProcAddress("NetEnumerateTrustedDomains");
  168. #ifdef NTONLY
  169. m_pfnDsGetDcNameW = (PFN_NETAPI32_DS_GET_DC_NAME)
  170. GetProcAddress("DsGetDcNameW");
  171. #else
  172. m_pfnDsGetDcNameA = (PFN_NETAPI32_DS_GET_DC_NAME)
  173. GetProcAddress("DsGetDcNameA");
  174. #endif
  175. // ******* END: NT4 and over only ***********
  176. // ******* BEGIN: NT 5 and over only *******
  177. m_pfnDsRoleGetPrimaryDomainInformation = (PFN_DS_ROLE_GET_PRIMARY_DOMAIN_INFORMATION)
  178. GetProcAddress("DsRoleGetPrimaryDomainInformation");
  179. m_pfnDsRoleFreeMemory = (PFN_DS_ROLE_FREE_MEMORY)
  180. GetProcAddress("DsRoleFreeMemory");
  181. m_pfnNetRenameMachineInDomain = (PFN_NET_RENAME_MACHINE_IN_DOMAIN)
  182. GetProcAddress("NetRenameMachineInDomain");
  183. m_pfnNetJoinDomain = (PFN_NET_JOIN_DOMAIN)
  184. GetProcAddress("NetJoinDomain");
  185. m_pfnNetUnjoinDomain = (PFN_NET_UNJOIN_DOMAIN)
  186. GetProcAddress("NetUnjoinDomain");
  187. // ******* END: NT5 and over only ***********
  188. // Note: Returns true as long as the core functions are there. The
  189. // nt4 and nt5 and over functions are optionally present; users should
  190. // call the function GetDllVersion (inherrited from the base class)
  191. // to check if the function is expected to be present based on the
  192. // version of the dll. Or they can rely on the fact that the function
  193. // will return false if the pointer is invalid (see function definition
  194. // below).
  195. if(m_pfnNetGroupEnum == NULL ||
  196. m_pfnNetGroupGetInfo == NULL ||
  197. m_pfnNetGroupSetInfo == NULL ||
  198. m_pfnNetLocalGroupGetInfo == NULL ||
  199. m_pfnNetLocalGroupSetInfo == NULL ||
  200. m_pfnNetGroupGetUsers == NULL ||
  201. m_pfnNetLocalGroupGetMembers == NULL ||
  202. m_pfnNetLocalGroupEnum == NULL ||
  203. m_pfnNetShareEnum == NULL ||
  204. m_pfnNetShareGetInfo == NULL ||
  205. m_pfnNetShareAdd == NULL ||
  206. m_pfnNetShareEnumSticky == NULL ||
  207. m_pfnNetShareSetInfo == NULL ||
  208. m_pfnNetShareDel == NULL ||
  209. m_pfnNetShareDelSticky == NULL ||
  210. m_pfnNetShareCheck == NULL ||
  211. m_pfnNetUserEnum == NULL ||
  212. m_pfnNetUserGetInfo == NULL ||
  213. m_pfnNetUserSetInfo == NULL ||
  214. m_pfnNetApiBufferFree == NULL ||
  215. m_pfnNetQueryDisplayInformation == NULL ||
  216. m_pfnNetServerSetInfo == NULL ||
  217. m_pfnNetServerGetInfo == NULL ||
  218. m_pfnNetGetDCName == NULL ||
  219. m_pfnNetWkstaGetInfo == NULL ||
  220. m_pfnNetGetAnyDCName == NULL ||
  221. m_pfnNetServerEnum == NULL ||
  222. m_pfnNetUserModalsGet == NULL ||
  223. m_pfnNetScheduleJobAdd == NULL ||
  224. m_pfnNetScheduleJobDel == NULL ||
  225. m_pfnNetScheduleJobEnum == NULL ||
  226. m_pfnNetScheduleJobGetInfo == NULL ||
  227. m_pfnNetUseGetInfo == NULL)
  228. {
  229. fRet = false;
  230. LogErrorMessage(L"Failed find entrypoint in NetApi32Api");
  231. }
  232. }
  233. return fRet;
  234. }
  235. /******************************************************************************
  236. * Member functions wrapping NetApi32 api functions. Add new functions here
  237. * as required.
  238. ******************************************************************************/
  239. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetGroupEnum
  240. (
  241. LPCWSTR a_servername,
  242. DWORD a_level,
  243. LPBYTE *a_bufptr,
  244. DWORD a_prefmaxlen,
  245. LPDWORD a_entriesread,
  246. LPDWORD a_totalentries,
  247. PDWORD_PTR a_resume_handle
  248. )
  249. {
  250. return m_pfnNetGroupEnum(a_servername, a_level, a_bufptr, a_prefmaxlen,
  251. a_entriesread, a_totalentries, a_resume_handle);
  252. }
  253. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetGroupGetInfo
  254. (
  255. LPCWSTR a_servername,
  256. LPCWSTR a_groupname,
  257. DWORD a_level,
  258. LPBYTE *a_bufptr
  259. )
  260. {
  261. return m_pfnNetGroupGetInfo(a_servername, a_groupname, a_level, a_bufptr);
  262. }
  263. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetGroupSetInfo
  264. (
  265. LPCWSTR a_servername,
  266. LPCWSTR a_groupname,
  267. DWORD a_level,
  268. LPBYTE a_buf,
  269. LPDWORD parm_err
  270. )
  271. {
  272. return m_pfnNetGroupSetInfo(a_servername, a_groupname, a_level, a_buf, parm_err ) ;
  273. }
  274. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetLocalGroupGetInfo
  275. (
  276. LPCWSTR a_servername,
  277. LPCWSTR a_groupname,
  278. DWORD a_level,
  279. LPBYTE *a_bufptr
  280. )
  281. {
  282. return m_pfnNetLocalGroupGetInfo(a_servername, a_groupname,
  283. a_level, a_bufptr);
  284. }
  285. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetLocalGroupSetInfo
  286. (
  287. LPCWSTR a_servername,
  288. LPCWSTR a_groupname,
  289. DWORD a_level,
  290. LPBYTE a_buf,
  291. LPDWORD a_parm_err
  292. )
  293. {
  294. return m_pfnNetLocalGroupSetInfo( a_servername,
  295. a_groupname,
  296. a_level,
  297. a_buf,
  298. a_parm_err ) ;
  299. }
  300. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetGroupGetUsers
  301. (
  302. LPCWSTR a_servername,
  303. LPCWSTR a_groupname,
  304. DWORD a_level,
  305. LPBYTE *a_bufptr,
  306. DWORD a_prefmaxlen,
  307. LPDWORD a_entriesread,
  308. LPDWORD a_totalentries,
  309. PDWORD_PTR a_ResumeHandle
  310. )
  311. {
  312. return m_pfnNetGroupGetUsers(a_servername, a_groupname, a_level, a_bufptr,
  313. a_prefmaxlen, a_entriesread, a_totalentries,
  314. a_ResumeHandle);
  315. }
  316. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetLocalGroupGetMembers
  317. (
  318. LPCWSTR a_servername,
  319. LPCWSTR a_groupname,
  320. DWORD a_level,
  321. LPBYTE *a_bufptr,
  322. DWORD a_prefmaxlen,
  323. LPDWORD a_entriesread,
  324. LPDWORD a_totalentries,
  325. PDWORD_PTR a_ResumeHandle
  326. )
  327. {
  328. return m_pfnNetLocalGroupGetMembers(a_servername, a_groupname, a_level,
  329. a_bufptr, a_prefmaxlen, a_entriesread,
  330. a_totalentries, a_ResumeHandle);
  331. }
  332. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetLocalGroupEnum
  333. (
  334. LPCWSTR a_servername,
  335. DWORD a_level,
  336. LPBYTE *a_bufptr,
  337. DWORD a_prefmaxlen,
  338. LPDWORD a_entriesread,
  339. LPDWORD a_totalentries,
  340. PDWORD_PTR a_resumehandle
  341. )
  342. {
  343. return m_pfnNetLocalGroupEnum(a_servername, a_level, a_bufptr, a_prefmaxlen,
  344. a_entriesread, a_totalentries,
  345. a_resumehandle);
  346. }
  347. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetShareEnum
  348. (
  349. LPTSTR a_servername,
  350. DWORD a_level,
  351. LPBYTE *a_bufptr,
  352. DWORD a_prefmaxlen,
  353. LPDWORD a_entriesread,
  354. LPDWORD a_totalentries,
  355. LPDWORD a_resume_handle
  356. )
  357. {
  358. return m_pfnNetShareEnum(a_servername, a_level, a_bufptr, a_prefmaxlen,
  359. a_entriesread, a_totalentries, a_resume_handle);
  360. }
  361. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetShareGetInfo
  362. (
  363. LPTSTR a_servername,
  364. LPTSTR a_netname,
  365. DWORD a_level,
  366. LPBYTE *a_bufptr
  367. )
  368. {
  369. return m_pfnNetShareGetInfo(a_servername, a_netname, a_level, a_bufptr);
  370. }
  371. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetShareAdd
  372. (
  373. LPTSTR a_servername,
  374. DWORD a_level,
  375. LPBYTE a_buf,
  376. LPDWORD a_parm_err
  377. )
  378. {
  379. return m_pfnNetShareAdd(a_servername, a_level, a_buf , a_parm_err);
  380. }
  381. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetShareEnumSticky
  382. (
  383. LPTSTR a_servername,
  384. DWORD a_level,
  385. LPBYTE *a_bufptr,
  386. DWORD a_prefmaxlen,
  387. LPDWORD a_entriesread,
  388. LPDWORD a_totalentries,
  389. LPDWORD a_resume_handle
  390. )
  391. {
  392. return m_pfnNetShareEnumSticky(a_servername, a_level, a_bufptr,
  393. a_prefmaxlen, a_entriesread,
  394. a_totalentries, a_resume_handle);
  395. }
  396. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetShareSetInfo
  397. (
  398. LPTSTR a_servername,
  399. LPTSTR a_netname,
  400. DWORD a_level,
  401. LPBYTE a_buf,
  402. LPDWORD a_parm_err
  403. )
  404. {
  405. return m_pfnNetShareSetInfo(a_servername, a_netname,
  406. a_level, a_buf, a_parm_err);
  407. }
  408. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetShareDel
  409. (
  410. LPTSTR a_servername,
  411. LPTSTR a_netname,
  412. DWORD a_reserved
  413. )
  414. {
  415. return m_pfnNetShareDel(a_servername, a_netname, a_reserved);
  416. }
  417. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetShareDelSticky
  418. (
  419. LPTSTR a_servername,
  420. LPTSTR a_netname,
  421. DWORD a_reserved
  422. )
  423. {
  424. return m_pfnNetShareDelSticky(a_servername, a_netname, a_reserved);
  425. }
  426. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetShareCheck
  427. (
  428. LPTSTR a_servername,
  429. LPTSTR a_device,
  430. LPDWORD a_type
  431. )
  432. {
  433. return m_pfnNetShareCheck(a_servername, a_device, a_type);
  434. }
  435. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetUserEnum
  436. (
  437. LPCWSTR a_servername,
  438. DWORD a_level,
  439. DWORD a_filter,
  440. LPBYTE *a_bufptr,
  441. DWORD a_prefmaxlen,
  442. LPDWORD a_entriesread,
  443. LPDWORD a_totalentries,
  444. LPDWORD a_resume_handle
  445. )
  446. {
  447. return m_pfnNetUserEnum(a_servername, a_level, a_filter,
  448. a_bufptr, a_prefmaxlen, a_entriesread,
  449. a_totalentries, a_resume_handle);
  450. }
  451. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetUserGetInfo
  452. (
  453. LPCWSTR a_servername,
  454. LPCWSTR a_username,
  455. DWORD a_level,
  456. LPBYTE *a_bufptr
  457. )
  458. {
  459. return m_pfnNetUserGetInfo(a_servername, a_username, a_level, a_bufptr);
  460. }
  461. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetUserSetInfo(
  462. LPCWSTR a_servername,
  463. LPCWSTR a_username,
  464. DWORD a_level,
  465. LPBYTE a_buf,
  466. LPDWORD a_parm_err
  467. )
  468. {
  469. return m_pfnNetUserSetInfo( a_servername, a_username, a_level, a_buf, a_parm_err) ;
  470. }
  471. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetApiBufferFree
  472. (
  473. void *a_bufptr
  474. )
  475. {
  476. return m_pfnNetApiBufferFree(a_bufptr);
  477. }
  478. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetQueryDisplayInformation
  479. (
  480. LPWSTR a_ServerName,
  481. DWORD a_Level,
  482. DWORD a_Index,
  483. DWORD a_EntriesRequested,
  484. DWORD a_PreferredMaximumLength,
  485. LPDWORD a_ReturnedEntryCount,
  486. PVOID *a_SortedBuffer
  487. )
  488. {
  489. return m_pfnNetQueryDisplayInformation(a_ServerName, a_Level, a_Index,
  490. a_EntriesRequested,
  491. a_PreferredMaximumLength,
  492. a_ReturnedEntryCount,
  493. a_SortedBuffer);
  494. }
  495. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetServerSetInfo
  496. (
  497. LPTSTR a_servername,
  498. DWORD a_level,
  499. LPBYTE a_buf,
  500. LPDWORD a_ParmError
  501. )
  502. {
  503. return m_pfnNetServerSetInfo(a_servername, a_level, a_buf, a_ParmError);
  504. }
  505. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetServerGetInfo
  506. (
  507. LPTSTR a_servername,
  508. DWORD a_level,
  509. LPBYTE *a_bufptr
  510. )
  511. {
  512. return m_pfnNetServerGetInfo(a_servername, a_level, a_bufptr);
  513. }
  514. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetGetDCName
  515. ( LPCWSTR a_servername,
  516. LPCWSTR a_domainname,
  517. LPBYTE *a_bufptr
  518. )
  519. {
  520. return m_pfnNetGetDCName(a_servername, a_domainname, a_bufptr);
  521. }
  522. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetWkstaGetInfo
  523. (
  524. LPWSTR a_servername,
  525. DWORD a_level,
  526. LPBYTE *a_bufptr
  527. )
  528. {
  529. return m_pfnNetWkstaGetInfo(a_servername, a_level, a_bufptr);
  530. }
  531. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetGetAnyDCName
  532. (
  533. LPWSTR a_servername,
  534. LPWSTR a_domainname,
  535. LPBYTE *a_bufptr
  536. )
  537. {
  538. return m_pfnNetGetAnyDCName(a_servername, a_domainname, a_bufptr);
  539. }
  540. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetServerEnum
  541. (
  542. LPTSTR a_servername,
  543. DWORD a_level,
  544. LPBYTE *a_bufptr,
  545. DWORD a_prefmaxlen,
  546. LPDWORD a_entriesread,
  547. LPDWORD a_totalentries,
  548. DWORD a_servertype,
  549. LPTSTR a_domain,
  550. LPDWORD a_resume_handle
  551. )
  552. {
  553. return m_pfnNetServerEnum(a_servername, a_level, a_bufptr, a_prefmaxlen,
  554. a_entriesread, a_totalentries, a_servertype,
  555. a_domain, a_resume_handle);
  556. }
  557. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetUserModalsGet
  558. (
  559. LPWSTR a_servername,
  560. DWORD a_level,
  561. LPBYTE *a_bufptr
  562. )
  563. {
  564. return m_pfnNetUserModalsGet(a_servername, a_level, a_bufptr);
  565. }
  566. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetScheduleJobAdd
  567. (
  568. LPCWSTR a_Servername,
  569. LPBYTE a_Buffer,
  570. LPDWORD a_JobId
  571. )
  572. {
  573. return m_pfnNetScheduleJobAdd(a_Servername, a_Buffer, a_JobId);
  574. }
  575. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetScheduleJobDel
  576. (
  577. LPCWSTR a_Servername,
  578. DWORD a_MinJobId,
  579. DWORD a_MaxJobId
  580. )
  581. {
  582. return m_pfnNetScheduleJobDel(a_Servername, a_MinJobId , a_MaxJobId);
  583. }
  584. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetScheduleJobEnum
  585. (
  586. LPCWSTR a_Servername,
  587. LPBYTE *a_PointerToBuffer,
  588. DWORD a_PrefferedMaximumLength,
  589. LPDWORD a_EntriesRead,
  590. LPDWORD a_TotalEntries,
  591. LPDWORD a_ResumeHandle
  592. )
  593. {
  594. return m_pfnNetScheduleJobEnum(a_Servername, a_PointerToBuffer,
  595. a_PrefferedMaximumLength, a_EntriesRead,
  596. a_TotalEntries, a_ResumeHandle);
  597. }
  598. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetScheduleJobGetInfo
  599. (
  600. LPCWSTR a_Servername,
  601. DWORD a_JobId,
  602. LPBYTE *a_PointerToBuffer
  603. )
  604. {
  605. return m_pfnNetScheduleJobGetInfo(a_Servername, a_JobId ,
  606. a_PointerToBuffer);
  607. }
  608. NET_API_STATUS NET_API_FUNCTION CNetApi32Api::NetUseGetInfo
  609. (
  610. LPCWSTR a_UncServerName,
  611. LPCWSTR a_UseName,
  612. DWORD a_Level,
  613. LPBYTE *a_BufPtr
  614. )
  615. {
  616. return m_pfnNetUseGetInfo(a_UncServerName, a_UseName, a_Level, a_BufPtr);
  617. }
  618. // ******* BEGIN: NT 4 and over only *******
  619. // This member function's wrapped pointer has not been validated as it may
  620. // not exist on all versions of the dll. Hence the wrapped function's normal
  621. // return value is returned via the last parameter, while the result of the
  622. // function indicates whether the function existed or not in the wrapped dll.
  623. bool NET_API_FUNCTION CNetApi32Api::NetEnumerateTrustedDomains
  624. (
  625. LPCWSTR a_servername,
  626. LPWSTR *a_domainNames,
  627. NET_API_STATUS *a_pnasRetval
  628. )
  629. {
  630. bool t_fExists = false;
  631. if(m_pfnNetEnumerateTrustedDomains != NULL)
  632. {
  633. NET_API_STATUS t_nasTemp = m_pfnNetEnumerateTrustedDomains(a_servername,
  634. a_domainNames);
  635. t_fExists = true;
  636. if(a_pnasRetval != NULL)
  637. {
  638. *a_pnasRetval = t_nasTemp;
  639. }
  640. }
  641. return t_fExists;
  642. }
  643. // This member function's wrapped pointer has not been validated as it may
  644. // not exist on all versions of the dll. Hence the wrapped function's normal
  645. // return value is returned via the last parameter, while the result of the
  646. // function indicates whether the function existed or not in the wrapped dll.
  647. bool NET_API_FUNCTION CNetApi32Api::DsGetDCName
  648. (
  649. LPCTSTR a_ComputerName,
  650. LPCTSTR a_DomainName,
  651. GUID *a_DomainGuid,
  652. LPCTSTR a_SiteName,
  653. ULONG a_Flags,
  654. PDOMAIN_CONTROLLER_INFO *a_DomainControllerInfo,
  655. NET_API_STATUS *a_pnasRetval
  656. )
  657. {
  658. bool t_fExists = false;
  659. PVOID pfn = NULL ;
  660. #ifdef NTONLY
  661. pfn = m_pfnDsGetDcNameW ;
  662. #else
  663. pfn = m_pfnDsGetDcNameA ;
  664. #endif
  665. if( pfn != NULL )
  666. {
  667. #ifdef NTONLY
  668. NET_API_STATUS t_nasTemp = m_pfnDsGetDcNameW(a_ComputerName,
  669. a_DomainName, a_DomainGuid, a_SiteName, a_Flags,
  670. a_DomainControllerInfo);
  671. #else
  672. NET_API_STATUS t_nasTemp = m_pfnDsGetDcNameA(a_ComputerName,
  673. a_DomainName, a_DomainGuid, a_SiteName, a_Flags,
  674. a_DomainControllerInfo);
  675. #endif
  676. t_fExists = true;
  677. if(a_pnasRetval != NULL)
  678. {
  679. *a_pnasRetval = t_nasTemp;
  680. }
  681. }
  682. return t_fExists;
  683. }
  684. // ******* END: NT4 and over only ***********
  685. // ******* BEGIN: NT 5 and over only *******
  686. // This member function's wrapped pointer has not been validated as it may
  687. // not exist on all versions of the dll. Hence the wrapped function's normal
  688. // return value is returned via the last parameter, while the result of the
  689. // function indicates whether the function existed or not in the wrapped dll.
  690. bool NET_API_FUNCTION CNetApi32Api::DSRoleGetPrimaryDomainInformation
  691. (
  692. LPCWSTR a_servername,
  693. DSROLE_PRIMARY_DOMAIN_INFO_LEVEL a_level,
  694. LPBYTE *a_bufptr,
  695. NET_API_STATUS *a_pnasRetval
  696. )
  697. {
  698. bool t_fExists = false;
  699. if(m_pfnDsRoleGetPrimaryDomainInformation != NULL)
  700. {
  701. NET_API_STATUS t_nasTemp = m_pfnDsRoleGetPrimaryDomainInformation(
  702. a_servername, a_level,
  703. a_bufptr);
  704. t_fExists = true;
  705. if(a_pnasRetval != NULL)
  706. {
  707. *a_pnasRetval = t_nasTemp;
  708. }
  709. }
  710. return t_fExists;
  711. }
  712. // This member function's wrapped pointer has not been validated as it may
  713. // not exist on all versions of the dll. Hence the wrapped function's normal
  714. // return value is returned via the last parameter, while the result of the
  715. // function indicates whether the function existed or not in the wrapped dll.
  716. bool NET_API_FUNCTION CNetApi32Api::DSRoleFreeMemory
  717. (
  718. LPBYTE a_bufptr,
  719. NET_API_STATUS *a_pnasRetval
  720. )
  721. {
  722. bool t_fExists = false;
  723. if(m_pfnDsRoleFreeMemory != NULL)
  724. {
  725. NET_API_STATUS t_nasTemp = m_pfnDsRoleFreeMemory(a_bufptr);
  726. t_fExists = true;
  727. if(a_pnasRetval != NULL)
  728. {
  729. *a_pnasRetval = t_nasTemp;
  730. }
  731. }
  732. return t_fExists;
  733. }
  734. // This member function's wrapped pointer has not been validated as it may
  735. // not exist on all versions of the dll. Hence the wrapped function's normal
  736. // return value is returned via the last parameter, while the result of the
  737. // function indicates whether the function existed or not in the wrapped dll.
  738. bool NET_API_FUNCTION CNetApi32Api::NetRenameMachineInDomain
  739. (
  740. LPCWSTR a_lpServer,
  741. LPCWSTR a_lpNewMachineName,
  742. LPCWSTR a_lpAccount,
  743. LPCWSTR a_lpPassword,
  744. DWORD a_fRenameOptions,
  745. NET_API_STATUS *a_pnasRetval
  746. )
  747. {
  748. bool t_fExists = false;
  749. if(m_pfnNetRenameMachineInDomain != NULL)
  750. {
  751. NET_API_STATUS t_nasTemp = m_pfnNetRenameMachineInDomain(a_lpServer,
  752. a_lpNewMachineName,
  753. a_lpAccount,
  754. a_lpPassword,
  755. a_fRenameOptions
  756. );
  757. t_fExists = true;
  758. if(a_pnasRetval != NULL)
  759. {
  760. *a_pnasRetval = t_nasTemp;
  761. }
  762. }
  763. return t_fExists;
  764. }
  765. // This member function's wrapped pointer has not been validated as it may
  766. // not exist on all versions of the dll. Hence the wrapped function's normal
  767. // return value is returned via the last parameter, while the result of the
  768. // function indicates whether the function existed or not in the wrapped dll.
  769. bool NET_API_FUNCTION CNetApi32Api::NetJoinDomain
  770. (
  771. LPCWSTR lpServer,
  772. LPCWSTR lpDomain,
  773. LPCWSTR lpAccountOU,
  774. LPCWSTR lpAccount,
  775. LPCWSTR lpPassword,
  776. DWORD fJoinOptions,
  777. NET_API_STATUS *a_pnasRetval
  778. )
  779. {
  780. bool t_fExists = false;
  781. if(m_pfnNetJoinDomain != NULL)
  782. {
  783. NET_API_STATUS t_nasTemp = m_pfnNetJoinDomain(lpServer,
  784. lpDomain,
  785. lpAccountOU,
  786. lpAccount,
  787. lpPassword,
  788. fJoinOptions);
  789. t_fExists = true;
  790. if(a_pnasRetval != NULL)
  791. {
  792. *a_pnasRetval = t_nasTemp;
  793. }
  794. }
  795. return t_fExists;
  796. }
  797. // This member function's wrapped pointer has not been validated as it may
  798. // not exist on all versions of the dll. Hence the wrapped function's normal
  799. // return value is returned via the last parameter, while the result of the
  800. // function indicates whether the function existed or not in the wrapped dll.
  801. bool NET_API_FUNCTION CNetApi32Api::NetUnjoinDomain
  802. (
  803. LPCWSTR lpServer,
  804. LPCWSTR lpAccount,
  805. LPCWSTR lpPassword,
  806. DWORD fUnjoinOptions,
  807. NET_API_STATUS *a_pnasRetval
  808. )
  809. {
  810. bool t_fExists = false;
  811. if(m_pfnNetUnjoinDomain != NULL)
  812. {
  813. NET_API_STATUS t_nasTemp = m_pfnNetUnjoinDomain(lpServer,
  814. lpAccount,
  815. lpPassword,
  816. fUnjoinOptions);
  817. t_fExists = true;
  818. if(a_pnasRetval != NULL)
  819. {
  820. *a_pnasRetval = t_nasTemp;
  821. }
  822. }
  823. return t_fExists;
  824. }
  825. // ******* END: NT5 and over only ***********