Don't try to create file twice in the NULL filename case for

StgCreateDocFile.
This commit is contained in:
Gerard Patel 2001-03-31 00:51:54 +00:00 committed by Alexandre Julliard
parent f11ff2a448
commit 282bdb3564
1 changed files with 11 additions and 1 deletions

View File

@ -5294,6 +5294,11 @@ HRESULT WINAPI StgCreateDocfile(
WCHAR tempPath[MAX_PATH]; WCHAR tempPath[MAX_PATH];
WCHAR prefix[] = { 'S', 'T', 'O', 0 }; WCHAR prefix[] = { 'S', 'T', 'O', 0 };
if (!(grfMode & STGM_SHARE_EXCLUSIVE))
return STG_E_INVALIDFLAG;
if (!(grfMode & (STGM_WRITE|STGM_READWRITE)))
return STG_E_INVALIDFLAG;
memset(tempPath, 0, sizeof(tempPath)); memset(tempPath, 0, sizeof(tempPath));
memset(tempFileName, 0, sizeof(tempFileName)); memset(tempFileName, 0, sizeof(tempFileName));
@ -5304,6 +5309,12 @@ HRESULT WINAPI StgCreateDocfile(
pwcsName = tempFileName; pwcsName = tempFileName;
else else
return STG_E_INSUFFICIENTMEMORY; return STG_E_INSUFFICIENTMEMORY;
creationMode = TRUNCATE_EXISTING;
}
else
{
creationMode = GetCreationModeFromSTGM(grfMode);
} }
/* /*
@ -5311,7 +5322,6 @@ HRESULT WINAPI StgCreateDocfile(
*/ */
shareMode = GetShareModeFromSTGM(grfMode); shareMode = GetShareModeFromSTGM(grfMode);
accessMode = GetAccessModeFromSTGM(grfMode); accessMode = GetAccessModeFromSTGM(grfMode);
creationMode = GetCreationModeFromSTGM(grfMode);
if (grfMode & STGM_DELETEONRELEASE) if (grfMode & STGM_DELETEONRELEASE)
fileAttributes = FILE_FLAG_RANDOM_ACCESS | FILE_FLAG_DELETE_ON_CLOSE; fileAttributes = FILE_FLAG_RANDOM_ACCESS | FILE_FLAG_DELETE_ON_CLOSE;