< prev index next >

src/java.base/windows/native/libnet/NTLMAuthentication.c

Print this page




   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include <jni.h>
  27 #include <windows.h>
  28 #include "jni_util.h"
  29 #include "jdk_util.h"


  30 #include <urlmon.h>
  31 
  32 typedef HRESULT (WINAPI *CoInternetCreateSecurityManagerType)
  33         (IServiceProvider*,IInternetSecurityManager**,DWORD);
  34 
  35 static CoInternetCreateSecurityManagerType fn_CoInternetCreateSecurityManager;
  36 
  37 JNIEXPORT jboolean JNICALL
  38 Java_sun_net_www_protocol_http_ntlm_NTLMAuthentication_isTrustedSiteAvailable
  39   (JNIEnv *env, jclass clazz)
  40 {
  41     HMODULE libUrlmon = JDK_LoadSystemLibrary("urlmon.dll");
  42     if (libUrlmon != NULL) {
  43         fn_CoInternetCreateSecurityManager = (CoInternetCreateSecurityManagerType)
  44                 GetProcAddress(libUrlmon, "CoInternetCreateSecurityManager");
  45         if (fn_CoInternetCreateSecurityManager != NULL) {
  46             return JNI_TRUE;
  47         }
  48     }
  49     return JNI_FALSE;




   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include <jni.h>
  27 #include <windows.h>
  28 #include "jni_util.h"
  29 #include "jni.h"
  30 #include "jvm.h"
  31 #include "jdk_util_md.h"
  32 #include <urlmon.h>
  33 
  34 typedef HRESULT (WINAPI *CoInternetCreateSecurityManagerType)
  35         (IServiceProvider*,IInternetSecurityManager**,DWORD);
  36 
  37 static CoInternetCreateSecurityManagerType fn_CoInternetCreateSecurityManager;
  38 
  39 JNIEXPORT jboolean JNICALL
  40 Java_sun_net_www_protocol_http_ntlm_NTLMAuthentication_isTrustedSiteAvailable
  41   (JNIEnv *env, jclass clazz)
  42 {
  43     HMODULE libUrlmon = JDK_LoadSystemLibrary("urlmon.dll");
  44     if (libUrlmon != NULL) {
  45         fn_CoInternetCreateSecurityManager = (CoInternetCreateSecurityManagerType)
  46                 GetProcAddress(libUrlmon, "CoInternetCreateSecurityManager");
  47         if (fn_CoInternetCreateSecurityManager != NULL) {
  48             return JNI_TRUE;
  49         }
  50     }
  51     return JNI_FALSE;


< prev index next >