Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions litestep/RecoveryMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#define ID_TERMINATE 3
#define ID_RUN 4
#define ID_SHUTDOWN 5
#define ID_EXPLORER 6
#define ID_ABOUT 7

const TCHAR szRecoveryMenuWndClass[] = _T("RecoveryMenuWndClass");

Expand All @@ -56,8 +58,10 @@ rgMenuCommands[] = \
{ IDS_LITESTEP_RECYCLELS, ID_RECYCLE, "Re&cycle LiteStep" }
,{ IDS_LITESTEP_QUITLS, ID_QUIT, "&Quit LiteStep" }
,{ IDS_LITESTEP_TERMINATELS, ID_TERMINATE, "Forcibly &Terminate LiteStep" }
,{ IDS_LITESTEP_ABOUTLS, ID_ABOUT, "&About LiteStep" }
,{ 0, -1, "" }
,{ IDS_LITESTEP_RUN, ID_RUN, "&Run..." }
,{ IDS_LITESTEP_EXPLORER, ID_EXPLORER, "&Start Explorer as shell" }
,{ 0, -1, "" }
,{ IDS_LITESTEP_SHUTDOWNWIN, ID_SHUTDOWN, "Sh&utdown Windows..." }
};
Expand Down Expand Up @@ -344,6 +348,21 @@ void RecoveryMenu::HandleMenuCommand(int nCommand) const
PostMessage(GetLitestepWnd(), LM_RECYCLE, LR_QUIT, 0);
}
break;

case ID_ABOUT:
{
// ditto
LMBANGCOMMAND lmbc = {sizeof(LMBANGCOMMAND), NULL, "!about", NULL};
PostMessage(GetLitestepWnd(), LM_BANGCOMMAND, 0, (LPARAM)&lmbc);
}
break;

case ID_EXPLORER:
{
// ditto
PostMessage(GetLitestepWnd(), LM_RECYCLE, LR_EXPLORER, 0);
}
break;

case ID_TERMINATE:
{
Expand Down
91 changes: 53 additions & 38 deletions litestep/WinMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,58 +276,73 @@ int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE, LPTSTR lpCmdLine, int)
wStartFlags |= LSF_RUN_EXPLORER;
wStartFlags &= ~LSF_RUN_STARTUPAPPS;
}

if (wStartFlags & LSF_RUN_EXPLORER)
{
//
// Mode 2: (Try to) start Explorer
//
if (StartExplorerShell(EXPLORER_WAIT_TIMEOUT))
{
// Explorer started as shell, no need try LiteStep as well
wStartFlags &= ~LSF_RUN_LITESTEP;
}
else
{
wStartFlags &= ~LSF_RUN_EXPLORER;
}
}

if (wStartFlags & LSF_RUN_LITESTEP)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

bool bLoop = true;
while (bLoop)
{
HANDLE hMutex = NULL;

if (IsOtherInstanceRunning(&hMutex))
// Loop back here if explorer is requested as the shell
// while LiteStep is already running
bLoop = false;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

if (wStartFlags & LSF_RUN_EXPLORER)
{
//
// Mode 3a: Other LiteStep instance already running
// Mode 2: (Try to) start Explorer
//
RESOURCE_STR(hInst, IDS_LITESTEP_ERROR1,
"A previous instance of LiteStep was detected.\n"
"Are you sure you want to continue?");

// Can show a MessageBox here since the other instance
// should have closed the welcome screen already
INT idConfirm = RESOURCE_MSGBOX_F(
"LiteStep", MB_ICONINFORMATION | MB_YESNO | MB_DEFBUTTON2);

if (idConfirm == IDNO)
if (StartExplorerShell(EXPLORER_WAIT_TIMEOUT))
{
// Explorer started as shell, no need try LiteStep as well
wStartFlags &= ~LSF_RUN_LITESTEP;
}
else
{
wStartFlags &= ~LSF_RUN_EXPLORER;
}
}

if (wStartFlags & LSF_RUN_LITESTEP)
{
//
// Mode 3b: Start the shell!
//
nReturn = StartLitestep(hInst, wStartFlags, szAltConfigFile);
HANDLE hMutex = NULL;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

if (IsOtherInstanceRunning(&hMutex))
{
//
// Mode 3a: Other LiteStep instance already running
//
RESOURCE_STR(hInst, IDS_LITESTEP_ERROR1,
"A previous instance of LiteStep was detected.\n"
"Are you sure you want to continue?");

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

// Can show a MessageBox here since the other instance
// should have closed the welcome screen already
INT idConfirm = RESOURCE_MSGBOX_F(
"LiteStep", MB_ICONINFORMATION | MB_YESNO | MB_DEFBUTTON2);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

if (idConfirm == IDNO)
{
wStartFlags &= ~LSF_RUN_LITESTEP;
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

if (wStartFlags & LSF_RUN_LITESTEP)
{
//
// Mode 3b: Start the shell!
//
nReturn = StartLitestep(hInst, wStartFlags, szAltConfigFile);
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace

if (hMutex)
{
CloseHandle(hMutex);
}
}

if (hMutex)
if ((nReturn == 4) && !(wStartFlags & LSF_RUN_EXPLORER))
{
CloseHandle(hMutex);
// User wants Explorer as the shell anyway
wStartFlags |= LSF_RUN_EXPLORER;
bLoop = true;
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions litestep/litestep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,12 @@ LRESULT CLiteStep::InternalWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
PostQuitMessage(0);
}
break;

case LR_EXPLORER:
{
PostQuitMessage(4);
}
break;

default: // wParam == LR_MSSHUTDOWN
{
Expand Down
2 changes: 2 additions & 0 deletions litestep/litestep.rc
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ BEGIN
IDS_LITESTEP_RUN "&Run..."
IDS_LITESTEP_SHUTDOWNWIN "Sh&utdown Windows..."
IDS_MODULEQUIT_ERROR "Exception while quitting module."
IDS_LITESTEP_ABOUTLS "&About LiteStep"
IDS_LITESTEP_EXPLORER "&Start Explorer as shell"
END

STRINGTABLE
Expand Down
2 changes: 2 additions & 0 deletions litestep/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#define IDS_MATHEXCEPTION 25
#define IDS_LSAPI_INIT_ERROR 26
#define IDS_LITESTEP_INIT_ERROR 27
#define IDS_LITESTEP_ABOUTLS 28
#define IDS_LITESTEP_EXPLORER 29
#define IDI_LS 101
#define IDB_LS 102
#define IDD_ABOUTBOX 103
Expand Down
1 change: 1 addition & 0 deletions lsapi/lsapidefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ typedef struct LSDESKTOPINFO
#define LR_LOGOFF 1
#define LR_QUIT 2
#define LR_MSSHUTDOWN 3
#define LR_EXPLORER 4


//-----------------------------------------------------------------------------
Expand Down