Skip to content

PackageFamilyName is not None even if it should be None #40096

@mveril

Description

@mveril

Windows Version

Microsoft Windows [version 10.0.26200.8117]

WSL Version

2.6.2.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

6.6.87.2

Distro Version

No response

Other Software

Rust 1.94.1
wslplugins-rs 0.1.0-beta.2

Repro Steps

I am the developer of wslplugins-rs a framework to easely develop WSL plugins in rust and I facing an issue when I try to debug an example I just developped.
1 clone the repo

git clone https://github.com/mveril/wslplugins-rs
  1. Go to branch unpackaged-distro-blacklist-policy
  2. sign the plugin and register it as you
cargo build --release -p unpackaged-distro-blacklist-policy
  1. found the dll in the target folder of the project sign it and register it as described in the readme of my project or in the Microsoft WSLPlugin sample
  2. Run WSL and check the logfile C:\\wsl-unpackaged-distro-blacklist.log and you can see something like
2026-04-03T17:25:06.790520Z  INFO unpackaged_distro_blacklist_policy: Distribution FedoraLinux-42 started with package family name Some("")

So the package family name is an empty string even if it should be None
This information is obtainied using this specific code

    #[inline]
    fn package_family_name(&self) -> Option<OsString> {
        // SAFETY: check already inside
        unsafe {
            let ptr = self.0.PackageFamilyName;
            if ptr.is_null() {
                None
            } else {
                Some(OsString::from_wide(PCWSTR::from_raw(ptr).as_wide()))
            }
        }
    }

Expected Behavior

Package family name should be a null pointer when it's an unpackaged distro but it's an pointer to an empty string

Actual Behavior

Package family name should be a null pointer when it's an unpackaged distro but it's an pointer to an empty string

Diagnostic Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions