<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body alink="#ee0000" bgcolor="#ffffff" link="#0000ee" text="#ffffff"
vlink="#551a8b">
<font color="#000055">I was attempting to wrapper up get and
write-resource from the mred.ss library, for use specifically on the
windows registry when I came across the following anomaly. I can get
correct values from the registry, but when I write a value to the
registry, write-resource reports #t, meaning a successful write, but a
subsequent get shows the value unchanged. These findings are
consistent with what I see in regedit.exe. I was running as an
administrator, under XP Pro SP2. I also tried the code outside the
module context under Pretty-Big with the same results. Below find the
code and results.<br>
-------------------BEGIN DEFINITIONS-------------------<br>
(module registry mzscheme<br>
(provide get-registry put-registry)<br>
(require (only (lib "mred.ss" "mred") get-resource write-resource))<br>
;;;<br>
;;; Define API<br>
;;;<br>
(define get-registry #f)<br>
(define put-registry #f)<br>
(let ()<br>
(set! get-registry<br>
(lambda (section entry)<br>
(let ([b (box "")])<br>
(get-resource section entry b)<br>
(unbox b))))<br>
(set! put-registry<br>
(lambda (section entry value)<br>
(write-resource section entry value)))<br>
)<br>
)<br>
#|<br>
<test-suite><br>
|#<br>
</font><font color="#000055">(require registry)<br>
</font><font color="#000055">(get-registry "HKEY_CURRENT_USER"
"Environment\\$CVSROOT")<br>
(put-registry "HKEY_CURRENT_USER" "Environment\\$CVSROOT" "C:\\cvsroot")<br>
(get-registry "HKEY_CURRENT_USER" "Environment\\$CVSROOT")<br>
--------------------END DEFINITIONS-----------------------<br>
--------------------BEGIN OUTPUT---------------------------<br>
Welcome to DrScheme, version 369.8-svn2mar2007 [3m].<br>
Language: Pretty Big (includes MrEd and Advanced Student).<br>
"v:/cvsroot"<br>
#t<br>
"v:/cvsroot"<br>
><br>
--------------------END OUTPUT------------------------------ </font><br>
<pre class="moz-signature" cols="72"><font color="#000055">Is this a known problem?
Thanks,
--kyle
Kyle Smith
airfoil at bellsouth dot net
</font>schemekeys.blogspot.com
</pre>
</body>
</html>