ReactOS 0.4.17-dev-116-ga4b6fe9
path.c File Reference
#include <stdarg.h>
#include "ntstatus.h"
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "winnls.h"
#include "ddk/ntddk.h"
#include "wine/test.h"
Include dependency graph for path.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 

Functions

static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)(LPWSTR dst
 
static UINT (WINAPI *pRtlDetermineDosPathNameType_U)(PCWSTR path)
 
static ULONG (WINAPI *pRtlIsDosDeviceName_U)(PCWSTR dos_name)
 
static BOOLEAN (WINAPI *pRtlIsNameLegalDOS8Dot3)(const UNICODE_STRING *
 
static DWORD (WINAPI *pRtlGetFullPathName_U)(const WCHAR *
 
static void test_RtlDetermineDosPathNameType_U (void)
 
static void test_RtlIsDosDeviceName_U (void)
 
static void test_RtlIsNameLegalDOS8Dot3 (void)
 
static void test_RtlGetFullPathName_U (void)
 
static void test_RtlDosPathNameToNtPathName_U (void)
 
static void test_nt_names (void)
 
 START_TEST (path)
 

Variables

static DWORD dstlen
 
static DWORD LPDWORD reslen
 
static DWORD LPDWORD LPCSTR src
 
static DWORD LPDWORD LPCSTR DWORD srclen
 
static DWORD
 
static LPDWORD
 
static LPCWSTR
 
static const STRING BOOLEAN
 
static POEM_STRING
 
static PBOOLEAN
 
static ULONG
 
static WCHAR WCHAR **static UNICODE_STRING WCHAR CURDIR *static UNICODE_STRING WCHAR CURDIR *static ACCESS_MASK
 

Macro Definition Documentation

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 24 of file path.c.

Function Documentation

◆ BOOLEAN()

static BOOLEAN ( WINAPI pRtlIsNameLegalDOS8Dot3) const
static

◆ DWORD()

static DWORD ( WINAPI pRtlGetFullPathName_U) const
static

◆ NTSTATUS()

static NTSTATUS ( WINAPI pRtlMultiByteToUnicodeN)
static

◆ START_TEST()

START_TEST ( path  )

Definition at line 768 of file path.c.

769{
770 HMODULE mod = GetModuleHandleA("ntdll.dll");
771
772 pRtlMultiByteToUnicodeN = (void *)GetProcAddress(mod,"RtlMultiByteToUnicodeN");
773 pRtlUnicodeToMultiByteN = (void *)GetProcAddress(mod,"RtlUnicodeToMultiByteN");
774 pRtlDetermineDosPathNameType_U = (void *)GetProcAddress(mod,"RtlDetermineDosPathNameType_U");
775 pRtlIsDosDeviceName_U = (void *)GetProcAddress(mod,"RtlIsDosDeviceName_U");
776 pRtlOemStringToUnicodeString = (void *)GetProcAddress(mod,"RtlOemStringToUnicodeString");
777 pRtlIsNameLegalDOS8Dot3 = (void *)GetProcAddress(mod,"RtlIsNameLegalDOS8Dot3");
778 pRtlGetFullPathName_U = (void *)GetProcAddress(mod,"RtlGetFullPathName_U");
779 pRtlDosPathNameToNtPathName_U = (void *)GetProcAddress(mod, "RtlDosPathNameToNtPathName_U");
780 pRtlDosPathNameToNtPathName_U_WithStatus = (void *)GetProcAddress(mod, "RtlDosPathNameToNtPathName_U_WithStatus");
781 pNtOpenFile = (void *)GetProcAddress(mod, "NtOpenFile");
782
789}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:68
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static void test_RtlGetFullPathName_U(void)
Definition: path.c:278
static void test_RtlIsNameLegalDOS8Dot3(void)
Definition: path.c:202
static void test_RtlDosPathNameToNtPathName_U(void)
Definition: path.c:435
static void test_RtlIsDosDeviceName_U(void)
Definition: path.c:116
static void test_nt_names(void)
Definition: path.c:666
static void test_RtlDetermineDosPathNameType_U(void)
Definition: path.c:44

◆ test_nt_names()

static void test_nt_names ( void  )
static

Definition at line 666 of file path.c.

667{
668 static const struct { const WCHAR *root, *name; NTSTATUS expect, broken; } tests[] =
669 {
670 { NULL, L"\\??\\C:\\windows\\system32\\kernel32.dll", STATUS_SUCCESS },
671 { NULL, L"\\??\\C:\\\\windows\\system32\\kernel32.dll", STATUS_SUCCESS, STATUS_OBJECT_NAME_INVALID },
672 { NULL, L"\\??\\C:\\windows\\system32\\", STATUS_FILE_IS_A_DIRECTORY },
673 { NULL, L"\\??\\C:\\\\\\windows\\system32\\kernel32.dll", STATUS_OBJECT_NAME_INVALID },
674 { NULL, L"\\??\\C:\\windows\\\\system32\\kernel32.dll", STATUS_OBJECT_NAME_INVALID },
675 { NULL, L"\\??\\C:\\windows\\system32\\.\\kernel32.dll", STATUS_OBJECT_NAME_INVALID, STATUS_OBJECT_PATH_NOT_FOUND },
676 { NULL, L"\\??\\C:\\windows\\system32\\..\\system32\\kernel32.dll", STATUS_OBJECT_NAME_INVALID },
677 { NULL, L"\\??\\C:\\.\\windows\\system32\\kernel32.dll", STATUS_OBJECT_NAME_INVALID, STATUS_OBJECT_PATH_NOT_FOUND },
678 { NULL, L"\\??\\C:\\windows\\system32\\kernel32.dll ", STATUS_OBJECT_NAME_NOT_FOUND },
679 { NULL, L"\\??\\C:\\windows\\system32\\kernel32.dll..", STATUS_OBJECT_NAME_NOT_FOUND },
680 { NULL, L"\\??\\C:\\windows \\system32 \\kernel32.dll", STATUS_OBJECT_PATH_NOT_FOUND },
681 { NULL, L"\\??\\C:\\windows.\\system32.\\kernel32.dll", STATUS_OBJECT_PATH_NOT_FOUND },
682 { NULL, L"\\??\\C:\\windows/system32/kernel32.dll", STATUS_OBJECT_NAME_INVALID },
683 { NULL, L"\\??\\C:\\windows\\system32\\kernel32.dll*", STATUS_OBJECT_NAME_INVALID },
684 { NULL, L"\\??\\C:\\windows\\system32?\\kernel32.dll", STATUS_OBJECT_NAME_INVALID },
685 { NULL, L"C:\\windows\\system32?\\kernel32.dll", STATUS_OBJECT_PATH_SYNTAX_BAD },
686 { NULL, L"/??\\C:\\windows\\system32\\kernel32.dll", STATUS_OBJECT_PATH_SYNTAX_BAD },
687 { NULL, L"\\??" L"/C:\\windows\\system32\\kernel32.dll", STATUS_OBJECT_PATH_NOT_FOUND },
688 { NULL, L"\\??\\C:/windows\\system32\\kernel32.dll", STATUS_OBJECT_PATH_NOT_FOUND },
689 { NULL, L"\\??\\C:\\windows\\system32\\", STATUS_FILE_IS_A_DIRECTORY },
690 { NULL, L"\\??\\C:\\windows\\SyStEm32\\", STATUS_FILE_IS_A_DIRECTORY },
691 { NULL, L"\\??\\C:\\windows\\system32\\\\", STATUS_OBJECT_NAME_INVALID },
692 { NULL, L"\\??\\C:\\windows\\system32\\foobar\\", STATUS_OBJECT_NAME_NOT_FOUND },
693 { NULL, L"\\??\\C:\\windows\\system32\\kernel32.dll\\", STATUS_OBJECT_NAME_INVALID },
694 { NULL, L"\\??\\C:\\windows\\system32\\kernel32.dll\\foo", STATUS_OBJECT_PATH_NOT_FOUND },
695 { NULL, L"\\??\\C:\\windows\\system32\\Kernel32.Dll\\", STATUS_OBJECT_NAME_INVALID },
696 { NULL, L"\\??\\C:\\windows\\system32\\Kernel32.Dll\\foo", STATUS_OBJECT_PATH_NOT_FOUND },
697 { NULL, L"\\??\\C:\\windows\\sys\001", STATUS_OBJECT_NAME_INVALID },
698 { L"\\??\\", NULL, STATUS_OBJECT_NAME_INVALID },
699 { L"\\??\\C:\\", NULL, STATUS_SUCCESS },
700 { L"\\??\\C:\\\\", NULL, STATUS_SUCCESS, STATUS_OBJECT_NAME_INVALID },
701 { L"/??\\C:\\", NULL, STATUS_OBJECT_PATH_SYNTAX_BAD },
702 { L"\\??\\C:/", NULL, STATUS_OBJECT_NAME_NOT_FOUND },
703 { L"\\??" L"/C:", NULL, STATUS_OBJECT_NAME_NOT_FOUND },
704 { L"\\??" L"/C:\\", NULL, STATUS_OBJECT_PATH_NOT_FOUND },
705 { L"\\??\\C:\\windows", NULL, STATUS_SUCCESS },
706 { L"\\??\\C:\\windows\\", NULL, STATUS_SUCCESS },
707 { L"\\??\\C:\\windows\\.", NULL, STATUS_OBJECT_NAME_INVALID },
708 { L"\\??\\C:\\windows\\.\\", NULL, STATUS_OBJECT_NAME_INVALID },
709 { L"\\??\\C:\\windows\\..", NULL, STATUS_OBJECT_NAME_INVALID },
710 { L"\\??\\C:\\windows\\..\\", NULL, STATUS_OBJECT_NAME_INVALID },
711 { L"\\??\\C:\\", L"windows\\system32\\kernel32.dll", STATUS_SUCCESS },
712 { L"\\??\\C:\\\\", L"windows\\system32\\kernel32.dll", STATUS_SUCCESS, STATUS_OBJECT_NAME_INVALID },
713 { L"\\??\\C:\\windows", L"system32\\kernel32.dll", STATUS_SUCCESS },
714 { L"\\??\\C:\\windows\\", L"system32\\kernel32.dll", STATUS_SUCCESS },
715 { L"\\??\\C:\\windows\\", L"system32\\", STATUS_FILE_IS_A_DIRECTORY },
716 { L"\\??\\C:\\windows\\", L"SyStEm32\\", STATUS_FILE_IS_A_DIRECTORY },
717 { L"\\??\\C:\\windows\\", L"system32\\\\", STATUS_OBJECT_NAME_INVALID },
718 { L"\\??\\C:\\windows\\", L"system32\\foobar\\", STATUS_OBJECT_NAME_NOT_FOUND },
719 { L"\\??\\C:\\windows\\", L"system32\\kernel32.dll\\", STATUS_OBJECT_NAME_INVALID },
720 { L"\\??\\C:\\windows\\", L"system32\\kernel32.dll\\foo", STATUS_OBJECT_PATH_NOT_FOUND },
721 { L"\\??\\C:\\windows\\", L"system32\\Kernel32.Dll\\", STATUS_OBJECT_NAME_INVALID },
722 { L"\\??\\C:\\windows\\", L"system32\\Kernel32.Dll\\foo", STATUS_OBJECT_PATH_NOT_FOUND },
723 { L"\\??\\C:\\windows\\", L"\\system32\\kernel32.dll", STATUS_INVALID_PARAMETER },
724 { L"\\??\\C:\\windows\\", L"/system32\\kernel32.dll", STATUS_OBJECT_NAME_INVALID },
725 { L"\\??\\C:\\windows\\", L".\\system32\\kernel32.dll", STATUS_OBJECT_NAME_INVALID, STATUS_OBJECT_PATH_NOT_FOUND },
726 { L"\\??\\C:\\windows\\", L"..\\windows\\system32\\kernel32.dll", STATUS_OBJECT_NAME_INVALID },
727 { L"\\??\\C:\\windows\\", L".", STATUS_OBJECT_NAME_INVALID },
728 { L"\\??\\C:\\windows\\", L"..", STATUS_OBJECT_NAME_INVALID },
729 { L"\\??\\C:\\windows\\", L"sys\001", STATUS_OBJECT_NAME_INVALID },
730 { L"C:\\", L"windows\\system32\\kernel32.dll", STATUS_OBJECT_PATH_SYNTAX_BAD },
731 };
732 unsigned int i;
738
740
741 for (i = 0; i < ARRAY_SIZE(tests); i++)
742 {
743 attr.RootDirectory = 0;
744 handle = 0;
746 if (tests[i].root)
747 {
749 status = pNtOpenFile( &attr.RootDirectory, SYNCHRONIZE | FILE_LIST_DIRECTORY, &attr, &io,
752 }
753 if (!status && tests[i].name)
754 {
758 }
759 if (attr.RootDirectory) NtClose( attr.RootDirectory );
760 if (handle) NtClose( handle );
762 "%u: got %lx / %lx for %s + %s\n", i, status, tests[i].expect,
764 }
765}
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR nameW[]
Definition: main.c:49
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define ARRAY_SIZE(A)
Definition: main.h:20
struct _root root
#define NULL
Definition: types.h:112
#define FILE_SHARE_READ
Definition: compat.h:136
#define L(x)
Definition: resources.c:13
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
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 debugstr_w
Definition: kernel32.h:32
static struct test_info tests[]
#define expect(expected, got)
Definition: path.c:34
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:72
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define FILE_GENERIC_READ
Definition: nt_native.h:653
#define STATUS_OBJECT_PATH_SYNTAX_BAD
Definition: ntstatus.h:389
short WCHAR
Definition: pedump.c:58
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: cookie.c:202
Definition: name.c:39
Definition: ps.c:97
#define STATUS_FILE_IS_A_DIRECTORY
Definition: udferr_usr.h:164
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149

Referenced by START_TEST().

◆ test_RtlDetermineDosPathNameType_U()

static void test_RtlDetermineDosPathNameType_U ( void  )
static

Definition at line 44 of file path.c.

45{
46 struct test
47 {
48 const char *path;
49 UINT ret;
50 };
51
52 static const struct test tests[] =
53 {
54 { "\\\\foo", 1 },
55 { "//foo", 1 },
56 { "\\/foo", 1 },
57 { "/\\foo", 1 },
58 { "\\\\", 1 },
59 { "//", 1 },
60 { "c:\\foo", 2 },
61 { "c:/foo", 2 },
62 { "c://foo", 2 },
63 { "c:\\", 2 },
64 { "c:/", 2 },
65 { "c:foo", 3 },
66 { "c:f\\oo", 3 },
67 { "c:foo/bar", 3 },
68 { "\\foo", 4 },
69 { "/foo", 4 },
70 { "\\", 4 },
71 { "/", 4 },
72 { "foo", 5 },
73 { "", 5 },
74 { "\0:foo", 5 },
75 { "\\\\.\\foo", 6 },
76 { "//./foo", 6 },
77 { "/\\./foo", 6 },
78 { "\\\\.foo", 1 },
79 { "//.foo", 1 },
80 { "\\\\.", 7 },
81 { "//.", 7 },
82 { "\\\\?\\foo", 6 },
83 { "//?/foo", 6 },
84 { "/\\?/foo", 6 },
85 { "\\\\?foo", 1 },
86 { "//?foo", 1 },
87 { "\\\\?", 7 },
88 { "//?", 7 },
89 { "CONIN$", 5 },
90 { "CONOUT$", 5 },
91 { "CONERR$", 5 },
92 { "\\\\.\\CONIN$", 6 },
93 { "\\\\.\\CONOUT$", 6 },
94 { NULL, 0 }
95 };
96
97 const struct test *test;
99 UINT ret;
100
101 if (!pRtlDetermineDosPathNameType_U)
102 {
103 win_skip("RtlDetermineDosPathNameType_U is not available\n");
104 return;
105 }
106
107 for (test = tests; test->path; test++)
108 {
109 pRtlMultiByteToUnicodeN( buffer, sizeof(buffer), NULL, test->path, strlen(test->path)+1 );
110 ret = pRtlDetermineDosPathNameType_U( buffer );
111 ok( ret == test->ret, "Wrong result %d/%d for %s\n", ret, test->ret, test->path );
112 }
113}
#define MAX_PATH
Definition: compat.h:34
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
return ret
Definition: mutex.c:146
GLuint buffer
Definition: glext.h:5915
#define win_skip
Definition: minitest.h:67
unsigned int UINT
Definition: ndis.h:50
#define test
Definition: rosglue.h:37

Referenced by START_TEST().

◆ test_RtlDosPathNameToNtPathName_U()

static void test_RtlDosPathNameToNtPathName_U ( void  )
static

Definition at line 435 of file path.c.

436{
437 char curdir[MAX_PATH];
439 WCHAR *file_part;
441 BOOL ret;
442 int i;
443
444 static const struct
445 {
446 const WCHAR *dos;
447 const WCHAR *nt;
448 int file_offset; /* offset to file part */
449 const WCHAR *alt_nt;
450 BOOL may_fail;
451 }
452 tests[] =
453 {
454 {L"c:\\", L"\\??\\c:\\", -1},
455 {L"c:\\test\\*.", L"\\??\\c:\\test\\*", 12},
456 {L"c:/", L"\\??\\c:\\", -1},
457 {L"c:/foo", L"\\??\\c:\\foo", 7},
458 {L"c:/foo.", L"\\??\\c:\\foo", 7},
459 {L"c:/foo ", L"\\??\\c:\\foo", 7},
460 {L"c:/foo . .", L"\\??\\c:\\foo", 7},
461 {L"c:/foo.a", L"\\??\\c:\\foo.a", 7},
462 {L"c:/foo a", L"\\??\\c:\\foo a", 7},
463 {L"c:/foo*", L"\\??\\c:\\foo*", 7},
464 {L"c:/foo*a", L"\\??\\c:\\foo*a", 7},
465 {L"c:/foo?", L"\\??\\c:\\foo?", 7},
466 {L"c:/foo?a", L"\\??\\c:\\foo?a", 7},
467 {L"c:/foo<", L"\\??\\c:\\foo<", 7},
468 {L"c:/foo<a", L"\\??\\c:\\foo<a", 7},
469 {L"c:/foo>", L"\\??\\c:\\foo>", 7},
470 {L"c:/foo>a", L"\\??\\c:\\foo>a", 7},
471 {L"c:/foo/", L"\\??\\c:\\foo\\", -1},
472 {L"c:/foo//", L"\\??\\c:\\foo\\", -1},
473 {L"C:/foo", L"\\??\\C:\\foo", 7},
474 {L"C:/foo/bar", L"\\??\\C:\\foo\\bar", 11},
475 {L"C:/foo/bar", L"\\??\\C:\\foo\\bar", 11},
476 {L"c:.", L"\\??\\C:\\windows", 7},
477 {L"c:foo", L"\\??\\C:\\windows\\foo", 15},
478 {L"c:foo/bar", L"\\??\\C:\\windows\\foo\\bar", 19},
479 {L"c:./foo", L"\\??\\C:\\windows\\foo", 15},
480 {L"c:/./foo", L"\\??\\c:\\foo", 7},
481 {L"c:/..", L"\\??\\c:\\", -1},
482 {L"c:/foo/.", L"\\??\\c:\\foo", 7},
483 {L"c:/foo/./bar", L"\\??\\c:\\foo\\bar", 11},
484 {L"c:/foo/../bar", L"\\??\\c:\\bar", 7},
485 {L"\\foo", L"\\??\\C:\\foo", 7},
486 {L"foo", L"\\??\\C:\\windows\\foo", 15},
487 {L".", L"\\??\\C:\\windows", 7},
488 {L"./", L"\\??\\C:\\windows\\", -1},
489 {L"..", L"\\??\\C:\\", -1},
490 {L"...", L"\\??\\C:\\windows\\", -1},
491 {L"./foo", L"\\??\\C:\\windows\\foo", 15},
492 {L"foo/..", L"\\??\\C:\\windows", 7},
493 {L"\\windows\\nul", L"\\??\\nul", -1},
494 {L"C:NUL.", L"\\??\\NUL", -1},
495 {L"C:NUL", L"\\??\\NUL", -1},
496 {L"AUX" , L"\\??\\AUX", -1},
497 {L"COM1" , L"\\??\\COM1", -1},
498 {L"?<>*\"|:", L"\\??\\C:\\windows\\?<>*\"|:", 15},
499 {L"?:", L"\\??\\?:\\", -1},
500
501 {L"\\\\foo", L"\\??\\UNC\\foo", -1},
502 {L"//foo", L"\\??\\UNC\\foo", -1},
503 {L"\\/foo", L"\\??\\UNC\\foo", -1},
504 {L"//", L"\\??\\UNC\\", -1},
505 {L"//foo/", L"\\??\\UNC\\foo\\", -1},
506
507 {L"//.", L"\\??\\", -1},
508 {L"//./", L"\\??\\", -1},
509 {L"//.//", L"\\??\\", -1},
510 {L"//./foo", L"\\??\\foo", 4},
511 {L"//./foo/", L"\\??\\foo\\", -1},
512 {L"//./foo/bar", L"\\??\\foo\\bar", 8},
513 {L"//./foo/.", L"\\??\\foo", 4},
514 {L"//./foo/..", L"\\??\\", -1},
515 {L"//./foo. . ", L"\\??\\foo", 4},
516
517 {L"//?", L"\\??\\", -1},
518 {L"//?/", L"\\??\\", -1},
519 {L"//?//", L"\\??\\", -1},
520 {L"//?/foo", L"\\??\\foo", 4},
521 {L"//?/foo/", L"\\??\\foo\\", -1},
522 {L"//?/foo/bar", L"\\??\\foo\\bar", 8},
523 {L"//?/foo/.", L"\\??\\foo", 4},
524 {L"//?/foo/..", L"\\??\\", -1},
525 {L"//?/foo. . ", L"\\??\\foo", 4},
526
527 {L"\\\\.", L"\\??\\", -1},
528 {L"\\\\.\\", L"\\??\\", -1},
529 {L"\\\\.\\/", L"\\??\\", -1},
530 {L"\\\\.\\foo", L"\\??\\foo", 4},
531 {L"\\\\.\\foo/", L"\\??\\foo\\", -1},
532 {L"\\\\.\\foo/bar", L"\\??\\foo\\bar", 8},
533 {L"\\\\.\\foo/.", L"\\??\\foo", 4},
534 {L"\\\\.\\foo/..", L"\\??\\", -1},
535 {L"\\\\.\\foo. . ", L"\\??\\foo", 4},
536 {L"\\\\.\\CON", L"\\??\\CON", 4, NULL, TRUE}, /* broken on win7 */
537 {L"\\\\.\\CONIN$", L"\\??\\CONIN$", 4},
538 {L"\\\\.\\CONOUT$", L"\\??\\CONOUT$", 4},
539
540 {L"\\\\?", L"\\??\\", -1},
541 {L"\\\\?\\", L"\\??\\", -1},
542
543 {L"\\\\?\\/", L"\\??\\/", 4},
544 {L"\\\\?\\foo", L"\\??\\foo", 4},
545 {L"\\\\?\\foo/", L"\\??\\foo/", 4},
546 {L"\\\\?\\foo/bar", L"\\??\\foo/bar", 4},
547 {L"\\\\?\\foo/.", L"\\??\\foo/.", 4},
548 {L"\\\\?\\foo/..", L"\\??\\foo/..", 4},
549 {L"\\\\?\\\\", L"\\??\\\\", -1},
550 {L"\\\\?\\\\\\", L"\\??\\\\\\", -1},
551 {L"\\\\?\\foo\\", L"\\??\\foo\\", -1},
552 {L"\\\\?\\foo\\bar",L"\\??\\foo\\bar", 8},
553 {L"\\\\?\\foo\\.", L"\\??\\foo\\.", 8},
554 {L"\\\\?\\foo\\..", L"\\??\\foo\\..", 8},
555 {L"\\\\?\\foo. . ", L"\\??\\foo. . ", 4},
556
557 {L"\\??", L"\\??\\C:\\??", 7},
558 {L"\\??\\", L"\\??\\C:\\??\\", -1},
559
560#ifdef __REACTOS__
561 {L"\\??\\/", L"\\??\\/", 4, L"\\??\\C:\\??\\" /* Windows 2003 */ },
562 {L"\\??\\foo", L"\\??\\foo", 4, L"\\??\\C:\\??\\foo" /* Windows 2003 */ },
563 {L"\\??\\foo/", L"\\??\\foo/", 4, L"\\??\\C:\\??\\foo\\" /* Windows 2003 */ },
564 {L"\\??\\foo/bar", L"\\??\\foo/bar", 4, L"\\??\\C:\\??\\foo\\bar" /* Windows 2003 */ },
565 {L"\\??\\foo/.", L"\\??\\foo/.", 4, L"\\??\\C:\\??\\foo" /* Windows 2003 */ },
566 {L"\\??\\foo/..", L"\\??\\foo/..", 4, L"\\??\\C:\\??" /* Windows 2003 */ },
567 {L"\\??\\\\", L"\\??\\\\", -1, L"\\??\\C:\\??\\" /* Windows 2003 */ },
568 {L"\\??\\\\\\", L"\\??\\\\\\", -1, L"\\??\\C:\\??\\" /* Windows 2003 */ },
569 {L"\\??\\foo\\", L"\\??\\foo\\", -1, L"\\??\\C:\\??\\foo\\" /* Windows 2003 */ },
570 {L"\\??\\foo\\bar", L"\\??\\foo\\bar", 8, L"\\??\\C:\\??\\foo\\bar" /* Windows 2003 */ },
571 {L"\\??\\foo\\.", L"\\??\\foo\\.", 8, L"\\??\\C:\\??\\foo" /* Windows 2003 */ },
572 {L"\\??\\foo\\..", L"\\??\\foo\\..", 8, L"\\??\\C:\\??" /* Windows 2003 */ },
573 {L"\\??\\foo. . ", L"\\??\\foo. . ", 4, L"\\??\\C:\\??\\foo" /* Windows 2003 */ },
574#else
575 {L"\\??\\/", L"\\??\\/", 4},
576 {L"\\??\\foo", L"\\??\\foo", 4},
577 {L"\\??\\foo/", L"\\??\\foo/", 4},
578 {L"\\??\\foo/bar", L"\\??\\foo/bar", 4},
579 {L"\\??\\foo/.", L"\\??\\foo/.", 4},
580 {L"\\??\\foo/..", L"\\??\\foo/..", 4},
581 {L"\\??\\\\", L"\\??\\\\", -1},
582 {L"\\??\\\\\\", L"\\??\\\\\\", -1},
583 {L"\\??\\foo\\", L"\\??\\foo\\", -1},
584 {L"\\??\\foo\\bar", L"\\??\\foo\\bar", 8},
585 {L"\\??\\foo\\.", L"\\??\\foo\\.", 8},
586 {L"\\??\\foo\\..", L"\\??\\foo\\..", 8},
587 {L"\\??\\foo. . ", L"\\??\\foo. . ", 4},
588#endif
589
590 {L"CONIN$", L"\\??\\CONIN$", -1, L"\\??\\C:\\windows\\CONIN$" /* win7 */ },
591 {L"CONOUT$", L"\\??\\CONOUT$", -1, L"\\??\\C:\\windows\\CONOUT$" /* win7 */ },
592 {L"cOnOuT$", L"\\??\\cOnOuT$", -1, L"\\??\\C:\\windows\\cOnOuT$" /* win7 */ },
593 {L"CONERR$", L"\\??\\C:\\windows\\CONERR$", 15},
594 };
595 static const WCHAR *error_paths[] = {
596 NULL, L"", L" ", L"C:\\nonexistent\\nul"
597 };
598
599 GetCurrentDirectoryA(sizeof(curdir), curdir);
600 SetCurrentDirectoryA("C:\\windows\\");
601
602 for (i = 0; i < ARRAY_SIZE(error_paths); ++i)
603 {
604 winetest_push_context("%s", debugstr_w(error_paths[i]));
605
606 ret = pRtlDosPathNameToNtPathName_U(error_paths[i], &nameW, &file_part, NULL);
607 ok(!ret, "Got %d.\n", ret);
608
609 if (pRtlDosPathNameToNtPathName_U_WithStatus)
610 {
611 status = pRtlDosPathNameToNtPathName_U_WithStatus(error_paths[i], &nameW, &file_part, NULL);
612#ifdef __REACTOS__
614 ok(status == STATUS_OBJECT_PATH_NOT_FOUND, "Got status %#lx.\n", status);
615 else
616#endif
617 ok(status == STATUS_OBJECT_NAME_INVALID, "Got status %#lx.\n", status);
618 }
619
621 }
622
623 for (i = 0; i < ARRAY_SIZE(tests); ++i)
624 {
625 ret = pRtlDosPathNameToNtPathName_U(tests[i].dos, &nameW, &file_part, NULL);
626 if (!ret && tests[i].may_fail)
627 {
628 win_skip("skipping broken %s\n", debugstr_w(tests[i].dos));
629 continue;
630 }
631 ok(ret == TRUE, "%s: Got %d.\n", debugstr_w(tests[i].dos), ret);
632
633 if (pRtlDosPathNameToNtPathName_U_WithStatus)
634 {
636 status = pRtlDosPathNameToNtPathName_U_WithStatus(tests[i].dos, &nameW, &file_part, NULL);
637 ok(status == STATUS_SUCCESS, "%s: Got status %#lx.\n", debugstr_w(tests[i].dos), status);
638 }
639
640#ifdef __REACTOS__
641 if (!nameW.Buffer) continue;
642#endif // __REACTOS__
643
644 ok(!wcscmp(nameW.Buffer, tests[i].nt)
645 || (tests[i].alt_nt && broken(!wcscmp(nameW.Buffer, tests[i].alt_nt))),
646 "%s: Expected %s, got %s.\n", debugstr_w(tests[i].dos),
647 debugstr_w(tests[i].nt), debugstr_w(nameW.Buffer));
648
649 if (!wcscmp(nameW.Buffer, tests[i].nt))
650 {
651 if (tests[i].file_offset > 0)
652 ok(file_part == nameW.Buffer + tests[i].file_offset,
653 "%s: Expected file part %s, got %s.\n", debugstr_w(tests[i].dos),
654 debugstr_w(nameW.Buffer + tests[i].file_offset), debugstr_w(file_part));
655 else
656 ok(file_part == NULL, "%s: Expected NULL file part, got %s.\n",
657 debugstr_w(tests[i].dos), debugstr_w(file_part));
658 }
659
661 }
662
663 SetCurrentDirectoryA(curdir);
664}
#define GetNTVersion()
Definition: apitest.h:17
PIMAGE_NT_HEADERS nt
Definition: delayimp.cpp:445
#define TRUE
Definition: types.h:120
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2065
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2125
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
unsigned int BOOL
Definition: ntddk_ex.h:94
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:537
IMAGE_DOS_HEADER dos
Definition: module.c:67
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25

Referenced by START_TEST().

◆ test_RtlGetFullPathName_U()

static void test_RtlGetFullPathName_U ( void  )
static

Definition at line 278 of file path.c.

279{
280 static const WCHAR emptyW[] = {0};
281 static const WCHAR deadbeefW[] = {'d','e','a','d','b','e','e','f',0};
282
283 struct test
284 {
285 const char *path;
286 const char *rname;
287 const char *rfile;
288 const char *alt_rname;
289 const char *alt_rfile;
290 };
291
292 static const struct test tests[] =
293 {
294 { "c:/test", "c:\\test", "test"},
295 { "c:/test/", "c:\\test\\", NULL},
296 { "c:/test ", "c:\\test", "test"},
297 { "c:/test.", "c:\\test", "test"},
298 { "c:/test .... .. ", "c:\\test", "test"},
299 { "c:/test/ .... .. ", "c:\\test\\", NULL},
300 { "c:/test/..", "c:\\", NULL},
301 { "c:/test/.. ", "c:\\test\\", NULL},
302 { "c:/TEST", "c:\\TEST", "TEST"},
303 { "c:/test/file", "c:\\test\\file", "file"},
304 { "c:/test./file", "c:\\test\\file", "file"},
305 { "c:/test.. /file", "c:\\test.. \\file","file"},
306 { "c:/test/././file", "c:\\test\\file", "file"},
307 { "c:/test\\.\\.\\file", "c:\\test\\file", "file"},
308 { "c:/test/\\.\\.\\file", "c:\\test\\file", "file"},
309 { "c:/test\\\\.\\.\\file", "c:\\test\\file", "file"},
310 { "c:/test\\test1\\..\\.\\file", "c:\\test\\file", "file"},
311 { "c:///test\\.\\.\\file//", "c:\\test\\file\\", NULL,
312 "c:\\test\\file", "file"}, /* nt4 */
313 { "c:///test\\..\\file\\..\\//", "c:\\", NULL},
314 { "c:/test../file", "c:\\test.\\file", "file",
315 "c:\\test..\\file", "file"}, /* vista */
316 { "c:\\test", "c:\\test", "test"},
317 { "c:\\test\\*.", "c:\\test\\*", "*"},
318 { "c:\\test\\a*b.*", "c:\\test\\a*b.*", "a*b.*"},
319 { "c:\\test\\a*b*.", "c:\\test\\a*b*", "a*b*"},
320 { "C:\\test", "C:\\test", "test"},
321 { "c:/", "c:\\", NULL},
322 { "c:.", "C:\\windows", "windows"},
323 { "c:foo", "C:\\windows\\foo", "foo"},
324 { "c:foo/bar", "C:\\windows\\foo\\bar", "bar"},
325 { "c:./foo", "C:\\windows\\foo", "foo"},
326 { "\\foo", "C:\\foo", "foo"},
327 { "foo", "C:\\windows\\foo", "foo"},
328 { ".", "C:\\windows", "windows"},
329 { "..", "C:\\", NULL},
330 { "...", "C:\\windows\\", NULL},
331 { "./foo", "C:\\windows\\foo", "foo"},
332 { "foo/..", "C:\\windows", "windows"},
333 { "\\windows\\nul", "\\\\.\\nul", NULL},
334 { "C:\\nonexistent\\nul", "\\\\.\\nul", NULL},
335 { "C:\\con\\con", "\\\\.\\con", NULL,
336 "C:\\con\\con", "con"}, /* win11 */
337 { "C:NUL.", "\\\\.\\NUL", NULL},
338 { "C:NUL", "\\\\.\\NUL", NULL},
339 { "AUX", "\\\\.\\AUX", NULL},
340 { "COM1", "\\\\.\\COM1", NULL},
341 { "?<>*\"|:", "C:\\windows\\?<>*\"|:", "?<>*\"|:"},
342
343 { "\\\\foo", "\\\\foo", NULL},
344 { "//foo", "\\\\foo", NULL},
345 { "\\/foo", "\\\\foo", NULL},
346 { "//", "\\\\", NULL},
347 { "//foo/", "\\\\foo\\", NULL},
348
349 { "//.", "\\\\.\\", NULL},
350 { "//./", "\\\\.\\", NULL},
351 { "//.//", "\\\\.\\", NULL},
352 { "//./foo", "\\\\.\\foo", "foo"},
353 { "//./foo/", "\\\\.\\foo\\", NULL},
354 { "//./foo/bar", "\\\\.\\foo\\bar", "bar"},
355 { "//./foo/.", "\\\\.\\foo", "foo"},
356 { "//./foo/..", "\\\\.\\", NULL},
357
358 { "//?/", "\\\\?\\", NULL},
359 { "//?//", "\\\\?\\", NULL},
360 { "//?/foo", "\\\\?\\foo", "foo"},
361 { "//?/foo/", "\\\\?\\foo\\", NULL},
362 { "//?/foo/bar", "\\\\?\\foo\\bar", "bar"},
363 { "//?/foo/.", "\\\\?\\foo", "foo"},
364 { "//?/foo/..", "\\\\?\\", NULL},
365
366 { "CONIN$", "\\\\.\\CONIN$", NULL,
367 "C:\\windows\\CONIN$", "CONIN$"},
368 { "CONOUT$", "\\\\.\\CONOUT$", NULL,
369 "C:\\windows\\CONOUT$", "CONOUT$"},
370
371 /* RtlGetFullPathName_U() can't understand the global namespace prefix */
372 { "\\??\\foo", "C:\\??\\foo", "foo"},
373 { 0 }
374 };
375
376 const struct test *test;
377 WCHAR pathbufW[2*MAX_PATH], rbufferW[MAX_PATH];
378 char rbufferA[MAX_PATH], rfileA[MAX_PATH], curdir[MAX_PATH];
379 ULONG ret;
380 WCHAR *file_part;
382 UINT len;
383
384 GetCurrentDirectoryA(sizeof(curdir), curdir);
385 SetCurrentDirectoryA("C:\\windows\\");
386
387 file_part = (WCHAR *)0xdeadbeef;
388 lstrcpyW(rbufferW, deadbeefW);
389 ret = pRtlGetFullPathName_U(NULL, MAX_PATH, rbufferW, &file_part);
390 ok(!ret, "Expected RtlGetFullPathName_U to return 0, got %lu\n", ret);
391 ok(!lstrcmpW(rbufferW, deadbeefW),
392 "Expected the output buffer to be untouched, got %s\n", wine_dbgstr_w(rbufferW));
393 ok(file_part == (WCHAR *)0xdeadbeef ||
394 file_part == NULL, /* Win7 */
395 "Expected file part pointer to be untouched, got %p\n", file_part);
396
397 file_part = (WCHAR *)0xdeadbeef;
398 lstrcpyW(rbufferW, deadbeefW);
399 ret = pRtlGetFullPathName_U(emptyW, MAX_PATH, rbufferW, &file_part);
400 ok(!ret, "Expected RtlGetFullPathName_U to return 0, got %lu\n", ret);
401 ok(!lstrcmpW(rbufferW, deadbeefW),
402 "Expected the output buffer to be untouched, got %s\n", wine_dbgstr_w(rbufferW));
403 ok(file_part == (WCHAR *)0xdeadbeef ||
404 file_part == NULL, /* Win7 */
405 "Expected file part pointer to be untouched, got %p\n", file_part);
406
407 for (test = tests; test->path; test++)
408 {
409 len= strlen(test->rname) * sizeof(WCHAR);
410 pRtlMultiByteToUnicodeN(pathbufW , sizeof(pathbufW), NULL, test->path, strlen(test->path)+1 );
411 ret = pRtlGetFullPathName_U( pathbufW,MAX_PATH, rbufferW, &file_part);
412 ok( ret == len || (test->alt_rname && ret == strlen(test->alt_rname)*sizeof(WCHAR)),
413 "Wrong result %ld/%d for \"%s\"\n", ret, len, test->path );
414 ok(pRtlUnicodeToMultiByteN(rbufferA,MAX_PATH,&reslen,rbufferW,(lstrlenW(rbufferW) + 1) * sizeof(WCHAR)) == STATUS_SUCCESS,
415 "RtlUnicodeToMultiByteN failed\n");
416 ok(!lstrcmpA(rbufferA,test->rname) || (test->alt_rname && !lstrcmpA(rbufferA,test->alt_rname)),
417 "Got \"%s\" expected \"%s\"\n",rbufferA,test->rname);
418 if (file_part)
419 {
420 ok(pRtlUnicodeToMultiByteN(rfileA,MAX_PATH,&reslen,file_part,(lstrlenW(file_part) + 1) * sizeof(WCHAR)) == STATUS_SUCCESS,
421 "RtlUnicodeToMultiByteN failed\n");
422 ok((test->rfile && !lstrcmpA(rfileA,test->rfile)) ||
423 (test->alt_rfile && !lstrcmpA(rfileA,test->alt_rfile)),
424 "Got \"%s\" expected \"%s\"\n",rfileA,test->rfile);
425 }
426 else
427 {
428 ok( !test->rfile, "Got NULL expected \"%s\"\n", test->rfile );
429 }
430 }
431
432 SetCurrentDirectoryA(curdir);
433}
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4104
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR emptyW[]
Definition: navigate.c:40
#define wine_dbgstr_w
Definition: kernel32.h:34
static DWORD LPDWORD reslen
Definition: path.c:32
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_RtlIsDosDeviceName_U()

static void test_RtlIsDosDeviceName_U ( void  )
static

Definition at line 116 of file path.c.

117{
118 struct test
119 {
120 const char *path;
121 WORD pos;
122 WORD len;
123 BOOL fails;
124 };
125
126 static const struct test tests[] =
127 {
128 { "\\\\.\\CON", 8, 6, TRUE }, /* fails on win8 */
129 { "\\\\.\\con", 8, 6, TRUE }, /* fails on win8 */
130 { "\\\\.\\CON2", 0, 0 },
131 { "\\\\.\\CONIN$", 0, 0 },
132 { "\\\\.\\CONOUT$",0, 0 },
133 { "", 0, 0 },
134 { "\\\\foo\\nul", 0, 0 },
135 { "c:\\nul:", 6, 6 },
136 { "c:\\nul\\", 0, 0 },
137 { "c:\\nul\\foo", 0, 0 },
138 { "c:\\nul::", 6, 6 },
139 { "c:\\nul::::::", 6, 6, TRUE }, /* fails on win11 */
140 { "c:prn ", 4, 6, TRUE }, /* fails on win11 */
141 { "c:prn.......", 4, 6, TRUE }, /* fails on win11 */
142 { "c:prn... ...", 4, 6, TRUE }, /* fails on win11 */
143 { "c:NUL .... ", 4, 6 },
144 { "c: . . .", 0, 0 },
145 { "c:", 0, 0 },
146 { " . . . :", 0, 0 },
147 { ":", 0, 0 },
148 { "c:nul. . . :", 4, 6 },
149 { "c:nul . . :", 4, 6 },
150 { "c:nul0", 0, 0 },
151 { "c:prn:aaa", 4, 6, TRUE }, /* fails on win11 */
152 { "c:PRN:.txt", 4, 6, TRUE }, /* fails on win11 */
153 { "c:aux:.txt...", 4, 6, TRUE }, /* fails on win11 */
154 { "c:prn:.txt:", 4, 6, TRUE }, /* fails on win11 */
155 { "c:nul:aaa", 4, 6, TRUE }, /* fails on win11 */
156 { "con:", 0, 6 },
157 { "lpt1:", 0, 8 },
158 { "c:com5:", 4, 8, TRUE }, /* fails on win11 */
159 { "CoM4:", 0, 8 },
160 { "lpt9:", 0, 8 },
161 { "c:\\lpt0.txt", 0, 0 },
162 { "CONIN$", 0, 12, TRUE }, /* fails on win7 */
163 { "CONOUT$", 0, 14, TRUE }, /* fails on win7 */
164 { "CONERR$", 0, 0 },
165 { "CON", 0, 6 },
166 { "PIPE", 0, 0 },
167 { "\\??\\CONIN$", 8, 12, TRUE }, /* fails on win7 */
168 { "\\??\\CONOUT$", 8, 14, TRUE }, /* fails on win7 */
169 { "\\??\\CONERR$", 0, 0 },
170 { "\\??\\CON", 8, 6, TRUE }, /* fails on win11 */
171 { "c:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
172 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
173 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
174 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
175 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
176 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
177 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\nul.txt", 1000, 6, TRUE }, /* fails on win11 */
178 { NULL, 0 }
179 };
180
181 const struct test *test;
182 WCHAR buffer[2000];
183 ULONG ret;
184
185 if (!pRtlIsDosDeviceName_U)
186 {
187 win_skip("RtlIsDosDeviceName_U is not available\n");
188 return;
189 }
190
191 for (test = tests; test->path; test++)
192 {
193 pRtlMultiByteToUnicodeN( buffer, sizeof(buffer), NULL, test->path, strlen(test->path)+1 );
194 ret = pRtlIsDosDeviceName_U( buffer );
195 ok( ret == MAKELONG( test->len, test->pos ) ||
196 (test->fails && broken( ret == 0 )),
197 "Wrong result (%d,%d)/(%d,%d) for %s\n",
198 HIWORD(ret), LOWORD(ret), test->pos, test->len, test->path );
199 }
200}
unsigned short WORD
Definition: ntddk_ex.h:93
#define LOWORD(l)
Definition: pedump.c:82
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247

Referenced by START_TEST().

◆ test_RtlIsNameLegalDOS8Dot3()

static void test_RtlIsNameLegalDOS8Dot3 ( void  )
static

Definition at line 202 of file path.c.

203{
204 struct test
205 {
206 const char *path;
208 BOOLEAN spaces;
209 };
210
211 static const struct test tests[] =
212 {
213 { "12345678", TRUE, FALSE },
214 { "123 5678", TRUE, TRUE },
215 { "12345678.", FALSE, 2 /*not set*/ },
216 { "1234 678.", FALSE, 2 /*not set*/ },
217 { "12345678.a", TRUE, FALSE },
218 { "12345678.a ", FALSE, 2 /*not set*/ },
219 { "12345678.a c", TRUE, TRUE },
220 { " 2345678.a ", FALSE, 2 /*not set*/ },
221 { "1 345678.abc", TRUE, TRUE },
222 { "1 8.a c", TRUE, TRUE },
223 { "1 3 5 7 .abc", FALSE, 2 /*not set*/ },
224 { "12345678. c", TRUE, TRUE },
225 { "123456789.a", FALSE, 2 /*not set*/ },
226 { "12345.abcd", FALSE, 2 /*not set*/ },
227 { "12345.ab d", FALSE, 2 /*not set*/ },
228 { ".abc", FALSE, 2 /*not set*/ },
229 { "12.abc.d", FALSE, 2 /*not set*/ },
230 { ".", TRUE, FALSE },
231 { "..", TRUE, FALSE },
232 { "...", FALSE, 2 /*not set*/ },
233 { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", FALSE, 2 /*not set*/ },
234 { NULL, 0 }
235 };
236
237 const struct test *test;
238 UNICODE_STRING ustr;
239 OEM_STRING oem, oem_ret;
240 WCHAR buffer[200];
241 char buff2[12];
242 BOOLEAN ret, spaces;
243
244 if (!pRtlIsNameLegalDOS8Dot3)
245 {
246 win_skip("RtlIsNameLegalDOS8Dot3 is not available\n");
247 return;
248 }
249
250 ustr.MaximumLength = sizeof(buffer);
251 ustr.Buffer = buffer;
252 for (test = tests; test->path; test++)
253 {
254 char path[100];
255 strcpy(path, test->path);
256 oem.Buffer = path;
257 oem.Length = strlen(test->path);
258 oem.MaximumLength = oem.Length + 1;
259 pRtlOemStringToUnicodeString( &ustr, &oem, FALSE );
260 spaces = 2;
261 oem_ret.Length = oem_ret.MaximumLength = sizeof(buff2);
262 oem_ret.Buffer = buff2;
263 ret = pRtlIsNameLegalDOS8Dot3( &ustr, &oem_ret, &spaces );
264 ok( ret == test->result, "Wrong result %d/%d for '%s'\n", ret, test->result, test->path );
265 ok( spaces == test->spaces, "Wrong spaces value %d/%d for '%s'\n", spaces, test->spaces, test->path );
266 if (strlen(test->path) <= 12)
267 {
268 STRING test_str;
269 char str[13];
270 strcpy( str, test->path );
271 RtlInitString( &test_str, str );
272 RtlUpperString( &test_str, &test_str );
273 ok( !RtlCompareString(&oem_ret, &test_str, FALSE),
274 "Wrong string '%.*s'/'%s'\n", oem_ret.Length, oem_ret.Buffer, test->path );
275 }
276 }
277}
unsigned char BOOLEAN
Definition: actypes.h:127
#define FALSE
Definition: types.h:117
std::wstring STRING
Definition: fontsub.cpp:33
GLuint64EXT * result
Definition: glext.h:11304
NTSYSAPI VOID NTAPI RtlInitString(PSTRING DestinationString, PCSZ SourceString)
NTSYSAPI LONG NTAPI RtlCompareString(PSTRING String1, PSTRING String2, BOOLEAN CaseInSensitive)
NTSYSAPI VOID NTAPI RtlUpperString(PSTRING DestinationString, PSTRING SourceString)
const WCHAR * str
strcpy
Definition: string.h:131
USHORT MaximumLength
Definition: env_spec_w32.h:370
STRING OEM_STRING
Definition: umtypes.h:205

Referenced by START_TEST().

◆ UINT()

static UINT ( WINAPI pRtlDetermineDosPathNameType_U)
static

◆ ULONG()

static ULONG ( WINAPI pRtlIsDosDeviceName_U)
static

Variable Documentation

◆ ACCESS_MASK

Definition at line 42 of file path.c.

◆ BOOLEAN

Definition at line 37 of file path.c.

◆ dstlen

DWORD dstlen

Definition at line 32 of file path.c.

◆ DWORD

Definition at line 34 of file path.c.

◆ LPCWSTR

Definition at line 34 of file path.c.

◆ LPDWORD

Definition at line 34 of file path.c.

◆ PBOOLEAN

Definition at line 38 of file path.c.

◆ POEM_STRING

Definition at line 38 of file path.c.

◆ reslen

DWORD LPDWORD reslen

Definition at line 32 of file path.c.

Referenced by test_RtlGetFullPathName_U().

◆ src

Definition at line 33 of file path.c.

◆ srclen

Definition at line 33 of file path.c.

◆ ULONG