title: Run-Time Check Failure #0 when running a function
body: <p>I get this error when trying to use this function</p>
  
  <pre><code> void WSPAPI GetLspGuid( LPGUID lpGuid )
   {
      memcpy( lpGuid, &amp;gProviderGuid, sizeof( GUID ) );
   }
  </code></pre>
  
  <p>the error</p>
  
  <pre><code>Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
  </code></pre>
  
  <p>the function is called by using </p>
  
  <pre><code>HMODULE         hMod = NULL;
  LPFN_GETLSPGUID fnGetLspGuid = NULL;
  int             retval = SOCKET_ERROR;
  
  // Load teh library
  hMod = LoadLibraryA( LspPath );
  if ( NULL == hMod )
  {
      fprintf( stderr, "RetrieveLspGuid: LoadLibraryA failed: %d\n", GetLastError() );
      goto cleanup;
  }
  
  // Get a pointer to the LSPs GetLspGuid function
  fnGetLspGuid = (LPFN_GETLSPGUID) GetProcAddress( hMod, "GetLspGuid" );
  if ( NULL == fnGetLspGuid )
  {
      fprintf( stderr, "RetrieveLspGuid: GetProcAddress failed: %d\n", GetLastError() );
      goto cleanup;
  }
  
  // Retrieve the LSPs GUID
  fnGetLspGuid( Guid );
  </code></pre>