Re: advpack: Implement LaunchINFSectionEx [resend]
"James Hawkins" <truiken(a)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(a)winehq.org
participants (1)
-
Alexandre Julliard