pkg/system: remove deprecated/unused consts and move IsWindowsClient()
- [x] follow-up (first commit is from that PR) to https://github.com/moby/moby/pull/43321

### pkg/system: remove deprecated (and unused) windows consts

These consts were deprecated in https://github.com/moby/moby/commit/46c591b045a77b7f0f96f96a51d8304264685929 (https://github.com/moby/moby/pull/42535), and although that has not been in a release yet (we usually deprecate for at least one release before removing), doing a search showed that there were no external consumers of these consts, so it should be fine to remove them.

This patch removes the consts that were moded to pkg/idtools;

- `SeTakeOwnershipPrivilege`
- `ContainerAdministratorSidString`
- `ContainerUserSidString`

### pkg/system: move IsWindowsClient to pkg/parsers/operatingsystem

This function was only used in a single place, and pkg/parsers/operatingsystem already copied the `verNTWorkstation` const, so we might as well move this function there as well to unclutter pkg/system.

The function had no external users, so not adding an alias / stub.
pkg/parsers/operatingsystem/operatingsystem_windows.go
package operatingsystem // import "github.com/docker/docker/pkg/parsers/operatingsystem"

import (
	"errors"

	"github.com/Microsoft/hcsshim/osversion"
	"golang.org/x/sys/windows"
	"golang.org/x/sys/windows/registry"
)

// VER_NT_WORKSTATION, see https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexa
const verNTWorkstation = 0x00000001 // VER_NT_WORKSTATION

// GetOperatingSystem gets the name of the current operating system.
func GetOperatingSystem() (string, error) {
	osversion := windows.RtlGetVersion() // Always succeeds.
	rel := windowsOSRelease{
		IsServer: osversion.ProductType != verNTWorkstation,
		Build:    osversion.BuildNumber,
	}

	// Make a best-effort attempt to retrieve the display version and
	// Update Build Revision by querying undocumented registry values.
	key, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
	if err == nil {
		defer key.Close()
		if ver, err := getFirstStringValue(key,
			"DisplayVersion", /* Windows 20H2 and above */
			"ReleaseId",      /* Windows 2009 and below */
		); err == nil {
			rel.DisplayVersion = ver
		}
		if ubr, _, err := key.GetIntegerValue("UBR"); err == nil {
			rel.UBR = ubr
		}
	}

	return rel.String(), nil
}

func getFirstStringValue(key registry.Key, names ...string) (string, error) {
	for _, n := range names {
		val, _, err := key.GetStringValue(n)
		if err != nil {
			if !errors.Is(err, registry.ErrNotExist) {
				return "", err
			}
			continue
		}
		return val, nil
	}
	return "", registry.ErrNotExist
}

// GetOperatingSystemVersion gets the version of the current operating system, as a string.
func GetOperatingSystemVersion() (string, error) {
	return osversion.Get().ToString(), nil
}

// IsContainerized returns true if we are running inside a container.
// No-op on Windows, always returns false.
func IsContainerized() (bool, error) {
	return false, nil
}

package operatingsystem // import "github.com/docker/docker/pkg/parsers/operatingsystem"

import (
	"errors"

	"github.com/Microsoft/hcsshim/osversion"
	"golang.org/x/sys/windows"
	"golang.org/x/sys/windows/registry"
)

// VER_NT_WORKSTATION, see https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoexa
const verNTWorkstation = 0x00000001 // VER_NT_WORKSTATION

// GetOperatingSystem gets the name of the current operating system.
func GetOperatingSystem() (string, error) {
	osversion := windows.RtlGetVersion() // Always succeeds.
	rel := windowsOSRelease{
		IsServer: osversion.ProductType != verNTWorkstation,
		Build:    osversion.BuildNumber,
	}

	// Make a best-effort attempt to retrieve the display version and
	// Update Build Revision by querying undocumented registry values.
	key, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
	if err == nil {
		defer key.Close()
		if ver, err := getFirstStringValue(key,
			"DisplayVersion", /* Windows 20H2 and above */
			"ReleaseId",      /* Windows 2009 and below */
		); err == nil {
			rel.DisplayVersion = ver
		}
		if ubr, _, err := key.GetIntegerValue("UBR"); err == nil {
			rel.UBR = ubr
		}
	}

	return rel.String(), nil
}

func getFirstStringValue(key registry.Key, names ...string) (string, error) {
	for _, n := range names {
		val, _, err := key.GetStringValue(n)
		if err != nil {
			if !errors.Is(err, registry.ErrNotExist) {
				return "", err
			}
			continue
		}
		return val, nil
	}
	return "", registry.ErrNotExist
}

// GetOperatingSystemVersion gets the version of the current operating system, as a string.
func GetOperatingSystemVersion() (string, error) {
	return osversion.Get().ToString(), nil
}

// IsContainerized returns true if we are running inside a container.
// No-op on Windows, always returns false.
func IsContainerized() (bool, error) {
	return false, nil
}

// IsWindowsClient returns true if the SKU is client. It returns false on
// Windows server.
func IsWindowsClient() bool {
	return windows.RtlGetVersion().ProductType == verNTWorkstation
}

It was there originally because of the (incorrect) assumption it could return `nil`, but it always returns a value; https://github.com/moby/moby/blob/0d04359ec2a190c0eecc0cb3c43eae95eb57de60/vendor/golang.org/x/sys/windows/syscall_windows.go#L1489-L1500