[FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW

Soft Works softworkz at hotmail.com
Mon Jun 13 22:02:02 EEST 2022



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> nil-admirari at mailo.com
> Sent: Monday, June 13, 2022 7:03 PM
> To: ffmpeg-devel at ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v14 2/5] compat/w32dlfcn.h: Remove
> MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW
> 
> > Why do you use a 'do' loop? Can't you use the normal 2-step
> > approach, i.e. call the winapi function with a NULL buffer,
> > and then use the returned size to allocate the buffer.
> > This way you always need a single allocation only.
> 
> GetModuleFileNameW does not follow this convention:
> https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-
> libloaderapi-getmodulefilenamew
> 
> > If the length of the path exceeds the size that the nSize parameter
> specifies,
> > the function succeeds and the string is truncated to nSize
> characters
> > including the terminating null character.
> 
> MS does the looping too in their WIL library:
> https://github.com/microsoft/wil/blob/master/include/wil/win32_helper
> s.h#L339-L341.

Yes, you're right in this case; hadn't looked it up.

Thanks for the pointers.

sw


More information about the ffmpeg-devel mailing list