{"id":31701882,"url":"https://github.com/getlantern/winfirewall","last_synced_at":"2025-10-08T21:09:47.860Z","repository":{"id":64847653,"uuid":"41369837","full_name":"getlantern/winfirewall","owner":"getlantern","description":"Control the Windows Firewall from Go, supports Windows XP API and Advanced Security COM API","archived":false,"fork":false,"pushed_at":"2015-08-25T14:59:49.000Z","size":604,"stargazers_count":31,"open_issues_count":0,"forks_count":18,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-04-15T03:25:55.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getlantern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-25T14:58:36.000Z","updated_at":"2024-02-22T03:33:47.000Z","dependencies_parsed_at":"2022-12-17T00:17:09.264Z","dependency_job_id":null,"html_url":"https://github.com/getlantern/winfirewall","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/getlantern/winfirewall","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getlantern%2Fwinfirewall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getlantern%2Fwinfirewall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getlantern%2Fwinfirewall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getlantern%2Fwinfirewall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getlantern","download_url":"https://codeload.github.com/getlantern/winfirewall/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getlantern%2Fwinfirewall/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000716,"owners_count":26082837,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-10-08T21:09:43.523Z","updated_at":"2025-10-08T21:09:47.855Z","avatar_url":"https://github.com/getlantern.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Windows Firewall Interface\n\nThis library provides Go with an interface for managing the Windows Firewall, using the Windows COM interface.\n\n\n## Usage\n\nSee the [test program in Go](cmd/main.go) or the [test program](cmd/main.c) in C.\n\n## Internal documentation\n\n### The C API\n\nNormally Microsoft would expect that you would use the C++ API. Accessing it from C is not well documented, but supported.\n\nIn order to access _netfw.h_ C interface, the `CINTERFACE` and `COBJMACROS` must be used. This will effectively allow you to access the class methods through an interface like this:\n\n```\nClassName_MethodName( Object, Arguments... )\n```\n\nThe C API wraps calls to the old Firewall API (*compat_xp* prefix) and the new *Advanced Security COM API* (*ascom* prefix).\n\n\n### Building the code on MinGW\n\nThe code is largely in C, so a C program is provided for testing the API. Besides defining the `CINTERFACE` and `COBJMACROS`, the following libraries must be included:\n\n* ole32.lib\n* oleaut32.lib\n* hnetcfg.dll\n\nThis last DLL is not provided by MinGW, so it is bundled with the library to allow cross-compilation. This one will provide the symbols normally provided by *FirewallAPI.dll* in more mothern versions of Windows.\n\n\nExample minimal MinGW GCC build line:\n\n```\nmingw-gcc myfile.c -DCINTERFACE -DCOBJMACROS -lole32 -loleaut32 -lhnetcfg\n```\n\nIn Go, configuration should be automatic thorugh CGO, so just providing the right C compiler backend should suffice:\n\n```\nCC=mingw-gcc CGO_ENABLED=1 GOOS=windows GOARCH=386 go build -o cmd/test-go.exe cmd/main.go\n```\n\nAs before, substitute *mingw-gcc* for your MinGW binary.\n\n\n### Files in /doc folder\n\nThis folder keeps some files that should serve for documenting the process, since this library is touching internal parts of Windows and MinGW and required some fiddling.\n\nThese files are kept for documentation purposes:\n\n* **cpp_api.c**: MSDN reference file that uses de C++ API.\n* **netfw.h**: A reference implementation of netfw.h needed because MinGW didn't provide one. This had to be slighltly modified to compile properly.\n* **netfw-xp.h**: A modified version of netfw.h that works with MinGW. It only supports the old API for Windows XP.\n* **WinXPSP2FireWall.{h,c}**: A reference implementation of the Firewall API for Windows XP, which has a more sparse documentation over the Internet.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetlantern%2Fwinfirewall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetlantern%2Fwinfirewall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetlantern%2Fwinfirewall/lists"}