taskschd: Use wide-char string literals.

Also merge some strings.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-11-17 00:55:17 +01:00 committed by Alexandre Julliard
parent c5ff8ff27e
commit 48e35424a6
3 changed files with 108 additions and 197 deletions

View file

@ -203,7 +203,6 @@ static HRESULT WINAPI TaskFolder_CreateFolder(ITaskFolder *iface, BSTR path, VAR
WCHAR *get_full_path(const WCHAR *parent, const WCHAR *path)
{
static const WCHAR bslash[] = { '\\', 0 };
WCHAR *folder_path;
int len = 0;
@ -224,7 +223,7 @@ WCHAR *get_full_path(const WCHAR *parent, const WCHAR *path)
{
len = lstrlenW(folder_path);
if (!len || folder_path[len - 1] != '\\')
lstrcatW(folder_path, bslash);
lstrcatW(folder_path, L"\\");
while (*path == '\\') path++;
lstrcatW(folder_path, path);
@ -232,7 +231,7 @@ WCHAR *get_full_path(const WCHAR *parent, const WCHAR *path)
len = lstrlenW(folder_path);
if (!len)
lstrcatW(folder_path, bslash);
lstrcatW(folder_path, L"\\");
return folder_path;
}

View file

@ -357,11 +357,10 @@ HRESULT RegisteredTask_create(const WCHAR *path, const WCHAR *name, ITaskDefinit
}
else
{
static const WCHAR languages[] = { 0 };
DWORD count = 0;
WCHAR *xml = NULL;
hr = SchRpcRetrieveTask(full_name, languages, &count, &xml);
hr = SchRpcRetrieveTask(full_name, L"", &count, &xml);
if (hr != S_OK || (hr = ITaskDefinition_put_XmlText(definition, xml)) != S_OK)
{
heap_free(full_name);

View file

@ -1440,7 +1440,6 @@ static const ITaskSettingsVtbl TaskSettings_vtbl =
static HRESULT TaskSettings_create(ITaskSettings **obj)
{
static const WCHAR exec_time_limit[] = { 'P','T','7','2','H',0 };
TaskSettings *taskset;
taskset = heap_alloc(sizeof(*taskset));
@ -1450,7 +1449,7 @@ static HRESULT TaskSettings_create(ITaskSettings **obj)
taskset->ref = 1;
/* set the defaults */
taskset->restart_interval = NULL;
taskset->execution_time_limit = heap_strdupW(exec_time_limit);
taskset->execution_time_limit = heap_strdupW(L"PT72H");
taskset->delete_expired_task_after = NULL;
taskset->restart_count = 0;
taskset->priority = 7;
@ -2398,56 +2397,6 @@ static HRESULT WINAPI TaskDefinition_put_Actions(ITaskDefinition *iface, IAction
return S_OK;
}
static const WCHAR Task[] = {'T','a','s','k',0};
static const WCHAR version[] = {'v','e','r','s','i','o','n',0};
static const WCHAR v1_0[] = {'1','.','0',0};
static const WCHAR v1_1[] = {'1','.','1',0};
static const WCHAR v1_2[] = {'1','.','2',0};
static const WCHAR v1_3[] = {'1','.','3',0};
static const WCHAR xmlns[] = {'x','m','l','n','s',0};
static const WCHAR task_ns[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','w','i','n','d','o','w','s','/','2','0','0','4','/','0','2','/','m','i','t','/','t','a','s','k',0};
static const WCHAR RegistrationInfo[] = {'R','e','g','i','s','t','r','a','t','i','o','n','I','n','f','o',0};
static const WCHAR Author[] = {'A','u','t','h','o','r',0};
static const WCHAR Description[] = {'D','e','s','c','r','i','p','t','i','o','n',0};
static const WCHAR Source[] = {'S','o','u','r','c','e',0};
static const WCHAR Date[] = {'D','a','t','e',0};
static const WCHAR Version[] = {'V','e','r','s','i','o','n',0};
static const WCHAR Documentation[] = {'D','o','c','u','m','e','n','t','a','t','i','o','n',0};
static const WCHAR URI[] = {'U','R','I',0};
static const WCHAR SecurityDescriptor[] = {'S','e','c','u','r','i','t','y','D','e','s','c','r','i','p','t','o','r',0};
static const WCHAR Settings[] = {'S','e','t','t','i','n','g','s',0};
static const WCHAR Triggers[] = {'T','r','i','g','g','e','r','s',0};
static const WCHAR Principals[] = {'P','r','i','n','c','i','p','a','l','s',0};
static const WCHAR principalW[] = {'P','r','i','n','c','i','p','a','l',0};
static const WCHAR id[] = {'i','d',0};
static const WCHAR UserId[] = {'U','s','e','r','I','d',0};
static const WCHAR LogonType[] = {'L','o','g','o','n','T','y','p','e',0};
static const WCHAR GroupId[] = {'G','r','o','u','p','I','d',0};
static const WCHAR DisplayName[] = {'D','i','s','p','l','a','y','N','a','m','e',0};
static const WCHAR HighestAvailable[] = {'H','i','g','h','e','s','t','A','v','a','i','l','a','b','l','e',0};
static const WCHAR Password[] = {'P','a','s','s','w','o','r','d',0};
static const WCHAR S4U[] = {'S','4','U',0};
static const WCHAR InteractiveToken[] = {'I','n','t','e','r','a','c','t','i','v','e','T','o','k','e','n',0};
static const WCHAR RunLevel[] = {'R','u','n','L','e','v','e','l',0};
static const WCHAR LeastPrivilege[] = {'L','e','a','s','t','P','r','i','v','i','l','e','g','e',0};
static const WCHAR actionsW[] = {'A','c','t','i','o','n','s',0};
static const WCHAR Exec[] = {'E','x','e','c',0};
static const WCHAR MultipleInstancesPolicy[] = {'M','u','l','t','i','p','l','e','I','n','s','t','a','n','c','e','s','P','o','l','i','c','y',0};
static const WCHAR IgnoreNew[] = {'I','g','n','o','r','e','N','e','w',0};
static const WCHAR DisallowStartIfOnBatteries[] = {'D','i','s','a','l','l','o','w','S','t','a','r','t','I','f','O','n','B','a','t','t','e','r','i','e','s',0};
static const WCHAR AllowStartOnDemand[] = {'A','l','l','o','w','S','t','a','r','t','O','n','D','e','m','a','n','d',0};
static const WCHAR StopIfGoingOnBatteries[] = {'S','t','o','p','I','f','G','o','i','n','g','O','n','B','a','t','t','e','r','i','e','s',0};
static const WCHAR AllowHardTerminate[] = {'A','l','l','o','w','H','a','r','d','T','e','r','m','i','n','a','t','e',0};
static const WCHAR StartWhenAvailable[] = {'S','t','a','r','t','W','h','e','n','A','v','a','i','l','a','b','l','e',0};
static const WCHAR RunOnlyIfNetworkAvailable[] = {'R','u','n','O','n','l','y','I','f','N','e','t','w','o','r','k','A','v','a','i','l','a','b','l','e',0};
static const WCHAR Enabled[] = {'E','n','a','b','l','e','d',0};
static const WCHAR Hidden[] = {'H','i','d','d','e','n',0};
static const WCHAR RunOnlyIfIdle[] = {'R','u','n','O','n','l','y','I','f','I','d','l','e',0};
static const WCHAR WakeToRun[] = {'W','a','k','e','T','o','R','u','n',0};
static const WCHAR ExecutionTimeLimit[] = {'E','x','e','c','u','t','i','o','n','T','i','m','e','L','i','m','i','t',0};
static const WCHAR Priority[] = {'P','r','i','o','r','i','t','y',0};
static const WCHAR IdleSettings[] = {'I','d','l','e','S','e','t','t','i','n','g','s',0};
static int xml_indent;
static inline void push_indent(void)
@ -2467,59 +2416,45 @@ static inline HRESULT write_stringW(IStream *stream, const WCHAR *str)
static void write_indent(IStream *stream)
{
static const WCHAR spacesW[] = {' ',' ',0};
int i;
for (i = 0; i < xml_indent; i += 2)
write_stringW(stream, spacesW);
write_stringW(stream, L" ");
}
static const WCHAR start_element[] = {'<',0};
static const WCHAR start_end_element[] = {'<','/',0};
static const WCHAR close_element[] = {'>',0};
static const WCHAR end_empty_element[] = {'/','>',0};
static const WCHAR eol[] = {'\n',0};
static const WCHAR spaceW[] = {' ',0};
static const WCHAR equalW[] = {'=',0};
static const WCHAR quoteW[] = {'"',0};
static inline HRESULT write_empty_element(IStream *stream, const WCHAR *name)
{
write_indent(stream);
write_stringW(stream, start_element);
write_stringW(stream, L"<");
write_stringW(stream, name);
write_stringW(stream, end_empty_element);
return write_stringW(stream, eol);
return write_stringW(stream, L"/>\n");
}
static inline HRESULT write_element(IStream *stream, const WCHAR *name)
{
write_indent(stream);
write_stringW(stream, start_element);
write_stringW(stream, L"<");
write_stringW(stream, name);
write_stringW(stream, close_element);
return write_stringW(stream, eol);
return write_stringW(stream, L">\n");
}
static inline HRESULT write_element_end(IStream *stream, const WCHAR *name)
{
write_indent(stream);
write_stringW(stream, start_end_element);
write_stringW(stream, L"</");
write_stringW(stream, name);
write_stringW(stream, close_element);
return write_stringW(stream, eol);
return write_stringW(stream, L">\n");
}
static inline HRESULT write_text_value(IStream *stream, const WCHAR *name, const WCHAR *value)
{
write_indent(stream);
write_stringW(stream, start_element);
write_stringW(stream, L"<");
write_stringW(stream, name);
write_stringW(stream, close_element);
write_stringW(stream, L">");
write_stringW(stream, value);
write_stringW(stream, start_end_element);
write_stringW(stream, L"</");
write_stringW(stream, name);
write_stringW(stream, close_element);
return write_stringW(stream, eol);
return write_stringW(stream, L">\n");
}
static HRESULT write_task_attributes(IStream *stream, ITaskDefinition *taskdef)
@ -2540,35 +2475,23 @@ static HRESULT write_task_attributes(IStream *stream, ITaskDefinition *taskdef)
switch (level)
{
case TASK_COMPATIBILITY_AT:
compatibility = v1_0;
compatibility = L"1.0";
break;
case TASK_COMPATIBILITY_V1:
compatibility = v1_1;
compatibility = L"1.1";
break;
case TASK_COMPATIBILITY_V2:
compatibility = v1_2;
compatibility = L"1.2";
break;
default:
compatibility = v1_3;
compatibility = L"1.3";
break;
}
write_stringW(stream, start_element);
write_stringW(stream, Task);
write_stringW(stream, spaceW);
write_stringW(stream, version);
write_stringW(stream, equalW);
write_stringW(stream, quoteW);
write_stringW(stream, L"<Task version=\"");
write_stringW(stream, compatibility);
write_stringW(stream, quoteW);
write_stringW(stream, spaceW);
write_stringW(stream, xmlns);
write_stringW(stream, equalW);
write_stringW(stream, quoteW);
write_stringW(stream, task_ns);
write_stringW(stream, quoteW);
write_stringW(stream, close_element);
return write_stringW(stream, eol);
write_stringW(stream, L"\" xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">");
return write_stringW(stream, L"\n");
}
static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *reginfo)
@ -2578,9 +2501,9 @@ static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *regin
VARIANT var;
if (!reginfo)
return write_empty_element(stream, RegistrationInfo);
return write_empty_element(stream, L"RegistrationInfo");
hr = write_element(stream, RegistrationInfo);
hr = write_element(stream, L"RegistrationInfo");
if (hr != S_OK) return hr;
push_indent();
@ -2588,49 +2511,49 @@ static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *regin
hr = IRegistrationInfo_get_Source(reginfo, &bstr);
if (hr == S_OK && bstr)
{
hr = write_text_value(stream, Source, bstr);
hr = write_text_value(stream, L"Source", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Date(reginfo, &bstr);
if (hr == S_OK && bstr)
{
hr = write_text_value(stream, Date, bstr);
hr = write_text_value(stream, L"Date", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Author(reginfo, &bstr);
if (hr == S_OK && bstr)
{
hr = write_text_value(stream, Author, bstr);
hr = write_text_value(stream, L"Author", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Version(reginfo, &bstr);
if (hr == S_OK && bstr)
{
hr = write_text_value(stream, Version, bstr);
hr = write_text_value(stream, L"Version", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Description(reginfo, &bstr);
if (hr == S_OK && bstr)
{
hr = write_text_value(stream, Description, bstr);
hr = write_text_value(stream, L"Description", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_Documentation(reginfo, &bstr);
if (hr == S_OK && bstr)
{
hr = write_text_value(stream, Documentation, bstr);
hr = write_text_value(stream, L"Documentation", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IRegistrationInfo_get_URI(reginfo, &bstr);
if (hr == S_OK && bstr)
{
hr = write_text_value(stream, URI, bstr);
hr = write_text_value(stream, L"URI", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
@ -2639,7 +2562,7 @@ static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *regin
{
if (V_VT(&var) == VT_BSTR)
{
hr = write_text_value(stream, SecurityDescriptor, V_BSTR(&var));
hr = write_text_value(stream, L"SecurityDescriptor", V_BSTR(&var));
VariantClear(&var);
if (hr != S_OK) return hr;
}
@ -2649,7 +2572,7 @@ static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *regin
pop_indent();
return write_element_end(stream, RegistrationInfo);
return write_element_end(stream, L"RegistrationInfo");
}
static HRESULT write_principal(IStream *stream, IPrincipal *principal)
@ -2660,9 +2583,9 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
TASK_RUNLEVEL_TYPE level;
if (!principal)
return write_empty_element(stream, Principals);
return write_empty_element(stream, L"Principals");
hr = write_element(stream, Principals);
hr = write_element(stream, L"Principals");
if (hr != S_OK) return hr;
push_indent();
@ -2671,41 +2594,34 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
if (hr == S_OK)
{
write_indent(stream);
write_stringW(stream, start_element);
write_stringW(stream, principalW);
write_stringW(stream, spaceW);
write_stringW(stream, id);
write_stringW(stream, equalW);
write_stringW(stream, quoteW);
write_stringW(stream, L"<Principal id=\"");
write_stringW(stream, bstr);
write_stringW(stream, quoteW);
write_stringW(stream, close_element);
write_stringW(stream, eol);
write_stringW(stream, L"\">\n");
SysFreeString(bstr);
}
else
write_element(stream, principalW);
write_element(stream, L"Principal");
push_indent();
hr = IPrincipal_get_GroupId(principal, &bstr);
if (hr == S_OK)
{
hr = write_text_value(stream, GroupId, bstr);
hr = write_text_value(stream, L"GroupId", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IPrincipal_get_DisplayName(principal, &bstr);
if (hr == S_OK)
{
hr = write_text_value(stream, DisplayName, bstr);
hr = write_text_value(stream, L"DisplayName", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
hr = IPrincipal_get_UserId(principal, &bstr);
if (hr == S_OK && lstrlenW(bstr))
{
hr = write_text_value(stream, UserId, bstr);
hr = write_text_value(stream, L"UserId", bstr);
SysFreeString(bstr);
if (hr != S_OK) return hr;
}
@ -2717,10 +2633,10 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
switch (level)
{
case TASK_RUNLEVEL_HIGHEST:
level_str = HighestAvailable;
level_str = L"HighestAvailable";
break;
case TASK_RUNLEVEL_LUA:
level_str = LeastPrivilege;
level_str = L"LeastPrivilege";
break;
default:
FIXME("Principal run level %d\n", level);
@ -2729,7 +2645,7 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
if (level_str)
{
hr = write_text_value(stream, RunLevel, level_str);
hr = write_text_value(stream, L"RunLevel", level_str);
if (hr != S_OK) return hr;
}
}
@ -2741,13 +2657,13 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
switch (logon)
{
case TASK_LOGON_PASSWORD:
logon_str = Password;
logon_str = L"Password";
break;
case TASK_LOGON_S4U:
logon_str = S4U;
logon_str = L"S4U";
break;
case TASK_LOGON_INTERACTIVE_TOKEN:
logon_str = InteractiveToken;
logon_str = L"InteractiveToken";
break;
default:
FIXME("Principal logon type %d\n", logon);
@ -2756,22 +2672,22 @@ static HRESULT write_principal(IStream *stream, IPrincipal *principal)
if (logon_str)
{
hr = write_text_value(stream, LogonType, logon_str);
hr = write_text_value(stream, L"LogonType", logon_str);
if (hr != S_OK) return hr;
}
}
pop_indent();
write_element_end(stream, principalW);
write_element_end(stream, L"Principal");
pop_indent();
return write_element_end(stream, Principals);
return write_element_end(stream, L"Principals");
}
static HRESULT write_settings(IStream *stream, ITaskSettings *settings)
{
if (!settings)
return write_empty_element(stream, Settings);
return write_empty_element(stream, L"Settings");
FIXME("stub\n");
return S_OK;
@ -2780,7 +2696,7 @@ static HRESULT write_settings(IStream *stream, ITaskSettings *settings)
static HRESULT write_triggers(IStream *stream, ITriggerCollection *triggers)
{
if (!triggers)
return write_empty_element(stream, Triggers);
return write_empty_element(stream, L"Triggers");
FIXME("stub\n");
return S_OK;
@ -2790,11 +2706,11 @@ static HRESULT write_actions(IStream *stream, IActionCollection *actions)
{
if (!actions)
{
write_element(stream, actionsW);
write_element(stream, L"Actions");
push_indent();
write_empty_element(stream, Exec);
write_empty_element(stream, L"Exec");
pop_indent();
return write_element_end(stream, actionsW);
return write_element_end(stream, L"Actions");
}
FIXME("stub\n");
@ -2843,7 +2759,7 @@ static HRESULT WINAPI TaskDefinition_get_XmlText(ITaskDefinition *iface, BSTR *x
pop_indent();
write_element_end(stream, Task);
write_element_end(stream, L"Task");
IStream_Write(stream, "\0\0", 2, NULL);
p = GlobalLock(hmem);
@ -2889,17 +2805,15 @@ static HRESULT read_text_value(IXmlReader *reader, WCHAR **value)
static HRESULT read_variantbool_value(IXmlReader *reader, VARIANT_BOOL *vbool)
{
static const WCHAR trueW[] = {'t','r','u','e',0};
static const WCHAR falseW[] = {'f','a','l','s','e',0};
HRESULT hr;
WCHAR *value;
hr = read_text_value(reader, &value);
if (hr != S_OK) return hr;
if (!lstrcmpW(value, trueW))
if (!lstrcmpW(value, L"true"))
*vbool = VARIANT_TRUE;
else if (!lstrcmpW(value, falseW))
else if (!lstrcmpW(value, L"false"))
*vbool = VARIANT_FALSE;
else
{
@ -2947,7 +2861,7 @@ static HRESULT read_principal_attributes(IXmlReader *reader, IPrincipal *princip
TRACE("%s=%s\n", debugstr_w(name), debugstr_w(value));
if (!lstrcmpW(name, id))
if (!lstrcmpW(name, L"id"))
IPrincipal_put_Id(principal, (BSTR)value);
else
FIXME("unhandled Principal attribute %s\n", debugstr_w(name));
@ -2983,7 +2897,7 @@ static HRESULT read_principal(IXmlReader *reader, IPrincipal *principal)
TRACE("/%s\n", debugstr_w(name));
if (!lstrcmpW(name, principalW))
if (!lstrcmpW(name, L"Principal"))
return S_OK;
break;
@ -2994,20 +2908,20 @@ static HRESULT read_principal(IXmlReader *reader, IPrincipal *principal)
TRACE("Element: %s\n", debugstr_w(name));
if (!lstrcmpW(name, UserId))
if (!lstrcmpW(name, L"UserId"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IPrincipal_put_UserId(principal, value);
}
else if (!lstrcmpW(name, LogonType))
else if (!lstrcmpW(name, L"LogonType"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
{
TASK_LOGON_TYPE logon = TASK_LOGON_NONE;
if (!lstrcmpW(value, InteractiveToken))
if (!lstrcmpW(value, L"InteractiveToken"))
logon = TASK_LOGON_INTERACTIVE_TOKEN;
else
FIXME("unhandled LogonType %s\n", debugstr_w(value));
@ -3015,14 +2929,14 @@ static HRESULT read_principal(IXmlReader *reader, IPrincipal *principal)
IPrincipal_put_LogonType(principal, logon);
}
}
else if (!lstrcmpW(name, RunLevel))
else if (!lstrcmpW(name, L"RunLevel"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
{
TASK_RUNLEVEL_TYPE level = TASK_RUNLEVEL_LUA;
if (!lstrcmpW(value, LeastPrivilege))
if (!lstrcmpW(value, L"LeastPrivilege"))
level = TASK_RUNLEVEL_LUA;
else
FIXME("unhandled RunLevel %s\n", debugstr_w(value));
@ -3071,7 +2985,7 @@ static HRESULT read_principals(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("/%s\n", debugstr_w(name));
if (!lstrcmpW(name, Principals))
if (!lstrcmpW(name, L"Principals"))
return S_OK;
break;
@ -3082,7 +2996,7 @@ static HRESULT read_principals(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("Element: %s\n", debugstr_w(name));
if (!lstrcmpW(name, principalW))
if (!lstrcmpW(name, L"Principal"))
{
IPrincipal *principal;
@ -3147,7 +3061,7 @@ static HRESULT read_settings(IXmlReader *reader, ITaskSettings *taskset)
TRACE("/%s\n", debugstr_w(name));
if (!lstrcmpW(name, Settings))
if (!lstrcmpW(name, L"Settings"))
return S_OK;
break;
@ -3158,14 +3072,14 @@ static HRESULT read_settings(IXmlReader *reader, ITaskSettings *taskset)
TRACE("Element: %s\n", debugstr_w(name));
if (!lstrcmpW(name, MultipleInstancesPolicy))
if (!lstrcmpW(name, L"MultipleInstancesPolicy"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
{
int_val = TASK_INSTANCES_IGNORE_NEW;
if (!lstrcmpW(value, IgnoreNew))
if (!lstrcmpW(value, L"IgnoreNew"))
int_val = TASK_INSTANCES_IGNORE_NEW;
else
FIXME("unhandled MultipleInstancesPolicy %s\n", debugstr_w(value));
@ -3173,79 +3087,79 @@ static HRESULT read_settings(IXmlReader *reader, ITaskSettings *taskset)
ITaskSettings_put_MultipleInstances(taskset, int_val);
}
}
else if (!lstrcmpW(name, DisallowStartIfOnBatteries))
else if (!lstrcmpW(name, L"DisallowStartIfOnBatteries"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_DisallowStartIfOnBatteries(taskset, bool_val);
}
else if (!lstrcmpW(name, AllowStartOnDemand))
else if (!lstrcmpW(name, L"AllowStartOnDemand"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_AllowDemandStart(taskset, bool_val);
}
else if (!lstrcmpW(name, StopIfGoingOnBatteries))
else if (!lstrcmpW(name, L"StopIfGoingOnBatteries"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_StopIfGoingOnBatteries(taskset, bool_val);
}
else if (!lstrcmpW(name, AllowHardTerminate))
else if (!lstrcmpW(name, L"AllowHardTerminate"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_AllowHardTerminate(taskset, bool_val);
}
else if (!lstrcmpW(name, StartWhenAvailable))
else if (!lstrcmpW(name, L"StartWhenAvailable"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_StartWhenAvailable(taskset, bool_val);
}
else if (!lstrcmpW(name, RunOnlyIfNetworkAvailable))
else if (!lstrcmpW(name, L"RunOnlyIfNetworkAvailable"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_RunOnlyIfNetworkAvailable(taskset, bool_val);
}
else if (!lstrcmpW(name, Enabled))
else if (!lstrcmpW(name, L"Enabled"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_Enabled(taskset, bool_val);
}
else if (!lstrcmpW(name, Hidden))
else if (!lstrcmpW(name, L"Hidden"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_Hidden(taskset, bool_val);
}
else if (!lstrcmpW(name, RunOnlyIfIdle))
else if (!lstrcmpW(name, L"RunOnlyIfIdle"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_RunOnlyIfIdle(taskset, bool_val);
}
else if (!lstrcmpW(name, WakeToRun))
else if (!lstrcmpW(name, L"WakeToRun"))
{
hr = read_variantbool_value(reader, &bool_val);
if (hr != S_OK) return hr;
ITaskSettings_put_WakeToRun(taskset, bool_val);
}
else if (!lstrcmpW(name, ExecutionTimeLimit))
else if (!lstrcmpW(name, L"ExecutionTimeLimit"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
ITaskSettings_put_ExecutionTimeLimit(taskset, value);
}
else if (!lstrcmpW(name, Priority))
else if (!lstrcmpW(name, L"Priority"))
{
hr = read_int_value(reader, &int_val);
if (hr == S_OK)
ITaskSettings_put_Priority(taskset, int_val);
}
else if (!lstrcmpW(name, IdleSettings))
else if (!lstrcmpW(name, L"IdleSettings"))
{
hr = read_idle_settings(reader, taskset);
if (hr != S_OK) return hr;
@ -3292,7 +3206,7 @@ static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *inf
TRACE("/%s\n", debugstr_w(name));
if (!lstrcmpW(name, RegistrationInfo))
if (!lstrcmpW(name, L"RegistrationInfo"))
return S_OK;
break;
@ -3303,43 +3217,43 @@ static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *inf
TRACE("Element: %s\n", debugstr_w(name));
if (!lstrcmpW(name, Author))
if (!lstrcmpW(name, L"Author"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Author(info, value);
}
else if (!lstrcmpW(name, Description))
else if (!lstrcmpW(name, L"Description"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Description(info, value);
}
else if (!lstrcmpW(name, Version))
else if (!lstrcmpW(name, L"Version"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Version(info, value);
}
else if (!lstrcmpW(name, Date))
else if (!lstrcmpW(name, L"Date"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Date(info, value);
}
else if (!lstrcmpW(name, Documentation))
else if (!lstrcmpW(name, L"Documentation"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Documentation(info, value);
}
else if (!lstrcmpW(name, URI))
else if (!lstrcmpW(name, L"URI"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_URI(info, value);
}
else if (!lstrcmpW(name, Source))
else if (!lstrcmpW(name, L"Source"))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
@ -3389,26 +3303,26 @@ static HRESULT read_task_attributes(IXmlReader *reader, ITaskDefinition *taskdef
TRACE("%s=%s\n", debugstr_w(name), debugstr_w(value));
if (!lstrcmpW(name, version))
if (!lstrcmpW(name, L"version"))
{
TASK_COMPATIBILITY compatibility = TASK_COMPATIBILITY_V2;
if (!lstrcmpW(value, v1_0))
if (!lstrcmpW(value, L"1.0"))
compatibility = TASK_COMPATIBILITY_AT;
else if (!lstrcmpW(value, v1_1))
else if (!lstrcmpW(value, L"1.1"))
compatibility = TASK_COMPATIBILITY_V1;
else if (!lstrcmpW(value, v1_2))
else if (!lstrcmpW(value, L"1.2"))
compatibility = TASK_COMPATIBILITY_V2;
else if (!lstrcmpW(value, v1_3))
else if (!lstrcmpW(value, L"1.3"))
compatibility = TASK_COMPATIBILITY_V2_1;
else
FIXME("unknown version %s\n", debugstr_w(value));
ITaskSettings_put_Compatibility(taskset, compatibility);
}
else if (!lstrcmpW(name, xmlns))
else if (!lstrcmpW(name, L"xmlns"))
{
if (lstrcmpW(value, task_ns))
if (lstrcmpW(value, L"http://schemas.microsoft.com/windows/2004/02/mit/task"))
{
FIXME("unknown namespace %s\n", debugstr_w(value));
break;
@ -3447,7 +3361,7 @@ static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("/%s\n", debugstr_w(name));
if (!lstrcmpW(name, Task))
if (!lstrcmpW(name, L"Task"))
return S_OK;
break;
@ -3458,7 +3372,7 @@ static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("Element: %s\n", debugstr_w(name));
if (!lstrcmpW(name, RegistrationInfo))
if (!lstrcmpW(name, L"RegistrationInfo"))
{
IRegistrationInfo *info;
@ -3467,7 +3381,7 @@ static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef)
hr = read_registration_info(reader, info);
IRegistrationInfo_Release(info);
}
else if (!lstrcmpW(name, Settings))
else if (!lstrcmpW(name, L"Settings"))
{
ITaskSettings *taskset;
@ -3476,11 +3390,11 @@ static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef)
hr = read_settings(reader, taskset);
ITaskSettings_Release(taskset);
}
else if (!lstrcmpW(name, Triggers))
else if (!lstrcmpW(name, L"Triggers"))
hr = read_triggers(reader, taskdef);
else if (!lstrcmpW(name, Principals))
else if (!lstrcmpW(name, L"Principals"))
hr = read_principals(reader, taskdef);
else if (!lstrcmpW(name, actionsW))
else if (!lstrcmpW(name, L"Actions"))
hr = read_actions(reader, taskdef);
else
FIXME("unhandled Task element %s\n", debugstr_w(name));
@ -3522,7 +3436,7 @@ static HRESULT read_xml(IXmlReader *reader, ITaskDefinition *taskdef)
TRACE("Element: %s\n", debugstr_w(name));
if (!lstrcmpW(name, Task))
if (!lstrcmpW(name, L"Task"))
{
hr = read_task_attributes(reader, taskdef);
if (hr != S_OK) return hr;
@ -3782,18 +3696,17 @@ static inline BOOL is_variant_null(const VARIANT *var)
static HRESULT start_schedsvc(void)
{
static const WCHAR scheduleW[] = { 'S','c','h','e','d','u','l','e',0 };
SC_HANDLE scm, service;
SERVICE_STATUS_PROCESS status;
ULONGLONG start_time;
HRESULT hr = SCHED_E_SERVICE_NOT_RUNNING;
TRACE("Trying to start %s service\n", debugstr_w(scheduleW));
TRACE("Trying to start Schedule service\n");
scm = OpenSCManagerW(NULL, NULL, 0);
if (!scm) return SCHED_E_SERVICE_NOT_INSTALLED;
service = OpenServiceW(scm, scheduleW, SERVICE_START | SERVICE_QUERY_STATUS);
service = OpenServiceW(scm, L"Schedule", SERVICE_START | SERVICE_QUERY_STATUS);
if (service)
{
if (StartServiceW(service, 0, NULL) || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING)
@ -3837,7 +3750,7 @@ static HRESULT start_schedsvc(void)
static HRESULT WINAPI TaskService_Connect(ITaskService *iface, VARIANT server, VARIANT user, VARIANT domain, VARIANT password)
{
static WCHAR ncalrpc[] = { 'n','c','a','l','r','p','c',0 };
static WCHAR ncalrpc[] = L"ncalrpc";
TaskService *task_svc = impl_from_ITaskService(iface);
WCHAR comp_name[MAX_COMPUTERNAME_LENGTH + 1];
DWORD len;