Write problem with MS Office 2003

Stefan Dösinger stefandoesinger at gmx.at
Tue May 24 13:35:17 CDT 2005


Am Montag, 23. Mai 2005 20:50 schrieben Sie:
> Stefan wrote:
> > There's a check for this case:
> >     if (cidl && !apidl)
> >         return E_INVALIDARG;
> >
> > MSDN doesn't give me a hint what to do if cidl is set to 0. If I
> > change the if line to "if (!cidl && !apidl)" (so E_INVALIDARG is
> > returned to office), saving the file works. Should this line be
> > "if (!cidl || !apidl)", or is there a special case for cidl==0?
>
> There is a special case for cidl == 0, some apps expect to be able to call
> GetAttributesOf with cidl == 0, apidl == NULL.  See the patch that
> introduced it here:
> http://www.winehq.org/hypermail/wine-patches/2005/05/0156.html
>
> The special case, in particular, is to handle SFGAO_VALIDATE, described on
> the MSDN page for IShellFolder::GetAttributesOf.  I'm guessing this bit is
> what the app writers were reading when they decided to call
> GetAttributesOf with cidl == 0:
> "When used with the file system folder, SFGAO_VALIDATE instructs the
> folder to discard cached properties retrieved by clients of
> IShellFolder2::GetDetailsEx that may have accumulated for the specified
> items."
>
> The correct fix is to modify SHELL32_GetItemAttributes to clear
> SFGAO_READONLY if the file is not read-only.
How do I handle apidl == NULL? As far as I understand, apidl specifies a list 
of folders/files to be checked, right? If apidl == 0, what folder should I 
check. Is there some 'current folder' in the IShellFolder class? I didn't 
find any.

I tried to call SHELL32_GetItemAttributes (_IShellFolder_ (This), NULL, 
rgfInOut) in the case cidl==0 && apidl == NULL. This makes write operations 
work again, but read-only folders aren't reported to be read-only(Office 
tries to save but fails later). With my incorrect first try to return an 
error in this case, writing works, and if I select a folder I can't write to 
Office complains immediatly.

Thanks,
Stefan



More information about the wine-patches mailing list