Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Violation in ntdll.dll?

Status
Not open for further replies.

KempCGDR

Programmer
Jan 10, 2003
445
GB
Just got this error message and I have no idea why. My code was working perfectly until I added an extra check to make sure a file exists ( If FileExists(Filename) etc). I'm assuming an access violation in something that looks like a major system file isn't a good thing, didn't crash my comp though, so probably not that bad.

I commented out everything except the code below and I still got the error, I'm left thinking "What the hell?"


var
strRemote,strLocal,UpdateText:String;
Remote,Local:TextFile;
Changed:Boolean;
Settings:TIniFile;
begin
Changed := False;
AssignFile(Remote, 'CaSCL.dat');
AssignFile(Local, 'LCaSCL.dat');
If FileExists('CaSCL.dat') then
begin
If FileExists('LCaSCL.dat') then
begin

end
else
Changed := True;

If Changed then
begin

end;
end
else
begin

end;
end;


How can a piece of code I've used hundreds of times do this?
 
Just tried putting that on its own in a blank project, no error, so it's happening somewhere else even though I haven't changed anything anywhere else, and this code doesn't interact with anything else.
 
Nailed it, it was totally unrelated. Apparently if you try to read a section from an ini file and don't pass a section name, it kills the app. So for some reason, the following doesn't use the default value you pass it:

Settings.ReadString('', 'Key name', 'Default value');

(The '' is a blank section name)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top