Changeset 96475 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Aug 25, 2022 2:27:54 AM (2 years ago)
- Location:
- trunk/src/VBox/Runtime/r3
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/localipc-posix.cpp
r96407 r96475 242 242 * Create the local (unix) socket and bind to it. 243 243 */ 244 rc = rtSocketCreate(&pThis->hSocket, AF_LOCAL, SOCK_STREAM, 0 /*iProtocol*/ );244 rc = rtSocketCreate(&pThis->hSocket, AF_LOCAL, SOCK_STREAM, 0 /*iProtocol*/, false /*fInheritable*/); 245 245 if (RT_SUCCESS(rc)) 246 246 { 247 RTSocketSetInheritance(pThis->hSocket, false /*fInheritable*/);248 247 signal(SIGPIPE, SIG_IGN); /* Required on solaris, at least. */ 249 248 … … 561 560 * Create the local (unix) socket and try connect to the server. 562 561 */ 563 rc = rtSocketCreate(&pThis->hSocket, AF_LOCAL, SOCK_STREAM, 0 /*iProtocol*/ );562 rc = rtSocketCreate(&pThis->hSocket, AF_LOCAL, SOCK_STREAM, 0 /*iProtocol*/, false /*fInheritable*/); 564 563 if (RT_SUCCESS(rc)) 565 564 { 566 RTSocketSetInheritance(pThis->hSocket, false /*fInheritable*/);567 565 signal(SIGPIPE, SIG_IGN); /* Required on solaris, at least. */ 568 566 -
trunk/src/VBox/Runtime/r3/socket.cpp
r96407 r96475 572 572 * @param iType The socket type (SOCK_XXX). 573 573 * @param iProtocol Socket parameter, usually 0. 574 */ 575 DECLHIDDEN(int) rtSocketCreate(PRTSOCKET phSocket, int iDomain, int iType, int iProtocol) 574 * @param fInheritable Set to true if the socket should be inherted by 575 * child processes, false if not inheritable. 576 */ 577 DECLHIDDEN(int) rtSocketCreate(PRTSOCKET phSocket, int iDomain, int iType, int iProtocol, bool fInheritable) 576 578 { 577 579 #ifdef RT_OS_WINDOWS … … 587 589 /* 588 590 * Create the socket. 589 */ 590 #ifdef RT_OS_WINDOWS 591 RTSOCKETNATIVE hNative = g_pfnsocket(iDomain, iType, iProtocol); 591 * 592 * The RTSocketSetInheritance operation isn't necessarily reliable on windows, 593 * so try use WSA_FLAG_NO_HANDLE_INHERIT with WSASocketW when possible. 594 */ 595 #ifdef RT_OS_WINDOWS 596 bool fCallSetInheritance = true; 597 RTSOCKETNATIVE hNative; 598 if (g_pfnWSASocketW) 599 { 600 DWORD fWsaFlags = WSA_FLAG_OVERLAPPED | (!fInheritable ? WSA_FLAG_NO_HANDLE_INHERIT : 0); 601 hNative = g_pfnWSASocketW(iDomain, iType, iProtocol, NULL, 0 /*Group*/, fWsaFlags); 602 if (hNative != NIL_RTSOCKETNATIVE) 603 fCallSetInheritance = false; 604 else 605 { 606 if (!fInheritable) 607 hNative = g_pfnsocket(iDomain, iType, iProtocol); 608 if (hNative == NIL_RTSOCKETNATIVE) 609 return rtSocketError(); 610 } 611 } 612 else 613 { 614 hNative = g_pfnsocket(iDomain, iType, iProtocol); 615 if (hNative == NIL_RTSOCKETNATIVE) 616 return rtSocketError(); 617 } 592 618 #else 593 619 RTSOCKETNATIVE hNative = socket(iDomain, iType, iProtocol); 594 #endif595 620 if (hNative == NIL_RTSOCKETNATIVE) 596 621 return rtSocketError(); 622 #endif 597 623 598 624 /* … … 600 626 */ 601 627 int rc = rtSocketCreateForNative(phSocket, hNative, false /*fLeaveOpen*/); 602 if (RT_FAILURE(rc)) 628 if (RT_SUCCESS(rc)) 629 { 630 #ifdef RT_OS_WINDOWS 631 if (fCallSetInheritance) 632 #endif 633 RTSocketSetInheritance(*phSocket, fInheritable); 634 } 635 else 603 636 { 604 637 #ifdef RT_OS_WINDOWS … … 943 976 AssertReturn(RTMemPoolRefCount(pThis) >= (pThis->cUsers ? 2U : 1U), VERR_CALLER_NO_REFERENCE); 944 977 945 int rc = VINF_SUCCESS; 946 #ifdef RT_OS_WINDOWS 947 if (!SetHandleInformation((HANDLE)pThis->hNative, HANDLE_FLAG_INHERIT, fInheritable ? HANDLE_FLAG_INHERIT : 0))948 rc = RTErrConvertFromWin32(GetLastError());978 #ifndef RT_OS_WINDOWS 979 if (fcntl(pThis->hNative, F_SETFD, fInheritable ? 0 : FD_CLOEXEC) < 0) 980 return RTErrConvertFromErrno(errno); 981 return VINF_SUCCESS; 949 982 #else 950 if (fcntl(pThis->hNative, F_SETFD, fInheritable ? 0 : FD_CLOEXEC) < 0) 951 rc = RTErrConvertFromErrno(errno); 952 #endif 953 954 return rc; 983 /* Windows is more complicated as sockets are complicated wrt inheritance 984 (see stackoverflow for details). In general, though we cannot hope to 985 make a socket really non-inheritable before vista as other layers in 986 the winsock maze may have additional handles associated with the socket. */ 987 if (g_pfnGetHandleInformation) 988 { 989 /* Check if the handle is already in what seems to be the right state 990 before we try doing anything. */ 991 DWORD fFlags; 992 if (g_pfnGetHandleInformation((HANDLE)pThis->hNative, &fFlags)) 993 { 994 if (RT_BOOL(fFlags & HANDLE_FLAG_INHERIT) == fInheritable) 995 return VINF_SUCCESS; 996 } 997 } 998 999 if (!g_pfnSetHandleInformation) 1000 return VERR_NET_NOT_UNSUPPORTED; 1001 1002 if (!g_pfnSetHandleInformation((HANDLE)pThis->hNative, HANDLE_FLAG_INHERIT, fInheritable ? HANDLE_FLAG_INHERIT : 0)) 1003 return RTErrConvertFromWin32(GetLastError()); 1004 /** @todo Need we do something related to WS_SIO_ASSOCIATE_HANDLE or 1005 * WS_SIO_TRANSLATE_HANDLE? Or what other handles could be associated 1006 * with the socket? that we need to modify? */ 1007 1008 return VINF_SUCCESS; 1009 #endif 955 1010 } 956 1011 -
trunk/src/VBox/Runtime/r3/tcp.cpp
r96407 r96475 332 332 */ 333 333 RTSOCKET WaitSock; 334 rc = rtSocketCreate(&WaitSock, AF_INET, SOCK_STREAM, IPPROTO_TCP );334 rc = rtSocketCreate(&WaitSock, AF_INET, SOCK_STREAM, IPPROTO_TCP, false /*fInheritable*/); 335 335 if (RT_SUCCESS(rc)) 336 336 { 337 RTSocketSetInheritance(WaitSock, false /*fInheritable*/);338 339 337 /* 340 338 * Set socket options. … … 343 341 if (!rtSocketSetOpt(WaitSock, SOL_SOCKET, SO_REUSEADDR, &fFlag, sizeof(fFlag))) 344 342 { 345 346 343 /* 347 344 * Bind a name to a socket and set it listening for connections. … … 842 839 */ 843 840 RTSOCKET Sock; 844 rc = rtSocketCreate(&Sock, PF_INET, SOCK_STREAM, 0 );841 rc = rtSocketCreate(&Sock, PF_INET, SOCK_STREAM, 0, false /*fInheritable*/); 845 842 if (RT_SUCCESS(rc)) 846 843 { 847 RTSocketSetInheritance(Sock, false /*fInheritable*/);848 849 844 if (!ppCancelCookie) 850 845 rc = rtSocketConnect(Sock, &Addr, cMillies); -
trunk/src/VBox/Runtime/r3/udp.cpp
r96407 r96475 303 303 */ 304 304 RTSOCKET Sock; 305 rc = rtSocketCreate(&Sock, AF_INET, SOCK_DGRAM, IPPROTO_UDP );305 rc = rtSocketCreate(&Sock, AF_INET, SOCK_DGRAM, IPPROTO_UDP, false /*fInheritable*/); 306 306 if (RT_SUCCESS(rc)) 307 307 { 308 RTSocketSetInheritance(Sock, false /*fInheritable*/);309 310 308 /* 311 309 * Set socket options. … … 719 717 */ 720 718 RTSOCKET Sock; 721 rc = rtSocketCreate(&Sock, AF_INET, SOCK_DGRAM, 0 );719 rc = rtSocketCreate(&Sock, AF_INET, SOCK_DGRAM, 0, false /*fInheritable*/); 722 720 if (RT_SUCCESS(rc)) 723 721 { 724 RTSocketSetInheritance(Sock, false /* fInheritable */);725 722 if (pLocalAddr) 726 723 rc = rtSocketBind(Sock, pLocalAddr); -
trunk/src/VBox/Runtime/r3/win/RTHandleGetStandard-win.cpp
r96407 r96475 51 51 52 52 #include "internal/socket.h" /* (Needs Windows.h.) */ 53 #include "internal-r3-win.h" /* (Needs Windows.h.) */ 53 54 54 55 … … 77 78 return RTErrConvertFromWin32(GetLastError()); 78 79 79 DWORD dwInfo ;80 if ( !GetHandleInformation(hNative, &dwInfo))80 DWORD dwInfo = 0; 81 if (g_pfnGetHandleInformation && !g_pfnGetHandleInformation(hNative, &dwInfo)) 81 82 return RTErrConvertFromWin32(GetLastError()); 82 83 bool const fInherit = RT_BOOL(dwInfo & HANDLE_FLAG_INHERIT); 83 84 85 SetLastError(NO_ERROR); 84 86 RTHANDLE h; 85 87 DWORD dwType = GetFileType(hNative); 86 88 switch (dwType & ~FILE_TYPE_REMOTE) 87 89 { 90 case FILE_TYPE_UNKNOWN: 91 if (GetLastError() != NO_ERROR) 92 return RTErrConvertFromWin32(GetLastError()); 93 RT_FALL_THROUGH(); 88 94 default: 89 case FILE_TYPE_UNKNOWN:90 95 case FILE_TYPE_CHAR: 91 96 case FILE_TYPE_DISK: -
trunk/src/VBox/Runtime/r3/win/init-win.cpp
r96448 r96475 87 87 static LPTOP_LEVEL_EXCEPTION_FILTER g_pfnUnhandledXcptFilter = NULL; 88 88 /** SystemTimeToTzSpecificLocalTime. */ 89 DECL_HIDDEN_DATA(decltype(SystemTimeToTzSpecificLocalTime) *) g_pfnSystemTimeToTzSpecificLocalTime = NULL;89 DECL_HIDDEN_DATA(decltype(SystemTimeToTzSpecificLocalTime) *) g_pfnSystemTimeToTzSpecificLocalTime = NULL; 90 90 /** CreateWaitableTimerEx . */ 91 DECL_HIDDEN_DATA(PFNCREATEWAITABLETIMEREX) g_pfnCreateWaitableTimerExW = NULL; 91 DECL_HIDDEN_DATA(PFNCREATEWAITABLETIMEREX) g_pfnCreateWaitableTimerExW = NULL; 92 DECL_HIDDEN_DATA(decltype(GetHandleInformation) *) g_pfnGetHandleInformation = NULL; 93 DECL_HIDDEN_DATA(decltype(SetHandleInformation) *) g_pfnSetHandleInformation = NULL; 92 94 93 95 /** The native ntdll.dll handle. */ … … 122 124 /** WSAEnumNetworkEvents */ 123 125 DECL_HIDDEN_DATA(PFNWSAENUMNETWORKEVENTS) g_pfnWSAEnumNetworkEvents = NULL; 126 /** WSASocketW */ 127 DECL_HIDDEN_DATA(PFNWSASOCKETW) g_pfnWSASocketW = NULL; 124 128 /** WSASend */ 125 DECL_HIDDEN_DATA(PFNWSAS end) g_pfnWSASend = NULL;129 DECL_HIDDEN_DATA(PFNWSASEND) g_pfnWSASend = NULL; 126 130 /** socket */ 127 131 DECL_HIDDEN_DATA(PFNWINSOCKSOCKET) g_pfnsocket = NULL; … … 311 315 312 316 /* 313 * Use the NT version of GetVersionExW so we don't get fooled by314 * compatability shims.317 * Use the NT version of RtlGetVersion (since w2k) so we don't get fooled 318 * by compatability shims. 315 319 */ 316 320 RT_ZERO(g_WinOsInfoEx); … … 326 330 /* 327 331 * Couldn't find it or it failed, try the windows version of the API. 332 * The GetVersionExW API was added in NT 3.51. 328 333 */ 329 334 RT_ZERO(g_WinOsInfoEx); 330 335 g_WinOsInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); 331 if (!GetVersionExW((POSVERSIONINFOW)&g_WinOsInfoEx)) 336 337 BOOL (__stdcall *pfnGetVersionExW)(OSVERSIONINFOW *); 338 *(FARPROC *)&pfnGetVersionExW = GetProcAddress(g_hModKernel32, "GetVersionExW"); 339 340 if (!pfnGetVersionExW || !pfnGetVersionExW((POSVERSIONINFOW)&g_WinOsInfoEx)) 332 341 { 333 342 /* … … 336 345 RT_ZERO(g_WinOsInfoEx); 337 346 g_WinOsInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); 338 if ( GetVersionExW((POSVERSIONINFOW)&g_WinOsInfoEx))347 if (!pfnGetVersionExW || !pfnGetVersionExW((POSVERSIONINFOW)&g_WinOsInfoEx)) 339 348 Assert(g_WinOsInfoEx.dwPlatformId != VER_PLATFORM_WIN32_NT || g_WinOsInfoEx.dwMajorVersion < 5); 340 349 else 341 350 { 351 /* 352 * Okay, nothing worked, so use GetVersion. 353 * This should only happen if we're on NT 3.1 or NT 3.50. 354 * It should never happen for 64-bit builds. 355 */ 356 #ifdef RT_ARCH_X86 357 RT_ZERO(g_WinOsInfoEx); 358 DWORD const dwVersion = GetVersion(); 359 360 /* Common fields: */ 361 g_WinOsInfoEx.dwMajorVersion = dwVersion & 0xff; 362 g_WinOsInfoEx.dwMinorVersion = (dwVersion >> 8) & 0xff; 363 if (!(dwVersion & RT_BIT_32(31))) 364 g_WinOsInfoEx.dwBuildNumber = dwVersion >> 16; 365 else 366 g_WinOsInfoEx.dwBuildNumber = 511; 367 g_WinOsInfoEx.dwPlatformId = VER_PLATFORM_WIN32_NT; 368 g_WinOsInfoEx.wProductType = VER_NT_WORKSTATION; 369 /** @todo get CSD from registry. */ 370 #else 342 371 AssertBreakpoint(); 343 372 RT_ZERO(g_WinOsInfoEx); 373 #endif 344 374 } 345 375 } … … 389 419 g_pfnWSAEventSelect = (decltype(g_pfnWSAEventSelect)) GetProcAddress(g_hModWinSock, "WSAEventSelect"); 390 420 g_pfnWSAEnumNetworkEvents = (decltype(g_pfnWSAEnumNetworkEvents))GetProcAddress(g_hModWinSock,"WSAEnumNetworkEvents"); 421 g_pfnWSASocketW = (decltype(g_pfnWSASocketW)) GetProcAddress(g_hModWinSock, "WSASocketW"); 391 422 g_pfnWSASend = (decltype(g_pfnWSASend)) GetProcAddress(g_hModWinSock, "WSASend"); 392 423 g_pfnsocket = (decltype(g_pfnsocket)) GetProcAddress(g_hModWinSock, "socket"); … … 419 450 Assert(g_pfnWSAEventSelect || g_fOldWinSock); 420 451 Assert(g_pfnWSAEnumNetworkEvents || g_fOldWinSock); 452 Assert(g_pfnWSASocketW || g_fOldWinSock); 421 453 Assert(g_pfnWSASend || g_fOldWinSock); 422 454 Assert(g_pfnsocket); … … 530 562 * present in older windows versions. 531 563 */ 532 g_pfnGetSystemWindowsDirectoryW = (PFNGETWINSYSDIR)GetProcAddress(g_hModKernel32, "GetSystemWindowsDirectoryW");564 g_pfnGetSystemWindowsDirectoryW = (PFNGETWINSYSDIR)GetProcAddress(g_hModKernel32, "GetSystemWindowsDirectoryW"); 533 565 if (g_pfnGetSystemWindowsDirectoryW) 534 g_pfnGetSystemWindowsDirectoryW = (PFNGETWINSYSDIR)GetProcAddress(g_hModKernel32, "GetWindowsDirectoryW");566 g_pfnGetSystemWindowsDirectoryW = (PFNGETWINSYSDIR)GetProcAddress(g_hModKernel32, "GetWindowsDirectoryW"); 535 567 g_pfnSystemTimeToTzSpecificLocalTime = (decltype(SystemTimeToTzSpecificLocalTime) *)GetProcAddress(g_hModKernel32, "SystemTimeToTzSpecificLocalTime"); 536 g_pfnCreateWaitableTimerExW = (PFNCREATEWAITABLETIMEREX)GetProcAddress(g_hModKernel32, "CreateWaitableTimerExW"); 568 g_pfnCreateWaitableTimerExW = (PFNCREATEWAITABLETIMEREX) GetProcAddress(g_hModKernel32, "CreateWaitableTimerExW"); 569 g_pfnGetHandleInformation = (decltype(GetHandleInformation) *)GetProcAddress(g_hModKernel32, "GetHandleInformation"); 570 g_pfnSetHandleInformation = (decltype(SetHandleInformation) *)GetProcAddress(g_hModKernel32, "SetHandleInformation"); 571 Assert(g_pfnSetHandleInformation || g_enmWinVer < kRTWinOSType_NT351); 572 Assert(g_pfnGetHandleInformation || g_enmWinVer < kRTWinOSType_NT351); 537 573 538 574 /* 539 575 * Resolve some ntdll.dll APIs that weren't there in early NT versions. 540 576 */ 541 g_pfnNtQueryFullAttributesFile = (PFNNTQUERYFULLATTRIBUTESFILE)GetProcAddress(g_hModNtDll, "NtQueryFullAttributesFile");542 g_pfnNtDuplicateToken = (PFNNTDUPLICATETOKEN)GetProcAddress( g_hModNtDll, "NtDuplicateToken");543 g_pfnNtAlertThread = (decltype(NtAlertThread) *)GetProcAddress( g_hModNtDll, "NtAlertThread");577 g_pfnNtQueryFullAttributesFile = (PFNNTQUERYFULLATTRIBUTESFILE)GetProcAddress(g_hModNtDll, "NtQueryFullAttributesFile"); 578 g_pfnNtDuplicateToken = (PFNNTDUPLICATETOKEN)GetProcAddress( g_hModNtDll, "NtDuplicateToken"); 579 g_pfnNtAlertThread = (decltype(NtAlertThread) *)GetProcAddress( g_hModNtDll, "NtAlertThread"); 544 580 545 581 /* -
trunk/src/VBox/Runtime/r3/win/internal-r3-win.h
r96407 r96475 117 117 typedef UINT (WINAPI *PFNGETWINSYSDIR)(LPWSTR,UINT); 118 118 extern DECL_HIDDEN_DATA(PFNGETWINSYSDIR) g_pfnGetSystemWindowsDirectoryW; 119 extern DECL_HIDDEN_DATA(decltype(SystemTimeToTzSpecificLocalTime) *) g_pfnSystemTimeToTzSpecificLocalTime;119 extern DECL_HIDDEN_DATA(decltype(SystemTimeToTzSpecificLocalTime) *) g_pfnSystemTimeToTzSpecificLocalTime; 120 120 typedef HANDLE (WINAPI *PFNCREATEWAITABLETIMEREX)(LPSECURITY_ATTRIBUTES, LPCWSTR, DWORD, DWORD); 121 121 extern DECL_HIDDEN_DATA(PFNCREATEWAITABLETIMEREX) g_pfnCreateWaitableTimerExW; 122 extern DECL_HIDDEN_DATA(decltype(GetHandleInformation) *) g_pfnGetHandleInformation; 123 extern DECL_HIDDEN_DATA(decltype(SetHandleInformation) *) g_pfnSetHandleInformation; 124 typedef UINT (WINAPI *PFNGETWINSYSDIR)(LPWSTR,UINT); 125 extern DECL_HIDDEN_DATA(PFNGETWINSYSDIR) g_pfnGetSystemWindowsDirectoryW; 126 122 127 123 128 extern DECL_HIDDEN_DATA(HMODULE) g_hModNtDll; … … 150 155 /** WSAEnumNetworkEvents */ 151 156 typedef int (WINAPI *PFNWSAENUMNETWORKEVENTS)(UINT_PTR, HANDLE, struct _WSANETWORKEVENTS *); 157 /** WSASocketW */ 158 typedef UINT_PTR (WINAPI *PFNWSASOCKETW)(int, int, int, struct _WSAPROTOCOL_INFOW *, unsigned, DWORD); 152 159 /** WSASend */ 153 typedef int (WINAPI *PFNWSASend)(UINT_PTR, struct _WSABUF *, DWORD, LPDWORD, DWORD dwFlags, struct _OVERLAPPED *, uintptr_t /*LPWSAOVERLAPPED_COMPLETION_ROUTINE*/); 160 typedef int (WINAPI *PFNWSASEND)(UINT_PTR, struct _WSABUF *, DWORD, LPDWORD, DWORD dwFlags, 161 struct _OVERLAPPED *, uintptr_t /*LPWSAOVERLAPPED_COMPLETION_ROUTINE*/); 154 162 155 163 /** socket */ … … 201 209 extern DECL_HIDDEN_DATA(PFNWSAEVENTSELECT) g_pfnWSAEventSelect; 202 210 extern DECL_HIDDEN_DATA(PFNWSAENUMNETWORKEVENTS) g_pfnWSAEnumNetworkEvents; 203 extern DECL_HIDDEN_DATA(PFNWSASend) g_pfnWSASend; 211 extern DECL_HIDDEN_DATA(PFNWSASOCKETW) g_pfnWSASocketW; 212 extern DECL_HIDDEN_DATA(PFNWSASEND) g_pfnWSASend; 204 213 extern DECL_HIDDEN_DATA(PFNWINSOCKSOCKET) g_pfnsocket; 205 214 extern DECL_HIDDEN_DATA(PFNWINSOCKCLOSESOCKET) g_pfnclosesocket; -
trunk/src/VBox/Runtime/r3/win/pipe-win.cpp
r96407 r96475 520 520 FILE_PIPE_LOCAL_INFORMATION Info; 521 521 RT_ZERO(Info); 522 if ( g_ enmWinVer != kRTWinOSType_NT310522 if ( g_pfnSetHandleInformation 523 523 && rtPipeQueryNtInfo(pThis, &Info)) 524 524 rc = VINF_SUCCESS; … … 563 563 if ( RT_SUCCESS(rc) 564 564 && hNative2 == INVALID_HANDLE_VALUE 565 && ! SetHandleInformation(hNative,566 HANDLE_FLAG_INHERIT /*dwMask*/,567 fFlags & RTPIPE_N_INHERIT ? HANDLE_FLAG_INHERIT : 0))565 && !g_pfnSetHandleInformation(hNative, 566 HANDLE_FLAG_INHERIT /*dwMask*/, 567 fFlags & RTPIPE_N_INHERIT ? HANDLE_FLAG_INHERIT : 0)) 568 568 { 569 569 rc = RTErrConvertFromWin32(GetLastError()); -
trunk/src/VBox/Runtime/r3/win/process-win.cpp
r96407 r96475 2380 2380 if (*aphStds[i] != INVALID_HANDLE_VALUE) 2381 2381 { 2382 if ( g_enmWinVer == kRTWinOSType_NT310)2382 if (!g_pfnGetHandleInformation) 2383 2383 afInhStds[i] = 0; /* No handle info on NT 3.1, so ASSUME it is not inheritable. */ 2384 else if (! GetHandleInformation(*aphStds[i], &afInhStds[i]))2384 else if (!g_pfnGetHandleInformation(*aphStds[i], &afInhStds[i])) 2385 2385 { 2386 2386 rc = RTErrConvertFromWin32(GetLastError()); … … 2404 2404 && !(afInhStds[i] & HANDLE_FLAG_INHERIT)) 2405 2405 { 2406 if ( g_enmWinVer == kRTWinOSType_NT310)2406 if (!g_pfnSetHandleInformation) 2407 2407 { 2408 2408 if (DuplicateHandle(GetCurrentProcess(), *aphStds[i], GetCurrentProcess(), &ahStdDups[i], … … 2415 2415 } 2416 2416 } 2417 else if (! SetHandleInformation(*aphStds[i], HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT))2417 else if (!g_pfnSetHandleInformation(*aphStds[i], HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) 2418 2418 { 2419 2419 rc = RTErrConvertFromWin32(GetLastError()); … … 2529 2529 } 2530 2530 2531 if (g_ enmWinVer != kRTWinOSType_NT310)2531 if (g_pfnSetHandleInformation) 2532 2532 { 2533 2533 /* Undo any handle inherit changes. */ … … 2536 2536 && !(afInhStds[i] & HANDLE_FLAG_INHERIT)) 2537 2537 { 2538 if ( ! SetHandleInformation(*aphStds[i], HANDLE_FLAG_INHERIT, 0)2538 if ( !g_pfnSetHandleInformation(*aphStds[i], HANDLE_FLAG_INHERIT, 0) 2539 2539 && ( GetLastError() != ERROR_INVALID_FUNCTION 2540 2540 || g_enmWinVer != kRTWinOSType_NT310) )
Note:
See TracChangeset
for help on using the changeset viewer.