| |
|
|
| CreateFileMapping created one Dateiabbildungsobjekt and supply which lever back. Filemapping is a simple manner complete (too very large) Files in memory To keep and of several Prozessen from hereon grab to. so can sowohl right effectively Pipes created as well as very speedy Bearbeitungszeiten access go.
Deklaration:
DEF @CreateFileMapping(6) !kernel32,CreateFileMappingA
Parameter:
1.Parameter: lever of/ one opened File or $FFFFFFFF as lever on a virtual Speicherbereich. 2.Parameter: Security-Attributes Structure or for the begot Objekt. can also 0 his. 3.Parameter: Flag, the whom allowed grabbed regelt. for the desired grabbed must the Filehandle ditto The suitable Accessrechte having. ? Happen? can with | add go.=> -$2 = only reading. -$4 = write and reading. -$8 = reading and write, but not The disk. under NT-based Systemen write only actually Process. moreover can of/ one the subesquent memory-? Happen? with | add go: => -$8000000 = Alloziert physikalischen memory in memory or in the Paging-File the Systems on the Plattefür any Pages in one cut offed (standard) -$1000000 = The by the lever in Parameter 1 angegebene File is a EXE. Parameter 2 and the Zugriffsrechte from Parameter 3 go from the File taken. -$4000000 = reserved any pages one Abschnitts, without physikalischen Memory allozieren. this reserved Speicherbereich can't vn others Allozierungsoparationen werwendet go, To it released becomes. reserved pages can in subesquent Call the function VirtualAlloc() relayed go. this Flag is only validly, if for Parameter 1 $FFFFFFFF definiert watts! To $8000000 or $4000000 can still following Flag with | add go: => -$10000000 = All pages one Abschnitts go as „nicht cachefähig“ marked. 4.Parameter: The oberen 32 Bits the Size the gemappten Bereichs (for >=4GB). can in the rule 0 stay. 5.Parameter: The downstairs 32 Bits the Size the gemappten Bereichs. 6.Parameter: address one Strings or Memory-Variable with a String, the a beliebigen names for the Mapping Objekt contains.
Return Value:
0 with failure, otherwise the lever on the Speicherbereich.
example: CompileMarkSeparationDef @MapViewOfFile(5) !kernel32,MapViewOfFile
DEf @UnmapViewOfFile(1) !kernel32,UnmapViewOfFile
DEF @CopyMemory(3) !kernel32,RtlMoveMemory
WINDOWSTYLE 31+512
Windowtitle Hier wird die Variable erzeugt
WINDOW 0,0-300,400
Declare Variable&,Tick&,Name$,Ausgelesen#
Declare Speicherhandle&,Speicheraddr&
Let Name$=AH-Variable
LET Speicherhandle&=@CreateFileMapping($FFFFFFFF,0,4,0,4,@addr(Name$))
LET Speicheraddr&=@MapViewOfFile(Speicherhandle&,2,0,0,0)
Drawtext 0,50,Handle des Speicherbereichs:+@STR$(Speicherhandle&)
LET TICK&=&GETTICKCOUNT
Whilenot %MENUITEM=-2
IF &GETTICKCOUNT-Tick&>10000
Let Variable&=@RND(1000)
@CopyMemory(Speicheraddr&,@addr(Variable&),4)
LET TICK&=&GETTICKCOUNT
endif
DIM Ausgelesen#,256
@CopyMemory(Ausgelesen#,Speicheraddr&,4)
Drawtext 0,80,Variale=+@STR$(@LONG(Ausgelesen#,0))+
Dispose Ausgelesen#
Sleep 10
WEND
@UnmapViewOfFile(Speicheraddr&)
@CloseHandle(Speicherhandle&)
| 04/02/05 ▲ | |
|
|
|