[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

geting version number, compnay name of EXE files (not using API).

Posted on 1999-01-13
10
Medium Priority
?
235 Views
Last Modified: 2013-12-03
How can I read version number and company name of an EXE or DLL file.
I know there are API calls to do this but my program has to run in dos when windows is not running.
What is the structure of windows EXE header and where can I find books or source code to do what I want?
0
Comment
Question by:mohanad
[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
10 Comments
 

Author Comment

by:mohanad
ID: 1418639
Edited text of question
0
 

Author Comment

by:mohanad
ID: 1418640
Edited text of question
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1418641
Information about Windows EXE file you can find in Book:
Tom Swan "Inside Windows File Formats", 15 Chapter.
For get Version,exe file,and other parameter you must read RES_VERSION part of EXE file. In windows there are some API in VER.DLL, that returns this information:
you can see names in ver.h
But in Dos....
I am afraid, that you must write same functions and that is
not easy. Can be you can use Console Application.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 1

Expert Comment

by:dnavarro
ID: 1418642
Can you read BASIC code?  If so, you have to call GetFileVersionInfo() and VerQueryValue().

$RESOURCE "VERINFO.PBR"
$INCLUDE  "WIN32API.INC"

FUNCTION MakeVerStr(BYVAL VerNumMS AS LONG, BYVAL VerNumLS AS LONG) AS STRING

  LOCAL Major AS INTEGER
  LOCAL Minor AS INTEGER
  LOCAL temp  AS STRING

  Major = VerNumMS \ &H10000
  Minor = VerNumMS AND &HFFFF&

  temp  = FORMAT$(Major) & "."

  IF Minor < 10 THEN
    temp = temp & "0"
  END IF

  temp = temp & FORMAT$(Minor)

  IF VerNumLS THEN
    temp = temp & " Build" & STR$(VerNumLS)
  END IF

  FUNCTION = temp

END FUNCTION

FUNCTION PbMain() AS LONG

  LOCAL file AS ASCIIZ * 256
  LOCAL info AS ASCIIZ * 64
  LOCAL t    AS ASCIIZ PTR
  LOCAL ffi  AS VS_FIXEDFILEINFO PTR

  file = COMMAND$

  IF LEN(file) = 0 THEN
    STDOUT "VERINFO.EXE - Display version information"
    STDOUT "Copyright (c) 1998 PowerBASIC, Inc."
    STDOUT ""
    STDOUT "Usage: VERINFO filename"
    FUNCTION = 1
    EXIT FUNCTION
  END IF

  IF LEN(DIR$(file)) = 0 THEN
    STDOUT "Error! " & file & " not found."
    EXIT FUNCTION
  END IF

  STDOUT "Version info for " & file

' ** Allocate a buffer for the version info data
  size& = GetFileVersionInfoSize(file, z&)

  IF size& = 0 THEN
    STDOUT "No version resource available."
    EXIT FUNCTION
  END IF

  Buffer$ = SPACE$(size&)

' ** Get the version info data into the buffer
  GetFileVersionInfo file, z&, size&, BYVAL STRPTR(Buffer$)

' ** Read the company name from the buffer
  VerQueryValue BYVAL STRPTR(Buffer$), "\StringFileInfo\040904E4\CompanyName", t, z&

' ** Display it on the screen
  STDOUT "    Company name: " & @t

' ** Read the copyright from the buffer
  VerQueryValue BYVAL STRPTR(Buffer$), "\StringFileInfo\040904E4\LegalCopyright", t, z&

' ** Display it on the screen
  STDOUT " Legal Copyright: " & @t

' ** Read the VS_FIXEDFILEINFO info
  VerQueryValue BYVAL STRPTR(Buffer$), "\", ffi, z&

  ' Now build the output report
  STDOUT " Product version: " & MakeVerStr(@ffi.dwProductVersionMS, @ffi.dwProductVersionLS)

END FUNCTION

0
 

Author Comment

by:mohanad
ID: 1418643
Thanks for the reply, but I would like to be able to reas the version infomration of a Windows EXE fil, file from DOS, DOS, DOS, program not using API calls, all the replys I have been getting are using API calls.
Can any body out thier help me please?
0
 

Author Comment

by:mohanad
ID: 1418644
Thnaks for the reply, but my quastion still not answered.
I would like to able to read version information of a Windows EXE files from  a DOS, DOS, DOS program not using Windows and API.
All the replys been getting are Windows Code, can any one out there give the source code and to read exe version info from DOS.
This is VVVery important, thanks.
M.Shurrab
0
 

Expert Comment

by:ddgamer
ID: 1418645
If you are needing the info from the PE format then you can find a thorough description at the following:

http://www.microsoft.com/win32dev/base/pefile.htm

Hope it helps.
0
 

Author Comment

by:mohanad
ID: 1418646
Thanks all for the replys, but may quastion is still not answered: I would like to run my progrm form DOS,DOS,DOS and not using any windows api calls.
The program should be able to read the verion information such as compnay name, verion, etc. (i.e read the windows header from a dos program).
Thanks

0
 
LVL 3

Accepted Solution

by:
luisr earned 200 total points
ID: 1418647
Send me an e-mail and I'll give you some code that does it. Actually is Windows code, but it accesses the version resource by parsing the executable file, not through Windows API class.

My e-mail is luisr@iname.com
0
 
LVL 3

Expert Comment

by:luisr
ID: 1418648
Have you tested the code that I sent you? Did it work?
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

649 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