On 15/04/2008, Reece Dunn <[EMAIL PROTECTED]> wrote:
> On 14/04/2008, Alexandre Julliard <[EMAIL PROTECTED]> wrote:
> > "Reece Dunn" <[EMAIL PROTECTED]> 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