2 * System File Checker (Windows File Protection)
4 * Copyright 2008 Pierre Schweitzer
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.
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.
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
26 typedef struct _PROTECTED_FILE_DATA
28 WCHAR FileName
[MAX_PATH
];
30 } PROTECTED_FILE_DATA
, *PPROTECTED_FILE_DATA
;
33 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
37 case DLL_PROCESS_ATTACH
:
39 DisableThreadLibraryCalls(hinstDLL
);
40 hLibModule
= hinstDLL
;
43 case DLL_PROCESS_DETACH
:
53 /******************************************************************
54 * SfcIsFileProtected [sfc_os.@]
56 * Check, if the given File is protected by the System
59 * RpcHandle [I] This must be NULL
60 * ProtFileName [I] Filename with Path to check
63 * Failure: FALSE with GetLastError() != ERROR_FILE_NOT_FOUND
64 * Success: TRUE, when the File is Protected
65 * FALSE with GetLastError() == ERROR_FILE_NOT_FOUND,
66 * when the File is not Protected
70 * We return always the Result for: "File is not Protected"
73 BOOL WINAPI
SfcIsFileProtected(HANDLE RpcHandle
, LPCWSTR ProtFileName
)
75 static BOOL reported
= FALSE
;
78 DPRINT("(%p, %S) stub\n", RpcHandle
, ProtFileName
);
82 DPRINT1("(%p, %S) stub\n", RpcHandle
, ProtFileName
);
86 SetLastError(ERROR_FILE_NOT_FOUND
);
90 /******************************************************************
91 * SfcIsKeyProtected [sfc_os.@]
93 * Check, if the given Registry Key is protected by the System
96 * hKey [I] Handle to the root registry key
97 * lpSubKey [I] Name of the subkey to check
98 * samDesired [I] The Registry View to Examine (32 or 64 bit)
101 * Failure: FALSE with GetLastError() != ERROR_FILE_NOT_FOUND
102 * Success: TRUE, when the Key is Protected
103 * FALSE with GetLastError() == ERROR_FILE_NOT_FOUND,
104 * when the Key is not Protected
107 BOOL WINAPI
SfcIsKeyProtected(HKEY hKey
, LPCWSTR lpSubKey
, REGSAM samDesired
)
109 static BOOL reported
= FALSE
;
112 DPRINT("(%p, %S) stub\n", hKey
, lpSubKey
);
116 DPRINT1("(%p, %S) stub\n", hKey
, lpSubKey
);
121 SetLastError(ERROR_INVALID_HANDLE
);
125 SetLastError(ERROR_FILE_NOT_FOUND
);
129 /******************************************************************
130 * SfcGetNextProtectedFile [sfc_os.@]
132 BOOL WINAPI
SfcGetNextProtectedFile(HANDLE RpcHandle
, PPROTECTED_FILE_DATA ProtFileData
)
136 SetLastError(ERROR_INVALID_PARAMETER
);
141 SetLastError(ERROR_NO_MORE_FILES
);