in reply to Win32 Shared Memory

Probably your best bet would be to take a look at Win32::API (and/or Win32::API::Prototype which will take care of some of the details for you) and build your own perl wrappers around the required APis.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

Replies are listed 'Best First'.
Re: Re: Win32 Shared Memory
by nornagon (Acolyte) on May 15, 2004 at 08:08 UTC
    Yer, I would if I knew what functions to import and from where :(

      The first page you linked to contains pretty much all you need to locate that information.

      Example:

      HANDLE memory_handle = OpenFileMapping(MAP_FILE_ALL_ACCESS, FALSE, "Creatures 3_mem");

      Googling for "OpenFileMapping MSDN" brings up http://msdn.microsoft.com/library/en-us/fileio/base/openfilemapping.asp as the first link. Pasting the prototype given at the top of the page into Win32::API::Prototype along with "Kernel32.dll" located near the bottom, and supply the constants and you should be able to get access to the shared memory segement (assuming you have whatever application creates it running on your machine).

      A similar process for each of the other APIs listed at your link would get you a long way towards your goal.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
        Ok, I tried that. BUT... (oh no...)

        I get this error: Modification of a read-only value attempted at C:/Perl/site/lib/Win32/API/Type.pm line 195, <DATA> line 164.

        Here's my code:

        use Win32::API; my $STANDARD_RIGHTS_REQUIRED = (0x000F0000); my $SECTION_QUERY = 0x0001; my $SECTION_MAP_WRITE = 0x0002; my $SECTION_MAP_READ = 0x0004; my $SECTION_MAP_EXECUTE = 0x0008; my $SECTION_EXTEND_SIZE = 0x0010; my $SECTION_ALL_ACCESS = ($STANDARD_RIGHTS_REQUIRED|$SECTION_Q +UERY| $SECTION_MAP_WRITE |$SECTION_MAP +_READ| $SECTION_MAP_EXECUTE |$SECTION_EXT +END_SIZE); Win32::API->Import('kernel32', 'HANDLE OpenFileMapping(DWORD dwDesired +Access, BOOL bInheritHandle, LPCTSTR lpName)'); my $foo = OpenFileMapping($SECTION_ALL_ACCESS, 0, "Creatures 3_mem");