41 static BOOL AlreadyDisplayingProps =
FALSE;
51 if (lpThreadParameter)
57 AlreadyDisplayingProps =
TRUE;
61 wcscat(szBuffer,
L"\\console.dll");
63 if (hConsoleApplet ==
NULL)
65 DPRINT1(
"Failed to load console.dll\n");
74 DPRINT1(
"Error: console.dll misses CPlApplet export\n");
82 DPRINT1(
"Error: failed to initialize console.dll\n");
90 DPRINT1(
"Error: console.dll returned unexpected CPL count\n");
107 AlreadyDisplayingProps =
FALSE;
116 DPRINT(
"ParseShellInfo is UNIMPLEMENTED\n");
146 ConsoleStartInfo->IconIndex = 0;
147 ConsoleStartInfo->hIcon =
NULL;
148 ConsoleStartInfo->hIconSm =
NULL;
149 ConsoleStartInfo->dwStartupFlags =
Parameters->WindowFlags;
150 ConsoleStartInfo->nFont = 0;
151 ConsoleStartInfo->nInputBufferSize = 0;
152 ConsoleStartInfo->uCodePage =
GetOEMCP();
209 if (lpDesktop) *lpDesktop =
NULL;
214 ConsoleStartInfo->wFillAttribute = (
WORD)
Parameters->FillAttribute;
218 ConsoleStartInfo->dwScreenBufferSize.X = (
SHORT)
Parameters->CountCharsX;
219 ConsoleStartInfo->dwScreenBufferSize.Y = (
SHORT)
Parameters->CountCharsY;
223 ConsoleStartInfo->wShowWindow = (
WORD)
Parameters->ShowWindowFlags;
241 if ((
Parameters->WindowFlags & STARTF_USEHOTKEY) == 0)
254 if (ConsoleStartInfo->dwStartupFlags & STARTF_USEHOTKEY)
260 Parameters->WindowFlags &= ~STARTF_SHELLPRIVATE;
264 Parameters->ConsoleHandle = ConsoleStartInfo->ConsoleHandle;
268 Parameters->StandardInput = ConsoleStartInfo->InputHandle;
269 Parameters->StandardOutput = ConsoleStartInfo->OutputHandle;
270 Parameters->StandardError = ConsoleStartInfo->ErrorHandle;
290 ULONG ConnectInfoSize =
sizeof(*ConnectInfo);
295 DPRINT(
"Connecting to the Console Server...\n");
303 DPRINT1(
"Failed to connect to the Console Server (Status %lx)\n",
Status);
308 if (*InServerProcess)
return TRUE;
311 if (!ConnectInfo->IsConsoleApp)
return TRUE;
316 ConnectInfo->ConsoleStartInfo.InitEvents,
366 DPRINT(
"ConDllInitialize for: %wZ\n"
367 "Our current console handles are: 0x%p, 0x%p, 0x%p 0x%p\n",
387 DPRINT(
"Image is not a console application\n");
396 DPRINT(
"No console to create\n");
408 DPRINT(
"Creating a new separate console\n");
418 DPRINT(
"Creating a new invisible console\n");
466 DPRINT(
"ConsoleTitle = '%S' - Desktop = '%S'\n",
467 ConsoleTitle, ConnectInfo.
Desktop);
491 DPRINT(
"CurDir = '%S' - AppName = '%S'\n",
528 DPRINT(
"Console setup: 0x%p, 0x%p, 0x%p, 0x%p\n",
#define CONSRV_SERVERDLL_INDEX
LONG(APIENTRY * APPLET_PROC)(HWND, UINT, LPARAM, LPARAM)
PIMAGE_NT_HEADERS WINAPI ImageNtHeader(_In_ PVOID)
static CHAR AppName[MAX_PATH]
#define NT_SUCCESS(StatCode)
static const WCHAR Title[]
#define DLL_PROCESS_ATTACH
#define DLL_PROCESS_DETACH
#define GetProcAddress(x, y)
#define DLL_THREAD_ATTACH
DWORD WINAPI ConsoleControlDispatcher(IN LPVOID lpThreadParameter)
VOID SetTEBLangID(VOID)
Internal helper function used to synchronize the current thread's language ID with the one from the c...
VOID InitializeCtrlHandling(VOID)
VOID SetUpAppName(IN BOOLEAN CaptureStrings, IN OUT LPDWORD CurDirLength, IN OUT LPWSTR *CurDir, IN OUT LPDWORD AppNameLength, IN OUT LPWSTR *AppName)
static INT ParseShellInfo(LPCWSTR lpszShellInfo, LPCWSTR lpszKeyword)
static const PWSTR DefaultConsoleTitle
DWORD WINAPI PropDialogHandler(IN LPVOID lpThreadParameter)
VOID SetUpConsoleInfo(IN BOOLEAN CaptureTitle, IN OUT LPDWORD pTitleLength, IN OUT LPWSTR *lpTitle OPTIONAL, IN OUT LPDWORD pDesktopLength, IN OUT LPWSTR *lpDesktop OPTIONAL, IN OUT PCONSOLE_START_INFO ConsoleStartInfo)
RTL_CRITICAL_SECTION ConsoleLock
static BOOLEAN ConnectConsole(IN PWSTR SessionDir, IN PCONSRV_API_CONNECTINFO ConnectInfo, OUT PBOOLEAN InServerProcess)
BOOLEAN WINAPI ConDllInitialize(IN ULONG Reason, IN PWSTR SessionDir)
VOID SetUpHandles(IN PCONSOLE_START_INFO ConsoleStartInfo)
static BOOLEAN IsConsoleApp(VOID)
BOOLEAN ConsoleInitialized
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
#define HANDLE_CREATE_NEW_CONSOLE
#define HANDLE_CREATE_NO_WINDOW
#define HANDLE_DETACHED_PROCESS
UINT WINAPI GetOEMCP(void)
#define STARTF_SHELLPRIVATE
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define IMAGE_SUBSYSTEM_WINDOWS_CUI
NTSTATUS NTAPI NtWaitForMultipleObjects(IN ULONG ObjectCount, IN PHANDLE HandleArray, IN WAIT_TYPE WaitType, IN BOOLEAN Alertable, IN PLARGE_INTEGER TimeOut OPTIONAL)
DWORD BaseSetLastNTError(IN NTSTATUS Status)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
NTSTATUS NTAPI CsrClientConnectToServer(_In_ PCWSTR ObjectDirectory, _In_ ULONG ServerId, _In_ PVOID ConnectionInfo, _Inout_ PULONG ConnectionInfoSize, _Out_ PBOOLEAN ServerToServerCall)
PULONG MinorVersion OPTIONAL
WCHAR ConsoleTitle[MAX_PATH+1]
LPTHREAD_START_ROUTINE PropRoutine
CONSOLE_START_INFO ConsoleStartInfo
LPTHREAD_START_ROUTINE CtrlRoutine
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_UNSUCCESSFUL
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
#define STARTF_USEPOSITION
#define STARTF_USESHOWWINDOW
#define STARTF_USECOUNTCHARS
#define STARTF_USEFILLATTRIBUTE
#define STARTF_USESTDHANDLES