001/**
002 * Copyright 2012 Emmanuel Bourg
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http:/**www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package net.jsign.pe;
018
019/**
020 * The subsystem of an executable file.
021 * 
022 * @author Emmanuel Bourg
023 * @since 1.0
024 */
025public enum Subsystem {
026
027    /** An unknown subsystem */
028    UNKNOWN(0),
029    /** Device drivers and native Windows processes */
030    NATIVE(1),
031    /** The Windows graphical user interface (GUI) subsystem */
032    WINDOWS_GUI(2),
033    /** The Windows character subsystem */
034    WINDOWS_CUI(3),
035    /** The Posix character subsystem */
036    POSIX_CUI(7),
037    /** Windows CE */
038    WINDOWS_CE_GUI(9),
039    /** An Extensible Firmware Interface (EFI) application */
040    EFI_APPLICATION(10),
041    /** An EFI driver with boot services */
042    EFI_BOOT_SERVICE_DRIVER(11),
043    /** An EFI driver with run-time services */
044    EFI_RUNTIME_DRIVER(12),
045    /** An EFI ROM image */
046    EFI_ROM(13),
047    /** XBOX */
048    XBOX(14);
049
050    final int value;
051
052    Subsystem(int value) {
053        this.value = value;
054    }
055
056    static Subsystem valueOf(int value) {
057        for (Subsystem format : values()) {
058            if (format.value == value) {
059                return format;
060            }
061        }
062
063        return null;
064    }
065}