문제

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.

도움이 되었습니까?

해결책

It turns out that with the release of Windows 8 and the subsequent change to the credential providers, starting with Visual Studio 2012, the constant CLSID_PasswordCredentialProvider began to point to the v2 Password Credential Provider rather than the v1 Password Credential Provider (the version that Windows 7 uses). So in order to get the wrapped credential provider sample to compile correctly, which was the one that I was testing, it was necessary to change the following line in CSampleProvider.cpp:

hr = CoCreateInstance(CLSID_PasswordCredentialProvider, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pUnknown));

to instead point to the V1 credential provider:

hr = CoCreateInstance(CLSID_V1PasswordCredentialProvider, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pUnknown));

Once this was done and the project was recompiled and installed it worked as expected.

Additional information about this problem can be found at: http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/376d6eb6-1a40-4721-abdc-27870966a1da/how-can-i-build-the-windows-7-credential-provider-samples-using-visual-studio-2012?forum=windowsgeneraldevelopmentissues

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top