title: MapViewOfFile returns ERROR_INVALID_PARAMETER Windows-10(Universal Windows Platform)
body: <p>I am trying to port my existing  Windows desktop application (runs fine on Windows-7) to Windows-10 (Universal Windows Platform)
  <br>On Windows-10, MapViewOfFile returns </p>
  
  <blockquote>
    <p>ERROR_INVALID_PARAMETER</p>
  </blockquote>
  
  <p>,when I set access type to <code>FILE_MAP_READ | FILE_MAP_WRITE | FILE_MAP_EXECUTE</code>.<br> My code below:</p>
  
  <pre><code>   HANDLE mhandle = NULL;
     HANDLE g_hfile;
     LARGE_INTEGER ms_size;
     size_t file_size = 0;     
     void* map = NULL; 
  
     CREATEFILE2_EXTENDED_PARAMETERS ms_param;
     ms_param.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
     ms_param.dwFileAttributes = GENERIC_WRITE | GENERIC_EXECUTE;
     ms_param.dwFileFlags = FILE_FLAG_NO_BUFFERING;
     ms_param.dwSecurityQosFlags = SECURITY_DELEGATION;
     ms_param.lpSecurityAttributes = NULL;
     ms_param.hTemplateFile = NULL;
     g_hfile = CreateFile2(filename, GENERIC_WRITE | GENERIC_EXECUTE, FILE_SHARE_READ|FILE_SHARE_WRITE, OPEN_EXISTING, &amp;ms_param);
     if (g_hfile == INVALID_HANDLE_VALUE)
     {
         return GetLastError();
     }
  
     if (GetFileSizeEx(g_hfile, &amp;ms_size) == 0)
     {
         return GetLastError();
     }
  
     file_size = ms_size.u.LowPart | ((unsigned long long)ms_size.u.HighPart &lt;&lt; 32 );
     mhandle = CreateFileMapping(g_hfile, NULL, PAGE_EXECUTE_READWRITE, (unsigned long long)ms_size.u.HighPart, ms_size.u.LowPart, NULL);
     if (mhandle == NULL)
     {
         return GetLastError();
     }
  
     map = MapViewOfFile(mhandle, FILE_MAP_READ | FILE_MAP_WRITE | FILE_MAP_EXECUTE, 0, 0, file_size);
    if (map == NULL)
    {
       return GetLastError();
    }
  </code></pre>
  
  <p>File being mapped is of size approximately 1KB. If I set access type to <code>FILE_MAP_READ | FILE_MAP_WRITE</code> or <code>FILE_MAP_READ | FILE_MAP_EXEC</code> <code>MapViewOfFile</code> works as expected.<br>But if I use either FILE_MAP_READ | <code>FILE_MAP_EXEC | FILE_MAP_EXECUTE</code> or <code>FILE_MAP_EXEC | FILE_MAP_EXECUTE</code> <code>MapViewOfFile</code> fails.
  <br>I didn't find any Windows-10 specific documentation for this api. I have read the available MSDN doc for this api here: <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa366761(v=vs.85).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/windows/desktop/aa366761(v=vs.85).aspx</a>
  <br>Moreover, API set for UWP doesnt seem to contain this api:<a href="https://msdn.microsoft.com/en-us/library/windows/desktop/mt186421(v=vs.85).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/windows/desktop/mt186421(v=vs.85).aspx</a>
  <br>Any suggestion will be highly appreciated</p>