How to install LSPs on Windows CE 4.2 and PPC 2003 (Part 1)


The Problems:

    P1) There is no way to determine the order in which LSPs will be installed in CE 4.2
    P2) The SSLLSP always installs itself over the base provider, and will ignore chains placed by other LSPs.

 A work around requires the following two attributes:

    W1)  Allows 3rd party LSPs to install in arbitrary order.
    W2)  Allows SSLLSP to be the first LSP to install.

 To solve I suggest the following solution:

    Create an application called lsp_install.dll. This application will install
    LSPs from  HKLM\COMM\WS2\LSP\LSP_INSTALL, using the same rules Windows CE 5.0 uses
    to install LSPs from  HKLM\COMM\WS2\LSP.

    Remove all  entries from HKLM\COMM\WS2\LSP.
    Add lsp_install.dll to  HKLM\COMM\WS2\LSP.
    Add the LSPs you need installed into HKLM\COMM\WS2\LSP_INSTALL

Why you should follow this solution exactly:

If you follow this solution exactly, you'll be able to interoperate with other
LSPs. If each LSP vendor creates their own solution to this problem, LSPs
from different vendors will have issues running on the same device.

Final registry layout:

     ; Only the LSP installer will be installed by the system.

    [HKEY_LOCAL_MACHINE\Comm\WS2\LSP\LSP_INSTALL]
        "Dll"="lsp_install.dll"

     ; All other LSPs are installed by the LSP_INSTALL.DLL
    ; Which enumerates the  Comm\WS2\LSP\LSP_INSTALL key.

    [HKEY_LOCAL_MACHINE\Comm\WS2\LSP\LSP_INSTALL\SSL]
        "Dll"="ssllsp.dll"
        "Order"=dword:1

     [HKEY_LOCAL_MACHINE\Comm\WS2\LSP\LSP_INSTALL\Your_LSP]
        "Dll"="your_lsp.dll"
        ; Order defaults to 0xFFFFFFFF if not specified.

 Code/Binaries for LSP_INSTALLER:
  We're working on the best way to distribute this. If someone creates such a dll, fire me a mail and we'll see about putting a link up to yours.

[Author: Igor Dvorkin]

Comments (8)

  1. Appreciate you addressing this important issue,

    Igor. The obvious question is how come the

    SSLLSP is not being fixed instead of this

    workaround. It is the real culprit for all

    the mess, isn’t it? It should not insist on

    necessarily being the first and it should not

    ignore the other chains either.

    Another question is that the SSLLSP seems to

    be doing something special to the Internet

    Explorer so the other LSPs are unable to see

    all the calls from it. Workaround there would

    be invaluable too. Thanks a lot for your

    insights – we need all the help we can get!

    Ilya Faenson

  2. I am really annoyed you want the customers to cover up the mess MS has created. It is MS’s responsibility to create a good product, good documentation, good developer tools and commitment to fix the problems in MS products.

    Overall, the LSP architecture is flawed. Windows CE team could have created a simple filter package, like an "easy to use" TDI filter.

    SSL shouldn’t be implemented as an LSP. It’s a security violation.

    Obviously LSP installation has problems, we had to create a service to install our LSP.

    On the implemenation side, why does winsock create a new socket handle instead of using the one provided by the LSP? Is this the reason you don’t implement AsyncSelect, because you need another message pump? Why do you insist that all sockets passed to the select() call should be from the same provider? Why do you guys care so much about IPv6?

    I don’t have time to list all the problems, but please realize that LSP design and implemtation has problems. Microsoft support in this area is clearly lacking. I don’t even expect MS to help developers, I know they won’t.

    I am not a open source guy, I don’t like bashing MSFT, but this is what I feel after working with Windows CE.

  3. Igor Dvorkin says:

    re: How to install LSPs on Windows CE 4.2 and PPC 2003 (Part 1)

    I am really annoyed you want the customers to cover up the mess MS has created. It is MS’s responsibility to create a good product, good documentation, good developer tools and commitment to fix the problems in MS products.

    [Igor Dvorkin] Thank you for your feedback. We’re working to solve the problems you mention, and our goal is to make our customers lives easier. We will be publishing more information is it becomes available. I have posted this information so that developers can understand what is going on while we work through the details of the solution.

    Overall, the LSP architecture is flawed. Windows CE team could have created a simple filter package, like an "easy to use" TDI filter.

    [Igor Dvorkin] LSPs solve some problems well, and others poorly. Windows CE also supports NDIS Intermediate drivers.

    SSL shouldn’t be implemented as an LSP. It’s a security violation.

    [Igor Dvorkin] What is the security violation you are concerned about?

    Obviously LSP installation has problems, we had to create a service to install our LSP.

    [Igor Dvorkin] I agree with you. I am personally working to eliminate these problems. Are you still having issues with LSP installation with CE 5.0?

    On the implemenation side, why does winsock create a new socket handle instead of using the one provided by the LSP?

    [Igor Dvorkin] Does this cause your applications issues?

    Is this the reason you don’t implement AsyncSelect, because you need another message pump?

    [Igor Dvorkin] In general Windows CE implements a subset of the desktop APIs. I do not know why AsyncSelect was not implemented.

    Why do you insist that all sockets passed to the select() call should be from the same provider?

    [Igor Dvorkin] This is mandated in the winsock specification.

    Why do you guys care so much about IPv6?

    [Igor Dvorkin] Does this cause your applications issues?

    I don’t have time to list all the problems, but please realize that LSP design and implemtation has problems. Microsoft support in this area is clearly lacking. I don’t even expect MS to help developers, I know they won’t.

    [Igor Dvorkin] I am grateful when you take the time to help us understand our issues. If you have more issues and suggestions please continue to send them.

  4. Ajay Agrawal says:

    Igor,

    I have installed the LSP on PPC 2003 as suggested here. But after that Pocket Outlook stops working. Once I rename the mylsp.dll to ssllsp.dll and do not install my lsp then outlook start working. Do you have any insight what may be going wrong?

    Thanks,

    -Ajay

  5. Ken Adams says:

    I have started working on an LSP-based application for the PocketPC (I have extensive desktop LSP development experience). To start with I wanted to write a shell "installer" DLL that simply implemented DllRegisterServer output a log to a log file and returned S_OK. (Just to prove my DLL was being called the whole process was working.) I did this and now when I reset the PocketPC it just locks up. Any thoughts? To get the installer dll to run I simply edited the SSL registry key and changed the "Dll" value to point to my "LSP_Install.dll" the key looks like this:

    Dll=Program FilesSafe EyesLSP_Install.dll

    Anyone have any thoughts on why this would be locking up my device so hard that I have to do a hard reset?

  6. cenet says:

    Is this the reason you don’t implement AsyncSelect, because you need another message pump?

    [Corey Burke] AsyncSelect is not implemented because it would tie Winsock to the GWES functionality and customers wishing to develop headless devices with Winsock would be required to pull in all the windowing code for functionality they wouldn’t be leveraging. Also AsyncSelect is inefficient. Basically you have an internal thread waiting on events and then posting messages to a queue that are eventually pumped. If you want to implement this yourself, you could create a thread, wait on queued events and post messages to your own message queue (or respond to them right away).

    Why do you insist that all sockets passed to the select() call should be from the same provider?

    [Corey Burke] Because the select function wasn’t design to support multiple service providers. It bundles up many different sockets into a single blocking call with a simgle, overarching timeout. If you consider the problem from a design perspective, I think you’ll see that there’s no way to timeout properly when you have multiple providers concurrently or serially select()ing on their socket handles.

    For example if select() were to call each provider serially, then the first provider might use the entire timeout period without being signalled whereas the last provider in the list might have wanted to signal immediately.

    However, let’s say the select() is set to block forever and you call all the providers concurrently, then those that don’t get signalled will just continue waiting with no way to signal them to cancel the select call.

    WSAEventSelect (a Microsoft-specific function) addresses this problem, but unfortunately it is not widely used and we have to support select().

    Why do you guys care so much about IPv6?

    [Corey Burke] Because this is the future of the Internet and we’d like our devices to continue working even as Asian markets and eventually US markets switch over to it. It’s possible to write IP-agnostic applications that work on both, and it’s much easier to write your apps in a robust way the first time then it is to go back and re-write them when they break. In the end, whether or not your app/device supports IPv6 is up to you, but your LSP should not prevent applications from using IPv6 networks.

  7. Florent says:

    Igor,

    Thanks for this useful post, however, as many people here I’m also currently working on an LSP based project and having some issues with it, maybe you could provide me some info about this, hopefully.

    Let’s make it short, I developped an LSP based on the sample found on the CE SDK, but I can’t find any accurate info how to install it properly. On MSDN I saw I need to "Copy the LSP installation code in a DllRegisterServer function" which is not very obvious to me. This leading me to wonder why MS didn’t find useful to write a simple "installer code" ready to use, just like they did in the Platform SDK ?

    From what I just saw in many forums/weblogs this concern seems very redundant so I think providing a complete sample LSP/ sample Installer package with source code (of course) would be a great idea and much better than long explanations, isn’t it ?

    Regards,

    Florent

  8. smartstone says:

    to all:

    guys, tried the windows 2000 LSP sample installation code.it worked on windows CE 4.2.

    for windows CE 5.0 , I did not try yet since I know the TSP sample code work.

    Best

Skip to main content