Click to Rate and Give Feedback
MSDN
MSDN Library
WRP Functions
 SfcIsFileProtected Function

  Switch on low bandwidth view
SfcIsFileProtected Function

Determines whether the specified file is protected. Applications should avoid replacing protected system files.

Syntax

C++
BOOL SfcIsFileProtected(
  __in  HANDLE RpcHandle,
  __in  LPCWSTR ProtFileName
);

Parameters

RpcHandle [in]

This parameter must be NULL.

ProtFileName [in]

The name of the file.

Return Value

If the file is protected, the return value is a nonzero value.

If the file is not protected, the return value is zero.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderSfc.h
LibrarySfc.lib
DLLSfc.dll

See Also

SfcIsKeyProtected

Build date: 6/4/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
vb.net example      dmex   |   Edit   |   Show History
Example: Messagebox.Show(WRPDisplayFileProtectionStatus("C:\Windows\explorer.exe"))

<DllImport("sfc.dll")> Public Shared Function SfcIsFileProtected(ByVal hRpc As Integer, ByVal ProtFileName As IntPtr) As Boolean
End Function

Public Shared Function WRPDisplayFileProtectionStatus(ByVal Filename As String) As String 
If SfcIsFileProtected(0, Marshal.StringToHGlobalUni(Filename)) Then 
Return "Protected: True" 
Else 
Return "Protected: False" 
End If 
End Function
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker