mstask: Try opening a file more times when saving a job file.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6a9e127097
commit
87cc8cf3bb
|
@ -1195,7 +1195,7 @@ static HRESULT WINAPI MSTASK_IPersistFile_Save(IPersistFile *iface, LPCOLESTR ta
|
||||||
FIXDLEN_DATA fixed;
|
FIXDLEN_DATA fixed;
|
||||||
WORD word, user_data_size = 0;
|
WORD word, user_data_size = 0;
|
||||||
HANDLE hfile;
|
HANDLE hfile;
|
||||||
DWORD size, ver, disposition;
|
DWORD size, ver, disposition, try;
|
||||||
TaskImpl *This = impl_from_IPersistFile(iface);
|
TaskImpl *This = impl_from_IPersistFile(iface);
|
||||||
ITask *task = &This->ITask_iface;
|
ITask *task = &This->ITask_iface;
|
||||||
LPWSTR appname = NULL, params = NULL, workdir = NULL, creator = NULL, comment = NULL;
|
LPWSTR appname = NULL, params = NULL, workdir = NULL, creator = NULL, comment = NULL;
|
||||||
|
@ -1258,9 +1258,15 @@ static HRESULT WINAPI MSTASK_IPersistFile_Save(IPersistFile *iface, LPCOLESTR ta
|
||||||
fixed.flags = This->flags;
|
fixed.flags = This->flags;
|
||||||
memset(&fixed.last_runtime, 0, sizeof(fixed.last_runtime));
|
memset(&fixed.last_runtime, 0, sizeof(fixed.last_runtime));
|
||||||
|
|
||||||
hfile = CreateFileW(task_name, GENERIC_WRITE, 0, NULL, disposition, 0, 0);
|
try = 1;
|
||||||
if (hfile == INVALID_HANDLE_VALUE)
|
for (;;)
|
||||||
return HRESULT_FROM_WIN32(GetLastError());
|
{
|
||||||
|
hfile = CreateFileW(task_name, GENERIC_READ | GENERIC_WRITE, 0, NULL, disposition, 0, 0);
|
||||||
|
if (hfile != INVALID_HANDLE_VALUE) break;
|
||||||
|
|
||||||
|
if (try++ >= 3) return HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
Sleep(100);
|
||||||
|
}
|
||||||
|
|
||||||
if (!WriteFile(hfile, &fixed, sizeof(fixed), &size, NULL))
|
if (!WriteFile(hfile, &fixed, sizeof(fixed), &size, NULL))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue