Windows Dev Center

Collapse the table of content
Expand the table of content
Expand Minimize

WSCInstallNameSpace function

The WSCInstallNameSpace function installs a namespace provider. For providers that are able to support multiple namespaces, this function must be called for each namespace supported, and a unique provider identifier must be supplied each time.


int WSPAPI WSCInstallNameSpace(
  _In_ LPWSTR lpszIdentifier,
  _In_ LPWSTR lpszPathName,
  _In_ DWORD  dwNameSpace,
  _In_ DWORD  dwVersion,
  _In_ LPGUID lpProviderId


lpszIdentifier [in]

A pointer to a string that identifies the provider associated with the globally unique identifier (GUID) passed in the lpProviderId parameter.

lpszPathName [in]

A pointer to a Unicode string that contains the load path to the provider DLL. This string observes the usual rules for path resolution and can contain embedded environment strings (such as %SystemRoot%). Such environment strings are expanded when the Ws2_32.dll must subsequently load the provider DLL on behalf of an application. After any embedded environment strings are expanded, the Ws2_32.dll passes the resulting string to the LoadLibrary function which loads the provider into memory. For more information, see LoadLibrary.

dwNameSpace [in]

The namespace supported by this provider.

dwVersion [in]

The version number of the provider.

lpProviderId [in]

A pointer to a GUID for the provider. This GUID should be generated by Uuidgen.exe.

Return value

If no error occurs, the WSCInstallNameSpace function returns NO_ERROR (zero). Otherwise, it returns SOCKET_ERROR if the function fails, and you must retrieve the appropriate error code using the WSAGetLastError function.

Error codeMeaning

The calling routine does not have sufficient privileges to install a namespace.


One or more of the arguments are invalid.


A nonrecoverable error occurred. This error is returned under several conditions including the following: the provider is already installed, the user lacks the administrative privileges required to write to the Winsock registry, or a failure occurred when creating or installing a catalog entry.


A system call that should never fail has failed.


Insufficient memory was available. This error is returned when there is insufficient memory to allocate a new catalog entry.



The namespace–configuration functions do not affect applications that are already running. Newly installed namespace providers will not be visible to applications nor will the changes in a namespace provider's activation state. Applications launched after the call to WSCInstallNameSpace will see the changes.

The WSCInstallNameSpace function can only be called by a user logged on as a member of the Administrators group. If WSCInstallNameSpace is called by a user that is not a member of the Administrators group, the function call will fail. For computers running on Windows Vista or Windows Server 2008, this function can also fail because of user account control (UAC). If an application that contains this function is executed by a user logged on as a member of the Administrators group other than the built-in Administrator, this call will fail unless the application has been marked in the manifest file with a requestedExecutionLevel set to requireAdministrator. If the application on Windows Vista or Windows Server 2008 lacks this manifest file, a user logged on as a member of the Administrators group other than the built-in Administrator must then be executing the application in an enhanced shell as the built-in Administrator (RunAs administrator) for this function to succeed.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]







See also




Community Additions

© 2015 Microsoft