[VB.NET] ZoneIdentifier Wrapper by fudmario

Iniciado por fudmario, Diciembre 04, 2016, 05:17:08 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Una simple implementacion para obtener el ZONE.IDENTIFIER(Windows Zone Identifier File) del archivos.

Ejemplo de Uso:

Código: vbnet

   Using zi As New ZoneIdentifier("D:\Sample.exe")
            If zi.Zone = UrlZone.Internet Then
                zi.Remove
            End If
   End Using



El Proyecto esta disponible para descargar: You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login


Si solo quieren eliminar el ZoneIdentifier, pueden usar la API:

Código: vbnet

<DllImport("kernel32.dll", CharSet:=CharSet.Auto, BestFitMapping:=False, ThrowOnUnmappableChar:=True, SetLastError:=True)>
        Public Shared Function DeleteFile(<MarshalAs(UnmanagedType.LPTStr)> ByVal filepath As String
        ) As <MarshalAs(UnmanagedType.Bool)> Boolean
        End Function


Ejemplo de Uso:

Código: vbnet

<DllImport("kernel32.dll", CharSet:=CharSet.Auto, BestFitMapping:=False, ThrowOnUnmappableChar:=True, SetLastError:=True)>
        Public Shared Function DeleteFile(<MarshalAs(UnmanagedType.LPTStr)> ByVal filepath As String
        ) As <MarshalAs(UnmanagedType.Bool)> Boolean
        End Function
Public Function DeleteZoneIdentifier(ByVal filePath As String) As Boolean
       Return DeleteFile(filePath + ":Zone.Identifier")
End Function