#include <vcl.h>
#pragma hdrstop
#include "dolaccess.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
tform1 *form1;
//---------------------------------------------------------------------------
__fastcall tform1::tform1(tcomponent* owner)
: tform(owner)
{
}
//---------------------------------------------------------------------------
void __fastcall tform1::speedbutton1click(tobject *sender)
{
if( opendialog1->execute())
edtfilename->text=opendialog1->filename;
else
application->messageboxa("没有选定有效的文件名!","消息",idok);
}
//---------------------------------------------------------------------------
void __fastcall tform1::button1click(tobject *sender)
{
int ifilehandle;
int ibyteread;
int i,j;
char *pszbuffer;
char code[0x27]={0x10,0xec,0xcb,0x9c,0x50,0x28,0x85,0x8a,0xc2,0x7b,
0x63,0xdf,0xe1,0x13,0x59,0xb1,0xa2,0x79,0x04,0x7c};
if(edtfilename->text.length()!=0)
{
try
{
ifilehandle=fileopen(edtfilename->text,fmopenread);
fileseek(ifilehandle,0x42,0);
pszbuffer=new char[0x27];
ibyteread=fileread(ifilehandle,pszbuffer,0x27);
fileclose(ifilehandle);
i=ibyteread/2;
for(j=0;j<=i;j++)
{
code[j]=code[j]^pszbuffer[2*j];
}
delete [] pszbuffer;
edtpassword->text=code;
if(edtpassword->text.length()==0)
edtpassword->text="此数据库未设置密码!";
}
catch(const exception& e)
{
application->messageboxa("读取文件错误!!!","错误!",idok);
}
}
else
{
application->messageboxa("没有输入有效的文件名","注意!",idok);
}
}