Using INamedBuffer

delphi package - easy access to kernel objects etc.
Post Reply
Cristian
Posts: 1
Joined: Thu Oct 02, 2008 1:11 pm

Using INamedBuffer

Post by Cristian »

Hi all,

I'm new in madshi!!
I have to say that is a great library!
But not very good documented, at least in some parts.

I'm developing a windows service, and I have created a monitor application to receive status information and interact with that service.

I think the best way to do this is by using INamedBuffer.
However I cant figure out how to use that interface.
I can create it, but how can I read/write to that buffer?
Can the read function be blocking and/or non-blocking?

Thanks for the tips!!

Cristian
madshi
Site Admin
Posts: 10339
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Hello,

INamedBuffer is just a simple encapsulation of the win32 APIs Create/OpenFileMapping, (Un)MapViewOfFile and CloseHandle.

Basically you can create a "shared" memory area this way to which all of your processes can write. "INamedBuffer.Memory" returns a point to the shared buffer. You can use the pointer for reading from or writing to the buffer. Reading/writing does not block. You can realize something like that yourself by making use of a named mutex or semaphore.

Alternatively you could also check out madCodeHook which contains direct IPC functions for communication between different processes. madCodeHook licensing is quite restricted, though.
Post Reply