Skip to content

WritePackageDefW fails when the Visual Studio installation path contains spaces (ERROR_INVALID_NAME) #329

Description

@user76-real

Hi,
I found an issue with WritePackageDefW when installing VisualD.

The installer executes the following command:
rundll32.exe "C:\Program Files (x86)\VisualD\visuald.dll",WritePackageDefW "SOFTWARE\Microsoft\VisualStudio\18.0" "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools"

Instead of completing successfully, VisualD displays the following Windows error:
"The filename, directory name, or volume label syntax is incorrect."
(Error 123 / ERROR_INVALID_NAME)

After inspecting the source code, WriteExtensionPackageDefinition() splits the command line at the first space and then directly uses the second argument as a file path:

auto idx = indexOf(wargs, ' ');
registryRoot = (wargs[0 .. idx] ~ "\0"w)[0 .. idx];
string fname = to!string(wargs[idx + 1 .. $]);

Images:
Image
Image

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