Request for small bit of mentoring

Detlef Riekenberg at
Wed Apr 18 16:12:48 CDT 2007

On Mo, 2007-04-16 at 16:44 -0500, Tom Spear wrote:
> I took lines 196-197 and duplicated that, 

You can move most of the code from FetchUninstallInformation()
to a seperate function and use the rootkey as Parameter.


Did you already checked, what windows does with
duplicate Programm names?

More hints:

    lstrcpyW(key_app, PathUninstallW);
    lstrcatW(key_app, BackSlashW);
    p = key_app+lstrlenW(PathUninstallW)+1;

Why not add the slash direct to PathUninstallW?

    sizeOfSubKeyName = 255;

Fixed numbers are not a good Idea (error-prone).
This value is related to "WCHAR subKeyName[256];", 
but RegEnumKeyEx expect the max. size in TCHAR, including the
terminating zero, so the correct value for sizeOfSubKeyName
is 256.

A nice, automatic way is:

 sizeOfSubKeyName = sizeof(subKeyName)/sizeof(subKeyName[0]);

Such a construct works independant from the type (WCHAR / CHAR)
and the length of the String.

All together looks like more than one Patch.

By by ... Detlef

More information about the wine-devel mailing list