title: What does it take to pInvoke CreateFileMapping?
body: <p>I'm not a fan of pInvokes but I don't think I have any other choice on this one, I need to resize memory mapped files in vb.net. Anyways, I got this pInvoke signature from pinvoke.net:</p>
  
  <pre><code>&lt;DllImport("kernel32.dll", SetLastError:= true, CharSet:= CharSet.Auto)&gt; _
  public Function CreateFileMapping( _
   hFile as intptr, _
   lpFileMappingAttributes As IntPtr , _
   flProtect As FileMapProtection, _
   dwMaximumSizeHigh As UInteger, _
   dwMaximumSizeLow As UInteger, _
   lpName As &lt;MarshalAs(UnmanagedType.LPTStr)&gt; string) as IntPtr
  End Function
  
  Public Enum FileMapProtection As UInteger
      PageReadonly = &amp;H2
      PageReadWrite = &amp;H4
      PageWriteCopy = &amp;H8
      PageExecuteRead = &amp;H20
      PageExecuteReadWrite = &amp;H40
      SectionCommit = &amp;H8000000
      SectionImage = &amp;H1000000
      SectionNoCache = &amp;H10000000
      SectionReserve = &amp;H4000000
  End Enum
  </code></pre>
  
  <p>I have imported System.Runtime.InteropServices but I get an error at the &lt; MarshalAs thingy. I have no idea whats missing or where its from. Don't you just hate it how none of these reference never mention any dependencies anywhere ever? Like I'm supposed to spontaneously know which library or framework branch its from. Usually I can find out by looking at the lefthand tree in MSDN but this time I cant find any direct reference to that command.</p>