Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to get Microsoft Access '97 password Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
31-Oct-02
Category
OLE
Language
Delphi 3.x
Views
85
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Maarten de Haan

Get the MicroSoft Access '97 password.

Answer:

1   function GetMDB97PassWord(Filename: string): string;
2   
3   const
4     XorArr: array[0..12] of Byte = ($86, $FB, $EC, $37, $5D, $44, $9C, $FA, $C6, $5E,
5       $28, $E6, $13);
6   
7   var
8     I: Integer;
9     Arr: array[0..12] of Byte;
10    S1: string;
11    FI: file of Byte;
12    By: Byte;
13    Access97: Boolean;
14    FileError: Boolean;
15  
16  begin
17    // Init
18    FileError := False;
19    Access97 := True;
20  
21    // Open file
22    AssignFile(FI, Filename);
23    Reset(FI);
24  
25    // Read file
26    I := 0;
27    repeat
28      if not Eof(FI) then
29      begin
30        read(FI, By);
31        Inc(I);
32      end;
33    until (I = $42) or Eof(FI);
34    if Eof(FI) then
35      FileError := True;
36  
37    // Read password string
38    for I := 0 to 12 do
39      if not Eof(FI) then
40        read(FI, Arr[I]);
41  
42    if Eof(FI) then
43      FileError := True;
44  
45    //Close file
46    CloseFile(FI);
47  
48    // Read string in S1
49    S1 := '';
50    for I := 0 to 12 do
51      S1 := S1 + Chr(Arr[I]);
52  
53    // Is nul string?
54    if S1 = #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 then
55      Access97 := False;
56  
57    // Decode string
58    S1 := '';
59    for I := 0 to 12 do
60      S1 := S1 + Chr(Arr[I] xor XORArr[I]);
61  
62    // Find end of string
63    I := 0;
64    repeat
65      Inc(I);
66    until (S1[I] = #0) or (I = 14);
67    if I <= 14 then
68      S1 := Copy(S1, 1, I - 1);
69  
70    // Gather the results
71    if Access97 then
72    begin
73      if Length(S1) > 0 then
74        Result := 'The password is: ' + S1 + '.'
75      else
76        Result := 'The file is NOT password protected.';
77    end
78    else
79      Result := 'The file is not an Access 97 file / wrong format.';
80  
81    if FileError then
82      Result := 'File error';
83  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC