shlwapi: Implement PathFileExistsAndAttributesA/W
Rolf Kalbermatter
rolf.kalbermatter at citeng.com
Mon Jan 19 03:23:35 CST 2004
Changelog
- include/shlwapi.h
- dlls/shlwapi/shlwapi.spec
- dlls/shlwapi/path.c
Implement PathFileExistsAndAttributesA/W function
License: X11/LGPL
Rolf Kalbermatter
Index: include/shlwapi.h
===================================================================
RCS file: /home/wine/wine/include/shlwapi.h,v
retrieving revision 1.40
diff -u -r1.40 shlwapi.h
--- include/shlwapi.h 6 Jan 2004 22:08:33 -0000 1.40
+++ include/shlwapi.h 18 Jan 2004 21:44:35 -0000
@@ -332,6 +332,10 @@
BOOL WINAPI PathFileExistsW(LPCWSTR);
#define PathFileExists WINELIB_NAME_AW(PathFileExists)
+BOOL WINAPI PathFileExistsAndAttributesA(LPCSTR lpszPath, DWORD *dwAttr);
+BOOL WINAPI PathFileExistsAndAttributesW(LPCWSTR lpszPath, DWORD *dwAttr);
+#define PathFileExistsAndAttributes WINELIB_NAME_AW(PathFileExistsAndAttributes)
+
LPSTR WINAPI PathFindExtensionA(LPCSTR);
LPWSTR WINAPI PathFindExtensionW(LPCWSTR);
#define PathFindExtension WINELIB_NAME_AW(PathFindExtension)
Index: dlls/shlwapi/shlwapi.spec
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/shlwapi.spec,v
retrieving revision 1.81
diff -u -r1.81 shlwapi.spec
--- dlls/shlwapi/shlwapi.spec 1 Oct 2003 03:10:42 -0000 1.81
+++ dlls/shlwapi/shlwapi.spec 18 Jan 2004 21:44:33 -0000
@@ -442,8 +442,8 @@
442 stdcall @(wstr ptr long) kernel32.GetEnvironmentVariableW
443 stdcall @(ptr long) kernel32.GetSystemWindowsDirectoryA
444 stdcall @(ptr long) kernel32.GetSystemWindowsDirectoryW
-445 stub -noname PathFileExistsAndAttributesA
-446 stub -noname PathFileExistsAndAttributesW
+445 stdcall -noname PathFileExistsAndAttributesA(str ptr)
+446 stdcall -noname PathFileExistsAndAttributesW(wstr ptr)
447 stub -noname FixSlashesAndColonA
448 stub -noname FixSlashesAndColonW
449 stub -noname NextPathA
Index: dlls/shlwapi/path.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/path.c,v
retrieving revision 1.39
diff -u -r1.39 path.c
--- dlls/shlwapi/path.c 6 Jan 2004 22:08:33 -0000 1.39
+++ dlls/shlwapi/path.c 18 Jan 2004 21:44:32 -0000
@@ -1714,6 +1714,63 @@
}
/*************************************************************************
+ * PathFileExistsAndAttributesA [SHLWAPI.445]
+ *
+ * Determine if a file exists.
+ *
+ * PARAMS
+ * lpszPath [I] Path to check
+ * dwAttr [O] attributes of file
+ *
+ * RETURNS
+ * TRUE If the file exists and is readable
+ * FALSE Otherwise
+ */
+BOOL WINAPI PathFileExistsAndAttributesA(LPCSTR lpszPath, DWORD *dwAttr)
+{
+ UINT iPrevErrMode;
+ DWORD dwVal = 0;
+
+ TRACE("(%s %p)\n", debugstr_a(lpszPath), dwAttr);
+
+ if (dwAttr)
+ *dwAttr = INVALID_FILE_ATTRIBUTES;
+
+ if (!lpszPath)
+ return FALSE;
+
+ iPrevErrMode = SetErrorMode(1);
+ dwVal = GetFileAttributesA(lpszPath);
+ SetErrorMode(iPrevErrMode);
+ if (dwAttr)
+ *dwAttr = dwVal;
+ return dwVal == INVALID_FILE_ATTRIBUTES ? FALSE : TRUE;
+}
+
+/*************************************************************************
+ * PathFileExistsAndAttributesW [SHLWAPI.446]
+ *
+ * See PathFileExistsA.
+ */
+BOOL WINAPI PathFileExistsAndAttributesW(LPCWSTR lpszPath, DWORD *dwAttr)
+{
+ UINT iPrevErrMode;
+ DWORD dwVal;
+
+ TRACE("(%s %p)\n", debugstr_w(lpszPath), dwAttr);
+
+ if (!lpszPath)
+ return FALSE;
+
+ iPrevErrMode = SetErrorMode(1);
+ dwVal = GetFileAttributesW(lpszPath);
+ SetErrorMode(iPrevErrMode);
+ if (dwAttr)
+ *dwAttr = dwVal;
+ return dwVal == INVALID_FILE_ATTRIBUTES ? FALSE : TRUE;
+}
+
+/*************************************************************************
* PathMatchSingleMaskA [internal]
*/
static BOOL WINAPI PathMatchSingleMaskA(LPCSTR name, LPCSTR mask)
More information about the wine-patches
mailing list