{"id":21070825,"url":"https://github.com/fafalone/setpeimageprops","last_synced_at":"2025-04-12T21:06:03.027Z","repository":{"id":229781379,"uuid":"777604017","full_name":"fafalone/SetPEImageProps","owner":"fafalone","description":"Set PE Image Header Properties","archived":false,"fork":false,"pushed_at":"2024-03-26T07:48:04.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T21:05:58.926Z","etag":null,"topics":["build-tool","pe-file","pe-format","twinbasic","vb6","windows"],"latest_commit_sha":null,"homepage":"","language":"Visual Basic 6.0","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fafalone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-26T06:58:04.000Z","updated_at":"2024-08-08T19:22:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"8087e2ab-15c8-410a-8b51-e128ce1c5d5c","html_url":"https://github.com/fafalone/SetPEImageProps","commit_stats":null,"previous_names":["fafalone/setpeimageprops"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FSetPEImageProps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FSetPEImageProps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FSetPEImageProps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FSetPEImageProps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fafalone","download_url":"https://codeload.github.com/fafalone/SetPEImageProps/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631684,"owners_count":21136562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","pe-file","pe-format","twinbasic","vb6","windows"],"created_at":"2024-11-19T18:48:29.860Z","updated_at":"2025-04-12T21:06:03.005Z","avatar_url":"https://github.com/fafalone.png","language":"Visual Basic 6.0","readme":"# SetPEImageProps\nSet PE Image Header Properties\n\nmodSetPEImageProps.twin is a module designed to be dropped into a twinBASIC project, after which it automatically modifies the compiled binaries right after they're built, using tB's `[RunAfterBuild]` attribute. \n\nI wanted to investigate whether the default version values tB applies were causing issues, so made this as a temporary solution until these options can be set by tB itself. Currently this module can adjust the following in the `IMAGE_OPTIONAL_HEADER`:\n\n* Linker version\n* Operating system version\n* Image version\n* Subsystem version\n* Win32VersionValue (should probably not change)\n* DllCharacteristics\n\n  twinBASIC sets the linker version to 6.0, which is associated with Visual Studio 6.0, and what I think might be more of an issue, it sets the OS version and subsystem version to 4.0 (Windows NT 4.0), while these are almost always set higher when compiling with other tools. Image version is often set to the same as those two, but is sometimes left as 1.0 (tB default as well). With the configuration provided in the code as posted here, the linker is set to 7.0 just to disassociate it from VS6, and the OS/Image/Subsystem versions are all set to 10.0. tB already supports setting the actual subsystem (GUI, CUI, or Native), so that's not currently included.\n\n  The other set of options included is to modify the `DllCharacteristics` field. I need to set one of these for one of my driver projects, but usually you should just leave it alone. Just adding a flag doesn't add support for a feature, so if you e.g. enable the control flow guard, it will likely result in crashing.\n\n  The design is fairly straightforward, should you want to modify any other fields. Again, this just hard codes values in the header, it won't change the code, and you don't want a mismatch. The actual function takes an optional path argument so you can call it manually at any time to adjust any file, but the automatic modification was my main goal here. It can handle bitness mismatches if you do call it manually.\n\n![image](https://github.com/fafalone/SetPEImageProps/assets/7834493/77e66fd9-9d18-4e89-80aa-47770129ba4d)\n\n**Requirements**\nThis module relies on my Windows Development Library for twinBASIC package being added.\n\n  \u003e [!IMPORTANT]\n  \u003e **Requires an updated WinDevLib!** If you drop the module into an existing project, you must also update WinDevLib if you're already using it, as there were bugs that would result in a corrupt exe using this in 64bit mode.\n\n---\n\nConfiguration:\n\n  ```vba\n  #Const MASTER_ENABLE = 1\n\n#Const ENABLE_OPT_HEADER_VERSIONING = 1\nPrivate Const MajorLinkerVersion As Byte = 7 'Default: 6\nPrivate Const MinorLinkerVersion As Byte = 0 'Default: 0\nPrivate Const MajorOperatingSystemVersion As Integer = 10 'Default: 4 (4.0 - Windows NT 4.0)\nPrivate Const MinorOperatingSystemVersion As Integer = 0 'Default: 0\nPrivate Const MajorImageVersion As Integer = 10 'Default: 1\nPrivate Const MinorImageVersion As Integer = 0 'Default: 0\nPrivate Const MajorSubsystemVersion As Integer = 10 'Default: 4 (4.0 - Windows NT 4.0)\nPrivate Const MinorSubsystemVersion As Integer = 0 'Default: 0\nPrivate Const Win32VersionValue As Long = 0 'Default: 0\n\n#Const ENABLE_OPT_HEADER_DLL_CHARACTERISTICS = 0\nPrivate Const DLLCHARACTERISTICS_HIGH_ENTROPY_VA = 0 'Default: 0  ' Image can handle a high entropy 64-bit virtual address space.\nPrivate Const DLLCHARACTERISTICS_DYNAMIC_BASE = 1 'Default: 1  ' DLL can move.\nPrivate Const DLLCHARACTERISTICS_FORCE_INTEGRITY = 0 'Default: 0  ' Code Integrity Image\nPrivate Const DLLCHARACTERISTICS_NX_COMPAT = 0 'Default: 0  ' Image is NX compatible\nPrivate Const DLLCHARACTERISTICS_NO_ISOLATION = 0 'Default: 0  ' Image understands isolation and doesn't want it\nPrivate Const DLLCHARACTERISTICS_NO_SEH = 1 'Default: 1 ' Image does not use SEH.  No SE handler may reside in this image\nPrivate Const DLLCHARACTERISTICS_NO_BIND = 0 'Default: 0  ' Do not bind this image.\nPrivate Const DLLCHARACTERISTICS_APPCONTAINER = 0 'Default: 0  ' Image should execute in an AppContainer\nPrivate Const DLLCHARACTERISTICS_WDM_DRIVER = 0 'Default: 0  ' Driver uses WDM model\nPrivate Const DLLCHARACTERISTICS_GUARD_CF = 0 'Default: 0  ' Image supports Control Flow Guard.\nPrivate Const DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0 'Default: 0\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffafalone%2Fsetpeimageprops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffafalone%2Fsetpeimageprops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffafalone%2Fsetpeimageprops/lists"}