ReactOS  0.4.14-dev-98-gb0d4763
FsRtlLegal.c File Reference
#include <kmt_test.h>
Include dependency graph for FsRtlLegal.c:

Go to the source code of this file.

Functions

 START_TEST (FsRtlLegal)
 

Variables

struct {
   PCSTR   Dbcs
 
   BOOLEAN   LegalFat
 
   BOOLEAN   LegalHpfs
 
   BOOLEAN   HasWildCards
 
   BOOLEAN   IsPath
 
   BOOLEAN   LeadingBackslash
 
NamesTests []
 
static const UCHAR LegalAnsiCharacterArray []
 

Function Documentation

◆ START_TEST()

START_TEST ( FsRtlLegal  )

Definition at line 236 of file FsRtlLegal.c.

237 {
238  ULONG i;
239  BOOLEAN Result;
240  ANSI_STRING DbcsName;
241  ULONG Flags;
242 
243  for (i = 0; i < RTL_NUMBER_OF(NamesTests); i++)
244  {
245  RtlInitAnsiString(&DbcsName, NamesTests[i].Dbcs);
246  for (Flags = 0; Flags < 8; Flags++)
247  {
248  Result = FsRtlIsFatDbcsLegal(DbcsName,
249  BooleanFlagOn(Flags, 1),
250  BooleanFlagOn(Flags, 2),
251  BooleanFlagOn(Flags, 4));
252  if (NamesTests[i].HasWildCards && !FlagOn(Flags, 1))
253  ok(Result == FALSE, "[%s] Result = %u but has wildcards\n", NamesTests[i].Dbcs, Result);
254  else if (NamesTests[i].IsPath && !FlagOn(Flags, 2))
255  ok(Result == FALSE, "[%s] Result = %u but is path\n", NamesTests[i].Dbcs, Result);
256  else if (NamesTests[i].LeadingBackslash && !FlagOn(Flags, 4))
257  ok(Result == FALSE, "[%s] Result = %u but has leading backslash\n", NamesTests[i].Dbcs, Result);
258  else if (!NamesTests[i].LegalFat)
259  ok(Result == FALSE, "[%s] Result = %u but is NOT legal FAT\n", NamesTests[i].Dbcs, Result);
260  else
261  ok(Result == TRUE, "[%s] Result = %u but IS legal FAT\n", NamesTests[i].Dbcs, Result);
262 
263  Result = FsRtlIsHpfsDbcsLegal(DbcsName,
264  BooleanFlagOn(Flags, 1),
265  BooleanFlagOn(Flags, 2),
266  BooleanFlagOn(Flags, 4));
267  if (NamesTests[i].HasWildCards && !FlagOn(Flags, 1))
268  ok(Result == FALSE, "[%s] Result = %u but has wildcards\n", NamesTests[i].Dbcs, Result);
269  else if (NamesTests[i].IsPath && !FlagOn(Flags, 2))
270  ok(Result == FALSE, "[%s] Result = %u but is path\n", NamesTests[i].Dbcs, Result);
271  else if (NamesTests[i].LeadingBackslash && !FlagOn(Flags, 4))
272  ok(Result == FALSE, "[%s] Result = %u but has leading backslash\n", NamesTests[i].Dbcs, Result);
273  else if (!NamesTests[i].LegalHpfs)
274  ok(Result == FALSE, "[%s] Result = %u but is NOT legal HPFS\n", NamesTests[i].Dbcs, Result);
275  else
276  ok(Result == TRUE, "[%s] Result = %u but IS legal HPFS\n", NamesTests[i].Dbcs, Result);
277  }
278  }
279 
280  for (i = 0; i <= 0x7f; ++i)
281  {
283  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, LegalAnsiCharacterArray[i], (*FsRtlLegalAnsiCharacterArray)[i]);
284 
286  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, FsRtlIsAnsiCharacterWild(i), BooleanFlagOn(LegalAnsiCharacterArray[i], FSRTL_WILD_CHARACTER));
287 
289  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, FsRtlIsAnsiCharacterLegalFat(i, FALSE), BooleanFlagOn(LegalAnsiCharacterArray[i], FSRTL_FAT_LEGAL));
291  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, FsRtlIsAnsiCharacterLegalFat(i, TRUE),
293 
295  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, FsRtlIsAnsiCharacterLegalHpfs(i, FALSE), BooleanFlagOn(LegalAnsiCharacterArray[i], FSRTL_HPFS_LEGAL));
297  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, FsRtlIsAnsiCharacterLegalHpfs(i, TRUE),
299 
301  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, FsRtlIsAnsiCharacterLegalNtfs(i, FALSE), BooleanFlagOn(LegalAnsiCharacterArray[i], FSRTL_NTFS_LEGAL));
303  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, FsRtlIsAnsiCharacterLegalNtfs(i, TRUE),
305 
307  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, FsRtlIsAnsiCharacterLegalNtfsStream(i, FALSE), BooleanFlagOn(LegalAnsiCharacterArray[i], FSRTL_NTFS_STREAM_LEGAL));
309  "Mismatching value for 0x%x: 0x%x (exp) - 0x%x (got)\n", i, FsRtlIsAnsiCharacterLegalNtfsStream(i, TRUE),
311  }
312 }
#define TRUE
Definition: types.h:120
#define FSRTL_NTFS_LEGAL
Definition: fsrtltypes.h:84
const UCHAR *const FsRtlLegalAnsiCharacterArray
Definition: fsrtlpc.c:154
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define FSRTL_HPFS_LEGAL
Definition: fsrtltypes.h:83
#define FSRTL_FAT_LEGAL
Definition: fsrtltypes.h:82
BOOLEAN LeadingBackslash
Definition: FsRtlLegal.c:18
#define FsRtlIsAnsiCharacterWild(C)
Definition: fsrtlfuncs.h:1608
BOOLEAN NTAPI FsRtlIsHpfsDbcsLegal(IN ANSI_STRING DbcsName, IN BOOLEAN WildCardsPermissible, IN BOOLEAN PathNamePermissible, IN BOOLEAN LeadingBackslashPermissible)
Definition: dbcsname.c:638
#define FSRTL_NTFS_STREAM_LEGAL
Definition: fsrtltypes.h:87
BOOLEAN LegalHpfs
Definition: FsRtlLegal.c:15
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
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
Definition: glfuncs.h:248
#define FsRtlIsAnsiCharacterLegalNtfsStream(C, WILD_OK)
Definition: fsrtlfuncs.h:1620
PCSTR Dbcs
Definition: FsRtlLegal.c:13
unsigned char BOOLEAN
_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
Definition: wsk.h:426
#define FsRtlIsAnsiCharacterLegalHpfs(C, WILD)
Definition: fsrtlfuncs.h:1614
BOOLEAN LegalFat
Definition: FsRtlLegal.c:14
#define FsRtlIsAnsiCharacterLegalFat(C, WILD)
Definition: fsrtlfuncs.h:1611
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
BOOLEAN HasWildCards
Definition: FsRtlLegal.c:16
BOOLEAN NTAPI FsRtlIsFatDbcsLegal(IN ANSI_STRING DbcsName, IN BOOLEAN WildCardsPermissible, IN BOOLEAN PathNamePermissible, IN BOOLEAN LeadingBackslashPermissible)
Definition: dbcsname.c:466
static struct @1577 NamesTests[]
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN IsPath
Definition: FsRtlLegal.c:17
static const UCHAR LegalAnsiCharacterArray[]
Definition: FsRtlLegal.c:104
#define FSRTL_WILD_CHARACTER
Definition: fsrtltypes.h:85
#define FsRtlIsAnsiCharacterLegalNtfs(C, WILD)
Definition: fsrtlfuncs.h:1617

Variable Documentation

◆ Dbcs

PCSTR Dbcs

Definition at line 13 of file FsRtlLegal.c.

Referenced by START_TEST().

◆ HasWildCards

BOOLEAN HasWildCards

Definition at line 16 of file FsRtlLegal.c.

Referenced by START_TEST().

◆ IsPath

BOOLEAN IsPath

Definition at line 17 of file FsRtlLegal.c.

Referenced by START_TEST().

◆ LeadingBackslash

BOOLEAN LeadingBackslash

Definition at line 18 of file FsRtlLegal.c.

Referenced by START_TEST().

◆ LegalAnsiCharacterArray

const UCHAR LegalAnsiCharacterArray[]
static

Definition at line 104 of file FsRtlLegal.c.

Referenced by START_TEST().

◆ LegalFat

BOOLEAN LegalFat

Definition at line 14 of file FsRtlLegal.c.

Referenced by START_TEST().

◆ LegalHpfs

BOOLEAN LegalHpfs

Definition at line 15 of file FsRtlLegal.c.

Referenced by START_TEST().

◆ NamesTests

struct { ... } NamesTests[]

Referenced by START_TEST().