58 *TargetLength *=
sizeof(
WCHAR);
144 RootHeader = RootHeader->
Next;
188 Entry->ExeName.Length = 0;
207 while ((CurrentHeader = *LastLink) !=
NULL)
212 LastLink = &CurrentHeader->
Next;
215 *LastLink = NewHeader;
216 NewHeader->
Next = CurrentHeader;
322 Entry->Source.Length = 0;
327 Entry->Target.Length = 0;
349 while ((CurrentEntry = *LastLink) !=
NULL)
354 LastLink = &CurrentEntry->
Next;
357 *LastLink = NewEntry;
358 NewEntry->
Next = CurrentEntry;
368 while ((CurEntry = *LastLink) !=
NULL)
370 if (CurEntry ==
Entry)
372 *LastLink =
Entry->Next;
376 LastLink = &CurEntry->
Next;
389 RootHeader = RootHeader->
Next;
414 CurEntry = CurEntry->
Next;
435 NextHeader =
Header->Next;
438 NextEntry =
Entry->Next;
457 (
PVOID*)&ConsoleAliasRequest->Source,
458 ConsoleAliasRequest->SourceLength,
461 (
PVOID*)&ConsoleAliasRequest->Target,
462 ConsoleAliasRequest->TargetLength,
465 (
PVOID*)&ConsoleAliasRequest->ExeName,
466 ConsoleAliasRequest->ExeLength,
472 lpTarget = (ConsoleAliasRequest->TargetLength != 0 ? ConsoleAliasRequest->Target :
NULL);
475 ConsoleAliasRequest->ExeName,
476 ConsoleAliasRequest->ExeLength,
477 ConsoleAliasRequest->Unicode2);
481 ConsoleAliasRequest->ExeName,
482 ConsoleAliasRequest->ExeLength,
483 ConsoleAliasRequest->Unicode2);
490 if (lpTarget ==
NULL)
493 ConsoleAliasRequest->Source,
494 ConsoleAliasRequest->SourceLength,
495 ConsoleAliasRequest->Unicode);
504 ConsoleAliasRequest->Source,
505 ConsoleAliasRequest->SourceLength,
506 ConsoleAliasRequest->Target,
507 ConsoleAliasRequest->TargetLength,
508 ConsoleAliasRequest->Unicode);
528 (
PVOID*)&ConsoleAliasRequest->Source,
529 ConsoleAliasRequest->SourceLength,
532 (
PVOID*)&ConsoleAliasRequest->Target,
533 ConsoleAliasRequest->TargetLength,
536 (
PVOID*)&ConsoleAliasRequest->ExeName,
537 ConsoleAliasRequest->ExeLength,
543 lpTarget = ConsoleAliasRequest->Target;
545 if (ConsoleAliasRequest->ExeLength == 0 || lpTarget ==
NULL ||
546 ConsoleAliasRequest->TargetLength == 0 || ConsoleAliasRequest->SourceLength == 0)
552 ConsoleAliasRequest->ExeName,
553 ConsoleAliasRequest->ExeLength,
554 ConsoleAliasRequest->Unicode2);
559 ConsoleAliasRequest->Source,
560 ConsoleAliasRequest->SourceLength,
561 ConsoleAliasRequest->Unicode);
565 if (ConsoleAliasRequest->Unicode)
568 if (
Length > ConsoleAliasRequest->TargetLength)
574 ConsoleAliasRequest->TargetLength =
Length;
579 if (
Length > ConsoleAliasRequest->TargetLength)
586 lpTarget,
Entry->Target.Length /
sizeof(
WCHAR));
587 ConsoleAliasRequest->TargetLength =
Length;
602 (
PVOID)&GetAllAliasesRequest->ExeName,
603 GetAllAliasesRequest->ExeLength,
606 (
PVOID)&GetAllAliasesRequest->AliasesBuffer,
607 GetAllAliasesRequest->AliasesBufferLength,
614 GetAllAliasesRequest->ExeName,
615 GetAllAliasesRequest->ExeLength,
616 GetAllAliasesRequest->Unicode2);
632 UINT TargetBufferLength = GetAllAliasesRequest->AliasesBufferLength;
636 UINT SourceLength, TargetLength;
638 if (GetAllAliasesRequest->Unicode)
640 TargetBufferW = GetAllAliasesRequest->AliasesBuffer;
641 TargetBufferLength /=
sizeof(
WCHAR);
645 TargetBufferA = GetAllAliasesRequest->AliasesBuffer;
652 if (
Offset + TargetLength + SourceLength + 2 > TargetBufferLength)
658 if (GetAllAliasesRequest->Unicode)
662 TargetBufferW[
Offset++] =
L'=';
665 TargetBufferW[
Offset++] =
L'\0';
671 &TargetBufferA[
Offset], SourceLength);
673 TargetBufferA[
Offset++] =
'=';
676 &TargetBufferA[
Offset], TargetLength);
678 TargetBufferA[
Offset++] =
'\0';
681 CurEntry = CurEntry->
Next;
684 if (GetAllAliasesRequest->Unicode)
691 GetAllAliasesRequest->AliasesBufferLength =
BytesWritten;
704 (
PVOID)&GetAllAliasesLengthRequest->ExeName,
705 GetAllAliasesLengthRequest->ExeLength,
712 GetAllAliasesLengthRequest->ExeName,
713 GetAllAliasesLengthRequest->ExeLength,
714 GetAllAliasesLengthRequest->Unicode2);
717 GetAllAliasesLengthRequest->Length =
719 GetAllAliasesLengthRequest->Unicode);
724 GetAllAliasesLengthRequest->Length = 0;
738 (
PVOID*)&GetAliasesExesRequest->ExeNames,
739 GetAliasesExesRequest->Length,
756 UINT TargetBufferSize = GetAliasesExesRequest->Length;
761 if (GetAliasesExesRequest->Unicode)
763 TargetBufferW = GetAliasesExesRequest->ExeNames;
764 TargetBufferSize /=
sizeof(
WCHAR);
768 TargetBufferA = GetAliasesExesRequest->ExeNames;
780 if (GetAliasesExesRequest->Unicode)
784 TargetBufferW[
Offset++] =
L'\0';
792 TargetBufferA[
Offset++] =
'\0';
795 RootHeader = RootHeader->
Next;
798 if (GetAliasesExesRequest->Unicode)
814 GetAliasesExesLengthRequest->Length =
816 GetAliasesExesLengthRequest->Unicode);
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
#define WideCharToMultiByte
#define MultiByteToWideChar
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
base of all file and directory entries
struct _ALIAS_ENTRY * Next
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
static VOID IntDeleteAliasEntry(PALIAS_HEADER Header, PALIAS_ENTRY Entry)
struct _ALIAS_ENTRY * PALIAS_ENTRY
static PALIAS_ENTRY IntGetAliasEntry(PCONSRV_CONSOLE Console, PALIAS_HEADER Header, PVOID Source, USHORT SourceLength, BOOLEAN Unicode)
static PALIAS_ENTRY IntCreateAliasEntry(PCONSRV_CONSOLE Console, PVOID Source, USHORT SourceLength, PVOID Target, USHORT TargetLength, BOOLEAN Unicode)
static VOID IntInsertAliasHeader(PALIAS_HEADER *RootHeader, PALIAS_HEADER NewHeader)
struct _ALIAS_HEADER ALIAS_HEADER
static UINT IntGetConsoleAliasesExesLength(PALIAS_HEADER RootHeader, BOOLEAN IsUnicode)
static VOID IntInsertAliasEntry(PALIAS_HEADER Header, PALIAS_ENTRY NewEntry)
struct _ALIAS_ENTRY ALIAS_ENTRY
struct _ALIAS_HEADER * PALIAS_HEADER
VOID IntDeleteAllAliases(PCONSRV_CONSOLE Console)
BOOLEAN ConvertInputUnicodeToAnsi(PCONSRV_CONSOLE Console, PVOID Source, USHORT SourceLength, PCHAR Target, USHORT TargetLength)
static PALIAS_HEADER IntFindAliasHeader(PCONSRV_CONSOLE Console, PVOID ExeName, USHORT ExeLength, BOOLEAN UnicodeExe)
static PALIAS_HEADER IntCreateAliasHeader(PCONSRV_CONSOLE Console, PVOID ExeName, USHORT ExeLength, BOOLEAN UnicodeExe)
static UINT IntGetAllConsoleAliasesLength(PALIAS_HEADER Header, BOOLEAN IsUnicode)
BOOLEAN ConvertInputAnsiToUnicode(PCONSRV_CONSOLE Console, PVOID Source, USHORT SourceLength, PWCHAR *Target, PUSHORT TargetLength)
#define CON_API(Name, TYPE, RequestName)
#define ConsoleAllocHeap(Flags, Size)
#define ConsoleFreeHeap(HeapBase)