Question for Custom StringFileInfo ?

DangDKhanh-2637 941 Reputation points
2021-01-19T09:19:06.133+00:00

Hi Expert,

After building some free utilities, I want to write some information to the exported .dll file.
I am customizing file.rc and want to add author information as well as URL like image, however after build, output file is empty these field (while other field have been added).
I want to ask how do I correctly write these information and these field supported?
58007-screenshot-2.png

Thanks you!

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,448 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,562 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Drake Wu - MSFT 991 Reputation points
    2021-01-20T03:35:56.093+00:00

    Hi @DangDKhanh-2637 , If you want to display your custom values in file > properties > Details, you will not be able to achieve, see this answer on stackoverflow.

    The values that are displayed are hard-coded in the shell and the shell simply will not parse your resource and look for values that it knows nothing about.

    You need to use VerQueryValue to get your custom value, like:

    	DWORD handle = 0;  
    	TCHAR file[] = L"C:\\test.dll";  
    	DWORD len = GetFileVersionInfoSize(file, &handle);  
    	LPVOID pdata = malloc(len);  
      
    	GetFileVersionInfo(file, 0, len, pdata);  
      
    	LPVOID lpBuffer = NULL;  
    	UINT length = 0;  
    	VerQueryValue(pdata, L"\\StringFileInfo\\040904b0\\Authors", &lpBuffer, &length);  
    	printf("%S\n", lpBuffer);  
    

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.