From: aminer on

Hello,


I have updated TAWEStorage to support Object Pascal
TStream, so, it now supports Memory streams , File streams etc...

and i have added two methods:

procedure LoadFromStream(in_stream: TStream);
procedure LoadFromFile(const FileName: string);



Description:


Why the 2 GB limitation on the Win 32 bits systems ?


My AWE Object pascal module is here, it allows your application
to use up to 64GB of RAM.


And here is the public interface of TAWEStorage class,
i have implemented the follow methods:


TAWEStorage = class(TObject)
public

Size:longword;
position:longword;
PageSize:integer;

constructor Create();
destructor Destroy(); override;
function GetMem(ulBytes: ULONG): BOOL;
function FreeMem(): BOOL;
function HowManyPagesAllocated(): ULONG;
function CopyFrom(in_stream:TStream;count:longint):longint;
function CopyTo(out_stream:TStream;count:longint):longint;
function Read(var Buffer;count:longint):longint;
function Write(const Buffer;count:longint):longint;
function ToString:string;
procedure LoadFromStream(in_stream: TStream);
procedure LoadFromFile(const FileName: string);

end;


Note: To be able to use AWE you have to set the user rights
correctly, so,go to: Control Panel -> Administrative tools
-> Local Security Policy -> User Rights Assignment and give
'Lock pages in memory' right to the user that wants to use AWE.


Every TAWEStorage object can go up to 4GB , and you can go up to
64GB !


You can download my AWE module from:


http://pages.videotron.com/aminer/


TAWEStorage is very easy to use, here is an example:


-------------------------------------------------


program test;


uses AWE,classes;


var
awe1:TAWEStorage;
ptr:pointer;
fstream1:TFileStream;
stream1,stream2:TMemoryStream;


Function StringToStream(const AString: string): TMemoryStream;
begin
Result := TMemoryStream(TStringStream.Create(AString));
end;


begin


stream2:=TMemoryStream.create;


fstream1:=TFileStream.create('test.txt',fmCreate);


stream1:=StringToStream('Hello world !');
awe1:=TAWEStorage.create;


writeln;
if awe1.getmem(stream1.size)
then writeln('Memory was reserved...')
else writeln('Memory was not reserved...');


writeln('Number of pages allocatd is: ',awe1.HowManyPagesAllocated);


if awe1.CopyFrom(stream1,stream1.size) <> 0
then writeln('CopyFrom ok ...')
else writelN('CopyFrom not ok ..');


awe1.position:=0;
awe1.CopyTo(stream2,awe1.size);


stream2.position:=0;
fstream1.copyfrom(stream2,stream2.size);
stream2.position:=0;
fstream1.position:=0;


writeln(awe1.tostring);


awe1.freemem;
awe1.free;
end.


--------------------------------------------------------------


A nice module, that you can use with ParallelHashList , right ?


There is another module at:


http://www.winsoft.sk/awe.htm


But you have to pay for it.. and i think my module is *better*.


Welcome: http://pages.videotron.com/aminer/


Sincerely,
Amine Moulay Ramdane.