ANSI plugin causes malformed data to be inserted into Registry

Issue #1 new
Ben Hutchison created an issue

Environment

  • Windows 7 Pro SP1 x64
  • Windows Server 2012 R2 Standard x64
  • MakeNSIS v3.0b1
  • liteFirewall 1.0 (2011-07)

Steps to reproduce

  1. Download Sample.nsi from the plugin installation ZIP.
  2. You can use either liteFirewall.dll or liteFirewallW.dll and it won't affect the results.
  3. If you want, set Unicode false in the NSI to force x86-ansi output (it defaults to false anyway, but this lets you try both modes easily)
  4. Add a firewall rule:

    liteFirewall::AddRule "$WINDIR\Notepad.exe" "liteFirewall Test"

    or

    liteFirewallW::AddRule "$WINDIR\Notepad.exe" "liteFirewall Test"

  5. Check the created rule in the Registry (HKLM\System\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\) or Windows Firewall with Advanced Security (wf.msc)

Expected results

  • The value of Unicode should not affect the results
  • A new firewall rule should have been created
  • Name = liteFirewall Test
  • Program = C:\Windows\Notepad.exe
  • Full Registry entry = v2.10|Action=Allow|Active=TRUE|Dir=In|Profile=Private|App=C:\Windows\Notepad.exe|Name=liteFirewall Test|

Actual results

  • Expected results occur when Unicode true is set
  • When Unicode false is set,
    • A new firewall rule is created
    • Name = 楬整楆敲慷汬吠獥t
    • Program = 㩃坜湩潤獷乜瑯灥摡攮數
    • Full Registry entry = v2.10|Action=Allow|Active=TRUE|Dir=In|Profile=Private|App=㩃坜湩潤獷乜瑯灥摡攮數|Name=楬整楆敲慷汬吠獥t|

Note: The actual Name and Program are also what you get if you encode the expected Name and Program with ANSI and then decode it with UTF-16.

Comments (3)

  1. l repo owner

    This seems an encoding issue. I strongly suggest you use the Unicode version (liteFirewallW.dll) with Unicode true.

  2. Log in to comment