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

Paolo Capriotti p.capriotti at gmail.com
Tue Sep 11 11:19:12 CEST 2012


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 <simon at mintsource.org>
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 =





More information about the Cvs-libraries mailing list