1

With EurekaLog, I found this Access Violation in my application:

 2.2 Address       : 00404A77
 2.5 Type          : EAccessViolation
 2.6 Message       : Access violation at address 00404A77 in module 'MyApp.exe'. Write of address 4F4F4E30.

Callstack:

--------------------------------------------------------------------------------------------
|Address |Module        |Unit           |Class          |Procedure/Method         |Line    |
--------------------------------------------------------------------------------------------
|*Exception Thread: ID=3748; Priority=??; Class=                                           |
|------------------------------------------------------------------------------------------|
|00404A77|MyApp.exe     |               |               |                         |        |
|75E1CD33|kernel32.dll  |               |               |LocalAlloc               |        |
|70BB2C72|MSVCR80.dll   |               |               |__set_flsgetvalue        |        |
|76F16FF2|ntdll.dll     |               |               |KiUserExceptionDispatcher|        |
|0064FC04|MyApp.exe     |uib.pas        |               |EventCallback            |4430[5] |
|70BB29A0|MSVCR80.dll   |               |               |_endthreadex             |        |
|75E1ED6A|kernel32.dll  |               |               |GetDriveTypeW            |        |
|------------------------------------------------------------------------------------------|

And the code from uib.pas:

procedure EventCallback(UserData: Pointer; Length: Smallint; Updated: PAnsiChar); cdecl;
begin
  if (Length > 0) and (Updated <> nil) then
  if (Assigned(UserData) and Assigned(Updated)) then
  with TUIBEventThread(UserData) do
  begin
    Move(Updated^, FResultBuffer^, Length);
    FQueueEvent := True;
    FSignal.SetEvent;
  end;
end;

Any idea what could be wrong and how to fix it?

Mariuz
  • 1,190
  • 2
  • 10
  • 19
Harriv
  • 6,029
  • 6
  • 44
  • 76

1 Answers1

1

According to comments, the line which is raising the access violation is the call to Move. So the diagnostics are telling you that the pointer to the destination buffer does not point to a valid buffer of whose length is at least Length.

In other words, your problem is that either:

  • FResultBuffer is an invalid pointer, or
  • The buffer that FResultBuffer refers to is not sufficiently long.
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490