http://blogs.clariusconsulting.net/pga

Pablo Galiano's Blog

Go Back to
pga′s Latest post

VS Shell application switches

If you want to know what happens behind the scenes when we execute a VS Shell application you can read Craig’s post about the VS Shell architecture.

To summarize Craig’s post when we execute a VS Shell application, it will find and load the appenvstub.dll (shipped with the VS SDK) and call one of the three exported methods of this dll (Start, Setup or Remove). Then the appenvstub.dll will act as a translator between the VS Shell Application and msenv.dll who is responsible for doing all the work.

The important thing (and purpose of this post) is that the VS Shell application calls the appenvstub.dll and passes the name of the Application (SKU), the command line switch (Start/Setup/Remove) and the rest of the command line buffer.

We can take a look at the main .cpp of the VS Shell application to see how it works:

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
    …

    if(fDoSetup)
    {
    …
        nRetVal = Setup(W2A(lpCmdLine), L”MyAppName_MyAppGUID“, NULL);
    …

    }
    else if(fDoRemove)
    {
    …
        nRetVal = Remove(W2A(lpCmdLine), L”MyAppName_MyAppGUID“);
    …
    }
    else
    {
    …
        nRetVal = Start(W2A(lpCmdLine), L”MyAppName_MyAppGUID“, nCmdShow, NULL, NULL);
    }

    …
}

 

The first parameter for these three methods is lpCmdLine and this is the entire command line buffer.

The Start method in particular is the one that we are interested in. Because appenvstub.dll ends up calling msenv.dll, this means that we can use the same command line switches that when we execute devenv.exe, in fact our VS Shell application is at the end another msenv.dll caller. (same as devenv.exe)

So basically we can use:

  • MyApp.exe /Splash (to show the splash screen)
  • MyApp.exe /Log (to enable the application log)
  • MyApp.exe /NOVSIP (to test the SLK and PLKs)

 

 Pablo

Comments