D3D11CreateDevice causes a reading access violation - graphics

The Code & Question
I'm trying out Microsoft's Application Verifier and hitting a read-access violation on the simple code below. Is this my fault? If not, who should I report this to?
#include <D3D11_1.h>
#pragma comment(lib, "d3d11.lib")
void main()
{
ID3D11Device* device = NULL;
D3D11CreateDevice(
NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
0,
NULL,
0,
D3D11_SDK_VERSION,
&device,
NULL,
NULL);
}
Application Verifier Output
Page heap: pid 0x1034: page heap enabled with flags 0x3.
AVRF: D3D11_Fails_AppVerifier.exe: pid 0x1034: flags 0x81643027: application verifier enabled
First-chance exception at 0x00007FFA4EA681B9 (atiuxp64.dll) in D3D11_Fails_AppVerifier.exe: 0xC0000005: Access violation reading location 0x0000009411813000.
=======================================
VERIFIER STOP 0000000000000013: pid 0x1034: First chance access violation for current stack trace.
0000009411813000 : Invalid address causing the exception.
00007FFA4EA681B9 : Code address executing the invalid access.
000000940FA5B430 : Exception record.
000000940FA5AF40 : Context record.
WinDBG Callstack
*** ERROR: Symbol file could not be found. Defaulted to export symbols for vrfcore.dll -
vrfcore!VerifierStopMessageEx+0x6f4:
00007ffa`48d33a00 cc int 3
0:000> k
Child-SP RetAddr Call Site
00000094`0fa5a1b0 00007ffa`48d39d20 vrfcore!VerifierStopMessageEx+0x6f4
*** ERROR: Symbol file could not be found. Defaulted to export symbols for verifier.dll -
00000094`0fa5a510 00007ffa`48c5a9d0 vrfcore!VerifierDisableVerifier+0x948
00000094`0fa5a5a0 00007ffa`54b6a743 verifier!VerifierStopMessage+0xa0
*** ERROR: Module load completed but symbols could not be loaded for vfbasics.dll
00000094`0fa5a640 00007ffa`48cc62d9 ntdll!RtlApplicationVerifierStop+0x103
00000094`0fa5a6a0 00007ffa`48cc8246 vfbasics+0x62d9
00000094`0fa5a700 00007ffa`48cc787e vfbasics+0x8246
00000094`0fa5a790 00007ffa`54af5f42 vfbasics+0x787e
00000094`0fa5a7e0 00007ffa`54af4763 ntdll!RtlRestoreContext+0x182
00000094`0fa5a870 00007ffa`54b330aa ntdll!RtlRaiseException+0xe33
00000094`0fa5af40 00007ffa`4ea681b9 ntdll!KiUserExceptionDispatcher+0x3a
*** ERROR: Symbol file could not be found. Defaulted to export symbols for atiuxp64.dll -
00000094`0fa5b658 00000094`1170b0f0 atiuxp64!OpenAdapter10_2+0x12525
00000094`0fa5b660 00000094`0fa5b800 0x00000094`1170b0f0
00000094`0fa5b668 00007ffa`4ea5aa93 0x00000094`0fa5b800
00000094`0fa5b670 00007ffa`4ea55dbe atiuxp64!OpenAdapter10_2+0x4dff
*** ERROR: Symbol file could not be found. Defaulted to export symbols for aticfx64.dll -
00000094`0fa5b720 00007ffa`4f18120e atiuxp64!OpenAdapter10_2+0x12a
*** ERROR: Symbol file could not be found. Defaulted to export symbols for d3d11.dll -
00000094`0fa5b750 00007ffa`4f3a88c1 aticfx64!OpenAdapter10_2+0x13e
00000094`0fa5b780 00007ffa`4f3a8691 d3d11!D3D11CoreCreateLayeredDevice+0x1ba1
00000094`0fa5b8a0 00007ffa`4f3a85db d3d11!D3D11CoreCreateLayeredDevice+0x1971
00000094`0fa5b900 00007ffa`4f387f3d d3d11!D3D11CoreCreateLayeredDevice+0x18bb
00000094`0fa5ba30 00007ffa`4f387e60 d3d11+0x7f3d
00000094`0fa5ba90 00007ffa`4f3a7c6e d3d11+0x7e60
00000094`0fa5bc60 00007ffa`4f3a81fb d3d11!D3D11CoreCreateLayeredDevice+0xf4e
00000094`0fa5c4c0 00007ffa`4f3a80ad d3d11!D3D11CoreCreateLayeredDevice+0x14db
00000094`0fa5c8a0 00007ffa`4f3a6cf9 d3d11!D3D11CoreCreateLayeredDevice+0x138d
00000094`0fa5c8d0 00007ffa`4f3a73cf d3d11!D3D11CoreCreateDevice+0xb09
00000094`0fa5c910 00007ffa`4f3a730b d3d11!D3D11CoreCreateLayeredDevice+0x6af
00000094`0fa5c960 00007ffa`4f3a7295 d3d11!D3D11CoreCreateLayeredDevice+0x5eb
00000094`0fa5c9d0 00007ffa`4f3a6e61 d3d11!D3D11CoreCreateLayeredDevice+0x575
00000094`0fa5caa0 00007ffa`4f3a7573 d3d11!D3D11CoreCreateLayeredDevice+0x141
00000094`0fa5cb40 00007ffa`4f3a5b7f d3d11!D3D11CoreCreateLayeredDevice+0x853
00000094`0fa5f260 00007ffa`4f3a58e4 d3d11!D3D11CreateDeviceAndSwapChain+0x37f
00000094`0fa5f590 00007ffa`4f3a57ec d3d11!D3D11CreateDeviceAndSwapChain+0xe4
00000094`0fa5f650 00007ffa`4f3a576c d3d11!D3D11CreateDevice+0x14c
*** WARNING: Unable to verify checksum for D3D11_Fails_AppVerifier.exe
00000094`0fa5f6c0 00007ff7`a70b1087 d3d11!D3D11CreateDevice+0xcc
00000094`0fa5f770 00007ff7`a70b175d D3D11_Fails_AppVerifier!main+0x77 [c:\_personalprojects\d3d11_fails_appverifier\main.cpp # 18]
00000094`0fa5f800 00007ff7`a70b188e D3D11_Fails_AppVerifier!__tmainCRTStartup+0x19d [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crtexe.c # 536]
*** ERROR: Symbol file could not be found. Defaulted to export symbols for kernel32.dll -
00000094`0fa5f870 00007ffa`540113d2 D3D11_Fails_AppVerifier!mainCRTStartup+0xe [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crtexe.c # 377]
00000094`0fa5f8a0 00007ffa`54ab5454 kernel32!BaseThreadInitThunk+0x22
00000094`0fa5f8d0 00000000`00000000 ntdll!RtlUserThreadStart+0x34
My PC's Info
Windows 8.1 Pro 64-bit (6.3, Build 9600)
AMD Radeon (TM) R9 200 Series
AMD Catalyst driver (15.7.1) Up to Date (Last checked 10/15/2015 10:16:39 PM)

App-Verifier no longer detects a read violation after using D3D_DRIVER_TYPE_WARP.
I've contacted AMD. Thanks for the suggestion Chuck Walbourn!

Related

Running SystemTap user-space probes inside a container

I am learning SystemTap and I have created a simple C program to grasp the basics.
When I run the program and a probe in the hosting system, the probe works flawlessly, but when I copy the exact same process in a container I run into some problems (container is running in privileged mode).
When I leave both the program and probe running for a few seconds a WARNING message appears and this is what the stap output looks like after I stop the program:
[root#client ~]# stap -v tmp-probe.stp /root/tmp
Pass 1: parsed user script and 482 library scripts using 115544virt/94804res/16320shr/78424data kb, in 140usr/20sys/168real ms.
Pass 2: analyzed script: 2 probes, 1 function, 0 embeds, 1 global using 116996virt/97852res/17612shr/79876data kb, in 10usr/0sys/6real ms.
Pass 3: using cached /root/.systemtap/cache/73/stap_7357b5a96975af17d2210a04bada9b6a_1260.c
Pass 4: using cached /root/.systemtap/cache/73/stap_7357b5a96975af17d2210a04bada9b6a_1260.ko
Pass 5: starting run.
WARNING: probe process("/root/tmp").statement(0x40113a) at inode-offset 12761464:0000000060a7c1a2 registration error [man warning::pass5] (rc -5)
0
Pass 5: run completed in 0usr/70sys/3579real ms.
The binary has been compiled with: gcc -ggdb3 -O0 tmp.c -o tmp and contains these probe points:
process("/root/tmp").begin $syscall:long $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long $arg6:long
process("/root/tmp").end $syscall:long $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long $arg6:long
process("/root/tmp").plt("puts")
process("/root/tmp").plt("sleep")
process("/root/tmp").syscall $syscall:long $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long $arg6:long
process("/root/tmp").mark("in_test")
process("/root/tmp").function("main#/root/tmp.c:11")
process("/root/tmp").function("test#/root/tmp.c:5")
tmp.c:
#include <stdio.h>
#include <sys/sdt.h>
#include <unistd.h>
void test() {
STAP_PROBE(test, in_test);
printf("here\n");
sleep(1);
}
int main() {
while (1) {
test();
}
}
tmp-probe.stp:
global cnt
probe process(#1).mark("in_test") {
cnt++
}
probe process(#1).end {
printf("%ld\n", cnt)
exit()
}
A more verbose stap output:
[root#client ~]# stap -vv tmp-probe.stp /root/tmp
Systemtap translator/driver (version 4.6/0.186, rpm 4.6-4.fc35)
Copyright (C) 2005-2021 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.32 ... 5.15.0-rc7
enabled features: AVAHI BOOST_STRING_REF DYNINST BPF JAVA PYTHON3 LIBRPM LIBSQLITE3 LIBVIRT LIBXML2 NLS NSS READLINE MONITOR_LIBS
Created temporary directory "/tmp/stapRsSKyO"
Session arch: x86_64 release: 5.16.20-200.fc35.x86_64
Build tree: "/lib/modules/5.16.20-200.fc35.x86_64/build"
Searched for library macro files: "/usr/share/systemtap/tapset/linux", found: 7, processed: 7
Searched for library macro files: "/usr/share/systemtap/tapset", found: 11, processed: 11
Searched: "/usr/share/systemtap/tapset/linux/x86_64", found: 20, processed: 20
Searched: "/usr/share/systemtap/tapset/linux", found: 407, processed: 407
Searched: "/usr/share/systemtap/tapset/x86_64", found: 1, processed: 1
Searched: "/usr/share/systemtap/tapset", found: 36, processed: 36
Pass 1: parsed user script and 482 library scripts using 115580virt/95008res/16520shr/78460data kb, in 130usr/30sys/163real ms.
derive-probes (location #0): process("/root/tmp").mark("in_test") of keyword at tmp-probe.stp:3:1
derive-probes (location #0): process("/root/tmp").end of keyword at tmp-probe.stp:7:1
Pass 2: analyzed script: 2 probes, 1 function, 0 embeds, 1 global using 117032virt/97860res/17624shr/79912data kb, in 10usr/0sys/6real ms.
Pass 3: using cached /root/.systemtap/cache/73/stap_7357b5a96975af17d2210a04bada9b6a_1260.c
Pass 4: using cached /root/.systemtap/cache/73/stap_7357b5a96975af17d2210a04bada9b6a_1260.ko
Pass 5: starting run.
Running /usr/bin/staprun -v -R /tmp/stapRsSKyO/stap_7357b5a96975af17d2210a04bada9b6a_1260.ko
staprun:insert_module:191 Module stap_7357b5a96975af17d2210a04bada9b_698092 inserted from file /tmp/stapRsSKyO/stap_7357b5a96975af17d2210a04bada9b6a_1260.ko
WARNING: probe process("/root/tmp").statement(0x40113a) at inode-offset 12761464:0000000060a7c1a2 registration error [man warning::pass5] (rc -5)
0
stapio:cleanup_and_exit:352 detach=0
stapio:cleanup_and_exit:369 closing control channel
staprun:remove_module:292 Module stap_7357b5a96975af17d2210a04bada9b_698092 removed.
Spawn waitpid result (0x0): 0
Pass 5: run completed in 10usr/70sys/2428real ms.
Running rm -rf /tmp/stapRsSKyO
Spawn waitpid result (0x0): 0
Removed temporary directory "/tmp/stapRsSKyO"

How can I change the CONFIG_ARCH_OPTIONAL_KERNEL_RWX value? by changing arch/Kconfig file directly?

I had asked a quesion at kernelnewbies email list and later I thought I found the answer (I thought I can put it in my defconfig). But then later found it was my mistake. So I still have the question and I ask it here to get answer.
This is what I see when I search “KERNEL_RWX” during “make menuconfig” for arm64 kernel(5-10.0-rc5).
The Kconfig file says CONFIG_STRICT_KERNEL_RWX is for setting text and rodata read-only.
Symbol: ARCH_OPTIONAL_KERNEL_RWX [=n]
Type : bool
Defined at arch/Kconfig:928
Symbol: ARCH_OPTIONAL_KERNEL_RWX_DEFAULT [=n]
Type : bool
Defined at arch/Kconfig:931
Symbol: STRICT_KERNEL_RWX [=y]
Type : bool
Defined at arch/Kconfig:937
Prompt: Make kernel text and rodata read-only
Depends on: ARCH_HAS_STRICT_KERNEL_RWX [=y]
Visible if: ARCH_HAS_STRICT_KERNEL_RWX [=y] && ARCH_OPTIONAL_KERNEL_RWX [=n]
Location:
(1) -> General architecture-dependent options
I wanted to try setting STRICT_KERNEL_RWX to =n. The 'Visible if' descriptionn says this option is visible when ARCH_OPTIONAL_KERNEL_RWX is =y which is now =n. (The STRICT_KERNEL_RWX menu didn't appear as a configurable menu in the menuconfig at this time). This is the lines in arch/Kconfig.
config ARCH_OPTIONAL_KERNEL_RWX
def_bool n
So I modified to ARCH_OPTIONAL_KERNEL_RWX=y in arch/Kconfig line 928. (BTW, This is question : is it correct to modify this Kconfig file directly? I’m not sure at the moment)
Then I could see the STRICT_KERNEL_RWX menu in the menuconfig and I set it to =n as I wanted.
But when I build the kernel, I see this errors.
ckim#ckim-ubuntu:~/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30$ makeit
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm64/mm/mmu.o
arch/arm64/mm/mmu.c: In function 'parse_rodata':
arch/arm64/mm/mmu.c:595:28: error: 'rodata_enabled' undeclared (first use in this function)
595 | int ret = strtobool(arg, &rodata_enabled);
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c:595:28: note: each undeclared identifier is reported only once for each function it appears in
arch/arm64/mm/mmu.c: In function 'map_entry_trampoline':
arch/arm64/mm/mmu.c:614:18: error: 'rodata_enabled' undeclared (first use in this function)
614 | pgprot_t prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c: In function 'map_kernel':
arch/arm64/mm/mmu.c:669:23: error: 'rodata_enabled' undeclared (first use in this function)
669 | pgprot_t text_prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:283: arch/arm64/mm/mmu.o] Error 1
make[1]: *** [scripts/Makefile.build:500: arch/arm64/mm] Error 2
make: *** [Makefile:1799: arch/arm64] Error 2
variable “rodata_enabled” is defined in init/main.c as below.
#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
bool rodata_enabled __ro_after_init = true;
static int __init set_debug_rodata(char *str)
{
return strtobool(str, &rodata_enabled);
}
__setup("rodata=", set_debug_rodata);
#endif
But now that CONFIG_STRICT_KERNEL_RWX=n, the above lines are not compiled here (CONFIG_STRICT_MODULE_RWX=n too). However, arch/arm64/mm/mmu.c code is still using rodata_enabled. Is this a bug of the code? Or am I missing something?
I can modify init/main.c and include/linux/init.h so that this rodata_enabled and related functions be defined regardless of these CONFIG values and make the errors go away, but I’m curious if this a kind of kernel bug raising compiler error.
So again my question is how should I change ARCH_OPTIONAL_KERNEL_RWX value? I tried setting it in my defconfig file but when I do make xxx_defonfig, the .config file shows still ARCH_OPTIONAL_KERNEL_RWX=n. Should I edit the arch/Kconfig file really?

Error during installation UHD on BeagleBone (Debian 10)

I followed instrucions from: https://files.ettus.com/manual/page_build_guide.html
I can't build and install uhd and .cpp files for uhd on my Debian. I have error after make command.
cmake .. is ok. The problem is with something called NEON I think.
Processor info:
cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 995.32
Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc08
CPU revision : 2
Hardware : Generic AM33XX (Flattened Device Tree)
Revision : 0000
Serial : 4219BBBK05E9
Release:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Installation:
root#beaglebone:/home/debian/uhd/host/build# make
[ 2%] Built target uhd_rpclib
[ 2%] Built target uhd-resources
[ 3%] Building CXX object lib/CMakeFiles/uhd.dir/convert/convert_with_neon.cpp.o
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h: In member function ‘virtual void __convert_fc32_1_sc16_item32_le_1_PRIORITY_SIMD::operator()(const input_type&, const output_type&, size_t)’:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:6740:1: error: inlining failed in call to always_inline ‘float32x4_t vdupq_n_f32(float32_t)’: target specific option mismatch
vdupq_n_f32 (float32_t __a)
^~~~~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:27:33: note: called from here
float32x4_t Q0 = vdupq_n_f32(float(scale_factor));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:10844:1: error: inlining failed in call to always_inline ‘void vst1_s16(int16_t*, int16x4_t)’: target specific option mismatch
vst1_s16 (int16_t * __a, int16x4_t __b)
^~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:50:17: note: called from here
vst1_s16((reinterpret_cast<int16_t*>(&output[i + 4])), D13);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:7440:1: error: inlining failed in call to always_inline ‘int32x4_t vcvtq_s32_f32(float32x4_t)’: target specific option mismatch
vcvtq_s32_f32 (float32x4_t __a)
^~~~~~~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:47:39: note: called from here
int32x4_t Q9 = vcvtq_s32_f32(Q8);
~~~~~~~~~~~~~^~~~
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:1172:1: error: inlining failed in call to always_inline ‘float32x4_t vmulq_f32(float32x4_t, float32x4_t)’: target specific option mismatch
vmulq_f32 (float32x4_t __a, float32x4_t __b)
^~~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:46:35: note: called from here
float32x4_t Q8 = vmulq_f32(Q7, Q0);
~~~~~~~~~^~~~~~~~
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:10392:1: error: inlining failed in call to always_inline ‘float32x4_t vld1q_f32(const float32_t*)’: target specific option mismatch
vld1q_f32 (const float32_t * __a)
^~~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:29:36: note: called from here
float32x4_t Q1 = vld1q_f32(reinterpret_cast<const float*>(&input[i]));
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [lib/CMakeFiles/uhd.dir/build.make:502: lib/CMakeFiles/uhd.dir/convert/convert_with_neon.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:129: lib/CMakeFiles/uhd.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
What I can do now?
Edit file CMakeCache.txt located in uhd/host/build/.
//Use NEON SIMD instuctions, if applicable
NEON_SIMD_ENABLE:BOOL=OFF
Then use:
make
It solve the problem.

" error: unknown field ‘compat_ioctl’ specified in initializer " while creating dummy ioctl

static const struct inode_operations msdos_dir_inode_operations = {
.create = msdos_create,
.lookup = msdos_lookup,
.unlink = msdos_unlink,
.mkdir = msdos_mkdir,
.rmdir = msdos_rmdir,
.rename = msdos_rename,
.setattr = fat_setattr,
.getattr = fat_getattr,
.compat_ioctl = my_ioctl, ---->error
};
i also tried with unlocked_ioctl but same error occured
[root#localhost fat]# make
make -C /lib/modules/3.11.10-100.fc18.x86_64/build M=/home/aditya/linux-3.12.6/fs/fat modules
make[1]: Entering directory `/usr/src/kernels/3.11.10-100.fc18.x86_64'
CC [M] /home/aditya/linux-3.12.6/fs/fat/namei_msdos.o
/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2: error: unknown field ‘compat_ioctl’ specified in initializer
/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2: warning: initialization from incompatible pointer type [enabled by default]
/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2: warning: (near initialization for ‘msdos_dir_inode_operations.setxattr’) [enabled by default]
make[2]: * [/home/aditya/linux-3.12.6/fs/fat/namei_msdos.o] Error 1
make[1]: * [module/home/aditya/linux-3.12.6/fs/fat] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.11.10-100.fc18.x86_64'
make: * [all] Error 2
The ioctl has been changed for a reason and it would be best if you follow the kernel changes in your driver too. You can not use drivers compiled for one version in another.
The change is not too difficult one.
In the fops structure change
ioctl to unlocked_ioctl
and in the ioctl function in your driver, do not pass the inode pointer. That is all, the rest of the code can remain the same.
see this tutorial for more details

SHGetFileInfo function cause unhandled exception

I have application with CMFCShellTreeCtrl on one of it's dialog and it is crashing when running on some Win8 machines. It happen when tree control trying to initialize and calls SHGetFileInfo in this part of afxshelltreectrl.cpp:
int CMFCShellTreeCtrl::OnGetItemIcon(LPAFX_SHELLITEMINFO pItem, BOOL bSelected)
{
ENSURE(pItem != NULL);
SHFILEINFO sfi;
UINT uiFlags = SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON;
if (bSelected)
{
uiFlags |= SHGFI_OPENICON;
}
else
{
uiFlags |= SHGFI_LINKOVERLAY;
}
if (SHGetFileInfo((LPCTSTR)pItem->pidlFQ, 0, &sfi, sizeof(sfi), uiFlags))
{
return sfi.iIcon;
}
return -1;
}
Application was build in VS2010 on Win7 32-bit.
I could not replicate this bug on VM so I debug remotely on client PC.
I compared the values ​​of arguments for SHGetFileInfo function, and they looked the same on my machine and the client's, except the memory addresses.
Call stack after exception:
screenshot
WinDbg log:
ModLoad: 02b70000 02bc9000 cmd.exe
ModLoad: 60780000 607ca000 C:\windows\SysWOW64\mscoree.dll
ModLoad: 60700000 6077a000 C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll
ModLoad: 711b0000 71250000 C:\windows\SysWOW64\sxs.dll
ModLoad: 60150000 606ff000 C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
ModLoad: 70e30000 70ecb000 C:\windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6910_none_d089c358442de345\MSVCR80.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6910_none_d089c358442de345\MSVCR80.dll -
ModLoad: 5f650000 6014a000 C:\windows\assembly\NativeImages_v2.0.50727_32\mscorlib\7f763721bf47dc8d58ec21cb64cbec91\mscorlib.ni.dll
ModLoad: 71770000 71778000 C:\Windows\Microsoft.NET\Framework\v2.0.50727\culture.dll
(c18.227c): CLR exception - code e0434f4d (first chance)
(c18.227c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\windows\SysWOW64\combase.dll -
eax=002d0068 ebx=80040154 ecx=04b1f654 edx=04b1f678 esi=0018b654 edi=76cbbda0
eip=002d0068 esp=0018b63c ebp=0018b648 iopl=0 nv up ei ng nz ac pe cy
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010297
002d0068 ?? ???
According to the call stack error occurs in some COM functions.
I am not familiar with COM so may be some one can help me to find the reason why SHGetFileInfo cause exception.
c0000005 is memory accessing exception. check whether your pItem has been initialized before calling this function. Or you can check whether 'pItem->pidlFQ' is valid.

Resources