I use SHFileOperation () to remove directories from a specific path. This is done in multiple threads, and the remote directory is always different.
From time to time, it throws exceptions:
An exception was thrown at 0x00007FF8AF5D9D2A (ntdll.dll) in del.exe: 0xC0000008: An invalid handle was specified
and this one:
The exception that occurred when 0x00007FF8ACC90A36 (shell32.dll) in del.exe: 0xC0000005: A place to read access violation 0x0000000000000001.
modules:
shell32.dll 00007FF8ACBD0000-00007FF8AE0D8000 ntdll.dll 00007FF8AF530000-00007FF8AF701000
This is the code:
SHFILEOPSTRUCTW tFileOptions = { 0 }; tFileOptions.pFrom = pwstrPath; tFileOptions.wFunc = FO_DELETE; tFileOptions.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI; iResult = SHFileOperationW(&tFileOptions); if (0 != iResult) { printf("WTF\n"); goto lbl_cleanup; } SHChangeNotify(SHCNE_RMDIR, SHCNF_PATHW, pwstrPath, NULL);
At the end, pwstrPath has a double null terminator.
What is the reason for these exceptions?
EDIT
Stack trace:

cydan source share