183N/A/*
2362N/A * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
268N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
268N/A *
268N/A * This code is free software; you can redistribute it and/or modify it
268N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
268N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
268N/A *
268N/A * This code is distributed in the hope that it will be useful, but WITHOUT
268N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
268N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
268N/A * version 2 for more details (a copy is included in the LICENSE file that
268N/A * accompanied this code).
268N/A *
268N/A * You should have received a copy of the GNU General Public License version
268N/A * 2 along with this work; if not, write to the Free Software Foundation,
268N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
268N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
183N/A */
183N/A
183N/A#include <windows.h>
183N/A#include <stdio.h>
183N/A#include <string.h>
183N/A#include <errno.h>
183N/A
183N/A#include <jvm.h>
183N/A
183N/A#include "jvm_symbols.h"
183N/A
183N/AJvmSymbols* lookupJvmSymbols() {
183N/A JvmSymbols* syms = (JvmSymbols*)malloc(sizeof(JvmSymbols));
183N/A if (syms != NULL) {
4311N/A HINSTANCE jvm = GetModuleHandle("jvm.dll");
183N/A if (jvm == NULL) {
183N/A free(syms);
183N/A return NULL;
183N/A }
183N/A syms->GetVersion = (GetVersion_t)
183N/A GetProcAddress(jvm, "JVM_DTraceGetVersion");
183N/A syms->IsSupported = (IsSupported_t)
183N/A GetProcAddress(jvm, "JVM_DTraceIsSupported");
183N/A syms->Activate = (Activate_t)
183N/A GetProcAddress(jvm, "JVM_DTraceActivate");
183N/A syms->Dispose = (Dispose_t)
183N/A GetProcAddress(jvm, "JVM_DTraceDispose");
183N/A syms->IsProbeEnabled = (IsProbeEnabled_t)
183N/A GetProcAddress(jvm, "JVM_DTraceIsProbeEnabled");
183N/A
183N/A (void)FreeLibrary(jvm);
183N/A if ( syms->GetVersion == NULL || syms->IsSupported == NULL ||
183N/A syms->Activate == NULL || syms->Dispose == NULL ||
183N/A syms->IsProbeEnabled == NULL) {
183N/A free(syms);
183N/A syms = NULL;
183N/A }
183N/A
183N/A }
183N/A return syms;
183N/A}