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.

802 lines
20 KiB

  1. #include "shellprv.h"
  2. #include "ids.h"
  3. #include "apdlg.h"
  4. #include "hwcmmn.h"
  5. #include "mtpt.h"
  6. static const DWORD s_rgdwHelpIDsArray[] =
  7. {
  8. IDC_AP_TOPTEXT, IDH_SELECT_CONTENT_TYPE,
  9. IDC_AP_LIST, IDH_SELECT_CONTENT_TYPE,
  10. IDC_AP_DEFAULTHANDLER, IDH_SELECT_ACTION,
  11. IDC_AP_LIST_ACTIONS, IDH_SELECT_ACTION,
  12. IDC_AP_PROMPTEACHTIME, IDH_PROMPT_ME_EACH_TIME,
  13. IDC_AP_NOACTION, IDH_TAKE_NO_ACTION,
  14. 0, 0
  15. };
  16. static const DWORD g_rgdwContentTypes[] =
  17. {
  18. CT_AUTOPLAYMUSIC ,
  19. CT_AUTOPLAYPIX ,
  20. CT_AUTOPLAYMOVIE ,
  21. CT_AUTOPLAYMIXEDCONTENT ,
  22. CT_CDAUDIO ,
  23. CT_DVDMOVIE ,
  24. CT_BLANKCDR , // could also have been: CT_BLANKCDRW
  25. };
  26. #define COL_ACTION 0
  27. #define COL_PROVIDER 1
  28. const UINT c_auTileColumns[] = {COL_ACTION, COL_PROVIDER};
  29. const UINT c_auTileSubItems[] = {COL_PROVIDER};
  30. HRESULT CAutoPlayDlg::_InitListViewActions()
  31. {
  32. HWND hwndList = GetDlgItem(_hwnd, IDC_AP_LIST_ACTIONS);
  33. HRESULT hr = _uilListViewActions.Init(hwndList);
  34. if (SUCCEEDED(hr))
  35. {
  36. hr = _uilListViewActions.InitTileInfo(c_auTileSubItems, ARRAYSIZE(c_auTileSubItems));
  37. if (SUCCEEDED(hr))
  38. {
  39. RECT rc = {0};
  40. LVTILEVIEWINFO lvtvi = {0};
  41. HIMAGELIST himagelist;
  42. ListView_SetView(hwndList, LV_VIEW_TILE);
  43. for (int i = 0; i < ARRAYSIZE(c_auTileColumns); ++i)
  44. {
  45. LVCOLUMN lvcolumn = {0};
  46. lvcolumn.mask = LVCF_SUBITEM;
  47. lvcolumn.iSubItem = c_auTileColumns[i];
  48. ListView_InsertColumn(hwndList, i, &lvcolumn);
  49. }
  50. GetClientRect(hwndList, &rc);
  51. lvtvi.cbSize = sizeof(lvtvi);
  52. lvtvi.dwMask = LVTVIM_TILESIZE | LVTVIM_COLUMNS;
  53. lvtvi.dwFlags = LVTVIF_FIXEDWIDTH;
  54. // Leave room for the scroll bar when setting tile sizes or listview gets screwed up.
  55. lvtvi.sizeTile.cx = ((rc.right - rc.left) - GetSystemMetrics(SM_CXVSCROLL));
  56. lvtvi.cLines = ARRAYSIZE(c_auTileSubItems);
  57. ListView_SetTileViewInfo(hwndList, &lvtvi);
  58. Shell_GetImageLists(&himagelist, NULL);
  59. if (himagelist)
  60. {
  61. ListView_SetImageList(hwndList, himagelist, LVSIL_NORMAL);
  62. hr = S_OK;
  63. }
  64. }
  65. }
  66. return hr;
  67. }
  68. HRESULT CAutoPlayDlg::_FillListViewActions(CContentTypeData* pdata)
  69. {
  70. HRESULT hr = _uilListViewActions.ResetContent();
  71. if (SUCCEEDED(hr))
  72. {
  73. int c = pdata->GetHandlerCount();
  74. if (c)
  75. {
  76. for (int i = 0; SUCCEEDED(hr) && (i < c); ++i)
  77. {
  78. CHandlerData* phandlerdata = pdata->GetHandlerData(i);
  79. if (phandlerdata)
  80. {
  81. CHandlerLVItem* puidata = new CHandlerLVItem();
  82. if (puidata)
  83. {
  84. hr = puidata->InitData(phandlerdata);
  85. if (SUCCEEDED(hr))
  86. {
  87. hr = _uilListViewActions.AddItem(puidata);
  88. if (FAILED(hr))
  89. {
  90. delete puidata;
  91. }
  92. }
  93. }
  94. else
  95. {
  96. hr = E_OUTOFMEMORY;
  97. }
  98. phandlerdata->Release();
  99. }
  100. }
  101. _fAtLeastOneAction = TRUE;
  102. }
  103. else
  104. {
  105. // disable the listview and its radio button
  106. _fAtLeastOneAction = FALSE;
  107. }
  108. }
  109. return hr;
  110. }
  111. HRESULT CAutoPlayDlg::_UpdateRestoreButton(BOOL fPromptEachTime)
  112. {
  113. BOOL fEnable;
  114. if (fPromptEachTime)
  115. {
  116. fEnable = FALSE;
  117. }
  118. else
  119. {
  120. fEnable = TRUE;
  121. }
  122. EnableWindow(GetDlgItem(_hwnd, IDC_AP_RESTOREDEFAULTS), fEnable);
  123. return fEnable;
  124. }
  125. HRESULT CAutoPlayDlg::_UpdateLowerPane()
  126. {
  127. CContentTypeData* pdata;
  128. HRESULT hr = _uilListView.GetSelectedItemData(&pdata);
  129. _fIgnoreListViewItemStateChanges = TRUE;
  130. if (SUCCEEDED(hr))
  131. {
  132. BOOL fPromptEachTime = !lstrcmpi(pdata->_pszHandlerDefault, TEXT("MSPromptEachTime"));
  133. if (!fPromptEachTime)
  134. {
  135. if (!(pdata->_dwHandlerDefaultFlags & HANDLERDEFAULT_USERCHOSENDEFAULT))
  136. {
  137. // There *NO* User Chosen Default
  138. fPromptEachTime = TRUE;
  139. }
  140. else
  141. {
  142. // There is a User Chosen Default
  143. if (pdata->_dwHandlerDefaultFlags &
  144. HANDLERDEFAULT_MORERECENTHANDLERSINSTALLED)
  145. {
  146. // But there's also more recent apps
  147. fPromptEachTime = TRUE;
  148. }
  149. }
  150. }
  151. hr = _FillListViewActions(pdata);
  152. if (SUCCEEDED(hr))
  153. {
  154. hr = _SelectListViewActionsItem(pdata->_pszHandlerDefault);
  155. }
  156. if (SUCCEEDED(hr))
  157. {
  158. hr = _SelectRadioButton(fPromptEachTime);
  159. }
  160. if (SUCCEEDED(hr))
  161. {
  162. hr = _UpdateRestoreButton(fPromptEachTime);
  163. }
  164. pdata->Release();
  165. }
  166. _fIgnoreListViewItemStateChanges = FALSE;
  167. return hr;
  168. }
  169. HRESULT CAutoPlayDlg::_UpdateApplyButton()
  170. {
  171. if (_dlmanager.IsDirty())
  172. {
  173. PropSheet_Changed(GetParent(_hwnd), _hwnd);
  174. }
  175. else
  176. {
  177. PropSheet_UnChanged(GetParent(_hwnd), _hwnd);
  178. }
  179. return S_OK;
  180. }
  181. HRESULT _SetHandlerDefault(LPWSTR* ppszHandlerDefault, LPCWSTR pszHandler)
  182. {
  183. LPWSTR pszHandlerNew;
  184. HRESULT hr = SHStrDup(pszHandler, &pszHandlerNew);
  185. if (SUCCEEDED(hr))
  186. {
  187. if (*ppszHandlerDefault)
  188. {
  189. CoTaskMemFree(*ppszHandlerDefault);
  190. }
  191. *ppszHandlerDefault = pszHandlerNew;
  192. }
  193. return hr;
  194. }
  195. HRESULT CAutoPlayDlg::_SelectRadioButton(BOOL fPromptEachTime)
  196. {
  197. CContentTypeData* pdata;
  198. HRESULT hr = _uilListView.GetSelectedItemData(&pdata);
  199. if (SUCCEEDED(hr))
  200. {
  201. int iCtrl;
  202. BOOL fEnableListView = FALSE;
  203. if (fPromptEachTime)
  204. {
  205. _SetHandlerDefault(&(pdata->_pszHandlerDefault), TEXT("MSPromptEachTime"));
  206. iCtrl = IDC_AP_PROMPTEACHTIME;
  207. }
  208. else
  209. {
  210. fEnableListView = TRUE;
  211. CHandlerData* phandlerdata;
  212. hr = _uilListViewActions.GetSelectedItemData(&phandlerdata);
  213. if (SUCCEEDED(hr))
  214. {
  215. _SetHandlerDefault(&(pdata->_pszHandlerDefault), phandlerdata->_pszHandler);
  216. phandlerdata->Release();
  217. }
  218. iCtrl = IDC_AP_DEFAULTHANDLER;
  219. }
  220. Button_SetCheck(GetDlgItem(_hwnd, IDC_AP_DEFAULTHANDLER), (IDC_AP_DEFAULTHANDLER == iCtrl));
  221. Button_SetCheck(GetDlgItem(_hwnd, IDC_AP_PROMPTEACHTIME), (IDC_AP_PROMPTEACHTIME == iCtrl));
  222. EnableWindow(GetDlgItem(_hwnd, IDC_AP_LIST_ACTIONS), fEnableListView);
  223. pdata->Release();
  224. hr = _UpdateApplyButton();
  225. }
  226. return hr;
  227. }
  228. HRESULT CAutoPlayDlg::_SelectListViewActionsItem(LPCWSTR pszHandlerDefault)
  229. {
  230. HRESULT hr = S_FALSE;
  231. LVITEM lvitem = {0};
  232. int iItemToSelect = 0;
  233. HWND hwndList = GetDlgItem(_hwnd, IDC_AP_LIST_ACTIONS);
  234. if (pszHandlerDefault)
  235. {
  236. int c = ListView_GetItemCount(hwndList);
  237. if (c)
  238. {
  239. int i;
  240. for (i = 0; i < c; ++i)
  241. {
  242. lvitem.mask = LVIF_PARAM;
  243. lvitem.iItem = i;
  244. if (ListView_GetItem(hwndList, &lvitem))
  245. {
  246. CHandlerLVItem* phandleruidata = (CHandlerLVItem*)lvitem.lParam;
  247. if (phandleruidata)
  248. {
  249. CHandlerData* phandlerdata = phandleruidata->GetData();
  250. if (phandlerdata)
  251. {
  252. if (!lstrcmp(phandlerdata->_pszHandler,
  253. pszHandlerDefault))
  254. {
  255. break;
  256. }
  257. phandlerdata->Release();
  258. }
  259. }
  260. }
  261. }
  262. if (i == c)
  263. {
  264. i = 0;
  265. }
  266. else
  267. {
  268. hr = S_OK;
  269. }
  270. iItemToSelect = i;
  271. }
  272. }
  273. else
  274. {
  275. // Select first one
  276. hr = S_OK;
  277. }
  278. lvitem.mask = LVIF_STATE;
  279. lvitem.iItem = iItemToSelect;
  280. lvitem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
  281. lvitem.state = LVIS_SELECTED | LVIS_FOCUSED;
  282. ListView_SetItem(hwndList, &lvitem);
  283. ListView_EnsureVisible(hwndList, lvitem.iItem, FALSE);
  284. return hr;
  285. }
  286. LRESULT CAutoPlayDlg::_OnApply()
  287. {
  288. if (_dlmanager.IsDirty())
  289. {
  290. // Should we get the return value, and if so, why?
  291. _dlmanager.Commit();
  292. }
  293. return PSNRET_NOERROR;
  294. }
  295. // Listview Actions
  296. HRESULT CAutoPlayDlg::_OnListViewActionsSelChange()
  297. {
  298. CHandlerData* phandlerdata;
  299. HRESULT hr = _uilListViewActions.GetSelectedItemData(&phandlerdata);
  300. if (SUCCEEDED(hr))
  301. {
  302. CContentTypeData* pdata;
  303. hr = _uilListView.GetSelectedItemData(&pdata);
  304. if (SUCCEEDED(hr))
  305. {
  306. _SetHandlerDefault(&(pdata->_pszHandlerDefault), phandlerdata->_pszHandler);
  307. pdata->Release();
  308. }
  309. phandlerdata->Release();
  310. }
  311. if (SUCCEEDED(hr))
  312. {
  313. hr = _UpdateApplyButton();
  314. }
  315. return hr;
  316. }
  317. // Radio buttons
  318. HRESULT CAutoPlayDlg::_OnRestoreDefault()
  319. {
  320. CContentTypeData* pdata;
  321. HRESULT hr = _uilListView.GetSelectedItemData(&pdata);
  322. if (SUCCEEDED(hr))
  323. {
  324. _SetHandlerDefault(&(pdata->_pszHandlerDefault), TEXT("MSPromptEachTime"));
  325. _SelectRadioButton(TRUE);
  326. hr = _UpdateApplyButton();
  327. if (SUCCEEDED(hr))
  328. {
  329. _UpdateRestoreButton(TRUE);
  330. }
  331. pdata->Release();
  332. SetFocus(GetNextDlgTabItem(_hwnd, GetDlgItem(_hwnd, IDC_AP_RESTOREDEFAULTS), FALSE /*next ctrl*/));
  333. }
  334. return hr;
  335. }
  336. HRESULT CAutoPlayDlg::_OnRadio(int iButton)
  337. {
  338. CContentTypeData* pdata;
  339. HRESULT hr = _uilListView.GetSelectedItemData(&pdata);
  340. if (SUCCEEDED(hr))
  341. {
  342. HWND hwndList = GetDlgItem(_hwnd, IDC_AP_LIST_ACTIONS);
  343. if (IDC_AP_DEFAULTHANDLER == iButton)
  344. {
  345. CHandlerData* phandlerdata;
  346. EnableWindow(hwndList, TRUE);
  347. hr = _uilListViewActions.GetSelectedItemData(&phandlerdata);
  348. if (SUCCEEDED(hr))
  349. {
  350. _SetHandlerDefault(&(pdata->_pszHandlerDefault), phandlerdata->_pszHandler);
  351. phandlerdata->Release();
  352. }
  353. }
  354. else
  355. {
  356. _SetHandlerDefault(&(pdata->_pszHandlerDefault), TEXT("MSPromptEachTime"));
  357. EnableWindow(hwndList, FALSE);
  358. }
  359. hr = _UpdateApplyButton();
  360. if (SUCCEEDED(hr))
  361. {
  362. _UpdateRestoreButton(!lstrcmpi(pdata->_pszHandlerDefault, TEXT("MSPromptEachTime")));
  363. }
  364. pdata->Release();
  365. }
  366. return hr;
  367. }
  368. LRESULT CAutoPlayDlg::OnInitDialog(WPARAM wParam, LPARAM lParam)
  369. {
  370. HRESULT hr = _InitDataObjects();
  371. _fIgnoreListViewItemStateChanges = TRUE;
  372. if (SUCCEEDED(hr))
  373. {
  374. hr = _InitListView();
  375. if (SUCCEEDED(hr))
  376. {
  377. hr = _FillListView();
  378. if (SUCCEEDED(hr))
  379. {
  380. hr = _InitListViewActions();
  381. if (SUCCEEDED(hr))
  382. {
  383. hr = _uilListView.SelectFirstItem();
  384. if (SUCCEEDED(hr))
  385. {
  386. hr = _UpdateLowerPane();
  387. }
  388. }
  389. }
  390. }
  391. }
  392. _fIgnoreListViewItemStateChanges = FALSE;
  393. return TRUE;
  394. }
  395. LRESULT CAutoPlayDlg::OnNotify(WPARAM wParam, LPARAM lParam)
  396. {
  397. LRESULT lRes = FALSE;
  398. LPNMHDR pNMHDR = (LPNMHDR)lParam;
  399. UINT_PTR idFrom = pNMHDR->idFrom;
  400. UINT uCode = pNMHDR->code;
  401. switch (uCode)
  402. {
  403. case PSN_APPLY:
  404. lRes = _OnApply();
  405. CBaseDlg::OnNotify(wParam, lParam);
  406. break;
  407. default:
  408. switch (idFrom)
  409. {
  410. case IDC_AP_LIST_ACTIONS:
  411. if (!_fIgnoreListViewItemStateChanges)
  412. {
  413. NMLISTVIEW* pNMLV = (NMLISTVIEW*)pNMHDR;
  414. if (LVN_ITEMCHANGED == uCode)
  415. {
  416. // Is a new item being selected?
  417. if ((pNMLV->uChanged & LVIF_STATE) &&
  418. pNMLV->uNewState & LVIS_SELECTED)
  419. {
  420. _OnListViewActionsSelChange();
  421. }
  422. }
  423. }
  424. lRes = CBaseDlg::OnNotify(wParam, lParam);
  425. break;
  426. default:
  427. lRes = CBaseDlg::OnNotify(wParam, lParam);
  428. break;
  429. }
  430. break;
  431. }
  432. return lRes;
  433. }
  434. LRESULT CAutoPlayDlg::OnCommand(WPARAM wParam, LPARAM lParam)
  435. {
  436. int iCtl = LOWORD(wParam);
  437. int iNot = HIWORD(wParam);
  438. switch (iCtl)
  439. {
  440. case IDC_AP_DEFAULTHANDLER:
  441. case IDC_AP_PROMPTEACHTIME:
  442. if (BN_CLICKED == iNot)
  443. {
  444. _OnRadio(iCtl);
  445. }
  446. break;
  447. case IDC_AP_LIST:
  448. if (HIWORD(wParam) == CBN_SELCHANGE)
  449. {
  450. _UpdateLowerPane();
  451. }
  452. break;
  453. case IDC_AP_RESTOREDEFAULTS:
  454. if (BN_CLICKED == iNot)
  455. {
  456. _OnRestoreDefault();
  457. }
  458. break;
  459. }
  460. return CBaseDlg::OnCommand(wParam, lParam);
  461. }
  462. LRESULT CAutoPlayDlg::OnDestroy(WPARAM wParam, LPARAM lParam)
  463. {
  464. _uilListView.ResetContent();
  465. _uilListViewActions.ResetContent();
  466. return CBaseDlg::OnDestroy(wParam, lParam);
  467. }
  468. LRESULT CAutoPlayDlg::OnHelp(WPARAM wParam, LPARAM lParam)
  469. {
  470. HWND hwndItem = (HWND)((LPHELPINFO)lParam)->hItemHandle;
  471. BOOL ret = WinHelp(hwndItem, TEXT("filefold.hlp"), HELP_WM_HELP, (ULONG_PTR)(LPTSTR)s_rgdwHelpIDsArray);
  472. if (!ret)
  473. {
  474. return CBaseDlg::OnHelp(wParam, lParam);
  475. }
  476. return ret;
  477. }
  478. LRESULT CAutoPlayDlg::OnContextMenu(WPARAM wParam, LPARAM lParam)
  479. {
  480. BOOL lRes=FALSE;
  481. if (HTCLIENT == (int)SendMessage(_hwnd, WM_NCHITTEST, 0, lParam))
  482. {
  483. POINT pt;
  484. HWND hwndItem = NULL;
  485. int iCtrlID = 0;
  486. pt.x = GET_X_LPARAM(lParam);
  487. pt.y = GET_Y_LPARAM(lParam);
  488. ScreenToClient(_hwnd, &pt);
  489. hwndItem = ChildWindowFromPoint(_hwnd, pt);
  490. iCtrlID = GetDlgCtrlID(hwndItem);
  491. lRes = WinHelp((HWND)wParam, TEXT("filefold.hlp"), HELP_CONTEXTMENU, (ULONG_PTR)(LPTSTR)s_rgdwHelpIDsArray);
  492. if (!lRes)
  493. {
  494. return CBaseDlg::OnContextMenu(wParam, lParam);
  495. }
  496. }
  497. else
  498. {
  499. lRes = FALSE;
  500. }
  501. return lRes;
  502. }
  503. CAutoPlayDlg::CAutoPlayDlg() : CBaseDlg((ULONG_PTR)s_rgdwHelpIDsArray)
  504. {
  505. ASSERT(ARRAYSIZE(_rgpContentTypeData) >= ARRAYSIZE(g_rgdwContentTypes));
  506. }
  507. HRESULT CAutoPlayDlg::Init(LPWSTR pszDrive, int iDriveType)
  508. {
  509. _iDriveType = iDriveType;
  510. return StringCchCopy(_szDrive, ARRAYSIZE(_szDrive), pszDrive);
  511. }
  512. HRESULT CAutoPlayDlg::_InitDataObjects()
  513. {
  514. HRESULT hr = S_FALSE;
  515. BOOL fIsCDDrive = FALSE;
  516. DWORD dwDriveCapabilities = HWDDC_CDROM;
  517. DWORD dwMediaCapabilities = HWDMC_CDROM;
  518. CMountPoint* pmtpt = CMountPoint::GetMountPoint(_szDrive);
  519. if (pmtpt)
  520. {
  521. fIsCDDrive = pmtpt->IsCDROM();
  522. if (fIsCDDrive)
  523. {
  524. hr = pmtpt->GetCDInfo(&dwDriveCapabilities, &dwMediaCapabilities);
  525. }
  526. pmtpt->Release();
  527. }
  528. for (DWORD dw = 0; SUCCEEDED(hr) && (dw < ARRAYSIZE(g_rgdwContentTypes));
  529. ++dw)
  530. {
  531. BOOL fAddOption = TRUE;
  532. if (fIsCDDrive)
  533. {
  534. if ((g_rgdwContentTypes[dw] & CT_DVDMOVIE) &&
  535. !(dwDriveCapabilities & (HWDDC_DVDROM | HWDDC_DVDRECORDABLE | HWDDC_DVDREWRITABLE)))
  536. {
  537. fAddOption = FALSE;
  538. }
  539. else if ((g_rgdwContentTypes[dw] & CT_BLANKCDR) &&
  540. !(dwDriveCapabilities & (HWDDC_CDRECORDABLE | HWDDC_CDREWRITABLE)))
  541. {
  542. fAddOption = FALSE;
  543. }
  544. }
  545. else
  546. {
  547. if (g_rgdwContentTypes[dw] &
  548. (CT_CDAUDIO | CT_DVDMOVIE | CT_BLANKCDR))
  549. {
  550. fAddOption = FALSE;
  551. }
  552. }
  553. if (fAddOption)
  554. {
  555. _rgpContentTypeData[dw] = new CContentTypeData();
  556. if (_rgpContentTypeData[dw])
  557. {
  558. hr = (_rgpContentTypeData[dw])->Init(_szDrive, g_rgdwContentTypes[dw]);
  559. if (SUCCEEDED(hr))
  560. {
  561. hr = _dlmanager.AddDataObject(_rgpContentTypeData[dw]);
  562. }
  563. else
  564. {
  565. // Let's just skip this one, do not go out of the loop and
  566. // abort the whole initialization.
  567. hr = S_FALSE;
  568. }
  569. }
  570. else
  571. {
  572. hr = E_OUTOFMEMORY;
  573. }
  574. }
  575. }
  576. return hr;
  577. }
  578. HRESULT CAutoPlayDlg::_InitListView()
  579. {
  580. HWND hwndList = GetDlgItem(_hwnd, IDC_AP_LIST);
  581. HRESULT hr = _uilListView.Init(hwndList);
  582. if (SUCCEEDED(hr))
  583. {
  584. Shell_GetImageLists(NULL, &_himagelist);
  585. if (_himagelist)
  586. {
  587. SendMessage(hwndList, CBEM_SETIMAGELIST, 0, (LPARAM)_himagelist);
  588. hr = S_OK;
  589. }
  590. }
  591. return hr;
  592. }
  593. HRESULT CAutoPlayDlg::_FillListView()
  594. {
  595. HRESULT hr = S_FALSE;
  596. for (DWORD dw = 0; SUCCEEDED(hr) && (dw < ARRAYSIZE(_rgpContentTypeData));
  597. ++dw)
  598. {
  599. if (_rgpContentTypeData[dw])
  600. {
  601. CContentTypeCBItem* pctlvitem = new CContentTypeCBItem();
  602. if (pctlvitem)
  603. {
  604. hr = pctlvitem->InitData(_rgpContentTypeData[dw]);
  605. if (SUCCEEDED(hr))
  606. {
  607. hr = _uilListView.AddItem(pctlvitem);
  608. }
  609. if (FAILED(hr))
  610. {
  611. delete pctlvitem;
  612. }
  613. }
  614. else
  615. {
  616. hr = E_OUTOFMEMORY;
  617. }
  618. }
  619. }
  620. return hr;
  621. }
  622. CAutoPlayDlg::~CAutoPlayDlg()
  623. {
  624. for (DWORD dw = 0; dw < ARRAYSIZE(_rgpContentTypeData); ++dw)
  625. {
  626. if (_rgpContentTypeData[dw])
  627. {
  628. (_rgpContentTypeData[dw])->Release();
  629. }
  630. }
  631. #ifdef AUTOPLAYDLG_LEAKPARANOIA
  632. // If this is on, you cannot open two Autoplay dialogs (e.g.: Autoplay
  633. // proppage and Autoplay prompt) at the same time and then close one.
  634. // It will assert for sure when you close the first one.
  635. ASSERT(!_DbgLocalAllocCount);
  636. #endif
  637. }