Changeset 57597 in vbox
- Timestamp:
- Sep 2, 2015 3:09:12 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 102458
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/fileio-win.cpp
r57358 r57597 824 824 * Query file info. 825 825 */ 826 HANDLE hHandle = (HANDLE)RTFileToNative(hFile); 827 826 828 BY_HANDLE_FILE_INFORMATION Data; 827 if (!GetFileInformationByHandle( (HANDLE)RTFileToNative(hFile), &Data))829 if (!GetFileInformationByHandle(hHandle, &Data)) 828 830 { 829 831 DWORD dwErr = GetLastError(); … … 831 833 * everything else is fine here ... */ 832 834 if (dwErr == ERROR_INVALID_HANDLE) 833 return RTErrConvertFromWin32(dwErr); 835 { 836 /* 837 * On Windows 7 or earlier certain standard handles such as 838 * stin, stdout and stderr were ring-3 pseudo handles which the 839 * kernel didn't know about. 840 * 841 * So simply ignore the ERROR_INVALID_HANDLE in that case to not 842 * break other parts which rely on this function. 843 */ 844 OSVERSIONINFOEX OSInfoEx = { 0 }; 845 OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); 846 847 bool fIgnoreError = false; 848 849 /* Windows 7 or earlier? */ 850 if ( GetVersionEx((LPOSVERSIONINFO) &OSInfoEx) 851 && (OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT) 852 && (OSInfoEx.dwMajorVersion <= 6) 853 && (OSInfoEx.dwMajorVersion <= 1)) 854 { 855 /* Do we want to query file information for one of the pseudo handles? Then skip. */ 856 if ( hHandle == GetStdHandle(STD_INPUT_HANDLE) 857 || hHandle == GetStdHandle(STD_OUTPUT_HANDLE) 858 || hHandle == GetStdHandle(STD_ERROR_HANDLE)) 859 { 860 fIgnoreError = true; 861 } 862 } 863 864 if (!fIgnoreError) 865 return RTErrConvertFromWin32(dwErr); 866 } 834 867 RT_ZERO(Data); 835 868 Data.dwFileAttributes = RTFS_DOS_NT_DEVICE;
Note:
See TracChangeset
for help on using the changeset viewer.