Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1996.
  5. //
  6. // File: util.hxx
  7. //
  8. // Contents: Utility macros and function prototypes.
  9. //
  10. // History: 04-20-95 DavidMun Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #ifndef __UTIL_HXX
  14. #define __UTIL_HXX
  15. //
  16. // Fuctions
  17. //
  18. HRESULT Activate(
  19. WCHAR *wszFileName,
  20. ITask **ppJob,
  21. IUnknown **ppQueue,
  22. BOOL *pfJob);
  23. LPCWSTR GetMonthsString(WORD rgfMonths);
  24. LPCSTR GetInterfaceString(REFIID iid);
  25. LPCSTR GetPriorityString(DWORD dwPriority);
  26. LPCSTR GetJobFlagsString(DWORD flJobFlags);
  27. LPCSTR GetTriggerTypeString(TASK_TRIGGER_TYPE TriggerType);
  28. LPCSTR GetDaysString(DWORD rgfDays);
  29. LPCSTR GetDaysOfWeekString(WORD flDaysOfTheWeek);
  30. LPCSTR GetStatusString(HRESULT hrJobStatus);
  31. HRESULT GetMoniker(WCHAR *wszFilename, IMoniker **ppmk);
  32. HRESULT Bind(WCHAR *wszFilename, REFIID iidToBind, VOID **ppitf);
  33. HRESULT DupString(const WCHAR *wszSource, WCHAR **ppwszDest);
  34. HRESULT DumpJob(ITask *pJob);
  35. VOID DumpJobFlags(DWORD flJobFlags);
  36. HRESULT DumpTrigger(BOOL fJob, USHORT usTrigger);
  37. HRESULT DumpTriggers(BOOL fJob);
  38. HRESULT DumpJobTriggers(ITask *pJob);
  39. HRESULT SaveIfDirty(ITask *pJob);
  40. HRESULT SaveIfDirty(IUnknown *pJobQueue);
  41. HRESULT _SaveIfDirty(IPersistFile *pPersistFile);
  42. HRESULT HasFilename(IPersistFile *pPersistFile);
  43. BOOL FileExists(LPWSTR wszFile);
  44. HRESULT GetEnumeratorSlot(WCHAR **ppwsz, ULONG *pidxSlot);
  45. HRESULT GetAndPrepareEnumeratorSlot(WCHAR **ppwsz, ULONG *pidxSlot);
  46. HRESULT VerifySlotFilled(ULONG idxSlot);
  47. VOID AddSeconds(SYSTEMTIME *pst, ULONG ulSeconds);
  48. //
  49. // Utility macros
  50. //
  51. #define LOG_AND_BREAK_ON_FAIL(hr, str) \
  52. if (FAILED(hr)) \
  53. { \
  54. g_Log.Write(LOG_FAIL, str " hr=%#010x", hr); \
  55. break; \
  56. }
  57. #define BREAK_ON_FAILURE(hr) if (FAILED(hr)) break;
  58. #define ARRAY_LEN(a) (sizeof(a)/sizeof(a[0]))
  59. #endif // __UTIL_HXX