Back to index

lightning-sunbird  0.9+nobinonly
IEPatcherDlg.h
Go to the documentation of this file.
00001 // IEPatcherDlg.h : header file
00002 //
00003 
00004 #if !defined(AFX_IEPATCHERDLG_H__A603167C_3B36_11D2_B44D_00600819607E__INCLUDED_)
00005 #define AFX_IEPATCHERDLG_H__A603167C_3B36_11D2_B44D_00600819607E__INCLUDED_
00006 
00007 #if _MSC_VER >= 1000
00008 #pragma once
00009 #endif // _MSC_VER >= 1000
00010 
00011 class CIEPatcherDlgAutoProxy;
00012 
00013 enum PatchStatus
00014 {
00015        psFileError,
00016        psUnknownStatus,
00017        psPatchPending,
00018        psNotPatchable,
00019        psPatchable,
00020        psMayBePatchable,
00021        psAlreadyPatched
00022 };
00023 
00024 struct QueuedFileData
00025 {
00026        CString sFileName;
00027        CString sPatchedFileName;
00028        PatchStatus ps;
00029 };
00030 
00031 #define WM_UPDATEFILESTATUS WM_USER+1
00032 
00034 // CIEPatcherDlg dialog
00035 
00036 class CIEPatcherDlg : public CDialog
00037 {
00038        DECLARE_DYNAMIC(CIEPatcherDlg);
00039        friend class CIEPatcherDlgAutoProxy;
00040 
00041 // Construction
00042 public:
00043        void AddFileToList(const CString &sFile);
00044        BOOL GetPendingFileToScan(CString &sFileToScan);
00045        BOOL GetPendingFileToPatch(CString &sFileToPatch);
00046        
00047        static PatchStatus ScanFile(const CString &sFileName);
00048        static PatchStatus ScanBuffer(char *pszBuffer, long nBufferSize, BOOL bApplyPatches);
00049        static BOOL PatchFile(const CString & sFileFrom, const CString & sFileTo, PatchStatus *pPatchStatus);
00050        
00051        static BOOL WriteBufferToFile(const CString &sFileName, char *pszBuffer, long nBufferSize);
00052        static BOOL ReadFileToBuffer(const CString &sFileName, char **ppszBuffer, long *pnBufferSize);
00053        static void TraceProgress(const CString &sProgress);
00054        
00055        void UpdateFileStatus(const CString &sFile, PatchStatus ps);
00056        void UpdateFileStatus(int nFileIndex, const CString &sFile, PatchStatus ps);
00057 
00058 
00059        CIEPatcherDlg(CWnd* pParent = NULL);      // standard constructor
00060        virtual ~CIEPatcherDlg();
00061 
00062        CImageList m_cImageList;
00063 
00064        CArray<QueuedFileData *, QueuedFileData *> m_cQueuedFileDataList;
00065        CCriticalSection m_csQueuedFileDataList;
00066 
00067 // Dialog Data
00068        //{{AFX_DATA(CIEPatcherDlg)
00069        enum { IDD = IDD_IEPATCHER_DIALOG };
00070        CButton       m_btnPatch;
00071        CListCtrl     m_cFileList;
00072        //}}AFX_DATA
00073 
00074        // ClassWizard generated virtual function overrides
00075        //{{AFX_VIRTUAL(CIEPatcherDlg)
00076        protected:
00077        virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
00078        //}}AFX_VIRTUAL
00079 
00080 // Implementation
00081 protected:
00082        CIEPatcherDlgAutoProxy* m_pAutoProxy;
00083        HICON m_hIcon;
00084 
00085        BOOL CanExit();
00086 
00087        // Generated message map functions
00088        //{{AFX_MSG(CIEPatcherDlg)
00089        virtual BOOL OnInitDialog();
00090        afx_msg void OnPaint();
00091        afx_msg HCURSOR OnQueryDragIcon();
00092        afx_msg void OnClose();
00093        afx_msg void OnScan();
00094        afx_msg void OnClickFilelist(NMHDR* pNMHDR, LRESULT* pResult);
00095        afx_msg void OnPatch();
00096        //}}AFX_MSG
00097        afx_msg LONG OnUpdateFileStatus(WPARAM, LPARAM);
00098        DECLARE_MESSAGE_MAP()
00099 };
00100 
00101 //{{AFX_INSERT_LOCATION}}
00102 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00103 
00104 #endif // !defined(AFX_IEPATCHERDLG_H__A603167C_3B36_11D2_B44D_00600819607E__INCLUDED_)
00105