3775N/A * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/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 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A/* only on Windows 64-bit or 32-bit application running under WOW64 */ 0N/A/* exported function in target VM */ 0N/A/* OpenProcess with SE_DEBUG_NAME privilege */ 0N/A/* convert jstring to C string */ 0N/A * Data copied to target process 0N/A * Return codes from enqueue function executed in target VM 0N/A * Code copied to target process 0N/A /* "null" command - does nothing in the target VM */ 0N/A/* This function marks the end of thread_func. */ 0N/A * Class: sun_tools_attach_WindowsVirtualMachine 0N/A * Class: sun_tools_attach_WindowsVirtualMachine 0N/A * Method: generateStub 0N/A * We should replace this with a real stub generator at some point 0N/A * Class: sun_tools_attach_WindowsVirtualMachine 0N/A * Method: openProcess 3775N/A /* process is attaching to itself; get a pseudo handle instead */ 3775N/A /* duplicate the pseudo handle so it can be used in more contexts */ 3775N/A * Could not duplicate the handle which isn't a good sign, 3775N/A * but we'll try again with OpenProcess() below. 3775N/A * Attempt to open process. If it fails then we try to enable the 3775N/A * SE_DEBUG_NAME privilege and retry. 3775N/A /* include the last error in the default detail message */ 0N/A * On Windows 64-bit we need to handle 32-bit tools trying to attach to 64-bit 0N/A * processes (and visa versa). X-architecture attaching is currently not supported 0N/A * by this implementation. 0N/A "Unable to attach to 32-bit process running under WOW64");
0N/A "Unable to attach to 64-bit process");
0N/A * Class: sun_tools_attach_WindowsVirtualMachine 0N/A * Method: closeProcess 0N/A * Class: sun_tools_attach_WindowsVirtualMachine 0N/A * Method: createPipe 0N/A 1,
// max. instances 0N/A 128,
// output buffer size 0N/A 8192,
// input buffer size 0N/A NULL);
// default security attribute 0N/A * Class: sun_tools_attach_WindowsVirtualMachine 0N/A * Class: sun_tools_attach_WindowsVirtualMachine 0N/A * Method: connectPipe 0N/A * Class: sun_tools_attach_WindowsVirtualMachine 0N/A * Signature: (J[BII)I 0N/A buf,
// buffer to receive data 0N/A * Class: sun_tools_attach_WindowsVirtualMachine 0N/A * Setup data to copy to target process 0N/A * Command and arguments 0N/A * Allocate memory in target process for data and code stub 0N/A * (assumed aligned and matches architecture of target process) 0N/A * Create thread in target process to execute code 0N/A "jvm.dll not loaded by target process");
0N/A "Unable to enqueue operation: the target VM does not support attach mechanism");
0N/A "Remote thread failed for unknown reason");
5043N/A // This error will occur when attaching to a process belonging to 5043N/A // another terminal session. See "Remarks": 5043N/A "Insufficient memory or insufficient privileges to attach");
0N/A * Attempts to enable the SE_DEBUG_NAME privilege and open the given process. 0N/A * Get the access token 0N/A * No access token for the thread so impersonate the security context 0N/A * Get LUID for the privilege 0N/A * Enable the privilege 0N/A * If we enabled the privilege then attempt to open the 0N/A * Revert to the previous privileges 0N/A * Close token and restore error 0N/A/* convert jstring to C string */