2/20/2006

Solution: dsofile.dll - Permission Denied

Update 2006-02-12: The updated dll has been posted to http://jeolmeun.googlepages.com/dsofile_dll.zip and if you use the dll don't sue me, use at your own risk, no warranty, "AS IS" provided, and agree to all terms that may change in the future. Covered enough?

As sort of posted on the VB newsgroup.

Have you been trying to set SummaryInformation for files on Windows XP with NTFS using dsofile.dll? Getting Error Number -2147217142 or Err.Number = 70 messages when setting a SummaryProperties property?

I have been getting the error when the file does not have any Summary fields set in the first place. If I go into the file's property Summary tab and set a comment in the Comments and then try to set a SummaryProperties property, it worked without error.

The problem seems to come from the dsofile.dll in the CDsoSummaryProperties::GetPropertyFromList which is called from CDsoSummaryProperties::WriteProperty method. When there are no properties (or pitem) in the file's (ADS) SummaryInformation, dsofile.dll doesn't seem to make a new item.

Solution: Email me for a debug build of the dsofile.dll file or get the package which has the source from http://support.microsoft.com/?id=224351 and change the CDsoSummaryProperties::GetPropertyFromList to look something like below.

Use at your own risk. (No warranties, no obligations, no liability, and that other legal stuff.) I haven't tested it thoroughly since it has been doing what I've been trying to do.

summprops.cpp - about line 733


///////////////////////////////
// GetPropertyFromList -- Enumerates a list and finds item with the
// matching id. It can also add a new item (if flag set).
//
STDMETHODIMP_(CDsoDocProperty*) CDsoSummaryProperties::GetPropertyFromList(CDsoDocProperty* plist, PROPID id, BOOL fAppendNew)
{
CDsoDocProperty* pitem = plist;
CDsoDocProperty* plast = pitem;

ODS("CDsoSummaryProperties::FindPropertyInList\n");

// Loop the list until you find the item...
while (pitem)
{
if (pitem->GetID() == id)
break;

plast = pitem;
pitem = pitem->GetNextProperty();
}

// If no match is found, we can add a new item to end of the list...
if ((pitem == NULL)
// && (plast)
&& (fAppendNew))
{
// Create the item...
pitem = new CDsoDocProperty();
if (pitem)
{
VARIANT var; var.vt = VT_EMPTY;
if (FAILED(pitem->InitProperty(NULL, id, &var, TRUE, plast == NULL ? NULL : (plast->AppendLink(pitem)) )))
{ // If we fail, try to reverse the append and kill the new object...
if (plast == NULL)
{
}
else
{
plast->AppendLink((pitem->GetNextProperty()));
}
pitem->Release();
pitem = NULL;
}
}
}

return pitem;
}

Name:
Location: United States