📄 tnamebreakerdlg.h
字号:
/*****************************************************************************/
/* TNameBreakerDlg.h Copyright (c) Ladislav Zezula 2003 */
/*---------------------------------------------------------------------------*/
/* Description : */
/*---------------------------------------------------------------------------*/
/* Date Ver Who Comment */
/* -------- ---- --- ------- */
/* 12.04.03 1.00 Lad The first version of TNameBreakerDlg.h */
/*****************************************************************************/
#ifndef __TNAMEBREAKERDLG_H__
#define __TNAMEBREAKERDLG_H__
#include "../!Common/TAnchors.h" // This dialog uses anchors
//-----------------------------------------------------------------------------
// Defines
#define STORM_BUFFER_SIZE 0x500 // Size of decryption engine buffer
//-----------------------------------------------------------------------------
// Listview item data
#define DTI_INDEX 0x00000001
#define DTI_HASH_INDEX 0x00000002
#define DTI_CODENAME1 0x00000004
#define DTI_CODENAME2 0x00000008
#define DTI_CODENAMES (DTI_CODENAME1 | DTI_CODENAME2)
#define DTI_LOCALE 0x00000010
#define DTI_SEED 0x00000020
#define DTI_FILESIZE 0x00000040
#define DTI_EXTENSION 0x00000080
#define DTI_FILENAME 0x00000100
struct TNameInfo
{
DWORD dwIndex; // File index in MPQ
DWORD dwFlags; // Which values we have (SEE DTI_XXXX)
DWORD dwHashIndex; // Index to Hash table
DWORD dwCodeName1; // The first codename
DWORD dwCodeName2; // The second codename
LCID lcLocale; // File locale
DWORD dwSeed; // Decryption seed
DWORD dwFileSize; // File size
char szExt[MAX_PATH]; // File extension
char * szPlainName; // Pointer to plain file name
char szFullName[MAX_PATH]; // The full path name
};
struct TDetectOptions
{
char szStartName[MAX_PATH]; // Starting file name
char szFileName[MAX_PATH]; // Currently tested file name
char * pchFilePos; // Position of the checked file
int nMaxNameLength; // Maximum name length
int nNameLength; // Current name length
CPtrList * pFolderList; // List of folders to try
char * szExts; // List of extensions to try
int nExts; // Number of extensions in list
int nIndex; // Index of the item in listview
BOOL bThisOnly; // TRUE if to detect the given name only
};
//-----------------------------------------------------------------------------
// TNameBreakerDlg dialog
class TNameBreakerDlg : public CDialog
{
public:
TNameBreakerDlg(CWnd* pParent = NULL);
~TNameBreakerDlg();
int RunBreaker(const char * szMpqName, const char * szFileList, const char * szDirs, const char * szExts, int nItem);
//{{AFX_DATA(TNameBreakerDlg)
enum { IDD = IDD_NAME_BREAKER };
CListCtrl m_FileList;
//}}AFX_DATA
CString m_strMpqName; // Name of the archive
CString m_strFileList; // Name of the filelist
CString m_strDirs; // Directory to autodetect
CString m_strExts; // Extensions
DWORD m_dwHashIndexMask; // Mask for the hash index
int m_nItem; // Item to focus
protected:
// Decryption functions (in TNameBreaker1.cpp)
static DWORD StormBuffer[STORM_BUFFER_SIZE];
// static BYTE IncChar[256];
// static BYTE NextChar[256];
static BOOL m_bInitialized;
int PrepareStormBuffer();
int DecryptFileName(char * szFileName, char * pchFirstNameChar, int nNameLength, int nMaxNameLength, char * szExts, int nExts);
int DecryptThread();
static DWORD WINAPI DecryptThread(LPVOID lpParam);
// UI functions
TNameInfo * CreateDetectInfo(DWORD dwIndex, int dwHashIndex, int dwCodeName1, int dwCodeName2, int lcLocale, int dwSeed, int dwSize, const char * szExt, const char * szFileName);
BOOL SetDetectInfo(TNameInfo * pInfo, int dwHashIndex, int dwCodeName1, int dwCodeName2, int lcLocale, int dwSeed, int dwSize, const char * szExt, const char * szFileName);
void UpdateItemLabels(int nIndex, TNameInfo * pInfo);
void InsertFolderAndExt(const char * szFullName);
int FindItemByFileIndex(DWORD dwFileIndex);
int DetectFileNames(const char * szDirs, const char * szExts, int nIndex);
int DetectFileNames(int nIndex);
int LoadArchive(const char * szMpqName, const char * szFileList);
int SaveListFile(const char * szListFile = NULL);
int DoNameBreaking();
BOOL StopWorkThread();
int UpdateNDetected();
int UpdateNUnknowns();
int FocusNextUnknown(int nStep);
int RefreshDetectInfo(BOOL bFinished = FALSE);
void CommandParent(UINT nShowCmd);
// Sort functions
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParam);
int CompareItems(LPARAM lParam1, LPARAM lParam2);
TDetectOptions m_dto; // Detect options for the worker thread
TAnchors m_Anchors; // Window anchors
TMPQHash * m_pHashTable; // Hash table of the loaded archive
TMPQHash * m_pHashEnd; // End of the hash table
CPtrList * m_pFolderList; // Folders found in the filelist
CPtrList * m_pExtList; // Extension list
CFont * m_pFont; // Listview font
HANDLE m_hThread; // Worker thread
UINT m_nTimer; // File info timer
DWORD m_dwStartTime; // Time elapsed since start
UINT m_nDetected; // Number of detected and unsaved file names
UINT m_dwUnknowns; // Number of unknown files
UINT m_nOldShow; // Saved show state if main window
int m_uSortColumn; // Last sorting column
BOOL m_bAscending; // TRUE is ascending sort
BOOL m_bInTimer; // TRUE if handling WM_TIMER
BOOL m_bMinimized; // TRUE if the window is minimized
//{{AFX_VIRTUAL(TNameBreakerDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
protected:
//{{AFX_MSG(TNameBreakerDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnCloseClick();
afx_msg void OnClose();
afx_msg void OnDeleteItem(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnLoadArchive(WPARAM wParam, LPARAM lParam);
afx_msg void OnFileListDblClk(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnNameFound(WPARAM wParam, LPARAM lParam);
afx_msg void OnWorkComplete(WPARAM wParam, LPARAM lParam);
afx_msg void OnSaveList();
afx_msg void OnPrevUnknown();
afx_msg void OnNextUnknown();
afx_msg void OnHexView();
afx_msg void OnDetect();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // __TNAMEBREAKERDLG_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -