Board index » delphi » 'ntdll.dll' problem

'ntdll.dll' problem


2006-08-19 03:41:24 AM
delphi280
procedure TMyManagerThread.addlist(obje: tobject);
begin
EnterCriticalSection( listkritik );
try
try
Managerlist.Add( obje );
except on e:exception do
begin
.......
end;
end;
finally
LeaveCriticalSection( listkritik );
end;
end;
procedure TfrTCPServer.myProc( Athread: TIdPeerThread );
var MyClass : TMyclass;
begin
.....
MyClass := TMyclass.create;
MyClass.no := 123;
..............
try
ManagerThreads[ Tperson( Athread.data ).roomNumber ].addlist( MyClass );
except on e: exception do
begin
ExceptionLoga( e.Message ); //---------->Access violation at address 7C82F350 in module 'ntdll.dll'. Write of address 31333176
end;
end;
What may be source of the problem? Why ntdll.dll?
This program runs on Windows 2003 Server server. I use Delhi 5.
 
 

Re:'ntdll.dll' problem

"mustafa korkmaz" <XXXX@XXXXX.COM>writes
Quote
procedure TMyManagerThread.addlist(obje: tobject);
begin
EnterCriticalSection( listkritik );
try
try
Managerlist.Add( obje );
except on e:exception do
begin
.......
end;
end;
finally
LeaveCriticalSection( listkritik );
end;
end;
FYI, you can simplify that by using a TThreadList instead.
Quote
ManagerThreads[ Tperson( Athread.data ).roomNumber ].addlist(
MyClass );
You did not show where ManagerThreads is allocated and filled in, how the
roomNumber is assigned, or where listkritik is instantiated. A problem in
any of those operations can cause unexpected problems later on.
Quote
What may be source of the problem?
There is not enough details yet to diagnose that.
Quote
Why ntdll.dll?
Because you did something that ultimately ended up calling an API function
inside of the DLL that then accessed invalid memory, throwing the exception.
Gambit
 

Re:'ntdll.dll' problem

Quote


procedure TfrTCPServer.myProc( Athread: TIdPeerThread );
var MyClass : TMyclass;
begin
.....
MyClass := TMyclass.create;
MyClass.no := 123;
..............
try
ManagerThreads[ Tperson( Athread.data ).roomNumber ].addlist( MyClass );
except on e: exception do
begin
ExceptionLoga( e.Message ); //---------->Access violation at address 7C82F350 in module 'ntdll.dll'. Write of address 31333176
end;
end;

What may be source of the problem?
Illegal index?
Why ntdll.dll?
..because the CS call is illegal?
First, break up that complex thingy!
procedure TfrTCPServer.myProc( Athread: TIdPeerThread );
var MyClass : TMyclass;
thisPerson:TPerson;
theirRoomNumber:integer;
begin
.....
MyClass := TMyclass.create;
MyClass.no := 123;
..............
try
thisPerson:=Tperson(Athread.data);
theirRoomNumber:=thisPerson.roomNumber;
ManagerThreads[theirRoomNumber].addlist( MyClass );
except on e: exception do
begin
ExceptionLoga( e.Message );
end;
end;
Rgds,
Martin
PS. You have a manager thread for every room??
 

Re:'ntdll.dll' problem

"Martin James" <XXXX@XXXXX.COM>writes
Quote
ManagerThreads[theirRoomNumber].addlist( MyClass );
var
theManager: TMyManagerThread
theManager := ManagerThreads[theirRoomNumber];
theManager.addlist( MyClass );
Gambit
 

Re:'ntdll.dll' problem

Quote

var
theManager: TMyManagerThread

theManager := ManagerThreads[theirRoomNumber];
theManager.addlist( MyClass );

Yes! Even more of the same <g>
Rgds,
Martin