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.

107 lines
4.8 KiB

  1. //#pragma title("TFile.hpp - Install File class")
  2. /*---------------------------------------------------------------------------
  3. File: TFile.hpp
  4. Comments: This file contains file installation functions.
  5. (c) Copyright 1995-1998, Mission Critical Software, Inc., All Rights Reserved
  6. Proprietary and confidential to Mission Critical SOftware, Inc.
  7. REVISION LOG ENTRY
  8. Author: Juan Medrano
  9. Revision By: ...
  10. Revised on 7/9/97
  11. Revision By: Christy Boles
  12. Converted to UNICODE, removed dependency on CString
  13. ---------------------------------------------------------------------------*/
  14. #ifndef MCSINC_TFile_hpp
  15. #define MCSINC_TFile_hpp
  16. class TInstallFile
  17. {
  18. protected:
  19. TCHAR m_szFileName[MAX_PATH]; // file name (not a full path)
  20. TCHAR m_szFilePath[MAX_PATH]; // full path (including file name)
  21. TCHAR m_szTargetPath[MAX_PATH]; // target path (full path)
  22. TCHAR m_szFileVersion[MAX_PATH]; // file version string from version resource
  23. TCHAR m_szFileSize[MAX_PATH]; // file size
  24. TCHAR m_szFileDateTime[MAX_PATH]; // modification date/time
  25. TCHAR * m_VersionInfo; // version info
  26. DWORD m_dwLanguageCode; // language code for version info strings
  27. VS_FIXEDFILEINFO m_FixedFileInfo; // file info structure from version resource
  28. WIN32_FIND_DATA m_FileData; // structure for FindFirstFile()
  29. BOOL m_bCopyNeeded; // does this file need to be copied?
  30. BOOL m_bSilent;
  31. public:
  32. TInstallFile( TCHAR const * pszFileName = NULL,
  33. TCHAR const * pszFileDir = NULL,
  34. BOOL silent = FALSE);
  35. ~TInstallFile() { delete [] m_VersionInfo; }
  36. DWORD OpenFileInfo( TCHAR const * pszFileDir );
  37. TCHAR * GetFileName() { return m_szFileName; }
  38. TCHAR * GetFilePath() { return m_szFilePath; }
  39. TCHAR * GetTargetPath() { return m_szTargetPath; }
  40. void SetFileName( TCHAR const * pszFileName ) { safecopy(m_szFileName,pszFileName); }
  41. void SetFilePath( TCHAR const * pszFilePath ) { safecopy(m_szFilePath,pszFilePath); }
  42. void SetTargetPath( TCHAR const * pszTargetPath ) { safecopy(m_szTargetPath,pszTargetPath); }
  43. void SetCopyNeeded( BOOL bCopyNeeded ) { m_bCopyNeeded = bCopyNeeded; }
  44. BOOL IsCopyNeeded() { return m_bCopyNeeded; }
  45. DWORD CopyTo( TCHAR const * pszDestinationPath );
  46. DWORD CopyToTarget() { return CopyTo( m_szTargetPath ); }
  47. int CompareFile( TInstallFile * pFileTrg );
  48. int CompareFileSize( TInstallFile * pFileTrg );
  49. int CompareFileDateTime( TInstallFile * pFileTrg );
  50. int CompareFileVersion( TInstallFile * pFileTrg );
  51. void GetFileVersion( UINT * uVerMaj, UINT * uVerMin, UINT * uVerRel, UINT * uVerMod );
  52. DWORD GetFileSize() { return m_FileData.nFileSizeLow; }
  53. FILETIME GetFileDateTime() { return m_FileData.ftLastWriteTime; }
  54. TCHAR * GetFileVersionString();
  55. TCHAR * GetFileSizeString();
  56. TCHAR * GetFileDateTimeString( TCHAR const * szFormatString = TEXT("%#c") );
  57. BOOL IsBusy();
  58. };
  59. class TDllFile : public TInstallFile
  60. {
  61. protected:
  62. TCHAR m_szProgId[MAX_PATH]; // Prog ID (OCX's only)
  63. TCHAR m_szRegPath[MAX_PATH]; // full path where file is currently registered
  64. BOOL m_bSystemFile; // should this file be located in system32?
  65. BOOL m_bRegistrationNeeded; // do we need to register this file?
  66. BOOL m_bRegisterTarget; // do we need to register this file on the target path?
  67. public:
  68. TDllFile( TCHAR const * pszFileName = NULL,
  69. TCHAR const * pszFileDir = NULL,
  70. TCHAR const * pszProgId = NULL,
  71. BOOL bSystemFile = FALSE );
  72. ~TDllFile() {};
  73. BOOL SupportsSelfReg();
  74. BOOL IsRegistered();
  75. BOOL IsRegistrationNeeded() { return m_bRegistrationNeeded; }
  76. BOOL DoRegisterTarget() { return m_bRegisterTarget; }
  77. BOOL IsSystemFile() { return m_bSystemFile; }
  78. DWORD CallDllFunction( TCHAR const * pszFunctionName, TCHAR const * pszDllName = NULL );
  79. DWORD Register();
  80. DWORD Unregister();
  81. TCHAR * GetProgId() { return m_szProgId; }
  82. TCHAR * GetRegPath() { return m_szRegPath; }
  83. void SetRegistrationNeeded( BOOL bRegistrationNeeded ) { m_bRegistrationNeeded = bRegistrationNeeded; }
  84. void SetRegisterTarget( BOOL bRegisterTarget ) { m_bRegisterTarget = bRegisterTarget; }
  85. void SetProgId( TCHAR const * pszProgId ) { safecopy(m_szProgId,pszProgId); }
  86. };
  87. #endif // MCSINC_TFile_hpp
  88. // TFile.hpp - end of file