Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1397 lines
32 KiB

  1. ///////////////////////////////////////////////////////////////////////////
  2. //Module: Static/StaticShowUtils.cpp
  3. //
  4. // Purpose: Static Show auxillary functions Implementation.
  5. //
  6. // Developers Name: Surya
  7. //
  8. // History:
  9. //
  10. // Date Author Comments
  11. // 10-8-2001 Surya Initial Version. SCM Base line 1.0
  12. //
  13. ///////////////////////////////////////////////////////////////////////////
  14. #include "nshipsec.h"
  15. extern HINSTANCE g_hModule;
  16. extern STORAGELOCATION g_StorageLocation;
  17. // magic strings
  18. #define IPSEC_SERVICE_NAME _TEXT("policyagent")
  19. #define GPEXT_KEY _TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\GPExtensions")
  20. _TCHAR pcszGPTIPSecKey[] = _TEXT("SOFTWARE\\Policies\\Microsoft\\Windows\\IPSEC\\GPTIPSECPolicy");
  21. _TCHAR pcszGPTIPSecName[] = _TEXT("DSIPSECPolicyName");
  22. _TCHAR pcszGPTIPSecFlags[] = _TEXT("DSIPSECPolicyFlags");
  23. _TCHAR pcszGPTIPSecPath[] = _TEXT("DSIPSECPolicyPath");
  24. _TCHAR pcszLocIPSecKey[] = _TEXT("SOFTWARE\\Policies\\Microsoft\\Windows\\IPSEC\\Policy\\Local");
  25. _TCHAR pcszLocIPSecPol[] = _TEXT("ActivePolicy");
  26. _TCHAR pcszCacheIPSecKey[] = _TEXT("SOFTWARE\\Policies\\Microsoft\\Windows\\IPSEC\\Policy\\Cache");
  27. _TCHAR pcszIPSecPolicy[] = _TEXT("ipsecPolicy");
  28. _TCHAR pcszIPSecName[] = _TEXT("ipsecName");
  29. _TCHAR pcszIPSecDesc[] = _TEXT("description");
  30. _TCHAR pcszIPSecTimestamp[] = _TEXT("whenChanged");
  31. _TCHAR pcszIpsecClsid[] = _TEXT("{e437bc1c-aa7d-11d2-a382-00c04f991e27}"); //mmc snapin UUID
  32. ///////////////////////////////////////////////////////////////////////////
  33. //
  34. //Function: GetPolicyInfo()
  35. //
  36. //Date of Creation: 21st Aug 2001
  37. //
  38. //Parameters:
  39. // IN LPTSTR pszMachineName,
  40. // OUT POLICY_INFO &m_PolicyInfo
  41. //
  42. //
  43. //Return: DWORD
  44. //
  45. //Description:
  46. // This function gets the policy specified from the machine specified.
  47. //
  48. //Revision History:
  49. //
  50. // Date Author Comments
  51. //
  52. ///////////////////////////////////////////////////////////////////////////
  53. DWORD
  54. GetPolicyInfo (
  55. IN LPTSTR pszMachineName,
  56. OUT POLICY_INFO &m_PolicyInfo
  57. )
  58. {
  59. HKEY hRegKey=NULL, hRegHKey=NULL;
  60. DWORD dwType = 0; // for RegQueryValueEx
  61. DWORD dwBufLen = 0; // for RegQueryValueEx
  62. _TCHAR pszBuf[STRING_TEXT_SIZE] = {0};
  63. DWORD dwError = 0;
  64. DWORD dwValue = 0;
  65. DWORD dwLength = sizeof(DWORD);
  66. //Initialize the m_PolicyInfo as PS_NO_POLICY assigned
  67. m_PolicyInfo.iPolicySource = PS_NO_POLICY;
  68. m_PolicyInfo.pszPolicyPath[0] = 0;
  69. m_PolicyInfo.pszPolicyName[0] = 0;
  70. m_PolicyInfo.pszPolicyDesc[0] = 0;
  71. dwError = RegConnectRegistry( pszMachineName,
  72. HKEY_LOCAL_MACHINE,
  73. &hRegHKey);
  74. if(dwError != ERROR_SUCCESS)
  75. {
  76. BAIL_OUT;
  77. }
  78. dwError = RegOpenKeyEx( hRegHKey,
  79. pcszGPTIPSecKey,
  80. 0,
  81. KEY_READ,
  82. &hRegKey);
  83. if(ERROR_SUCCESS == dwError)
  84. {
  85. // query for flags, if flags aint' there or equal to 0, we don't have domain policy
  86. dwError = RegQueryValueEx(hRegKey,
  87. pcszGPTIPSecFlags,
  88. NULL,
  89. &dwType,
  90. (LPBYTE)&dwValue,
  91. &dwLength);
  92. if(dwError != ERROR_SUCCESS)
  93. {
  94. if (dwValue == 0)
  95. {
  96. dwError = ERROR_FILE_NOT_FOUND;
  97. }
  98. }
  99. // now get name
  100. if (dwError == ERROR_SUCCESS)
  101. {
  102. dwBufLen = MAXSTRLEN*sizeof(_TCHAR);
  103. dwError = RegQueryValueEx( hRegKey,
  104. pcszGPTIPSecName,
  105. NULL,
  106. &dwType, // will be REG_SZ
  107. (LPBYTE) pszBuf,
  108. &dwBufLen);
  109. }
  110. }
  111. if (dwError == ERROR_SUCCESS)
  112. {
  113. m_PolicyInfo.iPolicySource = PS_DS_POLICY;
  114. m_PolicyInfo.pszPolicyPath[0] = 0;
  115. _tcsncpy(m_PolicyInfo.pszPolicyName, pszBuf,MAXSTRINGLEN-1);
  116. dwBufLen = MAXSTRLEN*sizeof(_TCHAR);
  117. dwError = RegQueryValueEx( hRegKey,
  118. pcszGPTIPSecPath,
  119. NULL,
  120. &dwType, // will be REG_SZ
  121. (LPBYTE) pszBuf,
  122. &dwBufLen);
  123. if (dwError == ERROR_SUCCESS)
  124. {
  125. _tcsncpy(m_PolicyInfo.pszPolicyPath, pszBuf,MAXSTRLEN-1);
  126. }
  127. dwError = ERROR_SUCCESS;
  128. BAIL_OUT;
  129. }
  130. else
  131. {
  132. if(hRegKey)
  133. RegCloseKey(hRegKey);
  134. hRegKey = NULL;
  135. if (dwError == ERROR_FILE_NOT_FOUND)
  136. {
  137. // DS reg key not found, check local
  138. dwError = RegOpenKeyEx( hRegHKey,
  139. pcszLocIPSecKey,
  140. 0,
  141. KEY_READ,
  142. &hRegKey);
  143. if(dwError != ERROR_SUCCESS)
  144. {
  145. BAIL_OUT;
  146. }
  147. dwBufLen = MAXSTRLEN*sizeof(_TCHAR);
  148. dwError = RegQueryValueEx( hRegKey,
  149. pcszLocIPSecPol,
  150. NULL,
  151. &dwType, // will be REG_SZ
  152. (LPBYTE) pszBuf,
  153. &dwBufLen);
  154. if (dwError == ERROR_SUCCESS)
  155. {
  156. // read it
  157. if(hRegKey)
  158. RegCloseKey(hRegKey);
  159. hRegKey = NULL;
  160. dwError = RegOpenKeyEx( hRegHKey,
  161. pszBuf,
  162. 0,
  163. KEY_READ,
  164. &hRegKey);
  165. _tcsncpy(m_PolicyInfo.pszPolicyPath, pszBuf,MAXSTRLEN-1);
  166. if (dwError == ERROR_SUCCESS)
  167. {
  168. dwBufLen = MAXSTRLEN*sizeof(_TCHAR);
  169. dwError = RegQueryValueEx( hRegKey,
  170. pcszIPSecName,
  171. NULL,
  172. &dwType, // will be REG_SZ
  173. (LPBYTE) pszBuf,
  174. &dwBufLen);
  175. }
  176. if (dwError == ERROR_SUCCESS)
  177. { // found it
  178. m_PolicyInfo.iPolicySource = PS_LOC_POLICY;
  179. _tcsncpy(m_PolicyInfo.pszPolicyName, pszBuf,MAXSTRINGLEN-1);
  180. }
  181. dwError = ERROR_SUCCESS;
  182. }
  183. }
  184. }
  185. error:
  186. if (hRegKey)
  187. {
  188. RegCloseKey(hRegKey);
  189. }
  190. if (hRegHKey)
  191. {
  192. RegCloseKey(hRegHKey);
  193. }
  194. return dwError;
  195. }
  196. ///////////////////////////////////////////////////////////////////////////
  197. //
  198. //Function: GetMorePolicyInfo()
  199. //
  200. //Date of Creation: 21st Aug 2001
  201. //
  202. //Parameters:
  203. // IN LPTSTR pszMachineName,
  204. // OUT POLICY_INFO &m_PolicyInfo
  205. //
  206. //
  207. //Return: DWORD
  208. //
  209. //Description:
  210. // This function gets the policy specified from the machine specified.
  211. //
  212. //Revision History:
  213. //
  214. // Date Author Comments
  215. //
  216. ///////////////////////////////////////////////////////////////////////////
  217. DWORD
  218. GetMorePolicyInfo (
  219. IN LPTSTR pszMachineName,
  220. OUT POLICY_INFO &m_PolicyInfo
  221. )
  222. {
  223. DWORD dwError = ERROR_SUCCESS , dwStrLen = 0;
  224. HKEY hRegKey = NULL, hRegHKey = NULL;
  225. DWORD dwType; // for RegQueryValueEx
  226. DWORD dwBufLen = 0; // for RegQueryValueEx
  227. DWORD dwValue = 0;
  228. DWORD dwLength = sizeof(DWORD);
  229. _TCHAR pszBuf[STRING_TEXT_SIZE] = {0};
  230. PTCHAR* ppszExplodeDN = NULL;
  231. // set some default values
  232. m_PolicyInfo.pszPolicyDesc[0] = 0;
  233. m_PolicyInfo.timestamp = 0;
  234. dwError = RegConnectRegistry( pszMachineName,
  235. HKEY_LOCAL_MACHINE,
  236. &hRegHKey);
  237. if(dwError != ERROR_SUCCESS)
  238. {
  239. BAIL_OUT;
  240. }
  241. switch (m_PolicyInfo.iPolicySource)
  242. {
  243. case PS_LOC_POLICY:
  244. // open the key
  245. dwError = RegOpenKeyEx( hRegHKey,
  246. m_PolicyInfo.pszPolicyPath,
  247. 0,
  248. KEY_READ,
  249. &hRegKey);
  250. if(dwError != ERROR_SUCCESS)
  251. {
  252. BAIL_OUT;
  253. }
  254. // timestamp
  255. dwError = RegQueryValueEx(hRegKey,
  256. pcszIPSecTimestamp,
  257. NULL,
  258. &dwType,
  259. (LPBYTE)&dwValue,
  260. &dwLength);
  261. if(dwError != ERROR_SUCCESS)
  262. {
  263. BAIL_OUT;
  264. }
  265. m_PolicyInfo.timestamp = dwValue;
  266. // description
  267. dwBufLen = MAXSTRLEN*sizeof(_TCHAR);
  268. dwError = RegQueryValueEx( hRegKey,
  269. pcszIPSecDesc,
  270. NULL,
  271. &dwType, // will be REG_SZ
  272. (LPBYTE) pszBuf,
  273. &dwBufLen);
  274. if(dwError != ERROR_SUCCESS)
  275. {
  276. BAIL_OUT;
  277. }
  278. _tcsncpy(m_PolicyInfo.pszPolicyDesc, pszBuf,MAXSTRINGLEN-1);
  279. break;
  280. case PS_DS_POLICY:
  281. // get the policy name from DN
  282. _tcsncpy(pszBuf, pcszCacheIPSecKey,STRING_TEXT_SIZE-1);
  283. ppszExplodeDN = ldap_explode_dn(m_PolicyInfo.pszPolicyPath, 1);
  284. if (!ppszExplodeDN)
  285. {
  286. BAIL_OUT;
  287. }
  288. dwStrLen = _tcslen(pszBuf);
  289. _tcsncat(pszBuf, _TEXT("\\"),STRING_TEXT_SIZE-dwStrLen-1);
  290. dwStrLen = _tcslen(pszBuf);
  291. _tcsncat(pszBuf, ppszExplodeDN[0],STRING_TEXT_SIZE-dwStrLen-1);
  292. // open the regkey
  293. dwError = RegOpenKeyEx( hRegHKey,
  294. pszBuf,
  295. 0,
  296. KEY_READ,
  297. &hRegKey);
  298. if(dwError != ERROR_SUCCESS)
  299. {
  300. BAIL_OUT;
  301. }
  302. // get the more correct name info
  303. dwBufLen = sizeof(pszBuf);
  304. dwError = RegQueryValueEx( hRegKey,
  305. pcszIPSecName,
  306. NULL,
  307. &dwType, // will be REG_SZ
  308. (LPBYTE) pszBuf,
  309. &dwBufLen);
  310. if (dwError == ERROR_SUCCESS)
  311. {
  312. _tcscpy(m_PolicyInfo.pszPolicyName, pszBuf);
  313. }
  314. m_PolicyInfo.timestamp = 0;
  315. // description
  316. dwBufLen = MAXSTRLEN*sizeof(_TCHAR);
  317. dwError = RegQueryValueEx( hRegKey,
  318. pcszIPSecDesc,
  319. NULL,
  320. &dwType, // will be REG_SZ
  321. (LPBYTE) pszBuf,
  322. &dwBufLen);
  323. if(dwError != ERROR_SUCCESS)
  324. {
  325. BAIL_OUT;
  326. }
  327. _tcsncpy(m_PolicyInfo.pszPolicyDesc, pszBuf,MAXSTRINGLEN-1);
  328. break;
  329. }
  330. error:
  331. if (hRegKey)
  332. {
  333. RegCloseKey(hRegKey);
  334. }
  335. if (hRegHKey)
  336. {
  337. RegCloseKey(hRegHKey);
  338. }
  339. if (ppszExplodeDN)
  340. {
  341. ldap_value_free(ppszExplodeDN);
  342. }
  343. return dwError;
  344. }
  345. ////////////////////////////////////////////////////////////////////////
  346. //
  347. //Function: GetActivePolicyInfo()
  348. //
  349. //Date of Creation: 21st Aug 2001
  350. //
  351. //Parameters:
  352. // IN LPTSTR pszMachineName,
  353. // OUT POLICY_INFO &m_PolicyInfo
  354. //
  355. //
  356. //Return: DWORD
  357. //
  358. //Description:
  359. // This function gets the active policy specified from the machine specified.
  360. //
  361. //Revision History:
  362. //
  363. // Date Author Comments
  364. //
  365. ////////////////////////////////////////////////////////////////////////
  366. DWORD
  367. GetActivePolicyInfo(
  368. IN LPTSTR pszMachineName,
  369. OUT POLICY_INFO &m_PolicyInfo
  370. )
  371. {
  372. DWORD dwReturn=ERROR_SUCCESS, dwStrLen = 0;
  373. dwReturn = GetPolicyInfo(pszMachineName,m_PolicyInfo);
  374. if( dwReturn == ERROR_SUCCESS )
  375. {
  376. switch (m_PolicyInfo.iPolicySource)
  377. {
  378. case PS_NO_POLICY:
  379. break;
  380. case PS_DS_POLICY:
  381. {
  382. m_PolicyInfo.dwLocation=IPSEC_DIRECTORY_PROVIDER;
  383. PGROUP_POLICY_OBJECT pGPO;
  384. pGPO = NULL;
  385. GetMorePolicyInfo(pszMachineName,m_PolicyInfo);
  386. pGPO = GetIPSecGPO(pszMachineName);
  387. if (pGPO)
  388. {
  389. PGROUP_POLICY_OBJECT pLastGPO = pGPO;
  390. while ( 1 )
  391. {
  392. if ( pLastGPO->pNext )
  393. pLastGPO = pLastGPO->pNext;
  394. else
  395. break;
  396. }
  397. _tcsncpy(m_PolicyInfo.pszOU,pLastGPO->lpLink,MAXSTRLEN-1);
  398. _tcsncpy(m_PolicyInfo.pszGPOName, pLastGPO->lpDisplayName,MAXSTRINGLEN-1);
  399. FreeGPOList (pGPO);
  400. }
  401. }
  402. break;
  403. case PS_LOC_POLICY:
  404. m_PolicyInfo.dwLocation=IPSEC_REGISTRY_PROVIDER;
  405. if(pszMachineName)
  406. {
  407. dwStrLen = _tcslen(pszMachineName);
  408. m_PolicyInfo.pszMachineName = new _TCHAR[dwStrLen+1];
  409. if(m_PolicyInfo.pszMachineName==NULL)
  410. {
  411. dwReturn=ERROR_OUTOFMEMORY;
  412. BAIL_OUT;
  413. }
  414. _tcsncpy(m_PolicyInfo.pszMachineName,pszMachineName,dwStrLen+1);
  415. }
  416. else
  417. m_PolicyInfo.pszMachineName=NULL;
  418. GetMorePolicyInfo(pszMachineName,m_PolicyInfo);
  419. break;
  420. default :
  421. break;
  422. }
  423. }
  424. error:
  425. return dwReturn;
  426. }
  427. ////////////////////////////////////////////////////////////////////////
  428. //
  429. //Function: GetIPSecGPO()
  430. //
  431. //Date of Creation: 21st Aug 2001
  432. //
  433. //Parameters:
  434. // IN LPTSTR pszMachineName
  435. //
  436. //
  437. //Return: PGROUP_POLICY_OBJECT
  438. //
  439. //Description:
  440. // This function gets the GPO specified from the machine specified.
  441. //
  442. //Revision History:
  443. //
  444. // Date Author Comments
  445. //
  446. ////////////////////////////////////////////////////////////////////////
  447. PGROUP_POLICY_OBJECT
  448. GetIPSecGPO (
  449. IN LPTSTR pszMachineName
  450. )
  451. {
  452. HKEY hKey = NULL;
  453. HKEY hRegHKey = NULL;
  454. DWORD dwStrLen = 0;
  455. LONG lResult;
  456. _TCHAR szName[MAXSTRLEN] = {0};
  457. GUID guid = {0};
  458. PGROUP_POLICY_OBJECT pGPO = NULL;
  459. //
  460. // Enumerate the extensions
  461. //
  462. lResult = RegConnectRegistry( pszMachineName,
  463. HKEY_LOCAL_MACHINE,
  464. &hRegHKey);
  465. if(lResult != ERROR_SUCCESS)
  466. {
  467. return NULL;
  468. }
  469. _TCHAR strGPExt[MAXSTRLEN] = {0};
  470. _tcsncpy(strGPExt,GPEXT_KEY,MAXSTRLEN-1);
  471. dwStrLen = _tcslen(strGPExt);
  472. _tcsncat(strGPExt , _TEXT("\\"),MAXSTRLEN- dwStrLen-1);
  473. dwStrLen = _tcslen(strGPExt);
  474. _tcsncat(strGPExt ,pcszIpsecClsid,MAXSTRLEN-dwStrLen-1);
  475. lResult = RegOpenKeyEx (hRegHKey, strGPExt, 0, KEY_READ, &hKey);
  476. if (lResult == ERROR_SUCCESS)
  477. {
  478. _tcsncpy(szName,pcszIpsecClsid,MAXSTRLEN-1);
  479. StringToGuid(szName, &guid);
  480. lResult = GetAppliedGPOList (GPO_LIST_FLAG_MACHINE, pszMachineName, NULL,
  481. &guid, &pGPO);
  482. }
  483. if( hKey )
  484. RegCloseKey(hKey);
  485. if( hRegHKey )
  486. RegCloseKey(hRegHKey);
  487. return pGPO;
  488. }
  489. ////////////////////////////////////////////////////////////////////////
  490. //
  491. //Function: StringToGuid()
  492. //
  493. //Date of Creation: 21st Aug 2001
  494. //
  495. //Parameters:
  496. // IN LPTSTR szValue,
  497. // OUT GUID * pGuid
  498. //
  499. //Return: VOID
  500. //
  501. //Description:
  502. // This function gets the GUID from the string
  503. //
  504. //Revision History:
  505. //
  506. // Date Author Comments
  507. //
  508. ////////////////////////////////////////////////////////////////////////
  509. VOID
  510. StringToGuid(
  511. IN LPTSTR szValue,
  512. OUT GUID * pGuid
  513. )
  514. {
  515. _TCHAR wc;
  516. INT i=0;
  517. //
  518. // If the first character is a '{', skip it
  519. //
  520. if ( szValue[0] == _TEXT('{') )
  521. szValue++;
  522. //
  523. // Since szValue may be used again, no permanent modification to
  524. // it is be made.
  525. //
  526. wc = szValue[8];
  527. szValue[8] = 0;
  528. pGuid->Data1 = _tcstoul( &szValue[0], 0, 16 );
  529. szValue[8] = wc;
  530. wc = szValue[13];
  531. szValue[13] = 0;
  532. pGuid->Data2 = (USHORT)_tcstoul( &szValue[9], 0, 16 );
  533. szValue[13] = wc;
  534. wc = szValue[18];
  535. szValue[18] = 0;
  536. pGuid->Data3 = (USHORT)_tcstoul( &szValue[14], 0, 16 );
  537. szValue[18] = wc;
  538. wc = szValue[21];
  539. szValue[21] = 0;
  540. pGuid->Data4[0] = (unsigned char)_tcstoul( &szValue[19], 0, 16 );
  541. szValue[21] = wc;
  542. wc = szValue[23];
  543. szValue[23] = 0;
  544. pGuid->Data4[1] = (unsigned char)_tcstoul( &szValue[21], 0, 16 );
  545. szValue[23] = wc;
  546. for ( i = 0; i < 6; i++ )
  547. {
  548. wc = szValue[26+i*2];
  549. szValue[26+i*2] = 0;
  550. pGuid->Data4[2+i] = (unsigned char)_tcstoul( &szValue[24+i*2], 0, 16 );
  551. szValue[26+i*2] = wc;
  552. }
  553. }
  554. ////////////////////////////////////////////////////////////////////////
  555. //
  556. //Function: GetGpoDsPath()
  557. //
  558. //Date of Creation: 21st Aug 2001
  559. //
  560. //Parameters:
  561. // IN LPTSTR szGpoId,
  562. // OUT LPTSTR szGpoDsPath
  563. //
  564. //Return: HRESULT
  565. //
  566. //Description:
  567. // This function gets DS path
  568. //
  569. //Revision History:
  570. //
  571. // Date Author Comments
  572. //
  573. //////////////////////////////////////////////////////////////////////////
  574. HRESULT
  575. GetGpoDsPath(
  576. IN LPTSTR szGpoId,
  577. OUT LPTSTR szGpoDsPath
  578. )
  579. {
  580. LPGROUPPOLICYOBJECT pGPO = NULL;
  581. HRESULT hr=ERROR_SUCCESS;
  582. hr = CoCreateInstance(CLSID_GroupPolicyObject, NULL, CLSCTX_SERVER, IID_IGroupPolicyObject, (void **)&pGPO);
  583. if (FAILED(hr))
  584. {
  585. BAIL_OUT;
  586. }
  587. hr = pGPO->OpenDSGPO((LPOLESTR)szGpoId,GPO_OPEN_READ_ONLY);
  588. if (FAILED(hr))
  589. {
  590. BAIL_OUT;
  591. }
  592. hr = pGPO->GetDSPath( GPO_SECTION_MACHINE,
  593. szGpoDsPath,
  594. 256
  595. );
  596. if (FAILED(hr))
  597. {
  598. BAIL_OUT;
  599. }
  600. error:
  601. return hr;
  602. }
  603. ////////////////////////////////////////////////////////////////////////
  604. //
  605. //Function: GetIPSECPolicyDN()
  606. //
  607. //Date of Creation: 21st Aug 2001
  608. //
  609. //Parameters:
  610. // IN LPWSTR pszMachinePath,
  611. // OUT LPWSTR pszPolicyDN
  612. //
  613. //Return: HRESULT
  614. //
  615. //Description:
  616. // This function gets the IPSEC policy DN
  617. //
  618. //Revision History:
  619. //
  620. // Date Author Comments
  621. //
  622. ////////////////////////////////////////////////////////////////////////
  623. HRESULT
  624. GetIPSECPolicyDN(
  625. IN LPWSTR pszMachinePath,
  626. OUT LPWSTR pszPolicyDN
  627. )
  628. {
  629. HRESULT hr = S_OK;
  630. IDirectoryObject * pIpsecObject = NULL;
  631. BSTR pszMicrosoftPath = NULL;
  632. BSTR pszIpsecPath = NULL;
  633. BSTR pszWindowsPath = NULL;
  634. LPWSTR pszOwnersReference = _TEXT("ipsecOwnersReference");
  635. PADS_ATTR_INFO pAttributeEntries = NULL;
  636. DWORD dwNumAttributesReturned = 0;
  637. // Build the fully qualified ADsPath for my object
  638. hr = CreateChildPath(
  639. pszMachinePath,
  640. _TEXT("cn=Microsoft"),
  641. &pszMicrosoftPath
  642. );
  643. BAIL_ON_FAILURE(hr);
  644. hr = CreateChildPath(
  645. pszMicrosoftPath,
  646. _TEXT("cn=Windows"),
  647. &pszWindowsPath
  648. );
  649. BAIL_ON_FAILURE(hr);
  650. hr = CreateChildPath(
  651. pszWindowsPath,
  652. _TEXT("cn=ipsec"),
  653. &pszIpsecPath
  654. );
  655. BAIL_ON_FAILURE(hr);
  656. hr = ADsGetObject(
  657. pszIpsecPath,
  658. IID_IDirectoryObject,
  659. (void **)&pIpsecObject
  660. );
  661. BAIL_ON_FAILURE(hr);
  662. //
  663. // Now populate our object with our data.
  664. //
  665. hr = pIpsecObject->GetObjectAttributes(
  666. &pszOwnersReference,
  667. 1,
  668. &pAttributeEntries,
  669. &dwNumAttributesReturned
  670. );
  671. BAIL_ON_FAILURE(hr);
  672. if (dwNumAttributesReturned != 1) {
  673. hr = E_FAIL;
  674. BAIL_ON_FAILURE(hr);
  675. }
  676. wcsncpy(pszPolicyDN, pAttributeEntries->pADsValues->DNString,STR_TEXT_SIZE-1);
  677. error:
  678. if (pIpsecObject) {
  679. pIpsecObject->Release();
  680. }
  681. if (pszMicrosoftPath) {
  682. SysFreeString(pszMicrosoftPath);
  683. }
  684. if (pszWindowsPath) {
  685. SysFreeString(pszWindowsPath);
  686. }
  687. if (pszIpsecPath) {
  688. SysFreeString(pszIpsecPath);
  689. }
  690. return(hr);
  691. }
  692. ////////////////////////////////////////////////////////////////////////
  693. //
  694. //Function: ComputePolicyDN()
  695. //
  696. //Date of Creation: 21st Aug 2001
  697. //
  698. //Parameters:
  699. // IN LPWSTR pszDirDomainName,
  700. // IN LPWSTR pszPolicyIdentifier,
  701. // OUT LPWSTR pszPolicyDN
  702. //
  703. //Return: DWORD
  704. //
  705. //Description:
  706. // This function computes the IPSEC policy DN
  707. //
  708. //Revision History:
  709. //
  710. // Date Author Comments
  711. //
  712. ////////////////////////////////////////////////////////////////////////
  713. DWORD
  714. ComputePolicyDN(
  715. IN LPWSTR pszDirDomainName,
  716. IN LPWSTR pszPolicyIdentifier,
  717. OUT LPWSTR pszPolicyDN
  718. )
  719. {
  720. DWORD dwError = ERROR_SUCCESS , dwStrLen = 0;
  721. if (!pszDirDomainName)
  722. {
  723. dwError = ERROR_INVALID_PARAMETER;
  724. BAIL_OUT;
  725. }
  726. wcsncpy(pszPolicyDN,_TEXT("cn=ipsecPolicy"),MAX_PATH-1);
  727. dwStrLen = wcslen(pszPolicyDN);
  728. wcsncat(pszPolicyDN,pszPolicyIdentifier,MAX_PATH-dwStrLen-1);
  729. dwStrLen = wcslen(pszPolicyDN);
  730. wcsncat(pszPolicyDN,_TEXT(",cn=IP Security,cn=System,"),MAX_PATH-dwStrLen-1);
  731. dwStrLen = wcslen(pszPolicyDN);
  732. wcsncat(pszPolicyDN, pszDirDomainName,MAX_PATH-dwStrLen-1);
  733. error:
  734. return(dwError);
  735. }
  736. ////////////////////////////////////////////////////////////////////////
  737. //
  738. //Function: ShowAssignedGpoPolicy()
  739. //
  740. //Date of Creation: 21st Aug 2001
  741. //
  742. //Parameters:
  743. // IN LPTSTR szGpoName,
  744. // IN PGPO pGPO,
  745. // IN BOOL bVerbose
  746. //
  747. //Return: DWORD
  748. //
  749. //Description:
  750. // This function prints the assigned policy to the GPO
  751. //
  752. //Revision History:
  753. //
  754. // Date Author Comments
  755. //
  756. ////////////////////////////////////////////////////////////////////////
  757. DWORD
  758. ShowAssignedGpoPolicy(
  759. IN LPTSTR szGpoName,
  760. IN PGPO pGPO
  761. )
  762. {
  763. DWORD dwError=ERROR_SUCCESS,dwStrLen = 0;
  764. LPTSTR szRsopNameSpace = _TEXT("root\\rsop\\computer");
  765. IWbemServices *pWbemServices = NULL;
  766. IEnumWbemClassObject * pEnum = 0;
  767. IWbemClassObject *pObject = 0;
  768. BSTR bstrLanguage,bstrQuery;
  769. _TCHAR szQuery[STR_TEXT_SIZE] = {0},szGpoDsPath[STR_TEXT_SIZE] = {0},szGpoId[STR_TEXT_SIZE]={0}, szPolicyDN[STR_TEXT_SIZE]={0};
  770. HRESULT hr=ERROR_SUCCESS;
  771. ULONG ulRet;
  772. BOOL bPolicyFound=FALSE;
  773. dwStrLen = _tcslen(szGpoName);
  774. pGPO->pszGPODisplayName=new _TCHAR[dwStrLen+1];
  775. if(pGPO->pszGPODisplayName == NULL)
  776. {
  777. dwError=ERROR_OUTOFMEMORY;
  778. BAIL_OUT;
  779. }
  780. _tcsncpy(pGPO->pszGPODisplayName,szGpoName,dwStrLen+1);
  781. dwError = CreateIWbemServices(szRsopNameSpace,&pWbemServices);
  782. BAIL_ON_WIN32_ERROR(dwError);
  783. dwError = AllocBSTRMem(_TEXT("WQL"),bstrLanguage);
  784. hr = HRESULT_FROM_WIN32(dwError);
  785. BAIL_ON_WIN32_ERROR(dwError);
  786. _snwprintf(szQuery,STR_TEXT_SIZE-1, _TEXT("SELECT * FROM RSOP_Gpo where name=\"%s\""), szGpoName);
  787. dwError = AllocBSTRMem(szQuery,bstrQuery);
  788. hr = HRESULT_FROM_WIN32(dwError);
  789. BAIL_ON_WIN32_ERROR(dwError);
  790. hr = pWbemServices->ExecQuery (bstrLanguage, bstrQuery,
  791. WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
  792. NULL, &pEnum);
  793. BAIL_ON_FAILURE(hr);
  794. //
  795. // Loop through the results
  796. //
  797. while ( (hr = pEnum->Next(WBEM_INFINITE, 1, &pObject, &ulRet)) == WBEM_S_NO_ERROR )
  798. {
  799. VARIANT varValue;
  800. BSTR bstrProp = NULL;
  801. dwError = AllocBSTRMem(_TEXT("id"),bstrProp);
  802. hr = HRESULT_FROM_WIN32(dwError);
  803. BAIL_ON_WIN32_ERROR(dwError);
  804. hr = pObject->Get (bstrProp, 0, &varValue, NULL, NULL);
  805. // check the HRESULT to see if the action succeeded.
  806. if (SUCCEEDED(hr))
  807. {
  808. LPTSTR pszDirectoryName = NULL;
  809. dwStrLen = _tcslen(V_BSTR(&varValue));
  810. pGPO->pszGPODNName=new _TCHAR[dwStrLen+1];
  811. if(pGPO->pszGPODNName == NULL)
  812. {
  813. dwError=ERROR_OUTOFMEMORY;
  814. BAIL_OUT;
  815. }
  816. _tcsncpy(pGPO->pszGPODNName,V_BSTR(&varValue),dwStrLen+1);
  817. _snwprintf(szGpoId,STR_TEXT_SIZE-1,_TEXT("LDAP://%s"),V_BSTR(&varValue));
  818. if ( ERROR_SUCCESS == GetGpoDsPath(szGpoId, szGpoDsPath))
  819. {
  820. hr = VariantClear( &varValue );
  821. if (FAILED(hr))
  822. {
  823. BAIL_OUT;
  824. }
  825. if (ERROR_SUCCESS == GetIPSECPolicyDN(
  826. szGpoDsPath,
  827. szPolicyDN
  828. ))
  829. {
  830. pszDirectoryName = wcsstr(szGpoDsPath, _TEXT("DC"));
  831. if(pszDirectoryName == NULL)
  832. {
  833. BAIL_OUT;
  834. }
  835. dwError=GetPolicyInfoFromDomain(pszDirectoryName,szPolicyDN,pGPO);
  836. if(dwError == ERROR_OUTOFMEMORY)
  837. {
  838. BAIL_OUT;
  839. }
  840. PrintGPOList(pGPO);
  841. bPolicyFound=TRUE;
  842. }
  843. }
  844. }
  845. pObject->Release ();
  846. if(bPolicyFound) break;
  847. }
  848. if(!bPolicyFound)
  849. {
  850. PrintErrorMessage(IPSEC_ERR,0,ERRCODE_SHW_STATIC_ASSIGNEDGPO_SRCMACHINE3);
  851. }
  852. pEnum->Release();
  853. error:
  854. if(dwError == ERROR_OUTOFMEMORY)
  855. {
  856. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  857. dwError=ERROR_SUCCESS;
  858. }
  859. return dwError;
  860. }
  861. DWORD
  862. ShowLocalGpoPolicy(
  863. POLICY_INFO &policyInfo,
  864. PGPO pGPO
  865. )
  866. {
  867. DWORD dwReturn;
  868. DWORD dwLocation;
  869. DWORD dwStrLength = 0;
  870. DWORD MaxStringLen = 0;
  871. LPTSTR pszMachineName = NULL;
  872. dwReturn = CopyStorageInfo(&pszMachineName,dwLocation);
  873. if(dwReturn == ERROR_OUTOFMEMORY)
  874. {
  875. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  876. dwReturn=ERROR_SUCCESS;
  877. BAIL_OUT;
  878. }
  879. // get the active policy info from the machine's registry
  880. dwReturn=GetActivePolicyInfo (pszMachineName,policyInfo);
  881. if((dwReturn==ERROR_SUCCESS)||(dwReturn==ERROR_FILE_NOT_FOUND))
  882. {
  883. if (policyInfo.iPolicySource != PS_NO_POLICY)
  884. {
  885. if(policyInfo.iPolicySource==PS_DS_POLICY)
  886. {
  887. pGPO->bDNPolicyOverrides=TRUE;
  888. dwReturn = GetLocalPolicyName(pGPO);
  889. if(dwReturn == ERROR_OUTOFMEMORY)
  890. {
  891. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  892. dwReturn = ERROR_SUCCESS;
  893. BAIL_OUT;
  894. }
  895. }
  896. if (_tcscmp(policyInfo.pszGPOName , _TEXT(""))!=0 && policyInfo.iPolicySource==PS_DS_POLICY)
  897. {
  898. //copy gpo DN
  899. dwStrLength = _tcslen(policyInfo.pszGPOName);
  900. pGPO->pszGPODNName= new _TCHAR[dwStrLength+1];
  901. if(pGPO->pszGPODNName==NULL)
  902. {
  903. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  904. dwReturn = ERROR_SUCCESS;
  905. BAIL_OUT;
  906. }
  907. _tcsncpy(pGPO->pszGPODNName,policyInfo.pszGPOName,dwStrLength);
  908. }
  909. dwStrLength = _tcslen(LocalGPOName);
  910. pGPO->pszGPODisplayName=new _TCHAR[dwStrLength+1];
  911. if(pGPO->pszGPODisplayName==NULL)
  912. {
  913. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  914. dwReturn = ERROR_SUCCESS;
  915. BAIL_OUT;
  916. }
  917. //copy gpo display name
  918. _tcsncpy(pGPO->pszGPODisplayName,LocalGPOName,dwStrLength+1);
  919. if (_tcscmp(policyInfo.pszPolicyName , _TEXT(""))!=0)
  920. {
  921. dwStrLength = _tcslen(policyInfo.pszPolicyName);
  922. pGPO->pszPolicyName=new _TCHAR[dwStrLength+1];
  923. if(pGPO->pszPolicyName==NULL)
  924. {
  925. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  926. dwReturn = ERROR_SUCCESS;
  927. BAIL_OUT;
  928. }
  929. _tcsncpy(pGPO->pszPolicyName ,policyInfo.pszPolicyName,dwStrLength+1);
  930. }
  931. if (_tcscmp(policyInfo.pszPolicyPath , _TEXT(""))!=0)
  932. {
  933. //copy gpo policy DN
  934. dwStrLength = _tcslen(policyInfo.pszPolicyPath);
  935. pGPO->pszPolicyDNName=new _TCHAR[dwStrLength+1];
  936. if(pGPO->pszPolicyDNName==NULL)
  937. {
  938. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  939. dwReturn = ERROR_SUCCESS;
  940. BAIL_OUT;
  941. }
  942. _tcsncpy(pGPO->pszPolicyDNName,policyInfo.pszPolicyPath,dwStrLength+1);
  943. }
  944. pGPO->bActive=TRUE;
  945. MaxStringLen = (sizeof(pGPO->pszLocalMachineName) / sizeof(pGPO->pszLocalMachineName[0]));
  946. if(!pszMachineName)
  947. {
  948. GetComputerName(pGPO->pszLocalMachineName,&MaxStringLen);
  949. }
  950. else
  951. {
  952. _tcsncpy(pGPO->pszLocalMachineName,pszMachineName,MaxStringLen-1);
  953. }
  954. //get Domain Name & DC name
  955. PDOMAIN_CONTROLLER_INFO pDomainControllerInfo = NULL;
  956. DWORD Flags = DS_DIRECTORY_SERVICE_REQUIRED | DS_RETURN_DNS_NAME | DS_FORCE_REDISCOVERY;
  957. dwReturn = DsGetDcName(NULL, //machine name
  958. NULL,
  959. NULL,
  960. NULL,
  961. Flags,
  962. &pDomainControllerInfo
  963. ) ;
  964. if(dwReturn==NO_ERROR && pDomainControllerInfo)
  965. {
  966. if(pDomainControllerInfo->DomainName)
  967. {
  968. dwStrLength = _tcslen(pDomainControllerInfo->DomainName);
  969. pGPO->pszDomainName= new _TCHAR[dwStrLength+1];
  970. if(pGPO->pszDomainName==NULL)
  971. {
  972. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  973. dwReturn = ERROR_SUCCESS;
  974. BAIL_OUT;
  975. }
  976. _tcsncpy(pGPO->pszDomainName,pDomainControllerInfo->DomainName,dwStrLength+1);
  977. }
  978. if(pDomainControllerInfo->DomainControllerName)
  979. {
  980. dwStrLength = _tcslen(pDomainControllerInfo->DomainControllerName);
  981. pGPO->pszDCName= new _TCHAR[dwStrLength+1];
  982. if(pGPO->pszDCName==NULL)
  983. {
  984. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  985. dwReturn = ERROR_SUCCESS;
  986. BAIL_OUT;
  987. }
  988. _tcsncpy(pGPO->pszDCName,pDomainControllerInfo->DomainControllerName,dwStrLength+1);
  989. }
  990. //free pDomainControllerInfo
  991. NetApiBufferFree(pDomainControllerInfo);
  992. }
  993. PrintGPOList(pGPO);
  994. dwReturn = ERROR_SUCCESS;
  995. }
  996. else
  997. {
  998. PrintErrorMessage(IPSEC_ERR,0,ERRCODE_SHW_STATIC_TAB_ASSIGNPOL_2);
  999. }
  1000. }
  1001. else if(dwReturn==ERROR_OUTOFMEMORY)
  1002. {
  1003. PrintErrorMessage(WIN32_ERR,ERROR_OUTOFMEMORY,NULL);
  1004. dwReturn = ERROR_SUCCESS;
  1005. }
  1006. if(dwReturn==ERROR_FILE_NOT_FOUND)
  1007. dwReturn=ERROR_SUCCESS;
  1008. if(policyInfo.pszMachineName)
  1009. {
  1010. delete [] policyInfo.pszMachineName;
  1011. policyInfo.pszMachineName = NULL;
  1012. }
  1013. if(pszMachineName)
  1014. delete [] pszMachineName;
  1015. error:
  1016. return dwReturn;
  1017. }
  1018. /////////////////////////////////////////////////////////////////////////
  1019. //
  1020. //Function: CreateIWbemServices()
  1021. //
  1022. //Date of Creation: 21st Aug 2001
  1023. //
  1024. //Parameters:
  1025. // IN LPTSTR pszIpsecWMINamespace,
  1026. // OUT IWbemServices **ppWbemServices
  1027. //
  1028. //Return: DWORD
  1029. //
  1030. //Description:
  1031. //
  1032. //
  1033. //Revision History:
  1034. //
  1035. // Date Author Comments
  1036. //
  1037. /////////////////////////////////////////////////////////////////////////
  1038. DWORD
  1039. CreateIWbemServices(
  1040. IN LPTSTR pszIpsecWMINamespace,
  1041. OUT IWbemServices **ppWbemServices
  1042. )
  1043. {
  1044. DWORD dwError = ERROR_SUCCESS;
  1045. IWbemLocator *pWbemLocator = NULL;
  1046. HRESULT hr = S_OK;
  1047. BSTR bstrIpsecWMIPath = NULL;
  1048. hr = CoCreateInstance(
  1049. CLSID_WbemLocator,
  1050. NULL,
  1051. CLSCTX_INPROC_SERVER,
  1052. IID_IWbemLocator,
  1053. (LPVOID*)&pWbemLocator
  1054. );
  1055. if (FAILED(hr))
  1056. {
  1057. dwError = ERROR_INTERNAL_ERROR;
  1058. BAIL_OUT;
  1059. }
  1060. dwError = AllocBSTRMem(pszIpsecWMINamespace,bstrIpsecWMIPath);
  1061. BAIL_ON_WIN32_ERROR(dwError);
  1062. hr = pWbemLocator->ConnectServer(
  1063. bstrIpsecWMIPath,
  1064. NULL,
  1065. NULL,
  1066. NULL,
  1067. 0,
  1068. NULL, NULL,
  1069. ppWbemServices );
  1070. if (FAILED(hr))
  1071. {
  1072. dwError = ERROR_INTERNAL_ERROR;
  1073. BAIL_OUT;
  1074. }
  1075. SysFreeString(bstrIpsecWMIPath);
  1076. if(pWbemLocator)
  1077. pWbemLocator->Release();
  1078. error:
  1079. return (dwError);
  1080. }
  1081. /////////////////////////////////////////////////////////////////////////
  1082. //
  1083. //Function: FormatTime()
  1084. //
  1085. //Date of Creation: 21st Aug 2001
  1086. //
  1087. //Parameters:
  1088. // IN time_t t,
  1089. // OUT LPTSTR pszTimeStr
  1090. //
  1091. //Return: HRESULT
  1092. //
  1093. //Description:
  1094. // Computes the last modified time
  1095. //
  1096. //Revision History:
  1097. //
  1098. // Date Author Comments
  1099. //
  1100. ///////////////////////////////////////////////////////////////////////////
  1101. HRESULT
  1102. FormatTime(
  1103. IN time_t t,
  1104. OUT LPTSTR pszTimeStr
  1105. )
  1106. {
  1107. time_t timeCurrent = time(NULL);
  1108. LONGLONG llTimeDiff = 0;
  1109. FILETIME ftCurrent = {0};
  1110. FILETIME ftLocal = {0};
  1111. SYSTEMTIME SysTime;
  1112. _TCHAR szBuff[STR_TEXT_SIZE] = {0};
  1113. DWORD dwStrLen = 0 ;
  1114. //Here tcsncpy not required
  1115. _tcscpy(pszTimeStr, _TEXT(""));
  1116. GetSystemTimeAsFileTime(&ftCurrent);
  1117. llTimeDiff = (LONGLONG)t - (LONGLONG)timeCurrent;
  1118. llTimeDiff *= 10000000;
  1119. *((LONGLONG UNALIGNED64 *)&ftCurrent) += llTimeDiff;
  1120. if (!FileTimeToLocalFileTime(&ftCurrent, &ftLocal ))
  1121. {
  1122. return HRESULT_FROM_WIN32(GetLastError());
  1123. }
  1124. if (!FileTimeToSystemTime( &ftLocal, &SysTime ))
  1125. {
  1126. return HRESULT_FROM_WIN32(GetLastError());
  1127. }
  1128. if (0 == GetDateFormat(LOCALE_USER_DEFAULT,
  1129. 0,
  1130. &SysTime,
  1131. NULL,
  1132. szBuff,
  1133. sizeof(szBuff)/sizeof(szBuff[0]) )) //number of characters
  1134. {
  1135. return HRESULT_FROM_WIN32(GetLastError());
  1136. }
  1137. dwStrLen = _tcslen(pszTimeStr);
  1138. _tcsncat(pszTimeStr,szBuff,BUFFER_SIZE-dwStrLen-1);
  1139. dwStrLen = _tcslen(pszTimeStr);
  1140. _tcsncat(pszTimeStr, _TEXT(" "),BUFFER_SIZE-dwStrLen-1);
  1141. ZeroMemory(szBuff, sizeof(szBuff));
  1142. if (0 == GetTimeFormat(LOCALE_USER_DEFAULT,
  1143. 0,
  1144. &SysTime,
  1145. NULL,
  1146. szBuff,
  1147. sizeof(szBuff)/sizeof(szBuff[0]))) //number of characters
  1148. {
  1149. return HRESULT_FROM_WIN32(GetLastError());
  1150. }
  1151. dwStrLen = _tcslen(pszTimeStr);
  1152. _tcsncat(pszTimeStr,szBuff,BUFFER_SIZE-dwStrLen-1);
  1153. return S_OK;
  1154. }
  1155. INT
  1156. WcsCmp0(
  1157. IN PWSTR pszString1,
  1158. IN PWSTR pszString2)
  1159. {
  1160. if ((pszString1 == NULL) || (pszString2 == NULL))
  1161. {
  1162. if (pszString1 == NULL)
  1163. {
  1164. if ((pszString2 == NULL) || (*pszString2 == L'\0'))
  1165. {
  1166. return 0;
  1167. }
  1168. return -1;
  1169. }
  1170. else
  1171. {
  1172. if (*pszString1 == L'\0')
  1173. {
  1174. return 0;
  1175. }
  1176. return 1;
  1177. }
  1178. }
  1179. return _tcscmp(pszString1, pszString2);
  1180. }
  1181. VOID
  1182. DisplayCertInfo(
  1183. LPTSTR pszCertName,
  1184. DWORD dwFlags
  1185. )
  1186. {
  1187. ASSERT(pszCertName != NULL);
  1188. PrintMessageFromModule(g_hModule, DYNAMIC_SHOW_MMSAS_FILTER_ROOTCA, pszCertName);
  1189. PrintMessageFromModule(g_hModule, DYNAMIC_SHOW_NEWLINE);
  1190. if((g_StorageLocation.dwLocation != IPSEC_DIRECTORY_PROVIDER && IsDomainMember(g_StorageLocation.pszMachineName))||(g_StorageLocation.dwLocation == IPSEC_DIRECTORY_PROVIDER))
  1191. {
  1192. if(dwFlags & IPSEC_MM_CERT_AUTH_ENABLE_ACCOUNT_MAP )
  1193. {
  1194. PrintMessageFromModule(g_hModule,SHW_AUTH_CERTMAP_ENABLED_YES_STR);
  1195. }
  1196. else
  1197. {
  1198. PrintMessageFromModule(g_hModule,SHW_AUTH_CERTMAP_ENABLED_NO_STR);
  1199. }
  1200. }
  1201. if (dwFlags & IPSEC_MM_CERT_AUTH_DISABLE_CERT_REQUEST)
  1202. {
  1203. PrintMessageFromModule(g_hModule, SHW_AUTH_EXCLUDE_CA_NAME_YES_STR);
  1204. }
  1205. else
  1206. {
  1207. PrintMessageFromModule(g_hModule, SHW_AUTH_EXCLUDE_CA_NAME_NO_STR);
  1208. }
  1209. }