PDA

View Full Version : OLE Property Compare


Michael Bulgrien
02-Nov-2007, 01:17 PM
I would really like the ability to compare the DSO OLE properties of two files.

See:
kb224351 (http://support.microsoft.com/?kbid=224351)
kb186898 (http://support.microsoft.com/kb/186898/)

Although the KB article references Microsoft Office documents, OLE Document Properties are not limited to Office documents. Any file that has a Summary tab on the File Properties dialog is using OLE Document Properties. My need is to compare OLE Properties on MSI files.

It would be an added bonus if one could configure Cirrus to assign one Summary tab property to a column in a Folder Compare session (user can specify which one). For example, when we package our product in a Microsoft Installer (MSI) file, we populate the Comments field on the File Properties Summary Tab with the corresponding build of the product. It would be most helpful to expose the Comments field in Cirrus so that I could see the build stamps on the MSI files when comparing two sets of MSI files on two different servers.

Here is a VB6 testrig I wrote to use the DSO OLE Document Properties Reader 2.1 dll to read properties on a file:

Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\WINDOWS\system32\STDOLE2 .TLB#OLE Automation
Reference=*\G{420B2830-E718-11CF-893D-00A0C9054228}#1.0#0#..\..\WINDOWS\system32\scrrun. dll#Microsoft Scripting Runtime
Reference=*\G{58968145-CF00-4341-995F-2EE093F6ABA3}#2.0#0#..\Dsofile.dll#DSO OLE Document Properties Reader 2.0

Option Explicit

Sub Main()
Dim sFile As String
sFile = InputBox("File:", "Read OLE Properties", "")
If sFile > "" Then ReadProperties sFile
End Sub

Sub ReadProperties(sFile As String)
Dim oDocumentProps As DSOFile.OleDocumentProperties
Dim oSummProp As DSOFile.SummaryProperties
Dim oCustProp As DSOFile.CustomProperty
Dim oFile As File
Dim ReadOnly As Boolean
Dim fso As FileSystemObject
Dim s As String

Set fso = New FileSystemObject
If fso.FileExists(sFile) Then

Set oFile = fso.GetFile(sFile)
ReadOnly = CBool(oFile.Attributes And 1)
Set oFile = Nothing

Set oDocumentProps = New DSOFile.OleDocumentProperties
oDocumentProps.Open sFile, ReadOnly, dsoOptionOpenReadOnlyIfNoWriteAccess
Set oSummProp = oDocumentProps.SummaryProperties

s = "Summary Properties" + vbCrLf
s = s + vbCrLf + "Application:" & vbTab & oSummProp.ApplicationName
s = s + vbCrLf + "Company: " & vbTab & oSummProp.Company
s = s + vbCrLf + "Author: " & vbTab & oSummProp.Author
s = s + vbCrLf + "Version: " & vbTab & oSummProp.Version
s = s + vbCrLf + "Revision: " & vbTab & oSummProp.RevisionNumber
s = s + vbCrLf + "Comments: " & vbTab & oSummProp.Comments
s = s + vbCrLf + "DateCreated:" & vbTab & oSummProp.DateCreated
s = s + vbCrLf + "DateLastPrinted:" & vbTab & oSummProp.DateLastPrinted
s = s + vbCrLf + "DateLastSaved:" & vbTab & oSummProp.DateLastSaved
s = s + vbCrLf + "LastSaved by:" & vbTab & oSummProp.LastSavedBy
s = s + vbCrLf + "Category: " & vbTab & oSummProp.Category
s = s + vbCrLf + "Keywords: " & vbTab & oSummProp.Keywords
s = s + vbCrLf + "Subject: " & vbTab & oSummProp.Subject
s = s + vbCrLf + "Manager: " & vbTab & oSummProp.Manager
s = s + vbCrLf + "ByteCount: " & vbTab & oSummProp.ByteCount
s = s + vbCrLf + "CharacterCount:" & vbTab & oSummProp.CharacterCount
s = s + vbCrLf + "Count w/spaces:" & vbTab & oSummProp.CharacterCountWithSpaces
s = s + vbCrLf + "LineCount: " & vbTab & oSummProp.LineCount
s = s + vbCrLf + "WordCount: " & vbTab & oSummProp.WordCount
s = s + vbCrLf + "ParagraphCount:" & vbTab & oSummProp.ParagraphCount
s = s + vbCrLf + "PageCount: " & vbTab & oSummProp.PageCount
s = s + vbCrLf + "NoteCount: " & vbTab & oSummProp.NoteCount
s = s + vbCrLf + "SlideCount:" & vbTab & oSummProp.SlideCount
s = s + vbCrLf + "PresFormat:" & vbTab & oSummProp.PresentationFormat
s = s + vbCrLf + "EditingTime" & vbTab & oSummProp.TotalEditTime
s = s + vbCrLf + "HiddenSlides:" & vbTab & oSummProp.HiddenSlideCount
s = s + vbCrLf + "MultimediaClips:" & vbTab & oSummProp.MultimediaClipCount
s = s + vbCrLf + "Template: " & vbTab & oSummProp.Template
s = s + vbCrLf + "IsShared: " & vbTab & oSummProp.SharedDocument

If oDocumentProps.IsOleFile Then
s = s + vbCrLf + vbCrLf + "OLE Properties" + vbCrLf
s = s + vbCrLf + "CLSID: " & vbTab & oDocumentProps.CLSID
s = s + vbCrLf + "OleFormat: " & vbTab & oDocumentProps.OleDocumentFormat
s = s + vbCrLf + "OleType: " & vbTab & oDocumentProps.OleDocumentType
End If

If oDocumentProps.CustomProperties.Count > 0 Then
s = s + vbCrLf + vbCrLf + "Custom Properties" + vbCrLf
For Each oCustProp In oDocumentProps.CustomProperties
s = s + vbCrLf + oCustProp.Name & ":" & vbTab & CStr(oCustProp.Value)
Next
End If

Set oCustProp = Nothing
Set oSummProp = Nothing
Set oDocumentProps = Nothing

MsgBox s

End If
Set fso = Nothing
End Sub

Chris
02-Nov-2007, 01:45 PM
Michael,

Thanks for the detailed suggestion. We've had a few requests for this in the past, and it is on our wish list.

Michael Bulgrien
18-Feb-2008, 01:19 PM
I'd like to re-emphasize the importance of being able to parse (or at least isolate) OLE properties from a file compare. When the content of two files are identical, but an individual has opened the file properties dialog and changed an "external" OLE file property (such as the title, subject, author, or comment) there is currently no way for BC to determine that the actual contents of the file are identical.

Even if Cirrus cannot parse the OLE properties initially, it would be helpful if it could at least identify when changes are confined to the "external" OLE properties and the "internal" content of the files remain the same.