Skip to content

add winos.file_signature function to retrieve file signature information#7326

Closed
luadebug wants to merge 54 commits intoxmake-io:devfrom
luadebug:sign
Closed

add winos.file_signature function to retrieve file signature information#7326
luadebug wants to merge 54 commits intoxmake-io:devfrom
luadebug:sign

Conversation

@luadebug
Copy link
Member

@luadebug luadebug commented Feb 15, 2026

TODO that still does not work.

Moved here from tboox/tbox#308

Resolves: #5629

Idea is that we can check for signature owner name GIGA-BYTE ... and if that is it and executable name is GCC.exe we should skip/filter out that .exe from find_tool("gcc")/find_gcc function at that case.

Currently I see:
image
Certainly mine wrapper over find_gcc/find_tool might be not correct... :/

image image

Yet they should return void or either another GCC.exe. Maybe this would work or maybe not.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @luadebug, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the winos module by adding the capability to programmatically query digital signature information for executable files on Windows. This new feature provides valuable security context, allowing applications to verify the authenticity and integrity of files by checking their digital signatures and trust status.

Highlights

  • New Functionality: A new winos.file_signature function has been introduced, allowing users to retrieve digital signature information for files on Windows.
  • Signature Details: The file_signature function returns whether a file is signed, if the signature is trusted by the OS, and the name of the signer.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • core/src/xmake/engine.c
    • Declared the xm_winos_file_signature function.
    • Registered xm_winos_file_signature in the g_winos_functions table to expose it to Lua.
  • core/src/xmake/winos/file_signature.c
    • Added a new source file implementing the xm_winos_file_signature function.
    • Implemented logic to use Windows CryptoAPI functions (WinVerifyTrust, CryptQueryObject, CertGetNameStringW) to extract file signature details.
    • Defined a tb_file_signature_info_t structure to hold signature status (is_signed, is_trusted) and signer name.
    • Provided a Lua binding that takes a file path and returns a table containing the signature information.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new winos.file_signature function to retrieve file signature information on Windows. The implementation correctly uses the WinVerifyTrust and CryptoAPIs to check the signature and extract the signer's name.

I've provided a couple of suggestions. One is a high-severity security improvement to enable certificate revocation checks, which are currently disabled. The other is a medium-severity suggestion to refactor a section of the code to improve its readability and maintainability by using a goto-based cleanup pattern.

Overall, this is a good addition. Please consider the feedback to make the new function more robust and secure.

@luadebug
Copy link
Member Author

OK I think it is ready to review.

@luadebug
Copy link
Member Author

luadebug commented Feb 15, 2026

CC: @waruqi

  1. Test, GCC.exe will be fetched first from PATH according to Windows OS behavior. But here it fetches second gcc.exe without GIGA-BYTE signature.
image
  1. Test there is only GCC.exe with GIGA-BYTE signature so it should return nil.
image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


CC: @waruqi

Added reference to GitHub issue regarding GIGA-BYTE signed gcc.exe.
@luadebug
Copy link
Member Author

Arch Linux fail is false positive here.

@waruqi
Copy link
Member

waruqi commented Feb 20, 2026

Does it work now?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Does it work now?

@luadebug
Copy link
Member Author

Does it work now?

I can't test for now. I will look into that later maybe. Currently mine Oracle VirtualBox has broken and I am installing Windows 11 24H2 via virt-manager instead of Oracle VirtualBox. Sorry.

@luadebug
Copy link
Member Author

luadebug commented Feb 20, 2026

Does it work now?

Well looks good to go...

image

@luadebug luadebug closed this Feb 20, 2026
@waruqi
Copy link
Member

waruqi commented Feb 20, 2026

?

@luadebug
Copy link
Member Author

?

I broke branch accidentally.

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.

xmake会将技嘉主板的管理面板误认为是gcc

3 participants

Comments