在某些情况下,升级到较新版本后,Windows 10在某些 32 位应用程序中创建窗口时从msctf.dll调用(msctf.dll)CreateWindowEx函数会导致崩溃或其他问题。在这篇文章中,我们将了解 CreateWindowEx函数是什么——探索导致此函数错误的可能原因,然后提供缓解问题的推荐解决方案。
了解CreateWindowEx函数
Windows应用程序,包括使用Windows窗体或Windows Presentation Foundation ( WPF ) 的 .NET 应用程序,通过调用CreateWindowExA或CreateWindowExW函数来创建它们的窗口。
这两个函数在内部调用一个通用的USER32函数,该函数将执行一些参数验证,例如调用中指定的窗口样式和句柄,如果指定了WS_EX_MDICHILD扩展窗口样式,则处理创建(WS_EX_MDICHILD)MDI子窗口并处理调用的当前激活上下文线。如果在CreateWindowEx调用的 USER32(CreateWindowEx)端(USER32-side)一切正常,它会调用 CreateWindowEx 的内核模式 ( WIN32K (CreateWindowEx))(WIN32K)实现。
CreateWindowEx在尝试创建新窗口对象时将执行以下任务:
- 确定为新窗口对象创建句柄是否会超过调用进程的 用户(User)句柄配额限制。
- 从桌面堆中为新窗口对象分配内存。
- 初始化新窗口对象的内存。
- 在用户(User)句柄表中为新窗口对象创建句柄。
CreateWindowEx 失败的原因
一些可以触发CreateWindowEx函数问题的条件列举如下:
- 指定的窗口类不存在。
- 使用无效的窗口样式或扩展的窗口样式。
- 使用无效的用户(User)句柄,例如窗口句柄和菜单句柄。
- 试图在不指定父窗口的情况下创建子窗口。
- 尝试创建子窗口或拥有的窗口,并且指定的父/所有者属于与调用线程不同的桌面。
- 创建子窗口或拥有的窗口将超出嵌套窗口限制。
- 创建一个新的窗口对象将超过调用进程的句柄配额。
- 桌面堆中的可用堆空间不足,无法为新窗口对象分配内存。
- 用户(User)句柄表中没有可用条目。
修复(Fix CreateWindowEx)Windows 10中 32 位应用程序的 CreateWindowEx 函数问题
Microsoft提供了针对CreateWindowEx函数问题的解决方法。
要解决此问题,您必须将Windows 10 安装回滚到以前的版本。
Windows 10中的回滚选项在您升级 Windows 10 安装后的10 天内(10 days)(大多数情况下)可用。
此操作会保留您的个人文件,但会删除升级后安装的应用程序和驱动程序,还会撤消您对设置所做的任何更改。
如果回滚选项不可用 -备份您的个人文件,那么您可以联系您的 IT 支持或帮助台或Microsoft 支持(Microsoft Support)以获取帮助以将您的设备恢复到以前的Window 10版本。
That’s it!
PS:Microsoft 正在制定解决方案,并将在即将发布的Windows 10版本中提供更新。(Windows 10)
CreateWindowEx function issues for 32-bit apps in Windows 10
In some cases, after an upgrade to а newer νersion, the Windows 10 causes crashes or other issues when it calls the CreateWindowEx function from msctf.dll when windows are created in some 32-bit applications. In this post, we will understand what the CreateWindowEx function is – explore the possible causes of this function error and then provide the recommended solution to mitigate the issue.
Understanding the CreateWindowEx function
Windows applications, including .NET applications that use Windows Forms or Windows Presentation Foundation (WPF), create their windows by calling the CreateWindowExA or CreateWindowExW functions.
Both functions internally call a common USER32 function that will perform some parameter validation, such as the window styles and handles specified in the call, handle creating a MDI child window if the WS_EX_MDICHILD extended window style is specified and processes the current activation context for the calling thread. If all is well on the USER32-side of the CreateWindowEx call, it then calls into the kernel-mode (WIN32K) implementation of CreateWindowEx.
CreateWindowEx will perform the following tasks when attempting to create a new window object:
- Determine if creating a handle for the new window object will exceed the User handle quota limit for the calling process.
- Allocates memory for the new window object from the desktop’s heap.
- Initializes the memory for the new window object.
- Creates a handle for the new window object in the User handle table.
Causes of CreateWindowEx failures
Some conditions that can trigger the CreateWindowEx function issue are enumerated as follows:
- The specified window class does not exist.
- Using invalid window styles or extended window styles.
- Using invalid User handles, such as window handles and menu handles.
- Attempting to create a child window without specifying a parent window.
- Attempting to create a child window or an owned window and the specified parent/owner belongs to a different desktop than the calling thread.
- Creating a child or owned window will exceed the nested window limit.
- Creating a new window object will exceed the handle quota for the calling process.
- There is insufficient heap available in the desktop’s heap to allocate memory for the new window object.
- There are no available entries in the User handle table.
Fix CreateWindowEx function issues for 32-bit apps in Windows 10
Microsoft has provided a workaround to the CreateWindowEx function issues.
To work around this issue, you’ll have to roll back your Windows 10 installation to the previous version.
The rollback option in Windows 10 is available for 10 days (in most cases) after you’ve upgraded your Windows 10 installation.
This operation keeps your personal files, but removes applications and drivers that were installed after the upgrade, and also reverses any changes that you made to settings.
If the roll back option isn’t available – backup your personal files, then you can contact your IT support or helpdesk or Microsoft Support for help to restore your device to the previous Window 10 version.
That’s it!
PS: Microsoft is working on a resolution and will provide an update in Windows 10 upcoming release.