ReactOS 0.4.16-dev-297-gc569aee
IsValidInstallDirectory.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Setup Library - Unit-tests
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Test for IsValidInstallDirectory
5 * COPYRIGHT: Copyright 2024 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
6 */
7
8#include "precomp.h"
9
10//
11// FIXME: Temporary symbols defined to make linking work.
12// They will be defined to something once INF file testing is implemented.
13//
24
27
28
30{
31 static const struct
32 {
35 } tests[] =
36 {
37 { L"", FALSE },
38 { L" ", FALSE },
39 { L"\\", FALSE },
40 { L"\\\\", FALSE },
41 { L".", FALSE },
42 { L"..", FALSE },
43 { L"...", FALSE },
44 { L"....", FALSE },
45 { L" WINNT", FALSE },
46 { L"WINNT ", FALSE },
47 { L".WINNT", FALSE },
48 { L"..WINNT", FALSE },
49 { L"W.INNT", FALSE },
50 { L"WI.NNT", TRUE },
51 { L"WIN.NT", TRUE },
52 { L"WINNT.", TRUE },
53 { L"WINNT..", FALSE },
54 { L"WINNT. ", FALSE },
55 { L"WINNT.e e", FALSE },
56 { L"WIN^`NT", FALSE },
57
58 { L"WINNT", TRUE },
59 { L"\\WINNT", TRUE },
60 { L"\\WINNT\\", TRUE },
61 { L"\\WINNT\\.", FALSE },
62 { L"WIN\\NT", TRUE },
63 { L"WIN\\NT.", TRUE },
64 { L"\\WIN\\NT\\", TRUE },
65 { L"\\WIN\\NT.\\", TRUE },
66 { L"\\WIN.\\NT52", TRUE },
67 { L"\\WIN\\.\\NT52", FALSE },
68 { L"\\WIN\\..\\NT52", FALSE },
69 { L"\\WIN\\...\\NT52", FALSE },
70 { L"\\WIN\\....\\NT52", FALSE },
71
72 { L"win.nt.5", FALSE },
73 { L"win.ntX5", FALSE },
74 { L"winn.tX5", TRUE },
75 { L"winnt.X5", TRUE },
76 { L"winntX.5", TRUE },
77 { L"winntX5.", TRUE },
78 { L"filenamee.xte", FALSE },
79 { L"filenamee.xt", FALSE },
80 { L"filename.ext", TRUE },
81 { L"file.ame.ext", FALSE },
82 { L"filenam.eext", FALSE },
83
84 { L"1 3 5 7 .abc", FALSE },
85 { L"12345678. c", FALSE },
86 { L"123456789.a", FALSE },
87 { L"12345.abcd", FALSE },
88 { L"12345.ab d", FALSE },
89 { L".abc", FALSE },
90 { L"12.abc.d", FALSE },
91 { L"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", FALSE },
92 };
93
94#define BOOL_TO_STR(b) ((b) ? "TRUE" : "FALSE")
95
97
98 UINT i;
99 for (i = 0; i < _countof(tests); ++i)
100 {
102 ok(ret == tests[i].result,
103 "Unexpected result for '%S', got %s, expected %s\n",
105 }
106
107#undef BOOL_TO_STR
108}
109
110/* EOF */
pSpInfGetBinaryField SpInfGetBinaryField
pSpInfGetMultiSzField SpInfGetMultiSzField
HANDLE ProcessHeap
#define BOOL_TO_STR(b)
pSpInfGetStringField SpInfGetStringField
pSpInfGetFieldCount SpInfGetFieldCount
pSpInfFindNextLine SpInfFindNextLine
pSpInfGetIntField SpInfGetIntField
pSpInfFindFirstLine SpInfFindFirstLine
pSpInfOpenInfFile SpInfOpenInfFile
BOOLEAN IsUnattendedSetup
pSpInfCloseInfFile SpInfCloseInfFile
pSpInfGetField SpInfGetField
unsigned char BOOLEAN
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
GLuint64EXT * result
Definition: glext.h:11304
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
ULONG(WINAPI * pSpInfGetFieldCount)(IN PINFCONTEXT Context)
Definition: infsupp.h:85
HINF(WINAPI * pSpInfOpenInfFile)(IN PCWSTR FileName, IN PCWSTR InfClass, IN DWORD InfStyle, IN LCID LocaleId, OUT PUINT ErrorLine)
Definition: infsupp.h:143
BOOL(WINAPI * pSpInfGetStringField)(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.h:123
BOOL(WINAPI * pSpInfGetMultiSzField)(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.h:112
BOOL(WINAPI * pSpInfFindFirstLine)(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.h:67
BOOL(WINAPI * pSpInfGetIntField)(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.h:103
VOID(WINAPI * pSpInfCloseInfFile)(IN HINF InfHandle)
Definition: infsupp.h:60
PCWSTR(WINAPI * pSpInfGetField)(IN PINFCONTEXT Context, IN ULONG FieldIndex)
Definition: infsupp.h:134
BOOL(WINAPI * pSpInfGetBinaryField)(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PUCHAR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.h:92
BOOL(WINAPI * pSpInfFindNextLine)(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.h:77
static struct test_info tests[]
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
BOOLEAN IsValidInstallDirectory(_In_ PCWSTR InstallDir)
Verify whether the given directory is suitable for ReactOS installation. Each path component must be ...
Definition: setuplib.c:771
#define _countof(array)
Definition: sndvol32.h:70
const uint16_t * PCWSTR
Definition: typedefs.h:57
int ret