Commit 25ec82c1 authored by Thuy Nguyen's avatar Thuy Nguyen Committed by Alexandre Julliard

StgCreateDocfile accepts NULL as a file name.

parent 8e5e588b
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "crtdll.h" #include "crtdll.h"
#include "tchar.h" #include "tchar.h"
#include "debug.h" #include "debug.h"
#include "windef.h"
#include "storage32.h" #include "storage32.h"
...@@ -4953,11 +4954,12 @@ HRESULT WINAPI StgCreateDocfile( ...@@ -4953,11 +4954,12 @@ HRESULT WINAPI StgCreateDocfile(
DWORD accessMode; DWORD accessMode;
DWORD creationMode; DWORD creationMode;
DWORD fileAttributes; DWORD fileAttributes;
WCHAR tempFileName[MAX_PATH];
/* /*
* Validate the parameters * Validate the parameters
*/ */
if ((ppstgOpen == 0) || (pwcsName == 0)) if (ppstgOpen == 0)
return STG_E_INVALIDPOINTER; return STG_E_INVALIDPOINTER;
/* /*
...@@ -4967,6 +4969,26 @@ HRESULT WINAPI StgCreateDocfile( ...@@ -4967,6 +4969,26 @@ HRESULT WINAPI StgCreateDocfile(
return STG_E_INVALIDFLAG; return STG_E_INVALIDFLAG;
/* /*
* Generate a unique name.
*/
if (pwcsName == 0)
{
WCHAR tempPath[MAX_PATH];
WCHAR prefix[] = { 'S', 'T', 'O', 0 };
memset(tempPath, 0, sizeof(tempPath));
memset(tempFileName, 0, sizeof(tempFileName));
if ((GetTempPathW(MAX_PATH, tempPath)) == 0 )
tempPath[0] = '.';
if (GetTempFileNameW(tempPath, prefix, 0, tempFileName) != 0)
pwcsName = tempFileName;
else
return STG_E_INSUFFICIENTMEMORY;
}
/*
* Interpret the STGM value grfMode * Interpret the STGM value grfMode
*/ */
shareMode = GetShareModeFromSTGM(grfMode); shareMode = GetShareModeFromSTGM(grfMode);
......
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