Skip to content

Commit

Permalink
gh-888: Allow to use ConEmu as default console in third-party applica…
Browse files Browse the repository at this point in the history
…tions.
  • Loading branch information
Maximus5 committed Oct 6, 2016
1 parent f46880d commit 74653b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/ConEmuHk/ConEmuHooks.cpp
@@ -1,6 +1,6 @@

/*
Copyright (c) 2009-2015 Maximus5
Copyright (c) 2009-2016 Maximus5
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -705,6 +705,12 @@ bool InitHooksDefTerm()
HOOK_ITEM_BY_NAME(ShellExecuteExW, shell32),
{0}
};
HookItem HooksAllocConsole[] =
{
// gh-888, gh-55: Allow to use ConEmu as default console in third-party applications
HOOK_ITEM_BY_NAME(AllocConsole, kernel32), // Only for "*.vshost.exe"?
{0}
};
HookItem HooksCmdLine[] =
{
// Issue 1125: "Run as administrator" too. Must be last export
Expand All @@ -714,7 +720,7 @@ bool InitHooksDefTerm()
HookItem HooksVshost[] =
{
// Issue 1312: .Net applications runs in "*.vshost.exe" helper GUI application when debugging
HOOK_ITEM_BY_NAME(AllocConsole, kernel32), // Only for "*.vshost.exe"?
// AllocConsole moved to HooksCommon
HOOK_ITEM_BY_NAME(ShowWindow, user32),
/* ************************ */
{0}
Expand All @@ -737,6 +743,12 @@ bool InitHooksDefTerm()
if (InitHooks(HooksCommon) < 0)
goto wrap;

if (gbIsNetVsHost || gbPrepareDefaultTerminal)
{
if (InitHooks(HooksAllocConsole) < 0)
goto wrap;
}

// Windows 7. There is new undocumented function "ShellExecCmdLine" used by Explorer
if (IsWin7())
{
Expand Down
2 changes: 1 addition & 1 deletion src/ConEmuHk/ConEmuHooks.h
@@ -1,6 +1,6 @@

/*
Copyright (c) 2009-2015 Maximus5
Copyright (c) 2009-2016 Maximus5
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down

0 comments on commit 74653b3

Please sign in to comment.