[AccessD] Weird A97 happenings

Gustav Brock Gustav at cactus.dk
Wed Mar 28 07:39:00 CDT 2007


Hi John and John

Search on "password" ...:

Public Sub smsAcc97PwdRead(ByVal vstrMdbPath As String)

'  Purpose:    Read MS Access 97 database level password
'  Written by: Shamil Salakhetdinov
'  e-mail:     shamil at marta.darts.spb.ru 
'
'  Parameters:
'              vstrMdbPath - full path for MS Access 97 database
'
'
'  Credits: www.rootshell.com/archive-j457nxiqi3gq59dv/199902/all-access.c.html 
'
'  Modified:   2001-06-22. Cactus Data ApS.
'  Reason:     Password length was limited to 13 characters
'              Now reads a password with the maximum length of 20 characters.
'              String manipulation simplified.
'              Rudimentary check of file type as JET file added.


  On Error GoTo smsAccPwdRead_Err

  Const cintAcc97JetOffset  As Integer = &H5
  Const cintAcc97PwdOffset  As Integer = &H43
  Const cintAcc97PwdLength  As Integer = 20
  ' Only up to cintAcc97PwdLenMan characters
  ' can be entered manually when changing password.
  Const cintAcc97PwdLenMan  As Integer = 14
  Const cstrJetFileTypeID   As String * 15 = "Standard Jet DB"
  
  Dim strJetBuf             As String * 15
  Dim strPwdClear           As String
  Dim strPwdBuf             As String * cintAcc97PwdLength
  Dim strPwd                As String
  Dim strMsgTxt             As String
  Dim strMsgTit             As String
  Dim intMsgMod             As Integer
  Dim bytChr                As Byte
  Dim intLen                As Integer
  Dim intFn                 As Integer
  Dim intI                  As Integer

  strPwdClear = Chr(&H86) & Chr(&HFB) & Chr(&HEC) & Chr(&H37) & _
                Chr(&H5D) & Chr(&H44) & Chr(&H9C) & Chr(&HFA) & _
                Chr(&HC6) & Chr(&H5E) & Chr(&H28) & Chr(&HE6) & _
                Chr(&H13) & Chr(&HB6) & Chr(&H8A) & Chr(&H60) & _
                Chr(&H54) & Chr(&H94) & Chr(&H7B) & Chr(&H36)
  
  strMsgTit = "Access 97 Jet File Password detection"
  strMsgTxt = "File '" & vstrMdbPath & "'" & vbCrLf
  
  intFn = FreeFile
  Open vstrMdbPath For Binary Access Read As #intFn
  Get #intFn, cintAcc97JetOffset, strJetBuf
  Get #intFn, cintAcc97PwdOffset, strPwdBuf
  Close intFn
  
  If Not StrComp(cstrJetFileTypeID, strJetBuf, vbBinaryCompare) = 0 Then
    ' Not a Jet file.
    strMsgTxt = strMsgTxt & "can not be identified as a Jet file."
    intMsgMod = vbExclamation + vbOKOnly
  Else
    For intI = 1 To cintAcc97PwdLength
      bytChr = Asc(Mid(strPwdBuf, intI, 1)) Xor Asc(Mid(strPwdClear, intI, 1))
      Mid(strPwdBuf, intI, 1) = Chr(bytChr)
      If bytChr = 0 Then
        strPwd = Left(strPwdBuf, intI - 1)
        ' Stop loop.
        intI = cintAcc97PwdLength
      ElseIf intI = cintAcc97PwdLength Then
        strPwd = strPwdBuf
      End If
      Debug.Print Asc(strPwdBuf), strPwdBuf
    Next intI
    
    intLen = Len(strPwd)
    If intLen = 0 Then
      ' Password is empty.
      strMsgTxt = strMsgTxt & "is not password protected."
    Else
      strMsgTxt = strMsgTxt & "is protected by password:" & vbCrLf & _
                  "'" & strPwd & "'." & vbCrLf & vbCrLf & _
                  "Length of password is " & intLen & " character" & Left("s", Abs(intLen > 1)) & "."
      If intLen > cintAcc97PwdLenMan Then
        strMsgTxt = strMsgTxt & vbCrLf & "This password can not be altered manually!"
      End If
    End If
    intMsgMod = vbInformation + vbOKOnly
  End If

  MsgBox strMsgTxt, intMsgMod, strMsgTit
  
smsAccPwdRead_Exit:
  Exit Sub
  
smsAccPwdRead_Err:
  MsgBox "smsAccPwdRead: Err = " & Err & " - " & Err.Description
  Resume smsAccPwdRead_Exit
    
End Sub

Sub SetDbPassword()

  Dim wks As Workspace
  Dim dbs As Database

  Dim strDatabaseFile As String
  Dim strPasswordOld As String
  Dim strPasswordNew As String

  strDatabaseFile = "denkrypttest.mdb" '"d:\myA97database.mdb"
  strPasswordOld = "" '"14191419141900xxyyz2"
  strPasswordNew = "1234pass" '"14191419141900xxyyz3"

  Set wks = DBEngine(0)
  Set dbs = wks.OpenDatabase(strDatabaseFile, True, False, ";pwd=" & strPasswordOld)
  dbs.NewPassword strPasswordOld, strPasswordNew
  dbs.Close
  Set dbs = Nothing
  Set wks = Nothing

End Sub

/gustav

>>> jwcolby at colbyconsulting.com 28-03-2007 14:21 >>>
If this is simply a password to get in, I think there is unlock code.  I got
it from Shamil one time IIRC.  I have the code somewhere but finding it... 


John W. Colby
Colby Consulting
www.ColbyConsulting.com 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Clark
Sent: Wednesday, March 28, 2007 8:08 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Weird A97 happenings

Well, I tried this, but before I could I could import from the old program,
I was prompted for a password.

So, I guess my biggest problem, at this moment, is that there is no password
for the program, yet I am being asked for one. I tried blanks but they
didn't work either. Why would a program begin asking for a password?



>>> "JWColby" <jwcolby at colbyconsulting.com> 3/27/2007 3:18 PM >>>
I would guess that the data store is still in A97 and the Access itself is
in A2K.  A2K could read but not write (forms / code etc) to an A97
container.  Build a new container in A2K and import all of the objects into
that container.


John W. Colby
Colby Consulting
www.ColbyConsulting.com 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Clark
Sent: Tuesday, March 27, 2007 3:01 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Weird A97 happenings

I think I explained wrong...there is the password prompt only on my PC using
A97 and A2K3, and now we get the same thing using my co-worker's PC that has
A2K7. The error message that I am getting on their PC is on a A2K
installation.


>>> "David McAfee" <davidmcafee at gmail.com> 3/27/2007 2:52 PM >>>
The security message is part of your 2003 installation. You can go to
Tools->options->Security and lower the level. As for the login prompt, 
Tools->options->there
is probably something going on with the mdw. DO you have another secured mdb
on your box? that app may not be set up correctly. Check out the securityFaq
white paper. If you cant find it on Microsoft's site, check out
RogersAccesslibrary.com and it is there.

You can also (band aid fix) create a shortcut and put a username and
password in the command line of the short cut (I believe even if the pw is
blank).



On 3/27/07, John Clark <John.Clark at niagaracounty.com> wrote:
>
> Years ago, I wrote a A97 program for our Hotline program. This is the 
> program that you call if you are going to hurt yourself, and is part 
> of the Mental Health department.
>
> It really isn't anything very complex and they have been using it for 
> all these years w/out any problems. It is one of the first programs I 
> wrote in Access, so there really isn't any big programming tricks 
> going on.
>
> Basically, it opens via the "Startup" options, to a form called, 
> "HotlineSplash" which OnTimer then closes, and OnClose is goes to the 
> "HotlineMenu" form. The first problem that they encountered was that 
> it wouldn't make the switch from the splash screen to the menu. It 
> gave the standard error message about a macro or code that could not 
> be run...the first message listed OnTimer as a problem.
>
> I'll interject here that I wrote the program using A97, but they have 
> since switched to A2K. I believe this was done early in 2006 (yeah, 
> we're always a bit behind).
>
> The first "Odd" thing that I notice, when I was nosing around, was 
> that I encountered a message that said something like, "You cannot 
> make any changes because this was written in an earlier version of 
> hotline." It apparently picked up the name of the program and put it 
> in the place of the word "access."
>
> I figured that a quick fix, to get them going, and I could look at the 
> real problem later, would be to skip the splash screen. So, I went 
> into the startup area and made the switch to open to the menu. It 
> seemed to work, because it came up to the menu and had no error.
> However, as soon as I try to push a command button choice, a similar 
> error occurs. Basically, an error appears when any function is 
> attempted, other than simply opening an object from the Access menu.
>
> I have A97 and A2003 installed on my PC, so I figured I'd make a copy 
> and look at it from my desk...I was remote controlling their PC originally.
> Whether I use A97 or  2K3, on my PC, I get a password screen. It 
> doesn't have a password. And, when I was using it from the desktop, I 
> didn't have to enter a password.
>
> ANY ideas here would be greatly appreciated! At this point, I'm ready 
> to drop back and punt. If your advice is to leave work and go get a 
> drink, I would probably heed your advice ;o)
>
> Thank you!
>
> John W Clark




More information about the AccessD mailing list