Using the LSP Installer

Other versions of this page are also available for the following:

Windows Mobile SupportedWindows Embedded CE Supported

8/28/2008

The Layered Service Provider (LSP) installer provides an easy way to incorporate all the basic LSP installation functionality that is required by Winsock into the LSP DLL itself. The user of the LSP Installer is required to provide the GUID’s and the name of the LSP only.

The installer should be used for existing LSPs or new LSPs that are created without using the LSP helper. You do not have to use the installer when you use the LSP Helper to create a new LSP.

To customize the LSP Installer for your LSP

  1. Modify the LSP installer sample with your LSP’s GUIDs, description and DLL name:
STDAPI DllRegisterServer()
{
    // TODO: Replace these GUIDs with your own.
    static GUID v_sampelsp_guid = 
    { 0x1546b33b, 0xa4c3, 0x4978, { 0xa3, 0x52, 0x97, 0xad, 0xd2, 0xc1, 0xd5, 0xf }
};

This GUID identifies the specific LSP in the chain:

    // TODO: Replace these GUIDs with your own.
    static GUID v_samplelsp_chain_guid = 
{ 0xb26a9109, 0xabc9, 0x4bf4, { 0xb1, 0xbe, 0x78, 0x84, 0x5d, 0xac, 0xde, 0x9e }
};

This GUID is used to identify the LSP chain for which the LSP provider is installed at the top:

    HRESULT hr = CLSPInstaller::DoInstall(L"samplelsp.dll", L"Sample LSP", &v_sampelsp_guid, &v_samplelsp_chain_guid);

The name of the LSP DLL and the description of the LSP are changed here.

  1. Link the LSP installer library into the LSP DLL. This final DLL can be installed at start time through the registry.
  2. Add the LSP to the registry:
    1. Add a registry subkey to the HKEY_LOCAL_MACHINE\COMM\WS2\LSP registry key.
      Using the SAMPLELSP.DLL that you created here, add the HKEY_LOCAL_MACHINE\Comm\WS2\LSP\SAMPLELSP registry subkey.

    2. To this subkey, add the registry entries shown in the following table:

      Value: type Description

      Dll: REG_SZ

      No default. The name of the DLL to load.

      Order: DWORD

      Default is 0xffffffff. The order in which the LSP loads, in relation to the other providers. The LSP with the lower value loads first.

      Entry: REG_SZ

      Default is DllRegisterServer. The DLL entry point for the installation function.

      Example:

      [HKEY_LOCAL_MACHINE\Comm\WS2\LSP\SAMPLELSP]
          "Dll"="samplelsp.dll" 
      

Note

This example lets the order to use the default value, because the matter in which the LSP is loaded should be irrelevant.

See Also

Concepts

Layered Protocols and Provider Chains
Installing an LSP
The LSP Helper Winsock Layered Service Provider (LSP)
AutoBind LSP
Desktop Passthrough LSP