Knowledge Base
The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides

|
The vSphere SDK SSPI.cpp sample does not compile with Microsoft Visual Studio 2005 and Microsoft Visual Studio 2008 (1020741)
Symptoms
- The SSPI.cpp sample (shipped with the vSphere SDK package) does not compile with Microsoft Visual Studio 2005 and Microsoft Visual Studio 2008, which are the supported platforms for vSphere Web Services SDK 4.0.
- If you try to compile the SSPI.cpp sample to generate the SSPI.dll (which needs to used in SSPICIMClient sample for pass through authentication), you see the following errors:
D:\vi-sdk-4.0.0-161137\SDK\samples\DotNet\cs\SSPI>cl /clr:oldsyntax /LD SSPI.cpp
-l "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\Secur32.Lib"
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50727.42
for Microsoft (R) .NET Framework version 2.00.50727.3082
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9002 : ignoring unknown option '-l'
SSPI.cpp
SSPI.cpp(233) : error C2664: 'InitializeSecurityContextA' : cannot convert param
eter 3 from 'SEC_WCHAR *' to 'SEC_CHAR *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-
style cast or function-style cast
SSPI.cpp(300) : error C2664: 'InitializeSecurityContextA' : cannot convert param
eter 3 from 'SEC_WCHAR *' to 'SEC_CHAR *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-
style cast or function-style cast
Resolution
Changes in the way typecasting is done in Microsoft Visual Studio 2005 and later render the original SSPI.cpp sample unable to compile.
To resolve this issue, use the modified SSPI.cpp sample attached to this article. The modified SSPI.cpp sample can be compiled with Microsoft Visual Studio 2005 and Microsoft Visual Studio 2008.
Note: The modified SSPI.cpp sample cannot be compiled with Microsoft Visual Studio 2003.
To build and compile the SSPI project:
- Compile SSPI.cpp with the command:
cl SSPI.cpp /clr:oldSyntax -I "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include" -l "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\Secur32.Lib" /LD
- This command generates two files:
- SSPI.dll
- SSPI.dll.manifest
- Embed SSPI.dll.manifest into SSPI.dll using mt.exe:
mt -manifest SSPI.dll.manifest -outputresource:SSPI.dll;2
- Add SSPI.dll in SSPICIMClient project (C# project) and build the project.
Additional Information
Attachments
Request a Product Feature
To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.
Actions
KB:
- Updated:
- Categories:
- Languages:
- Product Family:
- Product(s):
- Product Version(s):

