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.

1424 lines
42 KiB

  1. #include "precomp.h"
  2. #include "resource.h"
  3. #include "PropWnd2.h"
  4. #include "WndProcs.h"
  5. #include "nmakwiz.h"
  6. #include "nmakreg.h"
  7. #include <algorithm>
  8. const int CPropertyDataWindow2::mcs_iTop = 0;
  9. const int CPropertyDataWindow2::mcs_iLeft = 150;
  10. const int CPropertyDataWindow2::mcs_iBorder = 15;
  11. /* static */ map< UINT, CPolicyData::eKeyType > CPropertyDataWindow2::ms_ClassMap;
  12. /* static */ map< UINT, TCHAR* > CPropertyDataWindow2::ms_KeyMap;
  13. /* static */ map< UINT, TCHAR* > CPropertyDataWindow2::ms_ValueMap;
  14. LRESULT CALLBACK DefaultProc( HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
  15. {
  16. switch( iMsg )
  17. {
  18. case WM_VSCROLL:
  19. {
  20. OnMsg_VScroll( hwnd, wParam );
  21. return 0;
  22. break;
  23. }
  24. case WM_COMMAND:
  25. {
  26. return 0;
  27. }
  28. }
  29. return( DefWindowProc( hwnd, iMsg, wParam, lParam ) );
  30. }
  31. CPropertyDataWindow2::CPropertyDataWindow2( HWND hwndParent, UINT uIDD, LPTSTR szClassName, UINT PopUpHelpMenuTextId, int iX, int iY, int iWidth, int iHeight, BOOL bScroll ) :
  32. m_hwnd( NULL ),
  33. m_IDD( uIDD ),
  34. m_wndProc( (WNDPROC) DefaultProc),
  35. m_bInit( FALSE ),
  36. m_hwndParent( hwndParent )
  37. {
  38. m_szClassName = new TCHAR[ lstrlen( szClassName ) + 1 ];
  39. lstrcpy( m_szClassName, szClassName );
  40. _InitWindow();
  41. _SizeWindow( iX, iY, iWidth, iHeight );
  42. if( bScroll )
  43. {
  44. _PrepScrollBars();
  45. }
  46. ShowWindow( FALSE );
  47. }
  48. CPropertyDataWindow2::CPropertyDataWindow2( HWND hwndParent, UINT uIDD, LPTSTR szClassName, WNDPROC wndProc, UINT PopUpHelpMenuTextId, int iX, int iY, int iWidth, int iHeight, BOOL bScroll ) :
  49. m_IDD( uIDD ),
  50. m_hwnd( NULL ),
  51. m_wndProc( wndProc ),
  52. m_bInit( FALSE ),
  53. m_hwndParent( hwndParent )
  54. {
  55. m_szClassName = new TCHAR[ lstrlen( szClassName ) + 1 ];
  56. lstrcpy( m_szClassName, szClassName );
  57. _InitWindow();
  58. _SizeWindow( iX, iY, iWidth, iHeight );
  59. if( bScroll )
  60. {
  61. _PrepScrollBars();
  62. }
  63. ShowWindow( FALSE );
  64. }
  65. CPropertyDataWindow2::~CPropertyDataWindow2( void )
  66. {
  67. delete [] m_szClassName;
  68. list< CControlID * >::iterator it;
  69. for( it = m_condList.begin(); it != m_condList.end(); it++ )
  70. {
  71. delete *it;
  72. }
  73. for( it = m_specialControlList.begin(); it != m_specialControlList.end(); it++ )
  74. {
  75. delete *it;
  76. }
  77. }
  78. void CPropertyDataWindow2::Reset()
  79. {
  80. list< HWND >::iterator i;
  81. for( i = m_enableList.begin(); i != m_enableList.end(); i++ )
  82. {
  83. switch (GetWindowLong(*i, GWL_STYLE) & 0x0F)
  84. {
  85. case BS_AUTORADIOBUTTON:
  86. case BS_RADIOBUTTON:
  87. // Do nothing -- we always want default item checked
  88. break;
  89. default:
  90. Button_SetCheck(*i, FALSE);
  91. break;
  92. }
  93. }
  94. list< CControlID * >::iterator it;
  95. for( it = m_condList.begin(); it != m_condList.end(); it++ )
  96. {
  97. (*it)->Reset( m_hwnd );
  98. }
  99. for( it = m_specialControlList.begin(); it != m_specialControlList.end(); it++ )
  100. {
  101. (*it)->Reset( m_hwnd );
  102. }
  103. }
  104. void CPropertyDataWindow2::SetEnableListID( UINT uCount, ... )
  105. {
  106. UINT uID;
  107. HWND hwnd;
  108. va_list ap;
  109. va_start( ap, uCount );
  110. while( uCount )
  111. {
  112. uID = va_arg( ap, UINT );
  113. uCount--;
  114. if( NULL == ( hwnd = GetDlgItem( m_hwnd, uID ) ) )
  115. {
  116. OutputDebugString( TEXT("Enabling Invalid ID\n") );
  117. }
  118. else
  119. {
  120. m_checkIDList.push_front( uID );
  121. m_enableList.push_front( hwnd );
  122. }
  123. }
  124. va_end( ap );
  125. }
  126. BOOL CPropertyDataWindow2::SetFocus( UINT id )
  127. {
  128. return ::SetFocus( GetDlgItem( m_hwnd, id ) ) ? TRUE : FALSE;
  129. }
  130. void CPropertyDataWindow2::SetEditData( UINT id, TCHAR* sz )
  131. {
  132. Edit_SetText( GetDlgItem( m_hwnd, id ), sz );
  133. }
  134. void CPropertyDataWindow2::GetEditData( UINT id, LPTSTR sz, ULONG cb ) const
  135. {
  136. Edit_GetText( GetDlgItem( m_hwnd, id ), sz, cb );
  137. }
  138. ULONG CPropertyDataWindow2::GetEditDataLen( UINT id ) const
  139. {
  140. return Edit_GetTextLength( GetDlgItem( m_hwnd, id ) );
  141. }
  142. BOOL CPropertyDataWindow2::GetCheck( UINT id ) const
  143. {
  144. return(Button_GetCheck( GetDlgItem( m_hwnd, id ) ) ? TRUE : FALSE);
  145. }
  146. void CPropertyDataWindow2::SetCheck( UINT id, BOOL bCheck )
  147. {
  148. Button_SetCheck( GetDlgItem( m_hwnd, id ), bCheck );
  149. }
  150. void CPropertyDataWindow2::ShowWindow( BOOL bShowWindow /* = TRUE */ )
  151. {
  152. ::ShowWindow( m_hwnd, bShowWindow ? SW_SHOW : SW_HIDE );
  153. }
  154. void CPropertyDataWindow2::EnableWindow( BOOL bEnable /* = TRUE */ )
  155. {
  156. list< HWND >::const_iterator it;
  157. for (it = m_enableList.begin(); it != m_enableList.end(); ++it)
  158. {
  159. ::EnableWindow( (HWND)(*it), bEnable );
  160. }
  161. if( m_specialControlList.size() )
  162. {
  163. list< CControlID * >::const_iterator iter;
  164. for( iter = m_specialControlList.begin();
  165. iter != m_specialControlList.end();
  166. iter++ )
  167. {
  168. switch( (*iter)->GetType() )
  169. {
  170. case CControlID::CHECK:
  171. case CControlID::SLIDER:
  172. case CControlID::EDIT:
  173. case CControlID::EDIT_NUM:
  174. case CControlID::STATIC:
  175. case CControlID::COMBO:
  176. {
  177. HWND hwnd = GetDlgItem( m_hwnd, (*iter)->GetID() );
  178. ::EnableWindow( hwnd, bEnable );
  179. break;
  180. }
  181. default:
  182. OutputDebugString( TEXT("CPropertyDataWindow2::EnableWindow: unknown CControlID::type\n") );
  183. assert( 0 );
  184. break;
  185. }
  186. }
  187. }
  188. if( m_condList.size() )
  189. {
  190. list< CControlID * >::const_iterator iter;
  191. for( iter = m_condList.begin();
  192. iter != m_condList.end();
  193. iter++ )
  194. {
  195. ::EnableWindow( (*iter)->GetCondHwnd(), bEnable );
  196. }
  197. }
  198. }
  199. BOOL CPropertyDataWindow2::_InitWindow( void )
  200. {
  201. if( FALSE == m_bInit )
  202. {
  203. WNDCLASSEX wc;
  204. ZeroMemory( &wc, sizeof( WNDCLASSEX ) );
  205. wc . cbSize = sizeof( WNDCLASSEX );
  206. wc . style = 0;
  207. wc . cbWndExtra = DLGWINDOWEXTRA;
  208. wc . hInstance = g_hInstance;
  209. wc . lpfnWndProc = m_wndProc;
  210. wc . lpszClassName = m_szClassName;
  211. if( 0 == RegisterClassEx( &wc ) )
  212. {
  213. return FALSE;
  214. }
  215. if( NULL == (m_hwnd = CreateDialogParam( g_hInstance, MAKEINTRESOURCE( m_IDD ), m_hwndParent, NULL/*(DLGPROC)m_wndProc*/, 0 ) ) )
  216. {
  217. ErrorMessage( TEXT("CPropertyDataWindow2::_InitWindow"), GetLastError() );
  218. }
  219. m_bInit = TRUE;
  220. }
  221. return TRUE;
  222. }
  223. BOOL CPropertyDataWindow2::_SizeWindow( int X, int Y, int Width, int Height )
  224. {
  225. GetClientRect( m_hwnd, &m_rect );
  226. return SetWindowPos( m_hwnd, // handle to window
  227. HWND_TOP, // placement-order handle
  228. X, // horizontal position
  229. Y, // vertical position
  230. Width, // width
  231. Height, // height
  232. 0 // window-positioning flags
  233. );
  234. }
  235. void CPropertyDataWindow2::_PrepScrollBars()
  236. {
  237. RECT clientRect;
  238. GetClientRect( m_hwnd, &clientRect );
  239. int iTotalHeight = (m_rect.bottom - m_rect.top);
  240. int iVisible = clientRect.bottom - clientRect.top;
  241. if( iTotalHeight <= iVisible )
  242. {
  243. return;
  244. }
  245. SCROLLINFO ScrollInfo;
  246. ScrollInfo . cbSize = sizeof( SCROLLINFO );
  247. ScrollInfo . fMask = SIF_ALL;
  248. ScrollInfo . nMin = 0;
  249. ScrollInfo . nMax = iTotalHeight;
  250. // Make the scroll bar scroll 4/5th of a screen per page
  251. ScrollInfo . nPage = MulDiv( iVisible, 4, 5 );
  252. ScrollInfo . nPos = 0;
  253. SetScrollInfo( m_hwnd, SB_VERT, &ScrollInfo, 0 );
  254. }
  255. void CPropertyDataWindow2::AddControl( CControlID *pControlID )
  256. {
  257. m_specialControlList.push_front( pControlID );
  258. }
  259. void CPropertyDataWindow2::ConnectControlsToCheck( UINT idCheck, UINT uCount, ... )
  260. {
  261. HWND hwndCheck = GetDlgItem( m_hwnd, idCheck );
  262. PSUBDATA pSubData = new SUBDATA;
  263. pSubData -> proc = SubclassWindow( hwndCheck, wndProcForCheckTiedToEdit );
  264. va_list ap;
  265. va_start( ap, uCount );
  266. while( uCount )
  267. {
  268. uCount--;
  269. CControlID *pControlID = va_arg( ap, CControlID * );
  270. m_condList.push_front( pControlID );
  271. switch( pControlID->GetType() )
  272. {
  273. case CControlID::STATIC:
  274. case CControlID::CHECK:
  275. case CControlID::SLIDER:
  276. case CControlID::EDIT:
  277. case CControlID::EDIT_NUM:
  278. case CControlID::COMBO:
  279. {
  280. HWND hwnd = GetDlgItem( m_hwnd, pControlID->GetID() );
  281. pSubData->list.push_front( hwnd );
  282. break;
  283. }
  284. default:
  285. OutputDebugString( TEXT("CPropertyDataWindow2::ConnectControlsToCheck: unknown CControlID::type\n") );
  286. break;
  287. }
  288. }
  289. SetWindowLong( hwndCheck, GWL_USERDATA, (long)pSubData );
  290. }
  291. BOOL CPropertyDataWindow2::WriteStringValue
  292. (
  293. LPCTSTR szKeyName,
  294. LPCTSTR szValue
  295. )
  296. {
  297. TCHAR szFile[MAX_PATH];
  298. //
  299. // We SAVE settings to the file on the finish page.
  300. //
  301. g_pWiz->m_FinishSheet.GetFilePane()->GetPathAndFile(szFile);
  302. return(WritePrivateProfileString(SECTION_SETTINGS, szKeyName,
  303. szValue, szFile));
  304. }
  305. BOOL CPropertyDataWindow2::WriteNumberValue
  306. (
  307. LPCTSTR szKeyName,
  308. int nValue
  309. )
  310. {
  311. TCHAR szValue[MAX_DIGITS];
  312. TCHAR szFile[MAX_PATH];
  313. //
  314. // We SAVE settings to the file on the finish page.
  315. //
  316. g_pWiz->m_FinishSheet.GetFilePane()->GetPathAndFile(szFile);
  317. wsprintf(szValue, "%d", nValue);
  318. return(WritePrivateProfileString(SECTION_SETTINGS, szKeyName,
  319. szValue, szFile));
  320. }
  321. void CPropertyDataWindow2::ReadStringValue
  322. (
  323. LPCTSTR szKeyName,
  324. LPTSTR szValue,
  325. UINT cchMax
  326. )
  327. {
  328. TCHAR szFile[MAX_PATH];
  329. //
  330. // We READ settings from the file on the intro page.
  331. //
  332. g_pWiz->m_IntroSheet.GetFilePane()->GetPathAndFile(szFile);
  333. GetPrivateProfileString(SECTION_SETTINGS, szKeyName,
  334. TEXT(""), szValue, cchMax, szFile);
  335. }
  336. void CPropertyDataWindow2::ReadNumberValue
  337. (
  338. LPCTSTR szKeyName,
  339. int * pnValue
  340. )
  341. {
  342. TCHAR szFile[MAX_PATH];
  343. //
  344. // We READ settings from the file on the intro page.
  345. //
  346. g_pWiz->m_IntroSheet.GetFilePane()->GetPathAndFile(szFile);
  347. *pnValue = GetPrivateProfileInt(SECTION_SETTINGS, szKeyName,
  348. 0, szFile);
  349. }
  350. void CPropertyDataWindow2::ReadSettings()
  351. {
  352. list< CControlID *>::const_iterator it;
  353. _ReadCheckSettings();
  354. for( it = m_condList.begin(); it != m_condList.end(); it++ )
  355. {
  356. _ReadCheckSetting( (*it)->GetCondID() );
  357. switch( (*it)->GetType() )
  358. {
  359. case CControlID::STATIC:
  360. break;
  361. case CControlID::EDIT:
  362. case CControlID::EDIT_NUM:
  363. _ReadEditSetting( (*it)->GetID() );
  364. break;
  365. case CControlID::CHECK:
  366. _ReadCheckSetting( (*it)->GetID() );
  367. break;
  368. case CControlID::COMBO:
  369. _ReadComboSetting( (*it)->GetID() );
  370. break;
  371. case CControlID::SLIDER:
  372. _ReadSliderSetting( (*it) );
  373. break;
  374. default:
  375. OutputDebugString( TEXT("CPropertyDataWindow2::ReadSettings: unknown CControlID::type\n") );
  376. assert( 0 );
  377. break;
  378. }
  379. }
  380. for( it = m_specialControlList.begin(); it != m_specialControlList.end(); it++ )
  381. {
  382. switch( (*it)->GetType() )
  383. {
  384. case CControlID::STATIC:
  385. break;
  386. case CControlID::EDIT:
  387. case CControlID::EDIT_NUM:
  388. _ReadEditSetting( (*it)->GetID() );
  389. break;
  390. case CControlID::CHECK:
  391. _ReadCheckSetting( (*it)->GetID() );
  392. break;
  393. case CControlID::COMBO:
  394. _ReadComboSetting( (*it)->GetID() );
  395. break;
  396. case CControlID::SLIDER:
  397. _ReadSliderSetting( (*it) );
  398. break;
  399. default:
  400. OutputDebugString( TEXT("CPropertyDataWindow2::ReadSettings: unknown CControlID::type\n") );
  401. assert( 0 );
  402. break;
  403. }
  404. }
  405. }
  406. BOOL CPropertyDataWindow2::WriteSettings()
  407. {
  408. list< CControlID *>::const_iterator it;
  409. _WriteCheckSettings();
  410. for( it = m_condList.begin(); it != m_condList.end(); it++ )
  411. {
  412. _WriteCheckSetting( (*it)->GetCondID() );
  413. switch( (*it)->GetType() )
  414. {
  415. case CControlID::EDIT:
  416. case CControlID::EDIT_NUM:
  417. _WriteEditSetting( (*it)->GetID() );
  418. break;
  419. case CControlID::CHECK:
  420. _WriteCheckSetting( (*it)->GetID() );
  421. break;
  422. case CControlID::COMBO:
  423. _WriteComboSetting( (*it)->GetID() );
  424. break;
  425. case CControlID::SLIDER:
  426. _WriteSliderSetting( (*it)->GetID() );
  427. break;
  428. case CControlID::STATIC:
  429. break;
  430. default:
  431. OutputDebugString( TEXT("CPropertyDataWindow2::WriteSettings: unknown CControlID::type\n") );
  432. assert( 0 );
  433. break;
  434. }
  435. }
  436. for( it = m_specialControlList.begin(); it != m_specialControlList.end(); it++ )
  437. {
  438. switch( (*it)->GetType() )
  439. {
  440. case CControlID::EDIT:
  441. case CControlID::EDIT_NUM:
  442. _WriteEditSetting( (*it)->GetID() );
  443. break;
  444. case CControlID::CHECK:
  445. _WriteCheckSetting( (*it)->GetID() );
  446. break;
  447. case CControlID::COMBO:
  448. _WriteComboSetting( (*it)->GetID() );
  449. break;
  450. case CControlID::SLIDER:
  451. _WriteSliderSetting( (*it)->GetID() );
  452. break;
  453. case CControlID::STATIC:
  454. break;
  455. default:
  456. OutputDebugString( TEXT("CPropertyDataWindow2::WriteSettings: unknown CControlID::type\n") );
  457. assert( 0 );
  458. break;
  459. }
  460. }
  461. return TRUE;
  462. }
  463. void CPropertyDataWindow2::_ReadEditSetting( UINT EditID )
  464. {
  465. TCHAR szKeyName[8];
  466. TCHAR szSetting[512];
  467. wsprintf( szKeyName, TEXT("%d"), EditID );
  468. ReadStringValue(szKeyName, szSetting, CCHMAX(szSetting));
  469. SetEditData(EditID, szSetting);
  470. }
  471. BOOL CPropertyDataWindow2::_WriteEditSetting( UINT EditID )
  472. {
  473. BOOL fSuccess;
  474. int iLen = GetEditDataLen( EditID ) + 1;
  475. LPTSTR szData = new TCHAR[ iLen ];
  476. GetEditData( EditID, szData, iLen );
  477. TCHAR szKeyName[ 8 ];
  478. wsprintf(szKeyName, TEXT("%d"), EditID);
  479. fSuccess = WriteStringValue(szKeyName, szData);
  480. delete [] szData;
  481. return(fSuccess);
  482. }
  483. void CPropertyDataWindow2::_ReadIntSetting( UINT ID, int *pData )
  484. {
  485. TCHAR szKeyName[ 8 ];
  486. wsprintf( szKeyName, TEXT("%d"), ID );
  487. ReadNumberValue(szKeyName, pData);
  488. }
  489. BOOL CPropertyDataWindow2::_WriteIntSetting( UINT ID, int data )
  490. {
  491. TCHAR szKeyName[ 8 ];
  492. wsprintf( szKeyName, TEXT("%d"), ID );
  493. return(WriteNumberValue(szKeyName, data));
  494. }
  495. void CPropertyDataWindow2::_ReadSliderSetting( CControlID *pControlID )
  496. {
  497. int iPos;
  498. UINT ID = pControlID->GetID();
  499. _ReadIntSetting( ID, &iPos);
  500. //
  501. // HACK FOR AV BANDWIDTH -- TrackBars are limited to WORD-sized values
  502. // for range. So the registry has the real value (bits/sec) but we
  503. // represent it in NMRK UI as (kbits/sec).
  504. //
  505. iPos /= 1000;
  506. TrackBar_SetPos( GetDlgItem( m_hwnd, ID ), TRUE, iPos);
  507. TCHAR szPos[ MAX_DIGITS ];
  508. wsprintf( szPos, TEXT("%u"), iPos );
  509. Static_SetText( GetDlgItem( m_hwnd, pControlID->GetStaticID()), szPos );
  510. }
  511. BOOL CPropertyDataWindow2::_WriteSliderSetting( UINT ID )
  512. {
  513. int iPos;
  514. //
  515. // HACK FOR AV BANDWIDTH -- TrackBars are limited to WORD-sized values
  516. // for range. So the registry has the real value (bits/sec) but we
  517. // represent it in NMRK UI as (kbits/sec).
  518. //
  519. iPos = TrackBar_GetPos(GetDlgItem(m_hwnd, ID));
  520. iPos *= 1000;
  521. return _WriteIntSetting( ID, iPos);
  522. }
  523. void CPropertyDataWindow2::_ReadComboSetting( UINT ID )
  524. {
  525. int iSelected;
  526. _ReadIntSetting( ID, &iSelected );
  527. HWND hwndCombo = GetDlgItem( m_hwnd, ID );
  528. ComboBox_SetCurSel( hwndCombo, iSelected );
  529. }
  530. BOOL CPropertyDataWindow2::_WriteComboSetting( UINT ID )
  531. {
  532. return _WriteIntSetting( ID, ComboBox_GetCurSel( GetDlgItem( m_hwnd, ID ) ) );
  533. }
  534. void CPropertyDataWindow2::_ReadCheckSetting( UINT ID )
  535. {
  536. TCHAR szKeyName[ 8 ];
  537. int nValue;
  538. wsprintf( szKeyName, TEXT("%d"), ID );
  539. ReadNumberValue(szKeyName, &nValue);
  540. CheckDlgButton(m_hwnd, ID, nValue);
  541. }
  542. BOOL CPropertyDataWindow2::_WriteCheckSetting( UINT ID )
  543. {
  544. TCHAR szKeyName[ MAX_DIGITS ];
  545. wsprintf( szKeyName, TEXT("%d"), ID );
  546. return(WriteNumberValue(szKeyName, IsDlgButtonChecked(m_hwnd, ID)));
  547. }
  548. void CPropertyDataWindow2::_ReadCheckSettings()
  549. {
  550. for( list< UINT >::const_iterator it = m_checkIDList.begin(); it != m_checkIDList.end(); it++ )
  551. {
  552. _ReadCheckSetting(*it);
  553. }
  554. }
  555. BOOL CPropertyDataWindow2::_WriteCheckSettings()
  556. {
  557. for( list< UINT >::const_iterator it = m_checkIDList.begin(); it != m_checkIDList.end(); it++ )
  558. {
  559. if (!_WriteCheckSetting(*it))
  560. {
  561. return FALSE;
  562. }
  563. }
  564. return TRUE;
  565. }
  566. void CPropertyDataWindow2::MapControlsToRegKeys( void )
  567. {
  568. if( 0 != ms_ValueMap.size() )
  569. {
  570. return;
  571. }
  572. UINT CurrentID;
  573. // File Transfer
  574. CurrentID = IDC_PREVENT_THE_USER_FROM_SENDING_FILES;
  575. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  576. ms_KeyMap[ CurrentID ] = POLICIES_KEY;;
  577. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_FILETRANSFER_SEND;
  578. CurrentID = IDC_PREVENT_THE_USER_FROM_RECEIVING_FILES;
  579. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  580. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  581. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_FILETRANSFER_RECEIVE;
  582. CurrentID = IDC_EDIT_MAXIMUM_SIZE_OF_SENT_FILES;
  583. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  584. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  585. ms_ValueMap[ CurrentID ] = REGVAL_POL_MAX_SENDFILESIZE;
  586. // App Sharing
  587. CurrentID = IDC_DISABLE_ALL_SHARING_FEATURES;
  588. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  589. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  590. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_APP_SHARING;
  591. CurrentID = IDC_DISABLE_WEBDIR;
  592. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  593. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  594. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_WEBDIR;
  595. CurrentID = IDC_DISABLE_WEBDIR_GK;
  596. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  597. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  598. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_WEBDIR;
  599. CurrentID = IDC_PREVENT_SHARING;
  600. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  601. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  602. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_SHARING;
  603. CurrentID = IDC_PREVENT_SHARING_DESKTOP;
  604. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  605. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  606. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_DESKTOP_SHARING;
  607. CurrentID = IDC_PREVENT_SHARING_TRUECOLOR;
  608. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  609. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  610. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_TRUECOLOR_SHARING;
  611. CurrentID = IDC_PREVENT_SHARING_EXPLORER;
  612. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  613. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  614. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_EXPLORER_SHARING;
  615. CurrentID = IDC_PREVENT_SHARING_DOS;
  616. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  617. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  618. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_MSDOS_SHARING;
  619. CurrentID = IDC_PREVENT_SHARING_CONTROL;
  620. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  621. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  622. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_ALLOW_CONTROL;
  623. CurrentID = IDC_DISABLE_RDS_ON_ALL;
  624. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_LOCAL_MACHINE;
  625. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  626. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_RDS;
  627. CurrentID = IDC_DISABLE_RDS_ON_WIN9X;
  628. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_LOCAL_MACHINE;
  629. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  630. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_RDS_WIN9X;
  631. // Audio
  632. CurrentID = IDC_CREATE_AN_AUDIO_LOG_FILE; // HKLM
  633. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_LOCAL_MACHINE;
  634. ms_KeyMap[ CurrentID ] = DEBUG_KEY;
  635. ms_ValueMap[ CurrentID ] = REGVAL_RETAIL_LOG;
  636. CurrentID = IDC_CHECK_MUTE_SPEAKER_BY_DEFAULT;
  637. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  638. ms_KeyMap[ CurrentID ] = AUDIO_KEY;
  639. ms_ValueMap[ CurrentID ] = REGVAL_SPKMUTE;
  640. CurrentID = IDC_CHECK_MUTE_MICROPHONE_BY_DEFAULT;
  641. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  642. ms_KeyMap[ CurrentID ] = AUDIO_KEY;
  643. ms_ValueMap[ CurrentID ] = REGVAL_RECMUTE;
  644. CurrentID = IDC_ENABLE_DIRECT_SOUND;
  645. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  646. ms_KeyMap[ CurrentID ] = AUDIO_KEY;
  647. ms_ValueMap[ CurrentID ] = REGVAL_DIRECTSOUND;
  648. CurrentID = IDC_NOCHANGE_DIRECT_SOUND;
  649. ms_ClassMap[CurrentID] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  650. ms_KeyMap[CurrentID] = POLICIES_KEY;
  651. ms_ValueMap[CurrentID] = REGVAL_POL_NOCHANGE_DIRECTSOUND;
  652. CurrentID = IDC_PREVENT_THE_USER_FROM_USING_AUDIO;
  653. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  654. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  655. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_AUDIO;
  656. CurrentID = IDC_DISABLE_FULL_DUPLEX_AUDIO;
  657. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  658. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  659. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_FULLDUPLEX;
  660. // Video
  661. CurrentID = IDC_DISABLE_SENDING_VIDEO;
  662. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  663. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  664. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_VIDEO_SEND;
  665. CurrentID = IDC_DISABLE_RECIEVING_VIDEO;
  666. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  667. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  668. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_VIDEO_RECEIVE;
  669. // Notifications
  670. //
  671. // REMOTE OLDER WARNING is GONE
  672. //
  673. CurrentID = IDC_REQUIRE_COMPLETE_AUTHENTICATION;
  674. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_LOCAL_MACHINE;
  675. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  676. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_INCOMPLETE_CERTS;
  677. CurrentID = IDC_EDIT_SET_RDN_FOR_REQUIRED_CA;
  678. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_LOCAL_MACHINE;
  679. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  680. ms_ValueMap[ CurrentID ] = REGVAL_POL_ISSUER;
  681. // Directory Services
  682. CurrentID = IDC_ALLOW_USER_TO_USE_DIRECTORY_SERVICES;
  683. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  684. ms_KeyMap[ CurrentID ] = CONFERENCING_KEY;
  685. ms_ValueMap[ CurrentID ] = REGVAL_DONT_LOGON_ULS;
  686. CurrentID = IDC_PREVENT_THE_USER_FROM_ADDING_NEW_SERVERS;
  687. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  688. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  689. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_ADDING_NEW_ULS;
  690. // Chat
  691. CurrentID = IDC_DISABLE_CHAT;
  692. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  693. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  694. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_CHAT;
  695. // Whiteboard
  696. //
  697. // BOGUS BUGBUG LAURABU
  698. // We have OLD and NEW whiteboard
  699. //
  700. CurrentID = IDC_DISABLE_2XWHITEBOARD;
  701. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  702. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  703. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_OLDWHITEBOARD;
  704. CurrentID = IDC_DISABLE_WHITEBOARD;
  705. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  706. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  707. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_NEWWHITEBOARD;
  708. // Online Support
  709. CurrentID = IDC_EDIT_SET_URL_FOR_INTERNAL_SUPPORT_PAGE;
  710. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  711. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  712. ms_ValueMap[ CurrentID ] = REGVAL_POL_INTRANET_SUPPORT_URL;
  713. CurrentID = IDC_SHOW_THE_ONLINE_SUPPORT_PAGE_THE_FIRST_TIME_NETMEETING_STARTS;
  714. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  715. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  716. ms_ValueMap[ CurrentID ] = REGVAL_POL_SHOW_FIRST_TIME_URL;
  717. // Options Dialog
  718. CurrentID = IDC_DISABLE_THE_GENERAL_OPTIONS_PAGE;
  719. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  720. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  721. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_GENERALPAGE;
  722. CurrentID = IDC_DISABLE_THE_ADVANCED_CALLING_BUTTON;
  723. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  724. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  725. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_ADVANCEDCALLING;
  726. CurrentID = IDC_DISABLE_THE_SECURITY_OPTIONS_PAGE;
  727. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  728. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  729. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_SECURITYPAGE;
  730. CurrentID = IDC_DISABLE_THE_AUDIO_OPTIONS_PAGE;
  731. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  732. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  733. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_AUDIOPAGE;
  734. CurrentID = IDC_DISABLE_THE_VIDEO_OPTIONS_PAGE;
  735. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  736. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  737. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_VIDEOPAGE;
  738. CurrentID = IDC_DISABLE_AUTOACCEPT;
  739. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  740. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  741. ms_ValueMap[ CurrentID ] = REGVAL_POL_NO_AUTOACCEPTCALLS;
  742. CurrentID = IDC_PERSIST_AUTOACCEPT;
  743. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  744. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  745. ms_ValueMap[ CurrentID ] = REGVAL_POL_PERSIST_AUTOACCEPTCALLS;
  746. // Security RADIO Options
  747. CurrentID = IDC_RADIO_SECURITY_DEFAULT;
  748. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  749. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  750. ms_ValueMap[ CurrentID ] = REGVAL_POL_SECURITY;
  751. CurrentID = IDC_RADIO_SECURITY_REQUIRED;
  752. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  753. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  754. ms_ValueMap[ CurrentID ] = REGVAL_POL_SECURITY;
  755. CurrentID = IDC_RADIO_SECURITY_DISABLED;
  756. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  757. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  758. ms_ValueMap[ CurrentID ] = REGVAL_POL_SECURITY;
  759. // Call mode RADIO options
  760. CurrentID = IDC_RADIO_CALLMODE_DIRECT;
  761. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  762. ms_KeyMap[ CurrentID ] = CONFERENCING_KEY;
  763. ms_ValueMap[ CurrentID ] = REGVAL_CALLING_MODE;
  764. CurrentID = IDC_RADIO_CALLMODE_GATEKEEPER;
  765. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  766. ms_KeyMap[ CurrentID ] = CONFERENCING_KEY;
  767. ms_ValueMap[ CurrentID ] = REGVAL_CALLING_MODE;
  768. // Gateway
  769. CurrentID = IDC_CHECK_GATEWAY;
  770. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  771. ms_KeyMap[ CurrentID ] = CONFERENCING_KEY;
  772. ms_ValueMap[ CurrentID ] = REGVAL_USE_H323_GATEWAY;
  773. CurrentID = IDC_EDIT_GATEWAY;
  774. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  775. ms_KeyMap[ CurrentID ] = CONFERENCING_KEY;
  776. ms_ValueMap[ CurrentID ] = REGVAL_H323_GATEWAY;
  777. // Gatekeeper addressing RADIO options
  778. CurrentID = IDC_RADIO_GKMODE_ACCOUNT;
  779. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  780. ms_KeyMap[ CurrentID ] = CONFERENCING_KEY;
  781. ms_ValueMap[ CurrentID ] = REGVAL_GK_METHOD;
  782. CurrentID = IDC_RADIO_GKMODE_PHONE;
  783. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  784. ms_KeyMap[ CurrentID ] = CONFERENCING_KEY;
  785. ms_ValueMap[ CurrentID ] = REGVAL_GK_METHOD;
  786. CurrentID = IDC_RADIO_GKMODE_BOTH;
  787. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  788. ms_KeyMap[ CurrentID ] = CONFERENCING_KEY;
  789. ms_ValueMap[ CurrentID ] = REGVAL_GK_METHOD;
  790. CurrentID = IDC_EDIT_GATEKEEPER;
  791. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  792. ms_KeyMap[ CurrentID ] = CONFERENCING_KEY;
  793. ms_ValueMap[ CurrentID ] = REGVAL_GK_SERVER;
  794. CurrentID = IDC_CHECK_NOCHANGECALLMODE;
  795. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  796. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  797. ms_ValueMap[ CurrentID ] = REGVAL_POL_NOCHANGECALLMODE;
  798. // AV Throughput
  799. CurrentID = IDC_SLIDE_AV_THROUGHPUT;
  800. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  801. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  802. ms_ValueMap[ CurrentID ] = REGVAL_POL_MAX_BANDWIDTH;
  803. // AutoConf
  804. CurrentID = IDC_CHECK_AUTOCONFIG_CLIENTS;
  805. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  806. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  807. ms_ValueMap[ CurrentID ] = REGVAL_AUTOCONF_USE;
  808. CurrentID = IDC_AUTOCONF_URL;
  809. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  810. ms_KeyMap[ CurrentID ] = POLICIES_KEY;
  811. ms_ValueMap[ CurrentID ] = REGVAL_AUTOCONF_CONFIGFILE;
  812. // Network Speed RADIO options
  813. CurrentID = IDC_RADIO_NETSPEED_144;
  814. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  815. ms_KeyMap[ CurrentID ] = AUDIO_KEY;
  816. ms_ValueMap[ CurrentID ] = REGVAL_TYPICALBANDWIDTH;
  817. CurrentID = IDC_RADIO_NETSPEED_288;
  818. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  819. ms_KeyMap[ CurrentID ] = AUDIO_KEY;
  820. ms_ValueMap[ CurrentID ] = REGVAL_TYPICALBANDWIDTH;
  821. CurrentID = IDC_RADIO_NETSPEED_ISDN;
  822. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  823. ms_KeyMap[ CurrentID ] = AUDIO_KEY;
  824. ms_ValueMap[ CurrentID ] = REGVAL_TYPICALBANDWIDTH;
  825. CurrentID = IDC_RADIO_NETSPEED_LAN;
  826. ms_ClassMap[ CurrentID ] = CPolicyData::eKeyType_HKEY_CURRENT_USER;
  827. ms_KeyMap[ CurrentID ] = AUDIO_KEY;
  828. ms_ValueMap[ CurrentID ] = REGVAL_TYPICALBANDWIDTH;
  829. }
  830. BOOL CPropertyDataWindow2::WriteToINF( HANDLE hFile, BOOL bCheckValues )
  831. {
  832. list< UINT > condList;
  833. list< CControlID *>::const_iterator it;
  834. _WriteChecksToINF( hFile, bCheckValues );
  835. for( it = m_condList.begin(); it != m_condList.end(); it++ )
  836. {
  837. if( ms_ValueMap.find( (*it)->GetCondID() ) != ms_ValueMap.end() )
  838. {
  839. list< UINT >::const_iterator i;
  840. if( (i = find( condList.begin(), condList.end(), (*it)->GetCondID() ) ) == condList.end() )
  841. {
  842. condList.push_front( (*it)->GetCondID() );
  843. _WriteCheckToINF( hFile, (*it)->GetCondID(), bCheckValues );
  844. }
  845. }
  846. if( bCheckValues)
  847. {
  848. bCheckValues = Button_GetCheck( (*it)->GetCondHwnd() );
  849. }
  850. switch( (*it)->GetType() )
  851. {
  852. case CControlID::STATIC:
  853. break;
  854. case CControlID::EDIT_NUM:
  855. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  856. {
  857. _WriteEditNumToINF( hFile, (*it)->GetID(), bCheckValues );
  858. }
  859. break;
  860. case CControlID::EDIT:
  861. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  862. {
  863. _WriteEditToINF( hFile, (*it)->GetID(), bCheckValues );
  864. }
  865. break;
  866. case CControlID::CHECK:
  867. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  868. {
  869. _WriteCheckToINF( hFile, (*it)->GetID(), bCheckValues );
  870. }
  871. break;
  872. case CControlID::COMBO:
  873. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  874. {
  875. _WriteComboToINF( hFile, (*it)->GetID(), bCheckValues );
  876. }
  877. break;
  878. case CControlID::SLIDER:
  879. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  880. {
  881. _WriteSliderToINF( hFile, (*it)->GetID(), bCheckValues );
  882. }
  883. break;
  884. default:
  885. OutputDebugString( TEXT("CPropertyDataWindow2::WriteToINF: unknown CControlID::type\n") );
  886. assert( 0 );
  887. break;
  888. }
  889. }
  890. for( it = m_specialControlList.begin(); it != m_specialControlList.end(); it++ )
  891. {
  892. switch( (*it)->GetType() )
  893. {
  894. case CControlID::STATIC:
  895. break;
  896. case CControlID::EDIT_NUM:
  897. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  898. {
  899. _WriteEditNumToINF( hFile, (*it)->GetID(), bCheckValues );
  900. }
  901. break;
  902. case CControlID::EDIT:
  903. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  904. {
  905. _WriteEditToINF( hFile, (*it)->GetID(), bCheckValues );
  906. }
  907. break;
  908. case CControlID::CHECK:
  909. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  910. {
  911. _WriteCheckToINF( hFile, (*it)->GetID(), bCheckValues );
  912. }
  913. break;
  914. case CControlID::COMBO:
  915. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  916. {
  917. _WriteComboToINF( hFile, (*it)->GetID(), bCheckValues );
  918. }
  919. break;
  920. case CControlID::SLIDER:
  921. if( ms_ValueMap.find( (*it)->GetID() ) != ms_ValueMap.end() )
  922. {
  923. _WriteSliderToINF( hFile, (*it)->GetID(), bCheckValues );
  924. }
  925. break;
  926. default:
  927. OutputDebugString( TEXT("CPropertyDataWindow2::WriteToINF: unknown CControlID::type\n") );
  928. assert( 0 );
  929. break;
  930. }
  931. }
  932. return TRUE;
  933. }
  934. void CPropertyDataWindow2::_WriteCheckToINF( HANDLE hFile, UINT ID, BOOL bCheckValues )
  935. {
  936. HWND hwndButton;
  937. BOOL fIsRadioButton;
  938. DWORD dwWrite;
  939. hwndButton = GetDlgItem(m_hwnd, ID);
  940. switch (GetWindowLong(hwndButton, GWL_STYLE) & 0x0F)
  941. {
  942. case BS_RADIOBUTTON:
  943. case BS_AUTORADIOBUTTON:
  944. fIsRadioButton = TRUE;
  945. break;
  946. default:
  947. fIsRadioButton = FALSE;
  948. break;
  949. }
  950. if (bCheckValues && Button_GetCheck(hwndButton))
  951. {
  952. if (fIsRadioButton)
  953. {
  954. //
  955. // For radio buttons, real value is in user data
  956. //
  957. dwWrite = GetWindowLong(hwndButton, GWL_USERDATA);
  958. }
  959. else
  960. {
  961. dwWrite = TRUE;
  962. }
  963. CPolicyData(ms_ClassMap[ID], ms_KeyMap[ID], ms_ValueMap[ID], dwWrite).
  964. SaveToINFFile(hFile);
  965. }
  966. else
  967. {
  968. //
  969. // If this is a radio button, do not write the unchecked ones out.
  970. //
  971. if (!fIsRadioButton)
  972. {
  973. dwWrite = FALSE;
  974. CPolicyData(ms_ClassMap[ ID ],
  975. ms_KeyMap[ ID ],
  976. ms_ValueMap[ ID ],
  977. dwWrite).SaveToINFFile( hFile );
  978. }
  979. }
  980. }
  981. void CPropertyDataWindow2::_WriteChecksToINF( HANDLE hFile, BOOL bCheckValues )
  982. {
  983. list< UINT >::const_iterator it;
  984. for (it = m_checkIDList.begin(); it != m_checkIDList.end(); it++)
  985. {
  986. if (ms_ValueMap.find(*it) != ms_ValueMap.end())
  987. {
  988. _WriteCheckToINF(hFile, *it, bCheckValues);
  989. }
  990. }
  991. }
  992. void CPropertyDataWindow2::_WriteEditNumToINF( HANDLE hFile, UINT EditID, BOOL bCheckValues )
  993. {
  994. if( bCheckValues )
  995. {
  996. CPolicyData( ms_ClassMap[ EditID ],
  997. ms_KeyMap[ EditID ],
  998. ms_ValueMap[ EditID ],
  999. (DWORD) GetDlgItemInt( m_hwnd, EditID, NULL, FALSE ) ).SaveToINFFile( hFile );
  1000. }
  1001. else
  1002. {
  1003. _DeleteKey( hFile, EditID );
  1004. }
  1005. }
  1006. void CPropertyDataWindow2::_WriteEditToINF( HANDLE hFile, UINT EditID, BOOL bCheckValues )
  1007. {
  1008. if( bCheckValues )
  1009. {
  1010. int iLen = GetEditDataLen( EditID ) + 1;
  1011. LPTSTR szData = new TCHAR[ iLen ];
  1012. GetEditData( EditID, szData, iLen );
  1013. CPolicyData( ms_ClassMap[ EditID ],
  1014. ms_KeyMap[ EditID ],
  1015. ms_ValueMap[ EditID ],
  1016. szData ).SaveToINFFile( hFile );
  1017. delete [] szData;
  1018. }
  1019. else
  1020. {
  1021. _DeleteKey( hFile, EditID );
  1022. }
  1023. }
  1024. void CPropertyDataWindow2::_WriteSliderToINF( HANDLE hFile, UINT SliderID, BOOL bCheckValues )
  1025. {
  1026. if( bCheckValues )
  1027. {
  1028. int iPos;
  1029. iPos = TrackBar_GetPos(GetDlgItem(m_hwnd, SliderID));
  1030. iPos *= 1000;
  1031. CPolicyData( ms_ClassMap[ SliderID ],
  1032. ms_KeyMap[ SliderID ],
  1033. ms_ValueMap[ SliderID ],
  1034. (DWORD)iPos
  1035. ).SaveToINFFile( hFile );
  1036. }
  1037. else
  1038. {
  1039. _DeleteKey( hFile, SliderID );
  1040. }
  1041. }
  1042. void CPropertyDataWindow2::_WriteComboToINF( HANDLE hFile, UINT ComboID, BOOL bCheckValues )
  1043. {
  1044. if( bCheckValues )
  1045. {
  1046. HWND hwndCombo = GetDlgItem( m_hwnd, ComboID );
  1047. CPolicyData( ms_ClassMap[ ComboID ],
  1048. ms_KeyMap[ ComboID ],
  1049. ms_ValueMap[ ComboID ],
  1050. (DWORD) ComboBox_GetItemData( hwndCombo, ComboBox_GetCurSel( hwndCombo ) )
  1051. ).SaveToINFFile( hFile );
  1052. }
  1053. else
  1054. {
  1055. _DeleteKey( hFile, ComboID );
  1056. }
  1057. }
  1058. void CPropertyDataWindow2::_DeleteKey( HANDLE hFile, UINT ID )
  1059. {
  1060. CPolicyData( ms_ClassMap[ ID ],
  1061. ms_KeyMap[ ID ],
  1062. ms_ValueMap[ ID ],
  1063. CPolicyData::OpDelete()
  1064. ).SaveToINFFile( hFile );
  1065. }
  1066. int CPropertyDataWindow2::Spew( HWND hwndList, int iStartLine )
  1067. {
  1068. list< UINT >::const_iterator it;
  1069. for( it = m_checkIDList.begin(); it != m_checkIDList.end(); it++ )
  1070. {
  1071. if( Button_GetCheck( GetDlgItem( m_hwnd, *it ) ) )
  1072. {
  1073. HWND hwndButton = GetDlgItem( m_hwnd, *it );
  1074. // 2 is 1 for '\0' and 1 for '\t'
  1075. int iButtonTextLen = Button_GetTextLength( hwndButton ) + 2;
  1076. LPTSTR szButtonText = new TCHAR[ iButtonTextLen ];
  1077. szButtonText[0] = '\t';
  1078. Button_GetText( hwndButton, &(szButtonText[1]), iButtonTextLen - 1 );
  1079. ListBox_InsertString( hwndList, iStartLine, szButtonText );
  1080. iStartLine++;
  1081. }
  1082. }
  1083. list< CControlID *>::const_iterator i;
  1084. if( m_condList.size() )
  1085. {
  1086. for( i = m_condList.begin(); i != m_condList.end(); i++ )
  1087. {
  1088. if( Button_GetCheck( (*i)->GetCondHwnd() ) )
  1089. {
  1090. iStartLine = _Spew( hwndList, iStartLine, *i );
  1091. }
  1092. }
  1093. }
  1094. if( m_specialControlList.size() )
  1095. {
  1096. for( i = m_specialControlList.begin(); i != m_specialControlList.end(); i++ )
  1097. {
  1098. iStartLine = _Spew( hwndList, iStartLine, *i );
  1099. }
  1100. }
  1101. return iStartLine;
  1102. }
  1103. int CPropertyDataWindow2::_Spew( HWND hwndList, int iStartLine, CControlID *pControlID )
  1104. {
  1105. switch( pControlID->GetType() )
  1106. {
  1107. case CControlID::EDIT_NUM:
  1108. case CControlID::EDIT:
  1109. {
  1110. int iEditLen = GetEditDataLen( pControlID->GetID() ) + 1;
  1111. if( iEditLen )
  1112. {
  1113. int iLen = Button_GetTextLength( pControlID->GetCondHwnd() ) + 1;
  1114. LPTSTR sz = new TCHAR[ iLen];
  1115. Button_GetText( pControlID->GetCondHwnd(), sz, iLen );
  1116. LPTSTR szData = new TCHAR[ iEditLen];
  1117. GetEditData( pControlID->GetID(), szData, iEditLen );
  1118. // 2 is: 1 for ' ' and 1 for '\t'
  1119. LPTSTR szBuff = new TCHAR[ iLen + iEditLen + 2];
  1120. wsprintf( szBuff, TEXT("\t%s %s"), sz, szData );
  1121. ListBox_InsertString( hwndList, iStartLine, szBuff );
  1122. iStartLine++;
  1123. delete [] szData;
  1124. delete [] szBuff;
  1125. delete [] sz;
  1126. }
  1127. break;
  1128. }
  1129. case CControlID::CHECK:
  1130. {
  1131. HWND hwnd = GetDlgItem( m_hwnd, pControlID->GetID() );
  1132. if( Button_GetCheck( hwnd ) )
  1133. {
  1134. int iLen = Button_GetTextLength( hwnd ) + 2;
  1135. LPTSTR sz = new TCHAR[ iLen];
  1136. sz[0] = '\t';
  1137. Button_GetText( hwnd, &sz[1], iLen );
  1138. ListBox_InsertString( hwndList, iStartLine, sz );
  1139. iStartLine++;
  1140. delete [] sz;
  1141. }
  1142. break;
  1143. }
  1144. case CControlID::COMBO:
  1145. {
  1146. HWND hwnd = GetDlgItem( m_hwnd, pControlID->GetID() );
  1147. int iCurSel = ComboBox_GetCurSel( hwnd );
  1148. int iLen = ComboBox_GetLBTextLen( hwnd, iCurSel ) + 2;
  1149. LPTSTR sz = new TCHAR[ iLen ];
  1150. sz[0] = '\t';
  1151. ComboBox_GetLBText( hwnd, iCurSel, &(sz[1]) );
  1152. ListBox_InsertString( hwndList, iStartLine, sz );
  1153. iStartLine++;
  1154. delete [] sz;
  1155. break;
  1156. }
  1157. case CControlID::SLIDER:
  1158. {
  1159. HWND hwnd = GetDlgItem( m_hwnd, pControlID->GetID() );
  1160. TCHAR sz[ MAX_DIGITS ];
  1161. wsprintf( sz, TEXT("\t%d kbits/s"), TrackBar_GetPos( hwnd ) );
  1162. ListBox_InsertString( hwndList, iStartLine, sz );
  1163. iStartLine++;
  1164. break;
  1165. }
  1166. case CControlID::STATIC:
  1167. break;
  1168. default:
  1169. OutputDebugString( TEXT("CPropertyDataWindow2::_Spew: unknown CControlID::type\n") );
  1170. assert( 0 );
  1171. break;
  1172. }
  1173. return iStartLine;
  1174. }