Changeset 57603 in vbox
- Timestamp:
- Sep 3, 2015 8:26:47 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Runtime/r3/win/fileio-win.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/fileio-win.cpp
r57598 r57603 40 40 #include <iprt/string.h> 41 41 #include <iprt/err.h> 42 #include <iprt/ldr.h> 42 43 #include <iprt/log.h> 43 44 #include "internal/file.h" … … 49 50 * Defined Constants And Macros * 50 51 *********************************************************************************************************************************/ 51 52 typedef BOOL WINAPI FNVERIFYCONSOLEIOHANDLE(HANDLE); 53 typedef FNVERIFYCONSOLEIOHANDLE *PFNVERIFYCONSOLEIOHANDLE; /* No, nobody fell on the keyboard, really! */ 52 54 53 55 /** … … 851 853 && (OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT) 852 854 && (OSInfoEx.dwMajorVersion <= 6) 853 && (OSInfoEx.dwM ajorVersion <= 1))855 && (OSInfoEx.dwMinorVersion <= 1)) 854 856 { 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)) 857 PFNVERIFYCONSOLEIOHANDLE pfnVerifyConsoleIoHandle = NULL; 858 859 /* 860 * As the standard I/O handles could have been overwritten by SetStdHandle() we cannot assume 861 * that GetStdHandle will actually return real console I/O handles. 862 * 863 * So try to dynamically load the undocumented VerifyConsoleIoHandle from kernel32.dll. 864 * This function will check if the given handle actually is a console I/O handle, and if so, 865 * we know that we have to ignore the ERROR_INVALID_HANDLE on Windows 7 or earlier. 866 * 867 */ 868 RTLDRMOD hKernel32 = NIL_RTLDRMOD; 869 int rc2 = RTLdrLoadSystem("kernel32.dll", true /*fNoUnload*/, &hKernel32); 870 if (RT_SUCCESS(rc2)) 871 rc2 = RTLdrGetSymbol(hKernel32, "VerifyConsoleIoHandle", (void**)&pfnVerifyConsoleIoHandle); 872 873 if (RT_SUCCESS(rc2)) 859 874 { 860 fIgnoreError = true; 875 AssertPtr(pfnVerifyConsoleIoHandle); 876 877 /* Is the handle a console handle? Then ignore ERROR_INVALID_HANDLE. */ 878 if (pfnVerifyConsoleIoHandle(hHandle)) 879 fIgnoreError = true; 861 880 } 881 882 if (hKernel32 != NIL_RTLDRMOD) 883 RTLdrClose(hKernel32); 862 884 } 863 885
Note:
See TracChangeset
for help on using the changeset viewer.

