title: QueryDisplayConfig() does not initialize pathArray and modeArray correctly
body: <p>I'm trying to set-up an easy 1-click change of the mode of my screens (extended &lt;--> disconnected)<br>
  but my screens are assigned no ID by the <code>QueryDisplayConfig</code> method.</p>
  
  <p>(I'm using the User32 PInvoke lib from <a href="https://github.com/AArnott/pinvoke" rel="nofollow noreferrer">https://github.com/AArnott/pinvoke</a>, in addition to what you can find in the code below)</p>
  
  <p>I tried:</p>
  
  <ul>
  <li>stepping through the code with breakpoints, making sure EVERY value is the default value.</li>
  <li>elevating VS to run with administrator privileges.  </li>
  <li>making extra sure that the flags and errors are functioning correctly. </li>
  </ul>
  
  <pre class="lang-cs prettyprint-override"><code>[DllImport("User32.dll")]
  public static extern int GetDisplayConfigBufferSizes(uint flags, ref uint numPathArrayElements, ref uint numModeInfoArrayElements);
  [DllImport("User32.dll")]
  public static extern int QueryDisplayConfig(
      uint flags,
      ref uint numPathArrayElements, DISPLAYCONFIG_PATH_INFO[] pathArray,
      ref uint numModeInfoArrayElements, DISPLAYCONFIG_MODE_INFO[] modeInfoArray,
      DISPLAYCONFIG_TOPOLOGY_ID[] currentTopologyId
  );
  
  const int QDC_ALL_PATHS = 1;
  const int QDC_ONLY_ACTIVE_PATHS = 2;
  const int QDC_DATABASE_CURRENT = 4;
  
  public static void CheckDisplays() {
      uint numPathArrayElements = 0;
      uint numModeInfoArrayElements = 0;
      uint filter = QDC_ONLY_ACTIVE_PATHS;
  
      int bufferError = GetDisplayConfigBufferSizes(filter, ref numPathArrayElements, ref numModeInfoArrayElements);
  
      DISPLAYCONFIG_PATH_INFO[] pathArray = new DISPLAYCONFIG_PATH_INFO[numPathArrayElements];
      DISPLAYCONFIG_MODE_INFO[] modeArray = new DISPLAYCONFIG_MODE_INFO[numModeInfoArrayElements];
  
      int queryError = QueryDisplayConfig(filter, ref numPathArrayElements, pathArray, ref numModeInfoArrayElements, modeArray, null);
  
      Console.WriteLine();
      Console.WriteLine("Elements: " + numPathArrayElements); // Prints the correct amount of connected screens.
      Console.WriteLine("BUFFER ERROR: " + bufferError);      // Prints 0 -- as in Success.
      Console.WriteLine("PATH ERROR: " + queryError);         // Prints 0 -- as in Success.
  
      for (int i = 0; i &lt; pathArray.Length; i++) {
          if (pathArray[i].sourceInfo.id != 0) { Console.WriteLine($"Path{i} has been initialized correctly!!"); }
          // Every object in the array has default values and IDs of 0.
          // Nothing prints here.
      }
  }
  </code></pre>
  
  <p>Each screen should be assigned an ID and a proper mode. </p>
  
  <p>Instead, everything has the default value and I seem to be stuck.</p>