Skip to content

Commit 366d757

Browse files
boybookclaude
andcommitted
fix: add comprehensive Windows system DLL filter
Problem: Recursive dependency analysis bundled 149 Windows system DLLs including iphlpapi.dll, kernelbase.dll, crypt32.dll, d3d11.dll, and many other Windows system components that should never be bundled. Solution: Expanded systemDllPatterns from ~20 patterns to ~150 patterns covering all Windows system DLLs: - Core (kernel32, kernelbase, ntdll) - Networking (iphlpapi, dnsapi, winhttp, wininet) - Security/Crypto (crypt32, ncrypt, bcrypt, wintrust) - Graphics (d3d11, d3d12, dxgi, d2d1, dcomp) - COM/OLE (combase, ole32) - Windows components (userenv, netapi32, samlib, lsasrv) - UI/Shell (shcore, propsys, urlmon) - Management/Policy (wldp, policymanager, mdmregistration) - Enterprise/Domain (netlogon, dsreg, kerb*, gmsaclient) - And many more... Expected result: Only bundle libusb-1.0.dll and libwinpthread-1.dll from hamlib distribution directory, exclude all C:\Windows DLLs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4c67af5 commit 366d757

File tree

1 file changed

+167
-3
lines changed

1 file changed

+167
-3
lines changed

scripts/bundle-hamlib.js

Lines changed: 167 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,27 +409,191 @@ function bundleMac(dir, nodeBin) {
409409
*/
410410
function getDependenciesWinRecursive(dllPath, searchPaths = [], excludeSystemDlls = true, visited = new Set()) {
411411
// Windows system DLLs that should NOT be bundled (always available on Windows)
412+
// Strategy: Only bundle DLLs from the hamlib distribution directory, exclude everything from C:\Windows
412413
const systemDllPatterns = [
414+
// Core Windows DLLs
413415
/^kernel32\.dll$/i,
416+
/^kernelbase\.dll$/i,
414417
/^user32\.dll$/i,
415418
/^advapi32\.dll$/i,
416419
/^ws2_32\.dll$/i,
417420
/^winmm\.dll$/i,
418421
/^msvcrt\.dll$/i,
419-
/^msvcp\d+\.dll$/i, // MSVC C++ runtime
420-
/^vcruntime\d+\.dll$/i, // Visual C++ runtime
421-
/^ucrtbase\.dll$/i, // Universal CRT
422+
/^msvcp\d+.*\.dll$/i, // MSVC C++ runtime (any version)
423+
/^vcruntime\d+\.dll$/i, // Visual C++ runtime
424+
/^ucrtbase\.dll$/i, // Universal CRT
422425
/^api-ms-win-.*\.dll$/i, // API sets
426+
/^ext-ms-.*\.dll$/i, // Extension API sets
427+
428+
// COM/OLE
423429
/^ole32\.dll$/i,
424430
/^oleaut32\.dll$/i,
431+
/^combase\.dll$/i,
432+
433+
// Graphics/UI
425434
/^shell32\.dll$/i,
426435
/^gdi32\.dll$/i,
436+
/^user32\.dll$/i,
437+
/^win32u\.dll$/i,
438+
/^dxgi\.dll$/i,
439+
/^d2d1\.dll$/i,
440+
/^d3d\d+.*\.dll$/i, // DirectX (d3d11, d3d12, etc)
441+
/^dcomp\.dll$/i,
442+
443+
// System services
427444
/^ntdll\.dll$/i,
428445
/^setupapi\.dll$/i,
429446
/^cfgmgr32\.dll$/i,
430447
/^bcrypt\.dll$/i,
448+
/^bcryptprimitives\.dll$/i,
431449
/^sechost\.dll$/i,
432450
/^rpcrt4\.dll$/i,
451+
/^sspicli\.dll$/i,
452+
453+
// Networking
454+
/^iphlpapi\.dll$/i,
455+
/^nsi\.dll$/i,
456+
/^winnsi\.dll$/i,
457+
/^dhcpcsvc.*\.dll$/i,
458+
/^dnsapi\.dll$/i,
459+
/^winhttp\.dll$/i,
460+
/^wininet\.dll$/i,
461+
/^webio\.dll$/i,
462+
/^websocket\.dll$/i,
463+
/^httpapi\.dll$/i,
464+
/^firewallapi\.dll$/i,
465+
/^fwbase\.dll$/i,
466+
/^fwpolicyiomgr\.dll$/i,
467+
468+
// Security/Crypto
469+
/^crypt32\.dll$/i,
470+
/^cryptbase\.dll$/i,
471+
/^cryptsp\.dll$/i,
472+
/^cryptnet\.dll$/i,
473+
/^cryptxml\.dll$/i,
474+
/^cryptdll\.dll$/i,
475+
/^cryptngc\.dll$/i,
476+
/^crypttpmeksvc\.dll$/i,
477+
/^ncrypt\.dll$/i,
478+
/^ntasn1\.dll$/i,
479+
/^msasn1\.dll$/i,
480+
/^dpapi\.dll$/i,
481+
/^wintrust\.dll$/i,
482+
/^authz\.dll$/i,
483+
/^schannel\.dll$/i,
484+
/^tokenbinding\.dll$/i,
485+
486+
// Windows components
487+
/^cabinet\.dll$/i,
488+
/^profapi\.dll$/i,
489+
/^userenv\.dll$/i,
490+
/^netapi32\.dll$/i,
491+
/^netutils\.dll$/i,
492+
/^samlib\.dll$/i,
493+
/^samsrv\.dll$/i,
494+
/^samcli\.dll$/i,
495+
/^lsasrv\.dll$/i,
496+
/^lsaadt\.dll$/i,
497+
/^netlogon\.dll$/i,
498+
/^logoncli\.dll$/i,
499+
/^wldap32\.dll$/i,
500+
/^dsrole\.dll$/i,
501+
/^dsparse\.dll$/i,
502+
/^dsclient\.dll$/i,
503+
/^dsreg\.dll$/i,
504+
/^ntdsapi\.dll$/i,
505+
/^w32topl\.dll$/i,
506+
507+
// Windows UI/Shell
508+
/^shcore\.dll$/i,
509+
/^mpr\.dll$/i,
510+
/^propsys\.dll$/i,
511+
/^icu\.dll$/i,
512+
/^urlmon\.dll$/i,
513+
/^iertutil\.dll$/i,
514+
515+
// Debugging/Error reporting
516+
/^dbghelp\.dll$/i,
517+
/^dbgeng\.dll$/i,
518+
/^dbgmodel\.dll$/i,
519+
/^imagehlp\.dll$/i,
520+
/^wer\.dll$/i,
521+
/^faultrep\.dll$/i,
522+
523+
// Device/Driver management
524+
/^cldapi\.dll$/i,
525+
/^fltlib\.dll$/i,
526+
/^devobj\.dll$/i,
527+
/^devrtl\.dll$/i,
528+
/^setupcl\.dll$/i,
529+
/^drvstore\.dll$/i,
530+
531+
// Windows features
532+
/^twinapi\..*\.dll$/i,
533+
/^coremessaging\.dll$/i,
534+
/^coreuicomponents\.dll$/i,
535+
/^webservices\.dll$/i,
536+
/^esent\.dll$/i,
537+
/^wevtapi\.dll$/i,
538+
/^vaultcli\.dll$/i,
539+
/^credui\.dll$/i,
540+
/^webauthn\.dll$/i,
541+
/^noise\.dll$/i,
542+
/^hid\.dll$/i,
543+
544+
// Windows management/policy
545+
/^wldp\.dll$/i,
546+
/^policymanager.*\.dll$/i,
547+
/^mdmregistration\.dll$/i,
548+
/^dmcmnutils\.dll$/i,
549+
/^dmenrollengine\.dll$/i,
550+
/^omadmapi\.dll$/i,
551+
/^edp.*\.dll$/i,
552+
/^efs.*\.dll$/i,
553+
/^fve.*\.dll$/i,
554+
/^tpm.*\.dll$/i,
555+
/^ngc.*\.dll$/i,
556+
/^popkeycli\.dll$/i,
557+
/^bcd\.dll$/i,
558+
/^tbs\.dll$/i,
559+
/^vbsapi\.dll$/i,
560+
/^virtdisk\.dll$/i,
561+
/^pcrpf\.dll$/i,
562+
/^srpapi\.dll$/i,
563+
/^nrtapi\.dll$/i,
564+
565+
// Windows enterprise/domain
566+
/^kerb\d+\.dll$/i,
567+
/^gmsaclient\.dll$/i,
568+
/^wkscli\.dll$/i,
569+
/^srvcli\.dll$/i,
570+
571+
// Windows performance/diagnostics
572+
/^windowsperformancerecordercontrol\.dll$/i,
573+
/^diagnosticdatasettings\.dll$/i,
574+
/^umpdc\.dll$/i,
575+
/^rmclient\.dll$/i,
576+
577+
// Windows misc
578+
/^aepic\.dll$/i,
579+
/^bcp47langs\.dll$/i,
580+
/^msvcp110_win\.dll$/i,
581+
/^iri\.dll$/i,
582+
/^dmpushproxy\.dll$/i,
583+
/^declaredconfiguration\.dll$/i,
584+
/^dmxmlhelputils\.dll$/i,
585+
/^unenrollhook\.dll$/i,
586+
/^enterpriseresourcemanager\.dll$/i,
587+
/^xmllite\.dll$/i,
588+
/^.*typehelperutil\.dll$/i,
589+
/^contactactivation\.dll$/i,
590+
/^certca\.dll$/i,
591+
/^certenroll\.dll$/i,
592+
/^winbrand\.dll$/i,
593+
/^winipcfile\.dll$/i,
594+
/^winmsipc\.dll$/i,
595+
/^wuceffects\.dll$/i,
596+
/^microsoft\.internal\..*\.dll$/i,
433597
];
434598

435599
const dllName = path.basename(dllPath).toLowerCase();

0 commit comments

Comments
 (0)