// try to obtain a pointer
// to the first (and in this
// case the only)
// SHNAMEMAPPING struct of the
// structure pointed to by
// shfo.hNameMappings

// THIS IS THE PROBLEM: pShNM doesn't point to an
// SHNAMEMAPPING struct when the file being operated on
// was renamed by the file system
SHNAMEMAPPING* pShNM = (SHNAMEMAPPING*)((char*)shfo.hNameMappings + sizeof(int));
}

::SHFreeNameMappings((HANDLE)shfo.hNameMappings);
}

The docs say the following: "Treat hNameMappings as a pointer to a structure whose first member is an INT value, followed by an array of SHNAMEMAPPING structures. The INT value will be set to the number of structures in the array. Each SHNAMEMAPPING structure will contain the old and new path name for one of the renamed files."

The first member of the struct pointed to by SHFILEOPSTRUCT.hNameMappings (the number of SHNAMEMAPPING structs that will follow this int value) seems correct but the bytes that follow this integer value are just junk ... and not an SHNAMEMAPPING struct
Environment: NT4 SP5 IE5.0
(maybe it's something trivial but I don't know what I'm doing wrong)

Who is Participating?

It seems MSDN's description is buggy. The hNameMappings does NOT point to an int followed by an array of SHNAMEMAPPING structures. It points to an int follows by an array of pointers to SHNAMEMAPPING structures.

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.