Commit 282bdb35 authored by Gerard Patel's avatar Gerard Patel Committed by Alexandre Julliard

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

StgCreateDocFile.
parent f11ff2a4
...@@ -5294,6 +5294,11 @@ HRESULT WINAPI StgCreateDocfile( ...@@ -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( ...@@ -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( ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment