title: IPC Between Python and Win32 on Windows OS
body: <p>I have two C application that can communicate via win32 IPC APIs (CreateFileMapping() etc.)</p>
  
  <p>I have  to replace client application with a Python application. </p>
  
  <p>I have tried the following libraries on Python side.</p>
  
  <blockquote>
    <p>import win32file, win32api</p>
  </blockquote>
  
  <p>But this libraries does not have CreateFileMapping() functions. </p>
  
  <p>I have tried also mmap.mmap() function but I could not observe any communication. </p>
  
  <pre><code>import mmap
  
  sharedMemory = mmap.mmap(0, 512, "Local\\SharedBuffer")
  
  sharedMemory.write("AB")
  </code></pre>
  
  <p>I have also tried "Global\SharedBuffer" and "SharedBuffer" as shared Memory names both two side. </p>
  
  <pre><code>#define SHARED_BUFFER_NAME          ((LPCSTR)L"Local\\SharedBuffer")
  
  HANDLE bufferHandle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 512, SHARED_BUFFER_NAME);
  
  // Create a map for accessing Shared Buffer
  sharedBuffer = (char*)MapViewOfFile(bufferHandle, FILE_MAP_ALL_ACCESS, 0, 0, SHARED_BUFFER_SIZE);
  
  memset(sharedBuffer, 0, SHARED_BUFFER_SIZE);
  
  while (sharedBuffer[0] == 0);
  
  while (1);
  </code></pre>
  
  <p>win32 APIs are not mandatory for me. I need only simple shared buffer between C and python application on Windows Machine. </p>
  
  <p>Thanks</p>