Windows Installer API (SDK)

DrLocator Table

Referenz » DrLocator Table | Microsoft Docs


VBS class DrLocator


Class classDrLocatorTable
Private mSignature, mParent, mPath, mDepth

    Public Property Get pSignature
        pSignature = mSignature
    End Property
    Public Property Let pSignature(strSignature)
        mSignature = strSignature
    End Property
    Public Property Get pParent
        pParent = mParent
    End Property
    Public Property Let pParent(strParent)
        mParent = strParent
    End Property
    Public Property Get pPath
        pPath = mPath
    End Property
    Public Property Let pPath(strPath)
        mPath = strPath
    End Property
    Public Property Get pDepth
        pDepth = mDepth
    End Property
    Public Property Let pDepth(intDepth)
        mDepth = intDepth
    End Property
    
    Private Sub Class_Initialize
        'Anweisungen
    End Sub
    ' -----------------------------------------------------------------
    
    Public Function CreateTable()
    Dim strSQL, objView, objTableRow

    strSQL = "CREATE TABLE " & Chr(96) & "DrLocator" & Chr(96) & " (" & _
         Chr(96) & "Signature_" & Chr(96) & " CHAR(72) NOT NULL, " & _
         Chr(96) & "Parent" & Chr(96) & " CHAR(72), " & _
         Chr(96) & "Path" & Chr(96) & " CHAR(255), " & _
         Chr(96) & "Depth" & Chr(96) & " SHORT PRIMARY KEY " & _
         Chr(96) & "Signature_" & Chr(96) & "," & _
         Chr(96) & "Parent" & Chr(96) & "," & Chr(96) & "Path" & Chr(96) & ")"

    Set objView = objDatabase.OpenView(strSQL)
    objView.Execute
    objDatabase.Commit()

    msiValidation.pTable = "DrLocator"
    msiValidation.pColumn = "Signature_"
    msiValidation.pNullable = "N"
    msiValidation.pMinValue = Null
    msiValidation.pMaxValue = Null
    msiValidation.pKeyTable = ""
    msiValidation.pKeyColumn = Null
    msiValidation.pCategory = "Identifier"
    msiValidation.pSet = ""
    msiValidation.pDescription = "The Signature_ represents a unique file signature " & _
                                 "and is also the foreign key in the Signature table."

        msiValidation.ModifyValidationRecord
        msiValidation.ResetValidationRecord

    msiValidation.pTable = "DrLocator"
    msiValidation.pColumn = "Parent"
    msiValidation.pNullable = "Y"
    msiValidation.pMinValue = Null
    msiValidation.pMaxValue = Null
    msiValidation.pKeyTable = ""
    msiValidation.pKeyColumn = Null
    msiValidation.pCategory = "Identifier"
    msiValidation.pSet = ""
    msiValidation.pDescription = "The parent file signature. It is also a foreign " & _
                "key in the Signature table. If null and the Path column does not " & _
                "expand to a full path, then all the fixed drives of the user system " & _
                "are searched using the Path."

        msiValidation.ModifyValidationRecord
        msiValidation.ResetValidationRecord

    msiValidation.pTable = "DrLocator"
    msiValidation.pColumn = "Path"
    msiValidation.pNullable = "Y"
    msiValidation.pMinValue = Null
    msiValidation.pMaxValue = Null
    msiValidation.pKeyTable = ""
    msiValidation.pKeyColumn = Null
    msiValidation.pCategory = "AnyPath"
    msiValidation.pSet = ""
    msiValidation.pDescription = "The path on the user system. This is a either a " & _
                "subpath below the value of the Parent or a full path. The path may " & _
                "contain properties enclosed within [ ] that will be expanded."

        msiValidation.ModifyValidationRecord
        msiValidation.ResetValidationRecord

    msiValidation.pTable = "DrLocator"
    msiValidation.pColumn = "Depth"
    msiValidation.pNullable = "Y"
    msiValidation.pMinValue = 0
    msiValidation.pMaxValue = 32767
    msiValidation.pKeyTable = ""
    msiValidation.pKeyColumn = Null
    msiValidation.pCategory = ""
    msiValidation.pSet = ""
    msiValidation.pDescription = "The depth below the path to which the Signature_ " & _
                    "is recursively searched. If absent, the depth is assumed to be 0."

        msiValidation.ModifyValidationRecord
        msiValidation.ResetValidationRecord

    Set objView = Nothing
    
    End Function
    ' -----------------------------------------------------------------

    Public Function ModifyDrLocatorRecord()
    Dim strSQL, objView, objTableRow

    strSQL = "SELECT * FROM DrLocator"

    Set objView = objDatabase.OpenView(strSQL)
    objView.Execute
    Do 
        Set objTableRow = objView.Fetch
        If objTableRow Is Nothing Then
            Set objTableRow = objInstaller.CreateRecord(4)
            objTableRow.StringData(1) = mSignature
            objTableRow.StringData(2) = mParent
            objTableRow.StringData(3) = mPath
            objTableRow.IntegerData(4) = mDepth
            objView.Modify msiViewModifyAssign, objTableRow
            Exit Do
        End If
        objTableRow.StringData(1) = mSignature
        objTableRow.StringData(2) = mParent
        objTableRow.StringData(3) = mPath
        objTableRow.IntegerData(4) = mDepth
        objView.Modify msiViewModifyAssign, objTableRow
    Loop
    objDatabase.Commit()
    objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------
    
    Public Function ExecuteRequest(strKey, strValue)
    
    If IsMissingTable("DrLocator") Then CreateTable
    
    mSignature = LCase(strKey)
    mParent = ""
    mPath = strValue
    mDepth = CInt("0")
        ModifyDrLocatorRecord

    msiAppSearch.pProperty = UCase(strKey)
    msiAppSearch.pSignature = LCase(strKey)
        msiAppSearch.ModifyAppSearchRecord
    
    End Function
    ' -----------------------------------------------------------------

    Public Function DeleteDrLocatorRecord()
    Dim strSQL, objView, objTableRow

    strSQL = "SELECT * FROM DrLocator"

    Set objView = objDatabase.OpenView(strSQL)
    objView.Execute
    Do 
        Set objTableRow = objView.Fetch
        If objTableRow Is Nothing Then Exit Do
        
        If objTableRow.StringData(1) = mSignature Then _
           objView.Modify msiViewModifyDelete, objTableRow
    Loop
    objDatabase.Commit()
    objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------

    Public Function DeleteAllRecords()
    Dim strSQL, objView

    strSQL = "DELETE FROM DrLocator"

    Set objView = objDatabase.OpenView(strSQL)
        objView.Execute
    objDatabase.Commit()
        objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------

    Public Function DropTable()
    Dim strSQL, objView

    strSQL = "DROP TABLE DrLocator"

    Set objView = objDatabase.OpenView(strSQL)
        objView.Execute
    objDatabase.Commit()
        objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------

    Private Sub Class_Terminate()
        'Anweisungen
    End Sub
End Class
' ---------------------------------------------------------------------