Nice trick to get build’s timestamp at runtime (Visual C++ only):
</pre> EXTERN_C IMAGE_DOS_HEADER __ImageBase; (...) IMAGE_NT_HEADERS const* ntHeader = (IMAGE_NT_HEADERS*) ( (char*) &__ImageBase + __ImageBase.e_lfanew ); DWORD const timeStamp = ntHeader->FileHeader.TimeDateStamp; <pre>
It’s not very portable, but it doesn’t require any additional recompilation (as __DATE__ __TIME__ macros do).
The first HINSTANCE parameter from WinMain points to this IMAGE_DOS_HEADER, so no need to the global extern image dos header.
LikeLike