[CRT]
[reactos.git] / reactos / lib / sdk / crt / string / splitp.c
index 6f2855d..5242d51 100644 (file)
@@ -21,16 +21,24 @@ void _tsplitpath(const _TCHAR* path, _TCHAR* drive, _TCHAR* dir, _TCHAR* fname,
     if (fname) fname[0] = '\0';
     if (ext) ext[0] = '\0';
 
+#if WINVER >= 0x600
     /* Check parameter */
     if (!path)
     {
-        //__set_errno(EINVAL);
+#ifndef _LIBCNT_
+        _set_errno(EINVAL);
+#endif
         return;
     }
+#endif
 
+    //_Analysis_assume_(path != 0);
+
+#if WINVER == 0x600
     /* Skip '\\?\' prefix */
     if ((path[0] == '\\') && (path[1] == '\\') &&
         (path[2] == '?') && (path[3] == '\\')) path += 4;
+#endif
 
     if (path[0] == '\0') return;
 
@@ -56,9 +64,11 @@ void _tsplitpath(const _TCHAR* path, _TCHAR* drive, _TCHAR* dir, _TCHAR* fname,
         path++;
     }
 
-    /* Check if we got */
-    if (!file_start) file_start = path;
-    if (!ext_start || ext_start < file_start) ext_start = path;
+    /* Check if we got a file name / extension */
+    if (!file_start)
+        file_start = dir_start;
+    if (!ext_start || ext_start < file_start)
+        ext_start = path;
 
     if (dir)
     {