www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - binary values from reg_value_a

reply Dave Brooks <dave brooksnet.com> writes:
Hello,

I started using winstl over the past few months, after reading Matthew's 
articles in CUJ, and have been impressed with--and have gotten some good 
results--from the model.

My question is about the registry access functions, specifically getting 
arbitrary length binary values.  I can make a registry key sequence, 
then a value sequence, and iterate through the values, no problem.  I 
use a switch statement on type(), and the results I'm getting from 
value_sz() and value_dword() are correct, if you assume that regedit is 
correct that is.

I'm looking for recommendations on getting the "blob".  If I use 
value_sz(), the resulting string terminates at the first null it 
encounters.  When fetching a reg_value_a where type() is REG_BINARY, I 
can step through value_sz() and see that the correct data_size is 
returned from reg_query_value.  However, calling size() on the returned 
string shows a length that reflects a null terminated string; for an 
arbitrary data structure this might include just the first few bytes.

I've tried calling data() and length() with no better results.  I 
noticed that reg_binary() is commented out of the code and reg_blob is 
undefined.

What do you recommend?  I'm usng VC6 (upgrading a Win98 product at the 
moment) and otherwise have no real problems with winstl or boost or 
stlport or others.  I'll have to do this in Win2k/XP shortly.

Thanks in advance,
Dave
Jul 16 2003
parent reply "Matthew Wilson" <matthew stlsoft.org> writes:
Hi Dave

 Hello,
Hi Dave
 I started using winstl over the past few months, after reading Matthew's
 articles in CUJ, and have been impressed with--and have gotten some good
 results--from the model.
Thanks very much. It's good to be appreciated. (btw, I hope you'll read this month's - August's - CUJ and let me know what you think about it. There'll be a lot more of me in CUJ very soon, as well, so I hope you'll keep giving the feedback - good or bad - as it really helps with getting STLSoft of higher and higher quality.)
 My question is about the registry access functions, specifically getting
 arbitrary length binary values.  I can make a registry key sequence,
 then a value sequence, and iterate through the values, no problem.  I
 use a switch statement on type(), and the results I'm getting from
 value_sz() and value_dword() are correct, if you assume that regedit is
 correct that is.
Cool
 I'm looking for recommendations on getting the "blob".  If I use
 value_sz(), the resulting string terminates at the first null it
 encounters.  When fetching a reg_value_a where type() is REG_BINARY, I
 can step through value_sz() and see that the correct data_size is
 returned from reg_query_value.  However, calling size() on the returned
 string shows a length that reflects a null terminated string; for an
 arbitrary data structure this might include just the first few bytes.

 I've tried calling data() and length() with no better results.  I
 noticed that reg_binary() is commented out of the code and reg_blob is
 undefined.
:) This has been on my todo list for over a year, so I guess it's time that someone bugged me for it. I've just spent the last couple of hours implementing a cursory reg_blob (it's now a template, btw) and reg_value_type::value_binary(), and it all seems to work ok. You may have seen in reg_value_sequence_test that it enumerates the contents of HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer" which on my machine now shows the following: WebFindBandHook: ["{68F2D3FC-8366-4a46-8224-58EFA2749425}"] FileFindBandHook: ["{FFAC7A18-EDF9-40de-BA3F-49FC2269855E}"] Logon User Name: ["Matty"] ShellState: [ 24 00 00 00 37 28 00 00 00 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 0d 00 00 00 00 00 00 00 03 00 00 00 ] . . . <snip> which corresponds exactly with the contents as given by RegEdit. (ShellState is a blob.)
 What do you recommend?  I'm usng VC6 (upgrading a Win98 product at the
 moment) and otherwise have no real problems with winstl or boost or
 stlport or others.  I'll have to do this in Win2k/XP shortly.
I've so far only tested on VC6 on Windows XP, but it works fine. (It also compiles fine with Borland 5.6, CodeWarrior 8, Digital Mars 8.34, Visual C++ 7.1) Now, here's the slight rub. At the moment I am incredibly snowed under (I am, crazily, writing a book, for my sins!), so am not planning a release for some time. I was maybe going to do 1.6.5 to provide support for Intel 7.1, but there has been a delay with its shipment, so it's more likely that I'll just wait until 1.7.1 which I had planned to do at the end of this month, but will likely slip into August. It's going to be a very significant release, with lots of new components in existing sub-projects (especially ATLSTL, COMSTL and WinSTL), and probably also seeing the release of two new sub-projects (WTLSTL and .netSTL) so there's a good likelihood that it'll be awhile. So, that doesn't really help you, does it? ;/ I'm not going to be able to just send you winstl_reg_value.h & winstl_reg_value_sequence.h, as I've made a number of other changes to various files, which would make them probably slightly incompatible with your existing 1.6.4 set. I can see two possible solutions. (i) I can simply send you personally a cut of the current STLSoft tree. Though I can't guarantee that nothing's broken since 1.6.4, I'd be very surprised if it had. Naturally I couldn't start to fully support this as a separate branch, so you'd be somewhat on your own. (That's not to say I wouldn't help, but I'm just really busy, so any help may not be rapidly forthcoming.) (ii) I can post all 1.6.4+ changed files here as a zip for anyone/everyone who wants them. There'd be no general support, for the reasons given above. Either way, there would be *no* guarantee that the STLSoft 1.6.4+ I'd ship you would work with any other compiler than VC6 (though I'd be very surprised if it didn't work with VC 7.0 and 7.1 also). Let me know what you want to do.
 Thanks in advance,
 Dave
You're welcome in retrospect. Matthew -- Matthew Wilson STLSoft moderator and C++ monomaniac mailto:matthew stlsoft.org http://www.stlsoft.org news://news.digitalmars.com/c++.stlsoft "So far, C++ is the best language I've discovered to say what I want to say" -- Alex Stepanov ---------------------------------------------------------------------------- ---
Jul 16 2003
parent reply Dave Brooks <dave brooksnet.com> writes:
Matthew Wilson wrote:
 Hi Dave
Hi Matthew, Thanks for getting back to me on this!
 Thanks very much. It's good to be appreciated. (btw, I hope you'll read this
 month's - August's - CUJ and let me know what you think about it. There'll
 be a lot more of me in CUJ very soon, as well, so I hope you'll keep giving
 the feedback - good or bad - as it really helps with getting STLSoft of
 higher and higher quality.)
Actually, I was going to mention that article but didn't for the sake of brevity only. I really liked the shims concept, having not looked into it before, and had already talked to one of the other developers about it in the context useful information on getting our work done, and managing complexity. Are you taking over Thomas Becker's slot? I've enjoyed his work but have enjoyed yours also. In fact I first looked up STLSoft after your article on integer to string conversion, which is the first one I remember seeing.
 :) This has been on my todo list for over a year, so I guess it's time that
 someone bugged me for it. 
Buzz! :-) Never tried that role before; I'm usually the one here getting bugged!
 I've just spent the last couple of hours
 implementing a cursory reg_blob (it's now a template, btw) and
 reg_value_type::value_binary(), and it all seems to work ok. You may have
 seen in reg_value_sequence_test 
Excellent!; and, I did.
 I've so far only tested on VC6 on Windows XP, but it works fine. (It also
 compiles fine with Borland 5.6, CodeWarrior 8, Digital Mars 8.34, Visual C++
 7.1)
 
 Now, here's the slight rub. At the moment I am incredibly snowed under (I
 am, crazily, writing a book, for my sins!), 
Well, let us know, OK? I'd be happy to look it over for you if that would help. I've done that in the past for publishers; I can at least tell you which parts I understand. However, I expect that with your audience courtesy CUJ and STLSoft there is not a lack of qualified readers.
 It's going to be a very significant
 release, with lots of new components in existing sub-projects (especially
 ATLSTL, COMSTL and WinSTL), and probably also seeing the release of two new
 sub-projects (WTLSTL and .netSTL) 
That all sounds pretty good!
 I can see two possible solutions.
 
 (i) I can simply send you personally a cut of the current STLSoft tree.
 Though I can't guarantee that nothing's broken since 1.6.4, I'd be very
 surprised if it had. Naturally I couldn't start to fully support this as a
 separate branch, so you'd be somewhat on your own. (That's not to say I
 wouldn't help, but I'm just really busy, so any help may not be rapidly
 forthcoming.)
That would actually work for me if it's no trouble for you. My current project is a test/proof of concept. The blobs are important for an end result but if you hadn't had the oppportunity to reply to my post, I was going to extract the binary bits another way, and was contemplating on the way to work the alternatives. A more final version won't need to exist for at least a month or so.
 (ii) I can post all 1.6.4+ changed files here as a zip for anyone/everyone
 who wants them. There'd be no general support, for the reasons given above.
 
 Either way, there would be *no* guarantee that the STLSoft 1.6.4+ I'd ship
 you would work with any other compiler than VC6 (though I'd be very
 surprised if it didn't work with VC 7.0 and 7.1 also).
 
 Let me know what you want to do.
Which ever is best for everyone works for me. Thank you very much! Cheers! Dave
Jul 17 2003
parent reply "Matthew Wilson" <matthew stlsoft.org> writes:
 Thanks for getting back to me on this!
Welcome. :)
 Actually, I was going to mention that article but didn't for the sake of
 brevity only.  I really liked the shims concept, having not looked into
 it before, and had already talked to one of the other developers about
 it in the context useful information on getting our work done, and
 managing complexity.
Cool. Remember that shims doesn't just apply to C-strings. The next significant version of STLSoft (1.7.1) will contain a serious amount of pointer access shims, for ATL, COM, and pretty much anything else you can shake a stick at.
 Are you taking over Thomas Becker's slot?  I've enjoyed his work but
 have enjoyed yours also.  In fact I first looked up STLSoft after your
 article on integer to string conversion, which is the first one I
 remember seeing.
Cool. I can see the marketing strategy is working. ;)
 Buzz!  :-)  Never tried that role before; I'm usually the one here
 getting bugged!
:)
 Well, let us know, OK?  I'd be happy to look it over for you if that
 would help.  I've done that in the past for publishers; I can at least
 tell you which parts I understand.  However, I expect that with your
 audience courtesy CUJ and STLSoft there is not a lack of qualified
readers. One can always use more reveiwers.
 It's going to be a very significant
 release, with lots of new components in existing sub-projects
(especially
 ATLSTL, COMSTL and WinSTL), and probably also seeing the release of two
new
 sub-projects (WTLSTL and .netSTL)
That all sounds pretty good!
I just hope I can enough time to get all the things I want planned into it.
 I can see two possible solutions.

 (i) I can simply send you personally a cut of the current STLSoft tree.
 Though I can't guarantee that nothing's broken since 1.6.4, I'd be very
 surprised if it had. Naturally I couldn't start to fully support this as
a
 separate branch, so you'd be somewhat on your own. (That's not to say I
 wouldn't help, but I'm just really busy, so any help may not be rapidly
 forthcoming.)
That would actually work for me if it's no trouble for you. My current project is a test/proof of concept. The blobs are important for an end result but if you hadn't had the oppportunity to reply to my post, I was going to extract the binary bits another way, and was contemplating on the way to work the alternatives. A more final version won't need to exist for at least a month or so.
I'll do that. Please bear in mind all my caveats. :)
Jul 17 2003
next sibling parent reply "Greg Peet" <admin gregpeet.com> writes:
"Matthew Wilson" wrote:
 Are you taking over Thomas Becker's slot?  I've enjoyed his work but
 have enjoyed yours also.  In fact I first looked up STLSoft after your
 article on integer to string conversion, which is the first one I
 remember seeing.
Cool. I can see the marketing strategy is working. ;)
That article is also what prompted me to contact you and check out stlsoft, remember? You should list that article on your site as a must read! If it wasn't for that article, my TetriSDL project would never have been completed (for the score status bar)...until of course I got a message from The Tetris Compnay LLC stating my project's name was too similar causing me to remove it from sourceforge =''''''(
Jul 17 2003
parent reply Dave Brooks <dave brooksnet.com> writes:
Greg Peet wrote:

 [...] my project's name was too similar causing me to remove
 it from sourceforge =''''''(
Bummer, Greg! What did you end up calling it? I checked the STLSoft materials at your site the other day (researching the original issue) but your actual page was still under construction. Just curious! Dave
Jul 18 2003
parent "Greg Peet" <admin gregpeet.com> writes:
"Dave Brooks" wrote:
 [...] my project's name was too similar causing me to remove
 it from sourceforge =''''''(
Bummer, Greg! What did you end up calling it? I checked the STLSoft materials at your site the other day (researching the original issue) but your actual page was still under construction.
My project was called TetriSDL. It used the SDL library ( www.libsdl.org). I am remaking it from scratch (as I forgot to download the CVS snapshot to my PC) =( The new name is Vetros (Vetro meaning glass in italian) with the S for the word Tetris (in other words: falling glass objects that crash when you create a line across). We, as developers, are allowed to make clones of famous games, but cannot refer to any names used in the original (copyrighted) products. Thanks for doing a check out at my site. It will be up soon, I have just been spending more time on the STLSoft FAQ to get the PHP working with the MySQL. Plus, I wanted some project or library finished for the spotlight on my site. =) (tries to look impressive)
Jul 18 2003
prev sibling parent Dave Brooks <dave brooksnet.com> writes:
Matthew Wilson wrote:
 Cool. Remember that shims doesn't just apply to C-strings. 
Understood; string classes and data types (e.g. BSTR) are ubiquitious, as you mentioned in the article, but other things definitely came to mind as I read.
 The next
 significant version of STLSoft (1.7.1) will contain a serious amount of
 pointer access shims, for ATL, COM, and pretty much anything else you can
 shake a stick at.
Looking forward to it! In due time.
 Cool. I can see the marketing strategy is working. ;)
Yeah; one thing that has always gotten my attention is "Hey, this works". Years ago I was at one of the X Window technical conferences in Boston. A number of people had talked about Motif, size of code, size of executables, etc. John Osterhout gave his presentation on TCL/Tk (I think it was the first time in a public forum) and I remember the sound of many feet hitting the floor in unison as people jumped out of their seats and ran to the front to get his handout. This was immediately following his examples of small code size, followed by a statment of the small executable size. Point it, the stuff worked and filled a need that was keenly felt.
 One can always use more reveiwers.
Well, I like to read and use what I see there, so it could work out! I'll send you the materials you asked for.
 I just hope I can enough time to get all the things I want planned into it.
Good luck!
 I'll do that. Please bear in mind all my caveats. :)
All caveats duly noted and expectations adjusted accordingly. My needs at this point are not extreme. Best regards, Dave
Jul 18 2003