Is there a way for my EXE to tell when it was built?
The idea is to write a copyright date that shows "Copyright 2005-" and then
the date the EXE was last built
-baylor 7 2649
baylor <ba****@discuss ions.microsoft. com> wrote: Is there a way for my EXE to tell when it was built?
The idea is to write a copyright date that shows "Copyright 2005-" and then the date the EXE was last built
There's a 4-byte value beginning at byte 0x88 in all PE files which is
the timestamp. It's the number of seconds since 1970 that elapsed
before the file was created.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP] <sk***@pobox.co m> wrote in
news:MP******** *************** *@msnews.micros oft.com: baylor <ba****@discuss ions.microsoft. com> wrote: Is there a way for my EXE to tell when it was built?
The idea is to write a copyright date that shows "Copyright 2005-" and
then the date the EXE was last built
There's a 4-byte value beginning at byte 0x88 in all PE files which is the timestamp. It's the number of seconds since 1970 that elapsed before the file was created.
Sorry, 0x88 might be true for some files, but definitely not for all.
The time stamp is relative to the PE exe header, which is after the
old DOS executable header and the DOS executable stub (which can have any
size).
The every segment has it's own timestamp.
For example Noepad.exe (Win2K, SP4) has the file timestamp at 0xE0.
See http://tuts4you.com/tutorials/PE-
Headers/Portable.Execut able.File.Forma t.htm
or search for PE file format.
--
Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email
Mihai N. <nm************ **@yahoo.com> wrote: Sorry, 0x88 might be true for some files, but definitely not for all. The time stamp is relative to the PE exe header, which is after the old DOS executable header and the DOS executable stub (which can have any size). The every segment has it's own timestamp. For example Noepad.exe (Win2K, SP4) has the file timestamp at 0xE0.
See http://tuts4you.com/tutorials/PE- Headers/Portable.Execut able.File.Forma t.htm or search for PE file format.
I stand corrected - although according to the CLI spec, the DOS
executable stub must always be exactly 128 bytes. Whether the PE file
header comes immediately after the DOS stub is a different matter, of
course - and by the looks of it, adding 8 to the value specified at
position 0x3c is the way to go. (Mind you, that would suggest that the
file timestamp of notepad is at 0xe8, not 0xe0.)
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
I use the exe file date time:
Microsoft.Visua lBasic.FileDate Time(Applicatio n.ExecutablePat h).ToString("yy yy/MM/dd HH:mm:ss")
"baylor" wrote: Is there a way for my EXE to tell when it was built?
The idea is to write a copyright date that shows "Copyright 2005-" and then the date the EXE was last built
-baylor
> I stand corrected - although according to the CLI spec, the DOS executable stub must always be exactly 128 bytes. Whether the PE file header comes immediately after the DOS stub is a different matter, of course - and by the looks of it, adding 8 to the value specified at position 0x3c is the way to go. (Mind you, that would suggest that the file timestamp of notepad is at 0xe8, not 0xe0.)
You might be right about the CLI (meaning .NET ext files)
But for non-CLI executables this is definitely not true.
Notepad.exe was just an example. But I have seen applications where
the DOS executable was a full working version of the application.
An example is hiew (Hacker's View).
I thing the only 100% safe way is to get the .exe documentation
a do a proper parser. I not that difficult.
--
Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email
baylor wrote: Is there a way for my EXE to tell when it was built?
The idea is to write a copyright date that shows "Copyright 2005-" and then the date the EXE was last built
According to Don Box (ISBN 0-201-73411-7) page 24, if you use an
AssemblyVersion attribute like
[assembly: AssemblyVersion ("1.0.*")]
the third component of the version (major.minor.bu ild.revision) is the
number of days since 2/1/2000.
-- www.midnightbeach.com
> > Is there a way for my EXE to tell when it was built? The idea is to write a copyright date that shows "Copyright 2005-" and then the date the EXE was last built
According to Don Box (ISBN 0-201-73411-7) page 24, if you use an AssemblyVersion attribute like
[assembly: AssemblyVersion ("1.0.*")]
the third component of the version (major.minor.bu ild.revision) is the number of days since 2/1/2000.
And, since the revision is the seconds since midnight / 2:
/// <summary>
/// Returns build date/time, assuming Version was specified as AssemblyVersion ("1.0.*") (or any other major.minor)
/// </summary>
/// <param name="V">A Version instance, with build date/time info in build.revision fields</param>
/// <remarks>
/// Date/time does not honor daylight savings time.
/// </remarks>
public static DateTime BuildDateTime(V ersion V)
{
return new DateTime(2000, 2, 1) +
new TimeSpan(V.Buil d, 0, 0, V.Revision * 2);
}
Note that the timestamp is currently 1 hr off - I **assume** this
means that it uses the system's offset from UMT and is not daylight
savings time aware. That for builds from midnight to 1 AM (DST) it will
show the previous day. But I haven't tested this. ;-)
-- www.midnightbeach.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Shawn Wilson |
last post by:
Hi,
My host keeps messing things up and not telling me. I am trying to write a cron
job that will test to make sure the "unusual" functions I use work and, if not,
email me. I want it to send me the build date as well. The weird thing is, my
cron script (using phpinfo) gives me a different build date than phpinfo() in an
"admin tool" section of my website.
The cron script is sitting in the root of my home directory (non web...
|
by: nom_du_pere |
last post by:
The phpinfo function lists the system ... But is it the system that PHP
was compiled on OR the system that PHP is executing on? I took a sneak
peek at the source code and I am leaning toward the latter... Same
question for the build date. Is it the build date for PHP or the build
date for the system?
Thanks.
|
by: cameron |
last post by:
Is it possible to get the build date, (not the version), of a dll?
-Cam
|
by: dm_dal |
last post by:
I have a solution in VS.Net 2003. It contains 1 - asp.net project(c#), 1 -
c# class library project and 1 - db project. When I try to build the
solution, I get the following error:
Could not copy built outputs to the Web. Unable to add 'C:\Documents and
Settings\dyoung.BFGPDC\VSWebCache\DAL_DYOUNG\\bin\.pdb' to the project. The server connection timed out.
The dll representing the class library is copied correctly and both the dll...
|
by: Roger Helliwell |
last post by:
Hey gang,
What's the best way to implement a Build version (or "last updated"
date) in my web-app? I have a footer in my master page that displays
the application's name and copyright info etc. I'd like to add a Build
version and build date as well. (Without hardcoding it obviously.)
At first I thought I'd just take the timestamp of the web.config, but
my web.config doesn't change that much. Is there an easy way to
determine what day...
| |
by: baylor |
last post by:
Is there a way for my EXE to tell when it was built?
The idea is to write a copyright date that shows "Copyright 2005-" and then
the date the EXE was last built
-baylor
|
by: nautonnier |
last post by:
This may have been covered before but I didn't find anything after
doing a google search.
Does VS.NET 2005 have a way to put build or version numbers within
aspx pages? I'm envisioning an attribute on the page directive or
maybe its own tag. This would be a tremendous help to keep track
whether an application install is the latest version of any particular
page and not just the dll.
Thanks for any ideas,
|
by: Pieter |
last post by:
Hi,
How can I knwo the BuildDate from an application distributed by ClickOnce?
When I use "System.IO.File.GetLastWriteTime(objAssembly.Location)" or
"System.IO.File.GetCreationTime(objAssembly.Location)" it returns me the
date and time that the user downloaded and isntaled the application, butn ot
the date it was published...
|
by: eschneider |
last post by:
I have a webservice which every time I build it keeps adding Crystal
references into the web.config?
<add assembly="CrystalDecisions.Shared, Version=10.2.3600.0,
Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.2.3600.0,
Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
And No, I do not have any references to crystal when I look at project
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |