Attribute VB_Name = "mod_ADS"
Option Explicit
'
Private Const OF_EXIST = &H4000
Private Const OFS_MAXPATHNAME = 128
'
Private Type OFSTRUCT
    cBytes As Byte
    fFixedDisk As Byte
    nErrCode As Integer
    Reserved1 As Integer
    Reserved2 As Integer
    szPathName(OFS_MAXPATHNAME) As Byte
End Type
'
Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
'

Public Function Read_ADS_Info(strFileName As String) As Variant
    '
    Dim FileData As Variant
    '
    Open strFileName For Binary Access Read As #1
        Get #1, , FileData
    Close #1
    '
    Read_ADS_Info = FileData
    '
End Function

Public Sub Write_ADS_Info(strFileName As String, FileData As Variant)
    '
    Open strFileName For Binary Access Write As #1
        Put #1, , FileData
    Close #1
    '
End Sub

Public Function Does_ADS_FileExist(strFileName As String) As Boolean
    Dim OF As OFSTRUCT
    Does_ADS_FileExist = OpenFile(strFileName, OF, OF_EXIST) = 1
End Function

Public Sub Delete_ADS_File(strFileName As String)
    If Does_ADS_FileExist(strFileName) Then
        DeleteFile strFileName
    End If
End Sub
