Parent Directory
|
Revision Log
|
Patch
--- trunk/Win32/Sojaner.MemoryScanner/PEReader.cs 2012/06/05 23:12:53 321 +++ trunk/Win32/Sojaner.MemoryScanner/PEReader.cs 2012/06/05 23:20:12 322 @@ -147,7 +147,7 @@ { public UInt16 _MachineType; public UInt16 _NumberOfSections; - public UInt32 _TimeDateStamp; + public Int32 _TimeDateStamp; public UInt32 _PointerToSymbolTable; public UInt32 _NumberOfSymbols; public UInt16 _SizeOfOptionalHeader; @@ -166,27 +166,34 @@ return MachineType; } - private DateTime GetDateTimeFromDosDateTime(UInt32 i32TimeDate) + private DateTime GetDateTimeFromDosDateTime(Int32 i32TimeDate) { - UInt16 i16Time = (UInt16)(i32TimeDate & 0xFFFF); - UInt16 i16Date = (UInt16)((i32TimeDate & 0xFFFF0000) >> 16); + Int16 i16Time = (Int16)(i32TimeDate & 0xFFFF); + Int16 i16Date = (Int16)((i32TimeDate & 0xFFFF0000) >> 16); return GetDateTimeFromDosDateTime(i16Time, i16Date); } - private DateTime GetDateTimeFromDosDateTime(UInt16 i16Time, UInt16 i16Date) + private DateTime GetDateTimeFromDosDateTime(Int16 i16Time, Int16 i16Date) { - int iYear = 0; - int iMonth = 1; - int iDay = 1; - int iHour = 0; - int iMinute = 0; - int iSecond = 0; - iDay = (i16Date & 0x1F); - iMonth = ((i16Date & 0x01E0) >> 5); - iYear = 1970 + ((i16Date & 0xFE00) >> 9); - iSecond = (i16Time & 0x1F) * 2; - iMinute = ((i16Time & 0x07E0) >> 5); - iHour = ((i16Time & 0x0F800) >> 11); - return new DateTime(iYear, iMonth, iDay, iHour, iMinute, iSecond); + try + { + int iYear = 0; + int iMonth = 1; + int iDay = 1; + int iHour = 0; + int iMinute = 0; + int iSecond = 0; + iDay = (i16Date & 0x1F); + iMonth = ((i16Date & 0x01E0) >> 5); + iYear = 1980 + ((i16Date & 0xFE00) >> 9); + iSecond = (i16Time & 0x1F) * 2; + iMinute = ((i16Time & 0x07E0) >> 5); + iHour = ((i16Time & 0x0F800) >> 11); + return new DateTime(iYear, iMonth, iDay, iHour, iMinute, iSecond); + } + catch + { + return new DateTime(); + } } }
ViewVC Help | |
Powered by ViewVC 1.1.22 |