[Haskell-cafe] System.Win32.Registry... Help?

Dave Buznik byteasphyxia at gmail.com
Sun Jul 22 08:24:06 CEST 2012


---------- Forwarded message ----------
From: Anonymous Void <bitsofchaos at gmail.com>
Date: Sun, Jul 22, 2012 at 2:10 AM
Subject: Re: [Haskell-cafe] System.Win32.Registry... Help?
To: Tim Matthews <tim.matthews7 at gmail.com>


I've looked into their docs, but I can't for the life of me figure out
how to convert a string to lptstr, for example:
set_key :: HKEY -> String -> String -> IO ()
set_key cat loc key = do
  foo <- okey
  regSetValueEx foo "foo" rEG_SZ "foo" 0
  where okey = regOpenKeyEx cat loc kEY_ALL_ACCESS

will give me an error about it expecting LPTSTR and not [char] for "foo",
but I have no idea how to convert the c/win32 types using Haskell, and
msdn docs aren't helping any...
I know in Python the following works, but I don't want to use Python
for this app...
key = OpenKey(HKEY_CURRENT_USER, "Software\\7-Zip", 0, KEY_ALL_ACCESS)
SetValueEx(key, "test", 0, REG_SZ, "foobar")
CloseKey(key)
but that's basically where I'm stuck at right now,
I've searched but wasn't able to find one single use case of
regSetValueEx in Haskell,
otherwise I'd be done already... I've been stuck on this for days and
it's a two-hour app... I'm ashamed. LOL.

On Sun, Jul 22, 2012 at 1:44 AM, Tim Matthews <tim.matthews7 at gmail.com> wrote:
>
>
> On Sun, Jul 22, 2012 at 5:43 PM, Tim Matthews <tim.matthews7 at gmail.com>
> wrote:
>>
>>
>>
>> On Sun, Jul 22, 2012 at 5:11 PM, Anonymous Void <bitsofchaos at gmail.com>
>> wrote:
>>>
>>>
>>> but I have no idea what to put into some of the arguments for
>>> regSetValueEx or regCreateKeyEx,
>>
>>
>> Those are just plain bindings to windows function so refer to msdn
>
>


-- 
mysql> insert into female (vagina) select male.penis from male where
penis='sperm';
Query OK, 1 row affected (0.02 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> select * from female;
+--------+
| vagina |
+--------+
| sperm  |
+--------+
1 row in set (0.00 sec)

mysql>

... N' that's how programmers make babies.



More information about the Haskell-Cafe mailing list