New uninstaller

Dmitry Timoshkov dmitry at baikal.ru
Tue Mar 8 09:29:00 CST 2005


"Jonathan Ernst" <Jonathan at ErnstFamily.ch> wrote:

> I fixed/changed many things regarding unicode. It seems that now both
> outputing to the console and case insensitive find as you type feature
> (re-)work.
> 
> I fixed most warnings, but there are still 4 lines that I couldn't fix
> (173,

cast entries[numentries-1].command to LPBYTE as you do 3 lines earlier.

> 206,

wrong STARTUPINFO declaration, you need a unicode one with W suffix.

> 215,

you can't use sprintf to print to a WCHAR string, use win32 API wsprintfW
instead.

> 429). Can someone help me ?

>          slen  = strlenW(String),
>          plen  = strlenW(Pattern);

better use official API lstrlenW.

>         /* find start of pattern in string */
>         while (toupper(*start) != toupper(*Pattern))

You can't use toupper with unicode strings. I can't suggest a win32 equivalent
from the top of my head, you need to find out.

>         pptr = (WCHAR *)Pattern;

There is no need for a cast here.

> 
>         while (toupper(*sptr) == toupper(*pptr))

same as above.

> Last but not least, since these changes the uninstaller crashes (very)
> often. I have an unhandled exception when retrieving some apps from the
> uninstall key and I don't know what cause this:
> 
> err:seh:EXC_DefaultHandling Unhandled exception code c0000005 flags 0
> addr 0x77ecf5d4

Very likely a common error happening often in the process of unicodification:
buffer overflow due to not a correct memory allocation, or a not correct
initialization of a variable pointing to a buffer length (size of buffer in
bytes vs. WCHARs).

> > For better understanding of what is going on add the following as the
> > very first line in main.c:
> > 
> > #define __WINESRC__
> > 
> 
> When adding this line the compilation fails with this message:
> 
> main.c:194: error: `STARTUPINFO' undeclared (first use in this function)
> 
> Are some include(s) missing  ?

That's the point. I'd prefer that you could figure out that on your own.
Hint: look at the headers, and you will see that all those STARTUPINFO,
lstrcpy, RegOpenKey are not the real API names, but just macros depending
whether UNICODE is defined or not. In Wine using API macros is deprecated,
personally I'd prefer to not use them in programs/* either.

> Do you think I'm near the target ?

Definitely very close.

-- 
Dmitry.




More information about the wine-devel mailing list