Page 1 of 1

Kernel module cannot be loaded on Windows due to Unicode

PostPosted: 22. Jul 2015, 21:23
by Kentzo
VirtualBox does not support loading from paths that contain Unicode symbols. It's impossible to even use wide char on Windows, since vritualboxes uses A version of API.
Moreover, short paths does not work either.

Is there a workaround, e.g. encoding we can use to to transform Path into A-acceptable version VirtualBox will be able to understand later?

Re: Kernel module cannot be loaded on Windows due to Unicode

PostPosted: 23. Jul 2015, 11:04
by noteirak
Could you provide a sample code to reproduce the issue please? Including the creation of the folder with the unicode name.

Re: Kernel module cannot be loaded on Windows due to Unicode

PostPosted: 23. Jul 2015, 11:06
by mpack
I'd like to see justification of "short paths don't work either". I don't see how they can fail, and I'm pretty sure I've seen VBox error messages using them (which implies that they're being passed around internally on Windows hosts).

Re: Kernel module cannot be loaded on Windows due to Unicode

PostPosted: 23. Jul 2015, 11:48
by Kentzo
It's a little hard to provide source code, but we are using the setExtraData method to set string like "C:\غازي\MyKernelModule.dll". We use Python bindings, but AFAIK VirtualBox only uses A version of API which cannot represent such string by definition.

We tried to mitigate that by converting paths into short paths (even if they do not contain unicode symbols, to avoid unnecessary checks). But VirtualBox failed with the Unable to load R3 module GetLastError==126 error (VERR_MODULE_NOT_FOUND). Example of such path would be "C:\PROGRA~1\Andy\LIBAND~2.DLL"

Just recovered another strange thing from our discussion: the following path "D:\طفجدفسفم\lib64" was written as "D:\طفجدفسفم\lib64" into vbox file of VM.

Re: Kernel module cannot be loaded on Windows due to Unicode

PostPosted: 23. Jul 2015, 12:27
by mpack
Why is that strange? An ASCII xml file will use xml escape encodings.

Re: Kernel module cannot be loaded on Windows due to Unicode

PostPosted: 23. Jul 2015, 23:46
by Kentzo
Ok, that does mean that string was properly saved into XML file, that's good to know.

It worths to note that my module should support 4.3.12 and onwards.

VirtualBox uses the LoadLibraryA function to load modules till VirtualBox 5. That means that there is no way paths such those I posted will work.

Now, I'm trying to figure out why cannot it load it by short path. It could be a code signing issue… We're further debugging it and I will let you know as soon as I will have results.

Re: Kernel module cannot be loaded on Windows due to Unicode

PostPosted: 24. Jul 2015, 01:03
by Kentzo
It appears that VirtualBox 4.3.12 rejects my kernel module because of the signature created using Verisign certificate (signtool says it's OK).
In other hand it loads the same module signed with COMODO certificate (signtool says it's OK as well).

However the error is VERR_MODULE_NOT_FOUND which is greatly misleading.

Re: Kernel module cannot be loaded on Windows due to Unicode

PostPosted: 28. Jul 2015, 11:53
by noteirak
Yes, signature restriction were already in effect at this point I believe. There are several discussions about this restrictions in VirtualBox OSE Forum.

Re: Kernel module cannot be loaded on Windows due to Unicode

PostPosted: 28. Jul 2015, 16:12
by bird
Which version of VirtualBox have you been using? I believe this problem was fixed late in the 5.0.0 test cycle.

Kind regards,
bird.