title: CEN XFS Exception when returning from WFPOpen
body: <p>I'm writing a test DLL for an IDC service provider. I also written an mfc testing application that loads the XFS Manager.</p>
  
  <p>I'm encountering some problems calling the function WFSOpen.
  The manager correctly loads the SPI dll and calls its WFPOpen function. The WFPOpen executes correctly, reaching the return statement and returning WFS_SUCCESS to the caller. Then in the XFS Manager dll something bad happens, an exception is thrown and the WFSOpen function returns WFS_ERR_INTERNAL_ERROR to my testing application. </p>
  
  <p>I always get this message:</p>
  
  <pre><code>First-chance exception at 0x1000C285 (msxfs.dll) in TestXFSIDC.exe: 0xC0000005: Access violation writing location 0x011E3987.
  (Date)01.07.2015 (Time)09:29.39,570
  Exception occurred
  </code></pre>
  
  <p>The XFS log file reports this:</p>
  
  <pre><code>09:29:39.554 APICALL: WFSAsyncOpen
      actLogicalName: &lt;MyCardReader&gt;
      hApp: 398257252 0X17BCEC64
      actszAppId: &lt;TestXFSIDC&gt;
      actTraceLevel: 10 0X0000000A
      actTimeOut: 0 0X00000000
      actpHService: 8321216 0X007EF8C0
      actHWnd: 461622 0X00070B36
      dwSrvcVersionsRequired: 201731 0X00031403
      lpSrvcVersion: 8315892 0X007EE3F4
      lpSPIVersion: 8315364 0X007EE1E4
      actpRequestId: 8315352 0X007EE1D8
  
  09:29:39.554 OpenKey( HKEY_CURRENT_USER,WOSA_CURRENT_USER_KEY_NAME,0,KEY_READ | KEY_WRITE,&amp;hKeyWosaRoot) failed (reason=2,file=d:\buffington\development\cen xfs manager\source\xfs_conf.cpp,line=2168)
  
  09:29:39.570 WFPCALL: WFPOpen
      tmpServiceHandle: 1 0X00000001
      actLogicalName: &lt;MyCardReader&gt;
      hApp: 398257252 0X17BCEC64
      actszAppId: &lt;TestXFSIDC&gt;
      actTraceLevel: 10 0X0000000A
      actTimeOut: 0 0X00000000
      actHWnd: 461622 0X00070B36
      tmpRqId: 1 0X00000001
      pUser-&gt;getServiceProviderHandle(): 1807786008 0X6BC0A018
      dwSPIVersionsRequired: 16908035 0X0101FF03
      lpSPIVersion: 8315364 0X007EE1E4
      dwSrvcVersionsRequired: 201731 0X00031403
      lpSrvcVersion: 8315892 0X007EE3F4
  
  09:29:39.570 
  (Date)01.07.2015 (Time)09:29.39,570
  Called WFPOpen
  09:29:39.570 
  (Date)01.07.2015 (Time)09:29.39,570
  Exiting WFPOpen
  09:29:39.554 RegOpenKeyEx( x80000003, .DEFAULT\XFS )) failed (reason=5,file=d:\buffington\development\cen xfs manager\source\xfs_conf.cpp,line=384)
  09:29:39.570 
  (Date)01.07.2015 (Time)09:29.39,570
  Exception occurred
  </code></pre>
  
  <p>I'm using Visual Studio 2012 in Windows 8.1 64bit</p>