mirror of
https://github.com/reactos/reactos.git
synced 2025-06-23 20:50:20 +00:00
Move console alias functions from csrss to win32csr, and make aliases per-console.
svn path=/trunk/; revision=34817
This commit is contained in:
parent
198d88a60b
commit
b1086dbdae
9 changed files with 116 additions and 37 deletions
|
@ -217,7 +217,7 @@ AddConsoleAliasW (LPCWSTR lpSource,
|
||||||
|
|
||||||
Request->Data.AddConsoleAlias.TargetLength = TargetLength;
|
Request->Data.AddConsoleAlias.TargetLength = TargetLength;
|
||||||
|
|
||||||
CsrRequest = MAKE_CSR_API(ADD_CONSOLE_ALIAS, CSR_NATIVE);
|
CsrRequest = MAKE_CSR_API(ADD_CONSOLE_ALIAS, CSR_CONSOLE);
|
||||||
Status = CsrClientCallServer(Request,
|
Status = CsrClientCallServer(Request,
|
||||||
NULL,
|
NULL,
|
||||||
CsrRequest,
|
CsrRequest,
|
||||||
|
@ -342,7 +342,7 @@ GetConsoleAliasW (LPWSTR lpSource,
|
||||||
|
|
||||||
DPRINT("GetConsoleAliasW entered lpSource %S lpExeName %S\n", lpSource, lpExeName);
|
DPRINT("GetConsoleAliasW entered lpSource %S lpExeName %S\n", lpSource, lpExeName);
|
||||||
|
|
||||||
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIAS, CSR_NATIVE);
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIAS, CSR_CONSOLE);
|
||||||
|
|
||||||
ExeLength = wcslen(lpExeName) + 1;
|
ExeLength = wcslen(lpExeName) + 1;
|
||||||
SourceLength = wcslen(lpSource) + 1;
|
SourceLength = wcslen(lpSource) + 1;
|
||||||
|
@ -458,7 +458,7 @@ GetConsoleAliasExesW (LPWSTR lpExeNameBuffer,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIASES_EXES, CSR_NATIVE);
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIASES_EXES, CSR_CONSOLE);
|
||||||
CsrAllocateMessagePointer(CaptureBuffer,
|
CsrAllocateMessagePointer(CaptureBuffer,
|
||||||
ExeNameBufferLength,
|
ExeNameBufferLength,
|
||||||
(PVOID*)&Request.Data.GetConsoleAliasesExes.ExeNames);
|
(PVOID*)&Request.Data.GetConsoleAliasesExes.ExeNames);
|
||||||
|
@ -519,7 +519,7 @@ GetConsoleAliasExesLengthW (VOID)
|
||||||
|
|
||||||
DPRINT("GetConsoleAliasExesLengthW entered\n");
|
DPRINT("GetConsoleAliasExesLengthW entered\n");
|
||||||
|
|
||||||
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIASES_EXES_LENGTH, CSR_NATIVE);
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIASES_EXES_LENGTH, CSR_CONSOLE);
|
||||||
Request.Data.GetConsoleAliasesExesLength.Length = 0;
|
Request.Data.GetConsoleAliasesExesLength.Length = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ GetConsoleAliasesW (LPWSTR AliasBuffer,
|
||||||
if (!dwLength || dwLength > AliasBufferLength)
|
if (!dwLength || dwLength > AliasBufferLength)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
CsrRequest = MAKE_CSR_API(GET_ALL_CONSOLE_ALIASES, CSR_NATIVE);
|
CsrRequest = MAKE_CSR_API(GET_ALL_CONSOLE_ALIASES, CSR_CONSOLE);
|
||||||
Request.Data.GetAllConsoleAlias.AliasBuffer = AliasBuffer;
|
Request.Data.GetAllConsoleAlias.AliasBuffer = AliasBuffer;
|
||||||
Request.Data.GetAllConsoleAlias.AliasBufferLength = AliasBufferLength;
|
Request.Data.GetAllConsoleAlias.AliasBufferLength = AliasBufferLength;
|
||||||
Request.Data.GetAllConsoleAlias.lpExeName = ExeName;
|
Request.Data.GetAllConsoleAlias.lpExeName = ExeName;
|
||||||
|
@ -639,7 +639,7 @@ GetConsoleAliasesLengthW (LPWSTR lpExeName)
|
||||||
|
|
||||||
DPRINT("GetConsoleAliasesLengthW entered\n");
|
DPRINT("GetConsoleAliasesLengthW entered\n");
|
||||||
|
|
||||||
CsrRequest = MAKE_CSR_API(GET_ALL_CONSOLE_ALIASES_LENGTH, CSR_NATIVE);
|
CsrRequest = MAKE_CSR_API(GET_ALL_CONSOLE_ALIASES_LENGTH, CSR_CONSOLE);
|
||||||
Request.Data.GetAllConsoleAliasesLength.lpExeName = lpExeName;
|
Request.Data.GetAllConsoleAliasesLength.lpExeName = lpExeName;
|
||||||
Request.Data.GetAllConsoleAliasesLength.Length = 0;
|
Request.Data.GetAllConsoleAliasesLength.Length = 0;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
<file>process.c</file>
|
<file>process.c</file>
|
||||||
<file>user.c</file>
|
<file>user.c</file>
|
||||||
<file>wapi.c</file>
|
<file>wapi.c</file>
|
||||||
<file>alias.c</file>
|
|
||||||
</directory>
|
</directory>
|
||||||
<pch>csrss.h</pch>
|
<pch>csrss.h</pch>
|
||||||
<file>csrss.c</file>
|
<file>csrss.c</file>
|
||||||
|
|
|
@ -156,13 +156,6 @@ CSR_API(CsrSetShutdownParameters);
|
||||||
CSR_API(CsrSetLogonNotifyWindow);
|
CSR_API(CsrSetLogonNotifyWindow);
|
||||||
CSR_API(CsrRegisterLogonProcess);
|
CSR_API(CsrRegisterLogonProcess);
|
||||||
|
|
||||||
CSR_API(CsrAddConsoleAlias);
|
|
||||||
CSR_API(CsrGetConsoleAlias);
|
|
||||||
CSR_API(CsrGetAllConsoleAliases);
|
|
||||||
CSR_API(CsrGetAllConsoleAliasesLength);
|
|
||||||
CSR_API(CsrGetConsoleAliasesExes);
|
|
||||||
CSR_API(CsrGetConsoleAliasesExesLength);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* ndef API_H_INCLUDED */
|
#endif /* ndef API_H_INCLUDED */
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,10 @@ typedef struct tagCSRSS_CONSOLE
|
||||||
UINT OutputCodePage;
|
UINT OutputCodePage;
|
||||||
PCSRSS_CONSOLE_VTBL Vtbl;
|
PCSRSS_CONSOLE_VTBL Vtbl;
|
||||||
LIST_ENTRY ProcessList;
|
LIST_ENTRY ProcessList;
|
||||||
|
struct tagALIAS_HEADER *Aliases;
|
||||||
} CSRSS_CONSOLE;
|
} CSRSS_CONSOLE;
|
||||||
|
|
||||||
|
NTSTATUS FASTCALL ConioConsoleFromProcessData(PCSRSS_PROCESS_DATA ProcessData, PCSRSS_CONSOLE *Console);
|
||||||
VOID STDCALL ConioDeleteConsole(Object_t *Object);
|
VOID STDCALL ConioDeleteConsole(Object_t *Object);
|
||||||
VOID STDCALL ConioDeleteScreenBuffer(Object_t *Buffer);
|
VOID STDCALL ConioDeleteScreenBuffer(Object_t *Buffer);
|
||||||
void STDCALL ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode);
|
void STDCALL ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode);
|
||||||
|
@ -162,6 +164,16 @@ CSR_API(CsrGetProcessList);
|
||||||
Win32CsrUnlockObject((Object_t *) Buff)
|
Win32CsrUnlockObject((Object_t *) Buff)
|
||||||
#define ConioChangeIcon(Console, hWindowIcon) (Console)->Vtbl->ChangeIcon(Console, hWindowIcon)
|
#define ConioChangeIcon(Console, hWindowIcon) (Console)->Vtbl->ChangeIcon(Console, hWindowIcon)
|
||||||
|
|
||||||
|
/* alias.c */
|
||||||
|
VOID IntDeleteAllAliases(struct tagALIAS_HEADER *RootHeader);
|
||||||
|
CSR_API(CsrAddConsoleAlias);
|
||||||
|
CSR_API(CsrGetConsoleAlias);
|
||||||
|
CSR_API(CsrGetAllConsoleAliases);
|
||||||
|
CSR_API(CsrGetAllConsoleAliasesLength);
|
||||||
|
CSR_API(CsrGetConsoleAliasesExes);
|
||||||
|
CSR_API(CsrGetConsoleAliasesExesLength);
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONIO_H_INCLUDED */
|
#endif /* CONIO_H_INCLUDED */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -294,12 +294,6 @@ CSRSS_API_DEFINITION NativeDefinitions[] =
|
||||||
CSRSS_DEFINE_API(VERIFY_HANDLE, CsrVerifyHandle),
|
CSRSS_DEFINE_API(VERIFY_HANDLE, CsrVerifyHandle),
|
||||||
CSRSS_DEFINE_API(DUPLICATE_HANDLE, CsrDuplicateHandle),
|
CSRSS_DEFINE_API(DUPLICATE_HANDLE, CsrDuplicateHandle),
|
||||||
CSRSS_DEFINE_API(GET_INPUT_WAIT_HANDLE, CsrGetInputWaitHandle),
|
CSRSS_DEFINE_API(GET_INPUT_WAIT_HANDLE, CsrGetInputWaitHandle),
|
||||||
CSRSS_DEFINE_API(ADD_CONSOLE_ALIAS, CsrAddConsoleAlias),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_ALIAS, CsrGetConsoleAlias),
|
|
||||||
CSRSS_DEFINE_API(GET_ALL_CONSOLE_ALIASES, CsrGetAllConsoleAliases),
|
|
||||||
CSRSS_DEFINE_API(GET_ALL_CONSOLE_ALIASES_LENGTH, CsrGetAllConsoleAliasesLength),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES, CsrGetConsoleAliasesExes),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES_LENGTH, CsrGetConsoleAliasesExesLength),
|
|
||||||
{ 0, 0, NULL }
|
{ 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
/* INCLUDES ******************************************************************/
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <csrss.h>
|
#include "w32csr.h"
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
@ -32,8 +32,6 @@ typedef struct tagALIAS_HEADER
|
||||||
|
|
||||||
}ALIAS_HEADER, *PALIAS_HEADER;
|
}ALIAS_HEADER, *PALIAS_HEADER;
|
||||||
|
|
||||||
static PALIAS_HEADER RootHeader = NULL;
|
|
||||||
|
|
||||||
/* Ensure that a buffer is contained within the process's shared memory section. */
|
/* Ensure that a buffer is contained within the process's shared memory section. */
|
||||||
static BOOL
|
static BOOL
|
||||||
ValidateBuffer(PCSRSS_PROCESS_DATA ProcessData, PVOID Buffer, ULONG Size)
|
ValidateBuffer(PCSRSS_PROCESS_DATA ProcessData, PVOID Buffer, ULONG Size)
|
||||||
|
@ -73,7 +71,7 @@ IntCreateAliasHeader(LPCWSTR lpExeName)
|
||||||
PALIAS_HEADER Entry;
|
PALIAS_HEADER Entry;
|
||||||
UINT dwLength = wcslen(lpExeName) + 1;
|
UINT dwLength = wcslen(lpExeName) + 1;
|
||||||
|
|
||||||
Entry = RtlAllocateHeap(CsrssApiHeap, 0, sizeof(ALIAS_HEADER) + sizeof(WCHAR) * dwLength);
|
Entry = RtlAllocateHeap(Win32CsrApiHeap, 0, sizeof(ALIAS_HEADER) + sizeof(WCHAR) * dwLength);
|
||||||
if (!Entry)
|
if (!Entry)
|
||||||
return Entry;
|
return Entry;
|
||||||
|
|
||||||
|
@ -187,7 +185,7 @@ IntCreateAliasEntry(LPCWSTR lpSource, LPCWSTR lpTarget)
|
||||||
dwSource = wcslen(lpSource) + 1;
|
dwSource = wcslen(lpSource) + 1;
|
||||||
dwTarget = wcslen(lpTarget) + 1;
|
dwTarget = wcslen(lpTarget) + 1;
|
||||||
|
|
||||||
Entry = RtlAllocateHeap(CsrssApiHeap, 0, sizeof(ALIAS_ENTRY) + sizeof(WCHAR) * (dwSource + dwTarget));
|
Entry = RtlAllocateHeap(Win32CsrApiHeap, 0, sizeof(ALIAS_ENTRY) + sizeof(WCHAR) * (dwSource + dwTarget));
|
||||||
if (!Entry)
|
if (!Entry)
|
||||||
return Entry;
|
return Entry;
|
||||||
|
|
||||||
|
@ -297,7 +295,7 @@ IntDeleteAliasEntry(PALIAS_HEADER Header, PALIAS_ENTRY Entry)
|
||||||
if (Header->Data == Entry)
|
if (Header->Data == Entry)
|
||||||
{
|
{
|
||||||
Header->Data = Entry->Next;
|
Header->Data = Entry->Next;
|
||||||
RtlFreeHeap(CsrssApiHeap, 0, Entry);
|
RtlFreeHeap(Win32CsrApiHeap, 0, Entry);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LastEntry = Header->Data;
|
LastEntry = Header->Data;
|
||||||
|
@ -308,16 +306,33 @@ IntDeleteAliasEntry(PALIAS_HEADER Header, PALIAS_ENTRY Entry)
|
||||||
if (CurEntry == Entry)
|
if (CurEntry == Entry)
|
||||||
{
|
{
|
||||||
LastEntry->Next = Entry->Next;
|
LastEntry->Next = Entry->Next;
|
||||||
RtlFreeHeap(CsrssApiHeap, 0, Entry);
|
RtlFreeHeap(Win32CsrApiHeap, 0, Entry);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LastEntry = CurEntry;
|
LastEntry = CurEntry;
|
||||||
CurEntry = CurEntry->Next;
|
CurEntry = CurEntry->Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
VOID
|
||||||
|
IntDeleteAllAliases(PALIAS_HEADER RootHeader)
|
||||||
|
{
|
||||||
|
PALIAS_HEADER Header, NextHeader;
|
||||||
|
PALIAS_ENTRY Entry, NextEntry;
|
||||||
|
for (Header = RootHeader; Header; Header = NextHeader)
|
||||||
|
{
|
||||||
|
NextHeader = Header->Next;
|
||||||
|
for (Entry = Header->Data; Entry; Entry = NextEntry)
|
||||||
|
{
|
||||||
|
NextEntry = Entry->Next;
|
||||||
|
RtlFreeHeap(Win32CsrApiHeap, 0, Entry);
|
||||||
|
}
|
||||||
|
RtlFreeHeap(Win32CsrApiHeap, 0, Header);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CSR_API(CsrAddConsoleAlias)
|
CSR_API(CsrAddConsoleAlias)
|
||||||
{
|
{
|
||||||
|
PCSRSS_CONSOLE Console;
|
||||||
PALIAS_HEADER Header;
|
PALIAS_HEADER Header;
|
||||||
PALIAS_ENTRY Entry;
|
PALIAS_ENTRY Entry;
|
||||||
WCHAR * lpExeName;
|
WCHAR * lpExeName;
|
||||||
|
@ -341,16 +356,23 @@ CSR_API(CsrAddConsoleAlias)
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Header = IntFindAliasHeader(RootHeader, lpExeName);
|
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||||
|
if (!NT_SUCCESS(Request->Status))
|
||||||
|
{
|
||||||
|
return Request->Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Header = IntFindAliasHeader(Console->Aliases, lpExeName);
|
||||||
if (!Header && lpTarget != NULL)
|
if (!Header && lpTarget != NULL)
|
||||||
{
|
{
|
||||||
Header = IntCreateAliasHeader(lpExeName);
|
Header = IntCreateAliasHeader(lpExeName);
|
||||||
if (!Header)
|
if (!Header)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_INSUFFICIENT_RESOURCES;
|
Request->Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
IntInsertAliasHeader(&RootHeader, Header);
|
IntInsertAliasHeader(&Console->Aliases, Header);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpTarget == NULL) // delete the entry
|
if (lpTarget == NULL) // delete the entry
|
||||||
|
@ -365,6 +387,7 @@ CSR_API(CsrAddConsoleAlias)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_INVALID_PARAMETER;
|
Request->Status = STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,16 +396,19 @@ CSR_API(CsrAddConsoleAlias)
|
||||||
if (!Entry)
|
if (!Entry)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_INSUFFICIENT_RESOURCES;
|
Request->Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntInsertAliasEntry(Header, Entry);
|
IntInsertAliasEntry(Header, Entry);
|
||||||
Request->Status = STATUS_SUCCESS;
|
Request->Status = STATUS_SUCCESS;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSR_API(CsrGetConsoleAlias)
|
CSR_API(CsrGetConsoleAlias)
|
||||||
{
|
{
|
||||||
|
PCSRSS_CONSOLE Console;
|
||||||
PALIAS_HEADER Header;
|
PALIAS_HEADER Header;
|
||||||
PALIAS_ENTRY Entry;
|
PALIAS_ENTRY Entry;
|
||||||
UINT Length;
|
UINT Length;
|
||||||
|
@ -405,10 +431,17 @@ CSR_API(CsrGetConsoleAlias)
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Header = IntFindAliasHeader(RootHeader, lpExeName);
|
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||||
|
if (!NT_SUCCESS(Request->Status))
|
||||||
|
{
|
||||||
|
return Request->Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Header = IntFindAliasHeader(Console->Aliases, lpExeName);
|
||||||
if (!Header)
|
if (!Header)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_INVALID_PARAMETER;
|
Request->Status = STATUS_INVALID_PARAMETER;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,6 +449,7 @@ CSR_API(CsrGetConsoleAlias)
|
||||||
if (!Entry)
|
if (!Entry)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_INVALID_PARAMETER;
|
Request->Status = STATUS_INVALID_PARAMETER;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,23 +457,27 @@ CSR_API(CsrGetConsoleAlias)
|
||||||
if (Length > Request->Data.GetConsoleAlias.TargetBufferLength)
|
if (Length > Request->Data.GetConsoleAlias.TargetBufferLength)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_BUFFER_TOO_SMALL;
|
Request->Status = STATUS_BUFFER_TOO_SMALL;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ValidateBuffer(ProcessData, lpTarget, Request->Data.GetConsoleAlias.TargetBufferLength))
|
if (!ValidateBuffer(ProcessData, lpTarget, Request->Data.GetConsoleAlias.TargetBufferLength))
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_ACCESS_VIOLATION;
|
Request->Status = STATUS_ACCESS_VIOLATION;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscpy(lpTarget, Entry->lpTarget);
|
wcscpy(lpTarget, Entry->lpTarget);
|
||||||
Request->Data.GetConsoleAlias.BytesWritten = Length;
|
Request->Data.GetConsoleAlias.BytesWritten = Length;
|
||||||
Request->Status = STATUS_SUCCESS;
|
Request->Status = STATUS_SUCCESS;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSR_API(CsrGetAllConsoleAliases)
|
CSR_API(CsrGetAllConsoleAliases)
|
||||||
{
|
{
|
||||||
|
PCSRSS_CONSOLE Console;
|
||||||
ULONG BytesWritten;
|
ULONG BytesWritten;
|
||||||
PALIAS_HEADER Header;
|
PALIAS_HEADER Header;
|
||||||
|
|
||||||
|
@ -449,16 +487,24 @@ CSR_API(CsrGetAllConsoleAliases)
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Header = IntFindAliasHeader(RootHeader, Request->Data.GetAllConsoleAlias.lpExeName);
|
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||||
|
if (!NT_SUCCESS(Request->Status))
|
||||||
|
{
|
||||||
|
return Request->Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Header = IntFindAliasHeader(Console->Aliases, Request->Data.GetAllConsoleAlias.lpExeName);
|
||||||
if (!Header)
|
if (!Header)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_INVALID_PARAMETER;
|
Request->Status = STATUS_INVALID_PARAMETER;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntGetAllConsoleAliasesLength(Header) > Request->Data.GetAllConsoleAlias.AliasBufferLength)
|
if (IntGetAllConsoleAliasesLength(Header) > Request->Data.GetAllConsoleAlias.AliasBufferLength)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_BUFFER_OVERFLOW;
|
Request->Status = STATUS_BUFFER_OVERFLOW;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,6 +513,7 @@ CSR_API(CsrGetAllConsoleAliases)
|
||||||
Request->Data.GetAllConsoleAlias.AliasBufferLength))
|
Request->Data.GetAllConsoleAlias.AliasBufferLength))
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_ACCESS_VIOLATION;
|
Request->Status = STATUS_ACCESS_VIOLATION;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,11 +523,13 @@ CSR_API(CsrGetAllConsoleAliases)
|
||||||
|
|
||||||
Request->Data.GetAllConsoleAlias.BytesWritten = BytesWritten;
|
Request->Data.GetAllConsoleAlias.BytesWritten = BytesWritten;
|
||||||
Request->Status = STATUS_SUCCESS;
|
Request->Status = STATUS_SUCCESS;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSR_API(CsrGetAllConsoleAliasesLength)
|
CSR_API(CsrGetAllConsoleAliasesLength)
|
||||||
{
|
{
|
||||||
|
PCSRSS_CONSOLE Console;
|
||||||
PALIAS_HEADER Header;
|
PALIAS_HEADER Header;
|
||||||
UINT Length;
|
UINT Length;
|
||||||
|
|
||||||
|
@ -490,38 +539,55 @@ CSR_API(CsrGetAllConsoleAliasesLength)
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Header = IntFindAliasHeader(RootHeader, Request->Data.GetAllConsoleAliasesLength.lpExeName);
|
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||||
|
if (!NT_SUCCESS(Request->Status))
|
||||||
|
{
|
||||||
|
return Request->Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Header = IntFindAliasHeader(Console->Aliases, Request->Data.GetAllConsoleAliasesLength.lpExeName);
|
||||||
if (!Header)
|
if (!Header)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_INVALID_PARAMETER;
|
Request->Status = STATUS_INVALID_PARAMETER;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Length = IntGetAllConsoleAliasesLength(Header);
|
Length = IntGetAllConsoleAliasesLength(Header);
|
||||||
Request->Data.GetAllConsoleAliasesLength.Length = Length;
|
Request->Data.GetAllConsoleAliasesLength.Length = Length;
|
||||||
Request->Status = STATUS_SUCCESS;
|
Request->Status = STATUS_SUCCESS;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CSR_API(CsrGetConsoleAliasesExes)
|
CSR_API(CsrGetConsoleAliasesExes)
|
||||||
{
|
{
|
||||||
|
PCSRSS_CONSOLE Console;
|
||||||
UINT BytesWritten;
|
UINT BytesWritten;
|
||||||
UINT ExesLength;
|
UINT ExesLength;
|
||||||
|
|
||||||
DPRINT("CsrGetConsoleAliasesExes entered\n");
|
DPRINT("CsrGetConsoleAliasesExes entered\n");
|
||||||
|
|
||||||
ExesLength = IntGetConsoleAliasesExesLength(RootHeader);
|
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||||
|
if (!NT_SUCCESS(Request->Status))
|
||||||
|
{
|
||||||
|
return Request->Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExesLength = IntGetConsoleAliasesExesLength(Console->Aliases);
|
||||||
|
|
||||||
if (ExesLength > Request->Data.GetConsoleAliasesExes.Length)
|
if (ExesLength > Request->Data.GetConsoleAliasesExes.Length)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_BUFFER_OVERFLOW;
|
Request->Status = STATUS_BUFFER_OVERFLOW;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Request->Data.GetConsoleAliasesExes.ExeNames == NULL)
|
if (Request->Data.GetConsoleAliasesExes.ExeNames == NULL)
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_INVALID_PARAMETER;
|
Request->Status = STATUS_INVALID_PARAMETER;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,23 +596,30 @@ CSR_API(CsrGetConsoleAliasesExes)
|
||||||
Request->Data.GetConsoleAliasesExes.Length))
|
Request->Data.GetConsoleAliasesExes.Length))
|
||||||
{
|
{
|
||||||
Request->Status = STATUS_ACCESS_VIOLATION;
|
Request->Status = STATUS_ACCESS_VIOLATION;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
BytesWritten = IntGetConsoleAliasesExes(RootHeader,
|
BytesWritten = IntGetConsoleAliasesExes(Console->Aliases,
|
||||||
Request->Data.GetConsoleAliasesExes.ExeNames,
|
Request->Data.GetConsoleAliasesExes.ExeNames,
|
||||||
Request->Data.GetConsoleAliasesExes.Length);
|
Request->Data.GetConsoleAliasesExes.Length);
|
||||||
|
|
||||||
Request->Data.GetConsoleAliasesExes.BytesWritten = BytesWritten;
|
Request->Data.GetConsoleAliasesExes.BytesWritten = BytesWritten;
|
||||||
Request->Status = STATUS_SUCCESS;
|
Request->Status = STATUS_SUCCESS;
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSR_API(CsrGetConsoleAliasesExesLength)
|
CSR_API(CsrGetConsoleAliasesExesLength)
|
||||||
{
|
{
|
||||||
|
PCSRSS_CONSOLE Console;
|
||||||
DPRINT("CsrGetConsoleAliasesExesLength entered\n");
|
DPRINT("CsrGetConsoleAliasesExesLength entered\n");
|
||||||
|
|
||||||
Request->Status = STATUS_SUCCESS;
|
Request->Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||||
Request->Data.GetConsoleAliasesExesLength.Length = IntGetConsoleAliasesExesLength(RootHeader);
|
if (NT_SUCCESS(Request->Status))
|
||||||
|
{
|
||||||
|
Request->Data.GetConsoleAliasesExesLength.Length = IntGetConsoleAliasesExesLength(Console->Aliases);
|
||||||
|
ConioUnlockConsole(Console);
|
||||||
|
}
|
||||||
return Request->Status;
|
return Request->Status;
|
||||||
}
|
}
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
static NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
ConioConsoleFromProcessData(PCSRSS_PROCESS_DATA ProcessData, PCSRSS_CONSOLE *Console)
|
ConioConsoleFromProcessData(PCSRSS_PROCESS_DATA ProcessData, PCSRSS_CONSOLE *Console)
|
||||||
{
|
{
|
||||||
PCSRSS_CONSOLE ProcessConsole = ProcessData->Console;
|
PCSRSS_CONSOLE ProcessConsole = ProcessData->Console;
|
||||||
|
@ -961,6 +961,7 @@ ConioDeleteConsole(Object_t *Object)
|
||||||
CloseHandle(Console->ActiveEvent);
|
CloseHandle(Console->ActiveEvent);
|
||||||
DeleteCriticalSection(&Console->Header.Lock);
|
DeleteCriticalSection(&Console->Header.Lock);
|
||||||
RtlFreeUnicodeString(&Console->Title);
|
RtlFreeUnicodeString(&Console->Title);
|
||||||
|
IntDeleteAllAliases(Console->Aliases);
|
||||||
HeapFree(Win32CsrApiHeap, 0, Console);
|
HeapFree(Win32CsrApiHeap, 0, Console);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,12 @@ static CSRSS_API_DEFINITION Win32CsrApiDefinitions[] =
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_OUTPUT_CP, CsrGetConsoleOutputCodePage),
|
CSRSS_DEFINE_API(GET_CONSOLE_OUTPUT_CP, CsrGetConsoleOutputCodePage),
|
||||||
CSRSS_DEFINE_API(SET_CONSOLE_OUTPUT_CP, CsrSetConsoleOutputCodePage),
|
CSRSS_DEFINE_API(SET_CONSOLE_OUTPUT_CP, CsrSetConsoleOutputCodePage),
|
||||||
CSRSS_DEFINE_API(GET_PROCESS_LIST, CsrGetProcessList),
|
CSRSS_DEFINE_API(GET_PROCESS_LIST, CsrGetProcessList),
|
||||||
|
CSRSS_DEFINE_API(ADD_CONSOLE_ALIAS, CsrAddConsoleAlias),
|
||||||
|
CSRSS_DEFINE_API(GET_CONSOLE_ALIAS, CsrGetConsoleAlias),
|
||||||
|
CSRSS_DEFINE_API(GET_ALL_CONSOLE_ALIASES, CsrGetAllConsoleAliases),
|
||||||
|
CSRSS_DEFINE_API(GET_ALL_CONSOLE_ALIASES_LENGTH, CsrGetAllConsoleAliasesLength),
|
||||||
|
CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES, CsrGetConsoleAliasesExes),
|
||||||
|
CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES_LENGTH, CsrGetConsoleAliasesExesLength),
|
||||||
{ 0, 0, NULL }
|
{ 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<library>psapi</library>
|
<library>psapi</library>
|
||||||
<library>msvcrt</library>
|
<library>msvcrt</library>
|
||||||
<pch>w32csr.h</pch>
|
<pch>w32csr.h</pch>
|
||||||
|
<file>alias.c</file>
|
||||||
<file>conio.c</file>
|
<file>conio.c</file>
|
||||||
<file>desktopbg.c</file>
|
<file>desktopbg.c</file>
|
||||||
<file>dllmain.c</file>
|
<file>dllmain.c</file>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue