Ejemplo n.º 1
0
FileWriteTime GetLastWriteTimeForDirectory(const std::string& path) {
	HANDLE handle = CreateFile(path.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL);
	CHECK_HANDLE_ERRORS(handle);
	FILETIME lastWriteTime;
	CHECK_RETURN_ERRORS(GetFileTime(handle, NULL, NULL, &lastWriteTime));
	CHECK_RETURN_ERRORS(CloseHandle(handle));

	FileWriteTime result;
	result.lowDateTime = lastWriteTime.dwLowDateTime;
	result.highDateTime = lastWriteTime.dwHighDateTime;
	return result;
}
Ejemplo n.º 2
0
BOOL KSceneSettingPageRegionSplit::IsFileChanged( LPCTSTR lpPath, FILETIME OldFileTime )
{
	FILETIME NewFileTime;
	KG_PROCESS_ERROR(GetFileTime(lpPath, &NewFileTime));
	if (NewFileTime.dwHighDateTime != OldFileTime.dwHighDateTime 
		|| NewFileTime.dwLowDateTime != OldFileTime.dwLowDateTime)
	{
		return TRUE;
	}
Exit0:
	return FALSE;
}
Ejemplo n.º 3
0
/// 更新時刻によってキャッシュする必要があるかどうか判断
static bool needCopyFileByDate( LPCTSTR filePath,
                                LPCTSTR cachePath )
{
    FILETIME fileTime;
    FILETIME cacheTime;

    HANDLE fileHandle = CreateFile(filePath, 0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, OPEN_EXISTING, 0, NULL);
    HANDLE cacheHandle = CreateFile(cachePath, 0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, OPEN_EXISTING, 0, NULL);

    GetFileTime(fileHandle, NULL, NULL, &fileTime);
    GetFileTime(cacheHandle, NULL, NULL, &cacheTime);
    
    CloseHandle(fileHandle);
    CloseHandle(cacheHandle);
    
    if (CompareFileTime(&fileTime, &cacheTime)>0) {
        return true;
    }
    
    return false;
}
Ejemplo n.º 4
0
BOOL My_GetFileTime()
{
	HANDLE hFile=NULL;
	LPFILETIME lpCreationTime=NULL;
	LPFILETIME lpLastAccessTime=NULL;
	LPFILETIME lpLastWriteTime=NULL;
	BOOL returnVal_Real = NULL;
	BOOL returnVal_Intercepted = NULL;

	DWORD error_Real = 0;
	DWORD error_Intercepted = 0;
	__try{
	disableInterception();
	returnVal_Real = GetFileTime (hFile,lpCreationTime,lpLastAccessTime,lpLastWriteTime);
	error_Real = GetLastError();
	enableInterception();
	returnVal_Intercepted = GetFileTime (hFile,lpCreationTime,lpLastAccessTime,lpLastWriteTime);
	error_Intercepted = GetLastError();
	}__except(puts("in filter"), 1){puts("exception caught");}
	return ((returnVal_Real == returnVal_Intercepted) && (error_Real == error_Intercepted));
}
Ejemplo n.º 5
0
QDateTime AssetCache::LastModified(const QString &assetRef)
{
    QString absolutePath = FindInCache(assetRef);
    if (absolutePath.isEmpty())
        return QDateTime();

#ifdef Q_WS_WIN
    HANDLE fileHandle = (HANDLE)OpenFileHandle(absolutePath);
    if (fileHandle == INVALID_HANDLE_VALUE)
    {
        LogError("AssetCache: Failed to open cache file to read last modified time: " + assetRef);
        return QDateTime();
    }

    // Get last write time.
    FILETIME fileTime;
    BOOL success = GetFileTime(fileHandle, 0, 0, &fileTime); // http://msdn.microsoft.com/en-us/library/windows/desktop/ms724320(v=VS.85).aspx
    CloseHandle(fileHandle);
    if (!success)
    {
        LogError("AssetCache: Failed to read cache file last modified time: " + assetRef);
        return QDateTime();
    }

    // Convert to UTC.
    SYSTEMTIME sysTime;
    if (!FileTimeToSystemTime(&fileTime, &sysTime)) // http://msdn.microsoft.com/en-us/library/windows/desktop/ms724280(v=VS.85).aspx
    {
        LogError("Win32 FileTimeToSystemTime failed for asset ref " + assetRef);
        return QDateTime();
    }

    // Ignore msec
    QDateTime dateTime;
    dateTime.setTimeSpec(Qt::UTC);
    dateTime.setDate(QDate((int)sysTime.wYear, (int)sysTime.wMonth, (int)sysTime.wDay));
    dateTime.setTime(QTime((int)sysTime.wHour, (int)sysTime.wMinute, (int)sysTime.wSecond, 0));
    return dateTime;
#else
    QDateTime dateTime;
    QString nativePath = QDir::toNativeSeparators(absolutePath);
    struct stat fileStats;
    if (stat(nativePath.toStdString().c_str(), &fileStats) == 0)
    {
        qint64 msecFromEpoch = (qint64)fileStats.st_mtime * 1000;
        dateTime.setMSecsSinceEpoch(msecFromEpoch);
    }
    else
        LogError("AssetCache: Failed to read cache file last modified time: " + assetRef);
    return dateTime;
#endif
}
Ejemplo n.º 6
0
static int get_last_write_time(char *fname,__int64 *ft)
{
	int result=FALSE;
	HANDLE hf;
	hf=CreateFile(fname,0,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
	if(hf!=INVALID_HANDLE_VALUE){
		result=GetFileTime(hf,NULL,NULL,(FILETIME*)ft);
		if(result!=0)
			result=TRUE;
		CloseHandle(hf);
	}
	return result;
}
Ejemplo n.º 7
0
void File::GetOpenFileTime(RarTime *ft)
{
#ifdef _WIN_32
  FILETIME FileTime;
  GetFileTime(hFile,NULL,NULL,&FileTime);
  *ft=FileTime;
#endif
#if defined(_UNIX) || defined(_EMX)
  struct stat st;
  fstat(fileno(hFile),&st);
  *ft=st.st_mtime;
#endif
}
Ejemplo n.º 8
0
void loadShaderProgram(std::string sourcefile)
{
	//printf("loading shader from %s\n", sourcefile.c_str());
	g_shader.id = glCreateProgram();
	refreshShaderProgram(sourcefile);
	
	FILETIME create, access, write;
	HANDLE fhandle = CreateFile(SHADER_SRC, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
	GetFileTime(fhandle, &create, &access, &write);
	ULONGLONG time = (((ULONGLONG) write.dwHighDateTime) << 32) + write.dwLowDateTime;
	g_shader_modified = time;
	CloseHandle(fhandle);
}
Ejemplo n.º 9
0
// ////////////////////////////////////////////////////////////////////////////////
// @global 修改文件时间
//
void ChangeFileTime(const char *filename, unsigned long dosdate, tm_unz tmu_date)
{
	HANDLE hFile;
	FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;

	hFile = CreateFileA(filename,GENERIC_READ | GENERIC_WRITE,
		0,NULL,OPEN_EXISTING,0,NULL);
	GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite);
	DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal);
	LocalFileTimeToFileTime(&ftLocal,&ftm);
	SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
	CloseHandle(hFile);
}
Ejemplo n.º 10
0
bool IsFileNew(LPCTSTR oldfile, LPCTSTR newfile)
{
	FILETIME lpCreationTime;
	FILETIME lpLastAccessTime;
	FILETIME lpLastWriteTime;
	FILETIME lpLastWriteTime2;

	HANDLE file = CreateFile(oldfile, GENERIC_READ, FILE_SHARE_READ
		, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);

	if(file == INVALID_HANDLE_VALUE)
		return false;

	if(!GetFileTime(file, &lpCreationTime, &lpLastAccessTime, &lpLastWriteTime)) {
		CloseHandle(file);
		return false;
	}

	CloseHandle(file);

	file = CreateFile(newfile, GENERIC_READ, FILE_SHARE_READ
		, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);

	if(file == INVALID_HANDLE_VALUE)
		return false;

	if(!GetFileTime(file, &lpCreationTime, &lpLastAccessTime, &lpLastWriteTime2)) {
		CloseHandle(file);
		return false;
	}

	CloseHandle(file);

	if(lpLastWriteTime2.dwHighDateTime > lpLastWriteTime.dwHighDateTime ||
		lpLastWriteTime2.dwLowDateTime > lpLastWriteTime.dwLowDateTime)
		return true;

	return false;
}
Ejemplo n.º 11
0
int change_file_date(char *fname,unsigned long dosdate)
{
	HANDLE hfile;
	hfile=CreateFile(fname,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
	if(hfile!=INVALID_HANDLE_VALUE){
		FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
		GetFileTime(hfile,&ftCreate,&ftLastAcc,&ftLastWrite);
		DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal);
		LocalFileTimeToFileTime(&ftLocal,&ftm);
		SetFileTime(hfile,&ftm,&ftLastAcc,&ftm);
		CloseHandle(hfile);
		return TRUE;
	}
Ejemplo n.º 12
0
_WCRTLINK unsigned _dos_getftime( int hid, unsigned *date, unsigned *time )
{
    FILETIME        ctime, atime, wtime;
    unsigned short  d, t;

    if( GetFileTime( __getOSHandle( hid ), &ctime, &atime, &wtime ) ) {
        __MakeDOSDT( &wtime, &d, &t );
        *date = d;
        *time = t;
        return( 0 );
    }
    return( __set_errno_nt_reterr() );
}
Ejemplo n.º 13
0
unsigned long long Zipped::getFiletime(const MappedFile& item)
{
    unsigned long long itemFiletime = 0;
    HANDLE h = item.handle();
    if (h != INVALID_HANDLE_VALUE)
    {
        filetime64_t write = {0ULL};
        GetFileTime(h, 0 /*create*/, 0 /*access*/, &write.ft);
        itemFiletime = write.ft64;
    }

    return itemFiletime;
}
Ejemplo n.º 14
0
/**
this is not needed for bulk_extractor
*/
void File::GetOpenFileTime(RarTime *ft)
{ //We probably don't need to worry about this at all.
#ifdef _WIN_ALL
  FILETIME FileTime;
  GetFileTime(hFile,NULL,NULL,&FileTime);
  *ft=FileTime;
#endif
#if defined(_UNIX) || defined(_EMX)
  struct stat st;
  fstat(fileno(hFile),&st);
  *ft=st.st_mtime;
#endif
}
Ejemplo n.º 15
0
FILETIME* FileUtils::getFileTime(const std::string& fileName) {
	WORD ret = -1;
	HANDLE hFile = CreateFile(fileName.c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,OPEN_EXISTING, 0, NULL);
    if( hFile != INVALID_HANDLE_VALUE) {
		FILETIME* ftWrite = new FILETIME();	
		// Retrieve the file times for the file.
		if (GetFileTime(hFile, NULL, NULL, ftWrite)) {
			return ftWrite;
		}
		CloseHandle(hFile);    
	}            
	return 0;
}
Ejemplo n.º 16
0
BOOL  ffplayer::SetPlayedTime(DWORD nTime)
{	
	DWORD FileTime = GetFileTime();
	if (FileTime == 0)
	{
		m_seekTime = 0;
		return false;
	}

	float fPos = (float) nTime / (float)FileTime;
	SetPlayPos(fPos);
	m_seekTime = nTime;
	return true;
}
Ejemplo n.º 17
0
time_t FileSystemManager::getFileCreationTime(QString filePath)
{
	HANDLE hFile = CreateFile((LPCTSTR) filePath.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	if (hFile)
	{
		// Get the file modification time
		FILETIME fileCreationTime;
		GetFileTime(hFile, &fileCreationTime, NULL, NULL);

		CloseHandle(hFile);
		return fileTimeToUnixTime(fileCreationTime);
	}
	return 0;
}
Ejemplo n.º 18
0
//---------------------------------------------------------------------------
bool __fastcall TFile::SetDosTime(DWORD t)
{
  //DWORD dos = 0L;
  FILETIME CT, LAT, LWT, NORMAL;
  if( ! handle ) return false;
  Error = ! GetFileTime(handle, &CT, &LAT, &LWT);
  DosDateTimeToFileTime((WORD)(t>>16), (WORD)t, &NORMAL);

  LocalFileTimeToFileTime(&NORMAL, &LWT);
  Error = ! SetFileTime(handle, &CT, &LAT, &LWT);

  if( Exceptions && Error ) throw 0;
  return true;
}
void CWE506_Embedded_Malicious_Code__w32_file_attrib_accessed_12_bad()
{
    if(globalReturnsTrueOrFalse())
    {
        {
            FILETIME ftAccess;
            ULONGLONG qwResult;
            HANDLE hFile = INVALID_HANDLE_VALUE;
            do
            {
                hFile = CreateFile(TEXT("badFile.txt"),
                                   GENERIC_READ | GENERIC_WRITE, /* needed for SetFileTime to work properly */
                                   0,
                                   NULL,
                                   CREATE_ALWAYS,
                                   FILE_ATTRIBUTE_NORMAL, NULL);
                if (hFile == INVALID_HANDLE_VALUE)
                {
                    break;
                }
                if (!GetFileTime(hFile,
                                 NULL,
                                 &ftAccess,
                                 NULL))
                {
                    break;
                }
                /* adapted from http://support.microsoft.com/kb/188768 */
                qwResult = (((ULONGLONG) ftAccess.dwHighDateTime) << 32) + ftAccess.dwLowDateTime;
                /* Subtract 10 days from real last accesssed date */
                qwResult -= 10 * _DAY;
                /* Copy result back into ftAccess */
                ftAccess.dwLowDateTime  = (DWORD)(qwResult & 0xFFFFFFFF);
                ftAccess.dwHighDateTime = (DWORD)(qwResult >> 32);
                /* FLAW: Modify the file's last accessed time */
                SetFileTime(hFile,
                            (LPFILETIME)NULL,
                            &ftAccess,
                            (LPFILETIME)NULL);
            }
            while (0);
            if (hFile != INVALID_HANDLE_VALUE)
            {
                CloseHandle(hFile);
            }
        }
    }
    else
    {
        {
Ejemplo n.º 20
0
//---------------------------------------------------------------------------
double TFile::GetModificationTime(void)
{
  FILETIME CT, LAT, LWT, LOCAL;
  if( ! handle ) return 0.0;
  Error = ! GetFileTime(handle, &CT, &LAT, &LWT);
  if( Exceptions && Error ) throw 0;
  if( Error ) return 0.0;

  Error = ! FileTimeToLocalFileTime(&LWT, &LOCAL);
  if( Exceptions && Error ) throw 0;
  if( Error ) return 0.0;

  return _TFileTimeToDateTime((ULONGLONG *)&LOCAL);
}
Ejemplo n.º 21
0
void TFile::GetTimes(	FILETIME* pCreationTime,
						FILETIME* pLastAccessTime,
						FILETIME* pLastWriteTime) const
{
	DEBUG_VERIFY_ALLOCATION;

	DEBUG_VERIFY(IsOpen());

	if(!(m_flOpenFlags & FOF_READ))
		INITIATE_FAILURE;

	if(!GetFileTime(m_hFile, pCreationTime, pLastAccessTime, pLastWriteTime))
		INITIATE_FAILURE;
}
Ejemplo n.º 22
0
//---------------------------------------------------------------------
// put a local file --> remote 
bool Server::cmdPut(bstring const & localName, bstring const & remotePath, bool exists)
{
	DBGPRINT(("put '%s' '%s' %b\r\n", localName.c_str(), remotePath.c_str(), exists));
	bstring cmd = bstring(exists ? TEXT("reput \"") : TEXT("put \"")) + localName + TEXT("\" \"") + remotePath + TEXT("\"");

	if (!doCommand(cmd))
		return false;

	FILETIME ft;
	HANDLE hFile = CreateFile(localName.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
	if (hFile == (HANDLE)HFILE_ERROR)
		return true; // copy succeeded

	GetFileTime(hFile, 0, 0, &ft);
	long fsHigh = 0;
	long fsLow = SetFilePointer(hFile, 0, &fsHigh, FILE_END);

	CloseHandle(hFile);

	bstring chmod = TEXT("----");
	if (defChMod.length() > 0 || exeChMod.length() > 0) {
		chmod = defChMod;
		size_t ldot = remotePath.find_last_of('.');
		if (ldot != (size_t)-1) {
			bstring x = remotePath.substr(ldot);
			std::map<bstring, bstring>::iterator i = exeExtensions.find(x);
			if (i != exeExtensions.end())
				chmod = exeChMod;
		}
		if (chmod.length() > 0) {
			cmd = bstring(TEXT("chmod ")) + chmod + TEXT(" \"") + remotePath + TEXT("\"");
			doCommand(cmd);
		}
	}

	// fake update the directory
	insertFile(remotePath, &ft, fsLow, fsHigh, '-', chmod);

	// we cannot set the file time
	if (disableMtime)
		return true;

	// if setting the mtime failes, do not try it again
	if (!this->cmdMtime(remotePath, &ft))
		disableMtime = true;

	// put already succeeded.
	return true;
}
Ejemplo n.º 23
0
//---------------------------------------------------------------------------
DWORD __fastcall TFile::GetDosTime(void)
{
  DWORD dos = 0L;
  FILETIME CT, LAT, LWT, NORMAL;
  if( ! handle ) return dos;
  Error = ! GetFileTime(handle, &CT, &LAT, &LWT);
  FileTimeToLocalFileTime(&LWT, &NORMAL);

  //FileTimeToDosDateTime(&CT, ((LPWORD)&dos)+1, (LPWORD)&dos);
  //FileTimeToDosDateTime(&LAT, ((LPWORD)&dos)+1, (LPWORD)&dos);
  FileTimeToDosDateTime(&NORMAL, ((LPWORD)&dos)+1, (LPWORD)&dos);

  if( Exceptions && Error ) throw 0;
  return dos;
}
Ejemplo n.º 24
0
void changeFileDate(const std::string& filename, uLong dosdate, tm_unz tmu_date)
{
#ifdef _WIN32
	HANDLE hFile;
	FILETIME ftm, ftLocal, ftCreate, ftLastAcc, ftLastWrite;

	hFile = CreateFileA(filename.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
	if (hFile != INVALID_HANDLE_VALUE)
	{
		GetFileTime(hFile, &ftCreate, &ftLastAcc, &ftLastWrite);
		DosDateTimeToFileTime((WORD)(dosdate >> 16), (WORD)dosdate, &ftLocal);
		LocalFileTimeToFileTime(&ftLocal, &ftm);
		SetFileTime(hFile, &ftm, &ftLastAcc, &ftm);
		CloseHandle(hFile);
	}
Ejemplo n.º 25
0
  /* change_file_date : change the date/time of a file
     filename : the filename of the file where date/time must be modified
     dosdate : the new date at the MSDos format (4 bytes)
     tmu_date : the SAME new date at the tm_unz format */
  static void change_file_date( const wchar_t *filename, uLong dosdate, tm_unz tmu_date )
  {
#if defined(_WIN32) || defined (_WIN64)
    HANDLE hFile;
    FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;

    hFile = CreateFileW(filename,GENERIC_READ | GENERIC_WRITE,
                        0,NULL,OPEN_EXISTING,0,NULL);
    GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite);
    DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal);
    LocalFileTimeToFileTime(&ftLocal,&ftm);
    SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
    CloseHandle(hFile);
#endif
  }
Ejemplo n.º 26
0
u64 getLastModified(const char* file)
{
	FILETIME ft;
	HANDLE handle = CreateFile(file, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	if (GetFileTime(handle, NULL, NULL, &ft) == FALSE)
	{
		return 0;
	}
	CloseHandle(handle);

	ULARGE_INTEGER i;
	i.LowPart = ft.dwLowDateTime;
	i.HighPart = ft.dwHighDateTime;
	return i.QuadPart;
}
Ejemplo n.º 27
0
double OGGetFileTime( const char * file )
{
	FILETIME ft;

	HANDLE h = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);

	if( h==INVALID_HANDLE_VALUE )
		return -1;

	GetFileTime( h, 0, 0, &ft );

	CloseHandle( h );

	return ft.dwHighDateTime + ft.dwLowDateTime;
}
int OpenInFilePC(char *NameF)                                  //Открыли входной файл для чтения с компьютера
{
   Size_inF.QuadPart = 0;
   inFile = CreateFile(NameF, GENERIC_READ, FILE_SHARE_READ, NULL,
                       OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
   if(inFile == INVALID_HANDLE_VALUE)
      return ErrorSys2(NameF, (Lan+84)->msg);                //"Ошибка при открытии файла для чтения.");
   Size_inF.u.LowPart = GetFileSize(inFile, &Size_inF.u.HighPart);
   if(Size_inF.u.LowPart == 0xFFFFFFFF && GetLastError() != NO_ERROR)
      return ErrorSys2(NameF, (Lan+85)->msg);                //"Ошибка при запросе размера файла."
   if(Size_inF.QuadPart == 0)
      return Error2(NameF, (Lan+86)->msg);                   //"Недопустимо малый размер файла."
   GetFileTime(inFile, NULL, NULL, &Time_inF);               //Дата последней записи
   return 0;
}
Ejemplo n.º 29
0
Archivo: Time.c Proyecto: xpika/winhugs
static void hugsprim_GetFileTime_11(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsPtr arg2;
    HsPtr arg3;
    HsPtr arg4;
    HsBool res1;
    arg1 = hugs->getPtr();
    arg2 = hugs->getPtr();
    arg3 = hugs->getPtr();
    arg4 = hugs->getPtr();
    res1 = GetFileTime(arg1, arg2, arg3, arg4);
    hugs->putBool(res1);
    hugs->returnIO(hugs_root,1);
}
Ejemplo n.º 30
0
//---------------------------------------------------------------------------
Ztring File::Modified_Local_Get()
{
    #ifdef ZENLIB_USEWX
        if (File_Handle==NULL)
    #else //ZENLIB_USEWX
        #ifdef ZENLIB_STANDARD
            //if (File_Handle==-1)
            if (File_Handle==NULL)
        #elif defined WINDOWS
            if (File_Handle==NULL)
        #endif
    #endif //ZENLIB_USEWX
        return Ztring();

    #ifdef ZENLIB_USEWX
        return Ztring(); //Not implemented
    #else //ZENLIB_USEWX
        #ifdef ZENLIB_STANDARD
            struct stat Stat;
            int Result=stat(File_Name.To_Local().c_str(), &Stat);
            if (Result<0)
                return Ztring(); //Error
            Ztring Time; Time.Date_From_Seconds_1970_Local(Stat.st_mtime);
            return Time;
        #elif defined WINDOWS
            FILETIME TimeFT;
            if (GetFileTime(File_Handle, NULL, NULL, &TimeFT))
            {
                int64u Time64=0x100000000ULL*TimeFT.dwHighDateTime+TimeFT.dwLowDateTime; //100-ns
                TIME_ZONE_INFORMATION Info;
                DWORD Result=GetTimeZoneInformation(&Info);
                if (Result!=TIME_ZONE_ID_INVALID)
                {
                    Time64-=((int64s)Info.Bias)*60*1000*1000*10;
                    if (Result==TIME_ZONE_ID_DAYLIGHT)
                        Time64-=((int64s)Info.DaylightBias)*60*1000*1000*10;
                    else
                        Time64-=((int64s)Info.StandardBias)*60*1000*1000*10;
                }
                Ztring Time; Time.Date_From_Milliseconds_1601(Time64/10000);
                Time.FindAndReplace(_T("UTC "), _T(""));
                return Time;
            }
            else
                return Ztring(); //There was a problem
        #endif
    #endif //ZENLIB_USEWX
}