title: Serial Ports, CreateFile and SetCommState
body: <p>I'm using Windows API's CreateFile and <a href="http://msdn.microsoft.com/en-us/library/aa363436(VS.85).aspx" rel="nofollow noreferrer">SetCommState</a> functions to open a number of serial ports to read and write from, selecting ports using this notation:    </p>
  
  <pre><code>\\?\COM1
  </code></pre>
  
  <p>I've been logging performance closely, and for some odd reason the CreateFile call takes about as much time as the SetCommState calls do (about 4.1 seconds).</p>
  
  <p>I find this very odd and makes me suspect that both CreateFile and SetCommState perform a set of similar tasks with the windows subsystem that handles serial port communication.</p>
  
  <p>Could there be a way to speed up one of both calls, or eliminate one, for example calling CreateFile in such a way it already uses the DCB I've got prepared to call SetCommState with?</p>