Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/teraterm/filesys_log.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6768 by maya, Sun Jun 4 13:06:21 2017 UTC revision 6769 by maya, Mon Jun 5 08:37:56 2017 UTC
# Line 416  static void CloseFileSync(PFileVar ptr) Line 416  static void CloseFileSync(PFileVar ptr)
416                  CloseHandle(ptr->LogThread);                  CloseHandle(ptr->LogThread);
417                  ptr->LogThread = (HANDLE)-1;                  ptr->LogThread = (HANDLE)-1;
418          }          }
 #ifdef FileVarWin16  
         _lclose(ptr->FileHandle);  
 #else  
419          CloseHandle((HANDLE)ptr->FileHandle);          CloseHandle((HANDLE)ptr->FileHandle);
 #endif  
420  }  }
421    
422  // 遅延書き込み用スレッド  // 遅延書き込み用スレッド
# Line 444  static unsigned _stdcall DeferredLogWrit Line 440  static unsigned _stdcall DeferredLogWrit
440                          case WM_DPC_LOGTHREAD_SEND:                          case WM_DPC_LOGTHREAD_SEND:
441                                  buf = (PCHAR)msg.wParam;                                  buf = (PCHAR)msg.wParam;
442                                  buflen = (DWORD)msg.lParam;                                  buflen = (DWORD)msg.lParam;
 #ifdef FileVarWin16  
                                 _lwrite(fv->FileHandle, buf, buflen );  
 #else  
443                                  WriteFile((HANDLE)LogVar->FileHandle, buf, buflen, &wrote, NULL);                                  WriteFile((HANDLE)LogVar->FileHandle, buf, buflen, &wrote, NULL);
 #endif  
444                                  free(buf);   // ここでメモリ解放                                  free(buf);   // ここでメモリ解放
445                                  break;                                  break;
446    
# Line 617  BOOL LogStart() Line 609  BOOL LogStart()
609                  LogVar->FileHandle = (int)CreateFile(LogVar->FullName, GENERIC_WRITE, dwShareMode, NULL,                  LogVar->FileHandle = (int)CreateFile(LogVar->FullName, GENERIC_WRITE, dwShareMode, NULL,
610                                                       OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);                                                       OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
611                  if (LogVar->FileHandle>0){                  if (LogVar->FileHandle>0){
 #ifdef FileVarWin16  
                         _llseek(LogVar->FileHandle,0,2);  
 #else  
612                          SetFilePointer((HANDLE)LogVar->FileHandle, 0, NULL, FILE_END);                          SetFilePointer((HANDLE)LogVar->FileHandle, 0, NULL, FILE_END);
 #endif  
613                          /* 2007.05.24 Gentaro                          /* 2007.05.24 Gentaro
614                                  If log file already exists,                                  If log file already exists,
615                                  a newline is inserted before the first timestamp.                                  a newline is inserted before the first timestamp.
# Line 1020  void LogToFile() Line 1008  void LogToFile()
1008          #endif          #endif
1009                                          /* 2007.05.24 Gentaro */                                          /* 2007.05.24 Gentaro */
1010                                          if( eLineEnd == Line_FileHead ){                                          if( eLineEnd == Line_FileHead ){
 #ifdef FileVarWin16  
                                                 _lwrite(LogVar->FileHandle,"\r\n",2);  
 #else  
1011                                                  WriteFile((HANDLE)LogVar->FileHandle, "\r\n", 2, &wrote, NULL);                                                  WriteFile((HANDLE)LogVar->FileHandle, "\r\n", 2, &wrote, NULL);
 #endif  
1012                                          }                                          }
 #ifdef FileVarWin16  
                                         _lwrite(LogVar->FileHandle,"[",1);  
                                         _lwrite(LogVar->FileHandle, strtime, strlen(strtime));  
                                         _lwrite(LogVar->FileHandle,"] ",2);  
 #else  
1013                                          WriteFile((HANDLE)LogVar->FileHandle, "[", 1, &wrote, NULL);                                          WriteFile((HANDLE)LogVar->FileHandle, "[", 1, &wrote, NULL);
1014                                          WriteFile((HANDLE)LogVar->FileHandle, strtime, strlen(strtime), &wrote, NULL);                                          WriteFile((HANDLE)LogVar->FileHandle, strtime, strlen(strtime), &wrote, NULL);
1015                                          WriteFile((HANDLE)LogVar->FileHandle, "] ", 2, &wrote, NULL);                                          WriteFile((HANDLE)LogVar->FileHandle, "] ", 2, &wrote, NULL);
 #endif  
1016                                  }                                  }
1017    
1018                                  /* 2007.05.24 Gentaro */                                  /* 2007.05.24 Gentaro */
# Line 1045  void LogToFile() Line 1023  void LogToFile()
1023                                          eLineEnd = Line_Other; /* clear endmark*/                                          eLineEnd = Line_Other; /* clear endmark*/
1024                                  }                                  }
1025    
 #ifdef FileVarWin16  
                                 _lwrite(LogVar->FileHandle,(PCHAR)&b,1);  
 #else  
1026                                  WriteFile((HANDLE)LogVar->FileHandle, (PCHAR)&b, 1, &wrote, NULL);                                  WriteFile((HANDLE)LogVar->FileHandle, (PCHAR)&b, 1, &wrote, NULL);
 #endif  
1027                                  (LogVar->ByteCount)++;                                  (LogVar->ByteCount)++;
1028                          }                          }
1029                  }                  }
# Line 1171  void FileSendStart() Line 1145  void FileSendStart()
1145          else          else
1146                  (*SetFileVar)(SendVar);                  (*SetFileVar)(SendVar);
1147    
 #ifdef FileVarWin16  
         SendVar->FileHandle = _lopen(SendVar->FullName,OF_READ);  
 #else  
1148          SendVar->FileHandle = (int)CreateFile(SendVar->FullName, GENERIC_READ, FILE_SHARE_READ, NULL,          SendVar->FileHandle = (int)CreateFile(SendVar->FullName, GENERIC_READ, FILE_SHARE_READ, NULL,
1149                                                OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);                                                OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
 #endif  
1150          SendVar->FileOpen = (SendVar->FileHandle>0);          SendVar->FileOpen = (SendVar->FileHandle>0);
1151          if (! SendVar->FileOpen)          if (! SendVar->FileOpen)
1152          {          {
# Line 1295  void FileSendBinayBoost() Line 1265  void FileSendBinayBoost()
1265    
1266          do {          do {
1267                  if (FileSendHandler.pos == FileSendHandler.end) {                  if (FileSendHandler.pos == FileSendHandler.end) {
 #ifdef FileVarWin16  
                         fc = _lread(SendVar->FileHandle, &(FileSendHandler.buf[0]), sizeof(FileSendHandler.buf));  
 #else  
1268                          ReadFile((HANDLE)SendVar->FileHandle, &(FileSendHandler.buf[0]), sizeof(FileSendHandler.buf), &read_bytes, NULL);                          ReadFile((HANDLE)SendVar->FileHandle, &(FileSendHandler.buf[0]), sizeof(FileSendHandler.buf), &read_bytes, NULL);
1269                          fc = LOWORD(read_bytes);                          fc = LOWORD(read_bytes);
 #endif  
1270                          FileSendHandler.pos = 0;                          FileSendHandler.pos = 0;
1271                          FileSendHandler.end = fc;                          FileSendHandler.end = fc;
1272                  } else {                  } else {
# Line 1380  void FileSend() Line 1346  void FileSend()
1346                          }                          }
1347                  }                  }
1348                  else if (! FileReadEOF) {                  else if (! FileReadEOF) {
 #ifdef FileVarWin16  
                         fc = _lread(SendVar->FileHandle,&FileByte,1);  
 #else  
1349                          ReadFile((HANDLE)SendVar->FileHandle, &FileByte, 1, &read_bytes, NULL);                          ReadFile((HANDLE)SendVar->FileHandle, &FileByte, 1, &read_bytes, NULL);
1350                          fc = LOWORD(read_bytes);                          fc = LOWORD(read_bytes);
 #endif  
1351                          SendVar->ByteCount = SendVar->ByteCount + fc;                          SendVar->ByteCount = SendVar->ByteCount + fc;
1352    
1353                          if (FileCRSend && (fc==1) && (FileByte==0x0A)) {                          if (FileCRSend && (fc==1) && (FileByte==0x0A)) {
 #ifdef FileVarWin16  
                                 fc = _lread(SendVar->FileHandle,&FileByte,1);  
 #else  
1354                                  ReadFile((HANDLE)SendVar->FileHandle, &FileByte, 1, &read_bytes, NULL);                                  ReadFile((HANDLE)SendVar->FileHandle, &FileByte, 1, &read_bytes, NULL);
1355                                  fc = LOWORD(read_bytes);                                  fc = LOWORD(read_bytes);
 #endif  
1356                                  SendVar->ByteCount = SendVar->ByteCount + fc;                                  SendVar->ByteCount = SendVar->ByteCount + fc;
1357                          }                          }
1358                  }                  }

Legend:
Removed from v.6768  
changed lines
  Added in v.6769

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26