Changeset 78153 in vbox for trunk/src/VBox/Runtime/r3/win
- Timestamp:
- Apr 17, 2019 12:30:08 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/path-win.cpp
r76553 r78153 671 671 int rc; 672 672 673 /* 674 * GetCurrentDirectory may in some cases omit the drive letter, according 675 * to MSDN, thus the GetFullPathName call. 676 */ 677 RTUTF16 wszCurPath[RTPATH_MAX]; 678 if (GetCurrentDirectoryW(RTPATH_MAX, wszCurPath)) 679 { 680 RTUTF16 wszFullPath[RTPATH_MAX]; 681 if (GetFullPathNameW(wszCurPath, RTPATH_MAX, wszFullPath, NULL)) 682 rc = RTUtf16ToUtf8Ex(&wszFullPath[0], RTSTR_MAX, &pszPath, cchPath, NULL); 673 if (cchPath > 0) 674 { 675 /* 676 * GetCurrentDirectory may in some cases omit the drive letter, according 677 * to MSDN, thus the GetFullPathName call. 678 */ 679 RTUTF16 wszCurPath[RTPATH_MAX]; 680 if (GetCurrentDirectoryW(RTPATH_MAX, wszCurPath)) 681 { 682 RTUTF16 wszFullPath[RTPATH_MAX]; 683 if (GetFullPathNameW(wszCurPath, RTPATH_MAX, wszFullPath, NULL)) 684 rc = RTUtf16ToUtf8Ex(&wszFullPath[0], RTSTR_MAX, &pszPath, cchPath, NULL); 685 else 686 rc = RTErrConvertFromWin32(GetLastError()); 687 } 683 688 else 684 689 rc = RTErrConvertFromWin32(GetLastError()); 685 690 } 686 691 else 687 rc = RTErrConvertFromWin32(GetLastError());692 rc = VERR_BUFFER_OVERFLOW; 688 693 return rc; 689 694 } … … 724 729 RTDECL(int) RTPathGetCurrentOnDrive(char chDrive, char *pszPath, size_t cbPath) 725 730 { 726 WCHAR wszInput[4];727 wszInput[0] = chDrive;728 wszInput[1] = ':';729 wszInput[2] = '\0';730 731 731 int rc; 732 RTUTF16 wszFullPath[RTPATH_MAX]; 733 if (GetFullPathNameW(wszInput, RTPATH_MAX, wszFullPath, NULL)) 734 rc = RTUtf16ToUtf8Ex(&wszFullPath[0], RTSTR_MAX, &pszPath, cbPath, NULL); 732 if (cbPath > 0) 733 { 734 WCHAR wszInput[4]; 735 wszInput[0] = chDrive; 736 wszInput[1] = ':'; 737 wszInput[2] = '\0'; 738 RTUTF16 wszFullPath[RTPATH_MAX]; 739 if (GetFullPathNameW(wszInput, RTPATH_MAX, wszFullPath, NULL)) 740 rc = RTUtf16ToUtf8Ex(&wszFullPath[0], RTSTR_MAX, &pszPath, cbPath, NULL); 741 else 742 rc = RTErrConvertFromWin32(GetLastError()); 743 } 735 744 else 736 rc = RTErrConvertFromWin32(GetLastError());745 rc = VERR_BUFFER_OVERFLOW; 737 746 return rc; 738 747 }
Note:
See TracChangeset
for help on using the changeset viewer.