• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision5273 (tree)
Time2013-05-21 12:15:39
Author(del#1144)

Log Message

ログファイルの扱いを 32bit API に変更

Change Summary

Incremental Difference

--- trunk/teraterm/teraterm/filesys.cpp (revision 5272)
+++ trunk/teraterm/teraterm/filesys.cpp (revision 5273)
@@ -385,7 +385,11 @@
385385 CloseHandle(ptr->LogThread);
386386 ptr->LogThread = (HANDLE)-1;
387387 }
388+#ifdef FileVarWin16
388389 _lclose(ptr->FileHandle);
390+#else
391+ CloseHandle((HANDLE)ptr->FileHandle);
392+#endif
389393 }
390394
391395 // 遅延書き込み用スレッド
@@ -395,6 +399,7 @@
395399 PFileVar fv = (PFileVar)arg;
396400 PCHAR buf;
397401 DWORD buflen;
402+ DWORD wrote;
398403
399404 PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
400405
@@ -403,7 +408,11 @@
403408 case WM_DPC_LOGTHREAD_SEND:
404409 buf = (PCHAR)msg.wParam;
405410 buflen = (DWORD)msg.lParam;
411+#ifdef FileVarWin16
406412 _lwrite(fv->FileHandle, buf, buflen );
413+#else
414+ WriteFile((HANDLE)LogVar->FileHandle, buf, buflen, &wrote, NULL);
415+#endif
407416 free(buf); // ここでメモリ解放
408417 break;
409418
@@ -558,7 +567,11 @@
558567 LogVar->FileHandle = (int)CreateFile(LogVar->FullName, GENERIC_WRITE, dwShareMode, NULL,
559568 OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
560569 if (LogVar->FileHandle>0){
570+#ifdef FileVarWin16
561571 _llseek(LogVar->FileHandle,0,2);
572+#else
573+ SetFilePointer((HANDLE)LogVar->FileHandle, 0, NULL, FILE_END);
574+#endif
562575 /* 2007.05.24 Gentaro
563576 If log file already exists,
564577 a newline is inserted before the first timestamp.
@@ -800,6 +813,7 @@
800813 PCHAR WriteBuf;
801814 DWORD WriteBufMax, WriteBufLen;
802815 CHAR tmp[128];
816+ DWORD wrote;
803817
804818 if (! LogVar->FileOpen) return;
805819 if (FileLog)
@@ -895,11 +909,21 @@
895909 #endif
896910 /* 2007.05.24 Gentaro */
897911 if( eLineEnd == Line_FileHead ){
912+#ifdef FileVarWin16
898913 _lwrite(LogVar->FileHandle,"\r\n",2);
914+#else
915+ WriteFile((HANDLE)LogVar->FileHandle, "\r\n", 2, &wrote, NULL);
916+#endif
899917 }
918+#ifdef FileVarWin16
900919 _lwrite(LogVar->FileHandle,"[",1);
901920 _lwrite(LogVar->FileHandle, strtime, strlen(strtime));
902921 _lwrite(LogVar->FileHandle,"] ",2);
922+#else
923+ WriteFile((HANDLE)LogVar->FileHandle, "[", 1, &wrote, NULL);
924+ WriteFile((HANDLE)LogVar->FileHandle, strtime, strlen(strtime), &wrote, NULL);
925+ WriteFile((HANDLE)LogVar->FileHandle, "] ", 2, &wrote, NULL);
926+#endif
903927 }
904928
905929 /* 2007.05.24 Gentaro */
@@ -910,7 +934,11 @@
910934 eLineEnd = Line_Other; /* clear endmark*/
911935 }
912936
937+#ifdef FileVarWin16
913938 _lwrite(LogVar->FileHandle,(PCHAR)&b,1);
939+#else
940+ WriteFile((HANDLE)LogVar->FileHandle, (PCHAR)&b, 1, &wrote, NULL);
941+#endif
914942 (LogVar->ByteCount)++;
915943 }
916944 }
--- trunk/teraterm/teraterm/ttdde.c (revision 5272)
+++ trunk/teraterm/teraterm/ttdde.c (revision 5273)
@@ -593,8 +593,13 @@
593593 case CmdLogWrite:
594594 if (LogVar != NULL)
595595 {
596+ DWORD wrote;
597+#ifdef FileVarWin16
596598 _lwrite(LogVar->FileHandle,
597599 ParamFileName,strlen(ParamFileName));
600+#else
601+ WriteFile((HANDLE)LogVar->FileHandle, ParamFileName, strlen(ParamFileName), &wrote, NULL);
602+#endif
598603 LogVar->ByteCount =
599604 LogVar->ByteCount + strlen(ParamFileName);
600605 FLogRefreshNum();
Show on old repository browser