jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
changeset 12698 8d48f8005004
parent 9840 376425f4ed3d
child 14342 8435a30053c1
equal deleted inserted replaced
12697:79006a8e17dd 12698:8d48f8005004
   464                 }
   464                 }
   465             }
   465             }
   466         }
   466         }
   467         CloseHandle(hThread);
   467         CloseHandle(hThread);
   468     } else {
   468     } else {
   469         JNU_ThrowIOExceptionWithLastError(env, "CreateRemoteThread failed");
   469         if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) {
       
   470             //
       
   471             // This error will occur when attaching to a process belonging to
       
   472             // another terminal session. See "Remarks":
       
   473             // http://msdn.microsoft.com/en-us/library/ms682437%28VS.85%29.aspx
       
   474             //
       
   475             JNU_ThrowIOException(env,
       
   476                 "Insufficient memory or insufficient privileges to attach");
       
   477         } else {
       
   478             JNU_ThrowIOExceptionWithLastError(env, "CreateRemoteThread failed");
       
   479         }
   470     }
   480     }
   471 
   481 
   472     VirtualFreeEx(hProcess, pCode, 0, MEM_RELEASE);
   482     VirtualFreeEx(hProcess, pCode, 0, MEM_RELEASE);
   473     VirtualFreeEx(hProcess, pData, 0, MEM_RELEASE);
   483     VirtualFreeEx(hProcess, pData, 0, MEM_RELEASE);
   474 }
   484 }