regedit: 3/7 Convert the rest of setValue to unicode

Alexandre Julliard julliard at winehq.org
Thu Jul 10 06:40:04 CDT 2008


Alexander Nicolaysen Sørnes <alex at thehandofagony.com> writes:

> @@ -185,13 +199,16 @@ static DWORD getDataType(LPSTR *lpValue, DWORD* parse_type)
>          *lpValue+=ptr->len;
>          if (type == -1) {
>              char* end;
> +            char* buf = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(*lpValue)+1)*sizeof(WCHAR));
> +            WideCharToMultiByte(CP_ACP, 0, *lpValue, -1, buf, (lstrlenW(*lpValue)+1)*sizeof(WCHAR), NULL, NULL);
>              /* "hex(xx):" is special */
> -            type = (int)strtoul( *lpValue , &end, 16 );
> -            if (**lpValue=='\0' || *end!=')' || *(end+1)!=':') {
> +            type = (int)strtoul( buf , &end, 16 );
> +            if (*buf=='\0' || *end!=')' || *(end+1)!=':') {
>                  type=REG_NONE;
>              } else {
> -                *lpValue=end+2;
> +                *lpValue += (end - buf)*sizeof(WCHAR) + 2;

The last line is not correct, besides we have strtoulW so you don't need
any of that W->A conversion.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list