Despite the name, "Access violation" errors are not the sort of thing you get from security issues.
"Access violations" are triggered by using bad pointers (uninitialized pointers or pointers to memory that is not allocated, has been freed or is "owned" by some other process etc etc) When attempting to access some resource to which you do not have permission, other behaviours will result. In some instances you will get an exception (not usually an EAccessViolation tho, unless the code/class/library in question is particularly unfriendly in the way it deals with such things, but some other exception indicating the lack of permissions). When reading from the registry it occurred to me that you might simply be given a zero value (by the registry API) if you attempt to read from a key to which you don't have permission, rather than an exception or error being raised. If you inspect the value that you are reading from the registry in the debugger, does it contain 0 ? dt := Registry.ReadDateTime( .. ); // Inspect "dt" in the debugger HERE - do not convert to string, inspect the value directly If dt does contain 0 and the value in the registry is non-zero then clearly you are not successfully retrieving the stored value at all. If dt is non-zero then the problem will be in the conversion to string and would strongly indicate that the value is simply not compatible with the Delphi TDateTime representation. This however is I think the least likely explanation. > -----Original Message----- > From: delphi-boun...@delphi.org.nz [mailto:delphi- > boun...@delphi.org.nz] On Behalf Of Jan Bakuwel > Sent: Friday, 14 May 2010 12:06 p.m. > To: NZ Borland Developers Group - Delphi List > Subject: Re: [DUG] Reading binary data as date/time from registry > > Hi Jolyon, Phil, > > On 13/05/10 14:29, Jolyon Smith wrote: > > 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. > > > > They are. > > > 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. > > > > It's not an access violation. I can read the 8 bytes when I use an > 8-byte array just fine. > > My problem is how to interpret these bytes.... I get the feeling that > Microsoft might store date/times in a slightly different format than > Delphi... > > > > 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. > > > > > I first read the data into a TDateTime, then convert it to a string > with > TDateTime. > > > 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). > > > > You might be right about that (I hope not though). > > Jan > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz with > Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe