advpack: Implement LaunchINFSectionEx [resend]
Alexandre Julliard
julliard at winehq.org
Fri Mar 31 03:32:11 CST 2006
"James Hawkins" <truiken at gmail.com> writes:
> +static LPWSTR get_parameter(LPWSTR parameters, WCHAR separator, DWORD index)
> +{
> + LPWSTR param = NULL, ptr = parameters;
> + DWORD i = 0;
> +
> + while (*parameters && i < index)
> + {
> + if (*parameters == separator)
> + {
> + ptr = parameters;
> + i++;
> + }
> +
> + parameters++;
> + }
> +
> + if (!*parameters || *parameters == separator)
> + return NULL;
> +
> + param = HeapAlloc(GetProcessHeap(), 0, (parameters - ptr) * sizeof(WCHAR));
> + lstrcpynW(param, parameters, parameters - ptr);
> +
> + return param;
> +}
That's a very inefficient way of splitting a string. It's much better
to allocate a copy of the whole string and go through it just once,
inserting nulls to separate the tokens.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list