?
Solved

bde/tutil32 version number

Posted on 1998-04-29
5
Medium Priority
?
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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