none
How to disable the desktop (STANDARD SHELL) from showing up after a boot....wec7? RRS feed

  • Question

  • How to disable the desktop (STANDARD SHELL) from showing up after a boot?



    One of the normal ways (which seems not to work in wec7) is to use the “Launchxxx” and “Dependxxx” registry keys for the HKLM\Init key. If I replace explorer.exe (desktop STANDARD SHELL) with DEMO.EXE (our application) it kills ActiveSync. It seems Activesync is dependant on (desktop STANDARD SHELL) in order to run.



    Need to not show the desktop and launch immediately into our application (DEMO.exe) like we do with other products.


    • Edited by pd1 Tuesday, March 6, 2012 7:23 PM
    Tuesday, March 6, 2012 7:22 PM

All replies

  • From the Catalog items deselect the "Standard Shell" (sysgen_standardshell) and dont select any of the shell from graphical shell.

    You can launch your demo application by editing your OSDesign.reg file as :

    [HKEY_LOCAL_MACHINE\init]
    "Launch300"="Demo.exe"
    "Depend300"=hex:0A,01,02,03,04,05,06,07,08,09,0B,0C,0D,0E,0F,10,11,12,13,14,15,16,17,18,19,1A,1B,1C,1D,1E,1F,20,21,22,23,24,25,26,27,28,29,2A,2B,2C,2D,2E,2F,30,31,32,33,34,35,36,37,38,39,3A,3B,3C,3D,3E,3F,40,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64

    where depend and launch order needs to be properly choosen as per your requirement and depend hex flag needs to be correctly taken as per your requirement.

    You can even directly launch into your application even if standard shell is already selected, so that desktop is not visiable during boot, by correctly adjusting the launch order and flag value of launch and depend.

    Active sync and other modules should work if the appropriate sysgen value is selected and has nothing to do with standard shell is selected or not.

    Hope this will help.

     All the best !

    ---Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    Thursday, March 8, 2012 6:42 AM
  • Microsoft made a number of changes in WEC 7.0 that cause the behaviour you are seeing.

    Specifically, if you modify the LaunchXX key to replace the standard shell with your own application, the application will run but not appear on the screen, and ActiveSync will not work.

    The underlying issues are (this is a long explanation so bear with me):

    If you add ActiveSync to an OS design, the Local Authentication Subsystem (LASS) gets included as well. Apparently this happens because on WEC7 ActiveSync supports AirSync, and LASS is required for AirSync because MS Exchange Server mandates this.
    Now when LASS is included in the design, the OS will use a private code version of startui (i.e. not the one under C:\WINCE700\PUBLIC\...)
    The private version is LASS aware and creates a start-up/splash screen allowing the user to enter a username/password.
    This splash screen is a top-level window which hides all other applications that may be running; this is why if you launch your own UI application you won't see it on the screen, but by looking in the debugger you can tell it's running. The splash screen normally disappears when the standard shell is launched, but since the shell was replaced the splash screen now remains.
    The problem with ActiveSync connections not working is that ActiveSync now requires the "SHEL" API to be registered. This API normally is implemented by the standard shell, so if the shell never runs then the API never gets registered, and connections
    can't be made. From what I remember, ActiveSync uses the API to create an icon in the notification area and if this fails, it
    just refuses to connect.

    There's a workaround but it's not pretty.

    There is no supported way to ask the splash screen to go away, or to prevent it from appearing in the first place (short of not including ActiveSync in the OS). Rather, the splash screen waits for the standard shell to run, and then closes itself.

    The idea therefore is to trick the splash screen into thinking that your application really is the standard shell.
    The way to do this is to

    1. Create a window with the class name "HHTaskBar", and
    2. Register a (dummy) implementation if the SHEL API

    I have included our implementation at the bottom.
    It's based mainly on the code found in C:\WINCE700\PUBLIC\shell\oak\hpc\explorer

    As hinted above, implementing step 2) in your application software would also solve the problem with ActiveSync not working.

    I should mention we submitted this to Microsoft support as an incident report, but were informed that the behaviour in WEC7
    was by design.

    #include <windows.h>
    #include <windowsx.h>
    
    #define HHTASKBARCLASSNAME     TEXT("HHTaskBar")
    #define HHTASKBARDATA          8
    
    static HINSTANCE g_hInstance;
    
    LRESULT CALLBACK TaskBarWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
        return DefWindowProc(hWnd, msg, wParam, lParam);
    }
    
    HWND CreateTaskbar()
    {
        WNDCLASS wc;
        wc.style = 0;
        wc.lpfnWndProc = (WNDPROC)TaskBarWndProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = HHTASKBARDATA;
        wc.hInstance = g_hInstance;
        wc.hIcon = NULL;
        wc.hCursor = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = NULL;
        wc.lpszMenuName = NULL;
        wc.lpszClassName = HHTASKBARCLASSNAME;
    
        if(!RegisterClass(&wc))
        {
            ERRORMSG(1, (L"RegisterClass() failed, GetLastError = 0x%x\r\n", GetLastError()));
            return NULL;
        }
    
        RECT rc;
        SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
    
        HWND m_hwndTaskBar = CreateWindowEx(
            0,
            HHTASKBARCLASSNAME,
            L"",
            WS_POPUP,
            rc.left,
            rc.top,
            rc.right - rc.left,
            rc.bottom - rc.top,
            NULL,
            NULL,
            g_hInstance,
            NULL
        );
    
        if(!m_hwndTaskBar)
        {
            ERRORMSG(1, (L"CreateWindowEx() failed, GetLastError = 0x%x\r\n", GetLastError()));
        }
        
        return m_hwndTaskBar;
    }
    
    #define NUM_APIS    74
    
    void ShellApiReservedForNK (void);
    extern "C" void ShellNotifyCallback(DWORD cause, DWORD proc, DWORD thread);
    
    BOOL WINAPI SHCreateExplorerInstance(LPCTSTR pszPath, UINT uFlags)
    {
        return FALSE;
    }
    
    BOOL WINAPI Shell_NotifyIconI(DWORD dwMsg, PNOTIFYICONDATA pNID, DWORD cbNID)
    {
        return FALSE;
    }
    
    void ShellApiReservedForNK(void)
    {
    }
    
    extern "C" void ShellNotifyCallback(DWORD cause, DWORD proc, DWORD thread)
    {
        return;
    }
    
    BOOL PlaceHolder(DWORD dw)
    {
        return FALSE;
    }
    
    const PFNVOID VTable[NUM_APIS] = {
    //xref ApiSetStart
        (PFNVOID) ShellNotifyCallback,
        (PFNVOID) ShellApiReservedForNK, /* Reserved for NK */
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder/*XGetOpenFileName*/,
        (PFNVOID) PlaceHolder/*XGetSaveFileName*/,
        (PFNVOID) PlaceHolder/*XSHGetFileInfo*/,
        (PFNVOID) Shell_NotifyIconI,
        (PFNVOID) PlaceHolder, /* SHAddToRecentDocs */
        (PFNVOID) PlaceHolder/*SHCreateShortcut*/,
        (PFNVOID) SHCreateExplorerInstance,
        (PFNVOID) PlaceHolder, //internalSHRemoveFontResource,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder/*SHGetShortcutTarget*/,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder/*xxx_SHLoadDIBitmap*/,
        (PFNVOID) PlaceHolder/*SHSetDesktopPosition*/,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder, //24
        (PFNVOID) PlaceHolder, //25
        (PFNVOID) PlaceHolder, //26
        (PFNVOID) PlaceHolder, 
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder, // 30
        (PFNVOID) PlaceHolder, //31
        (PFNVOID) PlaceHolder, //32
        (PFNVOID) PlaceHolder, //33
        (PFNVOID) PlaceHolder, //34
        (PFNVOID) PlaceHolder, //35
        (PFNVOID) PlaceHolder, //36
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder, //39
        (PFNVOID) PlaceHolder, //40
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder, //43
        (PFNVOID) PlaceHolder, //44
        (PFNVOID) PlaceHolder, //45
        (PFNVOID) PlaceHolder, //46
        (PFNVOID) PlaceHolder, //47
        (PFNVOID) PlaceHolder, //48
        (PFNVOID) PlaceHolder, //49
        (PFNVOID) PlaceHolder, //50
        (PFNVOID) PlaceHolder, //51
        (PFNVOID) PlaceHolder, //52
        (PFNVOID) PlaceHolder, //53
        (PFNVOID) PlaceHolder, //54
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder,
        (PFNVOID) PlaceHolder, //58
        (PFNVOID) PlaceHolder, //59
        (PFNVOID) PlaceHolder, //60
        (PFNVOID) PlaceHolder, //61
        (PFNVOID) PlaceHolder, //62
        (PFNVOID) PlaceHolder, //63
        (PFNVOID) PlaceHolder, //64
        (PFNVOID) PlaceHolder, //65
        (PFNVOID) PlaceHolder, //66
        (PFNVOID) PlaceHolder, //67
        (PFNVOID) PlaceHolder, //68
        (PFNVOID) PlaceHolder, //69
        (PFNVOID) PlaceHolder, //70
        (PFNVOID) PlaceHolder, //71
        (PFNVOID) PlaceHolder, //72
        (PFNVOID) PlaceHolder, // 73 - new and internal for mckendrick
    //xref ApiSetEnd
    };
    
    const ULONGLONG SigTable[NUM_APIS] = {
        FNSIG3(DW,DW,DW), // ShellNotifyCallback
        FNSIG0(),  //ShellApiReservedForNK
        FNSIG1(DW), // PlaceHolder (was: ShellExecuteEx)
        FNSIG1(DW)/*FNSIG1(PTR)*/, //GetOpenFileName
        FNSIG1(DW)/*FNSIG1(PTR)*/, //GetSaveFileName
        FNSIG1(DW), // xxx_SHGetFileInfo
        FNSIG3(DW,I_PTR, DW), // Shell_NotifyIcon
        FNSIG1(DW), // SHAddToRecentDocs
        FNSIG1(DW)/*FNSIG2(PTR,PTR)*/, // SHCreateShortcut
        FNSIG2(I_WSTR,DW), // SHCreateExplorerInstance
        FNSIG1(DW), // SHRemoveFontResource
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW)/*FNSIG3(PTR, PTR, DW)*/, // SHGetShortcutTarget
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW)/*FNSIG1(PTR)*/, // SHLoadDIBitmap
        FNSIG1(DW)/*FNSIG3(DW, DW, DW)*/, // SHSetDesktopPosition
        FNSIG1(DW), // SHFileChange
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), // PlaceHolder
        FNSIG1(DW), //NotSystemParametersInfo
        FNSIG1(DW), // SHGetAppKeyAssoc
        FNSIG1(DW), // SHSetAppKeyWndAssoc
        FNSIG1(DW), // PlaceHolder  30
        FNSIG1(DW), // PlaceHolder  31
        FNSIG1(DW), // PlaceHolder  32
        FNSIG1(DW), // PlaceHolder  33
        FNSIG1(DW), // SHFileNotifyRemove
        FNSIG1(DW), // SHFileNotifyFree
        FNSIG1(DW), // PlaceHolder  36
        FNSIG1(DW), // SHCloseApps
        FNSIG1(DW), // SHSipPreference
        FNSIG1(DW), // PlaceHolder  39
        FNSIG1(DW), // PlaceHolder  40
        FNSIG1(DW), // SHSetNavBarText
        FNSIG1(DW), // SHDoneButton
        FNSIG1(DW), // PlaceHolder  43
        FNSIG1(DW), // PlaceHolder  44
        FNSIG1(DW), // PlaceHolder  45
        FNSIG1(DW), // PlaceHolder  46
        FNSIG1(DW), // PlaceHolder  47
        FNSIG1(DW), // PlaceHolder  48
        FNSIG1(DW), // PlaceHolder  49
        FNSIG1(DW), //SHChangeNotifyRegister
        FNSIG1(DW), // PlaceHolder  51
        FNSIG1(DW), // PlaceHolder  52
        FNSIG1(DW), // PlaceHolder  53
        FNSIG1(DW), // PlaceHolder  54
        FNSIG1(DW), // SHNotificationAdd
        FNSIG1(DW), //SHNotificationUpdate
        FNSIG1(DW), //SHNotificationRemove
        FNSIG1(DW), //SHNotificationGetData
        FNSIG1(DW), // PlaceHolder  59
        FNSIG1(DW), // PlaceHolder  60
        FNSIG1(DW), // PlaceHolder  61
        FNSIG1(DW), // PlaceHolder  62
        FNSIG1(DW), // PlaceHolder  63
        FNSIG1(DW), // PlaceHolder  64
        FNSIG1(DW), // PlaceHolder  65
        FNSIG1(DW), // PlaceHolder  66
        FNSIG1(DW), // PlaceHolder  67
        FNSIG1(DW), // PlaceHolder  68
        FNSIG1(DW), // PlaceHolder  69
        FNSIG1(DW), // PlaceHolder  70
        FNSIG1(DW), // PlaceHolder  71
        FNSIG1(DW), // PlaceHolder  72
        FNSIG1(DW), // SendChangeNotificationToWindowI
    };
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR, int)
    {
        g_hInstance = hInstance;
    
        HWND hTaskBar = CreateTaskbar();
        HANDLE hAPISet = CreateAPISet((char *)"SHEL", NUM_APIS, VTable, SigTable);
        RegisterAPISet(hAPISet, SH_SHELL);
    
        // Do what the application does...
    
        CloseHandle(hAPISet);
        DestroyWindow(hTaskBar);
    
        return 0;
    }
    

    Wednesday, March 21, 2012 1:19 AM
  • Does this issue affect CE6 too? I have noticed that when we replace explorer.exe with our own application ActiveSync connects to the PC and I can copy/paste files to and from the device, but if I try and run the CE Remote Registry editor, for example, it is unable to connect until I have launched explorer on the unit. I also cannot debug a C# application in VS2008 (through ActiveSync) without explorer running...

    Barak.

    • Edited by Barak14 Monday, March 26, 2012 3:39 AM
    Monday, March 26, 2012 3:38 AM
  • Hi Barak,

    I can reproduce the behaviour you describe on CE 6.0, but it's different from the WEC 7.0 issue above.

    On WEC 7.0, it is just not possible to connect with ActiveSync if Explorer is not running (or the SHEL API is not registered).
    The PC does not detect the device at all, and it is not possible to transfer files.

    With CE 6.0 the behaviour is different.
    This is what I tried:

    • In the registry (LaunchXX key), replace explorer.exe with a custom application
    • Reboot the device, observe custom application starting up
    • Connect with ActiveSync (PC runs Windows XP and ActiveSync 4.5.0)
          - PC detects device, file transfer works as expected
    • Start VS2008 debugger using a small C# SmartDevice project
          - Deploy fails with:

      ------ Deploy started: Project: HelloCsharp, Configuration: Debug Any CPU ------
      All attempts to connect to the deployment target at port 5655 have failed. Addresses attempted:
      127.0.0.1.
      The device security configuration may have disallowed the connection. Ensure that you have the appropriate certificates on your device for development. Review your SDK documentation for proper security settings for connecting to this device.

      Connect to device failed.
      ========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
    • Launch CE Explorer (without rebooting device or disconnecting ActiveSync)
          - VS2008 debugger now works

    I wouldn't rule out the possibility that registering the SHEL API could also fix this, but I suspect it's caused by something else.

    My first step probably would be to investigate whether the CE Explorer modifies the security configuration that the VS2008 message is referring to.


    • Edited by CarstenHansen Monday, March 26, 2012 5:36 AM Fixed line break
    Monday, March 26, 2012 5:35 AM
  • The symptoms you describe match what I see exactly.

    I've been looking at this and cannot see where the differences would be. The is a registry key - HLKM\System\CoreConOverrideSecurity which if set to 1 is meant to disable security on the device. But this value is set to 1 whether explorer runs or not.

    Looks like I'll need to write an app for the device to dump the registry as none of the remote tools work either when explorer isn't running, so I can't export the registry easily to compare what may have changed.

    Edit:

    I finally got it working! The changes described by CarstenHansen are exactly correct apart from two lines of code that were missing:

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
    {
        g_hInstance = hInstance;
        HWND hTaskBar = CreateTaskbar();
        HANDLE hAPISet = CreateAPISet((char *)"SHEL", NUM_APIS, VTable, SigTable);
        HANDLE hShellAPIs = OpenEvent(EVENT_ALL_ACCESS, FALSE, TEXT("SYSTEM/ShellAPIReady"));
        
        RegisterAPISet(hAPISet, SH_SHELL);
    
        // This is what makes it work!
        SetEvent(hShellAPIs);
    
        // Do what the application does...
        
        CloseHandle(hAPISet);
        DestroyWindow(hTaskBar);
    
        return 0;
    }

    Thanks for your help!

    Barak

    • Edited by Barak14 Friday, April 13, 2012 1:14 AM Found Solution
    • Proposed as answer by Barak14 Friday, April 13, 2012 1:57 AM
    Thursday, April 12, 2012 2:38 AM
  • Thanks for the update!

    I do remember trying the ShellAPIReady event, but found it made no difference at all on WEC 7.0.

    Another subtle change from CE 6.0, which wouldn't be such an issue if it were documented somewhere.
    I suppose it is now.

    Friday, April 13, 2012 2:18 AM