FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Registry example using Win32 api

 
Post new topic   Reply to topic     Forum Index -> Tutorials
View previous topic :: View next topic  
Author Message
Lynn



Joined: 27 Aug 2004
Posts: 89

PostPosted: Tue Sep 28, 2004 8:29 pm    Post subject: Registry example using Win32 api Reply with quote

There is sample code for access to the Win32 registry:
http://www.dsource.org/tutorials/index.php?show_example=125

Caveats:
There are some anomalies using a char[] as the input buffer for RegSetValueExA and using a char[] as the destination buffer for RegQueryValueExA (reflecting my newbie understanding of D.) Embarassed

There is an
extern (Windows)
definition for RegQueryValueExA since I couldn't find it in std.c.windows.windows.
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Tue Sep 28, 2004 10:02 pm    Post subject: Reply with quote

Cool.

If you're interested in working with the registry, you might be able to benefit from using std.windows.registry by Matthew Wilson. I'm pretty sure Matthew documented it somewhere, but you might have to download the docs from the synsoft website.
Back to top
View user's profile Send private message AIM Address
Lynn



Joined: 27 Aug 2004
Posts: 89

PostPosted: Wed Sep 29, 2004 6:48 am    Post subject: Reply with quote

I gave std.windows.registry a try, but had problems and perhaps gave up too quickly.

* There were conflicts between registry.d and windows.d.

* The first function I tried had an apparent compiler error, which reduced my confidence in the code:

Code:
LONG  RegQueryValueExA(in HKEY hkey,
             in LPCSTR lpValueName,
             in Reserved,   // <-- won't compile
             out REG_VALUE_TYPE type,
             in void *lpData,
             inout DWORD cbData);


I'll submit a bug report.
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Wed Sep 29, 2004 9:01 am    Post subject: Reply with quote

Lynn wrote:
I gave std.windows.registry a try, but had problems and perhaps gave up too quickly.
I didn't know if you were aware that it existed, so I thought it might be worth a shot.

Lynn wrote:
* There were conflicts between registry.d and windows.d.
That's annoying.

Lynn wrote:
* The first function I tried had an apparent compiler error, which reduced my confidence in the code:
That's definitely a bad sign. Sounds like it might be neglected code. It's probably not even compiled into phobos.lib.
Back to top
View user's profile Send private message AIM Address
Lynn



Joined: 27 Aug 2004
Posts: 89

PostPosted: Fri Oct 01, 2004 7:36 am    Post subject: Reply with quote

Is it possible to revise the tutorial code? I got some info about the buffer declaration to supply to RegQueryValueExA that seems to work better.

Would that be something I provide to you for revisions?

The code shows up as posted by "Anonymous". I wonder if I wasn't logged in?
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Fri Oct 01, 2004 11:19 am    Post subject: Reply with quote

Lynn wrote:
Is it possible to revise the tutorial code? I got some info about the buffer declaration to supply to RegQueryValueExA that seems to work better.

Would that be something I provide to you for revisions?
Sure. Just let me know what to change it to.

Lynn wrote:
The code shows up as posted by "Anonymous". I wonder if I wasn't logged in?
It could be that you weren't logged in, but it might be something wrong with the tutorial system. The PHP that makes the usernames show up is probably too clever.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group