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.

64 lines
2.4 KiB

  1. /******************************************************************************
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. wusafefn.h
  5. Abstract:
  6. definitions for WU safe functions
  7. ******************************************************************************/
  8. #pragma once
  9. #include "SafeFile.h" // file operations (SafeCreateFile, etc.)
  10. #include "SafeReg.h" // registry operations (SafeRegQueryStringValueCch, etc.)
  11. // path manipulation
  12. HRESULT PathCchCombineA(LPSTR szPath, DWORD cchPathBuff, LPCSTR szPrefix, LPCSTR szSuffix);
  13. HRESULT PathCchCombineW(LPWSTR szPath, DWORD cchPathBuff, LPCWSTR szPrefix, LPCWSTR szSuffix);
  14. HRESULT PathCchAppendA(LPSTR szPath, DWORD cchPathBuff, LPCSTR szNew);
  15. HRESULT PathCchAppendW(LPWSTR szPath, DWORD cchPathBuff, LPCWSTR szNew);
  16. HRESULT PathCchAddBackslashA(LPSTR szPath, DWORD cchPathBuff);
  17. HRESULT PathCchAddBackslashW(LPWSTR szPath, DWORD cchPathBuff);
  18. HRESULT PathCchCanonicalizeA(LPSTR pszDest, DWORD cchDest, LPCSTR pszSrc);
  19. HRESULT PathCchCanonicalizeW(LPWSTR pszDest, DWORD cchDest, LPCWSTR pszSrc);
  20. HRESULT PathCchAddExtensionA(LPSTR pszPath, DWORD cchPath, LPCSTR pszExt);
  21. HRESULT PathCchAddExtensionW(LPWSTR pszPath, DWORD cchPath, LPCWSTR pszExt);
  22. HRESULT PathCchRenameExtensionA(LPSTR pszPath, DWORD cchPath, LPCSTR pszExt);
  23. HRESULT PathCchRenameExtensionW(LPWSTR pszPath, DWORD cchPath, LPCWSTR pszExt);
  24. #if defined(UNICODE) || defined(_UNICODE)
  25. #define PathCchCombine PathCchCombineW
  26. #define PathCchAppend PathCchAppendW
  27. #define PathCchAddBackslash PathCchAddBackslashW
  28. #define PathCchCanonicalize PathCchCanonicalizeW
  29. #define PathCchAddExtension PathCchAddExtensionW
  30. #define PathCchRenameExtension PathCchRenameExtensionW
  31. #else
  32. #define PathCchCombine PathCchCombineA
  33. #define PathCchAppend PathCchAppendA
  34. #define PathCchAddBackslash PathCchAddBackslashA
  35. #define PathCchCanonicalize PathCchCanonicalizeA
  36. #define PathCchAddExtension PathCchAddExtensionA
  37. #define PathCchRenameExtension PathCchRenameExtensionA
  38. #endif
  39. // Load library
  40. HMODULE WINAPI LoadLibraryFromSystemDir(LPCTSTR szModule);
  41. // Critical sections
  42. // Spin count passed to InitializeCriticalSectionAndSpinCount
  43. #define DEFAULT_CS_SPIN_COUNT 0x80000FA0
  44. BOOL WINAPI WUInitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION lpcs, DWORD dwSpinCount);
  45. inline BOOL WINAPI SafeInitializeCriticalSection(LPCRITICAL_SECTION lpcs)
  46. {
  47. return WUInitializeCriticalSectionAndSpinCount(lpcs, DEFAULT_CS_SPIN_COUNT);
  48. }