2013-04-22 94 views
0

我有一個非常古老的VB 16位應用程序與.MDB文件一起工作,因爲還有一個.MDA文件 - 因此我猜測它是使用訪問2.0製作的。需要獲得我們的表格,關係和內容。表格數據採用「丹麥語」。編碼MDB表和內容

我的老闆確實有版權,但沒有管理員用戶名和密碼。應用程序運行良好,這意味着應用程序可以連接到MDB文件並使用它。我在Windows 7 32位機器上運行它。

看來數據庫是編碼的。知道他們使用RC4編碼和.MDB頭包含它的關鍵。

有沒有辦法從編碼.MDB中獲取表和數據。我已經嘗試了我的mdb解鎖工具,但他們中的大多數人都無法識別它是.mdb,但應用程序能正常工作。

我非常渴望找到解決方案。任何幫助深表感謝。

回答

0

後來知道他們使用RC4編碼,而.MDB頭部包含的關鍵字爲 。有沒有辦法從編碼的.MDB中獲取平板電腦和數據。

您必須使用對象模型代碼去除Access數據庫文件中的所有內容。下面是一個腳本,以便從腐敗 Access數據庫提取數據:

Function FilterDB(strFilePath As String) 
    Dim objAccess As Object 
    Dim strFolder As String 
    Dim strCurrentFile As String 
    Dim strCurrentObject As String 
    Dim strFilteredDB As String 

    Dim fs 
    Dim Ref 
    Dim f As Object 
    Dim objtype As AcObjectType 

    Dim objAllObjects As New Collection 
    Dim objObjectGroup As Object 
    Dim intObjType As Integer 
    Dim i As Integer 
    Dim j As Integer 
    Dim intRefNum As Integer 

    Dim RefItem As Reference 
    Dim arrayRefs() As String 

    Dim strErrMsg As String 

    'Open the source database 
    Set objAccess = CreateObject("Access.Application.10") 

    On Error GoTo ErrorHandler 

    objAccess.OpenCurrentDatabase strFilePath, False 

    strFolder = Left(strFilePath, InStrRev(strFilePath, "\", Len(strFilePath))) 
    strFilteredDB = Left(strFilePath, Len(strFilePath) - 4) & "filtered.mdb" 

    With objAllObjects 
     .Add objAccess.CurrentData.AllQueries 
     .Add objAccess.CurrentProject.AllForms 
     .Add objAccess.CurrentProject.AllReports 
     .Add objAccess.CurrentProject.AllMacros 
     .Add objAccess.CurrentProject.AllModules 
     .Add objAccess.CurrentProject.AllDataAccessPages 
    End With 

    Set fs = CreateObject("Scripting.FileSystemObject") 

    If Not fs.folderexists(strFolder & "\texttmp") Then 
     fs.CreateFolder (strFolder & "\texttmp") 
    End If 

    For i = 1 To objAllObjects.Count 

     If objAllObjects(i).Count > 0 Then 
      For j = 0 To objAllObjects(i).Count - 1 

       Set objObjectGroup = objAllObjects(i) 

       strCurrentObject = objObjectGroup(j).Name 
       intObjType = objObjectGroup(j).Type 
       objAccess.SaveAsText intObjType, strCurrentObject, _ 
       strFolder & "texttmp\" & strCurrentObject & intObjType & ".txt" 

      Next j 
     End If 

    Next i 

    'Bring in All the references 
    On Error Resume Next 

    ReDim arrayRefs(objAccess.References.Count - 1, 2) As String 

    For Each RefItem In objAccess.References() 
     If Not IsError(RefItem.Name) Then 

      arrayRefs(intRefNum, 0) = RefItem.Name 
      arrayRefs(intRefNum, 1) = RefItem.FullPath 
      intRefNum = intRefNum + 1 

     End If 
    Next RefItem 

    On Error GoTo ErrorHandler 

    Debug.Print "" 
    objAccess.Quit 
    Set objAccess = Nothing 

    Set objAccess = CreateObject("Access.Application") 

    objAccess.NewCurrentDatabase strFilteredDB 

    'Finds the first occurrence of a text file in the 
    'texttmp folder. 
    strCurrentFile = Dir(strFolder & "\texttmp" & "\*.txt") 

    'Count the files in the folder. 
    Set f = fs.GetFolder(strFolder) 

    'Check to see if the folder is empty. 
    'If not, load in all the files from there 
    If f.Files.Count <> 0 Then 

    Do Until strCurrentFile = "" 
     intObjType = Mid(strCurrentFile, Len(strCurrentFile) - 4, 1) 
     objAccess.LoadFromText intObjType, _ 
     Left(strCurrentFile, Len(strCurrentFile) - 5), _ 
     strFolder & "\texttmp\" & strCurrentFile 
     strCurrentFile = Dir 
    Loop 
    End If 


    On Error Resume Next 

    For i = 0 To UBound(arrayRefs()) 

     Set Ref = objAccess.References.AddFromFile(arrayRefs(i, 1)) 

    Next i 

    MsgBox "Finished creating filtered file:" & Chr(10) _ 
    & objAccess.CurrentProject.FullName & "." 

FunctionEnd: 

    On Error Resume Next 
    Set fs = CreateObject("Scripting.FileSystemObject") 

    If fs.folderexists(strFolder & "\texttmp") Then 
     fs.deletefolder (strFolder & "\texttmp") 
    End If 

    objAccess.Quit 
    Set objAccess = Nothing 
    Set f = Nothing 

    Exit Function 

ErrorHandler: 

    Select Case Err.Number 

     Case 58, 7866 
     strErrMsg = "The path\file name " & strFilePath _ 
      & " may be incorrect or the " _ 
      & Chr(10) & " database is opened exclusively by someone else." _ 
      & Chr(10) & Chr(10) & _ 
      "Please insure your path and file name are correct " _ 
      & Chr(10) & "and the database is not open." 

     Case 7865 
     strErrMsg = "The follwing database:" & Chr(10) & Chr(10) _ 
      & strFilteredDB & Chr(10) & Chr(10) _ 
      & "already exists." _ 
      & Chr(10) & Chr(10) & _ 
      " Please rename, move, or delete it before running" _ 
      & "the FilterDB function." 

     Case Else 
     strErrMsg = "Access Error #" & Err.Number & Chr(10) & Chr(10) & _ 
     Err.Description 

    End Select 

    MsgBox strErrMsg 

    GoTo FunctionEnd 

    End Function 
+0

謝謝傑里米我會嘗試, – user2186347 2013-04-24 09:42:46

+0

嗨傑里米,我想上面的代碼,它帶有一個錯誤 - 無論是路徑不正確或完全打開完全由別人。我想提供一些我已反編譯的應用程序的信息,以查看是否可以獲得任何線索。 – user2186347 2013-04-24 15:58:28

+0

有一個函數fn007A SetDefaultWorkspace fn007A(1,gv0042),fn007A(2,gv0042) Öª¼§eü³®Ëâ¨ü%þææ»&ø¸*-¾m,5ä – user2186347 2013-04-24 16:16:18