4

I'v been playing with some Delphi assemblies in IDA.

And I noticed a lot of system calls that I do not understand, and was unable finding any documentation about them. For example: I noticed a lot of calls to the the unknown function LStrClr(void *).

The best I could find was this site http://www.delphibasics.co.uk/ByLetter.asp?Letter=A But it lack many function calls, including LStrClr.

Thanks a lot for your reply, Michael Engstler.

PhiS
  • 4,540
  • 25
  • 35
Michael
  • 796
  • 11
  • 27

1 Answers1

7

LStrClr means Long String Clear. It is used to, well, clear a long string variable. In other words, when you write:

s := '';

then the compiler will generate a call to the runtime support function _LStrClr. In Unicode Delphi it will be _UStrClr where the U signifies UnicodeString as opposed to AnsiString.

There's no official documentation for this because it is all private implementation detail. However, there is the source code for the Delphi RTL. If you refer to that, such calls are simple to understand.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • @MichaelEngstler - you don't mention what version of Delphi you're using. These low level calls ("implementation details") can and probably will vary wildly between different versions (like between 8-bit/Win32 Borland Delphi 7 and native-Unicode Embarcadero XE2, for example ;)). – paulsm4 Apr 22 '12 at 18:20
  • `_LStrXXX()` functions are always used with `AnsiString` (and `AnsiString`-based types in D2009+, like `UTF8String` and `RawByteString`). That has not changed since `AnsiString` was first introduced. `UnicodeString` uses `_UStrXXX()` functions, and `WideString` uses `_WStrXXX` functions. 32-bit vs 64-bit does not make a difference. – Remy Lebeau Apr 23 '12 at 00:59