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.

255 lines
5.8 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // File Name:
  7. // netware.c
  8. //
  9. // Description:
  10. //
  11. //----------------------------------------------------------------------------
  12. #include "pch.h"
  13. #include "resource.h"
  14. //----------------------------------------------------------------------------
  15. //
  16. // Function: GreyNetwarePage
  17. //
  18. // Purpose: Greys the controls on the page appropriately depending on what
  19. // radio box is selected.
  20. //
  21. // Arguments: IN HWND hwnd - handle to the dialog box
  22. //
  23. // Returns: VOID
  24. //
  25. //----------------------------------------------------------------------------
  26. VOID
  27. GreyNetwarePage( IN HWND hwnd ) {
  28. BOOL bPrefferedServer = IsDlgButtonChecked( hwnd, RB_PREFERRED_SERVER );
  29. EnableWindow( GetDlgItem(hwnd, IDC_PREFERREDSERVER), bPrefferedServer );
  30. EnableWindow( GetDlgItem(hwnd, SLE_DEFAULT_TREE), ! bPrefferedServer );
  31. EnableWindow( GetDlgItem(hwnd, SLE_DEFAULT_CONTEXT), ! bPrefferedServer );
  32. }
  33. //----------------------------------------------------------------------------
  34. //
  35. // Function: OnNetwareInitDialog
  36. //
  37. // Purpose:
  38. //
  39. // Arguments: IN HWND hwnd - handle to the dialog box
  40. //
  41. // Returns: VOID
  42. //
  43. //----------------------------------------------------------------------------
  44. VOID
  45. OnNetwareInitDialog( IN HWND hwnd ) {
  46. //
  47. // Set the text limits on the edit boxes
  48. //
  49. SendDlgItemMessage( hwnd,
  50. IDC_PREFERREDSERVER,
  51. EM_LIMITTEXT,
  52. (WPARAM) MAX_PREFERRED_SERVER_LEN,
  53. (LPARAM) 0 );
  54. SendDlgItemMessage( hwnd,
  55. SLE_DEFAULT_TREE,
  56. EM_LIMITTEXT,
  57. (WPARAM) MAX_DEFAULT_TREE_LEN,
  58. (LPARAM) 0 );
  59. SendDlgItemMessage( hwnd,
  60. SLE_DEFAULT_CONTEXT,
  61. EM_LIMITTEXT,
  62. (WPARAM) MAX_DEFAULT_CONTEXT_LEN,
  63. (LPARAM) 0 );
  64. //
  65. // Set the initial state of the radio buttons
  66. //
  67. if( NetSettings.bDefaultTreeContext ) {
  68. CheckRadioButton( hwnd,
  69. RB_PREFERRED_SERVER,
  70. RB_DEFAULT_CONTEXT,
  71. RB_DEFAULT_CONTEXT );
  72. }
  73. else {
  74. CheckRadioButton( hwnd,
  75. RB_PREFERRED_SERVER,
  76. RB_DEFAULT_CONTEXT,
  77. RB_PREFERRED_SERVER );
  78. }
  79. GreyNetwarePage( hwnd );
  80. //
  81. // Fill the controls with the values from the global variables
  82. //
  83. SetWindowText( GetDlgItem( hwnd, IDC_PREFERREDSERVER ),
  84. NetSettings.szPreferredServer );
  85. SetWindowText( GetDlgItem( hwnd, SLE_DEFAULT_TREE ),
  86. NetSettings.szDefaultTree );
  87. SetWindowText( GetDlgItem( hwnd, SLE_DEFAULT_CONTEXT ),
  88. NetSettings.szDefaultContext );
  89. if( NetSettings.bNetwareLogonScript ) {
  90. CheckDlgButton( hwnd, CHKBOX_LOGONSCRIPT, BST_CHECKED );
  91. }
  92. else {
  93. CheckDlgButton( hwnd, CHKBOX_LOGONSCRIPT, BST_UNCHECKED );
  94. }
  95. }
  96. //----------------------------------------------------------------------------
  97. //
  98. // Function: OnNetwareOK
  99. //
  100. // Purpose:
  101. //
  102. // Arguments: IN HWND hwnd - handle to the dialog box
  103. //
  104. // Returns: VOID
  105. //
  106. //----------------------------------------------------------------------------
  107. VOID
  108. OnNetwareOK( IN HWND hwnd ) {
  109. if( IsDlgButtonChecked( hwnd, RB_DEFAULT_CONTEXT ) == BST_CHECKED ) {
  110. NetSettings.bDefaultTreeContext = TRUE;
  111. }
  112. else {
  113. NetSettings.bDefaultTreeContext = FALSE;
  114. }
  115. GetWindowText( GetDlgItem( hwnd, IDC_PREFERREDSERVER ),
  116. NetSettings.szPreferredServer,
  117. MAX_PREFERRED_SERVER_LEN + 1 );
  118. GetWindowText( GetDlgItem( hwnd, SLE_DEFAULT_TREE ),
  119. NetSettings.szDefaultTree,
  120. MAX_DEFAULT_TREE_LEN + 1 );
  121. GetWindowText( GetDlgItem( hwnd, SLE_DEFAULT_CONTEXT ),
  122. NetSettings.szDefaultContext,
  123. MAX_DEFAULT_CONTEXT_LEN + 1 );
  124. if( IsDlgButtonChecked( hwnd, CHKBOX_LOGONSCRIPT ) == BST_CHECKED ) {
  125. NetSettings.bNetwareLogonScript = TRUE;
  126. }
  127. else {
  128. NetSettings.bNetwareLogonScript = FALSE;
  129. }
  130. EndDialog( hwnd, 1 );
  131. }
  132. //----------------------------------------------------------------------------
  133. //
  134. // Function: DlgNetwarePage
  135. //
  136. // Purpose:
  137. //
  138. // Arguments: standard Win32 dialog proc arguments
  139. //
  140. // Returns: standard Win32 dialog proc return value
  141. //
  142. //----------------------------------------------------------------------------
  143. INT_PTR CALLBACK
  144. DlgNetwarePage( IN HWND hwnd,
  145. IN UINT uMsg,
  146. IN WPARAM wParam,
  147. IN LPARAM lParam) {
  148. BOOL bStatus = TRUE;
  149. switch( uMsg ) {
  150. case WM_INITDIALOG: {
  151. OnNetwareInitDialog( hwnd );
  152. break;
  153. }
  154. case WM_CREATE: {
  155. break;
  156. }
  157. case WM_COMMAND: {
  158. int nButtonId = LOWORD( wParam );
  159. switch ( nButtonId ) {
  160. case RB_PREFERRED_SERVER:
  161. case RB_DEFAULT_CONTEXT:
  162. CheckRadioButton( hwnd,
  163. RB_PREFERRED_SERVER,
  164. RB_DEFAULT_CONTEXT,
  165. nButtonId );
  166. GreyNetwarePage( hwnd );
  167. break;
  168. case IDOK: {
  169. OnNetwareOK( hwnd );
  170. break;
  171. }
  172. case IDCANCEL: {
  173. EndDialog( hwnd, 0 );
  174. break;
  175. }
  176. }
  177. }
  178. default:
  179. bStatus = FALSE;
  180. break;
  181. }
  182. return bStatus;
  183. }