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.

359 lines
6.0 KiB

  1. //*************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation 1998
  4. // All rights reserved
  5. //
  6. // util.hxx
  7. //
  8. //*************************************************************
  9. #ifndef _UTIL_HXX_
  10. #define _UTIL_HXX_
  11. #define HOMESHARE_VARIABLE L"%HOMESHARE%"
  12. #define HOMESHARE_VARLEN 11
  13. #define HOMEDRIVE_VARIABLE L"%HOMEDRIVE%"
  14. #define HOMEDRIVE_VARLEN 11
  15. #define HOMEPATH_VARIABLE L"%HOMEPATH%"
  16. #define HOMEPATH_VARLEN 10
  17. typedef enum tagCSCPinCommands
  18. {
  19. PinFile,
  20. UnpinFile
  21. } CSCPINCOMMAND;
  22. //
  23. //class to keep track of copy failures in a recursive file copy operation
  24. //
  25. class CCopyFailData {
  26. public:
  27. CCopyFailData();
  28. ~CCopyFailData();
  29. DWORD RegisterFailure (LPCTSTR pwszSource, LPCTSTR pwszDest);
  30. BOOL IsCopyFailure(void);
  31. LPCTSTR GetSourceName (void);
  32. LPCTSTR GetDestName (void);
  33. private:
  34. BOOL m_bCopyFailed;
  35. DWORD m_dwSourceBufLen;
  36. WCHAR * m_pwszSourceName;
  37. DWORD m_dwDestBufLen;
  38. WCHAR * m_pwszDestName;
  39. };
  40. DWORD
  41. IsOnNTFS(
  42. const WCHAR* pwszPath
  43. );
  44. void
  45. ModifyAccessAllowedAceCounts (
  46. PACE_HEADER pAce,
  47. LONG* pCount,
  48. LONG* pContainerCount,
  49. LONG* pObjectCount
  50. );
  51. DWORD
  52. RestrictMyDocsRedirection(
  53. HANDLE hToken,
  54. HKEY hKeyRoot,
  55. BOOL fRestrict
  56. );
  57. BOOL
  58. GroupInList (
  59. WCHAR * pwszSid,
  60. PTOKEN_GROUPS pGroups
  61. );
  62. NTSTATUS
  63. AllocateAndInitSidFromString (
  64. const WCHAR* lpszSidStr,
  65. PSID* ppSid
  66. );
  67. NTSTATUS
  68. LoadSidAuthFromString (
  69. const WCHAR* pString,
  70. PSID_IDENTIFIER_AUTHORITY pSidAuth
  71. );
  72. NTSTATUS
  73. GetIntFromUnicodeString (
  74. const WCHAR* szNum,
  75. ULONG Base,
  76. PULONG pValue
  77. );
  78. DWORD CALLBACK CopyProgressRoutine (
  79. LARGE_INTEGER TotalFileSize,
  80. LARGE_INTEGER TotalBytesTransferred,
  81. LARGE_INTEGER StreamSize,
  82. LARGE_INTEGER StreamBytesTransferred,
  83. DWORD dwStreamNumber,
  84. DWORD dwCallbackReason,
  85. HANDLE hSourceFile,
  86. HANDLE hDestinationFile,
  87. LPVOID lpData
  88. );
  89. DWORD FullFileCopyW (
  90. const WCHAR* wszSource,
  91. const WCHAR* wszDest,
  92. BOOL bFailIfExists
  93. );
  94. DWORD FullDirCopyW (
  95. const WCHAR* pwszSource,
  96. const WCHAR* pwszDest,
  97. BOOL bSkipDacl
  98. );
  99. DWORD FileInDir (
  100. LPCWSTR pwszFile,
  101. LPCWSTR pwszDir,
  102. BOOL* pExists
  103. );
  104. DWORD ComparePaths (
  105. LPCWSTR pwszSource,
  106. LPCWSTR pwszDest,
  107. int* pResult
  108. );
  109. DWORD
  110. CheckIdenticalSpecial (
  111. LPCWSTR pwszSource,
  112. LPCWSTR pwszDest,
  113. int* pResult
  114. );
  115. LPTSTR CheckSlash (
  116. LPTSTR lpDir
  117. );
  118. BOOL RegDelnodeRecurse (
  119. HKEY hKeyRoot,
  120. LPTSTR lpSubKey
  121. );
  122. BOOL RegDelnode (
  123. HKEY hKeyRoot,
  124. LPTSTR lpSubKey
  125. );
  126. void GetSetOwnerPrivileges (
  127. HANDLE hToken
  128. );
  129. DWORD
  130. SafeGetPrivateProfileStringW (
  131. const WCHAR * pwszSection,
  132. const WCHAR * pwszKey,
  133. const WCHAR * pwszDefault,
  134. WCHAR ** ppwszReturnedString,
  135. DWORD * pSize,
  136. const WCHAR * pwszIniFile
  137. );
  138. DWORD
  139. MySidCopy (
  140. PSID * ppDestSid,
  141. PSID pSourceSid
  142. );
  143. BOOL GetShareStatus (
  144. const WCHAR * pwszShare,
  145. DWORD * pdwStatus,
  146. DWORD * pdwPinCount,
  147. DWORD * pdwHints
  148. );
  149. SHARESTATUS
  150. GetCSCStatus (
  151. const WCHAR * pwszPath
  152. );
  153. void
  154. MoveDirInCSC (
  155. const WCHAR * pwszSource,
  156. const WCHAR * pwszDest,
  157. const WCHAR * pwszSkipSubdir,
  158. SHARESTATUS StatusFrom,
  159. SHARESTATUS StatusTo,
  160. BOOL bAllowRdrTimeoutForDel,
  161. BOOL bAllowRdrTimeoutForRen
  162. );
  163. DWORD
  164. DoCSCRename (
  165. const WCHAR * pwszSource,
  166. const WCHAR * pwszDest,
  167. BOOL bOverwrite,
  168. BOOL bAllowRdrTimeout
  169. );
  170. DWORD
  171. DeleteCSCFileTree (
  172. const WCHAR * pwszSource,
  173. const WCHAR * pwszSkipSubdir,
  174. BOOL bAllowRdrTimeout
  175. );
  176. DWORD
  177. DeleteCSCFile (
  178. const WCHAR * pwszPath,
  179. BOOL bAllowRdrTimeout
  180. );
  181. void
  182. DisplayStatusMessage (
  183. UINT rid
  184. );
  185. DWORD
  186. DeleteCSCShareIfEmpty (
  187. LPCTSTR pwszFileName,
  188. SHARESTATUS shStatus
  189. );
  190. DWORD
  191. MergePinInfo (
  192. LPCTSTR pwszSource,
  193. LPCTSTR pwszDest,
  194. SHARESTATUS StatusFrom,
  195. SHARESTATUS StatusTo
  196. );
  197. DWORD
  198. PinIfNecessary (
  199. const WCHAR * pwszPath,
  200. SHARESTATUS shStatus
  201. );
  202. DWORD
  203. CacheDesktopIni (
  204. LPCTSTR pwszPath,
  205. SHARESTATUS shStatus,
  206. CSCPINCOMMAND uCommand
  207. );
  208. DWORD WINAPI
  209. CSCCallbackProc (
  210. LPCTSTR pszName,
  211. DWORD dwStatus,
  212. DWORD dwHintFlags,
  213. DWORD dwPinCount,
  214. LPWIN32_FIND_DATA pFind32,
  215. DWORD dwReason,
  216. DWORD dwParam1,
  217. DWORD dwParam2,
  218. DWORD_PTR dwContext
  219. );
  220. HRESULT
  221. UpdateMyPicsShellLinks (
  222. HANDLE hUserToken,
  223. const WCHAR * pwszMyPicsLocName
  224. );
  225. DWORD
  226. LoadLocalizedFolderNames (
  227. void
  228. );
  229. DWORD
  230. DeleteCachedConfigFiles (
  231. const PGROUP_POLICY_OBJECT pGPOList,
  232. CFileDB * pFileDB
  233. );
  234. void
  235. SimplifyPath (
  236. WCHAR * pwszPath
  237. );
  238. DWORD
  239. PrecreateUnicodeIniFile (
  240. LPCTSTR lpszFilePath
  241. );
  242. BOOL
  243. IsPathLocal (
  244. LPCWSTR pwszPath
  245. );
  246. DWORD
  247. ExpandPathSpecial (
  248. CFileDB * pFileDB,
  249. const WCHAR * pwszPath,
  250. const WCHAR * pwszUserName,
  251. WCHAR * wszExpandedPath,
  252. ULONG * pDesiredBufferSize = NULL
  253. );
  254. DWORD
  255. ExpandHomeDir (
  256. REDIRECTABLE rID,
  257. const WCHAR * pwszPath,
  258. BOOL bAllowMyPics,
  259. WCHAR ** ppwszExpandedPath,
  260. const WCHAR * pwszHomedir = NULL
  261. );
  262. DWORD
  263. ExpandHomeDirPolicyPath (
  264. REDIRECTABLE rID,
  265. const WCHAR * pwszPath,
  266. BOOL bAllowMyPics,
  267. WCHAR ** ppwszExpandedPath,
  268. const WCHAR * pwszHomedir = NULL
  269. );
  270. BOOL
  271. IsHomedirPath (
  272. REDIRECTABLE rID,
  273. LPCWSTR pwszPath,
  274. BOOL bAllowMyPics
  275. );
  276. BOOL
  277. IsHomedirPolicyPath (
  278. REDIRECTABLE rID,
  279. LPCWSTR pwszPath,
  280. BOOL bAllowMyPics
  281. );
  282. BOOL
  283. HasHomeVariables (
  284. LPCWSTR pwszPath
  285. );
  286. DWORD
  287. GetWin32ErrFromHResult (
  288. HRESULT hr
  289. );
  290. DWORD
  291. GetExpandedPath(
  292. IN CFileDB* pFileDB,
  293. IN WCHAR* wszSourcePath,
  294. IN int rID,
  295. IN BOOL bAllowMyPics,
  296. OUT WCHAR** ppwszExpandedPath);
  297. #endif _UTIL_HXX_