[DUG] Reading binary data as date/time from registry

Jolyon Smith jsmith at deltics.co.nz
Thu May 13 14:29:32 NZST 2010


I'm not sure that reading the value as a Float (Double) is going to help...
a TDateTime *IS* a double, so ReadFloat and ReadDateTime will operate read
the data from the registry in *exactly* the same way.

i.e:

  dt := TDateTime(reg.ReadFloat);
  dt := reg.ReadDateTime;

are equivalent operations.

If it is reading as zero then I'd suspect some sort of access/security
problem on those keys in the registry though I can't think how it could
contrive to return a zero rather than raising an exception.

Alternatively it may be some aspect of the conversion of the TDateTime to a
string (presumably that is occurring in order to report a date being seen of
"30/12/1899"), which may be falling foul of some oddity of the value in the
TDateTime and returning the "zero" date as the "default in case of error"
condition.

An oddity may arise as a result of the application that is WRITING the data
not being a Delphi application and/or not storing it as a TDateTime
compatible formatted value (if being used in a license check or similar
sensitive information, as might be surmised from the value name, it is
likely that even if it is a Delphi TDateTime value, that it is being
obfuscated in some way to avoid external tampering etc).


> -----Original Message-----
> From: delphi-bounces at delphi.org.nz [mailto:delphi-
> bounces at delphi.org.nz] On Behalf Of Phil Scadden
> Sent: Thursday, 13 May 2010 1:36 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Reading binary data as date/time from registry
> 
> 
> > When I use TRegistry.ReadDateTime on those entries, I get 30/12/1899.
> >
> Which means its reading the input as zero. Try reading the Tregistry
> into double and casting as datetime.
> --
> Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St,
> Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477
> 5232
> 
> Notice: This email and any attachments are confidential. If received in
> error please destroy and immediately notify us. Do not copy or disclose
> the contents.
> 
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with
> Subject: unsubscribe



More information about the Delphi mailing list