From 94d6699c3b8d12540a77f6b5b7633d0857ac8fdf Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 7 Sep 2008 13:49:02 +0000 Subject: [PATCH] Commit 1/2 - Synced shlwapi.dll with Wine HEAD - Imported mstask.dll from Wine HEAD - Added mstask.dll, mstask_winetest.dll, winhttp_winetest.dll to bootcd - Update README.WINE svn path=/trunk/; revision=36029 --- reactos/baseaddress.rbuild | 1 + reactos/boot/bootdata/packages/reactos.dff | 3 + reactos/dll/win32/mstask/factory.c | 108 +++ reactos/dll/win32/mstask/mstask.inf | 16 + reactos/dll/win32/mstask/mstask.rbuild | 26 + reactos/dll/win32/mstask/mstask.spec | 28 + reactos/dll/win32/mstask/mstask_local.idl | 19 + reactos/dll/win32/mstask/mstask_main.c | 162 +++++ reactos/dll/win32/mstask/mstask_private.h | 70 ++ reactos/dll/win32/mstask/rsrc.rc | 20 + reactos/dll/win32/mstask/task.c | 771 +++++++++++++++++++++ reactos/dll/win32/mstask/task_scheduler.c | 187 +++++ reactos/dll/win32/mstask/task_trigger.c | 297 ++++++++ reactos/dll/win32/shlwapi/ordinal.c | 8 +- reactos/dll/win32/shlwapi/path.c | 13 +- reactos/dll/win32/shlwapi/shlwapi.rc | 1 + reactos/dll/win32/shlwapi/shlwapi_No.rc | 4 +- reactos/dll/win32/shlwapi/shlwapi_Zh.rc | 72 ++ reactos/dll/win32/shlwapi/string.c | 8 +- reactos/dll/win32/shlwapi/url.c | 119 ++-- reactos/dll/win32/win32.rbuild | 3 + reactos/include/ndk/rtltypes.h | 11 - reactos/include/psdk/mstask.idl | 385 ++++++++++ reactos/include/psdk/prsht.h | 3 + reactos/include/psdk/psdk.rbuild | 1 + reactos/include/psdk/winbase.h | 7 +- reactos/include/psdk/winerror.h | 43 ++ reactos/include/psdk/winnt.h | 5 + reactos/include/psdk/wtypes.idl | 16 +- reactos/lib/sdk/uuid/uuid.c | 1 + reactos/media/doc/README.WINE | 1 + 31 files changed, 2321 insertions(+), 88 deletions(-) create mode 100644 reactos/dll/win32/mstask/factory.c create mode 100644 reactos/dll/win32/mstask/mstask.inf create mode 100644 reactos/dll/win32/mstask/mstask.rbuild create mode 100644 reactos/dll/win32/mstask/mstask.spec create mode 100644 reactos/dll/win32/mstask/mstask_local.idl create mode 100644 reactos/dll/win32/mstask/mstask_main.c create mode 100644 reactos/dll/win32/mstask/mstask_private.h create mode 100644 reactos/dll/win32/mstask/rsrc.rc create mode 100644 reactos/dll/win32/mstask/task.c create mode 100644 reactos/dll/win32/mstask/task_scheduler.c create mode 100644 reactos/dll/win32/mstask/task_trigger.c create mode 100644 reactos/dll/win32/shlwapi/shlwapi_Zh.rc create mode 100644 reactos/include/psdk/mstask.idl diff --git a/reactos/baseaddress.rbuild b/reactos/baseaddress.rbuild index a00d0205734..2b3b0b22573 100644 --- a/reactos/baseaddress.rbuild +++ b/reactos/baseaddress.rbuild @@ -96,6 +96,7 @@ + diff --git a/reactos/boot/bootdata/packages/reactos.dff b/reactos/boot/bootdata/packages/reactos.dff index b529fc175ec..30dae8fdb7e 100644 --- a/reactos/boot/bootdata/packages/reactos.dff +++ b/reactos/boot/bootdata/packages/reactos.dff @@ -279,6 +279,7 @@ dll\win32\msgina\msgina.dll 1 dll\win32\mshtml\mshtml.dll 1 dll\win32\msi\msi.dll 1 dll\win32\msimg32\msimg32.dll 1 +dll\win32\mstask\mstask.dll 1 dll\win32\msvcrt\msvcrt.dll 1 dll\win32\msvcrt20\msvcrt20.dll 1 dll\win32\msvcrt40\msvcrt40.dll 1 @@ -654,6 +655,7 @@ modules\rostests\winetests\mapi32\mapi32_winetest.exe 7 o modules\rostests\winetests\mlang\mlang_winetest.exe 7 optional modules\rostests\winetests\mshtml\mshtml_winetest.exe 7 optional modules\rostests\winetests\msi\msi_winetest.exe 7 optional +modules\rostests\winetests\mstask\mstask_winetest.exe 7 optional modules\rostests\winetests\msvcrt\msvcrt_winetest.exe 7 optional modules\rostests\winetests\netapi32\netapi32_winetest.exe 7 optional modules\rostests\winetests\ntdll\ntdll_winetest.exe 7 optional @@ -677,6 +679,7 @@ modules\rostests\winetests\user32\user32_winetest.exe 7 o modules\rostests\winetests\usp10\usp10_winetest.exe 7 optional modules\rostests\winetests\uxtheme\uxtheme_winetest.exe 7 optional modules\rostests\winetests\version\version_winetest.exe 7 optional +modules\rostests\winetests\winhttp\winhttp_winetest.exe 7 optional modules\rostests\winetests\wininet\wininet_winetest.exe 7 optional modules\wallpaper\lake.bmp 4 optional diff --git a/reactos/dll/win32/mstask/factory.c b/reactos/dll/win32/mstask/factory.c new file mode 100644 index 00000000000..8906d922359 --- /dev/null +++ b/reactos/dll/win32/mstask/factory.c @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "mstask_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mstask); + +static HRESULT WINAPI MSTASK_IClassFactory_QueryInterface( + LPCLASSFACTORY iface, + REFIID riid, + LPVOID *ppvObj) +{ + ClassFactoryImpl *This = (ClassFactoryImpl *)iface; + + TRACE("IID: %s\n",debugstr_guid(riid)); + if (ppvObj == NULL) + return E_POINTER; + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IClassFactory)) + { + *ppvObj = &This->lpVtbl; + IClassFactory_AddRef(iface); + return S_OK; + } + + WARN("Unknown interface: %s\n", debugstr_guid(riid)); + *ppvObj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI MSTASK_IClassFactory_AddRef(LPCLASSFACTORY iface) +{ + TRACE("\n"); + InterlockedIncrement(&dll_ref); + return 2; +} + +static ULONG WINAPI MSTASK_IClassFactory_Release(LPCLASSFACTORY iface) +{ + TRACE("\n"); + InterlockedDecrement(&dll_ref); + return 1; +} + +static HRESULT WINAPI MSTASK_IClassFactory_CreateInstance( + LPCLASSFACTORY iface, + LPUNKNOWN pUnkOuter, + REFIID riid, + LPVOID *ppvObj) +{ + HRESULT res; + IUnknown *punk = NULL; + *ppvObj = NULL; + + TRACE("IID: %s\n",debugstr_guid(riid)); + + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + res = TaskSchedulerConstructor((LPVOID*) &punk); + if (FAILED(res)) + return res; + + res = ITaskScheduler_QueryInterface(punk, riid, ppvObj); + ITaskScheduler_Release(punk); + return res; +} + +static HRESULT WINAPI MSTASK_IClassFactory_LockServer( + LPCLASSFACTORY iface, + BOOL fLock) +{ + TRACE("\n"); + + if (fLock != FALSE) + MSTASK_IClassFactory_AddRef(iface); + else + MSTASK_IClassFactory_Release(iface); + return S_OK; +} + +static const IClassFactoryVtbl IClassFactory_Vtbl = +{ + MSTASK_IClassFactory_QueryInterface, + MSTASK_IClassFactory_AddRef, + MSTASK_IClassFactory_Release, + MSTASK_IClassFactory_CreateInstance, + MSTASK_IClassFactory_LockServer +}; + +ClassFactoryImpl MSTASK_ClassFactory = { &IClassFactory_Vtbl }; diff --git a/reactos/dll/win32/mstask/mstask.inf b/reactos/dll/win32/mstask/mstask.inf new file mode 100644 index 00000000000..10560933fdf --- /dev/null +++ b/reactos/dll/win32/mstask/mstask.inf @@ -0,0 +1,16 @@ +[version] +Signature="$CHICAGO$" + +[RegisterDll] +AddReg=Classes.Reg + +[UnregisterDll] +DelReg=Classes.Reg + +[Classes.Reg] +HKCR,"CLSID\%CLSID_CTaskScheduler%",,,"CTaskScheduler" +HKCR,"CLSID\%CLSID_CTaskScheduler%\InProcServer32",,,"mstask.dll" +HKCR,"CLSID\%CLSID_CTaskScheduler%\InProcServer32","ThreadingModel",,"Both" +HKCR,"CLSID\%CLSID_CTask%",,,"CTask" +HKCR,"CLSID\%CLSID_CTask%\InProcServer32",,,"mstask.dll" +HKCR,"CLSID\%CLSID_CTask%\InProcServer32","ThreadingModel",,"Both" diff --git a/reactos/dll/win32/mstask/mstask.rbuild b/reactos/dll/win32/mstask/mstask.rbuild new file mode 100644 index 00000000000..ea4d1f62eb3 --- /dev/null +++ b/reactos/dll/win32/mstask/mstask.rbuild @@ -0,0 +1,26 @@ + + + + + + + . + include/reactos/wine + + 0x600 + 0x600 + factory.c + mstask_main.c + task.c + task_scheduler.c + task_trigger.c + mstask_local.idl + rsrc.rc + mstask.spec + wine + uuid + ole32 + kernel32 + ntdll + + diff --git a/reactos/dll/win32/mstask/mstask.spec b/reactos/dll/win32/mstask/mstask.spec new file mode 100644 index 00000000000..0b6c23b79de --- /dev/null +++ b/reactos/dll/win32/mstask/mstask.spec @@ -0,0 +1,28 @@ +@ stub ConvertAtJobsToTasks +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stub GetNetScheduleAccountInformation +@ stub NetrJobAdd +@ stub NetrJobDel +@ stub NetrJobEnum +@ stub NetrJobGetInfo +@ stub SAGetAccountInformation +@ stub SAGetNSAccountInformation +@ stub SASetAccountInformation +@ stub SASetNSAccountInformation +@ stub SetNetScheduleAccountInformation +@ stub _ConvertAtJobsToTasks@0 +@ stub _DllCanUnloadNow@0 +@ stub _DllGetClassObject@12 +@ stub _GetNetScheduleAccountInformation@12 +@ stub _NetrJobAdd@12 +@ stub _NetrJobDel@12 +@ stub _NetrJobEnum@20 +@ stub _NetrJobGetInfo@12 +@ stub _SAGetAccountInformation@16 +@ stub _SAGetNSAccountInformation@12 +@ stub _SASetAccountInformation@20 +@ stub _SASetNSAccountInformation@12 +@ stub _SetNetScheduleAccountInformation@12 +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/reactos/dll/win32/mstask/mstask_local.idl b/reactos/dll/win32/mstask/mstask_local.idl new file mode 100644 index 00000000000..b1a044ab338 --- /dev/null +++ b/reactos/dll/win32/mstask/mstask_local.idl @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "mstask.idl" diff --git a/reactos/dll/win32/mstask/mstask_main.c b/reactos/dll/win32/mstask/mstask_main.c new file mode 100644 index 00000000000..df1f1d8c5e6 --- /dev/null +++ b/reactos/dll/win32/mstask/mstask_main.c @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include "mstask_private.h" +#include "winreg.h" +#include "advpub.h" + +#include "wine/debug.h" + + +WINE_DEFAULT_DEBUG_CHANNEL(mstask); + +static HINSTANCE hInst; +LONG dll_ref = 0; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return FALSE; + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + hInst = hinstDLL; + break; + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; +} + +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) +{ + TRACE("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv); + + if (IsEqualGUID(rclsid, &CLSID_CTaskScheduler)) { + return IClassFactory_QueryInterface((LPCLASSFACTORY)&MSTASK_ClassFactory, iid, ppv); + } + + FIXME("Not supported class: %s\n", debugstr_guid(rclsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI DllCanUnloadNow(void) +{ + return dll_ref != 0 ? S_FALSE : S_OK; +} + +static inline char *mstask_strdup(const char *s) +{ + size_t n = strlen(s) + 1; + char *d = HeapAlloc(GetProcessHeap(), 0, n); + return d ? memcpy(d, s, n) : NULL; +} + +static HRESULT init_register_strtable(STRTABLEA *strtable) +{ +#define CLSID_EXPANSION_ENTRY(id) { "CLSID_" #id, &CLSID_ ## id } + static const struct + { + const char *name; + const CLSID *clsid; + } + expns[] = + { + CLSID_EXPANSION_ENTRY(CTaskScheduler), + CLSID_EXPANSION_ENTRY(CTask) + }; +#undef CLSID_EXPANSION_ENTRY + static STRENTRYA pse[sizeof expns / sizeof expns[0]]; + unsigned int i; + + strtable->cEntries = sizeof pse / sizeof pse[0]; + strtable->pse = pse; + for (i = 0; i < strtable->cEntries; i++) + { + static const char dummy_sample[] = + "{12345678-1234-1234-1234-123456789012}"; + const CLSID *clsid = expns[i].clsid; + pse[i].pszName = mstask_strdup(expns[i].name); + pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, sizeof dummy_sample); + if (!pse[i].pszName || !pse[i].pszValue) + return E_OUTOFMEMORY; + sprintf(pse[i].pszValue, + "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", + clsid->Data1, clsid->Data2, clsid->Data3, clsid->Data4[0], + clsid->Data4[1], clsid->Data4[2], clsid->Data4[3], + clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], + clsid->Data4[7]); + } + + return S_OK; +} + +static void cleanup_register_strtable(STRTABLEA *strtable) +{ + unsigned int i; + for (i = 0; i < strtable->cEntries; i++) + { + HeapFree(GetProcessHeap(), 0, strtable->pse[i].pszName); + HeapFree(GetProcessHeap(), 0, strtable->pse[i].pszValue); + if (!strtable->pse[i].pszName || !strtable->pse[i].pszValue) + return; + } +} + +static HRESULT register_mstask(BOOL do_register) +{ + HRESULT hr; + STRTABLEA strtable; + HMODULE hAdvpack; + HRESULT (WINAPI *pRegInstall)(HMODULE hm, + LPCSTR pszSection, const STRTABLEA* pstTable); + static const WCHAR wszAdvpack[] = + {'a','d','v','p','a','c','k','.','d','l','l',0}; + + TRACE("(%x)\n", do_register); + + hAdvpack = LoadLibraryW(wszAdvpack); + pRegInstall = (void *)GetProcAddress(hAdvpack, "RegInstall"); + + hr = init_register_strtable(&strtable); + if (SUCCEEDED(hr)) + hr = pRegInstall(hInst, do_register ? "RegisterDll" : "UnregisterDll", + &strtable); + cleanup_register_strtable(&strtable); + + if (FAILED(hr)) + WINE_ERR("RegInstall failed: %08x\n", hr); + + return hr; +} + +HRESULT WINAPI DllRegisterServer(void) +{ + return register_mstask(TRUE); +} + +HRESULT WINAPI DllUnregisterServer(void) +{ + return register_mstask(FALSE); +} diff --git a/reactos/dll/win32/mstask/mstask_private.h b/reactos/dll/win32/mstask/mstask_private.h new file mode 100644 index 00000000000..eb3ecf856f2 --- /dev/null +++ b/reactos/dll/win32/mstask/mstask_private.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __MSTASK_PRIVATE_H__ +#define __MSTASK_PRIVATE_H__ + +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "mstask.h" + +extern LONG dll_ref; + +typedef struct +{ + const IClassFactoryVtbl *lpVtbl; + LONG ref; +} ClassFactoryImpl; +extern ClassFactoryImpl MSTASK_ClassFactory; + +typedef struct +{ + const ITaskTriggerVtbl *lpVtbl; + LONG ref; + TASK_TRIGGER triggerCond; +} TaskTriggerImpl; +extern HRESULT TaskTriggerConstructor(LPVOID *ppObj); + +typedef struct +{ + const ITaskSchedulerVtbl *lpVtbl; + LONG ref; +} TaskSchedulerImpl; +extern HRESULT TaskSchedulerConstructor(LPVOID *ppObj); + +typedef struct +{ + const ITaskVtbl *lpVtbl; + const IPersistFileVtbl *persistVtbl; + LONG ref; + LPWSTR taskName; + LPWSTR applicationName; + LPWSTR parameters; + LPWSTR comment; + DWORD maxRunTime; + LPWSTR accountName; +} TaskImpl; +extern HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj); + +#endif /* __MSTASK_PRIVATE_H__ */ diff --git a/reactos/dll/win32/mstask/rsrc.rc b/reactos/dll/win32/mstask/rsrc.rc new file mode 100644 index 00000000000..9915e028c48 --- /dev/null +++ b/reactos/dll/win32/mstask/rsrc.rc @@ -0,0 +1,20 @@ +/* + * Copyright 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* @makedep: mstask.inf */ +REGINST REGINST mstask.inf diff --git a/reactos/dll/win32/mstask/task.c b/reactos/dll/win32/mstask/task.c new file mode 100644 index 00000000000..3815b19747f --- /dev/null +++ b/reactos/dll/win32/mstask/task.c @@ -0,0 +1,771 @@ +/* + * Copyright (C) 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "mstask_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mstask); + +static inline TaskImpl *impl_from_IPersistFile( IPersistFile *iface ) +{ + return (TaskImpl*) ((char*)(iface) - FIELD_OFFSET(TaskImpl, persistVtbl)); +} + +static void TaskDestructor(TaskImpl *This) +{ + TRACE("%p\n", This); + HeapFree(GetProcessHeap(), 0, This->accountName); + HeapFree(GetProcessHeap(), 0, This->comment); + HeapFree(GetProcessHeap(), 0, This->parameters); + HeapFree(GetProcessHeap(), 0, This->taskName); + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_ref); +} + +static HRESULT WINAPI MSTASK_ITask_QueryInterface( + ITask* iface, + REFIID riid, + void **ppvObject) +{ + TaskImpl * This = (TaskImpl *)iface; + + TRACE("IID: %s\n", debugstr_guid(riid)); + if (ppvObject == NULL) + return E_POINTER; + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_ITask)) + { + *ppvObject = &This->lpVtbl; + ITask_AddRef(iface); + return S_OK; + } + else if (IsEqualGUID(riid, &IID_IPersistFile)) + { + *ppvObject = &This->persistVtbl; + ITask_AddRef(iface); + return S_OK; + } + + WARN("Unknown interface: %s\n", debugstr_guid(riid)); + *ppvObject = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI MSTASK_ITask_AddRef( + ITask* iface) +{ + TaskImpl *This = (TaskImpl *)iface; + ULONG ref; + TRACE("\n"); + ref = InterlockedIncrement(&This->ref); + return ref; +} + +static ULONG WINAPI MSTASK_ITask_Release( + ITask* iface) +{ + TaskImpl * This = (TaskImpl *)iface; + ULONG ref; + TRACE("\n"); + ref = InterlockedDecrement(&This->ref); + if (ref == 0) + TaskDestructor(This); + return ref; +} + +static HRESULT WINAPI MSTASK_ITask_CreateTrigger( + ITask* iface, + WORD *piNewTrigger, + ITaskTrigger **ppTrigger) +{ + TRACE("(%p, %p, %p)\n", iface, piNewTrigger, ppTrigger); + return TaskTriggerConstructor((LPVOID *)ppTrigger); +} + +static HRESULT WINAPI MSTASK_ITask_DeleteTrigger( + ITask* iface, + WORD iTrigger) +{ + FIXME("(%p, %d): stub\n", iface, iTrigger); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetTriggerCount( + ITask* iface, + WORD *plCount) +{ + FIXME("(%p, %p): stub\n", iface, plCount); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetTrigger( + ITask* iface, + WORD iTrigger, + ITaskTrigger **ppTrigger) +{ + FIXME("(%p, %d, %p): stub\n", iface, iTrigger, ppTrigger); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetTriggerString( + ITask* iface, + WORD iTrigger, + LPWSTR *ppwszTrigger) +{ + FIXME("(%p, %d, %p): stub\n", iface, iTrigger, ppwszTrigger); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetRunTimes( + ITask* iface, + const LPSYSTEMTIME pstBegin, + const LPSYSTEMTIME pstEnd, + WORD *pCount, + LPSYSTEMTIME *rgstTaskTimes) +{ + FIXME("(%p, %p, %p, %p, %p): stub\n", iface, pstBegin, pstEnd, pCount, + rgstTaskTimes); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetNextRunTime( + ITask* iface, + SYSTEMTIME *pstNextRun) +{ + FIXME("(%p, %p): stub\n", iface, pstNextRun); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetIdleWait( + ITask* iface, + WORD wIdleMinutes, + WORD wDeadlineMinutes) +{ + FIXME("(%p, %d, %d): stub\n", iface, wIdleMinutes, wDeadlineMinutes); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetIdleWait( + ITask* iface, + WORD *pwIdleMinutes, + WORD *pwDeadlineMinutes) +{ + FIXME("(%p, %p, %p): stub\n", iface, pwIdleMinutes, pwDeadlineMinutes); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_Run( + ITask* iface) +{ + FIXME("(%p): stub\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_Terminate( + ITask* iface) +{ + FIXME("(%p): stub\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_EditWorkItem( + ITask* iface, + HWND hParent, + DWORD dwReserved) +{ + FIXME("(%p, %p, %d): stub\n", iface, hParent, dwReserved); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetMostRecentRunTime( + ITask* iface, + SYSTEMTIME *pstLastRun) +{ + FIXME("(%p, %p): stub\n", iface, pstLastRun); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetStatus( + ITask* iface, + HRESULT *phrStatus) +{ + FIXME("(%p, %p): stub\n", iface, phrStatus); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetExitCode( + ITask* iface, + DWORD *pdwExitCode) +{ + FIXME("(%p, %p): stub\n", iface, pdwExitCode); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetComment( + ITask* iface, + LPCWSTR pwszComment) +{ + DWORD n; + TaskImpl *This = (TaskImpl *)iface; + LPWSTR tmp_comment; + + TRACE("(%p, %s)\n", iface, debugstr_w(pwszComment)); + + /* Empty comment */ + if (pwszComment[0] == 0) + { + HeapFree(GetProcessHeap(), 0, This->comment); + This->comment = NULL; + return S_OK; + } + + /* Set to pwszComment */ + n = (lstrlenW(pwszComment) + 1); + tmp_comment = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR)); + if (!tmp_comment) + return E_OUTOFMEMORY; + lstrcpyW(tmp_comment, pwszComment); + HeapFree(GetProcessHeap(), 0, This->comment); + This->comment = tmp_comment; + + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITask_GetComment( + ITask* iface, + LPWSTR *ppwszComment) +{ + DWORD n; + TaskImpl *This = (TaskImpl *)iface; + + TRACE("(%p, %p)\n", iface, ppwszComment); + + n = This->comment ? lstrlenW(This->comment) + 1 : 1; + *ppwszComment = CoTaskMemAlloc(n * sizeof(WCHAR)); + if (!*ppwszComment) + return E_OUTOFMEMORY; + + if (!This->comment) + *ppwszComment[0] = 0; + else + lstrcpyW(*ppwszComment, This->comment); + + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITask_SetCreator( + ITask* iface, + LPCWSTR pwszCreator) +{ + FIXME("(%p, %p): stub\n", iface, pwszCreator); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetCreator( + ITask* iface, + LPWSTR *ppwszCreator) +{ + FIXME("(%p, %p): stub\n", iface, ppwszCreator); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetWorkItemData( + ITask* iface, + WORD cBytes, + BYTE rgbData[]) +{ + FIXME("(%p, %d, %p): stub\n", iface, cBytes, rgbData); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetWorkItemData( + ITask* iface, + WORD *pcBytes, + BYTE **ppBytes) +{ + FIXME("(%p, %p, %p): stub\n", iface, pcBytes, ppBytes); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetErrorRetryCount( + ITask* iface, + WORD wRetryCount) +{ + FIXME("(%p, %d): stub\n", iface, wRetryCount); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetErrorRetryCount( + ITask* iface, + WORD *pwRetryCount) +{ + FIXME("(%p, %p): stub\n", iface, pwRetryCount); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetErrorRetryInterval( + ITask* iface, + WORD wRetryInterval) +{ + FIXME("(%p, %d): stub\n", iface, wRetryInterval); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetErrorRetryInterval( + ITask* iface, + WORD *pwRetryInterval) +{ + FIXME("(%p, %p): stub\n", iface, pwRetryInterval); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetFlags( + ITask* iface, + DWORD dwFlags) +{ + FIXME("(%p, 0x%08x): stub\n", iface, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetFlags( + ITask* iface, + DWORD *pdwFlags) +{ + FIXME("(%p, %p): stub\n", iface, pdwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetAccountInformation( + ITask* iface, + LPCWSTR pwszAccountName, + LPCWSTR pwszPassword) +{ + DWORD n; + TaskImpl *This = (TaskImpl *)iface; + LPWSTR tmp_account_name; + + TRACE("(%p, %s, %s): partial stub\n", iface, debugstr_w(pwszAccountName), + debugstr_w(pwszPassword)); + + if (pwszPassword) + FIXME("Partial stub ignores passwords\n"); + + n = (lstrlenW(pwszAccountName) + 1); + tmp_account_name = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR)); + if (!tmp_account_name) + return E_OUTOFMEMORY; + lstrcpyW(tmp_account_name, pwszAccountName); + HeapFree(GetProcessHeap(), 0, This->accountName); + This->accountName = tmp_account_name; + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITask_GetAccountInformation( + ITask* iface, + LPWSTR *ppwszAccountName) +{ + DWORD n; + TaskImpl *This = (TaskImpl *)iface; + + TRACE("(%p, %p): partial stub\n", iface, ppwszAccountName); + + /* This implements the WinXP behavior when accountName has not yet + * set. Win2K behaves differently, returning SCHED_E_CANNOT_OPEN_TASK */ + if (!This->accountName) + return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); + + n = (lstrlenW(This->accountName) + 1); + *ppwszAccountName = CoTaskMemAlloc(n * sizeof(WCHAR)); + if (!*ppwszAccountName) + return E_OUTOFMEMORY; + lstrcpyW(*ppwszAccountName, This->accountName); + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITask_SetApplicationName( + ITask* iface, + LPCWSTR pwszApplicationName) +{ + DWORD n; + TaskImpl *This = (TaskImpl *)iface; + LPWSTR tmp_name; + + TRACE("(%p, %s)\n", iface, debugstr_w(pwszApplicationName)); + + /* Empty application name */ + if (pwszApplicationName[0] == 0) + { + HeapFree(GetProcessHeap(), 0, This->applicationName); + This->applicationName = NULL; + return S_OK; + } + + /* Attempt to set pwszApplicationName to a path resolved application name */ + n = SearchPathW(NULL, pwszApplicationName, NULL, 0, NULL, NULL); + if (n) + { + tmp_name = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR)); + if (!tmp_name) + return E_OUTOFMEMORY; + n = SearchPathW(NULL, pwszApplicationName, NULL, n, tmp_name, NULL); + if (n) + { + HeapFree(GetProcessHeap(), 0, This->applicationName); + This->applicationName = tmp_name; + return S_OK; + } + else + HeapFree(GetProcessHeap(), 0, tmp_name); + } + + /* If unable to path resolve name, simply set to pwszApplicationName */ + n = (lstrlenW(pwszApplicationName) + 1); + tmp_name = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR)); + if (!tmp_name) + return E_OUTOFMEMORY; + lstrcpyW(tmp_name, pwszApplicationName); + HeapFree(GetProcessHeap(), 0, This->applicationName); + This->applicationName = tmp_name; + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITask_GetApplicationName( + ITask* iface, + LPWSTR *ppwszApplicationName) +{ + DWORD n; + TaskImpl *This = (TaskImpl *)iface; + + TRACE("(%p, %p)\n", iface, ppwszApplicationName); + + n = This->applicationName ? lstrlenW(This->applicationName) + 1 : 1; + *ppwszApplicationName = CoTaskMemAlloc(n * sizeof(WCHAR)); + if (!*ppwszApplicationName) + return E_OUTOFMEMORY; + + if (!This->applicationName) + *ppwszApplicationName[0] = 0; + else + lstrcpyW(*ppwszApplicationName, This->applicationName); + + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITask_SetParameters( + ITask* iface, + LPCWSTR pwszParameters) +{ + DWORD n; + TaskImpl *This = (TaskImpl *)iface; + LPWSTR tmp_parameters; + + TRACE("(%p, %s)\n", iface, debugstr_w(pwszParameters)); + + /* Empty parameter list */ + if (pwszParameters[0] == 0) + { + HeapFree(GetProcessHeap(), 0, This->parameters); + This->parameters = NULL; + return S_OK; + } + + /* Set to pwszParameters */ + n = (lstrlenW(pwszParameters) + 1); + tmp_parameters = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR)); + if (!tmp_parameters) + return E_OUTOFMEMORY; + lstrcpyW(tmp_parameters, pwszParameters); + HeapFree(GetProcessHeap(), 0, This->parameters); + This->parameters = tmp_parameters; + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITask_GetParameters( + ITask* iface, + LPWSTR *ppwszParameters) +{ + DWORD n; + TaskImpl *This = (TaskImpl *)iface; + + TRACE("(%p, %p)\n", iface, ppwszParameters); + + n = This->parameters ? lstrlenW(This->parameters) + 1 : 1; + *ppwszParameters = CoTaskMemAlloc(n * sizeof(WCHAR)); + if (!*ppwszParameters) + return E_OUTOFMEMORY; + + if (!This->parameters) + *ppwszParameters[0] = 0; + else + lstrcpyW(*ppwszParameters, This->parameters); + + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITask_SetWorkingDirectory( + ITask* iface, + LPCWSTR pwszWorkingDirectory) +{ + FIXME("(%p, %s): stub\n", iface, debugstr_w(pwszWorkingDirectory)); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetWorkingDirectory( + ITask* iface, + LPWSTR *ppwszWorkingDirectory) +{ + FIXME("(%p, %p): stub\n", iface, ppwszWorkingDirectory); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetPriority( + ITask* iface, + DWORD dwPriority) +{ + FIXME("(%p, 0x%08x): stub\n", iface, dwPriority); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetPriority( + ITask* iface, + DWORD *pdwPriority) +{ + FIXME("(%p, %p): stub\n", iface, pdwPriority); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetTaskFlags( + ITask* iface, + DWORD dwFlags) +{ + FIXME("(%p, 0x%08x): stub\n", iface, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_GetTaskFlags( + ITask* iface, + DWORD *pdwFlags) +{ + FIXME("(%p, %p): stub\n", iface, pdwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITask_SetMaxRunTime( + ITask* iface, + DWORD dwMaxRunTime) +{ + TaskImpl *This = (TaskImpl *)iface; + + TRACE("(%p, %d)\n", iface, dwMaxRunTime); + + This->maxRunTime = dwMaxRunTime; + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITask_GetMaxRunTime( + ITask* iface, + DWORD *pdwMaxRunTime) +{ + TaskImpl *This = (TaskImpl *)iface; + + TRACE("(%p, %p)\n", iface, pdwMaxRunTime); + + *pdwMaxRunTime = This->maxRunTime; + return S_OK; +} + +static HRESULT WINAPI MSTASK_IPersistFile_QueryInterface( + IPersistFile* iface, + REFIID riid, + void **ppvObject) +{ + TaskImpl *This = impl_from_IPersistFile(iface); + TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ppvObject); + return ITask_QueryInterface((ITask *) This, riid, ppvObject); +} + +static ULONG WINAPI MSTASK_IPersistFile_AddRef( + IPersistFile* iface) +{ + TaskImpl *This = impl_from_IPersistFile(iface); + ULONG ref; + TRACE("\n"); + ref = InterlockedIncrement(&This->ref); + return ref; +} + +static ULONG WINAPI MSTASK_IPersistFile_Release( + IPersistFile* iface) +{ + TaskImpl *This = impl_from_IPersistFile(iface); + ULONG ref; + TRACE("\n"); + ref = InterlockedDecrement(&This->ref); + if (ref == 0) + TaskDestructor(This); + return ref; +} + +static HRESULT WINAPI MSTASK_IPersistFile_GetClassID( + IPersistFile* iface, + CLSID *pClassID) +{ + FIXME("(%p, %p): stub\n", iface, pClassID); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_IPersistFile_IsDirty( + IPersistFile* iface) +{ + FIXME("(%p): stub\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_IPersistFile_Load( + IPersistFile* iface, + LPCOLESTR pszFileName, + DWORD dwMode) +{ + FIXME("(%p, %p, 0x%08x): stub\n", iface, pszFileName, dwMode); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_IPersistFile_Save( + IPersistFile* iface, + LPCOLESTR pszFileName, + BOOL fRemember) +{ + FIXME("(%p, %p, %d): stub\n", iface, pszFileName, fRemember); + WARN("Returning S_OK but not writing to disk: %s %d\n", + debugstr_w(pszFileName), fRemember); + return S_OK; +} + +static HRESULT WINAPI MSTASK_IPersistFile_SaveCompleted( + IPersistFile* iface, + LPCOLESTR pszFileName) +{ + FIXME("(%p, %p): stub\n", iface, pszFileName); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_IPersistFile_GetCurFile( + IPersistFile* iface, + LPOLESTR *ppszFileName) +{ + FIXME("(%p, %p): stub\n", iface, ppszFileName); + return E_NOTIMPL; +} + + +static const ITaskVtbl MSTASK_ITaskVtbl = +{ + MSTASK_ITask_QueryInterface, + MSTASK_ITask_AddRef, + MSTASK_ITask_Release, + MSTASK_ITask_CreateTrigger, + MSTASK_ITask_DeleteTrigger, + MSTASK_ITask_GetTriggerCount, + MSTASK_ITask_GetTrigger, + MSTASK_ITask_GetTriggerString, + MSTASK_ITask_GetRunTimes, + MSTASK_ITask_GetNextRunTime, + MSTASK_ITask_SetIdleWait, + MSTASK_ITask_GetIdleWait, + MSTASK_ITask_Run, + MSTASK_ITask_Terminate, + MSTASK_ITask_EditWorkItem, + MSTASK_ITask_GetMostRecentRunTime, + MSTASK_ITask_GetStatus, + MSTASK_ITask_GetExitCode, + MSTASK_ITask_SetComment, + MSTASK_ITask_GetComment, + MSTASK_ITask_SetCreator, + MSTASK_ITask_GetCreator, + MSTASK_ITask_SetWorkItemData, + MSTASK_ITask_GetWorkItemData, + MSTASK_ITask_SetErrorRetryCount, + MSTASK_ITask_GetErrorRetryCount, + MSTASK_ITask_SetErrorRetryInterval, + MSTASK_ITask_GetErrorRetryInterval, + MSTASK_ITask_SetFlags, + MSTASK_ITask_GetFlags, + MSTASK_ITask_SetAccountInformation, + MSTASK_ITask_GetAccountInformation, + MSTASK_ITask_SetApplicationName, + MSTASK_ITask_GetApplicationName, + MSTASK_ITask_SetParameters, + MSTASK_ITask_GetParameters, + MSTASK_ITask_SetWorkingDirectory, + MSTASK_ITask_GetWorkingDirectory, + MSTASK_ITask_SetPriority, + MSTASK_ITask_GetPriority, + MSTASK_ITask_SetTaskFlags, + MSTASK_ITask_GetTaskFlags, + MSTASK_ITask_SetMaxRunTime, + MSTASK_ITask_GetMaxRunTime +}; + +static const IPersistFileVtbl MSTASK_IPersistFileVtbl = +{ + MSTASK_IPersistFile_QueryInterface, + MSTASK_IPersistFile_AddRef, + MSTASK_IPersistFile_Release, + MSTASK_IPersistFile_GetClassID, + MSTASK_IPersistFile_IsDirty, + MSTASK_IPersistFile_Load, + MSTASK_IPersistFile_Save, + MSTASK_IPersistFile_SaveCompleted, + MSTASK_IPersistFile_GetCurFile +}; + +HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj) +{ + TaskImpl *This; + int n; + + TRACE("(%s, %p)\n", debugstr_w(pwszTaskName), ppObj); + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + if (!This) + return E_OUTOFMEMORY; + + This->lpVtbl = &MSTASK_ITaskVtbl; + This->persistVtbl = &MSTASK_IPersistFileVtbl; + This->ref = 1; + n = (lstrlenW(pwszTaskName) + 1) * sizeof(WCHAR); + This->taskName = HeapAlloc(GetProcessHeap(), 0, n); + if (!This->taskName) + { + HeapFree(GetProcessHeap(), 0, This); + return E_OUTOFMEMORY; + } + lstrcpyW(This->taskName, pwszTaskName); + This->applicationName = NULL; + This->parameters = NULL; + This->comment = NULL; + This->accountName = NULL; + + /* Default time is 3 days = 259200000 ms */ + This->maxRunTime = 259200000; + + *ppObj = &This->lpVtbl; + InterlockedIncrement(&dll_ref); + return S_OK; +} diff --git a/reactos/dll/win32/mstask/task_scheduler.c b/reactos/dll/win32/mstask/task_scheduler.c new file mode 100644 index 00000000000..5efa0869b2e --- /dev/null +++ b/reactos/dll/win32/mstask/task_scheduler.c @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "corerror.h" +#include "mstask_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mstask); + +static void TaskSchedulerDestructor(TaskSchedulerImpl *This) +{ + TRACE("%p\n", This); + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_ref); +} + +static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface( + ITaskScheduler* iface, + REFIID riid, + void **ppvObject) +{ + TaskSchedulerImpl * This = (TaskSchedulerImpl *)iface; + + TRACE("IID: %s\n", debugstr_guid(riid)); + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_ITaskScheduler)) + { + *ppvObject = &This->lpVtbl; + ITaskScheduler_AddRef(iface); + return S_OK; + } + + *ppvObject = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI MSTASK_ITaskScheduler_AddRef( + ITaskScheduler* iface) +{ + TaskSchedulerImpl *This = (TaskSchedulerImpl *)iface; + TRACE("\n"); + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI MSTASK_ITaskScheduler_Release( + ITaskScheduler* iface) +{ + TaskSchedulerImpl * This = (TaskSchedulerImpl *)iface; + ULONG ref; + TRACE("\n"); + ref = InterlockedDecrement(&This->ref); + if (ref == 0) + TaskSchedulerDestructor(This); + return ref; +} + +static HRESULT WINAPI MSTASK_ITaskScheduler_SetTargetComputer( + ITaskScheduler* iface, + LPCWSTR pwszComputer) +{ + FIXME("%p, %s: stub\n", iface, debugstr_w(pwszComputer)); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITaskScheduler_GetTargetComputer( + ITaskScheduler* iface, + LPWSTR *ppwszComputer) +{ + FIXME("%p, %p: stub\n", iface, ppwszComputer); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITaskScheduler_Enum( + ITaskScheduler* iface, + IEnumWorkItems **ppEnumTasks) +{ + FIXME("%p, %p: stub\n", iface, ppEnumTasks); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITaskScheduler_Activate( + ITaskScheduler* iface, + LPCWSTR pwszName, + REFIID riid, + IUnknown **ppunk) +{ + TRACE("%p, %s, %s, %p: stub\n", iface, debugstr_w(pwszName), + debugstr_guid(riid), ppunk); + FIXME("Partial stub always returning COR_E_FILENOTFOUND\n"); + return COR_E_FILENOTFOUND; +} + +static HRESULT WINAPI MSTASK_ITaskScheduler_Delete( + ITaskScheduler* iface, + LPCWSTR pwszName) +{ + FIXME("%p, %s: stub\n", iface, debugstr_w(pwszName)); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem( + ITaskScheduler* iface, + LPCWSTR pwszTaskName, + REFCLSID rclsid, + REFIID riid, + IUnknown **ppunk) +{ + HRESULT hr; + TRACE("(%p, %s, %s, %s, %p)\n", iface, debugstr_w(pwszTaskName), + debugstr_guid(rclsid) ,debugstr_guid(riid), ppunk); + + if (!IsEqualGUID(rclsid, &CLSID_CTask)) + return CLASS_E_CLASSNOTAVAILABLE; + + if (!IsEqualGUID(riid, &IID_ITask)) + return E_NOINTERFACE; + + hr = TaskConstructor(pwszTaskName, (LPVOID *)ppunk); + return hr; +} + +static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem( + ITaskScheduler* iface, + LPCWSTR pwszTaskName, + IScheduledWorkItem *pWorkItem) +{ + FIXME("%p, %s, %p: stub\n", iface, debugstr_w(pwszTaskName), pWorkItem); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITaskScheduler_IsOfType( + ITaskScheduler* iface, + LPCWSTR pwszName, + REFIID riid) +{ + FIXME("%p, %s, %s: stub\n", iface, debugstr_w(pwszName), + debugstr_guid(riid)); + return E_NOTIMPL; +} + +static const ITaskSchedulerVtbl MSTASK_ITaskSchedulerVtbl = +{ + MSTASK_ITaskScheduler_QueryInterface, + MSTASK_ITaskScheduler_AddRef, + MSTASK_ITaskScheduler_Release, + MSTASK_ITaskScheduler_SetTargetComputer, + MSTASK_ITaskScheduler_GetTargetComputer, + MSTASK_ITaskScheduler_Enum, + MSTASK_ITaskScheduler_Activate, + MSTASK_ITaskScheduler_Delete, + MSTASK_ITaskScheduler_NewWorkItem, + MSTASK_ITaskScheduler_AddWorkItem, + MSTASK_ITaskScheduler_IsOfType +}; + +HRESULT TaskSchedulerConstructor(LPVOID *ppObj) +{ + TaskSchedulerImpl *This; + TRACE("(%p)\n", ppObj); + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + if (!This) + return E_OUTOFMEMORY; + + This->lpVtbl = &MSTASK_ITaskSchedulerVtbl; + This->ref = 1; + + *ppObj = &This->lpVtbl; + InterlockedIncrement(&dll_ref); + return S_OK; +} diff --git a/reactos/dll/win32/mstask/task_trigger.c b/reactos/dll/win32/mstask/task_trigger.c new file mode 100644 index 00000000000..3823ee79649 --- /dev/null +++ b/reactos/dll/win32/mstask/task_trigger.c @@ -0,0 +1,297 @@ +/* + * Copyright (C) 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include "winternl.h" +#include "mstask_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mstask); + +static HRESULT WINAPI MSTASK_ITaskTrigger_QueryInterface( + ITaskTrigger* iface, + REFIID riid, + void **ppvObject) +{ + TaskTriggerImpl *This = (TaskTriggerImpl *)iface; + + TRACE("IID: %s\n", debugstr_guid(riid)); + if (ppvObject == NULL) + return E_POINTER; + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_ITaskTrigger)) + { + *ppvObject = &This->lpVtbl; + ITaskTrigger_AddRef(iface); + return S_OK; + } + + WARN("Unknown interface: %s\n", debugstr_guid(riid)); + *ppvObject = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI MSTASK_ITaskTrigger_AddRef( + ITaskTrigger* iface) +{ + TaskTriggerImpl *This = (TaskTriggerImpl *)iface; + ULONG ref; + TRACE("\n"); + ref = InterlockedIncrement(&This->ref); + return ref; +} + +static ULONG WINAPI MSTASK_ITaskTrigger_Release( + ITaskTrigger* iface) +{ + TaskTriggerImpl *This = (TaskTriggerImpl *)iface; + ULONG ref; + TRACE("\n"); + ref = InterlockedDecrement(&This->ref); + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_ref); + } + return ref; +} + +static HRESULT WINAPI MSTASK_ITaskTrigger_SetTrigger( + ITaskTrigger* iface, + const PTASK_TRIGGER pTrigger) +{ + TaskTriggerImpl * This = (TaskTriggerImpl *)iface; + TIME_FIELDS field_time; + LARGE_INTEGER sys_time; + TASK_TRIGGER tmp_trigger_cond; + + TRACE("(%p, %p)\n", iface, pTrigger); + + /* Verify valid structure size */ + if (pTrigger->cbTriggerSize != sizeof(*pTrigger)) + return E_INVALIDARG; + tmp_trigger_cond.cbTriggerSize = pTrigger->cbTriggerSize; + + /* Reserved field must be zero */ + tmp_trigger_cond.Reserved1 = 0; + + /* Verify and set valid start date and time */ + memset(&field_time, 0, sizeof(field_time)); + field_time.Year = pTrigger->wBeginYear; + field_time.Month = pTrigger->wBeginMonth; + field_time.Day = pTrigger->wBeginDay; + field_time.Hour = pTrigger->wStartHour; + field_time.Minute = pTrigger->wStartMinute; + if (!RtlTimeFieldsToTime(&field_time, &sys_time)) + return E_INVALIDARG; + tmp_trigger_cond.wBeginYear = pTrigger->wBeginYear; + tmp_trigger_cond.wBeginMonth = pTrigger->wBeginMonth; + tmp_trigger_cond.wBeginDay = pTrigger->wBeginDay; + tmp_trigger_cond.wStartHour = pTrigger->wStartHour; + tmp_trigger_cond.wStartMinute = pTrigger->wStartMinute; + + /* Verify valid end date if TASK_TRIGGER_FLAG_HAS_END_DATE flag is set */ + if (pTrigger->rgFlags & TASK_TRIGGER_FLAG_HAS_END_DATE) + { + memset(&field_time, 0, sizeof(field_time)); + field_time.Year = pTrigger->wEndYear; + field_time.Month = pTrigger->wEndMonth; + field_time.Day = pTrigger->wEndDay; + if (!RtlTimeFieldsToTime(&field_time, &sys_time)) + return E_INVALIDARG; + } + + /* Set valid end date independent of TASK_TRIGGER_FLAG_HAS_END_DATE flag */ + tmp_trigger_cond.wEndYear = pTrigger->wEndYear; + tmp_trigger_cond.wEndMonth = pTrigger->wEndMonth; + tmp_trigger_cond.wEndDay = pTrigger->wEndDay; + + /* Verify duration and interval pair */ + if (pTrigger->MinutesDuration <= pTrigger->MinutesInterval && + pTrigger->MinutesInterval > 0) + return E_INVALIDARG; + if (pTrigger->MinutesDuration > 0 && pTrigger->MinutesInterval == 0) + return E_INVALIDARG; + tmp_trigger_cond.MinutesDuration = pTrigger->MinutesDuration; + tmp_trigger_cond.MinutesInterval = pTrigger->MinutesInterval; + + /* Copy over flags */ + tmp_trigger_cond.rgFlags = pTrigger->rgFlags; + + /* Set TriggerType dependent fields of Type union */ + tmp_trigger_cond.TriggerType = pTrigger->TriggerType; + switch (pTrigger->TriggerType) + { + case TASK_TIME_TRIGGER_DAILY: + tmp_trigger_cond.Type.Daily.DaysInterval = + pTrigger->Type.Daily.DaysInterval; + break; + case TASK_TIME_TRIGGER_WEEKLY: + tmp_trigger_cond.Type.Weekly.WeeksInterval = + pTrigger->Type.Weekly.WeeksInterval; + tmp_trigger_cond.Type.Weekly.rgfDaysOfTheWeek = + pTrigger->Type.Weekly.rgfDaysOfTheWeek; + break; + case TASK_TIME_TRIGGER_MONTHLYDATE: + tmp_trigger_cond.Type.MonthlyDate.rgfDays = + pTrigger->Type.MonthlyDate.rgfDays; + tmp_trigger_cond.Type.MonthlyDate.rgfMonths = + pTrigger->Type.MonthlyDate.rgfMonths; + break; + case TASK_TIME_TRIGGER_MONTHLYDOW: + tmp_trigger_cond.Type.MonthlyDOW.wWhichWeek = + pTrigger->Type.MonthlyDOW.wWhichWeek; + tmp_trigger_cond.Type.MonthlyDOW.rgfDaysOfTheWeek = + pTrigger->Type.MonthlyDOW.rgfDaysOfTheWeek; + tmp_trigger_cond.Type.MonthlyDOW.rgfMonths = + pTrigger->Type.MonthlyDOW.rgfMonths; + break; + case TASK_TIME_TRIGGER_ONCE: + case TASK_EVENT_TRIGGER_ON_IDLE: + case TASK_EVENT_TRIGGER_AT_SYSTEMSTART: + case TASK_EVENT_TRIGGER_AT_LOGON: + default: + tmp_trigger_cond.Type = This->triggerCond.Type; + break; + } + + /* Reserved field must be zero */ + tmp_trigger_cond.Reserved2 = 0; + + /* wRandomMinutesInterval not currently used and is initialized to zero */ + tmp_trigger_cond.wRandomMinutesInterval = 0; + + /* Update object copy of triggerCond */ + This->triggerCond = tmp_trigger_cond; + + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITaskTrigger_GetTrigger( + ITaskTrigger* iface, + PTASK_TRIGGER pTrigger) +{ + TaskTriggerImpl * This = (TaskTriggerImpl *)iface; + + TRACE("(%p, %p)\n", iface, pTrigger); + + /* Native implementation doesn't verify equivalent cbTriggerSize fields */ + + /* Copy relevant fields of the structure */ + pTrigger->cbTriggerSize = This->triggerCond.cbTriggerSize; + pTrigger->Reserved1 = 0; + pTrigger->wBeginYear = This->triggerCond.wBeginYear; + pTrigger->wBeginMonth = This->triggerCond.wBeginMonth; + pTrigger->wBeginDay = This->triggerCond.wBeginDay; + pTrigger->wEndYear = This->triggerCond.wEndYear; + pTrigger->wEndMonth = This->triggerCond.wEndMonth; + pTrigger->wEndDay = This->triggerCond.wEndDay; + pTrigger->wStartHour = This->triggerCond.wStartHour; + pTrigger->wStartMinute = This->triggerCond.wStartMinute; + pTrigger->MinutesDuration = This->triggerCond.MinutesDuration; + pTrigger->MinutesInterval = This->triggerCond.MinutesInterval; + pTrigger->rgFlags = This->triggerCond.rgFlags; + pTrigger->TriggerType = This->triggerCond.TriggerType; + switch (This->triggerCond.TriggerType) + { + case TASK_TIME_TRIGGER_DAILY: + pTrigger->Type.Daily.DaysInterval = + This->triggerCond.Type.Daily.DaysInterval; + break; + case TASK_TIME_TRIGGER_WEEKLY: + pTrigger->Type.Weekly.WeeksInterval = + This->triggerCond.Type.Weekly.WeeksInterval; + pTrigger->Type.Weekly.rgfDaysOfTheWeek = + This->triggerCond.Type.Weekly.rgfDaysOfTheWeek; + break; + case TASK_TIME_TRIGGER_MONTHLYDATE: + pTrigger->Type.MonthlyDate.rgfDays = + This->triggerCond.Type.MonthlyDate.rgfDays; + pTrigger->Type.MonthlyDate.rgfMonths = + This->triggerCond.Type.MonthlyDate.rgfMonths; + break; + case TASK_TIME_TRIGGER_MONTHLYDOW: + pTrigger->Type.MonthlyDOW.wWhichWeek = + This->triggerCond.Type.MonthlyDOW.wWhichWeek; + pTrigger->Type.MonthlyDOW.rgfDaysOfTheWeek = + This->triggerCond.Type.MonthlyDOW.rgfDaysOfTheWeek; + pTrigger->Type.MonthlyDOW.rgfMonths = + This->triggerCond.Type.MonthlyDOW.rgfMonths; + break; + case TASK_TIME_TRIGGER_ONCE: + case TASK_EVENT_TRIGGER_ON_IDLE: + case TASK_EVENT_TRIGGER_AT_SYSTEMSTART: + case TASK_EVENT_TRIGGER_AT_LOGON: + default: + break; + } + pTrigger->Reserved2 = 0; + pTrigger->wRandomMinutesInterval = 0; + return S_OK; +} + +static HRESULT WINAPI MSTASK_ITaskTrigger_GetTriggerString( + ITaskTrigger* iface, + LPWSTR *ppwszTrigger) +{ + FIXME("Not implemented\n"); + return E_NOTIMPL; +} + +static const ITaskTriggerVtbl MSTASK_ITaskTriggerVtbl = +{ + MSTASK_ITaskTrigger_QueryInterface, + MSTASK_ITaskTrigger_AddRef, + MSTASK_ITaskTrigger_Release, + MSTASK_ITaskTrigger_SetTrigger, + MSTASK_ITaskTrigger_GetTrigger, + MSTASK_ITaskTrigger_GetTriggerString +}; + +HRESULT TaskTriggerConstructor(LPVOID *ppObj) +{ + TaskTriggerImpl *This; + SYSTEMTIME time; + TRACE("(%p)\n", ppObj); + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + if (!This) + return E_OUTOFMEMORY; + + This->lpVtbl = &MSTASK_ITaskTriggerVtbl; + This->ref = 1; + + /* Most fields of triggerCond default to zero. Initialize other + * fields to default values. */ + memset(&This->triggerCond, 0, sizeof(TASK_TRIGGER)); + GetLocalTime(&time); + This->triggerCond.cbTriggerSize = sizeof(This->triggerCond); + This->triggerCond.wBeginYear = time.wYear; + This->triggerCond.wBeginMonth = time.wMonth; + This->triggerCond.wBeginDay = time.wDay; + This->triggerCond.wStartHour = time.wHour; + This->triggerCond.wStartMinute = time.wMinute; + This->triggerCond.rgFlags = TASK_TRIGGER_FLAG_DISABLED; + This->triggerCond.TriggerType = TASK_TIME_TRIGGER_DAILY, + This->triggerCond.Type.Daily.DaysInterval = 1; + + *ppObj = &This->lpVtbl; + InterlockedIncrement(&dll_ref); + return S_OK; +} diff --git a/reactos/dll/win32/shlwapi/ordinal.c b/reactos/dll/win32/shlwapi/ordinal.c index d1668a678f7..b7be1f1ffbd 100644 --- a/reactos/dll/win32/shlwapi/ordinal.c +++ b/reactos/dll/win32/shlwapi/ordinal.c @@ -422,11 +422,11 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown) pIEnumFormatEtc = NULL; hRet = IUnknown_QueryInterface(pIUnknown, &IID_IEnumFORMATETC, (PVOID)&pIEnumFormatEtc); - if (!hRet && pIEnumFormatEtc) + if (hRet == S_OK && pIEnumFormatEtc) { /* Clone and register the enumerator */ hRet = IEnumFORMATETC_Clone(pIEnumFormatEtc, &pClone); - if (!hRet && pClone) + if (hRet == S_OK && pClone) { RegisterFormatEnumerator(lpBC, pClone, 0); @@ -1462,7 +1462,7 @@ HRESULT WINAPI IUnknown_QueryService(IUnknown* lpUnknown, REFGUID sid, REFIID ri hRet = IUnknown_QueryInterface(lpUnknown, &IID_IServiceProvider, (LPVOID*)&pService); - if (!hRet && pService) + if (hRet == S_OK && pService) { TRACE("QueryInterface returned (IServiceProvider*)%p\n", pService); @@ -4399,7 +4399,7 @@ PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(PSHELL_USER_PERMISSION *a { ret = GetTokenInformation(Token, TokenUser, (void*)tuUser, bufsize, &bufsize ); if (ret) - cur_user = ((PTOKEN_USER)&tuUser)->User.Sid; + cur_user = ((PTOKEN_USER)tuUser)->User.Sid; CloseHandle(Token); } } diff --git a/reactos/dll/win32/shlwapi/path.c b/reactos/dll/win32/shlwapi/path.c index d0d4e93c3bc..e06e027aa25 100644 --- a/reactos/dll/win32/shlwapi/path.c +++ b/reactos/dll/win32/shlwapi/path.c @@ -235,6 +235,7 @@ LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile) LPSTR WINAPI PathAddBackslashA(LPSTR lpszPath) { size_t iLen; + LPSTR prev = lpszPath; TRACE("(%s)\n",debugstr_a(lpszPath)); @@ -243,11 +244,15 @@ LPSTR WINAPI PathAddBackslashA(LPSTR lpszPath) if (iLen) { - lpszPath += iLen; - if (lpszPath[-1] != '\\') + do { + lpszPath = CharNextA(prev); + if (*lpszPath) + prev = lpszPath; + } while (*lpszPath); + if (*prev != '\\') { - *lpszPath++ = '\\'; - *lpszPath = '\0'; + *lpszPath++ = '\\'; + *lpszPath = '\0'; } } return lpszPath; diff --git a/reactos/dll/win32/shlwapi/shlwapi.rc b/reactos/dll/win32/shlwapi/shlwapi.rc index 9dc73fdf6e7..d03d996fe74 100644 --- a/reactos/dll/win32/shlwapi/shlwapi.rc +++ b/reactos/dll/win32/shlwapi/shlwapi.rc @@ -46,3 +46,4 @@ #include "shlwapi_Sv.rc" #include "shlwapi_Tr.rc" #include "shlwapi_Uk.rc" +#include "shlwapi_Zh.rc" diff --git a/reactos/dll/win32/shlwapi/shlwapi_No.rc b/reactos/dll/win32/shlwapi/shlwapi_No.rc index 37a39899e88..4df42c87dd0 100644 --- a/reactos/dll/win32/shlwapi/shlwapi_No.rc +++ b/reactos/dll/win32/shlwapi/shlwapi_No.rc @@ -37,7 +37,7 @@ FONT 8, "MS Shell Dlg" STRINGTABLE DISCARDABLE { IDS_BYTES_FORMAT "%ld byte" - IDS_TIME_INTERVAL_HOURS " t" + IDS_TIME_INTERVAL_HOURS " hr" IDS_TIME_INTERVAL_MINUTES " min" - IDS_TIME_INTERVAL_SECONDS " sek" + IDS_TIME_INTERVAL_SECONDS " sec" } diff --git a/reactos/dll/win32/shlwapi/shlwapi_Zh.rc b/reactos/dll/win32/shlwapi/shlwapi_Zh.rc new file mode 100644 index 00000000000..b5f03a14324 --- /dev/null +++ b/reactos/dll/win32/shlwapi/shlwapi_Zh.rc @@ -0,0 +1,72 @@ +/* + * shlwapi (Simplified and Traditional Chinese Resources) + * + * Copyright 2008 Hongbo Ni + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* Chinese text is encoded in UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDD_ERR_DIALOG DIALOG MOVEABLE DISCARDABLE 0, 0, 220, 60 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "错误!" +FONT 9, "MS Song" +{ + LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 + LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 + CHECKBOX "不要再显示这个讯息", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON L"确定(&O)" IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON L"取消(&C)" IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON L"是(&Y)" IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON L"否(&N)" IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP +} + +STRINGTABLE DISCARDABLE +{ + IDS_BYTES_FORMAT "%ld 字节" + IDS_TIME_INTERVAL_HOURS " 小时" + IDS_TIME_INTERVAL_MINUTES " 分" + IDS_TIME_INTERVAL_SECONDS " 秒" +} + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL + +IDD_ERR_DIALOG DIALOG MOVEABLE DISCARDABLE 0, 0, 220, 60 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "錯誤!" +FONT 8, "PMingLiu" +{ + LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 + LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 + CHECKBOX "不要再顯示這個訊息", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON L"確定(&O)" IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON L"取消(&C)" IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON L"是(&Y)" IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON L"否(&N)" IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP +} + +STRINGTABLE DISCARDABLE +{ + IDS_BYTES_FORMAT "%ld 字節" + IDS_TIME_INTERVAL_HOURS " 小時" + IDS_TIME_INTERVAL_MINUTES " 分" + IDS_TIME_INTERVAL_SECONDS " 秒" +} + +#pragma code_page(default) diff --git a/reactos/dll/win32/shlwapi/string.c b/reactos/dll/win32/shlwapi/string.c index abbfdbafdae..89cf5efc237 100644 --- a/reactos/dll/win32/shlwapi/string.c +++ b/reactos/dll/win32/shlwapi/string.c @@ -2511,8 +2511,9 @@ INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr, DWORD dwMode = 0; INT nWideCharCount = len - 1; - if (!ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr, - lpiLen)) + if (ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, + &nWideCharCount, lpDstStr, + lpiLen) == S_OK) return 0; if (nWideCharCount < len - 1) @@ -2523,7 +2524,8 @@ INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr, *lpiLen = 0; - if (ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, mem, lpiLen)) + if (ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, + mem, lpiLen) != S_OK) { SHTruncateString(mem, *lpiLen); lstrcpynA(lpDstStr, mem, *lpiLen + 1); diff --git a/reactos/dll/win32/shlwapi/url.c b/reactos/dll/win32/shlwapi/url.c index 2efe3869466..febf6a790f1 100644 --- a/reactos/dll/win32/shlwapi/url.c +++ b/reactos/dll/win32/shlwapi/url.c @@ -384,7 +384,6 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, if (*wk1++ == ':') state = 2; break; case 2: - if (*wk1 != '/') {state = 3; break;} *wk2++ = *wk1++; if (*wk1 != '/') {state = 6; break;} *wk2++ = *wk1++; @@ -660,29 +659,29 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, base.pszSuffix += delta; base.cchSuffix -= delta; } + }else { + /* get size of location field (if it exists) */ + work = (LPWSTR)base.pszSuffix; + sizeloc = 0; + if (*work++ == '/') { + if (*work++ == '/') { + /* At this point have start of location and + * it ends at next '/' or end of string. + */ + while(*work && (*work != '/')) work++; + sizeloc = (DWORD)(work - base.pszSuffix); + } + } } - /* get size of location field (if it exists) */ - work = (LPWSTR)base.pszSuffix; - sizeloc = 0; - if (*work++ == '/') { - if (*work++ == '/') { - /* At this point have start of location and - * it ends at next '/' or end of string. - */ - while(*work && (*work != '/')) work++; - sizeloc = (DWORD)(work - base.pszSuffix); - } - } - - /* Change .sizep2 to not have the last leaf in it, - * Note: we need to start after the location (if it exists) - */ + /* Change .sizep2 to not have the last leaf in it, + * Note: we need to start after the location (if it exists) + */ work = strrchrW((base.pszSuffix+sizeloc), '/'); - if (work) { - len = (DWORD)(work - base.pszSuffix + 1); - base.cchSuffix = len; - } + if (work) { + len = (DWORD)(work - base.pszSuffix + 1); + base.cchSuffix = len; + } /* * At this point: @@ -724,7 +723,7 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, process_case = 4; break; } - process_case = (*base.pszSuffix == '/') ? 5 : 3; + process_case = (*base.pszSuffix == '/' || base.nScheme == URL_SCHEME_MK) ? 5 : 3; break; } @@ -1156,13 +1155,15 @@ HRESULT WINAPI UrlUnescapeA( TRACE("(%s, %p, %p, 0x%08x)\n", debugstr_a(pszUrl), pszUnescaped, pcchUnescaped, dwFlags); - if(!pszUrl || (!pszUnescaped && !(dwFlags & URL_UNESCAPE_INPLACE)) || !pcchUnescaped) - return E_INVALIDARG; + if (!pszUrl) return E_INVALIDARG; if(dwFlags & URL_UNESCAPE_INPLACE) dst = pszUrl; else + { + if (!pszUnescaped || !pcchUnescaped) return E_INVALIDARG; dst = pszUnescaped; + } for(src = pszUrl, needed = 0; *src; src++, needed++) { if(dwFlags & URL_DONT_UNESCAPE_EXTRA_INFO && @@ -1223,13 +1224,15 @@ HRESULT WINAPI UrlUnescapeW( TRACE("(%s, %p, %p, 0x%08x)\n", debugstr_w(pszUrl), pszUnescaped, pcchUnescaped, dwFlags); - if(!pszUrl || (!pszUnescaped && !(dwFlags & URL_UNESCAPE_INPLACE))|| !pcchUnescaped) - return E_INVALIDARG; + if(!pszUrl) return E_INVALIDARG; if(dwFlags & URL_UNESCAPE_INPLACE) dst = pszUrl; else + { + if (!pszUnescaped || !pcchUnescaped) return E_INVALIDARG; dst = pszUnescaped; + } for(src = pszUrl, needed = 0; *src; src++, needed++) { if(dwFlags & URL_DONT_UNESCAPE_EXTRA_INFO && @@ -1505,32 +1508,38 @@ HRESULT WINAPI UrlHashW(LPCWSTR pszUrl, unsigned char *lpDest, DWORD nDestLen) HRESULT WINAPI UrlApplySchemeA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut, DWORD dwFlags) { LPWSTR in, out; - DWORD ret, len, len2; + HRESULT ret; + DWORD len; - TRACE("(in %s, out size %d, flags %08x) using W version\n", - debugstr_a(pszIn), *pcchOut, dwFlags); + TRACE("(%s, %p, %p:out size %d, 0x%08x)\n", debugstr_a(pszIn), + pszOut, pcchOut, pcchOut ? *pcchOut : 0, dwFlags); + + if (!pszIn || !pszOut || !pcchOut) return E_INVALIDARG; in = HeapAlloc(GetProcessHeap(), 0, - (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR)); + (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR)); out = in + INTERNET_MAX_URL_LENGTH; - MultiByteToWideChar(0, 0, pszIn, -1, in, INTERNET_MAX_URL_LENGTH); + MultiByteToWideChar(CP_ACP, 0, pszIn, -1, in, INTERNET_MAX_URL_LENGTH); len = INTERNET_MAX_URL_LENGTH; ret = UrlApplySchemeW(in, out, &len, dwFlags); - if ((ret != S_OK) && (ret != S_FALSE)) { - HeapFree(GetProcessHeap(), 0, in); - return ret; + if (ret != S_OK) { + HeapFree(GetProcessHeap(), 0, in); + return ret; } - len2 = WideCharToMultiByte(0, 0, out, len+1, 0, 0, 0, 0); - if (len2 > *pcchOut) { - *pcchOut = len2; - HeapFree(GetProcessHeap(), 0, in); - return E_POINTER; + len = WideCharToMultiByte(CP_ACP, 0, out, -1, NULL, 0, NULL, NULL); + if (len > *pcchOut) { + ret = E_POINTER; + goto cleanup; } - WideCharToMultiByte(0, 0, out, len+1, pszOut, *pcchOut, 0, 0); - *pcchOut = len2; + + WideCharToMultiByte(CP_ACP, 0, out, -1, pszOut, *pcchOut, NULL, NULL); + len--; + +cleanup: + *pcchOut = len; HeapFree(GetProcessHeap(), 0, in); return ret; } @@ -1587,7 +1596,7 @@ static HRESULT URL_ApplyDefault(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut) { HKEY newkey; DWORD data_len, dwType; - WCHAR value[MAX_PATH], data[MAX_PATH]; + WCHAR data[MAX_PATH]; static const WCHAR prefix_keyW[] = {'S','o','f','t','w','a','r','e', @@ -1599,14 +1608,12 @@ static HRESULT URL_ApplyDefault(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut) /* get and prepend default */ RegOpenKeyExW(HKEY_LOCAL_MACHINE, prefix_keyW, 0, 1, &newkey); - data_len = MAX_PATH; - value[0] = '@'; - value[1] = '\0'; - RegQueryValueExW(newkey, value, 0, &dwType, (LPBYTE)data, &data_len); + data_len = sizeof(data); + RegQueryValueExW(newkey, NULL, 0, &dwType, (LPBYTE)data, &data_len); RegCloseKey(newkey); if (strlenW(data) + strlenW(pszIn) + 1 > *pcchOut) { - *pcchOut = strlenW(data) + strlenW(pszIn) + 1; - return E_POINTER; + *pcchOut = strlenW(data) + strlenW(pszIn) + 1; + return E_POINTER; } strcpyW(pszOut, data); strcatW(pszOut, pszIn); @@ -1626,8 +1633,10 @@ HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DW DWORD res1; HRESULT ret; - TRACE("(in %s, out size %d, flags %08x)\n", - debugstr_w(pszIn), *pcchOut, dwFlags); + TRACE("(%s, %p, %p:out size %d, 0x%08x)\n", debugstr_w(pszIn), + pszOut, pcchOut, pcchOut ? *pcchOut : 0, dwFlags); + + if (!pszIn || !pszOut || !pcchOut) return E_INVALIDARG; if (dwFlags & URL_APPLY_GUESSFILE) { FIXME("(%s %p %p(%d) 0x%08x): stub URL_APPLY_GUESSFILE not implemented\n", @@ -1672,14 +1681,6 @@ HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DW return URL_ApplyDefault(pszIn, pszOut, pcchOut); } - /* just copy and give proper return code */ - if (strlenW(pszIn) + 1 > *pcchOut) { - *pcchOut = strlenW(pszIn) + 1; - return E_POINTER; - } - strcpyW(pszOut, pszIn); - *pcchOut = strlenW(pszOut); - TRACE("returning copy, left alone\n"); return S_FALSE; } @@ -2078,7 +2079,7 @@ HRESULT WINAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, debugstr_w(pszIn), pszOut, pcchOut, *pcchOut, dwPart, dwFlags); ret = URL_ParseUrl(pszIn, &pl); - if (!ret) { + if (ret == S_OK) { schaddr = pl.pScheme; schsize = pl.szScheme; diff --git a/reactos/dll/win32/win32.rbuild b/reactos/dll/win32/win32.rbuild index 92c472e3c24..82d2c64d259 100644 --- a/reactos/dll/win32/win32.rbuild +++ b/reactos/dll/win32/win32.rbuild @@ -169,6 +169,9 @@ + + + diff --git a/reactos/include/ndk/rtltypes.h b/reactos/include/ndk/rtltypes.h index b0b4cf9326c..4fcf5bf9eeb 100644 --- a/reactos/include/ndk/rtltypes.h +++ b/reactos/include/ndk/rtltypes.h @@ -348,17 +348,6 @@ typedef enum _RTL_GENERIC_COMPARE_RESULTS GenericEqual } RTL_GENERIC_COMPARE_RESULTS; -#else - -// -// ACL Query Information Classes -// -typedef enum _ACL_INFORMATION_CLASS -{ - AclRevisionInformation = 1, - AclSizeInformation -} ACL_INFORMATION_CLASS; - #endif // diff --git a/reactos/include/psdk/mstask.idl b/reactos/include/psdk/mstask.idl new file mode 100644 index 00000000000..cc70cce5eec --- /dev/null +++ b/reactos/include/psdk/mstask.idl @@ -0,0 +1,385 @@ +/* + * Task Scheduler Service interface + * + * Copyright (C) 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +import "oaidl.idl"; +import "oleidl.idl"; + +cpp_quote("#define TASK_SUNDAY 0x1") +cpp_quote("#define TASK_MONDAY 0x2") +cpp_quote("#define TASK_TUESDAY 0x4") +cpp_quote("#define TASK_WEDNESDAY 0x8") +cpp_quote("#define TASK_THURSDAY 0x10") +cpp_quote("#define TASK_FRIDAY 0x20") +cpp_quote("#define TASK_SATURDAY 0x40") + +cpp_quote("#define TASK_FIRST_WEEK 1") +cpp_quote("#define TASK_SECOND_WEEK 2") +cpp_quote("#define TASK_THIRD_WEEK 3") +cpp_quote("#define TASK_FOURTH_WEEK 4") +cpp_quote("#define TASK_LAST_WEEK 5") + +cpp_quote("#define TASK_JANUARY 0x1") +cpp_quote("#define TASK_FEBRUARY 0x2") +cpp_quote("#define TASK_MARCH 0x4") +cpp_quote("#define TASK_APRIL 0x8") +cpp_quote("#define TASK_MAY 0x10") +cpp_quote("#define TASK_JUNE 0x20") +cpp_quote("#define TASK_JULY 0x40") +cpp_quote("#define TASK_AUGUST 0x80") +cpp_quote("#define TASK_SEPTEMBER 0x100") +cpp_quote("#define TASK_OCTOBER 0x200") +cpp_quote("#define TASK_NOVEMBER 0x400") +cpp_quote("#define TASK_DECEMBER 0x800") + +cpp_quote("#define TASK_TRIGGER_FLAG_HAS_END_DATE 0x1") +cpp_quote("#define TASK_TRIGGER_FLAG_KILL_AT_DURATION_END 0x2") +cpp_quote("#define TASK_TRIGGER_FLAG_DISABLED 0x4") + +[ + local, + object, + uuid(148BD528-A2AB-11CE-B11F-00AA00530503), + pointer_default(unique) +] +interface IEnumWorkItems : IUnknown +{ + HRESULT Next( + [in] ULONG celt, + [out] LPWSTR **rgpwszNames, + [out] ULONG *pceltFetched); + + HRESULT Skip( + [in] ULONG celt); + + HRESULT Reset(); + + HRESULT Clone( + [out] IEnumWorkItems **ppEnumWorkItems); +} + +cpp_quote("#ifndef _HPROPSHEETPAGE_DEFINED") +typedef struct _PSP *HPROPSHEETPAGE; +cpp_quote("#define _HPROPSHEETPAGE_DEFINED") +cpp_quote("#endif") + +[ + local, + object, + uuid(4086658a-cbbb-11cf-b604-00c04fd8d565), + pointer_default(unique) +] +interface IProvideTaskPage : IUnknown +{ + typedef enum _TASKPAGE { + TASKPAGE_TASK = 0, + TASKPAGE_SCHEDULE = 1, + TASKPAGE_SETTINGS = 2 + } TASKPAGE; + + HRESULT GetPage( + [in] TASKPAGE tpType, + [in] BOOL fPersistChanges, + [out] HPROPSHEETPAGE *phPage); +} + +[ + local, + object, + uuid(148BD52B-A2AB-11CE-B11F-00AA00530503), + pointer_default(unique) +] +interface ITaskTrigger : IUnknown +{ + typedef enum _TASK_TRIGGER_TYPE { + TASK_TIME_TRIGGER_ONCE = 0, + TASK_TIME_TRIGGER_DAILY = 1, + TASK_TIME_TRIGGER_WEEKLY = 2, + TASK_TIME_TRIGGER_MONTHLYDATE = 3, + TASK_TIME_TRIGGER_MONTHLYDOW = 4, + TASK_EVENT_TRIGGER_ON_IDLE = 5, + TASK_EVENT_TRIGGER_AT_SYSTEMSTART = 6, + TASK_EVENT_TRIGGER_AT_LOGON = 7 + } TASK_TRIGGER_TYPE, *PTASK_TRIGGER_TYPE; + + typedef struct _DAILY { + WORD DaysInterval; + } DAILY; + + typedef struct _WEEKLY { + WORD WeeksInterval; + WORD rgfDaysOfTheWeek; + } WEEKLY; + + typedef struct _MONTHLYDATE { + DWORD rgfDays; + WORD rgfMonths; + } MONTHLYDATE; + + typedef struct _MONTHLYDOW { + WORD wWhichWeek; + WORD rgfDaysOfTheWeek; + WORD rgfMonths; + } MONTHLYDOW; + + typedef union _TRIGGER_TYPE_UNION { + DAILY Daily; + WEEKLY Weekly; + MONTHLYDATE MonthlyDate; + MONTHLYDOW MonthlyDOW; + } TRIGGER_TYPE_UNION; + + typedef struct _TASK_TRIGGER { + WORD cbTriggerSize; + WORD Reserved1; + WORD wBeginYear; + WORD wBeginMonth; + WORD wBeginDay; + WORD wEndYear; + WORD wEndMonth; + WORD wEndDay; + WORD wStartHour; + WORD wStartMinute; + DWORD MinutesDuration; + DWORD MinutesInterval; + DWORD rgFlags; + TASK_TRIGGER_TYPE TriggerType; + TRIGGER_TYPE_UNION Type; + WORD Reserved2; + WORD wRandomMinutesInterval; + } TASK_TRIGGER, *PTASK_TRIGGER; + + HRESULT SetTrigger( + [in] const PTASK_TRIGGER pTrigger); + + HRESULT GetTrigger( + [out] PTASK_TRIGGER pTrigger); + + HRESULT GetTriggerString( + [out] LPWSTR *ppwszTrigger); +} + +[ + local, + object, + uuid(a6b952f0-a4b1-11d0-997d-00aa006887ec), + pointer_default(unique) +] +interface IScheduledWorkItem : IUnknown +{ + HRESULT CreateTrigger( + [out] WORD *piNewTrigger, + [out] ITaskTrigger **ppTrigger); + + HRESULT DeleteTrigger( + [in] WORD iTrigger); + + HRESULT GetTriggerCount( + [out] WORD *plCount); + + HRESULT GetTrigger( + [in] WORD iTrigger, + [out] ITaskTrigger **ppTrigger); + + HRESULT GetTriggerString( + [in] WORD iTrigger, + [out] LPWSTR *ppwszTrigger); + + HRESULT GetRunTimes( + [in] const LPSYSTEMTIME pstBegin, + [in] const LPSYSTEMTIME pstEnd, + [in, out] WORD *pCount, + [out] LPSYSTEMTIME *rgstTaskTimes); + + HRESULT GetNextRunTime( + [out] SYSTEMTIME *pstNextRun); + + HRESULT SetIdleWait( + [in] WORD wIdleMinutes, + [in] WORD wDeadlineMinutes); + + HRESULT GetIdleWait( + [out] WORD *pwIdleMinutes, + [out] WORD *pwDeadlineMinutes); + + HRESULT Run(); + + HRESULT Terminate(); + + HRESULT EditWorkItem( + [in] HWND hParent, + [in] DWORD dwReserved); + + HRESULT GetMostRecentRunTime( + [out] SYSTEMTIME *pstLastRun); + + HRESULT GetStatus( + [out] HRESULT *phrStatus); + + HRESULT GetExitCode( + [out] DWORD *pdwExitCode); + + HRESULT SetComment( + [in] LPCWSTR pwszComment); + + HRESULT GetComment( + [out] LPWSTR *ppwszComment); + + HRESULT SetCreator( + LPCWSTR pwszCreator); + + HRESULT GetCreator( + [out] LPWSTR *ppwszCreator); + + HRESULT SetWorkItemData( + [in] WORD cBytes, + [in] BYTE rgbData[]); + + HRESULT GetWorkItemData( + [out] WORD *pcBytes, + [out] BYTE **ppBytes); + + HRESULT SetErrorRetryCount( + WORD wRetryCount); + + HRESULT GetErrorRetryCount( + [out] WORD *pwRetryCount); + + HRESULT SetErrorRetryInterval( + WORD wRetryInterval); + + HRESULT GetErrorRetryInterval( + [out] WORD *pwRetryInterval); + + HRESULT SetFlags( + DWORD dwFlags); + + HRESULT GetFlags( + [out] DWORD *pdwFlags); + + HRESULT SetAccountInformation( + [in] LPCWSTR pwszAccountName, + [in] LPCWSTR pwszPassword); + + HRESULT GetAccountInformation( + [out] LPWSTR *ppwszAccountName); +} + +[ + local, + object, + uuid(148BD524-A2AB-11CE-B11F-00AA00530503), + pointer_default(unique) +] +interface ITask : IScheduledWorkItem +{ + HRESULT SetApplicationName( + [in] LPCWSTR pwszApplicationName); + + HRESULT GetApplicationName( + [out] LPWSTR *ppwszApplicationName); + + HRESULT SetParameters( + [in] LPCWSTR pwszParameters); + + HRESULT GetParameters( + [out] LPWSTR *ppwszParameters); + + HRESULT SetWorkingDirectory( + [in] LPCWSTR pwszWorkingDirectory); + + HRESULT GetWorkingDirectory( + [in] LPWSTR *ppwszWorkingDirectory); + + HRESULT SetPriority( + [in] DWORD dwPriority); + + HRESULT GetPriority( + [out] DWORD *pdwPriority); + + HRESULT SetTaskFlags( + [in] DWORD dwFlags); + + HRESULT GetTaskFlags( + [out] DWORD *pdwFlags); + + HRESULT SetMaxRunTime( + [in] DWORD dwMaxRunTime); + + HRESULT GetMaxRunTime( + [out] DWORD *pdwMaxRunTime); +} + +[ + local, + object, + uuid(148BD527-A2AB-11CE-B11F-00AA00530503), + pointer_default(unique) +] +interface ITaskScheduler : IUnknown +{ + HRESULT SetTargetComputer( + [in] LPCWSTR pwszComputer); + + HRESULT GetTargetComputer( + [out] LPWSTR *ppwszComputer); + + HRESULT Enum( + [out] IEnumWorkItems **ppEnumTasks); + + HRESULT Activate( + [in] LPCWSTR pwszName, + [in] REFIID riid, + [out] IUnknown **ppunk); + + HRESULT Delete( + [in] LPCWSTR pwszName); + + HRESULT NewWorkItem( + [in] LPCWSTR pwszTaskName, + [in] REFCLSID rclsid, + [in] REFIID riid, + [out] IUnknown **ppunk); + + HRESULT AddWorkItem( + [in] LPCWSTR pwszTaskName, + [in] IScheduledWorkItem *pWorkItem); + + HRESULT IsOfType( + [in] LPCWSTR pwszName, + [in] REFIID riid); +} + +[ + uuid(148BD52A-A2AB-11CE-B11F-00AA00530503) +] +coclass CTaskScheduler +{ + [default] interface ITaskScheduler; +}; + + +[ + uuid(148BD520-A2AB-11CE-B11F-00AA00530503) +] +coclass CTask +{ + [default] interface ITask; +}; diff --git a/reactos/include/psdk/prsht.h b/reactos/include/psdk/prsht.h index ed7f087e4e1..408594a3936 100644 --- a/reactos/include/psdk/prsht.h +++ b/reactos/include/psdk/prsht.h @@ -208,7 +208,10 @@ typedef const PROPSHEETPAGEW *LPCPROPSHEETPAGEW; typedef UINT(CALLBACK *LPFNPSPCALLBACKA)(HWND,UINT,LPPROPSHEETPAGEA); typedef UINT(CALLBACK *LPFNPSPCALLBACKW)(HWND,UINT,LPPROPSHEETPAGEW); typedef int(CALLBACK *PFNPROPSHEETCALLBACK)(HWND,UINT,LPARAM); +#ifndef _HPROPSHEETPAGE_DEFINED +#define _HPROPSHEETPAGE_DEFINED DECLARE_HANDLE(HPROPSHEETPAGE); +#endif /* _HPROPSHEETPAGE_DEFINED */ typedef struct _PROPSHEETHEADERA { DWORD dwSize; DWORD dwFlags; diff --git a/reactos/include/psdk/psdk.rbuild b/reactos/include/psdk/psdk.rbuild index 2e404c1ba54..b07cf608545 100644 --- a/reactos/include/psdk/psdk.rbuild +++ b/reactos/include/psdk/psdk.rbuild @@ -19,6 +19,7 @@ mimeinfo.idl mlang.idl mshtml.idl + mstask.idl msxml.idl msxml2.idl oaidl.idl diff --git a/reactos/include/psdk/winbase.h b/reactos/include/psdk/winbase.h index 3b129ce1454..b1639a226e5 100644 --- a/reactos/include/psdk/winbase.h +++ b/reactos/include/psdk/winbase.h @@ -798,6 +798,8 @@ typedef struct _CRITICAL_SECTION { HANDLE LockSemaphore; ULONG_PTR SpinCount; } CRITICAL_SECTION,*PCRITICAL_SECTION,*LPCRITICAL_SECTION; +#ifndef _SYSTEMTIME_ +#define _SYSTEMTIME_ typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; @@ -808,6 +810,7 @@ typedef struct _SYSTEMTIME { WORD wSecond; WORD wMilliseconds; } SYSTEMTIME,*LPSYSTEMTIME,*PSYSTEMTIME; +#endif /* _SYSTEMTIME_ */ #if (_WIN32_WINNT >= 0x0500) typedef WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK ; #endif @@ -882,10 +885,6 @@ typedef enum _FINDEX_SEARCH_OPS { FindExSearchLimitToDevices, FindExSearchMaxSearchOp } FINDEX_SEARCH_OPS; -typedef enum _ACL_INFORMATION_CLASS { - AclRevisionInformation=1, - AclSizeInformation -} ACL_INFORMATION_CLASS; typedef struct tagHW_PROFILE_INFOA { DWORD dwDockInfo; CHAR szHwProfileGuid[HW_PROFILE_GUIDLEN]; diff --git a/reactos/include/psdk/winerror.h b/reactos/include/psdk/winerror.h index b5a00cb2829..0545f985024 100644 --- a/reactos/include/psdk/winerror.h +++ b/reactos/include/psdk/winerror.h @@ -1994,6 +1994,49 @@ #define CO_E_SXS_CONFIG _HRESULT_TYPEDEF_(0x80004032L) #define CO_E_MALFORMED_SPN _HRESULT_TYPEDEF_(0x80004033L) +/* Task Scheduler Service Error Codes */ +#define SCHED_S_TASK_READY _HRESULT_TYPEDEF_(0x00041300L) +#define SCHED_S_TASK_RUNNING _HRESULT_TYPEDEF_(0x00041301L) +#define SCHED_S_TASK_DISABLED _HRESULT_TYPEDEF_(0x00041302L) +#define SCHED_S_TASK_HAS_NOT_RUN _HRESULT_TYPEDEF_(0x00041303L) +#define SCHED_S_TASK_NO_MORE_RUNS _HRESULT_TYPEDEF_(0x00041304L) +#define SCHED_S_TASK_NOT_SCHEDULED _HRESULT_TYPEDEF_(0x00041305L) +#define SCHED_S_TASK_TERMINATED _HRESULT_TYPEDEF_(0x00041306L) +#define SCHED_S_TASK_NO_VALID_TRIGGERS _HRESULT_TYPEDEF_(0x00041307L) +#define SCHED_S_EVENT_TRIGGER _HRESULT_TYPEDEF_(0x00041308L) +#define SCHED_E_TRIGGER_NOT_FOUND _HRESULT_TYPEDEF_(0x80041309L) +#define SCHED_E_TASK_NOT_READY _HRESULT_TYPEDEF_(0x8004130AL) +#define SCHED_E_TASK_NOT_RUNNING _HRESULT_TYPEDEF_(0x8004130BL) +#define SCHED_E_SERVICE_NOT_INSTALLED _HRESULT_TYPEDEF_(0x8004130CL) +#define SCHED_E_CANNOT_OPEN_TASK _HRESULT_TYPEDEF_(0x8004130DL) +#define SCHED_E_INVALID_TASK _HRESULT_TYPEDEF_(0x8004130EL) +#define SCHED_E_ACCOUNT_INFORMATION_NOT_SET _HRESULT_TYPEDEF_(0x8004130FL) +#define SCHED_E_ACCOUNT_NAME_NOT_FOUND _HRESULT_TYPEDEF_(0x80041310L) +#define SCHED_E_ACCOUNT_DBASE_CORRUPT _HRESULT_TYPEDEF_(0x80041311L) +#define SCHED_E_NO_SECURITY_SERVICES _HRESULT_TYPEDEF_(0x80041312L) +#define SCHED_E_UNKNOWN_OBJECT_VERSION _HRESULT_TYPEDEF_(0x80041313L) +#define SCHED_E_UNSUPPORTED_ACCOUNT_OPTION _HRESULT_TYPEDEF_(0x80041314L) +#define SCHED_E_SERVICE_NOT_RUNNING _HRESULT_TYPEDEF_(0x80041315L) +#define SCHED_E_UNEXPECTEDNODE _HRESULT_TYPEDEF_(0x80041316L) +#define SCHED_E_NAMESPACE _HRESULT_TYPEDEF_(0x80041317L) +#define SCHED_E_INVALIDVALUE _HRESULT_TYPEDEF_(0x80041318L) +#define SCHED_E_MISSINGNODE _HRESULT_TYPEDEF_(0x80041319L) +#define SCHED_E_MALFORMEDXML _HRESULT_TYPEDEF_(0x8004131AL) +#define SCHED_S_SOME_TRIGGERS_FAILED _HRESULT_TYPEDEF_(0x0004131BL) +#define SCHED_S_BATCH_LOGON_PROBLEM _HRESULT_TYPEDEF_(0x0004131CL) +#define SCHED_E_TOO_MANY_NODES _HRESULT_TYPEDEF_(0x8004131DL) +#define SCHED_E_PAST_END_BOUNDARY _HRESULT_TYPEDEF_(0x8004131EL) +#define SCHED_E_ALREADY_RUNNING _HRESULT_TYPEDEF_(0x8004131FL) +#define SCHED_E_USER_NOT_LOGGED_ON _HRESULT_TYPEDEF_(0x80041320L) +#define SCHED_E_INVALID_TASK_HASH _HRESULT_TYPEDEF_(0x80041321L) +#define SCHED_E_SERVICE_NOT_AVAILABLE _HRESULT_TYPEDEF_(0x80041322L) +#define SCHED_E_SERVICE_TOO_BUSY _HRESULT_TYPEDEF_(0x80041323L) +#define SCHED_E_TASK_ATTEMPTED _HRESULT_TYPEDEF_(0x80041324L) +#define SCHED_S_TASK_QUEUED _HRESULT_TYPEDEF_(0x00041325L) +#define SCHED_E_TASK_DISABLED _HRESULT_TYPEDEF_(0x80041326L) +#define SCHED_E_TASK_NOT_V1_COMPAT _HRESULT_TYPEDEF_(0x80041327L) +#define SCHED_E_START_ON_DEMAND _HRESULT_TYPEDEF_(0x80041328L) + #define E_UNEXPECTED _HRESULT_TYPEDEF_(0x8000FFFFL) #define RPC_E_CALL_REJECTED _HRESULT_TYPEDEF_(0x80010001L) diff --git a/reactos/include/psdk/winnt.h b/reactos/include/psdk/winnt.h index 5e95559803e..70a727b5f89 100644 --- a/reactos/include/psdk/winnt.h +++ b/reactos/include/psdk/winnt.h @@ -1990,6 +1990,11 @@ typedef struct _ACL { WORD AceCount; WORD Sbz2; } ACL,*PACL; +typedef enum _ACL_INFORMATION_CLASS +{ + AclRevisionInformation = 1, + AclSizeInformation +} ACL_INFORMATION_CLASS; typedef struct _ACL_REVISION_INFORMATION { DWORD AclRevision; } ACL_REVISION_INFORMATION; diff --git a/reactos/include/psdk/wtypes.idl b/reactos/include/psdk/wtypes.idl index 844fda74c09..5d688df6ce7 100644 --- a/reactos/include/psdk/wtypes.idl +++ b/reactos/include/psdk/wtypes.idl @@ -207,6 +207,20 @@ typedef struct tagLOGPALETTE } LOGPALETTE, *PLOGPALETTE, *LPLOGPALETTE; cpp_quote("#endif") +cpp_quote("#ifndef _SYSTEMTIME_") +cpp_quote("#define _SYSTEMTIME_") +typedef struct _SYSTEMTIME{ + WORD wYear; + WORD wMonth; + WORD wDayOfWeek; + WORD wDay; + WORD wHour; + WORD wMinute; + WORD wSecond; + WORD wMilliseconds; +} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME; +cpp_quote("#endif") + cpp_quote("#ifndef _FILETIME_") cpp_quote("#define _FILETIME_") typedef struct _FILETIME { @@ -775,7 +789,7 @@ typedef struct tagQUERYCONTEXT DWORD dwVersionLo; } QUERYCONTEXT; -typedef [v1_enum] enum tagTYSPEC +typedef [v1_enum] enum tagTYSPEC { TYSPEC_CLSID, TYSPEC_FILEEXT, diff --git a/reactos/lib/sdk/uuid/uuid.c b/reactos/lib/sdk/uuid/uuid.c index a12b340e2bf..c242f846e7a 100644 --- a/reactos/lib/sdk/uuid/uuid.c +++ b/reactos/lib/sdk/uuid/uuid.c @@ -70,6 +70,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); #include "hlguids.h" #include "isguids.h" #include "objsafe.h" +#include "mstask.h" /* FIXME: cguids declares GUIDs but does not define their values */ diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 440e4b9bff7..89a2f83425c 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -64,6 +64,7 @@ reactos/dll/win32/mscoree # Autosync reactos/dll/win32/mshtml # Autosync reactos/dll/win32/msimg32 # Autosync reactos/dll/win32/msi # Autosync +reactos/dll/win32/mstask # Autosync reactos/dll/win32/msvcrt20 # Autosync reactos/dll/win32/msvfw32 # Autosync reactos/dll/win32/msxml3 # Synced to Wine-20071230