user[3/5]: handle special cases for SPI_SETDESKWALLPAPER (FIXED)

Andrew Ziem ahziem1 at mailbolt.com
Sun Jun 11 09:30:37 CDT 2006


Andrey Turkin wrote:
> Andrew Ziem wrote:
>> Please use this patch instead of previous "user3.patch".  Thanks to 
>> Andrey Turkin for catching the uninitialized variable.
>>
>> changelog:
>> user: handle special cases for SPI_SETDESKWALLPAPER
>>
>> The special cases remove the wallpaper or set it to default.  
>> Previously, these cases were ignored, so Wine would crash.
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>>  
>> -    if (filename == (LPSTR)-1)
>> +    if ((LPCSTR)SETWALLPAPER_DEFAULT == filename || (LPCSTR)NULL == 
>> filename || '\0' == filename[0])
>>      {
>> -    GetProfileStringA( "desktop", "WallPaper", "(None)", buffer, 256 );
>> -    filename = buffer;
>> +       /* set default wallpaper or remove wallpaper*/
>> +       if (hbitmapWallPaper)
>> +           DeleteObject( hbitmapWallPaper );
>> +       return TRUE;
>>      }
>>      hdc = GetDC( 0 );
> 
> According to MSDN, if
>  - pvParam==SETWALLPAPER_DEFAUL || pvParam==NULL, then wallpaper will be 
> set to default one
> - pvParam[0]=='\0', then wallpaper will be removed.
> I cannot see any signs of such distinction in your code :)

When I ran the unit test on Windows 2000, that's what it did: in all 
three cases (SETWALLPAPER_DEFAULT, NULL, or '\0'), Windows 2000 removed 
the wallpaper.  So, it seems the default wallpaper is no wallpaper, and 
a test could be added to show that.  (I already have a test that checks 
the default wallpaper is the same on both SETWALLPAPER_DEFAULT and NULL).

Beyond the cosmetics of changing the wallpaper, the purpose of the new 
code is to keep Wine from crashing on SETWALLPAPER_DEFAULT.


Andrew




More information about the wine-devel mailing list