Source code of Windows XP (NT5)
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.

6899 lines
151 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. llsrpc.c
  5. Abstract:
  6. Client side RPC wrappers for License Logging Service.
  7. Author:
  8. Arthur Hanson (arth) 30-Jan-1995
  9. Revision History:
  10. Jeff Parham (jeffparh) 04-Dec-1995
  11. o Forced include of LLS API prototypes, exposing an incorrect prototype
  12. in LLSAPI.H.
  13. o Fixed case where an LSA access denied was interpreted as implying the
  14. server had no DC, rather than properly bubbling the access denied back
  15. to the caller (of LlsConnectEnterprise()). This plugs a security hole
  16. wherein a non-admin user with the ability to read the System registry
  17. key would be allowed to administer domain licenses through
  18. License Manager. (Bug #11441.)
  19. o Added functions to support extended LLSRPC API.
  20. o Removed replication dependency on no further LlsConnect()'s being made
  21. until replication was completed.
  22. o Installed lock around llsrpc_handle global binding variable. Required
  23. addition of DllMain() function.
  24. o Added LLSRPC capabilities detection. Upon connection, the client
  25. requests the server's capabilities (an RPC call which itself will fail
  26. when connected to a 3.51 server). The capabilities set is an
  27. arbitrary bit field, but individual bits are normally defined to
  28. indicate that a specific feature has been implemented at the server.
  29. o Added szServerName filed to LOCAL_HANDLE to remember the name of the
  30. machine to which we're connected.
  31. --*/
  32. #include <nt.h>
  33. #include <ntlsa.h>
  34. #include <ntsam.h>
  35. #include <ntrtl.h>
  36. #include <nturtl.h>
  37. #include <windows.h>
  38. #include <lm.h>
  39. #include <dsgetdc.h>
  40. #include <dsrole.h>
  41. #include "debug.h"
  42. #include "llsapi.h"
  43. #include "llsrpc_c.h"
  44. #include "lsapi_c.h"
  45. // #define API_TRACE
  46. typedef struct _GENERIC_INFO_CONTAINER {
  47. DWORD EntriesRead;
  48. LPBYTE Buffer;
  49. } GENERIC_INFO_CONTAINER, *PGENERIC_INFO_CONTAINER, *LPGENERIC_INFO_CONTAINER ;
  50. typedef struct _GENERIC_ENUM_STRUCT {
  51. DWORD Level;
  52. PGENERIC_INFO_CONTAINER Container;
  53. } GENERIC_ENUM_STRUCT, *PGENERIC_ENUM_STRUCT, *LPGENERIC_ENUM_STRUCT ;
  54. typedef struct _LOCAL_HANDLE {
  55. TCHAR szServerName[ 3 + MAX_PATH ];
  56. LPTSTR pszStringBinding;
  57. handle_t llsrpc_handle;
  58. LLS_HANDLE Handle;
  59. BYTE Capabilities[ ( LLS_CAPABILITY_MAX + 7 ) / 8 ];
  60. } LOCAL_HANDLE, *PLOCAL_HANDLE;
  61. LPTSTR pszStringBinding = NULL;
  62. RTL_CRITICAL_SECTION g_RpcHandleLock;
  63. /////////////////////////////////////////////////////////////////////////
  64. BOOL APIENTRY DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
  65. /*++
  66. Routine Description:
  67. Standard DLL entry point.
  68. Arguments:
  69. hInstance (HINSTANCE)
  70. dwReason (DWORD)
  71. lpReserved (LPVOID)
  72. Return Value:
  73. TRUE if successful.
  74. --*/
  75. {
  76. NTSTATUS nt = STATUS_SUCCESS;
  77. switch (dwReason)
  78. {
  79. case DLL_PROCESS_ATTACH:
  80. DisableThreadLibraryCalls(hInstance);
  81. nt = RtlInitializeCriticalSection( &g_RpcHandleLock );
  82. break;
  83. case DLL_PROCESS_DETACH:
  84. nt = RtlDeleteCriticalSection( &g_RpcHandleLock );
  85. break;
  86. }
  87. return NT_SUCCESS( nt );
  88. }
  89. /////////////////////////////////////////////////////////////////////////
  90. NTSTATUS
  91. NTDomainGet(
  92. LPTSTR ServerName,
  93. LPTSTR Domain
  94. )
  95. /*++
  96. Routine Description:
  97. Arguments:
  98. Return Value:
  99. None.
  100. --*/
  101. {
  102. TCHAR Serv[MAX_PATH + 3];
  103. UNICODE_STRING us;
  104. NTSTATUS ret;
  105. OBJECT_ATTRIBUTES oa;
  106. ACCESS_MASK am;
  107. SECURITY_QUALITY_OF_SERVICE qos;
  108. LSA_HANDLE hLSA;
  109. PPOLICY_PRIMARY_DOMAIN_INFO pvBuffer;
  110. lstrcpy(Domain, TEXT(""));
  111. // only need read access
  112. //
  113. //am = POLICY_READ | POLICY_VIEW_LOCAL_INFORMATION;
  114. am = MAXIMUM_ALLOWED;
  115. // set up quality of service
  116. qos.Length = sizeof(SECURITY_QUALITY_OF_SERVICE);
  117. qos.ImpersonationLevel = SecurityImpersonation;
  118. qos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING;
  119. qos.EffectiveOnly = FALSE;
  120. // Macro sets everything except security field
  121. InitializeObjectAttributes( &oa, NULL, 0L, NULL, NULL );
  122. oa.SecurityQualityOfService = &qos;
  123. if ( (ServerName == NULL) || (ServerName[0] == TEXT('\0')) )
  124. ret = LsaOpenPolicy(NULL, &oa, am, &hLSA);
  125. else {
  126. if (ServerName[0] == TEXT('\\'))
  127. lstrcpy(Serv, ServerName);
  128. else
  129. wsprintf(Serv, TEXT("\\\\%s"), ServerName);
  130. // Set up unicode string structure
  131. us.Length = (USHORT)(lstrlen(Serv) * sizeof(TCHAR));
  132. us.MaximumLength = us.Length + sizeof(TCHAR);
  133. us.Buffer = Serv;
  134. ret = LsaOpenPolicy(&us, &oa, am, &hLSA);
  135. }
  136. if (!ret) {
  137. ret = LsaQueryInformationPolicy(hLSA, PolicyPrimaryDomainInformation, (PVOID *) &pvBuffer);
  138. LsaClose(hLSA);
  139. if ((!ret) && (pvBuffer != NULL) && (pvBuffer->Sid != NULL)) {
  140. lstrcpy(Domain, pvBuffer->Name.Buffer);
  141. LsaFreeMemory((PVOID) pvBuffer);
  142. } else
  143. if (!ret)
  144. ret = STATUS_UNSUCCESSFUL;
  145. }
  146. return ret;
  147. } // NTDomainGet
  148. /////////////////////////////////////////////////////////////////////////
  149. NTSTATUS
  150. EnterpriseServerGet(
  151. LPTSTR ServerName,
  152. LPTSTR pEnterpriseServer
  153. )
  154. /*++
  155. Routine Description:
  156. Arguments:
  157. Return Value:
  158. None.
  159. --*/
  160. {
  161. HKEY hKey = NULL;
  162. HKEY hKey2 = NULL;
  163. BOOL Enterprise = FALSE;
  164. BOOL bIsNetBIOSName = TRUE;
  165. DWORD dwType, dwSize;
  166. TCHAR RegKeyText[512];
  167. NTSTATUS Status;
  168. DWORD UseEnterprise;
  169. TCHAR EnterpriseServer[MAX_PATH + 3] = TEXT("");
  170. LPTSTR pName = ServerName;
  171. Status = RegConnectRegistry(ServerName, HKEY_LOCAL_MACHINE, &hKey);
  172. if (Status == ERROR_SUCCESS) {
  173. //
  174. // Create registry key-name we are looking for
  175. //
  176. lstrcpy(RegKeyText, TEXT("System\\CurrentControlSet\\Services\\LicenseService\\Parameters"));
  177. if ((Status = RegOpenKeyEx(hKey, RegKeyText, 0, KEY_READ, &hKey2)) == ERROR_SUCCESS) {
  178. dwSize = sizeof(UseEnterprise);
  179. Status = RegQueryValueEx(hKey2, TEXT("UseEnterprise"), NULL, &dwType, (LPBYTE) &UseEnterprise, &dwSize);
  180. if ((Status == ERROR_SUCCESS) && (UseEnterprise == 1)) {
  181. //
  182. // ** NEW - NT 5.0 **
  183. //
  184. // NB : This is temporary code! The proper way to do this is to
  185. // consult the license settings object in the site in which
  186. // the server resides.
  187. //
  188. // Read the SiteServer value first, if available, to get the site
  189. // server's DNS name. If this fails, default to EnterpriseServer.
  190. //
  191. dwSize = sizeof(EnterpriseServer);
  192. Status = RegQueryValueEx(hKey2,
  193. TEXT("SiteServer"),
  194. NULL,
  195. &dwType,
  196. (LPBYTE) &EnterpriseServer,
  197. &dwSize);
  198. if (Status == ERROR_SUCCESS && EnterpriseServer[0]) {
  199. bIsNetBIOSName = FALSE;
  200. }
  201. else {
  202. dwSize = sizeof(EnterpriseServer);
  203. Status = RegQueryValueEx(hKey2,
  204. TEXT("EnterpriseServer"),
  205. NULL,
  206. &dwType,
  207. (LPBYTE) &EnterpriseServer,
  208. &dwSize);
  209. }
  210. if (Status == ERROR_SUCCESS) {
  211. pName = EnterpriseServer;
  212. }
  213. }
  214. RegCloseKey(hKey2);
  215. }
  216. RegCloseKey(hKey);
  217. }
  218. if (bIsNetBIOSName && *pName != TEXT('\\')) {
  219. lstrcpy(pEnterpriseServer, TEXT("\\\\"));
  220. lstrcat(pEnterpriseServer, pName);
  221. } else
  222. lstrcpy(pEnterpriseServer, pName);
  223. return STATUS_SUCCESS;
  224. } // EnterpriseServerGet
  225. /////////////////////////////////////////////////////////////////////////
  226. /////////////////////////////////////////////////////////////////////////
  227. /////////////////////////////////////////////////////////////////////////
  228. /////////////////////////////////////////////////////////////////////////
  229. NTSTATUS
  230. NTAPI
  231. LlsEnterpriseServerFindW(
  232. LPTSTR Focus,
  233. DWORD Level,
  234. LPBYTE *BufPtr
  235. )
  236. /*++
  237. Routine Description:
  238. Arguments:
  239. Return Value:
  240. None.
  241. --*/
  242. {
  243. NTSTATUS Status;
  244. LPTSTR pFocus;
  245. BOOL Domain = TRUE;
  246. LPTSTR pszUuid = NULL;
  247. LPTSTR pszProtocolSequence = NULL;
  248. LPTSTR pszNetworkAddress = NULL;
  249. LPTSTR pszEndpoint = NULL;
  250. LPTSTR pszOptions = NULL;
  251. TCHAR EnterpriseServer[MAX_PATH + 4];
  252. TCHAR pDomain[MAX_PATH + 4];
  253. DWORD uRet;
  254. PDOMAIN_CONTROLLER_INFO pbBuffer = NULL;
  255. PLLS_CONNECT_INFO_0 pConnectInfo;
  256. ULONG Size;
  257. DSROLE_PRIMARY_DOMAIN_INFO_BASIC *pDomainInfo = NULL;
  258. BOOL fInWorkgroup = TRUE;
  259. if (Level != 0)
  260. return STATUS_INVALID_LEVEL;
  261. pDomain[0] = 0;
  262. EnterpriseServer[0] = 0;
  263. //
  264. // Figure out if doing domain or server
  265. //
  266. pFocus = Focus;
  267. if (pFocus !=NULL)
  268. while ((*pFocus != TEXT('\0')) && (*pFocus == TEXT('\\'))) {
  269. Domain = FALSE;
  270. pFocus++;
  271. }
  272. uRet = DsRoleGetPrimaryDomainInformation((!Domain) ? Focus : NULL,
  273. DsRolePrimaryDomainInfoBasic,
  274. (PBYTE *) &pDomainInfo);
  275. if ((uRet == NO_ERROR) && (pDomainInfo != NULL) && (pDomainInfo->MachineRole != DsRole_RoleStandaloneWorkstation) && (pDomainInfo->MachineRole != DsRole_RoleStandaloneServer))
  276. {
  277. fInWorkgroup = FALSE;
  278. }
  279. if ((uRet == NO_ERROR) && (pDomainInfo != NULL))
  280. {
  281. DsRoleFreeMemory(pDomainInfo);
  282. }
  283. if (!fInWorkgroup)
  284. {
  285. //
  286. // If we got a domain find the DC of it, else find DC of server
  287. //
  288. if (!Domain) {
  289. uRet = DsGetDcName(Focus, NULL, NULL, NULL, DS_BACKGROUND_ONLY, &pbBuffer);
  290. } else {
  291. //
  292. // Get the DC name of wherever we are going
  293. //
  294. if ((pFocus == NULL) || (*pFocus == TEXT('\0')))
  295. uRet = DsGetDcName(NULL, NULL, NULL, NULL, DS_BACKGROUND_ONLY, &pbBuffer);
  296. else
  297. uRet = DsGetDcName(NULL, pFocus, NULL, NULL, DS_BACKGROUND_ONLY, &pbBuffer);
  298. }
  299. }
  300. else
  301. {
  302. //
  303. // Not in a domain, don't call DsGetDcName
  304. //
  305. uRet = ERROR_NO_SUCH_DOMAIN;
  306. }
  307. if (uRet || (pbBuffer == NULL)) {
  308. //
  309. // If we focus on a server and can't find a domain then look for an
  310. // enterprise server. This is the case if the focus server is a
  311. // standalone system.
  312. //
  313. if (Domain == FALSE) {
  314. Status = EnterpriseServerGet((LPTSTR) Focus, EnterpriseServer);
  315. goto LlsEnterpriseServerFindWExit;
  316. }
  317. return STATUS_NO_SUCH_DOMAIN;
  318. } else {
  319. lstrcpy(pDomain,pbBuffer->DomainName);
  320. }
  321. //
  322. // Go to DC and figure out if they are replicating anywhere, if so go
  323. // to that system.
  324. //
  325. Status = EnterpriseServerGet((LPTSTR) (pbBuffer->DomainControllerName), EnterpriseServer);
  326. if (pbBuffer != NULL)
  327. NetApiBufferFree(pbBuffer);
  328. LlsEnterpriseServerFindWExit:
  329. if (Status != STATUS_SUCCESS)
  330. return Status;
  331. Size = sizeof(LLS_CONNECT_INFO_0);
  332. Size += ((lstrlen(pDomain) + 1) * sizeof(TCHAR));
  333. Size += ((lstrlen(EnterpriseServer) + 1) * sizeof(TCHAR));
  334. pConnectInfo = (PLLS_CONNECT_INFO_0) MIDL_user_allocate(Size);
  335. if (pConnectInfo == NULL)
  336. return STATUS_NO_MEMORY;
  337. pConnectInfo->Domain = (LPTSTR) (((PBYTE) pConnectInfo) + sizeof(LLS_CONNECT_INFO_0));
  338. pConnectInfo->EnterpriseServer = (LPTSTR) &pConnectInfo->Domain[lstrlen(pDomain) + 1];
  339. lstrcpy(pConnectInfo->Domain, pDomain);
  340. lstrcpy(pConnectInfo->EnterpriseServer, EnterpriseServer);
  341. *BufPtr = (LPBYTE) pConnectInfo;
  342. return Status;
  343. } // LlsEnterpriseServerFindW
  344. /////////////////////////////////////////////////////////////////////////
  345. NTSTATUS
  346. NTAPI
  347. LlsEnterpriseServerFindA(
  348. LPSTR Focus,
  349. DWORD Level,
  350. LPBYTE *BufPtr
  351. )
  352. /*++
  353. Routine Description:
  354. Arguments:
  355. Return Value:
  356. None.
  357. --*/
  358. {
  359. #ifdef API_TRACE
  360. dprintf(TEXT("LLSRPC.DLL: LlsEnterpriseServerFindA\n"));
  361. #endif
  362. return STATUS_NOT_SUPPORTED;
  363. } // LlsEnterpriseServerFindA
  364. /////////////////////////////////////////////////////////////////////////
  365. NTSTATUS
  366. NTAPI
  367. LlsConnectW(
  368. LPTSTR Server,
  369. LLS_HANDLE* Handle
  370. )
  371. /*++
  372. Routine Description:
  373. Arguments:
  374. Return Value:
  375. None.
  376. --*/
  377. {
  378. RPC_STATUS Status;
  379. LPTSTR pszUuid = NULL;
  380. LPTSTR pszProtocolSequence = NULL;
  381. LPTSTR pszNetworkAddress = NULL;
  382. LPTSTR pszEndpoint = NULL;
  383. LPTSTR pszOptions = NULL;
  384. TCHAR pComputer[MAX_COMPUTERNAME_LENGTH + 1];
  385. ULONG Size;
  386. PLOCAL_HANDLE pLocalHandle = NULL;
  387. handle_t prev_llsrpc_handle;
  388. #ifdef API_TRACE
  389. if (Server == NULL)
  390. dprintf(TEXT("LLSRPC.DLL: LlsConnectW: <NULL>\n"));
  391. else
  392. dprintf(TEXT("LLSRPC.DLL: LlsConnectW: %s\n"), Server);
  393. #endif
  394. //
  395. // ** NEW - NT 5.0 **
  396. //
  397. // The server name may either be a DNS name or a NetBIOS name.
  398. //
  399. if (Handle == NULL)
  400. return STATUS_INVALID_PARAMETER;
  401. *Handle = NULL;
  402. Size = sizeof(pComputer) / sizeof(TCHAR);
  403. GetComputerName(pComputer, &Size);
  404. if ((Server == NULL) || (*Server == TEXT('\0'))) {
  405. pszProtocolSequence = TEXT("ncalrpc");
  406. pszEndpoint = TEXT(LLS_LPC_ENDPOINT);
  407. pszNetworkAddress = NULL;
  408. } else {
  409. pszProtocolSequence = TEXT("ncacn_np");
  410. pszEndpoint = TEXT(LLS_NP_ENDPOINT);
  411. pszNetworkAddress = Server;
  412. }
  413. pLocalHandle = MIDL_user_allocate(sizeof(LOCAL_HANDLE));
  414. if (pLocalHandle == NULL)
  415. return STATUS_NO_MEMORY;
  416. pLocalHandle->pszStringBinding = NULL;
  417. pLocalHandle->llsrpc_handle = NULL;
  418. pLocalHandle->Handle = NULL;
  419. ZeroMemory( pLocalHandle->szServerName, sizeof( pLocalHandle->szServerName ) );
  420. if ( NULL != Server )
  421. {
  422. lstrcpyn( pLocalHandle->szServerName, Server, sizeof( pLocalHandle->szServerName ) / sizeof( *pLocalHandle->szServerName ) - 1 );
  423. }
  424. else
  425. {
  426. lstrcpy( pLocalHandle->szServerName, pComputer );
  427. }
  428. // Compose a string binding
  429. Status = RpcStringBindingComposeW(pszUuid,
  430. pszProtocolSequence,
  431. pszNetworkAddress,
  432. pszEndpoint,
  433. pszOptions,
  434. &pLocalHandle->pszStringBinding);
  435. if(Status) {
  436. #if DBG
  437. dprintf(TEXT("LLSRPC RpcStringBindingComposeW Failed: 0x%lX\n"), Status);
  438. #endif
  439. if(pLocalHandle->pszStringBinding)
  440. {
  441. RpcStringFree(&pLocalHandle->pszStringBinding);
  442. pLocalHandle->pszStringBinding = NULL;
  443. }
  444. MIDL_user_free( pLocalHandle );
  445. return I_RpcMapWin32Status(Status);
  446. }
  447. RtlEnterCriticalSection( &g_RpcHandleLock );
  448. prev_llsrpc_handle = llsrpc_handle;
  449. llsrpc_handle = NULL;
  450. // Bind using the created string binding...
  451. Status = RpcBindingFromStringBindingW(pLocalHandle->pszStringBinding, &llsrpc_handle);
  452. if(Status) {
  453. #if DBG
  454. dprintf(TEXT("LLSRPC RpcBindingFromStringBindingW Failed: 0x%lX\n"), Status);
  455. #endif
  456. if(llsrpc_handle)
  457. {
  458. RpcBindingFree(llsrpc_handle);
  459. llsrpc_handle = prev_llsrpc_handle;
  460. }
  461. Status = I_RpcMapWin32Status(Status);
  462. }
  463. if ( NT_SUCCESS( Status ) )
  464. {
  465. pLocalHandle->llsrpc_handle = llsrpc_handle;
  466. try {
  467. Status = LlsrConnect(&pLocalHandle->Handle, pComputer);
  468. }
  469. except (TRUE) {
  470. Status = I_RpcMapWin32Status(RpcExceptionCode());
  471. #if DBG
  472. dprintf(TEXT("LLSRPC ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  473. #endif
  474. }
  475. if ( NT_SUCCESS( Status ) )
  476. {
  477. // get server capabilities
  478. try {
  479. LlsrCapabilityGet( pLocalHandle->Handle, sizeof( pLocalHandle->Capabilities ), pLocalHandle->Capabilities );
  480. }
  481. except (TRUE) {
  482. Status = I_RpcMapWin32Status(RpcExceptionCode());
  483. if ( RPC_NT_PROCNUM_OUT_OF_RANGE == Status )
  484. {
  485. // 'salright; API doesn't exist at target server (it's running 3.51)
  486. ZeroMemory( pLocalHandle->Capabilities, sizeof( pLocalHandle->Capabilities ) );
  487. Status = STATUS_SUCCESS;
  488. }
  489. else
  490. {
  491. #if DBG
  492. dprintf(TEXT("LLSRPC ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  493. #endif
  494. }
  495. }
  496. if ( !NT_SUCCESS( Status ) )
  497. {
  498. LlsClose( pLocalHandle );
  499. }
  500. else
  501. {
  502. *Handle = (LLS_HANDLE) pLocalHandle;
  503. }
  504. }
  505. else
  506. {
  507. if(pLocalHandle->pszStringBinding)
  508. {
  509. RpcStringFree(&pLocalHandle->pszStringBinding);
  510. pLocalHandle->pszStringBinding = NULL;
  511. }
  512. if(llsrpc_handle)
  513. {
  514. RpcBindingFree(llsrpc_handle);
  515. llsrpc_handle = prev_llsrpc_handle;
  516. }
  517. MIDL_user_free( pLocalHandle );
  518. }
  519. }
  520. else
  521. {
  522. if(pLocalHandle->pszStringBinding)
  523. RpcStringFree(&pLocalHandle->pszStringBinding);
  524. MIDL_user_free( pLocalHandle );
  525. }
  526. llsrpc_handle = prev_llsrpc_handle;
  527. RtlLeaveCriticalSection( &g_RpcHandleLock );
  528. return Status;
  529. } // LlsConnectW
  530. /////////////////////////////////////////////////////////////////////////
  531. NTSTATUS
  532. NTAPI
  533. LlsConnectA(
  534. LPSTR Server,
  535. LLS_HANDLE* Handle
  536. )
  537. /*++
  538. Routine Description:
  539. Arguments:
  540. Return Value:
  541. None.
  542. --*/
  543. {
  544. #ifdef API_TRACE
  545. dprintf(TEXT("LLSRPC.DLL: LlsConnectA\n"));
  546. #endif
  547. return STATUS_NOT_SUPPORTED;
  548. } // LlsConnectA
  549. /////////////////////////////////////////////////////////////////////////
  550. NTSTATUS
  551. NTAPI
  552. LlsConnectEnterpriseW(
  553. LPTSTR Focus,
  554. LLS_HANDLE* Handle,
  555. DWORD Level,
  556. LPBYTE *BufPtr
  557. )
  558. /*++
  559. Routine Description:
  560. Arguments:
  561. Return Value:
  562. None.
  563. --*/
  564. {
  565. NTSTATUS Status;
  566. PLLS_CONNECT_INFO_0 pConnectInfo;
  567. Status = LlsEnterpriseServerFindW(Focus, Level, BufPtr);
  568. if (Status)
  569. return Status;
  570. pConnectInfo = (PLLS_CONNECT_INFO_0) *BufPtr;
  571. Status = LlsConnectW(pConnectInfo->EnterpriseServer, Handle);
  572. return Status;
  573. } // LlsConnectEnterpriseW
  574. /////////////////////////////////////////////////////////////////////////
  575. NTSTATUS
  576. NTAPI
  577. LlsConnectEnterpriseA(
  578. LPSTR Focus,
  579. LLS_HANDLE* Handle,
  580. DWORD Level,
  581. LPBYTE *BufPtr
  582. )
  583. /*++
  584. Routine Description:
  585. Arguments:
  586. Return Value:
  587. None.
  588. --*/
  589. {
  590. #ifdef API_TRACE
  591. dprintf(TEXT("LLSRPC.DLL: LlsConnectEnterpriseA\n"));
  592. #endif
  593. return STATUS_NOT_SUPPORTED;
  594. } // LlsConnectEnterpriseA
  595. /////////////////////////////////////////////////////////////////////////
  596. NTSTATUS
  597. NTAPI
  598. LlsClose(
  599. LLS_HANDLE Handle
  600. )
  601. /*++
  602. Routine Description:
  603. Arguments:
  604. Return Value:
  605. None.
  606. --*/
  607. {
  608. RPC_STATUS Status;
  609. NTSTATUS NtStatus = STATUS_SUCCESS;
  610. PLOCAL_HANDLE pLocalHandle;
  611. pLocalHandle = (PLOCAL_HANDLE) Handle;
  612. if (pLocalHandle == NULL)
  613. return STATUS_INVALID_PARAMETER;
  614. try {
  615. NtStatus = LlsrCloseEx(&(pLocalHandle->Handle));
  616. }
  617. except (TRUE) {
  618. NtStatus = I_RpcMapWin32Status(RpcExceptionCode());
  619. #if DBG
  620. dprintf(TEXT("ERROR LLSRPC.DLL: LlsrCloseEx RPC Exception: 0x%lX\n"), NtStatus);
  621. #endif
  622. }
  623. //
  624. // LlsrCloseEx was added for NT 5.0. Check for downlevel.
  625. //
  626. if (NtStatus == RPC_S_PROCNUM_OUT_OF_RANGE) {
  627. try {
  628. NtStatus = LlsrClose(pLocalHandle->Handle);
  629. }
  630. except (TRUE) {
  631. NtStatus = I_RpcMapWin32Status(RpcExceptionCode());
  632. #if DBG
  633. dprintf(TEXT("ERROR LLSRPC.DLL: LlsrClose RPC Exception: 0x%lX\n"), NtStatus);
  634. #endif
  635. }
  636. }
  637. try {
  638. Status = RpcStringFree(&pLocalHandle->pszStringBinding);
  639. if (Status ) {
  640. NtStatus = I_RpcMapWin32Status(Status);
  641. #if DBG
  642. dprintf(TEXT("LLSRPC.DLL: LlsClose - RpcStringFree returned: 0x%lX\n"), NtStatus);
  643. #endif
  644. }
  645. Status = RpcBindingFree(&pLocalHandle->llsrpc_handle);
  646. if (Status ) {
  647. NtStatus = I_RpcMapWin32Status(Status);
  648. #if DBG
  649. dprintf(TEXT("LLSRPC.DLL: LlsClose - RpcBindingFree returned: 0x%lX\n"), NtStatus);
  650. #endif
  651. }
  652. }
  653. except (TRUE) {
  654. NtStatus = I_RpcMapWin32Status(RpcExceptionCode());
  655. #if DBG
  656. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), NtStatus);
  657. #endif
  658. }
  659. MIDL_user_free(pLocalHandle);
  660. return NtStatus;
  661. } // LlsClose
  662. /////////////////////////////////////////////////////////////////////////
  663. NTSTATUS
  664. NTAPI
  665. LlsFreeMemory(
  666. PVOID BufPtr
  667. )
  668. /*++
  669. Routine Description:
  670. Arguments:
  671. Return Value:
  672. None.
  673. --*/
  674. {
  675. MIDL_user_free( BufPtr );
  676. return STATUS_SUCCESS;
  677. } // LlsFreeMemory
  678. /////////////////////////////////////////////////////////////////////////
  679. NTSTATUS
  680. NTAPI
  681. LlsLicenseEnumW(
  682. LLS_HANDLE Handle,
  683. DWORD Level,
  684. LPBYTE* bufptr,
  685. DWORD PrefMaxLen,
  686. LPDWORD EntriesRead,
  687. LPDWORD TotalEntries,
  688. LPDWORD ResumeHandle
  689. )
  690. /*++
  691. Routine Description:
  692. Arguments:
  693. Return Value:
  694. None.
  695. --*/
  696. {
  697. NTSTATUS Status;
  698. GENERIC_INFO_CONTAINER GenericInfoContainer;
  699. GENERIC_ENUM_STRUCT InfoStruct;
  700. PLOCAL_HANDLE pLocalHandle;
  701. #ifdef API_TRACE
  702. dprintf(TEXT("LLSRPC.DLL: LlsLicenseEnumW\n"));
  703. #endif
  704. pLocalHandle = (PLOCAL_HANDLE) Handle;
  705. if (pLocalHandle == NULL)
  706. return STATUS_INVALID_PARAMETER;
  707. GenericInfoContainer.Buffer = NULL;
  708. GenericInfoContainer.EntriesRead = 0;
  709. InfoStruct.Container = &GenericInfoContainer;
  710. InfoStruct.Level = Level;
  711. try {
  712. Status = LlsrLicenseEnumW(
  713. pLocalHandle->Handle,
  714. (PLLS_LICENSE_ENUM_STRUCTW) &InfoStruct,
  715. PrefMaxLen,
  716. TotalEntries,
  717. ResumeHandle
  718. );
  719. }
  720. except (TRUE) {
  721. Status = I_RpcMapWin32Status(RpcExceptionCode());
  722. #if DBG
  723. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  724. #endif
  725. }
  726. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  727. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  728. *EntriesRead = GenericInfoContainer.EntriesRead;
  729. }
  730. return Status;
  731. } // LlsLicenseEnumW
  732. /////////////////////////////////////////////////////////////////////////
  733. NTSTATUS
  734. NTAPI
  735. LlsLicenseEnumA(
  736. LLS_HANDLE Handle,
  737. DWORD Level,
  738. LPBYTE* bufptr,
  739. DWORD PrefMaxLen,
  740. LPDWORD EntriesRead,
  741. LPDWORD TotalEntries,
  742. LPDWORD ResumeHandle
  743. )
  744. /*++
  745. Routine Description:
  746. Arguments:
  747. Return Value:
  748. None.
  749. --*/
  750. {
  751. NTSTATUS Status;
  752. GENERIC_INFO_CONTAINER GenericInfoContainer;
  753. GENERIC_ENUM_STRUCT InfoStruct;
  754. PLOCAL_HANDLE pLocalHandle;
  755. #ifdef API_TRACE
  756. dprintf(TEXT("LLSRPC.DLL: LlsLicenseEnumA\n"));
  757. #endif
  758. pLocalHandle = (PLOCAL_HANDLE) Handle;
  759. if (pLocalHandle == NULL)
  760. return STATUS_INVALID_PARAMETER;
  761. GenericInfoContainer.Buffer = NULL;
  762. GenericInfoContainer.EntriesRead = 0;
  763. InfoStruct.Container = &GenericInfoContainer;
  764. InfoStruct.Level = Level;
  765. try {
  766. Status = LlsrLicenseEnumA(
  767. pLocalHandle->Handle,
  768. (PLLS_LICENSE_ENUM_STRUCTA) &InfoStruct,
  769. PrefMaxLen,
  770. TotalEntries,
  771. ResumeHandle
  772. );
  773. }
  774. except (TRUE) {
  775. Status = I_RpcMapWin32Status(RpcExceptionCode());
  776. #if DBG
  777. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  778. #endif
  779. }
  780. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  781. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  782. *EntriesRead = GenericInfoContainer.EntriesRead;
  783. }
  784. return Status;
  785. } // LlsLicenseEnumA
  786. /////////////////////////////////////////////////////////////////////////
  787. NTSTATUS
  788. NTAPI
  789. LlsLicenseAddW(
  790. IN LLS_HANDLE Handle,
  791. IN DWORD Level, // Level 0 supported
  792. IN LPBYTE bufptr
  793. )
  794. /*++
  795. Routine Description:
  796. Arguments:
  797. Return Value:
  798. None.
  799. --*/
  800. {
  801. NTSTATUS Status;
  802. PLOCAL_HANDLE pLocalHandle;
  803. #ifdef API_TRACE
  804. dprintf(TEXT("LLSRPC.DLL: LlsLicenseAddW\n"));
  805. #endif
  806. pLocalHandle = (PLOCAL_HANDLE) Handle;
  807. if (pLocalHandle == NULL)
  808. return STATUS_INVALID_PARAMETER;
  809. try {
  810. Status = LlsrLicenseAddW(pLocalHandle->Handle, Level, (PVOID) bufptr);
  811. }
  812. except (TRUE) {
  813. Status = I_RpcMapWin32Status(RpcExceptionCode());
  814. #if DBG
  815. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  816. #endif
  817. }
  818. return Status;
  819. } // LlsLicenseAddW
  820. /////////////////////////////////////////////////////////////////////////
  821. NTSTATUS
  822. NTAPI
  823. LlsLicenseAddA(
  824. IN LLS_HANDLE Handle,
  825. IN DWORD Level, // Level 0 supported
  826. IN LPBYTE bufptr
  827. )
  828. /*++
  829. Routine Description:
  830. Arguments:
  831. Return Value:
  832. None.
  833. --*/
  834. {
  835. NTSTATUS Status;
  836. PLOCAL_HANDLE pLocalHandle;
  837. #ifdef API_TRACE
  838. dprintf(TEXT("LLSRPC.DLL: LlsLicenseAddA\n"));
  839. #endif
  840. pLocalHandle = (PLOCAL_HANDLE) Handle;
  841. if (pLocalHandle == NULL)
  842. return STATUS_INVALID_PARAMETER;
  843. try {
  844. Status = LlsrLicenseAddA(pLocalHandle->Handle, Level, (PVOID) bufptr);
  845. }
  846. except (TRUE) {
  847. Status = I_RpcMapWin32Status(RpcExceptionCode());
  848. #if DBG
  849. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  850. #endif
  851. }
  852. return Status;
  853. } // LlsLicenseAddA
  854. /////////////////////////////////////////////////////////////////////////
  855. NTSTATUS
  856. NTAPI
  857. LlsProductEnumW(
  858. LLS_HANDLE Handle,
  859. DWORD Level,
  860. LPBYTE* bufptr,
  861. DWORD PrefMaxLen,
  862. LPDWORD EntriesRead,
  863. LPDWORD TotalEntries,
  864. LPDWORD ResumeHandle
  865. )
  866. /*++
  867. Routine Description:
  868. Arguments:
  869. Return Value:
  870. None.
  871. --*/
  872. {
  873. NTSTATUS Status;
  874. GENERIC_INFO_CONTAINER GenericInfoContainer;
  875. GENERIC_ENUM_STRUCT InfoStruct;
  876. PLOCAL_HANDLE pLocalHandle;
  877. #ifdef API_TRACE
  878. dprintf(TEXT("LLSRPC.DLL: LlsProductEnumW\n"));
  879. #endif
  880. pLocalHandle = (PLOCAL_HANDLE) Handle;
  881. if (pLocalHandle == NULL)
  882. return STATUS_INVALID_PARAMETER;
  883. GenericInfoContainer.Buffer = NULL;
  884. GenericInfoContainer.EntriesRead = 0;
  885. InfoStruct.Container = &GenericInfoContainer;
  886. InfoStruct.Level = Level;
  887. try {
  888. Status = LlsrProductEnumW(
  889. pLocalHandle->Handle,
  890. (PLLS_PRODUCT_ENUM_STRUCTW) &InfoStruct,
  891. PrefMaxLen,
  892. TotalEntries,
  893. ResumeHandle
  894. );
  895. }
  896. except (TRUE) {
  897. Status = I_RpcMapWin32Status(RpcExceptionCode());
  898. #if DBG
  899. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  900. #endif
  901. }
  902. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  903. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  904. *EntriesRead = GenericInfoContainer.EntriesRead;
  905. }
  906. return Status;
  907. } // LlsProductEnumW
  908. /////////////////////////////////////////////////////////////////////////
  909. NTSTATUS
  910. NTAPI
  911. LlsProductEnumA(
  912. LLS_HANDLE Handle,
  913. DWORD Level,
  914. LPBYTE* bufptr,
  915. DWORD PrefMaxLen,
  916. LPDWORD EntriesRead,
  917. LPDWORD TotalEntries,
  918. LPDWORD ResumeHandle
  919. )
  920. /*++
  921. Routine Description:
  922. Arguments:
  923. Return Value:
  924. None.
  925. --*/
  926. {
  927. NTSTATUS Status;
  928. GENERIC_INFO_CONTAINER GenericInfoContainer;
  929. GENERIC_ENUM_STRUCT InfoStruct;
  930. PLOCAL_HANDLE pLocalHandle;
  931. #ifdef API_TRACE
  932. dprintf(TEXT("LLSRPC.DLL: LlsProductEnumA\n"));
  933. #endif
  934. pLocalHandle = (PLOCAL_HANDLE) Handle;
  935. if (pLocalHandle == NULL)
  936. return STATUS_INVALID_PARAMETER;
  937. GenericInfoContainer.Buffer = NULL;
  938. GenericInfoContainer.EntriesRead = 0;
  939. InfoStruct.Container = &GenericInfoContainer;
  940. InfoStruct.Level = Level;
  941. try {
  942. Status = LlsrProductEnumA(
  943. pLocalHandle->Handle,
  944. (PLLS_PRODUCT_ENUM_STRUCTA) &InfoStruct,
  945. PrefMaxLen,
  946. TotalEntries,
  947. ResumeHandle
  948. );
  949. }
  950. except (TRUE) {
  951. Status = I_RpcMapWin32Status(RpcExceptionCode());
  952. #if DBG
  953. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  954. #endif
  955. }
  956. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  957. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  958. *EntriesRead = GenericInfoContainer.EntriesRead;
  959. }
  960. return Status;
  961. } // LlsProductEnumA
  962. /////////////////////////////////////////////////////////////////////////
  963. NTSTATUS
  964. LlsProductAddW(
  965. IN LLS_REPL_HANDLE Handle,
  966. IN LPWSTR ProductFamily,
  967. IN LPWSTR Product,
  968. IN LPWSTR Version
  969. )
  970. /*++
  971. Routine Description:
  972. Arguments:
  973. Return Value:
  974. None.
  975. --*/
  976. {
  977. NTSTATUS Status;
  978. PLOCAL_HANDLE pLocalHandle;
  979. #ifdef API_TRACE
  980. dprintf(TEXT("LLSRPC.DLL: LlsProductAddW\n"));
  981. #endif
  982. pLocalHandle = (PLOCAL_HANDLE) Handle;
  983. if (pLocalHandle == NULL)
  984. return STATUS_INVALID_PARAMETER;
  985. try {
  986. Status = LlsrProductAddW(pLocalHandle->Handle, ProductFamily, Product, Version);
  987. }
  988. except (TRUE) {
  989. Status = I_RpcMapWin32Status(RpcExceptionCode());
  990. #if DBG
  991. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  992. #endif
  993. }
  994. return Status;
  995. } // LlsProductAddW
  996. /////////////////////////////////////////////////////////////////////////
  997. NTSTATUS
  998. LlsProductAddA(
  999. IN LLS_REPL_HANDLE Handle,
  1000. IN LPSTR ProductFamily,
  1001. IN LPSTR Product,
  1002. IN LPSTR Version
  1003. )
  1004. /*++
  1005. Routine Description:
  1006. Arguments:
  1007. Return Value:
  1008. None.
  1009. --*/
  1010. {
  1011. NTSTATUS Status;
  1012. PLOCAL_HANDLE pLocalHandle;
  1013. #ifdef API_TRACE
  1014. dprintf(TEXT("LLSRPC.DLL: LlsProductAddA\n"));
  1015. #endif
  1016. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1017. if (pLocalHandle == NULL)
  1018. return STATUS_INVALID_PARAMETER;
  1019. try {
  1020. Status = LlsrProductAddA(pLocalHandle->Handle, ProductFamily, Product, Version);
  1021. }
  1022. except (TRUE) {
  1023. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1024. #if DBG
  1025. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1026. #endif
  1027. }
  1028. return Status;
  1029. } // LlsProductAddA
  1030. /////////////////////////////////////////////////////////////////////////
  1031. NTSTATUS
  1032. NTAPI
  1033. LlsProductUserEnumW(
  1034. LLS_HANDLE Handle,
  1035. LPTSTR Product,
  1036. DWORD Level,
  1037. LPBYTE* bufptr,
  1038. DWORD PrefMaxLen,
  1039. LPDWORD EntriesRead,
  1040. LPDWORD TotalEntries,
  1041. LPDWORD ResumeHandle
  1042. )
  1043. /*++
  1044. Routine Description:
  1045. Arguments:
  1046. Return Value:
  1047. None.
  1048. --*/
  1049. {
  1050. NTSTATUS Status;
  1051. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1052. GENERIC_ENUM_STRUCT InfoStruct;
  1053. PLOCAL_HANDLE pLocalHandle;
  1054. #ifdef API_TRACE
  1055. dprintf(TEXT("LLSRPC.DLL: LlsProductUserEnumW\n"));
  1056. #endif
  1057. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1058. if (pLocalHandle == NULL)
  1059. return STATUS_INVALID_PARAMETER;
  1060. GenericInfoContainer.Buffer = NULL;
  1061. GenericInfoContainer.EntriesRead = 0;
  1062. InfoStruct.Container = &GenericInfoContainer;
  1063. InfoStruct.Level = Level;
  1064. try {
  1065. Status = LlsrProductUserEnumW(
  1066. pLocalHandle->Handle,
  1067. Product,
  1068. (PLLS_PRODUCT_USER_ENUM_STRUCTW) &InfoStruct,
  1069. PrefMaxLen,
  1070. TotalEntries,
  1071. ResumeHandle
  1072. );
  1073. }
  1074. except (TRUE) {
  1075. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1076. #if DBG
  1077. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1078. #endif
  1079. }
  1080. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1081. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1082. *EntriesRead = GenericInfoContainer.EntriesRead;
  1083. }
  1084. return Status;
  1085. } // LlsProductUserEnumW
  1086. /////////////////////////////////////////////////////////////////////////
  1087. NTSTATUS
  1088. NTAPI
  1089. LlsProductUserEnumA(
  1090. LLS_HANDLE Handle,
  1091. LPSTR Product,
  1092. DWORD Level,
  1093. LPBYTE* bufptr,
  1094. DWORD PrefMaxLen,
  1095. LPDWORD EntriesRead,
  1096. LPDWORD TotalEntries,
  1097. LPDWORD ResumeHandle
  1098. )
  1099. /*++
  1100. Routine Description:
  1101. Arguments:
  1102. Return Value:
  1103. None.
  1104. --*/
  1105. {
  1106. NTSTATUS Status;
  1107. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1108. GENERIC_ENUM_STRUCT InfoStruct;
  1109. PLOCAL_HANDLE pLocalHandle;
  1110. #ifdef API_TRACE
  1111. dprintf(TEXT("LLSRPC.DLL: LlsProductUserEnumA\n"));
  1112. #endif
  1113. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1114. if (pLocalHandle == NULL)
  1115. return STATUS_INVALID_PARAMETER;
  1116. GenericInfoContainer.Buffer = NULL;
  1117. GenericInfoContainer.EntriesRead = 0;
  1118. InfoStruct.Container = &GenericInfoContainer;
  1119. InfoStruct.Level = Level;
  1120. try {
  1121. Status = LlsrProductUserEnumA(
  1122. pLocalHandle->Handle,
  1123. Product,
  1124. (PLLS_PRODUCT_USER_ENUM_STRUCTA) &InfoStruct,
  1125. PrefMaxLen,
  1126. TotalEntries,
  1127. ResumeHandle
  1128. );
  1129. }
  1130. except (TRUE) {
  1131. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1132. #if DBG
  1133. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1134. #endif
  1135. }
  1136. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1137. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1138. *EntriesRead = GenericInfoContainer.EntriesRead;
  1139. }
  1140. return Status;
  1141. } // LlsProductUserEnumA
  1142. /////////////////////////////////////////////////////////////////////////
  1143. NTSTATUS
  1144. NTAPI
  1145. LlsProductServerEnumW(
  1146. LLS_HANDLE Handle,
  1147. LPTSTR Product,
  1148. DWORD Level,
  1149. LPBYTE* bufptr,
  1150. DWORD PrefMaxLen,
  1151. LPDWORD EntriesRead,
  1152. LPDWORD TotalEntries,
  1153. LPDWORD ResumeHandle
  1154. )
  1155. /*++
  1156. Routine Description:
  1157. Arguments:
  1158. Return Value:
  1159. None.
  1160. --*/
  1161. {
  1162. NTSTATUS Status;
  1163. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1164. GENERIC_ENUM_STRUCT InfoStruct;
  1165. PLOCAL_HANDLE pLocalHandle;
  1166. #ifdef API_TRACE
  1167. dprintf(TEXT("LLSRPC.DLL: LlsProductServerEnumW\n"));
  1168. #endif
  1169. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1170. if (pLocalHandle == NULL)
  1171. return STATUS_INVALID_PARAMETER;
  1172. GenericInfoContainer.Buffer = NULL;
  1173. GenericInfoContainer.EntriesRead = 0;
  1174. InfoStruct.Container = &GenericInfoContainer;
  1175. InfoStruct.Level = Level;
  1176. try {
  1177. Status = LlsrProductServerEnumW(
  1178. pLocalHandle->Handle,
  1179. Product,
  1180. (PLLS_SERVER_PRODUCT_ENUM_STRUCTW) &InfoStruct,
  1181. PrefMaxLen,
  1182. TotalEntries,
  1183. ResumeHandle
  1184. );
  1185. }
  1186. except (TRUE) {
  1187. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1188. #if DBG
  1189. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1190. #endif
  1191. }
  1192. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1193. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1194. *EntriesRead = GenericInfoContainer.EntriesRead;
  1195. }
  1196. return Status;
  1197. } // LlsProductServerEnumW
  1198. /////////////////////////////////////////////////////////////////////////
  1199. NTSTATUS
  1200. NTAPI
  1201. LlsProductServerEnumA(
  1202. LLS_HANDLE Handle,
  1203. LPSTR Product,
  1204. DWORD Level,
  1205. LPBYTE* bufptr,
  1206. DWORD PrefMaxLen,
  1207. LPDWORD EntriesRead,
  1208. LPDWORD TotalEntries,
  1209. LPDWORD ResumeHandle
  1210. )
  1211. /*++
  1212. Routine Description:
  1213. Arguments:
  1214. Return Value:
  1215. None.
  1216. --*/
  1217. {
  1218. NTSTATUS Status;
  1219. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1220. GENERIC_ENUM_STRUCT InfoStruct;
  1221. PLOCAL_HANDLE pLocalHandle;
  1222. #ifdef API_TRACE
  1223. dprintf(TEXT("LLSRPC.DLL: LlsProductServerEnumA\n"));
  1224. #endif
  1225. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1226. if (pLocalHandle == NULL)
  1227. return STATUS_INVALID_PARAMETER;
  1228. GenericInfoContainer.Buffer = NULL;
  1229. GenericInfoContainer.EntriesRead = 0;
  1230. InfoStruct.Container = &GenericInfoContainer;
  1231. InfoStruct.Level = Level;
  1232. try {
  1233. Status = LlsrProductServerEnumA(
  1234. pLocalHandle->Handle,
  1235. Product,
  1236. (PLLS_SERVER_PRODUCT_ENUM_STRUCTA) &InfoStruct,
  1237. PrefMaxLen,
  1238. TotalEntries,
  1239. ResumeHandle
  1240. );
  1241. }
  1242. except (TRUE) {
  1243. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1244. #if DBG
  1245. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1246. #endif
  1247. }
  1248. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1249. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1250. *EntriesRead = GenericInfoContainer.EntriesRead;
  1251. }
  1252. return Status;
  1253. } // LlsProductServerEnumA
  1254. /////////////////////////////////////////////////////////////////////////
  1255. NTSTATUS
  1256. NTAPI
  1257. LlsProductLicenseEnumW(
  1258. LLS_HANDLE Handle,
  1259. LPTSTR Product,
  1260. DWORD Level,
  1261. LPBYTE* bufptr,
  1262. DWORD PrefMaxLen,
  1263. LPDWORD EntriesRead,
  1264. LPDWORD TotalEntries,
  1265. LPDWORD ResumeHandle
  1266. )
  1267. /*++
  1268. Routine Description:
  1269. Arguments:
  1270. Return Value:
  1271. None.
  1272. --*/
  1273. {
  1274. NTSTATUS Status;
  1275. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1276. GENERIC_ENUM_STRUCT InfoStruct;
  1277. PLOCAL_HANDLE pLocalHandle;
  1278. #ifdef API_TRACE
  1279. dprintf(TEXT("LLSRPC.DLL: LlsProductLicenseEnumW\n"));
  1280. #endif
  1281. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1282. if (pLocalHandle == NULL)
  1283. return STATUS_INVALID_PARAMETER;
  1284. GenericInfoContainer.Buffer = NULL;
  1285. GenericInfoContainer.EntriesRead = 0;
  1286. InfoStruct.Container = &GenericInfoContainer;
  1287. InfoStruct.Level = Level;
  1288. try {
  1289. Status = LlsrProductLicenseEnumW(
  1290. pLocalHandle->Handle,
  1291. Product,
  1292. (PLLS_PRODUCT_LICENSE_ENUM_STRUCTW) &InfoStruct,
  1293. PrefMaxLen,
  1294. TotalEntries,
  1295. ResumeHandle
  1296. );
  1297. }
  1298. except (TRUE) {
  1299. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1300. #if DBG
  1301. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1302. #endif
  1303. }
  1304. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1305. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1306. *EntriesRead = GenericInfoContainer.EntriesRead;
  1307. }
  1308. return Status;
  1309. } // LlsProductLicenseEnumW
  1310. /////////////////////////////////////////////////////////////////////////
  1311. NTSTATUS
  1312. NTAPI
  1313. LlsProductLicenseEnumA(
  1314. LLS_HANDLE Handle,
  1315. LPSTR Product,
  1316. DWORD Level,
  1317. LPBYTE* bufptr,
  1318. DWORD PrefMaxLen,
  1319. LPDWORD EntriesRead,
  1320. LPDWORD TotalEntries,
  1321. LPDWORD ResumeHandle
  1322. )
  1323. /*++
  1324. Routine Description:
  1325. Arguments:
  1326. Return Value:
  1327. None.
  1328. --*/
  1329. {
  1330. NTSTATUS Status;
  1331. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1332. GENERIC_ENUM_STRUCT InfoStruct;
  1333. PLOCAL_HANDLE pLocalHandle;
  1334. #ifdef API_TRACE
  1335. dprintf(TEXT("LLSRPC.DLL: LlsProductLicenseEnumA\n"));
  1336. #endif
  1337. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1338. if (pLocalHandle == NULL)
  1339. return STATUS_INVALID_PARAMETER;
  1340. GenericInfoContainer.Buffer = NULL;
  1341. GenericInfoContainer.EntriesRead = 0;
  1342. InfoStruct.Container = &GenericInfoContainer;
  1343. InfoStruct.Level = Level;
  1344. try {
  1345. Status = LlsrProductLicenseEnumA(
  1346. pLocalHandle->Handle,
  1347. Product,
  1348. (PLLS_PRODUCT_LICENSE_ENUM_STRUCTA) &InfoStruct,
  1349. PrefMaxLen,
  1350. TotalEntries,
  1351. ResumeHandle
  1352. );
  1353. }
  1354. except (TRUE) {
  1355. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1356. #if DBG
  1357. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1358. #endif
  1359. }
  1360. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1361. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1362. *EntriesRead = GenericInfoContainer.EntriesRead;
  1363. }
  1364. return Status;
  1365. } // LlsProductLicenseEnumA
  1366. /////////////////////////////////////////////////////////////////////////
  1367. NTSTATUS
  1368. NTAPI
  1369. LlsUserEnumW(
  1370. LLS_HANDLE Handle,
  1371. DWORD Level,
  1372. LPBYTE* bufptr,
  1373. DWORD PrefMaxLen,
  1374. LPDWORD EntriesRead,
  1375. LPDWORD TotalEntries,
  1376. LPDWORD ResumeHandle
  1377. )
  1378. /*++
  1379. Routine Description:
  1380. Arguments:
  1381. Return Value:
  1382. None.
  1383. --*/
  1384. {
  1385. NTSTATUS Status;
  1386. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1387. GENERIC_ENUM_STRUCT InfoStruct;
  1388. PLOCAL_HANDLE pLocalHandle;
  1389. #ifdef API_TRACE
  1390. dprintf(TEXT("LLSRPC.DLL: LlsUserEnumW\n"));
  1391. #endif
  1392. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1393. if (pLocalHandle == NULL)
  1394. return STATUS_INVALID_PARAMETER;
  1395. GenericInfoContainer.Buffer = NULL;
  1396. GenericInfoContainer.EntriesRead = 0;
  1397. InfoStruct.Container = &GenericInfoContainer;
  1398. InfoStruct.Level = Level;
  1399. try {
  1400. Status = LlsrUserEnumW(
  1401. pLocalHandle->Handle,
  1402. (PLLS_USER_ENUM_STRUCTW) &InfoStruct,
  1403. PrefMaxLen,
  1404. TotalEntries,
  1405. ResumeHandle
  1406. );
  1407. }
  1408. except (TRUE) {
  1409. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1410. #if DBG
  1411. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1412. #endif
  1413. }
  1414. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1415. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1416. *EntriesRead = GenericInfoContainer.EntriesRead;
  1417. }
  1418. return Status;
  1419. } // LlsUserEnumW
  1420. /////////////////////////////////////////////////////////////////////////
  1421. NTSTATUS
  1422. NTAPI
  1423. LlsUserEnumA(
  1424. LLS_HANDLE Handle,
  1425. DWORD Level,
  1426. LPBYTE* bufptr,
  1427. DWORD PrefMaxLen,
  1428. LPDWORD EntriesRead,
  1429. LPDWORD TotalEntries,
  1430. LPDWORD ResumeHandle
  1431. )
  1432. /*++
  1433. Routine Description:
  1434. Arguments:
  1435. Return Value:
  1436. None.
  1437. --*/
  1438. {
  1439. NTSTATUS Status;
  1440. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1441. GENERIC_ENUM_STRUCT InfoStruct;
  1442. PLOCAL_HANDLE pLocalHandle;
  1443. #ifdef API_TRACE
  1444. dprintf(TEXT("LLSRPC.DLL: LlsUserEnumA\n"));
  1445. #endif
  1446. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1447. if (pLocalHandle == NULL)
  1448. return STATUS_INVALID_PARAMETER;
  1449. GenericInfoContainer.Buffer = NULL;
  1450. GenericInfoContainer.EntriesRead = 0;
  1451. InfoStruct.Container = &GenericInfoContainer;
  1452. InfoStruct.Level = Level;
  1453. try {
  1454. Status = LlsrUserEnumA(
  1455. pLocalHandle->Handle,
  1456. (PLLS_USER_ENUM_STRUCTA) &InfoStruct,
  1457. PrefMaxLen,
  1458. TotalEntries,
  1459. ResumeHandle
  1460. );
  1461. }
  1462. except (TRUE) {
  1463. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1464. #if DBG
  1465. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1466. #endif
  1467. }
  1468. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1469. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1470. *EntriesRead = GenericInfoContainer.EntriesRead;
  1471. }
  1472. return Status;
  1473. } // LlsUserEnumA
  1474. /////////////////////////////////////////////////////////////////////////
  1475. NTSTATUS
  1476. NTAPI
  1477. LlsUserInfoGetW(
  1478. IN LLS_HANDLE Handle,
  1479. IN LPWSTR User,
  1480. IN DWORD Level,
  1481. OUT LPBYTE* bufptr
  1482. )
  1483. /*++
  1484. Routine Description:
  1485. Arguments:
  1486. Return Value:
  1487. None.
  1488. --*/
  1489. {
  1490. NTSTATUS Status;
  1491. PLOCAL_HANDLE pLocalHandle;
  1492. #ifdef API_TRACE
  1493. dprintf(TEXT("LLSRPC.DLL: LlsUserInfoGetW\n"));
  1494. #endif
  1495. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1496. if ((pLocalHandle == NULL) || (bufptr == NULL))
  1497. return STATUS_INVALID_PARAMETER;
  1498. *bufptr = NULL;
  1499. try {
  1500. Status = LlsrUserInfoGetW(pLocalHandle->Handle, User, Level, (PLLS_USER_INFOW *) bufptr);
  1501. }
  1502. except (TRUE) {
  1503. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1504. #if DBG
  1505. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1506. #endif
  1507. }
  1508. return Status;
  1509. } // LlsUserInfoGetW
  1510. /////////////////////////////////////////////////////////////////////////
  1511. NTSTATUS
  1512. NTAPI
  1513. LlsUserInfoGetA(
  1514. IN LLS_HANDLE Handle,
  1515. IN LPSTR User,
  1516. IN DWORD Level,
  1517. OUT LPBYTE* bufptr
  1518. )
  1519. /*++
  1520. Routine Description:
  1521. Arguments:
  1522. Return Value:
  1523. None.
  1524. --*/
  1525. {
  1526. NTSTATUS Status;
  1527. PLOCAL_HANDLE pLocalHandle;
  1528. #ifdef API_TRACE
  1529. dprintf(TEXT("LLSRPC.DLL: LlsUserInfoGetA\n"));
  1530. #endif
  1531. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1532. if ((pLocalHandle == NULL) || (bufptr == NULL))
  1533. return STATUS_INVALID_PARAMETER;
  1534. *bufptr = NULL;
  1535. try {
  1536. Status = LlsrUserInfoGetA(pLocalHandle->Handle, User, Level, (PVOID) bufptr);
  1537. }
  1538. except (TRUE) {
  1539. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1540. #if DBG
  1541. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1542. #endif
  1543. }
  1544. return Status;
  1545. } // LlsUserInfoGetA
  1546. /////////////////////////////////////////////////////////////////////////
  1547. NTSTATUS
  1548. NTAPI
  1549. LlsUserInfoSetW(
  1550. IN LLS_HANDLE Handle,
  1551. IN LPWSTR User,
  1552. IN DWORD Level,
  1553. IN LPBYTE bufptr // Level 1 supported
  1554. )
  1555. /*++
  1556. Routine Description:
  1557. Arguments:
  1558. Return Value:
  1559. None.
  1560. --*/
  1561. {
  1562. NTSTATUS Status;
  1563. PLOCAL_HANDLE pLocalHandle;
  1564. #ifdef API_TRACE
  1565. dprintf(TEXT("LLSRPC.DLL: LlsUserInfoSetW\n"));
  1566. #endif
  1567. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1568. if (pLocalHandle == NULL)
  1569. return STATUS_INVALID_PARAMETER;
  1570. try {
  1571. Status = LlsrUserInfoSetW(pLocalHandle->Handle, User, Level, (PLLS_USER_INFOW) bufptr);
  1572. }
  1573. except (TRUE) {
  1574. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1575. #if DBG
  1576. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1577. #endif
  1578. }
  1579. return Status;
  1580. } // LlsUserInfoSetW
  1581. /////////////////////////////////////////////////////////////////////////
  1582. NTSTATUS
  1583. NTAPI
  1584. LlsUserInfoSetA(
  1585. IN LLS_HANDLE Handle,
  1586. IN LPSTR User,
  1587. IN DWORD Level,
  1588. IN LPBYTE bufptr
  1589. )
  1590. /*++
  1591. Routine Description:
  1592. Arguments:
  1593. Return Value:
  1594. None.
  1595. --*/
  1596. {
  1597. NTSTATUS Status;
  1598. PLOCAL_HANDLE pLocalHandle;
  1599. #ifdef API_TRACE
  1600. dprintf(TEXT("LLSRPC.DLL: LlsUserInfoSetA\n"));
  1601. #endif
  1602. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1603. if (pLocalHandle == NULL)
  1604. return STATUS_INVALID_PARAMETER;
  1605. try {
  1606. Status = LlsrUserInfoSetA(pLocalHandle->Handle, User, Level, (PVOID) bufptr);
  1607. }
  1608. except (TRUE) {
  1609. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1610. #if DBG
  1611. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1612. #endif
  1613. }
  1614. return Status;
  1615. } // LlsUserInfoSetA
  1616. /////////////////////////////////////////////////////////////////////////
  1617. NTSTATUS
  1618. NTAPI
  1619. LlsUserDeleteW(
  1620. IN LLS_HANDLE Handle,
  1621. IN LPWSTR User
  1622. )
  1623. /*++
  1624. Routine Description:
  1625. Arguments:
  1626. Return Value:
  1627. None.
  1628. --*/
  1629. {
  1630. NTSTATUS Status;
  1631. PLOCAL_HANDLE pLocalHandle;
  1632. #ifdef API_TRACE
  1633. dprintf(TEXT("LLSRPC.DLL: LlsUserDeleteW\n"));
  1634. #endif
  1635. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1636. if (pLocalHandle == NULL)
  1637. return STATUS_INVALID_PARAMETER;
  1638. try {
  1639. Status = LlsrUserDeleteW(pLocalHandle->Handle, User);
  1640. }
  1641. except (TRUE) {
  1642. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1643. #if DBG
  1644. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1645. #endif
  1646. }
  1647. return Status;
  1648. } // LlsUserDeleteW
  1649. /////////////////////////////////////////////////////////////////////////
  1650. NTSTATUS
  1651. NTAPI
  1652. LlsUserDeleteA(
  1653. IN LLS_HANDLE Handle,
  1654. IN LPSTR User
  1655. )
  1656. /*++
  1657. Routine Description:
  1658. Arguments:
  1659. Return Value:
  1660. None.
  1661. --*/
  1662. {
  1663. NTSTATUS Status;
  1664. PLOCAL_HANDLE pLocalHandle;
  1665. #ifdef API_TRACE
  1666. dprintf(TEXT("LLSRPC.DLL: LlsUserDeleteA\n"));
  1667. #endif
  1668. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1669. if (pLocalHandle == NULL)
  1670. return STATUS_INVALID_PARAMETER;
  1671. try {
  1672. Status = LlsrUserDeleteA(pLocalHandle->Handle, User);
  1673. }
  1674. except (TRUE) {
  1675. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1676. #if DBG
  1677. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1678. #endif
  1679. }
  1680. return Status;
  1681. } // LlsUserDeleteA
  1682. /////////////////////////////////////////////////////////////////////////
  1683. NTSTATUS
  1684. NTAPI
  1685. LlsUserProductEnumW(
  1686. LLS_HANDLE Handle,
  1687. LPTSTR User,
  1688. DWORD Level,
  1689. LPBYTE* bufptr,
  1690. DWORD PrefMaxLen,
  1691. LPDWORD EntriesRead,
  1692. LPDWORD TotalEntries,
  1693. LPDWORD ResumeHandle
  1694. )
  1695. /*++
  1696. Routine Description:
  1697. Arguments:
  1698. Return Value:
  1699. None.
  1700. --*/
  1701. {
  1702. NTSTATUS Status;
  1703. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1704. GENERIC_ENUM_STRUCT InfoStruct;
  1705. PLOCAL_HANDLE pLocalHandle;
  1706. #ifdef API_TRACE
  1707. dprintf(TEXT("LLSRPC.DLL: LlsUserProductEnumW\n"));
  1708. #endif
  1709. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1710. if (pLocalHandle == NULL)
  1711. return STATUS_INVALID_PARAMETER;
  1712. GenericInfoContainer.Buffer = NULL;
  1713. GenericInfoContainer.EntriesRead = 0;
  1714. InfoStruct.Container = &GenericInfoContainer;
  1715. InfoStruct.Level = Level;
  1716. try {
  1717. Status = LlsrUserProductEnumW(
  1718. pLocalHandle->Handle,
  1719. User,
  1720. (PLLS_USER_PRODUCT_ENUM_STRUCTW) &InfoStruct,
  1721. PrefMaxLen,
  1722. TotalEntries,
  1723. ResumeHandle
  1724. );
  1725. }
  1726. except (TRUE) {
  1727. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1728. #if DBG
  1729. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1730. #endif
  1731. }
  1732. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1733. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1734. *EntriesRead = GenericInfoContainer.EntriesRead;
  1735. }
  1736. return Status;
  1737. } // LlsUserProductEnumW
  1738. /////////////////////////////////////////////////////////////////////////
  1739. NTSTATUS
  1740. NTAPI
  1741. LlsUserProductEnumA(
  1742. LLS_HANDLE Handle,
  1743. LPSTR User,
  1744. DWORD Level,
  1745. LPBYTE* bufptr,
  1746. DWORD PrefMaxLen,
  1747. LPDWORD EntriesRead,
  1748. LPDWORD TotalEntries,
  1749. LPDWORD ResumeHandle
  1750. )
  1751. /*++
  1752. Routine Description:
  1753. Arguments:
  1754. Return Value:
  1755. None.
  1756. --*/
  1757. {
  1758. NTSTATUS Status;
  1759. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1760. GENERIC_ENUM_STRUCT InfoStruct;
  1761. PLOCAL_HANDLE pLocalHandle;
  1762. #ifdef API_TRACE
  1763. dprintf(TEXT("LLSRPC.DLL: LlsUserProductEnumA\n"));
  1764. #endif
  1765. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1766. if (pLocalHandle == NULL)
  1767. return STATUS_INVALID_PARAMETER;
  1768. GenericInfoContainer.Buffer = NULL;
  1769. GenericInfoContainer.EntriesRead = 0;
  1770. InfoStruct.Container = &GenericInfoContainer;
  1771. InfoStruct.Level = Level;
  1772. try {
  1773. Status = LlsrUserProductEnumA(
  1774. pLocalHandle->Handle,
  1775. User,
  1776. (PLLS_USER_PRODUCT_ENUM_STRUCTA) &InfoStruct,
  1777. PrefMaxLen,
  1778. TotalEntries,
  1779. ResumeHandle
  1780. );
  1781. }
  1782. except (TRUE) {
  1783. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1784. #if DBG
  1785. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1786. #endif
  1787. }
  1788. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1789. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1790. *EntriesRead = GenericInfoContainer.EntriesRead;
  1791. }
  1792. return Status;
  1793. } // LlsUserProductEnumA
  1794. /////////////////////////////////////////////////////////////////////////
  1795. NTSTATUS
  1796. NTAPI
  1797. LlsUserProductDeleteW(
  1798. IN LLS_HANDLE Handle,
  1799. IN LPWSTR User,
  1800. IN LPWSTR Product
  1801. )
  1802. /*++
  1803. Routine Description:
  1804. Arguments:
  1805. Return Value:
  1806. None.
  1807. --*/
  1808. {
  1809. NTSTATUS Status;
  1810. PLOCAL_HANDLE pLocalHandle;
  1811. #ifdef API_TRACE
  1812. dprintf(TEXT("LLSRPC.DLL: LlsUserProductDeleteW\n"));
  1813. #endif
  1814. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1815. if (pLocalHandle == NULL)
  1816. return STATUS_INVALID_PARAMETER;
  1817. try {
  1818. Status = LlsrUserProductDeleteW(pLocalHandle->Handle, User, Product);
  1819. }
  1820. except (TRUE) {
  1821. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1822. #if DBG
  1823. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1824. #endif
  1825. }
  1826. return Status;
  1827. } // LlsUserProductDeleteW
  1828. /////////////////////////////////////////////////////////////////////////
  1829. NTSTATUS
  1830. NTAPI
  1831. LlsUserProductDeleteA(
  1832. IN LLS_HANDLE Handle,
  1833. IN LPSTR User,
  1834. IN LPSTR Product
  1835. )
  1836. /*++
  1837. Routine Description:
  1838. Arguments:
  1839. Return Value:
  1840. None.
  1841. --*/
  1842. {
  1843. NTSTATUS Status;
  1844. PLOCAL_HANDLE pLocalHandle;
  1845. #ifdef API_TRACE
  1846. dprintf(TEXT("LLSRPC.DLL: LlsUserProductDeleteA\n"));
  1847. #endif
  1848. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1849. if (pLocalHandle == NULL)
  1850. return STATUS_INVALID_PARAMETER;
  1851. try {
  1852. Status = LlsrUserProductDeleteA(pLocalHandle->Handle, User, Product);
  1853. }
  1854. except (TRUE) {
  1855. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1856. #if DBG
  1857. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1858. #endif
  1859. }
  1860. return Status;
  1861. } // LlsUserProductDeleteA
  1862. /////////////////////////////////////////////////////////////////////////
  1863. NTSTATUS
  1864. NTAPI
  1865. LlsGroupEnumW(
  1866. LLS_HANDLE Handle,
  1867. DWORD Level,
  1868. LPBYTE* bufptr,
  1869. DWORD PrefMaxLen,
  1870. LPDWORD EntriesRead,
  1871. LPDWORD TotalEntries,
  1872. LPDWORD ResumeHandle
  1873. )
  1874. /*++
  1875. Routine Description:
  1876. Arguments:
  1877. Return Value:
  1878. None.
  1879. --*/
  1880. {
  1881. NTSTATUS Status;
  1882. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1883. GENERIC_ENUM_STRUCT InfoStruct;
  1884. PLOCAL_HANDLE pLocalHandle;
  1885. #ifdef API_TRACE
  1886. dprintf(TEXT("LLSRPC.DLL: LlsGroupEnumW\n"));
  1887. #endif
  1888. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1889. if (pLocalHandle == NULL)
  1890. return STATUS_INVALID_PARAMETER;
  1891. GenericInfoContainer.Buffer = NULL;
  1892. GenericInfoContainer.EntriesRead = 0;
  1893. InfoStruct.Container = &GenericInfoContainer;
  1894. InfoStruct.Level = Level;
  1895. try {
  1896. Status = LlsrMappingEnumW(
  1897. pLocalHandle->Handle,
  1898. (PLLS_MAPPING_ENUM_STRUCTW) &InfoStruct,
  1899. PrefMaxLen,
  1900. TotalEntries,
  1901. ResumeHandle
  1902. );
  1903. }
  1904. except (TRUE) {
  1905. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1906. #if DBG
  1907. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1908. #endif
  1909. }
  1910. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1911. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1912. *EntriesRead = GenericInfoContainer.EntriesRead;
  1913. }
  1914. return Status;
  1915. } // LlsGroupEnumW
  1916. /////////////////////////////////////////////////////////////////////////
  1917. NTSTATUS
  1918. NTAPI
  1919. LlsGroupEnumA(
  1920. LLS_HANDLE Handle,
  1921. DWORD Level,
  1922. LPBYTE* bufptr,
  1923. DWORD PrefMaxLen,
  1924. LPDWORD EntriesRead,
  1925. LPDWORD TotalEntries,
  1926. LPDWORD ResumeHandle
  1927. )
  1928. /*++
  1929. Routine Description:
  1930. Arguments:
  1931. Return Value:
  1932. None.
  1933. --*/
  1934. {
  1935. NTSTATUS Status;
  1936. GENERIC_INFO_CONTAINER GenericInfoContainer;
  1937. GENERIC_ENUM_STRUCT InfoStruct;
  1938. PLOCAL_HANDLE pLocalHandle;
  1939. #ifdef API_TRACE
  1940. dprintf(TEXT("LLSRPC.DLL: LlsGroupEnumA\n"));
  1941. #endif
  1942. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1943. if (pLocalHandle == NULL)
  1944. return STATUS_INVALID_PARAMETER;
  1945. GenericInfoContainer.Buffer = NULL;
  1946. GenericInfoContainer.EntriesRead = 0;
  1947. InfoStruct.Container = &GenericInfoContainer;
  1948. InfoStruct.Level = Level;
  1949. try {
  1950. Status = LlsrMappingEnumA(
  1951. pLocalHandle->Handle,
  1952. (PLLS_MAPPING_ENUM_STRUCTA) &InfoStruct,
  1953. PrefMaxLen,
  1954. TotalEntries,
  1955. ResumeHandle
  1956. );
  1957. }
  1958. except (TRUE) {
  1959. Status = I_RpcMapWin32Status(RpcExceptionCode());
  1960. #if DBG
  1961. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  1962. #endif
  1963. }
  1964. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  1965. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  1966. *EntriesRead = GenericInfoContainer.EntriesRead;
  1967. }
  1968. return Status;
  1969. } // LlsGroupEnumA
  1970. /////////////////////////////////////////////////////////////////////////
  1971. NTSTATUS
  1972. NTAPI
  1973. LlsGroupInfoGetW(
  1974. IN LLS_HANDLE Handle,
  1975. IN LPWSTR Group,
  1976. IN DWORD Level,
  1977. OUT LPBYTE* bufptr
  1978. )
  1979. /*++
  1980. Routine Description:
  1981. Arguments:
  1982. Return Value:
  1983. None.
  1984. --*/
  1985. {
  1986. NTSTATUS Status;
  1987. PLOCAL_HANDLE pLocalHandle;
  1988. #ifdef API_TRACE
  1989. dprintf(TEXT("LLSRPC.DLL: LlsGroupInfoGetW\n"));
  1990. #endif
  1991. pLocalHandle = (PLOCAL_HANDLE) Handle;
  1992. if ((pLocalHandle == NULL) || (bufptr == NULL))
  1993. return STATUS_INVALID_PARAMETER;
  1994. *bufptr = NULL;
  1995. try {
  1996. Status = LlsrMappingInfoGetW(pLocalHandle->Handle, Group, Level, (PVOID) bufptr);
  1997. }
  1998. except (TRUE) {
  1999. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2000. #if DBG
  2001. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2002. #endif
  2003. }
  2004. return Status;
  2005. } // LlsGroupInfoGetW
  2006. /////////////////////////////////////////////////////////////////////////
  2007. NTSTATUS
  2008. NTAPI
  2009. LlsGroupInfoGetA(
  2010. IN LLS_HANDLE Handle,
  2011. IN LPSTR Group,
  2012. IN DWORD Level,
  2013. OUT LPBYTE* bufptr
  2014. )
  2015. /*++
  2016. Routine Description:
  2017. Arguments:
  2018. Return Value:
  2019. None.
  2020. --*/
  2021. {
  2022. NTSTATUS Status;
  2023. PLOCAL_HANDLE pLocalHandle;
  2024. #ifdef API_TRACE
  2025. dprintf(TEXT("LLSRPC.DLL: LlsGroupInfoGetA\n"));
  2026. #endif
  2027. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2028. if ((pLocalHandle == NULL) || (bufptr == NULL))
  2029. return STATUS_INVALID_PARAMETER;
  2030. *bufptr = NULL;
  2031. try {
  2032. Status = LlsrMappingInfoGetA(pLocalHandle->Handle, Group, Level, (PVOID) bufptr);
  2033. }
  2034. except (TRUE) {
  2035. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2036. #if DBG
  2037. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2038. #endif
  2039. }
  2040. return Status;
  2041. } // LlsGroupInfoGetA
  2042. /////////////////////////////////////////////////////////////////////////
  2043. NTSTATUS
  2044. NTAPI
  2045. LlsGroupInfoSetW(
  2046. IN LLS_HANDLE Handle,
  2047. IN LPWSTR Group,
  2048. IN DWORD Level,
  2049. IN LPBYTE bufptr
  2050. )
  2051. /*++
  2052. Routine Description:
  2053. Arguments:
  2054. Return Value:
  2055. None.
  2056. --*/
  2057. {
  2058. NTSTATUS Status;
  2059. PLOCAL_HANDLE pLocalHandle;
  2060. #ifdef API_TRACE
  2061. dprintf(TEXT("LLSRPC.DLL: LlsGroupInfoSetW\n"));
  2062. #endif
  2063. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2064. if (pLocalHandle == NULL)
  2065. return STATUS_INVALID_PARAMETER;
  2066. try {
  2067. Status = LlsrMappingInfoSetW(pLocalHandle->Handle, Group, Level, (PVOID) bufptr);
  2068. }
  2069. except (TRUE) {
  2070. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2071. #if DBG
  2072. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2073. #endif
  2074. }
  2075. return Status;
  2076. } // LlsGroupInfoSetW
  2077. /////////////////////////////////////////////////////////////////////////
  2078. NTSTATUS
  2079. NTAPI
  2080. LlsGroupInfoSetA(
  2081. IN LLS_HANDLE Handle,
  2082. IN LPSTR Group,
  2083. IN DWORD Level,
  2084. IN LPBYTE bufptr
  2085. )
  2086. /*++
  2087. Routine Description:
  2088. Arguments:
  2089. Return Value:
  2090. None.
  2091. --*/
  2092. {
  2093. NTSTATUS Status;
  2094. PLOCAL_HANDLE pLocalHandle;
  2095. #ifdef API_TRACE
  2096. dprintf(TEXT("LLSRPC.DLL: LlsGroupInfoSetA\n"));
  2097. #endif
  2098. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2099. if (pLocalHandle == NULL)
  2100. return STATUS_INVALID_PARAMETER;
  2101. try {
  2102. Status = LlsrMappingInfoSetA(pLocalHandle->Handle, Group, Level, (PVOID) bufptr);
  2103. }
  2104. except (TRUE) {
  2105. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2106. #if DBG
  2107. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2108. #endif
  2109. }
  2110. return Status;
  2111. } // LlsGroupInfoSetA
  2112. /////////////////////////////////////////////////////////////////////////
  2113. NTSTATUS
  2114. NTAPI
  2115. LlsGroupUserEnumW(
  2116. LLS_HANDLE Handle,
  2117. LPTSTR Group,
  2118. DWORD Level,
  2119. LPBYTE* bufptr,
  2120. DWORD PrefMaxLen,
  2121. LPDWORD EntriesRead,
  2122. LPDWORD TotalEntries,
  2123. LPDWORD ResumeHandle
  2124. )
  2125. /*++
  2126. Routine Description:
  2127. Arguments:
  2128. Return Value:
  2129. None.
  2130. --*/
  2131. {
  2132. NTSTATUS Status;
  2133. GENERIC_INFO_CONTAINER GenericInfoContainer;
  2134. GENERIC_ENUM_STRUCT InfoStruct;
  2135. PLOCAL_HANDLE pLocalHandle;
  2136. #ifdef API_TRACE
  2137. dprintf(TEXT("LLSRPC.DLL: LlsGroupUserEnumW\n"));
  2138. #endif
  2139. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2140. if (pLocalHandle == NULL)
  2141. return STATUS_INVALID_PARAMETER;
  2142. GenericInfoContainer.Buffer = NULL;
  2143. GenericInfoContainer.EntriesRead = 0;
  2144. InfoStruct.Container = &GenericInfoContainer;
  2145. InfoStruct.Level = Level;
  2146. try {
  2147. Status = LlsrMappingUserEnumW(
  2148. pLocalHandle->Handle,
  2149. Group,
  2150. (PLLS_USER_ENUM_STRUCTW) &InfoStruct,
  2151. PrefMaxLen,
  2152. TotalEntries,
  2153. ResumeHandle
  2154. );
  2155. }
  2156. except (TRUE) {
  2157. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2158. #if DBG
  2159. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2160. #endif
  2161. }
  2162. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  2163. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  2164. *EntriesRead = GenericInfoContainer.EntriesRead;
  2165. }
  2166. return Status;
  2167. } // LlsGroupUserEnumW
  2168. /////////////////////////////////////////////////////////////////////////
  2169. NTSTATUS
  2170. NTAPI
  2171. LlsGroupUserEnumA(
  2172. LLS_HANDLE Handle,
  2173. LPSTR Group,
  2174. DWORD Level,
  2175. LPBYTE* bufptr,
  2176. DWORD PrefMaxLen,
  2177. LPDWORD EntriesRead,
  2178. LPDWORD TotalEntries,
  2179. LPDWORD ResumeHandle
  2180. )
  2181. /*++
  2182. Routine Description:
  2183. Arguments:
  2184. Return Value:
  2185. None.
  2186. --*/
  2187. {
  2188. NTSTATUS Status;
  2189. GENERIC_INFO_CONTAINER GenericInfoContainer;
  2190. GENERIC_ENUM_STRUCT InfoStruct;
  2191. PLOCAL_HANDLE pLocalHandle;
  2192. #ifdef API_TRACE
  2193. dprintf(TEXT("LLSRPC.DLL: LlsGroupUserEnumA\n"));
  2194. #endif
  2195. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2196. if (pLocalHandle == NULL)
  2197. return STATUS_INVALID_PARAMETER;
  2198. GenericInfoContainer.Buffer = NULL;
  2199. GenericInfoContainer.EntriesRead = 0;
  2200. InfoStruct.Container = &GenericInfoContainer;
  2201. InfoStruct.Level = Level;
  2202. try {
  2203. Status = LlsrMappingUserEnumA(
  2204. pLocalHandle->Handle,
  2205. Group,
  2206. (PLLS_USER_ENUM_STRUCTA) &InfoStruct,
  2207. PrefMaxLen,
  2208. TotalEntries,
  2209. ResumeHandle
  2210. );
  2211. }
  2212. except (TRUE) {
  2213. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2214. #if DBG
  2215. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2216. #endif
  2217. }
  2218. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  2219. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  2220. *EntriesRead = GenericInfoContainer.EntriesRead;
  2221. }
  2222. return Status;
  2223. } // LlsGroupUserEnumA
  2224. /////////////////////////////////////////////////////////////////////////
  2225. NTSTATUS
  2226. NTAPI
  2227. LlsGroupUserAddW(
  2228. IN LLS_HANDLE Handle,
  2229. IN LPWSTR Group,
  2230. IN LPWSTR User
  2231. )
  2232. /*++
  2233. Routine Description:
  2234. Arguments:
  2235. Return Value:
  2236. None.
  2237. --*/
  2238. {
  2239. NTSTATUS Status;
  2240. PLOCAL_HANDLE pLocalHandle;
  2241. #ifdef API_TRACE
  2242. dprintf(TEXT("LLSRPC.DLL: LlsGroupUserAddW\n"));
  2243. #endif
  2244. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2245. if (pLocalHandle == NULL)
  2246. return STATUS_INVALID_PARAMETER;
  2247. try {
  2248. Status = LlsrMappingUserAddW(pLocalHandle->Handle, Group, User);
  2249. }
  2250. except (TRUE) {
  2251. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2252. #if DBG
  2253. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2254. #endif
  2255. }
  2256. return Status;
  2257. } // LlsGroupUserAddW
  2258. /////////////////////////////////////////////////////////////////////////
  2259. NTSTATUS
  2260. NTAPI
  2261. LlsGroupUserAddA(
  2262. IN LLS_HANDLE Handle,
  2263. IN LPSTR Group,
  2264. IN LPSTR User
  2265. )
  2266. /*++
  2267. Routine Description:
  2268. Arguments:
  2269. Return Value:
  2270. None.
  2271. --*/
  2272. {
  2273. NTSTATUS Status;
  2274. PLOCAL_HANDLE pLocalHandle;
  2275. #ifdef API_TRACE
  2276. dprintf(TEXT("LLSRPC.DLL: LlsGroupUserAddA\n"));
  2277. #endif
  2278. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2279. if (pLocalHandle == NULL)
  2280. return STATUS_INVALID_PARAMETER;
  2281. try {
  2282. Status = LlsrMappingUserAddA(pLocalHandle->Handle, Group, User);
  2283. }
  2284. except (TRUE) {
  2285. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2286. #if DBG
  2287. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2288. #endif
  2289. }
  2290. return Status;
  2291. } // LlsGroupUserAddA
  2292. /////////////////////////////////////////////////////////////////////////
  2293. NTSTATUS
  2294. NTAPI
  2295. LlsGroupUserDeleteW(
  2296. IN LLS_HANDLE Handle,
  2297. IN LPWSTR Group,
  2298. IN LPWSTR User
  2299. )
  2300. /*++
  2301. Routine Description:
  2302. Arguments:
  2303. Return Value:
  2304. None.
  2305. --*/
  2306. {
  2307. NTSTATUS Status;
  2308. PLOCAL_HANDLE pLocalHandle;
  2309. #ifdef API_TRACE
  2310. dprintf(TEXT("LLSRPC.DLL: LlsGroupUserDeleteW\n"));
  2311. #endif
  2312. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2313. if (pLocalHandle == NULL)
  2314. return STATUS_INVALID_PARAMETER;
  2315. try {
  2316. Status = LlsrMappingUserDeleteW(pLocalHandle->Handle, Group, User);
  2317. }
  2318. except (TRUE) {
  2319. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2320. #if DBG
  2321. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2322. #endif
  2323. }
  2324. return Status;
  2325. } // LlsGroupUserDeleteW
  2326. /////////////////////////////////////////////////////////////////////////
  2327. NTSTATUS
  2328. NTAPI
  2329. LlsGroupUserDeleteA(
  2330. IN LLS_HANDLE Handle,
  2331. IN LPSTR Group,
  2332. IN LPSTR User
  2333. )
  2334. /*++
  2335. Routine Description:
  2336. Arguments:
  2337. Return Value:
  2338. None.
  2339. --*/
  2340. {
  2341. NTSTATUS Status;
  2342. PLOCAL_HANDLE pLocalHandle;
  2343. #ifdef API_TRACE
  2344. dprintf(TEXT("LLSRPC.DLL: LlsGroupUserDeleteA\n"));
  2345. #endif
  2346. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2347. if (pLocalHandle == NULL)
  2348. return STATUS_INVALID_PARAMETER;
  2349. try {
  2350. Status = LlsrMappingUserDeleteA(pLocalHandle->Handle, Group, User);
  2351. }
  2352. except (TRUE) {
  2353. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2354. #if DBG
  2355. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2356. #endif
  2357. }
  2358. return Status;
  2359. } // LlsGroupUserDeleteA
  2360. /////////////////////////////////////////////////////////////////////////
  2361. NTSTATUS
  2362. NTAPI
  2363. LlsGroupAddW(
  2364. IN LLS_HANDLE Handle,
  2365. IN DWORD Level,
  2366. IN LPBYTE bufptr
  2367. )
  2368. /*++
  2369. Routine Description:
  2370. Arguments:
  2371. Return Value:
  2372. None.
  2373. --*/
  2374. {
  2375. NTSTATUS Status;
  2376. PLOCAL_HANDLE pLocalHandle;
  2377. #ifdef API_TRACE
  2378. dprintf(TEXT("LLSRPC.DLL: LlsGroupAddW\n"));
  2379. #endif
  2380. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2381. if (pLocalHandle == NULL)
  2382. return STATUS_INVALID_PARAMETER;
  2383. try {
  2384. Status = LlsrMappingAddW(pLocalHandle->Handle, Level, (PVOID) bufptr);
  2385. }
  2386. except (TRUE) {
  2387. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2388. #if DBG
  2389. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2390. #endif
  2391. }
  2392. return Status;
  2393. } // LlsGroupAddW
  2394. /////////////////////////////////////////////////////////////////////////
  2395. NTSTATUS
  2396. NTAPI
  2397. LlsGroupAddA(
  2398. IN LLS_HANDLE Handle,
  2399. IN DWORD Level,
  2400. IN LPBYTE bufptr
  2401. )
  2402. /*++
  2403. Routine Description:
  2404. Arguments:
  2405. Return Value:
  2406. None.
  2407. --*/
  2408. {
  2409. NTSTATUS Status;
  2410. PLOCAL_HANDLE pLocalHandle;
  2411. #ifdef API_TRACE
  2412. dprintf(TEXT("LLSRPC.DLL: LlsGroupAddA\n"));
  2413. #endif
  2414. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2415. if (pLocalHandle == NULL)
  2416. return STATUS_INVALID_PARAMETER;
  2417. try {
  2418. Status = LlsrMappingAddA(pLocalHandle->Handle, Level, (PVOID) bufptr);
  2419. }
  2420. except (TRUE) {
  2421. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2422. #if DBG
  2423. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2424. #endif
  2425. }
  2426. return Status;
  2427. } // LlsGroupAddA
  2428. /////////////////////////////////////////////////////////////////////////
  2429. NTSTATUS
  2430. NTAPI
  2431. LlsGroupDeleteW(
  2432. IN LLS_HANDLE Handle,
  2433. IN LPWSTR Group
  2434. )
  2435. /*++
  2436. Routine Description:
  2437. Arguments:
  2438. Return Value:
  2439. None.
  2440. --*/
  2441. {
  2442. NTSTATUS Status;
  2443. PLOCAL_HANDLE pLocalHandle;
  2444. #ifdef API_TRACE
  2445. dprintf(TEXT("LLSRPC.DLL: LlsGroupDeleteW\n"));
  2446. #endif
  2447. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2448. if (pLocalHandle == NULL)
  2449. return STATUS_INVALID_PARAMETER;
  2450. try {
  2451. Status = LlsrMappingDeleteW(pLocalHandle->Handle, Group);
  2452. }
  2453. except (TRUE) {
  2454. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2455. #if DBG
  2456. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2457. #endif
  2458. }
  2459. return Status;
  2460. } // LlsGroupDeleteW
  2461. /////////////////////////////////////////////////////////////////////////
  2462. NTSTATUS
  2463. NTAPI
  2464. LlsGroupDeleteA(
  2465. IN LLS_HANDLE Handle,
  2466. IN LPSTR Group
  2467. )
  2468. /*++
  2469. Routine Description:
  2470. Arguments:
  2471. Return Value:
  2472. None.
  2473. --*/
  2474. {
  2475. NTSTATUS Status;
  2476. PLOCAL_HANDLE pLocalHandle;
  2477. #ifdef API_TRACE
  2478. dprintf(TEXT("LLSRPC.DLL: GroupDeleteA\n"));
  2479. #endif
  2480. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2481. if (pLocalHandle == NULL)
  2482. return STATUS_INVALID_PARAMETER;
  2483. try {
  2484. Status = LlsrMappingDeleteA(pLocalHandle->Handle, Group);
  2485. }
  2486. except (TRUE) {
  2487. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2488. #if DBG
  2489. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2490. #endif
  2491. }
  2492. return Status;
  2493. } // LlsGroupDeleteA
  2494. #ifdef OBSOLETE
  2495. /////////////////////////////////////////////////////////////////////////
  2496. NTSTATUS
  2497. NTAPI
  2498. LlsServerEnumW(
  2499. LLS_HANDLE Handle,
  2500. LPWSTR Server,
  2501. DWORD Level,
  2502. LPBYTE* bufptr,
  2503. DWORD PrefMaxLen,
  2504. LPDWORD EntriesRead,
  2505. LPDWORD TotalEntries,
  2506. LPDWORD ResumeHandle
  2507. )
  2508. /*++
  2509. Routine Description:
  2510. Arguments:
  2511. Return Value:
  2512. None.
  2513. --*/
  2514. {
  2515. NTSTATUS Status;
  2516. GENERIC_INFO_CONTAINER GenericInfoContainer;
  2517. GENERIC_ENUM_STRUCT InfoStruct;
  2518. PLOCAL_HANDLE pLocalHandle;
  2519. #ifdef API_TRACE
  2520. dprintf(TEXT("LLSRPC.DLL: LlsServerEnumW\n"));
  2521. #endif
  2522. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2523. if (pLocalHandle == NULL)
  2524. return STATUS_INVALID_PARAMETER;
  2525. GenericInfoContainer.Buffer = NULL;
  2526. GenericInfoContainer.EntriesRead = 0;
  2527. InfoStruct.Container = &GenericInfoContainer;
  2528. InfoStruct.Level = Level;
  2529. try {
  2530. Status = LlsrServerEnumW(
  2531. pLocalHandle->Handle,
  2532. Server,
  2533. (PLLS_SERVER_ENUM_STRUCTW) &InfoStruct,
  2534. PrefMaxLen,
  2535. TotalEntries,
  2536. ResumeHandle
  2537. );
  2538. }
  2539. except (TRUE) {
  2540. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2541. #if DBG
  2542. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2543. #endif
  2544. }
  2545. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  2546. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  2547. *EntriesRead = GenericInfoContainer.EntriesRead;
  2548. }
  2549. return Status;
  2550. } // LlsServerEnumW
  2551. /////////////////////////////////////////////////////////////////////////
  2552. NTSTATUS
  2553. NTAPI
  2554. LlsServerEnumA(
  2555. LLS_HANDLE Handle,
  2556. LPSTR Server,
  2557. DWORD Level,
  2558. LPBYTE* bufptr,
  2559. DWORD PrefMaxLen,
  2560. LPDWORD EntriesRead,
  2561. LPDWORD TotalEntries,
  2562. LPDWORD ResumeHandle
  2563. )
  2564. /*++
  2565. Routine Description:
  2566. Arguments:
  2567. Return Value:
  2568. None.
  2569. --*/
  2570. {
  2571. NTSTATUS Status;
  2572. GENERIC_INFO_CONTAINER GenericInfoContainer;
  2573. GENERIC_ENUM_STRUCT InfoStruct;
  2574. PLOCAL_HANDLE pLocalHandle;
  2575. #ifdef API_TRACE
  2576. dprintf(TEXT("LLSRPC.DLL: LlsServerEnumA\n"));
  2577. #endif
  2578. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2579. if (pLocalHandle == NULL)
  2580. return STATUS_INVALID_PARAMETER;
  2581. GenericInfoContainer.Buffer = NULL;
  2582. GenericInfoContainer.EntriesRead = 0;
  2583. InfoStruct.Container = &GenericInfoContainer;
  2584. InfoStruct.Level = Level;
  2585. try {
  2586. Status = LlsrServerEnumA(
  2587. pLocalHandle->Handle,
  2588. Server,
  2589. (PLLS_SERVER_ENUM_STRUCTA) &InfoStruct,
  2590. PrefMaxLen,
  2591. TotalEntries,
  2592. ResumeHandle
  2593. );
  2594. }
  2595. except (TRUE) {
  2596. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2597. #if DBG
  2598. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2599. #endif
  2600. }
  2601. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  2602. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  2603. *EntriesRead = GenericInfoContainer.EntriesRead;
  2604. }
  2605. return Status;
  2606. } // LlsServerEnumA
  2607. /////////////////////////////////////////////////////////////////////////
  2608. NTSTATUS
  2609. NTAPI
  2610. LlsServerProductEnumW(
  2611. LLS_HANDLE Handle,
  2612. LPWSTR Server,
  2613. DWORD Level,
  2614. LPBYTE* bufptr,
  2615. DWORD PrefMaxLen,
  2616. LPDWORD EntriesRead,
  2617. LPDWORD TotalEntries,
  2618. LPDWORD ResumeHandle
  2619. )
  2620. /*++
  2621. Routine Description:
  2622. Arguments:
  2623. Return Value:
  2624. None.
  2625. --*/
  2626. {
  2627. NTSTATUS Status;
  2628. GENERIC_INFO_CONTAINER GenericInfoContainer;
  2629. GENERIC_ENUM_STRUCT InfoStruct;
  2630. PLOCAL_HANDLE pLocalHandle;
  2631. #ifdef API_TRACE
  2632. dprintf(TEXT("LLSRPC.DLL: LlsServerProductEnumW\n"));
  2633. #endif
  2634. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2635. if (pLocalHandle == NULL)
  2636. return STATUS_INVALID_PARAMETER;
  2637. GenericInfoContainer.Buffer = NULL;
  2638. GenericInfoContainer.EntriesRead = 0;
  2639. InfoStruct.Container = &GenericInfoContainer;
  2640. InfoStruct.Level = Level;
  2641. try {
  2642. Status = LlsrServerProductEnumW(
  2643. pLocalHandle->Handle,
  2644. Server,
  2645. (PLLS_SERVER_PRODUCT_ENUM_STRUCTW) &InfoStruct,
  2646. PrefMaxLen,
  2647. TotalEntries,
  2648. ResumeHandle
  2649. );
  2650. }
  2651. except (TRUE) {
  2652. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2653. #if DBG
  2654. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2655. #endif
  2656. }
  2657. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  2658. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  2659. *EntriesRead = GenericInfoContainer.EntriesRead;
  2660. }
  2661. return Status;
  2662. } // LlsServerProductEnumW
  2663. /////////////////////////////////////////////////////////////////////////
  2664. NTSTATUS
  2665. NTAPI
  2666. LlsServerProductEnumA(
  2667. LLS_HANDLE Handle,
  2668. LPSTR Server,
  2669. DWORD Level,
  2670. LPBYTE* bufptr,
  2671. DWORD PrefMaxLen,
  2672. LPDWORD EntriesRead,
  2673. LPDWORD TotalEntries,
  2674. LPDWORD ResumeHandle
  2675. )
  2676. /*++
  2677. Routine Description:
  2678. Arguments:
  2679. Return Value:
  2680. None.
  2681. --*/
  2682. {
  2683. NTSTATUS Status;
  2684. GENERIC_INFO_CONTAINER GenericInfoContainer;
  2685. GENERIC_ENUM_STRUCT InfoStruct;
  2686. PLOCAL_HANDLE pLocalHandle;
  2687. #ifdef API_TRACE
  2688. dprintf(TEXT("LLSRPC.DLL: LlsServerProductEnumA\n"));
  2689. #endif
  2690. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2691. if (pLocalHandle == NULL)
  2692. return STATUS_INVALID_PARAMETER;
  2693. GenericInfoContainer.Buffer = NULL;
  2694. GenericInfoContainer.EntriesRead = 0;
  2695. InfoStruct.Container = &GenericInfoContainer;
  2696. InfoStruct.Level = Level;
  2697. try {
  2698. Status = LlsrServerProductEnumA(
  2699. pLocalHandle->Handle,
  2700. Server,
  2701. (PLLS_SERVER_PRODUCT_ENUM_STRUCTA) &InfoStruct,
  2702. PrefMaxLen,
  2703. TotalEntries,
  2704. ResumeHandle
  2705. );
  2706. }
  2707. except (TRUE) {
  2708. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2709. #if DBG
  2710. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2711. #endif
  2712. }
  2713. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  2714. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  2715. *EntriesRead = GenericInfoContainer.EntriesRead;
  2716. }
  2717. return Status;
  2718. } // LlsServerProductEnumA
  2719. /////////////////////////////////////////////////////////////////////////
  2720. NTSTATUS
  2721. NTAPI
  2722. LlsLocalProductEnumW(
  2723. LLS_HANDLE Handle,
  2724. DWORD Level,
  2725. LPBYTE* bufptr,
  2726. DWORD PrefMaxLen,
  2727. LPDWORD EntriesRead,
  2728. LPDWORD TotalEntries,
  2729. LPDWORD ResumeHandle
  2730. )
  2731. /*++
  2732. Routine Description:
  2733. Arguments:
  2734. Return Value:
  2735. None.
  2736. --*/
  2737. {
  2738. NTSTATUS Status;
  2739. GENERIC_INFO_CONTAINER GenericInfoContainer;
  2740. GENERIC_ENUM_STRUCT InfoStruct;
  2741. PLOCAL_HANDLE pLocalHandle;
  2742. #ifdef API_TRACE
  2743. dprintf(TEXT("LLSRPC.DLL: LlsLocalProductEnumW\n"));
  2744. #endif
  2745. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2746. if (pLocalHandle == NULL)
  2747. return STATUS_INVALID_PARAMETER;
  2748. GenericInfoContainer.Buffer = NULL;
  2749. GenericInfoContainer.EntriesRead = 0;
  2750. InfoStruct.Container = &GenericInfoContainer;
  2751. InfoStruct.Level = Level;
  2752. try {
  2753. Status = LlsrLocalProductEnumW(
  2754. pLocalHandle->Handle,
  2755. (PLLS_SERVER_PRODUCT_ENUM_STRUCTW) &InfoStruct,
  2756. PrefMaxLen,
  2757. TotalEntries,
  2758. ResumeHandle
  2759. );
  2760. }
  2761. except (TRUE) {
  2762. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2763. #if DBG
  2764. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2765. #endif
  2766. }
  2767. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  2768. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  2769. *EntriesRead = GenericInfoContainer.EntriesRead;
  2770. }
  2771. return Status;
  2772. } // LlsLocalProductEnumW
  2773. /////////////////////////////////////////////////////////////////////////
  2774. NTSTATUS
  2775. NTAPI
  2776. LlsLocalProductEnumA(
  2777. LLS_HANDLE Handle,
  2778. DWORD Level,
  2779. LPBYTE* bufptr,
  2780. DWORD PrefMaxLen,
  2781. LPDWORD EntriesRead,
  2782. LPDWORD TotalEntries,
  2783. LPDWORD ResumeHandle
  2784. )
  2785. /*++
  2786. Routine Description:
  2787. Arguments:
  2788. Return Value:
  2789. None.
  2790. --*/
  2791. {
  2792. NTSTATUS Status;
  2793. GENERIC_INFO_CONTAINER GenericInfoContainer;
  2794. GENERIC_ENUM_STRUCT InfoStruct;
  2795. PLOCAL_HANDLE pLocalHandle;
  2796. #ifdef API_TRACE
  2797. dprintf(TEXT("LLSRPC.DLL: LlsLocalProductEnumA\n"));
  2798. #endif
  2799. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2800. if (pLocalHandle == NULL)
  2801. return STATUS_INVALID_PARAMETER;
  2802. GenericInfoContainer.Buffer = NULL;
  2803. GenericInfoContainer.EntriesRead = 0;
  2804. InfoStruct.Container = &GenericInfoContainer;
  2805. InfoStruct.Level = Level;
  2806. try {
  2807. Status = LlsrLocalProductEnumA(
  2808. pLocalHandle->Handle,
  2809. (PLLS_SERVER_PRODUCT_ENUM_STRUCTA) &InfoStruct,
  2810. PrefMaxLen,
  2811. TotalEntries,
  2812. ResumeHandle
  2813. );
  2814. }
  2815. except (TRUE) {
  2816. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2817. #if DBG
  2818. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2819. #endif
  2820. }
  2821. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  2822. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  2823. *EntriesRead = GenericInfoContainer.EntriesRead;
  2824. }
  2825. return Status;
  2826. } // LlsLocalProductEnumA
  2827. /////////////////////////////////////////////////////////////////////////
  2828. NTSTATUS
  2829. NTAPI
  2830. LlsLocalProductInfoGetW(
  2831. IN LLS_HANDLE Handle,
  2832. IN LPWSTR Product,
  2833. IN DWORD Level,
  2834. OUT LPBYTE* bufptr
  2835. )
  2836. /*++
  2837. Routine Description:
  2838. Arguments:
  2839. Return Value:
  2840. None.
  2841. --*/
  2842. {
  2843. NTSTATUS Status;
  2844. PLOCAL_HANDLE pLocalHandle;
  2845. #ifdef API_TRACE
  2846. dprintf(TEXT("LLSRPC.DLL: LlsLocalProductInfoGetW\n"));
  2847. #endif
  2848. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2849. if ((pLocalHandle == NULL) || (bufptr == NULL))
  2850. return STATUS_INVALID_PARAMETER;
  2851. *bufptr = NULL;
  2852. try {
  2853. Status = LlsrLocalProductInfoGetW(pLocalHandle->Handle, Product, Level, (PVOID) bufptr);
  2854. }
  2855. except (TRUE) {
  2856. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2857. #if DBG
  2858. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2859. #endif
  2860. }
  2861. return Status;
  2862. } // LlsLocalProductInfoGetW
  2863. /////////////////////////////////////////////////////////////////////////
  2864. NTSTATUS
  2865. NTAPI
  2866. LlsLocalProductInfoGetA(
  2867. IN LLS_HANDLE Handle,
  2868. IN LPSTR Product,
  2869. IN DWORD Level,
  2870. OUT LPBYTE* bufptr
  2871. )
  2872. /*++
  2873. Routine Description:
  2874. Arguments:
  2875. Return Value:
  2876. None.
  2877. --*/
  2878. {
  2879. NTSTATUS Status;
  2880. PLOCAL_HANDLE pLocalHandle;
  2881. #ifdef API_TRACE
  2882. dprintf(TEXT("LLSRPC.DLL: LlsLocalProductInfoGetA\n"));
  2883. #endif
  2884. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2885. if ((pLocalHandle == NULL) || (bufptr == NULL))
  2886. return STATUS_INVALID_PARAMETER;
  2887. *bufptr = NULL;
  2888. try {
  2889. Status = LlsrLocalProductInfoGetA(pLocalHandle->Handle, Product, Level, (PVOID) bufptr);
  2890. }
  2891. except (TRUE) {
  2892. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2893. #if DBG
  2894. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2895. #endif
  2896. }
  2897. return Status;
  2898. } // LlsLocalProductInfoGetA
  2899. /////////////////////////////////////////////////////////////////////////
  2900. NTSTATUS
  2901. NTAPI
  2902. LlsLocalProductInfoSetW(
  2903. IN LLS_HANDLE Handle,
  2904. IN LPWSTR Product,
  2905. IN DWORD Level,
  2906. IN LPBYTE bufptr
  2907. )
  2908. /*++
  2909. Routine Description:
  2910. Arguments:
  2911. Return Value:
  2912. None.
  2913. --*/
  2914. {
  2915. NTSTATUS Status;
  2916. PLOCAL_HANDLE pLocalHandle;
  2917. #ifdef API_TRACE
  2918. dprintf(TEXT("LLSRPC.DLL: LlsLocalProductInfoSetW\n"));
  2919. #endif
  2920. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2921. if (pLocalHandle == NULL)
  2922. return STATUS_INVALID_PARAMETER;
  2923. try {
  2924. Status = LlsrLocalProductInfoSetW(pLocalHandle->Handle, Product, Level, (PVOID) bufptr);
  2925. }
  2926. except (TRUE) {
  2927. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2928. #if DBG
  2929. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2930. #endif
  2931. }
  2932. return Status;
  2933. } // LlsLocalProductInfoSetW
  2934. /////////////////////////////////////////////////////////////////////////
  2935. NTSTATUS
  2936. NTAPI
  2937. LlsLocalProductInfoSetA(
  2938. IN LLS_HANDLE Handle,
  2939. IN LPSTR Product,
  2940. IN DWORD Level,
  2941. IN LPBYTE bufptr
  2942. )
  2943. /*++
  2944. Routine Description:
  2945. Arguments:
  2946. Return Value:
  2947. None.
  2948. --*/
  2949. {
  2950. NTSTATUS Status;
  2951. PLOCAL_HANDLE pLocalHandle;
  2952. #ifdef API_TRACE
  2953. dprintf(TEXT("LLSRPC.DLL: LlsLocalProductInfoSetA\n"));
  2954. #endif
  2955. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2956. if (pLocalHandle == NULL)
  2957. return STATUS_INVALID_PARAMETER;
  2958. try {
  2959. Status = LlsrLocalProductInfoSetA(pLocalHandle->Handle, Product, Level, (PVOID) bufptr);
  2960. }
  2961. except (TRUE) {
  2962. Status = I_RpcMapWin32Status(RpcExceptionCode());
  2963. #if DBG
  2964. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  2965. #endif
  2966. }
  2967. return Status;
  2968. } // LlsLocalProductInfoSetA
  2969. #endif // OBSOLETE
  2970. /////////////////////////////////////////////////////////////////////////
  2971. NTSTATUS
  2972. NTAPI
  2973. LlsServiceInfoGetW(
  2974. IN LLS_HANDLE Handle,
  2975. IN DWORD Level,
  2976. OUT LPBYTE* bufptr
  2977. )
  2978. /*++
  2979. Routine Description:
  2980. Arguments:
  2981. Return Value:
  2982. None.
  2983. --*/
  2984. {
  2985. NTSTATUS Status;
  2986. PLOCAL_HANDLE pLocalHandle;
  2987. #ifdef API_TRACE
  2988. dprintf(TEXT("LLSRPC.DLL: LlsServiceInfoGetW\n"));
  2989. #endif
  2990. pLocalHandle = (PLOCAL_HANDLE) Handle;
  2991. if ((pLocalHandle == NULL) || (bufptr == NULL))
  2992. return STATUS_INVALID_PARAMETER;
  2993. if ( LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_SERVICE_INFO_GETW ) )
  2994. {
  2995. *bufptr = NULL;
  2996. try {
  2997. Status = LlsrServiceInfoGetW(pLocalHandle->Handle, Level, (PVOID) bufptr);
  2998. }
  2999. except (TRUE) {
  3000. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3001. #if DBG
  3002. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3003. #endif
  3004. }
  3005. }
  3006. else if ( 0 != Level )
  3007. {
  3008. Status = STATUS_INVALID_LEVEL;
  3009. }
  3010. else
  3011. {
  3012. // the target server will blow up if we make the RPC call
  3013. // in 3.51, the IDL file for the returned structure was incorrect, causing
  3014. // the ReplicateTo and EnterpriseServer buffers at the server to be freed
  3015. // instead, get this info from the target machine's registry
  3016. PLLS_SERVICE_INFO_0W pServiceInfo;
  3017. pServiceInfo = MIDL_user_allocate( sizeof( *pServiceInfo ) );
  3018. if ( NULL == pServiceInfo )
  3019. {
  3020. Status = STATUS_NO_MEMORY;
  3021. }
  3022. else
  3023. {
  3024. DWORD cbServerName = sizeof( WCHAR ) * ( 3 + MAX_PATH );
  3025. ZeroMemory( pServiceInfo, sizeof( *pServiceInfo ) );
  3026. pServiceInfo->Version = 5; // we know it's a 3.51 box
  3027. pServiceInfo->TimeStarted = 0; // don't know, but 3.51 fills in 0 anyway
  3028. pServiceInfo->Mode = LLS_MODE_ENTERPRISE_SERVER; // we know it's a 3.51 box
  3029. pServiceInfo->ReplicateTo = MIDL_user_allocate( cbServerName );
  3030. pServiceInfo->EnterpriseServer = MIDL_user_allocate( cbServerName );
  3031. if ( ( NULL == pServiceInfo->ReplicateTo ) || ( NULL == pServiceInfo->EnterpriseServer ) )
  3032. {
  3033. Status = STATUS_NO_MEMORY;
  3034. }
  3035. else
  3036. {
  3037. HKEY hKeyLocalMachine;
  3038. LONG lError;
  3039. // get parameters from registry
  3040. lError = RegConnectRegistry( pLocalHandle->szServerName + 2, HKEY_LOCAL_MACHINE, &hKeyLocalMachine );
  3041. if ( ERROR_SUCCESS == lError )
  3042. {
  3043. HKEY hKeyParameters;
  3044. lError = RegOpenKeyEx( hKeyLocalMachine, TEXT( "System\\CurrentControlSet\\Services\\LicenseService\\Parameters" ), 0, KEY_READ, &hKeyParameters );
  3045. if ( ERROR_SUCCESS == lError )
  3046. {
  3047. DWORD cbData;
  3048. // these parameters all default to 0
  3049. // (they were initialized to 0 via ZeroMemory(), above)
  3050. cbData = sizeof( pServiceInfo->ReplicationTime );
  3051. lError = RegQueryValueEx( hKeyParameters, TEXT( "ReplicationTime" ), NULL, NULL, (LPBYTE) &pServiceInfo->ReplicationTime, &cbData );
  3052. cbData = sizeof( pServiceInfo->ReplicationType );
  3053. lError = RegQueryValueEx( hKeyParameters, TEXT( "ReplicationType" ), NULL, NULL, (LPBYTE) &pServiceInfo->ReplicationType, &cbData );
  3054. cbData = sizeof( pServiceInfo->UseEnterprise );
  3055. lError = RegQueryValueEx( hKeyParameters, TEXT( "UseEnterprise" ), NULL, NULL, (LPBYTE) &pServiceInfo->UseEnterprise, &cbData );
  3056. RegCloseKey( hKeyParameters );
  3057. lError = ERROR_SUCCESS;
  3058. }
  3059. RegCloseKey( hKeyLocalMachine );
  3060. }
  3061. switch ( lError )
  3062. {
  3063. case ERROR_SUCCESS:
  3064. Status = STATUS_SUCCESS;
  3065. break;
  3066. case ERROR_ACCESS_DENIED:
  3067. Status = STATUS_ACCESS_DENIED;
  3068. break;
  3069. default:
  3070. Status = STATUS_UNSUCCESSFUL;
  3071. break;
  3072. }
  3073. if ( STATUS_SUCCESS == Status )
  3074. {
  3075. // parameters retrieved from registry; only remaining parameters
  3076. // to be filled in are EnterpriseServer and ReplicateTo
  3077. TCHAR szDomain[ 1 + MAX_PATH ];
  3078. // retrieve the enterprise server
  3079. EnterpriseServerGet( pLocalHandle->szServerName, pServiceInfo->EnterpriseServer );
  3080. // derive ReplicateTo
  3081. Status = NTDomainGet( pLocalHandle->szServerName, szDomain );
  3082. if ( STATUS_ACCESS_DENIED != Status )
  3083. {
  3084. if ( STATUS_SUCCESS == Status )
  3085. {
  3086. NET_API_STATUS netStatus;
  3087. LPWSTR pszDCName;
  3088. netStatus = NetGetDCName( NULL, szDomain, (LPBYTE *) &pszDCName );
  3089. if ( NERR_Success == netStatus )
  3090. {
  3091. if ( !lstrcmpi( pszDCName, pLocalHandle->szServerName ) )
  3092. {
  3093. // server is primary domain controller;
  3094. // it replicates to its enterprise server (if any)
  3095. lstrcpy( pServiceInfo->ReplicateTo, pServiceInfo->EnterpriseServer );
  3096. }
  3097. else
  3098. {
  3099. // server is domain member; it replicates to the DC
  3100. lstrcpy( pServiceInfo->ReplicateTo, pszDCName );
  3101. }
  3102. NetApiBufferFree( pszDCName );
  3103. }
  3104. else
  3105. {
  3106. // server had domain but domain has no DC?
  3107. Status = STATUS_NO_SUCH_DOMAIN;
  3108. }
  3109. }
  3110. else
  3111. {
  3112. // server is not in a domain;
  3113. // it replicates to its enterprise server (if any)
  3114. lstrcpy( pServiceInfo->ReplicateTo, pServiceInfo->EnterpriseServer );
  3115. Status = STATUS_SUCCESS;
  3116. }
  3117. }
  3118. }
  3119. }
  3120. }
  3121. if ( STATUS_SUCCESS != Status )
  3122. {
  3123. if ( NULL != pServiceInfo )
  3124. {
  3125. if ( NULL != pServiceInfo->ReplicateTo )
  3126. {
  3127. MIDL_user_free( pServiceInfo->ReplicateTo );
  3128. }
  3129. if ( NULL != pServiceInfo->EnterpriseServer )
  3130. {
  3131. MIDL_user_free( pServiceInfo->EnterpriseServer );
  3132. }
  3133. MIDL_user_free( pServiceInfo );
  3134. }
  3135. }
  3136. else
  3137. {
  3138. if ( !lstrcmpi( pLocalHandle->szServerName, pServiceInfo->ReplicateTo ) )
  3139. {
  3140. *pServiceInfo->ReplicateTo = TEXT( '\0' );
  3141. }
  3142. if ( !lstrcmpi( pLocalHandle->szServerName, pServiceInfo->EnterpriseServer ) )
  3143. {
  3144. *pServiceInfo->EnterpriseServer = TEXT( '\0' );
  3145. }
  3146. *bufptr = (LPBYTE) pServiceInfo;
  3147. }
  3148. }
  3149. return Status;
  3150. } // LlsServiceInfoGetW
  3151. /////////////////////////////////////////////////////////////////////////
  3152. NTSTATUS
  3153. NTAPI
  3154. LlsServiceInfoGetA(
  3155. IN LLS_HANDLE Handle,
  3156. IN DWORD Level,
  3157. OUT LPBYTE* bufptr
  3158. )
  3159. /*++
  3160. Routine Description:
  3161. Arguments:
  3162. Return Value:
  3163. None.
  3164. --*/
  3165. {
  3166. NTSTATUS Status;
  3167. PLOCAL_HANDLE pLocalHandle;
  3168. #ifdef API_TRACE
  3169. dprintf(TEXT("LLSRPC.DLL: LlsServiceInfoGetA\n"));
  3170. #endif
  3171. pLocalHandle = (PLOCAL_HANDLE) Handle;
  3172. if ((pLocalHandle == NULL) || (bufptr == NULL))
  3173. return STATUS_INVALID_PARAMETER;
  3174. *bufptr = NULL;
  3175. try {
  3176. Status = LlsrServiceInfoGetA(pLocalHandle->Handle, Level, (PVOID) bufptr);
  3177. }
  3178. except (TRUE) {
  3179. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3180. #if DBG
  3181. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3182. #endif
  3183. }
  3184. return Status;
  3185. } // LlsServiceInfoGetA
  3186. /////////////////////////////////////////////////////////////////////////
  3187. NTSTATUS
  3188. NTAPI
  3189. LlsServiceInfoSetW(
  3190. IN LLS_HANDLE Handle,
  3191. IN DWORD Level,
  3192. IN LPBYTE bufptr
  3193. )
  3194. /*++
  3195. Routine Description:
  3196. Arguments:
  3197. Return Value:
  3198. None.
  3199. --*/
  3200. {
  3201. NTSTATUS Status;
  3202. PLOCAL_HANDLE pLocalHandle;
  3203. #ifdef API_TRACE
  3204. dprintf(TEXT("LLSRPC.DLL: LlsServiceInfoSetW\n"));
  3205. #endif
  3206. pLocalHandle = (PLOCAL_HANDLE) Handle;
  3207. if (pLocalHandle == NULL)
  3208. return STATUS_INVALID_PARAMETER;
  3209. try {
  3210. Status = LlsrServiceInfoSetW(pLocalHandle->Handle, Level, (PVOID) bufptr);
  3211. }
  3212. except (TRUE) {
  3213. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3214. #if DBG
  3215. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3216. #endif
  3217. }
  3218. if ( ( STATUS_NOT_SUPPORTED == Status ) && ( 0 == Level ) )
  3219. {
  3220. // RPC API is not supported; use the registry instead
  3221. HKEY hKeyLocalMachine;
  3222. HKEY hKeyParameters;
  3223. LONG lError;
  3224. PLLS_SERVICE_INFO_0W pServiceInfo = (PLLS_SERVICE_INFO_0W) bufptr;
  3225. LPWSTR pszEnterpriseServer;
  3226. pszEnterpriseServer = pServiceInfo->EnterpriseServer;
  3227. // strip leading backslashes from EnterpriseServer
  3228. if ( !wcsncmp( pszEnterpriseServer, L"\\\\", 2 ) )
  3229. {
  3230. pszEnterpriseServer += 2;
  3231. }
  3232. lError = RegConnectRegistry( pLocalHandle->szServerName + 2, HKEY_LOCAL_MACHINE, &hKeyLocalMachine );
  3233. if ( ERROR_SUCCESS == lError )
  3234. {
  3235. lError = RegOpenKeyEx( hKeyLocalMachine, TEXT( "System\\CurrentControlSet\\Services\\LicenseService\\Parameters" ), 0, KEY_WRITE, &hKeyParameters );
  3236. if ( ERROR_SUCCESS == lError )
  3237. {
  3238. lError = RegSetValueExW( hKeyParameters, L"EnterpriseServer", 0, REG_SZ, (LPBYTE) pszEnterpriseServer, sizeof( *pszEnterpriseServer ) * ( 1 + lstrlenW( pszEnterpriseServer ) ) );
  3239. if ( ERROR_SUCCESS == lError )
  3240. {
  3241. lError = RegSetValueEx( hKeyParameters, TEXT( "ReplicationTime" ), 0, REG_DWORD, (LPBYTE) &pServiceInfo->ReplicationTime, sizeof( pServiceInfo->ReplicationTime ) );
  3242. if ( ERROR_SUCCESS == lError )
  3243. {
  3244. lError = RegSetValueEx( hKeyParameters, TEXT( "ReplicationType" ), 0, REG_DWORD, (LPBYTE) &pServiceInfo->ReplicationType, sizeof( pServiceInfo->ReplicationType ) );
  3245. if ( ERROR_SUCCESS == lError )
  3246. {
  3247. lError = RegSetValueEx( hKeyParameters, TEXT( "UseEnterprise" ), 0, REG_DWORD, (LPBYTE) &pServiceInfo->UseEnterprise, sizeof( pServiceInfo->UseEnterprise ) );
  3248. if ( ERROR_SUCCESS == lError )
  3249. {
  3250. Status = STATUS_SUCCESS;
  3251. }
  3252. }
  3253. }
  3254. }
  3255. RegCloseKey( hKeyParameters );
  3256. }
  3257. RegCloseKey( hKeyLocalMachine );
  3258. }
  3259. }
  3260. return Status;
  3261. } // LlsServiceInfoSetW
  3262. /////////////////////////////////////////////////////////////////////////
  3263. NTSTATUS
  3264. NTAPI
  3265. LlsServiceInfoSetA(
  3266. IN LLS_HANDLE Handle,
  3267. IN DWORD Level,
  3268. IN LPBYTE bufptr
  3269. )
  3270. /*++
  3271. Routine Description:
  3272. Arguments:
  3273. Return Value:
  3274. None.
  3275. --*/
  3276. {
  3277. NTSTATUS Status;
  3278. PLOCAL_HANDLE pLocalHandle;
  3279. #ifdef API_TRACE
  3280. dprintf(TEXT("LLSRPC.DLL: LlsServiceInfoSetA\n"));
  3281. #endif
  3282. pLocalHandle = (PLOCAL_HANDLE) Handle;
  3283. if (pLocalHandle == NULL)
  3284. return STATUS_INVALID_PARAMETER;
  3285. try {
  3286. Status = LlsrServiceInfoSetA(pLocalHandle->Handle, Level, (PVOID) bufptr);
  3287. }
  3288. except (TRUE) {
  3289. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3290. #if DBG
  3291. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3292. #endif
  3293. }
  3294. return Status;
  3295. } // LlsServiceInfoSetA
  3296. /////////////////////////////////////////////////////////////////////////
  3297. /////////////////////////////////////////////////////////////////////////
  3298. /////////////////////////////////////////////////////////////////////////
  3299. /////////////////////////////////////////////////////////////////////////
  3300. NTSTATUS
  3301. LlsReplConnectW(
  3302. LPTSTR Server,
  3303. LLS_REPL_HANDLE* Handle
  3304. )
  3305. /*++
  3306. Routine Description:
  3307. Arguments:
  3308. Return Value:
  3309. None.
  3310. --*/
  3311. {
  3312. RPC_STATUS Status;
  3313. LPTSTR pszUuid = NULL;
  3314. LPTSTR pszProtocolSequence = NULL;
  3315. LPTSTR pszNetworkAddress = NULL;
  3316. LPTSTR pszEndpoint = NULL;
  3317. LPTSTR pszOptions = NULL;
  3318. TCHAR pComputer[MAX_COMPUTERNAME_LENGTH + 1];
  3319. ULONG Size;
  3320. #ifdef API_TRACE
  3321. if (Server == NULL)
  3322. dprintf(TEXT("LLSRPC.DLL: LlsReplConnectW: <NULL>\n"));
  3323. else
  3324. dprintf(TEXT("LLSRPC.DLL: LlsReplConnectW: %s\n"), Server);
  3325. #endif
  3326. //
  3327. // ** NEW - NT 5.0 **
  3328. //
  3329. // The server name may either be a DNS name or a NetBIOS name.
  3330. //
  3331. if (Server == NULL || (Server != NULL && !*Server))
  3332. return STATUS_INVALID_PARAMETER;
  3333. Size = sizeof(pComputer) / sizeof(TCHAR);
  3334. GetComputerName(pComputer, &Size);
  3335. pszProtocolSequence = TEXT("ncacn_np");
  3336. pszEndpoint = TEXT(LLS_NP_ENDPOINT);
  3337. pszNetworkAddress = Server;
  3338. // Compose a string binding
  3339. Status = RpcStringBindingComposeW(pszUuid,
  3340. pszProtocolSequence,
  3341. pszNetworkAddress,
  3342. pszEndpoint,
  3343. pszOptions,
  3344. &pszStringBinding);
  3345. if(Status) {
  3346. #if DBG
  3347. dprintf(TEXT("LLSRPC RpcStringBindingComposeW Failed: 0x%lX\n"), Status);
  3348. #endif
  3349. return I_RpcMapWin32Status(Status);
  3350. }
  3351. RtlEnterCriticalSection( &g_RpcHandleLock );
  3352. // Bind using the created string binding...
  3353. Status = RpcBindingFromStringBindingW(pszStringBinding, &llsrpc_handle);
  3354. if(Status) {
  3355. #if DBG
  3356. dprintf(TEXT("LLSRPC RpcBindingFromStringBindingW Failed: 0x%lX\n"), Status);
  3357. #endif
  3358. if(pszStringBinding != NULL)
  3359. {
  3360. RpcStringFree(&pszStringBinding);
  3361. }
  3362. if(llsrpc_handle != NULL)
  3363. {
  3364. RpcBindingFree(llsrpc_handle);
  3365. llsrpc_handle = NULL;
  3366. }
  3367. RtlLeaveCriticalSection( &g_RpcHandleLock );
  3368. return I_RpcMapWin32Status(Status);
  3369. }
  3370. try {
  3371. LlsrReplConnect(Handle, pComputer);
  3372. }
  3373. except (TRUE) {
  3374. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3375. #if DBG
  3376. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3377. #endif
  3378. }
  3379. if(!NT_SUCCESS(Status))
  3380. {
  3381. if(pszStringBinding != NULL)
  3382. {
  3383. RpcStringFree(&pszStringBinding);
  3384. }
  3385. if(llsrpc_handle != NULL)
  3386. {
  3387. RpcBindingFree(llsrpc_handle);
  3388. llsrpc_handle = NULL;
  3389. }
  3390. }
  3391. RtlLeaveCriticalSection( &g_RpcHandleLock );
  3392. return I_RpcMapWin32Status(Status);
  3393. } // LlsReplConnectW
  3394. /////////////////////////////////////////////////////////////////////////
  3395. NTSTATUS
  3396. NTAPI
  3397. LlsReplClose(
  3398. PLLS_REPL_HANDLE Handle
  3399. )
  3400. /*++
  3401. Routine Description:
  3402. Arguments:
  3403. Return Value:
  3404. None.
  3405. --*/
  3406. {
  3407. RPC_STATUS Status;
  3408. NTSTATUS NtStatus = STATUS_SUCCESS;
  3409. try {
  3410. NtStatus = LlsrReplClose(Handle);
  3411. }
  3412. except (TRUE) {
  3413. NtStatus = I_RpcMapWin32Status(RpcExceptionCode());
  3414. #if DBG
  3415. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), NtStatus);
  3416. #endif
  3417. }
  3418. try {
  3419. Status = RpcStringFree(&pszStringBinding);
  3420. if (Status ) {
  3421. NtStatus = I_RpcMapWin32Status(Status);
  3422. #if DBG
  3423. dprintf(TEXT("LLSRPC.DLL: LlsClose - RpcStringFree returned: 0x%lX\n"), NtStatus);
  3424. #endif
  3425. }
  3426. Status = RpcBindingFree(&llsrpc_handle);
  3427. if (Status ) {
  3428. NtStatus = I_RpcMapWin32Status(Status);
  3429. #if DBG
  3430. dprintf(TEXT("LLSRPC.DLL: LlsClose - RpcBindingFree returned: 0x%lX\n"), NtStatus);
  3431. #endif
  3432. }
  3433. }
  3434. except (TRUE) {
  3435. NtStatus = I_RpcMapWin32Status(RpcExceptionCode());
  3436. #if DBG
  3437. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), NtStatus);
  3438. #endif
  3439. }
  3440. return NtStatus;
  3441. } // LlsClose
  3442. /////////////////////////////////////////////////////////////////////////
  3443. NTSTATUS
  3444. LlsReplicationRequestW(
  3445. IN LLS_REPL_HANDLE Handle,
  3446. IN DWORD Version,
  3447. IN OUT PREPL_REQUEST Request
  3448. )
  3449. /*++
  3450. Routine Description:
  3451. Arguments:
  3452. Return Value:
  3453. None.
  3454. --*/
  3455. {
  3456. NTSTATUS Status;
  3457. try {
  3458. Status = LlsrReplicationRequestW(Handle, Version, Request);
  3459. }
  3460. except (TRUE) {
  3461. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3462. #if DBG
  3463. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3464. #endif
  3465. }
  3466. return Status;
  3467. } // LlsReplicationRequestW
  3468. /////////////////////////////////////////////////////////////////////////
  3469. NTSTATUS
  3470. LlsReplicationServerAddW(
  3471. IN LLS_REPL_HANDLE Handle,
  3472. IN ULONG NumRecords,
  3473. IN PREPL_SERVER_RECORD Servers
  3474. )
  3475. /*++
  3476. Routine Description:
  3477. Arguments:
  3478. Return Value:
  3479. None.
  3480. --*/
  3481. {
  3482. NTSTATUS Status;
  3483. try {
  3484. Status = LlsrReplicationServerAddW(Handle, NumRecords, Servers);
  3485. }
  3486. except (TRUE) {
  3487. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3488. #if DBG
  3489. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3490. #endif
  3491. }
  3492. return Status;
  3493. } // LlsReplicationServerAddW
  3494. /////////////////////////////////////////////////////////////////////////
  3495. NTSTATUS
  3496. LlsReplicationServerServiceAddW(
  3497. IN LLS_REPL_HANDLE Handle,
  3498. IN ULONG NumRecords,
  3499. IN PREPL_SERVER_SERVICE_RECORD ServerServices
  3500. )
  3501. /*++
  3502. Routine Description:
  3503. Arguments:
  3504. Return Value:
  3505. None.
  3506. --*/
  3507. {
  3508. NTSTATUS Status;
  3509. try {
  3510. Status = LlsrReplicationServerServiceAddW(Handle, NumRecords, ServerServices);
  3511. }
  3512. except (TRUE) {
  3513. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3514. #if DBG
  3515. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3516. #endif
  3517. }
  3518. return Status;
  3519. } // LlsReplicationServerServiceAddW
  3520. /////////////////////////////////////////////////////////////////////////
  3521. NTSTATUS
  3522. LlsReplicationServiceAddW(
  3523. IN LLS_REPL_HANDLE Handle,
  3524. IN ULONG NumRecords,
  3525. IN PREPL_SERVICE_RECORD Services
  3526. )
  3527. /*++
  3528. Routine Description:
  3529. Arguments:
  3530. Return Value:
  3531. None.
  3532. --*/
  3533. {
  3534. NTSTATUS Status;
  3535. try {
  3536. Status = LlsrReplicationServiceAddW(Handle, NumRecords, Services);
  3537. }
  3538. except (TRUE) {
  3539. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3540. #if DBG
  3541. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3542. #endif
  3543. }
  3544. return Status;
  3545. } // LlsReplicationServiceAddW
  3546. /////////////////////////////////////////////////////////////////////////
  3547. NTSTATUS
  3548. LlsReplicationUserAddW(
  3549. IN LLS_REPL_HANDLE Handle,
  3550. IN ULONG NumRecords,
  3551. IN PREPL_USER_RECORD_0 Users
  3552. )
  3553. /*++
  3554. Routine Description:
  3555. Arguments:
  3556. Return Value:
  3557. None.
  3558. --*/
  3559. {
  3560. NTSTATUS Status;
  3561. try {
  3562. Status = LlsrReplicationUserAddW(Handle, NumRecords, Users);
  3563. }
  3564. except (TRUE) {
  3565. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3566. #if DBG
  3567. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3568. #endif
  3569. }
  3570. return Status;
  3571. } // LlsReplicationUserAddW
  3572. /////////////////////////////////////////////////////////////////////////
  3573. /////////////////////////////////////////////////////////////////////////
  3574. /////////////////////////////////////////////////////////////////////////
  3575. NTSTATUS
  3576. NTAPI
  3577. LlsProductSecurityGetW(
  3578. LLS_HANDLE Handle,
  3579. LPWSTR Product,
  3580. LPBOOL pIsSecure
  3581. )
  3582. /*++
  3583. Routine Description:
  3584. Retrieve the "security" of a product. A product is deemed secure iff
  3585. it requires a secure certificate. In such a case, licenses for the
  3586. product may not be entered via the Honesty ("enter the number of
  3587. licenses you purchased") method.
  3588. Arguments:
  3589. Handle (LLS_HANDLE)
  3590. An open LLS handle to the target license server.
  3591. Product (LPWSTR)
  3592. The name of the product ("DisplayName") for which to receive the
  3593. security.
  3594. pIsSecure (LPBOOL)
  3595. On return, and if successful, indicates whether the product is
  3596. secure.
  3597. Return Value:
  3598. STATUS_SUCCESS or NTSTATUS error code.
  3599. --*/
  3600. {
  3601. NTSTATUS Status;
  3602. PLOCAL_HANDLE pLocalHandle;
  3603. #ifdef API_TRACE
  3604. dprintf(TEXT("LLSRPC.DLL: LlsProductSecurityGetW\n"));
  3605. #endif
  3606. if ( !LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_SECURE_CERTIFICATES ) )
  3607. {
  3608. return STATUS_NOT_SUPPORTED;
  3609. }
  3610. pLocalHandle = (PLOCAL_HANDLE) Handle;
  3611. if (pLocalHandle == NULL)
  3612. return STATUS_INVALID_PARAMETER;
  3613. try {
  3614. Status = LlsrProductSecurityGetW( pLocalHandle->Handle, Product, pIsSecure );
  3615. }
  3616. except (TRUE) {
  3617. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3618. #if DBG
  3619. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3620. #endif
  3621. }
  3622. return Status;
  3623. } // LlsProductSecurityGetW
  3624. /////////////////////////////////////////////////////////////////////////
  3625. NTSTATUS
  3626. NTAPI
  3627. LlsProductSecurityGetA(
  3628. LLS_HANDLE Handle,
  3629. LPSTR Product,
  3630. LPBOOL pIsSecure
  3631. )
  3632. /*++
  3633. Routine Description:
  3634. Retrieve the "security" of a product. A product is deemed secure iff
  3635. it requires a secure certificate. In such a case, licenses for the
  3636. product may not be entered via the Honesty ("enter the number of
  3637. licenses you purchased") method.
  3638. NOTE: Not yet implemented. Use LlsProductSecurityGetW().
  3639. Arguments:
  3640. Handle (LLS_HANDLE)
  3641. An open LLS handle to the target license server.
  3642. Product (LPSTR)
  3643. The name of the product ("DisplayName") for which to receive the
  3644. security.
  3645. pIsSecure (LPBOOL)
  3646. On return, and if successful, indicates whether the product is
  3647. secure.
  3648. Return Value:
  3649. STATUS_NOT_SUPPORTED.
  3650. --*/
  3651. {
  3652. #ifdef API_TRACE
  3653. dprintf(TEXT("LLSRPC.DLL: LlsProductSecurityGetA\n"));
  3654. #endif
  3655. return STATUS_NOT_SUPPORTED;
  3656. } // LlsProductSecurityGetA
  3657. /////////////////////////////////////////////////////////////////////////
  3658. NTSTATUS
  3659. NTAPI
  3660. LlsProductSecuritySetW(
  3661. LLS_HANDLE Handle,
  3662. LPWSTR Product
  3663. )
  3664. /*++
  3665. Routine Description:
  3666. Flags the given product as secure. A product is deemed secure iff
  3667. it requires a secure certificate. In such a case, licenses for the
  3668. product may not be entered via the Honesty ("enter the number of
  3669. licenses you purchased") method.
  3670. This designation is not reversible and is propagated up the
  3671. replication tree.
  3672. Arguments:
  3673. Handle (LLS_HANDLE)
  3674. An open LLS handle to the target license server.
  3675. Product (LPWSTR)
  3676. The name of the product ("DisplayName") for which to activate
  3677. security.
  3678. Return Value:
  3679. STATUS_SUCCESS or NTSTATUS error code.
  3680. --*/
  3681. {
  3682. NTSTATUS Status;
  3683. PLOCAL_HANDLE pLocalHandle;
  3684. #ifdef API_TRACE
  3685. dprintf(TEXT("LLSRPC.DLL: LlsProductSecuritySetW\n"));
  3686. #endif
  3687. if ( !LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_SECURE_CERTIFICATES ) )
  3688. {
  3689. return STATUS_NOT_SUPPORTED;
  3690. }
  3691. pLocalHandle = (PLOCAL_HANDLE) Handle;
  3692. if (pLocalHandle == NULL)
  3693. return STATUS_INVALID_PARAMETER;
  3694. try {
  3695. Status = LlsrProductSecuritySetW( pLocalHandle->Handle, Product );
  3696. }
  3697. except (TRUE) {
  3698. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3699. #if DBG
  3700. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3701. #endif
  3702. }
  3703. return Status;
  3704. } // LlsProductSecuritySetW
  3705. /////////////////////////////////////////////////////////////////////////
  3706. NTSTATUS
  3707. NTAPI
  3708. LlsProductSecuritySetA(
  3709. LLS_HANDLE Handle,
  3710. LPSTR Product
  3711. )
  3712. /*++
  3713. Routine Description:
  3714. Flags the given product as secure. A product is deemed secure iff
  3715. it requires a secure certificate. In such a case, licenses for the
  3716. product may not be entered via the Honesty ("enter the number of
  3717. licenses you purchased") method.
  3718. This designation is not reversible and is propagated up the
  3719. replication tree.
  3720. NOTE: Not yet implemented. Use LlsProductSecuritySetW().
  3721. Arguments:
  3722. Handle (LLS_HANDLE)
  3723. An open LLS handle to the target license server.
  3724. Product (LPSTR)
  3725. The name of the product ("DisplayName") for which to activate
  3726. security.
  3727. Return Value:
  3728. STATUS_NOT_SUPPORTED.
  3729. --*/
  3730. {
  3731. #ifdef API_TRACE
  3732. dprintf(TEXT("LLSRPC.DLL: LlsProductSecuritySetA\n"));
  3733. #endif
  3734. return STATUS_NOT_SUPPORTED;
  3735. } // LlsProductSecuritySetA
  3736. /////////////////////////////////////////////////////////////////////////
  3737. NTSTATUS
  3738. NTAPI
  3739. LlsProductLicensesGetW(
  3740. LLS_HANDLE Handle,
  3741. LPWSTR Product,
  3742. DWORD Mode,
  3743. LPDWORD pQuantity )
  3744. /*++
  3745. Routine Description:
  3746. Returns the number of licenses installed on the target machine for
  3747. use in the given mode.
  3748. Arguments:
  3749. Handle (LLS_HANDLE)
  3750. An open LLS handle to the target license server.
  3751. Product (LPWSTR)
  3752. The name of the product for which to tally licenses.
  3753. Mode (DWORD)
  3754. Licensing mode for which to tally the licenses.
  3755. pQuantity (LPDWORD)
  3756. On return (and if successful), holds the total number of licenses
  3757. for use by the given product in the given license mode.
  3758. Return Value:
  3759. STATUS_SUCCESS or NTSTATUS error code.
  3760. --*/
  3761. {
  3762. NTSTATUS Status;
  3763. PLOCAL_HANDLE pLocalHandle;
  3764. #ifdef API_TRACE
  3765. dprintf(TEXT("LLSRPC.DLL: LlsProductLicensesGetW\n"));
  3766. #endif
  3767. if ( !LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_SECURE_CERTIFICATES ) )
  3768. {
  3769. return STATUS_NOT_SUPPORTED;
  3770. }
  3771. pLocalHandle = (PLOCAL_HANDLE) Handle;
  3772. if (pLocalHandle == NULL)
  3773. return STATUS_INVALID_PARAMETER;
  3774. try {
  3775. Status = LlsrProductLicensesGetW( pLocalHandle->Handle, Product, Mode, pQuantity );
  3776. }
  3777. except (TRUE) {
  3778. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3779. #if DBG
  3780. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3781. #endif
  3782. }
  3783. return Status;
  3784. } // LlsProductLicensesGetW
  3785. /////////////////////////////////////////////////////////////////////////
  3786. NTSTATUS
  3787. NTAPI
  3788. LlsProductLicensesGetA(
  3789. LLS_HANDLE Handle,
  3790. LPSTR Product,
  3791. DWORD Mode,
  3792. LPDWORD pQuantity )
  3793. /*++
  3794. Routine Description:
  3795. Returns the number of licenses installed on the target machine for
  3796. use in the given mode.
  3797. NOTE: Not yet implemented. Use LlsProductLicensesGetW().
  3798. Arguments:
  3799. Handle (LLS_HANDLE)
  3800. An open LLS handle to the target license server.
  3801. Product (LPSTR)
  3802. The name of the product for which to tally licenses.
  3803. Mode (DWORD)
  3804. Licensing mode for which to tally the licenses.
  3805. pQuantity (LPDWORD)
  3806. On return (and if successful), holds the total number of licenses
  3807. for use by the given product in the given license mode.
  3808. Return Value:
  3809. STATUS_NOT_SUPPORTED.
  3810. --*/
  3811. {
  3812. #ifdef API_TRACE
  3813. dprintf(TEXT("LLSRPC.DLL: LlsProductLicensesGetA\n"));
  3814. #endif
  3815. return STATUS_NOT_SUPPORTED;
  3816. } // LlsProductLicensesGetA
  3817. #ifdef OBSOLETE
  3818. /////////////////////////////////////////////////////////////////////////
  3819. NTSTATUS
  3820. NTAPI
  3821. LlsCertificateClaimEnumW(
  3822. LLS_HANDLE Handle,
  3823. DWORD LicenseLevel,
  3824. LPBYTE pLicenseInfo,
  3825. DWORD TargetLevel,
  3826. LPBYTE * ppTargets,
  3827. LPDWORD pNumTargets )
  3828. /*++
  3829. Routine Description:
  3830. Enumerates the servers on which a given secure certificate is installed.
  3831. This function is normally invoked when an attempt to add licenses from
  3832. a certificate is denied.
  3833. Arguments:
  3834. Handle (LLS_HANDLE)
  3835. An open LLS handle to the target license server.
  3836. LicenseLevel (DWORD)
  3837. The level of the license structure pointed to by pLicenseInfo.
  3838. pLicenseInfo (LPBYTE)
  3839. Points to a LLS_LICENSE_INFO_X structure, where X is LicenseLevel.
  3840. This license structure describes a license for which the certificate
  3841. targets are requested.
  3842. TargetLevel (DWORD)
  3843. The level of the target structure desired.
  3844. ppTargets (LPBYTE *)
  3845. On return (and if successful), holds a PLLS_EX_CERTIFICATE_CLAIM_X,
  3846. where X is TargetLevel. This array of structures describes the
  3847. location of all installations of licenses from the given certificate.
  3848. pNumTargets (LPDWORD)
  3849. On return (and if successful), holds the number of structures pointed
  3850. to by ppTargets.
  3851. Return Value:
  3852. STATUS_SUCCESS or NTSTATUS error code.
  3853. --*/
  3854. {
  3855. NTSTATUS Status;
  3856. GENERIC_INFO_CONTAINER GenericInfoContainer;
  3857. GENERIC_ENUM_STRUCT InfoStruct;
  3858. PLOCAL_HANDLE pLocalHandle;
  3859. #ifdef API_TRACE
  3860. dprintf(TEXT("LLSRPC.DLL: LlsCertificateClaimEnumW\n"));
  3861. #endif
  3862. if ( !LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_SECURE_CERTIFICATES ) )
  3863. {
  3864. return STATUS_NOT_SUPPORTED;
  3865. }
  3866. pLocalHandle = (PLOCAL_HANDLE) Handle;
  3867. if (pLocalHandle == NULL)
  3868. return STATUS_INVALID_PARAMETER;
  3869. GenericInfoContainer.Buffer = NULL;
  3870. GenericInfoContainer.EntriesRead = 0;
  3871. InfoStruct.Container = &GenericInfoContainer;
  3872. InfoStruct.Level = TargetLevel;
  3873. try
  3874. {
  3875. Status = LlsrCertificateClaimEnumW(
  3876. pLocalHandle->Handle,
  3877. LicenseLevel,
  3878. (LPVOID) pLicenseInfo,
  3879. (PLLS_CERTIFICATE_CLAIM_ENUM_STRUCTW) &InfoStruct );
  3880. }
  3881. except (TRUE)
  3882. {
  3883. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3884. #if DBG
  3885. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3886. #endif
  3887. }
  3888. if (Status == STATUS_SUCCESS)
  3889. {
  3890. *ppTargets = (LPBYTE) GenericInfoContainer.Buffer;
  3891. *pNumTargets = GenericInfoContainer.EntriesRead;
  3892. }
  3893. return Status;
  3894. } // LlsCertificateClaimEnumW
  3895. /////////////////////////////////////////////////////////////////////////
  3896. NTSTATUS
  3897. NTAPI
  3898. LlsCertificateClaimEnumA(
  3899. LLS_HANDLE Handle,
  3900. DWORD LicenseLevel,
  3901. LPBYTE pLicenseInfo,
  3902. DWORD TargetLevel,
  3903. LPBYTE * ppTargets,
  3904. LPDWORD pNumTargets )
  3905. /*++
  3906. Routine Description:
  3907. Enumerates the servers on which a given secure certificate is installed.
  3908. This function is normally invoked when an attempt to add licenses from
  3909. a certificate is denied.
  3910. NOTE: Not yet implemented. Use LlsCertificateClaimEnumW().
  3911. Arguments:
  3912. Handle (LLS_HANDLE)
  3913. An open LLS handle to the target license server.
  3914. LicenseLevel (DWORD)
  3915. The level of the license structure pointed to by pLicenseInfo.
  3916. pLicenseInfo (LPBYTE)
  3917. Points to a LLS_LICENSE_INFO_X structure, where X is LicenseLevel.
  3918. This license structure describes a license for which the certificate
  3919. targets are requested.
  3920. TargetLevel (DWORD)
  3921. The level of the target structure desired.
  3922. ppTargets (LPBYTE *)
  3923. On return (and if successful), holds a PLLS_EX_CERTIFICATE_CLAIM_X,
  3924. where X is TargetLevel. This array of structures describes the
  3925. location of all installations of licenses from the given certificate.
  3926. pNumTargets (LPDWORD)
  3927. On return (and if successful), holds the number of structures pointed
  3928. to by ppTargets.
  3929. Return Value:
  3930. STATUS_NOT_SUPPORTED.
  3931. --*/
  3932. {
  3933. #ifdef API_TRACE
  3934. dprintf(TEXT("LLSRPC.DLL: LlsCertificateClaimEnumA\n"));
  3935. #endif
  3936. return STATUS_NOT_SUPPORTED;
  3937. } // LlsCertificateClaimEnumA
  3938. #endif // OBSOLETE
  3939. /////////////////////////////////////////////////////////////////////////
  3940. NTSTATUS
  3941. NTAPI
  3942. LlsCertificateClaimAddCheckW(
  3943. LLS_HANDLE Handle,
  3944. DWORD LicenseLevel,
  3945. LPBYTE pLicenseInfo,
  3946. LPBOOL pbMayInstall )
  3947. /*++
  3948. Routine Description:
  3949. Verify that no more licenses from a given certificate are installed in
  3950. a licensing enterprise than are allowed by the certificate.
  3951. Arguments:
  3952. Handle (LLS_HANDLE)
  3953. An open LLS handle to the target license server.
  3954. LicenseLevel (DWORD)
  3955. The level of the license structure pointed to by pLicenseInfo.
  3956. pLicenseInfo (LPBYTE)
  3957. Points to a LLS_LICENSE_INFO_X structure, where X is LicenseLevel.
  3958. This license structure describes the license wished to add.
  3959. pbMayInstall (LPBOOL)
  3960. On return (and if successful), indicates whether the certificate
  3961. may be legally installed.
  3962. Return Value:
  3963. STATUS_SUCCESS or NTSTATUS error code.
  3964. --*/
  3965. {
  3966. NTSTATUS Status;
  3967. PLOCAL_HANDLE pLocalHandle;
  3968. #ifdef API_TRACE
  3969. dprintf(TEXT("LLSRPC.DLL: LlsCertificateClaimAddCheckW\n"));
  3970. #endif
  3971. if ( !LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_SECURE_CERTIFICATES ) )
  3972. {
  3973. return STATUS_NOT_SUPPORTED;
  3974. }
  3975. pLocalHandle = (PLOCAL_HANDLE) Handle;
  3976. if (pLocalHandle == NULL)
  3977. return STATUS_INVALID_PARAMETER;
  3978. try {
  3979. Status = LlsrCertificateClaimAddCheckW( pLocalHandle->Handle, LicenseLevel, (LPVOID) pLicenseInfo, pbMayInstall );
  3980. }
  3981. except (TRUE) {
  3982. Status = I_RpcMapWin32Status(RpcExceptionCode());
  3983. #if DBG
  3984. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  3985. #endif
  3986. }
  3987. return Status;
  3988. } // LlsCertificateClaimAddCheckW
  3989. /////////////////////////////////////////////////////////////////////////
  3990. NTSTATUS
  3991. NTAPI
  3992. LlsCertificateClaimAddCheckA(
  3993. IN LLS_HANDLE Handle,
  3994. IN DWORD LicenseLevel,
  3995. IN LPBYTE pLicenseInfo,
  3996. OUT LPBOOL pbMayInstall )
  3997. /*++
  3998. Routine Description:
  3999. Verify that no more licenses from a given certificate are installed in
  4000. a licensing enterprise than are allowed by the certificate.
  4001. NOTE: Not yet implemented. Use LlsCertificateClaimAddCheckW().
  4002. Arguments:
  4003. Handle (LLS_HANDLE)
  4004. An open LLS handle to the target license server.
  4005. LicenseLevel (DWORD)
  4006. The level of the license structure pointed to by pLicenseInfo.
  4007. pLicenseInfo (LPBYTE)
  4008. Points to a LLS_LICENSE_INFO_X structure, where X is LicenseLevel.
  4009. This license structure describes the license wished to add.
  4010. pbMayInstall (LPBOOL)
  4011. On return (and if successful), indicates whether the certificate
  4012. may be legally installed.
  4013. Return Value:
  4014. STATUS_NOT_SUPPORTED.
  4015. --*/
  4016. {
  4017. #ifdef API_TRACE
  4018. dprintf(TEXT("LLSRPC.DLL: LlsCertificateClaimAddCheckA\n"));
  4019. #endif
  4020. return STATUS_NOT_SUPPORTED;
  4021. } // LlsCertificateClaimAddCheckA
  4022. /////////////////////////////////////////////////////////////////////////
  4023. NTSTATUS
  4024. NTAPI
  4025. LlsCertificateClaimAddW(
  4026. LLS_HANDLE Handle,
  4027. LPWSTR ServerName,
  4028. DWORD LicenseLevel,
  4029. LPBYTE pLicenseInfo )
  4030. /*++
  4031. Routine Description:
  4032. Declare a number of licenses from a given certificate as being installed
  4033. on the target machine.
  4034. Arguments:
  4035. Handle (LLS_HANDLE)
  4036. An open LLS handle to the target license server.
  4037. ServerName (LPWSTR)
  4038. Name of the server on which the licenses are installed.
  4039. LicenseLevel (DWORD)
  4040. The level of the license structure pointed to by pLicenseInfo.
  4041. pLicenseInfo (LPBYTE)
  4042. Points to a LLS_LICENSE_INFO_X structure, where X is LicenseLevel.
  4043. This license structure describes the license added.
  4044. Return Value:
  4045. STATUS_SUCCESS or NTSTATUS error code.
  4046. --*/
  4047. {
  4048. NTSTATUS Status;
  4049. PLOCAL_HANDLE pLocalHandle;
  4050. #ifdef API_TRACE
  4051. dprintf(TEXT("LLSRPC.DLL: LlsCertificateClaimAddW\n"));
  4052. #endif
  4053. if ( !LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_SECURE_CERTIFICATES ) )
  4054. {
  4055. return STATUS_NOT_SUPPORTED;
  4056. }
  4057. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4058. if (pLocalHandle == NULL)
  4059. return STATUS_INVALID_PARAMETER;
  4060. try {
  4061. Status = LlsrCertificateClaimAddW( pLocalHandle->Handle, ServerName, LicenseLevel, (LPVOID) pLicenseInfo );
  4062. }
  4063. except (TRUE) {
  4064. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4065. #if DBG
  4066. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4067. #endif
  4068. }
  4069. return Status;
  4070. } // LlsCertificateClaimAddW
  4071. /////////////////////////////////////////////////////////////////////////
  4072. NTSTATUS
  4073. NTAPI
  4074. LlsCertificateClaimAddA(
  4075. LLS_HANDLE Handle,
  4076. LPSTR ServerName,
  4077. DWORD LicenseLevel,
  4078. LPBYTE pLicenseInfo )
  4079. /*++
  4080. Routine Description:
  4081. Declare a number of licenses from a given certificate as being installed
  4082. on the target machine.
  4083. NOTE: Not yet implemented. Use LlsCertificateClaimAddW().
  4084. Arguments:
  4085. Handle (LLS_HANDLE)
  4086. An open LLS handle to the target license server.
  4087. ServerName (LPWSTR)
  4088. Name of the server on which the licenses are installed.
  4089. LicenseLevel (DWORD)
  4090. The level of the license structure pointed to by pLicenseInfo.
  4091. pLicenseInfo (LPBYTE)
  4092. Points to a LLS_LICENSE_INFO_X structure, where X is LicenseLevel.
  4093. This license structure describes the license added.
  4094. Return Value:
  4095. STATUS_NOT_SUPPORTED.
  4096. --*/
  4097. {
  4098. #ifdef API_TRACE
  4099. dprintf(TEXT("LLSRPC.DLL: LlsCertificateClaimAddA\n"));
  4100. #endif
  4101. return STATUS_NOT_SUPPORTED;
  4102. } // LlsCertificateClaimAddA
  4103. /////////////////////////////////////////////////////////////////////////
  4104. NTSTATUS
  4105. NTAPI
  4106. LlsReplicationCertDbAddW(
  4107. LLS_REPL_HANDLE Handle,
  4108. DWORD Level,
  4109. LPVOID Certificates )
  4110. /*++
  4111. Routine Description:
  4112. Called as an optional part of replication, this function replicates
  4113. the contents of the remote certificate database.
  4114. Arguments:
  4115. Handle (LLS_REPL_HANDLE)
  4116. An open replication handle to the target server.
  4117. Level (DWORD)
  4118. Level of replication information sent.
  4119. Certificates (LPVOID)
  4120. Replicated certificate information.
  4121. Return Value:
  4122. STATUS_SUCCESS or NTSTATUS error code.
  4123. --*/
  4124. {
  4125. NTSTATUS Status;
  4126. #ifdef API_TRACE
  4127. dprintf(TEXT("LLSRPC.DLL: LlsReplicationCertDbAddW\n"));
  4128. #endif
  4129. try {
  4130. Status = LlsrReplicationCertDbAddW( Handle, Level, Certificates );
  4131. }
  4132. except (TRUE) {
  4133. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4134. #if DBG
  4135. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4136. #endif
  4137. }
  4138. return Status;
  4139. } // LlsReplicationCertDbAddW
  4140. /////////////////////////////////////////////////////////////////////////
  4141. NTSTATUS
  4142. NTAPI
  4143. LlsReplicationProductSecurityAddW(
  4144. LLS_REPL_HANDLE Handle,
  4145. DWORD Level,
  4146. LPVOID SecureProducts )
  4147. /*++
  4148. Routine Description:
  4149. Called as an optional part of replication, this function replicates
  4150. the list of products which require secure certificates.
  4151. Arguments:
  4152. Handle (LLS_REPL_HANDLE)
  4153. An open replication handle to the target server.
  4154. Level (DWORD)
  4155. Level of the product security information.
  4156. SecureProducts (LPVOID)
  4157. Replicated secure product information.
  4158. Return Value:
  4159. STATUS_SUCCESS or NTSTATUS error code.
  4160. --*/
  4161. {
  4162. NTSTATUS Status;
  4163. #ifdef API_TRACE
  4164. dprintf(TEXT("LLSRPC.DLL: LlsReplicationProductSecurityAddW\n"));
  4165. #endif
  4166. try {
  4167. Status = LlsrReplicationProductSecurityAddW( Handle, Level, SecureProducts );
  4168. }
  4169. except (TRUE) {
  4170. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4171. #if DBG
  4172. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4173. #endif
  4174. }
  4175. return Status;
  4176. } // LlsReplicationProductSecurityAddW
  4177. /////////////////////////////////////////////////////////////////////////
  4178. NTSTATUS
  4179. NTAPI
  4180. LlsReplicationUserAddExW(
  4181. LLS_REPL_HANDLE Handle,
  4182. DWORD Level,
  4183. LPVOID Users )
  4184. /*++
  4185. Routine Description:
  4186. Replacement for LlsReplicationUserAddW(). (This function, unlike its
  4187. counterpart, supports structure levels.) This function replicates
  4188. the user list.
  4189. Arguments:
  4190. Handle (LLS_REPL_HANDLE)
  4191. An open replication handle to the target server.
  4192. Level (DWORD)
  4193. Level of the user information.
  4194. Users (LPVOID)
  4195. Replicated user information.
  4196. Return Value:
  4197. STATUS_SUCCESS or NTSTATUS error code.
  4198. --*/
  4199. {
  4200. NTSTATUS Status;
  4201. #ifdef API_TRACE
  4202. dprintf(TEXT("LLSRPC.DLL: LlsReplicationUserAddExW\n"));
  4203. #endif
  4204. if ( (0 != Level) && (1 != Level) )
  4205. return STATUS_INVALID_LEVEL;
  4206. try {
  4207. Status = LlsrReplicationUserAddExW( Handle, Level, Users );
  4208. }
  4209. except (TRUE) {
  4210. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4211. #if DBG
  4212. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4213. #endif
  4214. }
  4215. return Status;
  4216. } // LlsReplicationUserAddExW
  4217. /////////////////////////////////////////////////////////////////////////
  4218. BOOL
  4219. NTAPI
  4220. LlsCapabilityIsSupported(
  4221. LLS_HANDLE Handle,
  4222. DWORD Capability )
  4223. /*++
  4224. Routine Description:
  4225. Determine whether the target license server supports an arbitrary
  4226. function.
  4227. Arguments:
  4228. Handle (LLS_HANDLE)
  4229. An open LLS handle to the target license server.
  4230. Capability (DWORD)
  4231. The capability number to check for, 0 <= Capability < LLS_CAPABILITY_MAX.
  4232. Return Value:
  4233. TRUE (supports the capability) or FALSE (does not).
  4234. --*/
  4235. {
  4236. BOOL bIsSupported = FALSE;
  4237. PLOCAL_HANDLE pLocalHandle;
  4238. DWORD dwCapByte;
  4239. DWORD dwCapBit;
  4240. #ifdef API_TRACE
  4241. dprintf(TEXT("LLSRPC.DLL: LlsCapabilityIsSupported\n"));
  4242. #endif
  4243. if ( ( NULL != Handle ) && ( Capability < LLS_CAPABILITY_MAX ) )
  4244. {
  4245. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4246. dwCapByte = Capability / 8;
  4247. dwCapBit = Capability - 8 * dwCapByte;
  4248. if ( 1 & ( pLocalHandle->Capabilities[ dwCapByte ] >> dwCapBit ) )
  4249. {
  4250. bIsSupported = TRUE;
  4251. }
  4252. }
  4253. return bIsSupported;
  4254. } // LlsCapabilityIsSupported
  4255. NTSTATUS
  4256. NTAPI
  4257. LlsLocalServiceEnumW(
  4258. LLS_HANDLE Handle,
  4259. DWORD Level,
  4260. LPBYTE* bufptr,
  4261. DWORD PrefMaxLen,
  4262. LPDWORD EntriesRead,
  4263. LPDWORD TotalEntries,
  4264. LPDWORD ResumeHandle )
  4265. {
  4266. NTSTATUS Status;
  4267. PLOCAL_HANDLE pLocalHandle;
  4268. #ifdef API_TRACE
  4269. dprintf(TEXT("LLSRPC.DLL: LlsLocalServiceEnumW\n"));
  4270. #endif
  4271. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4272. if (pLocalHandle == NULL)
  4273. {
  4274. Status = STATUS_INVALID_PARAMETER;
  4275. }
  4276. else if ( LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_LOCAL_SERVICE_API ) )
  4277. {
  4278. GENERIC_INFO_CONTAINER GenericInfoContainer;
  4279. GENERIC_ENUM_STRUCT InfoStruct;
  4280. GenericInfoContainer.Buffer = NULL;
  4281. GenericInfoContainer.EntriesRead = 0;
  4282. InfoStruct.Container = &GenericInfoContainer;
  4283. InfoStruct.Level = Level;
  4284. try
  4285. {
  4286. Status = LlsrLocalServiceEnumW(
  4287. pLocalHandle->Handle,
  4288. (PLLS_LOCAL_SERVICE_ENUM_STRUCTW) &InfoStruct,
  4289. PrefMaxLen,
  4290. TotalEntries,
  4291. ResumeHandle
  4292. );
  4293. }
  4294. except (TRUE)
  4295. {
  4296. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4297. #if DBG
  4298. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4299. #endif
  4300. }
  4301. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES))
  4302. {
  4303. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  4304. *EntriesRead = GenericInfoContainer.EntriesRead;
  4305. }
  4306. }
  4307. else if ( 0 != Level )
  4308. {
  4309. Status = STATUS_INVALID_LEVEL;
  4310. }
  4311. else
  4312. {
  4313. PLLS_LOCAL_SERVICE_INFO_0 pLocalServices = NULL;
  4314. DWORD cEntriesRead = 0;
  4315. LONG lError;
  4316. HKEY hKeyLocalMachine;
  4317. lError = RegConnectRegistry( pLocalHandle->szServerName, HKEY_LOCAL_MACHINE, &hKeyLocalMachine );
  4318. if ( ERROR_SUCCESS == lError )
  4319. {
  4320. HKEY hKeyLicenseInfo;
  4321. lError = RegOpenKeyEx( hKeyLocalMachine, REG_KEY_LICENSE, 0, KEY_READ, &hKeyLicenseInfo );
  4322. if ( ERROR_SUCCESS == lError )
  4323. {
  4324. const DWORD cbBufferSize = 0x4000;
  4325. // fudge; we ignore MaxPrefLen and allocate a 16k buffer
  4326. // this is because when we restart an enumeration, we don't know how
  4327. // many items we have left (we could do it, but it'd be slow)
  4328. // this is only for 3.51 boxes, anyway, and this buffer will hold
  4329. // about 500 local service entries (plenty!)
  4330. // this also keeps us from having to keep the registry key open
  4331. // across function calls
  4332. pLocalServices = MIDL_user_allocate( cbBufferSize );
  4333. if ( NULL == pLocalServices )
  4334. {
  4335. lError = ERROR_OUTOFMEMORY;
  4336. }
  4337. else
  4338. {
  4339. DWORD iSubKey;
  4340. TCHAR szKeyName[ 128 ];
  4341. // read all the services installed on this machine
  4342. for ( iSubKey=0, cEntriesRead=0;
  4343. ( ERROR_SUCCESS == lError ) && ( ( cEntriesRead + 1 ) * sizeof( *pLocalServices ) < cbBufferSize );
  4344. iSubKey++ )
  4345. {
  4346. lError = RegEnumKey( hKeyLicenseInfo, iSubKey, szKeyName, sizeof( szKeyName ) / sizeof( *szKeyName ) );
  4347. if ( ERROR_SUCCESS == lError )
  4348. {
  4349. HKEY hKeyService;
  4350. lError = RegOpenKeyEx( hKeyLicenseInfo, szKeyName, 0, KEY_READ, &hKeyService );
  4351. if ( ERROR_SUCCESS == lError )
  4352. {
  4353. DWORD cbData;
  4354. cbData = sizeof( pLocalServices[ cEntriesRead ].Mode );
  4355. lError = RegQueryValueEx( hKeyService, REG_VALUE_MODE, NULL, NULL, (LPBYTE) &pLocalServices[ cEntriesRead ].Mode, &cbData );
  4356. if ( ERROR_SUCCESS == lError )
  4357. {
  4358. cbData = sizeof( pLocalServices[ cEntriesRead ].FlipAllow );
  4359. lError = RegQueryValueEx( hKeyService, REG_VALUE_FLIP, NULL, NULL, (LPBYTE) &pLocalServices[ cEntriesRead ].FlipAllow, &cbData );
  4360. if ( ERROR_SUCCESS == lError )
  4361. {
  4362. cbData = sizeof( pLocalServices[ cEntriesRead ].ConcurrentLimit );
  4363. lError = RegQueryValueEx( hKeyService, REG_VALUE_LIMIT, NULL, NULL, (LPBYTE) &pLocalServices[ cEntriesRead ].ConcurrentLimit, &cbData );
  4364. if ( ERROR_SUCCESS == lError )
  4365. {
  4366. DWORD cbKeyName;
  4367. DWORD cbDisplayName;
  4368. DWORD cbFamilyDisplayName;
  4369. cbData = sizeof( pLocalServices[ cEntriesRead ].HighMark );
  4370. lError = RegQueryValueEx( hKeyService, REG_VALUE_HIGHMARK, NULL, NULL, (LPBYTE) &pLocalServices[ cEntriesRead ].HighMark, &cbData );
  4371. if ( ERROR_SUCCESS != lError )
  4372. {
  4373. pLocalServices[ cEntriesRead ].HighMark = 0;
  4374. lError = ERROR_SUCCESS;
  4375. }
  4376. if ( ( ERROR_SUCCESS == RegQueryValueEx( hKeyService, REG_VALUE_NAME, NULL, NULL, NULL, &cbDisplayName ) )
  4377. && ( ERROR_SUCCESS == RegQueryValueEx( hKeyService, REG_VALUE_FAMILY, NULL, NULL, NULL, &cbFamilyDisplayName ) ) )
  4378. {
  4379. cbKeyName = sizeof( *szKeyName ) * ( 1 + lstrlen( szKeyName ) );
  4380. pLocalServices[ cEntriesRead ].KeyName = MIDL_user_allocate( cbKeyName );
  4381. if ( NULL == pLocalServices[ cEntriesRead ].KeyName )
  4382. {
  4383. lError = ERROR_OUTOFMEMORY;
  4384. }
  4385. else
  4386. {
  4387. lstrcpy( pLocalServices[ cEntriesRead ].KeyName, szKeyName );
  4388. pLocalServices[ cEntriesRead ].DisplayName = MIDL_user_allocate( cbDisplayName );
  4389. if ( NULL == pLocalServices[ cEntriesRead ].DisplayName )
  4390. {
  4391. lError = ERROR_OUTOFMEMORY;
  4392. }
  4393. else
  4394. {
  4395. lError = RegQueryValueEx( hKeyService, REG_VALUE_NAME, NULL, NULL, (LPBYTE) pLocalServices[ cEntriesRead ].DisplayName, &cbDisplayName );
  4396. if ( ERROR_SUCCESS == lError )
  4397. {
  4398. pLocalServices[ cEntriesRead ].FamilyDisplayName = MIDL_user_allocate( cbFamilyDisplayName );
  4399. if ( NULL == pLocalServices[ cEntriesRead ].FamilyDisplayName )
  4400. {
  4401. lError = ERROR_OUTOFMEMORY;
  4402. }
  4403. else
  4404. {
  4405. lError = RegQueryValueEx( hKeyService, REG_VALUE_FAMILY, NULL, NULL, (LPBYTE) pLocalServices[ cEntriesRead ].FamilyDisplayName, &cbFamilyDisplayName );
  4406. if ( ERROR_SUCCESS != lError )
  4407. {
  4408. MIDL_user_free( pLocalServices[ cEntriesRead ].FamilyDisplayName );
  4409. }
  4410. }
  4411. }
  4412. if ( ERROR_SUCCESS != lError )
  4413. {
  4414. MIDL_user_free( pLocalServices[ cEntriesRead ].DisplayName );
  4415. }
  4416. }
  4417. if ( ERROR_SUCCESS != lError )
  4418. {
  4419. MIDL_user_free( pLocalServices[ cEntriesRead ].KeyName );
  4420. }
  4421. else
  4422. {
  4423. // all data for this service was retrieved!
  4424. cEntriesRead++;
  4425. }
  4426. }
  4427. }
  4428. }
  4429. }
  4430. }
  4431. RegCloseKey( hKeyService );
  4432. }
  4433. if ( ERROR_OUTOFMEMORY != lError )
  4434. {
  4435. // continue enumeration...
  4436. lError = ERROR_SUCCESS;
  4437. }
  4438. }
  4439. }
  4440. }
  4441. RegCloseKey( hKeyLicenseInfo );
  4442. }
  4443. RegCloseKey( hKeyLocalMachine );
  4444. }
  4445. switch ( lError )
  4446. {
  4447. case ERROR_SUCCESS:
  4448. case ERROR_NO_MORE_ITEMS:
  4449. Status = STATUS_SUCCESS;
  4450. break;
  4451. case ERROR_ACCESS_DENIED:
  4452. Status = STATUS_ACCESS_DENIED;
  4453. break;
  4454. case ERROR_OUTOFMEMORY:
  4455. Status = STATUS_NO_MEMORY;
  4456. break;
  4457. case ERROR_FILE_NOT_FOUND:
  4458. case ERROR_PATH_NOT_FOUND:
  4459. Status = STATUS_NOT_FOUND;
  4460. break;
  4461. default:
  4462. Status = STATUS_UNSUCCESSFUL;
  4463. break;
  4464. }
  4465. if ( STATUS_SUCCESS != Status )
  4466. {
  4467. // free all of our allocations
  4468. DWORD i;
  4469. for ( i=0; i < cEntriesRead; i++ )
  4470. {
  4471. MIDL_user_free( pLocalServices[ i ].KeyName );
  4472. MIDL_user_free( pLocalServices[ i ].DisplayName );
  4473. MIDL_user_free( pLocalServices[ i ].FamilyDisplayName );
  4474. }
  4475. MIDL_user_free( pLocalServices );
  4476. }
  4477. else
  4478. {
  4479. // success! return the array of services.
  4480. *bufptr = (LPBYTE) pLocalServices;
  4481. *EntriesRead = cEntriesRead;
  4482. *TotalEntries = cEntriesRead;
  4483. *ResumeHandle = 0;
  4484. }
  4485. }
  4486. return Status;
  4487. }
  4488. NTSTATUS
  4489. NTAPI
  4490. LlsLocalServiceEnumA(
  4491. LLS_HANDLE Handle,
  4492. DWORD Level,
  4493. LPBYTE* bufptr,
  4494. DWORD PrefMaxLen,
  4495. LPDWORD EntriesRead,
  4496. LPDWORD TotalEntries,
  4497. LPDWORD ResumeHandle )
  4498. {
  4499. NTSTATUS Status;
  4500. PLOCAL_HANDLE pLocalHandle;
  4501. #ifdef API_TRACE
  4502. dprintf(TEXT("LLSRPC.DLL: LlsLocalServiceEnumA\n"));
  4503. #endif
  4504. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4505. if (pLocalHandle == NULL)
  4506. {
  4507. Status = STATUS_INVALID_PARAMETER;
  4508. }
  4509. else if ( LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_LOCAL_SERVICE_API ) )
  4510. {
  4511. GENERIC_INFO_CONTAINER GenericInfoContainer;
  4512. GENERIC_ENUM_STRUCT InfoStruct;
  4513. GenericInfoContainer.Buffer = NULL;
  4514. GenericInfoContainer.EntriesRead = 0;
  4515. InfoStruct.Container = &GenericInfoContainer;
  4516. InfoStruct.Level = Level;
  4517. try {
  4518. Status = LlsrLocalServiceEnumA(
  4519. pLocalHandle->Handle,
  4520. (PLLS_LOCAL_SERVICE_ENUM_STRUCTA) &InfoStruct,
  4521. PrefMaxLen,
  4522. TotalEntries,
  4523. ResumeHandle
  4524. );
  4525. }
  4526. except (TRUE) {
  4527. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4528. #if DBG
  4529. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4530. #endif
  4531. }
  4532. if ((Status == STATUS_SUCCESS) || (Status == STATUS_MORE_ENTRIES)) {
  4533. *bufptr = (LPBYTE) GenericInfoContainer.Buffer;
  4534. *EntriesRead = GenericInfoContainer.EntriesRead;
  4535. }
  4536. }
  4537. else
  4538. {
  4539. Status = STATUS_NOT_SUPPORTED;
  4540. }
  4541. return Status;
  4542. }
  4543. #ifdef OBSOLETE
  4544. NTSTATUS
  4545. NTAPI
  4546. LlsLocalServiceAddW(
  4547. LLS_HANDLE Handle,
  4548. DWORD Level,
  4549. LPBYTE bufptr )
  4550. {
  4551. NTSTATUS Status;
  4552. PLOCAL_HANDLE pLocalHandle;
  4553. #ifdef API_TRACE
  4554. dprintf(TEXT("LLSRPC.DLL: LlsLocalServiceAddW\n"));
  4555. #endif
  4556. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4557. if (pLocalHandle == NULL)
  4558. {
  4559. Status = STATUS_INVALID_PARAMETER;
  4560. }
  4561. else if ( LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_LOCAL_SERVICE_API ) )
  4562. {
  4563. try
  4564. {
  4565. Status = LlsrLocalServiceAddW( pLocalHandle->Handle, Level, (PLLS_LOCAL_SERVICE_INFOW) bufptr );
  4566. }
  4567. except (TRUE)
  4568. {
  4569. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4570. #if DBG
  4571. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4572. #endif
  4573. }
  4574. }
  4575. else if ( 0 != Level )
  4576. {
  4577. Status = STATUS_INVALID_LEVEL;
  4578. }
  4579. else if ( ( NULL == ((PLLS_LOCAL_SERVICE_INFO_0W) bufptr)->KeyName )
  4580. || ( NULL == ((PLLS_LOCAL_SERVICE_INFO_0W) bufptr)->DisplayName )
  4581. || ( NULL == ((PLLS_LOCAL_SERVICE_INFO_0W) bufptr)->FamilyDisplayName ) )
  4582. {
  4583. Status = STATUS_INVALID_PARAMETER;
  4584. }
  4585. else
  4586. {
  4587. PLLS_LOCAL_SERVICE_INFO_0W LocalServiceInfo;
  4588. LONG lError;
  4589. HKEY hKeyLocalMachine;
  4590. LocalServiceInfo = (PLLS_LOCAL_SERVICE_INFO_0W) bufptr;
  4591. lError = RegConnectRegistry( pLocalHandle->szServerName, HKEY_LOCAL_MACHINE, &hKeyLocalMachine );
  4592. if ( ERROR_SUCCESS == lError )
  4593. {
  4594. HKEY hKeyLicenseInfo;
  4595. lError = RegOpenKeyEx( hKeyLocalMachine, TEXT( "System\\CurrentControlSet\\Services\\LicenseInfo" ), 0, KEY_WRITE, &hKeyLicenseInfo );
  4596. if ( ERROR_SUCCESS == lError )
  4597. {
  4598. HKEY hKeyService;
  4599. DWORD dwDisposition;
  4600. // create key
  4601. lError = RegCreateKeyEx( hKeyLicenseInfo, LocalServiceInfo->KeyName, 0, NULL, 0, KEY_WRITE, NULL, &hKeyService, &dwDisposition );
  4602. if ( ERROR_SUCCESS == lError )
  4603. {
  4604. // set DisplayName
  4605. lError = RegSetValueEx( hKeyService, TEXT( "DisplayName" ), 0, REG_SZ, (LPBYTE) LocalServiceInfo->DisplayName, sizeof( *LocalServiceInfo->DisplayName ) * ( 1 + lstrlen( LocalServiceInfo->DisplayName ) ) );
  4606. if ( ERROR_SUCCESS == lError )
  4607. {
  4608. // set FamilyDisplayName
  4609. lError = RegSetValueEx( hKeyService, TEXT( "FamilyDisplayName" ), 0, REG_SZ, (LPBYTE) LocalServiceInfo->FamilyDisplayName, sizeof( *LocalServiceInfo->FamilyDisplayName ) * ( 1 + lstrlen( LocalServiceInfo->FamilyDisplayName ) ) );
  4610. }
  4611. RegCloseKey( hKeyService );
  4612. }
  4613. RegCloseKey( hKeyLicenseInfo );
  4614. }
  4615. RegCloseKey( hKeyLocalMachine );
  4616. }
  4617. switch ( lError )
  4618. {
  4619. case ERROR_SUCCESS:
  4620. Status = STATUS_SUCCESS;
  4621. break;
  4622. case ERROR_FILE_NOT_FOUND:
  4623. case ERROR_PATH_NOT_FOUND:
  4624. Status = STATUS_OBJECT_NAME_NOT_FOUND;
  4625. break;
  4626. case ERROR_ACCESS_DENIED:
  4627. Status = STATUS_ACCESS_DENIED;
  4628. break;
  4629. default:
  4630. Status = STATUS_UNSUCCESSFUL;
  4631. break;
  4632. }
  4633. if ( STATUS_SUCCESS == Status )
  4634. {
  4635. // set remaining items
  4636. Status = LlsLocalServiceInfoSetW( Handle, LocalServiceInfo->KeyName, Level, bufptr );
  4637. }
  4638. }
  4639. return Status;
  4640. }
  4641. NTSTATUS
  4642. NTAPI
  4643. LlsLocalServiceAddA(
  4644. LLS_HANDLE Handle,
  4645. DWORD Level,
  4646. LPBYTE bufptr )
  4647. {
  4648. NTSTATUS Status;
  4649. PLOCAL_HANDLE pLocalHandle;
  4650. #ifdef API_TRACE
  4651. dprintf(TEXT("LLSRPC.DLL: LlsLocalServiceAddA\n"));
  4652. #endif
  4653. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4654. if (pLocalHandle == NULL)
  4655. {
  4656. Status = STATUS_INVALID_PARAMETER;
  4657. }
  4658. else if ( LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_LOCAL_SERVICE_API ) )
  4659. {
  4660. try {
  4661. Status = LlsrLocalServiceAddA( pLocalHandle->Handle, Level, (PLLS_LOCAL_SERVICE_INFOA) bufptr );
  4662. }
  4663. except (TRUE) {
  4664. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4665. #if DBG
  4666. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4667. #endif
  4668. }
  4669. }
  4670. else
  4671. {
  4672. Status = STATUS_NOT_SUPPORTED;
  4673. }
  4674. return Status;
  4675. }
  4676. #endif // OBSOLETE
  4677. NTSTATUS
  4678. NTAPI
  4679. LlsLocalServiceInfoSetW(
  4680. LLS_HANDLE Handle,
  4681. LPWSTR KeyName,
  4682. DWORD Level,
  4683. LPBYTE bufptr )
  4684. {
  4685. NTSTATUS Status;
  4686. PLOCAL_HANDLE pLocalHandle;
  4687. #ifdef API_TRACE
  4688. dprintf(TEXT("LLSRPC.DLL: LlsLocalServiceInfoSetW\n"));
  4689. #endif
  4690. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4691. if (pLocalHandle == NULL)
  4692. {
  4693. Status = STATUS_INVALID_PARAMETER;
  4694. }
  4695. else if ( LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_LOCAL_SERVICE_API ) )
  4696. {
  4697. try
  4698. {
  4699. Status = LlsrLocalServiceInfoSetW( pLocalHandle->Handle, KeyName, Level, (PLLS_LOCAL_SERVICE_INFOW) bufptr );
  4700. }
  4701. except (TRUE)
  4702. {
  4703. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4704. #if DBG
  4705. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4706. #endif
  4707. }
  4708. }
  4709. else if ( 0 != Level )
  4710. {
  4711. Status = STATUS_INVALID_LEVEL;
  4712. }
  4713. else if ( NULL == KeyName )
  4714. {
  4715. Status = STATUS_INVALID_PARAMETER;
  4716. }
  4717. else
  4718. {
  4719. LONG lError;
  4720. HKEY hKeyLocalMachine;
  4721. lError = RegConnectRegistry( pLocalHandle->szServerName, HKEY_LOCAL_MACHINE, &hKeyLocalMachine );
  4722. if ( ERROR_SUCCESS == lError )
  4723. {
  4724. HKEY hKeyLicenseInfo;
  4725. lError = RegOpenKeyEx( hKeyLocalMachine, REG_KEY_LICENSE, 0, KEY_WRITE, &hKeyLicenseInfo );
  4726. if ( ERROR_SUCCESS == lError )
  4727. {
  4728. HKEY hKeyService;
  4729. PLLS_LOCAL_SERVICE_INFO_0W LocalServiceInfo;
  4730. LocalServiceInfo = (PLLS_LOCAL_SERVICE_INFO_0W) bufptr;
  4731. lError = RegOpenKeyEx( hKeyLicenseInfo, KeyName, 0, KEY_WRITE, &hKeyService );
  4732. if ( ERROR_SUCCESS == lError )
  4733. {
  4734. // set Mode
  4735. lError = RegSetValueEx( hKeyService, REG_VALUE_MODE, 0, REG_DWORD, (LPBYTE) &LocalServiceInfo->Mode, sizeof( LocalServiceInfo->Mode ) );
  4736. if ( ERROR_SUCCESS == lError )
  4737. {
  4738. // set FlipAllow
  4739. lError = RegSetValueEx( hKeyService, REG_VALUE_FLIP, 0, REG_DWORD, (LPBYTE) &LocalServiceInfo->FlipAllow, sizeof( LocalServiceInfo->FlipAllow ) );
  4740. if ( ERROR_SUCCESS == lError )
  4741. {
  4742. // set ConcurrentLimit
  4743. lError = RegSetValueEx( hKeyService, REG_VALUE_LIMIT, 0, REG_DWORD, (LPBYTE) &LocalServiceInfo->ConcurrentLimit, sizeof( LocalServiceInfo->ConcurrentLimit ) );
  4744. }
  4745. }
  4746. RegCloseKey( hKeyService );
  4747. }
  4748. RegCloseKey( hKeyLicenseInfo );
  4749. }
  4750. RegCloseKey( hKeyLocalMachine );
  4751. }
  4752. switch ( lError )
  4753. {
  4754. case ERROR_SUCCESS:
  4755. Status = STATUS_SUCCESS;
  4756. break;
  4757. case ERROR_FILE_NOT_FOUND:
  4758. case ERROR_PATH_NOT_FOUND:
  4759. Status = STATUS_OBJECT_NAME_NOT_FOUND;
  4760. break;
  4761. case ERROR_ACCESS_DENIED:
  4762. Status = STATUS_ACCESS_DENIED;
  4763. break;
  4764. default:
  4765. Status = STATUS_UNSUCCESSFUL;
  4766. break;
  4767. }
  4768. }
  4769. return Status;
  4770. }
  4771. NTSTATUS
  4772. NTAPI
  4773. LlsLocalServiceInfoSetA(
  4774. LLS_HANDLE Handle,
  4775. LPSTR KeyName,
  4776. DWORD Level,
  4777. LPBYTE bufptr )
  4778. {
  4779. NTSTATUS Status;
  4780. PLOCAL_HANDLE pLocalHandle;
  4781. #ifdef API_TRACE
  4782. dprintf(TEXT("LLSRPC.DLL: LlsLocalServiceInfoSetA\n"));
  4783. #endif
  4784. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4785. if (pLocalHandle == NULL)
  4786. {
  4787. Status = STATUS_INVALID_PARAMETER;
  4788. }
  4789. else if ( LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_LOCAL_SERVICE_API ) )
  4790. {
  4791. try {
  4792. Status = LlsrLocalServiceInfoSetA( pLocalHandle->Handle, KeyName, Level, (PLLS_LOCAL_SERVICE_INFOA) bufptr );
  4793. }
  4794. except (TRUE) {
  4795. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4796. #if DBG
  4797. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4798. #endif
  4799. }
  4800. }
  4801. else
  4802. {
  4803. Status = STATUS_NOT_SUPPORTED;
  4804. }
  4805. return Status;
  4806. }
  4807. NTSTATUS
  4808. NTAPI
  4809. LlsLocalServiceInfoGetW(
  4810. LLS_HANDLE Handle,
  4811. LPWSTR KeyName,
  4812. DWORD Level,
  4813. LPBYTE * pbufptr )
  4814. {
  4815. NTSTATUS Status;
  4816. PLOCAL_HANDLE pLocalHandle;
  4817. #ifdef API_TRACE
  4818. dprintf(TEXT("LLSRPC.DLL: LlsLocalServiceInfoGetW\n"));
  4819. #endif
  4820. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4821. if (pLocalHandle == NULL)
  4822. {
  4823. Status = STATUS_INVALID_PARAMETER;
  4824. }
  4825. else if ( LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_LOCAL_SERVICE_API ) )
  4826. {
  4827. try
  4828. {
  4829. Status = LlsrLocalServiceInfoGetW( pLocalHandle->Handle, KeyName, Level, (PLLS_LOCAL_SERVICE_INFOW *) pbufptr );
  4830. }
  4831. except (TRUE)
  4832. {
  4833. Status = I_RpcMapWin32Status(RpcExceptionCode());
  4834. #if DBG
  4835. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  4836. #endif
  4837. }
  4838. }
  4839. else if ( 0 != Level )
  4840. {
  4841. Status = STATUS_INVALID_LEVEL;
  4842. }
  4843. else if ( NULL == KeyName )
  4844. {
  4845. Status = STATUS_INVALID_PARAMETER;
  4846. }
  4847. else
  4848. {
  4849. PLLS_LOCAL_SERVICE_INFO_0W pLocalService = NULL;
  4850. LONG lError;
  4851. HKEY hKeyLocalMachine;
  4852. lError = RegConnectRegistry( pLocalHandle->szServerName, HKEY_LOCAL_MACHINE, &hKeyLocalMachine );
  4853. if ( ERROR_SUCCESS == lError )
  4854. {
  4855. HKEY hKeyLicenseInfo;
  4856. lError = RegOpenKeyEx( hKeyLocalMachine, REG_KEY_LICENSE, 0, KEY_READ, &hKeyLicenseInfo );
  4857. if ( ERROR_SUCCESS == lError )
  4858. {
  4859. HKEY hKeyService;
  4860. lError = RegOpenKeyEx( hKeyLicenseInfo, KeyName, 0, KEY_READ, &hKeyService );
  4861. if ( ERROR_SUCCESS == lError )
  4862. {
  4863. pLocalService = MIDL_user_allocate( sizeof( *pLocalService ) );
  4864. if ( NULL == pLocalService )
  4865. {
  4866. lError = ERROR_OUTOFMEMORY;
  4867. }
  4868. else
  4869. {
  4870. DWORD cbData;
  4871. cbData = sizeof( pLocalService->Mode );
  4872. lError = RegQueryValueEx( hKeyService, REG_VALUE_MODE, NULL, NULL, (LPBYTE) &pLocalService->Mode, &cbData );
  4873. if ( ERROR_SUCCESS == lError )
  4874. {
  4875. cbData = sizeof( pLocalService->FlipAllow );
  4876. lError = RegQueryValueEx( hKeyService, REG_VALUE_FLIP, NULL, NULL, (LPBYTE) &pLocalService->FlipAllow, &cbData );
  4877. if ( ERROR_SUCCESS == lError )
  4878. {
  4879. cbData = sizeof( pLocalService->ConcurrentLimit );
  4880. lError = RegQueryValueEx( hKeyService, REG_VALUE_LIMIT, NULL, NULL, (LPBYTE) &pLocalService->ConcurrentLimit, &cbData );
  4881. if ( ERROR_SUCCESS == lError )
  4882. {
  4883. DWORD cbKeyName;
  4884. DWORD cbDisplayName;
  4885. DWORD cbFamilyDisplayName;
  4886. cbData = sizeof( pLocalService->HighMark );
  4887. lError = RegQueryValueEx( hKeyService, REG_VALUE_HIGHMARK, NULL, NULL, (LPBYTE) &pLocalService->HighMark, &cbData );
  4888. if ( ERROR_SUCCESS != lError )
  4889. {
  4890. pLocalService->HighMark = 0;
  4891. lError = ERROR_SUCCESS;
  4892. }
  4893. if ( ( ERROR_SUCCESS == RegQueryValueEx( hKeyService, REG_VALUE_NAME, NULL, NULL, NULL, &cbDisplayName ) )
  4894. && ( ERROR_SUCCESS == RegQueryValueEx( hKeyService, REG_VALUE_FAMILY, NULL, NULL, NULL, &cbFamilyDisplayName ) ) )
  4895. {
  4896. cbKeyName = sizeof( *KeyName ) * ( 1 + lstrlen( KeyName ) );
  4897. pLocalService->KeyName = MIDL_user_allocate( cbKeyName );
  4898. if ( NULL == pLocalService->KeyName )
  4899. {
  4900. lError = ERROR_OUTOFMEMORY;
  4901. }
  4902. else
  4903. {
  4904. lstrcpy( pLocalService->KeyName, KeyName );
  4905. pLocalService->DisplayName = MIDL_user_allocate( cbDisplayName );
  4906. if ( NULL == pLocalService->DisplayName )
  4907. {
  4908. lError = ERROR_OUTOFMEMORY;
  4909. }
  4910. else
  4911. {
  4912. lError = RegQueryValueEx( hKeyService, REG_VALUE_NAME, NULL, NULL, (LPBYTE) pLocalService->DisplayName, &cbDisplayName );
  4913. if ( ERROR_SUCCESS == lError )
  4914. {
  4915. pLocalService->FamilyDisplayName = MIDL_user_allocate( cbFamilyDisplayName );
  4916. if ( NULL == pLocalService->FamilyDisplayName )
  4917. {
  4918. lError = ERROR_OUTOFMEMORY;
  4919. }
  4920. else
  4921. {
  4922. lError = RegQueryValueEx( hKeyService, REG_VALUE_FAMILY, NULL, NULL, (LPBYTE) pLocalService->FamilyDisplayName, &cbFamilyDisplayName );
  4923. if ( ERROR_SUCCESS != lError )
  4924. {
  4925. MIDL_user_free( pLocalService->FamilyDisplayName );
  4926. }
  4927. }
  4928. }
  4929. if ( ERROR_SUCCESS != lError )
  4930. {
  4931. MIDL_user_free( pLocalService->DisplayName );
  4932. }
  4933. }
  4934. if ( ERROR_SUCCESS != lError )
  4935. {
  4936. MIDL_user_free( pLocalService->KeyName );
  4937. }
  4938. }
  4939. }
  4940. }
  4941. }
  4942. }
  4943. if ( ERROR_SUCCESS != lError )
  4944. {
  4945. MIDL_user_free( pLocalService );
  4946. }
  4947. }
  4948. RegCloseKey( hKeyService );
  4949. }
  4950. RegCloseKey( hKeyLicenseInfo );
  4951. }
  4952. RegCloseKey( hKeyLocalMachine );
  4953. }
  4954. switch ( lError )
  4955. {
  4956. case ERROR_SUCCESS:
  4957. Status = STATUS_SUCCESS;
  4958. break;
  4959. case ERROR_FILE_NOT_FOUND:
  4960. case ERROR_PATH_NOT_FOUND:
  4961. Status = STATUS_OBJECT_NAME_NOT_FOUND;
  4962. break;
  4963. case ERROR_ACCESS_DENIED:
  4964. Status = STATUS_ACCESS_DENIED;
  4965. break;
  4966. default:
  4967. Status = STATUS_UNSUCCESSFUL;
  4968. break;
  4969. }
  4970. if ( STATUS_SUCCESS == Status )
  4971. {
  4972. *pbufptr = (LPBYTE) pLocalService;
  4973. }
  4974. }
  4975. return Status;
  4976. }
  4977. NTSTATUS
  4978. NTAPI
  4979. LlsLocalServiceInfoGetA(
  4980. LLS_HANDLE Handle,
  4981. DWORD Level,
  4982. LPSTR KeyName,
  4983. LPBYTE * pbufptr )
  4984. {
  4985. NTSTATUS Status;
  4986. PLOCAL_HANDLE pLocalHandle;
  4987. #ifdef API_TRACE
  4988. dprintf(TEXT("LLSRPC.DLL: LlsLocalServiceInfoGetA\n"));
  4989. #endif
  4990. pLocalHandle = (PLOCAL_HANDLE) Handle;
  4991. if (pLocalHandle == NULL)
  4992. {
  4993. Status = STATUS_INVALID_PARAMETER;
  4994. }
  4995. else if ( LlsCapabilityIsSupported( Handle, LLS_CAPABILITY_LOCAL_SERVICE_API ) )
  4996. {
  4997. try {
  4998. Status = LlsrLocalServiceInfoGetA( pLocalHandle->Handle, KeyName, Level, (PLLS_LOCAL_SERVICE_INFOA *) pbufptr );
  4999. }
  5000. except (TRUE) {
  5001. Status = I_RpcMapWin32Status(RpcExceptionCode());
  5002. #if DBG
  5003. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  5004. #endif
  5005. }
  5006. }
  5007. else
  5008. {
  5009. Status = STATUS_NOT_SUPPORTED;
  5010. }
  5011. return Status;
  5012. }
  5013. NTSTATUS
  5014. NTAPI
  5015. LlsLicenseRequest2W(
  5016. LLS_HANDLE Handle,
  5017. LPWSTR Product,
  5018. ULONG VersionIndex,
  5019. BOOLEAN IsAdmin,
  5020. ULONG DataType,
  5021. ULONG DataSize,
  5022. PBYTE Data,
  5023. PHANDLE pLicenseHandle )
  5024. {
  5025. NTSTATUS Status;
  5026. PLOCAL_HANDLE pLocalHandle;
  5027. LICENSE_HANDLE RpcLicenseHandle;
  5028. #ifdef API_TRACE
  5029. dprintf(TEXT("LLSRPC.DLL: LlsLicenseRequestW\n"));
  5030. #endif
  5031. pLocalHandle = (PLOCAL_HANDLE) Handle;
  5032. if ((pLocalHandle == NULL) || (pLicenseHandle == NULL))
  5033. {
  5034. Status = STATUS_INVALID_PARAMETER;
  5035. }
  5036. else
  5037. {
  5038. try {
  5039. RtlEnterCriticalSection( &g_RpcHandleLock );
  5040. lsapirpc_handle = pLocalHandle->llsrpc_handle;
  5041. Status = LlsrLicenseRequestW( &RpcLicenseHandle,
  5042. Product,
  5043. VersionIndex,
  5044. IsAdmin,
  5045. DataType,
  5046. DataSize,
  5047. Data );
  5048. RtlLeaveCriticalSection( &g_RpcHandleLock );
  5049. }
  5050. except (TRUE) {
  5051. Status = I_RpcMapWin32Status(RpcExceptionCode());
  5052. #if DBG
  5053. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  5054. #endif
  5055. }
  5056. *pLicenseHandle = RpcLicenseHandle;
  5057. }
  5058. return Status;
  5059. }
  5060. NTSTATUS
  5061. NTAPI
  5062. LlsLicenseRequestW(
  5063. LLS_HANDLE Handle,
  5064. LPWSTR Product,
  5065. ULONG VersionIndex,
  5066. BOOLEAN IsAdmin,
  5067. ULONG DataType,
  5068. ULONG DataSize,
  5069. PBYTE Data,
  5070. LPDWORD pLicenseHandle )
  5071. {
  5072. HANDLE RealLicenseHandle = (HANDLE)(-1);
  5073. NTSTATUS status;
  5074. if (sizeof(ULONG) == sizeof(HANDLE))
  5075. {
  5076. // Should still work on Win32
  5077. status = LlsLicenseRequest2W(Handle,Product,VersionIndex,IsAdmin,DataType,DataSize,Data,&RealLicenseHandle);
  5078. if (NULL != pLicenseHandle)
  5079. *pLicenseHandle = PtrToUlong(RealLicenseHandle);
  5080. }
  5081. else
  5082. {
  5083. status = STATUS_NOT_IMPLEMENTED;
  5084. if (NULL != pLicenseHandle)
  5085. *pLicenseHandle = (ULONG) 0xFFFFFFFF;
  5086. }
  5087. return status;
  5088. }
  5089. NTSTATUS
  5090. NTAPI
  5091. LlsLicenseRequest2A(
  5092. LLS_HANDLE Handle,
  5093. LPSTR Product,
  5094. ULONG VersionIndex,
  5095. BOOLEAN IsAdmin,
  5096. ULONG DataType,
  5097. ULONG DataSize,
  5098. PBYTE Data,
  5099. PHANDLE pLicenseHandle )
  5100. {
  5101. return STATUS_NOT_SUPPORTED;
  5102. }
  5103. NTSTATUS
  5104. NTAPI
  5105. LlsLicenseRequestA(
  5106. LLS_HANDLE Handle,
  5107. LPSTR Product,
  5108. ULONG VersionIndex,
  5109. BOOLEAN IsAdmin,
  5110. ULONG DataType,
  5111. ULONG DataSize,
  5112. PBYTE Data,
  5113. LPDWORD pLicenseHandle )
  5114. {
  5115. return STATUS_NOT_SUPPORTED;
  5116. }
  5117. NTSTATUS
  5118. NTAPI
  5119. LlsLicenseFree2(
  5120. LLS_HANDLE Handle,
  5121. HANDLE LicenseHandle )
  5122. {
  5123. NTSTATUS Status;
  5124. PLOCAL_HANDLE pLocalHandle;
  5125. LICENSE_HANDLE RpcLicenseHandle = (LICENSE_HANDLE) LicenseHandle;
  5126. #ifdef API_TRACE
  5127. dprintf(TEXT("LLSRPC.DLL: LlsLicenseFree\n"));
  5128. #endif
  5129. pLocalHandle = (PLOCAL_HANDLE) Handle;
  5130. if (pLocalHandle == NULL)
  5131. {
  5132. Status = STATUS_INVALID_PARAMETER;
  5133. }
  5134. else
  5135. {
  5136. try {
  5137. RtlEnterCriticalSection( &g_RpcHandleLock );
  5138. lsapirpc_handle = pLocalHandle->llsrpc_handle;
  5139. Status = LlsrLicenseFree( &RpcLicenseHandle );
  5140. RtlLeaveCriticalSection( &g_RpcHandleLock );
  5141. }
  5142. except (TRUE) {
  5143. Status = I_RpcMapWin32Status(RpcExceptionCode());
  5144. #if DBG
  5145. dprintf(TEXT("ERROR LLSRPC.DLL: RPC Exception: 0x%lX\n"), Status);
  5146. #endif
  5147. }
  5148. }
  5149. return Status;
  5150. }
  5151. NTSTATUS
  5152. NTAPI
  5153. LlsLicenseFree(
  5154. LLS_HANDLE Handle,
  5155. DWORD LicenseHandle )
  5156. {
  5157. if (sizeof(ULONG) == sizeof(HANDLE))
  5158. {
  5159. // Should still work on Win32
  5160. return LlsLicenseFree2(Handle,ULongToPtr(LicenseHandle));
  5161. }
  5162. else
  5163. {
  5164. return STATUS_NOT_IMPLEMENTED;
  5165. }
  5166. }