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

Print this page




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.fs;
  27 
  28 import java.security.AccessController;
  29 import java.security.PrivilegedAction;
  30 import sun.misc.Unsafe;
  31 
  32 /**
  33  * Win32 and library calls.
  34  */
  35 
  36 class WindowsNativeDispatcher {
  37     private WindowsNativeDispatcher() { }
  38 
  39     /**











  40      * HANDLE CreateFile(
  41      *   LPCTSTR lpFileName,
  42      *   DWORD dwDesiredAccess,
  43      *   DWORD dwShareMode,
  44      *   LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  45      *   DWORD dwCreationDisposition,
  46      *   DWORD dwFlagsAndAttributes,
  47      *   HANDLE hTemplateFile
  48      * )
  49      */
  50     static long CreateFile(String path,
  51                            int dwDesiredAccess,
  52                            int dwShareMode,
  53                            long lpSecurityAttributes,
  54                            int dwCreationDisposition,
  55                            int dwFlagsAndAttributes)
  56         throws WindowsException
  57     {
  58         NativeBuffer buffer = asNativeBuffer(path);
  59         try {


1022 
1023     /**
1024      * ReadDirectoryChangesW(
1025      *   HANDLE hDirectory,
1026      *   LPVOID lpBuffer,
1027      *   DWORD nBufferLength,
1028      *   BOOL bWatchSubtree,
1029      *   DWORD dwNotifyFilter,
1030      *   LPDWORD lpBytesReturned,
1031      *   LPOVERLAPPED lpOverlapped,
1032      *   LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
1033      * )
1034      */
1035     static native void ReadDirectoryChangesW(long hDirectory,
1036                                              long bufferAddress,
1037                                              int bufferLength,
1038                                              boolean watchSubTree,
1039                                              int filter,
1040                                              long bytesReturnedAddress,
1041                                              long pOverlapped)



















1042         throws WindowsException;
1043 
1044     /**
1045      * BackupRead(
1046      *   HANDLE hFile,
1047      *   LPBYTE lpBuffer,
1048      *   DWORD nNumberOfBytesToRead,
1049      *   LPDWORD lpNumberOfBytesRead,
1050      *   BOOL bAbort,
1051      *   BOOL bProcessSecurity,
1052      *   LPVOID* lpContext
1053      * )
1054      */
1055     static BackupResult BackupRead(long hFile,
1056                                    long bufferAddress,
1057                                    int bufferSize,
1058                                    boolean abort,
1059                                    long context)
1060         throws WindowsException
1061     {




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.fs;
  27 
  28 import java.security.AccessController;
  29 import java.security.PrivilegedAction;
  30 import sun.misc.Unsafe;
  31 
  32 /**
  33  * Win32 and library calls.
  34  */
  35 
  36 class WindowsNativeDispatcher {
  37     private WindowsNativeDispatcher() { }
  38 
  39     /**
  40      * HANDLE CreateEvent(
  41      *   LPSECURITY_ATTRIBUTES lpEventAttributes,
  42      *   BOOL bManualReset,
  43      *   BOOL bInitialState,
  44      *   PCTSTR lpName
  45      * );
  46      */
  47     static native long CreateEvent(boolean bManualReset, boolean bInitialState)
  48         throws WindowsException;
  49 
  50     /**
  51      * HANDLE CreateFile(
  52      *   LPCTSTR lpFileName,
  53      *   DWORD dwDesiredAccess,
  54      *   DWORD dwShareMode,
  55      *   LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  56      *   DWORD dwCreationDisposition,
  57      *   DWORD dwFlagsAndAttributes,
  58      *   HANDLE hTemplateFile
  59      * )
  60      */
  61     static long CreateFile(String path,
  62                            int dwDesiredAccess,
  63                            int dwShareMode,
  64                            long lpSecurityAttributes,
  65                            int dwCreationDisposition,
  66                            int dwFlagsAndAttributes)
  67         throws WindowsException
  68     {
  69         NativeBuffer buffer = asNativeBuffer(path);
  70         try {


1033 
1034     /**
1035      * ReadDirectoryChangesW(
1036      *   HANDLE hDirectory,
1037      *   LPVOID lpBuffer,
1038      *   DWORD nBufferLength,
1039      *   BOOL bWatchSubtree,
1040      *   DWORD dwNotifyFilter,
1041      *   LPDWORD lpBytesReturned,
1042      *   LPOVERLAPPED lpOverlapped,
1043      *   LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
1044      * )
1045      */
1046     static native void ReadDirectoryChangesW(long hDirectory,
1047                                              long bufferAddress,
1048                                              int bufferLength,
1049                                              boolean watchSubTree,
1050                                              int filter,
1051                                              long bytesReturnedAddress,
1052                                              long pOverlapped)
1053         throws WindowsException;
1054 
1055 
1056     /**
1057      * CancelIo(
1058      *   HANDLE hFile
1059      * )
1060      */
1061     static native void CancelIo(long hFile) throws WindowsException;
1062 
1063     /**
1064      * GetOverlappedResult(
1065      *   HANDLE hFile,
1066      *   LPOVERLAPPED lpOverlapped,
1067      *   LPDWORD lpNumberOfBytesTransferred,
1068      *   BOOL bWait
1069      * );
1070      */
1071     static native int GetOverlappedResult(long hFile, long lpOverlapped)
1072         throws WindowsException;
1073 
1074     /**
1075      * BackupRead(
1076      *   HANDLE hFile,
1077      *   LPBYTE lpBuffer,
1078      *   DWORD nNumberOfBytesToRead,
1079      *   LPDWORD lpNumberOfBytesRead,
1080      *   BOOL bAbort,
1081      *   BOOL bProcessSecurity,
1082      *   LPVOID* lpContext
1083      * )
1084      */
1085     static BackupResult BackupRead(long hFile,
1086                                    long bufferAddress,
1087                                    int bufferSize,
1088                                    boolean abort,
1089                                    long context)
1090         throws WindowsException
1091     {