Windows: App ‘G’ blocks shutdown

[German]Some users are annoyed by a strange behavior. The shutdown is blocked by a strange app 'G' – which makes many suspect a malware infection. It is simply a Windows bug that will soon be fixed.


The error in detail

If you search the Internet for the term 'App G prevents shutting down', there are hundreds of hits. The error runs from Windows 7 to Windows 10 through the operating system versions. On there is this post for example:

App called "g" is preventing shutdown or restart

Every once and a while there's this app called "g" that prevents my pc from shuting down but I have no idea what it is , does anyone have and idea on what tjis could be?

A user complains that an app named G interferes with the shutdown process. Another user confirms this in the same thread. This post describes the same thing. bestätigt das Ganze im gleichen Thread.

App G blockt Shutdown

The screenshot above shows this display during shutdown. The whole thing is described at in this article.  

App is preventing shutdown or restart

After updating my Windows 10 to creators update (build 15063.138) when I restart or shutdown the PC a screen appears and shows a 'G' app which is preventing the operation.

Is there a way to determine which application it is, or find out more details about it?

I do not see any "g" running process or installed application in my system.

Also in the Steam-Community, in Microsoft Answers forum (here and here) the problem is reported without a solution being found. There is also a German thread on the topic. As a rule, those affected are advised to check the system for malware. At Bleeping Computer, for example, you can find this forum thread with such hints. 


A Bug in Windows

The error has passed me by so far – but Woody Leonhard found the cause and described it in this  Computer World article. Also Woody noticed that there are hundreds of hits on the internet where the problem is described. People are sent to search for malware, but this is without result.

The reason: The whole thing is simply a bug in Windows that has been running for years through various versions. Raymond Chen of Microsoft described the background in the Microsoft developer blog in the article The program "G" is preventing you from shutting down.

Microsoft's developers have noticed some time ago that treating a UTF16-LE Unicode string as an 8-bit string generally takes only the first character. This is because the higher byte of the UTF16-LE code unit is zero for most Western European characters and the zero byte is interpreted as the end of the 8-bit string.

Let's get back to the mysterious "G" program, which blocks the shutdown. When the GDI+ library was created, it had to support Windows 98. However, Windows 98 had very limited support for Unicode. So everything was compiled as ANSI and used the ANSI versions of functions like RegisterClass, CreateWindow and DefWindowProc to create and manage help windows. The lack of Unicode support in the helper window didn't cause any problems since the window never displayed a user interface and never processed text. The window was there to do things like listen to WM_SETTINGSCHANGE messages so it knew when to invalidate its caches.

Later, most of the GDI+ library was recompiled simply as a Unicode component, not as an ANSI component. However, the notification window procedure contained an explicit call to DefWindowProcA. Most character set mismatches are detected by the compiler due to a type mismatch. However, the font dependency in DefWindowProc is not encoded in the parameter types. Therefore, this discrepancy was not detected by the compiler.

This discrepancy was also not detected during testing, since the notification window does not output any text. The title of the window "GDI+ Hook Window" was simply truncated to "G". But since this title is not used for anything, it didn't matter, the window title is never displayed to the user. Only if the program hangs at shutdown, the truncated string G is used. The error described above is noticed.

A Fix comes for Windows 10 20H1

Microsoft's developers have included a fix for the problem in the announcement of Windows 10 Insider Preview Build 19013. Jen Gentleman pointed this out in this tweet at the end of October::

The change log for the insider build 19013 already contains this reference to the correction of the bug:

Some of you have reached out about when trying to shutdown, seeing a message saying that an app named "G" was preventing shutdown. We investigated and found an issue where windows related to GDI+ were only referenced as "G." We've fixed this, so going forward, these will now have the name "GDI+ Window (<exe name>)", where <exe name> will show the .exe name of the app using GDI+.

So a fix exactly the error mentioned above, so that from the Windows 10 release in spring 2020, the application that hangs on shutdown will also be correctly named. 

Cookies helps to fund this blog: Cookie settings

This entry was posted in issue, Windows and tagged , . Bookmark the permalink.

Leave a Reply

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