本文整理汇总了C++中FileTimeToLocalFileTime函数的典型用法代码示例。如果您正苦于以下问题:C++ FileTimeToLocalFileTime函数的具体用法?C++ FileTimeToLocalFileTime怎么用?C++ FileTimeToLocalFileTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FileTimeToLocalFileTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: format_timestamp
static void format_timestamp(uint64_t seconds, int microseconds, char *buffer, int length,
char *date_separator, char *date_time_separator, char *time_separator) {
ULONGLONG timestamp = 0;
ULONGLONG offset_to_1970 = 116444736000000000;
SYSTEMTIME st;
FILETIME ft, ft_local;
timestamp = Int32x32To64(seconds, 10000000) + offset_to_1970;
ft.dwHighDateTime = (DWORD)((timestamp >> 32) & 0xFFFFFFFF);
ft.dwLowDateTime = (DWORD)(timestamp & 0xFFFFFFFF);
FileTimeToLocalFileTime(&ft, &ft_local);
FileTimeToSystemTime(&ft_local, &st);
if (microseconds < 0) {
_snprintf(buffer, length, "%d%s%02d%s%02d%s%02d%s%02d%s%02d",
st.wYear, date_separator, st.wMonth, date_separator, st.wDay, date_time_separator,
st.wHour, time_separator, st.wMinute, time_separator, st.wSecond);
} else {
_snprintf(buffer, length, "%d%s%02d%s%02d%s%02d%s%02d%s%02d.%06d",
st.wYear, date_separator, st.wMonth, date_separator, st.wDay, date_time_separator,
st.wHour, time_separator, st.wMinute, time_separator, st.wSecond, microseconds);
}
}
开发者ID:Loremipsum1988,项目名称:brickd,代码行数:24,代码来源:logviewer.c
示例2: timeT
CMSTime::CMSTime(const FILETIME& fileTime, int nDST)
{
// first convert file time (UTC time) to local time
FILETIME localTime;
if (!FileTimeToLocalFileTime(&fileTime, &localTime))
{
m_time = 0;
//AtlThrow(E_INVALIDARG);
return;
}
// then convert that time to system time
SYSTEMTIME sysTime;
if (!FileTimeToSystemTime(&localTime, &sysTime))
{
m_time = 0;
//AtlThrow(E_INVALIDARG);
return;
}
// then convert the system time to a time_t (C-runtime local time)
CMSTime timeT(sysTime, nDST);
*this = timeT;
}
开发者ID:juhuaguai,项目名称:duilib,代码行数:24,代码来源:mstime.cpp
示例3: Filesets_Dump_OnInitDialog
void Filesets_Dump_OnInitDialog (HWND hDlg, LPSET_DUMP_PARAMS psdp)
{
TCHAR szServer[ cchNAME ];
TCHAR szAggregate[ cchNAME ];
TCHAR szFileset[ cchNAME ];
psdp->lpi->GetServerName (szServer);
psdp->lpi->GetAggregateName (szAggregate);
psdp->lpi->GetFilesetName (szFileset);
TCHAR szText[ cchRESOURCE ];
GetDlgItemText (hDlg, IDC_DUMP_FULL, szText, cchRESOURCE);
LPTSTR pszText = FormatString (szText, TEXT("%s%s%s"), szServer, szAggregate, szFileset);
SetDlgItemText (hDlg, IDC_DUMP_FULL, pszText);
FreeString (pszText);
pszText = FormatString (IDS_SET_DUMP_NAME, TEXT("%s"), szFileset);
SetDlgItemText (hDlg, IDC_DUMP_FILENAME, pszText);
FreeString (pszText);
// Get the local system time
SYSTEMTIME st;
GetSystemTime (&st);
FILETIME ft;
SystemTimeToFileTime (&st, &ft);
FILETIME lft;
FileTimeToLocalFileTime (&ft, &lft);
FileTimeToSystemTime (&lft, &st);
DA_SetDate (GetDlgItem (hDlg, IDC_DUMP_DATE), &st);
TI_SetTime (GetDlgItem (hDlg, IDC_DUMP_TIME), &st);
CheckDlgButton (hDlg, IDC_DUMP_FULL, TRUE);
Filesets_Dump_OnSelect (hDlg);
Filesets_Dump_EnableOK (hDlg);
}
开发者ID:bagdxk,项目名称:openafs,代码行数:36,代码来源:set_dump.cpp
示例4: ConvertDate
void ConvertDate(const FILETIME& ft,wchar_t *DateText,wchar_t *TimeText)
{
if (ft.dwHighDateTime==0 && ft.dwLowDateTime==0)
{
if (DateText!=NULL)
*DateText=0;
if (TimeText!=NULL)
*TimeText=0;
return;
}
SYSTEMTIME st;
FILETIME ct;
FileTimeToLocalFileTime(&ft,&ct);
FileTimeToSystemTime(&ct,&st);
if (TimeText!=NULL)
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st, 0, TimeText, MAX_DATETIME);
if (DateText!=NULL)
GetDateFormat(LOCALE_USER_DEFAULT, 0, &st, 0, DateText, MAX_DATETIME);
}
开发者ID:CyberShadow,项目名称:FAR,代码行数:24,代码来源:Pmix.cpp
示例5: EnterCriticalSection
BOOL CStreamVideoSource::GetRawImage(BYTE **pRawData, FILETIME *timestamp, DWORD *bEOF )
{
// Lock the image here and don't unlock until we get the frame back
EnterCriticalSection(&m_csBufLock);
*bEOF = FALSE;
if( m_bGotVideoFrame )
{
// Get the next frame
*pRawData = m_pAlignedImg;
// Need Time stamp
GetSystemTimeAsFileTime(timestamp);
FileTimeToLocalFileTime(timestamp, timestamp);
m_bGotVideoFrame = FALSE;
return TRUE;
}
else
{
// Nothing.. unlock
LeaveCriticalSection(&m_csBufLock);
// Check for process exit
if( WAIT_OBJECT_0 == WaitForSingleObject( m_piStreamer.hProcess, 0 ) )
{
// Child process has disappeared (exited)
*bEOF = TRUE;
m_bRun = FALSE;
CleanupChild();
}
return FALSE;
}
}
开发者ID:anyboo,项目名称:SPlayer,代码行数:36,代码来源:StreamVideoSource.cpp
示例6: posixemu_stat
int posixemu_stat(const char *name, struct stat *statbuf)
{
char buf[1024];
DWORD attr;
FILETIME ft, lft;
fname_atow(name,buf,sizeof buf);
if ((attr = getattr(buf,&ft,(size_t*)&statbuf->st_size)) == (DWORD)~0)
{
lasterror = GetLastError();
return -1;
}
else
{
statbuf->st_mode = (attr & FILE_ATTRIBUTE_READONLY) ? FILEFLAG_READ: FILEFLAG_READ | FILEFLAG_WRITE;
if (attr & FILE_ATTRIBUTE_ARCHIVE) statbuf->st_mode |= FILEFLAG_ARCHIVE;
if (attr & FILE_ATTRIBUTE_DIRECTORY) statbuf->st_mode |= FILEFLAG_DIR;
FileTimeToLocalFileTime(&ft,&lft);
statbuf->st_mtime = (*(__int64 *)&lft-((__int64)(369*365+89)*(__int64)(24*60*60)*(__int64)10000000))/(__int64)10000000;
}
return 0;
}
开发者ID:lleoha,项目名称:WinFellow,代码行数:24,代码来源:POSIXEMU.C
示例7: hal_getsysdate
static TINT
hal_getsysdate(struct THALBase *hal, TDATE *datep, TINT *dsbiasp)
{
union { LARGE_INTEGER li; FILETIME ft; } utime;
union { LARGE_INTEGER li; FILETIME ft; } ltime;
TUINT64 syst;
TINT dsbias;
GetSystemTimeAsFileTime(&utime.ft);
syst = utime.li.QuadPart / 10; /* to microseconds since 1.1.1601 */
FileTimeToLocalFileTime(&utime.ft, <ime.ft);
dsbias = (TINT) ((utime.li.QuadPart - ltime.li.QuadPart) / 10000000);
if (dsbiasp)
*dsbiasp = dsbias;
else
syst -= (TINT64) dsbias * 1000000;
if (datep)
datep->tdt_Int64 = syst;
return 0;
}
开发者ID:callcc,项目名称:tekui,代码行数:24,代码来源:hal.c
示例8: filetime
uLong filetime(
const char *filename, /* name of file to get info on */
tm_zip *tmzip, /* return value: access, modific. and creation times */
uLong *dt) /* dostime */
/*****************************/
#ifdef WIN32
{
int ret = 0;
{
FILETIME ftLocal;
HANDLE hFind;
WIN32_FIND_DATA ff32;
hFind = FindFirstFile(filename,&ff32);
if (hFind != INVALID_HANDLE_VALUE)
{
FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal);
FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0);
FindClose(hFind);
ret = 1;
}
}
return ret;
}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:24,代码来源:minizip.c
示例9: defined
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
# if defined (ACE_HAS_WINCE)
ACE_TCHAR *
ACE_OS::ctime_r (const time_t *clock, ACE_TCHAR *buf, int buflen)
{
// buflen must be at least 26 wchar_t long.
if (buflen < 26) // Again, 26 is a magic number.
{
errno = ERANGE;
return 0;
}
// This is really stupid, converting FILETIME to timeval back and
// forth. It assumes FILETIME and DWORDLONG are the same structure
// internally.
ULARGE_INTEGER _100ns;
_100ns.QuadPart = (DWORDLONG) *clock * 10000 * 1000
+ ACE_Time_Value::FILETIME_to_timval_skew;
FILETIME file_time;
file_time.dwLowDateTime = _100ns.LowPart;
file_time.dwHighDateTime = _100ns.HighPart;
FILETIME localtime;
SYSTEMTIME systime;
FileTimeToLocalFileTime (&file_time, &localtime);
FileTimeToSystemTime (&localtime, &systime);
ACE_OS::sprintf (buf, ACE_OS_CTIME_R_FMTSTR,
ACE_OS_day_of_week_name[systime.wDayOfWeek],
ACE_OS_month_name[systime.wMonth - 1],
systime.wDay,
systime.wHour,
systime.wMinute,
systime.wSecond,
systime.wYear);
return buf;
}
开发者ID:08keelr,项目名称:TrinityCore,代码行数:36,代码来源:OS_NS_time.cpp
示例10: DragQueryFile
void CFileEncryptDlg::OnDropFiles(HDROP hDropInfo)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
int DropCount = DragQueryFile(hDropInfo, -1, NULL, 0);
CString FileInfo;
TCHAR *pName;
WIN32_FIND_DATA FindFileData;
SYSTEMTIME mysystime;
FILETIME loctime;
if (DropCount <= 1)
{
HANDLE hFile;
int NameSize = DragQueryFile(hDropInfo, 0, NULL, 0);
pName = new TCHAR[NameSize + 1];
DragQueryFile(hDropInfo, 0, pName, NameSize+1);
hFile = FindFirstFile(pName, &FindFileData);
FindClose(hFile);
if (hFile == INVALID_HANDLE_VALUE)
{
FileInfo = _T("是不是把硬盘\\U盘\\CD驱动器拖拽进来啦,这样是不行滴!");
SetButtonFalse();
}
else if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0x10)
{
FileInfo = _T("不能对文件夹进行操作!");
SetButtonFalse();
}
else if (FindFileData.nFileSizeLow == 0 && FindFileData.nFileSizeHigh == 0)
{
FileInfo = _T("文件大小为0字节,无需操作!");
SetButtonFalse();
}
else
{
// 文件名称
str_FileName = pName;
FileInfo += str_FileName;
FileInfo += _T("\r\n");
CString str_data;
// 文件大小
// llFileSize = (FindFileData.nFileSizeHigh << 32) + FindFileData.nFileSizeLow; // 行为未定义,但是运行正常,会首先转换为LONGLONG,然后左移
llFileSize = FindFileData.nFileSizeHigh;
llFileSize <<= 32;
llFileSize += FindFileData.nFileSizeLow;
str_data.Format(_T("文件大小:%I64d字节\r\n"), llFileSize);
FileInfo += str_data;
// 文件创建时间
// 转化为本地时间,否则会有8小时误差
FileTimeToLocalFileTime(&FindFileData.ftLastWriteTime, &loctime);
FileTimeToSystemTime(&loctime, &mysystime);
str_data.Format(_T("最后修改时间:%d年%d月%d日 %d:%02d:%02d"), mysystime.wYear, mysystime.wMonth,
mysystime.wDay, mysystime.wHour, mysystime.wMinute, mysystime.wSecond);
FileInfo += str_data;
GetDlgItem(IDC_ENCRYPT)->EnableWindow(TRUE);
GetDlgItem(IDC_DECRYPT)->EnableWindow(TRUE);
}
delete[] pName;
pName = NULL;
DragFinish(hDropInfo);
}
else
{
FileInfo = _T("本程序只支持单个文件拖拽加密!");
}
SetDlgItemText(IDC_FILE_INFORMATION, FileInfo);
CDialogEx::OnDropFiles(hDropInfo);
}
开发者ID:Ruijie-Qin,项目名称:FileEncrypt,代码行数:68,代码来源:FileEncryptDlg.cpp
示例11: propBasicQueryKey
/*
* propBasicQueryKey
*
* Purpose:
*
* Set information values for Key object type
*
* If ExtendedInfoAvailable is FALSE then it calls propSetDefaultInfo to set Basic page properties
*
*/
VOID propBasicQueryKey(
_In_ PROP_OBJECT_INFO *Context,
_In_ HWND hwndDlg,
_In_ BOOL ExtendedInfoAvailable
)
{
NTSTATUS status;
ULONG bytesNeeded;
HANDLE hObject;
TIME_FIELDS SystemTime;
WCHAR szBuffer[MAX_PATH];
KEY_FULL_INFORMATION kfi;
SetDlgItemText(hwndDlg, ID_KEYSUBKEYS, T_CannotQuery);
SetDlgItemText(hwndDlg, ID_KEYVALUES, T_CannotQuery);
SetDlgItemText(hwndDlg, ID_KEYLASTWRITE, T_CannotQuery);
if (Context == NULL) {
return;
}
//
// Open Key object.
//
hObject = NULL;
if (!propOpenCurrentObject(Context, &hObject, KEY_QUERY_VALUE)) {
return;
}
RtlSecureZeroMemory(&kfi, sizeof(KEY_FULL_INFORMATION));
status = NtQueryKey(hObject, KeyFullInformation, &kfi,
sizeof(KEY_FULL_INFORMATION), &bytesNeeded);
if (NT_SUCCESS(status)) {
//Subkeys count
RtlSecureZeroMemory(szBuffer, sizeof(szBuffer));
ultostr(kfi.SubKeys, _strend(szBuffer));
SetDlgItemText(hwndDlg, ID_KEYSUBKEYS, szBuffer);
//Values count
RtlSecureZeroMemory(szBuffer, sizeof(szBuffer));
ultostr(kfi.Values, _strend(szBuffer));
SetDlgItemText(hwndDlg, ID_KEYVALUES, szBuffer);
//LastWrite time
RtlSecureZeroMemory(&SystemTime, sizeof(SystemTime));
FileTimeToLocalFileTime((PFILETIME)&kfi.LastWriteTime,
(PFILETIME)&kfi.LastWriteTime);
RtlTimeToTimeFields((PLARGE_INTEGER)&kfi.LastWriteTime,
(PTIME_FIELDS)&SystemTime);
//Month starts from 0 index
if (SystemTime.Month - 1 < 0) SystemTime.Month = 1;
if (SystemTime.Month > 12) SystemTime.Month = 12;
RtlSecureZeroMemory(&szBuffer, sizeof(szBuffer));
wsprintf(szBuffer, FORMATTED_TIME_DATE_VALUE,
SystemTime.Hour,
SystemTime.Minute,
SystemTime.Second,
SystemTime.Day,
Months[SystemTime.Month - 1],
SystemTime.Year);
SetDlgItemText(hwndDlg, ID_KEYLASTWRITE, szBuffer);
}
//
// Query object basic and type info if needed.
//
if (ExtendedInfoAvailable == FALSE) {
propSetDefaultInfo(Context, hwndDlg, hObject);
}
NtClose(hObject);
}
开发者ID:songbei6,项目名称:WinObjEx64,代码行数:87,代码来源:propBasic.c
示例12: propBasicQuerySymlink
/*
* propBasicQuerySymlink
*
* Purpose:
*
* Set information values for SymbolicLink object type
*
* If ExtendedInfoAvailable is FALSE then it calls propSetDefaultInfo to set Basic page properties
*
*/
VOID propBasicQuerySymlink(
_In_ PROP_OBJECT_INFO *Context,
_In_ HWND hwndDlg,
_In_ BOOL ExtendedInfoAvailable
)
{
NTSTATUS status;
ULONG bytesNeeded;
HANDLE hObject;
LPWSTR lpLinkTarget;
TIME_FIELDS SystemTime;
WCHAR szBuffer[MAX_PATH];
OBJECT_BASIC_INFORMATION obi;
SetDlgItemText(hwndDlg, ID_OBJECT_SYMLINK_TARGET, T_CannotQuery);
SetDlgItemText(hwndDlg, ID_OBJECT_SYMLINK_CREATION, T_CannotQuery);
if (Context == NULL) {
return;
}
//
// Open SymbolicLink object.
//
hObject = NULL;
if (!propOpenCurrentObject(Context, &hObject, SYMBOLIC_LINK_QUERY)) {
return;
}
//
// Copy link target from main object list for performance reasons.
// So we don't need to query same data again.
//
lpLinkTarget = Context->lpDescription;
if (lpLinkTarget) {
SetDlgItemText(hwndDlg, ID_OBJECT_SYMLINK_TARGET, lpLinkTarget);
}
//Query Link Creation Time
RtlSecureZeroMemory(&obi, sizeof(OBJECT_BASIC_INFORMATION));
status = NtQueryObject(hObject, ObjectBasicInformation, &obi,
sizeof(OBJECT_BASIC_INFORMATION), &bytesNeeded);
if (NT_SUCCESS(status)) {
FileTimeToLocalFileTime((PFILETIME)&obi.CreationTime, (PFILETIME)&obi.CreationTime);
RtlSecureZeroMemory(&SystemTime, sizeof(SystemTime));
RtlTimeToTimeFields((PLARGE_INTEGER)&obi.CreationTime, (PTIME_FIELDS)&SystemTime);
//Month starts from 0 index
if (SystemTime.Month - 1 < 0) SystemTime.Month = 1;
if (SystemTime.Month > 12) SystemTime.Month = 12;
RtlSecureZeroMemory(&szBuffer, sizeof(szBuffer));
wsprintf(szBuffer, FORMATTED_TIME_DATE_VALUE,
SystemTime.Hour,
SystemTime.Minute,
SystemTime.Second,
SystemTime.Day,
Months[SystemTime.Month - 1],
SystemTime.Year);
SetDlgItemText(hwndDlg, ID_OBJECT_SYMLINK_CREATION, szBuffer);
}
//
// Query object basic and type info if needed.
//
if (ExtendedInfoAvailable == FALSE) {
propSetDefaultInfo(Context, hwndDlg, hObject);
}
NtClose(hObject);
}
开发者ID:songbei6,项目名称:WinObjEx64,代码行数:84,代码来源:propBasic.c
示例13: CheckRecursivFilesFromSizeAndEM
//----------------------------------------------------------------
void CheckRecursivFilesFromSizeAndEM(DWORD iitem, char *remote_name, long long int size, char *MD5, char *SHA256, BOOL recursif, char*source)
{
#ifdef DEBUG_MODE_FILES
AddMsg(h_main,"DEBUG","files:CheckRecursivFilesFromSizeAndEM START",remote_name);
#endif
WIN32_FIND_DATA data;
char tmp_path[LINE_SIZE]="", tmp_remote_name[LINE_SIZE]="", date[MAX_PATH]="\0\0\0";
//search
BOOL exist;
HANDLE hfile, hfind;
LARGE_INTEGER filesize;
char s_sha[SHA256_SIZE]="",s_md5[MAX_PATH];
FILETIME LocalFileTime;
SYSTEMTIME SysTimeModification;
snprintf(tmp_path,LINE_SIZE,"%s\\*.*",remote_name);
hfind = FindFirstFile(tmp_path, &data);
if (hfind != INVALID_HANDLE_VALUE && scan_start)
{
do
{
if (data.cFileName[0] == '.' && (data.cFileName[1] == 0 || (data.cFileName[2] == 0 && data.cFileName[1] == '.')))continue;
#ifdef DEBUG_MODE_FILES
AddMsg(h_main,(char*)"DEBUG S(CheckRecursivFilesFromSizeAndEM)",remote_name,(char*)data.cFileName);
#endif
if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && recursif)
{
snprintf(tmp_remote_name,LINE_SIZE,"%s\\%s",remote_name,data.cFileName);
#ifdef DEBUG_MODE_FILES
AddMsg(h_main,(char*)"DEBUG D(CheckRecursivFilesFromSizeAndEM)",tmp_remote_name,(char*)"");
#endif
CheckRecursivFilesFromSizeAndEM(iitem, tmp_remote_name, size, MD5, SHA256, recursif, source);
continue;
}
exist = FALSE;
filesize.HighPart = data.nFileSizeHigh;
filesize.LowPart = data.nFileSizeLow;
if (filesize.QuadPart == size || size == -1)
{
snprintf(tmp_remote_name,LINE_SIZE,"%s\\%s",remote_name,data.cFileName);
s_md5[0] = 0;
s_sha[0] = 0;
if (MD5[0] != 0 || SHA256[0] != 0 || (SHA256[0] == 0 && MD5[0] == 0))
{
//make MD5 and SHA256 hashes
//MD5
hfile = CreateFile(tmp_remote_name,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,0);
if (hfile != INVALID_HANDLE_VALUE)
{
FileToMd5(hfile, s_md5);
CloseHandle(hfile);
//SHA256
hfile = CreateFile(tmp_remote_name,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,0);
if (hfile != INVALID_HANDLE_VALUE)
{
FileToSHA256(hfile, s_sha);
CloseHandle(hfile);
}
}
if (MD5[0] == 0 && SHA256[0] == 0)exist = TRUE;
else
{
if(MD5[0] != 0 && compare_nocas(MD5,s_md5))exist = TRUE;
else if(SHA256[0] != 0 && compare_nocas(SHA256,s_sha))exist = TRUE;
}
if (exist && (filesize.QuadPart!=0 || (data.ftLastWriteTime.dwHighDateTime != 0 && data.ftLastWriteTime.dwLowDateTime != 0)))
{
date[0] = 0;
FileTimeToLocalFileTime(&(data.ftLastWriteTime), &LocalFileTime);
FileTimeToSystemTime(&LocalFileTime, &SysTimeModification);
snprintf(date,MAX_PATH,"[Last_modification:%02d/%02d/%02d-%02d:%02d:%02d,Size:%lo]"
,SysTimeModification.wYear,SysTimeModification.wMonth,SysTimeModification.wDay
,SysTimeModification.wHour,SysTimeModification.wMinute,SysTimeModification.wSecond,filesize.QuadPart);
if (s_sha[0] != 0)
{
snprintf(tmp_remote_name,LINE_SIZE,"%s %s;MD5;%s;%s;%s",tmp_remote_name,date,s_md5[0]==0?"":s_md5,SHA1_enable?"SHA1":"SHA256",s_sha[0]==0?"":s_sha);
}else if (s_md5[0] != 0)
{
snprintf(tmp_remote_name,LINE_SIZE,"%s %s;MD5;%s;;",tmp_remote_name,date,s_md5);
}else snprintf(tmp_remote_name,LINE_SIZE,"%s %s;;;;",tmp_remote_name,date);
AddMsg(h_main,(char*)"FOUND (File2)",tmp_remote_name,(char*)"");
AddLSTVUpdateItem(tmp_remote_name, COL_FILES, iitem);
}
}
}
//.........这里部分代码省略.........
开发者ID:garfieldchien,项目名称:omnia-projetcs,代码行数:101,代码来源:Files.c
示例14: wceex_stat
/*******************************************************************************
* wceex_stat - Get file attributes for file and store them in buffer.
*
* Description:
*
* File times on Windows CE: Windows CE object store keeps track of only
* one time, the time the file was last written to.
*
* Return value:
*
* Upon successful completion, 0 shall be returned.
* Otherwise, -1 shall be returned and errno set to indicate the error.
*
* XXX - mloskot - errno is not yet implemented
*
* Reference:
* IEEE Std 1003.1, 2004 Edition
*
*******************************************************************************/
int wceex_stat(const char* filename, struct stat *buffer)
{
HANDLE findhandle;
WIN32_FIND_DATA findbuf;
wchar_t pathWCE[MAX_PATH];
//Don't allow wildcards to be interpreted by system
if(strpbrk(filename, "?*"))
//if(wcspbrk(path, L"?*"))
{
//errno = ENOENT;
return(-1);
}
//search file/dir
mbstowcs(pathWCE, filename, strlen(filename) + 1);
findhandle = FindFirstFile(pathWCE, &findbuf);
if(findhandle == INVALID_HANDLE_VALUE)
{
//is root
if(_stricmp(filename, ".\\")==0)
{
findbuf.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
//dummy values
findbuf.nFileSizeHigh = 0;
findbuf.nFileSizeLow = 0;
findbuf.cFileName[0] = '\0';
buffer->st_mtime = wceex_local_to_time_r(1980 - TM_YEAR_BASE, 0, 1, 0, 0, 0);
buffer->st_atime = buffer->st_mtime;
buffer->st_ctime = buffer->st_mtime;
}
//treat as an error
else
{
//errno = ENOENT;
return(-1);
}
}
else
{
/* File is found*/
SYSTEMTIME SystemTime;
FILETIME LocalFTime;
//Time of last modification
if(!FileTimeToLocalFileTime( &findbuf.ftLastWriteTime, &LocalFTime) ||
!FileTimeToSystemTime(&LocalFTime, &SystemTime))
{
//errno = ::GetLastError();
FindClose( findhandle );
return( -1 );
}
buffer->st_mtime = wceex_local_to_time(&SystemTime);
//Time od last access of file
if(findbuf.ftLastAccessTime.dwLowDateTime || findbuf.ftLastAccessTime.dwHighDateTime)
{
if(!FileTimeToLocalFileTime(&findbuf.ftLastAccessTime, &LocalFTime) ||
!FileTimeToSystemTime(&LocalFTime, &SystemTime))
{
//errno = ::GetLastError();
FindClose( findhandle );
return( -1 );
}
buffer->st_atime = wceex_local_to_time(&SystemTime);
}
else
{
buffer->st_atime = buffer->st_mtime;
}
//Time of creation of file
if(findbuf.ftCreationTime.dwLowDateTime || findbuf.ftCreationTime.dwHighDateTime)
{
if(!FileTimeToLocalFileTime(&findbuf.ftCreationTime, &LocalFTime) ||
//.........这里部分代码省略.........
开发者ID:RangelReale,项目名称:sandbox,代码行数:101,代码来源:wce_stat.c
示例15: defined
//.........这里部分代码省略.........
int rc;
if ((rc = DosFindNext(dir,
&find, sizeof(find),
&count)) != 0) {
//fprintf(stderr, "%d\n\n", rc);
return -1;
}
if (count != 1)
return -1;
name = find.achName;
if (Flags & ffFULLPATH) {
JoinDirFile(fullpath, Directory, name);
name = fullpath;
}
memset((void *)&t, 0, sizeof(t));
t.tm_year = find.fdateLastWrite.year + 80;
t.tm_mon = find.fdateLastWrite.month - 1;
t.tm_mday = find.fdateLastWrite.day;
t.tm_hour = find.ftimeLastWrite.hours;
t.tm_min = find.ftimeLastWrite.minutes;
t.tm_sec = find.ftimeLastWrite.twosecs * 2; // ugh!
t.tm_isdst = -1;
*fi = new FileInfo(name,
(find.attrFile & FILE_DIRECTORY) ? fiDIRECTORY : fiFILE,
find.cbFile,
mktime(&t));
return 0;
#elif defined(NT) && !defined(USE_DIRENT)
#if defined(USE_VCFIND)
_finddata_t find;
char fullpath[MAXPATH];
char *name;
struct tm t;
int rc;
if ((rc = _findnext(dir,
&find)) != 0) {
// fprintf(stderr, "%d\n\n", rc);
return -1;
}
name = find.name;
if (Flags & ffFULLPATH) {
JoinDirFile(fullpath, Directory, name);
name = fullpath;
}
*fi = new FileInfo(name,
(find.attrib & _A_SUBDIR) ? fiDIRECTORY : fiFILE,
find.size,
find.time_create);
return 0;
#else
WIN32_FIND_DATA find;
char fullpath[MAXPATH];
char *name;
struct tm t;
SYSTEMTIME st;
FILETIME localft; // needed for time conversion
int rc;
if ((rc = FindNextFile((HANDLE)dir,
&find)) != TRUE) {
//fprintf(stderr, "%d\n\n", rc);
return -1;
}
name = find.cFileName;
if (Flags & ffFULLPATH) {
JoinDirFile(fullpath, Directory, name);
name = fullpath;
}
/*
* since filetime is in UTC format we need to convert it first to
* localtime and when we have "correct" time we can use it.
*/
FileTimeToLocalFileTime(&find.ftLastWriteTime, &localft);
FileTimeToSystemTime(&localft, &st);
t.tm_year = st.wYear - 1900;
t.tm_mon = st.wMonth - 1; // in system time january is 1...
t.tm_mday = st.wDay;
t.tm_hour = st.wHour;
t.tm_min = st.wMinute;
t.tm_sec = st.wSecond;
t.tm_isdst = -1;
*fi = new FileInfo(name,
(find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? fiDIRECTORY : fiFILE,
find.nFileSizeLow,
mktime(&t));
return 0;
#endif
// put code here
#endif
}
开发者ID:AaronDP,项目名称:efte_adbshell,代码行数:101,代码来源:s_direct.cpp
示例16: FindAttributesOrClasses
//.........这里部分代码省略.........
else
wprintf(L" Could not convert UTC-Time.\n");
}
break;
case ADSTYPE_LARGE_INTEGER:
for (x = 0; x< col.dwNumValues; x++)
{
liValue = col.pADsValues[x].LargeInteger;
filetime.dwLowDateTime = liValue.LowPart;
filetime.dwHighDateTime = liValue.HighPart;
if((filetime.dwHighDateTime==0) && (filetime.dwLowDateTime==0))
{
wprintf(L" No value set.\n");
}
else
{
//Check for properties of type LargeInteger that represent time
//if TRUE, then convert to variant time.
if ((0==wcscmp(L"accountExpires", col.pszAttrName))|
(0==wcscmp(L"badPasswordTime", col.pszAttrName))||
(0==wcscmp(L"lastLogon", col.pszAttrName))||
(0==wcscmp(L"lastLogoff", col.pszAttrName))||
(0==wcscmp(L"lockoutTime", col.pszAttrName))||
(0==wcscmp(L"pwdLastSet", col.pszAttrName))
)
{
//Handle special case for Never Expires where low part is -1
if (filetime.dwLowDateTime==-1)
{
wprintf(L" Never Expires.\n");
}
else
{
if (FileTimeToLocalFileTime(&filetime, &filetime) != 0)
{
if (FileTimeToSystemTime(&filetime,
&systemtime) != 0)
{
if (SystemTimeToVariantTime(&systemtime,
&date) != 0)
{
//Pack in variant.vt
varDate.vt = VT_DATE;
varDate.date = date;
VariantChangeType(&varDate,&varDate,VARIANT_NOVALUEPROP,VT_BSTR);
wprintf(L" %s\r\n",varDate.bstrVal);
VariantClear(&varDate);
}
else
{
wprintf(L" FileTimeToVariantTime failed\n");
}
}
else
{
wprintf(L" FileTimeToSystemTime failed\n");
}
}
else
{
wprintf(L" FileTimeToLocalFileTime failed\n");
}
}
}
else
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:67,代码来源:getschemainfo.cpp
示例17: ConvertDate
void ConvertDate(const FILETIME &ft,string &strDateText, string &strTimeText,int TimeLength,
int Brief,int TextMonth,int FullYear,int DynInit)
{
static int WDateFormat;
static wchar_t WDateSeparator,WTimeSeparator,WDecimalSeparator;
static bool Init=false;
static SYSTEMTIME lt;
int DateFormat;
wchar_t DateSeparator,TimeSeparator,DecimalSeparator;
if (!Init)
{
WDateFormat=GetDateFormat();
WDateSeparator=GetDateSeparator();
WTimeSeparator=GetTimeSeparator();
WDecimalSeparator=GetDecimalSeparator();
GetLocalTime(<);
Init=true;
}
DateFormat=DynInit?GetDateFormat():WDateFormat;
DateSeparator=DynInit?GetDateSeparator():WDateSeparator;
TimeSeparator=DynInit?GetTimeSeparator():WTimeSeparator;
DecimalSeparator=DynInit?GetDecimalSeparator():WDecimalSeparator;
int CurDateFormat=DateFormat;
if (Brief && CurDateFormat==2)
CurDateFormat=0;
SYSTEMTIME st;
FILETIME ct;
if (!ft.dwHighDateTime)
{
strDateText.Clear();
strTimeText.Clear();
return;
}
FileTimeToLocalFileTime(&ft,&ct);
FileTimeToSystemTime(&ct,&st);
//if ( !strTimeText.IsEmpty() )
{
const wchar_t *Letter=L"";
if (TimeLength==6)
{
Letter=(st.wHour<12) ? L"a":L"p";
if (st.wHour>12)
st.wHour-=12;
if (!st.wHour)
st.wHour=12;
}
if (TimeLength<7)
strTimeText.Format(L"%02d%c%02d%s",st.wHour,TimeSeparator,st.wMinute,Letter);
else
{
string strFullTime;
strFullTime.Format(L"%02d%c%02d%c%02d%c%03d",st.wHour,TimeSeparator,
st.wMinute,TimeSeparator,st.wSecond,DecimalSeparator,st.wMilliseconds);
strTimeText.Format(L"%.*s",TimeLength, strFullTime.CPtr());
}
}
//if ( !strDateText.IsEmpty() )
{
int Year=st.wYear;
if (!FullYear)
Year%=100;
if (TextMonth)
{
const wchar_t *Month=MSG(MMonthJan+st.wMonth-1);
switch (CurDateFormat)
{
case 0:
strDateText.Format(L"%3.3s %2d %02d",Month,st.wDay,Year);
break;
case 1:
strDateText.Format(L"%2d %3.3s %02d",st.wDay,Month,Year);
break;
default:
strDateText.Format(L"%02d %3.3s %2d",Year,Month,st.wDay);
break;
}
}
else
{
int p1,p2,p3=Year;
int w1=2, w2=2, w3=2;
wchar_t f1=L'0', f2=L'0', f3=FullYear==2?L' ':L'0';
switch (CurDateFormat)
{
case 0:
p1=st.wMonth;
p2=st.wDay;
//.........这里部分代码省略.........
开发者ID:alexlav,项目名称:conemu,代码行数:101,代码来源:datetime.cpp
示例18: Get_Exception_Info
//*************************************************************
LLSD WINAPI Get_Exception_Info(PEXCEPTION_POINTERS pException)
//*************************************************************
// Allocate Str[DUMP_SIZE_MAX] and return Str with dump, if !pException - just return call stack in Str.
{
LLSD info;
LPWSTR Str;
int Str_Len;
// int i;
LPWSTR Module_Name = new WCHAR[MAX_PATH];
PBYTE Module_Addr;
HANDLE hFile;
FILETIME Last_Write_Time;
FILETIME Local_File_Time;
SYSTEMTIME T;
Str = new WCHAR[DUMP_SIZE_MAX];
Str_Len = 0;
if (!Str)
return NULL;
Get_Version_Str(info);
GetModuleFileName(NULL, Str, MAX_PATH);
info["Process"] = ll_convert_wide_to_string(Str);
info["ThreadID"] = (S32)GetCurrentThreadId();
// If exception occurred.
if (pException)
{
EXCEPTION_RECORD & E = *pException->ExceptionRecord;
CONTEXT & C = *pException->ContextRecord;
// If module with E.ExceptionAddress found - save its path and date.
if (Get_Module_By_Ret_Addr((PBYTE)E.ExceptionAddress, Module_Name, Module_Addr))
{
info["Module"] = ll_convert_wide_to_string(Module_Name);
if ((hFile = CreateFile(Module_Name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL)) != INVALID_HANDLE_VALUE)
{
if (GetFileTime(hFile, NULL, NULL, &Last_Write_Time))
{
FileTimeToLocalFileTime(&Last_Write_Time, &Local_File_Time);
FileTimeToSystemTime(&Local_File_Time, &T);
info["DateModified"] = llformat("%02d/%02d/%d", T.wMonth, T.wDay, T.wYear);
}
CloseHandle(hFile);
}
}
else
{
info["ExceptionAddr"] = (int)E.ExceptionAddress;
}
info["ExceptionCode"] = (int)E.ExceptionCode;
/*
//TODO: Fix this
if (E.ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
{
// Access violation type - Write/Read.
LLSD exception_info;
exception_info["Type"] = E.ExceptionInformation[0] ? "Write" : "Read";
exception_info["Address"] = llformat("%08x", E.ExceptionInformation[1]);
info["Exception Information"] = exception_info;
}
*/
// Save instruction that caused exception.
/*
std::string str;
for (i = 0; i < 16; i++)
str += llformat(" %02X", PBYTE(E.ExceptionAddress)[i]);
info["Instruction"] = str;
*/
LLSD registers;
registers["EAX"] = (int)C.Eax;
registers["EBX"] = (int)C.Ebx;
registers["ECX"] = (int)C.Ecx;
registers["EDX"] = (int)C.Edx;
registers["ESI"] = (int)C.Esi;
registers["EDI"] = (int)C.Edi;
registers["ESP"] = (int)C.Esp;
registers["EBP"] = (int)C.Ebp;
registers["EIP"] = (int)C.Eip;
registers["EFlags"] = (int)C.EFlags;
info["Registers"] = registers;
} //if (pException)
// Save call stack info.
Get_Call_Stack(pException->ExceptionRecord, pException->ContextRecord, info);
return info;
} //Get_Exception_Info
开发者ID:VirtualReality,项目名称:Viewer,代码行数:97,代码来源:llwindebug.cpp
示例19: APR_DECLARE
APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
apr_time_t input)
{
SYSTEMTIME st;
FILETIME ft, localft;
AprTimeToFileTime(&ft, input);
#if APR_HAS_UNICODE_FS && !defined(_WIN32_WCE)
IF_WIN_OS_IS_UNICODE
{
TIME_ZONE_INFORMATION *tz;
SYSTEMTIME localst;
apr_time_t localtime;
get_local_timezone(&tz);
FileTimeToSystemTime(&ft, &st);
/* The Platform SDK documents that SYSTEMTIME/FILETIME are
* generally UTC. We use SystemTimeToTzSpecificLocalTime
* because FileTimeToLocalFileFime is documented that the
* resulting time local file time would have DST relative
* to the *present* date, not the date converted.
*/
SystemTimeToTzSpecificLocalTime(tz, &st, &localst);
SystemTimeToAprExpTime(result, &localst);
result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC);
/* Recover the resulting time as an apr time and use the
* delta for gmtoff in seconds (and ignore msec rounding)
*/
SystemTimeToFileTime(&localst, &localft);
FileTimeToAprTime(&localtime, &localft);
result->tm_gmtoff = (int)apr_time_sec(localtime)
- (int)apr_time_sec(input);
/* To compute the dst flag, we compare the expected
* local (standard) timezone bias to the delta.
* [Note, in war time or double daylight time the
* resulting tm_isdst is, desireably, 2 hours]
*/
result->tm_isdst = (result->tm_gmtoff / 3600)
- (-(tz->Bias + tz->StandardBias) / 60);
}
#endif
#if APR_HAS_ANSI_FS || defined(_WIN32_WCE)
ELSE_WIN_OS_IS_ANSI
{
TIME_ZONE_INFORMATION tz;
/* XXX: This code is simply *wrong*. The time converted will always
* map to the *now current* status of daylight savings time.
*/
FileTimeToLocalFileTime(&ft, &localft);
FileTimeToSystemTime(&localft, &st);
SystemTimeToAprExpTime(result, &st);
result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC);
switch (GetTimeZoneInformation(&tz)) {
case TIME_ZONE_ID_UNKNOWN:
result->tm_isdst = 0;
/* Bias = UTC - local time in minutes
* tm_gmtoff is seconds east of UTC
*/
result->tm_gmtoff = tz.Bias * -60;
break;
case TIME_ZONE_ID_STANDARD:
result->tm_isdst = 0;
result->tm_gmtoff = (tz.Bias + tz.StandardBias) * -60;
break;
case TIME_ZONE_ID_DAYLIGHT:
result->tm_isdst = 1;
result->tm_gmtoff = (tz.Bias + tz.DaylightBias) * -60;
break;
default:
/* noop */;
}
}
#endif
return APR_SUCCESS;
}
开发者ID:ohmann,项目名称:checkapi,代码行数:84,代码来源:time.c
示例20: fal_stats
//.........这里部分代码省略.........
// Then, see if the case matches.
String ffound(wFindData.cFileName);
if( fname.subString( fname.length() - ffound.length() ) != ffound )
return false;
}
// ok, file exists and with matching case
HANDLE temp = CreateFileW( wBuffer.w_str(),
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL );
if( (temp == INVALID_HANDLE_VALUE || temp == 0) && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED )
{
AutoCString cBuffer( fname );
temp = CreateFile( cBuffe
|
请发表评论