ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/Win32/Sojaner.MemoryScanner/PEReader.cs
(Generate patch)

Comparing trunk/Win32/Sojaner.MemoryScanner/PEReader.cs (file contents):
Revision 321 by william, Tue Jun 5 23:12:53 2012 UTC vs.
Revision 322 by william, Tue Jun 5 23:20:12 2012 UTC

# Line 147 | Line 147 | namespace Sojaner.MemoryScanner
147          {
148              public UInt16 _MachineType;
149              public UInt16 _NumberOfSections;
150 <            public UInt32 _TimeDateStamp;
150 >            public Int32 _TimeDateStamp;
151              public UInt32 _PointerToSymbolTable;
152              public UInt32 _NumberOfSymbols;
153              public UInt16 _SizeOfOptionalHeader;
# Line 166 | Line 166 | namespace Sojaner.MemoryScanner
166                  return MachineType;
167              }
168  
169 <            private DateTime GetDateTimeFromDosDateTime(UInt32 i32TimeDate)
169 >            private DateTime GetDateTimeFromDosDateTime(Int32 i32TimeDate)
170              {
171 <                UInt16 i16Time = (UInt16)(i32TimeDate & 0xFFFF);
172 <                UInt16 i16Date = (UInt16)((i32TimeDate & 0xFFFF0000) >> 16);
171 >                Int16 i16Time = (Int16)(i32TimeDate & 0xFFFF);
172 >                Int16 i16Date = (Int16)((i32TimeDate & 0xFFFF0000) >> 16);
173                  return GetDateTimeFromDosDateTime(i16Time, i16Date);
174              }
175 <            private DateTime GetDateTimeFromDosDateTime(UInt16 i16Time, UInt16 i16Date)
175 >            private DateTime GetDateTimeFromDosDateTime(Int16 i16Time, Int16 i16Date)
176              {
177 <                int iYear = 0;
178 <                int iMonth = 1;
179 <                int iDay = 1;
180 <                int iHour = 0;
181 <                int iMinute = 0;
182 <                int iSecond = 0;
183 <                iDay = (i16Date & 0x1F);
184 <                iMonth = ((i16Date & 0x01E0) >> 5);
185 <                iYear = 1970 + ((i16Date & 0xFE00) >> 9);
186 <                iSecond = (i16Time & 0x1F) * 2;
187 <                iMinute = ((i16Time & 0x07E0) >> 5);
188 <                iHour = ((i16Time & 0x0F800) >> 11);
189 <                return new DateTime(iYear, iMonth, iDay, iHour, iMinute, iSecond);
177 >                try
178 >                {
179 >                    int iYear = 0;
180 >                    int iMonth = 1;
181 >                    int iDay = 1;
182 >                    int iHour = 0;
183 >                    int iMinute = 0;
184 >                    int iSecond = 0;
185 >                    iDay = (i16Date & 0x1F);
186 >                    iMonth = ((i16Date & 0x01E0) >> 5);
187 >                    iYear = 1980 + ((i16Date & 0xFE00) >> 9);
188 >                    iSecond = (i16Time & 0x1F) * 2;
189 >                    iMinute = ((i16Time & 0x07E0) >> 5);
190 >                    iHour = ((i16Time & 0x0F800) >> 11);
191 >                    return new DateTime(iYear, iMonth, iDay, iHour, iMinute, iSecond);
192 >                }
193 >                catch
194 >                {
195 >                    return new DateTime();
196 >                }
197              }
198  
199          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines