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.

166 lines
3.3 KiB

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1996.
  5. //
  6. // File: util.hxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 08-Jan-96 RaviR Created.
  15. // 11-Jul-96 MarkBl Added JFxxx protos.
  16. //
  17. //____________________________________________________________________________
  18. #ifndef __UTIL_HXX__
  19. #define __UTIL_HXX__
  20. class CJob;
  21. HRESULT
  22. JFCreateAndLoadTask(
  23. LPCTSTR pszFolderPath,
  24. LPTSTR pszJob,
  25. ITask ** ppITask);
  26. HRESULT
  27. JFCreateAndLoadCJob(
  28. LPCTSTR pszFolderPath,
  29. LPTSTR pszJob,
  30. CJob ** ppJob);
  31. HRESULT
  32. JFGetAppNameForTask(
  33. LPCTSTR pszTask,
  34. LPTSTR pszAppName,
  35. UINT cchAppName);
  36. HRESULT
  37. JFGetJobFolder(
  38. REFIID riid,
  39. LPVOID* ppvObj);
  40. HRESULT
  41. JFSaveJob(
  42. HWND hwndOwner,
  43. ITask * pITask,
  44. BOOL fSecuritySupported,
  45. BOOL fTaskAccountChange,
  46. BOOL fTaskApplicationChange,
  47. BOOL fSuppressAccountInformationRequest = FALSE);
  48. HMENU
  49. UtGetMenuFromID(
  50. HMENU hmMain,
  51. UINT uID);
  52. int
  53. UtMergePopupMenus(
  54. HMENU hmMain,
  55. HMENU hmMerge,
  56. int idCmdFirst,
  57. int idCmdLast);
  58. void
  59. UtMergeMenu(
  60. HINSTANCE hinst,
  61. UINT idMainMerge,
  62. UINT idPopupMerge,
  63. LPQCMINFO pqcm);
  64. void
  65. EnsureUniquenessOfFileName(
  66. LPTSTR pszFile);
  67. BOOL
  68. ContainsTemplateObject(
  69. UINT cidl,
  70. LPCITEMIDLIST *apidl);
  71. VOID
  72. CheckSaDat(
  73. LPCTSTR tszFolderPath);
  74. //+---------------------------------------------------------------------------
  75. //
  76. // Function: NewDupString
  77. //
  78. // Synopsis: Allocates memory & duplicates a given string.
  79. //
  80. // Arguments: [lpszIn] -- IN the string to duplicate.
  81. //
  82. // Returns: HRESULT. The duplicated string. NULL on error.
  83. //
  84. // History: April 1994 RaviR Created
  85. //
  86. //+---------------------------------------------------------------------------
  87. inline
  88. LPTSTR
  89. NewDupString(
  90. LPCTSTR lpszIn)
  91. {
  92. register ULONG len = lstrlen(lpszIn) + 1;
  93. TCHAR * lpszOut = new TCHAR[len];
  94. if (lpszOut != NULL)
  95. {
  96. CopyMemory(lpszOut, lpszIn, len * sizeof(TCHAR));
  97. }
  98. return lpszOut;
  99. }
  100. //+---------------------------------------------------------------------------
  101. //
  102. // Function: CoTaskDupString
  103. //
  104. // Synopsis: Allocates memory & duplicates a given string.
  105. //
  106. // Arguments: [lpszIn] -- IN the string to duplicate.
  107. //
  108. // Returns: HRESULT. The duplicated string. NULL on error.
  109. //
  110. // History: April 1994 RaviR Created
  111. //
  112. //+---------------------------------------------------------------------------
  113. inline
  114. LPTSTR
  115. CoTaskDupString(
  116. LPTSTR lpszIn)
  117. {
  118. register ULONG cbTemp = (lstrlen(lpszIn) + 1) * sizeof(TCHAR);
  119. LPTSTR lpszOut = (LPTSTR)CoTaskMemAlloc(cbTemp);
  120. if (lpszOut != NULL)
  121. {
  122. CopyMemory(lpszOut, lpszIn, cbTemp);
  123. }
  124. return (lpszOut);
  125. }
  126. //___________________________________________________________________________
  127. //___________________________________________________________________________
  128. //___________________________________________________________________________
  129. //___________________________________________________________________________
  130. #if DBG==1
  131. LPTSTR DbgGetTimeStr(SYSTEMTIME &st);
  132. LPTSTR DbgGetTimeStr(FILETIME &ft);
  133. #endif
  134. #endif // __UTIL_HXX__