36static int (
__cdecl *p_makepath_s)(
char *,
size_t,
const char *,
const char *,
const char *,
const char *);
37static int (
__cdecl *p_wmakepath_s)(
wchar_t *,
size_t,
const wchar_t *,
const wchar_t *,
const wchar_t *,
const wchar_t *);
39static int (
__cdecl *p_wsearchenv_s)(
const wchar_t*,
const wchar_t*,
wchar_t*,
size_t);
61#define USE_BUFF ((char*)~0ul)
81 {
"foo",
NULL,
USE_BUFF,
"file",
"ext",
"foo\\file.ext" },
84 {
NULL,
"c",
"dir",
"file",
"ext",
"c:dir\\file.ext" },
85 {
NULL,
"c:",
"dir",
"file",
"ext",
"c:dir\\file.ext" },
86 {
NULL,
"c:\\",
"dir",
"file",
"ext",
"c:dir\\file.ext" }
157 {
NULL, 1,
"c:",
"d\\",
"file",
"ext",
"\0XXXXXXXXXXXX",
L"\0XXXXXXXXXXXX", 13},
158 {
NULL, 2,
"c:",
"d\\",
"file",
"ext",
"\0XXXXXXXXXXXX",
L"\0XXXXXXXXXXXX", 13},
159 {
NULL, 3,
"c:",
"d\\",
"file",
"ext",
"\0:XXXXXXXXXXX",
L"\0:XXXXXXXXXXX", 13},
160 {
NULL, 4,
"c:",
"d\\",
"file",
"ext",
"\0:dXXXXXXXXXX",
L"\0:dXXXXXXXXXX", 13},
161 {
NULL, 5,
"c:",
"d\\",
"file",
"ext",
"\0:d\\XXXXXXXXX",
L"\0:d\\XXXXXXXXX", 13},
162 {
NULL, 6,
"c:",
"d\\",
"file",
"ext",
"\0:d\\fXXXXXXXX",
L"\0:d\\fXXXXXXXX", 13},
163 {
NULL, 7,
"c:",
"d\\",
"file",
"ext",
"\0:d\\fiXXXXXXX",
L"\0:d\\fiXXXXXXX", 13},
164 {
NULL, 8,
"c:",
"d\\",
"file",
"ext",
"\0:d\\filXXXXXX",
L"\0:d\\filXXXXXX", 13},
165 {
NULL, 9,
"c:",
"d\\",
"file",
"ext",
"\0:d\\fileXXXXX",
L"\0:d\\fileXXXXX", 13},
166 {
NULL, 10,
"c:",
"d\\",
"file",
"ext",
"\0:d\\file.XXXX",
L"\0:d\\file.XXXX", 13},
167 {
NULL, 11,
"c:",
"d\\",
"file",
"ext",
"\0:d\\file.eXXX",
L"\0:d\\file.eXXX", 13},
168 {
NULL, 12,
"c:",
"d\\",
"file",
"ext",
"\0:d\\file.exXX",
L"\0:d\\file.exXX", 13},
170 {
NULL, 3,
"c:",
"dir",
"f",
"ext",
"\0:XXXXXXXX",
L"\0:XXXXXXXX", 10},
171 {
NULL, 4,
"c:",
"dir",
"f",
"ext",
"\0:dXXXXXXX",
L"\0:dXXXXXXX", 10},
172 {
NULL, 5,
"c:",
"dir",
"f",
"ext",
"\0:diXXXXXX",
L"\0:diXXXXXX", 10},
173 {
NULL, 6,
"c:",
"dir",
"f",
"ext",
"\0:dirXXXXX",
L"\0:dirXXXXX", 10},
174 {
NULL, 7,
"c:",
"dir",
"f",
"ext",
"\0:dir\\XXXX",
L"\0:dir\\XXXX", 10},
181 {
"foo", 4,
NULL,
USE_BUFF,
"file",
"ext",
"\0oo\0XXXXXXXXX",
L"\0oo\0XXXXXXXXX", 13},
182 {
"foo", 8,
NULL,
USE_BUFF,
"file",
"ext",
"\0oo\\filXXXXXX",
L"\0oo\\filXXXXXX", 13},
183 {
"foo", 12,
NULL,
USE_BUFF,
"file",
"ext",
"\0oo\\file.exXX",
L"\0oo\\file.exXX", 13},
199 if (!p_makepath_s || !p_wmakepath_s)
201 win_skip(
"Safe makepath functions are not available\n");
207 ok(
ret ==
EINVAL,
"Expected _makepath_s to return EINVAL, got %d\n",
ret);
212 ok(
ret ==
EINVAL,
"Expected _makepath_s to return EINVAL, got %d\n",
ret);
217 ok(
ret ==
EINVAL,
"Expected _wmakepath_s to return EINVAL, got %d\n",
ret);
222 ok(
ret ==
EINVAL,
"Expected _wmakepath_s to return EINVAL, got %d\n",
ret);
240 ok(
ret == 0,
"[%d] Expected _makepath_s to return 0, got %d\n",
i,
ret);
261 ok(
ret == 0,
"[%d] Expected _wmakepath_s to return 0, got %d\n",
i,
ret);
284 ok(
ret ==
ERANGE,
"[%d] Expected _makepath_s to return ERANGE, got %d\n",
i,
ret);
286 ok(!
memcmp(
p->expected,
buffer,
p->expected_length),
"unexpected output for case %d\n",
i);
300 ret = p_wmakepath_s(bufferW,
p->length,
305 ok(
ret ==
ERANGE,
"[%d] Expected _wmakepath_s to return ERANGE, got %d\n",
i,
ret);
308 ok(!
memcmp(
p->expected_unicode, bufferW,
p->expected_length *
sizeof(
WCHAR)),
"unexpected output for case %d\n",
i);
327 strcat(level1,
"msvcrt-test\\");
334 strcat(level2,
"nextlevel\\");
341 strcpy(teststring,level2);
342 strcat(teststring,
"test");
343 ok(
strcmp(full,teststring)==0,
"Invalid Path returned %s\n",full);
345 memcpy(teststring,level2,3);
347 strcat(teststring,
"test");
348 ok(
strcmp(full,teststring)==0,
"Invalid Path returned %s\n",full);
350 strcpy(teststring,level1);
351 strcat(teststring,
"test");
352 ok(
strcmp(full,teststring)==0,
"Invalid Path returned %s\n",full);
353 ok(
_fullpath(full,
"..\\test", 10)==
NULL,
"_fullpath failed to generate error\n");
356 ok(freeme!=
NULL,
"No path returned\n");
357 strcpy(teststring,level2);
358 strcat(teststring,
"test");
359 ok(
strcmp(freeme,teststring)==0,
"Invalid Path returned %s\n",freeme);
371 const char*
path =
"c:\\\x83\x5c\x83\x74\x83\x67.bin";
380 ok(!
strcmp(fname,
"\x83\x74\x83\x67"),
"got %s\n", fname);
388 ok(!
strcmp(fname,
"\x83\x5c\x83\x74\x83\x67"),
"got %s\n", fname);
396 const char *dirs[] = {
398 "\\search_env_test\\dir1",
399 "\\search_env_test\\dir2",
400 "\\search_env_test\\dir3longer"
403 const char *files[] = {
404 "\\search_env_test\\dir1\\1.dat",
405 "\\search_env_test\\dir1\\2.dat",
406 "\\search_env_test\\dir2\\1.dat",
407 "\\search_env_test\\dir2\\3.dat",
408 "\\search_env_test\\dir3longer\\3.dat"
417 if (
getenv(
"TEST_PATH")) {
418 skip(
"TEST_PATH environment variable already set\n");
434 ok(tmp_file !=
NULL,
"fopen failed (file = %s)\n",
path);
438 strcpy(env1,
"TEST_PATH=");
439 strcpy(env2,
"TEST_PATH=;");
450 if (!p_searchenv_s || !p_wsearchenv_s)
451 win_skip(
"searchenv_s or wsearchenv_s function is not available\n");
461 ok(
i ==
ENOENT,
"searchenv_s returned %d\n",
i);
474 ok(!
i,
"searchenv_s returned %d\n",
i);
478 memset(result_w,
'x',
sizeof(result_w));
483 if (p_wsearchenv_s) {
484 memset(result_w,
'x',
sizeof(result_w));
485 i = p_wsearchenv_s(
L"1.dat",
L"TEST_PATH", result_w,
MAX_PATH);
486 ok(!
i,
"wsearchenv_s returned %d\n",
i);
499 ok(!
i,
"searchenv_s returned %d\n",
i);
503 memset(result_w,
'x',
sizeof(result_w));
508 if (p_wsearchenv_s) {
509 memset(result_w,
'x',
sizeof(result_w));
510 i = p_wsearchenv_s(
L"3.dat",
L"TEST_PATH", result_w,
MAX_PATH);
511 ok(!
i,
"wsearchenv_s returned %d\n",
i);
525 ok(!
i,
"searchenv_s returned %d\n",
i);
529 memset(result_w,
'x',
sizeof(result_w));
534 if (p_wsearchenv_s) {
535 memset(result_w,
'x',
sizeof(result_w));
536 i = p_wsearchenv_s(
L"1.dat",
L"TEST_PATH", result_w,
MAX_PATH);
537 ok(!
i,
"wsearchenv_s returned %d\n",
i);
550 ok(!
i,
"searchenv_s returned %d\n",
i);
554 memset(result_w,
'x',
sizeof(result_w));
559 if (p_wsearchenv_s) {
560 memset(result_w,
'x',
sizeof(result_w));
561 i = p_wsearchenv_s(
L"3.dat",
L"TEST_PATH", result_w,
MAX_PATH);
562 ok(!
i,
"wsearchenv_s returned %d\n",
i);
566 strcpy(env1,
"TEST_PATH=");
568 strcat(env1,
"\"\\search_env_test\\\"d\"i\"r\"1");
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
_CRTIMP int __cdecl _getmbcp(void)
#define GetProcAddress(x, y)
#define WideCharToMultiByte
#define MultiByteToWideChar
static const WCHAR *const ext[]
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
static const WCHAR fileW[]
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
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
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl putenv(_In_z_ const char *_EnvString)
_CRTIMP void __cdecl _wsearchenv(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_EnvVar, _Pre_notnull_ _Post_z_ wchar_t *_ResultPath)
_Check_return_ _CRTIMP char *__cdecl _fullpath(_Out_writes_opt_z_(_SizeInBytes) char *_FullPath, _In_z_ const char *_Path, _In_ size_t _SizeInBytes)
_CRTIMP void __cdecl _splitpath(_In_z_ const char *_FullPath, _Pre_maybenull_ _Post_z_ char *_Drive, _Pre_maybenull_ _Post_z_ char *_Dir, _Pre_maybenull_ _Post_z_ char *_Filename, _Pre_maybenull_ _Post_z_ char *_Ext)
_CRTIMP void __cdecl _wmakepath(_Pre_notnull_ _Post_z_ wchar_t *_ResultPath, _In_opt_z_ const wchar_t *_Drive, _In_opt_z_ const wchar_t *_Dir, _In_opt_z_ const wchar_t *_Filename, _In_opt_z_ const wchar_t *_Ext)
_CRTIMP void __cdecl _searchenv(_In_z_ const char *_Filename, _In_z_ const char *_EnvVar, _Pre_notnull_ _Post_z_ char *_ResultPath)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
#define memcpy(s1, s2, n)
#define ERROR_ALREADY_EXISTS
static PEXPLICIT_ACCESSW *static HMODULE hmod
static void test_fullpath(void)
static void test_makepath(void)
static const makepath_case makepath_cases[]
static const makepath_s_case makepath_s_cases[]
static void test_searchenv(void)
static void test_splitpath(void)
static void test_makepath_s(void)
int __cdecl _setmbcp(int)
const WCHAR * expected_unicode
DWORD WINAPI GetLastError(void)