22#define BugCheckFileId (CDFS_BUG_CHECK_NAMESUP)
25#pragma alloc_text(PAGE, CdConvertBigToLittleEndian)
26#pragma alloc_text(PAGE, CdConvertNameToCdName)
27#pragma alloc_text(PAGE, CdDissectName)
28#pragma alloc_text(PAGE, CdGenerate8dot3Name)
29#pragma alloc_text(PAGE, CdFullCompareNames)
30#pragma alloc_text(PAGE, CdIsLegalName)
31#pragma alloc_text(PAGE, CdIs8dot3Name)
32#pragma alloc_text(PAGE, CdIsNameInExpression)
33#pragma alloc_text(PAGE, CdShortNameDirentOffset)
34#pragma alloc_text(PAGE, CdUpcaseName)
41CdConvertNameToCdName (
77 while ((NameLength < CdName->
FileName.Length) &&
95 NameLength +
sizeof(
WCHAR ),
164 RemainingByteCount - 1 );
172 while (RemainingByteCount != 0) {
176#pragma prefast(suppress:26014, "RemainingByteCount is even")
186 RemainingByteCount -= 2;
230 if (
Name != UpcaseName) {
236 UpcaseName->VersionString.Length = 0;
238 if (
Name->VersionString.Length != 0) {
240 UpcaseName->VersionString.MaximumLength =
241 UpcaseName->VersionString.Length =
Name->VersionString.Length;
248 UpcaseName->VersionString.Buffer =
Add2Ptr( UpcaseName->FileName.Buffer,
249 Name->FileName.Length,
259#pragma prefast( suppress:26015, "CD_NAME structures have two UNICODE_STRING structures pointing to the same allocation. there is no way to tell prefast this is the case and that the allocation is always big enough.");
261 *(UpcaseName->VersionString.Buffer) =
L';';
263 UpcaseName->VersionString.Buffer += 1;
282 if (
Name->VersionString.Length != 0) {
285 &
Name->VersionString,
340 (NameLength < RemainingName->
Length) && (*NextWchar !=
L'\\');
341 NameLength +=
sizeof(
WCHAR) , NextWchar += 1);
349 FinalName->MaximumLength = FinalName->Length = (
USHORT) NameLength;
368 NameLength +
sizeof(
WCHAR ),
413 if ((*Wchar < 0xff) &&
488 if (*NextWchar ==
L' ') {
return FALSE; }
490 if (*NextWchar ==
L'.') {
498 if ((DotCount > 0) ||
531 DbcsName.Buffer = DbcsNameBuffer;
533 if (!
NT_SUCCESS( RtlUnicodeStringToCountedOemString( &DbcsName,
604 ULONG BiasedDirentOffset;
606 ULONG MaximumBaseBytes;
607 ULONG BaseNameOffset;
657 NextWchar =
Add2Ptr( BiasedShortNameBuffer,
691 ThisWchar = (
WCHAR) (BiasedDirentOffset & 0x0000000f);
697 if (ThisWchar <= 9) {
699 *NextWchar = ThisWchar +
L'0';
703 *NextWchar = ThisWchar +
L'A' - 0xA;
712 BiasedDirentOffset >>= 4;
714 }
while (BiasedDirentOffset != 0);
729 BiasedShortName.
Buffer = NextWchar;
738 MaximumBaseBytes = 16 -
Length;
747 NextWchar = ShortFileName;
750 while ((BaseNameOffset <
ShortName.Length) &&
751 (
ShortName.Buffer[BaseNameOffset / 2] !=
L'.')) {
758 if (
ShortName.Buffer[BaseNameOffset / 2] ==
L'~') {
770#pragma prefast(suppress:26014, "OemNameOffset <= BaseNameOffset throughout this loop; OemName buffer previously allocated based on ShortName's length.")
779 if ((OemNameOffset + (BiasedShortName.
Length /
sizeof(
WCHAR))) > 8) {
781 OverflowBuffer =
TRUE;
793 if (!FoundTilde && !OverflowBuffer && (BaseNameOffset < MaximumBaseBytes)) {
795 *NextWchar =
ShortName.Buffer[BaseNameOffset / 2];
820 NextWchar += (BiasedShortName.
Length /
sizeof(
WCHAR ));
826 if (BaseNameOffset !=
ShortName.Length) {
895 &CurrentName->FileName,
905 if ((CurrentName->FileName.Length != SearchExpression->FileName.Length) ||
907 SearchExpression->FileName.Buffer,
908 CurrentName->FileName.Length ))) {
919 if (Match && CheckVersion && SearchExpression->VersionString.Length &&
930 &CurrentName->VersionString,
940 if ((CurrentName->VersionString.Length != SearchExpression->VersionString.Length) ||
942 SearchExpression->VersionString.Buffer,
943 CurrentName->VersionString.Length ))) {
997 for (NextWchar =
Name->Buffer;
998 RemainingByteCount != 0;
999 NextWchar += 1, RemainingByteCount -=
sizeof(
WCHAR )) {
1006 if (*NextWchar ==
L'.') {
1018 if ((*NextWchar <
L'0') ||
1019 (*NextWchar >
L'F') ||
1020 ((*NextWchar >
L'9') && (*NextWchar <
'A'))) {
1032 if (*NextWchar <
L'A') {
1034 ResultOffset += *NextWchar -
L'0';
1038 ResultOffset += (*NextWchar -
L'A') + 10;
1048 if (*NextWchar ==
L'~') {
1055 return ResultOffset;
1093 ULONG MinLength = NameA->Length;
1104 if (NameA->Length > NameB->Length) {
1106 MinLength = NameB->Length;
1109 }
else if (NameA->Length == NameB->Length) {
1121 if (
i < MinLength) {
1127 return ((NameA->Buffer[
i / 2 ] < NameB->Buffer[
i / 2 ]) ?
NTSYSAPI VOID NTAPI RtlGenerate8dot3Name(_In_ PCUNICODE_STRING Name, _In_ BOOLEAN AllowExtendedCharacters, _Inout_ PGENERATE_NAME_CONTEXT Context, _Inout_ PUNICODE_STRING Name8dot3)
#define BYTE_COUNT_8_DOT_3
FSRTL_COMPARISON_RESULT CdFullCompareNames(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING NameA, _In_ PUNICODE_STRING NameB)
VOID CdConvertBigToLittleEndian(_In_ PIRP_CONTEXT IrpContext, _In_reads_bytes_(ByteCount) PCHAR BigEndian, _In_ ULONG ByteCount, _Out_writes_bytes_(ByteCount) PCHAR LittleEndian)
CdName VersionString Length
VOID CdDissectName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PUNICODE_STRING RemainingName, _Out_ PUNICODE_STRING FinalName)
VOID CdUpcaseName(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME Name, _Inout_ PCD_NAME UpcaseName)
BOOLEAN CdIsNameInExpression(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME CurrentName, _In_ PCD_NAME SearchExpression, _In_ ULONG WildcardFlags, _In_ BOOLEAN CheckVersion)
VOID CdGenerate8dot3Name(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING FileName, _In_ ULONG DirentOffset, _Out_writes_bytes_to_(BYTE_COUNT_8_DOT_3, *ShortByteCount) PWCHAR ShortFileName, _Out_ PUSHORT ShortByteCount)
BOOLEAN CdIsLegalName(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING FileName)
ULONG CdShortNameDirentOffset(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING Name)
BOOLEAN CdIs8dot3Name(_In_ PIRP_CONTEXT IrpContext, _In_ UNICODE_STRING FileName)
_Inout_ PFCB _Inout_ PUNICODE_STRING RemainingName
#define CdRaiseStatus(IC, S)
#define CCB_FLAG_ENUM_NAME_EXP_HAS_WILD
#define CCB_FLAG_ENUM_VERSION_EXP_HAS_WILD
#define CCB_FLAG_ENUM_VERSION_MATCH_ALL
BOOLEAN NTAPI FsRtlIsFatDbcsLegal(IN ANSI_STRING DbcsName, IN BOOLEAN WildCardsPermissible, IN BOOLEAN PathNamePermissible, IN BOOLEAN LeadingBackslashPermissible)
#define NT_SUCCESS(StatCode)
#define FsRtlIsLeadDbcsCharacter(DBCS_CHAR)
#define RtlCompareMemory(s1, s2, l)
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING ShortName
IN PDCB IN POEM_STRING OemName
#define FsRtlIsAnsiCharacterLegalHpfs(C, WILD)
enum _FSRTL_COMPARISON_RESULT FSRTL_COMPARISON_RESULT
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
VOID NTAPI RtlFreeOemString(POEM_STRING OemString)
#define Add2Ptr(PTR, INC)
#define RtlEqualMemory(dst, src, len)
#define _In_reads_bytes_(size)
#define _Out_writes_bytes_(size)
#define _Out_writes_bytes_to_(size, count)
#define _Post_satisfies_(cond)
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG _In_ ULONG Length
BOOLEAN NTAPI FsRtlIsNameInExpression(IN PUNICODE_STRING Expression, IN PUNICODE_STRING Name, IN BOOLEAN IgnoreCase, IN PWCHAR UpcaseTable OPTIONAL)
#define __analysis_assert(e)
UNICODE_STRING VersionString
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_DISK_CORRUPT_ERROR
#define STATUS_INSUFFICIENT_RESOURCES
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount