Primary implementation of sfc.dll. To have it "fully" working, sfc_os.dll is will be needed.

It does nothing more. Don't shout, Fireball agreed for commit ;).

svn path=/trunk/; revision=35813
This commit is contained in:
Pierre Schweitzer 2008-08-30 18:53:27 +00:00
parent 48d386505a
commit d44a0a0009
8 changed files with 239 additions and 0 deletions

View file

@ -148,6 +148,7 @@
<property name="BASEADDRESS_RASDLG" value="0x768d0000" />
<property name="BASEADDRESS_GDIPLUS" value="0x76a00000" />
<property name="BASEADDRESS_ATL" value="0x76a80000" />
<property name="BASEADDRESS_SFC" value="0x76b50000" />
<property name="BASEADDRESS_WINTRUST" value="0x76c30000" />
<property name="BASEADDRESS_IMAGEHLP" value="0x76c90000" />
<property name="BASEADDRESS_CLUSAPI" value="0x76d10000" />

View file

@ -320,6 +320,7 @@ dll\win32\security\security.dll 1
dll\win32\sensapi\sensapi.dll 1
dll\win32\serialui\serialui.dll 1
dll\win32\setupapi\setupapi.dll 1
dll\win32\sfc\sfc.dll 1
dll\win32\shdocvw\shdocvw.dll 1
dll\win32\shell32\shell32.dll 1
dll\win32\shfolder\shfolder.dll 1

View file

@ -0,0 +1,14 @@
#ifndef _PRECOMP_H__
#define _PRECOMP_H__
#include <windows.h>
#include <sfc.h>
#include <srrestoreptapi.h>
DWORD WINAPI sfc_8();
DWORD WINAPI sfc_9();
typedef BOOL (WINAPI *PSRSRPA)(PRESTOREPOINTINFOA, PSTATEMGRSTATUS);
typedef BOOL (WINAPI *PSRSRPW)(PRESTOREPOINTINFOW, PSTATEMGRSTATUS);
#endif

130
reactos/dll/win32/sfc/sfc.c Normal file
View file

@ -0,0 +1,130 @@
/*
* System File Checker (Windows File Protection)
*
* Copyright 2008 Pierre Schweitzer
*
* 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 "precomp.h"
HINSTANCE hLibModule;
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls(hinstDLL);
hLibModule = hinstDLL;
break;
}
case DLL_PROCESS_DETACH:
{
break;
}
}
return TRUE;
}
DWORD WINAPI sfc_8()
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
DWORD WINAPI sfc_9()
{
return ERROR_CALL_NOT_IMPLEMENTED;
}
BOOL WINAPI SRSetRestorePointA(PRESTOREPOINTINFOA pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
{
HMODULE hModule;
PSRSRPA pSRSRPA;
BOOL bStatus = FALSE;
LPCWSTR lpLibFileName = L"srclient.dll";
LPCSTR lpProcName = "SRSetRestorePointA";
hModule = LoadLibraryW(lpLibFileName);
if (hModule)
{
pSRSRPA = (PSRSRPA)GetProcAddress(hModule, lpProcName);
if (pSRSRPA)
{
bStatus = pSRSRPA(pRestorePtSpec, pSMgrStatus);
}
else
{
if (pSMgrStatus)
{
pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
}
}
FreeLibrary(hModule);
}
else
{
if (pSMgrStatus)
{
pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
}
}
return bStatus;
}
BOOL WINAPI SRSetRestorePointW(PRESTOREPOINTINFOW pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
{
HMODULE hModule;
PSRSRPW pSRSRPW;
BOOL bStatus = FALSE;
LPCWSTR lpLibFileName = L"srclient.dll";
LPCSTR lpProcName = "SRSetRestorePointW";
hModule = LoadLibraryW(lpLibFileName);
if (hModule)
{
pSRSRPW = (PSRSRPW)GetProcAddress(hModule, lpProcName);
if (pSRSRPW)
{
bStatus = pSRSRPW(pRestorePtSpec, pSMgrStatus);
}
else
{
if (pSMgrStatus)
{
pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
}
}
FreeLibrary(hModule);
}
else
{
if (pSMgrStatus)
{
pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
}
}
return bStatus;
}
BOOL WINAPI SfpVerifyFile(LPCSTR pszFileName, LPSTR pszError, DWORD dwErrSize)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}

View file

@ -0,0 +1,8 @@
<module name="sfc" type="win32dll" baseaddress="${BASEADDRESS_SFC}" installbase="system32" installname="sfc.dll" allowwarnings="yes">
<importlibrary definition="sfc.spec.def" />
<include base="sfc">.</include>
<library>kernel32</library>
<file>sfc.c</file>
<file>sfc.spec</file>
<pch>precomp.h</pch>
</module>

View file

@ -0,0 +1,18 @@
@ stub sfc_1
@ stub sfc_2
@ stub sfc_3
@ stub sfc_4
@ stub sfc_5
@ stub sfc_6
@ stub sfc_7
@ stdcall sfc_8 ()
@ stdcall sfc_9 ()
@ stdcall SRSetRestorePoint (ptr ptr) SRSetRestorePointA
@ stdcall SRSetRestorePointA (ptr ptr)
@ stdcall SRSetRestorePointW (ptr ptr)
@ stub SfcGetNextProtectedFile
@ stub SfcIsFileProtected
@ stub SfcWLEventLogoff
@ stub SfcWLEventLogon
@ stdcall SfpVerifyFile (ptr ptr long)
@ stdcall start (long long ptr) DllMain

View file

@ -295,6 +295,9 @@
<directory name="setupapi">
<xi:include href="setupapi/setupapi.rbuild" />
</directory>
<directory name="sfc">
<xi:include href="sfc/sfc.rbuild" />
</directory>
<directory name="shdocvw">
<xi:include href="shdocvw/shdocvw.rbuild" />
</directory>

View file

@ -0,0 +1,64 @@
/*
* Definitions for the System File Checker (Windows File Protection)
*
* Copyright 2008 Pierre Schweitzer
*
* 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
*/
#ifndef _SRRESTOREPTAPI_H
#define _SRRESTOREPTAPI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Defines */
#define MAX_DESC 64
#define MAX_DESC_W 256
/* Types */
typedef struct _RESTOREPTINFOA {
DWORD dwEventType;
DWORD dwRestorePtType;
INT64 llSequenceNumber;
CHAR szDescription[MAX_DESC];
} RESTOREPOINTINFOA, *PRESTOREPOINTINFOA;
typedef struct _RESTOREPTINFOW {
DWORD dwEventType;
DWORD dwRestorePtType;
INT64 llSequenceNumber;
WCHAR szDescription[MAX_DESC_W];
} RESTOREPOINTINFOW, *PRESTOREPOINTINFOW;
typedef struct _SMGRSTATUS {
DWORD nStatus;
INT64 llSequenceNumber;
} STATEMGRSTATUS, *PSTATEMGRSTATUS;
/* Functions */
BOOL WINAPI SRSetRestorePointA(PRESTOREPOINTINFOA, PSTATEMGRSTATUS);
BOOL WINAPI SRSetRestorePointW(PRESTOREPOINTINFOW, PSTATEMGRSTATUS);
DWORD WINAPI SRRemoveRestorePoint(DWORD);
#ifdef __cplusplus
}
#endif
#endif