This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Win32API::File now in core
[perl5.git] / win32 / ext / Win32 / Win32.pm
CommitLineData
b4ad57f4
NC
1package Win32;
2
3BEGIN {
4 use strict;
5 use vars qw|$VERSION @ISA @EXPORT @EXPORT_OK|;
6
7 require Exporter;
8 require DynaLoader;
9
10 @ISA = qw|Exporter DynaLoader|;
7b3f41f4 11 $VERSION = '0.2601';
b4ad57f4
NC
12
13 @EXPORT = qw(
14 NULL
15 WIN31_CLASS
16 OWNER_SECURITY_INFORMATION
17 GROUP_SECURITY_INFORMATION
18 DACL_SECURITY_INFORMATION
19 SACL_SECURITY_INFORMATION
20 MB_ICONHAND
21 MB_ICONQUESTION
22 MB_ICONEXCLAMATION
23 MB_ICONASTERISK
24 MB_ICONWARNING
25 MB_ICONERROR
26 MB_ICONINFORMATION
27 MB_ICONSTOP
28 );
29 @EXPORT_OK = qw(
30 GetOSName
31 SW_HIDE
32 SW_SHOWNORMAL
33 SW_SHOWMINIMIZED
34 SW_SHOWMAXIMIZED
35 SW_SHOWNOACTIVATE
36
37 CSIDL_DESKTOP
38 CSIDL_PROGRAMS
39 CSIDL_PERSONAL
40 CSIDL_FAVORITES
41 CSIDL_STARTUP
42 CSIDL_RECENT
43 CSIDL_SENDTO
44 CSIDL_STARTMENU
45 CSIDL_MYMUSIC
46 CSIDL_MYVIDEO
47 CSIDL_DESKTOPDIRECTORY
48 CSIDL_NETHOOD
49 CSIDL_FONTS
50 CSIDL_TEMPLATES
51 CSIDL_COMMON_STARTMENU
52 CSIDL_COMMON_PROGRAMS
53 CSIDL_COMMON_STARTUP
54 CSIDL_COMMON_DESKTOPDIRECTORY
55 CSIDL_APPDATA
56 CSIDL_PRINTHOOD
57 CSIDL_LOCAL_APPDATA
58 CSIDL_COMMON_FAVORITES
59 CSIDL_INTERNET_CACHE
60 CSIDL_COOKIES
61 CSIDL_HISTORY
62 CSIDL_COMMON_APPDATA
63 CSIDL_WINDOWS
64 CSIDL_SYSTEM
65 CSIDL_PROGRAM_FILES
66 CSIDL_MYPICTURES
67 CSIDL_PROFILE
68 CSIDL_PROGRAM_FILES_COMMON
69 CSIDL_COMMON_TEMPLATES
70 CSIDL_COMMON_DOCUMENTS
71 CSIDL_COMMON_ADMINTOOLS
72 CSIDL_ADMINTOOLS
73 CSIDL_COMMON_MUSIC
74 CSIDL_COMMON_PICTURES
75 CSIDL_COMMON_VIDEO
76 CSIDL_RESOURCES
77 CSIDL_RESOURCES_LOCALIZED
78 CSIDL_CDBURN_AREA
79 );
80}
81
82# Routines available in core:
83# Win32::GetLastError
84# Win32::LoginName
85# Win32::NodeName
86# Win32::DomainName
87# Win32::FsType
88# Win32::GetCwd
89# Win32::GetOSVersion
90# Win32::FormatMessage ERRORCODE
91# Win32::Spawn COMMAND, ARGS, PID
92# Win32::GetTickCount
93# Win32::IsWinNT
94# Win32::IsWin95
95
96# We won't bother with the constant stuff, too much of a hassle. Just hard
97# code it here.
98
99sub NULL { 0 }
100sub WIN31_CLASS { &NULL }
101
102sub OWNER_SECURITY_INFORMATION { 0x00000001 }
103sub GROUP_SECURITY_INFORMATION { 0x00000002 }
104sub DACL_SECURITY_INFORMATION { 0x00000004 }
105sub SACL_SECURITY_INFORMATION { 0x00000008 }
106
107sub MB_ICONHAND { 0x00000010 }
108sub MB_ICONQUESTION { 0x00000020 }
109sub MB_ICONEXCLAMATION { 0x00000030 }
110sub MB_ICONASTERISK { 0x00000040 }
111sub MB_ICONWARNING { 0x00000030 }
112sub MB_ICONERROR { 0x00000010 }
113sub MB_ICONINFORMATION { 0x00000040 }
114sub MB_ICONSTOP { 0x00000010 }
115
116#
117# Newly added constants. These have an empty prototype, unlike the
118# the ones above, which aren't prototyped for compatibility reasons.
119#
120sub SW_HIDE () { 0 }
121sub SW_SHOWNORMAL () { 1 }
122sub SW_SHOWMINIMIZED () { 2 }
123sub SW_SHOWMAXIMIZED () { 3 }
124sub SW_SHOWNOACTIVATE () { 4 }
125
126sub CSIDL_DESKTOP () { 0x0000 } # <desktop>
127sub CSIDL_PROGRAMS () { 0x0002 } # Start Menu\Programs
128sub CSIDL_PERSONAL () { 0x0005 } # "My Documents" folder
129sub CSIDL_FAVORITES () { 0x0006 } # <user name>\Favorites
130sub CSIDL_STARTUP () { 0x0007 } # Start Menu\Programs\Startup
131sub CSIDL_RECENT () { 0x0008 } # <user name>\Recent
132sub CSIDL_SENDTO () { 0x0009 } # <user name>\SendTo
133sub CSIDL_STARTMENU () { 0x000B } # <user name>\Start Menu
134sub CSIDL_MYMUSIC () { 0x000D } # "My Music" folder
135sub CSIDL_MYVIDEO () { 0x000E } # "My Videos" folder
136sub CSIDL_DESKTOPDIRECTORY () { 0x0010 } # <user name>\Desktop
137sub CSIDL_NETHOOD () { 0x0013 } # <user name>\nethood
138sub CSIDL_FONTS () { 0x0014 } # windows\fonts
139sub CSIDL_TEMPLATES () { 0x0015 }
140sub CSIDL_COMMON_STARTMENU () { 0x0016 } # All Users\Start Menu
141sub CSIDL_COMMON_PROGRAMS () { 0x0017 } # All Users\Start Menu\Programs
142sub CSIDL_COMMON_STARTUP () { 0x0018 } # All Users\Startup
143sub CSIDL_COMMON_DESKTOPDIRECTORY () { 0x0019 } # All Users\Desktop
144sub CSIDL_APPDATA () { 0x001A } # Application Data, new for NT4
145sub CSIDL_PRINTHOOD () { 0x001B } # <user name>\PrintHood
146sub CSIDL_LOCAL_APPDATA () { 0x001C } # non roaming, user\Local Settings\Application Data
147sub CSIDL_COMMON_FAVORITES () { 0x001F }
148sub CSIDL_INTERNET_CACHE () { 0x0020 }
149sub CSIDL_COOKIES () { 0x0021 }
150sub CSIDL_HISTORY () { 0x0022 }
151sub CSIDL_COMMON_APPDATA () { 0x0023 } # All Users\Application Data
152sub CSIDL_WINDOWS () { 0x0024 } # GetWindowsDirectory()
153sub CSIDL_SYSTEM () { 0x0025 } # GetSystemDirectory()
154sub CSIDL_PROGRAM_FILES () { 0x0026 } # C:\Program Files
155sub CSIDL_MYPICTURES () { 0x0027 } # "My Pictures", new for Win2K
156sub CSIDL_PROFILE () { 0x0028 } # USERPROFILE
157sub CSIDL_PROGRAM_FILES_COMMON () { 0x002B } # C:\Program Files\Common
158sub CSIDL_COMMON_TEMPLATES () { 0x002D } # All Users\Templates
159sub CSIDL_COMMON_DOCUMENTS () { 0x002E } # All Users\Documents
160sub CSIDL_COMMON_ADMINTOOLS () { 0x002F } # All Users\Start Menu\Programs\Administrative Tools
161sub CSIDL_ADMINTOOLS () { 0x0030 } # <user name>\Start Menu\Programs\Administrative Tools
162sub CSIDL_COMMON_MUSIC () { 0x0035 } # All Users\My Music
163sub CSIDL_COMMON_PICTURES () { 0x0036 } # All Users\My Pictures
164sub CSIDL_COMMON_VIDEO () { 0x0037 } # All Users\My Video
165sub CSIDL_RESOURCES () { 0x0038 } # %windir%\Resources\, For theme and other windows resources.
166sub CSIDL_RESOURCES_LOCALIZED () { 0x0039 } # %windir%\Resources\<LangID>, for theme and other windows specific resources.
167sub CSIDL_CDBURN_AREA () { 0x003B } # <user name>\Local Settings\Application Data\Microsoft\CD Burning
168
169### This method is just a simple interface into GetOSVersion(). More
170### specific or demanding situations should use that instead.
171
172my ($found_os, $found_desc);
173
174sub GetOSName {
175 my ($os,$desc,$major, $minor, $build, $id)=("","");
176 unless (defined $found_os) {
177 # If we have a run this already, we have the results cached
178 # If so, return them
179
180 # Use the standard API call to determine the version
181 ($desc, $major, $minor, $build, $id) = Win32::GetOSVersion();
182
183 # If id==0 then its a win32s box -- Meaning Win3.11
184 unless($id) {
185 $os = 'Win32s';
186 }
187 else {
188 # Magic numbers from MSDN documentation of OSVERSIONINFO
189 # Most version names can be parsed from just the id and minor
190 # version
191 $os = {
192 1 => {
193 0 => "95",
194 10 => "98",
195 90 => "Me"
196 },
197 2 => {
b76aa5af 198 0 => "NT4",
b4ad57f4 199 1 => "XP/.Net",
b76aa5af 200 2 => "2003",
b4ad57f4
NC
201 51 => "NT3.51"
202 }
203 }->{$id}->{$minor};
204 }
205
206 # This _really_ shouldnt happen. At least not for quite a while
207 # Politely warn and return undef
208 unless (defined $os) {
209 warn qq[Windows version [$id:$major:$minor] unknown!];
210 return undef;
211 }
212
213 my $tag = "";
214
b76aa5af
JD
215 # But distinguising W2k and Vista from NT4 requires looking at the major version
216 if ($os eq "NT4") {
217 $os = {5 => "2000", 6 => "Vista"}->{$major} || "NT4";
b4ad57f4
NC
218 }
219
220 # For the rest we take a look at the build numbers and try to deduce
221 # the exact release name, but we put that in the $desc
222 elsif ($os eq "95") {
223 if ($build eq '67109814') {
224 $tag = '(a)';
225 }
226 elsif ($build eq '67306684') {
227 $tag = '(b1)';
228 }
229 elsif ($build eq '67109975') {
230 $tag = '(b2)';
231 }
232 }
233 elsif ($os eq "98" && $build eq '67766446') {
234 $tag = '(2nd ed)';
235 }
236
237 if (length $tag) {
238 if (length $desc) {
239 $desc = "$tag $desc";
240 }
241 else {
242 $desc = $tag;
243 }
244 }
245
246 # cache the results, so we dont have to do this again
247 $found_os = "Win$os";
248 $found_desc = $desc;
249 }
250
251 return wantarray ? ($found_os, $found_desc) : $found_os;
252}
253
254bootstrap Win32;
255
2561;
257
258__END__
259
1674ad2b
JD
260=head1 NAME
261
262Win32 - Interfaces to some Win32 API Functions
263
264=head1 DESCRIPTION
265
b4ad57f4 266Perl on Win32 contains several functions to access Win32 APIs. Some
1674ad2b
JD
267are included in Perl itself (on Win32) and some are only available
268after explicitly requesting the Win32 module with:
269
270 use Win32;
271
272The builtin functions are marked as [CORE] and the other ones
b4ad57f4 273as [EXT] in the following alphabetical listing.
1674ad2b
JD
274
275=head2 Alphabetical Listing of Win32 Functions
276
277=over
278
279=item Win32::AbortSystemShutdown(MACHINE)
280
281[EXT] Aborts a system shutdown (started by the
282InitiateSystemShutdown function) on the specified MACHINE.
283
284=item Win32::BuildNumber()
285
b4ad57f4 286[CORE] Returns the ActivePerl build number. This function is
1674ad2b
JD
287only available in the ActivePerl binary distribution.
288
289=item Win32::CopyFile(FROM, TO, OVERWRITE)
290
625a29bd 291[CORE] The Win32::CopyFile() function copies an existing file to a new
b4ad57f4
NC
292file. All file information like creation time and file attributes will
293be copied to the new file. However it will B<not> copy the security
294information. If the destination file already exists it will only be
295overwritten when the OVERWRITE parameter is true. But even this will
625a29bd
GS
296not overwrite a read-only file; you have to unlink() it first
297yourself.
1674ad2b
JD
298
299=item Win32::DomainName()
300
301[CORE] Returns the name of the Microsoft Network domain that the
da147683
JD
302owner of the current perl process is logged into. This function does
303B<not> work on Windows 9x.
1674ad2b
JD
304
305=item Win32::ExpandEnvironmentStrings(STRING)
306
307[EXT] Takes STRING and replaces all referenced environment variable
b4ad57f4
NC
308names with their defined values. References to environment variables
309take the form C<%VariableName%>. Case is ignored when looking up the
310VariableName in the environment. If the variable is not found then the
1674ad2b
JD
311original C<%VariableName%> text is retained. Has the same effect
312as the following:
313
314 $string =~ s/%([^%]*)%/$ENV{$1} || "%$1%"/eg
315
316=item Win32::FormatMessage(ERRORCODE)
317
318[CORE] Converts the supplied Win32 error number (e.g. returned by
319Win32::GetLastError()) to a descriptive string. Analogous to the
320perror() standard-C library function. Note that C<$^E> used
321in a string context has much the same effect.
322
323 C:\> perl -e "$^E = 26; print $^E;"
324 The specified disk or diskette cannot be accessed
325
326=item Win32::FsType()
327
328[CORE] Returns the name of the filesystem of the currently active
b4ad57f4
NC
329drive (like 'FAT' or 'NTFS'). In list context it returns three values:
330(FSTYPE, FLAGS, MAXCOMPLEN). FSTYPE is the filesystem type as
331before. FLAGS is a combination of values of the following table:
1674ad2b
JD
332
333 0x00000001 supports case-sensitive filenames
334 0x00000002 preserves the case of filenames
335 0x00000004 supports Unicode in filenames
336 0x00000008 preserves and enforces ACLs
337 0x00000010 supports file-based compression
338 0x00000020 supports disk quotas
339 0x00000040 supports sparse files
340 0x00000080 supports reparse points
341 0x00000100 supports remote storage
342 0x00008000 is a compressed volume (e.g. DoubleSpace)
343 0x00010000 supports object identifiers
344 0x00020000 supports the Encrypted File System (EFS)
345
346MAXCOMPLEN is the maximum length of a filename component (the part
347between two backslashes) on this file system.
348
349=item Win32::FreeLibrary(HANDLE)
350
b4ad57f4
NC
351[EXT] Unloads a previously loaded dynamic-link library. The HANDLE is
352no longer valid after this call. See L<LoadLibrary|Win32::LoadLibrary(LIBNAME)>
4a4eefd0 353for information on dynamically loading a library.
1674ad2b
JD
354
355=item Win32::GetArchName()
356
b4ad57f4
NC
357[EXT] Use of this function is deprecated. It is equivalent with
358$ENV{PROCESSOR_ARCHITECTURE}. This might not work on Win9X.
1674ad2b
JD
359
360=item Win32::GetChipName()
361
362[EXT] Returns the processor type: 386, 486 or 586 for Intel processors,
36321064 for the Alpha chip.
364
365=item Win32::GetCwd()
366
b4ad57f4 367[CORE] Returns the current active drive and directory. This function
1674ad2b
JD
368does not return a UNC path, since the functionality required for such
369a feature is not available under Windows 95.
370
e364e11c
JD
371=item Win32::GetFileVersion(FILENAME)
372
373[EXT] Returns the file version number from the VERSIONINFO resource of
374the executable file or DLL. This is a tuple of four 16 bit numbers.
375In list context these four numbers will be returned. In scalar context
376they are concatenated into a string, separated by dots.
377
87755fa7
GS
378=item Win32::GetFolderPath(FOLDER [, CREATE])
379
380[EXT] Returns the full pathname of one of the Windows special folders.
381The folder will be created if it doesn't exist and the optional CREATE
382argument is true. The following FOLDER constants are defined by the
383Win32 module, but only exported on demand:
384
385 CSIDL_ADMINTOOLS
386 CSIDL_APPDATA
387 CSIDL_CDBURN_AREA
388 CSIDL_COMMON_ADMINTOOLS
389 CSIDL_COMMON_APPDATA
390 CSIDL_COMMON_DESKTOPDIRECTORY
391 CSIDL_COMMON_DOCUMENTS
392 CSIDL_COMMON_FAVORITES
393 CSIDL_COMMON_MUSIC
394 CSIDL_COMMON_PICTURES
395 CSIDL_COMMON_PROGRAMS
396 CSIDL_COMMON_STARTMENU
397 CSIDL_COMMON_STARTUP
398 CSIDL_COMMON_TEMPLATES
399 CSIDL_COMMON_VIDEO
400 CSIDL_COOKIES
401 CSIDL_DESKTOP
402 CSIDL_DESKTOPDIRECTORY
403 CSIDL_FAVORITES
404 CSIDL_FONTS
405 CSIDL_HISTORY
406 CSIDL_INTERNET_CACHE
407 CSIDL_LOCAL_APPDATA
408 CSIDL_MYMUSIC
409 CSIDL_MYPICTURES
410 CSIDL_MYVIDEO
411 CSIDL_NETHOOD
412 CSIDL_PERSONAL
413 CSIDL_PRINTHOOD
414 CSIDL_PROFILE
415 CSIDL_PROGRAMS
416 CSIDL_PROGRAM_FILES
417 CSIDL_PROGRAM_FILES_COMMON
418 CSIDL_RECENT
419 CSIDL_RESOURCES
420 CSIDL_RESOURCES_LOCALIZED
421 CSIDL_SENDTO
422 CSIDL_STARTMENU
423 CSIDL_STARTUP
424 CSIDL_SYSTEM
425 CSIDL_TEMPLATES
426 CSIDL_WINDOWS
427
428Note that not all folders are defined on all versions of Windows.
429
430Please refer to the MSDN documentation of the CSIDL constants,
431currently available at:
432
433http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/enums/csidl.asp
434
1674ad2b
JD
435=item Win32::GetFullPathName(FILENAME)
436
437[CORE] GetFullPathName combines the FILENAME with the current drive
438and directory name and returns a fully qualified (aka, absolute)
b4ad57f4 439path name. In list context it returns two elements: (PATH, FILE) where
1674ad2b
JD
440PATH is the complete pathname component (including trailing backslash)
441and FILE is just the filename part. Note that no attempt is made to
442convert 8.3 components in the supplied FILENAME to longnames or
443vice-versa. Compare with Win32::GetShortPathName and
b4ad57f4 444Win32::GetLongPathName.
1674ad2b
JD
445
446=item Win32::GetLastError()
447
448[CORE] Returns the last error value generated by a call to a Win32 API
449function. Note that C<$^E> used in a numeric context amounts to the
450same value.
451
452=item Win32::GetLongPathName(PATHNAME)
453
4375e838 454[CORE] Returns a representation of PATHNAME composed of longname
da2094fd 455components (if any). The result may not necessarily be longer
1674ad2b
JD
456than PATHNAME. No attempt is made to convert PATHNAME to the
457absolute path. Compare with Win32::GetShortPathName and
458Win32::GetFullPathName.
459
1674ad2b
JD
460=item Win32::GetNextAvailDrive()
461
462[CORE] Returns a string in the form of "<d>:" where <d> is the first
463available drive letter.
464
465=item Win32::GetOSVersion()
466
3e526985 467[CORE] Returns the list (STRING, MAJOR, MINOR, BUILD, ID), where the
d10f8d7a
YO
468elements are, respectively: An arbitrary descriptive string, the major
469version number of the operating system, the minor version number, the
470build number, and a digit indicating the actual operating system.
3e526985
JD
471For the ID, the values are 0 for Win32s, 1 for Windows 9X/Me and 2 for
472Windows NT/2000/XP/2003. In scalar context it returns just the ID.
d10f8d7a
YO
473
474Currently known values for ID MAJOR and MINOR are as follows:
475
476 OS ID MAJOR MINOR
477 Win32s 0 - -
478 Windows 95 1 4 0
479 Windows 98 1 4 10
480 Windows Me 1 4 90
481 Windows NT 3.51 2 3 51
482 Windows NT 4 2 4 0
483 Windows 2000 2 5 0
484 Windows XP 2 5 1
3e526985 485 Windows Server 2003 2 5 2
b76aa5af 486 Windows Vista 2 6 0
3e526985
JD
487
488On Windows NT 4 SP6 and later this function returns the following
489additional values: SPMAJOR, SPMINOR, SUITEMASK, PRODUCTTYPE.
490
491SPMAJOR and SPMINOR are are the version numbers of the latest
492installed service pack.
493
494SUITEMASK is a bitfield identifying the product suites available on
495the system. Known bits are:
496
497 VER_SUITE_SMALLBUSINESS 0x00000001
498 VER_SUITE_ENTERPRISE 0x00000002
499 VER_SUITE_BACKOFFICE 0x00000004
500 VER_SUITE_COMMUNICATIONS 0x00000008
501 VER_SUITE_TERMINAL 0x00000010
502 VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
503 VER_SUITE_EMBEDDEDNT 0x00000040
504 VER_SUITE_DATACENTER 0x00000080
505 VER_SUITE_SINGLEUSERTS 0x00000100
506 VER_SUITE_PERSONAL 0x00000200
507 VER_SUITE_BLADE 0x00000400
508 VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
509 VER_SUITE_SECURITY_APPLIANCE 0x00001000
510
511The VER_SUITE_xxx names are listed here to crossreference the Microsoft
512documentation. The Win32 module does not provide symbolic names for these
513constants.
514
515PRODUCTTYPE provides additional information about the system. It should
516be one of the following integer values:
517
518 1 - Workstation (NT 4, 2000 Pro, XP Home, XP Pro)
519 2 - Domaincontroller
520 3 - Server
d10f8d7a
YO
521
522=item Win32::GetOSName()
523
524[EXT] In scalar context returns the name of the Win32 operating system
525being used. In list context returns a two element list of the OS name
526and whatever edition information is known about the particular build
b4ad57f4 527(for Win9X boxes) and whatever service packs have been installed.
d10f8d7a
YO
528The latter is roughly equivalent to the first item returned by
529GetOSVersion() in list context.
530
531Currently the possible values for the OS name are
532
3e526985 533 Win32s Win95 Win98 WinMe WinNT3.51 WinNT4 Win2000 WinXP/.Net Win2003
d10f8d7a
YO
534
535This routine is just a simple interface into GetOSVersion(). More
536specific or demanding situations should use that instead. Another
537option would be to use POSIX::uname(), however the latter appears to
538report only the OS family name and not the specific OS. In scalar
539context it returns just the ID.
1674ad2b 540
3e526985
JD
541The name "WinXP/.Net" is used for historical reasons only, to maintain
542backwards compatibility of the Win32 module. Windows .NET Server has
543been renamed as Windows 2003 Server before final release and uses a
544different major/minor version number than Windows XP.
545
1674ad2b
JD
546=item Win32::GetShortPathName(PATHNAME)
547
eb6bfc3a
GA
548[CORE] Returns a representation of PATHNAME that is composed of short
549(8.3) path components where available. For path components where the
550file system has not generated the short form the returned path will
551use the long form, so this function might still for instance return a
552path containing spaces. Compare with Win32::GetFullPathName and
1674ad2b
JD
553Win32::GetLongPathName.
554
555=item Win32::GetProcAddress(INSTANCE, PROCNAME)
556
b4ad57f4 557[EXT] Returns the address of a function inside a loaded library. The
1674ad2b 558information about what you can do with this address has been lost in
b4ad57f4 559the mist of time. Use the Win32::API module instead of this deprecated
1674ad2b
JD
560function.
561
562=item Win32::GetTickCount()
563
564[CORE] Returns the number of milliseconds elapsed since the last
b4ad57f4 565system boot. Resolution is limited to system timer ticks (about 10ms
1674ad2b
JD
566on WinNT and 55ms on Win9X).
567
e364e11c
JD
568=item Win32::GuidGen()
569
570[EXT] Creates a globally unique 128 bit integer that can be used as a
571persistent identifier in a distributed setting. To a very high degree
572of certainty this function returns a unique value. No other
573invocation, on the same or any other system (networked or not), should
574return the same value.
575
576The return value is formatted according to OLE conventions, as groups
577of hex digits with surrounding braces. For example:
578
579 {09531CF1-D0C7-4860-840C-1C8C8735E2AD}
580
cb49b31f 581=item Win32::InitiateSystemShutdown
551e1d92 582
cb49b31f 583(MACHINE, MESSAGE, TIMEOUT, FORCECLOSE, REBOOT)
1674ad2b
JD
584
585[EXT] Shutsdown the specified MACHINE, notifying users with the
b4ad57f4 586supplied MESSAGE, within the specified TIMEOUT interval. Forces
1674ad2b 587closing of all documents without prompting the user if FORCECLOSE is
b4ad57f4 588true, and reboots the machine if REBOOT is true. This function works
1674ad2b
JD
589only on WinNT.
590
b4ad57f4
NC
591=item Win32::IsAdminUser()
592
593[EXT] Returns non zero if the account in whose security context the
594current process/thread is running belongs to the local group of
595Administrators in the built-in system domain; returns 0 if not.
596Returns the undefined value and prints a warning if an error occurred.
597This function always returns 1 on Win9X.
598
1674ad2b
JD
599=item Win32::IsWinNT()
600
601[CORE] Returns non zero if the Win32 subsystem is Windows NT.
602
603=item Win32::IsWin95()
604
605[CORE] Returns non zero if the Win32 subsystem is Windows 95.
606
607=item Win32::LoadLibrary(LIBNAME)
608
609[EXT] Loads a dynamic link library into memory and returns its module
b4ad57f4
NC
610handle. This handle can be used with Win32::GetProcAddress and
611Win32::FreeLibrary. This function is deprecated. Use the Win32::API
1674ad2b
JD
612module instead.
613
614=item Win32::LoginName()
615
616[CORE] Returns the username of the owner of the current perl process.
617
618=item Win32::LookupAccountName(SYSTEM, ACCOUNT, DOMAIN, SID, SIDTYPE)
619
620[EXT] Looks up ACCOUNT on SYSTEM and returns the domain name the SID and
621the SID type.
622
623=item Win32::LookupAccountSID(SYSTEM, SID, ACCOUNT, DOMAIN, SIDTYPE)
624
625a29bd 625[EXT] Looks up SID on SYSTEM and returns the account name, domain name,
1674ad2b
JD
626and the SID type.
627
628=item Win32::MsgBox(MESSAGE [, FLAGS [, TITLE]])
629
b4ad57f4 630[EXT] Create a dialogbox containing MESSAGE. FLAGS specifies the
1674ad2b
JD
631required icon and buttons according to the following table:
632
633 0 = OK
634 1 = OK and Cancel
635 2 = Abort, Retry, and Ignore
636 3 = Yes, No and Cancel
637 4 = Yes and No
638 5 = Retry and Cancel
639
640 MB_ICONSTOP "X" in a red circle
641 MB_ICONQUESTION question mark in a bubble
642 MB_ICONEXCLAMATION exclamation mark in a yellow triangle
643 MB_ICONINFORMATION "i" in a bubble
644
b4ad57f4 645TITLE specifies an optional window title. The default is "Perl".
1674ad2b
JD
646
647The function returns the menu id of the selected push button:
648
649 0 Error
650
651 1 OK
652 2 Cancel
653 3 Abort
654 4 Retry
655 5 Ignore
656 6 Yes
657 7 No
658
659=item Win32::NodeName()
660
661[CORE] Returns the Microsoft Network node-name of the current machine.
662
663=item Win32::RegisterServer(LIBRARYNAME)
664
665[EXT] Loads the DLL LIBRARYNAME and calls the function DllRegisterServer.
666
02637f4c
JD
667=item Win32::SetChildShowWindow(SHOWWINDOW)
668
669[CORE] Sets the I<ShowMode> of child processes started by system().
670By default system() will create a new console window for child
b4ad57f4 671processes if Perl itself is not running from a console. Calling
02637f4c
JD
672SetChildShowWindow(0) will make these new console windows invisible.
673Calling SetChildShowWindow() without arguments reverts system() to the
674default behavior. The return value of SetChildShowWindow() is the
675previous setting or C<undef>.
676
677[EXT] The following symbolic constants for SHOWWINDOW are available
678(but not exported) from the Win32 module: SW_HIDE, SW_SHOWNORMAL,
679SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED and SW_SHOWNOACTIVATE.
680
1674ad2b
JD
681=item Win32::SetCwd(NEWDIRECTORY)
682
b4ad57f4 683[CORE] Sets the current active drive and directory. This function does not
1674ad2b
JD
684work with UNC paths, since the functionality required to required for
685such a feature is not available under Windows 95.
686
687=item Win32::SetLastError(ERROR)
688
b4ad57f4 689[CORE] Sets the value of the last error encountered to ERROR. This is
1674ad2b 690that value that will be returned by the Win32::GetLastError()
b4ad57f4 691function.
1674ad2b
JD
692
693=item Win32::Sleep(TIME)
694
b4ad57f4 695[CORE] Pauses for TIME milliseconds. The timeslices are made available
1674ad2b
JD
696to other processes and threads.
697
698=item Win32::Spawn(COMMAND, ARGS, PID)
699
700[CORE] Spawns a new process using the supplied COMMAND, passing in
b4ad57f4
NC
701arguments in the string ARGS. The pid of the new process is stored in
702PID. This function is deprecated. Please use the Win32::Process module
1674ad2b
JD
703instead.
704
705=item Win32::UnregisterServer(LIBRARYNAME)
706
707[EXT] Loads the DLL LIBRARYNAME and calls the function
708DllUnregisterServer.
709
710=back
711
712=cut