[1/2] shlwapi: Fixed the todo blocks in the SHCreateStreamOnFile tests. [try 2]

Reece Dunn msclrhd at googlemail.com
Tue Apr 15 03:27:27 CDT 2008


On 15/04/2008, Reece Dunn <msclrhd at googlemail.com> wrote:
> On 14/04/2008, Alexandre Julliard <julliard at winehq.org> wrote:
>  > "Reece Dunn" <msclrhd at googlemail.com> writes:
>  >  > @@ -459,7 +458,9 @@ HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode,
>  >  >    switch(STGM_CREATE_MODE(dwMode))
>  >  >    {
>  >  >    case STGM_FAILIFTHERE:
>  >  > -    dwCreate = OPEN_EXISTING;
>  >  > +    if (bCreate && PathFileExistsW(lpszPath))
>  >  > +      return HRESULT_FROM_WIN32(ERROR_FILE_EXISTS);
>  >  > +    dwCreate = bCreate ? CREATE_ALWAYS : OPEN_EXISTING;
>  >
>  >  That case should be handled by CreateFile, you shouldn't check for the
>  >  file existence explicitly.
>
> The MSDN documentation for CreateFile
>  (http://msdn2.microsoft.com/en-us/library/aa363858.aspx) suggests that
>  CREATE_NEW has the desired behaviour. However, the Wine implementation
>  is not handling this correctly. Therefore, I'll improve the CreateFile
>  tests to test the CREATE_NEW behaviour.

There were tests for the CREATE_NEW case in kernel32/tests/file.c,
verifying this behaviour. I tracked the problem down to a strange way
of converting a GetLastError status to a HRESULT. Fixing that got the
desired behaviour (see my new patch).

- Reece



More information about the wine-devel mailing list