Skip to content

Commit f506624

Browse files
committed
fix SILOOBJECT_BASIC_INFORMATION alignment
Signed-off-by: qmuntal <[email protected]>
1 parent 060de7c commit f506624

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

internal/jobobject/jobobject.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,16 @@ func (job *JobObject) ApplyFileBinding(root, target string, readOnly bool) error
523523
func isJobSilo(h windows.Handle) bool {
524524
// None of the information from the structure that this info class expects will be used, this is just used as
525525
// the call will fail if the job hasn't been upgraded to a silo so we can use this to tell when we open a job
526-
// if it's a silo or not. Because none of the info matters simply define a dummy struct with the size that the call
527-
// expects which is 16 bytes.
528-
type isSiloObj struct {
529-
_ [16]byte
530-
}
531-
var siloInfo isSiloObj
526+
// if it's a silo or not. We still need to define the struct layout as expected by Win32, else the struct
527+
// alignment might be different and the call will fail.
528+
type SILOOBJECT_BASIC_INFORMATION struct {
529+
SiloID uint32
530+
SiloParentID uint32
531+
NumberOfProcesses uint32
532+
IsInServerSilo bool
533+
Reserved [3]uint8
534+
}
535+
var siloInfo SILOOBJECT_BASIC_INFORMATION
532536
err := winapi.QueryInformationJobObject(
533537
h,
534538
winapi.JobObjectSiloBasicInformation,

0 commit comments

Comments
 (0)