| 1 |
doda |
6806 |
/* |
| 2 |
|
|
* Copyright (C) 1994-1998 T. Teranishi |
| 3 |
nmaya |
9048 |
* (C) 2005- TeraTerm Project |
| 4 |
doda |
6806 |
* All rights reserved. |
| 5 |
|
|
* |
| 6 |
doda |
6841 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
|
|
* modification, are permitted provided that the following conditions |
| 8 |
|
|
* are met: |
| 9 |
doda |
6806 |
* |
| 10 |
doda |
6841 |
* 1. Redistributions of source code must retain the above copyright |
| 11 |
|
|
* notice, this list of conditions and the following disclaimer. |
| 12 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
|
|
* notice, this list of conditions and the following disclaimer in the |
| 14 |
|
|
* documentation and/or other materials provided with the distribution. |
| 15 |
|
|
* 3. The name of the author may not be used to endorse or promote products |
| 16 |
|
|
* derived from this software without specific prior written permission. |
| 17 |
doda |
6806 |
* |
| 18 |
doda |
6841 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR |
| 19 |
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 |
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 21 |
|
|
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 |
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 23 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 |
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 |
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 |
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 |
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 |
doda |
6806 |
*/ |
| 29 |
maya |
3227 |
|
| 30 |
|
|
/* TERATERM.EXE, file transfer routines */ |
| 31 |
zmatsuo |
7526 |
#include <stdio.h> |
| 32 |
|
|
#include <io.h> |
| 33 |
|
|
#include <process.h> |
| 34 |
zmatsuo |
8852 |
#include <windows.h> |
| 35 |
|
|
#include <htmlhelp.h> |
| 36 |
|
|
#include <assert.h> |
| 37 |
zmatsuo |
7526 |
|
| 38 |
maya |
3227 |
#include "teraterm.h" |
| 39 |
|
|
#include "tttypes.h" |
| 40 |
|
|
#include "ttftypes.h" |
| 41 |
|
|
#include "ftdlg.h" |
| 42 |
|
|
#include "protodlg.h" |
| 43 |
|
|
#include "ttwinman.h" |
| 44 |
|
|
#include "commlib.h" |
| 45 |
|
|
#include "ttcommon.h" |
| 46 |
|
|
#include "ttdde.h" |
| 47 |
|
|
#include "ttlib.h" |
| 48 |
|
|
#include "dlglib.h" |
| 49 |
doda |
3904 |
#include "vtterm.h" |
| 50 |
zmatsuo |
7290 |
#include "win16api.h" |
| 51 |
maya |
3227 |
#include "ftlib.h" |
| 52 |
yutakapon |
5392 |
#include "buffer.h" |
| 53 |
zmatsuo |
8852 |
#include "helpid.h" |
| 54 |
|
|
#include "layer_for_unicode.h" |
| 55 |
zmatsuo |
8863 |
#include "layer_for_unicode_crt.h" |
| 56 |
|
|
#include "codeconv.h" |
| 57 |
yutakapon |
5392 |
|
| 58 |
zmatsuo |
8852 |
#include "filesys_log_res.h" |
| 59 |
yutakapon |
5162 |
|
| 60 |
zmatsuo |
8866 |
#include "filesys.h" |
| 61 |
|
|
|
| 62 |
doda |
3904 |
#define FS_BRACKET_NONE 0 |
| 63 |
|
|
#define FS_BRACKET_START 1 |
| 64 |
|
|
#define FS_BRACKET_END 2 |
| 65 |
|
|
|
| 66 |
maya |
3227 |
PFileVar SendVar = NULL; |
| 67 |
zmatsuo |
9052 |
//PFileVar FileVar = NULL; |
| 68 |
|
|
//static PCHAR ProtoVar = NULL; |
| 69 |
|
|
//static int ProtoId; |
| 70 |
maya |
3227 |
|
| 71 |
doda |
3904 |
static BOOL FileRetrySend, FileRetryEcho, FileCRSend, FileReadEOF, BinaryMode; |
| 72 |
maya |
3227 |
static BYTE FileByte; |
| 73 |
|
|
|
| 74 |
maya |
6071 |
#define FILE_SEND_BUF_SIZE 8192 |
| 75 |
|
|
struct FileSendHandler { |
| 76 |
|
|
CHAR buf[FILE_SEND_BUF_SIZE]; |
| 77 |
|
|
int pos; |
| 78 |
|
|
int end; |
| 79 |
|
|
}; |
| 80 |
|
|
static struct FileSendHandler FileSendHandler; |
| 81 |
|
|
static int FileDlgRefresh; |
| 82 |
|
|
|
| 83 |
doda |
3904 |
static int FileBracketMode = FS_BRACKET_NONE; |
| 84 |
|
|
static int FileBracketPtr = 0; |
| 85 |
|
|
static char BracketStartStr[] = "\033[200~"; |
| 86 |
|
|
static char BracketEndStr[] = "\033[201~"; |
| 87 |
|
|
|
| 88 |
zmatsuo |
9052 |
BOOL FSend = FALSE; |
| 89 |
maya |
3227 |
|
| 90 |
|
|
static HMODULE HTTFILE = NULL; |
| 91 |
|
|
static int TTFILECount = 0; |
| 92 |
|
|
|
| 93 |
zmatsuo |
9053 |
#if 0 |
| 94 |
maya |
3227 |
PGetSetupFname GetSetupFname; |
| 95 |
zmatsuo |
9052 |
PGetTransFname GetTransFname; |
| 96 |
maya |
3227 |
PGetMultiFname GetMultiFname; |
| 97 |
|
|
PGetGetFname GetGetFname; |
| 98 |
|
|
PSetFileVar SetFileVar; |
| 99 |
|
|
PGetXFname GetXFname; |
| 100 |
zmatsuo |
9053 |
#endif |
| 101 |
zmatsuo |
9055 |
#if 0 |
| 102 |
maya |
3227 |
PProtoInit ProtoInit; |
| 103 |
zmatsuo |
9052 |
PProtoParse ProtoParse; |
| 104 |
maya |
3227 |
PProtoTimeOutProc ProtoTimeOutProc; |
| 105 |
|
|
PProtoCancel ProtoCancel; |
| 106 |
maya |
7182 |
PTTFILESetUILanguageFile TTFILESetUILanguageFile; |
| 107 |
|
|
PTTFILESetFileSendFilter TTFILESetFileSendFilter; |
| 108 |
zmatsuo |
9055 |
#endif |
| 109 |
maya |
3227 |
|
| 110 |
zmatsuo |
9053 |
#if 0 |
| 111 |
maya |
3227 |
#define IdGetSetupFname 1 |
| 112 |
|
|
#define IdGetTransFname 2 |
| 113 |
|
|
#define IdGetMultiFname 3 |
| 114 |
|
|
#define IdGetGetFname 4 |
| 115 |
|
|
#define IdSetFileVar 5 |
| 116 |
|
|
#define IdGetXFname 6 |
| 117 |
zmatsuo |
9053 |
#endif |
| 118 |
maya |
3227 |
|
| 119 |
|
|
#define IdProtoInit 7 |
| 120 |
|
|
#define IdProtoParse 8 |
| 121 |
|
|
#define IdProtoTimeOutProc 9 |
| 122 |
|
|
#define IdProtoCancel 10 |
| 123 |
|
|
|
| 124 |
maya |
7182 |
#define IdTTFILESetUILanguageFile 11 |
| 125 |
|
|
#define IdTTFILESetFileSendFilter 12 |
| 126 |
|
|
|
| 127 |
zmatsuo |
9055 |
#if 0 |
| 128 |
zmatsuo |
8858 |
BOOL LoadTTFILE(void) |
| 129 |
maya |
3227 |
{ |
| 130 |
|
|
BOOL Err; |
| 131 |
|
|
|
| 132 |
|
|
if (HTTFILE != NULL) |
| 133 |
|
|
{ |
| 134 |
|
|
TTFILECount++; |
| 135 |
|
|
return TRUE; |
| 136 |
|
|
} |
| 137 |
|
|
else |
| 138 |
|
|
TTFILECount = 0; |
| 139 |
|
|
|
| 140 |
doda |
6792 |
HTTFILE = LoadHomeDLL("TTPFILE.DLL"); |
| 141 |
maya |
3227 |
if (HTTFILE == NULL) |
| 142 |
|
|
return FALSE; |
| 143 |
|
|
|
| 144 |
maya |
7182 |
Err = FALSE; |
| 145 |
maya |
3227 |
|
| 146 |
zmatsuo |
9053 |
#if 0 |
| 147 |
maya |
3227 |
GetSetupFname = (PGetSetupFname)GetProcAddress(HTTFILE, |
| 148 |
|
|
MAKEINTRESOURCE(IdGetSetupFname)); |
| 149 |
|
|
if (GetSetupFname==NULL) |
| 150 |
|
|
Err = TRUE; |
| 151 |
|
|
|
| 152 |
|
|
GetTransFname = (PGetTransFname)GetProcAddress(HTTFILE, |
| 153 |
|
|
MAKEINTRESOURCE(IdGetTransFname)); |
| 154 |
|
|
if (GetTransFname==NULL) |
| 155 |
|
|
Err = TRUE; |
| 156 |
|
|
|
| 157 |
|
|
GetMultiFname = (PGetMultiFname)GetProcAddress(HTTFILE, |
| 158 |
|
|
MAKEINTRESOURCE(IdGetMultiFname)); |
| 159 |
|
|
if (GetMultiFname==NULL) |
| 160 |
|
|
Err = TRUE; |
| 161 |
|
|
|
| 162 |
|
|
GetGetFname = (PGetGetFname)GetProcAddress(HTTFILE, |
| 163 |
|
|
MAKEINTRESOURCE(IdGetGetFname)); |
| 164 |
|
|
if (GetGetFname==NULL) |
| 165 |
|
|
Err = TRUE; |
| 166 |
|
|
|
| 167 |
|
|
SetFileVar = (PSetFileVar)GetProcAddress(HTTFILE, |
| 168 |
|
|
MAKEINTRESOURCE(IdSetFileVar)); |
| 169 |
|
|
if (SetFileVar==NULL) |
| 170 |
|
|
Err = TRUE; |
| 171 |
|
|
|
| 172 |
|
|
GetXFname = (PGetXFname)GetProcAddress(HTTFILE, |
| 173 |
|
|
MAKEINTRESOURCE(IdGetXFname)); |
| 174 |
|
|
if (GetXFname==NULL) |
| 175 |
|
|
Err = TRUE; |
| 176 |
zmatsuo |
9053 |
#endif |
| 177 |
maya |
3227 |
|
| 178 |
|
|
ProtoInit = (PProtoInit)GetProcAddress(HTTFILE, |
| 179 |
|
|
MAKEINTRESOURCE(IdProtoInit)); |
| 180 |
|
|
if (ProtoInit==NULL) |
| 181 |
|
|
Err = TRUE; |
| 182 |
|
|
|
| 183 |
|
|
ProtoParse = (PProtoParse)GetProcAddress(HTTFILE, |
| 184 |
|
|
MAKEINTRESOURCE(IdProtoParse)); |
| 185 |
|
|
if (ProtoParse==NULL) |
| 186 |
|
|
Err = TRUE; |
| 187 |
|
|
|
| 188 |
|
|
ProtoTimeOutProc = (PProtoTimeOutProc)GetProcAddress(HTTFILE, |
| 189 |
|
|
MAKEINTRESOURCE(IdProtoTimeOutProc)); |
| 190 |
|
|
if (ProtoTimeOutProc==NULL) |
| 191 |
|
|
Err = TRUE; |
| 192 |
|
|
|
| 193 |
|
|
ProtoCancel = (PProtoCancel)GetProcAddress(HTTFILE, |
| 194 |
|
|
MAKEINTRESOURCE(IdProtoCancel)); |
| 195 |
|
|
if (ProtoCancel==NULL) |
| 196 |
|
|
Err = TRUE; |
| 197 |
|
|
|
| 198 |
maya |
7182 |
TTFILESetUILanguageFile = (PTTFILESetUILanguageFile)GetProcAddress(HTTFILE, |
| 199 |
|
|
MAKEINTRESOURCE(IdTTFILESetUILanguageFile)); |
| 200 |
|
|
if (TTFILESetUILanguageFile==NULL) { |
| 201 |
|
|
Err = TRUE; |
| 202 |
|
|
} |
| 203 |
|
|
else { |
| 204 |
|
|
TTFILESetUILanguageFile(ts.UILanguageFile); |
| 205 |
|
|
} |
| 206 |
|
|
|
| 207 |
|
|
TTFILESetFileSendFilter = (PTTFILESetFileSendFilter)GetProcAddress(HTTFILE, |
| 208 |
|
|
MAKEINTRESOURCE(IdTTFILESetFileSendFilter)); |
| 209 |
|
|
if (TTFILESetFileSendFilter==NULL) { |
| 210 |
|
|
Err = TRUE; |
| 211 |
|
|
} |
| 212 |
|
|
else { |
| 213 |
|
|
TTFILESetFileSendFilter(ts.FileSendFilter); |
| 214 |
|
|
} |
| 215 |
|
|
|
| 216 |
maya |
3227 |
if (Err) |
| 217 |
|
|
{ |
| 218 |
|
|
FreeLibrary(HTTFILE); |
| 219 |
|
|
HTTFILE = NULL; |
| 220 |
doda |
6435 |
return FALSE; |
| 221 |
maya |
3227 |
} |
| 222 |
|
|
else { |
| 223 |
|
|
TTFILECount = 1; |
| 224 |
|
|
return TRUE; |
| 225 |
|
|
} |
| 226 |
|
|
} |
| 227 |
|
|
|
| 228 |
zmatsuo |
8858 |
BOOL FreeTTFILE(void) |
| 229 |
maya |
3227 |
{ |
| 230 |
|
|
if (TTFILECount==0) |
| 231 |
|
|
return FALSE; |
| 232 |
|
|
TTFILECount--; |
| 233 |
|
|
if (TTFILECount>0) |
| 234 |
|
|
return TRUE; |
| 235 |
|
|
if (HTTFILE!=NULL) |
| 236 |
|
|
{ |
| 237 |
|
|
FreeLibrary(HTTFILE); |
| 238 |
|
|
HTTFILE = NULL; |
| 239 |
|
|
} |
| 240 |
|
|
return TRUE; |
| 241 |
|
|
} |
| 242 |
zmatsuo |
9055 |
#endif |
| 243 |
maya |
3227 |
|
| 244 |
|
|
static PFileTransDlg SendDlg = NULL; |
| 245 |
zmatsuo |
9052 |
//static PProtoDlg PtDlg = NULL; |
| 246 |
maya |
3227 |
|
| 247 |
zmatsuo |
7526 |
static BOOL OpenFTDlg(PFileVar fv) |
| 248 |
maya |
3227 |
{ |
| 249 |
|
|
PFileTransDlg FTDlg; |
| 250 |
|
|
|
| 251 |
|
|
FTDlg = new CFileTransDlg(); |
| 252 |
|
|
|
| 253 |
doda |
4454 |
fv->StartTime = 0; |
| 254 |
|
|
fv->ProgStat = 0; |
| 255 |
zmatsuo |
8857 |
cv.FilePause &= ~fv->OpId; |
| 256 |
doda |
4454 |
|
| 257 |
maya |
3227 |
if (FTDlg!=NULL) |
| 258 |
|
|
{ |
| 259 |
zmatsuo |
9056 |
CFileTransDlgInfo info; |
| 260 |
|
|
info.UILanguageFile = ts.UILanguageFile; |
| 261 |
|
|
info.OpId = OpSendFile; |
| 262 |
|
|
info.DlgCaption = ToWcharA(fv->DlgCaption); |
| 263 |
|
|
info.FileName = NULL; |
| 264 |
|
|
info.FullName = ToWcharA(fv->FullName); |
| 265 |
|
|
info.HideDialog = ts.LogHideDialog ? TRUE : FALSE; |
| 266 |
|
|
info.HMainWin = HVTWin; |
| 267 |
|
|
//FTDlg->Create(hInst, HVTWin, fv, &cv, &ts); |
| 268 |
|
|
FTDlg->Create(hInst, &info); |
| 269 |
|
|
//FTDlg->RefreshNum(fv); |
| 270 |
|
|
FTDlg->RefreshNum(0, fv->FileSize, fv->ByteCount); |
| 271 |
|
|
free(info.DlgCaption); |
| 272 |
|
|
free(info.FullName); |
| 273 |
maya |
3227 |
} |
| 274 |
|
|
|
| 275 |
zmatsuo |
8894 |
SendDlg = FTDlg; /* File send */ |
| 276 |
maya |
3227 |
|
| 277 |
doda |
6947 |
fv->StartTime = GetTickCount(); |
| 278 |
maya |
3227 |
|
| 279 |
|
|
return (FTDlg!=NULL); |
| 280 |
|
|
} |
| 281 |
|
|
|
| 282 |
zmatsuo |
8857 |
static void ShowFTDlg(WORD OpId) |
| 283 |
maya |
3227 |
{ |
| 284 |
zmatsuo |
8894 |
if (SendDlg != NULL) { |
| 285 |
|
|
SendDlg->ShowWindow(SW_SHOWNORMAL); |
| 286 |
|
|
SetForegroundWindow(SendDlg->GetSafeHwnd()); |
| 287 |
maya |
3227 |
} |
| 288 |
|
|
} |
| 289 |
|
|
|
| 290 |
zmatsuo |
9052 |
static BOOL NewFileVar(PFileVar *fv) |
| 291 |
maya |
3227 |
{ |
| 292 |
|
|
if ((*fv)==NULL) |
| 293 |
|
|
{ |
| 294 |
|
|
*fv = (PFileVar)malloc(sizeof(TFileVar)); |
| 295 |
|
|
if ((*fv)!=NULL) |
| 296 |
|
|
{ |
| 297 |
maya |
7951 |
char FileDirExpanded[MAX_PATH]; |
| 298 |
|
|
ExpandEnvironmentStrings(ts.FileDir, FileDirExpanded, sizeof(FileDirExpanded)); |
| 299 |
maya |
3227 |
memset(*fv, 0, sizeof(TFileVar)); |
| 300 |
maya |
7951 |
strncpy_s((*fv)->FullName, sizeof((*fv)->FullName), FileDirExpanded, _TRUNCATE); |
| 301 |
maya |
3227 |
AppendSlash((*fv)->FullName,sizeof((*fv)->FullName)); |
| 302 |
|
|
(*fv)->DirLen = strlen((*fv)->FullName); |
| 303 |
|
|
(*fv)->FileOpen = FALSE; |
| 304 |
|
|
(*fv)->OverWrite = ((ts.FTFlag & FT_RENAME) == 0); |
| 305 |
|
|
(*fv)->HMainWin = HVTWin; |
| 306 |
|
|
(*fv)->Success = FALSE; |
| 307 |
|
|
(*fv)->NoMsg = FALSE; |
| 308 |
|
|
(*fv)->HideDialog = FALSE; |
| 309 |
|
|
} |
| 310 |
|
|
} |
| 311 |
|
|
|
| 312 |
|
|
return ((*fv)!=NULL); |
| 313 |
|
|
} |
| 314 |
|
|
|
| 315 |
zmatsuo |
9052 |
static void FreeFileVar(PFileVar *fv) |
| 316 |
maya |
3227 |
{ |
| 317 |
|
|
if ((*fv)!=NULL) |
| 318 |
|
|
{ |
| 319 |
zmatsuo |
8894 |
if ((*fv)->FileOpen) CloseHandle((*fv)->FileHandle); |
| 320 |
zmatsuo |
7541 |
if ((*fv)->FnStrMemHandle != 0) |
| 321 |
maya |
3227 |
{ |
| 322 |
|
|
GlobalUnlock((*fv)->FnStrMemHandle); |
| 323 |
|
|
GlobalFree((*fv)->FnStrMemHandle); |
| 324 |
|
|
} |
| 325 |
|
|
free(*fv); |
| 326 |
|
|
*fv = NULL; |
| 327 |
|
|
} |
| 328 |
|
|
} |
| 329 |
|
|
|
| 330 |
zmatsuo |
9053 |
/* �_�C�A���O���������������� */ |
| 331 |
|
|
static void CenterCommonDialog(HWND hDlg) |
| 332 |
|
|
{ |
| 333 |
|
|
/* hDlg���e���_�C�A���O���E�B���h�E�n���h�� */ |
| 334 |
|
|
HWND hWndDlgRoot = GetParent(hDlg); |
| 335 |
|
|
CenterWindow(hWndDlgRoot, GetParent(hWndDlgRoot)); |
| 336 |
|
|
} |
| 337 |
|
|
|
| 338 |
|
|
static HFONT DlgFoptFont; |
| 339 |
|
|
static UINT_PTR CALLBACK TransFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) |
| 340 |
|
|
{ |
| 341 |
|
|
static const DlgTextInfo text_info[] = { |
| 342 |
|
|
{ IDC_FOPT, "DLG_FOPT" }, |
| 343 |
|
|
{ IDC_FOPTBIN, "DLG_FOPT_BINARY" }, |
| 344 |
|
|
}; |
| 345 |
|
|
LPOPENFILENAME ofn; |
| 346 |
|
|
LPWORD pw; |
| 347 |
|
|
LPOFNOTIFY notify; |
| 348 |
|
|
LOGFONT logfont; |
| 349 |
|
|
HFONT font; |
| 350 |
|
|
const char *UILanguageFile = ts.UILanguageFile; |
| 351 |
|
|
|
| 352 |
|
|
switch (Message) { |
| 353 |
|
|
case WM_INITDIALOG: |
| 354 |
|
|
ofn = (LPOPENFILENAME)lParam; |
| 355 |
|
|
pw = (LPWORD)ofn->lCustData; |
| 356 |
|
|
SetWindowLongPtr(Dialog, DWLP_USER, (LONG_PTR)pw); |
| 357 |
|
|
|
| 358 |
|
|
font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0); |
| 359 |
|
|
GetObject(font, sizeof(LOGFONT), &logfont); |
| 360 |
|
|
if (get_lang_font("DLG_TAHOMA_FONT", Dialog, &logfont, &DlgFoptFont, UILanguageFile)) { |
| 361 |
|
|
SendDlgItemMessage(Dialog, IDC_FOPT, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0)); |
| 362 |
|
|
SendDlgItemMessage(Dialog, IDC_FOPTBIN, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0)); |
| 363 |
|
|
SendDlgItemMessage(Dialog, IDC_FOPTAPPEND, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0)); |
| 364 |
|
|
SendDlgItemMessage(Dialog, IDC_PLAINTEXT, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0)); |
| 365 |
|
|
SendDlgItemMessage(Dialog, IDC_TIMESTAMP, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0)); |
| 366 |
|
|
} |
| 367 |
|
|
else { |
| 368 |
|
|
DlgFoptFont = NULL; |
| 369 |
|
|
} |
| 370 |
|
|
|
| 371 |
|
|
SetI18nDlgStrs("Tera Term", Dialog, text_info, _countof(text_info), UILanguageFile); |
| 372 |
|
|
|
| 373 |
|
|
SetRB(Dialog,*pw & 1,IDC_FOPTBIN,IDC_FOPTBIN); |
| 374 |
|
|
|
| 375 |
|
|
CenterCommonDialog(Dialog); |
| 376 |
|
|
|
| 377 |
|
|
return TRUE; |
| 378 |
|
|
case WM_COMMAND: // for old style dialog |
| 379 |
|
|
switch (LOWORD(wParam)) { |
| 380 |
|
|
case IDOK: |
| 381 |
|
|
pw = (LPWORD)GetWindowLongPtr(Dialog,DWLP_USER); |
| 382 |
|
|
if (pw!=NULL) |
| 383 |
|
|
GetRB(Dialog,pw,IDC_FOPTBIN,IDC_FOPTBIN); |
| 384 |
|
|
if (DlgFoptFont != NULL) { |
| 385 |
|
|
DeleteObject(DlgFoptFont); |
| 386 |
|
|
} |
| 387 |
|
|
break; |
| 388 |
|
|
case IDCANCEL: |
| 389 |
|
|
if (DlgFoptFont != NULL) { |
| 390 |
|
|
DeleteObject(DlgFoptFont); |
| 391 |
|
|
} |
| 392 |
|
|
break; |
| 393 |
|
|
} |
| 394 |
|
|
break; |
| 395 |
|
|
case WM_NOTIFY: // for Explorer-style dialog |
| 396 |
|
|
notify = (LPOFNOTIFY)lParam; |
| 397 |
|
|
switch (notify->hdr.code) { |
| 398 |
|
|
case CDN_FILEOK: |
| 399 |
|
|
pw = (LPWORD)GetWindowLongPtr(Dialog,DWLP_USER); |
| 400 |
|
|
if (pw!=NULL) |
| 401 |
|
|
GetRB(Dialog,pw,IDC_FOPTBIN,IDC_FOPTBIN); |
| 402 |
|
|
if (DlgFoptFont != NULL) { |
| 403 |
|
|
DeleteObject(DlgFoptFont); |
| 404 |
|
|
} |
| 405 |
|
|
break; |
| 406 |
|
|
} |
| 407 |
|
|
break; |
| 408 |
|
|
} |
| 409 |
|
|
return FALSE; |
| 410 |
|
|
} |
| 411 |
|
|
|
| 412 |
|
|
static BOOL _GetTransFname(PFileVar fv, PCHAR CurDir, WORD FuncId, LPLONG Option) |
| 413 |
|
|
{ |
| 414 |
|
|
char uimsg[MAX_UIMSG]; |
| 415 |
|
|
char *FNFilter; |
| 416 |
|
|
OPENFILENAME ofn; |
| 417 |
|
|
WORD optw; |
| 418 |
|
|
wchar_t TempDir[MAXPATHLEN]; |
| 419 |
|
|
BOOL Ok; |
| 420 |
|
|
char FileName[MAX_PATH]; |
| 421 |
|
|
const char *UILanguageFile = ts.UILanguageFile; |
| 422 |
|
|
|
| 423 |
|
|
/* save current dir */ |
| 424 |
|
|
_GetCurrentDirectoryW(_countof(TempDir), TempDir); |
| 425 |
|
|
|
| 426 |
|
|
memset(&ofn, 0, sizeof(OPENFILENAME)); |
| 427 |
|
|
|
| 428 |
|
|
strncpy_s(fv->DlgCaption, sizeof(fv->DlgCaption),"Tera Term: ", _TRUNCATE); |
| 429 |
|
|
switch (FuncId) { |
| 430 |
|
|
case GTF_SEND: |
| 431 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_SENDFILE", uimsg, sizeof(uimsg), TitSendFile, UILanguageFile); |
| 432 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 433 |
|
|
break; |
| 434 |
|
|
case GTF_BP: |
| 435 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_BPSEND", uimsg, sizeof(uimsg), TitBPSend, UILanguageFile); |
| 436 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 437 |
|
|
break; |
| 438 |
|
|
default: |
| 439 |
|
|
return FALSE; |
| 440 |
|
|
} |
| 441 |
|
|
|
| 442 |
|
|
FNFilter = GetCommonDialogFilterA(ts.FileSendFilter, UILanguageFile); |
| 443 |
|
|
|
| 444 |
|
|
ExtractFileName(fv->FullName, FileName ,sizeof(FileName)); |
| 445 |
|
|
strncpy_s(fv->FullName, sizeof(fv->FullName), FileName, _TRUNCATE); |
| 446 |
|
|
ofn.lStructSize = get_OPENFILENAME_SIZE(); |
| 447 |
|
|
ofn.hwndOwner = fv->HMainWin; |
| 448 |
|
|
ofn.lpstrFilter = FNFilter; |
| 449 |
|
|
ofn.nFilterIndex = 1; |
| 450 |
|
|
ofn.lpstrFile = fv->FullName; |
| 451 |
|
|
ofn.nMaxFile = sizeof(fv->FullName); |
| 452 |
|
|
ofn.lpstrInitialDir = CurDir; |
| 453 |
|
|
|
| 454 |
|
|
switch (FuncId) { |
| 455 |
|
|
case GTF_SEND: |
| 456 |
|
|
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; |
| 457 |
|
|
ofn.Flags |= OFN_ENABLETEMPLATE | OFN_ENABLEHOOK | OFN_EXPLORER | OFN_ENABLESIZING; |
| 458 |
|
|
ofn.lpTemplateName = MAKEINTRESOURCE(IDD_FOPT); |
| 459 |
|
|
|
| 460 |
|
|
ofn.lpfnHook = (LPOFNHOOKPROC)(&TransFnHook); |
| 461 |
|
|
optw = (WORD)*Option; |
| 462 |
|
|
ofn.lCustData = (LPARAM)&optw; |
| 463 |
|
|
break; |
| 464 |
|
|
case GTF_BP: |
| 465 |
|
|
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; |
| 466 |
|
|
break; |
| 467 |
|
|
} |
| 468 |
|
|
|
| 469 |
|
|
ofn.Flags |= OFN_SHOWHELP; |
| 470 |
|
|
|
| 471 |
|
|
ofn.lpstrTitle = fv->DlgCaption; |
| 472 |
|
|
|
| 473 |
|
|
ofn.hInstance = hInst; |
| 474 |
|
|
|
| 475 |
|
|
Ok = GetOpenFileName(&ofn); |
| 476 |
|
|
free(FNFilter); |
| 477 |
|
|
|
| 478 |
|
|
if (Ok) { |
| 479 |
|
|
*Option = (long)optw; |
| 480 |
|
|
|
| 481 |
|
|
fv->DirLen = ofn.nFileOffset; |
| 482 |
|
|
|
| 483 |
|
|
if (CurDir!=NULL) { |
| 484 |
|
|
memcpy(CurDir,fv->FullName,fv->DirLen-1); |
| 485 |
|
|
CurDir[fv->DirLen-1] = 0; |
| 486 |
|
|
} |
| 487 |
|
|
} |
| 488 |
|
|
/* restore dir */ |
| 489 |
|
|
_SetCurrentDirectoryW(TempDir); |
| 490 |
|
|
return Ok; |
| 491 |
|
|
} |
| 492 |
|
|
|
| 493 |
|
|
static void _SetFileVar(PFileVar fv) |
| 494 |
|
|
{ |
| 495 |
|
|
int i; |
| 496 |
|
|
char uimsg[MAX_UIMSG]; |
| 497 |
|
|
char c; |
| 498 |
|
|
const char *UILanguageFile = ts.UILanguageFile; |
| 499 |
|
|
|
| 500 |
|
|
GetFileNamePos(fv->FullName,&(fv->DirLen),&i); |
| 501 |
|
|
c = fv->FullName[fv->DirLen]; |
| 502 |
|
|
if (c=='\\'||c=='/') fv->DirLen++; |
| 503 |
|
|
strncpy_s(fv->DlgCaption, sizeof(fv->DlgCaption),"Tera Term: ", _TRUNCATE); |
| 504 |
|
|
switch (fv->OpId) { |
| 505 |
|
|
case OpLog: |
| 506 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_LOG", uimsg, sizeof(uimsg), TitLog, UILanguageFile); |
| 507 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 508 |
|
|
break; |
| 509 |
|
|
case OpSendFile: |
| 510 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_SENDFILE", uimsg, sizeof(uimsg), TitSendFile, UILanguageFile); |
| 511 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 512 |
|
|
break; |
| 513 |
|
|
case OpKmtRcv: |
| 514 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_KMTRCV", uimsg, sizeof(uimsg), TitKmtRcv, UILanguageFile); |
| 515 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 516 |
|
|
break; |
| 517 |
|
|
case OpKmtGet: |
| 518 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_KMTGET", uimsg, sizeof(uimsg), TitKmtGet, UILanguageFile); |
| 519 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 520 |
|
|
break; |
| 521 |
|
|
case OpKmtSend: |
| 522 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_KMTSEND", uimsg, sizeof(uimsg), TitKmtSend, UILanguageFile); |
| 523 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 524 |
|
|
break; |
| 525 |
|
|
case OpKmtFin: |
| 526 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_KMTFIN", uimsg, sizeof(uimsg), TitKmtFin, UILanguageFile); |
| 527 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 528 |
|
|
break; |
| 529 |
|
|
case OpXRcv: |
| 530 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_XRCV", uimsg, sizeof(uimsg), TitXRcv, UILanguageFile); |
| 531 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 532 |
|
|
break; |
| 533 |
|
|
case OpXSend: |
| 534 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_XSEND", uimsg, sizeof(uimsg), TitXSend, UILanguageFile); |
| 535 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 536 |
|
|
break; |
| 537 |
|
|
case OpYRcv: |
| 538 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_YRCV", uimsg, sizeof(uimsg), TitYRcv, UILanguageFile); |
| 539 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 540 |
|
|
break; |
| 541 |
|
|
case OpYSend: |
| 542 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_YSEND", uimsg, sizeof(uimsg), TitYSend, UILanguageFile); |
| 543 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 544 |
|
|
break; |
| 545 |
|
|
case OpZRcv: |
| 546 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_ZRCV", uimsg, sizeof(uimsg), TitZRcv, UILanguageFile); |
| 547 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 548 |
|
|
break; |
| 549 |
|
|
case OpZSend: |
| 550 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_ZSEND", uimsg, sizeof(uimsg), TitZSend, UILanguageFile); |
| 551 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 552 |
|
|
break; |
| 553 |
|
|
case OpBPRcv: |
| 554 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_BPRCV", uimsg, sizeof(uimsg), TitBPRcv, UILanguageFile); |
| 555 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 556 |
|
|
break; |
| 557 |
|
|
case OpBPSend: |
| 558 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_BPSEND", uimsg, sizeof(uimsg), TitBPSend, UILanguageFile); |
| 559 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 560 |
|
|
break; |
| 561 |
|
|
case OpQVRcv: |
| 562 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_QVRCV", uimsg, sizeof(uimsg), TitQVRcv, UILanguageFile); |
| 563 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 564 |
|
|
break; |
| 565 |
|
|
case OpQVSend: |
| 566 |
|
|
get_lang_msg("FILEDLG_TRANS_TITLE_QVSEND", uimsg, sizeof(uimsg), TitQVSend, UILanguageFile); |
| 567 |
|
|
strncat_s(fv->DlgCaption, sizeof(fv->DlgCaption), uimsg, _TRUNCATE); |
| 568 |
|
|
break; |
| 569 |
|
|
} |
| 570 |
|
|
} |
| 571 |
|
|
|
| 572 |
zmatsuo |
8858 |
void FileSendStart(void) |
| 573 |
maya |
3227 |
{ |
| 574 |
doda |
6946 |
LONG Option = 0; |
| 575 |
maya |
3227 |
|
| 576 |
|
|
if (! cv.Ready || FSend) return; |
| 577 |
|
|
if (cv.ProtoFlag) |
| 578 |
|
|
{ |
| 579 |
|
|
FreeFileVar(&SendVar); |
| 580 |
|
|
return; |
| 581 |
|
|
} |
| 582 |
|
|
|
| 583 |
zmatsuo |
9055 |
#if 0 |
| 584 |
doda |
6435 |
if (! LoadTTFILE()) |
| 585 |
maya |
3227 |
return; |
| 586 |
zmatsuo |
9055 |
#endif |
| 587 |
maya |
3227 |
if (! NewFileVar(&SendVar)) |
| 588 |
|
|
{ |
| 589 |
zmatsuo |
9055 |
#if 0 |
| 590 |
maya |
3227 |
FreeTTFILE(); |
| 591 |
zmatsuo |
9055 |
#endif |
| 592 |
maya |
3227 |
return; |
| 593 |
|
|
} |
| 594 |
|
|
SendVar->OpId = OpSendFile; |
| 595 |
|
|
|
| 596 |
|
|
FSend = TRUE; |
| 597 |
|
|
|
| 598 |
maya |
7951 |
if (strlen(&(SendVar->FullName[SendVar->DirLen])) == 0) { |
| 599 |
|
|
char FileDirExpanded[MAX_PATH]; |
| 600 |
|
|
ExpandEnvironmentStrings(ts.FileDir, FileDirExpanded, sizeof(FileDirExpanded)); |
| 601 |
doda |
6946 |
if (ts.TransBin) |
| 602 |
|
|
Option |= LOGDLG_BINARY; |
| 603 |
maya |
3227 |
SendVar->FullName[0] = 0; |
| 604 |
zmatsuo |
9053 |
if (! _GetTransFname(SendVar, FileDirExpanded, GTF_SEND, &Option)) { |
| 605 |
maya |
3227 |
FileTransEnd(OpSendFile); |
| 606 |
|
|
return; |
| 607 |
|
|
} |
| 608 |
doda |
6946 |
ts.TransBin = CheckFlag(Option, LOGDLG_BINARY); |
| 609 |
maya |
3227 |
} |
| 610 |
|
|
else |
| 611 |
zmatsuo |
9053 |
_SetFileVar(SendVar); |
| 612 |
maya |
3227 |
|
| 613 |
zmatsuo |
7290 |
SendVar->FileHandle = CreateFile(SendVar->FullName, GENERIC_READ, FILE_SHARE_READ, NULL, |
| 614 |
|
|
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); |
| 615 |
|
|
SendVar->FileOpen = (SendVar->FileHandle != INVALID_HANDLE_VALUE); |
| 616 |
maya |
3227 |
if (! SendVar->FileOpen) |
| 617 |
|
|
{ |
| 618 |
|
|
FileTransEnd(OpSendFile); |
| 619 |
|
|
return; |
| 620 |
|
|
} |
| 621 |
|
|
SendVar->ByteCount = 0; |
| 622 |
|
|
SendVar->FileSize = GetFSize(SendVar->FullName); |
| 623 |
|
|
|
| 624 |
|
|
TalkStatus = IdTalkFile; |
| 625 |
|
|
FileRetrySend = FALSE; |
| 626 |
|
|
FileRetryEcho = FALSE; |
| 627 |
|
|
FileCRSend = FALSE; |
| 628 |
doda |
3904 |
FileReadEOF = FALSE; |
| 629 |
maya |
6071 |
FileSendHandler.pos = 0; |
| 630 |
|
|
FileSendHandler.end = 0; |
| 631 |
|
|
FileDlgRefresh = 0; |
| 632 |
maya |
3227 |
|
| 633 |
doda |
3904 |
if (BracketedPasteMode()) { |
| 634 |
|
|
FileBracketMode = FS_BRACKET_START; |
| 635 |
|
|
FileBracketPtr = 0; |
| 636 |
|
|
BinaryMode = TRUE; |
| 637 |
|
|
} |
| 638 |
|
|
else { |
| 639 |
|
|
FileBracketMode = FS_BRACKET_NONE; |
| 640 |
|
|
BinaryMode = ts.TransBin; |
| 641 |
|
|
} |
| 642 |
|
|
|
| 643 |
maya |
3227 |
if (! OpenFTDlg(SendVar)) |
| 644 |
|
|
FileTransEnd(OpSendFile); |
| 645 |
|
|
} |
| 646 |
|
|
|
| 647 |
zmatsuo |
8949 |
BOOL FileSendStart2(const char *filename, int binary) |
| 648 |
|
|
{ |
| 649 |
|
|
if (SendVar != NULL) { |
| 650 |
|
|
return FALSE; |
| 651 |
|
|
} |
| 652 |
|
|
if (!NewFileVar(&SendVar)) { |
| 653 |
|
|
return FALSE; |
| 654 |
|
|
} |
| 655 |
|
|
|
| 656 |
|
|
SendVar->DirLen = 0; |
| 657 |
|
|
strncpy_s(SendVar->FullName, sizeof(SendVar->FullName), filename, _TRUNCATE); |
| 658 |
|
|
ts.TransBin = binary; |
| 659 |
|
|
SendVar->NoMsg = TRUE; |
| 660 |
|
|
FileSendStart(); |
| 661 |
|
|
|
| 662 |
|
|
return TRUE; |
| 663 |
|
|
} |
| 664 |
|
|
|
| 665 |
maya |
3227 |
void FileTransEnd(WORD OpId) |
| 666 |
|
|
/* OpId = 0: close Log and FileSend |
| 667 |
|
|
OpLog: close Log |
| 668 |
|
|
OpSendFile: close FileSend */ |
| 669 |
|
|
{ |
| 670 |
zmatsuo |
8900 |
if ((OpId==0) || (OpId==OpLog)) { |
| 671 |
|
|
if (FLogIsOpend()) { |
| 672 |
|
|
FLogClose(); |
| 673 |
|
|
} |
| 674 |
maya |
3227 |
} |
| 675 |
|
|
|
| 676 |
|
|
if (((OpId==0) || (OpId==OpSendFile)) && FSend) |
| 677 |
|
|
{ |
| 678 |
|
|
FSend = FALSE; |
| 679 |
|
|
TalkStatus = IdTalkKeyb; |
| 680 |
|
|
if (SendDlg!=NULL) |
| 681 |
|
|
{ |
| 682 |
|
|
SendDlg->DestroyWindow(); |
| 683 |
|
|
SendDlg = NULL; |
| 684 |
|
|
} |
| 685 |
|
|
FreeFileVar(&SendVar); |
| 686 |
zmatsuo |
9055 |
#if 0 |
| 687 |
maya |
3227 |
FreeTTFILE(); |
| 688 |
zmatsuo |
9055 |
#endif |
| 689 |
maya |
3227 |
} |
| 690 |
|
|
|
| 691 |
|
|
EndDdeCmnd(0); |
| 692 |
|
|
} |
| 693 |
|
|
|
| 694 |
zmatsuo |
8857 |
void FileTransPause(WORD OpId, BOOL Pause) |
| 695 |
|
|
{ |
| 696 |
|
|
if (Pause) { |
| 697 |
|
|
cv.FilePause |= OpId; |
| 698 |
|
|
} |
| 699 |
|
|
else { |
| 700 |
|
|
cv.FilePause &= ~OpId; |
| 701 |
|
|
} |
| 702 |
|
|
} |
| 703 |
|
|
|
| 704 |
maya |
3227 |
int FSOut1(BYTE b) |
| 705 |
|
|
{ |
| 706 |
doda |
3904 |
if (BinaryMode) |
| 707 |
maya |
3227 |
return CommBinaryOut(&cv,(PCHAR)&b,1); |
| 708 |
|
|
else if ((b>=0x20) || (b==0x09) || (b==0x0A) || (b==0x0D)) |
| 709 |
|
|
return CommTextOut(&cv,(PCHAR)&b,1); |
| 710 |
|
|
else |
| 711 |
|
|
return 1; |
| 712 |
doda |
3861 |
} |
| 713 |
maya |
3227 |
|
| 714 |
|
|
int FSEcho1(BYTE b) |
| 715 |
|
|
{ |
| 716 |
doda |
3904 |
if (BinaryMode) |
| 717 |
maya |
3227 |
return CommBinaryEcho(&cv,(PCHAR)&b,1); |
| 718 |
|
|
else |
| 719 |
|
|
return CommTextEcho(&cv,(PCHAR)&b,1); |
| 720 |
|
|
} |
| 721 |
|
|
|
| 722 |
maya |
6071 |
// �������������������������g�� |
| 723 |
|
|
// - BinaryMode == true |
| 724 |
|
|
// - FileBracketMode == false |
| 725 |
|
|
// - cv.TelFlag == false |
| 726 |
|
|
// - ts.LocalEcho == 0 |
| 727 |
zmatsuo |
8894 |
static void FileSendBinayBoost(void) |
| 728 |
maya |
6071 |
{ |
| 729 |
|
|
WORD c, fc; |
| 730 |
|
|
LONG BCOld; |
| 731 |
|
|
DWORD read_bytes; |
| 732 |
|
|
|
| 733 |
|
|
if ((SendDlg == NULL) || |
| 734 |
|
|
((cv.FilePause & OpSendFile) != 0)) |
| 735 |
|
|
return; |
| 736 |
|
|
|
| 737 |
|
|
BCOld = SendVar->ByteCount; |
| 738 |
|
|
|
| 739 |
|
|
if (FileRetrySend) |
| 740 |
|
|
{ |
| 741 |
|
|
c = CommRawOut(&cv, &(FileSendHandler.buf[FileSendHandler.pos]), |
| 742 |
|
|
FileSendHandler.end - FileSendHandler.pos); |
| 743 |
|
|
FileSendHandler.pos += c; |
| 744 |
|
|
FileRetrySend = (FileSendHandler.end != FileSendHandler.pos); |
| 745 |
|
|
if (FileRetrySend) |
| 746 |
|
|
return; |
| 747 |
|
|
} |
| 748 |
|
|
|
| 749 |
|
|
do { |
| 750 |
|
|
if (FileSendHandler.pos == FileSendHandler.end) { |
| 751 |
zmatsuo |
7930 |
ReadFile(SendVar->FileHandle, &(FileSendHandler.buf[0]), sizeof(FileSendHandler.buf), &read_bytes, NULL); |
| 752 |
maya |
6071 |
fc = LOWORD(read_bytes); |
| 753 |
|
|
FileSendHandler.pos = 0; |
| 754 |
|
|
FileSendHandler.end = fc; |
| 755 |
|
|
} else { |
| 756 |
|
|
fc = FileSendHandler.end - FileSendHandler.end; |
| 757 |
|
|
} |
| 758 |
|
|
|
| 759 |
|
|
if (fc != 0) |
| 760 |
|
|
{ |
| 761 |
|
|
c = CommRawOut(&cv, &(FileSendHandler.buf[FileSendHandler.pos]), |
| 762 |
|
|
FileSendHandler.end - FileSendHandler.pos); |
| 763 |
|
|
FileSendHandler.pos += c; |
| 764 |
|
|
FileRetrySend = (FileSendHandler.end != FileSendHandler.pos); |
| 765 |
|
|
SendVar->ByteCount = SendVar->ByteCount + c; |
| 766 |
|
|
if (FileRetrySend) |
| 767 |
|
|
{ |
| 768 |
zmatsuo |
9056 |
if (SendVar->ByteCount != BCOld) { |
| 769 |
|
|
//SendDlg->RefreshNum(SendVar); |
| 770 |
|
|
SendDlg->RefreshNum(SendVar->StartTime, SendVar->FileSize, SendVar->ByteCount); |
| 771 |
|
|
} |
| 772 |
maya |
6071 |
return; |
| 773 |
|
|
} |
| 774 |
|
|
} |
| 775 |
|
|
FileDlgRefresh = SendVar->ByteCount; |
| 776 |
zmatsuo |
9056 |
//SendDlg->RefreshNum(SendVar); |
| 777 |
|
|
SendDlg->RefreshNum(SendVar->StartTime, SendVar->FileSize, SendVar->ByteCount); |
| 778 |
maya |
6071 |
BCOld = SendVar->ByteCount; |
| 779 |
|
|
if (fc != 0) |
| 780 |
|
|
return; |
| 781 |
|
|
} while (fc != 0); |
| 782 |
|
|
|
| 783 |
|
|
FileTransEnd(OpSendFile); |
| 784 |
|
|
} |
| 785 |
|
|
|
| 786 |
zmatsuo |
8858 |
void FileSend(void) |
| 787 |
maya |
3227 |
{ |
| 788 |
|
|
WORD c, fc; |
| 789 |
|
|
LONG BCOld; |
| 790 |
maya |
5281 |
DWORD read_bytes; |
| 791 |
maya |
3227 |
|
| 792 |
maya |
6115 |
if (cv.PortType == IdSerial && ts.FileSendHighSpeedMode && |
| 793 |
maya |
6110 |
BinaryMode && !FileBracketMode && !cv.TelFlag && |
| 794 |
maya |
6079 |
(ts.LocalEcho == 0) && (ts.Baud >= 115200)) { |
| 795 |
maya |
6071 |
return FileSendBinayBoost(); |
| 796 |
|
|
} |
| 797 |
|
|
|
| 798 |
maya |
3227 |
if ((SendDlg==NULL) || |
| 799 |
|
|
((cv.FilePause & OpSendFile) !=0)) |
| 800 |
|
|
return; |
| 801 |
|
|
|
| 802 |
|
|
BCOld = SendVar->ByteCount; |
| 803 |
|
|
|
| 804 |
|
|
if (FileRetrySend) |
| 805 |
|
|
{ |
| 806 |
|
|
FileRetryEcho = (ts.LocalEcho>0); |
| 807 |
|
|
c = FSOut1(FileByte); |
| 808 |
|
|
FileRetrySend = (c==0); |
| 809 |
|
|
if (FileRetrySend) |
| 810 |
|
|
return; |
| 811 |
|
|
} |
| 812 |
|
|
|
| 813 |
|
|
if (FileRetryEcho) |
| 814 |
|
|
{ |
| 815 |
|
|
c = FSEcho1(FileByte); |
| 816 |
|
|
FileRetryEcho = (c==0); |
| 817 |
|
|
if (FileRetryEcho) |
| 818 |
|
|
return; |
| 819 |
|
|
} |
| 820 |
|
|
|
| 821 |
|
|
do { |
| 822 |
doda |
3904 |
if (FileBracketMode == FS_BRACKET_START) { |
| 823 |
|
|
FileByte = BracketStartStr[FileBracketPtr++]; |
| 824 |
|
|
fc = 1; |
| 825 |
maya |
3227 |
|
| 826 |
doda |
3904 |
if (FileBracketPtr >= sizeof(BracketStartStr) - 1) { |
| 827 |
|
|
FileBracketMode = FS_BRACKET_END; |
| 828 |
|
|
FileBracketPtr = 0; |
| 829 |
|
|
BinaryMode = ts.TransBin; |
| 830 |
|
|
} |
| 831 |
|
|
} |
| 832 |
|
|
else if (! FileReadEOF) { |
| 833 |
zmatsuo |
7930 |
ReadFile(SendVar->FileHandle, &FileByte, 1, &read_bytes, NULL); |
| 834 |
maya |
5281 |
fc = LOWORD(read_bytes); |
| 835 |
maya |
3227 |
SendVar->ByteCount = SendVar->ByteCount + fc; |
| 836 |
doda |
3904 |
|
| 837 |
|
|
if (FileCRSend && (fc==1) && (FileByte==0x0A)) { |
| 838 |
zmatsuo |
7930 |
ReadFile(SendVar->FileHandle, &FileByte, 1, &read_bytes, NULL); |
| 839 |
maya |
5281 |
fc = LOWORD(read_bytes); |
| 840 |
doda |
3904 |
SendVar->ByteCount = SendVar->ByteCount + fc; |
| 841 |
|
|
} |
| 842 |
maya |
3227 |
} |
| 843 |
doda |
3904 |
else { |
| 844 |
|
|
fc = 0; |
| 845 |
|
|
} |
| 846 |
maya |
3227 |
|
| 847 |
doda |
3904 |
if (fc == 0 && FileBracketMode == FS_BRACKET_END) { |
| 848 |
|
|
FileReadEOF = TRUE; |
| 849 |
|
|
FileByte = BracketEndStr[FileBracketPtr++]; |
| 850 |
|
|
fc = 1; |
| 851 |
|
|
BinaryMode = TRUE; |
| 852 |
|
|
|
| 853 |
|
|
if (FileBracketPtr >= sizeof(BracketEndStr) - 1) { |
| 854 |
|
|
FileBracketMode = FS_BRACKET_NONE; |
| 855 |
|
|
FileBracketPtr = 0; |
| 856 |
|
|
} |
| 857 |
|
|
} |
| 858 |
|
|
|
| 859 |
|
|
|
| 860 |
maya |
3227 |
if (fc!=0) |
| 861 |
|
|
{ |
| 862 |
|
|
c = FSOut1(FileByte); |
| 863 |
|
|
FileCRSend = (ts.TransBin==0) && (FileByte==0x0D); |
| 864 |
|
|
FileRetrySend = (c==0); |
| 865 |
|
|
if (FileRetrySend) |
| 866 |
|
|
{ |
| 867 |
zmatsuo |
9056 |
if (SendVar->ByteCount != BCOld) { |
| 868 |
|
|
//SendDlg->RefreshNum(SendVar); |
| 869 |
|
|
SendDlg->RefreshNum(SendVar->StartTime, SendVar->FileSize, SendVar->ByteCount); |
| 870 |
|
|
} |
| 871 |
maya |
3227 |
return; |
| 872 |
|
|
} |
| 873 |
|
|
if (ts.LocalEcho>0) |
| 874 |
|
|
{ |
| 875 |
|
|
c = FSEcho1(FileByte); |
| 876 |
|
|
FileRetryEcho = (c==0); |
| 877 |
|
|
if (FileRetryEcho) |
| 878 |
|
|
return; |
| 879 |
|
|
} |
| 880 |
|
|
} |
| 881 |
doda |
3904 |
if ((fc==0) || ((SendVar->ByteCount % 100 == 0) && (FileBracketPtr == 0))) { |
| 882 |
zmatsuo |
9056 |
//SendDlg->RefreshNum(SendVar); |
| 883 |
|
|
SendDlg->RefreshNum(SendVar->StartTime, SendVar->FileSize, SendVar->ByteCount); |
| 884 |
maya |
3227 |
BCOld = SendVar->ByteCount; |
| 885 |
|
|
if (fc!=0) |
| 886 |
|
|
return; |
| 887 |
|
|
} |
| 888 |
|
|
} while (fc!=0); |
| 889 |
|
|
|
| 890 |
|
|
FileTransEnd(OpSendFile); |
| 891 |
|
|
} |
| 892 |
|
|
|
| 893 |
zmatsuo |
9052 |
#if 0 |
| 894 |
zmatsuo |
8857 |
static BOOL OpenProtoDlg(PFileVar fv, int IdProto, int Mode, WORD Opt1, WORD Opt2) |
| 895 |
maya |
3227 |
{ |
| 896 |
|
|
int vsize; |
| 897 |
|
|
PProtoDlg pd; |
| 898 |
|
|
|
| 899 |
|
|
ProtoId = IdProto; |
| 900 |
|
|
|
| 901 |
|
|
switch (ProtoId) { |
| 902 |
|
|
case PROTO_KMT: |
| 903 |
|
|
vsize = sizeof(TKmtVar); |
| 904 |
|
|
break; |
| 905 |
|
|
case PROTO_XM: |
| 906 |
|
|
vsize = sizeof(TXVar); |
| 907 |
|
|
break; |
| 908 |
|
|
case PROTO_YM: |
| 909 |
|
|
vsize = sizeof(TYVar); |
| 910 |
|
|
break; |
| 911 |
|
|
case PROTO_ZM: |
| 912 |
|
|
vsize = sizeof(TZVar); |
| 913 |
|
|
break; |
| 914 |
|
|
case PROTO_BP: |
| 915 |
|
|
vsize = sizeof(TBPVar); |
| 916 |
|
|
break; |
| 917 |
|
|
case PROTO_QV: |
| 918 |
|
|
vsize = sizeof(TQVVar); |
| 919 |
|
|
break; |
| 920 |
zmatsuo |
8852 |
default: |
| 921 |
|
|
vsize = 0; |
| 922 |
|
|
assert(FALSE); |
| 923 |
|
|
break; |
| 924 |
maya |
3227 |
} |
| 925 |
|
|
ProtoVar = (PCHAR)malloc(vsize); |
| 926 |
|
|
if (ProtoVar==NULL) |
| 927 |
|
|
return FALSE; |
| 928 |
|
|
|
| 929 |
|
|
switch (ProtoId) { |
| 930 |
|
|
case PROTO_KMT: |
| 931 |
|
|
((PKmtVar)ProtoVar)->KmtMode = Mode; |
| 932 |
|
|
break; |
| 933 |
|
|
case PROTO_XM: |
| 934 |
|
|
((PXVar)ProtoVar)->XMode = Mode; |
| 935 |
|
|
((PXVar)ProtoVar)->XOpt = Opt1; |
| 936 |
|
|
((PXVar)ProtoVar)->TextFlag = 1 - (Opt2 & 1); |
| 937 |
|
|
break; |
| 938 |
doda |
6435 |
case PROTO_YM: |
| 939 |
maya |
3227 |
((PYVar)ProtoVar)->YMode = Mode; |
| 940 |
yutakapon |
3819 |
((PYVar)ProtoVar)->YOpt = Opt1; |
| 941 |
maya |
3227 |
break; |
| 942 |
|
|
case PROTO_ZM: |
| 943 |
|
|
((PZVar)ProtoVar)->BinFlag = (Opt1 & 1) != 0; |
| 944 |
|
|
((PZVar)ProtoVar)->ZMode = Mode; |
| 945 |
|
|
break; |
| 946 |
|
|
case PROTO_BP: |
| 947 |
|
|
((PBPVar)ProtoVar)->BPMode = Mode; |
| 948 |
|
|
break; |
| 949 |
|
|
case PROTO_QV: |
| 950 |
|
|
((PQVVar)ProtoVar)->QVMode = Mode; |
| 951 |
|
|
break; |
| 952 |
|
|
} |
| 953 |
|
|
|
| 954 |
|
|
pd = new CProtoDlg(); |
| 955 |
|
|
if (pd==NULL) |
| 956 |
|
|
{ |
| 957 |
|
|
free(ProtoVar); |
| 958 |
|
|
ProtoVar = NULL; |
| 959 |
|
|
return FALSE; |
| 960 |
|
|
} |
| 961 |
zmatsuo |
8947 |
CProtoDlgInfo info; |
| 962 |
|
|
info.UILanguageFile = ts.UILanguageFile; |
| 963 |
|
|
info.HMainWin = fv->HMainWin; |
| 964 |
|
|
pd->Create(hInst, HVTWin, &info); |
| 965 |
|
|
fv->HWin = pd->m_hWnd; |
| 966 |
maya |
3227 |
|
| 967 |
|
|
(*ProtoInit)(ProtoId,FileVar,ProtoVar,&cv,&ts); |
| 968 |
|
|
|
| 969 |
|
|
PtDlg = pd; |
| 970 |
|
|
return TRUE; |
| 971 |
|
|
} |
| 972 |
|
|
|
| 973 |
zmatsuo |
8858 |
static void CloseProtoDlg(void) |
| 974 |
maya |
3227 |
{ |
| 975 |
|
|
if (PtDlg!=NULL) |
| 976 |
|
|
{ |
| 977 |
|
|
PtDlg->DestroyWindow(); |
| 978 |
|
|
PtDlg = NULL; |
| 979 |
|
|
|
| 980 |
|
|
::KillTimer(FileVar->HMainWin,IdProtoTimer); |
| 981 |
|
|
if ((ProtoId==PROTO_QV) && |
| 982 |
|
|
(((PQVVar)ProtoVar)->QVMode==IdQVSend)) |
| 983 |
|
|
CommTextOut(&cv,"\015",1); |
| 984 |
|
|
if (FileVar->LogFlag) |
| 985 |
zmatsuo |
7290 |
CloseHandle(FileVar->LogFile); |
| 986 |
maya |
3227 |
FileVar->LogFile = 0; |
| 987 |
|
|
if (ProtoVar!=NULL) |
| 988 |
|
|
{ |
| 989 |
|
|
free(ProtoVar); |
| 990 |
|
|
ProtoVar = NULL; |
| 991 |
|
|
} |
| 992 |
|
|
} |
| 993 |
|
|
} |
| 994 |
|
|
|
| 995 |
zmatsuo |
8858 |
static BOOL ProtoStart(void) |
| 996 |
maya |
3227 |
{ |
| 997 |
|
|
if (cv.ProtoFlag) |
| 998 |
|
|
return FALSE; |
| 999 |
|
|
if (FSend) |
| 1000 |
|
|
{ |
| 1001 |
|
|
FreeFileVar(&FileVar); |
| 1002 |
|
|
return FALSE; |
| 1003 |
|
|
} |
| 1004 |
|
|
|
| 1005 |
|
|
if (! LoadTTFILE()) |
| 1006 |
|
|
return FALSE; |
| 1007 |
|
|
NewFileVar(&FileVar); |
| 1008 |
|
|
|
| 1009 |
|
|
if (FileVar==NULL) |
| 1010 |
|
|
{ |
| 1011 |
|
|
FreeTTFILE(); |
| 1012 |
|
|
return FALSE; |
| 1013 |
|
|
} |
| 1014 |
|
|
cv.ProtoFlag = TRUE; |
| 1015 |
|
|
return TRUE; |
| 1016 |
|
|
} |
| 1017 |
|
|
|
| 1018 |
zmatsuo |
8858 |
void ProtoEnd(void) |
| 1019 |
maya |
3227 |
{ |
| 1020 |
|
|
if (! cv.ProtoFlag) |
| 1021 |
|
|
return; |
| 1022 |
|
|
cv.ProtoFlag = FALSE; |
| 1023 |
|
|
|
| 1024 |
|
|
/* Enable transmit delay (serial port) */ |
| 1025 |
|
|
cv.DelayFlag = TRUE; |
| 1026 |
|
|
TalkStatus = IdTalkKeyb; |
| 1027 |
|
|
|
| 1028 |
|
|
CloseProtoDlg(); |
| 1029 |
|
|
|
| 1030 |
|
|
if ((FileVar!=NULL) && FileVar->Success) |
| 1031 |
|
|
EndDdeCmnd(1); |
| 1032 |
|
|
else |
| 1033 |
|
|
EndDdeCmnd(0); |
| 1034 |
|
|
|
| 1035 |
|
|
FreeTTFILE(); |
| 1036 |
|
|
FreeFileVar(&FileVar); |
| 1037 |
|
|
} |
| 1038 |
|
|
|
| 1039 |
zmatsuo |
8857 |
/** |
| 1040 |
|
|
* OnIdle()#teraterm.cpp�����R�[�������� |
| 1041 |
|
|
* cv.ProtoFlag �� 0 ���O������ |
| 1042 |
|
|
* @retval 0 continue |
| 1043 |
|
|
* 1/2 ActiveWin(�O���[�o������)���l(IdVT=1/IdTek=2) |
| 1044 |
|
|
* �� ������������������������ |
| 1045 |
|
|
*/ |
| 1046 |
zmatsuo |
8858 |
int ProtoDlgParse(void) |
| 1047 |
maya |
3227 |
{ |
| 1048 |
|
|
int P; |
| 1049 |
|
|
|
| 1050 |
|
|
P = ActiveWin; |
| 1051 |
|
|
if (PtDlg==NULL) |
| 1052 |
|
|
return P; |
| 1053 |
|
|
|
| 1054 |
|
|
if ((*ProtoParse)(ProtoId,FileVar,ProtoVar,&cv)) |
| 1055 |
|
|
P = 0; /* continue */ |
| 1056 |
|
|
else { |
| 1057 |
|
|
CommSend(&cv); |
| 1058 |
|
|
ProtoEnd(); |
| 1059 |
|
|
} |
| 1060 |
|
|
return P; |
| 1061 |
|
|
} |
| 1062 |
|
|
|
| 1063 |
zmatsuo |
8858 |
void ProtoDlgTimeOut(void) |
| 1064 |
maya |
3227 |
{ |
| 1065 |
|
|
if (PtDlg!=NULL) |
| 1066 |
|
|
(*ProtoTimeOutProc)(ProtoId,FileVar,ProtoVar,&cv); |
| 1067 |
|
|
} |
| 1068 |
|
|
|
| 1069 |
zmatsuo |
8858 |
void ProtoDlgCancel(void) |
| 1070 |
maya |
3227 |
{ |
| 1071 |
|
|
if ((PtDlg!=NULL) && |
| 1072 |
|
|
(*ProtoCancel)(ProtoId,FileVar,ProtoVar,&cv)) |
| 1073 |
|
|
ProtoEnd(); |
| 1074 |
|
|
} |
| 1075 |
|
|
|
| 1076 |
|
|
void KermitStart(int mode) |
| 1077 |
|
|
{ |
| 1078 |
|
|
WORD w; |
| 1079 |
|
|
|
| 1080 |
|
|
if (! ProtoStart()) |
| 1081 |
|
|
return; |
| 1082 |
|
|
|
| 1083 |
|
|
switch (mode) { |
| 1084 |
|
|
case IdKmtSend: |
| 1085 |
|
|
FileVar->OpId = OpKmtSend; |
| 1086 |
|
|
if (strlen(&(FileVar->FullName[FileVar->DirLen]))==0) |
| 1087 |
|
|
{ |
| 1088 |
maya |
7951 |
char FileDirExpanded[MAX_PATH]; |
| 1089 |
|
|
ExpandEnvironmentStrings(ts.FileDir, FileDirExpanded, sizeof(FileDirExpanded)); |
| 1090 |
|
|
if (!(*GetMultiFname)(FileVar, FileDirExpanded, GMF_KERMIT, &w) || |
| 1091 |
maya |
3227 |
(FileVar->NumFname==0)) |
| 1092 |
|
|
{ |
| 1093 |
|
|
ProtoEnd(); |
| 1094 |
|
|
return; |
| 1095 |
|
|
} |
| 1096 |
|
|
} |
| 1097 |
|
|
else |
| 1098 |
|
|
(*SetFileVar)(FileVar); |
| 1099 |
|
|
break; |
| 1100 |
|
|
case IdKmtReceive: |
| 1101 |
|
|
FileVar->OpId = OpKmtRcv; |
| 1102 |
|
|
break; |
| 1103 |
|
|
case IdKmtGet: |
| 1104 |
|
|
FileVar->OpId = OpKmtSend; |
| 1105 |
|
|
if (strlen(&(FileVar->FullName[FileVar->DirLen]))==0) |
| 1106 |
|
|
{ |
| 1107 |
zmatsuo |
9051 |
if (! (*GetGetFname)(FileVar->HMainWin,FileVar, &ts) || |
| 1108 |
maya |
3227 |
(strlen(FileVar->FullName)==0)) |
| 1109 |
|
|
{ |
| 1110 |
|
|
ProtoEnd(); |
| 1111 |
|
|
return; |
| 1112 |
|
|
} |
| 1113 |
|
|
} |
| 1114 |
|
|
else |
| 1115 |
|
|
(*SetFileVar)(FileVar); |
| 1116 |
|
|
break; |
| 1117 |
|
|
case IdKmtFinish: |
| 1118 |
|
|
FileVar->OpId = OpKmtFin; |
| 1119 |
|
|
break; |
| 1120 |
|
|
default: |
| 1121 |
|
|
ProtoEnd(); |
| 1122 |
|
|
return; |
| 1123 |
|
|
} |
| 1124 |
|
|
TalkStatus = IdTalkQuiet; |
| 1125 |
|
|
|
| 1126 |
|
|
/* disable transmit delay (serial port) */ |
| 1127 |
|
|
cv.DelayFlag = FALSE; |
| 1128 |
|
|
|
| 1129 |
|
|
if (! OpenProtoDlg(FileVar,PROTO_KMT,mode,0,0)) |
| 1130 |
|
|
ProtoEnd(); |
| 1131 |
|
|
} |
| 1132 |
|
|
|
| 1133 |
zmatsuo |
8949 |
BOOL KermitStartSend(const char *filename) |
| 1134 |
|
|
{ |
| 1135 |
|
|
if (FileVar !=NULL) |
| 1136 |
|
|
return FALSE; |
| 1137 |
|
|
if (!NewFileVar(&FileVar)) |
| 1138 |
|
|
return FALSE; |
| 1139 |
|
|
|
| 1140 |
|
|
FileVar->DirLen = 0; |
| 1141 |
|
|
strncpy_s(FileVar->FullName, sizeof(FileVar->FullName),filename, _TRUNCATE); |
| 1142 |
|
|
FileVar->NumFname = 1; |
| 1143 |
|
|
FileVar->NoMsg = TRUE; |
| 1144 |
|
|
KermitStart(IdKmtSend); |
| 1145 |
|
|
|
| 1146 |
|
|
return TRUE; |
| 1147 |
|
|
} |
| 1148 |
|
|
|
| 1149 |
|
|
BOOL KermitGet(const char *filename) |
| 1150 |
|
|
{ |
| 1151 |
|
|
if (FileVar !=NULL) |
| 1152 |
|
|
return FALSE; |
| 1153 |
|
|
if (!NewFileVar(&FileVar)) |
| 1154 |
|
|
return FALSE; |
| 1155 |
|
|
|
| 1156 |
|
|
FileVar->DirLen = 0; |
| 1157 |
|
|
strncpy_s(FileVar->FullName, sizeof(FileVar->FullName),filename, _TRUNCATE); |
| 1158 |
|
|
FileVar->NumFname = 1; |
| 1159 |
|
|
FileVar->NoMsg = TRUE; |
| 1160 |
|
|
KermitStart(IdKmtGet); |
| 1161 |
|
|
|
| 1162 |
|
|
return TRUE; |
| 1163 |
|
|
} |
| 1164 |
|
|
|
| 1165 |
|
|
BOOL KermitStartRecive(void) |
| 1166 |
|
|
{ |
| 1167 |
|
|
if (FileVar !=NULL) |
| 1168 |
|
|
return FALSE; |
| 1169 |
|
|
if (!NewFileVar(&FileVar)) |
| 1170 |
|
|
return FALSE; |
| 1171 |
|
|
|
| 1172 |
|
|
FileVar->NoMsg = TRUE; |
| 1173 |
|
|
KermitStart(IdKmtReceive); |
| 1174 |
|
|
|
| 1175 |
|
|
return TRUE; |
| 1176 |
|
|
} |
| 1177 |
|
|
|
| 1178 |
|
|
BOOL KermitFinish(void) |
| 1179 |
|
|
{ |
| 1180 |
|
|
if (FileVar !=NULL) |
| 1181 |
|
|
return FALSE; |
| 1182 |
|
|
if (!NewFileVar(&FileVar)) |
| 1183 |
|
|
return FALSE; |
| 1184 |
|
|
|
| 1185 |
|
|
FileVar->NoMsg = TRUE; |
| 1186 |
|
|
KermitStart(IdKmtFinish); |
| 1187 |
|
|
|
| 1188 |
|
|
return TRUE; |
| 1189 |
|
|
} |
| 1190 |
|
|
|
| 1191 |
maya |
3227 |
void XMODEMStart(int mode) |
| 1192 |
|
|
{ |
| 1193 |
|
|
LONG Option; |
| 1194 |
doda |
6328 |
int tmp; |
| 1195 |
maya |
3227 |
|
| 1196 |
|
|
if (! ProtoStart()) |
| 1197 |
|
|
return; |
| 1198 |
|
|
|
| 1199 |
|
|
if (mode==IdXReceive) |
| 1200 |
|
|
FileVar->OpId = OpXRcv; |
| 1201 |
|
|
else |
| 1202 |
|
|
FileVar->OpId = OpXSend; |
| 1203 |
|
|
|
| 1204 |
|
|
if (strlen(&(FileVar->FullName[FileVar->DirLen]))==0) |
| 1205 |
|
|
{ |
| 1206 |
maya |
7951 |
char FileDirExpanded[MAX_PATH]; |
| 1207 |
|
|
ExpandEnvironmentStrings(ts.FileDir, FileDirExpanded, sizeof(FileDirExpanded)); |
| 1208 |
maya |
3227 |
Option = MAKELONG(ts.XmodemBin,ts.XmodemOpt); |
| 1209 |
|
|
if (! (*GetXFname)(FileVar->HMainWin, |
| 1210 |
maya |
7951 |
mode==IdXReceive,&Option,FileVar,FileDirExpanded)) |
| 1211 |
maya |
3227 |
{ |
| 1212 |
|
|
ProtoEnd(); |
| 1213 |
|
|
return; |
| 1214 |
|
|
} |
| 1215 |
doda |
6328 |
tmp = HIWORD(Option); |
| 1216 |
|
|
if (mode == IdXReceive) { |
| 1217 |
|
|
if (IsXoptCRC(tmp)) { |
| 1218 |
|
|
if (IsXopt1k(ts.XmodemOpt)) { |
| 1219 |
|
|
ts.XmodemOpt = Xopt1kCRC; |
| 1220 |
|
|
} |
| 1221 |
|
|
else { |
| 1222 |
|
|
ts.XmodemOpt = XoptCRC; |
| 1223 |
|
|
} |
| 1224 |
|
|
} |
| 1225 |
|
|
else { |
| 1226 |
|
|
if (IsXopt1k(ts.XmodemOpt)) { |
| 1227 |
|
|
ts.XmodemOpt = Xopt1kCksum; |
| 1228 |
|
|
} |
| 1229 |
|
|
else { |
| 1230 |
|
|
ts.XmodemOpt = XoptCheck; |
| 1231 |
|
|
} |
| 1232 |
|
|
} |
| 1233 |
|
|
ts.XmodemBin = LOWORD(Option); |
| 1234 |
|
|
} |
| 1235 |
|
|
else { |
| 1236 |
|
|
if (IsXopt1k(tmp)) { |
| 1237 |
|
|
if (IsXoptCRC(ts.XmodemOpt)) { |
| 1238 |
|
|
ts.XmodemOpt = Xopt1kCRC; |
| 1239 |
|
|
} |
| 1240 |
|
|
else { |
| 1241 |
|
|
ts.XmodemOpt = Xopt1kCksum; |
| 1242 |
|
|
} |
| 1243 |
|
|
} |
| 1244 |
|
|
else { |
| 1245 |
|
|
if (IsXoptCRC(ts.XmodemOpt)) { |
| 1246 |
|
|
ts.XmodemOpt = XoptCRC; |
| 1247 |
|
|
} |
| 1248 |
|
|
else { |
| 1249 |
|
|
ts.XmodemOpt = XoptCheck; |
| 1250 |
|
|
} |
| 1251 |
|
|
} |
| 1252 |
|
|
} |
| 1253 |
maya |
3227 |
} |
| 1254 |
|
|
else |
| 1255 |
|
|
(*SetFileVar)(FileVar); |
| 1256 |
|
|
|
| 1257 |
|
|
if (mode==IdXReceive) |
| 1258 |
|
|
FileVar->FileHandle = _lcreat(FileVar->FullName,0); |
| 1259 |
|
|
else |
| 1260 |
|
|
FileVar->FileHandle = _lopen(FileVar->FullName,OF_READ); |
| 1261 |
|
|
|
| 1262 |
zmatsuo |
7290 |
FileVar->FileOpen = FileVar->FileHandle != INVALID_HANDLE_VALUE; |
| 1263 |
maya |
3227 |
if (! FileVar->FileOpen) |
| 1264 |
|
|
{ |
| 1265 |
|
|
ProtoEnd(); |
| 1266 |
|
|
return; |
| 1267 |
|
|
} |
| 1268 |
|
|
TalkStatus = IdTalkQuiet; |
| 1269 |
|
|
|
| 1270 |
|
|
/* disable transmit delay (serial port) */ |
| 1271 |
|
|
cv.DelayFlag = FALSE; |
| 1272 |
|
|
|
| 1273 |
|
|
if (! OpenProtoDlg(FileVar,PROTO_XM,mode, |
| 1274 |
|
|
ts.XmodemOpt,ts.XmodemBin)) |
| 1275 |
|
|
ProtoEnd(); |
| 1276 |
|
|
} |
| 1277 |
|
|
|
| 1278 |
zmatsuo |
8949 |
BOOL XMODEMStartReceive(const char *fiename, WORD ParamBinaryFlag, WORD ParamXmodemOpt) |
| 1279 |
|
|
{ |
| 1280 |
|
|
if (FileVar !=NULL) |
| 1281 |
|
|
return FALSE; |
| 1282 |
|
|
if (!NewFileVar(&FileVar)) |
| 1283 |
|
|
return FALSE; |
| 1284 |
|
|
|
| 1285 |
|
|
FileVar->DirLen = 0; |
| 1286 |
|
|
strncpy_s(FileVar->FullName, sizeof(FileVar->FullName),fiename, _TRUNCATE); |
| 1287 |
|
|
if (IsXopt1k(ts.XmodemOpt)) { |
| 1288 |
|
|
if (IsXoptCRC(ParamXmodemOpt)) { |
| 1289 |
|
|
// CRC |
| 1290 |
|
|
ts.XmodemOpt = Xopt1kCRC; |
| 1291 |
|
|
} |
| 1292 |
|
|
else { // Checksum |
| 1293 |
|
|
ts.XmodemOpt = Xopt1kCksum; |
| 1294 |
|
|
} |
| 1295 |
|
|
} |
| 1296 |
|
|
else { |
| 1297 |
|
|
if (IsXoptCRC(ParamXmodemOpt)) { |
| 1298 |
|
|
ts.XmodemOpt = XoptCRC; |
| 1299 |
|
|
} |
| 1300 |
|
|
else { |
| 1301 |
|
|
ts.XmodemOpt = XoptCheck; |
| 1302 |
|
|
} |
| 1303 |
|
|
} |
| 1304 |
|
|
ts.XmodemBin = ParamBinaryFlag; |
| 1305 |
|
|
FileVar->NoMsg = TRUE; |
| 1306 |
|
|
XMODEMStart(IdXReceive); |
| 1307 |
|
|
|
| 1308 |
|
|
return TRUE; |
| 1309 |
|
|
} |
| 1310 |
|
|
|
| 1311 |
|
|
BOOL XMODEMStartSend(const char *fiename, WORD ParamXmodemOpt) |
| 1312 |
|
|
{ |
| 1313 |
|
|
if (FileVar !=NULL) |
| 1314 |
|
|
return FALSE; |
| 1315 |
|
|
if (!NewFileVar(&FileVar)) |
| 1316 |
|
|
return FALSE; |
| 1317 |
|
|
|
| 1318 |
|
|
FileVar->DirLen = 0; |
| 1319 |
|
|
strncpy_s(FileVar->FullName, sizeof(FileVar->FullName), fiename, _TRUNCATE); |
| 1320 |
|
|
if (IsXoptCRC(ts.XmodemOpt)) { |
| 1321 |
|
|
if (IsXopt1k(ParamXmodemOpt)) { |
| 1322 |
|
|
ts.XmodemOpt = Xopt1kCRC; |
| 1323 |
|
|
} |
| 1324 |
|
|
else { |
| 1325 |
|
|
ts.XmodemOpt = XoptCRC; |
| 1326 |
|
|
} |
| 1327 |
|
|
} |
| 1328 |
|
|
else { |
| 1329 |
|
|
if (IsXopt1k(ParamXmodemOpt)) { |
| 1330 |
|
|
ts.XmodemOpt = Xopt1kCksum; |
| 1331 |
|
|
} |
| 1332 |
|
|
else { |
| 1333 |
|
|
ts.XmodemOpt = XoptCheck; |
| 1334 |
|
|
} |
| 1335 |
|
|
} |
| 1336 |
|
|
FileVar->NoMsg = TRUE; |
| 1337 |
|
|
XMODEMStart(IdXSend); |
| 1338 |
|
|
|
| 1339 |
|
|
return TRUE; |
| 1340 |
|
|
} |
| 1341 |
|
|
|
| 1342 |
maya |
3227 |
void YMODEMStart(int mode) |
| 1343 |
|
|
{ |
| 1344 |
|
|
WORD Opt; |
| 1345 |
|
|
|
| 1346 |
|
|
if (! ProtoStart()) |
| 1347 |
|
|
return; |
| 1348 |
|
|
|
| 1349 |
|
|
if (mode==IdYSend) |
| 1350 |
|
|
{ |
| 1351 |
maya |
7951 |
char FileDirExpanded[MAX_PATH]; |
| 1352 |
|
|
ExpandEnvironmentStrings(ts.FileDir, FileDirExpanded, sizeof(FileDirExpanded)); |
| 1353 |
|
|
|
| 1354 |
yutakapon |
3819 |
// �t�@�C���]�������I�v�V������"Yopt1K"�����������B |
| 1355 |
|
|
// TODO: "Yopt1K", "YoptG", "YoptSingle"�������������������AIDD_FOPT���g�������K�v�����B |
| 1356 |
|
|
Opt = Yopt1K; |
| 1357 |
maya |
3227 |
FileVar->OpId = OpYSend; |
| 1358 |
|
|
if (strlen(&(FileVar->FullName[FileVar->DirLen]))==0) |
| 1359 |
|
|
{ |
| 1360 |
maya |
7951 |
if (! (*GetMultiFname)(FileVar,FileDirExpanded,GMF_Y,&Opt) || |
| 1361 |
maya |
3227 |
(FileVar->NumFname==0)) |
| 1362 |
|
|
{ |
| 1363 |
|
|
ProtoEnd(); |
| 1364 |
|
|
return; |
| 1365 |
|
|
} |
| 1366 |
yutakapon |
3819 |
//ts.XmodemBin = Opt; |
| 1367 |
maya |
3227 |
} |
| 1368 |
|
|
else |
| 1369 |
|
|
(*SetFileVar)(FileVar); |
| 1370 |
|
|
} |
| 1371 |
doda |
6363 |
else { |
| 1372 |
maya |
3227 |
FileVar->OpId = OpYRcv; |
| 1373 |
yutakapon |
3820 |
// �t�@�C���]�������I�v�V������"Yopt1K"�����������B |
| 1374 |
|
|
Opt = Yopt1K; |
| 1375 |
yutakapon |
3821 |
(*SetFileVar)(FileVar); |
| 1376 |
yutakapon |
3820 |
} |
| 1377 |
maya |
3227 |
|
| 1378 |
|
|
TalkStatus = IdTalkQuiet; |
| 1379 |
|
|
|
| 1380 |
|
|
/* disable transmit delay (serial port) */ |
| 1381 |
|
|
cv.DelayFlag = FALSE; |
| 1382 |
|
|
|
| 1383 |
|
|
if (! OpenProtoDlg(FileVar,PROTO_YM,mode,Opt,0)) |
| 1384 |
|
|
ProtoEnd(); |
| 1385 |
|
|
} |
| 1386 |
|
|
|
| 1387 |
zmatsuo |
8949 |
BOOL YMODEMStartReceive() |
| 1388 |
|
|
{ |
| 1389 |
|
|
if (FileVar != NULL) { |
| 1390 |
|
|
return FALSE; |
| 1391 |
|
|
} |
| 1392 |
|
|
if (!NewFileVar(&FileVar)) { |
| 1393 |
|
|
return FALSE; |
| 1394 |
|
|
} |
| 1395 |
|
|
FileVar->NoMsg = TRUE; |
| 1396 |
|
|
YMODEMStart(IdYReceive); |
| 1397 |
|
|
return TRUE; |
| 1398 |
|
|
} |
| 1399 |
|
|
|
| 1400 |
|
|
BOOL YMODEMStartSend(const char *fiename) |
| 1401 |
|
|
{ |
| 1402 |
|
|
if (FileVar != NULL) { |
| 1403 |
|
|
return FALSE; |
| 1404 |
|
|
} |
| 1405 |
|
|
if (!NewFileVar(&FileVar)) { |
| 1406 |
|
|
return FALSE; |
| 1407 |
|
|
} |
| 1408 |
|
|
|
| 1409 |
|
|
FileVar->DirLen = 0; |
| 1410 |
|
|
strncpy_s(FileVar->FullName, sizeof(FileVar->FullName),fiename, _TRUNCATE); |
| 1411 |
|
|
FileVar->NumFname = 1; |
| 1412 |
|
|
FileVar->NoMsg = TRUE; |
| 1413 |
|
|
YMODEMStart(IdYSend); |
| 1414 |
|
|
return TRUE; |
| 1415 |
|
|
} |
| 1416 |
|
|
|
| 1417 |
maya |
3227 |
void ZMODEMStart(int mode) |
| 1418 |
|
|
{ |
| 1419 |
|
|
WORD Opt; |
| 1420 |
|
|
|
| 1421 |
|
|
if (! ProtoStart()) |
| 1422 |
|
|
return; |
| 1423 |
|
|
|
| 1424 |
doda |
6361 |
if (mode == IdZSend || mode == IdZAutoS) |
| 1425 |
maya |
3227 |
{ |
| 1426 |
|
|
Opt = ts.XmodemBin; |
| 1427 |
|
|
FileVar->OpId = OpZSend; |
| 1428 |
|
|
if (strlen(&(FileVar->FullName[FileVar->DirLen]))==0) |
| 1429 |
|
|
{ |
| 1430 |
maya |
7951 |
char FileDirExpanded[MAX_PATH]; |
| 1431 |
|
|
ExpandEnvironmentStrings(ts.FileDir, FileDirExpanded, sizeof(FileDirExpanded)); |
| 1432 |
|
|
if (! (*GetMultiFname)(FileVar,FileDirExpanded,GMF_Z,&Opt) || |
| 1433 |
maya |
3227 |
(FileVar->NumFname==0)) |
| 1434 |
|
|
{ |
| 1435 |
doda |
6364 |
if (mode == IdZAutoS) { |
| 1436 |
|
|
CommRawOut(&cv, "\030\030\030\030\030\030\030\030\b\b\b\b\b\b\b\b\b\b", 18); |
| 1437 |
|
|
} |
| 1438 |
maya |
3227 |
ProtoEnd(); |
| 1439 |
|
|
return; |
| 1440 |
|
|
} |
| 1441 |
|
|
ts.XmodemBin = Opt; |
| 1442 |
|
|
} |
| 1443 |
|
|
else |
| 1444 |
|
|
(*SetFileVar)(FileVar); |
| 1445 |
|
|
} |
| 1446 |
doda |
6361 |
else /* IdZReceive or IdZAutoR */ |
| 1447 |
maya |
3227 |
FileVar->OpId = OpZRcv; |
| 1448 |
|
|
|
| 1449 |
|
|
TalkStatus = IdTalkQuiet; |
| 1450 |
|
|
|
| 1451 |
|
|
/* disable transmit delay (serial port) */ |
| 1452 |
|
|
cv.DelayFlag = FALSE; |
| 1453 |
|
|
|
| 1454 |
|
|
if (! OpenProtoDlg(FileVar,PROTO_ZM,mode,Opt,0)) |
| 1455 |
|
|
ProtoEnd(); |
| 1456 |
|
|
} |
| 1457 |
|
|
|
| 1458 |
zmatsuo |
8949 |
BOOL ZMODEMStartReceive(void) |
| 1459 |
|
|
{ |
| 1460 |
|
|
if (FileVar != NULL) { |
| 1461 |
|
|
return FALSE; |
| 1462 |
|
|
} |
| 1463 |
|
|
if (!NewFileVar(&FileVar)) { |
| 1464 |
|
|
return FALSE; |
| 1465 |
|
|
} |
| 1466 |
|
|
|
| 1467 |
|
|
FileVar->NoMsg = TRUE; |
| 1468 |
|
|
ZMODEMStart(IdZReceive); |
| 1469 |
|
|
|
| 1470 |
|
|
return TRUE; |
| 1471 |
|
|
} |
| 1472 |
|
|
|
| 1473 |
|
|
BOOL ZMODEMStartSend(const char *fiename, WORD ParamBinaryFlag) |
| 1474 |
|
|
{ |
| 1475 |
|
|
if (FileVar != NULL) { |
| 1476 |
|
|
return FALSE; |
| 1477 |
|
|
} |
| 1478 |
|
|
if (!NewFileVar(&FileVar)) { |
| 1479 |
|
|
return FALSE; |
| 1480 |
|
|
} |
| 1481 |
|
|
|
| 1482 |
|
|
FileVar->DirLen = 0; |
| 1483 |
|
|
strncpy_s(FileVar->FullName, sizeof(FileVar->FullName),fiename, _TRUNCATE); |
| 1484 |
|
|
FileVar->NumFname = 1; |
| 1485 |
|
|
ts.XmodemBin = ParamBinaryFlag; |
| 1486 |
|
|
FileVar->NoMsg = TRUE; |
| 1487 |
|
|
|
| 1488 |
|
|
ZMODEMStart(IdZSend); |
| 1489 |
|
|
|
| 1490 |
|
|
return TRUE; |
| 1491 |
|
|
} |
| 1492 |
|
|
|
| 1493 |
maya |
3227 |
void BPStart(int mode) |
| 1494 |
|
|
{ |
| 1495 |
doda |
6946 |
LONG Option = 0; |
| 1496 |
maya |
3227 |
|
| 1497 |
|
|
if (! ProtoStart()) |
| 1498 |
|
|
return; |
| 1499 |
|
|
if (mode==IdBPSend) |
| 1500 |
|
|
{ |
| 1501 |
|
|
FileVar->OpId = OpBPSend; |
| 1502 |
|
|
if (strlen(&(FileVar->FullName[FileVar->DirLen]))==0) |
| 1503 |
|
|
{ |
| 1504 |
maya |
7951 |
char FileDirExpanded[MAX_PATH]; |
| 1505 |
|
|
ExpandEnvironmentStrings(ts.FileDir, FileDirExpanded, sizeof(FileDirExpanded)); |
| 1506 |
maya |
3227 |
FileVar->FullName[0] = 0; |
| 1507 |
maya |
7951 |
if (! (*GetTransFname)(FileVar, FileDirExpanded, GTF_BP, &Option)) |
| 1508 |
maya |
3227 |
{ |
| 1509 |
|
|
ProtoEnd(); |
| 1510 |
|
|
return; |
| 1511 |
|
|
} |
| 1512 |
|
|
} |
| 1513 |
|
|
else |
| 1514 |
|
|
(*SetFileVar)(FileVar); |
| 1515 |
|
|
} |
| 1516 |
|
|
else /* IdBPReceive or IdBPAuto */ |
| 1517 |
|
|
FileVar->OpId = OpBPRcv; |
| 1518 |
|
|
|
| 1519 |
|
|
TalkStatus = IdTalkQuiet; |
| 1520 |
|
|
|
| 1521 |
|
|
/* disable transmit delay (serial port) */ |
| 1522 |
|
|
cv.DelayFlag = FALSE; |
| 1523 |
|
|
|
| 1524 |
|
|
if (! OpenProtoDlg(FileVar,PROTO_BP,mode,0,0)) |
| 1525 |
|
|
ProtoEnd(); |
| 1526 |
|
|
} |
| 1527 |
|
|
|
| 1528 |
zmatsuo |
8949 |
BOOL BPSendStart(const char *filename) |
| 1529 |
|
|
{ |
| 1530 |
|
|
if (FileVar != NULL) { |
| 1531 |
|
|
return FALSE; |
| 1532 |
|
|
} |
| 1533 |
|
|
if (!NewFileVar(&FileVar)) { |
| 1534 |
|
|
return FALSE; |
| 1535 |
|
|
} |
| 1536 |
|
|
|
| 1537 |
|
|
FileVar->DirLen = 0; |
| 1538 |
|
|
strncpy_s(FileVar->FullName, sizeof(FileVar->FullName), filename, _TRUNCATE); |
| 1539 |
|
|
FileVar->NumFname = 1; |
| 1540 |
|
|
FileVar->NoMsg = TRUE; |
| 1541 |
|
|
BPStart(IdBPSend); |
| 1542 |
|
|
|
| 1543 |
|
|
return TRUE; |
| 1544 |
|
|
} |
| 1545 |
|
|
|
| 1546 |
|
|
BOOL BPStartReceive(void) |
| 1547 |
|
|
{ |
| 1548 |
|
|
if (FileVar != NULL) |
| 1549 |
|
|
return FALSE; |
| 1550 |
|
|
if (!NewFileVar(&FileVar)) |
| 1551 |
|
|
return FALSE; |
| 1552 |
|
|
|
| 1553 |
|
|
FileVar->NoMsg = TRUE; |
| 1554 |
|
|
BPStart(IdBPReceive); |
| 1555 |
|
|
|
| 1556 |
|
|
return TRUE; |
| 1557 |
|
|
} |
| 1558 |
|
|
|
| 1559 |
maya |
3227 |
void QVStart(int mode) |
| 1560 |
|
|
{ |
| 1561 |
|
|
WORD W; |
| 1562 |
|
|
|
| 1563 |
|
|
if (! ProtoStart()) |
| 1564 |
|
|
return; |
| 1565 |
|
|
|
| 1566 |
|
|
if (mode==IdQVSend) |
| 1567 |
|
|
{ |
| 1568 |
|
|
FileVar->OpId = OpQVSend; |
| 1569 |
|
|
if (strlen(&(FileVar->FullName[FileVar->DirLen]))==0) |
| 1570 |
|
|
{ |
| 1571 |
maya |
7951 |
char FileDirExpanded[MAX_PATH]; |
| 1572 |
|
|
ExpandEnvironmentStrings(ts.FileDir, FileDirExpanded, sizeof(FileDirExpanded)); |
| 1573 |
|
|
if (! (*GetMultiFname)(FileVar,FileDirExpanded,GMF_QV, &W) || |
| 1574 |
maya |
3227 |
(FileVar->NumFname==0)) |
| 1575 |
|
|
{ |
| 1576 |
|
|
ProtoEnd(); |
| 1577 |
|
|
return; |
| 1578 |
|
|
} |
| 1579 |
|
|
} |
| 1580 |
|
|
else |
| 1581 |
|
|
(*SetFileVar)(FileVar); |
| 1582 |
|
|
} |
| 1583 |
|
|
else |
| 1584 |
|
|
FileVar->OpId = OpQVRcv; |
| 1585 |
|
|
|
| 1586 |
|
|
TalkStatus = IdTalkQuiet; |
| 1587 |
|
|
|
| 1588 |
|
|
/* disable transmit delay (serial port) */ |
| 1589 |
|
|
cv.DelayFlag = FALSE; |
| 1590 |
|
|
|
| 1591 |
|
|
if (! OpenProtoDlg(FileVar,PROTO_QV,mode,0,0)) |
| 1592 |
|
|
ProtoEnd(); |
| 1593 |
|
|
} |
| 1594 |
zmatsuo |
8948 |
|
| 1595 |
zmatsuo |
8949 |
BOOL QVStartReceive(void) |
| 1596 |
|
|
{ |
| 1597 |
|
|
if (FileVar != NULL) { |
| 1598 |
|
|
return FALSE; |
| 1599 |
|
|
} |
| 1600 |
|
|
if (!NewFileVar(&FileVar)) { |
| 1601 |
|
|
return FALSE; |
| 1602 |
|
|
} |
| 1603 |
zmatsuo |
8948 |
|
| 1604 |
zmatsuo |
8949 |
FileVar->NoMsg = TRUE; |
| 1605 |
|
|
QVStart(IdQVReceive); |
| 1606 |
|
|
|
| 1607 |
|
|
return TRUE; |
| 1608 |
|
|
} |
| 1609 |
|
|
|
| 1610 |
|
|
BOOL QVStartSend(const char *filename) |
| 1611 |
|
|
{ |
| 1612 |
|
|
if (FileVar != NULL) { |
| 1613 |
|
|
return FALSE; |
| 1614 |
|
|
} |
| 1615 |
|
|
if (!NewFileVar(&FileVar)) { |
| 1616 |
|
|
return FALSE; |
| 1617 |
|
|
} |
| 1618 |
|
|
|
| 1619 |
|
|
FileVar->DirLen = 0; |
| 1620 |
|
|
strncpy_s(FileVar->FullName, sizeof(FileVar->FullName),filename, _TRUNCATE); |
| 1621 |
|
|
FileVar->NumFname = 1; |
| 1622 |
|
|
FileVar->NoMsg = TRUE; |
| 1623 |
|
|
QVStart(IdQVSend); |
| 1624 |
|
|
|
| 1625 |
|
|
return TRUE; |
| 1626 |
|
|
} |
| 1627 |
zmatsuo |
9052 |
#endif |
| 1628 |
zmatsuo |
8949 |
|
| 1629 |
zmatsuo |
8948 |
BOOL IsSendVarNULL() |
| 1630 |
|
|
{ |
| 1631 |
|
|
return SendVar == NULL; |
| 1632 |
|
|
} |
| 1633 |
|
|
|
| 1634 |
zmatsuo |
9052 |
#if 0 |
| 1635 |
zmatsuo |
8948 |
BOOL IsFileVarNULL() |
| 1636 |
|
|
{ |
| 1637 |
|
|
return FileVar == NULL; |
| 1638 |
|
|
} |
| 1639 |
zmatsuo |
9052 |
#endif |