Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS

Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
@@ -0,0 +1,23 @@
// Delete.cpp: implementation of the CDelete class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PatchIT.h"
#include "Delete.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDelete::~CDelete()
{
}
+27
View File
@@ -0,0 +1,27 @@
// Delete.h: interface for the CDelete class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DELETE_H__7D50B654_DEDD_412D_B807_3CFD1C9EA36E__INCLUDED_)
#define AFX_DELETE_H__7D50B654_DEDD_412D_B807_3CFD1C9EA36E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "PatchOperation.h"
class CDelete : public CPatchOperation
{
public:
CDelete(DWORD loc,DWORD sze) {Location=loc; Size=sze;}
CString GetOpText() {CString str; str.Format("Delete %7i Bytes at %7i\n",Size,Location); return str;}
DWORD InsertedBytes() {return 0;}
DWORD DeletedBytes() {return Size;}
virtual ~CDelete();
};
#endif // !defined(AFX_DELETE_H__7D50B654_DEDD_412D_B807_3CFD1C9EA36E__INCLUDED_)
+157
View File
@@ -0,0 +1,157 @@
// FilePro.cpp: implementation of the CFilePro class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PatchIT.h"
#include "FilePro.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
float SyncRank(DWORD pos,DWORD size,DWORD sloc,DWORD fsize)
{
DWORD recommend_size=fsize/1000;
if(size>recommend_size) return 0.00000001f;
if(recommend_size==0) recommend_size=1;
float sweight,pweight;
if(size<=recommend_size)
sweight=(float)size/recommend_size;
else
sweight=(float)(fsize-(size-recommend_size))/(fsize-recommend_size);
//if(size<8 || size>(fsize*2.0)) sweight/=2.0;
pweight=(float)((fsize-sloc)-pos)/(fsize-sloc);
return pweight*sweight;
}
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CFilePro::CFilePro()
{
BlockLoc=BlockSize=0;
}
void CFilePro::ReadBlockAt(DWORD bl)
{
BlockLoc=bl;
if(GetPosition()!=BlockLoc) Seek(bl,CFile::begin);
BlockSize=GetLength()-BlockLoc;
if(BlockSize<=BUFFERSIZE)
LastBlock=true;
else {BlockSize=BUFFERSIZE; LastBlock=false;}
Read(Buffer,BlockSize);
}
DWORD CFilePro::DifferAt(CFilePro &file,DWORD *floc)
{
DWORD pos1,pos2;
DWORD eof1,eof2;
eof1=GetLength();
eof2=file.GetLength();
pos1=GetPosition();
pos2=file.GetPosition();
while(GetByte(pos1)==file.GetByte(pos2) && pos1<eof1 && pos2<eof2) {pos1++; pos2++;}
Seek(pos1,CFile::begin);
file.Seek(pos2,CFile::begin);
*floc=pos2;
return pos1;
}
BYTE CFilePro::GetByte(DWORD loc)
{
if((loc-BlockLoc)<BlockSize)
return Buffer[loc-BlockLoc];
else
ReadBlockAt(loc);
return Buffer[0];
}
bool CFilePro::SyncedAt(CFilePro &file,DWORD *sloc,int earlyout)
{
DWORD pos;
DWORD cur_pos,old_pos,old_pos2,eof,eof2;
DWORD hipos=0,hisize=0;
float hirank=0.0f;
DWORD cnt=1;
float rank;
eof=GetLength();
eof2=file.GetLength();
cur_pos=old_pos=GetPosition();
old_pos2=file.GetPosition();
if(old_pos2>=eof2 || old_pos>=eof) return false;
while(cur_pos<eof && (earlyout<0 || hisize<(DWORD)earlyout))
{
pos=0;
while(GetByte(cur_pos)!=file.GetByte(old_pos2) && cur_pos<eof) cur_pos++;
if(cur_pos<eof)
{
cnt=1;
while(GetByte(cur_pos+cnt)==file.GetByte(old_pos2+cnt) && (cur_pos+cnt)<eof && (old_pos2+cnt)<eof2) cnt++;
rank=SyncRank(cur_pos,cnt,old_pos,eof);
if(rank>hirank) //Best Sync Rank
{
hirank=rank;
hisize=cnt;
hipos=cur_pos;
}
/*
if(cnt>hisize) //Largeest BLock
{
hisize=cnt;
hipos=cur_pos;
}
*/
cur_pos++;
}
}
Seek(old_pos,CFile::begin);
file.Seek(old_pos2,CFile::begin);
*sloc=hipos;
return (hisize>0)?true:false;
}
unsigned __int64 CFilePro::CRC()
{
unsigned __int64 sum=0;
Seek(0,CFile::begin);
DWORD pos;
do
{
ReadBlockAt(GetPosition());
pos=0;
while(pos<BlockSize) {sum+=(__int64)Buffer[pos]; pos++;}
}
while(BlockSize>=BUFFERSIZE);
return sum;
}
CFilePro::~CFilePro()
{
}
+34
View File
@@ -0,0 +1,34 @@
// FilePro.h: interface for the CFilePro class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FILEPRO_H__3D5A8AA2_5CA6_481D_B14D_5B1074EA0304__INCLUDED_)
#define AFX_FILEPRO_H__3D5A8AA2_5CA6_481D_B14D_5B1074EA0304__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define BUFFERSIZE 1024
//#define BUFFERSIZE 4
class CFilePro:public CFile
{
protected:
bool LastBlock;
DWORD BlockLoc;
DWORD BlockSize;
BYTE Buffer[BUFFERSIZE];
void ReadBlockAt(DWORD bl);
public:
DWORD DifferAt(CFilePro &file,DWORD *pos2);
bool SyncedAt(CFilePro &file,DWORD *sloc,int earlyout=-1);
BYTE GetByte(DWORD loc);
unsigned __int64 CRC();
CFilePro();
virtual ~CFilePro();
};
#endif // !defined(AFX_FILEPRO_H__3D5A8AA2_5CA6_481D_B14D_5B1074EA0304__INCLUDED_)
@@ -0,0 +1,24 @@
// Insert.cpp: implementation of the CInsert class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PatchIT.h"
#include "Insert.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CInsert::~CInsert()
{
}
+26
View File
@@ -0,0 +1,26 @@
// Insert.h: interface for the CInsert class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_INSERT_H__30575E3B_321A_4F48_9DC3_3248FC7CF6E0__INCLUDED_)
#define AFX_INSERT_H__30575E3B_321A_4F48_9DC3_3248FC7CF6E0__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "PatchOperation.h"
class CInsert : public CPatchOperation
{
DWORD SourceLoc;
public:
CInsert(DWORD loc,DWORD sze,DWORD sloc) {Location=loc; Size=sze; SourceLoc=sloc;}
CString GetOpText() {CString str; str.Format("Insert %7i Bytes at %7i From %7i\n",Size,Location,SourceLoc); return str;}
DWORD InsertedBytes() {return Size;}
DWORD DeletedBytes() {return 0;}
virtual ~CInsert();
};
#endif // !defined(AFX_INSERT_H__30575E3B_321A_4F48_9DC3_3248FC7CF6E0__INCLUDED_)
@@ -0,0 +1,86 @@
// PatchApply.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "PatchApply.h"
#include "PatchApplyDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
bool EnglishErrors=false;
/////////////////////////////////////////////////////////////////////////////
// CPatchApplyApp
BEGIN_MESSAGE_MAP(CPatchApplyApp, CWinApp)
//{{AFX_MSG_MAP(CPatchApplyApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPatchApplyApp construction
CPatchApplyApp::CPatchApplyApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CPatchApplyApp object
CPatchApplyApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CPatchApplyApp initialization
BOOL CPatchApplyApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CPatchApplyDlg dlg;
CString cmdline=this->m_lpCmdLine;
if(cmdline.Find("englishalways")>=0) EnglishErrors=true;
if(cmdline.Find("-s")>=0)
{
dlg.InSetup=true;
if(!dlg.NeedUpgrade()) return FALSE;
}
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
@@ -0,0 +1,146 @@
# Microsoft Developer Studio Project File - Name="PatchApply" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=PatchApply - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "PatchApply.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "PatchApply.mak" CFG="PatchApply - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "PatchApply - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "PatchApply - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "PatchApply - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../../rel.bin"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 Version.lib patchw32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "PatchApply - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../../../dbg.bin"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\libraries" /I "C:\Program Files\PocketSoft\RTPatch" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 Version.lib patchw32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "PatchApply - Win32 Release"
# Name "PatchApply - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\PatchApply.cpp
# End Source File
# Begin Source File
SOURCE=.\PatchApply.rc
# End Source File
# Begin Source File
SOURCE=.\PatchApplyDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\PatchApply.h
# End Source File
# Begin Source File
SOURCE=.\PatchApplyDlg.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\PatchApply.ico
# End Source File
# Begin Source File
SOURCE=.\res\PatchApply.rc2
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project
@@ -0,0 +1,49 @@
// PatchApply.h : main header file for the PATCHAPPLY application
//
#if !defined(AFX_PATCHAPPLY_H__0E24A44B_D150_44D7_B5EE_4C13F453B378__INCLUDED_)
#define AFX_PATCHAPPLY_H__0E24A44B_D150_44D7_B5EE_4C13F453B378__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CPatchApplyApp:
// See PatchApply.cpp for the implementation of this class
//
class CPatchApplyApp : public CWinApp
{
public:
CPatchApplyApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPatchApplyApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CPatchApplyApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PATCHAPPLY_H__0E24A44B_D150_44D7_B5EE_4C13F453B378__INCLUDED_)
@@ -0,0 +1,472 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Korean resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
#ifdef _WIN32
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
#pragma code_page(949)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_TABLESTART "---------------------KOREAN STRINGS----------------------"
IDS_ENG_PTTIT "MechWarrior 4 彐纂"
IDS_ENG_PTLSF "樹橫 婦溼 冖橾擊 彐纂ビ朝 醞"
IDS_ENG_ERROR "螃盟"
IDS_ENG_REGERROR "MW4陛 撲纂腎橫 氈雖 彊剪釭 薯渠煎 撲纂腎橫 氈雖 彊蝗棲棻."
IDS_ENG_UCP "彐纂蒂 諫猿ブ 熱 橈蝗棲棻."
IDS_ENG_UDL "憲 熱 橈朝 樹橫"
IDS_ENG_PGF "啪歜 冖橾擊 機等檜⑷ビ朝 醞"
IDS_ENG_OPCOM "彐纂 濛機 諫猿"
IDS_ENG_WINTITLE "MechWarrior 4: Vengeance 彐纂 嶸丶葬ⅷ"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_EXIT "部頂晦"
IDS_ENG_PATCHERROR "彐纂 螃盟"
IDS_ENG_PROC "霞ヤ 醞: "
IDS_ENG_SEETXT "螃盟 囀萄縑 渠フ 撲貲擎 ""PR2 readme.rtf""縑 氈蝗棲棻."
IDS_ENG_PH6 "****Place Holder****"
IDS_ENG_PH7 "****Place Holder****"
IDS_ENG_PH8 "****Place Holder****"
IDS_ENG_PH9 "****Place Holder****"
IDS_ENG_PTMSG "MechWarrior 4: Vengeance 彐纂蒂 褒ヤビ衛啊蝗棲梱?"
IDS_READMEFNAME "PR2 readme.rtf"
IDS_LANGMISSING "The current version of the game installed is not a supported version. You must have at least MechWarrior IV Patch 2 installed to work with the expansion pack. You are currently running the English version of this patch which does not support the current language version of MechWarrior IV that you have installed. It is suggested that you download the appropriate patch files for your language and install it seperately. If you continue with this version you will run into errors."
END
#endif // Korean resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Chinese (Taiwan) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHT)
#ifdef _WIN32
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL
#pragma code_page(950)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_TABLESTART "---------------------TAIWANESE STRINGS----------------------"
IDS_ENG_PTTIT "Mech Warrior 4 修補程式"
IDS_ENG_PTLSF "正在更新語系相關檔案。"
IDS_ENG_ERROR "錯誤"
IDS_ENG_REGERROR "MW4 尚未安裝或是安裝不正確。"
IDS_ENG_UCP "無法完成修補。"
IDS_ENG_UDL "無法辨識的語系。"
IDS_ENG_PGF "正在更新遊戲檔。"
IDS_ENG_OPCOM "修補完成"
IDS_ENG_WINTITLE "「機甲爭霸戰 4 復仇者」修補工具"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_EXIT "離開"
IDS_ENG_PATCHERROR "修補發生錯誤"
IDS_ENG_PROC "處理中 - "
IDS_ENG_SEETXT "錯誤碼說明請參閱\\ PR2 readme.rtf"
IDS_ENG_PH6 "****Place Holder****"
IDS_ENG_PH7 "****Place Holder****"
IDS_ENG_PH8 "****Place Holder****"
IDS_ENG_PH9 "****Place Holder****"
IDS_ENG_PTMSG "您要修補「機甲爭霸戰 4 復仇者」嗎?"
IDS_READMEFNAME "PR2 readme.rtf"
IDS_LANGMISSING "The current version of the game installed is not a supported version. You must have at least MechWarrior IV Patch 2 installed to work with the expansion pack. You are currently running the English version of this patch which does not support the current language version of MechWarrior IV that you have installed. It is suggested that you download the appropriate patch files for your language and install it seperately. If you continue with this version you will run into errors."
END
#endif // Chinese (Taiwan) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_TABLESTART "---------------------GERMAN STRINGS----------------------"
IDS_ENG_PTTIT "Patch f僡 Mech Warrior 4"
IDS_ENG_PTLSF "Patch f僡 Sprachdateien wird installiert"
IDS_ENG_ERROR "Fehler"
IDS_ENG_REGERROR "MW4 ist auf diesem Computer nicht installiert oder nicht richtig installiert. "
IDS_ENG_UCP "Patch-Installation kann nicht abgeschlossen werden."
IDS_ENG_UDL "Unbekannte Sprache"
IDS_ENG_PGF "Patch f僡 Spieldateien wird installiert"
IDS_ENG_OPCOM "Patch-Installation abgeschlossen"
IDS_ENG_WINTITLE "Mech Warrior 4 Vengeance - Patch-Dienstprogamm"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_EXIT "Beenden"
IDS_ENG_PATCHERROR "Fehler bei Patch-Installation"
IDS_ENG_PROC "Verarbeitung erfolgt - "
IDS_ENG_SEETXT "Erl酳terungen zu den Fehlercodes finden Sie in der Datei ""PR2\nInfodatei.rtf"""
IDS_ENG_PH6 "****Place Holder****"
IDS_ENG_PH7 "****Place Holder****"
IDS_ENG_PH8 "****Place Holder****"
IDS_ENG_PH9 "****Place Holder****"
IDS_ENG_PTMSG "M鐼hten Sie den Patch f僡 Mech Warrior 4 Vengeance installieren?"
IDS_READMEFNAME "PR2\nInfodatei.rtf"
IDS_LANGMISSING "The current version of the game installed is not a supported version. You must have at least MechWarrior IV Patch 2 installed to work with the expansion pack. You are currently running the English version of this patch which does not support the current language version of MechWarrior IV that you have installed. It is suggested that you download the appropriate patch files for your language and install it seperately. If you continue with this version you will run into errors."
END
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
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_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\PatchApply.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\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 DISCARDABLE "res\\MW4.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About PatchApply"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "PatchApply Version 1.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2001",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
END
IDD_PATCHAPPLY_DIALOG DIALOGEX 0, 0, 241, 79
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "MechWarrior 4 Vengeance Patching Util"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "Progress1",IDC_PATCHPROG,"msctls_progress32",WS_BORDER,
7,41,227,14
CTEXT "Static",IDC_STATTEXT,7,3,227,8
PUSHBUTTON "Exit",IDC_EXIT,95,59,50,14
CONTROL "Progress1",IDC_FILEPROG,"msctls_progress32",WS_BORDER,7,
17,227,14
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// 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 "040904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "\0"
VALUE "FileDescription", "PatchApply MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "PatchApply\0"
VALUE "LegalCopyright", "Copyright (C) 2001\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "PatchApply.EXE\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "PatchApply Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_PATCHAPPLY_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 234
TOPMARGIN, 3
BOTTOMMARGIN, 73
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About PatchApply..."
IDS_ENG_TABLESTART "---------------------ENGLISH STRINGS----------------------"
IDS_ENG_PTTIT "Mech Warrior 4 Patch"
IDS_ENG_PTLSF "Patching language specific files"
IDS_ENG_ERROR "Error"
IDS_ENG_REGERROR "MW4 is not installed or not installed correctly on this computer. "
IDS_ENG_UCP "Unable to complete patch."
IDS_ENG_UDL "Unidentified Language"
IDS_ENG_PGF "Patching Game Files"
IDS_ENG_OPCOM "Patching Operation Complete"
IDS_ENG_WINTITLE "Mech Warrior 4 Vengeance Patching Utility"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_EXIT "Done"
IDS_ENG_PATCHERROR "Patch Error"
IDS_ENG_PROC "Processing - "
IDS_ENG_SEETXT "Error code descriptions can be found in the ""PR2 readme.rtf """
IDS_ENG_PH6 "****Place Holder****"
IDS_ENG_PH7 "****Place Holder****"
IDS_ENG_PH8 "****Place Holder****"
IDS_ENG_PH9 "****Place Holder****"
IDS_ENG_PTMSG "Do you want to patch Mech Warrior 4 Vengeance?"
IDS_READMEFNAME "PR2 readme.rtf"
IDS_LANGMISSING "The current version of the game installed is not a supported version. You must have at least MechWarrior IV Patch 2 installed to work with the expansion pack. You are currently running the English version of this patch which does not support the current language version of MechWarrior IV that you have installed. It is suggested that you download the appropriate patch files for your language and install it seperately. If you continue with this version you will run into errors."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_TABLESTART "---------------------FRENCH STRINGS----------------------"
IDS_ENG_PTTIT "Correctif Mech Warrior 4"
IDS_ENG_PTLSF "Correction des fichiers langues sp嶰ifiques"
IDS_ENG_ERROR "Erreur"
IDS_ENG_REGERROR "MW4 n'est pas install ou n'est pas correctement install sur cet ordinateur. "
IDS_ENG_UCP "Impossible de terminer la correction."
IDS_ENG_UDL "Langue non identifi嶪"
IDS_ENG_PGF "Correction des fichiers jeu"
IDS_ENG_OPCOM "Correction termin嶪"
IDS_ENG_WINTITLE "Utilitaire de correction Mech Warrior 4 Vengeance"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_EXIT "Quitter"
IDS_ENG_PATCHERROR "Erreur du correctif"
IDS_ENG_PROC "Traitement: "
IDS_ENG_SEETXT "Les descriptions des codes d'erreurs se trouvent dans le fichier 促R2 lisez-moi.rtf ."
IDS_ENG_PH6 "****Place Holder****"
IDS_ENG_PH7 "****Place Holder****"
IDS_ENG_PH8 "****Place Holder****"
IDS_ENG_PH9 "****Place Holder****"
IDS_ENG_PTMSG "Voulez-vous corriger Mech Warrior 4 Vengeance?"
IDS_READMEFNAME "PR2 lisez-moi.rtf"
IDS_LANGMISSING "The current version of the game installed is not a supported version. You must have at least MechWarrior IV Patch 2 installed to work with the expansion pack. You are currently running the English version of this patch which does not support the current language version of MechWarrior IV that you have installed. It is suggested that you download the appropriate patch files for your language and install it seperately. If you continue with this version you will run into errors."
END
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Spanish (Modern) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN)
#ifdef _WIN32
LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_TABLESTART "---------------------SPANISH STRINGS----------------------"
IDS_ENG_PTTIT "Correcci鏮 parcial de Mech Warrior 4"
IDS_ENG_PTLSF "Correcci鏮 parcial de archivos espec璗icos de idioma en curso"
IDS_ENG_ERROR "Error"
IDS_ENG_REGERROR "MW4 no est instalado en este equipo o no se instal correctamente."
IDS_ENG_UCP "No se puede completar la correcci鏮 parcial."
IDS_ENG_UDL "Idioma no definido"
IDS_ENG_PGF "Correcci鏮 parcial de archivos del juego en curso"
IDS_ENG_OPCOM "Correcci鏮 parcial completada"
IDS_ENG_WINTITLE "Utilidad de correcci鏮 parcial de Mech Warrior 4 Vengeance"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ENG_EXIT "Salir"
IDS_ENG_PATCHERROR "Error de correcci鏮 parcial"
IDS_ENG_PROC "Procesando: "
IDS_ENG_SEETXT "Las descripciones de c鏚igos de error se encuentran en el archivo ""PR2 l嶧me.rtf"""
IDS_ENG_PH6 "****Place Holder****"
IDS_ENG_PH7 "****Place Holder****"
IDS_ENG_PH8 "****Place Holder****"
IDS_ENG_PH9 "****Place Holder****"
IDS_ENG_PTMSG "澳eseas realizar la correcci鏮 parcial de Mech Warrior 4 Vengeance?"
IDS_READMEFNAME "PR2 l嶧me.rtf"
IDS_LANGMISSING "The current version of the game installed is not a supported version. You must have at least MechWarrior IV Patch 2 installed to work with the expansion pack. You are currently running the English version of this patch which does not support the current language version of MechWarrior IV that you have installed. It is suggested that you download the appropriate patch files for your language and install it seperately. If you continue with this version you will run into errors."
END
#endif // Spanish (Modern) 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_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\PatchApply.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,692 @@
// PatchApplyDlg.cpp : implementation file
//
#include "stdafx.h"
#include "PatchApply.h"
#include "PatchApplyDlg.h"
#include "patchwin.h"
#define PATCHFILE "mw4.rtp"
extern bool EnglishErrors;
#define LNG_ENGLISH 0x0409
#define LNG_FRENCH 0x040C
#define LNG_GERMAN 0x0407
#define LNG_KOREAN 0x0412
#define LNG_SPANISH 0x0C0A
#define LNG_CHINESE 0x0404
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
void PatchApply(const char *);
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPatchApplyDlg dialog
CPatchApplyDlg *g_DlgPtr;
CPatchApplyDlg::CPatchApplyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPatchApplyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPatchApplyDlg)
m_StatText = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
g_DlgPtr=this;
InSetup=false;
IsEnglish=false;
Patching=false;
ErrorProcessed=false;
}
void CPatchApplyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPatchApplyDlg)
DDX_Control(pDX, IDC_FILEPROG, m_FileProg);
DDX_Control(pDX, IDC_EXIT, m_But);
DDX_Control(pDX, IDC_PATCHPROG, m_PatchProg);
DDX_Text(pDX, IDC_STATTEXT, m_StatText);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPatchApplyDlg, CDialog)
//{{AFX_MSG_MAP(CPatchApplyDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_EXIT, OnExit)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPatchApplyDlg message handlers
BOOL CPatchApplyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
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);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
SetWindowText(GetTransString(IDS_ENG_WINTITLE));
m_But.SetWindowText(GetTransString(IDS_ENG_EXIT));
IsEnglish=false;
Patching=false;
m_PatchProg.SetRange(0,100);
m_PatchProg.SetPos(0);
m_FileProg.SetPos(0);
ErrorProcessed=false;
CRect deskrect,rect;
SystemParametersInfo(SPI_GETWORKAREA, NULL, (LPVOID) &deskrect, false);
GetWindowRect(rect);
SetWindowPos(NULL,deskrect.CenterPoint().x-rect.Width()/2,
deskrect.CenterPoint().y-rect.Height()/2,-1,-1,SWP_NOZORDER|SWP_NOSIZE);
ShowWindow(SW_SHOW);
if(InSetup|| (MessageBox(GetTransString(IDS_ENG_PTTIT),GetTransString(IDS_ENG_PTMSG),MB_OKCANCEL)==IDOK))
{
ApplyPatch();
}
else
PostQuitMessage(0);
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CPatchApplyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CPatchApplyDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
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;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CPatchApplyDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
struct LANGANDCODEPAGE {
WORD wLanguage;
WORD wCodePage;
} ;
LPVOID CALLBACK CallBack( UINT Id, LPVOID Parm)
{
return g_DlgPtr->PatchCallBack(Id,Parm);
//MessageBox(NULL,(LPCSTR)Parm,"RTPatch",MB_OK);
return NULL;
}
void CPatchApplyDlg::ApplyPatch()
{
Patching=true;
m_But.EnableWindow(FALSE);
HKEY pathkey;
if(ERROR_SUCCESS !=RegOpenKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Microsoft Games\\MechWarrior Vengeance",&pathkey))
{
FatalError(IDS_ENG_REGERROR);
return;
}
DWORD ktype;
DWORD size= MAX_PATH;
char dbuf[MAX_PATH];
if(ERROR_SUCCESS !=RegQueryValueEx(pathkey,"EXE Path",NULL,&ktype,(BYTE *)dbuf,&size) || size<=0 || ktype!=REG_SZ)
{
FatalError(IDS_ENG_REGERROR);
return;
}
RegCloseKey(pathkey);
CString game_path(dbuf);
CString file_path;
m_StatText=GetTransString(IDS_ENG_PTLSF); UpdateData(FALSE);
file_path=game_path+"\\MissionLang.dll";
DWORD bufsize=GetFileVersionInfoSize((char *)(LPCSTR)file_path,NULL);
if(!bufsize)
{
FatalError(IDS_ENG_REGERROR);
return;
}
BYTE *pBlock=new BYTE[bufsize];
GetFileVersionInfo((char *)(LPCSTR)file_path,NULL,bufsize,pBlock);
void *lpBuffer;
UINT dwBytes;
// Read the list of languages and code pages.
UINT cbTranslate;
LANGANDCODEPAGE *lpTranslate;
VerQueryValue(pBlock,
TEXT("\\VarFileInfo\\Translation"),
(LPVOID*)&lpTranslate,
&cbTranslate);
// Read the file description for each language and code page.
char SubBlock[512];
wsprintf( SubBlock,
TEXT("\\StringFileInfo\\%04x%04x\\FileDescription"),
lpTranslate->wLanguage,
lpTranslate->wCodePage);
// Retrieve file description for language and code page "i".
VerQueryValue(pBlock,
SubBlock,
&lpBuffer,
&dwBytes);
CString source_dir;
switch(lpTranslate->wLanguage)
{
case LNG_ENGLISH: source_dir="English"; break;
case LNG_FRENCH: source_dir="French"; break;
case LNG_GERMAN: source_dir="German"; break;
case LNG_KOREAN: source_dir="Korean"; break;
case LNG_SPANISH: source_dir="Spanish"; break;
case LNG_CHINESE: source_dir="Taiwan"; break;
default:
FatalError(IDS_ENG_UDL);
}
//copy or patch files from sourcedir here;
// CopyFile(source_dir+"\\missionlang.dll",game_path+"\\missionlang.dll",NULL);
// CopyFile(source_dir+"\\ScriptStrings.dll",game_path+"\\ScriptStrings.dll",NULL);
delete pBlock;
char tstr[MAX_PATH];
CString old_cwd;
GetCurrentDirectory(MAX_PATH,tstr);
old_cwd=tstr;
source_dir=old_cwd+"\\"+source_dir;
SetCurrentDirectory(game_path);
m_StatText=GetTransString(IDS_ENG_PGF); UpdateData(FALSE);
//Apply Pros/exe Patch here
CString cmdline;
WIN32_FIND_DATA finddat;
cmdline.Format("\"%s\" \"%s\\mw4\"",game_path,source_dir);
if(INVALID_HANDLE_VALUE==FindFirstFile(source_dir+"\\"+PATCHFILE,&finddat))
{
if(InSetup && lpTranslate->wLanguage!=LNG_ENGLISH)
{
FatalError(IDS_LANGMISSING);
}
else
FatalError(IDS_ENG_PATCHERROR);
SetCurrentDirectory(tstr);
return;
}
UINT res=RTPatchApply32((char *)(LPCSTR)cmdline,CallBack,0);
if(res)
{
FatalError(IDS_ENG_PATCHERROR);
SetCurrentDirectory(tstr);
return;
}
SetCurrentDirectory(tstr);
/*
HKEY verkey;
if(ERROR_SUCCESS !=RegOpenKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Microsoft Games\\MechWarrior Vengeance",&verkey))
{ FatalError(IDS_ENG_REGERROR); return ; }
if(ERROR_SUCCESS !=RegSetValueEx(verkey,"Version",NULL,REG_SZ,(BYTE *)"4.0a",strlen("4.0a")+1))
{ FatalError(IDS_ENG_REGERROR); return; }
RegCloseKey(verkey);
*/
m_PatchProg.SetPos(100);
m_StatText=GetTransString(IDS_ENG_OPCOM); UpdateData(FALSE);
m_But.EnableWindow(TRUE);
DisplayReadMe();
Patching=false;
OnOK();
}
bool CPatchApplyDlg::NeedUpgrade()
{
bool ret=false;
char str[256];
DWORD len=256;
DWORD type=REG_SZ;
HKEY verkey;
if(ERROR_SUCCESS !=RegOpenKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Microsoft Games\\MechWarrior Vengeance",&verkey))
{ ret=true; }
else
if(ERROR_SUCCESS !=RegQueryValueEx(verkey,"Version",NULL,&type,(BYTE *)str,&len))
{ ret=true; }
else
{
if(len<=0 || strcmp(str,"4.0c")<0) ret=true;
else ret=false;
}
RegCloseKey(verkey);
return ret;
}
static LPCSTR LoadStringEx(UINT id)
{
if(!EnglishErrors)
{
LANGID lid=GetSystemDefaultLangID();
HRSRC hres = FindResourceEx(NULL, RT_STRING, MAKEINTRESOURCE((id >> 4) + 1), lid);
if (hres) {
HGLOBAL hmem = LoadResource(NULL, hres);
if (hmem) {
LPWSTR pwz = (LPWSTR)LockResource(hmem);
for (UINT u = id & 15; u > 0; u--)
pwz += *pwz + 1;
if (!*pwz)
return NULL;
static char szMultiByte[1024];
int iRc = WideCharToMultiByte(CP_ACP, 0, pwz + 1, *pwz, szMultiByte, sizeof(szMultiByte), NULL, NULL);
szMultiByte[iRc] = 0;
return szMultiByte;
}
}
DWORD dwErr = GetLastError();
}
CString str;
str.LoadString(id);
return str;
}
CString CPatchApplyDlg::GetTransString(UINT id)
{
CString str;
#if 0
UINT baseid;
LCID lid=GetSystemDefaultLCID();
switch(lid)
{
case LNG_FRENCH: baseid=IDS_FRN_TABLESTART; break;
case LNG_GERMAN: baseid=IDS_GER_TABLESTART; break;
case LNG_KOREAN: baseid=IDS_KOR_TABLESTART; break;
case LNG_SPANISH: baseid=IDS_SPN_TABLESTART; break;
case LNG_CHINESE: baseid=IDS_TAI_TABLESTART; break;
default:
case LNG_ENGLISH: baseid=IDS_ENG_TABLESTART; IsEnglish=true; break;
}
str.LoadString((id-IDS_ENG_TABLESTART)+baseid);
#endif
str = LoadStringEx(id);
#if 0
LCID lcid = GetThreadLocale();
char szString[1024];
int iRc = ::LoadString(AfxGetInstanceHandle(), id, szString, sizeof(szString));
if (iRc)
str = szString;
#endif
return str;
}
void CPatchApplyDlg::FatalError(UINT id)
{
if(!ErrorProcessed)
MessageBox(GetTransString(id)+"\n"+GetTransString(IDS_ENG_UCP),GetTransString(IDS_ENG_ERROR),MB_OK|MB_ICONERROR);
PostQuitMessage(0);
}
bool CPatchApplyDlg::DoesFileExist(LPCSTR fname)
{
return 0xffffffff!=GetFileAttributes( fname );
}
bool CPatchApplyDlg::DisplayReadMe()
{
CString readmefile;
readmefile.LoadString(IDS_READMEFNAME);
if(DoesFileExist( readmefile ))
{
SHELLEXECUTEINFO info;
ZeroMemory(&info,sizeof(info));
info.cbSize=sizeof(info);
info.lpVerb="open";
info.lpFile=readmefile;
info.nShow=SW_SHOWNORMAL;
info.fMask=SEE_MASK_NOCLOSEPROCESS;
ShellExecuteEx(&info);
DWORD eflag;
do
{
if(GetExitCodeProcess(info.hProcess,&eflag)==0) return true;
}
while(eflag==STILL_ACTIVE);
return true;
}
return false;
}
void CPatchApplyDlg::OnExit()
{
OnOK();
}
#define MAX_MESSAGES 10
LPVOID CPatchApplyDlg::PatchCallBack( UINT Id, LPVOID Parm)
{
MSG msg;
UINT MsgCount;
LPVOID RetVal;
// CallBackParam = Parm;
// InCallBack=TRUE; // this flag is checked by our message loop
// to insure that it doesn't respond to the
// menu and try to start one patch in the middle
// of another one...
RetVal = "";
// do a few messages while we're here...
for ( MsgCount = MAX_MESSAGES;
MsgCount && PeekMessage( &msg, NULL, 0, 0, PM_REMOVE );
MsgCount--)
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
switch( Id )
{
case 1:
// Warning message header
break;
case 2:
// Warning message text
break;
case 3:
if(!IsEnglish)
{
CString errnum=(char *) Parm;
errnum=errnum.Mid(10,4);
MessageBox(GetTransString(IDS_ENG_SEETXT)+"\n"+errnum+"\n"+GetTransString(IDS_ENG_UCP),GetTransString(IDS_ENG_ERROR),MB_OK|MB_ICONERROR);
ErrorProcessed=true;
PostQuitMessage(0);
// Error message header
}
break;
case 4:
// Error message text
if(IsEnglish)
{
CString err=(char *) Parm;
err+=GetTransString(IDS_ENG_UCP);
MessageBox(err,"RTP Error",MB_OK|MB_ICONERROR);
ErrorProcessed=true;
PostQuitMessage(0);
}
break;
case 9:
// progress message
case 0xa:
// help message
case 0xb:
// patch file comment
case 0xc:
// copyright message
// WriteIt( (char *) Parm ); // for all these callbacks, we just
break; // write the associated text to the
// text pane
case 5:
// % completed
{
int prog=(int) (((long)(0xffff & *((UINT *) Parm))*100L)/0x8000L);
m_PatchProg.SetPos( prog);
}
break;
case 6:
{
int pnum=*((UINT *) Parm);
m_FileProg.SetRange(0,pnum);
}
// Number of patch files
// PATCHGUI ignores this
break;
case 7:
// begin patch
{
CString str=GetTransString(IDS_ENG_PROC);
str+=(char *) Parm ;
m_StatText=str;
UpdateData(FALSE);
m_PatchProg.SetPos(0);
}
break;
case 8:
{
// end patch
m_StatText="";
UpdateData(FALSE);
m_PatchProg.SetPos(0);
m_FileProg.SetPos(m_FileProg.GetPos()+1);
}
break;
case 0xd:
// this one shouldn't happen (only occurs if the command line
// doesn't have a patch file in it, and we insure that it does).
break;
case 0xe:
// this one shouldn't happen either (same reason)
break;
case 0xf:
// Password Dialog
break;
case 0x10:
// Invalid Password Alert
break;
case 0x11:
break;
case 0x12:
break;
case 0x13:
break;
case 0x14:
break;
case 0x16:
break;
case 0x15:
// Idle...
default:
break;
}
// do a few more messages while we're here...
for ( MsgCount = MAX_MESSAGES;
MsgCount && PeekMessage( &msg, NULL, 0, 0, PM_REMOVE );
MsgCount--)
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
return (RetVal);
}
void CPatchApplyDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
if(!Patching) CDialog::OnClose();
}
@@ -0,0 +1,69 @@
// PatchApplyDlg.h : header file
//
#if !defined(AFX_PATCHAPPLYDLG_H__3189E982_D0CF_4C3F_B9A8_4C7EC712B011__INCLUDED_)
#define AFX_PATCHAPPLYDLG_H__3189E982_D0CF_4C3F_B9A8_4C7EC712B011__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CPatchApplyDlg dialog
class CPatchApplyDlg : public CDialog
{
// Construction
public:
LPVOID PatchCallBack( UINT Id, LPVOID Parm);
void FatalError(UINT id);
CString GetTransString(UINT);
void ApplyPatch();
CPatchApplyDlg(CWnd* pParent = NULL); // standard constructor
bool DoesFileExist(LPCSTR fname);
bool DisplayReadMe();
static bool NeedUpgrade();
void RunPatch();
bool InSetup;
bool IsEnglish;
bool Patching;
bool ErrorProcessed;
// Dialog Data
//{{AFX_DATA(CPatchApplyDlg)
enum { IDD = IDD_PATCHAPPLY_DIALOG };
CProgressCtrl m_FileProg;
CButton m_But;
CProgressCtrl m_PatchProg;
CString m_StatText;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPatchApplyDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CPatchApplyDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnExit();
afx_msg void OnClose();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PATCHAPPLYDLG_H__3189E982_D0CF_4C3F_B9A8_4C7EC712B011__INCLUDED_)
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,135 @@
/*-------------------------------------------------------------------------*\
| |
| FILE: PATCHWIN.H |
| |
| |
| RTPatch Patch Apply DLL API Header File |
| ver. 6.00 |
| |
| |
| (C) Copyright Pocket Soft, Inc. 1997-2001. All Rights Reserved. |
| |
\*-------------------------------------------------------------------------*/
#ifndef PATCHWIN_INCLUDED
#define PATCHWIN_INCLUDED
# include <windows.h>
/*-----------------------------------------------------------------------*\
| C++ name mangling prevention -- beginning of block |
\*-----------------------------------------------------------------------*/
# ifdef __cplusplus
extern "C" {
# endif /*__cplusplus */
# ifdef _WIN32
// STRUCTURES
struct FileAttrib {
unsigned Flags;
unsigned Attributes;
FILETIME ChangedTime;
FILETIME CreateTime;
FILETIME AccessTime;
unsigned long Size;
};
struct PatchAsyncParm {
long Position;
long Count;
void * Buffer;
};
struct PatchUserFileParm {
wchar_t * OldName;
wchar_t * NewName;
unsigned SelfReg;
unsigned Shared;
unsigned Backup;
};
// CONSTANTS
# define PATCH_SUCCESS 0
# define PATCH_BUSY -1
// Attrib Flags
# define ATTRIB_ATTRIBUTE 0x1
# define ATTRIB_CHANGED_DATE 0x2
# define ATTRIB_CREATE_DATE 0x4
# define ATTRIB_ACCESS_DATE 0x8
# define ATTRIB_SIZE 0x10
int /* ErrCode */
__declspec( dllimport ) CALLBACK
RTPatchSetOpen( int Handle, HANDLE (CALLBACK *FileOpenPtr)( wchar_t *, int ) );
int /* ErrCode */
__declspec( dllimport ) CALLBACK
RTPatchSetDirWalk( int Handle,
int (CALLBACK *DirWalkPtr)( wchar_t *, int, WIN32_FIND_DATAW * ) );
int /* ErrCode */
__declspec( dllimport ) CALLBACK
RTPatchSetCreate( int Handle,
HANDLE (CALLBACK *FileCreatePtr)(wchar_t * ) );
int /* ErrCode */
__declspec( dllimport ) CALLBACK
RTPatchSetDelete( int Handle,
int (CALLBACK *FileDeletePtr)(wchar_t * ) );
int /* ErrCode */
__declspec( dllimport ) CALLBACK
RTPatchSetRename( int Handle,
int (CALLBACK *FileRenamePtr)(wchar_t *, wchar_t * ) );
int /* ErrCode */
__declspec( dllimport ) CALLBACK
RTPatchSetAttribSet( int Handle,
int (CALLBACK *FileAttribSetPtr)(wchar_t *, struct FileAttrib *) );
int /* ErrCode */
__declspec( dllimport ) CALLBACK
RTPatchSetAttribGet( int Handle,
int (CALLBACK *FileAttribGetPtr)(wchar_t *, struct FileAttrib *) );
UINT
__declspec( dllimport )
CALLBACK RTPatchApply32( LPSTR CmdLine,
LPVOID (CALLBACK * CallBackFn)(UINT, LPVOID),
BOOL WaitFlag);
UINT
__declspec( dllimport )
__cdecl RTPatchApply32NoCall( LPSTR CmdLine );
# else
struct PatchAsyncParm {
long Position;
long Count;
void * Buffer;
}
struct PatchUserFileParm {
wchar_t * OldName;
wchar_t * NewName;
unsigned long SelfReg;
unsigned long Shared;
unsigned long Backup;
}
UINT CALLBACK RTPatchApply( LPSTR CmdLine,
LPVOID (CALLBACK * CallBackFn)(UINT, LPVOID),
BOOL WaitFlag);
UINT _far _cdecl RTPatchApplyNoCall( LPSTR CmdLine );
# endif
/*-----------------------------------------------------------------------*\
C++ name mangling prevention -- end of block
\*-----------------------------------------------------------------------*/
# ifdef __cplusplus
};
# endif
# endif /* PATCHWIN_INCLUDED */
@@ -0,0 +1,88 @@
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : PatchApply
========================================================================
AppWizard has created this PatchApply application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your PatchApply application.
PatchApply.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
PatchApply.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CPatchApplyApp application class.
PatchApply.cpp
This is the main application source file that contains the application
class CPatchApplyApp.
PatchApply.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Visual C++.
PatchApply.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
res\PatchApply.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file PatchApply.rc.
res\PatchApply.rc2
This file contains resources that are not edited by Microsoft
Visual C++. You should place all resources not editable by
the resource editor in this file.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one dialog class:
PatchApplyDlg.h, PatchApplyDlg.cpp - the dialog
These files contain your CPatchApplyDlg class. This class defines
the behavior of your application's main dialog. The dialog's
template is in PatchApply.rc, which can be edited in Microsoft
Visual C++.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named PatchApply.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Visual C++ reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC42XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC42DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// PatchApply.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
@@ -0,0 +1,27 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__509F3CF4_AC67_4E03_815F_7CC533F6D246__INCLUDED_)
#define AFX_STDAFX_H__509F3CF4_AC67_4E03_815F_7CC533F6D246__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__509F3CF4_AC67_4E03_815F_7CC533F6D246__INCLUDED_)
Binary file not shown.
@@ -0,0 +1,13 @@
//
// PATCHAPPLY.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,150 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by PatchApply.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_PATCHAPPLY_DIALOG 102
#define IDS_ENG_TABLESTART 102
#define IDS_ENG_PTTIT 103
#define IDS_ENG_PTLSF 104
#define IDS_ENG_ERROR 105
#define IDS_ENG_REGERROR 106
#define IDS_ENG_UCP 107
#define IDS_ENG_UDL 108
#define IDS_ENG_PGF 109
#define IDS_ENG_OPCOM 110
#define IDS_ENG_PH 111
#define IDS_ENG_WINTITLE 111
#define IDS_ENG_PH2 112
#define IDS_ENG_EXIT 112
#define IDS_ENG_PH3 113
#define IDS_ENG_PATCHERROR 113
#define IDS_ENG_PH4 114
#define IDS_ENG_PROC 114
#define IDS_ENG_PH5 115
#define IDS_ENG_SEETXT 115
#define IDS_ENG_PH6 116
#define IDS_ENG_PH7 117
#define IDS_ENG_PH8 118
#define IDS_ENG_PH9 119
#define IDS_ENG_PTMSG 120
#define IDS_FRN_TABLESTART 121
#define IDS_READMEFNAME 121
#define IDS_FRN_PTTIT2 122
#define IDS_LANGMISSING 122
#define IDS_FRN_PTLSF2 123
#define IDS_FRN_ERROR2 124
#define IDS_FRN_REGERROR2 125
#define IDS_FRN_UCP2 126
#define IDS_FRN_UDL2 127
#define IDR_MAINFRAME 128
#define IDS_FRN_PGF2 128
#define IDS_FRN_OPCOM2 129
#define IDS_FRN_PH10 130
#define IDS_FRN_PH11 131
#define IDS_FRN_PH12 132
#define IDS_FRN_PH13 133
#define IDS_FRN_PH14 134
#define IDS_FRN_PH15 135
#define IDS_FRN_PH16 136
#define IDS_FRN_PH17 137
#define IDS_FRN_PH18 138
#define IDS_FRN_PTMSG2 139
#define IDS_GER_TABLESTART3 140
#define IDS_GER_TABLESTART 140
#define IDS_GER_PTTIT3 141
#define IDS_GER_PTLSF3 142
#define IDS_GER_ERROR3 143
#define IDS_GER_REGERROR3 144
#define IDS_GER_UCP3 145
#define IDS_GER_UDL3 146
#define IDS_GER_PGF3 147
#define IDS_GER_OPCOM3 148
#define IDS_GER_PH19 149
#define IDS_GER_PH20 150
#define IDS_GER_PH21 151
#define IDS_GER_PH22 152
#define IDS_GER_PH23 153
#define IDS_GER_PH24 154
#define IDS_GER_PH25 155
#define IDS_GER_PH26 156
#define IDS_GER_PH27 157
#define IDS_GER_PTMSG3 158
#define IDS_KOR_TABLESTART4 159
#define IDS_KOR_TABLESTART 159
#define IDS_KOR_PTTIT4 160
#define IDS_KOR_PTLSF4 161
#define IDS_KOR_ERROR4 162
#define IDS_KOR_REGERROR4 163
#define IDS_KOR_UCP4 164
#define IDS_KOR_UDL4 165
#define IDS_KOR_PGF4 166
#define IDS_KOR_OPCOM4 167
#define IDS_KOR_PH28 168
#define IDS_KOR_PH29 169
#define IDS_KOR_PH30 170
#define IDS_KOR_PH31 171
#define IDS_KOR_PH32 172
#define IDS_KOR_PH33 173
#define IDS_KOR_PH34 174
#define IDS_KOR_PH35 175
#define IDS_KOR_PH36 176
#define IDS_KOR_PTMSG4 177
#define IDS_SPN_TABLESTART5 178
#define IDS_SPN_TABLESTART 178
#define IDS_SPN_PTTIT5 179
#define IDS_SPN_PTLSF5 180
#define IDS_SPN_ERROR5 181
#define IDS_SPN_REGERROR5 182
#define IDS_SPN_UCP5 183
#define IDS_SPN_UDL5 184
#define IDS_SPN_PGF5 185
#define IDS_SPN_OPCOM5 186
#define IDS_SPN_PH37 187
#define IDS_SPN_PH38 188
#define IDS_SPN_PH39 189
#define IDS_SPN_PH40 190
#define IDS_SPN_PH41 191
#define IDS_SPN_PH42 192
#define IDS_SPN_PH43 193
#define IDS_SPN_PH44 194
#define IDS_SPN_PH45 195
#define IDS_SPN_PTMSG5 196
#define IDS_TAI_TABLESTART6 197
#define IDS_TAI_TABLESTART 197
#define IDS_TAI_PTTIT6 198
#define IDS_TAI_PTLSF6 199
#define IDS_TAI_ERROR6 200
#define IDS_TAI_REGERROR6 201
#define IDS_TAI_UCP6 202
#define IDS_TAI_UDL6 203
#define IDS_TAI_PGF6 204
#define IDS_TAI_OPCOM6 205
#define IDS_TAI_PH46 206
#define IDS_TAI_WINTITLE 206
#define IDS_TAI_PH47 207
#define IDS_TAI_PH48 208
#define IDS_TAI_PH49 209
#define IDS_TAI_PH50 210
#define IDS_TAI_PH51 211
#define IDS_TAI_PH52 212
#define IDS_TAI_PH53 213
#define IDS_TAI_PH54 214
#define IDS_TAI_PTMSG6 215
#define IDC_PATCHPROG 1000
#define IDC_STATTEXT 1001
#define IDC_EXIT 1003
#define IDC_FILEPROG 1004
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
@@ -0,0 +1,74 @@
// PatchIT.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "PatchIT.h"
#include "PatchITDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPatchITApp
BEGIN_MESSAGE_MAP(CPatchITApp, CWinApp)
//{{AFX_MSG_MAP(CPatchITApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPatchITApp construction
CPatchITApp::CPatchITApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CPatchITApp object
CPatchITApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CPatchITApp initialization
BOOL CPatchITApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CPatchITDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
+202
View File
@@ -0,0 +1,202 @@
# Microsoft Developer Studio Project File - Name="PatchIT" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=PatchIT - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "PatchIT.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "PatchIT.mak" CFG="PatchIT - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "PatchIT - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "PatchIT - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "PatchIT - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../rel.bin"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "PatchIT - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../../dbg.bin"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "PatchIT - Win32 Release"
# Name "PatchIT - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Delete.cpp
# End Source File
# Begin Source File
SOURCE=.\FilePro.cpp
# End Source File
# Begin Source File
SOURCE=.\Insert.cpp
# End Source File
# Begin Source File
SOURCE=.\PatchIT.cpp
# End Source File
# Begin Source File
SOURCE=.\PatchIT.rc
# End Source File
# Begin Source File
SOURCE=.\PatchITDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\PatchOperation.cpp
# End Source File
# Begin Source File
SOURCE=.\ProgDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\Span.cpp
# End Source File
# Begin Source File
SOURCE=.\SpanFile.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Delete.h
# End Source File
# Begin Source File
SOURCE=.\FilePro.h
# End Source File
# Begin Source File
SOURCE=.\Insert.h
# End Source File
# Begin Source File
SOURCE=.\PatchIT.h
# End Source File
# Begin Source File
SOURCE=.\PatchITDlg.h
# End Source File
# Begin Source File
SOURCE=.\PatchOperation.h
# End Source File
# Begin Source File
SOURCE=.\ProgDlg.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\Span.h
# End Source File
# Begin Source File
SOURCE=.\SpanFile.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\PatchIT.ico
# End Source File
# Begin Source File
SOURCE=.\res\PatchIT.rc2
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project
@@ -0,0 +1,41 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "PatchApply"=.\PatchApply\PatchApply.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "PatchIT"=.\PatchIT.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
+49
View File
@@ -0,0 +1,49 @@
// PatchIT.h : main header file for the PATCHIT application
//
#if !defined(AFX_PATCHIT_H__A671C735_F8F6_4068_9318_28084861DCC1__INCLUDED_)
#define AFX_PATCHIT_H__A671C735_F8F6_4068_9318_28084861DCC1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CPatchITApp:
// See PatchIT.cpp for the implementation of this class
//
class CPatchITApp : public CWinApp
{
public:
CPatchITApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPatchITApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CPatchITApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PATCHIT_H__A671C735_F8F6_4068_9318_28084861DCC1__INCLUDED_)
+223
View File
@@ -0,0 +1,223 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
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_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\PatchIT.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\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 DISCARDABLE "res\\PatchIT.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About PatchIT"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "PatchIT Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX
LTEXT "Copyright (C) 2001",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
END
IDD_PATCHIT_DIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "PatchIT"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,260,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,260,23,50,14
END
CG_IDD_PROGRESS DIALOG DISCARDABLE 0, 0, 186, 63
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Cancel",IDCANCEL,67,42,50,14
CONTROL "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32",
WS_BORDER,15,18,154,13
LTEXT " 0 %",CG_IDC_PROGDLG_PERCENT,83,7,18,8
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// 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 "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "PatchIT MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "PatchIT\0"
VALUE "LegalCopyright", "Copyright (C) 2001\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "PatchIT.EXE\0"
VALUE "ProductName", "PatchIT Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_PATCHIT_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 313
TOPMARGIN, 7
BOTTOMMARGIN, 193
END
CG_IDD_PROGRESS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 56
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About PatchIT..."
CG_IDS_PROGRESS_CAPTION "Analyzing..."
END
#endif // English (U.S.) 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_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\PatchIT.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,310 @@
// PatchITDlg.cpp : implementation file
//
#include "stdafx.h"
#include "PatchIT.h"
#include "PatchITDlg.h"
#include "FilePro.h"
#include "SpanFile.h"
#include "Insert.h"
#include "Delete.h"
#include "ProgDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CPatchOperation OpList;
CPatchOperation *LastNode=&OpList;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPatchITDlg dialog
CPatchITDlg::CPatchITDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPatchITDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPatchITDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CPatchITDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPatchITDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPatchITDlg, CDialog)
//{{AFX_MSG_MAP(CPatchITDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPatchITDlg message handlers
BOOL CPatchITDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
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);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
Test();
return TRUE; // return TRUE unless you set the focus to a control
}
void CPatchITDlg::Test()
{
CProgressDlg pdlg;
pdlg.Create(this);
pdlg.ShowWindow(SW_SHOW);
pdlg.SetRange(0,100);
DWORD starttime,endtime;
starttime=GetTickCount();
CSpanFile file1,file2;
//file1.Load("c:\\Test1.txt");
//file2.Load("c:\\Test2.txt");
//file1.MapFiles(file2,1);
file1.Load("c:\\Temp\\DFLWNew.exe");
file2.Load("c:\\Temp\\DFLWOrg.exe");
file1.MapFiles(file2,1024);
file1.BuildOps(file2,&OpList);
CString str,report;
report=file1.SpanReport(file2);
/*
CFilePro file1,file2;
file1.Open("c:\\Temp\\propsOld.mw4",CFile::modeRead);
file2.Open("c:\\Temp\\propsNew.mw4",CFile::modeRead);
//file1.Open("c:\\Temp\\DFLWOrg.exe",CFile::modeRead);
//file2.Open("c:\\Temp\\DFLWNew.exe",CFile::modeRead);
//file1.Open("c:\\Test1.txt",CFile::modeRead);
//file2.Open("c:\\Test2.txt",CFile::modeRead);
DWORD diffat;
DWORD dlgmax=file2.GetLength();
bool insres,delres;
DWORD inspos,delpos;
DWORD insdist,deldist;
DWORD f2pos;
DWORD loc,size;
do
{
diffat=file1.DifferAt(file2,&f2pos);
insres=file2.SyncedAt(file1,&inspos,64);
delres=file1.SyncedAt(file2,&delpos,64);
insdist=inspos-file2.GetPosition();
deldist=delpos-file1.GetPosition();
pdlg.SetPos((file2.GetPosition()*100)/dlgmax);
if((insres && delres && insdist<=deldist) || (insres&&(!delres)) )
{
//INsertion
LastNode->Next=new CInsert(diffat,insdist);
LastNode=LastNode->Next;
file2.Seek(insdist,CFile::current);
}
else if((insres && delres && insdist>=deldist) || ((!insres)&&delres) )
{ //Deletion
LastNode->Next=new CDelete(diffat,deldist);
LastNode=LastNode->Next;
file1.Seek(deldist,CFile::current);
}
}
while(insres || delres);
//These must have their order retained
//If These opertation are huge then this alg doesn't work.
if((file1.GetLength()-file1.GetPosition())>0)
{ // Extra Bytes at End Delete them
LastNode->Next=new CDelete(file1.GetPosition(),file1.GetLength()-file1.GetPosition());
LastNode=LastNode->Next;
loc=file1.GetPosition();
size=file1.GetLength()-file1.GetPosition();
file1.Seek(deldist,CFile::current);
}
if((file2.GetLength()-file2.GetPosition())>0)
{ // Extra Bytes at End Insert them
LastNode->Next=new CInsert(file1.GetPosition(),file2.GetLength()-file2.GetPosition());
LastNode=LastNode->Next;
file1.Seek(deldist,CFile::current);
}
*/
endtime=GetTickCount();
report="";
str.Format("Operations: %i\n",OpList.OpCount());
report+=str;
str.Format("Deleted Bytes: %i Bytes\n",OpList.DeletedBytes());
report+=str;
str.Format("Inserted Bytes: %i Bytes\n",OpList.InsertedBytes());
report+=str;
DWORD et,h,m,s;
et=(endtime-starttime)/1000;
s=et%60;
et-=s;
et/=60;
m=et%(60);
et-=m;
et/=60;
h=et;
str.Format("Time To Create %02i:%02i:%02i\n\n",h,m,s);
report+=str;
report+="Operations:\n";
LastNode=OpList.Next;
while(LastNode)
{
report+=LastNode->GetOpText();
LastNode=LastNode->Next;
}
/*
FILE *fl;
fl=fopen("c:\\Temp\\PatchRepB.txt","w");
fprintf(fl,"%s",report);
fclose(fl);
exit(1);
*/
}
void CPatchITDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CPatchITDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
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;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CPatchITDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
@@ -0,0 +1,50 @@
// PatchITDlg.h : header file
//
#if !defined(AFX_PATCHITDLG_H__C50A089B_8BC8_4610_8142_C1B4BCAC35EF__INCLUDED_)
#define AFX_PATCHITDLG_H__C50A089B_8BC8_4610_8142_C1B4BCAC35EF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CPatchITDlg dialog
class CPatchITDlg : public CDialog
{
// Construction
public:
CPatchITDlg(CWnd* pParent = NULL); // standard constructor
void Test();
// Dialog Data
//{{AFX_DATA(CPatchITDlg)
enum { IDD = IDD_PATCHIT_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPatchITDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CPatchITDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PATCHITDLG_H__C50A089B_8BC8_4610_8142_C1B4BCAC35EF__INCLUDED_)
@@ -0,0 +1,54 @@
// PatchOperation.cpp: implementation of the CPatchOperation class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PatchIT.h"
#include "PatchOperation.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CPatchOperation::CPatchOperation()
{
Next=NULL;
}
DWORD CPatchOperation::InsertedBytes()
{
int count=0;
CPatchOperation *np;
np=Next;
while(np) {count+=np->InsertedBytes(); np=np->Next;}
return count;
}
DWORD CPatchOperation::DeletedBytes()
{
int count=0;
CPatchOperation *np;
np=Next;
while(np) {count+=np->DeletedBytes(); np=np->Next;}
return count;
}
DWORD CPatchOperation::OpCount()
{
int count=0;
CPatchOperation *np;
np=Next;
while(np) {count++; np=np->Next;}
return count;
}
CPatchOperation::~CPatchOperation()
{
}
@@ -0,0 +1,27 @@
// PatchOperation.h: interface for the CPatchOperation class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_PATCHOPERATION_H__98354F37_9816_47D3_B577_AD4F2CD8E807__INCLUDED_)
#define AFX_PATCHOPERATION_H__98354F37_9816_47D3_B577_AD4F2CD8E807__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CPatchOperation
{
protected:
public:
CPatchOperation *Next;
DWORD Location,Size;
CPatchOperation();
virtual DWORD InsertedBytes();
virtual DWORD DeletedBytes();
DWORD OpCount();
virtual CString GetOpText() {return "";}
virtual ~CPatchOperation();
};
#endif // !defined(AFX_PATCHOPERATION_H__98354F37_9816_47D3_B577_AD4F2CD8E807__INCLUDED_)
+210
View File
@@ -0,0 +1,210 @@
// ProgDlg.cpp : implementation file
// CG: This file was added by the Progress Dialog component
#include "stdafx.h"
#include "resource.h"
#include "ProgDlg.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CProgressDlg dialog
CProgressDlg::CProgressDlg(UINT nCaptionID)
{
m_nCaptionID = CG_IDS_PROGRESS_CAPTION;
if (nCaptionID != 0)
m_nCaptionID = nCaptionID;
m_bCancel=FALSE;
m_nLower=0;
m_nUpper=100;
m_nStep=10;
//{{AFX_DATA_INIT(CProgressDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_bParentDisabled = FALSE;
}
CProgressDlg::~CProgressDlg()
{
if(m_hWnd!=NULL)
DestroyWindow();
}
BOOL CProgressDlg::DestroyWindow()
{
ReEnableParent();
return CDialog::DestroyWindow();
}
void CProgressDlg::ReEnableParent()
{
if(m_bParentDisabled && (m_pParentWnd!=NULL))
m_pParentWnd->EnableWindow(TRUE);
m_bParentDisabled=FALSE;
}
BOOL CProgressDlg::Create(CWnd *pParent)
{
// Get the true parent of the dialog
m_pParentWnd = CWnd::GetSafeOwner(pParent);
// m_bParentDisabled is used to re-enable the parent window
// when the dialog is destroyed. So we don't want to set
// it to TRUE unless the parent was already enabled.
if((m_pParentWnd!=NULL) && m_pParentWnd->IsWindowEnabled())
{
m_pParentWnd->EnableWindow(FALSE);
m_bParentDisabled = TRUE;
}
if(!CDialog::Create(CProgressDlg::IDD,pParent))
{
ReEnableParent();
return FALSE;
}
return TRUE;
}
void CProgressDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProgressDlg)
DDX_Control(pDX, CG_IDC_PROGDLG_PROGRESS, m_Progress);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CProgressDlg, CDialog)
//{{AFX_MSG_MAP(CProgressDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CProgressDlg::OnCancel()
{
m_bCancel=TRUE;
}
void CProgressDlg::SetRange(int nLower,int nUpper)
{
m_nLower = nLower;
m_nUpper = nUpper;
m_Progress.SetRange(nLower,nUpper);
}
int CProgressDlg::SetPos(int nPos)
{
PumpMessages();
int iResult = m_Progress.SetPos(nPos);
UpdatePercent(nPos);
return iResult;
}
int CProgressDlg::SetStep(int nStep)
{
m_nStep = nStep; // Store for later use in calculating percentage
return m_Progress.SetStep(nStep);
}
int CProgressDlg::OffsetPos(int nPos)
{
PumpMessages();
int iResult = m_Progress.OffsetPos(nPos);
UpdatePercent(iResult+nPos);
return iResult;
}
int CProgressDlg::StepIt()
{
PumpMessages();
int iResult = m_Progress.StepIt();
UpdatePercent(iResult+m_nStep);
return iResult;
}
void CProgressDlg::PumpMessages()
{
// Must call Create() before using the dialog
ASSERT(m_hWnd!=NULL);
MSG msg;
// Handle dialog messages
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if(!IsDialogMessage(&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
BOOL CProgressDlg::CheckCancelButton()
{
// Process all pending messages
PumpMessages();
// Reset m_bCancel to FALSE so that
// CheckCancelButton returns FALSE until the user
// clicks Cancel again. This will allow you to call
// CheckCancelButton and still continue the operation.
// If m_bCancel stayed TRUE, then the next call to
// CheckCancelButton would always return TRUE
BOOL bResult = m_bCancel;
m_bCancel = FALSE;
return bResult;
}
void CProgressDlg::UpdatePercent(int nNewPos)
{
CWnd *pWndPercent = GetDlgItem(CG_IDC_PROGDLG_PERCENT);
int nPercent;
int nDivisor = m_nUpper - m_nLower;
ASSERT(nDivisor>0); // m_nLower should be smaller than m_nUpper
int nDividend = (nNewPos - m_nLower);
ASSERT(nDividend>=0); // Current position should be greater than m_nLower
nPercent = nDividend * 100 / nDivisor;
// Since the Progress Control wraps, we will wrap the percentage
// along with it. However, don't reset 100% back to 0%
if(nPercent!=100)
nPercent %= 100;
// Display the percentage
CString strBuf;
strBuf.Format(_T("%d%c"),nPercent,_T('%'));
CString strCur; // get current percentage
pWndPercent->GetWindowText(strCur);
if (strCur != strBuf)
pWndPercent->SetWindowText(strBuf);
}
/////////////////////////////////////////////////////////////////////////////
// CProgressDlg message handlers
BOOL CProgressDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_Progress.SetRange(m_nLower,m_nUpper);
m_Progress.SetStep(m_nStep);
m_Progress.SetPos(m_nLower);
CString strCaption;
VERIFY(strCaption.LoadString(m_nCaptionID));
SetWindowText(strCaption);
return TRUE;
}
+67
View File
@@ -0,0 +1,67 @@
// ProgDlg.h : header file
// CG: This file was added by the Progress Dialog component
/////////////////////////////////////////////////////////////////////////////
// CProgressDlg dialog
#ifndef __PROGDLG_H__
#define __PROGDLG_H__
class CProgressDlg : public CDialog
{
// Construction / Destruction
public:
CProgressDlg(UINT nCaptionID = 0); // standard constructor
~CProgressDlg();
BOOL Create(CWnd *pParent=NULL);
// Checking for Cancel button
BOOL CheckCancelButton();
// Progress Dialog manipulation
void SetRange(int nLower,int nUpper);
int SetStep(int nStep);
int SetPos(int nPos);
int OffsetPos(int nPos);
int StepIt();
// Dialog Data
//{{AFX_DATA(CProgressDlg)
enum { IDD = CG_IDD_PROGRESS };
CProgressCtrl m_Progress;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CProgressDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
UINT m_nCaptionID;
int m_nLower;
int m_nUpper;
int m_nStep;
BOOL m_bCancel;
BOOL m_bParentDisabled;
void ReEnableParent();
virtual void OnCancel();
virtual void OnOK() {};
void UpdatePercent(int nCurrent);
void PumpMessages();
// Generated message map functions
//{{AFX_MSG(CProgressDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // __PROGDLG_H__
@@ -0,0 +1,88 @@
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : PatchIT
========================================================================
AppWizard has created this PatchIT application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your PatchIT application.
PatchIT.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
PatchIT.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CPatchITApp application class.
PatchIT.cpp
This is the main application source file that contains the application
class CPatchITApp.
PatchIT.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Visual C++.
PatchIT.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
res\PatchIT.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file PatchIT.rc.
res\PatchIT.rc2
This file contains resources that are not edited by Microsoft
Visual C++. You should place all resources not editable by
the resource editor in this file.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one dialog class:
PatchITDlg.h, PatchITDlg.cpp - the dialog
These files contain your CPatchITDlg class. This class defines
the behavior of your application's main dialog. The dialog's
template is in PatchIT.rc, which can be edited in Microsoft
Visual C++.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named PatchIT.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Visual C++ reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC42XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC42DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////
+231
View File
@@ -0,0 +1,231 @@
// Span.cpp: implementation of the Span class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PatchIT.h"
#include "Span.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
void Span::DeleteChildren()
{
if(Next) Next->DeleteChildren();
delete Next;
Next=NULL;
}
void Span::InsertNodeAfter(Span *span)
{
if(Next)
{
Next->Prev=span;
}
span->Next=Next;
span->Prev=this;
Next=span;
}
int Span::FindLargestSpan(Span *comspan,DWORD *pos1,DWORD *pos2,DWORD minsize)
{
DWORD maxspan=minsize;
BYTE *comsbuf=comspan->Buffer;
DWORD pos,cspos,dpos;
for(pos=0;pos<Size && (pos+maxspan)<=Size;pos++)
{
for(cspos=0;cspos<comspan->Size && (cspos+maxspan)<=comspan->Size;cspos++)
{
if(Buffer[pos]==comsbuf[cspos] &&
Buffer[pos+(maxspan-1)]==comsbuf[cspos+(maxspan-1)]
)
{
//Check First and Last for Early out
for(dpos=1;(cspos+dpos)<comspan->Size &&
(pos+dpos)<Size &&
Buffer[pos+dpos]==comsbuf[cspos+dpos];dpos++);
if(dpos>maxspan)
{
maxspan=dpos;
*pos1=pos;
*pos2=cspos;
}
}
}
}
return maxspan;
} //End of Find Span
int Span::MapLargestSpan(Span *comspan,DWORD minsize)
{
DWORD spansize;
DWORD pos,cspos;
spansize=FindLargestSpan(comspan,&pos,&cspos,minsize);
if(spansize>minsize)
{ // Missed creeping up Take Last One
Span *new_span1,*new_span2;
new_span1=AddSpanAt(Buffer+pos,spansize);
new_span2=comspan->AddSpanAt(comspan->Buffer+cspos,spansize);
new_span1->MappedTo=new_span2;
new_span2->MappedTo=new_span1;
if(new_span1->Prev!=NULL && new_span1->Prev->MappedTo==NULL &&
new_span2->Prev!=NULL && new_span2->Prev->MappedTo==NULL) //Map the left
new_span1->Prev->MapLargestSpan(new_span2->Prev,minsize);
if(new_span1->Next!=NULL && new_span1->Next->MappedTo==NULL &&
new_span2->Next!=NULL && new_span2->Next->MappedTo==NULL) //Map the right
new_span1->Next->MapLargestSpan(new_span2->Next,minsize);
return spansize;
}
return spansize;
} //End of Find Span
Span *Span::AddSpanAt(BYTE * loc,DWORD size)
{
/* // This will put it in the right place
if(loc<Buffer)
{ // Location is in a forward Box
ASSERT(Next);
Next->AddSpanAt(loc,size,map);
return;
}
*/
ASSERT(loc>=Buffer && (loc+size)<=(Buffer+Size)); //Must Be a Sub Span
ASSERT(MappedTo==NULL); //Cannot Split a Mapped Span
DWORD endsize;
Span *new_span;
if((loc-Buffer)==0) //Don't Need a new one Adjust them
{
endsize=Size-size;
Size=size;
new_span=this;
}
else
{
new_span= new Span(loc,size); // Make our Span
InsertNodeAfter(new_span);
endsize=Size-((loc-Buffer)+size);
Size=(loc-Buffer);
}
ASSERT(endsize>=0);
if(endsize>0)
{
new_span->InsertNodeAfter(new Span(loc+size,endsize)); // At end span if needed;
}
return new_span;
}
void Span::SpanInfo(CString &fstr,BYTE *base1,BYTE *base2)
{
CString str;
str.Format("Location = %i Size = %i ",Buffer-base1,Size);
if(MappedTo)
{
CString str2;
str2.Format(" -> Location = %i",MappedTo->Buffer-base2);
str+=str2;
}
str+="\n";
fstr+=str;
if(Next) Next->SpanInfo(fstr,base1,base2);
}
void Span::BuildOps(Span *sspan,CPatchOperation *OpList,const BYTE *base1,const BYTE *base2)
{
Span *cur_node1,*cur_node2;
DWORD lastloc=0;
cur_node1=this;
cur_node2=sspan;
while(cur_node1 && cur_node2)
{
if(cur_node2->MappedTo==NULL)
{
OpList->Next=new CInsert(cur_node1->Buffer-base1,cur_node2->Size,cur_node2->Buffer-base2);
OpList=OpList->Next;
cur_node2=cur_node2->Next;
}
if(cur_node1->MappedTo==NULL)
{
OpList->Next=new CDelete(cur_node1->Buffer-base1,cur_node1->Size);
OpList=OpList->Next;
lastloc=cur_node1->Buffer-base1+cur_node1->Size;
cur_node1=cur_node1->Next;
}
ASSERT((!cur_node1 || cur_node1->MappedTo!=NULL));
ASSERT((!cur_node2 || cur_node2->MappedTo!=NULL));
if(cur_node1 || cur_node2)
{
ASSERT(cur_node2 && cur_node1);
lastloc=cur_node1->Buffer-base1+cur_node1->Size;
cur_node1=cur_node1->Next;
cur_node2=cur_node2->Next;
}
}
if(cur_node1)
{
ASSERT(cur_node1->MappedTo==NULL);
OpList->Next=new CDelete(cur_node1->Buffer-base1,cur_node1->Size);
OpList=OpList->Next;
lastloc=cur_node1->Buffer-base1+cur_node1->Size;
cur_node1=cur_node1->Next;
}
if(cur_node2)
{
ASSERT(cur_node2->MappedTo==NULL);
OpList->Next=new CInsert(lastloc,cur_node2->Size,cur_node2->Buffer-base2);
OpList=OpList->Next;
cur_node2=cur_node2->Next;
}
ASSERT(!cur_node1 && !cur_node2);
}
Span::~Span()
{
DeleteChildren();
}
+35
View File
@@ -0,0 +1,35 @@
// Span.h: interface for the Span class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SPAN_H__2D007EAB_A54F_4563_8763_33EBBC0DF18E__INCLUDED_)
#define AFX_SPAN_H__2D007EAB_A54F_4563_8763_33EBBC0DF18E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Insert.h"
#include "Delete.h"
class Span
{
protected:
DWORD Size;
BYTE *Buffer;
Span *Next,*Prev,*MappedTo;
void InsertNodeAfter(Span *span);
int FindLargestSpan(Span *comspan,DWORD *pos1,DWORD *pos2,DWORD minsize);
public:
void DeleteChildren();
Span(BYTE * loc,DWORD size,Span *mapto=NULL) {Buffer=loc; Size=size; MappedTo=Next=Prev=NULL; MappedTo=mapto;}
void SpanInfo(CString &fstr,BYTE *base1,BYTE *base2);
Span *AddSpanAt(BYTE *loc,DWORD size);
void BuildOps(Span *sspan,CPatchOperation *OpList,const BYTE *base1,const BYTE *base2);
Span *GetNextUnMapped();
int MapLargestSpan(Span *comspan,DWORD minsize=64);
virtual ~Span();
};
#endif // !defined(AFX_SPAN_H__2D007EAB_A54F_4563_8763_33EBBC0DF18E__INCLUDED_)
@@ -0,0 +1,62 @@
// SpanFile.cpp: implementation of the CSpanFile class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PatchIT.h"
#include "SpanFile.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CSpanFile::CSpanFile()
{
Buffer=NULL;
FileSpan=NULL;
}
void CSpanFile::Load(CString fname)
{
File.Open(fname,CFile::modeRead);
if(Buffer) delete Buffer;
if(FileSpan) delete FileSpan;
Size=File.GetLength();
Buffer=new BYTE[Size];
File.Read(Buffer,Size);
FileSpan=new Span(Buffer,Size);
File.Close();
}
CString CSpanFile::SpanReport(CSpanFile &file)
{
CString str;
str="";
FileSpan->SpanInfo(str,Buffer,file.Buffer);
return str;
}
void CSpanFile::MapFiles(CSpanFile &file,DWORD MinSize)
{
FileSpan->MapLargestSpan(file.FileSpan,1);
int blocksize=MinSize;
}
void CSpanFile::BuildOps(CSpanFile &file,CPatchOperation *oplist)
{
FileSpan->BuildOps(file.FileSpan,oplist,Buffer,file.Buffer);
}
CSpanFile::~CSpanFile()
{
}
@@ -0,0 +1,30 @@
// SpanFile.h: interface for the CSpanFile class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SPANFILE_H__19DC7856_E51B_45E0_B60A_F4C90CA5E331__INCLUDED_)
#define AFX_SPANFILE_H__19DC7856_E51B_45E0_B60A_F4C90CA5E331__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Span.h"
class CSpanFile
{
protected:
CFile File;
DWORD Size;
BYTE *Buffer;
Span *FileSpan;
public:
CSpanFile();
void BuildOps(CSpanFile &file,CPatchOperation *oplist);
void Load(CString fname);
CString SpanReport(CSpanFile &file);
void MapFiles(CSpanFile &file,DWORD MinSize=64);
virtual ~CSpanFile();
};
#endif // !defined(AFX_SPANFILE_H__19DC7856_E51B_45E0_B60A_F4C90CA5E331__INCLUDED_)
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// PatchIT.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
+27
View File
@@ -0,0 +1,27 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__6220446F_0A6F_4BFE_9FDE_78EC7C27F040__INCLUDED_)
#define AFX_STDAFX_H__6220446F_0A6F_4BFE_9FDE_78EC7C27F040__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__6220446F_0A6F_4BFE_9FDE_78EC7C27F040__INCLUDED_)
Binary file not shown.
@@ -0,0 +1,13 @@
//
// PATCHIT.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,24 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by PatchIT.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_PATCHIT_DIALOG 102
#define CG_IDD_PROGRESS 103
#define CG_IDS_PROGRESS_CAPTION 104
#define IDR_MAINFRAME 128
#define CG_IDC_PROGDLG_PROGRESS 1003
#define CG_IDC_PROGDLG_PERCENT 1004
// 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 1000
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif