si tambien habia hecho un code para chequear si un archivo estaba protegido, y tambien desproteger el archivo con SetSfcFileException que lo desprotege por un minuto
y esta para desprotegerlo por un minuto:
Código (vb) [Seleccionar]
Private Declare Function SfcIsFileProtected Lib "sfc.dll" _
(ByVal hRpc As Long, _
ByVal ProtFileName As Long) As Long
Public Function IsFileProtected(ByVal strFile As String) As Boolean
Dim res As Long
res = SfcIsFileProtected(0, StrPtr(strFile))
If res = 0 Then
IsFileProtected = False
Exit Function
Else
IsFileProtected = True
Exit Function
End If
End Function
Sub Main()
If IsFileProtected("C:\windows\system32\userinit.exe") Then MsgBox "WFP Protect This File"
End Sub
y esta para desprotegerlo por un minuto:
Código (vb) [Seleccionar]
Option Explicit
Private Declare Function SfcFileException Lib "sfc_os.dll" _
Alias "#5" (ByVal dwUnknown0 As Long, _ ByVal pwszFile As Long, _
ByVal dwUnknown1 As Long) As Long
Function DisableWFP(strPath As String) As Boolean
On Error Resume Next
If SfcFileException(0, StrPtr(strPath), -1) <> 0 Then
DisableWFP = False
Exit Function
End If
'Aquí puedes colocar el code para reemplazar, eliminar o renombrar el file
DisableWFP = True
End Function