[CMAKE]
[reactos.git] / dll / win32 / sfc / sfc.c
1 /*
2 * System File Checker (Windows File Protection)
3 *
4 * Copyright 2008 Pierre Schweitzer
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "precomp.h"
22
23 HINSTANCE hLibModule;
24
25 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
26 {
27 switch (fdwReason)
28 {
29 case DLL_PROCESS_ATTACH:
30 {
31 DisableThreadLibraryCalls(hinstDLL);
32 hLibModule = hinstDLL;
33 break;
34 }
35 case DLL_PROCESS_DETACH:
36 {
37 break;
38 }
39 }
40
41 return TRUE;
42 }
43
44 DWORD WINAPI sfc_8()
45 {
46 return ERROR_CALL_NOT_IMPLEMENTED;
47 }
48
49 DWORD WINAPI sfc_9()
50 {
51 return ERROR_CALL_NOT_IMPLEMENTED;
52 }
53
54 BOOL WINAPI SRSetRestorePointA(PRESTOREPOINTINFOA pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
55 {
56 HMODULE hModule;
57 PSRSRPA pSRSRPA;
58 BOOL bStatus = FALSE;
59 LPCWSTR lpLibFileName = L"srclient.dll";
60 LPCSTR lpProcName = "SRSetRestorePointA";
61
62 hModule = LoadLibraryW(lpLibFileName);
63 if (hModule)
64 {
65 pSRSRPA = (PSRSRPA)GetProcAddress(hModule, lpProcName);
66 if (pSRSRPA)
67 {
68 bStatus = pSRSRPA(pRestorePtSpec, pSMgrStatus);
69 }
70 else
71 {
72 if (pSMgrStatus)
73 {
74 pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
75 }
76 }
77 FreeLibrary(hModule);
78 }
79 else
80 {
81 if (pSMgrStatus)
82 {
83 pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
84 }
85 }
86
87 return bStatus;
88 }
89
90 BOOL WINAPI SRSetRestorePointW(PRESTOREPOINTINFOW pRestorePtSpec, PSTATEMGRSTATUS pSMgrStatus)
91 {
92 HMODULE hModule;
93 PSRSRPW pSRSRPW;
94 BOOL bStatus = FALSE;
95 LPCWSTR lpLibFileName = L"srclient.dll";
96 LPCSTR lpProcName = "SRSetRestorePointW";
97
98 hModule = LoadLibraryW(lpLibFileName);
99 if (hModule)
100 {
101 pSRSRPW = (PSRSRPW)GetProcAddress(hModule, lpProcName);
102 if (pSRSRPW)
103 {
104 bStatus = pSRSRPW(pRestorePtSpec, pSMgrStatus);
105 }
106 else
107 {
108 if (pSMgrStatus)
109 {
110 pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
111 }
112 }
113 FreeLibrary(hModule);
114 }
115 else
116 {
117 if (pSMgrStatus)
118 {
119 pSMgrStatus->nStatus = ERROR_CALL_NOT_IMPLEMENTED;
120 }
121 }
122
123 return bStatus;
124 }
125
126 BOOL WINAPI SfpVerifyFile(LPCSTR pszFileName, LPSTR pszError, DWORD dwErrSize)
127 {
128 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
129 return FALSE;
130 }