github.com/iDigitalFlame/xmt@v0.5.4/device/local/z_arch_windows.go (about)

     1  //go:build windows && (386 || arm)
     2  // +build windows
     3  // +build 386 arm
     4  
     5  // Copyright (C) 2020 - 2023 iDigitalFlame
     6  //
     7  // This program is free software: you can redistribute it and/or modify
     8  // it under the terms of the GNU General Public License as published by
     9  // the Free Software Foundation, either version 3 of the License, or
    10  // any later version.
    11  //
    12  // This program is distributed in the hope that it will be useful,
    13  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    14  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15  // GNU General Public License for more details.
    16  //
    17  // You should have received a copy of the GNU General Public License
    18  // along with this program.  If not, see <https://www.gnu.org/licenses/>.
    19  //
    20  
    21  package local
    22  
    23  import (
    24  	"github.com/iDigitalFlame/xmt/device"
    25  	"github.com/iDigitalFlame/xmt/device/arch"
    26  	"github.com/iDigitalFlame/xmt/device/winapi"
    27  )
    28  
    29  func systemType() uint8 {
    30  	// NOTE(dij): Check if we're running under WOW64 and report the /actual/
    31  	//            system arch, since we only know what we've been built as.
    32  	//            Apparently applies to x86 AND ARM!
    33  	switch r, _ := winapi.InWow64Process(); {
    34  	case r && arch.Current == arch.X86:
    35  		return uint8(uint8(device.OS)<<4 | uint8(arch.X86OnX64))
    36  	case r && arch.Current == arch.ARM:
    37  		return uint8(uint8(device.OS)<<4 | uint8(arch.ARMOnARM64))
    38  	}
    39  	return uint8(uint8(device.OS)<<4 | uint8(arch.Current))
    40  }