← Index
NYTProf Performance Profile   « line view »
For Makefile.PL
  Run on Sun Mar 1 16:04:44 2015
Reported on Sun Mar 1 16:09:02 2015

FilenameC:/tmp64ng/perl/lib/Win32.pm
StatementsExecuted 16 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1110s0sWin32::::BEGIN@4Win32::BEGIN@4
1110s0sWin32::::BEGIN@5Win32::BEGIN@5
0000s0sWin32::::DACL_SECURITY_INFORMATIONWin32::DACL_SECURITY_INFORMATION
0000s0sWin32::::GROUP_SECURITY_INFORMATIONWin32::GROUP_SECURITY_INFORMATION
15110s0sWin32::::GetCwdWin32::GetCwd (xsub)
0000s0sWin32::::GetOSDisplayNameWin32::GetOSDisplayName
0000s0sWin32::::GetOSNameWin32::GetOSName
6110s0sWin32::::GetShortPathNameWin32::GetShortPathName (xsub)
1110s0sWin32::::IsWin95Win32::IsWin95 (xsub)
0000s0sWin32::::MB_ICONASTERISKWin32::MB_ICONASTERISK
0000s0sWin32::::MB_ICONERRORWin32::MB_ICONERROR
0000s0sWin32::::MB_ICONEXCLAMATIONWin32::MB_ICONEXCLAMATION
0000s0sWin32::::MB_ICONHANDWin32::MB_ICONHAND
0000s0sWin32::::MB_ICONINFORMATIONWin32::MB_ICONINFORMATION
0000s0sWin32::::MB_ICONQUESTIONWin32::MB_ICONQUESTION
0000s0sWin32::::MB_ICONSTOPWin32::MB_ICONSTOP
0000s0sWin32::::MB_ICONWARNINGWin32::MB_ICONWARNING
0000s0sWin32::::NULLWin32::NULL
0000s0sWin32::::OWNER_SECURITY_INFORMATIONWin32::OWNER_SECURITY_INFORMATION
0000s0sWin32::::SACL_SECURITY_INFORMATIONWin32::SACL_SECURITY_INFORMATION
0000s0sWin32::::WIN31_CLASSWin32::WIN31_CLASS
0000s0sWin32::::_GetOSNameWin32::_GetOSName
0000s0sWin32::::_GetProcessorArchitectureWin32::_GetProcessorArchitecture
0000s0sWin32::::_GetSystemMetricsWin32::_GetSystemMetrics
1110s0sWin32::::bootstrapWin32::bootstrap (xsub)
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Win32;
2
3# BEGIN {
420s20s
# spent 0s within Win32::BEGIN@4 which was called: # once (0s+0s) by ExtUtils::MM::_is_win95 at line 4
use strict;
# spent 0s making 1 call to Win32::BEGIN@4 # spent 0s making 1 call to strict::import
520s20s
# spent 0s within Win32::BEGIN@5 which was called: # once (0s+0s) by ExtUtils::MM::_is_win95 at line 5
use vars qw|$VERSION $XS_VERSION @ISA @EXPORT @EXPORT_OK|;
# spent 0s making 1 call to Win32::BEGIN@5 # spent 0s making 1 call to vars::import
6
710s require Exporter;
810s require DynaLoader;
9
1010s @ISA = qw|Exporter DynaLoader|;
1110s $VERSION = '0.51';
1210s $XS_VERSION = $VERSION;
1310s $VERSION = eval $VERSION;
# spent 0s executing statements in string eval
14
1510s @EXPORT = qw(
16 NULL
17 WIN31_CLASS
18 OWNER_SECURITY_INFORMATION
19 GROUP_SECURITY_INFORMATION
20 DACL_SECURITY_INFORMATION
21 SACL_SECURITY_INFORMATION
22 MB_ICONHAND
23 MB_ICONQUESTION
24 MB_ICONEXCLAMATION
25 MB_ICONASTERISK
26 MB_ICONWARNING
27 MB_ICONERROR
28 MB_ICONINFORMATION
29 MB_ICONSTOP
30 );
3110s @EXPORT_OK = qw(
32 GetOSName
33 SW_HIDE
34 SW_SHOWNORMAL
35 SW_SHOWMINIMIZED
36 SW_SHOWMAXIMIZED
37 SW_SHOWNOACTIVATE
38
39 CSIDL_DESKTOP
40 CSIDL_PROGRAMS
41 CSIDL_PERSONAL
42 CSIDL_FAVORITES
43 CSIDL_STARTUP
44 CSIDL_RECENT
45 CSIDL_SENDTO
46 CSIDL_STARTMENU
47 CSIDL_MYMUSIC
48 CSIDL_MYVIDEO
49 CSIDL_DESKTOPDIRECTORY
50 CSIDL_NETHOOD
51 CSIDL_FONTS
52 CSIDL_TEMPLATES
53 CSIDL_COMMON_STARTMENU
54 CSIDL_COMMON_PROGRAMS
55 CSIDL_COMMON_STARTUP
56 CSIDL_COMMON_DESKTOPDIRECTORY
57 CSIDL_APPDATA
58 CSIDL_PRINTHOOD
59 CSIDL_LOCAL_APPDATA
60 CSIDL_COMMON_FAVORITES
61 CSIDL_INTERNET_CACHE
62 CSIDL_COOKIES
63 CSIDL_HISTORY
64 CSIDL_COMMON_APPDATA
65 CSIDL_WINDOWS
66 CSIDL_SYSTEM
67 CSIDL_PROGRAM_FILES
68 CSIDL_MYPICTURES
69 CSIDL_PROFILE
70 CSIDL_PROGRAM_FILES_COMMON
71 CSIDL_COMMON_TEMPLATES
72 CSIDL_COMMON_DOCUMENTS
73 CSIDL_COMMON_ADMINTOOLS
74 CSIDL_ADMINTOOLS
75 CSIDL_COMMON_MUSIC
76 CSIDL_COMMON_PICTURES
77 CSIDL_COMMON_VIDEO
78 CSIDL_RESOURCES
79 CSIDL_RESOURCES_LOCALIZED
80 CSIDL_CDBURN_AREA
81 );
82# }
83
84# We won't bother with the constant stuff, too much of a hassle. Just hard
85# code it here.
86
87sub NULL { 0 }
88sub WIN31_CLASS { &NULL }
89
90sub OWNER_SECURITY_INFORMATION { 0x00000001 }
91sub GROUP_SECURITY_INFORMATION { 0x00000002 }
92sub DACL_SECURITY_INFORMATION { 0x00000004 }
93sub SACL_SECURITY_INFORMATION { 0x00000008 }
94
95sub MB_ICONHAND { 0x00000010 }
96sub MB_ICONQUESTION { 0x00000020 }
97sub MB_ICONEXCLAMATION { 0x00000030 }
98sub MB_ICONASTERISK { 0x00000040 }
99sub MB_ICONWARNING { 0x00000030 }
100sub MB_ICONERROR { 0x00000010 }
101sub MB_ICONINFORMATION { 0x00000040 }
102sub MB_ICONSTOP { 0x00000010 }
103
104#
105# Newly added constants. These have an empty prototype, unlike the
106# the ones above, which aren't prototyped for compatibility reasons.
107#
108sub SW_HIDE () { 0 }
109sub SW_SHOWNORMAL () { 1 }
110sub SW_SHOWMINIMIZED () { 2 }
111sub SW_SHOWMAXIMIZED () { 3 }
112sub SW_SHOWNOACTIVATE () { 4 }
113
114sub CSIDL_DESKTOP () { 0x0000 } # <desktop>
115sub CSIDL_PROGRAMS () { 0x0002 } # Start Menu\Programs
116sub CSIDL_PERSONAL () { 0x0005 } # "My Documents" folder
117sub CSIDL_FAVORITES () { 0x0006 } # <user name>\Favorites
118sub CSIDL_STARTUP () { 0x0007 } # Start Menu\Programs\Startup
119sub CSIDL_RECENT () { 0x0008 } # <user name>\Recent
120sub CSIDL_SENDTO () { 0x0009 } # <user name>\SendTo
121sub CSIDL_STARTMENU () { 0x000B } # <user name>\Start Menu
122sub CSIDL_MYMUSIC () { 0x000D } # "My Music" folder
123sub CSIDL_MYVIDEO () { 0x000E } # "My Videos" folder
124sub CSIDL_DESKTOPDIRECTORY () { 0x0010 } # <user name>\Desktop
125sub CSIDL_NETHOOD () { 0x0013 } # <user name>\nethood
126sub CSIDL_FONTS () { 0x0014 } # windows\fonts
127sub CSIDL_TEMPLATES () { 0x0015 }
128sub CSIDL_COMMON_STARTMENU () { 0x0016 } # All Users\Start Menu
129sub CSIDL_COMMON_PROGRAMS () { 0x0017 } # All Users\Start Menu\Programs
130sub CSIDL_COMMON_STARTUP () { 0x0018 } # All Users\Startup
131sub CSIDL_COMMON_DESKTOPDIRECTORY () { 0x0019 } # All Users\Desktop
132sub CSIDL_APPDATA () { 0x001A } # Application Data, new for NT4
133sub CSIDL_PRINTHOOD () { 0x001B } # <user name>\PrintHood
134sub CSIDL_LOCAL_APPDATA () { 0x001C } # non roaming, user\Local Settings\Application Data
135sub CSIDL_COMMON_FAVORITES () { 0x001F }
136sub CSIDL_INTERNET_CACHE () { 0x0020 }
137sub CSIDL_COOKIES () { 0x0021 }
138sub CSIDL_HISTORY () { 0x0022 }
139sub CSIDL_COMMON_APPDATA () { 0x0023 } # All Users\Application Data
140sub CSIDL_WINDOWS () { 0x0024 } # GetWindowsDirectory()
141sub CSIDL_SYSTEM () { 0x0025 } # GetSystemDirectory()
142sub CSIDL_PROGRAM_FILES () { 0x0026 } # C:\Program Files
143sub CSIDL_MYPICTURES () { 0x0027 } # "My Pictures", new for Win2K
144sub CSIDL_PROFILE () { 0x0028 } # USERPROFILE
145sub CSIDL_PROGRAM_FILES_COMMON () { 0x002B } # C:\Program Files\Common
146sub CSIDL_COMMON_TEMPLATES () { 0x002D } # All Users\Templates
147sub CSIDL_COMMON_DOCUMENTS () { 0x002E } # All Users\Documents
148sub CSIDL_COMMON_ADMINTOOLS () { 0x002F } # All Users\Start Menu\Programs\Administrative Tools
149sub CSIDL_ADMINTOOLS () { 0x0030 } # <user name>\Start Menu\Programs\Administrative Tools
150sub CSIDL_COMMON_MUSIC () { 0x0035 } # All Users\My Music
151sub CSIDL_COMMON_PICTURES () { 0x0036 } # All Users\My Pictures
152sub CSIDL_COMMON_VIDEO () { 0x0037 } # All Users\My Video
153sub CSIDL_RESOURCES () { 0x0038 } # %windir%\Resources\, For theme and other windows resources.
154sub CSIDL_RESOURCES_LOCALIZED () { 0x0039 } # %windir%\Resources\<LangID>, for theme and other windows specific resources.
155sub CSIDL_CDBURN_AREA () { 0x003B } # <user name>\Local Settings\Application Data\Microsoft\CD Burning
156
157sub 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.
158sub VER_NT_SERVER () { 0x0000003 } # The operating system is Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
159# Note that a server that is also a domain controller is reported as VER_NT_DOMAIN_CONTROLLER, not VER_NT_SERVER.
160sub VER_NT_WORKSTATION () { 0x0000001 } # The operating system is Windows Vista, Windows XP Professional, Windows XP Home Edition, or Windows 2000 Professional.
161
162
163sub VER_SUITE_BACKOFFICE () { 0x00000004 } # Microsoft BackOffice components are installed.
164sub VER_SUITE_BLADE () { 0x00000400 } # Windows Server 2003, Web Edition is installed.
165sub VER_SUITE_COMPUTE_SERVER () { 0x00004000 } # Windows Server 2003, Compute Cluster Edition is installed.
166sub VER_SUITE_DATACENTER () { 0x00000080 } # Windows Server 2008 Datacenter, Windows Server 2003, Datacenter Edition, or Windows 2000 Datacenter Server is installed.
167sub 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.
168sub VER_SUITE_EMBEDDEDNT () { 0x00000040 } # Windows XP Embedded is installed.
169sub VER_SUITE_PERSONAL () { 0x00000200 } # Windows Vista Home Premium, Windows Vista Home Basic, or Windows XP Home Edition is installed.
170sub 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.
171sub 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 flag.
172sub 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.
173sub VER_SUITE_STORAGE_SERVER () { 0x00002000 } # Windows Storage Server 2003 R2 or Windows Storage Server 2003 is installed.
174sub VER_SUITE_TERMINAL () { 0x00000010 } # Terminal Services is installed. This value is always set.
175# If VER_SUITE_TERMINAL is set but VER_SUITE_SINGLEUSERTS is not set, the system is running in application server mode.
176sub VER_SUITE_WH_SERVER () { 0x00008000 } # Windows Home Server is installed.
177
178
179sub SM_TABLETPC () { 86 }
180sub SM_MEDIACENTER () { 87 }
181sub SM_STARTER () { 88 }
182sub SM_SERVERR2 () { 89 }
183
184sub PRODUCT_UNDEFINED () { 0x000 } # An unknown product
185sub PRODUCT_ULTIMATE () { 0x001 } # Ultimate
186sub PRODUCT_HOME_BASIC () { 0x002 } # Home Basic
187sub PRODUCT_HOME_PREMIUM () { 0x003 } # Home Premium
188sub PRODUCT_ENTERPRISE () { 0x004 } # Enterprise
189sub PRODUCT_HOME_BASIC_N () { 0x005 } # Home Basic N
190sub PRODUCT_BUSINESS () { 0x006 } # Business
191sub PRODUCT_STANDARD_SERVER () { 0x007 } # Server Standard (full installation)
192sub PRODUCT_DATACENTER_SERVER () { 0x008 } # Server Datacenter (full installation)
193sub PRODUCT_SMALLBUSINESS_SERVER () { 0x009 } # Windows Small Business Server
194sub PRODUCT_ENTERPRISE_SERVER () { 0x00A } # Server Enterprise (full installation)
195sub PRODUCT_STARTER () { 0x00B } # Starter
196sub PRODUCT_DATACENTER_SERVER_CORE () { 0x00C } # Server Datacenter (core installation)
197sub PRODUCT_STANDARD_SERVER_CORE () { 0x00D } # Server Standard (core installation)
198sub PRODUCT_ENTERPRISE_SERVER_CORE () { 0x00E } # Server Enterprise (core installation)
199sub PRODUCT_ENTERPRISE_SERVER_IA64 () { 0x00F } # Server Enterprise for Itanium-based Systems
200sub PRODUCT_BUSINESS_N () { 0x010 } # Business N
201sub PRODUCT_WEB_SERVER () { 0x011 } # Web Server (full installation)
202sub PRODUCT_CLUSTER_SERVER () { 0x012 } # HPC Edition
203sub PRODUCT_HOME_SERVER () { 0x013 } # Home Server Edition
204sub PRODUCT_STORAGE_EXPRESS_SERVER () { 0x014 } # Storage Server Express
205sub PRODUCT_STORAGE_STANDARD_SERVER () { 0x015 } # Storage Server Standard
206sub PRODUCT_STORAGE_WORKGROUP_SERVER () { 0x016 } # Storage Server Workgroup
207sub PRODUCT_STORAGE_ENTERPRISE_SERVER () { 0x017 } # Storage Server Enterprise
208sub PRODUCT_SERVER_FOR_SMALLBUSINESS () { 0x018 } # Windows Server 2008 for Windows Essential Server Solutions
209sub PRODUCT_SMALLBUSINESS_SERVER_PREMIUM () { 0x019 } # Windows Small Business Server Premium
210sub PRODUCT_HOME_PREMIUM_N () { 0x01A } # Home Premium N
211sub PRODUCT_ENTERPRISE_N () { 0x01B } # Enterprise N
212sub PRODUCT_ULTIMATE_N () { 0x01C } # Ultimate N
213sub PRODUCT_WEB_SERVER_CORE () { 0x01D } # Web Server (core installation)
214sub PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT () { 0x01E } # Windows Essential Business Server Management Server
215sub PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY () { 0x01F } # Windows Essential Business Server Security Server
216sub PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING () { 0x020 } # Windows Essential Business Server Messaging Server
217sub PRODUCT_SERVER_FOUNDATION () { 0x021 } # Server Foundation
218
219sub PRODUCT_SERVER_FOR_SMALLBUSINESS_V () { 0x023 } # Windows Server 2008 without Hyper-V for Windows Essential Server Solutions
220sub PRODUCT_STANDARD_SERVER_V () { 0x024 } # Server Standard without Hyper-V (full installation)
221sub PRODUCT_DATACENTER_SERVER_V () { 0x025 } # Server Datacenter without Hyper-V (full installation)
222sub PRODUCT_ENTERPRISE_SERVER_V () { 0x026 } # Server Enterprise without Hyper-V (full installation)
223sub PRODUCT_DATACENTER_SERVER_CORE_V () { 0x027 } # Server Datacenter without Hyper-V (core installation)
224sub PRODUCT_STANDARD_SERVER_CORE_V () { 0x028 } # Server Standard without Hyper-V (core installation)
225sub PRODUCT_ENTERPRISE_SERVER_CORE_V () { 0x029 } # Server Enterprise without Hyper-V (core installation)
226sub PRODUCT_HYPERV () { 0x02A } # Microsoft Hyper-V Server
227
228sub PRODUCT_STARTER_N () { 0x02F } # Starter N
229sub PRODUCT_PROFESSIONAL () { 0x030 } # Professional
230sub PRODUCT_PROFESSIONAL_N () { 0x031 } # Professional N
231
232sub PRODUCT_STARTER_E () { 0x042 } # Starter E
233sub PRODUCT_HOME_BASIC_E () { 0x043 } # Home Basic E
234sub PRODUCT_HOME_PREMIUM_E () { 0x044 } # Home Premium E
235sub PRODUCT_PROFESSIONAL_E () { 0x045 } # Professional E
236sub PRODUCT_ENTERPRISE_E () { 0x046 } # Enterprise E
237sub PRODUCT_ULTIMATE_E () { 0x047 } # Ultimate E
238
239sub PRODUCT_UNLICENSED () { 0xABCDABCD } # product has not been activated and is no longer in the grace period
240
241sub PROCESSOR_ARCHITECTURE_AMD64 () { 9 } # x64 (AMD or Intel)
242sub PROCESSOR_ARCHITECTURE_IA64 () { 6 } # Intel Itanium Processor Family (IPF)
243sub PROCESSOR_ARCHITECTURE_INTEL () { 0 } # x86
244sub PROCESSOR_ARCHITECTURE_UNKNOWN () { 0xffff } # Unknown architecture.
245
246sub _GetProcessorArchitecture {
247 my $arch = {
248 386 => PROCESSOR_ARCHITECTURE_INTEL,
249 486 => PROCESSOR_ARCHITECTURE_INTEL,
250 586 => PROCESSOR_ARCHITECTURE_INTEL,
251 2200 => PROCESSOR_ARCHITECTURE_IA64,
252 8664 => PROCESSOR_ARCHITECTURE_AMD64,
253 }->{Win32::GetChipName()};
254 return defined($arch) ? $arch : PROCESSOR_ARCHITECTURE_UNKNOWN;
255}
256
257### This method is just a simple interface into GetOSVersion(). More
258### specific or demanding situations should use that instead.
259
26010smy ($cached_os, $cached_desc);
261
262sub GetOSName {
263 unless (defined $cached_os) {
264 my($desc, $major, $minor, $build, $id, undef, undef, $suitemask, $producttype)
265 = Win32::GetOSVersion();
266 my $arch = _GetProcessorArchitecture();
267 my $productinfo = Win32::GetProductInfo(6, 0, 0, 0);
268 ($cached_os, $cached_desc) = _GetOSName($desc, $major, $minor, $build, $id,
269 $suitemask, $producttype, $productinfo, $arch);
270 }
271 return wantarray ? ($cached_os, $cached_desc) : $cached_os;
272}
273
274sub GetOSDisplayName {
275 # Calling GetOSDisplayName() with arguments is for the test suite only!
276 my($name,$desc) = @_ ? @_ : GetOSName();
277 $name =~ s/^Win//;
278 if ($desc =~ /^Windows Home Server\b/ || $desc =~ /^Windows XP Professional x64 Edition\b/) {
279 ($name, $desc) = ($desc, "");
280 }
281 elsif ($desc =~ s/\s*(Windows (.*) Server( \d+)?)//) {
282 $name = "$1 $name";
283 $desc =~ s/^\s+//;
284 }
285 else {
286 for ($name) {
287 s/^/Windows / unless /^Win32s$/;
288 s/\/.Net//;
289 s/NT(\d)/NT $1/;
290 if ($desc =~ s/\s*(HPC|Small Business|Web) Server//) {
291 my $name = $1;
292 $desc =~ s/^\s*//;
293 s/(200.)/$name Server $1/;
294 }
295 s/^Windows (20(03|08|12))/Windows Server $1/;
296 }
297 }
298 $name .= " $desc" if length $desc;
299 return $name;
300}
301
302sub _GetSystemMetrics {
303 my($index,$metrics) = @_;
304 return Win32::GetSystemMetrics($index) unless ref $metrics;
305 return $metrics->{$index} if ref $metrics eq "HASH" && defined $metrics->{$index};
306 return 1 if ref $metrics eq "ARRAY" && grep $_ == $index, @$metrics;
307 return 0;
308}
309
310sub _GetOSName {
311 # The $metrics argument only exists for the benefit of t/GetOSName.t
312 my($csd, $major, $minor, $build, $id, $suitemask, $producttype, $productinfo, $arch, $metrics) = @_;
313
314 my($os,@tags);
315 my $desc = "";
316 if ($id == 0) {
317 $os = "Win32s";
318 }
319 elsif ($id == 1) {
320 if ($minor == 0) {
321 $os = "95";
322 }
323 elsif ($minor == 10) {
324 $os = "98";
325 }
326 elsif ($minor == 90) {
327 $os = "Me";
328 }
329 }
330 elsif ($id == 2) {
331 if ($major == 3) {
332 $os = "NT3.51";
333 }
334 elsif ($major == 4) {
335 $os = "NT4";
336 }
337 elsif ($major == 5) {
338 if ($minor == 0) {
339 $os = "2000";
340 if ($producttype == VER_NT_WORKSTATION) {
341 $desc = "Professional";
342 }
343 else {
344 if ($suitemask & VER_SUITE_DATACENTER) {
345 $desc = "Datacenter Server";
346 }
347 elsif ($suitemask & VER_SUITE_ENTERPRISE) {
348 $desc = "Advanced Server";
349 }
350 elsif ($suitemask & VER_SUITE_SMALLBUSINESS_RESTRICTED) {
351 $desc = "Small Business Server";
352 }
353 else {
354 $desc = "Server";
355 }
356 }
357 # XXX ignoring "Windows 2000 Advanced Server Limited Edition" for Itanium
358 # XXX and "Windows 2000 Datacenter Server Limited Edition" for Itanium
359 }
360 elsif ($minor == 1) {
361 $os = "XP/.Net";
362 if (_GetSystemMetrics(SM_MEDIACENTER, $metrics)) {
363 $desc = "Media Center Edition";
364 }
365 elsif (_GetSystemMetrics(SM_TABLETPC, $metrics)) {
366 # Tablet PC Edition is based on XP Pro
367 $desc = "Tablet PC Edition";
368 }
369 elsif (_GetSystemMetrics(SM_STARTER, $metrics)) {
370 $desc = "Starter Edition";
371 }
372 elsif ($suitemask & VER_SUITE_PERSONAL) {
373 $desc = "Home Edition";
374 }
375 else {
376 $desc = "Professional";
377 }
378 # XXX ignoring all Windows XP Embedded and Fundamentals versions
379 }
380 elsif ($minor == 2) {
381 $os = "2003";
382
383 if (_GetSystemMetrics(SM_SERVERR2, $metrics)) {
384 # XXX R2 was released for all x86 and x64 versions,
385 # XXX but only Enterprise Edition for Itanium.
386 $desc = "R2";
387 }
388
389 if ($suitemask == VER_SUITE_STORAGE_SERVER) {
390 $desc .= " Windows Storage Server";
391 }
392 elsif ($suitemask == VER_SUITE_WH_SERVER) {
393 $desc .= " Windows Home Server";
394 }
395 elsif ($producttype == VER_NT_WORKSTATION && $arch == PROCESSOR_ARCHITECTURE_AMD64) {
396 $desc .= " Windows XP Professional x64 Edition";
397 }
398
399 # Test for the server type.
400 if ($producttype != VER_NT_WORKSTATION) {
401 if ($arch == PROCESSOR_ARCHITECTURE_IA64) {
402 if ($suitemask & VER_SUITE_DATACENTER) {
403 $desc .= " Datacenter Edition for Itanium-based Systems";
404 }
405 elsif ($suitemask & VER_SUITE_ENTERPRISE) {
406 $desc .= " Enterprise Edition for Itanium-based Systems";
407 }
408 }
409 elsif ($arch == PROCESSOR_ARCHITECTURE_AMD64) {
410 if ($suitemask & VER_SUITE_DATACENTER) {
411 $desc .= " Datacenter x64 Edition";
412 }
413 elsif ($suitemask & VER_SUITE_ENTERPRISE) {
414 $desc .= " Enterprise x64 Edition";
415 }
416 else {
417 $desc .= " Standard x64 Edition";
418 }
419 }
420 else {
421 if ($suitemask & VER_SUITE_COMPUTE_SERVER) {
422 $desc .= " Windows Compute Cluster Server";
423 }
424 elsif ($suitemask & VER_SUITE_DATACENTER) {
425 $desc .= " Datacenter Edition";
426 }
427 elsif ($suitemask & VER_SUITE_ENTERPRISE) {
428 $desc .= " Enterprise Edition";
429 }
430 elsif ($suitemask & VER_SUITE_BLADE) {
431 $desc .= " Web Edition";
432 }
433 elsif ($suitemask & VER_SUITE_SMALLBUSINESS_RESTRICTED) {
434 $desc .= " Small Business Server";
435 }
436 else {
437 if ($desc !~ /Windows (Home|Storage) Server/) {
438 $desc .= " Standard Edition";
439 }
440 }
441 }
442 }
443 }
444 }
445 elsif ($major == 6) {
446 if ($minor == 0) {
447 if ($producttype == VER_NT_WORKSTATION) {
448 $os = "Vista";
449 }
450 else {
451 $os = "2008";
452 }
453 }
454 elsif ($minor == 1) {
455 if ($producttype == VER_NT_WORKSTATION) {
456 $os = "7";
457 }
458 else {
459 $os = "2008";
460 $desc = "R2";
461 }
462 }
463 elsif ($minor == 2) {
464 if ($producttype == VER_NT_WORKSTATION) {
465 $os = "8";
466 }
467 else {
468 $os = "2012";
469 }
470 }
471 elsif ($minor == 3) {
472 if ($producttype == VER_NT_WORKSTATION) {
473 $os = "8.1";
474 }
475 else {
476 $os = "2012";
477 $desc = "R2";
478 }
479 }
480
481 if ($productinfo == PRODUCT_ULTIMATE) {
482 $desc .= " Ultimate";
483 }
484 elsif ($productinfo == PRODUCT_HOME_PREMIUM) {
485 $desc .= " Home Premium";
486 }
487 elsif ($productinfo == PRODUCT_HOME_BASIC) {
488 $desc .= " Home Basic";
489 }
490 elsif ($productinfo == PRODUCT_ENTERPRISE) {
491 $desc .= " Enterprise";
492 }
493 elsif ($productinfo == PRODUCT_BUSINESS) {
494 # "Windows 7 Business" had a name change to "Windows 7 Professional"
495 $desc .= $minor == 0 ? " Business" : " Professional";
496 }
497 elsif ($productinfo == PRODUCT_STARTER) {
498 $desc .= " Starter";
499 }
500 elsif ($productinfo == PRODUCT_CLUSTER_SERVER) {
501 $desc .= " HPC Server";
502 }
503 elsif ($productinfo == PRODUCT_DATACENTER_SERVER) {
504 $desc .= " Datacenter";
505 }
506 elsif ($productinfo == PRODUCT_DATACENTER_SERVER_CORE) {
507 $desc .= " Datacenter Edition (core installation)";
508 }
509 elsif ($productinfo == PRODUCT_ENTERPRISE_SERVER) {
510 $desc .= " Enterprise";
511 }
512 elsif ($productinfo == PRODUCT_ENTERPRISE_SERVER_CORE) {
513 $desc .= " Enterprise Edition (core installation)";
514 }
515 elsif ($productinfo == PRODUCT_ENTERPRISE_SERVER_IA64) {
516 $desc .= " Enterprise Edition for Itanium-based Systems";
517 }
518 elsif ($productinfo == PRODUCT_SMALLBUSINESS_SERVER) {
519 $desc .= " Small Business Server";
520 }
521 elsif ($productinfo == PRODUCT_SMALLBUSINESS_SERVER_PREMIUM) {
522 $desc .= " Small Business Server Premium Edition";
523 }
524 elsif ($productinfo == PRODUCT_STANDARD_SERVER) {
525 $desc .= " Standard";
526 }
527 elsif ($productinfo == PRODUCT_STANDARD_SERVER_CORE) {
528 $desc .= " Standard Edition (core installation)";
529 }
530 elsif ($productinfo == PRODUCT_WEB_SERVER) {
531 $desc .= " Web Server";
532 }
533 elsif ($productinfo == PRODUCT_PROFESSIONAL) {
534 $desc .= " Professional";
535 }
536
537 if ($arch == PROCESSOR_ARCHITECTURE_INTEL) {
538 $desc .= " (32-bit)";
539 }
540 elsif ($arch == PROCESSOR_ARCHITECTURE_AMD64) {
541 $desc .= " (64-bit)";
542 }
543 }
544 }
545
546 unless (defined $os) {
547 warn "Unknown Windows version [$id:$major:$minor]";
548 return;
549 }
550
551 for ($desc) {
552 s/\s\s+/ /g;
553 s/^\s//;
554 s/\s$//;
555 }
556
557 # XXX What about "Small Business Server"? NT, 200, 2003, 2008 editions...
558
559 if ($major >= 5) {
560 # XXX XP, Vista, 7 all have starter editions
561 #push(@tags, "Starter Edition") if _GetSystemMetrics(SM_STARTER, $metrics);
562 }
563
564 if (@tags) {
565 unshift(@tags, $desc) if length $desc;
566 $desc = join(" ", @tags);
567 }
568
569 if (length $csd) {
570 $desc .= " " if length $desc;
571 $desc .= $csd;
572 }
573 return ("Win$os", $desc);
574}
575
576# "no warnings 'redefine';" doesn't work for 5.8.7 and earlier
57710slocal $^W = 0;
57810s10sbootstrap Win32;
# spent 0s making 1 call to DynaLoader::bootstrap
579
58010s1;
581
582__END__
 
# spent 0s within Win32::GetCwd which was called 15 times, avg 0s/call: # 15 times (0s+0s) by Cwd::_win32_cwd at line 783 of Cwd.pm, avg 0s/call
sub Win32::GetCwd; # xsub
# spent 0s within Win32::GetShortPathName which was called 6 times, avg 0s/call: # 6 times (0s+0s) by ExtUtils::MM_Win32::_normalize_path_name at line 494 of ExtUtils/MM_Win32.pm, avg 0s/call
sub Win32::GetShortPathName; # xsub
# spent 0s within Win32::IsWin95 which was called: # once (0s+0s) by ExtUtils::MM::_is_win95 at line 48 of ExtUtils/MM.pm
sub Win32::IsWin95; # xsub
# spent 0s within Win32::bootstrap which was called: # once (0s+0s) by DynaLoader::bootstrap at line 216 of DynaLoader.pm
sub Win32::bootstrap; # xsub