Taibite error with API function

Developed or developing a new product in PureBasic? Tell the world about it.
nicolaus
Enthusiast
Enthusiast
Posts: 456
Joined: Tue Aug 05, 2003 11:30 pm
Contact:

Taibite error with API function

Post 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
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post 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,
El_Choni
nicolaus
Enthusiast
Enthusiast
Posts: 456
Joined: Tue Aug 05, 2003 11:30 pm
Contact:

Post by nicolaus »

Thx El_Choni i test this the next time.

Regards Nico
Post Reply