# HG changeset patch # User ksrini # Date 1299190617 28800 # Node ID 4f307b4eb7414986fb8cd7bef8916f3b27b4c712 # Parent 692619a439fcacc842739d486cfb18606fd9928b 7016985: (launcher) implement safe secure dll loading Reviewed-by: mchung diff -r 692619a439fc -r 4f307b4eb741 jdk/src/windows/bin/java_md.c --- a/jdk/src/windows/bin/java_md.c Wed Mar 02 05:35:14 2011 -0800 +++ b/jdk/src/windows/bin/java_md.c Thu Mar 03 14:16:57 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1212,11 +1212,22 @@ return findBootClass(env, classname); } +typedef BOOL (WINAPI *pfn_SetDllDirectory)(LPCTSTR); + void InitLauncher(boolean javaw) { INITCOMMONCONTROLSEX icx; + // Launcher links with kernel32 + HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32.dll")); + pfn_SetDllDirectory fn = (pfn_SetDllDirectory) GetProcAddress(hKernel32, + "SetDllDirectory"); + if (fn != NULL) { + // Exclude CWD from Dll search path + fn(""); + } + /* * Required for javaw mode MessageBox output as well as for * HotSpot -XX:+ShowMessageBoxOnError in java mode, an empty