Changeset 267


Ignore:
Timestamp:
05/26/10 16:26:02 (21 months ago)
Author:
mickem
Message:

2010-05-25 MickeM - 0.3.8 (take 2)

! Release the new version

  • Fixed issue with FILEAGE
Location:
branches/stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/AutoBuild.h

    r266 r267  
    33// change the FALSE to TRUE for autoincrement of build number 
    44#define INCREMENT_VERSION TRUE 
    5 #define FILEVER        0,3,8,68 
    6 #define PRODUCTVER     0,3,8,68 
    7 #define STRFILEVER     _T("0.3.8.68") 
    8 #define STRPRODUCTVER  _T("0.3.8.68") 
    9 #define STRPRODUCTDATE  _T("2010-05-17") 
     5#define FILEVER        0,3,8,72 
     6#define PRODUCTVER     0,3,8,72 
     7#define STRFILEVER     _T("0.3.8.72") 
     8#define STRPRODUCTVER  _T("0.3.8.72") 
     9#define STRPRODUCTDATE  _T("2010-05-25") 
    1010#endif // AUTOBUILD_H 
  • branches/stable/changelog

    r266 r267  
    66 * Fix depend onservice LanManWorkStation (old win) 
    77 * Fix RtlStringFromGUID problem on NT4 
     8 
     92010-05-25 MickeM - 0.3.8 (take 2) 
     10 ! Release the new version 
     11 * Fixed issue with FILEAGE 
     12 
     132010-05-19 MickeM - 0.3.8 
     14 ! Release the new version 
    815 
    9162010-05-17 MickeM 
  • branches/stable/include/strEx.h

    r264 r267  
    202202    return buf; 
    203203  } 
     204#define MK_FORMAT_FTD(min, key, val) \ 
     205  if (mtm->tm_year > min) \ 
     206  strEx::replace(format, key, strEx::itos(val));  \ 
     207  else  \ 
     208  strEx::replace(format, key, _T("0")); 
     209 
     210 
    204211 
    205212  static const __int64 SECS_BETWEEN_EPOCHS = 11644473600; 
     
    345352  } 
    346353 
    347 #define MK_FORMAT_FTD(min, key, val) \ 
    348   if (mtm->tm_year > min) \ 
    349     strEx::replace(format, key, strEx::itos(val));  \ 
    350   else  \ 
    351     strEx::replace(format, key, _T("0")); 
    352  
    353   inline std::wstring format_time_delta(struct tm *mtm, std::wstring format = _T("%Y years %m months %d days %H hours %M minutes")) { 
    354     // "Date: %Y-%m-%d %H:%M:%S" 
    355     MK_FORMAT_FTD(70, _T("%Y"), mtm->tm_year); 
    356     MK_FORMAT_FTD(0, _T("%m"), mtm->tm_mon); 
    357     MK_FORMAT_FTD(0, _T("%d"), mtm->tm_mday-1); 
    358     MK_FORMAT_FTD(0, _T("%H"), mtm->tm_hour); 
    359     MK_FORMAT_FTD(0, _T("%M"), mtm->tm_min); 
    360     MK_FORMAT_FTD(0, _T("%S"), mtm->tm_sec); 
    361     return format; 
    362   } 
    363354 
    364355#define WEEK  (7 * 24 * 60 * 60 * 1000) 
     
    613604  } 
    614605 
     606  inline std::wstring format_time_delta(struct tm *mtm, std::wstring format = _T("%Y years %m months %d days %H hours %M minutes")) { 
     607    // "Date: %Y-%m-%d %H:%M:%S" 
     608    MK_FORMAT_FTD(70, _T("%Y"), mtm->tm_year); 
     609    MK_FORMAT_FTD(0, _T("%m"), mtm->tm_mon); 
     610    MK_FORMAT_FTD(0, _T("%d"), mtm->tm_mday-1); 
     611    MK_FORMAT_FTD(0, _T("%H"), mtm->tm_hour); 
     612    MK_FORMAT_FTD(0, _T("%M"), mtm->tm_min); 
     613    MK_FORMAT_FTD(0, _T("%S"), mtm->tm_sec); 
     614    return format; 
     615  } 
     616  inline std::wstring format_time_delta(time_t time, std::wstring format = _T("%Y years %m months %d days %H hours %M minutes")) { 
     617    struct tm nt; // = new struct tm; 
     618#if (_MSC_VER > 1300)  // 1300 == VC++ 7.0 
     619    if (gmtime_s(&nt, &time) != 0) 
     620      return _T(""); 
     621#else 
     622    nt = gmtime(&time); 
     623    if (nt == NULL) 
     624      return ""; 
     625#endif 
     626    return format_time_delta(&nt, format); 
     627  } 
     628  inline std::wstring format_filetime_delta(unsigned long long filetime, std::wstring format = _T("%Y-%m-%d %H:%M:%S")) { 
     629    if (filetime == 0) 
     630      return _T("ZERO"); 
     631    //filetime -= (SECS_BETWEEN_EPOCHS * SECS_TO_100NS); 
     632    filetime /= SECS_TO_100NS; 
     633    return format_time_delta(static_cast<time_t>(filetime), format); 
     634  } 
    615635 
    616636#ifdef _DEBUG 
  • branches/stable/modules/CheckDisk/CheckDisk.cpp

    r261 r267  
    478478 
    479479  std::wstring error; 
    480   bool has_error; 
     480  //bool has_error; 
    481481 
    482482  static file_info get(__int64 now, std::wstring path, std::wstring file) { 
     
    677677}; 
    678678 
     679struct file_container : public file_info { 
     680  std::wstring error_; 
     681 
     682 
     683  static file_container get(std::wstring file) { 
     684    FILETIME now; 
     685    GetSystemTimeAsFileTime(&now); 
     686    unsigned __int64 nowi64 = ((now.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now.dwLowDateTime); 
     687    return get(file, nowi64); 
     688  } 
     689 
     690  static file_container get(std::wstring file, unsigned long long now) { 
     691 
     692    BY_HANDLE_FILE_INFORMATION _info; 
     693 
     694    HANDLE hFile = CreateFile(file.c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 
     695      0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 
     696    if (hFile == INVALID_HANDLE_VALUE) { 
     697      return file_container(now, file, _T("Could not open file: ") + file); 
     698    } 
     699    GetFileInformationByHandle(hFile, &_info); 
     700    CloseHandle(hFile); 
     701    file_container info(now, _info, file); 
     702    //info.ullNow = now; 
     703    return info; 
     704  } 
     705 
     706 
     707  file_container(__int64 now, const BY_HANDLE_FILE_INFORMATION info, std::wstring file) : file_info(now, info, file_helpers::meta::get_path(file), file_helpers::meta::get_filename(file)) {} 
     708  file_container(__int64 now, std::wstring file, std::wstring error) : error_(error), file_info(now, file_helpers::meta::get_path(file), file_helpers::meta::get_filename(file)) {} 
     709 
     710  bool has_errors() { 
     711    return !error_.empty(); 
     712  } 
     713  std::wstring get_error() { 
     714    return error_; 
     715  } 
     716 
     717}; 
    679718struct file_filter { 
    680719  filters::filter_all_numeric<unsigned long long, checkHolders::disk_size_handler<checkHolders::disk_size_type> > size; 
     
    955994  std::wstring path; 
    956995  bool debug = false; 
    957   find_first_file_info finder; 
    958996  MAP_OPTIONS_BEGIN(stl_args) 
    959997    MAP_OPTIONS_STR(_T("path"), path) 
     
    9681006  } 
    9691007 
    970   NSC_error errors; 
    971   pattern_type splitpath = split_pattern(path); 
    972   recursive_scan<find_first_file_info>(splitpath.first, splitpath.second, -1, -1, finder, &errors, debug); 
    973   if (errors.has_error()) { 
     1008  file_container info = file_container::get(path); 
     1009 
     1010  if (!info.error_.empty()) { 
    9741011    if (show_errors_) 
    975       message = errors.get_error(); 
     1012      message = _T("0&") + info.error_; 
    9761013    else 
    977       message = _T("Check contains error. Check log for details (or enable show_errors in nsc.ini)"); 
    978     return NSCAPI::returnUNKNOWN; 
    979   } 
    980   time_t value = (finder.now_-finder.info.ullLastWriteTime)/10000000; 
    981   message = strEx::itos(value/60) + _T("&") + strEx::format_time_delta(gmtime(&value), format); 
     1014      message = _T("0&Check contains error. Check log for details (or enable show_errors in nsc.ini)"); 
     1015    return NSCAPI::returnUNKNOWN; 
     1016  } 
     1017  static const __int64 SECS_TO_100NS = 10000000; 
     1018  time_t value = (info.ullNow-info.ullLastWriteTime)/SECS_TO_100NS; 
     1019  message = strEx::itos(value/60) + _T("&") + strEx::format_time_delta(value, format); 
    9821020  return NSCAPI::returnOK; 
    9831021} 
     
    11771215  return returnCode; 
    11781216} 
    1179 struct file_container : public file_info { 
    1180   std::wstring error_; 
    1181  
    1182   static file_container get(std::wstring file, unsigned long long now) { 
    1183  
    1184     BY_HANDLE_FILE_INFORMATION _info; 
    1185  
    1186     HANDLE hFile = CreateFile(file.c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 
    1187       0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 
    1188     if (hFile == INVALID_HANDLE_VALUE) { 
    1189       return file_container(now, file, _T("Could not open file: ") + file); 
    1190     } 
    1191     GetFileInformationByHandle(hFile, &_info); 
    1192     CloseHandle(hFile); 
    1193     file_container info(now, _info, file); 
    1194     //info.ullNow = now; 
    1195     return info; 
    1196   } 
    1197  
    1198  
    1199   file_container(__int64 now, const BY_HANDLE_FILE_INFORMATION info, std::wstring file) : file_info(now, info, file_helpers::meta::get_path(file), file_helpers::meta::get_filename(file)) {} 
    1200   file_container(__int64 now, std::wstring file, std::wstring error) : error_(error), file_info(now, file_helpers::meta::get_path(file), file_helpers::meta::get_filename(file)) {} 
    1201  
    1202   bool has_errors() { 
    1203     return !error_.empty(); 
    1204   } 
    1205   std::wstring get_error() { 
    1206     return error_; 
    1207   } 
    1208  
    1209 }; 
     1217 
    12101218 
    12111219typedef checkHolders::ExactBounds<checkHolders::NumericBounds<checkHolders::disk_size_type, checkHolders::disk_size_handler<checkHolders::disk_size_type> > > ExactBoundsDiscSize; 
Note: See TracChangeset for help on using the changeset viewer.