Be careful with that, they do not have to be null-terminated!
the return value will give you the length in this case.

On Sun, Oct 9, 2016 at 9:45 AM, Colin Finck <co...@reactos.org> wrote:

> hbelu...@svn.reactos.org wrote:
> > +#define RC_STRING_MAX_SIZE  4096
> > +
> > +    WCHAR Format[RC_STRING_MAX_SIZE];
> > +    LPWSTR lpMsgBuf = NULL;
> > +    DWORD Len;
> >      va_list args;
> >
> >      if (!LoadStringW(GetModuleHandleW(NULL), id, Format,
> > _countof(Format)))
>
> Now instead of
>
>     #define RC_STRING_MAX_SIZE  4096
>     WCHAR Format[RC_STRING_MAX_SIZE];
>     LoadStringW(GetModuleHandleW(NULL), id, Format, _countof(Format));
>
> just do a
>
>     LPWSTR lpFormatBuf;
>     LoadStringW(GetModuleHandleW(NULL), id, (LPWSTR)&lpFormatBuf, 0);
>
> and you have a perfect universal solution for any resource string length
> without caring about buffer sizes at all. It doesn't even need any extra
> memory :)
> This should actually be changed in a lot of places!
>
>
> - Colin
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev@reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Reply via email to