Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good afternoon I need to grab some information from a process, such as FileVersionInfo.FileDescription FileVersionInfo.ProductName and a 64-bit process, is it possible? when is a 32-bit process on how I can get this in the if, but it is a 64-bit process this information comes FileVersionInfo.FileDescription such as zero

C#
 if (32BitProcess)
{
    descricaoArquivo = Process.MainModule.FileVersionInfo.FileDescription;
    nomePrograma = Process.MainModule.FileVersionInfo.ProductName;
}
else
{
    nomePrograma =        Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
    descricaoArquivo = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().FullName);
}
Posted
Comments
Sergey Alexandrovich Kryukov 3-Dec-13 9:30am    
It looks like you are dealing only with the current process, not an external process. Is that right? There is not difference between 32-bit and 64-bit target architectures, in this respect. Just don't do this "if"...
—SA
Rafabiel 3-Dec-13 9:42am    
actually works this way, every time I switch between windows, it takes the active process and give me this information, such as name of the executable and the location of it, but when is a 64-bit process and Some modules of this process is zero, them only when it is a 32-bit process
Rafabiel 3-Dec-13 9:49am    
I think it would be easier if I could get the folder of the executable from the name of the process??
Sergey Alexandrovich Kryukov 3-Dec-13 10:13am    
You did not answer my question. Is this the current process? What do you want to achieve, ultimately?
—SA
Rafabiel 3-Dec-13 10:18am    
yes, is the current process

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900