perl
view release on metacpan or search on metacpan
cpan/Win32/Win32.pm view on Meta::CPAN
sub SW_HIDE () { 0 }
sub SW_SHOWNORMAL () { 1 }
sub SW_SHOWMINIMIZED () { 2 }
sub SW_SHOWMAXIMIZED () { 3 }
sub SW_SHOWNOACTIVATE () { 4 }
sub CSIDL_DESKTOP () { 0x0000 } # <desktop>
sub CSIDL_PROGRAMS () { 0x0002 } # Start Menu\Programs
sub CSIDL_PERSONAL () { 0x0005 } # "My Documents" folder
sub CSIDL_FAVORITES () { 0x0006 } # <user name>\Favorites
sub CSIDL_STARTUP () { 0x0007 } # Start Menu\Programs\Startup
sub CSIDL_RECENT () { 0x0008 } # <user name>\Recent
sub CSIDL_SENDTO () { 0x0009 } # <user name>\SendTo
sub CSIDL_STARTMENU () { 0x000B } # <user name>\Start Menu
sub CSIDL_MYMUSIC () { 0x000D } # "My Music" folder
sub CSIDL_MYVIDEO () { 0x000E } # "My Videos" folder
sub CSIDL_DESKTOPDIRECTORY () { 0x0010 } # <user name>\Desktop
sub CSIDL_NETHOOD () { 0x0013 } # <user name>\nethood
sub CSIDL_FONTS () { 0x0014 } # windows\fonts
sub CSIDL_TEMPLATES () { 0x0015 }
sub CSIDL_COMMON_STARTMENU () { 0x0016 } # All Users\Start Menu
sub CSIDL_COMMON_PROGRAMS () { 0x0017 } # All Users\Start Menu\Programs
sub CSIDL_COMMON_STARTUP () { 0x0018 } # All Users\Startup
sub CSIDL_COMMON_DESKTOPDIRECTORY () { 0x0019 } # All Users\Desktop
sub CSIDL_APPDATA () { 0x001A } # Application Data, new for NT4
sub CSIDL_PRINTHOOD () { 0x001B } # <user name>\PrintHood
sub CSIDL_LOCAL_APPDATA () { 0x001C } # non roaming, user\Local Settings\Application Data
sub CSIDL_COMMON_FAVORITES () { 0x001F }
sub CSIDL_INTERNET_CACHE () { 0x0020 }
sub CSIDL_COOKIES () { 0x0021 }
sub CSIDL_HISTORY () { 0x0022 }
sub CSIDL_COMMON_APPDATA () { 0x0023 } # All Users\Application Data
sub CSIDL_WINDOWS () { 0x0024 } # GetWindowsDirectory()
sub CSIDL_SYSTEM () { 0x0025 } # GetSystemDirectory()
sub CSIDL_PROGRAM_FILES () { 0x0026 } # C:\Program Files
sub CSIDL_MYPICTURES () { 0x0027 } # "My Pictures", new for Win2K
sub CSIDL_PROFILE () { 0x0028 } # USERPROFILE
sub CSIDL_PROGRAM_FILES_COMMON () { 0x002B } # C:\Program Files\Common
sub CSIDL_COMMON_TEMPLATES () { 0x002D } # All Users\Templates
sub CSIDL_COMMON_DOCUMENTS () { 0x002E } # All Users\Documents
sub CSIDL_COMMON_ADMINTOOLS () { 0x002F } # All Users\Start Menu\Programs\Administrative Tools
sub CSIDL_ADMINTOOLS () { 0x0030 } # <user name>\Start Menu\Programs\Administrative Tools
sub CSIDL_COMMON_MUSIC () { 0x0035 } # All Users\My Music
sub CSIDL_COMMON_PICTURES () { 0x0036 } # All Users\My Pictures
sub CSIDL_COMMON_VIDEO () { 0x0037 } # All Users\My Video
sub CSIDL_RESOURCES () { 0x0038 } # %windir%\Resources\, For theme and other windows resources.
sub CSIDL_RESOURCES_LOCALIZED () { 0x0039 } # %windir%\Resources\<LangID>, for theme and other windows specific resources.
sub CSIDL_CDBURN_AREA () { 0x003B } # <user name>\Local Settings\Application Data\Microsoft\CD Burning
sub VER_NT_DOMAIN_CONTROLLER () { 0x0000002 } # The system is a domain controller and the operating system is Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
sub VER_NT_SERVER () { 0x0000003 } # The operating system is Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
# Note that a server that is also a domain controller is reported as VER_NT_DOMAIN_CONTROLLER, not VER_NT_SERVER.
sub VER_NT_WORKSTATION () { 0x0000001 } # The operating system is Windows Vista, Windows XP Professional, Windows XP Home Edition, or Windows 2000 Professional.
sub VER_SUITE_BACKOFFICE () { 0x00000004 } # Microsoft BackOffice components are installed.
sub VER_SUITE_BLADE () { 0x00000400 } # Windows Server 2003, Web Edition is installed.
sub VER_SUITE_COMPUTE_SERVER () { 0x00004000 } # Windows Server 2003, Compute Cluster Edition is installed.
sub VER_SUITE_DATACENTER () { 0x00000080 } # Windows Server 2008 Datacenter, Windows Server 2003, Datacenter Edition, or Windows 2000 Datacenter Server is installed.
sub VER_SUITE_ENTERPRISE () { 0x00000002 } # Windows Server 2008 Enterprise, Windows Server 2003, Enterprise Edition, or Windows 2000 Advanced Server is installed. Refer to the Remarks section for more information about this bit flag.
sub VER_SUITE_EMBEDDEDNT () { 0x00000040 } # Windows XP Embedded is installed.
sub VER_SUITE_PERSONAL () { 0x00000200 } # Windows Vista Home Premium, Windows Vista Home Basic, or Windows XP Home Edition is installed.
sub VER_SUITE_SINGLEUSERTS () { 0x00000100 } # Remote Desktop is supported, but only one interactive session is supported. This value is set unless the system is running in application server mode.
sub VER_SUITE_SMALLBUSINESS () { 0x00000001 } # Microsoft Small Business Server was once installed on the system, but may have been upgraded to another version of Windows. Refer to the Remarks section for more information about this bit fl...
sub VER_SUITE_SMALLBUSINESS_RESTRICTED () { 0x00000020 } # Microsoft Small Business Server is installed with the restrictive client license in force. Refer to the Remarks section for more information about this bit flag.
sub VER_SUITE_STORAGE_SERVER () { 0x00002000 } # Windows Storage Server 2003 R2 or Windows Storage Server 2003 is installed.
sub VER_SUITE_TERMINAL () { 0x00000010 } # Terminal Services is installed. This value is always set.
# If VER_SUITE_TERMINAL is set but VER_SUITE_SINGLEUSERTS is not set, the system is running in application server mode.
sub VER_SUITE_WH_SERVER () { 0x00008000 } # Windows Home Server is installed.
sub VER_SUITE_MULTIUSERTS () { 0x00020000 } # AppServer mode is enabled.
sub SM_TABLETPC () { 86 }
sub SM_MEDIACENTER () { 87 }
sub SM_STARTER () { 88 }
sub SM_SERVERR2 () { 89 }
sub PRODUCT_UNDEFINED () { 0x000 } # An unknown product
sub PRODUCT_ULTIMATE () { 0x001 } # Ultimate
sub PRODUCT_HOME_BASIC () { 0x002 } # Home Basic
sub PRODUCT_HOME_PREMIUM () { 0x003 } # Home Premium
sub PRODUCT_ENTERPRISE () { 0x004 } # Enterprise
sub PRODUCT_HOME_BASIC_N () { 0x005 } # Home Basic N
sub PRODUCT_BUSINESS () { 0x006 } # Business
sub PRODUCT_STANDARD_SERVER () { 0x007 } # Server Standard (full installation)
sub PRODUCT_DATACENTER_SERVER () { 0x008 } # Server Datacenter (full installation)
sub PRODUCT_SMALLBUSINESS_SERVER () { 0x009 } # Windows Small Business Server
sub PRODUCT_ENTERPRISE_SERVER () { 0x00A } # Server Enterprise (full installation)
sub PRODUCT_STARTER () { 0x00B } # Starter
sub PRODUCT_DATACENTER_SERVER_CORE () { 0x00C } # Server Datacenter (core installation)
sub PRODUCT_STANDARD_SERVER_CORE () { 0x00D } # Server Standard (core installation)
sub PRODUCT_ENTERPRISE_SERVER_CORE () { 0x00E } # Server Enterprise (core installation)
sub PRODUCT_ENTERPRISE_SERVER_IA64 () { 0x00F } # Server Enterprise for Itanium-based Systems
sub PRODUCT_BUSINESS_N () { 0x010 } # Business N
sub PRODUCT_WEB_SERVER () { 0x011 } # Web Server (full installation)
sub PRODUCT_CLUSTER_SERVER () { 0x012 } # HPC Edition
sub PRODUCT_HOME_SERVER () { 0x013 } # Home Server Edition
sub PRODUCT_STORAGE_EXPRESS_SERVER () { 0x014 } # Storage Server Express
sub PRODUCT_STORAGE_STANDARD_SERVER () { 0x015 } # Storage Server Standard
sub PRODUCT_STORAGE_WORKGROUP_SERVER () { 0x016 } # Storage Server Workgroup
sub PRODUCT_STORAGE_ENTERPRISE_SERVER () { 0x017 } # Storage Server Enterprise
sub PRODUCT_SERVER_FOR_SMALLBUSINESS () { 0x018 } # Windows Server 2008 for Windows Essential Server Solutions
sub PRODUCT_SMALLBUSINESS_SERVER_PREMIUM () { 0x019 } # Windows Small Business Server Premium
sub PRODUCT_HOME_PREMIUM_N () { 0x01A } # Home Premium N
sub PRODUCT_ENTERPRISE_N () { 0x01B } # Enterprise N
sub PRODUCT_ULTIMATE_N () { 0x01C } # Ultimate N
sub PRODUCT_WEB_SERVER_CORE () { 0x01D } # Web Server (core installation)
sub PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT () { 0x01E } # Windows Essential Business Server Management Server
sub PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY () { 0x01F } # Windows Essential Business Server Security Server
sub PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING () { 0x020 } # Windows Essential Business Server Messaging Server
sub PRODUCT_SERVER_FOUNDATION () { 0x021 } # Server Foundation
#define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
sub PRODUCT_SERVER_FOR_SMALLBUSINESS_V () { 0x023 } # Windows Server 2008 without Hyper-V for Windows Essential Server Solutions
sub PRODUCT_STANDARD_SERVER_V () { 0x024 } # Server Standard without Hyper-V (full installation)
sub PRODUCT_DATACENTER_SERVER_V () { 0x025 } # Server Datacenter without Hyper-V (full installation)
sub PRODUCT_ENTERPRISE_SERVER_V () { 0x026 } # Server Enterprise without Hyper-V (full installation)
sub PRODUCT_DATACENTER_SERVER_CORE_V () { 0x027 } # Server Datacenter without Hyper-V (core installation)
sub PRODUCT_STANDARD_SERVER_CORE_V () { 0x028 } # Server Standard without Hyper-V (core installation)
sub PRODUCT_ENTERPRISE_SERVER_CORE_V () { 0x029 } # Server Enterprise without Hyper-V (core installation)
sub PRODUCT_HYPERV () { 0x02A } # Microsoft Hyper-V Server
#define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
#define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
#define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
#define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
sub PRODUCT_STARTER_N () { 0x02F } # Starter N
sub PRODUCT_PROFESSIONAL () { 0x030 } # Professional
sub PRODUCT_PROFESSIONAL_N () { 0x031 } # Professional N
#define PRODUCT_SB_SOLUTION_SERVER 0x00000032
#define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
#define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
#define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
#define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
#define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
#define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
#define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
#define PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A
#define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
#define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
#define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
#define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
#define PRODUCT_CLUSTER_SERVER_V 0x00000040
#define PRODUCT_EMBEDDED 0x00000041
sub PRODUCT_STARTER_E () { 0x042 } # Starter E
sub PRODUCT_HOME_BASIC_E () { 0x043 } # Home Basic E
sub PRODUCT_HOME_PREMIUM_E () { 0x044 } # Home Premium E
sub PRODUCT_PROFESSIONAL_E () { 0x045 } # Professional E
sub PRODUCT_ENTERPRISE_E () { 0x046 } # Enterprise E
sub PRODUCT_ULTIMATE_E () { 0x047 } # Ultimate E
#define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
#define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
#define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
#define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
#define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
#define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
#define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
#define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
#define PRODUCT_THINPC 0x00000057
#define PRODUCT_EMBEDDED_A 0x00000058
#define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
#define PRODUCT_EMBEDDED_E 0x0000005A
#define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
#define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
#define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
#define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
#define PRODUCT_CORE_ARM 0x00000061
sub PRODUCT_CORE_N () { 0x62 } # Windows 10 Home N
sub PRODUCT_CORE_COUNTRYSPECIFIC () { 0x63 } # Windows 10 Home China
sub PRODUCT_CORE_SINGLELANGUAGE () { 0x64 } # Windows 10 Home Single Language
sub PRODUCT_CORE () { 0x65 } # Windows 10 Home
#define PRODUCT_PROFESSIONAL_WMC 0x00000067
#define PRODUCT_MOBILE_CORE 0x00000068
#define PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069
#define PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A
#define PRODUCT_EMBEDDED_EVAL 0x0000006B
#define PRODUCT_EMBEDDED_E_EVAL 0x0000006C
#define PRODUCT_NANO_SERVER 0x0000006D
#define PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E
#define PRODUCT_CORE_CONNECTED 0x0000006F
#define PRODUCT_PROFESSIONAL_STUDENT 0x00000070
#define PRODUCT_CORE_CONNECTED_N 0x00000071
#define PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072
#define PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073
#define PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074
#define PRODUCT_CONNECTED_CAR 0x00000075
#define PRODUCT_INDUSTRY_HANDHELD 0x00000076
#define PRODUCT_PPI_PRO 0x00000077
#define PRODUCT_ARM64_SERVER 0x00000078
sub PRODUCT_EDUCATION () { 0x79 } # Windows 10 Education
sub PRODUCT_EDUCATION_N () { 0x7A } # Windows 10 Education N
#define PRODUCT_IOTUAP 0x0000007B
#define PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C
#define PRODUCT_ENTERPRISE_S 0x0000007D
#define PRODUCT_ENTERPRISE_S_N 0x0000007E
#define PRODUCT_PROFESSIONAL_S 0x0000007F
#define PRODUCT_PROFESSIONAL_S_N 0x00000080
#define PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081
#define PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082
sub PRODUCT_UNLICENSED () { 0xABCDABCD } # product has not been activated and is no longer in the grace period
sub PROCESSOR_ARCHITECTURE_ARM64 () { 12 } # ARM64
sub PROCESSOR_ARCHITECTURE_ARM () { 5 } # ARM
sub PROCESSOR_ARCHITECTURE_AMD64 () { 9 } # x64 (AMD or Intel)
sub PROCESSOR_ARCHITECTURE_IA64 () { 6 } # Intel Itanium Processor Family (IPF)
sub PROCESSOR_ARCHITECTURE_INTEL () { 0 } # x86
sub PROCESSOR_ARCHITECTURE_UNKNOWN () { 0xffff } # Unknown architecture.
sub _GetProcessorArchitecture {
my $arch = {
386 => PROCESSOR_ARCHITECTURE_INTEL,
486 => PROCESSOR_ARCHITECTURE_INTEL,
586 => PROCESSOR_ARCHITECTURE_INTEL,
2200 => PROCESSOR_ARCHITECTURE_IA64,
8664 => PROCESSOR_ARCHITECTURE_AMD64,
}->{Win32::GetChipName()};
if (!defined($arch)) {
$arch = {
5 => PROCESSOR_ARCHITECTURE_ARM,
12 => PROCESSOR_ARCHITECTURE_ARM64,
}->{Win32::GetChipArch()};
}
return defined($arch) ? $arch : PROCESSOR_ARCHITECTURE_UNKNOWN;
}
### This method is just a simple interface into GetOSVersion(). More
### specific or demanding situations should use that instead.
my ($cached_os, $cached_desc);
sub GetOSName {
unless (defined $cached_os) {
my($desc, $major, $minor, $build, $id, undef, undef, $suitemask, $producttype)
= Win32::GetOSVersion();
cpan/Win32/Win32.pm view on Meta::CPAN
Windows NT 3.51 2 3 51 -
Windows NT 4 2 4 0 -
Windows 2000 2 5 0 -
Windows XP 2 5 1 -
Windows Server 2003 2 5 2 -
Windows Server 2003 R2 2 5 2 -
Windows Home Server 2 5 2 -
Windows Vista 2 6 0 -
Windows Server 2008 2 6 0 -
Windows 7 2 6 1 -
Windows Server 2008 R2 2 6 1 -
Windows 8 2 6 2 -
Windows Server 2012 2 6 2 -
Windows 8.1 2 6 2 -
Windows Server 2012 R2 2 6 2 -
Windows 10 2 10 0 -
Windows Server 2016 2 10 0 14393
Windows Server 2019 2 10 0 17677
On Windows NT 4 SP6 and later this function returns the following
additional values: SPMAJOR, SPMINOR, SUITEMASK, PRODUCTTYPE.
The version numbers for Windows 2003 and Windows Home Server are
identical; the SUITEMASK field must be used to differentiate between
them.
The version numbers for Windows Vista and Windows Server 2008 are
identical; the PRODUCTTYPE field must be used to differentiate between
them.
The version numbers for Windows 7 and Windows Server 2008 R2 are
identical; the PRODUCTTYPE field must be used to differentiate between
them.
The version numbers for Windows 8 and Windows Server 2012 are
identical; the PRODUCTTYPE field must be used to differentiate between
them.
For modern Windows releases, the major and minor version numbers are
identical. The PRODUCTTYPE field must be used to differentiate between
Windows 10 and Server releases. The BUILD field is used to
differentiate Windows Server versions: currently 2016, 2019, and
Semi-Annual Channel releases.
SPMAJOR and SPMINOR are the version numbers of the latest
installed service pack. (In the Windows 10 era, these are unused.)
SUITEMASK is a bitfield identifying the product suites available on
the system. Known bits are:
VER_SUITE_SMALLBUSINESS 0x00000001
VER_SUITE_ENTERPRISE 0x00000002
VER_SUITE_BACKOFFICE 0x00000004
VER_SUITE_COMMUNICATIONS 0x00000008
VER_SUITE_TERMINAL 0x00000010
VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
VER_SUITE_EMBEDDEDNT 0x00000040
VER_SUITE_DATACENTER 0x00000080
VER_SUITE_SINGLEUSERTS 0x00000100
VER_SUITE_PERSONAL 0x00000200
VER_SUITE_BLADE 0x00000400
VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
VER_SUITE_SECURITY_APPLIANCE 0x00001000
VER_SUITE_STORAGE_SERVER 0x00002000
VER_SUITE_COMPUTE_SERVER 0x00004000
VER_SUITE_WH_SERVER 0x00008000
VER_SUITE_MULTIUSERTS 0x00020000
The VER_SUITE_xxx names are listed here to cross reference the Microsoft
documentation. The Win32 module does not provide symbolic names for these
constants.
PRODUCTTYPE provides additional information about the system. It should
be one of the following integer values:
1 - Workstation (NT 4, 2000 Pro, XP Home, XP Pro, Vista, etc)
2 - Domaincontroller
3 - Server (2000 Server, Server 2003, Server 2008, etc)
Note that a server that is also a domain controller is reported as
PRODUCTTYPE 2 (Domaincontroller) and not PRODUCTTYPE 3 (Server).
=item Win32::GetShortPathName(PATHNAME)
[CORE] Returns a representation of PATHNAME that is composed of short
(8.3) path components where available. For path components where the
file system has not generated the short form the returned path will
use the long form, so this function might still for instance return a
path containing spaces. Returns C<undef> when the PATHNAME does not
exist. Compare with Win32::GetFullPathName() and
Win32::GetLongPathName().
=item Win32::GetSystemMetrics(INDEX)
Retrieves the specified system metric or system configuration setting.
Please refer to the Microsoft documentation of the GetSystemMetrics()
function for a reference of available INDEX values. All system
metrics return integer values.
=item Win32::GetProcAddress(INSTANCE, PROCNAME)
Returns the address of a function inside a loaded library. The
information about what you can do with this address has been lost in
the mist of time. Use the Win32::API module instead of this deprecated
function.
=item Win32::GetProcessPrivileges([PID])
Returns a reference to a hash holding the information about the privileges
held by the specified process. The keys are privilege names, and the values
are booleans indicating whether a given privilege is currently enabled or not.
If the optional PID parameter is omitted, the function queries the current
process.
Example return value:
{
SeTimeZonePrivilege => 0,
SeShutdownPrivilege => 0,
SeUndockPrivilege => 0,
SeIncreaseWorkingSetPrivilege => 0,
( run in 0.912 second using v1.01-cache-2.11-cpan-71847e10f99 )