Page 1 of 1

Taibite error with API function

Posted: Fri May 21, 2004 2:14 pm
by nicolaus
Hello

Im creat a lib with tailbit but i have an error from tailbit.
In my code i have a API-fundtion "RtlFillMemory()" and tailbite give me the error "Unknown Windows API function: _RtlFillMemory@12" but wehen i creat a normal procedure in a code in PB with this API function PB have no probs.

Wath is this?

Thx Nico

p.s. sorry for my bad englisch

Posted: Sat May 22, 2004 11:49 am
by El_Choni
You can try with FillMemory_() (RtlZeroMemory_() is not supported in Windows 9X/Me).

Code: Select all

; The FillMemory macro fills a block of memory with a specified value.
; 
; void FillMemory(
;   PVOID Destination,
;   SIZE_T Length,
;   BYTE Fill
; );
FillMemory_(*Buffer, BufferSize, FillValue) ; <-- Only lower byte is used
But, since they're both Windows macros, maybe it doesn't work either (can't test right now). You can use this as a replacement:

Code: Select all

For i=*Buffer To *Buffer+BufferSize
  PokeB(i, FillValue.b)
Next i
Or this:

Code: Select all

  push edi
  lea edi, *Buffer ; Memory address to fill
  mov ecx, BufferSize
  shr ecx, 2
  mov al, FillValue ; FillValue.b !!!
  rep stosb
  pop edi
If your memory size is dword or qword aligned, you can do it faster. I think this should work. Regards,

Posted: Sat May 22, 2004 12:42 pm
by nicolaus
Thx El_Choni i test this the next time.

Regards Nico