#include once "window9.bi"

Function Read_DataS (ByVal H As HANDLE, ByVal Lenght As Integer) As Byte Ptr Export
	Dim As Byte ptr pMemory = CAllocate(Lenght+2)
	if pMemory then
		Dim iRetBytes As ulong
		ReadFile(H ,pMemory,Lenght,Cast(LPDWORD,@iRetBytes),0)
	endif
	Return pMemory
End Function

Function Read_DataA ( ByVal H As HANDLE, ByVal Lenght As Integer) As Byte ptr Export
	Dim As Byte ptr pMemory = Allocate(Lenght)
	if pMemory then
		Dim iRetBytes As ulong
		ReadFile(H ,pMemory,Lenght,Cast(LPDWORD,@iRetBytes),0)
	endif
	Return pMemory
End Function

sub Read_Data ( ByVal H As HANDLE,ByRef pMemory As Byte ptr ,ByVal Lenght As Integer) Export
	Dim iRetBytes As ulong
	ReadFile(H ,pMemory,Lenght,Cast(LPDWORD,@iRetBytes),0)  
End Sub
