[commit: Win32] master: regSetStringValue should account for null terminator in value string (68f2363)

Paolo Capriotti <[email protected]> Tue, 11 Sep 2012 02:19:12 -0700
Newsgroups gmane.comp.lang.haskell.cvs.libraries
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Win32

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/68f236334335488ca5b81da97e1813cff1565ff3

>---------------------------------------------------------------

commit 68f236334335488ca5b81da97e1813cff1565ff3
Author: Simon Peter Nicholls <[email protected]>
Date:   Tue Jul 24 09:02:14 2012 +0200

    regSetStringValue should account for null terminator in value string

>---------------------------------------------------------------

 System/Win32/Registry.hsc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/System/Win32/Registry.hsc b/System/Win32/Registry.hsc
index 7b04867..7c92970 100644
--- a/System/Win32/Registry.hsc
+++ b/System/Win32/Registry.hsc
@@ -497,7 +497,7 @@ type RegValueType = DWORD
 regSetStringValue :: HKEY -> String -> String -> IO ()
 regSetStringValue hk key val =
   withTString val $ \ v ->
-  regSetValueEx hk key rEG_SZ v (length val * sizeOf (undefined::TCHAR))
+  regSetValueEx hk key rEG_SZ v ((1+length val) * sizeOf (undefined::TCHAR))
 
 regSetValueEx :: HKEY -> String -> RegValueType -> LPTSTR -> Int -> IO ()
 regSetValueEx key subkey ty value value_len =