Cracking TimeLock32 v2.0 without patching
("Universal keygenerator for a commercial protection")
C++ source code for a keygenerator
by Riz la+
(07 July 1997, slightly edited by Fravia)
Courtesy of Fravia's page of reverse engineering
First enclosed file (Read1st.txt) cut and paste!
*************************Begin Read1st.txt********************************
TimeLock32 v2.0 Retrieval utility (for Windows 95)
First of all:
This prog is for educational purposes only.
Use this prog or any code of it at your very own risk !
This prog was written with Borland C++ v5.01 using the Object Windows Library (!).
Sorry, only the essential files included to keep the mail message as small as possible:
tl322ret.cpp
tl322ret.rc
To compile:
1) Enter the Borland C++ IDE
2) Make a new project in the directory where the [tl322ret.*] files reside
and name it [tl322ret]. Choose Win32/GUI/OWL as attributes.
3) Remove the [tl322ret.def] file from the project to use the standard def-file.
4) Adjust the Compiler/Linker options as you like.
5) Compile.
***************************End Read1st.txt********************************
Second file (TL322ret.rc) cut and paste!
***************************Begin TL322ret.rc********************************
/****************************************************************************
tlock.rc
produced by Borland Resource Workshop
*****************************************************************************/
#define TLOCKMAIN 100
#define IDC_SAVE 101
#define IDC_PRODID 110
#define IDC_TIMEID 111
#define IDC_YEAR 112
#define IDC_VERSION 113
#define IDC_PRODUCT 114
#define IDC_COMPANY 115
#define IDC_REGISTRATION 116
#define IDC_UNLOCK 117
#define IDC_DECRYPT 118
#define IDC_EDITNAME 119
#define IDC_PASSWORD 120
#define IDC_STATUS 130
#define IDC_COPYRIGHT 131
#define TLOCKICON 200
#define IDC_GENERATE 300
#define IDC_BUTTONNAME 301
TLOCKICON ICON
{
'00 00 01 00 01 00 20 20 00 01 00 00 00 00 A8 08'
'00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
'00 00 01 00 08 00 00 00 00 00 80 04 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 40 00 00 00 80 00 00 00 FF 00 00 00 00 20'
'00 00 40 20 00 00 80 20 00 00 FF 20 00 00 00 40'
'00 00 40 40 00 00 80 40 00 00 FF 40 00 00 00 60'
'00 00 40 60 00 00 80 60 00 00 FF 60 00 00 00 80'
'00 00 40 80 00 00 80 80 00 00 FF 80 00 00 00 A0'
'00 00 40 A0 00 00 80 A0 00 00 FF A0 00 00 00 C0'
'00 00 40 C0 00 00 80 C0 00 00 FF C0 00 00 00 FF'
'00 00 40 FF 00 00 80 FF 00 00 FF FF 00 00 00 00'
'20 00 40 00 20 00 80 00 20 00 FF 00 20 00 00 20'
'20 00 40 20 20 00 80 20 20 00 FF 20 20 00 00 40'
'20 00 40 40 20 00 80 40 20 00 FF 40 20 00 00 60'
'20 00 40 60 20 00 80 60 20 00 FF 60 20 00 00 80'
'20 00 40 80 20 00 80 80 20 00 FF 80 20 00 00 A0'
'20 00 40 A0 20 00 80 A0 20 00 FF A0 20 00 00 C0'
'20 00 40 C0 20 00 80 C0 20 00 FF C0 20 00 00 FF'
'20 00 40 FF 20 00 80 FF 20 00 FF FF 20 00 00 00'
'40 00 40 00 40 00 80 00 40 00 FF 00 40 00 00 20'
'40 00 40 20 40 00 80 20 40 00 FF 20 40 00 00 40'
'40 00 40 40 40 00 80 40 40 00 FF 40 40 00 00 60'
'40 00 40 60 40 00 80 60 40 00 FF 60 40 00 00 80'
'40 00 40 80 40 00 80 80 40 00 FF 80 40 00 00 A0'
'40 00 40 A0 40 00 80 A0 40 00 FF A0 40 00 00 C0'
'40 00 40 C0 40 00 80 C0 40 00 FF C0 40 00 00 FF'
'40 00 40 FF 40 00 80 FF 40 00 FF FF 40 00 00 00'
'60 00 40 00 60 00 80 00 60 00 FF 00 60 00 00 20'
'60 00 40 20 60 00 80 20 60 00 FF 20 60 00 00 40'
'60 00 40 40 60 00 80 40 60 00 FF 40 60 00 00 60'
'60 00 40 60 60 00 80 60 60 00 FF 60 60 00 00 80'
'60 00 40 80 60 00 80 80 60 00 FF 80 60 00 00 A0'
'60 00 40 A0 60 00 80 A0 60 00 FF A0 60 00 00 C0'
'60 00 40 C0 60 00 80 C0 60 00 FF C0 60 00 00 FF'
'60 00 40 FF 60 00 80 FF 60 00 FF FF 60 00 00 00'
'80 00 40 00 80 00 80 00 80 00 FF 00 80 00 00 20'
'80 00 40 20 80 00 80 20 80 00 FF 20 80 00 00 40'
'80 00 40 40 80 00 80 40 80 00 FF 40 80 00 00 60'
'80 00 40 60 80 00 80 60 80 00 FF 60 80 00 00 80'
'80 00 40 80 80 00 80 80 80 00 FF 80 80 00 00 A0'
'80 00 40 A0 80 00 80 A0 80 00 FF A0 80 00 00 C0'
'80 00 40 C0 80 00 80 C0 80 00 FF C0 80 00 00 FF'
'80 00 40 FF 80 00 80 FF 80 00 FF FF 80 00 00 00'
'A0 00 40 00 A0 00 80 00 A0 00 FF 00 A0 00 00 20'
'A0 00 40 20 A0 00 80 20 A0 00 FF 20 A0 00 00 40'
'A0 00 40 40 A0 00 80 40 A0 00 FF 40 A0 00 00 60'
'A0 00 40 60 A0 00 80 60 A0 00 FF 60 A0 00 00 80'
'A0 00 40 80 A0 00 80 80 A0 00 FF 80 A0 00 00 A0'
'A0 00 40 A0 A0 00 80 A0 A0 00 FF A0 A0 00 00 C0'
'A0 00 40 C0 A0 00 80 C0 A0 00 FF C0 A0 00 00 FF'
'A0 00 40 FF A0 00 80 FF A0 00 FF FF A0 00 00 00'
'C0 00 40 00 C0 00 80 00 C0 00 FF 00 C0 00 00 20'
'C0 00 40 20 C0 00 80 20 C0 00 FF 20 C0 00 00 40'
'C0 00 40 40 C0 00 80 40 C0 00 FF 40 C0 00 00 60'
'C0 00 40 60 C0 00 80 60 C0 00 FF 60 C0 00 00 80'
'C0 00 40 80 C0 00 80 80 C0 00 FF 80 C0 00 00 A0'
'C0 00 40 A0 C0 00 80 A0 C0 00 FF A0 C0 00 00 C0'
'C0 00 40 C0 C0 00 80 C0 C0 00 FF C0 C0 00 00 FF'
'C0 00 40 FF C0 00 80 FF C0 00 FF FF C0 00 00 00'
'FF 00 40 00 FF 00 80 00 FF 00 FF 00 FF 00 00 20'
'FF 00 40 20 FF 00 80 20 FF 00 FF 20 FF 00 00 40'
'FF 00 40 40 FF 00 80 40 FF 00 FF 40 FF 00 00 60'
'FF 00 40 60 FF 00 80 60 FF 00 FF 60 FF 00 00 80'
'FF 00 40 80 FF 00 80 80 FF 00 FF 80 FF 00 00 A0'
'FF 00 40 A0 FF 00 80 A0 FF 00 FF A0 FF 00 00 C0'
'FF 00 40 C0 FF 00 80 C0 FF 00 FF C0 FF 00 00 FF'
'FF 00 40 FF FF 00 80 FF FF 00 FF FF FF 00 FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF 00 FF FF FF 00 00 00 00 00 FF 00'
'FF FF FF 00 00 00 FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF 00 FF FF FF 00 FF FF FF FF FF FF'
'FF FF 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF FF FF FF 00 FF 00 FF FF FF 00 FF FF FF FF FF'
'FF FF 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF FF FF FF 00 FF 00 FF FF FF FF 00 FF FF FF FF'
'FF FF 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF FF FF 00 FF FF FF 00 FF FF FF FF 00 FF FF FF'
'FF FF 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF FF FF 00 FF FF FF 00 FF FF FF FF FF 00 FF FF'
'FF FF 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF 00 FF FF'
'FF FF 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF 00 FF FF FF 00 FF FF'
'FF FF 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF 00 00 00 FF FF FF'
'FF FF FF 00 00 00 FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF 00 FF FF FF FF 00 FF FF 00 00 00 FF FF'
'FF 00 00 00 FF FF 00 FF FF FF 00 FF FF FF FF FF'
'FF FF FF 00 FF FF FF FF 00 FF 00 FF FF FF 00 FF'
'00 FF FF FF 00 FF 00 FF FF 00 FF FF FF FF FF FF'
'FF FF FF 00 FF FF FF FF 00 FF 00 FF FF FF 00 FF'
'00 FF FF FF FF FF 00 FF 00 FF FF FF FF FF FF FF'
'FF FF FF 00 FF FF FF FF 00 FF 00 FF FF FF 00 FF'
'00 FF FF FF FF FF 00 00 FF FF FF FF FF FF FF FF'
'FF FF FF 00 FF FF FF FF 00 FF 00 FF FF FF 00 FF'
'00 FF FF FF 00 FF 00 FF 00 FF FF FF FF FF FF FF'
'FF FF FF 00 FF FF FF FF 00 FF FF 00 00 00 FF FF'
'FF 00 00 00 FF FF 00 FF FF 00 FF FF FF FF FF FF'
'FF FF FF 00 FF FF FF FF 00 FF FF FF FF FF FF FF'
'FF FF FF FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF FF FF 00 FF FF FF FF 00 FF FF FF FF FF FF FF'
'FF FF FF FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF 00 00 00 00 00 FF FF 00 FF FF FF FF FF FF FF'
'FF FF FF FF FF FF 00 FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00'
}
TLOCKMAIN DIALOGEX 1, 0, 220, 240
STYLE DS_3DLOOK | WS_CHILD | WS_VISIBLE
CAPTION ""
FONT 8, "MS Sans Serif", 400, 0
{
CONTROL "Exit", -1, "static", SS_ETCHEDFRAME | WS_CHILD | WS_VISIBLE, 15, 5, 190, 39, 0
CONTROL "TimeLock32 v2.0 Retrieval Utility", -1, "static", SS_CENTER | WS_CHILD | WS_VISIBLE, 20, 8, 180, 8, 0
CONTROL "You wanna change my credits? It's really easy, lamer.", IDC_COPYRIGHT, "static", SS_CENTER | WS_CHILD | WS_VISIBLE, 20, 19, 180, 8, 0
CONTROL "", -1, "static", SS_CENTER | WS_CHILD | WS_VISIBLE, 20, 30, 180, 8, 0
CONTROL "...", IDC_BUTTONNAME, "button", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 47, 45, 12, 0
CONTROL "", IDC_EDITNAME, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 47, 140, 12, 0
CONTROL "Product", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 15, 62, 45, 8, 0
CONTROL "", IDC_PRODUCT, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 60, 140, 12, 0
CONTROL "Company", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 15, 75, 45, 8, 0
CONTROL "", IDC_COMPANY, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 73, 140, 12, 0
CONTROL "Version", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 15, 88, 45, 8, 0
CONTROL "", IDC_VERSION, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 86, 40, 12, 0
CONTROL "Year", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 115, 88, 20, 8, 0
CONTROL "", IDC_YEAR, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 140, 86, 65, 12, 0
CONTROL "Verification ID", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 15, 101, 45, 8, 0
CONTROL "", IDC_TIMEID, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 99, 140, 12, 0
CONTROL "Product ID", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 15, 114, 45, 8, 0
CONTROL "", IDC_PRODID, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 112, 140, 12, 0
CONTROL "Decrypt Key", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 15, 127, 45, 8, 0
CONTROL "", IDC_DECRYPT, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 125, 140, 12, 0
CONTROL "Password", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 15, 145, 45, 8, 0
CONTROL "", IDC_PASSWORD, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 143, 140, 12, 0
CONTROL "Reg No", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 15, 163, 45, 8, 0
CONTROL "", IDC_REGISTRATION, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 161, 140, 12, 0
CONTROL "*Unlock Code", -1, "static", SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, 15, 177, 45, 8, 0
CONTROL "", IDC_UNLOCK, "edit", ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 65, 174, 140, 12, 0
CONTROL "Generate!", IDC_GENERATE, "button", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 15, 195, 45, 12, 0
CONTROL "Exit", IDOK, "BUTTON", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE, 15, 222, 45, 12
CONTROL "", IDC_STATUS, "static", SS_CENTER | SS_SUNKEN | WS_CHILD | WS_VISIBLE, 65, 195, 140, 40, 0
CONTROL "Save", IDC_SAVE, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 208, 45, 12, 0
}
*****************************End TL322ret.rc********************************
Third file (TL322ret.cpp) cut and paste!
***************************Begin TL322ret.cpp********************************
/*************************************************************************
Compiler: Borland C++ 5.01 / Object Windows Library
OS: Windows 95
Author: Riz la+ [June 1997]
Purpose: Universal Key Generator for applications protected by [tl32v20.dll]
Disclaimer of liability:
This program is for free, in any way:
You can use it as you like, but I am not responsible for any (mis)use
or any damage that this prog will produce. Use at your own risk.
**************************************************************************/
#include
#include
#include
#include
#include
#include
#include
///////////////
//this will appear in the title bar
#define APPNAME "TimeLock32 v2.0 Retrieval Utility"
///////////////
//resource defines
#define TLOCKMAIN 100
#define IDC_SAVE 101
#define IDC_PRODID 110
#define IDC_TIMEID 111
#define IDC_YEAR 112
#define IDC_VERSION 113
#define IDC_PRODUCT 114
#define IDC_COMPANY 115
#define IDC_REGISTRATION 116
#define IDC_UNLOCK 117
#define IDC_DECRYPT 118
#define IDC_EDITNAME 119
#define IDC_PASSWORD 120
#define IDC_STATUS 130
#define IDC_COPYRIGHT 131
#define TLOCKICON 200
#define IDC_GENERATE 300
#define IDC_BUTTONNAME 301
///////////////
//Global var
//rectangle of the main dialog
TRect DlgRect;
//#########################################################################
// T L o c k D l g
//#########################################################################
class TLockDlg : public TDialog
{
public:
///////////////
//constructor
TLockDlg (TWindow* parent,
TResId resId = TLOCKMAIN,
TModule* module=0 );
///////////////
//destructor
virtual ~TLockDlg();
protected:
///////////////
//aliases
TEdit
*password,*decrypt,*tsfname,*prodid,*timeid,*year,*version,
*product,*company,*registration,*unlock;
TStatic
*copyright,*status;
TButton
*btsfname,*generate;
TCheckBox
*save;
///////////////
//standard
virtual void SetupWindow();
///////////////
//sets the text of a TEdit control, copies a string buffer
void SetString(const char* filebuffer, char* buffer, long offset, TEdit* set);
///////////////
//gets the filename of the [tsf-file]
void GetFileName();
///////////////
//here will the magic take place
void Generate();
///////////////
//response table
DECLARE_RESPONSE_TABLE(TLockDlg);
};
/*///////////////////////////
# Response Table
//////////////////////////*/
DEFINE_RESPONSE_TABLE1(TLockDlg,TDialog)
EV_BN_CLICKED(IDC_GENERATE,Generate),
EV_BN_CLICKED(IDC_BUTTONNAME,GetFileName),
END_RESPONSE_TABLE;
/*///////////////////////////
#constructor
//////////////////////////*/
TLockDlg::TLockDlg (TWindow* parent, TResId resId, TModule* module)
: TDialog(parent,resId,module)
{
///////////////
//aliases
copyright= new TStatic(this,IDC_COPYRIGHT);
status= new TStatic(this,IDC_STATUS);
password= new TEdit(this,IDC_PASSWORD);
tsfname= new TEdit(this,IDC_EDITNAME);
decrypt= new TEdit(this,IDC_DECRYPT);
prodid= new TEdit(this,IDC_PRODID);
timeid= new TEdit(this,IDC_TIMEID);
year= new TEdit(this,IDC_YEAR);
version= new TEdit(this,IDC_VERSION);
product= new TEdit(this,IDC_PRODUCT);
company= new TEdit(this,IDC_COMPANY);
registration= new TEdit(this,IDC_REGISTRATION);
unlock= new TEdit(this,IDC_UNLOCK);
btsfname= new TButton(this,IDC_BUTTONNAME);
generate= new TButton(this,IDC_GENERATE);
save= new TCheckBox(this, IDC_SAVE);
}
/*///////////////////////////
#destructor
//////////////////////////*/
TLockDlg::~TLockDlg()
{
///////////////
// every "new" needs a "delete":
delete copyright; delete status;
delete password; delete decrypt; delete tsfname; delete prodid; delete timeid;
delete year; delete version; delete product; delete company; delete registration;
delete unlock;
delete btsfname; delete generate;
delete save;
}
/*///////////////////////////
# SetupWindow()
//////////////////////////*/
void TLockDlg::SetupWindow()
{
///////////////
//standard
TDialog::SetupWindow();
///////////////
//get dialog rect for a shrink to dialog operation of parent window
GetWindowRect(DlgRect);
///////////////
//set "copyright" notice (it's very badly encrypted, but will just spoil newbie-lamers.)
char buffer[]={0xcf ,0xdf ,0xc2 ,0xb0 ,0x8b ,0x98 ,0xc2 ,0x8e ,0x83 ,0xc9 ,0xc2 ,
0xb9 ,0xa8 ,0x97 ,0x8c ,0x87, 0xc2 ,0xd3 ,0xdb ,0xdb ,0xd5 ,0xbf ,
0xc2 ,0xdf ,0xcf ,0x00};
for(int z=0;zSetText(buffer);
status->SetText("Choose a [tsf file] and press [Generate!]");
}
/*///////////////////////////
# GetFileName()
//////////////////////////*/
void TLockDlg::GetFileName()
{
char path[MAXPATH]="\0";
char drive[MAXDRIVE]="\0";
char dir[MAXDIR]="\0";
tsfname->GetText(path,sizeof(path));
fnsplit(path, drive, dir, 0, 0);
wsprintf(path,"%s%s",drive,dir);
TFileOpenDialog::TData data (OFN_HIDEREADONLY |OFN_FILEMUSTEXIST |OFN_PATHMUSTEXIST,
"Tsf Files(*.tsf)|*.tsf|All Files (*.*)|*.*",0,path);
if (TFileOpenDialog(this,data,0,"Choose a TimeLock32 v2.0 File").Execute()==IDOK)
{
tsfname->SetText(data.FileName);
generate->EnableWindow(true);
status->SetText("Press [Generate!] now");
password->SetText("");
decrypt->SetText("");
prodid->SetText("");
timeid->SetText("");
year->SetText("");
version->SetText("");
product->SetText("");
company->SetText("");
registration->SetText("");
unlock->SetText("");
}
}
/*///////////////////////////
# Generate()
//////////////////////////*/
void TLockDlg::Generate()
{
status->SetText("");
///////////////
//get the filename and open it
char filename[MAXPATH]="\0";
tsfname->GetText(filename,sizeof(filename));
TFile infile(filename,infile.ReadOnly,infile.PermRead);
if(infile.IsOpen())
{
///////////////
//[?.tsf] made by [tl32v20.dll] must be 2602 bytes long
if(infile.Length() == 2602L)
{
///////////////
//read file in buffer (and close file)
char* filebuffer = new char[2602L];
infile.Read((void*)filebuffer, 2602L);
infile.Close();
///////////////
//the decryption key:
//max length = 0x0b
//beginning in [?.tsf] at offset 0x8f9
///////////////
//get length of decryption key
//(every "block" in a [tsf-file] is terminated by 0x00)
int z=0x00;
while(filebuffer[z+0x8f9] != 0x00)
{
z++;
}
long decryptlength = z-0x01;
///////////////
//get the decryption key and decrypt it
char *decryptstr = new char[decryptlength];
for(int c = 0x00; c <= decryptlength; c++) { decryptstr[c]="char(filebuffer[c+0x8f9]" 0x2a + 0x20); } /////////////// //now we got the key...let's decrypt the whole file int d="0x00;" for(int c="0x00;" c < 2602L; c++) { /////////////// //the strings are separated by 0x00, and the decryption key has to start from //decryptstr[0] every time, so reset it if (filebuffer[c]="=0x00)" { d="0x00;" continue; } /////////////// //decrypting the decryption key needs to be different (see above) else if (c>=0x8f9 && c<=0x8f9+0x0b) { filebuffer[c]="char(filebuffer[c]" 0x2a + 0x20); continue; } /////////////// //else decrypt as usual else { filebuffer[c]="char(filebuffer[c]" decryptstr[d++] + 0x20); } /////////////// //pointer to decryption key needs to be reset, if last char reached if (d="=decryptlength+1)" { d="0x00;" } } /////////////// //everything's done now so let's calculate the permanent unlock code "char.class" tppabs="http://fravia.org/char.class" regbuffer[255]="\0" , prodbuffer[255]="\0" , codebuffer[255]="\0" ; //let's get the registration number (and set it as text) SetString(filebuffer,regbuffer,0x907L,registration); //let's get the product id (and set it as text) SetString(filebuffer, prodbuffer, 0x8a3L, prodid); /////////////// //and now: let's generate: /////////////// char first="0x04," second="0x0f," third="0x00," fourth="0x07," fifth="0x00;" signed long dummy; for(int z="0x00;z<=0x0f;z++)" { dummy="(regbuffer[fifth++]" 0x30) + (regbuffer[fourth--] 0x30); if(dummy> 0x09) dummy -= 0x0a;
dummy -= prodbuffer[third++] - 0x30;
if(dummy <0X00) dummy +="0x0a;" dummy +="regbuffer[second--]" 0x30; if(dummy> 0x09) dummy -= 0x0a;
dummy -= regbuffer[first++] - 0x30;
if(dummy <0X00) dummy +="0x0a;" wsprintf(codebuffer,"%s%d",codebuffer,dummy); if(z="=7)" { first="0x0b;" second="0x0f;" fourth="0x0f;" } if(z="=0x0c)" { first="0x04;" } if(third="=0x06)" third="0x00;" } unlock->SetText(codebuffer);
///////////////
//show some information
char buffer[255]="\0";
SetString(filebuffer,buffer,0x00L,password);
SetString(filebuffer, buffer, 0x8f9L, decrypt);
SetString(filebuffer, buffer, 0x8b0L, timeid);
SetString(filebuffer, buffer, 0xceL, year);
SetString(filebuffer, buffer, 0xbbL, version);
SetString(filebuffer, buffer, 0x89L, product);
SetString(filebuffer, buffer, 0x11L, company);
//these were already set above
//SetString(filebuffer, buffer, 0x907L, registration);
//SetString(filebuffer, buffer, 0x8a3L, prodid);
status->SetText("Decoding done.");
///////////////
//write decoded file, if you like to
if(save->GetCheck()==BF_CHECKED)
{
char file[MAXFILE+MAXEXT]="\0";
fnsplit(filename, 0, 0, file, 0);
string name = file + (string)".dec";
TFile outfile(name.c_str(),outfile.WriteOnly|outfile.Create,outfile.PermWrite);
if(outfile.IsOpen())
{
outfile.Write((void*)&filebuffer[0L],2602L);
outfile.Flush();
outfile.Close();
}
status->SetText("Decoding done.\nDecoded file saved.");
}
///////////////
//we need to destroy our "news"
delete[] filebuffer;
delete[] decryptstr;
}
///////////////
//[?.tsf] has wrong length
else status->SetText("Error: Wrong length of input file");
}
///////////////
//couldn't open [?.tsf]
else status->SetText("Error: Couldn't open input file.");
}
/*///////////////////////////
# SetString()
//////////////////////////*/
void TLockDlg::SetString(const char* filebuffer, char* buffer, long offset, TEdit* set)
{
int c=0;
while(filebuffer[c+offset]!=0x00)
{
buffer[c]=filebuffer[c+offset];
c++;
}
buffer[c]=0x00;
set->SetText(buffer);
}
//#########################################################################
// T L o c k F r a m e W i n d o w
//#########################################################################
class TLockFrameWindow : public TDecoratedFrame
{
public:
TLockFrameWindow (TWindow* parent,
const char far *title,
TWindow* clientWnd = 0,
bool trackMenuSelection = false,
TModule* module = 0)
:TDecoratedFrame (parent,title,clientWnd,false)
{
Attr.Style &=~WS_THICKFRAME & ~WS_MAXIMIZEBOX;
Attr.Style |=WS_EX_DLGMODALFRAME;
}
virtual void SetupWindow();
};
void TLockFrameWindow::SetupWindow()
{
TDecoratedFrame::SetupWindow();
///////////////
//shrink to client
int x,y;
TRect recscreen,recwind;
::GetWindowRect(GetDesktopWindow(),&recscreen);
GetWindowRect(recwind);
int Width=DlgRect.Width()
+(GetSystemMetrics(SM_CXBORDER)*2);
int Height=DlgRect.Height()
+GetSystemMetrics(SM_CYCAPTION)
+GetSystemMetrics(SM_CYBORDER);
x=recscreen.Width()-Width;
y=recscreen.Height()-Height;
SetWindowPos(0,recscreen.left+x/2,recscreen.top+y/2,Width,Height,
SWP_NOZORDER);
}
//#########################################################################
// TLockApp
//#########################################################################
class TLockApp : public TApplication
{
public:
TLockApp();
protected:
void InitMainWindow();
};
TLockApp::TLockApp() : TApplication()
{
}
void TLockApp::InitMainWindow()
{
TLockDlg* dlg=(new TLockDlg(0,TLOCKMAIN));
TLockFrameWindow* frame=(new TLockFrameWindow(0,APPNAME,dlg));
EnableCtl3d();
frame->SetIcon(this,TLOCKICON);
MainWindow=frame;
}
//#########################################################################
// M A I N
//#########################################################################
int OwlMain(int, char**)
{
return TLockApp().Run();
}
***************************End TL322ret.cpp********************************
You are deep inside fravia's page of reverse engineering,
choose your way out:
homepage
links
anonymity
+ORC
students' essays
tools cocktails
search_forms
mailFraVia
Is reverse engineering legal?