Paul Vriens : shell32/tests: Don't fill a string with potential garbage.

Alexandre Julliard julliard at winehq.org
Thu Dec 3 10:29:54 CST 2009


Module: wine
Branch: master
Commit: 1c582d2ac5ba213889fcef938cdcb4c25d367437
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1c582d2ac5ba213889fcef938cdcb4c25d367437

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Thu Dec  3 13:33:36 2009 +0100

shell32/tests: Don't fill a string with potential garbage.

---

 dlls/shell32/tests/progman_dde.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/shell32/tests/progman_dde.c b/dlls/shell32/tests/progman_dde.c
index c3cb1e7..7e6c874 100644
--- a/dlls/shell32/tests/progman_dde.c
+++ b/dlls/shell32/tests/progman_dde.c
@@ -120,6 +120,14 @@ static void init_strings(void)
         LONG res;
 
         /* Older Win9x and NT4 */
+        RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
+        size = sizeof(Programs);
+        RegQueryValueExA(key, "Programs", NULL, NULL, (LPBYTE)&Programs, &size);
+        size = sizeof(startup);
+        RegQueryValueExA(key, "Startup", NULL, NULL, (LPBYTE)&startup, &size);
+        lstrcpyA(Startup, (strrchr(startup, '\\') + 1));
+        RegCloseKey(key);
+
         RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
         size = sizeof(CommonPrograms);
         res = RegQueryValueExA(key, "Common Programs", NULL, NULL, (LPBYTE)&CommonPrograms, &size);
@@ -129,14 +137,6 @@ static void init_strings(void)
             /* Win9x */
             lstrcpyA(CommonPrograms, Programs);
         }
-
-        RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
-        size = sizeof(Programs);
-        RegQueryValueExA(key, "Programs", NULL, NULL, (LPBYTE)&Programs, &size);
-        size = sizeof(startup);
-        RegQueryValueExA(key, "Startup", NULL, NULL, (LPBYTE)&startup, &size);
-        lstrcpyA(Startup, (strrchr(startup, '\\') + 1));
-        RegCloseKey(key);
     }
 
     memset(&cs, 0, sizeof(cs));




More information about the wine-cvs mailing list