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.

84 lines
3.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000
  6. //
  7. // File: cscpin.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __CSCPIN_CSCPIN_H_
  11. #define __CSCPIN_CSCPIN_H_
  12. #include "print.h"
  13. //
  14. // This structure contains the information the user passed on the command
  15. // line.
  16. //
  17. struct CSCPIN_INFO
  18. {
  19. LPCTSTR pszFile; // Single file or input file listing multiple files.
  20. LPCTSTR pszLogFile; // Non-null if log file is to be used.
  21. BOOL bUseListFile; // pszFile is the name of a listing file.
  22. BOOL bPin; // TRUE == Default behavior is 'pin'.
  23. BOOL bPinDefaultSet; // TRUE if user specified -p or -u cmd line param.
  24. BOOL bVerbose; // TRUE == Output verbose information.
  25. };
  26. //-----------------------------------------------------------------------------
  27. // CCscPin
  28. //
  29. // This class coordinates the pinning and unpinning of an entire set of
  30. // files and directories. It is initialized with information provided on the
  31. // command line through a CSCPIN_INFO structure. The object client calls
  32. // the Run() method to start the pinning/unpinning process.
  33. //
  34. //-----------------------------------------------------------------------------
  35. class CCscPin
  36. {
  37. public:
  38. CCscPin(const CSCPIN_INFO& info);
  39. ~CCscPin(void);
  40. HRESULT Run(void);
  41. private:
  42. WCHAR m_szFile[MAX_PATH]; // The single file or the listfile.
  43. BOOL m_bUseListFile; // m_szFile is a listfile.
  44. BOOL m_bPin; // TRUE if -p specified, FALSE if -u.
  45. BOOL m_bPinDefaultSet; // TRUE if either -p or -u specified.
  46. BOOL m_bVerbose; // TRUE if -v specified.
  47. BOOL m_bBreakDetected; // TRUE if a console break occured.
  48. int m_cFilesPinned; // Count of files pinned.
  49. int m_cCscErrors; // Count of CSC errors that occured.
  50. CPrint m_pr; // Console/Log output object.
  51. HRESULT _ProcessThisPath(LPCTSTR pszFile, BOOL bPin);
  52. HRESULT _ProcessPathsInFile(LPCTSTR pszFile);
  53. HRESULT _FillSparseFiles(void);
  54. DWORD _TranslateFillResult(DWORD dwError, DWORD dwStatus, DWORD *pdwCscAction);
  55. BOOL _IsAdminPinPolicyActive(void);
  56. BOOL _DetectConsoleBreak(void);
  57. static DWORD WINAPI _FolderCallback(
  58. LPCWSTR pszItem,
  59. ENUM_REASON eReason,
  60. WIN32_FIND_DATAW *pFind32,
  61. LPARAM pContext);
  62. static DWORD WINAPI _FillSparseFilesCallback(
  63. LPCWSTR pszName,
  64. DWORD dwStatus,
  65. DWORD dwHintFlags,
  66. DWORD dwPinCount,
  67. WIN32_FIND_DATAW *pfd,
  68. DWORD dwReason,
  69. DWORD dwParam1,
  70. DWORD dwParam2,
  71. DWORD_PTR dwContext);
  72. };
  73. #endif // __CSCPIN_CSCPIN_H_