Solved

bde/tutil32 version number

Posted on 1998-04-29
5
213 Views
Last Modified: 2010-04-06
Does anyone know how I can get the tutil32.dll and bde version numbers? Thanks, Tom.
0
Comment
Question by:tomcorcoran
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 50 total points
ID: 1339394
Hi Tom

The following functions should do it for you.

(GetDllVersion is defined at the bottom.)

type
  TVersionNumber = Record
    MS1          : Word;
    MS2          : Word;
    LS1          : Word;
    LS2          : Word;
  end;

function GetTUtilVersion: string;
var
  VerRec: TVersionNumber;
begin
  // VerRec structure is filled, AND a string is returned.
  Result := GetDllVersion(VerRec, 'TUTIL32.DLL');
end;

function GetBdeVersion: string;
var
  Registry : TRegistry;
      BDEDir : String;
  VerRec: TVersionNumber;
begin
  // VerRec structure is filled, AND a string is returned.

      Registry := TRegistry.Create;
      Registry.RootKey := HKEY_LOCAL_MACHINE;
      If Registry.OpenKey('Software\Borland\Database Engine', FALSE) then
      begin
            BDEDir := Registry.ReadString('DLLPATH');
            while (Pos(';', BDEDir) > 0) do
                  BDEDir := Copy(BDEDir, Pos(';', BDEDir) + 1, MaxInt);

            if BDEDir[length(BDEDir)] <> '\' then
                  BDEDir := BDEDir + '\';
            BDEDir := BDEDir + 'Idapi32.dll';
    Result := GetDllVersion(VerRec, BDEDir);
      end
      else
    Result := '';
      Registry.Free;
end;

function GetDllVersion(var VerRec : TVersionNumber; TheDllName: string): string;
type
   PFixedFileInfo = PVSFixedFileInfo;
var
  UTVerInfo : Pointer;
  PFixedInfo : Pointer;
  VerInfoSize : DWORD;
  VerHandle : DWORD;
  RetLen : Integer;
  FileNulStr : DBITBLNAME;
begin
  VerInfoSize := GetFileVersionInfoSize(StrPCopy(FileNulStr, TheDllName), VerHandle);
  If VerInfoSize > 0 then
  begin
    GetMem(UTVerInfo, VerInfoSize);
    GetFileVersionInfo(
       FileNulStr,
       VerHandle,
       VerInfoSize,
       UTVerInfo);
    VerQueryValue(UTVerInfo, '\' , PFixedInfo, RetLen);
    VerRec.MS1 := HIWORD(PFixedFileInfo(PFixedInfo)^.dwFileVersionMS);
    VerRec.MS2 := LOWORD(PFixedFileInfo(PFixedInfo)^.dwFileVersionMS);
            VerRec.LS1 := HIWORD(PFixedFileInfo(PFixedInfo)^.dwFileVersionLS);
            VerRec.LS2 := LOWORD(PFixedFileInfo(PFixedInfo)^.dwFileVersionLS);
            Result := IntToStr(VerRec.MS1) + '.' +
                                          IntToStr(VerRec.MS2) + '.' +
                                          IntToStr(VerRec.LS1) + '.' +
                                          IntToStr(VerRec.LS2);
            FreeMem(UTVerInfo, VerInfoSize);
      end
      else
    Result := '';
end;

Cheers,
JB
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1339395
Oh yeah, add Bde and Registry to your uses clause.
JB
0
 

Author Comment

by:tomcorcoran
ID: 1339396
Thanks a million Jim Bob, I'll try that out. Tom.
0
 

Author Comment

by:tomcorcoran
ID: 1339397
Jim Bob, Awesome stuff my man, worked like a charm, nice code for the reg to, used it to run bde admin from the prog also. Tom.
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1339398
Hi Tom,
Thanks, but I can't take all the credit.  We use this code in our company, and I didn't write it originally, although I did fix 2 bugs that it had.

Cheers,
JB
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
build html 5 client that connect to indy Tidtcpserver 3 395
oracle global variables 4 68
delphi parse string to params 3 122
Wincontrol not (correctly) drawn 15 37
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question