[3/6] dinput: SetActionMap saving simple configurations to an .ini file

Vitaliy Margolen wine-devel at kievinfo.com
Sun Oct 23 12:58:36 CDT 2011

Few nit picks.

On 10/22/2011 02:53 PM, Lucas Fialho Zawacki wrote:
> +static void _write_private_profile_intW(const char *format, WCHAR* section, WCHAR* key, int value, WCHAR* file)
> +{
> +    WCHAR* value_str = heap_printfW(format, value);
Here and everywhere else you not checking if memory allocation succeeded.

> +    WCHAR path[] = {
> +        '%','C','o','m','m','o','n','P','r','o','g','r','a','m','F','i','l','e','s','%','\\',
> +        'D','i','r','e','c','t','X','\\',
> +        'D','i','r','e','c','t','I','n','p','u','t','\\',
> +        'U','s','e','r',' ','M','a','p','s','\0'};
Missing static const qualifiers. Also the above directory does not exists 
and you not explicitly creating it.

> +    guid_strA = debugstr_guid(&lpdiaf->guidActionMap);
> +    guid_size = MultiByteToWideChar(CP_ACP, 0, guid_strA, -1, NULL, 0);
I'm not sure debug function is ok to be used in the regular code. Also, if 
need it as unicode why not print it as unicode from the beginning?

> +    IDirectInputDevice_GetDeviceInfo(&This->IDirectInputDevice8W_iface, &didevi);
You should use IDirectInputDevice8W_from_impl() function instead of directly 
accessing internals.

> +                    memcpy(username, find_data.cFileName, (end - find_data.cFileName + 1) * sizeof(WCHAR));
No checking for big enough buffer. Assuming that file names are in specified 

Also I'm not exactly sure why do you need a mapping user name anyway? Wine 
does not support multiple users. The user currently running Wine would be 
the one created all the files. All this seems to be redundant.


More information about the wine-devel mailing list