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.

205 lines
3.7 KiB

  1. /* File: C:\WACKER\xfer\mdmx_sd.c (Created: 17-Jan-1994)
  2. * created from HAWIN
  3. * mdmx_sd.c -- Routines to handle xmodem displays for HA5a/G
  4. *
  5. * Copyright 1989, 1994 by Hilgraeve Inc. -- Monroe, MI
  6. * All rights reserved
  7. *
  8. * $Revision: 7 $
  9. * $Date: 7/12/02 8:10a $
  10. */
  11. #include <windows.h>
  12. #pragma hdrstop
  13. #include <setjmp.h>
  14. #define BYTE unsigned char
  15. #include <tdll\assert.h>
  16. #include <tdll\stdtyp.h>
  17. #include <tdll\session.h>
  18. #include <tdll\xfer_msc.h>
  19. #include <tdll\load_res.h>
  20. #include <term\res.h>
  21. #include <tdll\globals.h>
  22. #include <tdll\file_io.h>
  23. #include <tdll\com.h>
  24. #include "xfr_srvc.h"
  25. #include "xfr_todo.h"
  26. #include "xfr_dsp.h"
  27. #include "xfer_tsc.h"
  28. #include "foo.h"
  29. #include "xfer.h"
  30. #include "xfer.hh"
  31. #include "mdmx.h"
  32. #include "mdmx.hh"
  33. void mdmxXferInit(ST_MDMX *xc, int method)
  34. {
  35. XFR_XY_PARAMS *pX;
  36. #if defined(DEADWOOD)
  37. DWORD nLen;
  38. #endif // defined(DEADWOOD)
  39. if (xc)
  40. {
  41. ComSndBufrClear(sessQueryComHdl((xc->hSession)));
  42. ComRcvBufrClear(sessQueryComHdl((xc->hSession)));
  43. pX = (XFR_XY_PARAMS *)xfer_get_params(xc->hSession, method);
  44. assert(pX);
  45. if (pX)
  46. {
  47. switch (pX->nErrCheckType)
  48. {
  49. default:
  50. case XP_ECP_AUTOMATIC:
  51. xc->mdmx_chkt = UNDETERMINED;
  52. break;
  53. case XP_ECP_CRC:
  54. xc->mdmx_chkt = CRC;
  55. break;
  56. case XP_ECP_CHECKSUM:
  57. xc->mdmx_chkt = CHECKSUM;
  58. break;
  59. }
  60. xc->mdmx_tries = pX->nNumRetries;
  61. xc->mdmx_chartime = pX->nByteWait;
  62. xc->mdmx_pckttime = pX->nPacketWait;
  63. }
  64. else
  65. {
  66. //
  67. // Set to the defaults set in xfrInitializeXandYmodem().
  68. //
  69. xc->mdmx_chkt = UNDETERMINED;
  70. xc->mdmx_tries = 10;
  71. xc->mdmx_chartime = 5;
  72. xc->mdmx_pckttime = 20;
  73. }
  74. xc->p_putc = xm_putc;
  75. // Should we do this ?
  76. // xc->p_getc = xm_getc;
  77. xc->p_crc_tbl = NULL;
  78. #if defined(DEADWOOD)
  79. resLoadDataBlock(glblQueryDllHinst(),
  80. IDT_CSB_CRC_TABLE,
  81. &xc->p_crc_tbl,
  82. &nLen);
  83. assert(nLen != 0);
  84. #else // defined(DEADWOOD)
  85. xc->p_crc_tbl = usCrc16Lookup;
  86. #endif // defined(DEADWOOD)
  87. }
  88. }
  89. void mdmxdspFilecnt(ST_MDMX *pX, int cnt)
  90. {
  91. if (pX)
  92. {
  93. xferMsgFilecnt(pX->hSession, cnt);
  94. }
  95. }
  96. void mdmxdspErrorcnt(ST_MDMX *pX, int cnt)
  97. {
  98. if (pX)
  99. {
  100. xferMsgErrorcnt(pX->hSession, cnt);
  101. }
  102. }
  103. void mdmxdspPacketErrorcnt(ST_MDMX *pX, int cnt)
  104. {
  105. if (pX)
  106. {
  107. xferMsgPacketErrcnt(pX->hSession, cnt);
  108. }
  109. }
  110. void mdmxdspTotalsize(ST_MDMX *pX, long bytes)
  111. {
  112. if (pX)
  113. {
  114. xferMsgTotalsize(pX->hSession, bytes);
  115. }
  116. }
  117. void mdmxdspFilesize(ST_MDMX *pX, long fsize)
  118. {
  119. if (pX)
  120. {
  121. xferMsgFilesize(pX->hSession, fsize);
  122. }
  123. }
  124. void mdmxdspNewfile(ST_MDMX *pX,
  125. int filen,
  126. LPSTR theirname,
  127. LPTSTR ourname)
  128. {
  129. if (pX)
  130. {
  131. xferMsgNewfile(pX->hSession,
  132. filen,
  133. theirname,
  134. ourname);
  135. }
  136. }
  137. void mdmxdspProgress(ST_MDMX *pX,
  138. long stime,
  139. long ttime,
  140. long cps,
  141. long file_so_far,
  142. long total_so_far)
  143. {
  144. if (pX)
  145. {
  146. xferMsgProgress(pX->hSession,
  147. stime,
  148. ttime,
  149. cps,
  150. file_so_far,
  151. total_so_far);
  152. }
  153. }
  154. void mdmxdspChecktype(ST_MDMX *pX, int ctype)
  155. {
  156. if (pX)
  157. {
  158. xferMsgChecktype(pX->hSession, ctype);
  159. }
  160. }
  161. void mdmxdspPacketnumber(ST_MDMX *pX, long number)
  162. {
  163. if (pX)
  164. {
  165. xferMsgPacketnumber(pX->hSession, number);
  166. }
  167. }
  168. void mdmxdspLastError(ST_MDMX *pX, int errcode)
  169. {
  170. if (pX)
  171. {
  172. xferMsgLasterror(pX->hSession, errcode);
  173. }
  174. }
  175. void mdmxdspCloseDisplay(ST_MDMX * pX)
  176. {
  177. if (pX)
  178. {
  179. xferMsgClose(pX->hSession);
  180. }
  181. }