Closed Bug 634823 Opened 9 years ago Closed 9 years ago

Design an API for accessing the Windows registry for use in our codebase

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ehsan, Assigned: ehsan)

Details

The Windows registry API is extremely difficult to use correctly, and I've seen many sloppy uses of the APIs throughout our code base (recent example: bug 634819).

It is not a good idea to expect all of our developers and reviewers to understand how to wrap their heads around this madness.

We need to get our own APIs, which have a very simple interface, hand out safe types to callers, and make invalid usage impossible, and then we need to switch our code base to the new API.

I'm willing to do this post 2.0.
The Chrome equivalent is at:
http://src.chromium.org/viewvc/chrome/trunk/src/base/win/registry.h?revision=HEAD&view=markup

It seems sane and could probably serve as a good starting point.
(In reply to comment #1)
> The Chrome equivalent is at:
> http://src.chromium.org/viewvc/chrome/trunk/src/base/win/registry.h?revision=HEAD&view=markup
> 
> It seems sane and could probably serve as a good starting point.

Thanks Jeff.  I took a brief look and their code also suffers from at least one of the same problems as our current code does (not making sure that REG_SZ values are null terminated)...
Something different from nsIWindowsRegKey which we already have?
(In reply to comment #3)
> Something different from nsIWindowsRegKey which we already have?

That seems exactly like what I had in mind, only better.  I didn't know about this API!
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Whiteboard: [post-2.0]
You need to log in before you can comment on or make changes to this bug.