The MASM Forum

General => The Campus => Topic started by: Zen on June 03, 2015, 04:06:29 AM

Title: Where is RegGetValue ?
Post by: Zen on June 03, 2015, 04:06:29 AM
I'm writing some Registry search code, which is tedious and boring.
Registry Functions, MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724875(v=vs.85).aspx)
...And, because I'm inept,...I'm just thrashing what would otherwise be a functional, if incredibly bloated, program.
So,...I invoke alot. And, I tried to invoke RegGetValue (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724868(v=vs.85).aspx), only to discover when I tried to compile the executable, that RegGetValue is not prototyped in Advapi32.inc with the rest of the Registry Functions. It's OK,...I can use RegEnumValue (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724865(v=vs.85).aspx),...it has the same functionality, and, is actually more fun,...
Apparently, RegGetValue was added in Windows Vista. Has anybody else noticed this ? Would anybody here actually use it ?
If I create the prototype in my source, Advapi32.lib still doesn't link to the actual function, does it ?
Title: Re: Where is RegGetValue ?
Post by: dedndave on June 03, 2015, 04:45:17 AM
no - you would also need to create a new LIB file
you could use Erol's tools for that job

but, there's really no need to use that function
in fact, if you do, it will probably make you incompatible with XP
Title: Re: Where is RegGetValue ?
Post by: TWell on June 03, 2015, 04:53:25 AM
Shlwapi.lib has registry functions too.
here (https://msdn.microsoft.com/en-us/library/windows/desktop/bb773477%28v=vs.85%29.aspx)
Title: Re: Where is RegGetValue ?
Post by: jj2007 on June 03, 2015, 06:06:04 AM
Quote from: Zen on June 03, 2015, 04:06:29 AM
I'm writing some Registry search code, which is tedious and boring.

It is, it is. And it's awfully slow - just try the built-in search of regedit ::)
But there is a fast alternative, see attachment (open the *.asc in WordPad). Line 5 has the gotcha, and porting it to plain Masm32 should be fairly easy and straightforward.
Title: Re: Where is RegGetValue ?
Post by: Zen on June 03, 2015, 06:42:08 AM
DAVE, TWELL, and JOCHEN,
Thanks,...this is exactly what I needed to know.
In fact, I have already coded the Registry search with RegEnumValue, and, it's just what I needed. It's better, in fact.

I've been playing around with Japheth's original COMView (http://web.archive.org/web/20141003032346/http:/www.japheth.de/), which is so useful. I somehow managed to lose the source code (he used to give it away), but, re-creating the functionality is not too challenging. So, that's what I'm working on, updating COMView. Hopefully, I can add some cool new features. Running a 32-bit App on WOW64 can be weird (https://msdn.microsoft.com/en-us/library/windows/desktop/aa365743(v=vs.85).aspx) if you are accessing the Registry: Accessing an Alternate Registry View (https://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx).
If you have any wild ideas,...I'd love to hear them.  :icon_mrgreen:

...I have a couple of ideas that definitely within the realm of Mission Impossible,...
Title: Re: Where is RegGetValue ?
Post by: jj2007 on June 03, 2015, 10:21:35 AM
Quote from: Zen on June 03, 2015, 06:42:08 AMRunning a 32-bit App on WOW64 can be weird (https://msdn.microsoft.com/en-us/library/windows/desktop/aa365743(v=vs.85).aspx)

KEY_QUERY_VALUE or KEY_WOW64_64KEY if needed, but it's rarely relevant. In fact, if you find a nice example where the difference is important, let me know - I need one for SetReg64 (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1279)...
Title: Re: Where is RegGetValue ?
Post by: Zen on June 07, 2015, 05:24:48 AM
Humor: Was The Windows Registry a Good Idea?, Aug 2007 (http://blog.codinghorror.com/was-the-windows-registry-a-good-idea/)

Good Review by Raymond Chen here: Why Is the Registry a Hierarchical Database Instead of a Relational One?, Sept 2011 (http://blogs.msdn.com/b/oldnewthing/archive/2011/09/07/10206968.aspx)

...Here is an astute observation from Raymond Chen:
Quote from: RAYMOND CHENGiven the heterogeneity of the data the registry needs to keep track of, imposing some sort of uniform schema is doomed to failure.

...In addition (Raymond Chen, again):
Quote from: RAYMOND CHENIn other words, make it a total free-for-all. In which case, why do you need a schema at all? Just leave it as an unregulated collection of name/value pairs governed by convention rather than rigid rules, as long as the code which writes the information and the code which reads it agree on the format of the information and where to look for it.