none
How can I build the Windows 7 Credential Provider Samples using Visual Studio 2012?

    Question

  • I'm working on creating a custom credential provider wrapper. The Windows 7 SDK Sample Credential Provider Wrapper does most of what I want so my plan was to start with that and make modifications so that it does everything that I need it to.

    I have run into a small problem however. I would like to use Visual Studio 2012 to do the development work. The samples were created using Visual Studio 2008. I have been able to successfully build and use the sample providers when using Visual Studio 2008. However, when I attempt to import the project into Visual Studio 2012, it will compile just fine but it doesn't work when I try to use it.

    I have been able to validate using WinDbg that the credential provider is loading when on the lock/login screen but nothing displays. Unfortunately I don't know much more about WinDbg to be able to trace down the problem using that tool.

    I have seen a suggestion come up elsewhere while researching the problem regarding problems that occur when you compile a credential provider for a 64-bit machine using the win32 platform. I am using a 64-bit machine and I have made sure that I'm compiling using x64 platform in both versions of Visual Studio.

    Also worth mentioning, after doing the VS2008 to VS2012 conversion which seemed to take place with no issues, I had to change the "Runtime Library" setting from "Multi-threaded DLL (/MD)" to "Multi-threaded (/MT)". This was the original setting in the VS2008 project. It was possible to get the credential provider to "work" (aka not throw an error about a missing DLL dependency) without making this change, but I had to first install Visual C++ Redistributable for Visual Studio 2012. Making this change removes that dependency.

    Any suggestions on how I can resolve this problem and successfully compile the credential provider samples in VS2012?

    UPDATE

    After getting VS2008 and VS2012 installed on the same machine I was able to change the "Platform Toolset" property from "Visual Studio 2012 (v110)" to "Visual Studio 2008 (v90)". Once this change was made compilation worked and the credential provider worked just as it had when compiling using VS2008 directly. No other settings were changed with this test. I can work with this solution but it seems as though I should be able to get this to work using the VS2012 Platform Toolset so I'd prefer not to settle on this just yet because the VS2008 Linker can be very buggy.

    Tuesday, October 08, 2013 5:58 PM

Answers

  • Hi Kenneth I,

    Welcome back!

    There is actually a doc that explains the change in Windows 8 SDK and Visual Studio 2012.

    download.microsoft.com/.../Credential%20Provider%20Framework%20Changes%20in%20Windows%208.docx

    We chose to change the class ID of the password credential provider in Windows 8 and Windows Server 2012. And, to make sure that old code would continue to work in Windows 8 with just a recompile, of course we made sure that the OLD name “CLSID_PasswordCredentialProvider” would point to the NEW class ID value. And, for supporting old platforms, we gave user a NEW name “CLSID_V1PasswordCredentialProvider” to point to the OLD class ID value.

    Supporting both values requires you to try and load each class in turn, and ve loaded. please go for this rather simple code in SetUsageScenario:

    1: IUnknown *pUnknown = NULL; 
    2: _pWrappedCLSID = CLSID_PasswordCredentialProvider;   
    3: hr = ::CoCreateInstance(CLSID_PasswordCredentialProvider, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pUnknown));   
    4: if (hr == REGDB_E_CLASSNOTREG)   
    5: {   
    6:     _pWrappedCLSID = CLSID_V1PasswordCredentialProvider;   
    7:     hr = ::CoCreateInstance(CLSID_V1PasswordCredentialProvider, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pUnknown));   
    8: }


    Of course, if you’re filtering on credential providers, and hope to hide the password provider, you’ll want to filter both providers there, too. Again, here’s my simple code for that in Filter:

    1: if (IsEqualGUID(rgclsidProviders[i], CLSID_PasswordCredentialProvider))   
    2:     rgbAllow[i]=FALSE;   
    3: if (IsEqualGUID(rgclsidProviders[i], CLSID_V1PasswordCredentialProvider))   
    4:     rgbAllow[i]=FALSE;

    I hope it is helpful!

    Regards!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Kenneth I Friday, October 11, 2013 2:24 PM
    Friday, October 11, 2013 3:44 AM
    Moderator

All replies

  • Hello,

    I have moved this thread to General Windows Desktop Development Issues forum for better response.

    Thanks,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 10, 2013 2:26 AM
  • Hi Kenneth I,

    Welcome to MSDN forum!

    According to your description, I guess your problem is not the Platform Toolset but the target Framework, While you change the Platform toolset from VS2012 to VS2008, the target Framework will also be changed for compatibility.

    Please refer this article:

    http://msdn.microsoft.com/en-us/library/vstudio/ff770576.aspx

    So I guess there are some functions that are not compatible between the two toolset.

    Regards!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 10, 2013 2:35 AM
    Moderator
  • I assume that you're referring to the target .NET framework.  The credential providers are not using .NET at all.  I still followed the directions found on the page you referenced, however, and found that no reference was being made to TargetFrameworkVersion in the .vcxproj file.  I switched the platform toolset back to VS2012 and checked the .vcxproj file at that point as well and still saw no reference to TargetFrameworkVersion.

    Any other ideas?

    Thursday, October 10, 2013 3:43 PM
  • Hi Kenneth I,

    Welcome back!

    There is actually a doc that explains the change in Windows 8 SDK and Visual Studio 2012.

    download.microsoft.com/.../Credential%20Provider%20Framework%20Changes%20in%20Windows%208.docx

    We chose to change the class ID of the password credential provider in Windows 8 and Windows Server 2012. And, to make sure that old code would continue to work in Windows 8 with just a recompile, of course we made sure that the OLD name “CLSID_PasswordCredentialProvider” would point to the NEW class ID value. And, for supporting old platforms, we gave user a NEW name “CLSID_V1PasswordCredentialProvider” to point to the OLD class ID value.

    Supporting both values requires you to try and load each class in turn, and ve loaded. please go for this rather simple code in SetUsageScenario:

    1: IUnknown *pUnknown = NULL; 
    2: _pWrappedCLSID = CLSID_PasswordCredentialProvider;   
    3: hr = ::CoCreateInstance(CLSID_PasswordCredentialProvider, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pUnknown));   
    4: if (hr == REGDB_E_CLASSNOTREG)   
    5: {   
    6:     _pWrappedCLSID = CLSID_V1PasswordCredentialProvider;   
    7:     hr = ::CoCreateInstance(CLSID_V1PasswordCredentialProvider, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pUnknown));   
    8: }


    Of course, if you’re filtering on credential providers, and hope to hide the password provider, you’ll want to filter both providers there, too. Again, here’s my simple code for that in Filter:

    1: if (IsEqualGUID(rgclsidProviders[i], CLSID_PasswordCredentialProvider))   
    2:     rgbAllow[i]=FALSE;   
    3: if (IsEqualGUID(rgclsidProviders[i], CLSID_V1PasswordCredentialProvider))   
    4:     rgbAllow[i]=FALSE;

    I hope it is helpful!

    Regards!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Kenneth I Friday, October 11, 2013 2:24 PM
    Friday, October 11, 2013 3:44 AM
    Moderator
  • Ah!  That did the trick! I had seen the referenced document but for some reasons didn't connect the dots on this.  Thanks so much for the information about supporting both as well!  I'll eventually be wanting to adapt my provider to support Windows 8 as well.
    Friday, October 11, 2013 2:23 PM
  • hi,

    please tell me what is  _PWrappedCLSID where i have to use this variable.

    Thanks

    venkat

    Thursday, December 12, 2013 9:32 AM