summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2009-04-30 16:53:20 -0700
committerJan Dubois <jand@activestate.com>2009-11-20 16:38:13 -0800
commit4ebea3c679ca93eb90d62be76bf8eb3cd7d14160 (patch)
tree7e8113501d92392714226ab02d20cc447841addc /win32/win32.c
parent074f7b78c4d97c74b49b2220b52710cd138da795 (diff)
downloadperl-4ebea3c679ca93eb90d62be76bf8eb3cd7d14160.tar.gz
Always add a manifest resource to perl.exe to specify the <trustInfo>
settings for Windows Vista and later. Without this setting Windows will treat perl.exe as a legacy application and apply various heuristics like redirecting access to protected file system areas (like the "Program Files" folder) to the users "VirtualStore" instead of generating a proper "permission denied" error. For VC8 and VC9 this manifest setting is automatically generated by the compiler/linker (together with the binding information for their respective runtime libraries); for all other compilers we need to embed the manifest resource explicitly in the external resource file. This change also requests the Microsoft Common-Controls version 6.0 (themed controls introduced in Windows XP) via the dependency list in the assembly manifest. For VC8 and VC9 this is specified using the /manifestdependency linker commandline option instead.
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 050c50cfec..d583087d42 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -22,6 +22,7 @@
# define WC_NO_BEST_FIT_CHARS 0x00000400 /* requires Windows 2000 or later */
#endif
#include <winnt.h>
+#include <commctrl.h>
#include <tlhelp32.h>
#include <io.h>
#include <signal.h>
@@ -4800,6 +4801,16 @@ Perl_win32_init(int *argcp, char ***argvp)
{
HMODULE module;
+ /* When the manifest resource requests Common-Controls v6 then
+ * user32.dll no longer registers all the Windows classes used for
+ * standard controls but leaves some of them to be registered by
+ * comctl32.dll. InitCommonControls() doesn't do anything but calling
+ * it makes sure comctl32.dll gets loaded into the process and registers
+ * the standard control classes. Without this even normal Windows APIs
+ * like MessageBox() can fail under some versions of Windows XP.
+ */
+ InitCommonControls();
+
#ifdef SET_INVALID_PARAMETER_HANDLER
_invalid_parameter_handler oldHandler, newHandler;
newHandler = my_invalid_parameter_handler;