https://git.reactos.org/?p=reactos.git;a=commitdiff;h=085f135f1a1f27e4e439eb99454408ef62bc57dd

commit 085f135f1a1f27e4e439eb99454408ef62bc57dd
Author:     Eric Kohl <[email protected]>
AuthorDate: Sat Jan 22 13:28:50 2022 +0100
Commit:     Eric Kohl <[email protected]>
CommitDate: Sat Jan 22 13:28:50 2022 +0100

    [SFCFILES] Add sfcfiles dll and header file
    
    Sfcfiles.dll contains only a short list of protected files (WIP).
---
 dll/win32/CMakeLists.txt          |  1 +
 dll/win32/sfcfiles/CMakeLists.txt | 10 +++++++
 dll/win32/sfcfiles/sfcfiles.c     | 59 +++++++++++++++++++++++++++++++++++++++
 dll/win32/sfcfiles/sfcfiles.rc    |  5 ++++
 dll/win32/sfcfiles/sfcfiles.spec  |  1 +
 sdk/include/psdk/sfcfiles.h       | 25 +++++++++++++++++
 6 files changed, 101 insertions(+)

diff --git a/dll/win32/CMakeLists.txt b/dll/win32/CMakeLists.txt
index c0238ebeea5..d596b912ab0 100644
--- a/dll/win32/CMakeLists.txt
+++ b/dll/win32/CMakeLists.txt
@@ -184,6 +184,7 @@ add_subdirectory(serialui)
 add_subdirectory(setupapi)
 add_subdirectory(sfc)
 add_subdirectory(sfc_os)
+add_subdirectory(sfcfiles)
 add_subdirectory(shdoclc)
 add_subdirectory(shdocvw)
 add_subdirectory(shell32)
diff --git a/dll/win32/sfcfiles/CMakeLists.txt 
b/dll/win32/sfcfiles/CMakeLists.txt
new file mode 100644
index 00000000000..0cd46689e87
--- /dev/null
+++ b/dll/win32/sfcfiles/CMakeLists.txt
@@ -0,0 +1,10 @@
+spec2def(sfcfiles.dll sfcfiles.spec)
+
+list(APPEND SOURCE
+    sfcfiles.c
+    ${CMAKE_CURRENT_BINARY_DIR}/sfcfiles.def)
+
+add_library(sfcfiles MODULE ${SOURCE})
+set_module_type(sfcfiles win32dll)
+add_importlibs(sfcfiles msvcrt kernel32 ntdll)
+add_cd_file(TARGET sfcfiles DESTINATION reactos/system32 FOR all)
diff --git a/dll/win32/sfcfiles/sfcfiles.c b/dll/win32/sfcfiles/sfcfiles.c
new file mode 100644
index 00000000000..da329e8c7c5
--- /dev/null
+++ b/dll/win32/sfcfiles/sfcfiles.c
@@ -0,0 +1,59 @@
+/*
+ * PROJECT:     ReactOS System File Checker
+ * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
+ * FILE:        dll/win32/sfcfiles/sfcfiles.c
+ * PURPOSE:     List of protected files
+ * PROGRAMMERS: Copyright 2022 Eric Kohl ([email protected])
+ */
+
+#define WIN32_NO_STATUS
+#include <windef.h>
+#include <winbase.h>
+#include <ndk/umtypes.h>
+#include <sfcfiles.h>
+
+
+static
+PROTECT_FILE_ENTRY
+ProtectedFiles[] =
+{
+    {NULL, L"%systemroot%\\system32\\advapi32.dll", NULL},
+    {NULL, L"%systemroot%\\system32\\comctl32.dll", NULL},
+    {NULL, L"%systemroot%\\system32\\comdlg32.dll", NULL},
+    {NULL, L"%systemroot%\\system32\\kernel32.dll", NULL},
+    {NULL, L"%systemroot%\\system32\\ntdll.dll", NULL},
+    {NULL, L"%systemroot%\\system32\\ntoskrnl.exe", NULL}
+};
+
+
+BOOL
+WINAPI
+DllMain(
+    _In_ HINSTANCE hInstDLL,
+    _In_ DWORD fdwReason,
+    _In_ LPVOID lpvReserved)
+{
+    switch (fdwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            DisableThreadLibraryCalls(hInstDLL);
+            break;
+
+        case DLL_PROCESS_DETACH:
+            break;
+    }
+
+    return TRUE;
+}
+
+
+NTSTATUS
+WINAPI
+SfcGetFiles(
+    _Out_ PPROTECT_FILE_ENTRY *ProtFileData,
+    _Out_ PULONG FileCount)
+{
+    *ProtFileData = ProtectedFiles;
+    *FileCount = ARRAYSIZE(ProtectedFiles);
+    return STATUS_SUCCESS;
+}
diff --git a/dll/win32/sfcfiles/sfcfiles.rc b/dll/win32/sfcfiles/sfcfiles.rc
new file mode 100644
index 00000000000..ddcb33c079f
--- /dev/null
+++ b/dll/win32/sfcfiles/sfcfiles.rc
@@ -0,0 +1,5 @@
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION  "System File Checker Files"
+#define REACTOS_STR_INTERNAL_NAME     "sfcfiles"
+#define REACTOS_STR_ORIGINAL_FILENAME "sfcfiles.dll"
+#include <reactos/version.rc>
diff --git a/dll/win32/sfcfiles/sfcfiles.spec b/dll/win32/sfcfiles/sfcfiles.spec
new file mode 100644
index 00000000000..a4d118834df
--- /dev/null
+++ b/dll/win32/sfcfiles/sfcfiles.spec
@@ -0,0 +1 @@
+@ stdcall SfcGetFiles(ptr ptr)
diff --git a/sdk/include/psdk/sfcfiles.h b/sdk/include/psdk/sfcfiles.h
new file mode 100644
index 00000000000..b7a03179058
--- /dev/null
+++ b/sdk/include/psdk/sfcfiles.h
@@ -0,0 +1,25 @@
+#ifndef __SFCFILES_H
+#define __SFCFILES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _PROTECT_FILE_ENTRY
+{
+    PWSTR SourceFileName;
+    PWSTR FileName;
+    PWSTR InfName;
+} PROTECT_FILE_ENTRY, *PPROTECT_FILE_ENTRY;
+
+NTSTATUS
+WINAPI
+SfcGetFiles(
+    _Out_ PPROTECT_FILE_ENTRY *ProtFileData,
+    _Out_ PULONG FileCount);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Reply via email to