• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

Dll get version...

Help me get this Crap working :)
just the Normal info or if u want.. also Win2k part..
Const
 DLLVER_PLATFORM_WINDOWS = $00000001;  // Windows 95
 DLLVER_PLATFORM_NT      = $00000002;  // Windows NT

Type
  pDllVersionInfo = ^TDllVersionInfo;
  TDllVersionInfo = Record
    cbSize,
    dwMajorVersion,
    dwMinorVersion,
    dwBuildNumber,
    dwPlatformID : DWord;
   end;

{ // ONLY FOR WINDOWS 2000 DLLS
 TDLLVERSIONINFO2 = Record
  info1      : TDLLVERSIONINFO;
  dwFlags    : DWORD;
  ullVersion : ULONGLONG;
 End;
}


Function DLLGetVersion(dllName : PChar) : pDllVersionInfo;
Var
 hinstDll : Longint;
 ProcDLLGetVersion : Function(pdvi : pDLLVERSIONINFO) : HResult;
 dvi  : pDllVersionInfo;
Begin
 New(dvi);

 dvi^.cbSize := SizeOf(TDLLVersionInfo);
 FillChar(dvi,SizeOf(TDLLVersionInfo),0);

 hinstDll := LoadLibrary(DllName);

 if (hinstDll >0) then
  Begin
   ProcDLLGetVersion := GetProcAddress(hinstDll, 'DllGetVersion');

    if Assigned(ProcDLLGetVersion) then
      Begin
        ProcDLLGetVersion(dvi);
      End;

    ProcDLLGetVersion := nil;
  End;

 FreeLibrary(hinstDll);

 Result := dvi;
 Dispose(dvi);
End;

0
brainware
Asked:
brainware
  • 6
  • 5
  • 3
  • +1
1 Solution
 
LischkeCommented:
Hi brainware, change the declaration of ProcDLLGetVersion to:

ProcDLLGetVersion : Function(pdvi : pDLLVERSIONINFO): HResult; stdcall;

Your forgot the calling convention.

Ciao, Mike
0
 
brainwareAuthor Commented:
Still crashes on me :(
0
 
MadshiCommented:
Try this one:

type
  TDllVersion = record
    size         : cardinal;
    majorVersion : cardinal;
    minorVersion : cardinal;
    buildNumber  : cardinal;
    platformID   : cardinal;
  end;

function GetModuleVersion(moduleFile: string) : TDllVersion;
var func : function (var dllVersion: TDllVersion) : integer; stdcall;
    c1   : cardinal;
begin
  ZeroMemory(@result, sizeOf(TDllVersion));
  result.size := sizeOf(TDllVersion);
  c1 := LoadLibrary(pchar(moduleFile));
  if c1 <> 0 then
    try
      func := GetProcAddress(c1, 'DllGetVersion');
      if @func <> nil then func(result);
    finally FreeLibrary(c1) end;
end;

Regards, Madshi.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
simonetCommented:
MAN,

YOU HAVE A VERY DIRTY MOUTH AND OFFENSIVE VOCABULARY.

In your question about CPU features, you made references to the "damn sources" of my component.

About the word "crap", I've lost count of times I've seen it in your last postings.

Although I could give you a solution for this question, I won't, for I feel offended by your vocabulary. And, if you want the sources for my components, feel free to BUY it from me. I am not willing to give away the sources for one who swears all the time and who refers to the code as a "damn" thing.




0
 
brainwareAuthor Commented:
Simonet: mabye becuse so MANY keeps on posting comments/answers not Valid to what i asked for.  
So far i think a few who have never been posting such was Madshi, Lischke, Williams etc.

And if i did use some "not exactly nice words" im sorry. Im not going to explain my actions, But you can just be happy u aint in the same situation as me.

Regards
Michael.
0
 
brainwareAuthor Commented:
Thanks Madshi, Works..
submit answer...
0
 
MadshiCommented:
Thanx...  :-)

BTW, you could have accept my comment as an answer, too...   (-:

Regards, Madshi.
0
 
MadshiCommented:
Ahhh - now here is the answer...   :-)
0
 
LischkeCommented:
..and basically I should propose the answer as I have first mentioned the correct solution.

Thank you :-/

Ciao, Mike
0
 
MadshiCommented:
Well, Mike, your correction was one of at least 2 corrections!! I've rewritten the whole stuff and tested it. As Michael said, with only your 1 correction it did not work.

Regards, Madshi.
0
 
LischkeCommented:
Yes, I see, the returned pointer which is freed and the var parameter...

Ciao, Mike
0
 
MadshiCommented:
Yes, and the order of these two lines:

 dvi^.cbSize := SizeOf(TDLLVersionInfo);
 FillChar(dvi,SizeOf(TDLLVersionInfo),0);

:-)

Regards, Madshi.
0
 
brainwareAuthor Commented:
Well many thanks..

BTW, you could have accept my comment as an answer, too..
Huh???

Anyways.. just wondering.. do u know how to get Version info from DirectX Dlls too? they dont use GetDllVersion :(
0
 
MadshiCommented:
Look at GetFileVersionInfo.

Michael, if you have asked a question and no answer is waiting (or accepted), you will find the possibility to accept any comment as the answer (in the right top of the comment). So you don't need to ask the experts to post an answer anymore...   :-)

Regards, Madshi.
0
 
brainwareAuthor Commented:
oh oki.. didnt notice that..
mabye bacuse i dislike the new look so much ehhe..
again thank.. PS: i send a Email to ya..
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 5
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now