Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

QueryIsFile() in 30.00.20

Charles Dye

Super Moderator
May
4,980
128
Staff member
It looks like QueryIsFile() does Bad Things in 30.00.20. I can't imagine why the function itself would have changed. RTL "improvement" ?
 
The QueryIsFile API changed to allow an optional second argument:

DLLExports int WINAPI QueryIsFile( LPCTSTR, CAtlString * strFound=NULL );
So how should a plugin author proceed?
 
I didn't know the compiler would break old code on an optional new argument. For build 21 (which I'll post shortly) I named the new version QueryIsFileEx.

Will we need a new header and library?
 
FWIW, I found this on StackOverflow (6 years old)

Code:
BOOL FileExists(LPCTSTR szPath)
{
  DWORD dwAttrib = GetFileAttributes(szPath);

  return (dwAttrib != INVALID_FILE_ATTRIBUTES && 
         !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
}
 
FWIW, I found this on StackOverflow (6 years old)

Code:
BOOL FileExists(LPCTSTR szPath)
{
  DWORD dwAttrib = GetFileAttributes(szPath);

  return (dwAttrib != INVALID_FILE_ATTRIBUTES &&
         !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
}

Mine is a bit more ornate. But since you like elegant... note that INVALID_FILE_ATTRIBUTES has FILE_ATTRIBUTE_DIRECTORY set.
 
I didn't know the compiler would break old code on an optional new argument. For build 21 (which I'll post shortly) I named the new version QueryIsFileEx.

Thank you for that. I could dig out all calls to QueryIsFile() in all of my old plugins, but would prefer not to!
 
Back
Top