Changeset 98343 in vbox
- Timestamp:
- Jan 30, 2023 11:11:47 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155571
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r98306 r98343 32 32 *********************************************************************************************************************************/ 33 33 #define LOG_GROUP LOG_GROUP_GUI 34 35 #include <iprt/stream.h> 34 36 35 37 #include <VBox/com/com.h> … … 2792 2794 if (RT_FAILURE(rc)) 2793 2795 return RTMsgInitFailure(rc); 2794 return TrustedMain(argc, argv, NULL); 2796 2797 #ifdef RT_OS_WINDOWS 2798 /* As we run with the WINDOWS subsystem, we need to either attach to or create an own console 2799 * to get any stdout / stderr output. */ 2800 bool fAllocConsole = ::IsDebuggerPresent(); 2801 if (!fAllocConsole) 2802 { 2803 if (!AttachConsole(ATTACH_PARENT_PROCESS)) 2804 fAllocConsole = true; 2805 } 2806 2807 if (fAllocConsole) 2808 { 2809 if (!AllocConsole()) 2810 MessageBox(GetDesktopWindow(), L"Unable to attach to or allocate a console!", L"VBoxSDL", MB_OK | MB_ICONERROR); 2811 /* Continue running. */ 2812 } 2813 2814 RTFILE hStdOut; 2815 RTFileFromNative(&hStdOut, (RTHCINTPTR)GetStdHandle(STD_OUTPUT_HANDLE)); 2816 /** @todo Closing of standard handles not support via IPRT (yet). */ 2817 RTStrmOpenFileHandle(hStdOut, "wt", 0, &g_pStdOut); 2818 2819 RTFILE hStdErr; 2820 RTFileFromNative(&hStdErr, (RTHCINTPTR)GetStdHandle(STD_ERROR_HANDLE)); 2821 RTStrmOpenFileHandle(hStdErr, "wt", 0, &g_pStdErr); 2822 2823 if (!fAllocConsole) /* When attaching to the parent console, make sure we start on a fresh line. */ 2824 RTPrintf("\n"); 2825 #endif /* RT_OS_WINDOWS */ 2826 2827 int rcExit = TrustedMain(argc, argv, NULL); 2828 2829 #ifdef RT_OS_WINDOWS 2830 FreeConsole(); /* Detach or destroy (from) console. */ 2831 #endif 2832 2833 return rcExit; 2795 2834 } 2796 2835 #endif /* !VBOX_WITH_HARDENING */
Note:
See TracChangeset
for help on using the changeset viewer.