Restructure repository to include all source folders

Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 20:17:20 +09:00
parent 5d3cd64a25
commit dd97ddec92
11602 changed files with 1446576 additions and 0 deletions

View File

@@ -0,0 +1,284 @@
// BinaryTree.h: interface for the CBinaryTree template.
// Inventor Name: Hatem Mostafa
// Created: 18/1/2003
// Modified: 20/12/2004
//
//////////////////////////////////////////////////////////////////////
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <vector>
using namespace std;
#define TREENODE CBinaryTreeNode<KEY, DATA>
#define LEFT Childs[0]
#define RIGHT Childs[1]
template <class KEY, class DATA> class CBinaryTreeNode
{
public:
CBinaryTreeNode()
{
Parent = LEFT = RIGHT = NULL;
Count = ID = 0;
ArrayEqualIDs = NULL;
}
~CBinaryTreeNode()
{
if(ArrayEqualIDs)
delete ArrayEqualIDs;
}
public:
// node parent, left, right respectively
TREENODE *Parent, *Childs[2];
// node key
KEY Key;
// node data
DATA Data;
// node repetition count
int Count;
// node ID
int ID;
// node repeated keys' IDs
vector<int> *ArrayEqualIDs;
const TREENODE& operator=(const TREENODE& node)
{
Key = node.Key;
Data = node.Data;
Count = node.Count;
ID = node.ID;
if(node.ArrayEqualIDs)
{
if(ArrayEqualIDs == NULL)
ArrayEqualIDs = new vector<int>;
*ArrayEqualIDs = *node.ArrayEqualIDs;
}
return *this;
}
};
template <class KEY, class ARG_KEY, class DATA, class ARG_DATA> class CBinaryTree
{
public:
CBinaryTree()
{
Root = Nil = NULL;
Count = Serial = 0;
Modified = NoRepeat = false;
}
~CBinaryTree()
{
RemoveAll();
}
public:
// tree root node
TREENODE* Root, * Nil;
// tree nodes count
int Count, Serial;
// flag to indicate if the tree is modified or not
bool Modified;
// ignore repeated keys in the Add function
bool NoRepeat;
// return tree nodes count
inline int GetCount() const { return Count; }
// check if the tree is empty or not
inline bool IsEmpty() const { return Count == 0; }
// remove all tree nodes
void RemoveAll()
{
TREENODE *node = Root, *pTemp;
while(node != Nil)
{
// check for left child
if(node->LEFT != Nil)
node = node->LEFT;
// check for right child
else if(node->RIGHT != Nil)
node = node->RIGHT;
else // node has no childs
{ // save node pointer
pTemp = node;
// set node pointer at its parent to NULL
if(node->Parent != Nil)
node->Parent->Childs[node != node->Parent->LEFT] = Nil;
// update pointer node to its parent
node = node->Parent;
// delete the saved node
delete pTemp;
}
}
Count = Serial = 0;
Root = Nil;
Modified = false;
}
// insert key in the tree
inline TREENODE* Insert(ARG_KEY key, int nID = -1, TREENODE* node = NULL)
{
if(Root == Nil)
{
Root = NewNode();
node = Root;
}
else
{
if(node == NULL)
node = Root;
int nResult;
while(true)
{
nResult = node->Key.compare(key);
if(nResult == 0)
{
node->Count++;
if(NoRepeat == false)
{
if(node->ArrayEqualIDs == NULL)
node->ArrayEqualIDs = new vector<int>;
node->ArrayEqualIDs->push_back(nID == -1 ? Serial : nID);
Serial++;
Count++;
}
return node;
}
nResult = nResult > 0 ? 0 : 1;
if(node->Childs[nResult] == Nil)
{
node->Childs[nResult] = NewNode();
node->Childs[nResult]->Parent = node;
node = node->Childs[nResult];
break;
}
node = node->Childs[nResult];
}
}
node->Key = key;
node->ID = nID == -1 ? Serial : nID;
Serial++;
Count++;
node->Count++;
Modified = true;
return node;
}
// search for a key in the tree
inline TREENODE* Search(ARG_KEY key, TREENODE* node = NULL) const
{
if(node == NULL)
node = Root;
int nResult;
while(node != Nil && (nResult = node->Key.compare(key)) != 0)
node = node->Childs[nResult < 0];
return node == Nil ? NULL : node;
}
// return minimum key in the tree
TREENODE* Min(TREENODE* node) const
{
// iterate in the left branch
while(node != Nil && node->LEFT != Nil)
node = node->LEFT;
return node;
}
// return maximum key in the tree
TREENODE* Max(TREENODE* node) const
{
// iterate in the right branch
while(node != Nil && node->RIGHT != Nil)
node = node->RIGHT;
return node;
}
// return node successor
TREENODE* Successor(TREENODE* node) const
{
// return the left most node in the right subtree
if(node->RIGHT != Nil)
return Min(node->RIGHT);
// go up from node until we find a node that is the left of its parent
TREENODE* Parent = node->Parent;
while(Parent != Nil && node == Parent->RIGHT)
{
node = Parent;
Parent = node->Parent;
}
return Parent;
}
// return node predecessor
TREENODE* Predecessor(TREENODE* node) const
{
// return the right most node in the left subtree
if(node->LEFT != Nil)
return Max(node->LEFT);
// go up from node until we find a node that is the right of its parent
TREENODE* Parent = node->Parent;
while(Parent != Nil && node == Parent->LEFT)
{
node = Parent;
Parent = node->Parent;
}
return Parent;
}
// delete node
// 1- node has no child, remove it
// 2- node has one child, splice it (connect its parent and child)
// 3- node has two childs, splice its successor and put it in its place
void Delete(TREENODE* node)
{
TREENODE *pSplice = (node->LEFT == Nil || node->RIGHT == Nil)?node:Successor(node);
TREENODE *pChild = pSplice->Childs[pSplice->LEFT == Nil];
// connect child to spliced node parent
if(pChild != Nil)
pChild->Parent = pSplice->Parent;
// connect spliced node parent to child
if(pSplice->Parent == Nil)
Root = pChild;
else
pSplice->Parent->Childs[pSplice != pSplice->Parent->LEFT] = pChild;
// put spliced node in place of node (if required)
if(pSplice != node)
{ // copy spliced node
*node = *pSplice;
// delete the spliced node
delete pSplice;
}
else
// delete the node
delete node;
Count--;
}
// save all tree nodes in a vector of integers
void Save(vector<int> &nArraySort, bool bAscending = true, bool (* lpfn)(int, int) = NULL)
{
nArraySort.resize(Count);
int nIndex = 0, *pArray = &*nArraySort.begin();
TREENODE* node = bAscending ? Min(Root) : Max(Root);
while(node != Nil)
{
if(lpfn)
(*lpfn)(nIndex++, Count);
SaveNode(node, pArray);
node = bAscending ? Successor(node) : Predecessor(node);
}
Modified = false;
}
// add one node to a vector of integers
void SaveNode(TREENODE* node, int*& pArray)
{
*pArray++ = node->ID;
if(node->ArrayEqualIDs)
{
memcpy(pArray, &*node->ArrayEqualIDs->begin(), node->ArrayEqualIDs->size()*sizeof(int));
pArray += node->ArrayEqualIDs->size();
}
}
protected:
virtual TREENODE* NewNode()
{
return new TREENODE();
}
};

View File

@@ -0,0 +1,56 @@
// FindFFEdit.cpp : 구현 파일입니다.
//
#include "stdafx.h"
#include "PacketDecoder.h"
#include "FindFFEdit.h"
#include ".\findffedit.h"
// CFindFFEdit
IMPLEMENT_DYNAMIC(CFindFFEdit, CEdit)
CFindFFEdit::CFindFFEdit()
{
}
CFindFFEdit::~CFindFFEdit()
{
}
BEGIN_MESSAGE_MAP(CFindFFEdit, CEdit)
ON_WM_KEYDOWN()
END_MESSAGE_MAP()
// CFindFFEdit 메시지 처리기입니다.
void CFindFFEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
if (nChar == VK_F3)
{
CString szContents;
GetWindowText(szContents);
szContents.MakeUpper();
int nFoundPos = szContents.Find(_T("FF"), LOWORD(CharFromPos(GetCaretPos())));
if (-1 == nFoundPos)
{
SetSel(0, 0);
nFoundPos = szContents.Find(_T("FF"), LOWORD(CharFromPos(GetCaretPos())));
}
if (0 <= nFoundPos)
{
SetSel(nFoundPos, nFoundPos + 2);
}
}
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}

View File

@@ -0,0 +1,22 @@
#pragma once
// CFindFFEdit
class CFindFFEdit : public CEdit
{
DECLARE_DYNAMIC(CFindFFEdit)
public:
CFindFFEdit();
virtual ~CFindFFEdit();
protected:
DECLARE_MESSAGE_MAP()
private:
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
};

View File

@@ -0,0 +1,184 @@
// Huffman.cpp: implementation of the Huffman class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include <stdlib.h>
#include <malloc.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#endif
//////////////////////////////////////////////////////////////////////
class CHuffmanNode
{
public:
CHuffmanNode() { memset(this, 0, sizeof(CHuffmanNode)); }
int nFrequency; // must be first for byte align
BYTE byAscii;
DWORD dwCode;
int nCodeLength;
CHuffmanNode *pParent, *pLeft, *pRight;
};
int __cdecl frequencyCompare(const void *elem1, const void *elem2 )
{
CHuffmanNode *pNodes[2] = { (CHuffmanNode*)elem1, (CHuffmanNode*)elem2 };
if(pNodes[0]->nFrequency == pNodes[1]->nFrequency)
return 0;
return pNodes[0]->nFrequency < pNodes[1]->nFrequency ? 1 : -1;
}
int __cdecl asciiCompare(const void *elem1, const void *elem2 )
{
return ((CHuffmanNode*)elem1)->byAscii > ((CHuffmanNode*)elem2)->byAscii ? 1 : -1;
}
CHuffmanNode* PopNode(CHuffmanNode *pNodes[], int nIndex, bool bRight)
{
CHuffmanNode* pNode = pNodes[nIndex];
pNode->dwCode = bRight;
pNode->nCodeLength = 1;
return pNode;
}
void SetNodeCode(CHuffmanNode* pNode)
{
CHuffmanNode* pParent = pNode->pParent;
while(pParent && pParent->nCodeLength)
{
pNode->dwCode <<= 1;
pNode->dwCode |= pParent->dwCode;
pNode->nCodeLength++;
pParent = pParent->pParent;
}
}
int GetHuffmanTree(CHuffmanNode nodes[], bool bSetCodes = true)
{
CHuffmanNode* pNodes[256], *pNode;
// add used ascii to Huffman queue
int nNodeCount = 0;
for(int nCount = 0; nCount < 256 && nodes[nCount].nFrequency; nCount++)
pNodes[nNodeCount++] = &nodes[nCount];
int nParentNode = nNodeCount, nBackNode = nNodeCount-1;
while(nBackNode > 0)
{
// parent node
pNode = &nodes[nParentNode++];
// pop first child
pNode->pLeft = PopNode(pNodes, nBackNode--, false);
// pop second child
pNode->pRight = PopNode(pNodes, nBackNode--, true);
// adjust parent of the two poped nodes
pNode->pLeft->pParent = pNode->pRight->pParent = pNode;
// adjust parent frequency
pNode->nFrequency = pNode->pLeft->nFrequency + pNode->pRight->nFrequency;
// insert parent node depending on its frequency
for(int i = nBackNode; i >= 0; i--)
if(pNodes[i]->nFrequency >= pNode->nFrequency)
break;
memmove(pNodes+i+2, pNodes+i+1, (nBackNode-i)*sizeof(int));
pNodes[i+1] = pNode;
nBackNode++;
}
// set tree leaves nodes code
if(bSetCodes)
for(nCount = 0; nCount < nNodeCount; nCount++)
SetNodeCode(&nodes[nCount]);
return nNodeCount;
}
bool CompressHuffman(BYTE *pSrc, int nSrcLen, BYTE *&pDes, int &nDesLen)
{
CHuffmanNode nodes[511];
// initialize nodes ascii
for(int nCount = 0; nCount < 256; nCount++)
nodes[nCount].byAscii = nCount;
// get ascii frequencies
for(nCount = 0; nCount < nSrcLen; nCount++)
nodes[pSrc[nCount]].nFrequency++;
// sort ascii chars depending on frequency
qsort(nodes, 256, sizeof(CHuffmanNode), frequencyCompare);
// construct Huffman tree
int nNodeCount = GetHuffmanTree(nodes);
// construct compressed buffer
int nNodeSize = sizeof(DWORD)+sizeof(BYTE);
nDesLen = nSrcLen+nNodeCount*nNodeSize;
pDes = (BYTE*)malloc(nDesLen);
BYTE *pDesPtr = pDes;
memset(pDesPtr, 0, nDesLen);
// save source buffer length at the first DWORD
*(DWORD*)pDesPtr = nSrcLen;
pDesPtr += sizeof(DWORD);
// save Huffman tree leaves count-1 (as it may be 256)
*pDesPtr = nNodeCount-1;
pDesPtr += sizeof(BYTE);
// save Huffman tree used leaves nodes
for(nCount = 0; nCount < nNodeCount; nCount++)
{ // the array sorted on frequency so used nodes come first
memcpy(pDesPtr, &nodes[nCount], nNodeSize);
pDesPtr += nNodeSize;
}
// sort nodes depending on ascii to can index nodes with its ascii value
qsort(nodes, 256, sizeof(CHuffmanNode), asciiCompare);
int nDesIndex = 0;
// loop to write codes
for(nCount = 0; nCount < nSrcLen; nCount++)
{
*(DWORD*)(pDesPtr+(nDesIndex>>3)) |= nodes[pSrc[nCount]].dwCode << (nDesIndex&7);
nDesIndex += nodes[pSrc[nCount]].nCodeLength;
}
// update destination length
nDesLen = (pDesPtr-pDes)+(nDesIndex+7)/8;
pDes = (BYTE*)realloc(pDes, nDesLen);
return true;
}
bool DecompressHuffman(BYTE *pSrc, int nSrcLen, BYTE *&pDes, int &nDesLen)
{
// copy destination final length
nDesLen = *(DWORD*)pSrc;
// allocate buffer for decompressed buffer
pDes = (BYTE*)malloc(nDesLen+1);
int nNodeCount = *(pSrc+sizeof(DWORD))+1;
// initialize Huffman nodes with frequency and ascii
CHuffmanNode nodes[511], *pNode;
int nNodeSize = sizeof(DWORD)+sizeof(BYTE), nSrcIndex = nNodeSize;
for(int nCount = 0; nCount < nNodeCount; nCount++)
{
memcpy(&nodes[nCount], pSrc+nSrcIndex, nNodeSize);
nSrcIndex += nNodeSize;
}
// construct Huffman tree
GetHuffmanTree(nodes, false);
// get Huffman tree root
CHuffmanNode *pRoot = &nodes[0];
while(pRoot->pParent)
pRoot = pRoot->pParent;
int nDesIndex = 0;
DWORD nCode;
nSrcIndex <<= 3; // convert from bits to bytes
while(nDesIndex < nDesLen)
{
nCode = (*(DWORD*)(pSrc+(nSrcIndex>>3)))>>(nSrcIndex&7);
pNode = pRoot;
while(pNode->pLeft) // if node has pLeft then it must has pRight
{ // node not leaf
pNode = (nCode&1) ? pNode->pRight : pNode->pLeft;
nCode >>= 1;
nSrcIndex++;
}
pDes[nDesIndex++] = pNode->byAscii;
}
return true;
}

View File

@@ -0,0 +1,11 @@
// Huffman.h
//
//////////////////////////////////////////////////////////////////////
#if !defined(__HUFFMAN_COMPRESS_H__)
#define __HUFFMAN_COMPRESS_H__
bool CompressHuffman(BYTE *pSrc, int nSrcLen, BYTE *&pDes, int &nDesLen);
bool DecompressHuffman(BYTE *pSrc, int nSrcLen, BYTE *&pDes, int &nDesLen);
#endif __HUFFMAN_COMPRESS_H__

View File

@@ -0,0 +1,146 @@
// LZW.cpp: implementation of the LZW class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "BinaryTree.h"
//////////////////////////////////////////////////////////////////////
class CBuffer
{
public:
CBuffer() {}
CBuffer(BYTE* pBuffer, int nLength) { m_pBuffer = pBuffer, m_nLength = nLength; }
CBuffer(const CBuffer& buffer) { *this = buffer; }
public:
BYTE* m_pBuffer;
int m_nLength;
inline int compare(const CBuffer* buffer)
{
int nResult = memcmp(m_pBuffer, buffer->m_pBuffer, min(m_nLength, buffer->m_nLength));
if(nResult != 0 || m_nLength == buffer->m_nLength)
return nResult;
return m_nLength > buffer->m_nLength ? 1 : -1;
}
inline void operator=(const CBuffer* buffer) { m_pBuffer = buffer->m_pBuffer; m_nLength = buffer->m_nLength; }
};
bool CompressLZW(BYTE *pSrc, int nSrcLen, BYTE *&pDes, int &nDesLen, int nBitsPerSample)
{
nDesLen = (sizeof(DWORD)+1)<<3;
// allocate buffer for destination buffer
pDes = (BYTE*)malloc(nSrcLen*2);
memset(pDes, 0, nSrcLen*2);
// save source buffer length at the first DWORD
*(DWORD*)pDes = nSrcLen;
*(pDes+sizeof(DWORD)) = nBitsPerSample;
int nSample = *pSrc;
int nMaxSamples = 1 << nBitsPerSample;
// dictionary hash table
CBinaryTree<CBuffer, CBuffer*, int, int> dictionary;
dictionary.NoRepeat = true;
// keep first 256 IDs for ascii Samples
dictionary.Serial = 256;
// tree node to keep last success search to start with
CBinaryTreeNode<CBuffer, int>* pNode = dictionary.Root;
// left dictionary Samples points to the source buffer
CBuffer node(pSrc, 2);
// scan the input buffer
while(nSrcLen-- > 0)
{
if(dictionary.Serial == nMaxSamples)
{
dictionary.RemoveAll();
dictionary.Serial = 256;
}
pNode = dictionary.Insert(&node, -1, pNode);
if(pNode->Count > 1)
// (repeated Sample), save success Sample to be used next fail
nSample = pNode->ID, node.m_nLength++;
else
{ // write last success Sample
*(DWORD*)(pDes+(nDesLen>>3)) |= nSample << (nDesLen&7);
nDesLen += nBitsPerSample;
// initialize node to next Sample
node.m_pBuffer += node.m_nLength-1;
node.m_nLength = 2;
// copy first byte of the node as a new Sample
nSample = *node.m_pBuffer;
// initialize search root
pNode = dictionary.Root;
}
}
nDesLen = (nDesLen+7)/8;
pDes = (BYTE*)realloc(pDes, nDesLen);
return true;
}
void ClearDictionary(vector<CBuffer *>& dictionary)
{
for(vector<CBuffer*>::iterator i = dictionary.begin(); i != dictionary.end(); i++)
delete (*i);
dictionary.clear();
}
bool DecompressLZW(BYTE *pSrc, int nSrcLen, BYTE *&pDes, int &nDesLen)
{ // first two DWORDS (final buffer length, Samples sizes bitmap buffer start)
// copy destination final length
nDesLen = *(DWORD*)pSrc;
// copy bits pre Sample
int nBitsPerSample = *(pSrc+sizeof(DWORD));
// allocate buffer for decompressed buffer
pDes = (BYTE*)malloc(nDesLen+1);
// copy first char from source to destination
*pDes = *(pSrc+sizeof(DWORD)+1);
int nMaxSamples = 1 << nBitsPerSample;
int nSample, nSrcIndex = ((sizeof(DWORD)+1)<<3) + nBitsPerSample;
// dictionary array
vector<CBuffer *> dictionary;
// let dictionary Samples points to the destination buffer
CBuffer node(pDes, 2), *pNodeSample;
int nDesIndex = 1, nDesIndexSave, nSampleLen;
while(nDesIndex < nDesLen)
{
nSample = (*(DWORD*)(pSrc+(nSrcIndex>>3)))>>(nSrcIndex&7) & (nMaxSamples-1);
nSrcIndex += nBitsPerSample;
if(dictionary.size() == nMaxSamples-256)
ClearDictionary(dictionary);
if(nSample >= 256)
if(nSample-256 < (int)dictionary.size())
{ // normal case, valid dictionary Sample
nDesIndexSave = nDesIndex;
pNodeSample = dictionary.at(nSample-256);
nSampleLen = pNodeSample->m_nLength+1;
// copy dictionary node buffer to decompressed buffer
memcpy(pDes+nDesIndex, pNodeSample->m_pBuffer, pNodeSample->m_nLength);
nDesIndex += pNodeSample->m_nLength;
}
else
{ // out of range Sample
nSampleLen = nDesIndex-nDesIndexSave+2;
// copy previous decompressed Sample as a new one + ...
memcpy(pDes+nDesIndex, pDes+nDesIndexSave, nDesIndex-nDesIndexSave);
nDesIndex += nDesIndex-nDesIndexSave;
// add first char of the previous decompressed Sample
*(pDes+nDesIndex++) = *(pDes+nDesIndexSave);
nDesIndexSave += nSampleLen-2;
}
else
nDesIndexSave = nDesIndex, *(pDes+nDesIndex++) = (BYTE)nSample, nSampleLen = 2;
// add current segment to the dictionary
dictionary.push_back(new CBuffer(node));
// increment next node pointer to the last char of the added Sample
node.m_pBuffer += node.m_nLength-1;
node.m_nLength = nSampleLen;
}
// free dictionary Samples
ClearDictionary(dictionary);
return true;
}

View File

@@ -0,0 +1,11 @@
// LZW.h
//
//////////////////////////////////////////////////////////////////////
#if !defined(__LZW_H__)
#define __LZW_H__
bool CompressLZW(BYTE *pSrc, int nSrcLen, BYTE *&pDes, int &nDesLen, int nBitsPerSample = 12);
bool DecompressLZW(BYTE *pSrc, int nSrcLen, BYTE *&pDes, int &nDesLen);
#endif __LZW_H__

View File

@@ -0,0 +1,65 @@
#ifndef CRC32_H
#define CRC32_H
/* crc32 0xdebb20e3 table and supplementary functions. */
static const u32 crc_32_tab[] =
{
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
0x2d02ef8dL
};
#define crc32(crc,byte) (crc_32_tab[(u8)(crc) ^ (u8)(byte)] ^ ((crc) >> 8))
#endif

View File

@@ -0,0 +1,111 @@
/*
* Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de>
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License version 2 (the "GPL"), in which case the
* provisions of the GPL are applicable instead of the above. If you wish to
* allow the use of your version of this file only under the terms of the
* GPL and not to allow others to use your version of this file under the
* BSD license, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the GPL. If
* you do not delete the provisions above, a recipient may use your version
* of this file under either the BSD or the GPL.
*/
#ifndef LZF_H
#define LZF_H
/***********************************************************************
**
** lzf -- an extremely fast/free compression/decompression-method
** http://liblzf.plan9.de/
**
** This algorithm is believed to be patent-free.
**
***********************************************************************/
#define LZF_VERSION 0x0105 /* 1.5 */
/*
* Compress in_len bytes stored at the memory block starting at
* in_data and write the result to out_data, up to a maximum length
* of out_len bytes.
*
* If the output buffer is not large enough or any error occurs
* return 0, otherwise return the number of bytes used (which might
* be considerably larger than in_len, so it makes sense to always
* use out_len == in_len - 1), to ensure _some_ compression, and store
* the data uncompressed otherwise.
*
* lzf_compress might use different algorithms on different systems and
* even diferent runs, thus might result in different compressed strings
* depending on the phase of the moon or similar factors. However, all
* these strings are architecture-independent and will result in the
* original data when decompressed using lzf_decompress.
*
* The buffers must not be overlapping.
*
* If the option LZF_STATE_ARG is enabled, an extra argument must be
* supplied which is not reflected in this header file. Refer to lzfP.h
* and lzf_c.c.
*
*/
extern "C"
{
unsigned int
lzf_compress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);
}
/*
* Decompress data compressed with some version of the lzf_compress
* function and stored at location in_data and length in_len. The result
* will be stored at out_data up to a maximum of out_len characters.
*
* If the output buffer is not large enough to hold the decompressed
* data, a 0 is returned and errno is set to E2BIG. Otherwise the number
* of decompressed bytes (i.e. the original length of the data) is
* returned.
*
* If an error in the compressed data is detected, a zero is returned and
* errno is set to EINVAL.
*
* This function is very fast, about as fast as a copying loop.
*/
extern "C"
{
unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);
}
#endif

View File

@@ -0,0 +1,157 @@
/*
* Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de>
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License version 2 (the "GPL"), in which case the
* provisions of the GPL are applicable instead of the above. If you wish to
* allow the use of your version of this file only under the terms of the
* GPL and not to allow others to use your version of this file under the
* BSD license, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the GPL. If
* you do not delete the provisions above, a recipient may use your version
* of this file under either the BSD or the GPL.
*/
#ifndef LZFP_h
#define LZFP_h
#define STANDALONE 1 /* at the moment, this is ok. */
#ifndef STANDALONE
# include "lzf.h"
#endif
/*
* size of hashtable is (1 << HLOG) * sizeof (char *)
* decompression is independent of the hash table size
* the difference between 15 and 14 is very small
* for small blocks (and 14 is usually a but faster).
* For a low-memory/faster configuration, use HLOG == 13;
* For best compression, use 15 or 16 (or more).
*/
#ifndef HLOG
# define HLOG 14
#endif
/*
* sacrifice very little compression quality in favour of compression speed.
* This gives almost the same compression as the default code, and is
* (very roughly) 15% faster. This is the preferable mode of operation.
*/
#ifndef VERY_FAST
# define VERY_FAST 1
#endif
/*
* sacrifice some more compression quality in favour of compression speed.
* (roughly 1-2% worse compression for large blocks and
* 9-10% for small, redundant, blocks and >>20% better speed in both cases)
* In short: when in need for speed, enable this for binary data,
* possibly disable this for text data.
*/
#ifndef ULTRA_FAST
# define ULTRA_FAST 0
#endif
/*
* unconditionally aligning does not cost very much, so do it if unsure
*/
#ifndef STRICT_ALIGN
# define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
#endif
/*
* use string functions to copy memory.
* this is usually a loss, even with glibc's optimized memcpy
*/
#ifndef USE_MEMCPY
# define USE_MEMCPY 0
#endif
/*
* you may choose to pre-set the hash table (might be faster on some
* modern cpus and large (>>64k) blocks)
*/
#ifndef INIT_HTAB
# define INIT_HTAB 0
#endif
/*
* avoid assigning values to errno variable? for some embedding purposes
* (linux kernel for example), this is neccessary. NOTE: this breaks
* the documentation in lzf.h.
*/
#ifndef AVOID_ERRNO
# define AVOID_ERRNO 0
#endif
/*
* Wether to pass the LZF_STATE variable as argument, or allocate it
* on the stack. For small-stack environments, define this to 1.
* NOTE: this breaks the prototype in lzf.h.
*/
#ifndef LZF_STATE_ARG
# define LZF_STATE_ARG 0
#endif
/*****************************************************************************/
/* nothing should be changed below */
typedef unsigned char u8;
typedef const u8 *LZF_STATE[1 << (HLOG)];
#if !STRICT_ALIGN
/* for unaligned accesses we need a 16 bit datatype. */
# include <limits.h>
# if USHRT_MAX == 65535
typedef unsigned short u16;
# elif UINT_MAX == 65535
typedef unsigned int u16;
# else
# undef STRICT_ALIGN
# define STRICT_ALIGN 1
# endif
#endif
#if ULTRA_FAST
# if defined(VERY_FAST)
# undef VERY_FAST
# endif
#endif
#if USE_MEMCPY || INIT_HTAB
# ifdef __cplusplus
# include <cstring>
# else
# include <string.h>
# endif
#endif
#endif

View File

@@ -0,0 +1,242 @@
/*
* Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de>
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License version 2 (the "GPL"), in which case the
* provisions of the GPL are applicable instead of the above. If you wish to
* allow the use of your version of this file only under the terms of the
* GPL and not to allow others to use your version of this file under the
* BSD license, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the GPL. If
* you do not delete the provisions above, a recipient may use your version
* of this file under either the BSD or the GPL.
*/
#include "lzfP.h"
#define HSIZE (1 << (HLOG))
/*
* don't play with this unless you benchmark!
* decompression is not dependent on the hash function
* the hashing function might seem strange, just believe me
* it works ;)
*/
#ifndef FRST
# define FRST(p) (((p[0]) << 8) | p[1])
# define NEXT(v,p) (((v) << 8) | p[2])
# define IDX(h) ((((h ^ (h << 5)) >> (3*8 - HLOG)) - h*5) & (HSIZE - 1))
#endif
/*
* IDX works because it is very similar to a multiplicative hash, e.g.
* ((h * 57321 >> (3*8 - HLOG)) & (HSIZE - 1))
* the latter is also quite fast on newer CPUs, and sligthly better
*
* the next one is also quite good, albeit slow ;)
* (int)(cos(h & 0xffffff) * 1e6)
*/
#if 0
/* original lzv-like hash function, much worse and thus slower */
# define FRST(p) (p[0] << 5) ^ p[1]
# define NEXT(v,p) ((v) << 5) ^ p[2]
# define IDX(h) ((h) & (HSIZE - 1))
#endif
#define MAX_LIT (1 << 5)
#define MAX_OFF (1 << 13)
#define MAX_REF ((1 << 8) + (1 << 3))
/*
* compressed format
*
* 000LLLLL <L+1> ; literal
* LLLooooo oooooooo ; backref L
* 111ooooo LLLLLLLL oooooooo ; backref L+7
*
*/
unsigned int
lzf_compress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len
#if LZF_STATE_ARG
, LZF_STATE *htab
#endif
)
{
#if !LZF_STATE_ARG
LZF_STATE htab;
#endif
const u8 **hslot;
const u8 *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data;
const u8 *in_end = ip + in_len;
u8 *out_end = op + out_len;
const u8 *ref;
unsigned int hval = FRST (ip);
unsigned long off;
int lit = 0;
#if INIT_HTAB
# if USE_MEMCPY
memset (htab, 0, sizeof (htab));
# else
for (hslot = htab; hslot < htab + HSIZE; hslot++)
*hslot++ = ip;
# endif
#endif
for (;;)
{
if (ip < in_end - 2)
{
hval = NEXT (hval, ip);
hslot = htab + IDX (hval);
ref = *hslot; *hslot = ip;
if (1
#if INIT_HTAB && !USE_MEMCPY
&& ref < ip /* the next test will actually take care of this, but this is faster */
#endif
&& (off = ip - ref - 1) < MAX_OFF
&& ip + 4 < in_end
&& ref > (u8 *)in_data
#if STRICT_ALIGN
&& ref[0] == ip[0]
&& ref[1] == ip[1]
&& ref[2] == ip[2]
#else
&& *(u16 *)ref == *(u16 *)ip
&& ref[2] == ip[2]
#endif
)
{
/* match found at *ref++ */
unsigned int len = 2;
unsigned int maxlen = in_end - ip - len;
maxlen = maxlen > MAX_REF ? MAX_REF : maxlen;
if (op + lit + 1 + 3 >= out_end)
return 0;
do
len++;
while (len < maxlen && ref[len] == ip[len]);
if (lit)
{
*op++ = lit - 1;
lit = -lit;
do
*op++ = ip[lit];
while (++lit);
}
len -= 2;
ip++;
if (len < 7)
{
*op++ = (off >> 8) + (len << 5);
}
else
{
*op++ = (off >> 8) + ( 7 << 5);
*op++ = len - 7;
}
*op++ = off;
#if ULTRA_FAST || VERY_FAST
ip += len;
#if VERY_FAST && !ULTRA_FAST
--ip;
#endif
hval = FRST (ip);
hval = NEXT (hval, ip);
htab[IDX (hval)] = ip;
ip++;
#if VERY_FAST && !ULTRA_FAST
hval = NEXT (hval, ip);
htab[IDX (hval)] = ip;
ip++;
#endif
#else
do
{
hval = NEXT (hval, ip);
htab[IDX (hval)] = ip;
ip++;
}
while (len--);
#endif
continue;
}
}
else if (ip == in_end)
break;
/* one more literal byte we must copy */
lit++;
ip++;
if (lit == MAX_LIT)
{
if (op + 1 + MAX_LIT >= out_end)
return 0;
*op++ = MAX_LIT - 1;
#if USE_MEMCPY
memcpy (op, ip - MAX_LIT, MAX_LIT);
op += MAX_LIT;
lit = 0;
#else
lit = -lit;
do
*op++ = ip[lit];
while (++lit);
#endif
}
}
if (lit)
{
if (op + lit + 1 >= out_end)
return 0;
*op++ = lit - 1;
lit = -lit;
do
*op++ = ip[lit];
while (++lit);
}
return op - (u8 *) out_data;
}

View File

@@ -0,0 +1,116 @@
/*
* Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de>
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License version 2 (the "GPL"), in which case the
* provisions of the GPL are applicable instead of the above. If you wish to
* allow the use of your version of this file only under the terms of the
* GPL and not to allow others to use your version of this file under the
* BSD license, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the GPL. If
* you do not delete the provisions above, a recipient may use your version
* of this file under either the BSD or the GPL.
*/
#include "lzfP.h"
#if AVOID_ERRNO
# define SET_ERRNO(n)
#else
# include <errno.h>
# define SET_ERRNO(n) errno = (n)
#endif
unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len)
{
u8 const *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data;
u8 const *const in_end = ip + in_len;
u8 *const out_end = op + out_len;
do
{
unsigned int ctrl = *ip++;
if (ctrl < (1 << 5)) /* literal run */
{
ctrl++;
if (op + ctrl > out_end)
{
SET_ERRNO (E2BIG);
return 0;
}
#if USE_MEMCPY
memcpy (op, ip, ctrl);
op += ctrl;
ip += ctrl;
#else
do
*op++ = *ip++;
while (--ctrl);
#endif
}
else /* back reference */
{
unsigned int len = ctrl >> 5;
u8 *ref = op - ((ctrl & 0x1f) << 8) - 1;
if (len == 7)
len += *ip++;
ref -= *ip++;
if (op + len + 2 > out_end)
{
SET_ERRNO (E2BIG);
return 0;
}
if (ref < (u8 *)out_data)
{
SET_ERRNO (EINVAL);
return 0;
}
*op++ = *ref++;
*op++ = *ref++;
do
*op++ = *ref++;
while (--len);
}
}
while (op < out_end && ip < in_end);
return op - (u8 *)out_data;
}

View File

@@ -0,0 +1,72 @@
// PacketDecoder.cpp : 응용 프로그램에 대한 클래스 동작을 정의합니다.
//
#include "stdafx.h"
#include "PacketDecoder.h"
#include "PacketDecoderDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CPacketDecoderApp
BEGIN_MESSAGE_MAP(CPacketDecoderApp, CWinApp)
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
// CPacketDecoderApp 생성
CPacketDecoderApp::CPacketDecoderApp()
{
// TODO: 여기에 생성 코드를 추가합니다.
// InitInstance에 모든 중요한 초기화 작업을 배치합니다.
}
// 유일한 CPacketDecoderApp 개체입니다.
CPacketDecoderApp theApp;
// CPacketDecoderApp 초기화
BOOL CPacketDecoderApp::InitInstance()
{
// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControls()가 필요합니다.
// InitCommonControls()를 사용하지 않으면 창을 만들 수 없습니다.
InitCommonControls();
CWinApp::InitInstance();
AfxEnableControlContainer();
// 표준 초기화
// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
// 아래에서 필요 없는 특정 초기화 루틴을 제거해야 합니다.
// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
// TODO: 이 문자열을 회사 또는 조직의 이름과 같은
// 적절한 내용으로 수정해야 합니다.
SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성한 응용 프로그램"));
CPacketDecoderDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 여기에 대화 상자가 확인을 눌러 없어지는 경우 처리할
// 코드를 배치합니다.
}
else if (nResponse == IDCANCEL)
{
// TODO: 여기에 대화 상자가 취소를 눌러 없어지는 경우 처리할
// 코드를 배치합니다.
}
// 대화 상자가 닫혔으므로 응용 프로그램의 메시지 펌프를 시작하지 않고
// 응용 프로그램을 끝낼 수 있도록 FALSE를 반환합니다.
return FALSE;
}

View File

@@ -0,0 +1,31 @@
// PacketDecoder.h : PROJECT_NAME 응용 프로그램에 대한 주 헤더 파일입니다.
//
#pragma once
#ifndef __AFXWIN_H__
#error PCH에서 이 파일을 포함하기 전에 'stdafx.h'를 포함하십시오.
#endif
#include "resource.h" // 주 기호
// CPacketDecoderApp:
// 이 클래스의 구현에 대해서는 PacketDecoder.cpp을 참조하십시오.
//
class CPacketDecoderApp : public CWinApp
{
public:
CPacketDecoderApp();
// 재정의
public:
virtual BOOL InitInstance();
// 구현
DECLARE_MESSAGE_MAP()
};
extern CPacketDecoderApp theApp;

View File

@@ -0,0 +1,211 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// 한국어 resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
#ifdef _WIN32
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
#pragma code_page(949)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
"LANGUAGE 18, 1\r\n"
"#pragma code_page(949)\r\n"
"#include ""res\\PacketDecoder.rc2"" // Microsoft Visual C++에서 편집되지 않은 리소스\r\n"
"#include ""afxres.rc"" // 표준 구성 요소\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON "res\\PacketDecoder.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "PacketDecoder 정보"
FONT 9, "MS Shell Dlg", 0, 0, 0x1
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "PacketDecoder Version 1.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2005",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "확인",IDOK,178,7,50,16,WS_GROUP
END
IDD_PACKETDECODER_DIALOG DIALOGEX 0, 0, 410, 417
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "PacketDecoder"
FONT 9, "굴림체", 400, 0, 0x81
BEGIN
PUSHBUTTON "패킷 헤더 파싱",IDC_PARSE_HEADER,258,394,69,16
PUSHBUTTON "패킷 압축",IDC_COMPRESS_PACKET,334,394,69,16
EDITTEXT IDC_COMPRESS_MINILZO,7,354,396,16,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_PACKET_HEADER,7,334,396,16,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_WORKSPACE,7,181,396,145,ES_MULTILINE |
ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
LTEXT "Parse Packet",IDC_STATIC,7,7,49,8
LTEXT "WorkSpace",IDC_STATIC,7,169,37,8
EDITTEXT IDC_PACKET_CONTENT,7,17,396,145,ES_MULTILINE |
ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
EDITTEXT IDC_COMPRESS_ZLIB,7,374,396,16,ES_AUTOHSCROLL |
ES_READONLY
END
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "041203b5"
BEGIN
VALUE "CompanyName", "TODO: <회사 이름>"
VALUE "FileDescription", "TODO: <파일 설명>"
VALUE "FileVersion", "1.0.0.1"
VALUE "InternalName", "PacketDecoder.exe"
VALUE "LegalCopyright", "TODO: (c) <회사 이름>. All rights reserved."
VALUE "OriginalFilename", "PacketDecoder.exe"
VALUE "ProductName", "TODO: <제품 이름>"
VALUE "ProductVersion", "1.0.0.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "변환", 0x412, 949
END
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_PACKETDECODER_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 403
TOPMARGIN, 7
BOTTOMMARGIN, 410
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_ABOUTBOX "PacketDecoder 정보(&A)..."
END
#endif // 한국어 resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
LANGUAGE 18, 1
#pragma code_page(949)
#include "res\PacketDecoder.rc2" // Microsoft Visual C++에서 편집되지 않은 리소스
#include "afxres.rc" // 표준 구성 요소
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="PacketDecoder"
ProjectGUID="{E9A9A701-E701-420B-9EEB-D01A8F1F8982}"
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
UseOfMFC="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../;./;../../RylServerProject/;../../RylServerProject/BaseLibrary;../../RylServerProject/RylServerLibrary"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
TreatWChar_tAsBuiltInType="TRUE"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="FALSE"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1042"
AdditionalIncludeDirectories="$(IntDir)"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
UseOfMFC="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../;./;../../RylServerProject/;../../RylServerProject/BaseLibrary;../../RylServerProject/RylServerLibrary"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
MinimalRebuild="FALSE"
RuntimeLibrary="0"
TreatWChar_tAsBuiltInType="TRUE"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="FALSE"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1042"
AdditionalIncludeDirectories="$(IntDir)"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="소스 파일"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\FindFFEdit.cpp">
</File>
<File
RelativePath=".\Huffman.cpp">
</File>
<File
RelativePath=".\LZW.cpp">
</File>
<File
RelativePath=".\PacketDecoder.cpp">
</File>
<File
RelativePath=".\PacketDecoderDlg.cpp">
</File>
<File
RelativePath=".\stdafx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="헤더 파일"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\BinaryTree.h">
</File>
<File
RelativePath=".\FindFFEdit.h">
</File>
<File
RelativePath=".\Huffman.h">
</File>
<File
RelativePath=".\LZW.h">
</File>
<File
RelativePath=".\PacketDecoder.h">
</File>
<File
RelativePath=".\PacketDecoderDlg.h">
</File>
<File
RelativePath=".\Resource.h">
</File>
<File
RelativePath=".\stdafx.h">
</File>
</Filter>
<Filter
Name="리소스 파일"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\res\PacketDecoder.ico">
</File>
<File
RelativePath=".\PacketDecoder.rc">
</File>
<File
RelativePath=".\res\PacketDecoder.rc2">
</File>
</Filter>
<Filter
Name="LIBLZF"
Filter="">
<File
RelativePath=".\Lzf\crc32.h">
</File>
<File
RelativePath=".\Lzf\lzf.h">
</File>
<File
RelativePath=".\Lzf\lzf_c.c">
</File>
<File
RelativePath=".\Lzf\lzf_d.c">
</File>
<File
RelativePath=".\Lzf\lzfP.h">
</File>
</Filter>
<File
RelativePath=".\res\PacketDecoder.manifest">
</File>
<File
RelativePath=".\ReadMe.txt">
</File>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value="PacketDecoder.rc"/>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,619 @@
// PacketDecoderDlg.cpp : 구현 파일
//
#include "stdafx.h"
#include "PacketDecoder.h"
#include "PacketDecoderDlg.h"
#include "Huffman.h"
#include "LZW.h"
#include <LZF/lzf.h>
#include <Network/Packet/PacketBase.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/WrapPacket.h>
#include <Network/XORCrypt/XORCrypt.h>
#include <Utility/Compress/MiniLZO/MiniLZOWrapper.h>
#include <zlib/zlib.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// 응용 프로그램 정보에 사용되는 CAboutDlg 대화 상자입니다.
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// 대화 상자 데이터
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원
// 구현
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// CPacketDecoderDlg 대화 상자
CPacketDecoderDlg::CPacketDecoderDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPacketDecoderDlg::IDD, pParent)
, m_szParseResult(_T(""))
, m_szCompressMiniLZO(_T(""))
, m_szCompressZLIB(_T(""))
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CPacketDecoderDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_PACKET_CONTENT, m_edPacketContents);
DDX_Control(pDX, IDC_WORKSPACE, m_edWorkspace);
DDX_Text(pDX, IDC_PACKET_HEADER, m_szParseResult);
DDX_Text(pDX, IDC_COMPRESS_MINILZO, m_szCompressMiniLZO);
DDX_Text(pDX, IDC_COMPRESS_ZLIB, m_szCompressZLIB);
}
BEGIN_MESSAGE_MAP(CPacketDecoderDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_PARSE_HEADER, OnBnClickedParseHeader)
ON_BN_CLICKED(IDC_COMPRESS_PACKET, OnBnClickedCompressPacket)
END_MESSAGE_MAP()
// CPacketDecoderDlg 메시지 처리기
BOOL CPacketDecoderDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 시스템 메뉴에 "정보..." 메뉴 항목을 추가합니다.
// IDM_ABOUTBOX는 시스템 명령 범위에 있어야 합니다.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는
// 프레임워크가 이 작업을 자동으로 수행합니다.
SetIcon(m_hIcon, TRUE); // 큰 아이콘을 설정합니다.
SetIcon(m_hIcon, FALSE); // 작은 아이콘을 설정합니다.
ShowWindow(SW_MINIMIZE);
// TODO: 여기에 추가 초기화 작업을 추가합니다.
return TRUE; // 컨트롤에 대한 포커스를 설정하지 않을 경우 TRUE를 반환합니다.
}
void CPacketDecoderDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// 대화 상자에 최소화 단추를 추가할 경우 아이콘을 그리려면
// 아래 코드가 필요합니다. 문서/뷰 모델을 사용하는 MFC 응용 프로그램의 경우에는
// 프레임워크에서 이 작업을 자동으로 수행합니다.
void CPacketDecoderDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 그리기를 위한 디바이스 컨텍스트
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 클라이언트 사각형에서 아이콘을 가운데에 맞춥니다.
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 아이콘을 그립니다.
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// 사용자가 최소화된 창을 끄는 동안에 커서가 표시되도록 시스템에서
// 이 함수를 호출합니다.
HCURSOR CPacketDecoderDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
BYTE CharToHexNum(TCHAR cChar)
{
BYTE nVal = 0;
switch(cChar)
{
case _T('0'): nVal = 0; break;
case _T('1'): nVal = 1; break;
case _T('2'): nVal = 2; break;
case _T('3'): nVal = 3; break;
case _T('4'): nVal = 4; break;
case _T('5'): nVal = 5; break;
case _T('6'): nVal = 6; break;
case _T('7'): nVal = 7; break;
case _T('8'): nVal = 8; break;
case _T('9'): nVal = 9; break;
case _T('a'): nVal = 0xa; break;
case _T('b'): nVal = 0xb; break;
case _T('c'): nVal = 0xc; break;
case _T('d'): nVal = 0xd; break;
case _T('e'): nVal = 0xe; break;
case _T('f'): nVal = 0xf; break;
case _T('A'): nVal = 0xa; break;
case _T('B'): nVal = 0xb; break;
case _T('C'): nVal = 0xc; break;
case _T('D'): nVal = 0xd; break;
case _T('E'): nVal = 0xe; break;
case _T('F'): nVal = 0xf; break;
}
return nVal;
}
LPCTSTR GetPacketNameFromCommand(PktBase::CMDType cPacketCmd)
{
#define ENUM_RETURN_STRING(x) case x: return _T(#x)
switch(cPacketCmd)
{
ENUM_RETURN_STRING(CmdNull);
ENUM_RETURN_STRING(CmdAuthAccount);
ENUM_RETURN_STRING(CmdServerGroup);
ENUM_RETURN_STRING(CmdUserLogin);
ENUM_RETURN_STRING(CmdUserKill);
ENUM_RETURN_STRING(CmdCharSelect);
ENUM_RETURN_STRING(CmdCharCreate);
ENUM_RETURN_STRING(CmdCharDelete);
ENUM_RETURN_STRING(CmdCharLogin);
ENUM_RETURN_STRING(CmdCharSuicide);
ENUM_RETURN_STRING(CmdCharRespawn);
ENUM_RETURN_STRING(CmdCharMove);
ENUM_RETURN_STRING(CmdCharMoveUpdate);
ENUM_RETURN_STRING(CmdCharChat);
ENUM_RETURN_STRING(CmdCharAttack);
ENUM_RETURN_STRING(CmdCharCastObject);
ENUM_RETURN_STRING(CmdCharUseSkill);
ENUM_RETURN_STRING(CmdCharTakeItem);
ENUM_RETURN_STRING(CmdCharSwapItem);
ENUM_RETURN_STRING(CmdCharRepairItem);
ENUM_RETURN_STRING(CmdCharUseItem);
ENUM_RETURN_STRING(CmdCharTradeItem);
ENUM_RETURN_STRING(CmdCharSkillLock);
ENUM_RETURN_STRING(CmdCharSkillCreate);
ENUM_RETURN_STRING(CmdCharSkillErase);
ENUM_RETURN_STRING(CmdCharClassUpgrade);
ENUM_RETURN_STRING(CmdCharShapeInfo);
ENUM_RETURN_STRING(CmdCharIncreasePoint);
ENUM_RETURN_STRING(CmdCharBindPosition);
ENUM_RETURN_STRING(CmdCharRequireInfo);
ENUM_RETURN_STRING(CmdCharUpdateAddress);
ENUM_RETURN_STRING(CmdCharPartyCmd);
ENUM_RETURN_STRING(CmdCharPartyMemInfo);
ENUM_RETURN_STRING(CmdCharExchangeCmd);
ENUM_RETURN_STRING(CmdSysConnectAgent);
ENUM_RETURN_STRING(CmdSysPacketTransmit);
ENUM_RETURN_STRING(CmdCharLogout);
ENUM_RETURN_STRING(CmdDBGetData);
ENUM_RETURN_STRING(CmdDBUpdateData);
ENUM_RETURN_STRING(CmdAgentParty);
ENUM_RETURN_STRING(CmdSysServerLogin);
ENUM_RETURN_STRING(CmdServerZone);
ENUM_RETURN_STRING(CmdGameCellInfo);
ENUM_RETURN_STRING(CmdCharInfo);
ENUM_RETURN_STRING(CmdCharAddressInfo);
ENUM_RETURN_STRING(CmdCharCellLogin);
ENUM_RETURN_STRING(CmdCharCellLogout);
ENUM_RETURN_STRING(CmdMonMove);
ENUM_RETURN_STRING(CmdCharAttackInfo);
ENUM_RETURN_STRING(CmdCharAttacked);
ENUM_RETURN_STRING(CmdCharAward);
ENUM_RETURN_STRING(CmdCharItemInfo);
ENUM_RETURN_STRING(CmdCharPickUp);
ENUM_RETURN_STRING(CmdCharPullDown);
ENUM_RETURN_STRING(CmdCharPickUpInfo);
ENUM_RETURN_STRING(CmdCharPullDownInfo);
ENUM_RETURN_STRING(CmdCharCastObjectInfo);
ENUM_RETURN_STRING(CmdCharInstallSocket);
ENUM_RETURN_STRING(CmdCharLevelUp);
ENUM_RETURN_STRING(CmdCharPartyInfo);
ENUM_RETURN_STRING(CmdCharUpgradeItem);
ENUM_RETURN_STRING(CmdCharHPRegen);
ENUM_RETURN_STRING(CmdCharLevelUpInfo);
ENUM_RETURN_STRING(CmdCharSplitItem);
ENUM_RETURN_STRING(CmdUpdateUIDTable);
ENUM_RETURN_STRING(CmdCharQuickSlotMove);
ENUM_RETURN_STRING(CmdCharSwitchEQ);
ENUM_RETURN_STRING(CmdSysMngerRegistry);
ENUM_RETURN_STRING(CmdSysMngerRequest);
ENUM_RETURN_STRING(CmdSysMngerResponse);
ENUM_RETURN_STRING(CmdCharTakeItems);
ENUM_RETURN_STRING(CmdCharTakeGold);
ENUM_RETURN_STRING(CmdCharExchangeItem);
ENUM_RETURN_STRING(CmdCellBroadCasting);
ENUM_RETURN_STRING(CmdSysPatchAddress);
ENUM_RETURN_STRING(CmdCharPartyCmdInfo);
ENUM_RETURN_STRING(CmdServerLog);
ENUM_RETURN_STRING(CmdCharWhisper);
ENUM_RETURN_STRING(CmdSysServerVerUpdate);
ENUM_RETURN_STRING(CmdSysMng);
ENUM_RETURN_STRING(CmdSysChannelUpdate);
ENUM_RETURN_STRING(CmdCharPartyFind);
ENUM_RETURN_STRING(CmdCharPartyMemData);
ENUM_RETURN_STRING(CmdCharControlOption);
ENUM_RETURN_STRING(CmdCharDuelCmd);
ENUM_RETURN_STRING(CmdCharFameInfo);
ENUM_RETURN_STRING(CmdLoginServerList);
ENUM_RETURN_STRING(CmdCharSpellInfo);
ENUM_RETURN_STRING(CmdCharSkillUnLock);
ENUM_RETURN_STRING(CmdSysPing);
ENUM_RETURN_STRING(CmdCharMoveZone);
ENUM_RETURN_STRING(CmdAgentZone);
ENUM_RETURN_STRING(CmdDeposit);
ENUM_RETURN_STRING(CmdDepositUpdate);
ENUM_RETURN_STRING(CmdCharStallOpen);
ENUM_RETURN_STRING(CmdCharStallRegisterItem);
ENUM_RETURN_STRING(CmdCharStallEnter);
ENUM_RETURN_STRING(CmdCharStallItemInfo);
ENUM_RETURN_STRING(CmdCharAdminCmd);
ENUM_RETURN_STRING(CmdCharTeamBattleInfo);
ENUM_RETURN_STRING(CmdFriendAddRequest);
ENUM_RETURN_STRING(CmdFriendRemoveRequest);
ENUM_RETURN_STRING(CmdFriendEtcRequest);
ENUM_RETURN_STRING(CmdFriendAck);
ENUM_RETURN_STRING(CmdFriendDB);
ENUM_RETURN_STRING(CmdEliteBonus);
ENUM_RETURN_STRING(CmdCharStartQuest);
ENUM_RETURN_STRING(CmdCharOperateTrigger);
ENUM_RETURN_STRING(CmdQuestDB);
ENUM_RETURN_STRING(CmdCharEndQuest);
ENUM_RETURN_STRING(CmdCharDisappearItem);
ENUM_RETURN_STRING(CmdCharAuthorizePanel);
ENUM_RETURN_STRING(CmdCharPeaceMode);
ENUM_RETURN_STRING(CmdConfigInfoDB);
ENUM_RETURN_STRING(CmdCharAutoRouting);
ENUM_RETURN_STRING(CmdRankingInfo);
ENUM_RETURN_STRING(CmdCharStateRedistribution);
ENUM_RETURN_STRING(CmdBillingTimeoutNotify);
ENUM_RETURN_STRING(CmdAdminToolGetData);
ENUM_RETURN_STRING(CmdAdminToolSetData);
ENUM_RETURN_STRING(CmdEventDropItem);
ENUM_RETURN_STRING(CmdCharCancelQuest);
ENUM_RETURN_STRING(CmdBillingTimeCheckNotify);
ENUM_RETURN_STRING(CmdCharLotteryResult);
ENUM_RETURN_STRING(CmdCharSummonCmd);
ENUM_RETURN_STRING(CmdChatClientLogin);
ENUM_RETURN_STRING(CmdChatLogin);
ENUM_RETURN_STRING(CmdChatLogout);
ENUM_RETURN_STRING(CmdChatInfoChanged);
ENUM_RETURN_STRING(CmdCharSummon);
ENUM_RETURN_STRING(CmdJapanAuthAccount);
ENUM_RETURN_STRING(CmdCharBattleGroundRespawn);
ENUM_RETURN_STRING(CmdCharRespawnWaitQueue);
ENUM_RETURN_STRING(CmdStatueInfo);
ENUM_RETURN_STRING(CmdCameraScript);
ENUM_RETURN_STRING(CmdCharEquipDurability);
ENUM_RETURN_STRING(CmdCreateGuild);
ENUM_RETURN_STRING(CmdGuildCmd);
ENUM_RETURN_STRING(CmdGuildMark);
ENUM_RETURN_STRING(CmdGuildLevel);
ENUM_RETURN_STRING(CmdGuildRelation);
ENUM_RETURN_STRING(CmdGuildList);
ENUM_RETURN_STRING(CmdGuildDB);
ENUM_RETURN_STRING(CmdGuildRight);
ENUM_RETURN_STRING(CmdGuildMemberList);
ENUM_RETURN_STRING(CmdMyGuildInfo);
ENUM_RETURN_STRING(CmdGuildSafe);
ENUM_RETURN_STRING(CmdGuildMemberInfoUpdate);
ENUM_RETURN_STRING(CmdCharStatusRetrain);
ENUM_RETURN_STRING(CmdSysServerLogout);
//ENUM_RETURN_STRING(CmdCharPartyAddress);
//ENUM_RETURN_STRING(CmdCharPartyMemAddress);
ENUM_RETURN_STRING(CmdBGServerMapList);
ENUM_RETURN_STRING(CmdBGServerResultList);
ENUM_RETURN_STRING(CmdBGServerMoveZone);
ENUM_RETURN_STRING(CmdBGServerMileageChange);
ENUM_RETURN_STRING(CmdBGServerCharSlot);
ENUM_RETURN_STRING(CmdHanBTNWarning);
ENUM_RETURN_STRING(CmdHanBTNUserKill);
ENUM_RETURN_STRING(CmdCharRepairAllItem);
ENUM_RETURN_STRING(CmdCSAuth);
ENUM_RETURN_STRING(CmdCharItemChemical);
ENUM_RETURN_STRING(CmdGuildInclination);
ENUM_RETURN_STRING(CmdGuildMemberFameUpdate);
ENUM_RETURN_STRING(CmdCastleInfo);
ENUM_RETURN_STRING(CmdCampInfo);
ENUM_RETURN_STRING(CmdCreateCastle);
ENUM_RETURN_STRING(CmdCreateCamp);
ENUM_RETURN_STRING(CmdCreateSiegeArms);
ENUM_RETURN_STRING(CmdCastleCmd);
ENUM_RETURN_STRING(CmdCampCmd);
ENUM_RETURN_STRING(CmdSiegeArmsCmd);
ENUM_RETURN_STRING(CmdCastleRight);
ENUM_RETURN_STRING(CmdCampRight);
ENUM_RETURN_STRING(CmdSiegeBroadCast);
//ENUM_RETURN_STRING(CmdSiegeTimeInfo);
ENUM_RETURN_STRING(CmdStealthInfo);
//ENUM_RETURN_STRING(CmdCastleUpdate);
ENUM_RETURN_STRING(CmdCellBroadCast2nd);
ENUM_RETURN_STRING(CmdCharRespawnInfo);
ENUM_RETURN_STRING(CmdCharRespawnAreaInfo);
ENUM_RETURN_STRING(CmdCharEquipShopInfo);
ENUM_RETURN_STRING(CmdSiegeBroadCast2nd);
ENUM_RETURN_STRING(CmdCharItemOptionGraft);
ENUM_RETURN_STRING(CmdCharItemCompensation);
ENUM_RETURN_STRING(CmdGuildMemberGoldUpdate);
ENUM_RETURN_STRING(CmdCampMessage);
ENUM_RETURN_STRING(CmdNewSiegeBroadCast);
ENUM_RETURN_STRING(CmdSelectAccountNation);
ENUM_RETURN_STRING(CmdNationChangeResult);
ENUM_RETURN_STRING(CmdUnifiedCharInfo);
ENUM_RETURN_STRING(CmdUnifiedCharSelect);
ENUM_RETURN_STRING(CmdChatBan);
ENUM_RETURN_STRING(CmdGiveItemToTempInven);
ENUM_RETURN_STRING(CmdCharNameChange);
ENUM_RETURN_STRING(CmdFertilityInfo);
ENUM_RETURN_STRING(CmdProcessMining);
ENUM_RETURN_STRING(CmdWorldWeaponInfo);
ENUM_RETURN_STRING(CmdCampShopInfo);
ENUM_RETURN_STRING(CmdCharInstallRuneSocket);
ENUM_RETURN_STRING(CmdTakeMaterial);
ENUM_RETURN_STRING(CmdCastleTaxMove);
ENUM_RETURN_STRING(CmdCastleSiegeCount);
ENUM_RETURN_STRING(CmdCompressedPacket);
ENUM_RETURN_STRING(CmdFinalPacketNum);
}
return _T("Unknown Packet");
}
PktBase* CPacketDecoderDlg::DecodePacket(LPBYTE lpBuffer, int nBufferLen, int& nPacketSize)
{
PktBase* lpPktBase = 0;
if (0 != lpBuffer)
{
CString szPacketContents;
m_edPacketContents.GetWindowText(szPacketContents);
const LPCTSTR lpSeparator = _T(" \t\r\n");
LPBYTE lpPacketCopyPos = lpBuffer;
int nTokenPos = 0;
CString szToken;
szToken = szPacketContents.Tokenize(lpSeparator, nTokenPos);
while(_T("") != szToken && lpPacketCopyPos - lpBuffer < nBufferLen)
{
szToken.MakeUpper();
if (2 == szToken.GetLength() &&
_istxdigit(szToken.GetString()[0]) &&
_istxdigit(szToken.GetString()[1]))
{
(*lpPacketCopyPos)
= CharToHexNum(szToken.GetString()[0]) * 16
+ CharToHexNum(szToken.GetString()[1]);
++lpPacketCopyPos;
}
szToken = szPacketContents.Tokenize(lpSeparator, nTokenPos);
}
nPacketSize = static_cast<int>(lpPacketCopyPos - lpBuffer);
CXORCrypt::GetInstance().DecodeHeader((char*)lpBuffer + 1, sizeof(PktBase) - 1, 0, 0);
lpPktBase = reinterpret_cast<PktBase*>(lpBuffer);
if(lpPktBase->IsCrypt())
{
CXORCrypt::GetInstance().DecodePacket((char*)lpBuffer + sizeof(PktBase),
nPacketSize - sizeof(PktBase), lpPktBase->GetCodePage());
}
else if(lpPktBase->IsCompress())
{
BYTE aryBuffer[PktMaxLen];
memcpy(aryBuffer, lpBuffer, min(PktMaxLen, nPacketSize));
DWORD dwDecompressedSize = PktMaxLen;
if (!CMiniLZO::Decompress(
(char*)aryBuffer + sizeof(PktBase),
nPacketSize - sizeof(PktBase),
(char*)lpBuffer + sizeof(PktBase),
&dwDecompressedSize))
{
lpPktBase = 0;
}
else
{
lpPktBase->SetLen(
static_cast<PktBase::LengthType>(dwDecompressedSize + sizeof(PktBase)));
}
}
}
return lpPktBase;
}
void CPacketDecoderDlg::OnBnClickedParseHeader()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
BYTE aryBuffer[PktMaxLen];
int nPacketSize = 0;
PktBase* lpPktBase = DecodePacket(aryBuffer, PktMaxLen, nPacketSize);
if (0 != lpPktBase)
{
m_szParseResult.Format(_T("%s:%3d(0x%02x) : Real(%dByte)/Decoded(%dByte) (%s:%s)"),
GetPacketNameFromCommand(lpPktBase->GetCmd()), lpPktBase->GetCmd(), lpPktBase->GetCmd(),
nPacketSize, lpPktBase->GetLen(),
lpPktBase->IsCrypt() ? _T("XOR Crypted") : _T("No Crypt"),
lpPktBase->IsCompress() ? _T("MiniLZO Compressed") : _T("No Compressed"));
}
else
{
m_szParseResult.Empty();
}
UpdateData(FALSE);
}
void CPacketDecoderDlg::OnBnClickedCompressPacket()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
BYTE aryBuffer[PktMaxLen];
int nPacketSize = 0;
PktBase* lpPktBase = DecodePacket(aryBuffer, PktMaxLen, nPacketSize);
if (0 != lpPktBase && sizeof(PktBase) <= lpPktBase->GetLen())
{
BYTE aryCompressedBuffer[PktMaxLen];
DWORD dwCompressedSize = PktMaxLen;
if (PacketWrap::WrapCompress(
reinterpret_cast<char*>(aryCompressedBuffer), dwCompressedSize,
reinterpret_cast<char*>(lpPktBase), lpPktBase->GetLen(), 0, 0, 0))
{
m_szCompressMiniLZO.Format(_T("MiniLZO : 압축전 패킷 길이 : %5d / 압축후 패킷 길이 : %5d"),
lpPktBase->GetLen(), dwCompressedSize);
}
else
{
m_szCompressMiniLZO.Format(_T("MiniLZO : 패킷 압축에 실패했습니다"));
}
/*
dwCompressedSize = PktMaxLen;
if (Z_OK == compress(aryCompressedBuffer, &dwCompressedSize,
reinterpret_cast<LPBYTE>(lpPktBase + 1), lpPktBase->GetLen() - sizeof(PktBase)))
{
m_szCompressZLIB.Format(_T("ZLIB : 압축전 패킷 길이 : %5d / 압축후 패킷 길이 : %5d"),
lpPktBase->GetLen(), dwCompressedSize + sizeof(PktBase));
}
else
{
m_szCompressZLIB.Format(_T("ZLIB : 패킷 압축에 실패했습니다"));
}*/
/*
LPBYTE lpBuffer = 0;
int nDecompressSize = PktMaxLen;
if (CompressHuffman(reinterpret_cast<LPBYTE>(lpPktBase + 1),
lpPktBase->GetLen() - sizeof(PktBase), lpBuffer, nDecompressSize))
{
m_szCompressZLIB.Format(_T("Huffman : 압축전 패킷 길이 : %5d / 압축후 패킷 길이 : %5d"),
lpPktBase->GetLen(), nDecompressSize + sizeof(PktBase));
free(lpBuffer);
}
else
{
m_szCompressZLIB.Format(_T("Huffman : 패킷 압축에 실패했습니다"));
}
*/
/*
LPBYTE lpBuffer = 0;
int nDecompressSize = PktMaxLen;
if (CompressLZW(reinterpret_cast<LPBYTE>(lpPktBase + 1),
lpPktBase->GetLen() - sizeof(PktBase), lpBuffer, nDecompressSize))
{
m_szCompressZLIB.Format(_T("LZW : 압축전 패킷 길이 : %5d / 압축후 패킷 길이 : %5d"),
lpPktBase->GetLen(), nDecompressSize + sizeof(PktBase));
free(lpBuffer);
}
else
{
m_szCompressZLIB.Format(_T("LZW : 패킷 압축에 실패했습니다"));
}*/
unsigned int nDecompressSize = lzf_compress(lpPktBase + 1,
lpPktBase->GetLen() - sizeof(PktBase), aryCompressedBuffer, PktMaxLen);
if (0 != nDecompressSize)
{
m_szCompressZLIB.Format(_T("LZF : 압축전 패킷 길이 : %5d / 압축후 패킷 길이 : %5d"),
lpPktBase->GetLen(), nDecompressSize + sizeof(PktBase));
}
else
{
m_szCompressZLIB.Format(_T("LZF : 패킷 압축에 실패했습니다"));
}
}
else
{
m_szCompressMiniLZO.Empty();
m_szCompressZLIB.Empty();
}
UpdateData(FALSE);
}

View File

@@ -0,0 +1,49 @@
// PacketDecoderDlg.h : 헤더 파일
//
#pragma once
#include "afxwin.h"
#include "FindFFEdit.h"
// forward decl
struct PktBase;
// CPacketDecoderDlg 대화 상자
// 네트워크로 캡쳐한 패킷을 입력하면, 디코딩해서 원하는 정보로 뽑아냅니다.
class CPacketDecoderDlg : public CDialog
{
// 생성
public:
CPacketDecoderDlg(CWnd* pParent = NULL); // 표준 생성자
// 대화 상자 데이터
enum { IDD = IDD_PACKETDECODER_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원
// 구현
protected:
HICON m_hIcon;
// 메시지 맵 함수를 생성했습니다.
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
private:
afx_msg void OnBnClickedParseHeader();
afx_msg void OnBnClickedCompressPacket();
PktBase* DecodePacket(LPBYTE lpBuffer, int nBufferLen, int& nPacketSize);
CFindFFEdit m_edPacketContents;
CFindFFEdit m_edWorkspace;
CString m_szParseResult;
CString m_szCompressMiniLZO;
CString m_szCompressZLIB;
};

View File

@@ -0,0 +1,77 @@
================================================================================
MFC 라이브러리 : PacketDecoder 프로젝트 개요
================================================================================
응용 프로그램 마법사를 사용하여 PacketDecoder 응용 프로그램을 만듭니다. 이 응용
프로그램에서는 기본적인 MFC 사용 밥법과 응용 프로그램 작성 방법을 설명합니다.
이 파일에는 PacketDecoder 응용 프로그램을 구성하는 각 파일에 대한 개요가 포함되어
있습니다.
PacketDecoder.vcproj
응용 프로그램 마법사를 사용하여 생성된 VC++ 프로젝트의 주 프로젝트 파일입니다.
이 파일에는 파일을 생성한 Visual C++ 버전 정보 및 응용 프로그램 마법사에서 선택한 플랫폼,
구성, 프로젝트 기능 등의 정보가 포함됩니다.
PacketDecoder.h
응용 프로그램의 주 헤더 파일입니다. 이 파일에는 다른 프로젝트에 관련된 Resource.h와 같은
특정 헤더가 포함되며 CPacketDecoderApp 응용 프로그램 클래스가 선언됩니다.
PacketDecoder.cpp
CPacketDecoderApp 응용 프로그램 클래스를 포함하는 주 응용 프로그램의 소스 파일입니다.
PacketDecoder.rc
프로그램에서 사용하는 모든 Microsoft Windows 리소스가 나열된 파일입니다.
이 파일에는 RES 하위 디렉터리에 저장된 아이콘, 비트맵 및 커서가 포함되며
Microsoft Visual C++에서 직접 이 파일을 편집할 수도 있습니다. 사용자의 프로젝트
리소스는 1042에 들어 있습니다.
res\PacketDecoder.ico
응용 프로그램의 아이콘으로 사용되는 아이콘 파일입니다.
이 아이콘은 주 리소스 파일인 PacketDecoder.rc에 포함됩니다.
res\PacketDecoder.rc2
Microsoft Visual C++에서 편집할 수 없는 리소스가 포함된 파일입니다.
리소스 편집기에서 편집할 수 없는 모든 리소스는 이 파일에 포함되어 있습니다.
/////////////////////////////////////////////////////////////////////////////
응용 프로그램 마법사에서는 단일 대화 상자 클래스를 만듭니다.
PacketDecoderDlg.h, PacketDecoderDlg.cpp - 대화 상자
CPacketDecoderDlg 클래스를 포함하는 파일입니다. 이 클래스에는 응용 프로그램의
주 대화 상자에 대한 동작이 정의됩니다. 대화 상자의 템플릿은 PacketDecoder.rc에
있으며 Microsoft Visual C++에서 편집할 수 있습니다.
/////////////////////////////////////////////////////////////////////////////
기타 기능
ActiveX 컨트롤
응용 프로그램에서 ActiveX 컨트롤을 사용할 수 있습니다.
/////////////////////////////////////////////////////////////////////////////
기타 표준 파일
StdAfx.h, StdAfx.cpp
미리 컴파일된 헤더 파일(PCH) PacketDecoder.pch 및 미리 컴파일된
형식 파일 StdAfx.obj를 빌드할 때 사용되는 파일입니다.
Resource.h
새로운 리소스 ID를 정의하는 표준 헤더 파일입니다.
Microsoft Visual C++에서 이 파일을 읽고 업데이트합니다.
/////////////////////////////////////////////////////////////////////////////
기타 정보
응용 프로그램 마법사에서는 "TODO:"를 사용하여 추가하거나 사용자 지정해야 하는
소스 코드를 나타냅니다.
응용 프로그램에서 공유 DLL에 MFC를 사용하고 응용 프로그램의 언어가 운영 체제의
언어와 다른 경우 Microsoft Visual C++ CD-ROM의 Win\System 디렉터리에 있는
해당 지역의 리소스인 MFC70XXX.DLL을 컴퓨터의 system 또는 system32 디렉터리에
복사한 다음 MFCLOC.DLL로 이름을 바꾸어야 합니다. "XXX"는 해당 언어를 나타내는
약어입니다. 예를 들어 MFC70DEU.DLL에는 독일어로 변환된 리소스가 포함됩니다.
이런 작업을 하지 않으면 응용 프로그램의 일부 UI 요소가 운영 체제의 언어로
남아 있게 됩니다.
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,27 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by PacketDecoder.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_PACKETDECODER_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_PARSE_HEADER 1000
#define IDC_COMPRESS_PACKET 1001
#define IDC_PACKET_CONTENT 1002
#define IDC_COMPRESS_MINILZO 1003
#define IDC_PACKET_HEADER 1004
#define IDC_WORKSPACE 1005
#define IDC_COMPRESS_ZLIB 1006
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Windows.PacketDecoder"
type="win32"
/>
<description>여기에 응용 프로그램 설명을 추가합니다.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

View File

@@ -0,0 +1,13 @@
//
// PacketDecoder.RC2 - resources Microsoft Visual C++에서 직접 편집하지 않는 리소스
//
#ifdef APSTUDIO_INVOKED
#error 이 파일은 Microsoft Visual C++에서 편집할 수 없습니다.
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// 여기에 수동으로 편집한 리소스를 추가합니다.
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,7 @@
// stdafx.cpp : 표준 포함 파일을 포함하는 소스 파일입니다.
// PacketDecoder.pch는 미리 컴파일된 헤더가 됩니다.
// stdafx.obj는 미리 컴파일된 형식 정보를 포함합니다.
#include "stdafx.h"

View File

@@ -0,0 +1,42 @@
// stdafx.h : 잘 변경되지 않고 자주 사용하는
// 표준 시스템 포함 파일 및 프로젝트 관련 포함 파일이
// 들어 있는 포함 파일입니다.
#pragma once
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Windows 헤더에서 거의 사용되지 않는 내용을 제외시킵니다.
#endif
// 아래 지정된 플랫폼보다 우선하는 플랫폼을 대상으로 하는 경우 다음 정의를 수정하십시오.
// 다른 플랫폼에 사용되는 해당 값의 최신 정보는 MSDN을 참조하십시오.
#ifndef WINVER // Windows 95 및 Windows NT 4 이후 버전에서만 기능을 사용할 수 있습니다.
#define WINVER 0x0400 // Windows 98과 Windows 2000 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
#endif
#ifndef _WIN32_WINNT // Windows NT 4 이후 버전에서만 기능을 사용할 수 있습니다.
#define _WIN32_WINNT 0x0400 // Windows 98과 Windows 2000 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
#endif
#ifndef _WIN32_WINDOWS // Windows 98 이후 버전에서만 기능을 사용할 수 있습니다.
#define _WIN32_WINDOWS 0x0410 // Windows Me 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
#endif
#ifndef _WIN32_IE // IE 4.0 이후 버전에서만 기능을 사용할 수 있습니다.
#define _WIN32_IE 0x0400 // IE 5.0 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
#endif
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 일부 CString 생성자는 명시적으로 선언됩니다.
// MFC의 공통 부분과 무시 가능한 경고 메시지에 대한 숨기기를 해제합니다.
#define _AFX_ALL_WARNINGS
#include <afxwin.h> // MFC 핵심 및 표준 구성 요소
#include <afxext.h> // MFC 익스텐션
#include <afxdisp.h> // MFC 자동화 클래스
#include <afxdtctl.h> // Internet Explorer 4 공용 컨트롤에 대한 MFC 지원
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // Windows 공용 컨트롤에 대한 MFC 지원
#endif // _AFX_NO_AFXCMN_SUPPORT