ReactOS 0.4.16-dev-1946-g52006dd
path.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "shlwapi.h"
#include "wininet.h"
Include dependency graph for path.c:

Go to the source code of this file.

Macros

#define LONG_LEN   (MAX_PATH * 2)
 
#define HALF_LEN   (MAX_PATH / 2 + 1)
 

Functions

static BOOL (WINAPI *pPathIsValidCharA)(char
 
static LPWSTR (WINAPI *pPathCombineW)(LPWSTR
 
static HRESULT (WINAPI *pPathCreateFromUrlA)(LPCSTR
 
static LPWSTR GetWideString (const char *src)
 
static void test_PathSearchAndQualify (void)
 
static void test_PathCreateFromUrl (void)
 
static void test_PathIsUrl (void)
 
static void test_PathIsValidCharA (void)
 
static void test_PathIsValidCharW (void)
 
static void test_PathMakePretty (void)
 
static void test_PathMatchSpec (void)
 
static void test_PathCombineW (void)
 
static void test_PathCombineA (void)
 
static void test_PathAddBackslash (void)
 
static void test_PathAppendA (void)
 
static void test_PathCanonicalizeA (void)
 
static void test_PathFindExtensionA (void)
 
static void test_PathBuildRootA (void)
 
static void test_PathCommonPrefixA (void)
 
static void test_PathUnquoteSpaces (void)
 
static void test_PathGetDriveNumber (void)
 
static void test_PathUnExpandEnvStrings (void)
 
static void test_PathIsRelativeA (void)
 
static void test_PathIsRelativeW (void)
 
static void test_PathStripPathA (void)
 
static void test_PathUndecorate (void)
 
static void test_PathRemoveBlanks (void)
 
 START_TEST (path)
 

Variables

static DWORD
 
static LPCWSTR
 
static LPSTR
 
static LPDWORD
 
static LPWSTR
 
static LPCSTR
 
static UINT
 
struct {
   const char *   url
 
   const char *   path
 
   DWORD   ret
 
   DWORD   todo
 
TEST_PATHFROMURL []
 
struct {
   const char *   path
 
   BOOL   expect
 
TEST_PATH_IS_URL []
 
struct {
   const char *   path
 
   const char *   result
 
TEST_PATH_UNQUOTE_SPACES []
 
static const DWORD SHELL_charclass []
 
struct {
   const char *   path
 
   BOOL   expect
 
test_path_is_relative []
 

Macro Definition Documentation

◆ HALF_LEN

#define HALF_LEN   (MAX_PATH / 2 + 1)

Definition at line 542 of file path.c.

◆ LONG_LEN

#define LONG_LEN   (MAX_PATH * 2)

Definition at line 541 of file path.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pPathIsValidCharA)
static

◆ GetWideString()

static LPWSTR GetWideString ( const char src)
static

Definition at line 186 of file path.c.

187{
188 WCHAR *ret;
189
190 if (!src)
191 return NULL;
192
193 ret = malloc(2 * INTERNET_MAX_URL_LENGTH * sizeof(WCHAR));
194
196
197 return ret;
198}
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
return ret
Definition: mutex.c:146
GLenum src
Definition: glext.h:6340
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_PathCreateFromUrl(), test_PathIsRelativeW(), and test_PathUnquoteSpaces().

◆ HRESULT()

static HRESULT ( WINAPI pPathCreateFromUrlA)
static

◆ LPWSTR()

static LPWSTR ( WINAPI pPathCombineW)
static

◆ START_TEST()

START_TEST ( path  )

Definition at line 1770 of file path.c.

1771{
1772 HMODULE hShlwapi = GetModuleHandleA("shlwapi.dll");
1773
1774 /* SHCreateStreamOnFileEx was introduced in shlwapi v6.0 */
1775 if(!GetProcAddress(hShlwapi, "SHCreateStreamOnFileEx")){
1776 win_skip("Too old shlwapi version\n");
1777 return;
1778 }
1779
1780 pPathCreateFromUrlA = (void*)GetProcAddress(hShlwapi, "PathCreateFromUrlA");
1781 pPathCreateFromUrlW = (void*)GetProcAddress(hShlwapi, "PathCreateFromUrlW");
1782 pPathCreateFromUrlAlloc = (void*)GetProcAddress(hShlwapi, "PathCreateFromUrlAlloc");
1783 pPathCombineW = (void*)GetProcAddress(hShlwapi, "PathCombineW");
1784 pPathIsValidCharA = (void*)GetProcAddress(hShlwapi, (LPSTR)455);
1785 pPathIsValidCharW = (void*)GetProcAddress(hShlwapi, (LPSTR)456);
1786 pPathAppendA = (void*)GetProcAddress(hShlwapi, "PathAppendA");
1787 pPathUnExpandEnvStringsA = (void*)GetProcAddress(hShlwapi, "PathUnExpandEnvStringsA");
1788 pPathUnExpandEnvStringsW = (void*)GetProcAddress(hShlwapi, "PathUnExpandEnvStringsW");
1789 pPathIsRelativeA = (void*)GetProcAddress(hShlwapi, "PathIsRelativeA");
1790 pPathIsRelativeW = (void*)GetProcAddress(hShlwapi, "PathIsRelativeW");
1791
1795
1799
1802
1818}
static HMODULE hShlwapi
Definition: clsid.c:38
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define win_skip
Definition: minitest.h:67
static void test_PathUndecorate(void)
Definition: path.c:1686
static void test_PathGetDriveNumber(void)
Definition: path.c:1437
static void test_PathAppendA(void)
Definition: path.c:810
static void test_PathCommonPrefixA(void)
Definition: path.c:1203
static void test_PathStripPathA(void)
Definition: path.c:1673
static void test_PathUnExpandEnvStrings(void)
Definition: path.c:1472
static void test_PathUnquoteSpaces(void)
Definition: path.c:1414
static void test_PathRemoveBlanks(void)
Definition: path.c:1726
static void test_PathFindExtensionA(void)
Definition: path.c:1081
static void test_PathCreateFromUrl(void)
Definition: path.c:252
static void test_PathSearchAndQualify(void)
Definition: path.c:202
static void test_PathBuildRootA(void)
Definition: path.c:1147
static void test_PathCombineW(void)
Definition: path.c:489
static void test_PathIsRelativeW(void)
Definition: path.c:1649
static void test_PathMatchSpec(void)
Definition: path.c:457
static void test_PathIsRelativeA(void)
Definition: path.c:1630
static void test_PathAddBackslash(void)
Definition: path.c:748
static void test_PathIsValidCharA(void)
Definition: path.c:383
static void test_PathCombineA(void)
Definition: path.c:544
static void test_PathMakePretty(void)
Definition: path.c:434
static void test_PathIsValidCharW(void)
Definition: path.c:410
static void test_PathCanonicalizeA(void)
Definition: path.c:937
static void test_PathIsUrl(void)
Definition: path.c:334
char * LPSTR
Definition: xmlstorage.h:182

◆ test_PathAddBackslash()

static void test_PathAddBackslash ( void  )
static

Definition at line 748 of file path.c.

749{
750 LPSTR str;
751 char path[MAX_PATH];
752 char too_long[LONG_LEN];
753
754 /* try a NULL path */
755 SetLastError(0xdeadbeef);
757 ok(str == NULL, "Expected str == NULL, got %p\n", str);
758 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
759
760 /* try an empty path */
761 path[0] = '\0';
762 SetLastError(0xdeadbeef);
764 ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
765 ok(!path[0], "Expected empty string, got %i\n", lstrlenA(path));
766 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
767
768 /* try a relative path */
769 lstrcpyA(path, "one\\two");
770 SetLastError(0xdeadbeef);
772 ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
773 ok(!lstrcmpA(path, "one\\two\\"), "Expected one\\two\\, got %s\n", path);
774 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
775
776 /* try periods */
777 lstrcpyA(path, "one\\..\\two");
778 SetLastError(0xdeadbeef);
780 ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
781 ok(!lstrcmpA(path, "one\\..\\two\\"), "Expected one\\..\\two\\, got %s\n", path);
782 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
783
784 /* try just a space */
785 lstrcpyA(path, " ");
786 SetLastError(0xdeadbeef);
788 ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
789 ok(!lstrcmpA(path, " \\"), "Expected \\, got %s\n", path);
790 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
791
792 /* path already has backslash */
793 lstrcpyA(path, "C:\\one\\");
794 SetLastError(0xdeadbeef);
796 ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
797 ok(!lstrcmpA(path, "C:\\one\\"), "Expected C:\\one\\, got %s\n", path);
798 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
799
800 memset(too_long, 'a', LONG_LEN);
801 too_long[LONG_LEN - 1] = '\0';
802
803 /* path is longer than MAX_PATH */
804 SetLastError(0xdeadbeef);
805 str = PathAddBackslashA(too_long);
806 ok(str == NULL, "Expected str == NULL, got %p\n", str);
807 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
808}
#define ok(value,...)
Definition: atltest.h:57
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4198
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define LONG_LEN
Definition: path.c:541
#define PathAddBackslashA
Definition: pathcch.h:301
const WCHAR * str
#define memset(x, y, z)
Definition: compat.h:39
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by START_TEST().

◆ test_PathAppendA()

static void test_PathAppendA ( void  )
static

Definition at line 810 of file path.c.

811{
812 char path[MAX_PATH];
813 char too_long[LONG_LEN];
814 char half[HALF_LEN];
815 BOOL res;
816
817 lstrcpyA(path, "C:\\one");
818
819 /* try NULL pszMore */
820 SetLastError(0xdeadbeef);
822 ok(!res, "Expected failure\n");
823 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
824 ok(!lstrcmpA(path, "C:\\one"), "Expected C:\\one, got %s\n", path);
825
826 /* try empty pszMore */
827 SetLastError(0xdeadbeef);
828 res = PathAppendA(path, "");
829 ok(res, "Expected success\n");
830 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
831 ok(!lstrcmpA(path, "C:\\one"), "Expected C:\\one, got %s\n", path);
832
833 /* try NULL pszPath */
834 SetLastError(0xdeadbeef);
835 res = PathAppendA(NULL, "two\\three");
836 ok(!res, "Expected failure\n");
837 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
838
839 /* try empty pszPath */
840 path[0] = '\0';
841 SetLastError(0xdeadbeef);
842 res = PathAppendA(path, "two\\three");
843 ok(res, "Expected success\n");
844 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
845 ok(!lstrcmpA(path, "two\\three"), "Expected \\two\\three, got %s\n", path);
846
847 /* try empty pszPath and empty pszMore */
848 path[0] = '\0';
849 SetLastError(0xdeadbeef);
850 res = PathAppendA(path, "");
851 ok(res, "Expected success\n");
852 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
853 ok(!lstrcmpA(path, "\\"), "Expected \\, got %s\n", path);
854
855 /* try legit params */
856 lstrcpyA(path, "C:\\one");
857 SetLastError(0xdeadbeef);
858 res = PathAppendA(path, "two\\three");
859 ok(res, "Expected success\n");
860 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
861 ok(!lstrcmpA(path, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", path);
862
863 /* try pszPath with backslash after it */
864 lstrcpyA(path, "C:\\one\\");
865 SetLastError(0xdeadbeef);
866 res = PathAppendA(path, "two\\three");
867 ok(res, "Expected success\n");
868 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
869 ok(!lstrcmpA(path, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", path);
870
871 /* try pszMore with backslash before it */
872 lstrcpyA(path, "C:\\one");
873 SetLastError(0xdeadbeef);
874 res = PathAppendA(path, "\\two\\three");
875 ok(res, "Expected success\n");
876 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
877 ok(!lstrcmpA(path, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", path);
878
879 /* try pszMore with backslash after it */
880 lstrcpyA(path, "C:\\one");
881 SetLastError(0xdeadbeef);
882 res = PathAppendA(path, "two\\three\\");
883 ok(res, "Expected success\n");
884 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
885 ok(!lstrcmpA(path, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", path);
886
887 /* try spaces in pszPath */
888 lstrcpyA(path, "C: \\ one ");
889 SetLastError(0xdeadbeef);
890 res = PathAppendA(path, "two\\three");
891 ok(res, "Expected success\n");
892 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
893 ok(!lstrcmpA(path, "C: \\ one \\two\\three"), "Expected C: \\ one \\two\\three, got %s\n", path);
894
895 /* try spaces in pszMore */
896 lstrcpyA(path, "C:\\one");
897 SetLastError(0xdeadbeef);
898 res = PathAppendA(path, " two \\ three ");
899 ok(res, "Expected success\n");
900 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
901 ok(!lstrcmpA(path, "C:\\one\\ two \\ three "), "Expected 'C:\\one\\ two \\ three ', got %s\n", path);
902
903 /* pszPath is too long */
904 memset(too_long, 'a', LONG_LEN);
905 too_long[LONG_LEN - 1] = '\0';
906 SetLastError(0xdeadbeef);
907 res = PathAppendA(too_long, "two\\three");
908 ok(!res, "Expected failure\n");
909 todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
910 ok(!too_long[0] || broken(lstrlenA(too_long) == (LONG_LEN - 1)), /* Win95 and some W2K */
911 "Expected length of too_long to be zero, got %i\n", lstrlenA(too_long));
912
913 /* pszMore is too long */
914 lstrcpyA(path, "C:\\one");
915 memset(too_long, 'a', LONG_LEN);
916 too_long[LONG_LEN - 1] = '\0';
917 SetLastError(0xdeadbeef);
918 res = PathAppendA(path, too_long);
919 ok(!res, "Expected failure\n");
920 todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
921 ok(!path[0] || broken(!lstrcmpA(path, "C:\\one")), /* Win95 and some W2K */
922 "Expected length of path to be zero, got %i\n", lstrlenA(path));
923
924 /* both params combined are too long */
925 memset(path, 'a', HALF_LEN);
926 path[HALF_LEN - 1] = '\0';
927 memset(half, 'b', HALF_LEN);
928 half[HALF_LEN - 1] = '\0';
929 SetLastError(0xdeadbeef);
930 res = PathAppendA(path, half);
931 ok(!res, "Expected failure\n");
932 ok(!path[0] || broken(lstrlenA(path) == (HALF_LEN - 1)), /* Win95 and some W2K */
933 "Expected length of path to be zero, got %i\n", lstrlenA(path));
934 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
935}
#define broken(x)
Definition: atltest.h:178
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint res
Definition: glext.h:9613
#define todo_wine
Definition: minitest.h:80
#define HALF_LEN
Definition: path.c:542
#define PathAppendA
Definition: pathcch.h:309

Referenced by START_TEST().

◆ test_PathBuildRootA()

static void test_PathBuildRootA ( void  )
static

Definition at line 1147 of file path.c.

1148{
1149 LPSTR root;
1150 char path[10];
1151 char root_expected[26][4];
1152 char drive;
1153 int j;
1154
1155 /* set up the expected paths */
1156 for (drive = 'A'; drive <= 'Z'; drive++)
1157 sprintf(root_expected[drive - 'A'], "%c:\\", drive);
1158
1159 /* test the expected values */
1160 for (j = 0; j < 26; j++)
1161 {
1162 SetLastError(0xdeadbeef);
1163 lstrcpyA(path, "aaaaaaaaa");
1165 ok(root == path, "Expected root == path, got %p\n", root);
1166 ok(!lstrcmpA(root, root_expected[j]), "Expected %s, got %s\n", root_expected[j], root);
1167 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1168 }
1169
1170 /* test a negative drive number */
1171 SetLastError(0xdeadbeef);
1172 lstrcpyA(path, "aaaaaaaaa");
1173 root = PathBuildRootA(path, -1);
1174 ok(root == path, "Expected root == path, got %p\n", root);
1175 ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
1176 "Expected aaaaaaaaa or empty string, got %s\n", path);
1177 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1178
1179 /* test a drive number greater than 25 */
1180 SetLastError(0xdeadbeef);
1181 lstrcpyA(path, "aaaaaaaaa");
1182 root = PathBuildRootA(path, 26);
1183 ok(root == path, "Expected root == path, got %p\n", root);
1184 ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
1185 "Expected aaaaaaaaa or empty string, got %s\n", path);
1186 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1187
1188 /* length of path is less than 4 */
1189 SetLastError(0xdeadbeef);
1190 lstrcpyA(path, "aa");
1191 root = PathBuildRootA(path, 0);
1192 ok(root == path, "Expected root == path, got %p\n", root);
1193 ok(!lstrcmpA(path, "A:\\"), "Expected A:\\, got %s\n", path);
1194 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1195
1196 /* path is NULL */
1197 SetLastError(0xdeadbeef);
1198 root = PathBuildRootA(NULL, 0);
1199 ok(root == NULL, "Expected root == NULL, got %p\n", root);
1200 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1201}
struct _root root
LPSTR WINAPI PathBuildRootA(LPSTR lpszPath, int drive)
Definition: path.c:329
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define sprintf
Definition: sprintf.c:45

Referenced by START_TEST().

◆ test_PathCanonicalizeA()

static void test_PathCanonicalizeA ( void  )
static

Definition at line 937 of file path.c.

938{
939 char dest[LONG_LEN + MAX_PATH];
940 char too_long[LONG_LEN];
941 BOOL res;
942
943 /* try a NULL source */
944 lstrcpyA(dest, "test");
945 SetLastError(0xdeadbeef);
947 ok(!res, "Expected failure\n");
949 "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
950 ok(dest[0] == 0 || !lstrcmpA(dest, "test"),
951 "Expected either an empty string (Vista) or test, got %s\n", dest);
952
953 /* try an empty source */
954 lstrcpyA(dest, "test");
955 SetLastError(0xdeadbeef);
957 ok(res, "Expected success\n");
958 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
959 ok(!lstrcmpA(dest, "\\") ||
960 broken(!lstrcmpA(dest, "test")), /* Win95 and some W2K */
961 "Expected \\, got %s\n", dest);
962
963 /* try a NULL dest */
964 SetLastError(0xdeadbeef);
965 res = PathCanonicalizeA(NULL, "C:\\");
966 ok(!res, "Expected failure\n");
968 "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
969
970 /* try empty dest */
971 dest[0] = '\0';
972 SetLastError(0xdeadbeef);
973 res = PathCanonicalizeA(dest, "C:\\");
974 ok(res, "Expected success\n");
975 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
976 ok(!lstrcmpA(dest, "C:\\"), "Expected C:\\, got %s\n", dest);
977
978 /* try non-empty dest */
979 lstrcpyA(dest, "test");
980 SetLastError(0xdeadbeef);
981 res = PathCanonicalizeA(dest, "C:\\");
982 ok(res, "Expected success\n");
983 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
984 ok(!lstrcmpA(dest, "C:\\"), "Expected C:\\, got %s\n", dest);
985
986 /* try a space for source */
987 lstrcpyA(dest, "test");
988 SetLastError(0xdeadbeef);
989 res = PathCanonicalizeA(dest, " ");
990 ok(res, "Expected success\n");
991 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
992 ok(!lstrcmpA(dest, " "), "Expected ' ', got %s\n", dest);
993
994 /* try a relative path */
995 lstrcpyA(dest, "test");
996 SetLastError(0xdeadbeef);
997 res = PathCanonicalizeA(dest, "one\\two");
998 ok(res, "Expected success\n");
999 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1000 ok(!lstrcmpA(dest, "one\\two"), "Expected one\\two, got %s\n", dest);
1001
1002 /* try current dir and previous dir */
1003 lstrcpyA(dest, "test");
1004 SetLastError(0xdeadbeef);
1005 res = PathCanonicalizeA(dest, "C:\\one\\.\\..\\two\\three\\..");
1006 ok(res, "Expected success\n");
1007 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1008 ok(!lstrcmpA(dest, "C:\\two"), "Expected C:\\two, got %s\n", dest);
1009
1010 /* try simple forward slashes */
1011 lstrcpyA(dest, "test");
1012 SetLastError(0xdeadbeef);
1013 res = PathCanonicalizeA(dest, "C:\\one/two/three\\four/five\\six");
1014 ok(res, "Expected success\n");
1015 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1016 ok(!lstrcmpA(dest, "C:\\one/two/three\\four/five\\six"),
1017 "Expected C:\\one/two/three\\four/five\\six, got %s\n", dest);
1018
1019 /* try simple forward slashes with same dir */
1020 lstrcpyA(dest, "test");
1021 SetLastError(0xdeadbeef);
1022 res = PathCanonicalizeA(dest, "C:\\one/.\\two");
1023 ok(res, "Expected success\n");
1024 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1025 ok(!lstrcmpA(dest, "C:\\one/.\\two"), "Expected C:\\one/.\\two, got %s\n", dest);
1026
1027 /* try simple forward slashes with change dir */
1028 lstrcpyA(dest, "test");
1029 SetLastError(0xdeadbeef);
1030 res = PathCanonicalizeA(dest, "C:\\one/.\\two\\..");
1031 ok(res, "Expected success\n");
1032 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1033 ok(!lstrcmpA(dest, "C:\\one/.") ||
1034 !lstrcmpA(dest, "C:\\one/"), /* Vista */
1035 "Expected \"C:\\one/.\" or \"C:\\one/\", got \"%s\"\n", dest);
1036
1037 /* try relative forward slashes */
1038 lstrcpyA(dest, "test");
1039 SetLastError(0xdeadbeef);
1040 res = PathCanonicalizeA(dest, "../../one/two/");
1041 ok(res, "Expected success\n");
1042 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1043 ok(!lstrcmpA(dest, "../../one/two/"), "Expected ../../one/two/, got %s\n", dest);
1044
1045 /* try relative forward slashes */
1046 lstrcpyA(dest, "test");
1047 SetLastError(0xdeadbeef);
1048 res = PathCanonicalizeA(dest, "../../one/two/\\*");
1049 ok(res, "Expected success\n");
1050 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1051 ok(!lstrcmpA(dest, "../../one/two/\\*"), "Expected ../../one/two/\\*, got %s\n", dest);
1052
1053 /* try forward slashes with change dirs
1054 * NOTE: if there is a forward slash in between two backslashes,
1055 * everything in between the two backslashes is considered on dir
1056 */
1057 lstrcpyA(dest, "test");
1058 SetLastError(0xdeadbeef);
1059 res = PathCanonicalizeA(dest, "C:\\one/.\\..\\two/three\\..\\four/.five");
1060 ok(res, "Expected success\n");
1061 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1062 ok(!lstrcmpA(dest, "C:\\four/.five"), "Expected C:\\four/.five, got %s\n", dest);
1063
1064 /* try src is too long */
1065 memset(too_long, 'a', LONG_LEN);
1066 too_long[LONG_LEN - 1] = '\0';
1067 lstrcpyA(dest, "test");
1068 SetLastError(0xdeadbeef);
1069 res = PathCanonicalizeA(dest, too_long);
1070 ok(!res ||
1071 broken(res), /* Win95, some W2K and XP-SP1 */
1072 "Expected failure\n");
1073 todo_wine
1074 {
1075 ok(GetLastError() == 0xdeadbeef || GetLastError() == ERROR_FILENAME_EXCED_RANGE /* Vista */,
1076 "Expected 0xdeadbeef or ERROR_FILENAME_EXCED_RANGE, got %ld\n", GetLastError());
1077 }
1078 ok(lstrlenA(too_long) == LONG_LEN - 1, "Expected length LONG_LEN - 1, got %i\n", lstrlenA(too_long));
1079}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static char * dest
Definition: rtl.c:135
#define PathCanonicalizeA
Definition: pathcch.h:313
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:385

Referenced by START_TEST().

◆ test_PathCombineA()

static void test_PathCombineA ( void  )
static

Definition at line 544 of file path.c.

545{
546 LPSTR str;
547 char dest[MAX_PATH];
548 char too_long[LONG_LEN];
549 char one[HALF_LEN], two[HALF_LEN];
550
551 /* try NULL dest */
552 SetLastError(0xdeadbeef);
553 str = PathCombineA(NULL, "C:\\", "one\\two\\three");
554 ok(str == NULL, "Expected NULL, got %p\n", str);
555 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
556
557 /* try NULL dest and NULL directory */
558 SetLastError(0xdeadbeef);
559 str = PathCombineA(NULL, NULL, "one\\two\\three");
560 ok(str == NULL, "Expected NULL, got %p\n", str);
561 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
562
563 /* try all NULL*/
564 SetLastError(0xdeadbeef);
566 ok(str == NULL, "Expected NULL, got %p\n", str);
567 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
568
569 /* try NULL file part */
570 SetLastError(0xdeadbeef);
571 lstrcpyA(dest, "control");
572 str = PathCombineA(dest, "C:\\", NULL);
573 ok(str == dest, "Expected str == dest, got %p\n", str);
574 ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
575 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
576
577 /* try empty file part */
578 SetLastError(0xdeadbeef);
579 lstrcpyA(dest, "control");
580 str = PathCombineA(dest, "C:\\", "");
581 ok(str == dest, "Expected str == dest, got %p\n", str);
582 ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
583 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
584
585 /* try empty directory and file part */
586 SetLastError(0xdeadbeef);
587 lstrcpyA(dest, "control");
588 str = PathCombineA(dest, "", "");
589 ok(str == dest, "Expected str == dest, got %p\n", str);
590 ok(!lstrcmpA(str, "\\") ||
591 broken(!lstrcmpA(str, "control")), /* Win95 and some W2K */
592 "Expected \\, got %s\n", str);
593 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
594
595 /* try NULL directory */
596 SetLastError(0xdeadbeef);
597 lstrcpyA(dest, "control");
598 str = PathCombineA(dest, NULL, "one\\two\\three");
599 ok(str == dest, "Expected str == dest, got %p\n", str);
600 ok(!lstrcmpA(str, "one\\two\\three"), "Expected one\\two\\three, got %s\n", str);
601 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
602
603 /* try NULL directory and empty file part */
604 SetLastError(0xdeadbeef);
605 lstrcpyA(dest, "control");
606 str = PathCombineA(dest, NULL, "");
607 ok(str == dest, "Expected str == dest, got %p\n", str);
608 ok(!lstrcmpA(str, "\\") ||
609 broken(!lstrcmpA(str, "one\\two\\three")), /* Win95 and some W2K */
610 "Expected \\, got %s\n", str);
611 ok(GetLastError() == 0xdeadbeef ||
613 "Expected 0xdeadbeef, got %ld\n", GetLastError());
614
615 /* try NULL directory and file part */
616 SetLastError(0xdeadbeef);
617 lstrcpyA(dest, "control");
619 ok(str == NULL ||
620 broken(str != NULL), /* Win95 and some W2K */
621 "Expected str == NULL, got %p\n", str);
622 ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
623 "Expected 0 length, got %i\n", lstrlenA(dest));
624 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
625
626 /* try directory without backslash */
627 SetLastError(0xdeadbeef);
628 lstrcpyA(dest, "control");
629 str = PathCombineA(dest, "C:", "one\\two\\three");
630 ok(str == dest, "Expected str == dest, got %p\n", str);
631 ok(!lstrcmpA(str, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", str);
632 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
633
634 /* try directory with backslash */
635 SetLastError(0xdeadbeef);
636 lstrcpyA(dest, "control");
637 str = PathCombineA(dest, "C:\\", "one\\two\\three");
638 ok(str == dest, "Expected str == dest, got %p\n", str);
639 ok(!lstrcmpA(str, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", str);
640 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
641
642 /* try directory with backslash and file with prepended backslash */
643 SetLastError(0xdeadbeef);
644 lstrcpyA(dest, "control");
645 str = PathCombineA(dest, "C:\\", "\\one\\two\\three");
646 ok(str == dest, "Expected str == dest, got %p\n", str);
647 ok(!lstrcmpA(str, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", str);
648 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
649
650 /* try previous test, with backslash appended as well */
651 SetLastError(0xdeadbeef);
652 lstrcpyA(dest, "control");
653 str = PathCombineA(dest, "C:\\", "\\one\\two\\three\\");
654 ok(str == dest, "Expected str == dest, got %p\n", str);
655 ok(!lstrcmpA(str, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", str);
656 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
657
658 /* try a relative directory */
659 SetLastError(0xdeadbeef);
660 lstrcpyA(dest, "control");
661 str = PathCombineA(dest, "relative\\dir", "\\one\\two\\three\\");
662 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
663 /* Vista fails which probably makes sense as PathCombineA expects an absolute dir */
664 if (str)
665 {
666 ok(str == dest, "Expected str == dest, got %p\n", str);
667 ok(!lstrcmpA(str, "one\\two\\three\\"), "Expected one\\two\\three\\, got %s\n", str);
668 }
669
670 /* try forward slashes */
671 SetLastError(0xdeadbeef);
672 lstrcpyA(dest, "control");
673 str = PathCombineA(dest, "C:\\", "one/two/three\\");
674 ok(str == dest, "Expected str == dest, got %p\n", str);
675 ok(!lstrcmpA(str, "C:\\one/two/three\\"), "Expected one/two/three\\, got %s\n", str);
676 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
677
678 /* try a really weird directory */
679 SetLastError(0xdeadbeef);
680 lstrcpyA(dest, "control");
681 str = PathCombineA(dest, "C:\\/\\/", "\\one\\two\\three\\");
682 ok(str == dest, "Expected str == dest, got %p\n", str);
683 ok(!lstrcmpA(str, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", str);
684 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
685
686 /* try periods */
687 SetLastError(0xdeadbeef);
688 lstrcpyA(dest, "control");
689 str = PathCombineA(dest, "C:\\", "one\\..\\two\\.\\three");
690 ok(str == dest, "Expected str == dest, got %p\n", str);
691 ok(!lstrcmpA(str, "C:\\two\\three"), "Expected C:\\two\\three, got %s\n", str);
692 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
693
694 /* try .. as file */
695 /* try forward slashes */
696 SetLastError(0xdeadbeef);
697 lstrcpyA(dest, "control");
698 str = PathCombineA(dest, "C:\\", "..");
699 ok(str == dest, "Expected str == dest, got %p\n", str);
700 ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
701 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
702
703 /* try relative paths */
704 /* try forward slashes */
705 SetLastError(0xdeadbeef);
706 lstrcpyA(dest, "control");
707 str = PathCombineA(dest, "../../../one/two/", "*");
708 ok(str == dest, "Expected str == dest, got %p\n", str);
709 ok(!lstrcmpA(str, "../../../one/two/\\*"), "Expected ../../../one/two/\\*, got %s\n", str);
710 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
711
712 memset(too_long, 'a', LONG_LEN);
713 too_long[LONG_LEN - 1] = '\0';
714
715 /* try a file longer than MAX_PATH */
716 SetLastError(0xdeadbeef);
717 lstrcpyA(dest, "control");
718 str = PathCombineA(dest, "C:\\", too_long);
719 ok(str == NULL, "Expected str == NULL, got %p\n", str);
720 ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
721 "Expected 0 length, got %i\n", lstrlenA(dest));
722 todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
723
724 /* try a directory longer than MAX_PATH */
725 SetLastError(0xdeadbeef);
726 lstrcpyA(dest, "control");
727 str = PathCombineA(dest, too_long, "one\\two\\three");
728 ok(str == NULL, "Expected str == NULL, got %p\n", str);
729 ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
730 "Expected 0 length, got %i\n", lstrlenA(dest));
731 todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
732
733 memset(one, 'b', HALF_LEN);
734 memset(two, 'c', HALF_LEN);
735 one[HALF_LEN - 1] = '\0';
736 two[HALF_LEN - 1] = '\0';
737
738 /* destination string is longer than MAX_PATH, but not the constituent parts */
739 SetLastError(0xdeadbeef);
740 lstrcpyA(dest, "control");
742 ok(str == NULL, "Expected str == NULL, got %p\n", str);
743 ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
744 "Expected 0 length, got %i\n", lstrlenA(dest));
745 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
746}
static double two
Definition: jn_yn.c:52
#define PathCombineA
Definition: pathcch.h:317
int one
Definition: sehframes.cpp:28

Referenced by START_TEST().

◆ test_PathCombineW()

static void test_PathCombineW ( void  )
static

Definition at line 489 of file path.c.

490{
491 LPWSTR wszString, wszString2;
492 WCHAR wbuf[MAX_PATH+1], wstr1[MAX_PATH] = {'C',':','\\',0}, wstr2[MAX_PATH];
493 static const WCHAR expout[] = {'C',':','\\','A','A',0};
494 int i;
495
496 if (!pPathCombineW)
497 {
498 win_skip("PathCombineW isn't available\n");
499 return;
500 }
501
502 wszString2 = malloc(MAX_PATH * sizeof(WCHAR));
503
504 /* NULL test */
505 wszString = pPathCombineW(NULL, NULL, NULL);
506 ok (wszString == NULL, "Expected a NULL return\n");
507
508 /* Some NULL */
509 wszString2[0] = 'a';
510 wszString = pPathCombineW(wszString2, NULL, NULL);
511 ok (wszString == NULL ||
512 broken(wszString[0] == 'a'), /* Win95 and some W2K */
513 "Expected a NULL return\n");
514 ok (wszString2[0] == 0 ||
515 broken(wszString2[0] == 'a'), /* Win95 and some W2K */
516 "Destination string not empty\n");
517
518 free(wszString2);
519
520 /* overflow test */
521 wstr2[0] = wstr2[1] = wstr2[2] = 'A';
522 for (i=3; i<MAX_PATH/2; i++)
523 wstr1[i] = wstr2[i] = 'A';
524 wstr1[(MAX_PATH/2) - 1] = wstr2[MAX_PATH/2] = 0;
525 memset(wbuf, 0xbf, sizeof(wbuf));
526
527 wszString = pPathCombineW(wbuf, wstr1, wstr2);
528 ok(wszString == NULL, "Expected a NULL return\n");
529 ok(wbuf[0] == 0 ||
530 broken(wbuf[0] == 0xbfbf), /* Win95 and some W2K */
531 "Buffer contains data\n");
532
533 /* PathCombineW can be used in place */
534 wstr1[3] = 0;
535 wstr2[2] = 0;
536 ok(PathCombineW(wstr1, wstr1, wstr2) == wstr1, "Expected a wstr1 return\n");
537 ok(StrCmpW(wstr1, expout) == 0, "Unexpected PathCombine output\n");
538}
#define free
Definition: debug_ros.c:5
int WINAPI StrCmpW(const WCHAR *str, const WCHAR *comp)
Definition: string.c:450
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define PathCombineW
Definition: pathcch.h:318
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by START_TEST().

◆ test_PathCommonPrefixA()

static void test_PathCommonPrefixA ( void  )
static

Definition at line 1203 of file path.c.

1204{
1205 char path1[MAX_PATH], path2[MAX_PATH];
1206 char out[MAX_PATH];
1207 int count;
1208
1209 /* test NULL path1 */
1210 SetLastError(0xdeadbeef);
1211 lstrcpyA(path2, "C:\\");
1212 lstrcpyA(out, "aaa");
1214 ok(count == 0, "Expected 0, got %i\n", count);
1215 todo_wine
1216 {
1217 ok(!lstrcmpA(out, "aaa"), "Expected aaa, got %s\n", out);
1218 }
1219 ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
1220 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1221
1222 /* test NULL path2 */
1223 SetLastError(0xdeadbeef);
1224 lstrcpyA(path1, "C:\\");
1225 lstrcpyA(out, "aaa");
1227 ok(count == 0, "Expected 0, got %i\n", count);
1228 todo_wine
1229 {
1230 ok(!lstrcmpA(out, "aaa"), "Expected aaa, got %s\n", out);
1231 }
1232 ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
1233 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1234
1235 /* test empty path1 */
1236 SetLastError(0xdeadbeef);
1237 path1[0] = '\0';
1238 lstrcpyA(path2, "C:\\");
1239 lstrcpyA(out, "aaa");
1241 ok(count == 0, "Expected 0, got %i\n", count);
1242 ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
1243 ok(!path1[0], "Expected 0 length path1, got %i\n", lstrlenA(path1));
1244 ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
1245 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1246
1247 /* test empty path1 */
1248 SetLastError(0xdeadbeef);
1249 path2[0] = '\0';
1250 lstrcpyA(path1, "C:\\");
1251 lstrcpyA(out, "aaa");
1253 ok(count == 0, "Expected 0, got %i\n", count);
1254 ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
1255 ok(!path2[0], "Expected 0 length path2, got %i\n", lstrlenA(path2));
1256 ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
1257 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1258
1259 /* paths are legit, out is NULL */
1260 SetLastError(0xdeadbeef);
1261 lstrcpyA(path1, "C:\\");
1262 lstrcpyA(path2, "C:\\");
1264 ok(count == 3, "Expected 3, got %i\n", count);
1265 ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
1266 ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
1267 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1268
1269 /* all parameters legit */
1270 SetLastError(0xdeadbeef);
1271 lstrcpyA(path1, "C:\\");
1272 lstrcpyA(path2, "C:\\");
1273 lstrcpyA(out, "aaa");
1275 ok(count == 3, "Expected 3, got %i\n", count);
1276 ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
1277 ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
1278 ok(!lstrcmpA(out, "C:\\"), "Expected C:\\, got %s\n", out);
1279 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1280
1281 /* path1 and path2 not the same, but common prefix */
1282 SetLastError(0xdeadbeef);
1283 lstrcpyA(path1, "C:\\one\\two");
1284 lstrcpyA(path2, "C:\\one\\three");
1285 lstrcpyA(out, "aaa");
1287 ok(count == 6, "Expected 6, got %i\n", count);
1288 ok(!lstrcmpA(path1, "C:\\one\\two"), "Expected C:\\one\\two, got %s\n", path1);
1289 ok(!lstrcmpA(path2, "C:\\one\\three"), "Expected C:\\one\\three, got %s\n", path2);
1290 ok(!lstrcmpA(out, "C:\\one"), "Expected C:\\one, got %s\n", out);
1291 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1292
1293 /* try . prefix */
1294 SetLastError(0xdeadbeef);
1295 lstrcpyA(path1, "one\\.two");
1296 lstrcpyA(path2, "one\\.three");
1297 lstrcpyA(out, "aaa");
1299 ok(count == 3, "Expected 3, got %i\n", count);
1300 ok(!lstrcmpA(path1, "one\\.two"), "Expected one\\.two, got %s\n", path1);
1301 ok(!lstrcmpA(path2, "one\\.three"), "Expected one\\.three, got %s\n", path2);
1302 ok(!lstrcmpA(out, "one"), "Expected one, got %s\n", out);
1303 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1304
1305 /* try .. prefix */
1306 SetLastError(0xdeadbeef);
1307 lstrcpyA(path1, "one\\..two");
1308 lstrcpyA(path2, "one\\..three");
1309 lstrcpyA(out, "aaa");
1311 ok(count == 3, "Expected 3, got %i\n", count);
1312 ok(!lstrcmpA(path1, "one\\..two"), "Expected one\\..two, got %s\n", path1);
1313 ok(!lstrcmpA(path2, "one\\..three"), "Expected one\\..three, got %s\n", path2);
1314 ok(!lstrcmpA(out, "one"), "Expected one, got %s\n", out);
1315 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1316
1317 /* try ... prefix */
1318 SetLastError(0xdeadbeef);
1319 lstrcpyA(path1, "one\\...two");
1320 lstrcpyA(path2, "one\\...three");
1321 lstrcpyA(out, "aaa");
1323 ok(count == 3, "Expected 3, got %i\n", count);
1324 ok(!lstrcmpA(path1, "one\\...two"), "Expected one\\...two, got %s\n", path1);
1325 ok(!lstrcmpA(path2, "one\\...three"), "Expected one\\...three, got %s\n", path2);
1326 ok(!lstrcmpA(out, "one"), "Expected one, got %s\n", out);
1327 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1328
1329 /* try .\ prefix */
1330 SetLastError(0xdeadbeef);
1331 lstrcpyA(path1, "one\\.\\two");
1332 lstrcpyA(path2, "one\\.\\three");
1333 lstrcpyA(out, "aaa");
1335 ok(count == 5, "Expected 5, got %i\n", count);
1336 ok(!lstrcmpA(path1, "one\\.\\two"), "Expected one\\.\\two, got %s\n", path1);
1337 ok(!lstrcmpA(path2, "one\\.\\three"), "Expected one\\.\\three, got %s\n", path2);
1338 ok(!lstrcmpA(out, "one\\."), "Expected one\\., got %s\n", out);
1339 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1340
1341 /* try ..\ prefix */
1342 SetLastError(0xdeadbeef);
1343 lstrcpyA(path1, "one\\..\\two");
1344 lstrcpyA(path2, "one\\..\\three");
1345 lstrcpyA(out, "aaa");
1347 ok(count == 6, "Expected 6, got %i\n", count);
1348 ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1);
1349 ok(!lstrcmpA(path2, "one\\..\\three"), "Expected one\\..\\three, got %s\n", path2);
1350 ok(!lstrcmpA(out, "one\\.."), "Expected one\\.., got %s\n", out);
1351 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1352
1353 /* try ...\\ prefix */
1354 SetLastError(0xdeadbeef);
1355 lstrcpyA(path1, "one\\...\\two");
1356 lstrcpyA(path2, "one\\...\\three");
1357 lstrcpyA(out, "aaa");
1359 ok(count == 7, "Expected 7, got %i\n", count);
1360 ok(!lstrcmpA(path1, "one\\...\\two"), "Expected one\\...\\two, got %s\n", path1);
1361 ok(!lstrcmpA(path2, "one\\...\\three"), "Expected one\\...\\three, got %s\n", path2);
1362 ok(!lstrcmpA(out, "one\\..."), "Expected one\\..., got %s\n", out);
1363 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1364
1365 /* try prefix that is not an msdn labeled prefix type */
1366 SetLastError(0xdeadbeef);
1367 lstrcpyA(path1, "same");
1368 lstrcpyA(path2, "same");
1369 lstrcpyA(out, "aaa");
1371 ok(count == 4, "Expected 4, got %i\n", count);
1372 ok(!lstrcmpA(path1, "same"), "Expected same, got %s\n", path1);
1373 ok(!lstrcmpA(path2, "same"), "Expected same, got %s\n", path2);
1374 ok(!lstrcmpA(out, "same"), "Expected same, got %s\n", out);
1375 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1376
1377 /* try . after directory */
1378 SetLastError(0xdeadbeef);
1379 lstrcpyA(path1, "one\\mid.\\two");
1380 lstrcpyA(path2, "one\\mid.\\three");
1381 lstrcpyA(out, "aaa");
1383 ok(count == 8, "Expected 8, got %i\n", count);
1384 ok(!lstrcmpA(path1, "one\\mid.\\two"), "Expected one\\mid.\\two, got %s\n", path1);
1385 ok(!lstrcmpA(path2, "one\\mid.\\three"), "Expected one\\mid.\\three, got %s\n", path2);
1386 ok(!lstrcmpA(out, "one\\mid."), "Expected one\\mid., got %s\n", out);
1387 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1388
1389 /* try . in the middle of a directory */
1390 SetLastError(0xdeadbeef);
1391 lstrcpyA(path1, "one\\mid.end\\two");
1392 lstrcpyA(path2, "one\\mid.end\\three");
1393 lstrcpyA(out, "aaa");
1395 ok(count == 11, "Expected 11, got %i\n", count);
1396 ok(!lstrcmpA(path1, "one\\mid.end\\two"), "Expected one\\mid.end\\two, got %s\n", path1);
1397 ok(!lstrcmpA(path2, "one\\mid.end\\three"), "Expected one\\mid.end\\three, got %s\n", path2);
1398 ok(!lstrcmpA(out, "one\\mid.end"), "Expected one\\mid.end, got %s\n", out);
1399 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1400
1401 /* try comparing a .. with the expanded path */
1402 SetLastError(0xdeadbeef);
1403 lstrcpyA(path1, "one\\..\\two");
1404 lstrcpyA(path2, "two");
1405 lstrcpyA(out, "aaa");
1407 ok(count == 0, "Expected 0, got %i\n", count);
1408 ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1);
1409 ok(!lstrcmpA(path2, "two"), "Expected two, got %s\n", path2);
1410 ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
1411 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1412}
int WINAPI PathCommonPrefixA(const char *file1, const char *file2, char *path)
Definition: path.c:1570
GLuint GLuint GLsizei count
Definition: gl.h:1545
static const WCHAR path1[]
Definition: path.c:28
static const WCHAR path2[]
Definition: path.c:29
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by START_TEST().

◆ test_PathCreateFromUrl()

static void test_PathCreateFromUrl ( void  )
static

Definition at line 252 of file path.c.

253{
254 size_t i;
255 char ret_path[INTERNET_MAX_URL_LENGTH];
256 DWORD len, len2, ret;
258 WCHAR *pathW, *urlW;
259
260 if (!pPathCreateFromUrlA) {
261 win_skip("PathCreateFromUrlA not found\n");
262 return;
263 }
264
265 /* Won't say how much is needed without a buffer */
266 len = 0xdeca;
267 ret = pPathCreateFromUrlA("file://foo", NULL, &len, 0);
268 ok(ret == E_INVALIDARG, "got 0x%08lx expected E_INVALIDARG\n", ret);
269 ok(len == 0xdeca, "got %lx expected 0xdeca\n", len);
270
271 /* Test the decoding itself */
272 for (i = 0; i < ARRAY_SIZE(TEST_PATHFROMURL); i++) {
274 ret = pPathCreateFromUrlA(TEST_PATHFROMURL[i].url, ret_path, &len, 0);
276 ok(ret == TEST_PATHFROMURL[i].ret, "ret %08lx from url %s\n", ret, TEST_PATHFROMURL[i].url);
278 if(!(TEST_PATHFROMURL[i].todo & 0x2)) {
279 ok(!lstrcmpiA(ret_path, TEST_PATHFROMURL[i].path), "got %s expected %s from url %s\n", ret_path, TEST_PATHFROMURL[i].path, TEST_PATHFROMURL[i].url);
280 ok(len == strlen(ret_path), "ret len %ld from url %s\n", len, TEST_PATHFROMURL[i].url);
281 } else todo_wine
282 /* Wrong string, don't bother checking the length */
283 ok(!lstrcmpiA(ret_path, TEST_PATHFROMURL[i].path), "got %s expected %s from url %s\n", ret_path, TEST_PATHFROMURL[i].path, TEST_PATHFROMURL[i].url);
284 }
285
286 if (pPathCreateFromUrlW) {
290 ret = pPathCreateFromUrlW(urlW, ret_pathW, &len, 0);
291 WideCharToMultiByte(CP_ACP, 0, ret_pathW, -1, ret_path, sizeof(ret_path),NULL,NULL);
293 ok(ret == TEST_PATHFROMURL[i].ret, "ret %08lx from url L\"%s\"\n", ret, TEST_PATHFROMURL[i].url);
295 if(!(TEST_PATHFROMURL[i].todo & 0x2)) {
296 ok(!lstrcmpiW(ret_pathW, pathW), "got %s expected %s from url L\"%s\"\n",
298 ok(len == lstrlenW(ret_pathW), "ret len %ld from url L\"%s\"\n", len, TEST_PATHFROMURL[i].url);
299 } else todo_wine
300 /* Wrong string, don't bother checking the length */
301 ok(!lstrcmpiW(ret_pathW, pathW), "got %s expected %s from url L\"%s\"\n",
303 }
304
305 if (SUCCEEDED(ret))
306 {
307 /* Check what happens if the buffer is too small */
308 len2 = 2;
309 ret = pPathCreateFromUrlW(urlW, ret_pathW, &len2, 0);
310 ok(ret == E_POINTER, "ret %08lx, expected E_POINTER from url %s\n", ret, TEST_PATHFROMURL[i].url);
312 ok(len2 == len + 1, "got len = %ld expected %ld from url %s\n", len2, len + 1, TEST_PATHFROMURL[i].url);
313 }
314
315 free(urlW);
316 free(pathW);
317 }
318 }
319
320 if (pPathCreateFromUrlAlloc)
321 {
322 static const WCHAR fileW[] = {'f','i','l','e',':','/','/','f','o','o',0};
323 static const WCHAR fooW[] = {'\\','\\','f','o','o',0};
324
325 pathW = NULL;
326 ret = pPathCreateFromUrlAlloc(fileW, &pathW, 0);
327 ok(ret == S_OK, "got 0x%08lx expected S_OK\n", ret);
328 ok(lstrcmpiW(pathW, fooW) == 0, "got %s expected %s\n", wine_dbgstr_w(pathW), wine_dbgstr_w(fooW));
329 LocalFree(pathW);
330 }
331}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ARRAY_SIZE(A)
Definition: main.h:20
#define E_INVALIDARG
Definition: ddrawi.h:101
#define WideCharToMultiByte
Definition: compat.h:111
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4265
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4227
static const WCHAR fileW[]
Definition: url.c:111
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define wine_dbgstr_w
Definition: kernel32.h:34
#define todo_wine_if(is_todo)
Definition: minitest.h:81
static const WCHAR url[]
Definition: encode.c:1384
static const WCHAR fooW[]
Definition: locale.c:44
DWORD todo
Definition: path.c:47
static LPWSTR GetWideString(const char *src)
Definition: path.c:186
static const struct @1836 TEST_PATHFROMURL[]
#define E_POINTER
Definition: winerror.h:3480

Referenced by START_TEST().

◆ test_PathFindExtensionA()

static void test_PathFindExtensionA ( void  )
static

Definition at line 1081 of file path.c.

1082{
1083 LPSTR ext;
1084 char path[MAX_PATH];
1085 char too_long[LONG_LEN];
1086
1087 /* try a NULL path */
1088 SetLastError(0xdeadbeef);
1090 ok(ext == NULL, "Expected NULL, got %p\n", ext);
1091 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1092
1093 /* try an empty path */
1094 path[0] = '\0';
1095 SetLastError(0xdeadbeef);
1097 ok(ext == path, "Expected ext == path, got %p\n", ext);
1098 ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
1099 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1100
1101 /* try a path without an extension */
1102 lstrcpyA(path, "file");
1103 SetLastError(0xdeadbeef);
1105 ok(ext == path + lstrlenA(path), "Expected ext == path, got %p\n", ext);
1106 ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
1107 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1108
1109 /* try a path with an extension */
1110 lstrcpyA(path, "file.txt");
1111 SetLastError(0xdeadbeef);
1113 ok(ext == path + lstrlenA("file"),
1114 "Expected ext == path + lstrlenA(\"file\"), got %p\n", ext);
1115 ok(!lstrcmpA(ext, ".txt"), "Expected .txt, got %s\n", ext);
1116 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1117
1118 /* try a path with two extensions */
1119 lstrcpyA(path, "file.txt.doc");
1120 SetLastError(0xdeadbeef);
1122 ok(ext == path + lstrlenA("file.txt"),
1123 "Expected ext == path + lstrlenA(\"file.txt\"), got %p\n", ext);
1124 ok(!lstrcmpA(ext, ".doc"), "Expected .txt, got %s\n", ext);
1125 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1126
1127 /* try a path longer than MAX_PATH without an extension*/
1128 memset(too_long, 'a', LONG_LEN);
1129 too_long[LONG_LEN - 1] = '\0';
1130 SetLastError(0xdeadbeef);
1131 ext = PathFindExtensionA(too_long);
1132 ok(ext == too_long + LONG_LEN - 1, "Expected ext == too_long + LONG_LEN - 1, got %p\n", ext);
1133 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1134
1135 /* try a path longer than MAX_PATH with an extension*/
1136 memset(too_long, 'a', LONG_LEN);
1137 too_long[LONG_LEN - 1] = '\0';
1138 lstrcpyA(too_long + 300, ".abcde");
1139 too_long[lstrlenA(too_long)] = 'a';
1140 SetLastError(0xdeadbeef);
1141 ext = PathFindExtensionA(too_long);
1142 ok(ext == too_long + 300, "Expected ext == too_long + 300, got %p\n", ext);
1143 ok(lstrlenA(ext) == LONG_LEN - 301, "Expected LONG_LEN - 301, got %i\n", lstrlenA(ext));
1144 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
1145}
static const WCHAR *const ext[]
Definition: module.c:53
LPSTR WINAPI PathFindExtensionA(const char *path)
Definition: path.c:1253

Referenced by START_TEST().

◆ test_PathGetDriveNumber()

static void test_PathGetDriveNumber ( void  )
static

Definition at line 1437 of file path.c.

1438{
1439 static const CHAR test1A[] = "a:\\test.file";
1440 static const CHAR test2A[] = "file:////b:\\test.file";
1441 static const CHAR test3A[] = "file:///c:\\test.file";
1442 static const CHAR test4A[] = "file:\\\\c:\\test.file";
1443 static const CHAR test5A[] = "\\\\?\\C:\\dir\\file.txt";
1444 static const WCHAR test1W[] =
1445 {'a',':','\\',0};
1446 static const WCHAR test5W[] =
1447 {'\\','\\','?','\\','C',':','\\','d','i','r','\\','f','i','l','e',0};
1448 int ret;
1449
1450 SetLastError(0xdeadbeef);
1452 ok(ret == -1, "got %d\n", ret);
1453 ok(GetLastError() == 0xdeadbeef, "got %ld\n", GetLastError());
1454
1455 ret = PathGetDriveNumberA(test1A);
1456 ok(ret == 0, "got %d\n", ret);
1457 ret = PathGetDriveNumberW(test1W);
1458 ok(ret == 0, "got %d\n", ret);
1459 ret = PathGetDriveNumberA(test2A);
1460 ok(ret == -1, "got %d\n", ret);
1461 ret = PathGetDriveNumberA(test3A);
1462 ok(ret == -1, "got %d\n", ret);
1463 ret = PathGetDriveNumberA(test4A);
1464 ok(ret == -1, "got %d\n", ret);
1465
1466 ret = PathGetDriveNumberA(test5A);
1467 ok(ret == -1, "got %d\n", ret);
1468 ret = PathGetDriveNumberW(test5W);
1469 ok(ret == 2 || broken(ret == -1) /* winxp */, "got = %d\n", ret);
1470}
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:553
int WINAPI PathGetDriveNumberA(LPCSTR lpszPath)
Definition: path.c:538
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ test_PathIsRelativeA()

static void test_PathIsRelativeA ( void  )
static

Definition at line 1630 of file path.c.

1631{
1632 BOOL ret;
1633 int i, num;
1634
1635 if (!pPathIsRelativeA) {
1636 win_skip("PathIsRelativeA not available\n");
1637 return;
1638 }
1639
1641 for (i = 0; i < num; i++) {
1642 ret = pPathIsRelativeA(test_path_is_relative[i].path);
1644 "PathIsRelativeA(\"%s\") expects %d, got %d.\n",
1646 }
1647}
GLuint GLuint num
Definition: glext.h:9618
#define expect(expected, got)
Definition: path.c:34
static const struct @1839 test_path_is_relative[]

Referenced by START_TEST().

◆ test_PathIsRelativeW()

static void test_PathIsRelativeW ( void  )
static

Definition at line 1649 of file path.c.

1650{
1651 BOOL ret;
1652 int i, num;
1653 LPWSTR path;
1654
1655 if (!pPathIsRelativeW) {
1656 win_skip("PathIsRelativeW not available\n");
1657 return;
1658 }
1659
1661 for (i = 0; i < num; i++) {
1663
1664 ret = pPathIsRelativeW(path);
1666 "PathIsRelativeW(\"%s\") expects %d, got %d.\n",
1668
1669 free(path);
1670 }
1671}

Referenced by START_TEST().

◆ test_PathIsUrl()

static void test_PathIsUrl ( void  )
static

Definition at line 334 of file path.c.

335{
336 size_t i;
337 BOOL ret;
338
339 for (i = 0; i < ARRAY_SIZE(TEST_PATH_IS_URL); i++) {
342 "returned %d from path %s, expected %d\n", ret, TEST_PATH_IS_URL[i].path,
344 }
345}
BOOL WINAPI PathIsURLA(const char *path)
Definition: path.c:3222
static struct @1837 TEST_PATH_IS_URL[]

Referenced by START_TEST().

◆ test_PathIsValidCharA()

static void test_PathIsValidCharA ( void  )
static

Definition at line 383 of file path.c.

384{
385 BOOL ret;
386 unsigned int c;
387
388 /* For whatever reason, PathIsValidCharA and PathAppendA share the same
389 * ordinal number in some native versions. Check this to prevent a crash.
390 */
391 if (!pPathIsValidCharA || pPathIsValidCharA == (void*)pPathAppendA)
392 {
393 win_skip("PathIsValidCharA isn't available\n");
394 return;
395 }
396
397 for (c = 0; c < 0x7f; c++)
398 {
399 ret = pPathIsValidCharA( c, ~0U );
400 ok ( ret || !SHELL_charclass[c], "PathIsValidCharA failed: 0x%02x got 0x%08x\n", c, ret );
401 }
402
403 for (c = 0x7f; c <= 0xff; c++)
404 {
405 ret = pPathIsValidCharA( c, ~0U );
406 ok ( ret, "PathIsValidCharA failed: 0x%02x got 0x%08x\n", c, ret );
407 }
408}
#define U(x)
Definition: wordpad.c:45
static const DWORD SHELL_charclass[]
Definition: path.c:4323
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80

Referenced by START_TEST().

◆ test_PathIsValidCharW()

static void test_PathIsValidCharW ( void  )
static

Definition at line 410 of file path.c.

411{
412 BOOL ret;
413 unsigned int c;
414
415 if (!pPathIsValidCharW)
416 {
417 win_skip("PathIsValidCharW isn't available\n");
418 return;
419 }
420
421 for (c = 0; c < 0x7f; c++)
422 {
423 ret = pPathIsValidCharW( c, ~0U );
424 ok ( ret || !SHELL_charclass[c], "PathIsValidCharW failed: 0x%02x got 0x%08x\n", c, ret );
425 }
426
427 for (c = 0x007f; c <= 0xffff; c++)
428 {
429 ret = pPathIsValidCharW( c, ~0U );
430 ok ( ret, "PathIsValidCharW failed: 0x%02x got 0x%08x\n", c, ret );
431 }
432}

Referenced by START_TEST().

◆ test_PathMakePretty()

static void test_PathMakePretty ( void  )
static

Definition at line 434 of file path.c.

435{
436 char buff[MAX_PATH];
437
438 ok (PathMakePrettyA(NULL) == FALSE, "PathMakePretty: NULL path succeeded\n");
439 buff[0] = '\0';
440 ok (PathMakePrettyA(buff) == TRUE, "PathMakePretty: Empty path failed\n");
441
442 strcpy(buff, "C:\\A LONG FILE NAME WITH \\SPACES.TXT");
443 ok (PathMakePrettyA(buff) == TRUE, "PathMakePretty: Long UC name failed\n");
444 ok (strcmp(buff, "C:\\a long file name with \\spaces.txt") == 0,
445 "PathMakePretty: Long UC name not changed\n");
446
447 strcpy(buff, "C:\\A LONG FILE NAME WITH \\MixedCase.TXT");
448 ok (PathMakePrettyA(buff) == FALSE, "PathMakePretty: Long MC name succeeded\n");
449 ok (strcmp(buff, "C:\\A LONG FILE NAME WITH \\MixedCase.TXT") == 0,
450 "PathMakePretty: Failed but modified path\n");
451
452 strcpy(buff, "TEST");
453 ok (PathMakePrettyA(buff) == TRUE, "PathMakePretty: Short name failed\n");
454 ok (strcmp(buff, "Test") == 0, "PathMakePretty: 1st char lowercased %s\n", buff);
455}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI PathMakePrettyA(LPSTR lpszPath)
Definition: path.c:2674
static unsigned char buff[32768]
Definition: fatten.c:17
strcpy
Definition: string.h:131

Referenced by START_TEST().

◆ test_PathMatchSpec()

static void test_PathMatchSpec ( void  )
static

Definition at line 457 of file path.c.

458{
459 static const char file[] = "c:\\foo\\bar\\filename.ext";
460 static const char spec1[] = ".ext";
461 static const char spec2[] = "*.ext";
462 static const char spec3[] = "*.ext ";
463 static const char spec4[] = " *.ext";
464 static const char spec5[] = "* .ext";
465 static const char spec6[] = "*. ext";
466 static const char spec7[] = "* . ext";
467 static const char spec8[] = "*.e?t";
468 static const char spec9[] = "filename.ext";
469 static const char spec10[] = "*bar\\filename.ext";
470 static const char spec11[] = " foo; *.ext";
471 static const char spec12[] = "*.ext;*.bar";
472 static const char spec13[] = "*bar*";
473
474 ok (PathMatchSpecA(file, spec1) == FALSE, "PathMatchSpec: Spec1 failed\n");
475 ok (PathMatchSpecA(file, spec2) == TRUE, "PathMatchSpec: Spec2 failed\n");
476 ok (PathMatchSpecA(file, spec3) == FALSE, "PathMatchSpec: Spec3 failed\n");
477 ok (PathMatchSpecA(file, spec4) == TRUE, "PathMatchSpec: Spec4 failed\n");
478 todo_wine ok (PathMatchSpecA(file, spec5) == TRUE, "PathMatchSpec: Spec5 failed\n");
479 todo_wine ok (PathMatchSpecA(file, spec6) == TRUE, "PathMatchSpec: Spec6 failed\n");
480 ok (PathMatchSpecA(file, spec7) == FALSE, "PathMatchSpec: Spec7 failed\n");
481 ok (PathMatchSpecA(file, spec8) == TRUE, "PathMatchSpec: Spec8 failed\n");
482 ok (PathMatchSpecA(file, spec9) == FALSE, "PathMatchSpec: Spec9 failed\n");
483 ok (PathMatchSpecA(file, spec10) == TRUE, "PathMatchSpec: Spec10 failed\n");
484 ok (PathMatchSpecA(file, spec11) == TRUE, "PathMatchSpec: Spec11 failed\n");
485 ok (PathMatchSpecA(file, spec12) == TRUE, "PathMatchSpec: Spec12 failed\n");
486 ok (PathMatchSpecA(file, spec13) == TRUE, "PathMatchSpec: Spec13 failed\n");
487}
BOOL WINAPI PathMatchSpecA(const char *path, const char *mask)
Definition: path.c:2456
Definition: fci.c:127

Referenced by START_TEST().

◆ test_PathRemoveBlanks()

static void test_PathRemoveBlanks ( void  )
static

Definition at line 1726 of file path.c.

1727{
1728 struct remove_blanks_test {
1729 const char* input;
1730 const char* expected;
1731 };
1732 struct remove_blanks_test tests[] = {
1733 {"", ""},
1734 {" ", ""},
1735 {"test", "test"},
1736 {" test", "test"},
1737 {" test", "test"},
1738 {"test ", "test"},
1739 {"test ", "test"},
1740 {" test ", "test"},
1741 {" test ", "test"}};
1742 char pathA[MAX_PATH];
1743 WCHAR pathW[MAX_PATH];
1744 int i, ret;
1745 const UINT CP_ASCII = 20127;
1746
1749
1750 for (i=0; i < ARRAY_SIZE(tests); i++)
1751 {
1754 ok(strcmp(pathA, tests[i].expected) == 0, "input string '%s', expected '%s', got '%s'\n",
1756
1758 ok(ret != 0, "MultiByteToWideChar failed for '%s'\n", tests[i].input);
1759
1760 PathRemoveBlanksW(pathW);
1761
1762 ret = WideCharToMultiByte(CP_ASCII, 0, pathW, -1, pathA, MAX_PATH, NULL, NULL);
1763 ok(ret != 0, "WideCharToMultiByte failed for %s from test string '%s'\n", wine_dbgstr_w(pathW), tests[i].input);
1764
1765 ok(strcmp(pathA, tests[i].expected) == 0, "input string '%s', expected '%s', got '%s'\n",
1767 }
1768}
void WINAPI PathRemoveBlanksW(WCHAR *path)
Definition: path.c:1910
void WINAPI PathRemoveBlanksA(char *path)
Definition: path.c:1886
GLenum GLenum GLenum input
Definition: glext.h:9031
GLuint pathA
Definition: glext.h:11719
#define MB_ERR_INVALID_CHARS
Definition: unicode.h:41
static struct test_info tests[]
BOOL expected
Definition: store.c:2000
unsigned int UINT
Definition: ndis.h:50

Referenced by START_TEST().

◆ test_PathSearchAndQualify()

static void test_PathSearchAndQualify ( void  )
static

Definition at line 202 of file path.c.

203{
204 WCHAR path1[] = {'c',':','\\','f','o','o',0};
205 WCHAR expect1[] = {'c',':','\\','f','o','o',0};
206 WCHAR path2[] = {'c',':','f','o','o',0};
207 WCHAR c_drive[] = {'c',':',0};
208 WCHAR foo[] = {'f','o','o',0};
209 WCHAR path3[] = {'\\','f','o','o',0};
210 WCHAR winini[] = {'w','i','n','.','i','n','i',0};
212 WCHAR cur_dir[MAX_PATH];
213 WCHAR dot[] = {'.',0};
214
215 /* c:\foo */
217 "PathSearchAndQualify rets 0\n");
218 ok(!lstrcmpiW(out, expect1), "strings don't match\n");
219
220 /* c:foo */
222 "PathSearchAndQualify rets 0\n");
223 GetFullPathNameW(c_drive, MAX_PATH, cur_dir, NULL);
224 PathAddBackslashW(cur_dir);
225 lstrcatW(cur_dir, foo);
226 ok(!lstrcmpiW(out, cur_dir), "strings don't match\n");
227
228 /* foo */
230 "PathSearchAndQualify rets 0\n");
231 GetFullPathNameW(dot, MAX_PATH, cur_dir, NULL);
232 PathAddBackslashW(cur_dir);
233 lstrcatW(cur_dir, foo);
234 ok(!lstrcmpiW(out, cur_dir), "strings don't match\n");
235
236 /* \foo */
238 "PathSearchAndQualify rets 0\n");
239 GetFullPathNameW(dot, MAX_PATH, cur_dir, NULL);
240 lstrcpyW(cur_dir + 2, path3);
241 ok(!lstrcmpiW(out, cur_dir), "strings don't match\n");
242
243 /* win.ini */
244 ok(PathSearchAndQualifyW(winini, out, MAX_PATH) != 0,
245 "PathSearchAndQualify rets 0\n");
246 if(!SearchPathW(NULL, winini, NULL, MAX_PATH, cur_dir, NULL))
247 GetFullPathNameW(winini, MAX_PATH, cur_dir, NULL);
248 ok(!lstrcmpiW(out, cur_dir), "strings don't match\n");
249
250}
#define lstrcpyW
Definition: compat.h:749
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
BOOL WINAPI PathSearchAndQualifyW(const WCHAR *path, WCHAR *buffer, UINT length)
Definition: path.c:2348
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static const WCHAR path3[]
Definition: misc.c:320
#define PathAddBackslashW
Definition: pathcch.h:302

Referenced by START_TEST().

◆ test_PathStripPathA()

static void test_PathStripPathA ( void  )
static

Definition at line 1673 of file path.c.

1674{
1675 const char const_path[] = "test";
1676 char path[] = "short//path\\file.txt";
1677
1679 ok(!strcmp(path, "file.txt"), "path = %s\n", path);
1680
1681 /* following test should not crash */
1682 /* LavView 2013 depends on that behaviour */
1683 PathStripPathA((char*)const_path);
1684}
void WINAPI PathStripPathA(char *path)
Definition: path.c:2316

Referenced by START_TEST().

◆ test_PathUndecorate()

static void test_PathUndecorate ( void  )
static

Definition at line 1686 of file path.c.

1687{
1688 static const struct {
1689 const WCHAR *path;
1690 const WCHAR *expect;
1691 } tests[] = {
1692 { L"c:\\test\\a[123]", L"c:\\test\\a" },
1693 { L"c:\\test\\a[123].txt", L"c:\\test\\a.txt" },
1694 { L"c:\\test\\a.txt[123]", L"c:\\test\\a.txt[123]" },
1695 { L"c:\\test\\a[123a].txt", L"c:\\test\\a[123a].txt" },
1696 { L"c:\\test\\a[a123].txt", L"c:\\test\\a[a123].txt" },
1697 { L"c:\\test\\a[12\x0660].txt", L"c:\\test\\a[12\x0660].txt" },
1698 { L"c:\\test\\a[12]file", L"c:\\test\\a[12]file" },
1699 { L"c:\\test[123]\\a", L"c:\\test[123]\\a" },
1700 { L"c:\\test\\[123]", L"c:\\test\\[123]" },
1701 { L"a[123]", L"a" },
1702 { L"a[]", L"a" },
1703 { L"[123]", L"[123]" }
1704 };
1705 char bufa[MAX_PATH], expect[MAX_PATH];
1707 unsigned i;
1708
1709 for (i = 0; i < ARRAY_SIZE(tests); i++)
1710 {
1711 wcscpy(buf, tests[i].path);
1713 ok(!wcscmp(buf, tests[i].expect), "PathUndecorateW returned %s, expected %s\n",
1715
1718 PathUndecorateA(bufa);
1719 ok(!strcmp(bufa, expect), "PathUndecorateA returned %s, expected %s\n", bufa, expect);
1720 }
1721
1724}
wcscpy
void WINAPI PathUndecorateW(LPWSTR pszPath)
Definition: path.c:4094
void WINAPI PathUndecorateA(LPSTR pszPath)
Definition: path.c:4070
#define L(x)
Definition: resources.c:13
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by START_TEST().

◆ test_PathUnExpandEnvStrings()

static void test_PathUnExpandEnvStrings ( void  )
static

Definition at line 1472 of file path.c.

1473{
1474 static const WCHAR sysrootW[] = {'%','S','y','s','t','e','m','R','o','o','t','%',0};
1475 static const WCHAR sysdriveW[] = {'%','S','y','s','t','e','m','D','r','i','v','e','%',0};
1476 static const WCHAR nonpathW[] = {'p','a','t','h',0};
1477 static const WCHAR computernameW[] = {'C','O','M','P','U','T','E','R','N','A','M','E',0};
1478 static const char sysrootA[] = "%SystemRoot%";
1479 static const char sysdriveA[] = "%SystemDrive%";
1480 WCHAR pathW[MAX_PATH], buffW[MAX_PATH], sysdrvW[3], envvarW[30];
1481 char path[MAX_PATH], buff[MAX_PATH], sysdrvA[3], envvarA[30];
1482 BOOL ret;
1483 UINT len;
1484
1485 if (!pPathUnExpandEnvStringsA || !pPathUnExpandEnvStringsW)
1486 {
1487 win_skip("PathUnExpandEnvStrings not available\n");
1488 return;
1489 }
1490
1491 /* The value of ComputerName is not a path */
1492 ret = GetEnvironmentVariableA("COMPUTERNAME", envvarA, sizeof(envvarA));
1493 ok(ret, "got %d\n", ret);
1494 SetLastError(0xdeadbeef);
1495 ret = pPathUnExpandEnvStringsA(envvarA, buff, sizeof(buff));
1496 ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
1497
1498 ret = GetEnvironmentVariableW(computernameW, envvarW, ARRAY_SIZE(envvarW));
1499 ok(ret, "got %d\n", ret);
1500 SetLastError(0xdeadbeef);
1501 ret = pPathUnExpandEnvStringsW(envvarW, buffW, ARRAY_SIZE(buffW));
1502 ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
1503
1504 /* something that can't be represented with env var */
1505 strcpy(path, "somepath_name");
1506 strcpy(buff, "xx");
1507 SetLastError(0xdeadbeef);
1508 ret = pPathUnExpandEnvStringsA(path, buff, sizeof(buff));
1509 ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
1510 ok(buff[0] == 'x', "wrong return string %s\n", buff);
1511
1513 ok(len > 0, "failed to get sysdir\n");
1514
1515 sysdrvA[0] = path[0];
1516 strcpy(&sysdrvA[1], ":");
1517
1518 /* buffer size is not enough */
1519 strcpy(buff, "xx");
1520 SetLastError(0xdeadbeef);
1521 ret = pPathUnExpandEnvStringsA(path, buff, 5);
1522 ok(!ret && GetLastError() == 0xdeadbeef, "got %d\n", ret);
1523 ok(buff[0] == 'x', "wrong return string %s\n", buff);
1524
1525 /* buffer size is enough to hold variable name only */
1526 strcpy(buff, "xx");
1527 SetLastError(0xdeadbeef);
1528 ret = pPathUnExpandEnvStringsA(path, buff, sizeof(sysrootA));
1529 ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
1530 ok(buff[0] == 'x', "wrong return string %s\n", buff);
1531
1532 /* enough size */
1533 buff[0] = 0;
1534 ret = pPathUnExpandEnvStringsA(path, buff, sizeof(buff));
1535 ok(ret, "got %d\n", ret);
1536 ok(!strncmp(buff, sysrootA, sizeof(sysrootA)-1), "wrong return string %s\n", buff);
1537
1538 /* expanded value occurs multiple times */
1539 /* for drive C: it unexpands it like 'C:C:' -> '%SystemDrive%C:' */
1540 buff[0] = 0;
1541 strcpy(path, sysdrvA);
1542 strcat(path, sysdrvA);
1543 ret = pPathUnExpandEnvStringsA(path, buff, sizeof(buff));
1544 ok(ret, "got %d\n", ret);
1545 /* expected string */
1546 strcpy(path, sysdriveA);
1547 strcat(path, sysdrvA);
1548 ok(!strcmp(buff, path), "wrong unexpanded string %s, expected %s\n", buff, path);
1549
1550 /* now with altered variable */
1551 ret = GetEnvironmentVariableA("SystemDrive", envvarA, sizeof(envvarA));
1552 ok(ret, "got %d\n", ret);
1553
1554 ret = SetEnvironmentVariableA("SystemDrive", "WW");
1555 ok(ret, "got %d\n", ret);
1556
1557 /* variables are not cached */
1558 strcpy(path, sysdrvA);
1559 strcat(path, sysdrvA);
1560 SetLastError(0xdeadbeef);
1561 ret = pPathUnExpandEnvStringsA(path, buff, sizeof(buff));
1562 ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
1563
1564 ret = SetEnvironmentVariableA("SystemDrive", envvarA);
1565 ok(ret, "got %d\n", ret);
1566
1567 /* PathUnExpandEnvStringsW */
1568
1569 /* something that can't be represented with env var */
1570 lstrcpyW(pathW, nonpathW);
1571 buffW[0] = 'x'; buffW[1] = 0;
1572 SetLastError(0xdeadbeef);
1573 ret = pPathUnExpandEnvStringsW(pathW, buffW, ARRAY_SIZE(buffW));
1574 ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
1575 ok(buffW[0] == 'x', "wrong return string %s\n", wine_dbgstr_w(buffW));
1576
1578 ok(len > 0, "failed to get sysdir\n");
1579
1580 sysdrvW[0] = pathW[0];
1581 sysdrvW[1] = ':';
1582 sysdrvW[2] = 0;
1583
1584 /* buffer size is not enough */
1585 buffW[0] = 'x'; buffW[1] = 0;
1586 SetLastError(0xdeadbeef);
1587 ret = pPathUnExpandEnvStringsW(pathW, buffW, 5);
1588 ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
1589 ok(buffW[0] == 'x', "wrong return string %s\n", wine_dbgstr_w(buffW));
1590
1591 /* buffer size is enough to hold variable name only */
1592 buffW[0] = 'x'; buffW[1] = 0;
1593 SetLastError(0xdeadbeef);
1594 ret = pPathUnExpandEnvStringsW(pathW, buffW, ARRAY_SIZE(sysrootW));
1595 ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
1596 ok(buffW[0] == 'x', "wrong return string %s\n", wine_dbgstr_w(buffW));
1597
1598 /* enough size */
1599 buffW[0] = 0;
1600 ret = pPathUnExpandEnvStringsW(pathW, buffW, ARRAY_SIZE(buffW));
1601 ok(ret, "got %d\n", ret);
1602 ok(!memcmp(buffW, sysrootW, sizeof(sysrootW) - sizeof(WCHAR)), "wrong return string %s\n", wine_dbgstr_w(buffW));
1603
1604 /* expanded value occurs multiple times */
1605 /* for drive C: it unexpands it like 'C:C:' -> '%SystemDrive%C:' */
1606 buffW[0] = 0;
1607 lstrcpyW(pathW, sysdrvW);
1608 lstrcatW(pathW, sysdrvW);
1609 ret = pPathUnExpandEnvStringsW(pathW, buffW, ARRAY_SIZE(buffW));
1610 ok(ret, "got %d\n", ret);
1611 /* expected string */
1612 lstrcpyW(pathW, sysdriveW);
1613 lstrcatW(pathW, sysdrvW);
1614 ok(!lstrcmpW(buffW, pathW), "wrong unexpanded string %s, expected %s\n", wine_dbgstr_w(buffW), wine_dbgstr_w(pathW));
1615}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:754
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
strcat
Definition: string.h:92

Referenced by START_TEST().

◆ test_PathUnquoteSpaces()

static void test_PathUnquoteSpaces ( void  )
static

Definition at line 1414 of file path.c.

1415{
1416 int i;
1417 for (i = 0; i < ARRAY_SIZE(TEST_PATH_UNQUOTE_SPACES); i++)
1418 {
1422
1424 ok(!strcmp(path, TEST_PATH_UNQUOTE_SPACES[i].result), "%s (A): got %s expected %s\n",
1427
1428 PathUnquoteSpacesW(pathW);
1429 ok(!lstrcmpW(pathW, resultW), "%s (W): strings differ\n",
1431 free(pathW);
1432 free(resultW);
1433 free(path);
1434 }
1435}
void WINAPI PathUnquoteSpacesW(WCHAR *path)
Definition: path.c:2006
void WINAPI PathUnquoteSpacesA(char *path)
Definition: path.c:1988
GLuint64EXT * result
Definition: glext.h:11304
static const struct @1838 TEST_PATH_UNQUOTE_SPACES[]
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)

Referenced by START_TEST().

Variable Documentation

◆ DWORD

Definition at line 30 of file path.c.

◆ expect

BOOL expect

Definition at line 135 of file path.c.

◆ LPCSTR

Definition at line 36 of file path.c.

◆ LPCWSTR

Definition at line 32 of file path.c.

◆ LPDWORD

Definition at line 33 of file path.c.

◆ LPSTR

Definition at line 33 of file path.c.

◆ LPWSTR

Definition at line 34 of file path.c.

◆ path

Definition at line 46 of file path.c.

◆ result

Definition at line 169 of file path.c.

◆ ret

DWORD ret

Definition at line 47 of file path.c.

◆ SHELL_charclass

const DWORD SHELL_charclass[]
static

Definition at line 347 of file path.c.

◆ 

const struct { ... } test_path_is_relative[]
Initial value:
= {
{NULL, TRUE},
{"\0", TRUE},
{"test.txt", TRUE},
{"\\\\folder\\test.txt", FALSE},
{"file://folder/test.txt", TRUE},
{"C:\\test.txt", FALSE},
{"file:///C:/test.txt", TRUE}
}

Referenced by test_PathIsRelativeA(), and test_PathIsRelativeW().

◆ 

struct { ... } TEST_PATH_IS_URL[]
Initial value:
= {
{"http://foo/bar", TRUE},
{"c:\\foo\\bar", FALSE},
{"c:/foo/bar", FALSE},
{"foo://foo/bar", TRUE},
{"foo\\bar", FALSE},
{"foo.bar", FALSE},
{"bogusscheme:", TRUE},
{"http:partial", TRUE},
{"www.winehq.org", FALSE},
{"winehq.org", FALSE},
{"ftp.winehq.org", FALSE},
{"http://winehq.org", TRUE},
{"http://www.winehq.org", TRUE},
{"https://winehq.org", TRUE},
{"https://www.winehq.org", TRUE},
{"ftp://winehq.org", TRUE},
{"ftp://ftp.winehq.org", TRUE},
{"file://does_not_exist.txt", TRUE},
{"about:blank", TRUE},
{"about:home", TRUE},
{"about:mozilla", TRUE},
{"HTTP://www.winehq.org", TRUE},
{" http://www.winehq.org", FALSE},
{"", FALSE},
}

Referenced by test_PathIsUrl().

◆ 

const struct { ... } TEST_PATH_UNQUOTE_SPACES[]
Initial value:
= {
{ "abcdef", "abcdef" },
{ "\"abcdef\"", "abcdef" },
{ "\"abcdef", "\"abcdef" },
{ "abcdef\"", "abcdef\"" },
{ "\"\"abcdef\"\"", "\"abcdef\"" },
{ "abc\"def", "abc\"def" },
{ "\"abc\"def", "\"abc\"def" },
{ "\"abc\"def\"", "abc\"def" },
{ "\'abcdef\'", "\'abcdef\'" },
{ "\"\"", "" },
{ "\"", "" }
}

Referenced by test_PathUnquoteSpaces().

◆ 

const struct { ... } TEST_PATHFROMURL[]

Referenced by test_PathCreateFromUrl().

◆ todo

DWORD todo

Definition at line 47 of file path.c.

Referenced by test_IWbemPath_SetText(), and test_PathCreateFromUrl().

◆ UINT

Definition at line 37 of file path.c.

◆ url

const char* url

Definition at line 45 of file path.c.