Skip to content

[WIP] hack: add CompanyName to Windows manifest / metadata#42872

Closed
thaJeztah wants to merge 4 commits intomoby:masterfrom
thaJeztah:windows_metadata
Closed

[WIP] hack: add CompanyName to Windows manifest / metadata#42872
thaJeztah wants to merge 4 commits intomoby:masterfrom
thaJeztah:windows_metadata

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah commented Sep 22, 2021

Pushing as a branch; this is still broken, and we should consider trying to use https://github.com/josephspurrier/goversioninfo instead, which allows using https://github.com/crazy-max/WindowsSpyBlocker/blob/1fc0bc4c0e9567285f3cfc193811f5fed54e8e1c/main.go#L3-L4 / https://github.com/crazy-max/WindowsSpyBlocker/blob/1fc0bc4c0e9567285f3cfc193811f5fed54e8e1c/magefile.go#L309-L344


From https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests

CompanyName
Company that produced the file. For example, "Microsoft Corporation" or
"Standard Microsystems Corporation, Inc."

According to the https://docs.microsoft.com/en-us/windows/win32/menurc/stringfileinfo-block documentation, the following fields are required:

  • CompanyName
  • FileDescription
  • FileVersion
  • InternalName
  • OriginalFilename
  • ProductName
  • ProductVersion

Looking at hack/make/.resources-windows/common.rc and dockerd.rc, we currently set:

  • ProductName (DOCKER_NAME)
  • FileVersion (DOCKER_VERSION)
  • ProductVersion (DOCKER_VERSION)
  • CompanyName (PACKAGER_NAME) (added in this commit)
  • OriginalFileName (DOCKER_COMMIT)

So after this patch, we're still missing:

FileDescription
File description to be presented to users. This string may be displayed in a
list box when the user is choosing files to install?for example, "Keyboard
Driver for AT-Style Keyboards".

InternalName
Internal name of the file, if one exists?for example, a module name if the file
is a dynamic-link library. If the file has no internal name, this string should
be the original filename, without extension.

There's also some optional fields (mentioning them for completeness):

LegalCopyright
Copyright notices that apply to the file. This should include the full text of
all notices, legal symbols, copyright dates, and so on.

LegalTrademarks
Trademarks and registered trademarks that apply to the file. This should include
the full text of all notices, legal symbols, trademark numbers, and so on.

PrivateBuild
Information about a private version of the file?for example, "Built by TESTER1
on TESTBED". This string should be present only if VS_FF_PRIVATEBUILD is
specified in the fileflags parameter of the root block.

SpecialBuild
Text that indicates how this version of the file differs from the standard
version? for example, "Private build for TESTER1 solving mouse problems on M250
and M250E computers". This string should be present only if VS_FF_SPECIALBUILD
is specified in the fileflags parameter of the root block.

With this patch:

PACKAGER_NAME="ACME" DOCKER_VERSION=21.99.9 GITCOMMIT=beefcafe DOCKER_CROSSPLATFORMS=windows/amd64 hack/make.sh cross

This "somewhat" works:

apt-get update && apt-get install exiftool
exiftool bundles/cross/windows/amd64-daemon/dockerd-dev.exe

ExifTool Version Number         : 12.16
File Name                       : dockerd-dev.exe
Directory                       : bundles/cross/windows/amd64-daemon
File Size                       : 52 MiB
File Modification Date/Time     : 2021:09:22 11:58:33+00:00
File Access Date/Time           : 2021:09:22 11:58:34+00:00
File Inode Change Date/Time     : 2021:09:22 11:58:33+00:00
File Permissions                : rwxr-xr-x
File Type                       : Win64 EXE
File Type Extension             : exe
MIME Type                       : application/octet-stream
Machine Type                    : AMD AMD64
Time Stamp                      : 0000:00:00 00:00:00
Image File Characteristics      : Executable, Large address aware, No debug
PE Type                         : PE32+
Linker Version                  : 3.0
Code Size                       : 21667328
Initialized Data Size           : 688640
Uninitialized Data Size         : 0
Entry Point                     : 0x6c600
OS Version                      : 6.1
Image Version                   : 1.0
Subsystem Version               : 6.1
Subsystem                       : Windows command line
File Version Number             : 0.0.0.0
Product Version Number          : 0.0.0.0
File Flags Mask                 : 0x0000
File Flags                      : (none)
File OS                         : Unknown (0)
Object File Type                : Unknown
File Subtype                    : 0
Language Code                   : Neutral
Character Set                   : Unicode
Product Name                    : Docker Engine
File Version                    : dev
Product Version                 : dev
Company Name                    : ACME
Original File Name              : beefcafe

Unfortunately, quoting is a problem; values don't work if they contain a space;

For example, changing DOCKER_VERSION to dev bla, and everything breaks

x86_64-w64-mingw32-windres \
    -i hack/make/.resources-windows/dockerd.rc \
    -o autogen/winresources/dockerd/rsrc_amd64.syso -F pe-x86-64 --use-temp-file \
    -I /tmp/ -D 'DOCKER_VERSION="dev bla"' -D 'DOCKER_COMMIT="712f91d239"'

x86_64-w64-mingw32-gcc: error: bla": No such file or directory
x86_64-w64-mingw32-windres: x86_64-w64-mingw32-gcc exited with status 1

Signed-off-by: Sebastiaan van Stijn <[email protected]>
These parameters were added without documenting them.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
From https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests

    CompanyName
    Company that produced the file. For example, "Microsoft Corporation" or
    "Standard Microsystems Corporation, Inc."

According to that documentation, the following fields are _required_:

- CompanyName
- FileDescription
- FileVersion
- InternalName
- OriginalFilename
- ProductName
- ProductVersion

Looking at hack/make/.resources-windows/common.rc and dockerd.rc, we currently set:

- ProductName (DOCKER_NAME)
- FileVersion (DOCKER_VERSION)
- ProductVersion (DOCKER_VERSION)
- CompanyName (PACKAGER_NAME) (added in this commit)
- OriginalFileName (DOCKER_COMMIT)

So after this patch, we're still missing:

    FileDescription
    File description to be presented to users. This string may be displayed in a
    list box when the user is choosing files to install?for example, "Keyboard
    Driver for AT-Style Keyboards".

    InternalName
    Internal name of the file, if one exists?for example, a module name if the file
    is a dynamic-link library. If the file has no internal name, this string should
    be the original filename, without extension.

There's also some optional fields (mentioning them for completeness):

    LegalCopyright
    Copyright notices that apply to the file. This should include the full text of
    all notices, legal symbols, copyright dates, and so on.

    LegalTrademarks
    Trademarks and registered trademarks that apply to the file. This should include
    the full text of all notices, legal symbols, trademark numbers, and so on.

    PrivateBuild
    Information about a private version of the file?for example, "Built by TESTER1
    on TESTBED". This string should be present only if VS_FF_PRIVATEBUILD is
    specified in the fileflags parameter of the root block.

    SpecialBuild
    Text that indicates how this version of the file differs from the standard
    version? for example, "Private build for TESTER1 solving mouse problems on M250
    and M250E computers". This string should be present only if VS_FF_SPECIALBUILD
    is specified in the fileflags parameter of the root block.

With this patch:

    PACKAGER_NAME="ACME" DOCKER_VERSION=21.99.9 GITCOMMIT=beefcafe DOCKER_CROSSPLATFORMS=windows/amd64 hack/make.sh cross

This "somewhat" works:

    apt-get update && apt-get install exiftool
    exiftool bundles/cross/windows/amd64-daemon/dockerd-dev.exe

    ExifTool Version Number         : 12.16
    File Name                       : dockerd-dev.exe
    Directory                       : bundles/cross/windows/amd64-daemon
    File Size                       : 52 MiB
    File Modification Date/Time     : 2021:09:22 11:58:33+00:00
    File Access Date/Time           : 2021:09:22 11:58:34+00:00
    File Inode Change Date/Time     : 2021:09:22 11:58:33+00:00
    File Permissions                : rwxr-xr-x
    File Type                       : Win64 EXE
    File Type Extension             : exe
    MIME Type                       : application/octet-stream
    Machine Type                    : AMD AMD64
    Time Stamp                      : 0000:00:00 00:00:00
    Image File Characteristics      : Executable, Large address aware, No debug
    PE Type                         : PE32+
    Linker Version                  : 3.0
    Code Size                       : 21667328
    Initialized Data Size           : 688640
    Uninitialized Data Size         : 0
    Entry Point                     : 0x6c600
    OS Version                      : 6.1
    Image Version                   : 1.0
    Subsystem Version               : 6.1
    Subsystem                       : Windows command line
    File Version Number             : 0.0.0.0
    Product Version Number          : 0.0.0.0
    File Flags Mask                 : 0x0000
    File Flags                      : (none)
    File OS                         : Unknown (0)
    Object File Type                : Unknown
    File Subtype                    : 0
    Language Code                   : Neutral
    Character Set                   : Unicode
    Product Name                    : Docker Engine
    File Version                    : dev
    Product Version                 : dev
    Company Name                    : ACME
    Original File Name              : beefcafe

Unfortunately, quoting is a problem; values don't work if they contain a space;

For example, changing `DOCKER_VERSION` to `dev bla`, and everything breaks

    x86_64-w64-mingw32-windres \
        -i hack/make/.resources-windows/dockerd.rc \
        -o autogen/winresources/dockerd/rsrc_amd64.syso -F pe-x86-64 --use-temp-file \
        -I /tmp/ -D 'DOCKER_VERSION="dev bla"' -D 'DOCKER_COMMIT="712f91d239"'

    x86_64-w64-mingw32-gcc: error: bla": No such file or directory
    x86_64-w64-mingw32-windres: x86_64-w64-mingw32-gcc exited with status 1

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Copy Markdown
Member Author

closing in favor of #43431

@thaJeztah thaJeztah closed this Mar 26, 2022
@thaJeztah thaJeztah deleted the windows_metadata branch March 26, 2022 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant