5 use vars qw|$VERSION $XS_VERSION @ISA @EXPORT @EXPORT_OK|;
10 @ISA = qw|Exporter DynaLoader|;
12 $XS_VERSION = $VERSION;
13 $VERSION = eval $VERSION;
18 OWNER_SECURITY_INFORMATION
19 GROUP_SECURITY_INFORMATION
20 DACL_SECURITY_INFORMATION
21 SACL_SECURITY_INFORMATION
49 CSIDL_DESKTOPDIRECTORY
53 CSIDL_COMMON_STARTMENU
56 CSIDL_COMMON_DESKTOPDIRECTORY
60 CSIDL_COMMON_FAVORITES
70 CSIDL_PROGRAM_FILES_COMMON
71 CSIDL_COMMON_TEMPLATES
72 CSIDL_COMMON_DOCUMENTS
73 CSIDL_COMMON_ADMINTOOLS
79 CSIDL_RESOURCES_LOCALIZED
84 # We won't bother with the constant stuff, too much of a hassle. Just hard
88 sub WIN31_CLASS { &NULL }
90 sub OWNER_SECURITY_INFORMATION { 0x00000001 }
91 sub GROUP_SECURITY_INFORMATION { 0x00000002 }
92 sub DACL_SECURITY_INFORMATION { 0x00000004 }
93 sub SACL_SECURITY_INFORMATION { 0x00000008 }
95 sub MB_ICONHAND { 0x00000010 }
96 sub MB_ICONQUESTION { 0x00000020 }
97 sub MB_ICONEXCLAMATION { 0x00000030 }
98 sub MB_ICONASTERISK { 0x00000040 }
99 sub MB_ICONWARNING { 0x00000030 }
100 sub MB_ICONERROR { 0x00000010 }
101 sub MB_ICONINFORMATION { 0x00000040 }
102 sub MB_ICONSTOP { 0x00000010 }
105 # Newly added constants. These have an empty prototype, unlike the
106 # the ones above, which aren't prototyped for compatibility reasons.
109 sub SW_SHOWNORMAL () { 1 }
110 sub SW_SHOWMINIMIZED () { 2 }
111 sub SW_SHOWMAXIMIZED () { 3 }
112 sub SW_SHOWNOACTIVATE () { 4 }
114 sub CSIDL_DESKTOP () { 0x0000 } # <desktop>
115 sub CSIDL_PROGRAMS () { 0x0002 } # Start Menu\Programs
116 sub CSIDL_PERSONAL () { 0x0005 } # "My Documents" folder
117 sub CSIDL_FAVORITES () { 0x0006 } # <user name>\Favorites
118 sub CSIDL_STARTUP () { 0x0007 } # Start Menu\Programs\Startup
119 sub CSIDL_RECENT () { 0x0008 } # <user name>\Recent
120 sub CSIDL_SENDTO () { 0x0009 } # <user name>\SendTo
121 sub CSIDL_STARTMENU () { 0x000B } # <user name>\Start Menu
122 sub CSIDL_MYMUSIC () { 0x000D } # "My Music" folder
123 sub CSIDL_MYVIDEO () { 0x000E } # "My Videos" folder
124 sub CSIDL_DESKTOPDIRECTORY () { 0x0010 } # <user name>\Desktop
125 sub CSIDL_NETHOOD () { 0x0013 } # <user name>\nethood
126 sub CSIDL_FONTS () { 0x0014 } # windows\fonts
127 sub CSIDL_TEMPLATES () { 0x0015 }
128 sub CSIDL_COMMON_STARTMENU () { 0x0016 } # All Users\Start Menu
129 sub CSIDL_COMMON_PROGRAMS () { 0x0017 } # All Users\Start Menu\Programs
130 sub CSIDL_COMMON_STARTUP () { 0x0018 } # All Users\Startup
131 sub CSIDL_COMMON_DESKTOPDIRECTORY () { 0x0019 } # All Users\Desktop
132 sub CSIDL_APPDATA () { 0x001A } # Application Data, new for NT4
133 sub CSIDL_PRINTHOOD () { 0x001B } # <user name>\PrintHood
134 sub CSIDL_LOCAL_APPDATA () { 0x001C } # non roaming, user\Local Settings\Application Data
135 sub CSIDL_COMMON_FAVORITES () { 0x001F }
136 sub CSIDL_INTERNET_CACHE () { 0x0020 }
137 sub CSIDL_COOKIES () { 0x0021 }
138 sub CSIDL_HISTORY () { 0x0022 }
139 sub CSIDL_COMMON_APPDATA () { 0x0023 } # All Users\Application Data
140 sub CSIDL_WINDOWS () { 0x0024 } # GetWindowsDirectory()
141 sub CSIDL_SYSTEM () { 0x0025 } # GetSystemDirectory()
142 sub CSIDL_PROGRAM_FILES () { 0x0026 } # C:\Program Files
143 sub CSIDL_MYPICTURES () { 0x0027 } # "My Pictures", new for Win2K
144 sub CSIDL_PROFILE () { 0x0028 } # USERPROFILE
145 sub CSIDL_PROGRAM_FILES_COMMON () { 0x002B } # C:\Program Files\Common
146 sub CSIDL_COMMON_TEMPLATES () { 0x002D } # All Users\Templates
147 sub CSIDL_COMMON_DOCUMENTS () { 0x002E } # All Users\Documents
148 sub CSIDL_COMMON_ADMINTOOLS () { 0x002F } # All Users\Start Menu\Programs\Administrative Tools
149 sub CSIDL_ADMINTOOLS () { 0x0030 } # <user name>\Start Menu\Programs\Administrative Tools
150 sub CSIDL_COMMON_MUSIC () { 0x0035 } # All Users\My Music
151 sub CSIDL_COMMON_PICTURES () { 0x0036 } # All Users\My Pictures
152 sub CSIDL_COMMON_VIDEO () { 0x0037 } # All Users\My Video
153 sub CSIDL_RESOURCES () { 0x0038 } # %windir%\Resources\, For theme and other windows resources.
154 sub CSIDL_RESOURCES_LOCALIZED () { 0x0039 } # %windir%\Resources\<LangID>, for theme and other windows specific resources.
155 sub CSIDL_CDBURN_AREA () { 0x003B } # <user name>\Local Settings\Application Data\Microsoft\CD Burning
157 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.
158 sub 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.
160 sub VER_NT_WORKSTATION () { 0x0000001 } # The operating system is Windows Vista, Windows XP Professional, Windows XP Home Edition, or Windows 2000 Professional.
163 sub VER_SUITE_BACKOFFICE () { 0x00000004 } # Microsoft BackOffice components are installed.
164 sub VER_SUITE_BLADE () { 0x00000400 } # Windows Server 2003, Web Edition is installed.
165 sub VER_SUITE_COMPUTE_SERVER () { 0x00004000 } # Windows Server 2003, Compute Cluster Edition is installed.
166 sub VER_SUITE_DATACENTER () { 0x00000080 } # Windows Server 2008 Datacenter, Windows Server 2003, Datacenter Edition, or Windows 2000 Datacenter Server is installed.
167 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.
168 sub VER_SUITE_EMBEDDEDNT () { 0x00000040 } # Windows XP Embedded is installed.
169 sub VER_SUITE_PERSONAL () { 0x00000200 } # Windows Vista Home Premium, Windows Vista Home Basic, or Windows XP Home Edition is installed.
170 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.
171 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 flag.
172 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.
173 sub VER_SUITE_STORAGE_SERVER () { 0x00002000 } # Windows Storage Server 2003 R2 or Windows Storage Server 2003 is installed.
174 sub 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.
176 sub VER_SUITE_WH_SERVER () { 0x00008000 } # Windows Home Server is installed.
179 sub SM_TABLETPC () { 86 }
180 sub SM_MEDIACENTER () { 87 }
181 sub SM_STARTER () { 88 }
182 sub SM_SERVERR2 () { 89 }
184 sub PRODUCT_UNDEFINED () { 0x000 } # An unknown product
185 sub PRODUCT_ULTIMATE () { 0x001 } # Ultimate
186 sub PRODUCT_HOME_BASIC () { 0x002 } # Home Basic
187 sub PRODUCT_HOME_PREMIUM () { 0x003 } # Home Premium
188 sub PRODUCT_ENTERPRISE () { 0x004 } # Enterprise
189 sub PRODUCT_HOME_BASIC_N () { 0x005 } # Home Basic N
190 sub PRODUCT_BUSINESS () { 0x006 } # Business
191 sub PRODUCT_STANDARD_SERVER () { 0x007 } # Server Standard (full installation)
192 sub PRODUCT_DATACENTER_SERVER () { 0x008 } # Server Datacenter (full installation)
193 sub PRODUCT_SMALLBUSINESS_SERVER () { 0x009 } # Windows Small Business Server
194 sub PRODUCT_ENTERPRISE_SERVER () { 0x00A } # Server Enterprise (full installation)
195 sub PRODUCT_STARTER () { 0x00B } # Starter
196 sub PRODUCT_DATACENTER_SERVER_CORE () { 0x00C } # Server Datacenter (core installation)
197 sub PRODUCT_STANDARD_SERVER_CORE () { 0x00D } # Server Standard (core installation)
198 sub PRODUCT_ENTERPRISE_SERVER_CORE () { 0x00E } # Server Enterprise (core installation)
199 sub PRODUCT_ENTERPRISE_SERVER_IA64 () { 0x00F } # Server Enterprise for Itanium-based Systems
200 sub PRODUCT_BUSINESS_N () { 0x010 } # Business N
201 sub PRODUCT_WEB_SERVER () { 0x011 } # Web Server (full installation)
202 sub PRODUCT_CLUSTER_SERVER () { 0x012 } # HPC Edition
203 sub PRODUCT_HOME_SERVER () { 0x013 } # Home Server Edition
204 sub PRODUCT_STORAGE_EXPRESS_SERVER () { 0x014 } # Storage Server Express
205 sub PRODUCT_STORAGE_STANDARD_SERVER () { 0x015 } # Storage Server Standard
206 sub PRODUCT_STORAGE_WORKGROUP_SERVER () { 0x016 } # Storage Server Workgroup
207 sub PRODUCT_STORAGE_ENTERPRISE_SERVER () { 0x017 } # Storage Server Enterprise
208 sub PRODUCT_SERVER_FOR_SMALLBUSINESS () { 0x018 } # Windows Server 2008 for Windows Essential Server Solutions
209 sub PRODUCT_SMALLBUSINESS_SERVER_PREMIUM () { 0x019 } # Windows Small Business Server Premium
210 sub PRODUCT_HOME_PREMIUM_N () { 0x01A } # Home Premium N
211 sub PRODUCT_ENTERPRISE_N () { 0x01B } # Enterprise N
212 sub PRODUCT_ULTIMATE_N () { 0x01C } # Ultimate N
213 sub PRODUCT_WEB_SERVER_CORE () { 0x01D } # Web Server (core installation)
214 sub PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT () { 0x01E } # Windows Essential Business Server Management Server
215 sub PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY () { 0x01F } # Windows Essential Business Server Security Server
216 sub PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING () { 0x020 } # Windows Essential Business Server Messaging Server
217 sub PRODUCT_SERVER_FOUNDATION () { 0x021 } # Server Foundation
218 #define PRODUCT_HOME_PREMIUM_SERVER 0x00000022
219 sub PRODUCT_SERVER_FOR_SMALLBUSINESS_V () { 0x023 } # Windows Server 2008 without Hyper-V for Windows Essential Server Solutions
220 sub PRODUCT_STANDARD_SERVER_V () { 0x024 } # Server Standard without Hyper-V (full installation)
221 sub PRODUCT_DATACENTER_SERVER_V () { 0x025 } # Server Datacenter without Hyper-V (full installation)
222 sub PRODUCT_ENTERPRISE_SERVER_V () { 0x026 } # Server Enterprise without Hyper-V (full installation)
223 sub PRODUCT_DATACENTER_SERVER_CORE_V () { 0x027 } # Server Datacenter without Hyper-V (core installation)
224 sub PRODUCT_STANDARD_SERVER_CORE_V () { 0x028 } # Server Standard without Hyper-V (core installation)
225 sub PRODUCT_ENTERPRISE_SERVER_CORE_V () { 0x029 } # Server Enterprise without Hyper-V (core installation)
226 sub PRODUCT_HYPERV () { 0x02A } # Microsoft Hyper-V Server
227 #define PRODUCT_STORAGE_EXPRESS_SERVER_CORE 0x0000002B
228 #define PRODUCT_STORAGE_STANDARD_SERVER_CORE 0x0000002C
229 #define PRODUCT_STORAGE_WORKGROUP_SERVER_CORE 0x0000002D
230 #define PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE 0x0000002E
231 sub PRODUCT_STARTER_N () { 0x02F } # Starter N
232 sub PRODUCT_PROFESSIONAL () { 0x030 } # Professional
233 sub PRODUCT_PROFESSIONAL_N () { 0x031 } # Professional N
234 #define PRODUCT_SB_SOLUTION_SERVER 0x00000032
235 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS 0x00000033
236 #define PRODUCT_STANDARD_SERVER_SOLUTIONS 0x00000034
237 #define PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE 0x00000035
238 #define PRODUCT_SB_SOLUTION_SERVER_EM 0x00000036
239 #define PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM 0x00000037
240 #define PRODUCT_SOLUTION_EMBEDDEDSERVER 0x00000038
241 #define PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE 0x00000039
242 #define PRODUCT_PROFESSIONAL_EMBEDDED 0x0000003A
243 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT 0x0000003B
244 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL 0x0000003C
245 #define PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC 0x0000003D
246 #define PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC 0x0000003E
247 #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE 0x0000003F
248 #define PRODUCT_CLUSTER_SERVER_V 0x00000040
249 #define PRODUCT_EMBEDDED 0x00000041
250 sub PRODUCT_STARTER_E () { 0x042 } # Starter E
251 sub PRODUCT_HOME_BASIC_E () { 0x043 } # Home Basic E
252 sub PRODUCT_HOME_PREMIUM_E () { 0x044 } # Home Premium E
253 sub PRODUCT_PROFESSIONAL_E () { 0x045 } # Professional E
254 sub PRODUCT_ENTERPRISE_E () { 0x046 } # Enterprise E
255 sub PRODUCT_ULTIMATE_E () { 0x047 } # Ultimate E
256 #define PRODUCT_ENTERPRISE_EVALUATION 0x00000048
257 #define PRODUCT_MULTIPOINT_STANDARD_SERVER 0x0000004C
258 #define PRODUCT_MULTIPOINT_PREMIUM_SERVER 0x0000004D
259 #define PRODUCT_STANDARD_EVALUATION_SERVER 0x0000004F
260 #define PRODUCT_DATACENTER_EVALUATION_SERVER 0x00000050
261 #define PRODUCT_ENTERPRISE_N_EVALUATION 0x00000054
262 #define PRODUCT_EMBEDDED_AUTOMOTIVE 0x00000055
263 #define PRODUCT_EMBEDDED_INDUSTRY_A 0x00000056
264 #define PRODUCT_THINPC 0x00000057
265 #define PRODUCT_EMBEDDED_A 0x00000058
266 #define PRODUCT_EMBEDDED_INDUSTRY 0x00000059
267 #define PRODUCT_EMBEDDED_E 0x0000005A
268 #define PRODUCT_EMBEDDED_INDUSTRY_E 0x0000005B
269 #define PRODUCT_EMBEDDED_INDUSTRY_A_E 0x0000005C
270 #define PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER 0x0000005F
271 #define PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER 0x00000060
272 #define PRODUCT_CORE_ARM 0x00000061
273 sub PRODUCT_CORE_N () { 0x62 } # Windows 10 Home N
274 sub PRODUCT_CORE_COUNTRYSPECIFIC () { 0x63 } # Windows 10 Home China
275 sub PRODUCT_CORE_SINGLELANGUAGE () { 0x64 } # Windows 10 Home Single Language
276 sub PRODUCT_CORE () { 0x65 } # Windows 10 Home
277 #define PRODUCT_PROFESSIONAL_WMC 0x00000067
278 #define PRODUCT_MOBILE_CORE 0x00000068
279 #define PRODUCT_EMBEDDED_INDUSTRY_EVAL 0x00000069
280 #define PRODUCT_EMBEDDED_INDUSTRY_E_EVAL 0x0000006A
281 #define PRODUCT_EMBEDDED_EVAL 0x0000006B
282 #define PRODUCT_EMBEDDED_E_EVAL 0x0000006C
283 #define PRODUCT_NANO_SERVER 0x0000006D
284 #define PRODUCT_CLOUD_STORAGE_SERVER 0x0000006E
285 #define PRODUCT_CORE_CONNECTED 0x0000006F
286 #define PRODUCT_PROFESSIONAL_STUDENT 0x00000070
287 #define PRODUCT_CORE_CONNECTED_N 0x00000071
288 #define PRODUCT_PROFESSIONAL_STUDENT_N 0x00000072
289 #define PRODUCT_CORE_CONNECTED_SINGLELANGUAGE 0x00000073
290 #define PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC 0x00000074
291 #define PRODUCT_CONNECTED_CAR 0x00000075
292 #define PRODUCT_INDUSTRY_HANDHELD 0x00000076
293 #define PRODUCT_PPI_PRO 0x00000077
294 #define PRODUCT_ARM64_SERVER 0x00000078
295 sub PRODUCT_EDUCATION () { 0x79 } # Windows 10 Education
296 sub PRODUCT_EDUCATION_N () { 0x7A } # Windows 10 Education N
297 #define PRODUCT_IOTUAP 0x0000007B
298 #define PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER 0x0000007C
299 #define PRODUCT_ENTERPRISE_S 0x0000007D
300 #define PRODUCT_ENTERPRISE_S_N 0x0000007E
301 #define PRODUCT_PROFESSIONAL_S 0x0000007F
302 #define PRODUCT_PROFESSIONAL_S_N 0x00000080
303 #define PRODUCT_ENTERPRISE_S_EVALUATION 0x00000081
304 #define PRODUCT_ENTERPRISE_S_N_EVALUATION 0x00000082
306 sub PRODUCT_UNLICENSED () { 0xABCDABCD } # product has not been activated and is no longer in the grace period
308 sub PROCESSOR_ARCHITECTURE_AMD64 () { 9 } # x64 (AMD or Intel)
309 sub PROCESSOR_ARCHITECTURE_IA64 () { 6 } # Intel Itanium Processor Family (IPF)
310 sub PROCESSOR_ARCHITECTURE_INTEL () { 0 } # x86
311 sub PROCESSOR_ARCHITECTURE_UNKNOWN () { 0xffff } # Unknown architecture.
313 sub _GetProcessorArchitecture {
315 386 => PROCESSOR_ARCHITECTURE_INTEL,
316 486 => PROCESSOR_ARCHITECTURE_INTEL,
317 586 => PROCESSOR_ARCHITECTURE_INTEL,
318 2200 => PROCESSOR_ARCHITECTURE_IA64,
319 8664 => PROCESSOR_ARCHITECTURE_AMD64,
320 }->{Win32::GetChipName()};
321 return defined($arch) ? $arch : PROCESSOR_ARCHITECTURE_UNKNOWN;
324 ### This method is just a simple interface into GetOSVersion(). More
325 ### specific or demanding situations should use that instead.
327 my ($cached_os, $cached_desc);
330 unless (defined $cached_os) {
331 my($desc, $major, $minor, $build, $id, undef, undef, $suitemask, $producttype)
332 = Win32::GetOSVersion();
333 my $arch = _GetProcessorArchitecture();
334 my $productinfo = Win32::GetProductInfo(6, 0, 0, 0);
335 ($cached_os, $cached_desc) = _GetOSName($desc, $major, $minor, $build, $id,
336 $suitemask, $producttype, $productinfo, $arch);
338 return wantarray ? ($cached_os, $cached_desc) : $cached_os;
341 sub GetOSDisplayName {
342 # Calling GetOSDisplayName() with arguments is for the test suite only!
343 my($name,$desc) = @_ ? @_ : GetOSName();
345 if ($desc =~ /^Windows Home Server\b/ || $desc =~ /^Windows XP Professional x64 Edition\b/) {
346 ($name, $desc) = ($desc, "");
348 elsif ($desc =~ s/\s*(Windows (.*) Server( \d+)?)//) {
354 s/^/Windows / unless /^Win32s$/;
357 if ($desc =~ s/\s*(HPC|Small Business|Web) Server//) {
360 s/(200.)/$name Server $1/;
362 s/^Windows (20(03|08|12))/Windows Server $1/;
365 $name .= " $desc" if length $desc;
369 sub _GetSystemMetrics {
370 my($index,$metrics) = @_;
371 return Win32::GetSystemMetrics($index) unless ref $metrics;
372 return $metrics->{$index} if ref $metrics eq "HASH" && defined $metrics->{$index};
373 return 1 if ref $metrics eq "ARRAY" && grep $_ == $index, @$metrics;
378 # The $metrics argument only exists for the benefit of t/GetOSName.t
379 my($csd, $major, $minor, $build, $id, $suitemask, $producttype, $productinfo, $arch, $metrics) = @_;
390 elsif ($minor == 10) {
393 elsif ($minor == 90) {
401 elsif ($major == 4) {
404 elsif ($major == 5) {
407 if ($producttype == VER_NT_WORKSTATION) {
408 $desc = "Professional";
411 if ($suitemask & VER_SUITE_DATACENTER) {
412 $desc = "Datacenter Server";
414 elsif ($suitemask & VER_SUITE_ENTERPRISE) {
415 $desc = "Advanced Server";
417 elsif ($suitemask & VER_SUITE_SMALLBUSINESS_RESTRICTED) {
418 $desc = "Small Business Server";
424 # XXX ignoring "Windows 2000 Advanced Server Limited Edition" for Itanium
425 # XXX and "Windows 2000 Datacenter Server Limited Edition" for Itanium
427 elsif ($minor == 1) {
429 if (_GetSystemMetrics(SM_MEDIACENTER, $metrics)) {
430 $desc = "Media Center Edition";
432 elsif (_GetSystemMetrics(SM_TABLETPC, $metrics)) {
433 # Tablet PC Edition is based on XP Pro
434 $desc = "Tablet PC Edition";
436 elsif (_GetSystemMetrics(SM_STARTER, $metrics)) {
437 $desc = "Starter Edition";
439 elsif ($suitemask & VER_SUITE_PERSONAL) {
440 $desc = "Home Edition";
443 $desc = "Professional";
445 # XXX ignoring all Windows XP Embedded and Fundamentals versions
447 elsif ($minor == 2) {
450 if (_GetSystemMetrics(SM_SERVERR2, $metrics)) {
451 # XXX R2 was released for all x86 and x64 versions,
452 # XXX but only Enterprise Edition for Itanium.
456 if ($suitemask == VER_SUITE_STORAGE_SERVER) {
457 $desc .= " Windows Storage Server";
459 elsif ($suitemask == VER_SUITE_WH_SERVER) {
460 $desc .= " Windows Home Server";
462 elsif ($producttype == VER_NT_WORKSTATION && $arch == PROCESSOR_ARCHITECTURE_AMD64) {
463 $desc .= " Windows XP Professional x64 Edition";
466 # Test for the server type.
467 if ($producttype != VER_NT_WORKSTATION) {
468 if ($arch == PROCESSOR_ARCHITECTURE_IA64) {
469 if ($suitemask & VER_SUITE_DATACENTER) {
470 $desc .= " Datacenter Edition for Itanium-based Systems";
472 elsif ($suitemask & VER_SUITE_ENTERPRISE) {
473 $desc .= " Enterprise Edition for Itanium-based Systems";
476 elsif ($arch == PROCESSOR_ARCHITECTURE_AMD64) {
477 if ($suitemask & VER_SUITE_DATACENTER) {
478 $desc .= " Datacenter x64 Edition";
480 elsif ($suitemask & VER_SUITE_ENTERPRISE) {
481 $desc .= " Enterprise x64 Edition";
484 $desc .= " Standard x64 Edition";
488 if ($suitemask & VER_SUITE_COMPUTE_SERVER) {
489 $desc .= " Windows Compute Cluster Server";
491 elsif ($suitemask & VER_SUITE_DATACENTER) {
492 $desc .= " Datacenter Edition";
494 elsif ($suitemask & VER_SUITE_ENTERPRISE) {
495 $desc .= " Enterprise Edition";
497 elsif ($suitemask & VER_SUITE_BLADE) {
498 $desc .= " Web Edition";
500 elsif ($suitemask & VER_SUITE_SMALLBUSINESS_RESTRICTED) {
501 $desc .= " Small Business Server";
504 if ($desc !~ /Windows (Home|Storage) Server/) {
505 $desc .= " Standard Edition";
512 elsif ($major == 6) {
514 if ($producttype == VER_NT_WORKSTATION) {
521 elsif ($minor == 1) {
522 if ($producttype == VER_NT_WORKSTATION) {
530 elsif ($minor == 2) {
531 if ($producttype == VER_NT_WORKSTATION) {
538 elsif ($minor == 3) {
539 if ($producttype == VER_NT_WORKSTATION) {
548 elsif ($major == 10) {
553 if ($productinfo == PRODUCT_ULTIMATE) {
554 $desc .= " Ultimate";
556 elsif ($productinfo == PRODUCT_HOME_PREMIUM) {
557 $desc .= " Home Premium";
559 elsif ($productinfo == PRODUCT_HOME_BASIC) {
560 $desc .= " Home Basic";
562 elsif ($productinfo == PRODUCT_ENTERPRISE) {
563 $desc .= " Enterprise";
565 elsif ($productinfo == PRODUCT_BUSINESS) {
566 # "Windows 7 Business" had a name change to "Windows 7 Professional"
567 $desc .= $minor == 0 ? " Business" : " Professional";
569 elsif ($productinfo == PRODUCT_STARTER) {
572 elsif ($productinfo == PRODUCT_CLUSTER_SERVER) {
573 $desc .= " HPC Server";
575 elsif ($productinfo == PRODUCT_DATACENTER_SERVER) {
576 $desc .= " Datacenter";
578 elsif ($productinfo == PRODUCT_DATACENTER_SERVER_CORE) {
579 $desc .= " Datacenter Edition (core installation)";
581 elsif ($productinfo == PRODUCT_ENTERPRISE_SERVER) {
582 $desc .= " Enterprise";
584 elsif ($productinfo == PRODUCT_ENTERPRISE_SERVER_CORE) {
585 $desc .= " Enterprise Edition (core installation)";
587 elsif ($productinfo == PRODUCT_ENTERPRISE_SERVER_IA64) {
588 $desc .= " Enterprise Edition for Itanium-based Systems";
590 elsif ($productinfo == PRODUCT_SMALLBUSINESS_SERVER) {
591 $desc .= " Small Business Server";
593 elsif ($productinfo == PRODUCT_SMALLBUSINESS_SERVER_PREMIUM) {
594 $desc .= " Small Business Server Premium Edition";
596 elsif ($productinfo == PRODUCT_STANDARD_SERVER) {
597 $desc .= " Standard";
599 elsif ($productinfo == PRODUCT_STANDARD_SERVER_CORE) {
600 $desc .= " Standard Edition (core installation)";
602 elsif ($productinfo == PRODUCT_WEB_SERVER) {
603 $desc .= " Web Server";
605 elsif ($productinfo == PRODUCT_PROFESSIONAL) {
606 $desc .= " Professional";
609 if ($arch == PROCESSOR_ARCHITECTURE_INTEL) {
610 $desc .= " (32-bit)";
612 elsif ($arch == PROCESSOR_ARCHITECTURE_AMD64) {
613 $desc .= " (64-bit)";
618 unless (defined $os) {
619 warn "Unknown Windows version [$id:$major:$minor]";
629 # XXX What about "Small Business Server"? NT, 200, 2003, 2008 editions...
632 # XXX XP, Vista, 7 all have starter editions
633 #push(@tags, "Starter Edition") if _GetSystemMetrics(SM_STARTER, $metrics);
637 unshift(@tags, $desc) if length $desc;
638 $desc = join(" ", @tags);
642 $desc .= " " if length $desc;
645 return ("Win$os", $desc);
648 # "no warnings 'redefine';" doesn't work for 5.8.7 and earlier
658 Win32 - Interfaces to some Win32 API Functions
662 The Win32 module contains functions to access Win32 APIs.
664 =head2 Alphabetical Listing of Win32 Functions
666 It is recommended to C<use Win32;> before any of these functions;
667 however, for backwards compatibility, those marked as [CORE] will
668 automatically do this for you.
670 In the function descriptions below the term I<Unicode string> is used
671 to indicate that the string may contain characters outside the system
672 codepage. The caveat I<If supported by the core Perl version>
673 generally means Perl 5.8.9 and later, though some Unicode pathname
674 functionality may work on earlier versions.
678 =item Win32::AbortSystemShutdown(MACHINE)
680 Aborts a system shutdown (started by the
681 InitiateSystemShutdown function) on the specified MACHINE.
683 =item Win32::BuildNumber()
685 [CORE] Returns the ActivePerl build number. This function is
686 only available in the ActivePerl binary distribution.
688 =item Win32::CopyFile(FROM, TO, OVERWRITE)
690 [CORE] The Win32::CopyFile() function copies an existing file to a new
691 file. All file information like creation time and file attributes will
692 be copied to the new file. However it will B<not> copy the security
693 information. If the destination file already exists it will only be
694 overwritten when the OVERWRITE parameter is true. But even this will
695 not overwrite a read-only file; you have to unlink() it first
698 =item Win32::CreateDirectory(DIRECTORY)
700 Creates the DIRECTORY and returns a true value on success. Check $^E
701 on failure for extended error information.
703 DIRECTORY may contain Unicode characters outside the system codepage.
704 Once the directory has been created you can use
705 Win32::GetANSIPathName() to get a name that can be passed to system
706 calls and external programs.
708 =item Win32::CreateFile(FILE)
710 Creates the FILE and returns a true value on success. Check $^E on
711 failure for extended error information.
713 FILE may contain Unicode characters outside the system codepage. Once
714 the file has been created you can use Win32::GetANSIPathName() to get
715 a name that can be passed to system calls and external programs.
717 =item Win32::DomainName()
719 [CORE] Returns the name of the Microsoft Network domain or workgroup
720 that the owner of the current perl process is logged into. The
721 "Workstation" service must be running to determine this
722 information. This function does B<not> work on Windows 9x.
724 =item Win32::ExpandEnvironmentStrings(STRING)
726 Takes STRING and replaces all referenced environment variable
727 names with their defined values. References to environment variables
728 take the form C<%VariableName%>. Case is ignored when looking up the
729 VariableName in the environment. If the variable is not found then the
730 original C<%VariableName%> text is retained. Has the same effect
733 $string =~ s/%([^%]*)%/$ENV{$1} || "%$1%"/eg
735 However, this function may return a Unicode string if the environment
736 variable being expanded hasn't been assigned to via %ENV. Access
737 to %ENV is currently always using byte semantics.
739 =item Win32::FormatMessage(ERRORCODE)
741 [CORE] Converts the supplied Win32 error number (e.g. returned by
742 Win32::GetLastError()) to a descriptive string. Analogous to the
743 perror() standard-C library function. Note that C<$^E> used
744 in a string context has much the same effect.
746 C:\> perl -e "$^E = 26; print $^E;"
747 The specified disk or diskette cannot be accessed
749 =item Win32::FsType()
751 [CORE] Returns the name of the filesystem of the currently active
752 drive (like 'FAT' or 'NTFS'). In list context it returns three values:
753 (FSTYPE, FLAGS, MAXCOMPLEN). FSTYPE is the filesystem type as
754 before. FLAGS is a combination of values of the following table:
756 0x00000001 supports case-sensitive filenames
757 0x00000002 preserves the case of filenames
758 0x00000004 supports Unicode in filenames
759 0x00000008 preserves and enforces ACLs
760 0x00000010 supports file-based compression
761 0x00000020 supports disk quotas
762 0x00000040 supports sparse files
763 0x00000080 supports reparse points
764 0x00000100 supports remote storage
765 0x00008000 is a compressed volume (e.g. DoubleSpace)
766 0x00010000 supports object identifiers
767 0x00020000 supports the Encrypted File System (EFS)
769 MAXCOMPLEN is the maximum length of a filename component (the part
770 between two backslashes) on this file system.
772 =item Win32::FreeLibrary(HANDLE)
774 Unloads a previously loaded dynamic-link library. The HANDLE is
775 no longer valid after this call. See L<LoadLibrary|Win32::LoadLibrary(LIBNAME)>
776 for information on dynamically loading a library.
778 =item Win32::GetACP()
780 Returns the current Windows ANSI code page identifier for the operating
781 system. See also GetOEMCP(), GetConsoleCP() and GetConsoleOutputCP().
783 =item Win32::GetANSIPathName(FILENAME)
785 Returns an ANSI version of FILENAME. This may be the short name
786 if the long name cannot be represented in the system codepage.
788 While not currently implemented, it is possible that in the future
789 this function will convert only parts of the path to FILENAME to a
792 If FILENAME doesn't exist on the filesystem, or if the filesystem
793 doesn't support short ANSI filenames, then this function will
794 translate the Unicode name into the system codepage using replacement
797 =item Win32::GetArchName()
799 Use of this function is deprecated. It is equivalent with
800 $ENV{PROCESSOR_ARCHITECTURE}. This might not work on Win9X.
802 =item Win32::GetChipName()
804 Returns the processor type: 386, 486 or 586 for x86 processors, 8664
805 for the x64 processor and 2200 for the Itanium. Since it returns the
806 native processor type it will return a 64-bit processor type even when
807 called from a 32-bit Perl running on 64-bit Windows.
809 =item Win32::GetConsoleCP()
811 Returns the input code page used by the console associated with the
812 calling process. To set the console's input code page, see
813 SetConsoleCP(). See also GetConsoleOutputCP(), GetACP() and
816 =item Win32::GetConsoleOutputCP()
818 Returns the output code page used by the console associated with the
819 calling process. To set the console's output code page, see
820 SetConsoleOutputCP(). See also GetConsoleCP(), GetACP(), and
823 =item Win32::GetCwd()
825 [CORE] Returns the current active drive and directory. This function
826 does not return a UNC path, since the functionality required for such
827 a feature is not available under Windows 95.
829 If supported by the core Perl version, this function will return an
830 ANSI path name for the current directory if the long pathname cannot
831 be represented in the system codepage.
833 =item Win32::GetCurrentProcessId()
835 Returns the process identifier of the current process. Until the
836 process terminates, the process identifier uniquely identifies the
837 process throughout the system.
839 The current process identifier is normally also available via the
840 predefined $$ variable. Under fork() emulation however $$ may contain
841 a pseudo-process identifier that is only meaningful to the Perl
842 kill(), wait() and waitpid() functions. The
843 Win32::GetCurrentProcessId() function will always return the regular
844 Windows process id, even when called from inside a pseudo-process.
846 =item Win32::GetCurrentThreadId()
848 Returns the thread identifier of the calling thread. Until the thread
849 terminates, the thread identifier uniquely identifies the thread
850 throughout the system.
852 =item Win32::GetFileVersion(FILENAME)
854 Returns the file version number from the VERSIONINFO resource of
855 the executable file or DLL. This is a tuple of four 16 bit numbers.
856 In list context these four numbers will be returned. In scalar context
857 they are concatenated into a string, separated by dots.
859 =item Win32::GetFolderPath(FOLDER [, CREATE])
861 Returns the full pathname of one of the Windows special folders.
862 The folder will be created if it doesn't exist and the optional CREATE
863 argument is true. The following FOLDER constants are defined by the
864 Win32 module, but only exported on demand:
869 CSIDL_COMMON_ADMINTOOLS
871 CSIDL_COMMON_DESKTOPDIRECTORY
872 CSIDL_COMMON_DOCUMENTS
873 CSIDL_COMMON_FAVORITES
875 CSIDL_COMMON_PICTURES
876 CSIDL_COMMON_PROGRAMS
877 CSIDL_COMMON_STARTMENU
879 CSIDL_COMMON_TEMPLATES
883 CSIDL_DESKTOPDIRECTORY
898 CSIDL_PROGRAM_FILES_COMMON
901 CSIDL_RESOURCES_LOCALIZED
909 Note that not all folders are defined on all versions of Windows.
911 Please refer to the MSDN documentation of the CSIDL constants,
912 currently available at:
914 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/enums/csidl.asp
916 This function will return an ANSI folder path if the long name cannot
917 be represented in the system codepage. Use Win32::GetLongPathName()
918 on the result of Win32::GetFolderPath() if you want the Unicode
919 version of the folder name.
921 =item Win32::GetFullPathName(FILENAME)
923 [CORE] GetFullPathName combines the FILENAME with the current drive
924 and directory name and returns a fully qualified (aka, absolute)
925 path name. In list context it returns two elements: (PATH, FILE) where
926 PATH is the complete pathname component (including trailing backslash)
927 and FILE is just the filename part. Note that no attempt is made to
928 convert 8.3 components in the supplied FILENAME to longnames or
929 vice-versa. Compare with Win32::GetShortPathName() and
930 Win32::GetLongPathName().
932 If supported by the core Perl version, this function will return an
933 ANSI path name if the full pathname cannot be represented in the
936 =item Win32::GetLastError()
938 [CORE] Returns the last error value generated by a call to a Win32 API
939 function. Note that C<$^E> used in a numeric context amounts to the
942 =item Win32::GetLongPathName(PATHNAME)
944 [CORE] Returns a representation of PATHNAME composed of longname
945 components (if any). The result may not necessarily be longer
946 than PATHNAME. No attempt is made to convert PATHNAME to the
947 absolute path. Compare with Win32::GetShortPathName() and
948 Win32::GetFullPathName().
950 This function may return the pathname in Unicode if it cannot be
951 represented in the system codepage. Use Win32::GetANSIPathName()
952 before passing the path to a system call or another program.
954 =item Win32::GetNextAvailDrive()
956 [CORE] Returns a string in the form of "<d>:" where <d> is the first
957 available drive letter.
959 =item Win32::GetOEMCP()
961 Returns the current original equipment manufacturer (OEM) code page
962 identifier for the operating system. See also GetACP(), GetConsoleCP()
963 and GetConsoleOutputCP().
965 =item Win32::GetOSDisplayName()
967 Returns the "marketing" name of the Windows operating system version
968 being used. It returns names like these (random samples):
970 Windows 2000 Datacenter Server
971 Windows XP Professional
972 Windows XP Tablet PC Edition
974 Windows Server 2003 Enterprise Edition for Itanium-based Systems
975 Windows Vista Ultimate (32-bit)
976 Windows Small Business Server 2008 R2 (64-bit)
978 The display name describes the native Windows version, so even on a
979 32-bit Perl this function may return a "Windows ... (64-bit)" name
980 when running on a 64-bit Windows.
982 This function should only be used to display the actual OS name to the
983 user; it should not be used to determine the class of operating systems
984 this system belongs to. The Win32::GetOSName(), Win32::GetOSVersion,
985 Win32::GetProductInfo() and Win32::GetSystemMetrics() functions provide
986 the base information to check for certain capabilities, or for families
989 =item Win32::GetOSName()
991 In scalar context returns the name of the Win32 operating system
992 being used. In list context returns a two element list of the OS name
993 and whatever edition information is known about the particular build
994 (for Win9X boxes) and whatever service packs have been installed.
995 The latter is roughly equivalent to the first item returned by
996 GetOSVersion() in list context.
998 The description will also include tags for other special editions,
999 like "R2", "Media Center", "Tablet PC", or "Starter Edition".
1001 Currently the possible values for the OS name are
1017 This routine is just a simple interface into GetOSVersion(). More
1018 specific or demanding situations should use that instead. Another
1019 option would be to use POSIX::uname(), however the latter appears to
1020 report only the OS family name and not the specific OS. In scalar
1021 context it returns just the ID.
1023 The name "WinXP/.Net" is used for historical reasons only, to maintain
1024 backwards compatibility of the Win32 module. Windows .NET Server has
1025 been renamed as Windows 2003 Server before final release and uses a
1026 different major/minor version number than Windows XP.
1028 Similarly the name "WinWin32s" should have been "Win32s" but has been
1029 kept as-is for backwards compatibility reasons too.
1031 =item Win32::GetOSVersion()
1033 [CORE] Returns the list (STRING, MAJOR, MINOR, BUILD, ID), where the
1034 elements are, respectively: An arbitrary descriptive string, the major
1035 version number of the operating system, the minor version number, the
1036 build number, and a digit indicating the actual operating system.
1037 For the ID, the values are 0 for Win32s, 1 for Windows 9X/Me and 2 for
1038 Windows NT/2000/XP/2003/Vista/2008/7. In scalar context it returns just
1041 Currently known values for ID MAJOR and MINOR are as follows:
1049 Windows NT 3.51 2 3 51
1054 Windows Server 2003 2 5 2
1055 Windows Server 2003 R2 2 5 2
1056 Windows Home Server 2 5 2
1059 Windows Server 2008 2 6 0
1061 Windows Server 2008 R2 2 6 1
1063 Windows Server 2012 2 6 2
1065 On Windows NT 4 SP6 and later this function returns the following
1066 additional values: SPMAJOR, SPMINOR, SUITEMASK, PRODUCTTYPE.
1068 The version numbers for Windows 2003 and Windows Home Server are
1069 identical; the SUITEMASK field must be used to differentiate between
1072 The version numbers for Windows Vista and Windows Server 2008 are
1073 identical; the PRODUCTTYPE field must be used to differentiate between
1076 The version numbers for Windows 7 and Windows Server 2008 R2 are
1077 identical; the PRODUCTTYPE field must be used to differentiate between
1080 The version numbers for Windows 8 and Windows Server 2012 are
1081 identical; the PRODUCTTYPE field must be used to differentiate between
1084 SPMAJOR and SPMINOR are the version numbers of the latest
1085 installed service pack.
1087 SUITEMASK is a bitfield identifying the product suites available on
1088 the system. Known bits are:
1090 VER_SUITE_SMALLBUSINESS 0x00000001
1091 VER_SUITE_ENTERPRISE 0x00000002
1092 VER_SUITE_BACKOFFICE 0x00000004
1093 VER_SUITE_COMMUNICATIONS 0x00000008
1094 VER_SUITE_TERMINAL 0x00000010
1095 VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
1096 VER_SUITE_EMBEDDEDNT 0x00000040
1097 VER_SUITE_DATACENTER 0x00000080
1098 VER_SUITE_SINGLEUSERTS 0x00000100
1099 VER_SUITE_PERSONAL 0x00000200
1100 VER_SUITE_BLADE 0x00000400
1101 VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
1102 VER_SUITE_SECURITY_APPLIANCE 0x00001000
1103 VER_SUITE_STORAGE_SERVER 0x00002000
1104 VER_SUITE_COMPUTE_SERVER 0x00004000
1105 VER_SUITE_WH_SERVER 0x00008000
1107 The VER_SUITE_xxx names are listed here to cross reference the Microsoft
1108 documentation. The Win32 module does not provide symbolic names for these
1111 PRODUCTTYPE provides additional information about the system. It should
1112 be one of the following integer values:
1114 1 - Workstation (NT 4, 2000 Pro, XP Home, XP Pro, Vista, etc)
1115 2 - Domaincontroller
1116 3 - Server (2000 Server, Server 2003, Server 2008, etc)
1118 Note that a server that is also a domain controller is reported as
1119 PRODUCTTYPE 2 (Domaincontroller) and not PRODUCTTYPE 3 (Server).
1121 =item Win32::GetShortPathName(PATHNAME)
1123 [CORE] Returns a representation of PATHNAME that is composed of short
1124 (8.3) path components where available. For path components where the
1125 file system has not generated the short form the returned path will
1126 use the long form, so this function might still for instance return a
1127 path containing spaces. Returns C<undef> when the PATHNAME does not
1128 exist. Compare with Win32::GetFullPathName() and
1129 Win32::GetLongPathName().
1131 =item Win32::GetSystemMetrics(INDEX)
1133 Retrieves the specified system metric or system configuration setting.
1134 Please refer to the Microsoft documentation of the GetSystemMetrics()
1135 function for a reference of available INDEX values. All system
1136 metrics return integer values.
1138 =item Win32::GetProcAddress(INSTANCE, PROCNAME)
1140 Returns the address of a function inside a loaded library. The
1141 information about what you can do with this address has been lost in
1142 the mist of time. Use the Win32::API module instead of this deprecated
1145 =item Win32::GetProductInfo(OSMAJOR, OSMINOR, SPMAJOR, SPMINOR)
1147 Retrieves the product type for the operating system on the local
1148 computer, and maps the type to the product types supported by the
1149 specified operating system. Please refer to the Microsoft
1150 documentation of the GetProductInfo() function for more information
1151 about the parameters and return value. This function requires Windows
1154 See also the Win32::GetOSName() and Win32::GetOSDisplayName()
1155 functions which provide a higher level abstraction of the data
1156 returned by this function.
1158 =item Win32::GetTickCount()
1160 [CORE] Returns the number of milliseconds elapsed since the last
1161 system boot. Resolution is limited to system timer ticks (about 10ms
1162 on WinNT and 55ms on Win9X).
1164 =item Win32::GuidGen()
1166 Creates a globally unique 128 bit integer that can be used as a
1167 persistent identifier in a distributed setting. To a very high degree
1168 of certainty this function returns a unique value. No other
1169 invocation, on the same or any other system (networked or not), should
1170 return the same value.
1172 The return value is formatted according to OLE conventions, as groups
1173 of hex digits with surrounding braces. For example:
1175 {09531CF1-D0C7-4860-840C-1C8C8735E2AD}
1177 =item Win32::InitiateSystemShutdown
1179 (MACHINE, MESSAGE, TIMEOUT, FORCECLOSE, REBOOT)
1181 Shutsdown the specified MACHINE, notifying users with the
1182 supplied MESSAGE, within the specified TIMEOUT interval. Forces
1183 closing of all documents without prompting the user if FORCECLOSE is
1184 true, and reboots the machine if REBOOT is true. This function works
1187 =item Win32::IsAdminUser()
1189 Returns non zero if the account in whose security context the
1190 current process/thread is running belongs to the local group of
1191 Administrators in the built-in system domain; returns 0 if not.
1192 On Windows Vista it will only return non-zero if the process is
1193 actually running with elevated privileges. Returns C<undef>
1194 and prints a warning if an error occurred. This function always
1197 =item Win32::IsWinNT()
1199 [CORE] Returns non zero if the Win32 subsystem is Windows NT.
1201 =item Win32::IsWin95()
1203 [CORE] Returns non zero if the Win32 subsystem is Windows 95.
1205 =item Win32::LoadLibrary(LIBNAME)
1207 Loads a dynamic link library into memory and returns its module
1208 handle. This handle can be used with Win32::GetProcAddress() and
1209 Win32::FreeLibrary(). This function is deprecated. Use the Win32::API
1212 =item Win32::LoginName()
1214 [CORE] Returns the username of the owner of the current perl process.
1215 The return value may be a Unicode string.
1217 =item Win32::LookupAccountName(SYSTEM, ACCOUNT, DOMAIN, SID, SIDTYPE)
1219 Looks up ACCOUNT on SYSTEM and returns the domain name the SID and
1222 =item Win32::LookupAccountSID(SYSTEM, SID, ACCOUNT, DOMAIN, SIDTYPE)
1224 Looks up SID on SYSTEM and returns the account name, domain name,
1227 =item Win32::MsgBox(MESSAGE [, FLAGS [, TITLE]])
1229 Create a dialog box containing MESSAGE. FLAGS specifies the
1230 required icon and buttons according to the following table:
1234 2 = Abort, Retry, and Ignore
1235 3 = Yes, No and Cancel
1237 5 = Retry and Cancel
1239 MB_ICONSTOP "X" in a red circle
1240 MB_ICONQUESTION question mark in a bubble
1241 MB_ICONEXCLAMATION exclamation mark in a yellow triangle
1242 MB_ICONINFORMATION "i" in a bubble
1244 TITLE specifies an optional window title. The default is "Perl".
1246 The function returns the menu id of the selected push button:
1258 =item Win32::NodeName()
1260 [CORE] Returns the Microsoft Network node-name of the current machine.
1262 =item Win32::OutputDebugString(STRING)
1264 Sends a string to the application or system debugger for display.
1265 The function does nothing if there is no active debugger.
1267 Alternatively one can use the I<Debug Viewer> application to
1268 watch the OutputDebugString() output:
1270 http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx
1272 =item Win32::RegisterServer(LIBRARYNAME)
1274 Loads the DLL LIBRARYNAME and calls the function DllRegisterServer.
1276 =item Win32::SetChildShowWindow(SHOWWINDOW)
1278 [CORE] Sets the I<ShowMode> of child processes started by system().
1279 By default system() will create a new console window for child
1280 processes if Perl itself is not running from a console. Calling
1281 SetChildShowWindow(0) will make these new console windows invisible.
1282 Calling SetChildShowWindow() without arguments reverts system() to the
1283 default behavior. The return value of SetChildShowWindow() is the
1284 previous setting or C<undef>.
1286 The following symbolic constants for SHOWWINDOW are available
1287 (but not exported) from the Win32 module: SW_HIDE, SW_SHOWNORMAL,
1288 SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED and SW_SHOWNOACTIVATE.
1290 =item Win32::SetConsoleCP(ID)
1292 Sets the input code page used by the console associated with the
1293 calling process. The return value of SetConsoleCP() is nonzero on
1294 success or zero on failure. To get the console's input code page, see
1297 =item Win32::SetConsoleOutputCP(ID)
1299 Sets the output code page used by the console associated with the
1300 calling process. The return value of SetConsoleOutputCP() is nonzero on
1301 success or zero on failure. To get the console's output code page, see
1302 GetConsoleOutputCP().
1304 =item Win32::SetCwd(NEWDIRECTORY)
1306 [CORE] Sets the current active drive and directory. This function does not
1307 work with UNC paths, since the functionality required to required for
1308 such a feature is not available under Windows 95.
1310 =item Win32::SetLastError(ERROR)
1312 [CORE] Sets the value of the last error encountered to ERROR. This is
1313 that value that will be returned by the Win32::GetLastError()
1316 =item Win32::Sleep(TIME)
1318 [CORE] Pauses for TIME milliseconds. The timeslices are made available
1319 to other processes and threads.
1321 =item Win32::Spawn(COMMAND, ARGS, PID)
1323 [CORE] Spawns a new process using the supplied COMMAND, passing in
1324 arguments in the string ARGS. The pid of the new process is stored in
1325 PID. This function is deprecated. Please use the Win32::Process module
1328 =item Win32::UnregisterServer(LIBRARYNAME)
1330 Loads the DLL LIBRARYNAME and calls the function
1331 DllUnregisterServer.