ReactOS
0.4.16-dev-109-gf4cb10f
SfcGetFiles.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS api tests
3
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4
* PURPOSE: Test for SfcGetFiles
5
* COPYRIGHT: Copyright 2018 Mark Jansen (mark.jansen@reactos.org)
6
*/
7
8
#include <
apitest.h
>
9
#include <
strsafe.h
>
10
#include <
ndk/umtypes.h
>
11
12
typedef
struct
_PROTECT_FILE_ENTRY
{
13
PWSTR
SourceFileName
;
14
PWSTR
FileName
;
15
PWSTR
InfName
;
16
}
PROTECT_FILE_ENTRY
, *
PPROTECT_FILE_ENTRY
;
17
18
NTSTATUS
(
WINAPI
*
SfcGetFiles
)(
PPROTECT_FILE_ENTRY
* ProtFileData,
PULONG
FileCount
);
19
20
PCWSTR
wszEnvVars
[] =
21
{
22
L
"%systemroot%"
,
23
L
"%commonprogramfiles%"
,
24
L
"%ProgramFiles%"
,
25
L
"%systemdrive%"
26
};
27
28
static
void
Test_GetFiles
()
29
{
30
PPROTECT_FILE_ENTRY
FileData
;
31
PCWSTR
Ptr
;
32
ULONG
FileCount
,
n
,
j
;
33
NTSTATUS
Status
;
34
35
Status
=
SfcGetFiles
(&
FileData
, &
FileCount
);
36
ok
(
NT_SUCCESS
(
Status
),
"SfcGetFiles failed: 0x%lx\n"
,
Status
);
37
38
if
(!
NT_SUCCESS
(
Status
))
39
return
;
40
41
for
(
n
= 0;
n
<
FileCount
; ++
n
)
42
{
43
PPROTECT_FILE_ENTRY
Entry
=
FileData
+
n
;
44
45
ok
(
Entry
->FileName !=
NULL
,
"Entry %lu without FileName!"
,
n
);
46
if
(
Entry
->FileName)
47
{
48
Ptr
=
NULL
;
49
for
(
j
= 0;
j
<
_countof
(
wszEnvVars
); ++
j
)
50
{
51
Ptr
=
wcsstr
(
Entry
->FileName,
wszEnvVars
[
j
]);
52
if
(
Ptr
)
53
break
;
54
}
55
ok
(
Ptr
!=
NULL
,
"Expected to find one match from wszEnvVars in %s\n"
,
wine_dbgstr_w
(
Entry
->FileName));
56
}
57
if
(
Entry
->InfName)
58
{
59
Ptr
=
wcsstr
(
Entry
->InfName,
L
".inf"
);
60
ok
(
Ptr
== (
Entry
->InfName +
wcslen
(
Entry
->InfName) - 4),
61
".inf not found in %s\n"
,
wine_dbgstr_w
(
Entry
->InfName));
62
}
63
}
64
}
65
66
START_TEST
(
SfcGetFiles
)
67
{
68
HMODULE
mod
;
69
70
mod
=
LoadLibraryA
(
"sfcfiles.dll"
);
71
if
(!
mod
)
72
{
73
skip
(
"sfcfiles.dll not found\n"
);
74
return
;
75
}
76
77
SfcGetFiles
= (
void
*)
GetProcAddress
(
mod
,
"SfcGetFiles"
);
78
ok
(
SfcGetFiles
!=
NULL
,
"Function not exported!\n"
);
79
if
(!
SfcGetFiles
)
80
return
;
81
82
Test_GetFiles
();
83
}
mod
std::map< E_MODULE, HMODULE > mod
Definition:
LocaleTests.cpp:66
PROTECT_FILE_ENTRY
struct _PROTECT_FILE_ENTRY PROTECT_FILE_ENTRY
wszEnvVars
PCWSTR wszEnvVars[]
Definition:
SfcGetFiles.c:20
FileCount
PULONG FileCount
Definition:
SfcGetFiles.c:18
Test_GetFiles
static void Test_GetFiles()
Definition:
SfcGetFiles.c:28
PPROTECT_FILE_ENTRY
struct _PROTECT_FILE_ENTRY * PPROTECT_FILE_ENTRY
apitest.h
ok
#define ok(value,...)
Definition:
atltest.h:57
skip
#define skip(...)
Definition:
atltest.h:64
START_TEST
#define START_TEST(x)
Definition:
atltest.h:75
NTSTATUS
LONG NTSTATUS
Definition:
precomp.h:26
FileData
static FILEDATA FileData[MAX_FDS]
Definition:
fs.c:51
NULL
#define NULL
Definition:
types.h:112
NT_SUCCESS
#define NT_SUCCESS(StatCode)
Definition:
apphelp.c:33
NTSTATUS
#define NTSTATUS
Definition:
precomp.h:21
GetProcAddress
#define GetProcAddress(x, y)
Definition:
compat.h:753
LoadLibraryA
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition:
loader.c:111
Ptr
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition:
fsrtlfuncs.h:898
Status
Status
Definition:
gdiplustypes.h:25
n
GLdouble n
Definition:
glext.h:7729
j
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 GLint GLint j
Definition:
glfuncs.h:250
wcslen
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
wcsstr
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
void
Definition:
nsiface.idl:2307
wine_dbgstr_w
#define wine_dbgstr_w
Definition:
kernel32.h:34
L
#define L(x)
Definition:
ntvdm.h:50
SfcGetFiles
NTSTATUS WINAPI SfcGetFiles(_Out_ PPROTECT_FILE_ENTRY *ProtFileData, _Out_ PULONG FileCount)
Definition:
sfcfiles.c:52
_countof
#define _countof(array)
Definition:
sndvol32.h:70
strsafe.h
Entry
base of all file and directory entries
Definition:
entries.h:83
_PROTECT_FILE_ENTRY
Definition:
SfcGetFiles.c:12
_PROTECT_FILE_ENTRY::FileName
PWSTR FileName
Definition:
SfcGetFiles.c:14
_PROTECT_FILE_ENTRY::InfName
PWSTR InfName
Definition:
SfcGetFiles.c:15
_PROTECT_FILE_ENTRY::SourceFileName
PWSTR SourceFileName
Definition:
SfcGetFiles.c:13
PWSTR
uint16_t * PWSTR
Definition:
typedefs.h:56
PULONG
uint32_t * PULONG
Definition:
typedefs.h:59
PCWSTR
const uint16_t * PCWSTR
Definition:
typedefs.h:57
ULONG
uint32_t ULONG
Definition:
typedefs.h:59
umtypes.h
WINAPI
#define WINAPI
Definition:
msvc.h:6
modules
rostests
apitests
sfc
SfcGetFiles.c
Generated on Wed Oct 9 2024 06:13:32 for ReactOS by
1.9.6