Suppose I have two hanldes:
HANDLE h1;
HANDLE h2;
And both have received values resulted from some Windows API function - in particular, I'm interesed in handles resulted from calls to CreateFile()
. How do I determine that h1
and h2
reference the same underlying object - in the case of CreateFile()
- same file, directory or device? Is there some API to determine that?
You could use GetFinalPathNameByHandle and compare the file path of both handles. https://msdn.microsoft.com/en-us/library/windows/desktop/aa364962(v=vs.85).aspx