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.

182 lines
3.9 KiB

  1. /* File: C:\WACKER\XFER\x_hp_dlg.c (Created: 24-Jan-1994)
  2. * created from:
  3. * File: C:\WACKER\TDLL\genrcdlg.c (Created: 16-Dec-1993)
  4. * created from:
  5. * File: C:\HA5G\ha5g\genrcdlg.c (Created: 12-Sep-1990)
  6. *
  7. * Copyright 1990,1993,1994 by Hilgraeve Inc. -- Monroe, MI
  8. * All rights reserved
  9. *
  10. * $Revision: 2 $
  11. * $Date: 2/25/02 1:17p $
  12. */
  13. #include <windows.h>
  14. #include <commctrl.h>
  15. #include <tdll\stdtyp.h>
  16. #include <tdll\assert.h>
  17. #include <tdll\mc.h>
  18. #define RESYNC 102
  19. #define RESYNC_UD 202
  20. #define BLOCKS 104
  21. #define BLOCKS_UD 204
  22. #define CMP_ON 106
  23. #define CMP_OFF 107
  24. #define CRC 109
  25. #define CSUM 110
  26. #define RMIN 3
  27. #define RMAX 60
  28. #define SMIN 128
  29. #define SMAX 16384
  30. #if !defined(DlgParseCmd)
  31. #define DlgParseCmd(i,n,c,w,l) i=LOWORD(w);n=HIWORD(w);c=(HWND)l;
  32. #endif
  33. struct stSaveDlgStuff
  34. {
  35. int nOldHelp;
  36. /*
  37. * Put in whatever else you might need to access later
  38. */
  39. };
  40. typedef struct stSaveDlgStuff SDS;
  41. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  42. * FUNCTION: HyperProtocolParamsDlg
  43. *
  44. * DESCRIPTION: Dialog manager stub
  45. *
  46. * ARGUMENTS: Standard Windows dialog manager
  47. *
  48. * RETURNS: Standard Windows dialog manager
  49. *
  50. */
  51. BOOL CALLBACK HyperProtocolParamsDlg(HWND hDlg,
  52. UINT wMsg,
  53. WPARAM wPar,
  54. LPARAM lPar)
  55. {
  56. #if defined(UPPER_FEATURES)
  57. HWND hwndChild;
  58. INT nId;
  59. INT nNtfy;
  60. SDS *pS;
  61. switch (wMsg)
  62. {
  63. case WM_INITDIALOG:
  64. {
  65. RECT rc;
  66. int nLoop;
  67. DWORD dw;
  68. pS = (SDS *)malloc(sizeof(SDS));
  69. if (pS == (SDS *)0)
  70. {
  71. /* TODO: decide if we need to display an error here */
  72. EndDialog(hDlg, FALSE);
  73. }
  74. /*
  75. * We need to create a couple of UP/DOWN controls
  76. */
  77. GetClientRect(GetDlgItem(hDlg, RESYNC), &rc);
  78. nLoop = rc.top - rc.bottom;
  79. dw = WS_CHILD | WS_BORDER | WS_VISIBLE;
  80. dw |= UDS_ALIGNRIGHT;
  81. dw |= UDS_ARROWKEYS;
  82. dw |= UDS_SETBUDDYINT;
  83. hwndChild = CreateUpDownControl(
  84. dw, /* create window flags */
  85. rc.right, /* left edge */
  86. rc.top, /* top edge */
  87. (nLoop / 3) * 2,/* width */
  88. nLoop, /* height */
  89. hDlg, /* parent window */
  90. RESYNC_UD,
  91. (HINSTANCE)GetWindowLongPtr(hDlg, GWLP_HINSTANCE),
  92. GetDlgItem(hDlg, RESYNC),
  93. RMAX, /* upper limit */
  94. RMIN, /* lower limit */
  95. 5); /* starting position */
  96. assert(hwndChild);
  97. GetClientRect(GetDlgItem(hDlg, BLOCKS), &rc);
  98. nLoop = rc.top - rc.bottom;
  99. dw = WS_CHILD | WS_BORDER | WS_VISIBLE;
  100. dw |= UDS_ALIGNRIGHT;
  101. dw |= UDS_ARROWKEYS;
  102. dw |= UDS_SETBUDDYINT;
  103. hwndChild = CreateUpDownControl(
  104. dw, /* create window flags */
  105. rc.right, /* left edge */
  106. rc.top, /* top edge */
  107. (nLoop / 3) * 2,/* width */
  108. nLoop, /* height */
  109. hDlg, /* parent window */
  110. BLOCKS_UD,
  111. (HINSTANCE)GetWindowLongPtr(hDlg, GWLP_HINSTANCE),
  112. GetDlgItem(hDlg, BLOCKS),
  113. SMAX, /* upper limit */
  114. SMIN, /* lower limit */
  115. 2048); /* starting position */
  116. assert(hwndChild);
  117. SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pS);
  118. }
  119. break;
  120. case WM_DESTROY:
  121. break;
  122. case WM_COMMAND:
  123. /*
  124. * Did we plan to put a macro in here to do the parsing ?
  125. */
  126. DlgParseCmd(nId, nNtfy, hwndChild, wPar, lPar);
  127. switch (nId)
  128. {
  129. case IDOK:
  130. pS = (SDS *)GetWindowLongPtr(hDlg, DWLP_USER);
  131. /*
  132. * Do whatever saving is necessary
  133. */
  134. /* Free the storeage */
  135. free(pS);
  136. pS = (SDS *)0;
  137. EndDialog(hDlg, TRUE);
  138. break;
  139. case IDCANCEL:
  140. pS = (SDS *)GetWindowLongPtr(hDlg, DWLP_USER);
  141. /* Free the storeage */
  142. free(pS);
  143. pS = (SDS *)0;
  144. EndDialog(hDlg, FALSE);
  145. break;
  146. default:
  147. return FALSE;
  148. }
  149. break;
  150. default:
  151. return FALSE;
  152. }
  153. #endif
  154. return TRUE;
  155. }