title: Why does Windows not allow WinSock to be started while impersonating another user
body: <p>Using my own program or others I can't get winsock to run when calling if the process is created with CreateProcessWithLogonW or CreateProcessAsUserW. It returns this error when I create the socket: </p>
  
  <blockquote>
  <pre><code>WSAEPROVIDERFAILEDINIT 10106
  </code></pre>
    
    <p>Service provider failed to initialize.</p>
  
  <pre><code>The requested service provider could not be loaded or initialized.
  </code></pre>
    
    <p>This error is returned if either a
    service provider's DLL could not be
    loaded (LoadLibrary failed) or the
    provider's WSPStartup or NSPStartup
    function failed</p>
  </blockquote>
  
  <p>.</p>
  
  <p>However, <code>WSAStartup</code> seems to go w/o an error. Just creating the socket with WSASocket returns this.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <blockquote>
    <p>Errors:</p>
    
    <p>LoadUserProfile: Error Code 2.
    Can't find file specified</p>
    
    <p>AdjustTokenPrivs: Error Code 5. Access
    Denied</p>
  </blockquote>