⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timedatestamp.pas

📁 Delphi写的PE查看器
💻 PAS
字号:
{******************************************************************************}
{Copyright(C) 2007,Pefine Security Lab                                         }
{All rights reserved.                                                          }
{                                                                              }
{Abstract:View Win32 PE file information.                                      }
{                                                                              }
{Version:1.01                                                                  }
{Author:WindRand                                                               }
{Date:2007-01-20                                                               }
{******************************************************************************}
unit TimeDateStamp;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TTimeDateStampFrm = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    TDEdit: TEdit;
    Button1: TButton;
    GroupBox2: TGroupBox;
    Label2: TLabel;
    Label3: TLabel;
    TEdit: TEdit;
    DEdit: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  TimeDateStampFrm: TTimeDateStampFrm;

implementation

uses PEHeader, PublicUnit;

{$R *.dfm}

procedure TTimeDateStampFrm.FormCreate(Sender: TObject);
var
  iDateTime,iYear,iDay:Integer;
  iHour,iMin,iSec:Integer;
  TempDate,GMTDate:TDate;
  TempTime,GMTTime:TTime;
  Year,Month,Day:Word;
  Hour,Min,Sec,MSec:Word;
  i:Integer;
  RInt:Integer;
begin
  RInt:=0;
  GMTDate:=StrToDate('1970-01-01');
  GMTTime:=StrToTime('00:00:00');
  DecodeDate(GMTDate,Year,Month,Day);
  DecodeTime(GMTTime,Hour,Min,Sec,MSec);
  TDEdit.Text:=IntToHex(PEHeaderFrm.tFlag,8);
  iDateTime:=HexToInt(TDEdit.Text);
  //计算文件创建的年份
  iYear:=iDateTime div (365*24*60*60);
  Year:=Year+iYear;
  //计算文件除创建整年份以外还有多少天
  iDay:=(iDateTime mod (365*24*60*60)) div (24*60*60);
  //把瑞年的年份数计算出来
  for i:=1970 to Year-1 do
    begin
      if (i mod 4 = 0) and ((i mod 100 <> 0) or (i mod 400 = 0)) then
        RInt:=RInt+1;
    end;

  //计算文件创建的时间(几时)
  iHour:=((iDateTime mod (365*24*60*60)) mod (24*60*60)) div (60*60);
  Hour:=Hour+iHour;
  //计算文件创建的时间(几分)
  iMin:=(((iDateTime mod (365*24*60*60)) mod (24*60*60)) mod (60*60)) div 60;
  Min:=Min+iMin;
  //计算文件创建的时间(几秒)
  iSec:=(((iDateTime mod (365*24*60*60)) mod (24*60*60)) mod (60*60)) mod 60;
  Sec:=Sec+iSec;
  //合并日期和时间
  TempDate:=EncodeDate(Year,Month,Day);
  TempTime:=EncodeTime(Hour,Min,Sec,MSec);
  //由于瑞年的二月份有29天,瑞年年份一年有366年天,而平年一年有365天,上面
  //是用365计算的,所以要减去瑞年年份多出来的一天
  DEdit.Text:=DateToStr(TempDate+iDay-RInt);
  TEdit.Text:=TimeToStr(TempTime);
end;

procedure TTimeDateStampFrm.Button1Click(Sender: TObject);
begin
  Close;
end;

procedure TTimeDateStampFrm.FormShow(Sender: TObject);
begin
  //Interface center
  With TimeDateStampFrm do
    begin
      Left:=(Screen.Width div 2)-(Width div 2);
      Top:=(Screen.Height div 2)-(Height div 2);
    end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -