Leaked source code of windows server 2003
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.5 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. size_t bufLen);
  68. BOOL
  69. ContainsTemplateObject(
  70. UINT cidl,
  71. LPCITEMIDLIST *apidl);
  72. VOID
  73. CheckSaDat(
  74. LPCTSTR tszFolderPath);
  75. //+---------------------------------------------------------------------------
  76. //
  77. // Function: NewDupString
  78. //
  79. // Synopsis: Allocates memory & duplicates a given string.
  80. //
  81. // Arguments: [lpszIn] -- IN the string to duplicate.
  82. //
  83. // Returns: HRESULT. The duplicated string. NULL on error.
  84. //
  85. // History: April 1994 RaviR Created
  86. //
  87. //+---------------------------------------------------------------------------
  88. inline
  89. LPTSTR
  90. NewDupString(
  91. LPCTSTR lpszIn)
  92. {
  93. register ULONG len = lstrlen(lpszIn) + 1;
  94. TCHAR * lpszOut = new TCHAR[len];
  95. if (lpszOut != NULL)
  96. {
  97. CopyMemory(lpszOut, lpszIn, len * sizeof(TCHAR));
  98. }
  99. return lpszOut;
  100. }
  101. //+---------------------------------------------------------------------------
  102. //
  103. // Function: CoTaskDupString
  104. //
  105. // Synopsis: Allocates memory & duplicates a given string.
  106. //
  107. // Arguments: [lpszIn] -- IN the string to duplicate.
  108. //
  109. // Returns: HRESULT. The duplicated string. NULL on error.
  110. //
  111. // History: April 1994 RaviR Created
  112. //
  113. //+---------------------------------------------------------------------------
  114. inline
  115. LPTSTR
  116. CoTaskDupString(
  117. LPTSTR lpszIn)
  118. {
  119. register ULONG cbTemp = (lstrlen(lpszIn) + 1) * sizeof(TCHAR);
  120. LPTSTR lpszOut = (LPTSTR)CoTaskMemAlloc(cbTemp);
  121. if (lpszOut != NULL)
  122. {
  123. CopyMemory(lpszOut, lpszIn, cbTemp);
  124. }
  125. return (lpszOut);
  126. }
  127. //___________________________________________________________________________
  128. //___________________________________________________________________________
  129. //___________________________________________________________________________
  130. //___________________________________________________________________________
  131. #if DBG==1
  132. LPTSTR DbgGetTimeStr(SYSTEMTIME &st);
  133. LPTSTR DbgGetTimeStr(FILETIME &ft);
  134. #endif
  135. #endif // __UTIL_HXX__