#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);
}
}
//---------------------------------------------------------------------------