[Ttssh2-commit] [5281] ファイル送信で送るファイルの扱いを 32bit API に変更

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2013年 5月 24日 (金) 23:55:45 JST


Revision: 5281
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5281
Author:   maya
Date:     2013-05-24 23:55:44 +0900 (Fri, 24 May 2013)
Log Message:
-----------
ファイル送信で送るファイルの扱いを 32bit API に変更

Modified Paths:
--------------
    trunk/teraterm/teraterm/filesys.cpp

-------------- next part --------------
Modified: trunk/teraterm/teraterm/filesys.cpp
===================================================================
--- trunk/teraterm/teraterm/filesys.cpp	2013-05-24 11:43:28 UTC (rev 5280)
+++ trunk/teraterm/teraterm/filesys.cpp	2013-05-24 14:55:44 UTC (rev 5281)
@@ -1060,7 +1060,12 @@
 	else
 		(*SetFileVar)(SendVar);
 
+#ifdef FileVarWin16
 	SendVar->FileHandle = _lopen(SendVar->FullName,OF_READ);
+#else
+	SendVar->FileHandle = (int)CreateFile(SendVar->FullName, GENERIC_READ, FILE_SHARE_READ, NULL,
+	                                      OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+#endif
 	SendVar->FileOpen = (SendVar->FileHandle>0);
 	if (! SendVar->FileOpen)
 	{
@@ -1151,6 +1156,7 @@
 {
 	WORD c, fc;
 	LONG BCOld;
+	DWORD read_bytes;
 
 	if ((SendDlg==NULL) ||
 	    ((cv.FilePause & OpSendFile) !=0))
@@ -1187,11 +1193,21 @@
 			}
 		}
 		else if (! FileReadEOF) {
+#ifdef FileVarWin16
 			fc = _lread(SendVar->FileHandle,&FileByte,1);
+#else
+			ReadFile((HANDLE)SendVar->FileHandle, &FileByte, 1, &read_bytes, NULL);
+			fc = LOWORD(read_bytes);
+#endif
 			SendVar->ByteCount = SendVar->ByteCount + fc;
 
 			if (FileCRSend && (fc==1) && (FileByte==0x0A)) {
+#ifdef FileVarWin16
 				fc = _lread(SendVar->FileHandle,&FileByte,1);
+#else
+				ReadFile((HANDLE)SendVar->FileHandle, &FileByte, 1, &read_bytes, NULL);
+				fc = LOWORD(read_bytes);
+#endif
 				SendVar->ByteCount = SendVar->ByteCount + fc;
 			}
 		}



Ttssh2-commit メーリングリストの案内
Back to archive index