Solved

bde/tutil32 version number

Posted on 1998-04-29
5
210 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
Comment Utility
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
Comment Utility
Oh yeah, add Bde and Registry to your uses clause.
JB
0
 

Author Comment

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

Author Comment

by:tomcorcoran
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now