[flac-dev] Patch to add Unicode filename support for win32 flac

Janne Hyvärinen cse at sci.fi
Tue Mar 19 12:49:47 PDT 2013


On 19.3.2013 19:13, LRN wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 19.03.2013 20:35, Janne Hyvärinen wrote:
>> On 19.3.2013 15:49, JonY wrote:
>>> On 3/19/2013 19:59, Janne Hyvärinen wrote:
>>>> On 18.3.2013 12:25, Erik de Castro Lopo wrote:
>>>>> JonY wrote:
>>>>>
>>>>>> Before anyone does anything, see __wgetmainargs
>>>>>> <http://msdn.microsoft.com/en-us/library/ff770599.aspx>.
>>>>>>
>>>>>> It can expand wildcards. Since it already provides
>>>>>> argc/argv/env, it is more a less a drop-in replacement for
>>>>>> the main() arguments.
>>>>> +1
>>>>>
>>>>> Erik
>>>> Alright, here's a patch utilizing this function. There's a lot
>>>> of changes here. Project files have a new configuration called
>>>> "Release (UTF8)", intended to be used when building the command
>>>> line tools. This project has the required UTF-8 define in place
>>>> so all libraries expect things in encoded format. Regular Debug
>>>> and Release configurations do not use any new tricks so
>>>> existing projects won't break when compiled with those
>>>> settings.
>>>>
>>>> I'm at work and couldn't do extensive testing, but command line
>>>> FLAC.exe seems to perform everything right with this.
>>>>
>>>> Metaflac probably requires some minor tweaks but I wanted to
>>>> show some progress so that 1.3 doesn't slip out the door while
>>>> I'm busy.
>>>>
>>> As for calling __wgetmainargs, I have some concerns about the
>>> security implications: LoadLibrary("msvcrt.dll") <- Which msvcrt?
>>> Theoretical security exploit.
>> There is msvcrt.dll in the System32 dir in all supported Windows
>> systems. That is what the function targets, but of course
>> LoadLibrary searches from exe's dir first. I think security exploit
>> concerns are warrantless, if you can place malicious replacement
>> c-runtime dll in the exe's path you have already won.
> See [1] for the info. According to that article,
> LoadLibraryA("msvcrt.dll") should be perfectly safe.
>
>
> [1]
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx
>
>

Seems safe indeed.
Attached an updated patch where metaflac works too.
Test MSVC 2012 compiles of flac.exe and metaflac.exe uploaded to 
http://www.saunalahti.fi/~cse/temp/flac-1.3pre2-mod.zip

-------------- next part --------------
A non-text attachment was scrubbed...
Name: utf8_io_v2.zip
Type: application/x-zip-compressed
Size: 24509 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20130319/b5811db9/attachment-0001.bin 


More information about the flac-dev mailing list