/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <windows.h>
#include "jni.h"
#include "jni_util.h"
#include "jvm.h"
#include "jlong.h"
#include "sun_nio_ch_FileDispatcherImpl.h"
#include <io.h>
#include "nio.h"
#include "nio_util.h"
#include "jlong.h"
/**************************************************************
*/
{
if (h == INVALID_HANDLE_VALUE) {
return IOS_THROWN;
}
len, /* number of bytes to read */
&read, /* number of bytes read */
NULL); /* no overlapped struct */
if (result == 0) {
if (error == ERROR_BROKEN_PIPE) {
return IOS_EOF;
}
if (error == ERROR_NO_DATA) {
return IOS_UNAVAILABLE;
}
return IOS_THROWN;
}
}
{
int i = 0;
if (h == INVALID_HANDLE_VALUE) {
return IOS_THROWN;
}
for(i=0; i<len; i++) {
loc, /* address to put data */
num, /* number of bytes to read */
&read, /* number of bytes read */
NULL); /* no overlapped struct */
if (read > 0) {
}
break;
}
}
if (result == 0) {
if (error == ERROR_BROKEN_PIPE) {
return IOS_EOF;
}
if (error == ERROR_NO_DATA) {
return IOS_UNAVAILABLE;
}
return IOS_THROWN;
}
}
{
long highPos = 0;
long highOffset = 0;
if (h == INVALID_HANDLE_VALUE) {
return IOS_THROWN;
}
if (GetLastError() != ERROR_SUCCESS) {
return IOS_THROWN;
}
}
if (GetLastError() != ERROR_SUCCESS) {
return IOS_THROWN;
}
}
len, /* number of bytes to read */
&read, /* number of bytes read */
NULL); /* struct with offset */
if (result == 0) {
if (error == ERROR_BROKEN_PIPE) {
return IOS_EOF;
}
if (error == ERROR_NO_DATA) {
return IOS_UNAVAILABLE;
}
return IOS_THROWN;
}
if (GetLastError() != ERROR_SUCCESS) {
return IOS_THROWN;
}
}
}
{
if (h != INVALID_HANDLE_VALUE) {
} else {
}
len, /* number of bytes to write */
&written, /* receives number of bytes written */
lpOv); /* overlapped struct */
}
if ((h == INVALID_HANDLE_VALUE) || (result == 0)) {
}
}
{
if (h != INVALID_HANDLE_VALUE) {
int i = 0;
} else {
}
for(i=0; i<len; i++) {
loc, /* pointers to the buffers */
num, /* number of bytes to write */
&written,/* receives number of bytes written */
lpOv); /* overlapped struct */
if (written > 0) {
totalWritten += written;
}
break;
}
}
}
if ((h == INVALID_HANDLE_VALUE) || (result == 0)) {
}
}
{
long highPos = 0;
long highOffset = 0;
if (GetLastError() != ERROR_SUCCESS) {
return IOS_THROWN;
}
}
if (GetLastError() != ERROR_SUCCESS) {
return IOS_THROWN;
}
}
len, /* number of bytes to write */
&written, /* receives number of bytes written */
NULL); /* no overlapped struct */
if ((h == INVALID_HANDLE_VALUE) || (result == 0)) {
return IOS_THROWN;
}
if (GetLastError() != ERROR_SUCCESS) {
return IOS_THROWN;
}
}
}
{
int result = 0;
if (h != INVALID_HANDLE_VALUE) {
result = FlushFileBuffers(h);
if (result == 0) {
if (error != ERROR_ACCESS_DENIED) {
return IOS_THROWN;
}
}
} else {
return IOS_THROWN;
}
return 0;
}
{
long highPos = 0;
if (GetLastError() != ERROR_SUCCESS) {
return IOS_THROWN;
}
}
result = SetEndOfFile(h);
if (result == 0) {
return IOS_THROWN;
}
return 0;
}
{
if (GetLastError() != ERROR_SUCCESS) {
return IOS_THROWN;
}
}
}
{
OVERLAPPED o;
o.hEvent = 0;
o.OffsetHigh = highPos;
}
}
if (result == 0) {
if (error != ERROR_LOCK_VIOLATION) {
}
if (flags & LOCKFILE_FAIL_IMMEDIATELY) {
}
}
}
{
OVERLAPPED o;
o.hEvent = 0;
o.OffsetHigh = highPos;
}
}
if (h != INVALID_HANDLE_VALUE) {
if (result < 0)
}
}
{
}
{
}
{
if (res == 0)
return ptr_to_jlong(hResult);
}