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.

65 lines
1.5 KiB

  1. #ifndef _UTIL_H_
  2. #define _UTIL_H_
  3. #include <macros.h>
  4. #include <cstrings.h>
  5. #include <regclass.h>
  6. #include <fusenetincludes.h>
  7. #undef SAFEDELETE
  8. #define SAFEDELETE(p) if ((p) != NULL) { delete (p); (p) = NULL; };
  9. #undef SAFEDELETEARRAY
  10. #define SAFEDELETEARRAY(p) if ((p) != NULL) { delete[] (p); (p) = NULL; };
  11. #undef SAFERELEASE
  12. #define SAFERELEASE(p) if ((p) != NULL) { (p)->Release(); (p) = NULL; };
  13. #define KNOWN_SYSTEM_ASSEMBLY 0
  14. #define KNOWN_TRUSTED_ASSEMBLY 1
  15. inline
  16. WCHAR*
  17. WSTRDupDynamic(LPCWSTR pwszSrc)
  18. {
  19. LPWSTR pwszDest = NULL;
  20. if (pwszSrc != NULL)
  21. {
  22. const DWORD dwLen = lstrlenW(pwszSrc) + 1;
  23. pwszDest = new WCHAR[dwLen];
  24. if( pwszDest )
  25. memcpy(pwszDest, pwszSrc, dwLen * sizeof(WCHAR));
  26. }
  27. return pwszDest;
  28. }
  29. HRESULT ConvertVersionStrToULL(LPCWSTR pwzVerStr, ULONGLONG *pullVersion);
  30. HRESULT
  31. RemoveDirectoryAndChildren(LPWSTR szDir);
  32. HRESULT FusionpHresultFromLastError();
  33. VOID MakeRandomString(LPWSTR wzRandom, DWORD cc);
  34. HRESULT CreateRandomDir(LPWSTR pwzRootPath, LPWSTR pwzRandomDir, DWORD cchDirLen);
  35. HRESULT CreateDirectoryHierarchy(LPWSTR pwzRootDir, LPWSTR pwzFilePath);
  36. HRESULT IsKnownAssembly(IAssemblyIdentity *pId, DWORD dwFlags);
  37. BOOL EnsureDebuggerPresent();
  38. BOOL DoHeapValidate();
  39. HRESULT DoPathCombine(CString& sDest, LPWSTR pwzSource);
  40. HRESULT CheckFileExistence(LPCWSTR pwzFile, BOOL *pbExists);
  41. HRESULT FusionCompareString(LPCWSTR pwz1, LPWSTR pwz2, DWORD dwFlags);
  42. #endif // _UTIL_H_