3 * Copyright (C) 2007 by Larry Wall and others
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
10 #define WIN32_LEAN_AND_MEAN
13 #if defined(__CYGWIN__) && !defined(USEIMPORTLIB)
16 #define PERL_NO_GET_CONTEXT
18 #if defined(__CYGWIN__) && !defined(USEIMPORTLIB)
19 #define EXTCONST extern const
27 DWORD err = GetLastError();
28 /* capture the XSANY value before Perl_load_module, the CV's any member will
29 * be overwritten by Perl_load_module and subsequent newXSes or pure perl
32 const char *function = (const char *) XSANY.any_ptr;
33 Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpvn("Win32",5), newSVnv(0.27));
37 call_pv(function, GIMME_V);
40 XS_EXTERNAL(boot_Win32CORE)
42 /* This function only exists because writemain.SH, lib/ExtUtils/Embed.pm
43 * and win32/buildext.pl will all generate references to it. The function
44 * should never be called though, as Win32CORE.pm doesn't use DynaLoader.
47 #if !defined(__CYGWIN__) || defined(USEIMPORTLIB)
53 /* This function is called from init_os_extras(). The Perl interpreter
54 * is not yet fully initialized, so don't do anything fancy in here.
58 char Win32__GetCwd [sizeof("Win32::GetCwd")];
59 char Win32__SetCwd [sizeof("Win32::SetCwd")];
60 char Win32__GetNextAvailDrive [sizeof("Win32::GetNextAvailDrive")];
61 char Win32__GetLastError [sizeof("Win32::GetLastError")];
62 char Win32__SetLastError [sizeof("Win32::SetLastError")];
63 char Win32__LoginName [sizeof("Win32::LoginName")];
64 char Win32__NodeName [sizeof("Win32::NodeName")];
65 char Win32__DomainName [sizeof("Win32::DomainName")];
66 char Win32__FsType [sizeof("Win32::FsType")];
67 char Win32__GetOSVersion [sizeof("Win32::GetOSVersion")];
68 char Win32__IsWinNT [sizeof("Win32::IsWinNT")];
69 char Win32__IsWin95 [sizeof("Win32::IsWin95")];
70 char Win32__FormatMessage [sizeof("Win32::FormatMessage")];
71 char Win32__Spawn [sizeof("Win32::Spawn")];
72 char Win32__GetTickCount [sizeof("Win32::GetTickCount")];
73 char Win32__GetShortPathName [sizeof("Win32::GetShortPathName")];
74 char Win32__GetFullPathName [sizeof("Win32::GetFullPathName")];
75 char Win32__GetLongPathName [sizeof("Win32::GetLongPathName")];
76 char Win32__CopyFile [sizeof("Win32::CopyFile")];
77 char Win32__Sleep [sizeof("Win32::Sleep")];
81 "Win32::GetNextAvailDrive",
82 "Win32::GetLastError",
83 "Win32::SetLastError",
88 "Win32::GetOSVersion",
91 "Win32::FormatMessage",
93 "Win32::GetTickCount",
94 "Win32::GetShortPathName",
95 "Win32::GetFullPathName",
96 "Win32::GetLongPathName",
101 static const unsigned char fnname_lens [] = {
102 sizeof("Win32::GetCwd"),
103 sizeof("Win32::SetCwd"),
104 sizeof("Win32::GetNextAvailDrive"),
105 sizeof("Win32::GetLastError"),
106 sizeof("Win32::SetLastError"),
107 sizeof("Win32::LoginName"),
108 sizeof("Win32::NodeName"),
109 sizeof("Win32::DomainName"),
110 sizeof("Win32::FsType"),
111 sizeof("Win32::GetOSVersion"),
112 sizeof("Win32::IsWinNT"),
113 sizeof("Win32::IsWin95"),
114 sizeof("Win32::FormatMessage"),
115 sizeof("Win32::Spawn"),
116 sizeof("Win32::GetTickCount"),
117 sizeof("Win32::GetShortPathName"),
118 sizeof("Win32::GetFullPathName"),
119 sizeof("Win32::GetLongPathName"),
120 sizeof("Win32::CopyFile"),
121 sizeof("Win32::Sleep")
123 const unsigned char * len = (const unsigned char *)&fnname_lens;
124 const char * function = (char *)&fnname_table;
125 while (function < (char *)&fnname_table + sizeof(fnname_table)) {
126 const char * const file = __FILE__;
127 CV * const cv = newXS(function, w32_CORE_all, file);
128 XSANY.any_ptr = (void *)function;
133 /* Don't forward Win32::SetChildShowWindow(). It accesses the internal variable
134 * w32_showwindow in thread_intern and is therefore not implemented in Win32.xs.
136 /* newXS("Win32::SetChildShowWindow", w32_SetChildShowWindow, file); */