import System.Win32
import Control.Exception
import Control.Monad

x = "bumble"
name = "test_registry001"

-- Create, read, and delete a value (test for bug #3241)
main = do
  k1 <- regOpenKey hKEY_CURRENT_USER "Software"
  k2 <- regOpenKey k1 "Haskell"
  k3 <- regOpenKey k2 "GHC"
  flip finally (regDeleteValue k3 name) $ do
  regSetStringValue k3 name x
  r <- regQueryValue k3 (Just name)
  print r

import System.Win32
import Control.Exception
import Control.Monad

x = "bumble"
name = "test_registry001"

-- Create, read, and delete a value (test for bug #3241)
main = do
  k1 <- regCreateKey hKEY_CURRENT_USER "Software"
  k2 <- regCreateKey k1 "Haskell"
  k3 <- regCreateKey k2 "GHC"
  flip finally (regDeleteValue k3 name) $ do
  regSetStringValue k3 name x
  r <- regQueryValue k3 (Just name)
  print r

Use regCreateKey to be more robust when registry entry does not exist.
Use regCreateKey to be more robust when registry entry does not exist.

Signed-off-by: Edward Z. Yang <dbd597f5635f432486c5d365e9bb585b3eaa1853@mit.edu>
