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.

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