596{
598 struct {
604 } test_paths[] = {
605 {
608 },
609 {
612 },
613 {
616 },
617 {
618 "C:\\", "C:\\", 0,
620 },
621 {
622 "C:\\", "C:\\", 1,
624 },
625 {
626 "C:\\", "C:\\", sizeof(volume_path),
628 },
629 {
630 "c:\\", "C:\\", sizeof(volume_path),
632 },
633 {
634 "C::", "C:\\", sizeof(volume_path),
636 },
637 {
638 "\\\\$$$", "C:\\", 1,
640 },
641 {
642 "C:\\windows\\system32", "C:\\", sizeof(volume_path),
644 },
645 {
646 "C:\\windows\\system32\\AnInvalidFolder", "C:\\", sizeof(volume_path),
648 },
649 {
650 "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:\\", sizeof(volume_path),
652 },
653 {
654 "\\\\?\\InvalidDrive:\\AnInvalidFolder", "\\\\?\\InvalidDrive:\\" ,
655 sizeof(volume_path),
657 },
658 {
659 "\\\\?\\Volume{00000000-00-0000-0000-000000000000}\\AnInvalidFolder",
660 "\\\\?\\Volume{00000000-00-0000-0000-000000000000}\\" ,
661 sizeof(volume_path),
663 },
664 {
665 "\\\\ReallyBogus\\InvalidDrive:\\AnInvalidFolder",
666 "\\\\ReallyBogus\\InvalidDrive:\\" , sizeof(volume_path),
668 },
669 {
670 "C::", "C:\\", 4,
672 },
673 {
674 "M::", "C:\\", 4,
676 },
677 {
678 "InvalidDrive:\\AnInvalidFolder", "%CurrentDrive%\\", sizeof(volume_path),
680 },
681 {
682 "\\??\\CdRom0", "%CurrentDrive%\\", sizeof(volume_path),
684 },
685 {
686 "\\??\\ReallyBogus", "%CurrentDrive%\\", sizeof(volume_path),
688 },
689 {
690 "C:", "C:", 2,
692 },
693 {
694 "C:", "C:", 3,
696 },
697 {
698 "C:\\", "C:", 2,
700 },
701 {
702 "C:\\", "C:", 3,
704 },
705 {
706 "C::", "C:", 2,
708 },
709 {
710 "C::", "C:", 3,
712 },
713 {
714 "C::", "C:\\", 4,
716 },
717 {
718 "C:\\windows\\system32\\AnInvalidFolder", "C:", 3,
720 },
721 {
722 "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 3,
724 },
725 {
726 "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 6,
728 },
729 {
730 "\\\\?\\C:\\AnInvalidFolder", "\\\\?\\C:", 7,
732 },
733 {
734 "\\\\?\\c:\\AnInvalidFolder", "\\\\?\\c:", 7,
736 },
737 {
738 "C:/", "C:\\", 4,
740 },
741 {
742 "M:/", "", 4,
744 },
745 {
746 "C:ABC:DEF:\\AnInvalidFolder", "C:\\", 4,
748 },
749 {
750 "?:ABC:DEF:\\AnInvalidFolder", "?:\\" , sizeof(volume_path),
752 },
753 {
754 "relative/path", "%CurrentDrive%\\", sizeof(volume_path),
756 },
757 {
758 "/unix-style/absolute/path", "%CurrentDrive%\\", sizeof(volume_path),
760 },
761 {
762 "\\??\\C:\\NonExistent", "%CurrentDrive%\\", sizeof(volume_path),
764 },
765 {
766 "\\??\\M:\\NonExistent", "%CurrentDrive%\\", sizeof(volume_path),
768 },
769 {
770 "somefile:def", "%CurrentDrive%\\", sizeof(volume_path),
772 },
773 {
774 "s:omefile", "S:\\" , sizeof(volume_path),
776 },
777 };
781
782
783 if (!pGetVolumePathNameA)
784 {
785 win_skip(
"required functions not found\n");
786 return;
787 }
788
789
791 ok(
ret,
"Failed to obtain the current working directory.\n" );
792 cwd[2] = 0;
794 ok(
ret,
"Failed to set an environment variable for the current working drive.\n" );
795
796 for (
i=0;
i<
sizeof(test_paths)/
sizeof(test_paths[0]);
i++)
797 {
799 char *output = (test_paths[
i].path_name !=
NULL ? volume_path :
NULL);
801
802 volume_path[0] = 0;
803 if (test_paths[
i].
path_len <
sizeof(volume_path))
804 volume_path[ test_paths[
i].
path_len ] = 0x11;
805
810 "GetVolumePathName test %d %s unexpectedly.\n",
812
814 {
816
818
821 ok(
success,
"GetVolumePathName test %d unexpectedly returned path %s (expected %s).\n",
823 }
824 else
825 {
826
828 ok(
success,
"GetVolumePathName test %d unexpectedly returned error 0x%x (expected 0x%x).\n",
830 }
831
832 if (test_paths[
i].
path_len <
sizeof(volume_path))
834 "GetVolumePathName test %d corrupted byte after end of buffer.\n",
i);
835 }
836}
int strcmp(const char *String1, const char *String2)
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
static char * path_name(DOS_FILE *file)
#define success(from, fromstr, to, tostr)