How to get Access serial number


Question

How to get Access serial number ?

Answer

From: Shamil Salakhetdinov <shamil@marta.darts.spb.ru>
To: Mike <jedi@charm.net>
Subject: Re: Eureka! I got it! [accessd] How to get Access serial number?
Date: 25 February 1999. 5:27

Mike,

This function worked for my English (USA) and German versions of Acc97 8.0.3512. Please send me a short note how it will work for your Acc97 installation if it works at all.

TIA,
Shamil

Option Compare Database
Option Explicit

'*+
' Feel free to use this piece of code but please don't delete this header.
'
' Purpose: Read License Key of Acc97 given its exe fullpath.
' Author: Shamil Salakhetdinov, e-mail: shamil@marta.darts.spb.ru
' Written at: 24.02.99 23:47:18 St.Petersburg (Russia) Mean Time
'
' Note:
'
' Tested with MS Office 97 Pro English (USA) version and German(Standard)
' version no service packs installed
'
' Usage:
'
' GetAcc97LicKey("e:\off97\office\msaccess.exe")
'*+

Private Const cstrSignature As String = _
"53 00 74 00 72 00 69 00 6E 00 67 00 46 00 " & _
"69 00 6C 00 65 00 49 00 6E 00 66 00 6F 00 "

Public Function GetAcc97LicKey(ByVal vstrAcc97FullPath As String)
Const clngRecLen As Long = 32767

Dim intFn As Integer
Dim strInBuf As String * clngRecLen
Dim lngOffSet As Long
Dim lngPos As Long
Dim strSign As String
Dim i As Integer
Dim lngLOF As Long

For i = 1 To Len(cstrSignature) Step 3
strSign = strSign & Chr("&h" & Mid(cstrSignature, i, 2))
Next i

intFn = FreeFile
Open vstrAcc97FullPath For Binary Access Read As #intFn

lngLOF = LOF(intFn)

Do While (1)
Get #intFn, , strInBuf

lngPos = InStr(1, strInBuf, strSign)

If lngPos <> 0 Then Exit Do
If lngOffSet + clngRecLen > lngLOF Then Exit Do

lngOffSet = lngOffSet + clngRecLen
Seek #intFn, lngOffSet
strInBuf = ""
Loop


If lngPos <> 0 Then
Seek #intFn, lngOffSet + lngPos - 1 + 704 + 172 - 18
Get #intFn, , strInBuf
GetAcc97LicKey = Left(strInBuf, 20)
End If

Close #intFn

End Function

HOME    TOPICS

Copyright © 1999 by Shamil Salakhetdinov.
All rights reserved. Terms of use.

Last updated: October 10, 2006

Published also here at 4TOPS: How to get Access serial number