oleacc: Add GetStateText implementation (try3)
Alexandre Julliard
julliard at winehq.org
Tue May 13 12:57:23 CDT 2014
Piotr Caban <piotr at codeweavers.com> writes:
> +UINT WINAPI GetStateTextW(DWORD state_bit, WCHAR *state_str, UINT state_str_len)
> +{
> + DWORD state_id;
> +
> + TRACE("%x %p %u\n", state_bit, state_str, state_str_len);
> +
> + state_id = IDS_STATE_MIN;
> + while(state_bit) {
> + state_id++;
> + state_bit /= 2;
> + }
> +
> + if(state_id>=IDS_STATE_MIN && state_id<=IDS_STATE_MAX) {
> + UINT ret;
> +
> + if(state_str) {
> + ret = LoadStringW(oleacc_handle, state_id, state_str, state_str_len);
> + }else {
> + WCHAR tmp;
> + ret = LoadStringW(oleacc_handle, state_id, &tmp, 0);
> + }
> +
> + if(!ret && state_str && state_str_len)
> + state_str[0] = 0;
> + return ret;
> + }
The id range check doesn't seem very useful. Also it would be worth
testing that a 0 length is supposed to return the string pointer the way
LoadString does.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list