Language selection: [日本語(Japanese)]

Restart Manager for Desktop app #5 (Test tool)

Last time (Sorry, but it is posted only in Japanese), I checked the operation of the restart manager about the package created with File Package App. When creating that post, I thought good if there was a tool that could easily check all behaviors. I created a test tool there.

Restart Manager Test Tool

With general applications, you can only check the behavior of the restart manager with the behavior of that application. I wanted to check various operations about the restart manager, and I created a test tool.

Restart Manager Test Tool

Download and feature details are here.

There are two EXE files in the zip file. RestartManagerTest.exe is a 32-bit application that can be launched on both 32-bit Windows and 64-bit Windows. RestartManagerTest64.exe is a 64-bit application that can be launched on 64-bit Windows only.

With this tool you can test the behavior of the API and WM_QUERYENDSESSION message for the restart manager introduced in Windows Vista.

Restart Manager Test 1.0.4 – main window

Testing the APIs

The APIs that can be tested are as follows.

  • Register the application restart (RegisterApplicationRestart)
  • Unregister the application restart (UnregisterApplicationRestart)
  • Register the shutdown block reason (ShutdownBlockReasonCreate)
  • Unregister the shutdown block reason (ShutdownBlockReasonDestroy)

You can try these with the buttons in the upper left area of the main window.

Testing the WM_QUERYENDSESSION message

The functions that you can try when you receive the WM_QUERYENDSESSION message are as follows.

  • Register the application restart (RegisterApplicationRestart)
  • Unregister the application restart (UnregisterApplicationRestart)
  • Register the shutdown block reason (ShutdownBlockReasonCreate)
  • Wait for a fixed time (20 seconds)
  • Return value setting (true or false)

You can try these by checking the check box in the upper right area of the main window.

Operation confirmation with RmLogoTest.exe

RmLogoTest.exe is a tool to test the correspondence status of the restart manager of the desktop application and it is in the Windows App Certification Kit. The Windows App Cerification Kit is included in the Windows SDK. The latest Windows SDK in 2018 is Windows 10 SDK. When you install Windows 10 SDK, Windows App Cerification Kit will be installed in the following location.

64 bit Windows:
C:\Program Files (x86)\Windows Kits\10\App Certification Kit\

32 bit Windows:
C:\Program Files\Windows Kits\10\App Certification Kit\

RmLogoTest.exe is in this folder.

You can check the success pattern / failure pattern of RmLogoTest.exe using this Restart Manager Test tool.

Confirm that the app can be terminated simply

Uncheck all checkboxes in the upper right area of the main window (When receiving WM_QUERYENDSESSION).

> RmLogoTest.exe ProcessId
LOGO Validation PASSED. Successfully stopped process id ProcessId

The app will terminate without problems. Since the app is simply finished, the app will not restart.

Confirmation that app can be restarted (registering in message handler)

Check only the check box of Call RegisterApplicationRestart() in the upper right area of the main window (When receiving WM_QUERYENDSESSION).

> RmLogoTest.exe ProcessId
LOGO Validation PASSED. Successfully stopped process id ProcessId

Note: One or more applications or services were restarted

Register the app restart at the time of receiving WM_QUERYENDSESSION message, and the app will restart without any problems.

Confirmation that the app can be restarted (registered in advance)

Uncheck all checkboxes in the upper right area of the main window (When receiving WM_QUERYENDSESSION). Before executing RmLogoTest.exe, register the app restart by clicking the [RegisterApplicationRestart()] button in the upper left area. After that, start RmLogoTest.exe.

> RmLogoTest.exe ProcessId
LOGO Validation PASSED. Successfully stopped process id ProcessId

Note: One or more applications or services were restarted

Even if you register the app restart before the timing of receiving the WM_QUERYENDSESSION message, the app restarts without any problems.

Confirm that you can refuse shutdown

Check only the Return false check box  in the upper right area of the main window (When receiving WM_QUERYENDSESSION).

> RmLogoTest.exe ProcessId
LOGO Validation FAILED. Unable to shutdown registered process id ProcessId with error code 0000015f

Debugging Information --
# of Proc/Svcs : 1
Reboot ReasonCode: 00000000

Session 1, Pid 6220, Type 1, Status 1 - RestartManagerTest ()

Because app refused shutdown, it will be FAILED as a logo test, but it behaves as expected.

Confirm when processing takes time in the message handler

Check only the check box of Wait 20 sec. in the upper right area of the main window (When receiving WM_QUERYENDSESSION).

> RmLogoTest.exe ProcessId
LOGO Validation FAILED. Unable to shutdown registered process id ProcessId with error code 0000015f

Debugging Information --
# of Proc/Svcs : 1
Reboot ReasonCode: 00000000

Session 1, Pid 6220, Type 1, Status 1 - RestartManagerTest ()

It will take 5 seconds or more in the message handler, so it will be FAILED as a logo test, but it behaves as expected.

Confirm that the shutdown block reason is displayed

RmLogoTest.exe can not confirm that the shutdown block reason is correctly registered. Therefore, We actually sign out, shut down or restart to confirm the operation.

Register the reason for rejection within message handler

Check only the Call ShutdownBlockReasonCreate() and Return false check boxes in the upper right area of the main window (When receiving WM_QUERYENDSESSION).

  1. In the edit box under the [ShutdownBlockReasonCreate()] button, set the rejection reason text (for example, Test for refusing shutdown).
  2. Sign out, shutdown or reboot

The reason for shutdown refusal will be registered at the timing of receiving the WM_QUERYENDSESSION message. After that, the reboot screen shows the following, and the reason for refusing shutdown (Test for refusing shutdown) is displayed.

Test for restart refusal

Register for rejection reason in advance

Check only the Return false check box in the upper right area of the main window (When receiving WM_QUERYENDSESSION).

  1. In the edit box under the [ShutdownBlockReasonCreate()] button, set the rejection reason text (for example, Test for refusing shutdown).
  2. Click the [ShutdownBlockReasonCreate()] button.
  3. Sign out, shutdown or reboot

At the time of receiving the WM_QUERYENDSESSION message, the reason for shutdown refusal is not registered, but the reboot screen shows the following, and the reason of refusing shutdown (Test for refusing shutdown) is displayed.

Test for restart refusal

Thus, with this Restart Manager Test Tool you can test on the restart manager introduced in Windows Vista.

One Reply to “Restart Manager for Desktop app #5 (Test tool)”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.