< prev index next >

src/java.base/windows/classes/sun/nio/fs/WindowsSecurity.java

Print this page
@@ -23,10 +23,12 @@
   * questions.
   */
  
  package sun.nio.fs;
  
+ import jdk.internal.vm.Continuation;
+ 
  import static sun.nio.fs.WindowsNativeDispatcher.*;
  import static sun.nio.fs.WindowsConstants.*;
  
  /**
   * Security related utility methods.

@@ -100,10 +102,13 @@
  
          final long token = hToken;
          final boolean stopImpersontating = impersontating;
          final boolean needToRevert = elevated;
  
+         // prevent yielding with privileges
+         Continuation.pin();
+ 
          return () -> {
              try {
                  if (token != 0L) {
                      try {
                          if (stopImpersontating)

@@ -117,10 +122,11 @@
                          CloseHandle(token);
                      }
                  }
              } finally {
                  LocalFree(pLuid);
+                 Continuation.unpin();
              }
          };
      }
  
      /**
< prev index next >