[ros-diffs] [cwittich] 41419: fix warnings (untested)

cwittich at svn.reactos.org cwittich at svn.reactos.org
Mon Jun 15 17:04:57 CEST 2009


Author: cwittich
Date: Mon Jun 15 19:04:56 2009
New Revision: 41419

URL: http://svn.reactos.org/svn/reactos?rev=41419&view=rev
Log:
fix warnings (untested)

Modified:
    trunk/reactos/base/applications/paint/main.c
    trunk/reactos/base/applications/paint/registry.c
    trunk/reactos/base/applications/paint/registry.h
    trunk/reactos/base/applications/paint/winproc.c

Modified: trunk/reactos/base/applications/paint/main.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/main.c?rev=41419&r1=41418&r2=41419&view=diff
==============================================================================
--- trunk/reactos/base/applications/paint/main.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/main.c [iso-8859-1] Mon Jun 15 19:04:56 2009
@@ -223,7 +223,7 @@
     hCurPen         = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
     hCurAirbrush    = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_AIRBRUSH));
 
-    HWND hLine = CreateWindowEx (0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL, hThisInstance, NULL);
+    CreateWindowEx (0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL, hThisInstance, NULL);
 
     // creating the 16 bitmap radio buttons and setting the bitmap
 

Modified: trunk/reactos/base/applications/paint/registry.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/registry.c?rev=41419&r1=41418&r2=41419&view=diff
==============================================================================
--- trunk/reactos/base/applications/paint/registry.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/registry.c [iso-8859-1] Mon Jun 15 19:04:56 2009
@@ -9,31 +9,30 @@
 /* INCLUDES *********************************************************/
 
 #include <windows.h>
+#include <tchar.h>
 
 /* FUNCTIONS ********************************************************/
 
-void setWallpaper(char fname[], int style)
+void SetWallpaper(TCHAR *FileName, DWORD dwStyle, DWORD dwTile)
 {
-    HKEY hkeycontrolpanel;
-    HKEY hkeydesktop;
-    RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel", 0, 0, hkeycontrolpanel);
-    RegOpenKeyEx(hkeycontrolpanel, "Desktop", 0, KEY_SET_VALUE, hkeydesktop);
-    RegSetValueEx(hkeydesktop, "Wallpaper", 0, REG_SZ, fname, sizeof(fname));
-    switch (style)
+    HKEY hDesktop;
+    TCHAR szStyle[3], szTile[3];
+
+    if ((dwStyle > 2) || (dwTile > 2))
+        return;
+
+    if (RegOpenKeyEx(HKEY_CURRENT_USER, 
+        _T("Control Panel\\Desktop"), 0,
+        KEY_READ | KEY_SET_VALUE, &hDesktop) == ERROR_SUCCESS)
     {
-        case 0:
-            RegSetValueEx(hkeydesktop, "WallpaperStyle", 0, REG_SZ, "2", 2);
-            RegSetValueEx(hkeydesktop, "TileWallpaper", 0, REG_SZ, "0", 2);
-            break;
-        case 1:
-            RegSetValueEx(hkeydesktop, "WallpaperStyle", 0, REG_SZ, "1", 2);
-            RegSetValueEx(hkeydesktop, "TileWallpaper", 0, REG_SZ, "0", 2);
-            break;
-        case 2:
-            RegSetValueEx(hkeydesktop, "WallpaperStyle", 0, REG_SZ, "1", 2);
-            RegSetValueEx(hkeydesktop, "TileWallpaper", 0, REG_SZ, "1", 2);
-            break;
+        RegSetValueEx(hDesktop, _T("Wallpaper"), 0, REG_SZ, (LPBYTE) FileName, _tcslen(FileName) * sizeof(TCHAR));
+
+        _stprintf(szStyle, _T("%i"), dwStyle);
+        _stprintf(szTile,  _T("%i"), dwTile);
+
+        RegSetValueEx(hDesktop, _T("WallpaperStyle"), 0, REG_SZ, (LPBYTE) szStyle, _tcslen(szStyle) * sizeof(TCHAR));
+        RegSetValueEx(hDesktop, _T("TileWallpaper"), 0, REG_SZ, (LPBYTE) szTile, _tcslen(szTile) * sizeof(TCHAR));
+
+        RegCloseKey(hDesktop);
     }
-    RegCloseKey(hkeydesktop);
-    RegCloseKey(hkeycontrolpanel);
 }

Modified: trunk/reactos/base/applications/paint/registry.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/registry.h?rev=41419&r1=41418&r2=41419&view=diff
==============================================================================
--- trunk/reactos/base/applications/paint/registry.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/registry.h [iso-8859-1] Mon Jun 15 19:04:56 2009
@@ -6,4 +6,4 @@
  * PROGRAMMERS: Benedikt Freisen
  */
 
-void setWallpaper(char fname[], int style);
+void SetWallpaper(TCHAR *szFileName, DWORD dwStyle, DWORD dwTile);

Modified: trunk/reactos/base/applications/paint/winproc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/winproc.c?rev=41419&r1=41418&r2=41419&view=diff
==============================================================================
--- trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] Mon Jun 15 19:04:56 2009
@@ -423,13 +423,13 @@
                     }
                     break;
                 case IDM_FILEASWALLPAPERPLANE:
-                    setWallpaper(filepathname, 2);
+                    SetWallpaper(filepathname, 1, 1);
                     break;
                 case IDM_FILEASWALLPAPERCENTERED:
-                    setWallpaper(filepathname, 1);
+                    SetWallpaper(filepathname, 1, 0);
                     break;
                 case IDM_FILEASWALLPAPERSTRETCHED:
-                    setWallpaper(filepathname, 0);
+                    SetWallpaper(filepathname, 2, 0);
                     break;
                 case IDM_EDITUNDO:
                     undo();



More information about the Ros-diffs mailing list