I'm facing a peculiar issue that I can't fix. I discovered recently that my Win 8.1 Update 1 (with all updates through WSUS offline) starts eating all the CPU when opening "the device and printers" window.
There's a 5-10' delay until the devices appear however the CPU keeps on spinning even after the icons are displayed for about 5-10' more minutes.
Xperf file (thanks to @magicandre1981 for instructions) is posted on Dropbox - 24MB zip unpacked to 145MB.
Looking through Sysinternals process explorer it seems the problem is caused by MultiByteToUnicodeN
call (unfortunately I cannot post an image):
ntdll.dl!RtlMultiByteToUnicodeN+0x1cf0
ntdll.dl!RtlMultiByteToUnicodeN+0x1cf0
ntdll.dl!RtlMultiByteToUnicodeN+0x1cf0
ntdll.dl!RtlMultiByteToUnicodeN+0x1cf0
ntdll.dl!RtlMultiByteToUnicodeN+0x1cf0
SHCORE.dll!GetScaleFactorForDevice+0x1d4
FunDisc.dll!DllCanUnloadNow+0x2e8
SHCORE.dll!GetScaleFactorForDevice+0x1d4
SHCORE.dll!GetScaleFactorForDevice+0x1d4
windows.immersiveshell.serviceprovider.dll!
SHCORE.dll!GetScaleFactorForDevice+0x1d4
SHCORE.dll!GetScaleFactorForDevice+0x1d4
SHCORE.dll!GetScaleFactorForDevice+0x1d4
SHCORE.dll!GetScaleFactorForDevice+0x1d4
Explorer.EXE
Any ideas how to fix this? Either I wait 20' or so or have to kill the explorer task. I've tried reinstalling all the devices to no avail; for some reason rendering this window causes the unicode translation to eat all the CPU.
Update with symbols
Based on the comment received, I've installed the retail symbols for windows 8.1 and pointed process explorer (as explained in this post to it however the output looks pretty much the same. I've looked at the stack for a thread and it seems it is spending most of its time in the synchronizing on one object:
ntoskrnl.exe!KeSynchronizeExecution+0x2246
ntoskrnl.exe!KeRemoveQueueEx+0x108e
ntoskrnl.exe!KeRemoveQueueEx+0xae9
ntoskrnl.exe!KeWaitForSingleObject+0x22a
ntoskrnl.exe!KeSetBasePriorityThread+0x4ec
ntoskrnl.exe!KeRemoveQueueEx+0x281d
ntoskrnl.exe!KiCheckForKernelApcDelivery+0x23
ntoskrnl.exe!SeQuerySessionIdToken+0x1b99
ntoskrnl.exe!SeQuerySessionIdToken+0x15f9
ntoskrnl.exe!SeQuerySessionIdToken+0x1440
ntoskrnl.exe!FsRtlAllocateExtraCreateParameter+0x744e
ntoskrnl.exe!FsRtlAllocateExtraCreateParameter+0x52c4
ntoskrnl.exe!FsRtlAllocateExtraCreateParameter+0x13c8
ntoskrnl.exe!FsRtlAllocateExtraCreateParameter+0x10da
ntoskrnl.exe!IoDeleteAllDependencyRelations+0x14d0
ntoskrnl.exe!FsRtlAllocateExtraCreateParameter+0xa96
ntoskrnl.exe!FsRtlAllocateExtraCreateParameter+0x898
ntoskrnl.exe!ObReferenceObjectByHandleWithTag+0xe92
ntoskrnl.exe!NtDeviceIoControlFile+0x56
ntoskrnl.exe!setjmpex+0x34b3
ntdll.dll!NtDeviceIoControlFile+0xa
KERNELBASE.dll!GetModuleHandleExA+0xb6
KERNEL32.DLL!DeviceIoControl+0x80
cfgmgr32.dll!SwMemFree+0x6a7
KERNELBASE.dll!SetKernelObjectSecurity+0xc1
ntdll.dll!RtlAcquireSRWLockExclusive+0x31e
ntdll.dll!RtlMultiByteToUnicodeN+0x20a3
KERNEL32.DLL!BaseThreadInitThunk+0xd
ntdll.dll!RtlUserThreadStart+0x1d
Here's another stack from one of the initiating threads (SHCORE.dll!GetScaleFactorForDevice
):
ntoskrnl.exe!KeSynchronizeExecution+0x2246
ntoskrnl.exe!KeRemoveQueueEx+0x108e
ntoskrnl.exe!KeRemoveQueueEx+0xae9
ntoskrnl.exe!KeWaitForSingleObject+0x22a
ntoskrnl.exe!KeSetBasePriorityThread+0x4ec
ntoskrnl.exe!KeRemoveQueueEx+0x281d
ntoskrnl.exe!KiCheckForKernelApcDelivery+0x23
win32k.sys+0x12aaea
win32k.sys+0x6d10d
win32k.sys+0xca699
win32k.sys+0x35a9f
win32k.sys+0x2a514
win32k.sys+0x138e28
win32k.sys+0x19fa8
win32k.sys+0x4921e
ntoskrnl.exe!setjmpex+0x34b3
USER32.dll!WindowFromPhysicalPoint+0x1a
USER32.dll!CallWindowProcW+0x2bf
USER32.dll!SendMessageW+0x111
UxTheme.dll!DrawThemeParentBackgroundEx+0x18f
Comctl32.dll!ImageList_GetIconSize+0xee3
Comctl32.dll!ImageList_GetIconSize+0x1107
Comctl32.dll!DrawScrollBar+0x12bf
USER32.dll!DispatchMessageW+0x154
USER32.dll!CallWindowProcW+0x132
Comctl32.dll!DefSubclassProc+0xb2
Comctl32.dll!DefSubclassProc+0x77
explorerframe.dll!Ordinal111+0x655d
Comctl32.dll!DPA_GetPtr+0x282
Comctl32.dll!DPA_GetPtr+0x152
USER32.dll!DispatchMessageW+0x154
USER32.dll!OffsetRect+0x172
USER32.dll!OffsetRect+0x22d
ntdll.dll!KiUserCallbackDispatcher+0x1f
USER32.dll!WindowFromPhysicalPoint+0x1a
USER32.dll!CallWindowProcW+0x2bf
USER32.dll!SendMessageW+0x111
UxTheme.dll!DrawThemeParentBackgroundEx+0x1a6
explorerframe.dll!Ordinal111+0xabef
explorerframe.dll!Ordinal111+0x6ae5
USER32.dll!DispatchMessageW+0x154
USER32.dll!OffsetRect+0x172
USER32.dll!OffsetRect+0x22d
ntdll.dll!KiUserCallbackDispatcher+0x1f
USER32.dll!WindowFromPhysicalPoint+0x1a
USER32.dll!CallWindowProcW+0x2bf
USER32.dll!SendMessageW+0x111
UxTheme.dll!DrawThemeParentBackgroundEx+0x1a6
explorerframe.dll!Ordinal111+0xaa52
Comctl32.dll!DPA_GetPtr+0x282
Comctl32.dll!DPA_GetPtr+0x152
USER32.dll!GetWindowLongPtrA+0x265
USER32.dll!OffsetRect+0x172
USER32.dll!OffsetRect+0x22d
ntdll.dll!KiUserCallbackDispatcher+0x1f
USER32.dll!SendMessageW+0x1aa
USER32.dll!SendMessageW+0x1bc
explorerframe.dll!Ordinal111+0x546e
explorerframe.dll!Ordinal111+0x10568
explorerframe.dll!Ordinal111+0x11d50
explorerframe.dll!Ordinal111+0x11d00
explorerframe.dll!Ordinal111+0xeee3
SHELL32.dll!SHGetKnownFolderPathWorker+0x84c
SHELL32.dll!SHGetKnownFolderPathWorker+0xa23
SHCORE.dll!GetScaleFactorForDevice+0x333
KERNEL32.DLL!BaseThreadInitThunk+0xd
ntdll.dll!RtlUserThreadStart+0x1d
Note it took 30' or so this time around - had time to install the symbols, read the posts, do some diagnostics and post back and still have the CPU jacked up..
Second Update for symbols
Thanks to @kinokijuf, I have used the Windows Defender Debug.dll and have more accurate info. The Threads now look as follows:
ntdll.dll!TppWorkerThread
ntdll.dll!TppWorkerThread
ntdll.dll!TppWorkerThread
ntdll.dll!TppWorkerThread
ntdll.dll!TppWorkerThread
SHCORE.dll!Microsoft::WRL::FtmBase::MarshalInterface+0x1c
SHCORE.dll!Microsoft::WRL::FtmBase::MarshalInterface+0x1c
FunDisc.dll!CNotificationQUeue::ThreadProc
SHCORE.dll!Microsoft::WRL::FtmBase::MarshalInterface+0x1c
windows.immersiveshell.serviceprovicer.dll!CImmersiveShellController::s_ImmersiveShellComponentsThreadProc
Explorer.EXE!wWinMainCRTStartup
While the top level threads still show thread/lock contention ?:
ntoskrnl.exe!KiSwapContext+0x76
ntoskrnl.exe!KiSwapThread+0x14e
ntoskrnl.exe!KiCommitThreadWait+0x129
ntoskrnl.exe!KeWaitForSingleObject+0x22a
ntoskrnl.exe!KiSchedulerApc+0x74
ntoskrnl.exe!KiDeliverApc+0x1fd
ntoskrnl.exe!KiSwapThread+0x2da
ntoskrnl.exe!KiCommitThreadWait+0x129
ntoskrnl.exe!KeRemoveQueueEx+0x27b
ntoskrnl.exe!IoRemoveIoCompletion+0x8a
ntoskrnl.exe!NtWaitForWorkViaWorkerFactory+0x30a
ntoskrnl.exe!KiSystemServiceCopyEnd+0x13
ntdll.dll!NtWaitForWorkViaWorkerFactory+0xa
ntdll.dll!TppWorkerThread+0x286
KERNEL32.DLL!BaseThreadInitThunk+0xd
ntdll.dll!RtlUserThreadStart+0x1d
Thanks,
Ordinal111
.