473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Need help with using VerQueryValue

Hi,

I can't get the VerQueryValue function to work for the life of me
(it's returning 0, which means it failed, and I have NO IDEA why!) All
I'm trying to do is get (and print) the file version and product
version of a dll. I am using Visual Studio C++ .NET.

I think I've done all the appropriate things before calling
VerQueryVal, like calling GetFileVersionInfoSize and
GetFileVersionInfo. I want to be able to print out the actual file
version and product version of the dll - how do I do this? Please help
me fix my code, I am desperate!!

My code:

DWORD handle, size;
DWORD *lpTransArray;
LPDWORD word = 0;
char buf[256];
UINT uLen;

size = GetFileVersionInfoSize("c:\\dll\\CNP5E409_D0B81.DL L", word);
cout << "Size (in bytes) is: " << size << endl;

cout << "GetFileVersionInfo() returned: "
<< GetFileVersionInfo("c:\\dll\\CNP5E409_D0B81.DLL",
handle, size, buf)
<< endl;
cout << "GetLastError() returned: " << GetLastError() << endl;

cout << "VerQueryValue() returned: "
<< VerQueryValue(buf, _T("\\VarFileInfo\\Translation"),
(LPVOID*)&lpTransArray, &uLen)
<< endl;

TCHAR szSubblockHeader[25];
_stprintf(szSubblockHeader, _T("\\StringFileInfo\\%04X%04X"),
LOWORD(lpTransArray[0]), HIWORD(lpTransArray[0]));

TCHAR szSubblock[80];
_stprintf(szSubblock, _T("%s\\%s"), szSubblockHeader,
_T("FileVersion"));
LPTSTR lpszValue;
cout << "VerQueryValue() returned: " << VerQueryValue(buf,
szSubblock, (LPVOID *)&lpszValue, &uLen) << endl;
cout << "lpszValue is: " << &lpszValue << endl;

My output:

Size (in bytes) is: 1932
GetFileVersionInfo() returned: 1
GetLastError() returned: 0
VerQueryValue() returned: 0
VerQueryValue() returned: 0
lpszValue is: 0x0012FD6C

Thank you!
Jul 19 '05 #1
1 6308
"Return info" <Ja*************@cda.canon.com> wrote...
I can't get the VerQueryValue function to work for the life of me
(it's returning 0, which means it failed, and I have NO IDEA why!) All
I'm trying to do is get (and print) the file version and product
version of a dll.
There is no VarQueryValue function in standard C++.
I am using Visual Studio C++ .NET.
Then you should consider asking in a newsgroup where this is
on topic, like one of microsoft.public.dotnet.* hierarchy of
public forums. If your server doesn't carry those, connect to
the public server msnews.microsoft.com.
[...]


Victor
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
15
by: drdoubt | last post by:
using namespace std In my C++ program, even after applying , I need to use the std namespace with the scope resolution operator, like, std::cout, std::vector. This I found a little bit...
6
by: seansan | last post by:
Hi, Does anyone know how to read the full access version number in visual basic? I need to know if the current program instance is SR-1 or SP-3, etc... I currently use: DB_DAO =...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.