i downloaded this class http://www.codeproject.com/file/VersionInfo.asp
i use it to get the file information from a few programs i currently run.
It works fine when i want to information from the program i wrote, but i can't get the file informations of "chrome" or my "visual studio" for example.
when i query the productName of my application i get "Todo:ProductName" because it is not set yet ;)
but when i query the productName of chrome.exe i just get "" nothing.
Does anynone know why?
Edit: i debugged a little and the probleme is here.
BOOL CFileVersionInfo::Open( IN LPCTSTR lpszFileName )
{
if( lpszFileName == NULL )
ASSERT_RETURN( FALSE );
Close();
if( !GetVersionInfo( lpszFileName ) || !QueryVersionTrans() )
Close();
return m_bValid;
};
The GetVersionInfo( lpsz... ) does return 0 when there is "chrome.exe" entered
Edit 2: Yes chrome.exe has an product name field.
example: chrome.exe - File description: Google Chrome - Type: Application - File version: 23.0.1271.97 - Product NAme: Google Chrome - Product Version: 23.0.1271.97 - Copyright: ..blabla... - Size: 1.18MB - Date modified: some_date - Language: English - Original Filename: chrome.exe
Edit 3: How can I get the full path to the exe? I just have the process ID. At the moment iam looping over all processes and search for my processId.
Thanks so far for you answers :-)
How can I get the full path to the exe?
Use OpenProcess() to get a HANDLE
to the process and then use QueryFullProcessImageName() to obtain the full path of the exe.
Remember to check the result of GetLastError()
to determine the reason for failure.