Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensfc_os.c
Go to the documentation of this file.
00001 /* 00002 * System File Checker (Windows File Protection) 00003 * 00004 * Copyright 2008 Pierre Schweitzer 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include "precomp.h" 00022 #include "debug.h" 00023 00024 HINSTANCE hLibModule; 00025 00026 typedef struct _PROTECTED_FILE_DATA 00027 { 00028 WCHAR FileName[MAX_PATH]; 00029 DWORD FileNumber; 00030 } PROTECTED_FILE_DATA, *PPROTECTED_FILE_DATA; 00031 00032 00033 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 00034 { 00035 switch (fdwReason) 00036 { 00037 case DLL_PROCESS_ATTACH: 00038 { 00039 DisableThreadLibraryCalls(hinstDLL); 00040 hLibModule = hinstDLL; 00041 break; 00042 } 00043 case DLL_PROCESS_DETACH: 00044 { 00045 break; 00046 } 00047 } 00048 00049 return TRUE; 00050 } 00051 00052 00053 /****************************************************************** 00054 * SfcIsFileProtected [sfc_os.@] 00055 * 00056 * Check, if the given File is protected by the System 00057 * 00058 * PARAMS 00059 * RpcHandle [I] This must be NULL 00060 * ProtFileName [I] Filename with Path to check 00061 * 00062 * RETURNS 00063 * Failure: FALSE with GetLastError() != ERROR_FILE_NOT_FOUND 00064 * Success: TRUE, when the File is Protected 00065 * FALSE with GetLastError() == ERROR_FILE_NOT_FOUND, 00066 * when the File is not Protected 00067 * 00068 * 00069 * BUGS 00070 * We return always the Result for: "File is not Protected" 00071 * 00072 */ 00073 BOOL WINAPI SfcIsFileProtected(HANDLE RpcHandle, LPCWSTR ProtFileName) 00074 { 00075 static BOOL reported = FALSE; 00076 00077 if (reported) { 00078 DPRINT("(%p, %S) stub\n", RpcHandle, ProtFileName); 00079 } 00080 else 00081 { 00082 DPRINT1("(%p, %S) stub\n", RpcHandle, ProtFileName); 00083 reported = TRUE; 00084 } 00085 00086 SetLastError(ERROR_FILE_NOT_FOUND); 00087 return FALSE; 00088 } 00089 00090 /****************************************************************** 00091 * SfcIsKeyProtected [sfc_os.@] 00092 * 00093 * Check, if the given Registry Key is protected by the System 00094 * 00095 * PARAMS 00096 * hKey [I] Handle to the root registry key 00097 * lpSubKey [I] Name of the subkey to check 00098 * samDesired [I] The Registry View to Examine (32 or 64 bit) 00099 * 00100 * RETURNS 00101 * Failure: FALSE with GetLastError() != ERROR_FILE_NOT_FOUND 00102 * Success: TRUE, when the Key is Protected 00103 * FALSE with GetLastError() == ERROR_FILE_NOT_FOUND, 00104 * when the Key is not Protected 00105 * 00106 */ 00107 BOOL WINAPI SfcIsKeyProtected(HKEY hKey, LPCWSTR lpSubKey, REGSAM samDesired) 00108 { 00109 static BOOL reported = FALSE; 00110 00111 if (reported) { 00112 DPRINT("(%p, %S) stub\n", hKey, lpSubKey); 00113 } 00114 else 00115 { 00116 DPRINT1("(%p, %S) stub\n", hKey, lpSubKey); 00117 reported = TRUE; 00118 } 00119 00120 if( !hKey ) { 00121 SetLastError(ERROR_INVALID_HANDLE); 00122 return FALSE; 00123 } 00124 00125 SetLastError(ERROR_FILE_NOT_FOUND); 00126 return FALSE; 00127 } 00128 00129 /****************************************************************** 00130 * SfcGetNextProtectedFile [sfc_os.@] 00131 */ 00132 BOOL WINAPI SfcGetNextProtectedFile(HANDLE RpcHandle, PPROTECTED_FILE_DATA ProtFileData) 00133 { 00134 if (!ProtFileData) 00135 { 00136 SetLastError(ERROR_INVALID_PARAMETER); 00137 return FALSE; 00138 } 00139 00140 UNIMPLEMENTED; 00141 SetLastError(ERROR_NO_MORE_FILES); 00142 return FALSE; 00143 } 00144 00145 /****************************************************************** 00146 * SfcFileException [sfc_os.@] 00147 * 00148 * Disable the protection for the given file during one minute 00149 * 00150 * PARAMS 00151 * dwUnknown0 [I] Set to 0 00152 * pwszFile [I] Name of the file to unprotect 00153 * dwUnknown1 [I] Set to -1 00154 * 00155 * RETURNS 00156 * Failure: 1; 00157 * Success: 0; 00158 * 00159 */ 00160 DWORD WINAPI SfcFileException(DWORD dwUnknown0, PWCHAR pwszFile, DWORD dwUnknown1) 00161 { 00162 UNIMPLEMENTED; 00163 /* Always return success */ 00164 return 0; 00165 } Generated on Sun May 27 2012 04:26:13 for ReactOS by
1.7.6.1
|