CE5: Accessing shared memory from a 2nd process
- From: "Keaven Pineau" <keaven@xxxxxxxxxxx>
- Date: Mon, 5 Nov 2007 11:45:13 -0500
Hello gurus,
I want to be able to access a buffer allocated in shared memory from 2 or +
APIs. The reason is quite simple, the sell department wants to be able to
sell the module (APIs) separately.
So I have a peripheral's driver that will write into a buffer allocated by
the first calling API but can be used by the others APIs. I have no problem
concerning the multiple access aspect. The problem I have is when I am
trying to read the buffer from the 2nd API the buffer has no data in it.
What I have done is that my driver has a copy of the buffer pointer that is
updated when the 1st API is allocating the shared memory. The buffer size
is ~2.5 MB. Later, the 2nd API will ask the driver if a buffer is already
allocated, if so the driver will give the copy of the pointer. Now, what I
am expecting is either one of the APIs could ask for a transfer to the
buffer to the driver and the data will be updated in the shared buffer and
accessible by both API's pointer. Unfortunately, it doesn't work so I am
missing a piece.
I am stocking the pointer value in the driver with the following variable.
static unsigned char *pSharedBuffer; // Global scope
The buffer is allocated in the api with the following lines.
unsigned char *ImageBuffer; //API Global Scope
ImageBuffer = VituralAlloc(0, 2621440, MEM_RESERVE, PAGE_READWRITE);
VirtualAlloc(ImageBuffer, 2621440, MEM_COMMIT, PAGE_READWRITE);
I am passing back the value of ImageBuffer to the driver so it can hold it
in pSharedBuffer for the other APIs.
Otherwise, the pointer value from the driver is copy in ImageBuffer.
I checked the value of the pointer and it is 0x00060000 everywhere. Why the
API that is not allocating the buffer cannot read it?
Regards,
Keaven
.
- Follow-Ups:
- Re: CE5: Accessing shared memory from a 2nd process
- From: Valter Minute
- Re: CE5: Accessing shared memory from a 2nd process
- Prev by Date: Re: GetDescriptor does not return with USB 2.0 devices
- Next by Date: Re: Is USB Function Driver is Nothing but CLient Driver ?
- Previous by thread: Re: TCPMP Error
- Next by thread: Re: CE5: Accessing shared memory from a 2nd process
- Index(es):
Relevant Pages
|