1

I noticed that my MFC based applications (also using BCGControlBar Pro) is creating several keys under the application key with a GUID (e.g. Computer\HKEY_CURRENT_USER\SOFTWARE\Acme\Program Name\3CF4873E-E8CC-4e67-A3D2-56F5B610B4FA). In those keys are a single REG_SZ value named Untitled with the Data blank (empty string).

This must be something the framework is doing because I don't create them. What are these and how do I stop it from happening?

Thanks.

user3161924
  • 1,849
  • 18
  • 33
  • 1
    Just an 'educated guess' but maybe they're keys used for 'auto-restart' if/when your program crashes. I used to get loads of them, until I disabled that feature. – Adrian Mole Feb 27 '21 at 00:05
  • i haven't had any crashes, but there is the restart manager support, wonder if that's possible where system restarts from updates, etc.. ? Hmm, I uses restart manager for updates for it to restart, was there some other "auto-restart" option you're talking about? – user3161924 Feb 27 '21 at 00:37
  • I *think* the entries were mostly added when I had crashes, etc. Not sure. Can you temporarily disable the restart manager and see if they stop appearing? At least, you'll then know what's causing them. – Adrian Mole Feb 27 '21 at 00:40
  • Your right!! I did an upgrade and it added that key. So windows updates reboots must do the same. Man, I really like to use the restart manager, maybe i'll mess around capturing the restart message and not sending it off to MFC or something? Do you happen to know any test built-in utility to force a restart using restart manager on an app? – user3161924 Feb 27 '21 at 00:55
  • To force restart manager to activate, you only need to add a serious bug in your code. You can add a menu command (or whatever) that causes a write to a null pointer: that will generally do the trick. – Adrian Mole Feb 27 '21 at 00:56
  • FWIW, you can disable the in-built restart manager and roll your own. It's a bit of work: typically, write a registry entry, schedule the restart, then exit; on startup, check for that registry entry and, if it's there, act accordingly. (Then you can delete that entry.) That's what I do to handle my "Check for update..." command. – Adrian Mole Feb 27 '21 at 01:02
  • ok, I'm going to try AFX_RESTART_MANAGER_SUPPORT_RESTART | AFX_RESTART_MANAGER_SUPPORT_RECOVERY instead of ALL. I found there used to be a RMTOOL.EXE part of Microsoft Logo Testing Tools, does anyone know where that is now? – user3161924 Feb 27 '21 at 01:25

1 Answers1

0

The problem was as @Adrian Mole suspected above. It has to do with the Restart Manager implementation in MFC. The interesting thing is I couldn't reproduce the problem in a Debug build, only a Release build.

Since my application really isn't document based where you open and save a file, I was able to solve it by changing the option in the MFC CWinApp class for my application from:

m_dwRestartManagerSupportFlags=AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS;

to

m_dwRestartManagerSupportFlags=AFX_RESTART_MANAGER_SUPPORT_RESTART | AFX_RESTART_MANAGER_SUPPORT_RECOVERY;

Also, in the windows-classic-samples-master you'll find a rmfilterapp you can modify to easily test your app using the Restart Manager.

user3161924
  • 1,849
  • 18
  • 33