Jump to content

mmap


Michel Claveau
 Share

Recommended Posts

Hi, all!

mmap is a "file mapped in memory".

mmap exist in Windows, and is implemented in several languages, like Python or Ruby.

For AutoIt, I writed a little DLL.

All is in the .zip attachment.

For try:

  • unzip mmap.zip in a dir of your choice
  • launch read_mmap.au3 ({F1} for Quit)
  • in another window, launch write_mmap.au3
  • Input your text to test, then {Enter} ('END' for finish)
It's all. But, if you have Python, you can launch write_mmap.py in a third window

If Autoit's developpers want to include mmap in Autoit, they can look the source of the DLL.

[Edit] Posted Image

1) More simplist version (usage more easy to understand). For try:

Launch read_simple.au3

Launch write_simple.au3

2) New release of the DLL. Now accept a name for the mapped-file-object.

But source (of the DLL) on demand...

ammap.dll

read_simple.au3

write_simple.au3

ammap.zip

Edited by Michel Claveau
Link to comment
Share on other sites

Hi, all!

mmap is a "file mapped in memory".

mmap exist in Windows, and is implemented in several languages, like Python or Ruby.

For AutoIt, I writed a little DLL.

All is in the .zip attachment.

For try:

  • unzip mmap.zip in a dir of your choice
  • launch read_mmap.au3 ({F1} for Quit)
  • in another window, launch write_mmap.au3
  • Input your text to test, then {Enter} ('END' for finish)
It's all. But, if you have Python, you can launch write_mmap.py in a third window

If Autoit's developpers want to include mmap in Autoit, they can look the source of the DLL.

Hi there, really a nice concept ;)

i was going to build a fifo buffer out of it but i can't realise it non blocking,

would it be possible for you to add functions like AddSharedBuffer and maybe GetSharedBufferPart?

my problems are that im using the first "thread" to sniff winpcap packets strip the tcp offset off of it and pump it into the shared memory, then "thread" two should get the first two bytes if the buffer read the length out of it then reads the ammount out of the buffer and removes it from the buffer.

i have to follow this strategy because packet data can (but not have to) overlap more then one tcp packet...

and if the winpcap thread takes to long to run packets are going to be lost...

it would help me a lot :evil:

looking forward to hearing from you.

Best regards,

JRSmile

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

hi there, already found an alternative: http://www.autoitscript.com/forum/index.php?showtopic=106710

thanks anyway.

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

Hi!

hi there, already found an alternative: http://www.autoitscript.com/forum/index.php?showtopic=106710

thanks anyway.

mailslot & mmap have not the same purpose.

mailslot use a network layer.

mmap use a shared-memory (like a memory-file)

mailslot go across a LAN

mmap is only inter-process into one computer.

But,

mmap is very fast: I try more than 50 000 data exchanges by second.

mmap is compatible with mmap library in Python, Ruby, C, Perl, etc.

I had edit the first post...

Edited by Michel Claveau
Link to comment
Share on other sites

Re !

What I don't understand is why is that dll needed. I mean, I know what it does, but it's not clear to me why aren't you using AutoIt for that.

What's the reason for that?

Because, i do not know how to use, directly from Autoit, these Windows-API:

CreateFileMapping

MapViewOfFile

memset

UnmapViewOfFile

CloseHandle

strncpy

(see: http://msdn.microsoft.com/en-us/library/aa366537(VS.85).aspx)

If you know...

Link to comment
Share on other sites

Re !

Because, i do not know how to use, directly from Autoit, these Windows-API:

CreateFileMapping

MapViewOfFile

memset

UnmapViewOfFile

CloseHandle

strncpy

(see: http://msdn.microsoft.com/en-us/library/aa366537(VS.85).aspx)

If you know...

I know something. Look here for file mapping related functions and here for example of RtlMoveMemory.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...