@@ -319,17 +319,6 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle
319
319
}
320
320
}
321
321
322
- var maj , min , build uint32
323
- rtlGetNtVersionNumbers (& maj , & min , & build )
324
- isWin7 := maj < 6 || (maj == 6 && min <= 1 )
325
- // NT kernel handles are divisible by 4, with the bottom 3 bits left as
326
- // a tag. The fully set tag correlates with the types of handles we're
327
- // concerned about here. Except, the kernel will interpret some
328
- // special handle values, like -1, -2, and so forth, so kernelbase.dll
329
- // checks to see that those bottom three bits are checked, but that top
330
- // bit is not checked.
331
- isLegacyWin7ConsoleHandle := func (handle Handle ) bool { return isWin7 && handle & 0x10000003 == 3 }
332
-
333
322
p , _ := GetCurrentProcess ()
334
323
parentProcess := p
335
324
if sys .ParentProcess != 0 {
@@ -338,15 +327,7 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle
338
327
fd := make ([]Handle , len (attr .Files ))
339
328
for i := range attr .Files {
340
329
if attr .Files [i ] > 0 {
341
- destinationProcessHandle := parentProcess
342
-
343
- // On Windows 7, console handles aren't real handles, and can only be duplicated
344
- // into the current process, not a parent one, which amounts to the same thing.
345
- if parentProcess != p && isLegacyWin7ConsoleHandle (Handle (attr .Files [i ])) {
346
- destinationProcessHandle = p
347
- }
348
-
349
- err := DuplicateHandle (p , Handle (attr .Files [i ]), destinationProcessHandle , & fd [i ], 0 , true , DUPLICATE_SAME_ACCESS )
330
+ err := DuplicateHandle (p , Handle (attr .Files [i ]), parentProcess , & fd [i ], 0 , true , DUPLICATE_SAME_ACCESS )
350
331
if err != nil {
351
332
return 0 , 0 , err
352
333
}
@@ -377,14 +358,6 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle
377
358
378
359
fd = append (fd , sys .AdditionalInheritedHandles ... )
379
360
380
- // On Windows 7, console handles aren't real handles, so don't pass them
381
- // through to PROC_THREAD_ATTRIBUTE_HANDLE_LIST.
382
- for i := range fd {
383
- if isLegacyWin7ConsoleHandle (fd [i ]) {
384
- fd [i ] = 0
385
- }
386
- }
387
-
388
361
// The presence of a NULL handle in the list is enough to cause PROC_THREAD_ATTRIBUTE_HANDLE_LIST
389
362
// to treat the entire list as empty, so remove NULL handles.
390
363
j := 0
0 commit comments