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

2006-06-11 Thread Andrew Ziem

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





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

2006-06-11 Thread Andrey Turkin

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 :)




Re: user[3/5]: handle special cases for SPI_SETDESKWALLPAPER

2006-06-10 Thread Andrew Ziem

Thank you for catching that.  I missed the part

   = {'\0'};



Andrey Turkin wrote:

I cannot see where emptyW initialized.

Andrew Ziem wrote:
The special cases remove the wallpaper or set it to default.  
Previously, these cases were ignored, so Wine would crash.





+if (NULL == pvParam || SETWALLPAPER_DEFAULT == pvParam)
+{
+static const WCHAR emptyW[1];
+if (!SetDeskWallPaper( (LPSTR)pvParam ))
+return FALSE;
+SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, 
SPI_SETDESKWALLPAPER_VALNAME, emptyW, fWinIni);






Re: user[3/5]: handle special cases for SPI_SETDESKWALLPAPER

2006-06-10 Thread Andrey Turkin

I cannot see where emptyW initialized.

Andrew Ziem wrote:
The special cases remove the wallpaper or set it to default.  
Previously, these cases were ignored, so Wine would crash.





+if (NULL == pvParam || SETWALLPAPER_DEFAULT == pvParam)
+{
+static const WCHAR emptyW[1];
+if (!SetDeskWallPaper( (LPSTR)pvParam ))
+return FALSE;
+SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, 
SPI_SETDESKWALLPAPER_VALNAME, emptyW, fWinIni);
+}
+else
+{
+if (!SetDeskWallPaper( (LPSTR) pvParam ))
+   return FALSE;
+}
+break;