[ros-dev] [ros-diffs] [hbelusca] 72943: [PING] - Use a dynamic-allocated buffer with FormatMessageW, fixes messages disappearance (eg. ping help in russian). CORE-12108 #comment Fixed in r72943. - Remove the unneeded 1-...
Colin Finck
colin at reactos.org
Sun Oct 9 07:45:17 UTC 2016
hbelusca at 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
More information about the Ros-dev
mailing list