sfc_os: (1/2) add stub for sfc_os.dll

Detlef Riekenberg wine.dev at web.de
Tue Jan 16 13:35:06 CST 2007


MS introduced "sfc.dll" (System File Checker) in Win2000,
but they moved the code to "sfc_os.dll" with WinXP.

The native importlib is for the affected API is still "sfc.lib"
There is no "sfc_os.lib" in the PSDK.
(Thanks Francois)


I copied the stub for SfcIsFileProtected from sfc.dll
and added the missing "DllMain"

The next Patch will forward sfc.dll,SfcIsFileProtected
to sfc_os.dll and remove our stub


Changelog:
- sfc_os: add stub for sfc_os.dll


-- 
 
By by ... Detlef

-------------- next part --------------
>From 0d6595aa1e9121fb76db8e62dd75a0fac68838d4 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Tue, 16 Jan 2007 19:57:06 +0100
Subject: [PATCH] sfc_os: add stub for sfc_os.dll
---
 dlls/sfc_os/Makefile.in |   12 ++++++
 dlls/sfc_os/sfc_os.c    |   87 +++++++++++++++++++++++++++++++++++++++++++++++
 dlls/sfc_os/sfc_os.spec |    2 +
 3 files changed, 101 insertions(+), 0 deletions(-)

diff --git a/dlls/sfc_os/Makefile.in b/dlls/sfc_os/Makefile.in
new file mode 100644
index 0000000..22a8ac7
--- /dev/null
+++ b/dlls/sfc_os/Makefile.in
@@ -0,0 +1,12 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = sfc_os.dll
+IMPORTS   = kernel32
+
+C_SRCS = sfc_os.c
+
+ at MAKE_DLL_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/sfc_os/sfc_os.c b/dlls/sfc_os/sfc_os.c
new file mode 100644
index 0000000..01e7862
--- /dev/null
+++ b/dlls/sfc_os/sfc_os.c
@@ -0,0 +1,87 @@
+/*
+ * Implementation of the System File Checker (Windows File Protection)
+ *
+ * Copyright 2006 Detlef Riekenberg
+ *
+ * This file contains only stubs to get the localspl.dll up and running
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "sfc.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(sfc);
+
+/******************************************************************
+ *      DllMain
+ */
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+    TRACE("(%p, %d, %p)\n",hinstDLL, fdwReason, lpvReserved);
+
+    switch(fdwReason)
+    {
+        case DLL_WINE_PREATTACH:
+            return FALSE;           /* prefer native version */
+
+        case DLL_PROCESS_ATTACH:
+            DisableThreadLibraryCalls( hinstDLL );
+            break;
+    }
+    return TRUE;
+}
+
+/******************************************************************
+ *              SfcIsFileProtected     [sfc_os.@]
+ *
+ * Check, if the given File is protected by the System
+ *
+ * PARAMS
+ *  RpcHandle    [I] This must be NULL
+ *  ProtFileName [I] Filename with Path to check
+ *
+ * RETURNS
+ *  Failure: FALSE with GetLastError() != ERROR_FILE_NOT_FOUND
+ *  Success: TRUE, when the File is Protected
+ *           FALSE with GetLastError() == ERROR_FILE_NOT_FOUND,
+ *           when the File is not Protected
+ *
+ *
+ * BUGS
+ *  We return always the Result for: "File is not Protected"
+ *
+ */
+BOOL WINAPI SfcIsFileProtected(HANDLE RpcHandle, LPCWSTR ProtFileName)
+{
+    static BOOL reported = FALSE;
+
+    if (reported) {
+        TRACE("(%p, %s) stub\n", RpcHandle, debugstr_w(ProtFileName));
+    }
+    else
+    {
+        FIXME("(%p, %s) stub\n", RpcHandle, debugstr_w(ProtFileName));
+        reported = TRUE;
+    }
+
+    SetLastError(ERROR_FILE_NOT_FOUND);
+    return FALSE;
+}
diff --git a/dlls/sfc_os/sfc_os.spec b/dlls/sfc_os/sfc_os.spec
new file mode 100644
index 0000000..bd71d4d
--- /dev/null
+++ b/dlls/sfc_os/sfc_os.spec
@@ -0,0 +1,2 @@
+@ stub SfcGetNextProtectedFile
+@ stdcall SfcIsFileProtected(ptr wstr)
-- 
1.4.1



More information about the wine-patches mailing list