Skip to Content
Managing The Windows 2000 Registry
book

Managing The Windows 2000 Registry

by Paul Robichaux
August 2000
Intermediate to advanced
558 pages
16h 53m
English
O'Reilly Media, Inc.
Content preview from Managing The Windows 2000 Registry

Programming with C/C++

The API examples and documentation in earlier sections all present the Registry API in its native C/C++ form. Since many administrators are comfortable with C and/or C++, I’ll start the programming examples by presenting three distinct uses for the Registry API routines I’ve already presented.

Example: Watching a Key for Changes

RegNotifyChangeKeyValue is a little-used, but very useful, routine. It’s only present in Windows 2000 and NT, which perhaps accounts for its relative anonymity. If you need to be notified when a key or its values changes, it’s the best tool for getting you that notification. WatchKey, shown in Example 8-4, is a small utility that takes advantage of RegNotifyChangeKeyValue to warn you when a key you specify has been changed.

How the code works

After a check of its initial command-line arguments, the code performs the following steps:

  1. It identifies which root key “owns” the key you want to monitor; this is required because RegOpenKeyEx needs an already open key (i.e., one of the roots) to open the target key. If it can’t figure out which root the user specified, it prints an error and exits.

  2. It captures the pathname of the key to monitor and uses it, along with the root key, to call RegOpenKeyEx. The key is opened with KEY_READ access, which includes KEY_NOTIFY access too. If the key can’t be opened, the code generates an error message and exits.

  3. The target key is monitored with a call to RegNotifyChangeKeyValue. The code passes ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Microsoft® Windows® 2000 Security Handbook

Microsoft® Windows® 2000 Security Handbook

Jeff Schmidt
Windows Registry Troubleshooting

Windows Registry Troubleshooting

MVP Mike Halsey, MVP Andrew Bettany
Windows Server® 2012 Unleashed

Windows Server® 2012 Unleashed

Rand Morimoto, Michael Noel, Guy Yardeni, Omar Droubi, Andrew Abbate, Chris Amaris

Publisher Resources

ISBN: 1565929438Catalog PageErrata