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.

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