Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

bde/tutil32 version number

Posted on 1998-04-29
5
Medium Priority
?
223 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

636 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