首页 > 数据库 > Access > 正文

ACCESS2000数据库文件密码的提取(源程序c++builder5)(推荐大家转换成C#版本)

2024-09-07 19:04:59
字体:
来源:转载
供稿:网友

#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);
   }
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表