./src/windows/classes/java/lang/ProcessImpl.java

Print this page

        

@@ -328,6 +328,24 @@
      */
     private static native long openForAtomicAppend(String path)
         throws IOException;
 
     private static native boolean closeHandle(long handle);
+    
+    private static native int getProcessId(long handle);
+    private static native String getModuleBaseName(int pid);
+
+    @Override
+    public int getPid() {
+        if (!isAlive()) {
+            return -1;
+        } else {
+            return getProcessId(handle);
+        }
+    }
+
+    @Override
+    public String getProcessName(int pid) {
+        return getModuleBaseName(pid);
+    }
+
 }