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.

805 lines
17 KiB

  1. #include "precomp.h"
  2. #include "version.h"
  3. #include "nacguids.h"
  4. #include "RegEntry.h"
  5. #include "ConfReg.h"
  6. #include "NmSysInfo.h"
  7. #include "capflags.h"
  8. #define SZ_YES _T("1")
  9. #define SZ_NO _T("0")
  10. /* B S T R _ T O _ L P T S T R */
  11. /*-------------------------------------------------------------------------
  12. %%Function: BSTR_to_LPTSTR
  13. -------------------------------------------------------------------------*/
  14. HRESULT BSTR_to_LPTSTR(LPTSTR *ppsz, BSTR bstr)
  15. {
  16. #ifndef UNICODE
  17. // compute the length of the required BSTR
  18. int cch = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
  19. if (cch <= 0)
  20. return E_FAIL;
  21. // cch is the number of BYTES required, including the null terminator
  22. *ppsz = (LPTSTR) new char[cch];
  23. if (*ppsz == NULL)
  24. return E_OUTOFMEMORY;
  25. WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, *ppsz, cch, NULL, NULL);
  26. return S_OK;
  27. #else
  28. return E_NOTIMPL;
  29. #endif // UNICODE
  30. }
  31. //
  32. // Hack alert:
  33. //
  34. // The follwoing system property constant is used to inform
  35. // the Netmeeting Manager object that the caller is Whistler
  36. // RTC client so that it can take some actions for performance
  37. // purpose, i.e. don't poll A/V capabilities and don't do
  38. // ILS logon.
  39. //
  40. // This value MUST NOT collide with the NM_SYSPROP_Consts defined
  41. // in imsconf3.idl
  42. //
  43. #define NM_SYSPROP_CALLERISRTC 300
  44. ///////////////////////////////////////////////
  45. // Init and construction methods
  46. ///////////////////////////////////////////////
  47. HRESULT CNmSysInfoObj::FinalConstruct()
  48. {
  49. DBGENTRY(CNmSysInfoObj::FinalConstruct);
  50. HRESULT hr = S_OK;
  51. m_dwID = 0;
  52. DBGEXIT_HR(CNmSysInfoObj::FinalConstruct,hr);
  53. return hr;
  54. }
  55. void CNmSysInfoObj::FinalRelease()
  56. {
  57. DBGENTRY(CNmSysInfoObj::FinalRelease);
  58. m_spConfHook = NULL;
  59. DBGEXIT(CNmSysInfoObj::FinalRelease);
  60. }
  61. ///////////////////////////////////////////////
  62. // INmSysInfo2 methods
  63. ///////////////////////////////////////////////
  64. STDMETHODIMP CNmSysInfoObj::IsInstalled(void)
  65. {
  66. DBGENTRY(CNmSysInfoObj::IsInstalled);
  67. HRESULT hr = S_OK;
  68. TCHAR sz[MAX_PATH];
  69. // Fail if not a valid installation directory
  70. if (GetInstallDirectory(sz) && FDirExists(sz))
  71. {
  72. // Validate ULS entries
  73. RegEntry reUls(ISAPI_KEY "\\" REGKEY_USERDETAILS, HKEY_CURRENT_USER);
  74. LPTSTR psz;
  75. hr = NM_E_NOT_INITIALIZED;
  76. psz = reUls.GetString(REGVAL_ULS_EMAIL_NAME);
  77. if (lstrlen(psz))
  78. {
  79. psz = reUls.GetString(REGVAL_ULS_RES_NAME);
  80. {
  81. RegEntry reConf(CONFERENCING_KEY, HKEY_CURRENT_USER);
  82. // check to see if the wizard has been run in UI mode
  83. DWORD dwVersion = reConf.GetNumber(REGVAL_WIZARD_VERSION_UI, 0);
  84. BOOL fForceWizard = (VER_PRODUCTVERSION_DW != dwVersion);
  85. if (fForceWizard)
  86. {
  87. // the wizard has not been run in UI mode, check to see if its been run in NOUI mode
  88. dwVersion = reConf.GetNumber(REGVAL_WIZARD_VERSION_NOUI, 0);
  89. fForceWizard = (VER_PRODUCTVERSION_DW != dwVersion);
  90. }
  91. if (fForceWizard)
  92. {
  93. hr = S_FALSE; // Wizard has never been run
  94. }
  95. else
  96. {
  97. hr = S_OK;
  98. }
  99. }
  100. }
  101. }
  102. else
  103. {
  104. hr = E_FAIL;
  105. }
  106. DBGEXIT_HR(CNmSysInfoObj::IsInstalled,hr);
  107. return hr;
  108. }
  109. STDMETHODIMP CNmSysInfoObj::GetProperty(NM_SYSPROP uProp, BSTR *pbstrProp)
  110. {
  111. DBGENTRY(CNmSysInfoObj::GetProperty);
  112. HRESULT hr = S_OK;
  113. if(pbstrProp)
  114. {
  115. switch (uProp)
  116. {
  117. case NM_SYSPROP_BUILD_VER:
  118. *pbstrProp = T2BSTR(VER_PRODUCTVERSION_STR);
  119. break;
  120. case NM_SYSPROP_LOGGED_ON:
  121. _EnsureConfHook();
  122. if(m_spConfHook)
  123. {
  124. *pbstrProp = T2BSTR((S_OK == m_spConfHook->LoggedIn()) ? SZ_YES : SZ_NO);
  125. }
  126. break;
  127. case NM_SYSPROP_IS_RUNNING:
  128. _EnsureConfHook();
  129. if(m_spConfHook)
  130. {
  131. *pbstrProp = T2BSTR((S_OK == m_spConfHook->IsRunning()) ? SZ_YES : SZ_NO);
  132. }
  133. break;
  134. case NM_SYSPROP_IN_CONFERENCE:
  135. _EnsureConfHook();
  136. if(m_spConfHook)
  137. {
  138. *pbstrProp = T2BSTR((S_OK == m_spConfHook->InConference()) ? SZ_YES : SZ_NO);
  139. }
  140. break;
  141. case NM_SYSPROP_USER_CITY:
  142. case NM_SYSPROP_USER_COUNTRY:
  143. case NM_SYSPROP_USER_CATEGORY:
  144. *pbstrProp = T2BSTR((""));
  145. break;
  146. case NM_SYSPROP_ICA_ENABLE:
  147. *pbstrProp = T2BSTR(("0"));
  148. break;
  149. default:
  150. {
  151. HKEY hkey;
  152. LPTSTR pszSubKey;
  153. LPTSTR pszValue;
  154. bool fString;
  155. TCHAR sz[MAX_PATH];
  156. if(GetKeyDataForProp(uProp, &hkey, &pszSubKey, &pszValue, &fString))
  157. {
  158. RegEntry re(pszSubKey, hkey);
  159. if (fString)
  160. {
  161. *pbstrProp = T2BSTR(re.GetString(pszValue));
  162. }
  163. else
  164. {
  165. DWORD dw = re.GetNumber(pszValue, 0);
  166. wsprintf(sz, "%d", dw);
  167. *pbstrProp = T2BSTR(sz);
  168. break;
  169. }
  170. }
  171. else
  172. {
  173. pbstrProp = NULL;
  174. hr = E_INVALIDARG;
  175. }
  176. }
  177. }
  178. }
  179. else
  180. {
  181. hr = E_POINTER;
  182. }
  183. DBGEXIT_HR(CNmSysInfoObj::GetProperty,hr);
  184. return hr;
  185. }
  186. STDMETHODIMP CNmSysInfoObj::SetProperty(NM_SYSPROP uProp, BSTR bstrName)
  187. {
  188. DBGENTRY(CNmSysInfoObj::SetProperty);
  189. HRESULT hr = S_OK;
  190. LPTSTR psz;
  191. LPTSTR szName= NULL;
  192. if(FAILED(BSTR_to_LPTSTR (&szName, bstrName)))
  193. {
  194. return E_FAIL;
  195. }
  196. if( bstrName )
  197. {
  198. // Special processing for new NM 2.x functions
  199. switch (uProp)
  200. {
  201. case NM_SYSPROP_LOGGED_ON:
  202. {
  203. _EnsureConfHook();
  204. if(m_spConfHook)
  205. {
  206. if(0 == lstrcmp(SZ_YES,szName))
  207. {
  208. m_spConfHook->LDAPLogon(TRUE);
  209. }
  210. else
  211. {
  212. m_spConfHook->LDAPLogon(FALSE);
  213. }
  214. }
  215. break;
  216. }
  217. case NM_SYSPROP_DISABLE_H323:
  218. {
  219. _EnsureConfHook();
  220. if(m_spConfHook)
  221. {
  222. hr = m_spConfHook->DisableH323(0 == lstrcmp(SZ_YES,szName));
  223. }
  224. }
  225. break;
  226. case NM_SYSPROP_DISABLE_INITIAL_ILS_LOGON:
  227. {
  228. _EnsureConfHook();
  229. if(m_spConfHook)
  230. {
  231. hr = m_spConfHook->DisableInitialILSLogon(0 == lstrcmp(SZ_YES,szName));
  232. }
  233. }
  234. break;
  235. case NM_SYSPROP_CALLERISRTC:
  236. {
  237. _EnsureConfHook();
  238. if(m_spConfHook)
  239. {
  240. hr = m_spConfHook->SetCallerIsRTC(0 == lstrcmp(SZ_YES,szName));
  241. }
  242. }
  243. break;
  244. case NM_SYSPROP_ICA_ENABLE:
  245. case NM_SYSPROP_USER_CITY:
  246. case NM_SYSPROP_USER_COUNTRY:
  247. case NM_SYSPROP_USER_CATEGORY:
  248. case NM_SYSPROP_USER_LOCATION:
  249. // We don't support these properties anymore
  250. hr = S_OK;
  251. break;
  252. case NM_SYSPROP_WB_HELPFILE:
  253. case NM_SYSPROP_CB_HELPFILE:
  254. {
  255. // We don't use these anymare
  256. hr = S_OK;
  257. break;
  258. }
  259. default:
  260. {
  261. LPTSTR pszSubKey;
  262. LPTSTR pszValue;
  263. bool fString;
  264. HKEY hkey;
  265. if(GetKeyDataForProp(uProp, &hkey, &pszSubKey, &pszValue, &fString))
  266. {
  267. RegEntry re(pszSubKey, hkey);
  268. if (fString)
  269. {
  270. if (0 != re.SetValue(pszValue, szName))
  271. {
  272. hr = E_UNEXPECTED;
  273. }
  274. }
  275. else
  276. {
  277. DWORD dw = DecimalStringToUINT(szName);
  278. if (0 != re.SetValue(pszValue, dw))
  279. {
  280. hr = E_UNEXPECTED;
  281. }
  282. }
  283. }
  284. else
  285. {
  286. hr = E_INVALIDARG;
  287. }
  288. break;
  289. }
  290. }
  291. }
  292. else
  293. {
  294. hr = E_INVALIDARG;
  295. }
  296. delete szName;
  297. DBGEXIT_HR(CNmSysInfoObj::SetProperty,hr);
  298. return hr;
  299. }
  300. STDMETHODIMP CNmSysInfoObj::GetUserData(REFGUID rguid, BYTE **ppb, ULONG *pcb)
  301. {
  302. HRESULT hr = E_FAIL;
  303. _EnsureConfHook();
  304. if(m_spConfHook)
  305. {
  306. return m_spConfHook->GetUserData(rguid, ppb, pcb);
  307. }
  308. return hr;
  309. }
  310. STDMETHODIMP CNmSysInfoObj::SetUserData(REFGUID rguid, BYTE *pb, ULONG cb)
  311. {
  312. HRESULT hr = E_FAIL;
  313. _EnsureConfHook();
  314. if(m_spConfHook)
  315. {
  316. return m_spConfHook->SetUserData(rguid, pb, cb);
  317. }
  318. return hr;
  319. }
  320. STDMETHODIMP CNmSysInfoObj::GetNmApp(REFGUID rguid,BSTR *pbstrApplication, BSTR *pbstrCommandLine, BSTR *pbstrDirectory)
  321. {
  322. HRESULT hr = S_OK;
  323. DBGENTRY(CNmSysInfoObj::GetNmApp);
  324. bool bErr = FALSE;
  325. TCHAR szKey[MAX_PATH];
  326. // Validate parameters
  327. if ((!pbstrApplication) || (!IsBadWritePtr(pbstrApplication, sizeof(BSTR *))) &&
  328. (!pbstrCommandLine) || (!IsBadWritePtr(pbstrCommandLine, sizeof(BSTR *))) &&
  329. (!pbstrDirectory) || (!IsBadWritePtr(pbstrDirectory, sizeof(BSTR *))) )
  330. {
  331. _GetSzKeyForGuid(szKey, rguid);
  332. RegEntry re(szKey, HKEY_LOCAL_MACHINE);
  333. if(pbstrApplication)
  334. {
  335. *pbstrApplication = T2BSTR(re.GetString(REGVAL_GUID_APPNAME));
  336. if(NULL == *pbstrApplication)
  337. {
  338. bErr = true;
  339. }
  340. }
  341. if(pbstrCommandLine)
  342. {
  343. *pbstrCommandLine = T2BSTR(re.GetString(REGVAL_GUID_CMDLINE));
  344. if(NULL == *pbstrCommandLine)
  345. {
  346. bErr = true;
  347. }
  348. }
  349. if(pbstrDirectory)
  350. {
  351. *pbstrDirectory = T2BSTR(re.GetString(REGVAL_GUID_CURRDIR));
  352. if(NULL == *pbstrDirectory)
  353. {
  354. bErr = true;
  355. }
  356. }
  357. if(bErr)
  358. {
  359. if (NULL != pbstrApplication)
  360. {
  361. SysFreeString(*pbstrApplication);
  362. *pbstrApplication = NULL;
  363. }
  364. if (NULL != pbstrCommandLine)
  365. {
  366. SysFreeString(*pbstrCommandLine);
  367. *pbstrCommandLine = NULL;
  368. }
  369. if (NULL != pbstrDirectory)
  370. {
  371. SysFreeString(*pbstrDirectory);
  372. *pbstrDirectory = NULL;
  373. }
  374. hr = E_OUTOFMEMORY;
  375. }
  376. }
  377. else
  378. {
  379. hr = E_POINTER;
  380. }
  381. DBGEXIT_HR(CNmSysInfoObj::GetNmApp,hr);
  382. return hr;
  383. }
  384. STDMETHODIMP CNmSysInfoObj::SetNmApp(REFGUID rguid,BSTR bstrApplication, BSTR bstrCommandLine, BSTR bstrDirectory)
  385. {
  386. HRESULT hr = S_OK;
  387. DBGENTRY(CNmSysInfoObj::SetNmApp);
  388. bool bDeleteKey = TRUE;
  389. LPTSTR psz = NULL;
  390. TCHAR szKey[MAX_PATH];
  391. LPTSTR szApplication = NULL;
  392. LPTSTR szCommandLine = NULL;
  393. LPTSTR szDirectory = NULL;
  394. BSTR_to_LPTSTR (&szApplication, bstrApplication);
  395. BSTR_to_LPTSTR (&szCommandLine, bstrCommandLine);
  396. BSTR_to_LPTSTR (&szDirectory, bstrDirectory);
  397. _GetSzKeyForGuid(szKey, rguid);
  398. RegEntry re(szKey, HKEY_LOCAL_MACHINE);
  399. if(!bstrApplication)
  400. {
  401. re.DeleteValue(REGVAL_GUID_APPNAME);
  402. }
  403. else
  404. {
  405. if(szApplication)
  406. {
  407. re.SetValue(REGVAL_GUID_APPNAME, szApplication);
  408. }
  409. else
  410. {
  411. hr = E_OUTOFMEMORY;
  412. }
  413. bDeleteKey = false;
  414. }
  415. if (NULL == bstrCommandLine)
  416. {
  417. re.DeleteValue(REGVAL_GUID_CMDLINE);
  418. }
  419. else
  420. {
  421. if(szCommandLine)
  422. {
  423. re.SetValue(REGVAL_GUID_CMDLINE, szCommandLine);
  424. }
  425. else
  426. {
  427. hr = E_OUTOFMEMORY;
  428. }
  429. bDeleteKey = false;
  430. }
  431. if (NULL == bstrDirectory)
  432. {
  433. re.DeleteValue(REGVAL_GUID_CURRDIR);
  434. }
  435. else
  436. {
  437. if(szDirectory)
  438. {
  439. re.SetValue(REGVAL_GUID_CURRDIR, szDirectory);
  440. }
  441. else
  442. {
  443. hr = E_OUTOFMEMORY;
  444. }
  445. bDeleteKey = false;
  446. }
  447. if (bDeleteKey)
  448. {
  449. // All keys were NULL - delete the entire key
  450. RegEntry reApps(GUID_KEY, HKEY_LOCAL_MACHINE);
  451. GuidToSz((GUID *) &rguid, szKey);
  452. reApps.DeleteValue(szKey);
  453. }
  454. delete szApplication;
  455. delete szCommandLine;
  456. delete szDirectory;
  457. DBGEXIT_HR(CNmSysInfoObj::SetNmApp,hr);
  458. return hr;
  459. }
  460. STDMETHODIMP CNmSysInfoObj::GetNmchCaps(ULONG *pchCaps)
  461. {
  462. DBGENTRY(CNmSysInfoObj::GetNmchCaps);
  463. HRESULT hr = S_OK;
  464. _EnsureConfHook();
  465. if(m_spConfHook)
  466. {
  467. if(pchCaps && !IsBadWritePtr(pchCaps, sizeof(ULONG *)))
  468. {
  469. ULONG nmch = NMCH_DATA; // Always capable of data
  470. RegEntry re(POLICIES_KEY, HKEY_CURRENT_USER);
  471. if ((DEFAULT_POL_NO_FILETRANSFER_SEND == re.GetNumber(REGVAL_POL_NO_FILETRANSFER_SEND,
  472. DEFAULT_POL_NO_FILETRANSFER_SEND)) &&
  473. (DEFAULT_POL_NO_FILETRANSFER_RECEIVE == re.GetNumber(REGVAL_POL_NO_FILETRANSFER_RECEIVE,
  474. DEFAULT_POL_NO_FILETRANSFER_RECEIVE)) )
  475. {
  476. nmch |= NMCH_FT;
  477. }
  478. if (DEFAULT_POL_NO_APP_SHARING == re.GetNumber(REGVAL_POL_NO_APP_SHARING,
  479. DEFAULT_POL_NO_APP_SHARING))
  480. {
  481. nmch |= NMCH_SHARE;
  482. }
  483. if (DEFAULT_POL_NO_AUDIO == re.GetNumber(REGVAL_POL_NO_AUDIO,
  484. DEFAULT_POL_NO_AUDIO))
  485. {
  486. if(S_OK == m_spConfHook->IsNetMeetingRunning())
  487. {
  488. DWORD dwLocalCaps;
  489. if(SUCCEEDED(m_spConfHook->GetLocalCaps(&dwLocalCaps)) && (dwLocalCaps & CAPFLAG_SEND_AUDIO))
  490. {
  491. nmch |= NMCH_AUDIO;
  492. }
  493. }
  494. }
  495. if ((DEFAULT_POL_NO_VIDEO_SEND == re.GetNumber(REGVAL_POL_NO_VIDEO_SEND,
  496. DEFAULT_POL_NO_VIDEO_SEND)) &&
  497. (DEFAULT_POL_NO_VIDEO_RECEIVE == re.GetNumber(REGVAL_POL_NO_VIDEO_RECEIVE,
  498. DEFAULT_POL_NO_VIDEO_RECEIVE)) )
  499. {
  500. if(S_OK == m_spConfHook->IsNetMeetingRunning())
  501. {
  502. DWORD dwLocalCaps;
  503. if(SUCCEEDED(m_spConfHook->GetLocalCaps(&dwLocalCaps)) && (dwLocalCaps & CAPFLAG_SEND_VIDEO))
  504. {
  505. nmch |= NMCH_VIDEO;
  506. }
  507. }
  508. }
  509. *pchCaps = nmch;
  510. }
  511. else
  512. {
  513. hr = E_POINTER;
  514. }
  515. if(SUCCEEDED(hr))
  516. {
  517. hr = m_spConfHook->IsNetMeetingRunning();
  518. }
  519. }
  520. else
  521. {
  522. ERROR_OUT(("The confhook should be valid"));
  523. hr = E_UNEXPECTED;
  524. }
  525. DBGEXIT_HR(CNmSysInfoObj::GetNmchCaps,hr);
  526. return hr;
  527. }
  528. STDMETHODIMP CNmSysInfoObj::GetLaunchInfo(INmConference **ppConference, INmMember **ppMember)
  529. {
  530. DBGENTRY(CNmSysInfoObj::GetLaunchInfo);
  531. HRESULT hr = S_OK;
  532. if(ppMember)
  533. {
  534. *ppMember = NULL;
  535. }
  536. if(ppConference)
  537. {
  538. *ppConference = NULL;
  539. }
  540. _EnsureConfHook();
  541. if(m_spConfHook)
  542. {
  543. // If NetMeeting is not initialized, return NM_E_NOT_INITIALIZED
  544. hr = m_spConfHook->IsNetMeetingRunning();
  545. if(S_OK != hr) goto end;
  546. // If there is no default conference, return S_FALSE
  547. CComPtr<INmConference> spConf;
  548. hr = m_spConfHook->GetActiveConference(&spConf);
  549. if(S_OK != hr) goto end;
  550. // If the confID environment variable is not there, return S_FALSE
  551. TCHAR sz[MAX_PATH];
  552. if (0 == GetEnvironmentVariable(ENV_CONFID, sz, CCHMAX(sz)))
  553. {
  554. hr = S_FALSE;
  555. goto end;
  556. }
  557. // If the conference ID from the environment variable is not there, return S_FALSE
  558. DWORD dw = DecimalStringToUINT(sz);
  559. DWORD dwGCCConfID;
  560. if(SUCCEEDED(hr = spConf->GetID(&dwGCCConfID)))
  561. {
  562. if(dw != dwGCCConfID)
  563. {
  564. // Conferenec does not exist anymore
  565. hr = S_FALSE;
  566. goto end;
  567. }
  568. // If the nodeID environment variable is note there, return S_FALSE
  569. if (0 == GetEnvironmentVariable(ENV_NODEID, sz, CCHMAX(sz)))
  570. {
  571. hr = S_FALSE;
  572. goto end;
  573. }
  574. // If ppMember is not NULL, fill it with a new SDKMember object from the nodeID
  575. if(ppMember)
  576. {
  577. CComPtr<IInternalConferenceObj> spConfObj = com_cast<IInternalConferenceObj>(spConf);
  578. if(spConfObj)
  579. {
  580. hr = spConfObj->GetMemberFromNodeID(DecimalStringToUINT(sz), ppMember);
  581. }
  582. else
  583. {
  584. hr = E_UNEXPECTED;
  585. goto end;
  586. }
  587. }
  588. // If ppConferenec is not NULL, fill it with a new SDKMember object
  589. if(ppConference)
  590. {
  591. *ppConference = spConf;
  592. (*ppConference)->AddRef();
  593. }
  594. }
  595. }
  596. else
  597. {
  598. hr = E_UNEXPECTED;
  599. }
  600. end:
  601. DBGEXIT_HR(CNmSysInfoObj::GetLaunchInfo,hr);
  602. return hr;
  603. }
  604. ///////////////////////////////////////////////
  605. // Helper Fns
  606. ///////////////////////////////////////////////
  607. /*static*/ bool CNmSysInfoObj::GetKeyDataForProp(NM_SYSPROP uProp, HKEY * phkey, LPTSTR * ppszSubKey, LPTSTR * ppszValue, bool *pfString)
  608. {
  609. DBGENTRY(CNmSysInfoObj::GetKeyDataForProp);
  610. // Default to ULS registry key
  611. *phkey = HKEY_CURRENT_USER;
  612. *ppszSubKey = ISAPI_KEY "\\" REGKEY_USERDETAILS;
  613. *pfString = true;
  614. bool bRet = true;
  615. switch (uProp)
  616. {
  617. case NM_SYSPROP_EMAIL_NAME: *ppszValue = REGVAL_ULS_EMAIL_NAME; break;
  618. case NM_SYSPROP_SERVER_NAME: *ppszValue = REGVAL_SERVERNAME; break;
  619. case NM_SYSPROP_RESOLVE_NAME: *ppszValue = REGVAL_ULS_RES_NAME; break;
  620. case NM_SYSPROP_FIRST_NAME: *ppszValue = REGVAL_ULS_FIRST_NAME; break;
  621. case NM_SYSPROP_LAST_NAME: *ppszValue = REGVAL_ULS_LAST_NAME; break;
  622. case NM_SYSPROP_USER_NAME: *ppszValue = REGVAL_ULS_NAME; break;
  623. case NM_SYSPROP_USER_COMMENTS: *ppszValue = REGVAL_ULS_COMMENTS_NAME; break;
  624. case NM_SYSPROP_USER_CITY: *ppszValue = REGVAL_ULS_LOCATION_NAME; break;
  625. case NM_SYSPROP_H323_GATEWAY:
  626. *ppszSubKey = AUDIO_KEY;
  627. *ppszValue = REGVAL_H323_GATEWAY;
  628. break;
  629. case NM_SYSPROP_H323_GATEWAY_ENABLE:
  630. *ppszSubKey = AUDIO_KEY;
  631. *ppszValue = REGVAL_USE_H323_GATEWAY;
  632. *pfString = FALSE;
  633. break;
  634. case NM_SYSPROP_INSTALL_DIRECTORY:
  635. *phkey = HKEY_LOCAL_MACHINE;
  636. *ppszSubKey = CONFERENCING_KEY;
  637. *ppszValue = REGVAL_INSTALL_DIR;
  638. break;
  639. case NM_SYSPROP_APP_NAME:
  640. *phkey = HKEY_LOCAL_MACHINE;
  641. *ppszSubKey = CONFERENCING_KEY;
  642. *ppszValue = REGVAL_NC_NAME;
  643. break;
  644. default:
  645. WARNING_OUT(("GetKeyDataForProp - invalid argument %d", uProp));
  646. bRet = false;
  647. break;
  648. } /* switch (uProp) */
  649. DBGEXIT_BOOL(CNmSysInfoObj::GetKeyDataForProp,bRet ? TRUE : FALSE);
  650. return bRet;
  651. }
  652. /*static*/ void CNmSysInfoObj::_GetSzKeyForGuid(LPTSTR psz, REFGUID rguid)
  653. {
  654. DBGENTRY(CNmSysInfoObj::_GetSzKeyForGuid);
  655. lstrcpy(psz, GUID_KEY "\\");
  656. GuidToSz((GUID *) &rguid, &psz[lstrlen(psz)]);
  657. DBGEXIT(CNmSysInfoObj::_GetSzKeyForGuid);
  658. }
  659. HRESULT CNmSysInfoObj::_EnsureConfHook(void)
  660. {
  661. HRESULT hr = S_OK;
  662. if(!m_spConfHook)
  663. {
  664. hr = CoCreateInstance(CLSID_NmManager, NULL, CLSCTX_ALL, IID_IInternalConfExe, reinterpret_cast<void**>(&m_spConfHook));
  665. if(SUCCEEDED(hr))
  666. {
  667. m_spConfHook->SetSysInfoID(m_dwID);
  668. }
  669. }
  670. return hr;
  671. }