Announcement

Collapse
No announcement yet.

(non) visibility of resource file info?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    (non) visibility of resource file info?

    Using ProcessExplorer from SysInternals, I am able to see what processes are running (and do lots of other stuff..). Among other things, it displays the Description and Company Name of each process.

    ...Except for programs I compile with PB. These show up in the list, but without a Description or Company Name.

    I have tried to include such strings in a .RC file (yes, I've done: .RES, .PBR, #include...) but they are not detected or displayed by PE.

    I have tried adding variations (changing the standard "FileDescription" to just "Description", etc.), but none of these variations are being detected either.

    I have also used Paul Squire's excellent FireFly program, filling in all the Project Properties... no success with this either...

    When I examine the .EXEs with a file viewer, I can see the string data, so I know it's being included at all times.

    However, something is preventing PE from detecting it.

    Has anyone else noticed this, and perhaps have an explanation?

    Thanks,
    -John (most definitely a Business Analyst, and only a "hobbyist" programmer)

    #2
    Does it show anything if you right-click on the .exe and look under 'Properties'?
    (Maybe you could post a non-working example?)
    Regards,
    Peter

    "Simplicity is a prerequisite for reliability"

    Comment


      #3
      Do the extra string data show up when using Windows' (File) Explorer, right click, properties, version info?

      Mine do on PB-compiled PE files.

      Sounds like something 'ProcessExplorer' is doing.
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


        #4
        Originally posted by Peter Lameijn View Post
        Does it show anything if you right-click on the .exe and look under 'Properties'?
        (Maybe you could post a non-working example?)

        In PE and right-clicking Properites, the info does not display under either the "Image" tab, nor can it be found under the "Strings" tab...

        Here's the .rc file:

        Code:
        // The first section is my bastardizing examples found on MSDN site:
        //            http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
        // The second section is what I started with that didn't seem to work...
        
        // The following Include allows RC to satisfy:  VOS__WINDOWS32
        #include "e:\win32api\resource.h"
        
        //---------------------------------------------------------------
        //From the MSDN website:
        #define VER_FILEVERSION             0,0,0,1
        //#define VER_FILEVERSION_STR         "0.0.0.1\0"
        
        #define VER_PRODUCTVERSION          1,0,0,0
        //#define VER_PRODUCTVERSION_STR      "1.0\0"
        
        /*
        #ifndef DEBUG
        #define VER_DEBUG                   0
        #else
        #define VER_DEBUG                   VS_FF_DEBUG
        #endif
        */
        
        
        #define VER_COMPANYNAME_STR        "JMCC, LLC.\0"
        #define VER_FILEDESCRIPTION_STR    "Process Killer\0"
        #define VER_FILEVERSION_STR        "0.0.0.1\0"
        #define VER_INTERNALNAME_STR       "jkp\0"
        #define VER_LEGALCOPYRIGHT_STR     "Copyright 2008 ©, John H. Montenigro. ALL RIGHTS RESERVED.\0"
        //#define VER_LEGALTRADEMARKS1_STR   "
        //#define VER_LEGALTRADEMARKS2_STR   "
        #define VER_ORIGINALFILENAME_STR   "jkp.exe\0"
        #define VER_PRODUCTNAME_STR        "John's Kill Process\0"
        #define VER_PRODUCTVERSION_STR     "1.0\0"
        
        VS_VERSION_INFO VERSIONINFO
        FILEVERSION       VER_FILEVERSION
        PRODUCTVERSION    VER_PRODUCTVERSION
        //FILEFLAGSMASK      VS_FFI_FILEFLAGSMASK
        //FILEFLAGS          (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
        FILEOS            VOS__WINDOWS32
        //FILETYPE           VFT_DLL
        FILETYPE          VFT_APP
        FILESUBTYPE       VFT2_UNKNOWN
        BEGIN
            BLOCK "StringFileInfo"
            BEGIN
                BLOCK "040904E4"
                BEGIN
                    VALUE "CompanyName",      VER_COMPANYNAME_STR
                    VALUE "FileDescription",  VER_FILEDESCRIPTION_STR
                    VALUE "FileVersion",      VER_FILEVERSION_STR
                    VALUE "InternalName",     VER_INTERNALNAME_STR
                    VALUE "LegalCopyright",   VER_LEGALCOPYRIGHT_STR
        //            VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
        //            VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
                    VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
                    VALUE "ProductName",      VER_PRODUCTNAME_STR
                    VALUE "ProductVersion",   VER_PRODUCTVERSION_STR
                END
            END
        END
        //---------------------------------------------------------------
        
        
        
        //  Second section; what I started with (that didn't seem to work)
        /*
        VS_VERSION_INFO VERSIONINFO
        Begin
        BLOCK "StringFileInfo"
           Begin
              VALUE "CompanyName", "JMCC, LLC\0"
              VALUE "FileDescription", "Process Killer\0"
              VALUE "FileVersion", "0.0.0.1\0"
              VALUE "InternalName", "jkp\0"
              VALUE "OriginalFilename", "jkp.exe\0"
              VALUE "LegalCopyright", "Copyright 2008 ©, John H. Montenigro. ALL RIGHTS RESERVED.\0"
              VALUE "ProductName", "John's Kill Process\0"
              VALUE "ProductVersion", "0.1.0.0\0"
              VALUE "LegalTrademarks", "John H. Montenigro\0"
              VALUE "Comments", "combined from many PB Forum samples\0"
           End
        End
        */
        
        ICON1 ICON jhmKillProcess.ICO

        Comment


          #5
          Originally posted by Michael Mattias View Post
          Do the extra string data show up when using Windows' (File) Explorer, right click, properties, version info?

          Mine do on PB-compiled PE files.

          Sounds like something 'ProcessExplorer' is doing.
          Yes, and under the "Version" tab, I am able to click on all other variables and see their proper values... (I've been using PE for so long, I didn't remember that Windows Explorer could show EXE FileInfo strings...)

          OK, so then, what is PE doing??????

          I can't even venture an intelligent guess...

          Comment


            #6
            Your second version resource is missing (at least)...
            Code:
            //FILETYPE           VFT_DLL
            FILETYPE          VFT_APP
            .. and the language identifier.
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


              #7
              Hi John,
              I never noticed it before myself, so I fired up SysInternals Process Explorer and checked for my software, and sure enough no description or company name.

              Then I tried the PB "Hello World" and it showed up....so I wondered what was different about their *.rc file, and mine, and then I noticed the hello world rc had
              Code:
              BEGIN
                  BLOCK "StringFileInfo"
                  BEGIN
                      BLOCK "040904B0"
                      BEGIN
                          VALUE "Comments", "Hello, World!\0"
                          VALUE "CompanyName", "PowerBASIC, Inc.\0"
                          VALUE "FileDescription", "Simple MSGBOX Application for Windows\0"
                          VALUE "FileVersion", "8.00\0"
                          VALUE "InternalName", "HELLO\0"
                          VALUE "LegalCopyright", "Copyright \251 1996-2005 PowerBASIC, Inc."
                              "\0"
                          VALUE "LegalTrademarks", "PowerBASIC is a trademark of PowerBASIC, "
                              "Inc.\0"
                          VALUE "OriginalFilename", "HELLO.EXE\0"
                          VALUE "ProductName", "PowerBASIC for Windows\0"
                          VALUE "ProductVersion", "8.0\0"
                      END
                  END
              [b]
                  BLOCK "VarFileInfo"
                  BEGIN
                      VALUE "Translation", 0x409, 0x4B0
                  END
              [/b]
              END
              where mine did not have the translation....once I added it, the Company name and description appeared in process explorer.
              Engineer's Motto: If it aint broke take it apart and fix it

              "If at 1st you don't succeed... call it version 1.0"

              "Half of Programming is coding"....."The other 90% is DEBUGGING"

              "Document my code????" .... "WHYYY??? do you think they call it CODE? "

              Comment


                #8
                Originally posted by Cliff Nichols View Post
                Code:
                [b]
                    BLOCK "VarFileInfo"
                    BEGIN
                        VALUE "Translation", 0x409, 0x4B0
                    END
                [/b]
                END
                where mine did not have the translation....once I added it, the Company name and description appeared in process explorer.

                First I added that block and compiled, etc but still no success.

                Then I realized that the value of "Translation" had to match the value of the hex string following BLOCK, within the StringFileInfo block...

                I did a LOT of reading but didn't see anything on this; it was your sample code, a lot of asking "what's this for? what's this doing? why is this here? what happens IF I do this..." and a healthy dose of dumb luck.

                But it sure put a smile on my face to see my process and company names finally show up on PE's list!!

                Thank you all for your help!
                -John

                Comment


                  #9
                  John you noticed what I noticed (unfortunately I have not had a chance to research why) but
                  BLOCK "040904B0"
                  must mean something but until I can research no idea

                  Must be in the docs somewhere...but I never got to learn how resource files work (beyond working) to question it...but now I gotta know

                  Engineer's Motto: If it aint broke take it apart and fix it

                  "If at 1st you don't succeed... call it version 1.0"

                  "Half of Programming is coding"....."The other 90% is DEBUGGING"

                  "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                  Comment


                    #10
                    PB windows "Bin" directory, file RC.HLP
                    Or Start/Programs/PBWindowsYourVersion/Resource Compiler help

                    Find "block"
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                      #11
                      Code:
                      //----------------------
                      //The following example is from: http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
                      //----------------------
                      
                      #define VER_FILEVERSION             3,10,349,0
                      #define VER_FILEVERSION_STR         "3.10.349.0\0"
                      
                      #define VER_PRODUCTVERSION          3,10,0,0
                      #define VER_PRODUCTVERSION_STR      "3.10\0"
                      
                      #ifndef DEBUG
                      #define VER_DEBUG                   0
                      #else
                      #define VER_DEBUG                   VS_FF_DEBUG
                      #endif
                      
                      VS_VERSION_INFO VERSIONINFO
                      FILEVERSION    	VER_FILEVERSION
                      PRODUCTVERSION 	VER_PRODUCTVERSION
                      FILEFLAGSMASK  	VS_FFI_FILEFLAGSMASK
                      FILEFLAGS      	(VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
                      FILEOS         	VOS__WINDOWS32
                      FILETYPE       	VFT_DLL
                      FILESUBTYPE    	VFT2_UNKNOWN
                      BEGIN
                          BLOCK "StringFileInfo"
                          BEGIN
                              BLOCK "040904E4"
                              BEGIN
                                  VALUE "CompanyName",      VER_COMPANYNAME_STR
                                  VALUE "FileDescription",  VER_FILEDESCRIPTION_STR
                                  VALUE "FileVersion",      VER_FILEVERSION_STR
                                  VALUE "InternalName",     VER_INTERNALNAME_STR
                                  VALUE "LegalCopyright",   VER_LEGALCOPYRIGHT_STR
                                  VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
                                  VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
                                  VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
                                  VALUE "ProductName",      VER_PRODUCTNAME_STR
                                  VALUE "ProductVersion",   VER_PRODUCTVERSION_STR
                              END
                          END
                      
                          BLOCK "VarFileInfo"
                          BEGIN
                              /* The following line should only be modified for localized versions.     */
                              /* It consists of any number of WORD,WORD pairs, with each pair           */
                              /* describing a language,codepage combination supported by the file.      */
                              /*                                                                        */
                              /* For example, a file might have values "0x409,1252" indicating that it  */
                              /* supports English language (0x409) in the Windows ANSI codepage (1252). */
                      
                              VALUE "Translation", 0x409, 1252
                      
                          END
                      END
                      
                      
                      
                      //----------------------
                      //The following data comes from: http://msdn.microsoft.com/en-us/library/aa381049(VS.85).aspx
                      //----------------------
                      
                      /*
                      StringFileInfo Block
                      
                      A string information block has the following form:
                      
                      
                       Copy Code
                      BLOCK "StringFileInfo" { BLOCK "lang-charset" {VALUE "string-name", "value" . . . }}
                      
                      lang-charset 
                      Language and character-set identifier pair. It is a hexadecimal string consisting of the concatenation of the language and character-set identifiers specified in the Remarks section.
                      
                      string-name 
                      Name of a value in the block and can be one of the predefined names specified in the Remarks section.
                      
                      value 
                      Character string that specifies the value of the corresponding string name. More than one VALUE statement can be given.
                      */
                      
                      
                      //---------------
                      //The following info comes from:  http://msdn.microsoft.com/en-us/library/aa381057(VS.85).aspx
                      //----------------------
                      
                      /*
                      VarFileInfo Block
                      
                      A variable information block has the following form:
                      
                      
                       Copy Code
                      BLOCK "VarFileInfo" { VALUE "Translation", langID, charsetID . . . }
                      langID 
                      One of the language identifiers specified in the Remarks section.
                      
                      charsetID 
                      One of the character-set identifiers specified in the Remarks section.
                      */

                      Michael,

                      Your point is well taken. As a hobbyist programmer, I don't code much, and what little I do, rarely requires a Resource file. (Or, perhaps, I haven't learned yet how to use them well?) In any case, I do tend to use what is easiest to use, and in my experience, I have found it simplest to compile an .RC file directly through the IDE. I didn't realize there was an RC helpfile, because I never see the RC itself. My oversight.

                      However, I did my earlier research on the MSDN itself, which in fact is what the RC help takes us to.

                      And on the MSDN site, I did a search on StringFileInfo, which me precious little to go on. I did browse around, and the extracts above show what I found.

                      Notice that where the language codes are mentioned, it says that they refer to identifiers "specified in the Remarks section" or that "can be one of the predefined names specified in the Remarks section". I never understood the meaning of "can" to denote a requirement.

                      Also notice that the prototype shows the language string enclosed in curly braces which, in my 20-year career as a Tech Writer documenting software, has always indicated "optional". If that meaning has changed, I missed the announcement. So, I decided to go with the default (which is what one usually gets when not using an optional parameter), expecting the compiler to use the current language as set locally on my machine.

                      Also notice that in any mention of the language code, there IS NO MENTION THAT THE CODES MUST MATCH. Or, for that matter, why one would want to/need to include them. Simply put, no connection whatsoever is made between the language code string that follows BLOCK, and any requirement for including a matching string in VarFileInfo.

                      Rather, there is a warning that the codes "should only be modified for localized versions", and since I'm not doing that, I take it to mean I can leave them as shown.

                      However, I realize I made an error of omission by not noticing that the value in the line: BLOCK "040904E4"
                      was identical to the value in this line: VALUE "Translation", 0x409, 1252
                      and concluding that there is a requirement to include both lines as well as to make them match.

                      The writer here wasn't going for clarity, eh? But, yes, I admit it: I missed what wasn't being pointed out. But it wasn't for lack of effort.

                      Let us not forget that, as someone on these forums is so fond of pointing out, if it's not in the documentation, it's not there.

                      . . .

                      But now we've got it explained, and it's here for posterity. May those who come after us avoid the terrible mistakes I've made here, and live long and prosperous lives!

                      -John

                      Comment


                        #12
                        You are probably confused because you have never seen a multi-block version resource.
                        The VarFileInfo section describes the variable information part of the resource. The
                        variable information, "Translation", describes which languages are supported by the file.
                        The string, "Translation", is followed by a series of paired numbers. The first number
                        in a pair is the language ID for which a StringFileInfo section exists. The second
                        number in the pair is the character set for which the StringFileInfo section exists.

                        The StringFileInfo section can be divided into multiple blocks, one block for each
                        language and character set specified in the VarFileInfo section.

                        For example, a version resource that supports French and English, as generated by the
                        Phoenix Visual Designer, will look like this

                        Code:
                        VS_VERSION_INFO VERSIONINFO
                        FILEVERSION 1,0,0,0
                        PRODUCTVERSION 1,0,0,0
                        FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
                        FILEFLAGS 0x0L
                        FILESUBTYPE 0x0L
                        BEGIN
                          BLOCK "StringFileInfo"
                          BEGIN
                            BLOCK "040904E4"  // Lang=English (United States), CharSet=Windows, Multilingual
                            BEGIN
                              VALUE "Comments", "Developed by Dominic Mitchell - Prometheus Software\r\nMississauga\0"
                              VALUE "CompanyName", "Prometheus Software\0"
                              VALUE "FileDescription", "Phoenix Tree Control\0"
                              VALUE "FileVersion", "1.0.0.0\0"
                              VALUE "InternalName", "Tree2D\0"
                              VALUE "LegalCopyright", "Copyright (c) 2008\0"
                              VALUE "LegalTrademarks", " \0"
                              VALUE "OriginalFilename", "Tree2D.dll\0"
                              VALUE "ProductName", "Tree Control\0"
                              VALUE "ProductVersion", "1.0.0.0\0"
                            END
                            BLOCK "040C04E4"  // Lang=French (France), CharSet=Windows, Multilingual
                            BEGIN
                              VALUE "Comments", "Développé par Dominic Mitchell - Prometheus Software\r\nMississauga\0"
                              VALUE "CompanyName", "Prometheus Software\0"
                              VALUE "FileDescription", "Phoenix arbre de contrôle\0"
                              VALUE "FileVersion", "1.0.0.0\0"
                              VALUE "InternalName", "Tree2D\0"
                              VALUE "LegalCopyright", "Copyright (c) 2008\0"
                              VALUE "LegalTrademarks", " \0"
                              VALUE "OriginalFilename", "Tree2D.dll\0"
                              VALUE "ProductName", "Arbre de contrôle\0"
                              VALUE "ProductVersion", "1.0.0.0\0"
                            END
                          END
                          BLOCK "VarFileInfo"
                          BEGIN
                            VALUE "Translation", 0x409, 1252, 0x40C, 1252
                          END
                        END
                        Last edited by Dominic Mitchell; 3 Sep 2008, 09:02 AM.
                        Dominic Mitchell
                        Phoenix Visual Designer
                        http://www.phnxthunder.com

                        Comment


                          #13
                          Dominic,
                          Thanks for the explicit example with explanation.

                          You are probably confused because you have never seen a multi-block version resource.
                          Up until your posting, quite correct! Any rc files I've seen were either those generated by FireFly, or the barest minimum: ICON ICON filename.ico

                          Until Cliff posted his code, I had not seen a complete example (even a simple one-language example), but to see a two-language example brings it all together.

                          Your example also shows that all the #DEFINEs I had used in my last posting aren't necessary. I was imitating what I had seen in the MSDN samples, trusting that "the pros" have a good reason for what they'd done even though it may not be obvious to me. So your example confirms that there's nothing wrong with the simpler construction I had originally imitated from FireFly's output. Good to know.


                          Most sample code shows only one narrow example, just enough to validate the minimal case. It's usually not enough to permit recognition of the proper structure or pattern.

                          Your example is "robust": more than the minimum but not too complex. The point is easy to recognize. Really makes a difference!

                          Thanks for taking the time and being thorough.

                          -John

                          Comment

                          Working...
                          X
                          😀
                          🥰
                          🤢
                          😎
                          😡
                          👍
                          👎