From 5d066f4f7a12ff2d0c80164ff2b5ccd81edb63d0 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Sun, 15 Nov 2020 23:11:13 +0100 Subject: [PATCH] mstask: Use wide-char string literals. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- dlls/mstask/task.c | 10 ++++------ dlls/mstask/task_scheduler.c | 15 +++++---------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index a15e0164b43..398cefc58e4 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -1617,8 +1617,8 @@ static BOOL write_unicode_string(HANDLE hfile, const WCHAR *str) static HRESULT WINAPI MSTASK_IPersistFile_Save(IPersistFile *iface, LPCOLESTR task_name, BOOL remember) { - static WCHAR authorW[] = { 'W','i','n','e',0 }; - static WCHAR commentW[] = { 'C','r','e','a','t','e','d',' ','b','y',' ','W','i','n','e',0 }; + static WCHAR authorW[] = L"Wine"; + static WCHAR commentW[] = L"Created by Wine"; FIXDLEN_DATA fixed; WORD word, user_data_size = 0; HANDLE hfile; @@ -1883,8 +1883,6 @@ static const IPersistFileVtbl MSTASK_IPersistFileVtbl = HRESULT TaskConstructor(ITaskService *service, const WCHAR *name, ITask **task) { - static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\',0 }; - static const WCHAR jobW[] = { '.','j','o','b',0 }; TaskImpl *This; WCHAR task_name[MAX_PATH]; ITaskDefinition *taskdef; @@ -1896,9 +1894,9 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *name, ITask **task) if (wcschr(name, '.')) return E_INVALIDARG; GetWindowsDirectoryW(task_name, MAX_PATH); - lstrcatW(task_name, tasksW); + lstrcatW(task_name, L"\\Tasks\\"); lstrcatW(task_name, name); - lstrcatW(task_name, jobW); + lstrcatW(task_name, L".job"); hr = ITaskService_NewTask(service, 0, &taskdef); if (hr != S_OK) return hr; diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c index 54ca3609ff4..12eeae3565c 100644 --- a/dlls/mstask/task_scheduler.c +++ b/dlls/mstask/task_scheduler.c @@ -124,7 +124,6 @@ static inline BOOL is_file(const WIN32_FIND_DATAW *data) static HRESULT WINAPI EnumWorkItems_Next(IEnumWorkItems *iface, ULONG count, LPWSTR **names, ULONG *fetched) { - static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\','*',0 }; EnumWorkItemsImpl *This = impl_from_IEnumWorkItems(iface); WCHAR path[MAX_PATH]; WIN32_FIND_DATAW data; @@ -146,7 +145,7 @@ static HRESULT WINAPI EnumWorkItems_Next(IEnumWorkItems *iface, ULONG count, LPW if (This->handle == INVALID_HANDLE_VALUE) { GetWindowsDirectoryW(path, MAX_PATH); - lstrcatW(path, tasksW); + lstrcatW(path, L"\\Tasks\\*"); This->handle = FindFirstFileW(path, &data); if (This->handle == INVALID_HANDLE_VALUE) return S_FALSE; @@ -417,8 +416,6 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_Activate(ITaskScheduler *iface, static HRESULT WINAPI MSTASK_ITaskScheduler_Delete(ITaskScheduler *iface, LPCWSTR name) { - static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\',0 }; - static const WCHAR jobW[] = { '.','j','o','b',0 }; WCHAR task_name[MAX_PATH]; TRACE("%p, %s\n", iface, debugstr_w(name)); @@ -426,9 +423,9 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_Delete(ITaskScheduler *iface, LPCWST if (wcschr(name, '.')) return E_INVALIDARG; GetWindowsDirectoryW(task_name, MAX_PATH); - lstrcatW(task_name, tasksW); + lstrcatW(task_name, L"\\Tasks\\"); lstrcatW(task_name, name); - lstrcatW(task_name, jobW); + lstrcatW(task_name, L".job"); if (!DeleteFileW(task_name)) return HRESULT_FROM_WIN32(GetLastError()); @@ -459,8 +456,6 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem( static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem(ITaskScheduler *iface, LPCWSTR name, IScheduledWorkItem *item) { - static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\',0 }; - static const WCHAR jobW[] = { '.','j','o','b',0 }; WCHAR task_name[MAX_PATH]; IPersistFile *pfile; HRESULT hr; @@ -470,9 +465,9 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem(ITaskScheduler *iface, L if (wcschr(name, '.')) return E_INVALIDARG; GetWindowsDirectoryW(task_name, MAX_PATH); - lstrcatW(task_name, tasksW); + lstrcatW(task_name, L"\\Tasks\\"); lstrcatW(task_name, name); - lstrcatW(task_name, jobW); + lstrcatW(task_name, L".job"); hr = IScheduledWorkItem_QueryInterface(item, &IID_IPersistFile, (void **)&pfile); if (hr == S_OK) -- 2.11.4.GIT