guint32 *bytesread, WapiOverlapped *overlapped)
{
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
- WapiHandleType type=_wapi_handle_type (handle);
+ WapiHandleType type;
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FALSE);
+ }
+
+ type = _wapi_handle_type (handle);
if(io_ops[type].readfile==NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
guint32 *byteswritten, WapiOverlapped *overlapped)
{
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
- WapiHandleType type=_wapi_handle_type (handle);
+ WapiHandleType type;
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FALSE);
+ }
+
+ type = _wapi_handle_type (handle);
if(io_ops[type].writefile==NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
gboolean FlushFileBuffers(gpointer fd_handle)
{
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
- WapiHandleType type=_wapi_handle_type (handle);
+ WapiHandleType type;
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FALSE);
+ }
+
+ type = _wapi_handle_type (handle);
if(io_ops[type].flushfile==NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
gboolean SetEndOfFile(gpointer fd_handle)
{
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
- WapiHandleType type=_wapi_handle_type (handle);
+ WapiHandleType type;
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FALSE);
+ }
+
+ type = _wapi_handle_type (handle);
if(io_ops[type].setendoffile==NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
gint32 *highmovedistance, WapiSeekMethod method)
{
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
- WapiHandleType type=_wapi_handle_type (handle);
+ WapiHandleType type;
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(INVALID_SET_FILE_POINTER);
+ }
+
+ type = _wapi_handle_type (handle);
if(io_ops[type].seek==NULL) {
- return(FALSE);
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(INVALID_SET_FILE_POINTER);
}
return(io_ops[type].seek (handle, movedistance, highmovedistance,
WapiFileType GetFileType(gpointer fd_handle)
{
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
- WapiHandleType type=_wapi_handle_type (handle);
+ WapiHandleType type;
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FILE_TYPE_UNKNOWN);
+ }
+
+ type = _wapi_handle_type (handle);
if(io_ops[type].getfiletype==NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
return(FILE_TYPE_UNKNOWN);
}
guint32 GetFileSize(gpointer fd_handle, guint32 *highsize)
{
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
- WapiHandleType type=_wapi_handle_type (handle);
+ WapiHandleType type;
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(INVALID_FILE_SIZE);
+ }
+
+ type = _wapi_handle_type (handle);
if(io_ops[type].getfilesize==NULL) {
- return(FALSE);
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(INVALID_FILE_SIZE);
}
return(io_ops[type].getfilesize (handle, highsize));
WapiFileTime *last_access, WapiFileTime *last_write)
{
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
- WapiHandleType type=_wapi_handle_type (handle);
+ WapiHandleType type;
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FALSE);
+ }
+
+ type = _wapi_handle_type (handle);
if(io_ops[type].getfiletime==NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
const WapiFileTime *last_write)
{
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
- WapiHandleType type=_wapi_handle_type (handle);
+ WapiHandleType type;
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FALSE);
+ }
+
+ type = _wapi_handle_type (handle);
if(io_ops[type].setfiletime==NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
gboolean ret = FALSE;
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FALSE);
+ }
+
ok = _wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
(gpointer *) &file_handle,
(gpointer *) &file_private_handle);
gboolean ok;
off_t offset, length;
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FALSE);
+ }
ok = _wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
(gpointer *)&file_handle,
gboolean ok;
off_t offset, length;
gpointer handle = _wapi_handle_fd_offset_to_handle (fd_handle);
+
+ if (handle == NULL) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return(FALSE);
+ }
ok = _wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
(gpointer *)&file_handle,
{
gpointer handle = _wapi_handle_fd_offset_to_handle (GUINT_TO_POINTER (fd_handle));
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ WSASetLastError (WSAENOTSOCK);
+ return(0);
+ }
+
_wapi_handle_unref (handle);
return(0);
}
return(INVALID_SOCKET);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(INVALID_SOCKET);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError (WSAENOTSOCK);
return SOCKET_ERROR;
}
return(SOCKET_ERROR);
}
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(SOCKET_ERROR);
}
{
gpointer handle = _wapi_handle_fd_offset_to_handle (GUINT_TO_POINTER (fd));
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return;
}
{
gpointer handle = _wapi_handle_fd_offset_to_handle (GUINT_TO_POINTER (fd));
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return(0);
}
{
gpointer handle = _wapi_handle_fd_offset_to_handle (GUINT_TO_POINTER (fd));
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError(WSAENOTSOCK);
return;
}
int result;
notifier_data_t *ndata;
- if (_wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
+ if (handle == NULL ||
+ _wapi_handle_type (handle) != WAPI_HANDLE_SOCKET) {
WSASetLastError (WSAENOTSOCK);
return FALSE;
}