time stamp convert tools 1.0.0.1 on vs2010

来源:互联网 发布:后端用java还是php 编辑:程序博客网 时间:2024/05/18 12:42

PEview(v0.99)中有显示时间戳的功能,但是不知道为啥显示不出来.
CFF, studPE只显示时间戳的值,但是没有转成人类识别的时间字符串.
写了一个控制台程序,用来贴入PE工具得到的时间戳的16进制值, 输出时间戳字符串.

工程下载点

src_time_stamp_convert_tools.zip

实验

// test_2017_0529_1356.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <Windows.h>#include <stdlib.h>#include <stdio.h>#include <time.h>BOOL php_time_2_systemtime(long lPhpTime, SYSTEMTIME* pst);int get_offset_utc_and_localtime();/** run result================================================================================time stamp convert tools 1.0.0.1 on vs2010================================================================================time stamp input value can accept below:         592BC182         0x592bc182         0x592BC182         0X592BC182--------------------------------------------------------------------------------please input time stamp : 0x592bc182time stamp input is : 0x592BC182time stamp input convert to time is : 2017-05-29 14:36:50--------------------------------------------------------------------------------请按任意键继续. . .*/int _tmain(int argc, _TCHAR* argv[]){    BOOL bRc = FALSE;    SYSTEMTIME st;    char szTime[11] = {'\0'};    DWORD dwTimeStamp = 0;    long ltm = 0;    printf("================================================================================\n");    printf("time stamp convert tools 1.0.0.1 on vs2010\n");    printf("================================================================================\n");    printf("time stamp input value can accept below:\n");    printf("\t 592BC182\n");    printf("\t 0x592bc182\n");    printf("\t 0x592BC182\n");    printf("\t 0X592BC182\n");    printf("--------------------------------------------------------------------------------\n");    printf("please input time stamp : ");    scanf("%10s", szTime);  // can input 0x592BC182 or 592BC182    dwTimeStamp = (int)strtol(szTime, NULL, 16);    printf("time stamp input is : 0x%X\n", dwTimeStamp);    ltm = (long)dwTimeStamp;    ltm += get_offset_utc_and_localtime();    bRc = php_time_2_systemtime(ltm, &st);    if (bRc) {        printf("time stamp input convert to time is : %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d\n",            st.wYear,            st.wMonth,            st.wDay,            st.wHour,            st.wMinute,            st.wSecond);    } else {        printf("invalid time stamp input\n");    }    printf("--------------------------------------------------------------------------------\n");    system("pause");    return 0;}int get_offset_utc_and_localtime(){    time_t now = 0;    time_t utc = 0;    time_t local = 0;    struct tm* tmutc;    struct tm* tmlocal;    time(&now);    tmutc = gmtime(&now);    utc = mktime(tmutc);    tmlocal = localtime(&now);    local = mktime(tmlocal);    return (local - utc);}BOOL php_time_2_systemtime(long lPhpTime, SYSTEMTIME* pst){      BOOL        bRc = FALSE;      time_t      tmt = -1;      struct tm*  pGmt = NULL;      do       {          if (NULL == pst)              break;          tmt = lPhpTime;          pGmt = gmtime(&tmt);        if (NULL == pGmt)              break;          pst->wYear = 1900 + pGmt->tm_year;          pst->wMonth = 1 + pGmt->tm_mon;          pst->wDay = pGmt->tm_mday;          pst->wHour = pGmt->tm_hour;          pst->wMinute = pGmt->tm_min;          pst->wSecond = pGmt->tm_sec;          pst->wDayOfWeek = pGmt->tm_wday;          bRc = TRUE;      } while (0);      return bRc;  }