mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 12:32:47 +00:00
Implement tape IO functions.
svn path=/trunk/; revision=9078
This commit is contained in:
parent
dbb520a63f
commit
eddb2f5168
4 changed files with 435 additions and 124 deletions
|
@ -1,6 +1,6 @@
|
||||||
#ifndef _NTOS_H
|
#ifndef _NTOS_H
|
||||||
#define _NTOS_H
|
#define _NTOS_H
|
||||||
/* $Id: ntos.h,v 1.20 2004/01/23 21:18:27 ekohl Exp $ */
|
/* $Id: ntos.h,v 1.21 2004/04/10 23:19:42 ekohl Exp $ */
|
||||||
|
|
||||||
#if defined(NTOS_MODE_USER)
|
#if defined(NTOS_MODE_USER)
|
||||||
/*
|
/*
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
#include "ntos/cdrom.h"
|
#include "ntos/cdrom.h"
|
||||||
#include "ntos/console.h"
|
#include "ntos/console.h"
|
||||||
#include "ntos/disk.h"
|
#include "ntos/disk.h"
|
||||||
|
#include "ntos/tape.h"
|
||||||
#include "ntos/except.h"
|
#include "ntos/except.h"
|
||||||
#include "ntos/file.h"
|
#include "ntos/file.h"
|
||||||
#include "ntos/gditypes.h"
|
#include "ntos/gditypes.h"
|
||||||
|
@ -55,6 +56,7 @@
|
||||||
#include "ntos/cdrom.h"
|
#include "ntos/cdrom.h"
|
||||||
#include "ntos/console.h"
|
#include "ntos/console.h"
|
||||||
#include "ntos/disk.h"
|
#include "ntos/disk.h"
|
||||||
|
#include "ntos/tape.h"
|
||||||
#include "ntos/except.h"
|
#include "ntos/except.h"
|
||||||
#include "ntos/file.h"
|
#include "ntos/file.h"
|
||||||
#include "ntos/gditypes.h"
|
#include "ntos/gditypes.h"
|
||||||
|
|
57
reactos/include/ntos/tape.h
Normal file
57
reactos/include/ntos/tape.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/* $Id: tape.h,v 1.1 2004/04/10 23:18:42 ekohl Exp $
|
||||||
|
*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS kernel
|
||||||
|
* FILE: include/ntos/tape.h
|
||||||
|
* PURPOSE: Tape drive definitions
|
||||||
|
* PROGRAMMER: Eric Kohl
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __INCLUDE_TAPE_H
|
||||||
|
#define __INCLUDE_TAPE_H
|
||||||
|
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_BASE FILE_DEVICE_TAPE
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_CHECK_VERIFY \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_CREATE_PARTITION \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x000a, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_ERASE \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_FIND_NEW_DEVICES \
|
||||||
|
CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_GET_DRIVE_PARAMS \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_GET_MEDIA_PARAMS \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_GET_POSITION \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_GET_STATUS \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0009, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_PREPARE \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_SET_DRIVE_PARAMS \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_SET_MEDIA_PARAMS \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_SET_POSITION \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
|
#define IOCTL_TAPE_WRITE_MARKS \
|
||||||
|
CTL_CODE(IOCTL_TAPE_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __INCLUDE_TAPE_H */
|
|
@ -5285,65 +5285,74 @@ typedef struct _SYSTEM_POWER_STATUS {
|
||||||
} SYSTEM_POWER_STATUS;
|
} SYSTEM_POWER_STATUS;
|
||||||
typedef SYSTEM_POWER_STATUS *LPSYSTEM_POWER_STATUS;
|
typedef SYSTEM_POWER_STATUS *LPSYSTEM_POWER_STATUS;
|
||||||
|
|
||||||
|
typedef struct _TAPE_CREATE_PARTITION {
|
||||||
|
ULONG Method;
|
||||||
|
ULONG Count;
|
||||||
|
ULONG Size;
|
||||||
|
} TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
|
||||||
|
|
||||||
typedef struct _TAPE_ERASE {
|
typedef struct _TAPE_ERASE {
|
||||||
ULONG Type;
|
ULONG Type;
|
||||||
} TAPE_ERASE;
|
BOOLEAN Immediate;
|
||||||
|
} TAPE_ERASE, *PTAPE_ERASE;
|
||||||
|
|
||||||
typedef struct _TAPE_GET_DRIVE_PARAMETERS {
|
typedef struct _TAPE_GET_DRIVE_PARAMETERS {
|
||||||
BOOLEAN ECC;
|
BOOLEAN ECC;
|
||||||
BOOLEAN Compression;
|
BOOLEAN Compression;
|
||||||
BOOLEAN DataPadding;
|
BOOLEAN DataPadding;
|
||||||
BOOLEAN ReportSetmarks;
|
BOOLEAN ReportSetmarks;
|
||||||
ULONG DefaultBlockSize;
|
ULONG DefaultBlockSize;
|
||||||
ULONG MaximumBlockSize;
|
ULONG MaximumBlockSize;
|
||||||
ULONG MinimumBlockSize;
|
ULONG MinimumBlockSize;
|
||||||
ULONG MaximumPartitionCount;
|
ULONG MaximumPartitionCount;
|
||||||
ULONG FeaturesLow;
|
ULONG FeaturesLow;
|
||||||
ULONG FeaturesHigh;
|
ULONG FeaturesHigh;
|
||||||
ULONG EOTWarningZoneSize;
|
ULONG EOTWarningZoneSize;
|
||||||
} TAPE_GET_DRIVE_PARAMETERS;
|
} TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
|
||||||
|
|
||||||
typedef struct _TAPE_GET_MEDIA_PARAMETERS {
|
typedef struct _TAPE_GET_MEDIA_PARAMETERS {
|
||||||
LARGE_INTEGER Capacity;
|
LARGE_INTEGER Capacity;
|
||||||
LARGE_INTEGER Remaining;
|
LARGE_INTEGER Remaining;
|
||||||
DWORD BlockSize;
|
ULONG BlockSize;
|
||||||
DWORD PartitionCount;
|
ULONG PartitionCount;
|
||||||
BOOLEAN WriteProtected;
|
BOOLEAN WriteProtected;
|
||||||
} TAPE_GET_MEDIA_PARAMETERS;
|
} TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
|
||||||
|
|
||||||
typedef struct _TAPE_GET_POSITION {
|
typedef struct _TAPE_GET_POSITION {
|
||||||
ULONG Type;
|
ULONG Type;
|
||||||
ULONG Partition;
|
ULONG Partition;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
} TAPE_GET_POSITION;
|
} TAPE_GET_POSITION, *PTAPE_GET_POSITION;
|
||||||
|
|
||||||
typedef struct _TAPE_PREPARE {
|
typedef struct _TAPE_PREPARE {
|
||||||
ULONG Operation;
|
ULONG Operation;
|
||||||
} TAPE_PREPARE;
|
BOOLEAN Immediate;
|
||||||
|
} TAPE_PREPARE, *PTAPE_PREPARE;
|
||||||
|
|
||||||
typedef struct _TAPE_SET_DRIVE_PARAMETERS {
|
typedef struct _TAPE_SET_DRIVE_PARAMETERS {
|
||||||
BOOLEAN ECC;
|
BOOLEAN ECC;
|
||||||
BOOLEAN Compression;
|
BOOLEAN Compression;
|
||||||
BOOLEAN DataPadding;
|
BOOLEAN DataPadding;
|
||||||
BOOLEAN ReportSetmarks;
|
BOOLEAN ReportSetmarks;
|
||||||
ULONG EOTWarningZoneSize;
|
ULONG EOTWarningZoneSize;
|
||||||
} TAPE_SET_DRIVE_PARAMETERS;
|
} TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
|
||||||
|
|
||||||
typedef struct _TAPE_SET_MEDIA_PARAMETERS {
|
typedef struct _TAPE_SET_MEDIA_PARAMETERS {
|
||||||
ULONG BlockSize;
|
ULONG BlockSize;
|
||||||
} TAPE_SET_MEDIA_PARAMETERS;
|
} TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
|
||||||
|
|
||||||
typedef struct _TAPE_SET_POSITION {
|
typedef struct _TAPE_SET_POSITION {
|
||||||
ULONG Method;
|
ULONG Method;
|
||||||
ULONG Partition;
|
ULONG Partition;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
BOOLEAN Immediate;
|
BOOLEAN Immediate;
|
||||||
} TAPE_SET_POSITION;
|
} TAPE_SET_POSITION, *PTAPE_SET_POSITION;
|
||||||
|
|
||||||
typedef struct _TAPE_WRITE_MARKS {
|
typedef struct _TAPE_WRITE_MARKS {
|
||||||
ULONG Type;
|
ULONG Type;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
} TAPE_WRITE_MARKS;
|
BOOLEAN Immediate;
|
||||||
|
} TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/* $Id: tape.c,v 1.7 2004/01/23 21:16:03 ekohl Exp $
|
/* $Id: tape.c,v 1.8 2004/04/10 23:20:17 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/kernel32/file/tape.c
|
* FILE: lib/kernel32/file/tape.c
|
||||||
* PURPOSE: Tape functions
|
* PURPOSE: Tape functions
|
||||||
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
|
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
|
||||||
* GetTempFileName is modified from WINE [ Alexandre Juiliard ]
|
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* Created 01/11/98
|
* Created 01/11/98
|
||||||
*/
|
*/
|
||||||
|
@ -20,151 +19,395 @@
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
CreateTapePartition (HANDLE hDevice,
|
||||||
CreateTapePartition (
|
DWORD dwPartitionMethod,
|
||||||
HANDLE hDevice,
|
DWORD dwCount,
|
||||||
DWORD dwPartitionMethod,
|
DWORD dwSize)
|
||||||
DWORD dwCount,
|
|
||||||
DWORD dwSize
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
TAPE_CREATE_PARTITION TapeCreatePartition;
|
||||||
return 0;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
DWORD ErrorCode;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
TapeCreatePartition.Method = dwPartitionMethod;
|
||||||
|
TapeCreatePartition.Count = dwCount;
|
||||||
|
TapeCreatePartition.Size = dwSize;
|
||||||
|
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_CREATE_PARTITION,
|
||||||
|
&TapeCreatePartition,
|
||||||
|
sizeof(TAPE_CREATE_PARTITION),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
SetLastError (ErrorCode);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
EraseTape (HANDLE hDevice,
|
||||||
EraseTape (
|
DWORD dwEraseType,
|
||||||
HANDLE hDevice,
|
BOOL bImmediate)
|
||||||
DWORD dwEraseType,
|
|
||||||
BOOL bImmediate
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
TAPE_ERASE TapeErase;
|
||||||
return 0;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
}
|
DWORD ErrorCode;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
/*
|
TapeErase.Type = dwEraseType;
|
||||||
* @unimplemented
|
TapeErase.Immediate = (BOOLEAN)bImmediate;
|
||||||
*/
|
|
||||||
DWORD
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
STDCALL
|
NULL,
|
||||||
GetTapeParameters (
|
NULL,
|
||||||
HANDLE hDevice,
|
NULL,
|
||||||
DWORD dwOperation,
|
&IoStatusBlock,
|
||||||
LPDWORD lpdwSize,
|
IOCTL_TAPE_ERASE,
|
||||||
LPVOID lpTapeInformation
|
&TapeErase,
|
||||||
)
|
sizeof(TAPE_ERASE),
|
||||||
{
|
NULL,
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
0);
|
||||||
return 0;
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
SetLastError (ErrorCode);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
GetTapeParameters (HANDLE hDevice,
|
||||||
GetTapeStatus (
|
DWORD dwOperation,
|
||||||
HANDLE hDevice
|
LPDWORD lpdwSize,
|
||||||
)
|
LPVOID lpTapeInformation)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
return 0;
|
DWORD ErrorCode;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
if (dwOperation == GET_TAPE_MEDIA_INFORMATION)
|
||||||
|
{
|
||||||
|
if (*lpdwSize < sizeof(TAPE_GET_MEDIA_PARAMETERS))
|
||||||
|
{
|
||||||
|
*lpdwSize = sizeof(TAPE_GET_MEDIA_PARAMETERS);
|
||||||
|
return ERROR_MORE_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_GET_MEDIA_PARAMS,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
lpTapeInformation,
|
||||||
|
sizeof(TAPE_GET_MEDIA_PARAMETERS));
|
||||||
|
}
|
||||||
|
else if (dwOperation == GET_TAPE_DRIVE_INFORMATION)
|
||||||
|
{
|
||||||
|
if (*lpdwSize < sizeof(TAPE_GET_DRIVE_PARAMETERS))
|
||||||
|
{
|
||||||
|
*lpdwSize = sizeof(TAPE_GET_DRIVE_PARAMETERS);
|
||||||
|
return ERROR_MORE_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_GET_DRIVE_PARAMS,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
lpTapeInformation,
|
||||||
|
sizeof(TAPE_GET_DRIVE_PARAMETERS));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ERROR_INVALID_FUNCTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
SetLastError (ErrorCode);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
GetTapePosition (HANDLE hDevice,
|
||||||
PrepareTape (
|
DWORD dwPositionType,
|
||||||
HANDLE hDevice,
|
LPDWORD lpdwPartition,
|
||||||
DWORD dwOperation,
|
LPDWORD lpdwOffsetLow,
|
||||||
BOOL bImmediate
|
LPDWORD lpdwOffsetHigh)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
TAPE_GET_POSITION TapeGetPosition;
|
||||||
return 0;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
DWORD ErrorCode;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
TapeGetPosition.Type = dwPositionType;
|
||||||
|
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_GET_POSITION,
|
||||||
|
&TapeGetPosition,
|
||||||
|
sizeof(TAPE_GET_POSITION),
|
||||||
|
&TapeGetPosition,
|
||||||
|
sizeof(TAPE_GET_POSITION));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
*lpdwPartition = 0;
|
||||||
|
*lpdwOffsetLow = 0;
|
||||||
|
*lpdwOffsetHigh = 0;
|
||||||
|
|
||||||
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
SetLastError (ErrorCode);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
*lpdwPartition = TapeGetPosition.Partition;
|
||||||
|
*lpdwOffsetLow = TapeGetPosition.Offset.u.LowPart;
|
||||||
|
*lpdwOffsetHigh = TapeGetPosition.Offset.u.HighPart;
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
GetTapeStatus (HANDLE hDevice)
|
||||||
SetTapeParameters (
|
|
||||||
HANDLE hDevice,
|
|
||||||
DWORD dwOperation,
|
|
||||||
LPVOID lpTapeInformation
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
return 0;
|
DWORD ErrorCode;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_GET_STATUS,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
SetLastError (ErrorCode);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
PrepareTape (HANDLE hDevice,
|
||||||
SetTapePosition (
|
DWORD dwOperation,
|
||||||
HANDLE hDevice,
|
BOOL bImmediate)
|
||||||
DWORD dwPositionMethod,
|
|
||||||
DWORD dwPartition,
|
|
||||||
DWORD dwOffsetLow,
|
|
||||||
DWORD dwOffsetHigh,
|
|
||||||
BOOL bImmediate
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
TAPE_PREPARE TapePrepare;
|
||||||
return FALSE;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
DWORD ErrorCode;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
TapePrepare.Operation = dwOperation;
|
||||||
|
TapePrepare.Immediate = (BOOLEAN)bImmediate;
|
||||||
|
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_PREPARE,
|
||||||
|
&TapePrepare,
|
||||||
|
sizeof(TAPE_PREPARE),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
SetLastError (ErrorCode);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
SetTapeParameters (HANDLE hDevice,
|
||||||
WriteTapemark (
|
DWORD dwOperation,
|
||||||
HANDLE hDevice,
|
LPVOID lpTapeInformation)
|
||||||
DWORD dwTapemarkType,
|
|
||||||
DWORD dwTapemarkCount,
|
|
||||||
BOOL bImmediate
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
return 0;
|
DWORD ErrorCode;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
if (dwOperation == SET_TAPE_MEDIA_INFORMATION)
|
||||||
|
{
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_SET_MEDIA_PARAMS,
|
||||||
|
lpTapeInformation,
|
||||||
|
sizeof(TAPE_SET_MEDIA_PARAMETERS),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
else if (dwOperation == SET_TAPE_DRIVE_INFORMATION)
|
||||||
|
{
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_SET_DRIVE_PARAMS,
|
||||||
|
lpTapeInformation,
|
||||||
|
sizeof(TAPE_SET_DRIVE_PARAMETERS),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ERROR_INVALID_FUNCTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
SetLastError (ErrorCode);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
DWORD
|
DWORD STDCALL
|
||||||
STDCALL
|
SetTapePosition (HANDLE hDevice,
|
||||||
GetTapePosition (
|
DWORD dwPositionMethod,
|
||||||
HANDLE hDevice,
|
DWORD dwPartition,
|
||||||
DWORD dwPositionType,
|
DWORD dwOffsetLow,
|
||||||
LPDWORD lpdwPartition,
|
DWORD dwOffsetHigh,
|
||||||
LPDWORD lpdwOffsetLow,
|
BOOL bImmediate)
|
||||||
LPDWORD lpdwOffsetHigh
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
TAPE_SET_POSITION TapeSetPosition;
|
||||||
return 0;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
DWORD ErrorCode;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
TapeSetPosition.Method = dwPositionMethod;
|
||||||
|
TapeSetPosition.Partition = dwPartition;
|
||||||
|
TapeSetPosition.Offset.u.LowPart = dwOffsetLow;
|
||||||
|
TapeSetPosition.Offset.u.HighPart = dwOffsetHigh;
|
||||||
|
TapeSetPosition.Immediate = (BOOLEAN)bImmediate;
|
||||||
|
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_SET_POSITION,
|
||||||
|
&TapeSetPosition,
|
||||||
|
sizeof(TAPE_SET_POSITION),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
SetLastError (ErrorCode);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
DWORD STDCALL
|
||||||
|
WriteTapemark (HANDLE hDevice,
|
||||||
|
DWORD dwTapemarkType,
|
||||||
|
DWORD dwTapemarkCount,
|
||||||
|
BOOL bImmediate)
|
||||||
|
{
|
||||||
|
TAPE_WRITE_MARKS TapeWriteMarks;
|
||||||
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
DWORD ErrorCode;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
TapeWriteMarks.Type = dwTapemarkType;
|
||||||
|
TapeWriteMarks.Count = dwTapemarkCount;
|
||||||
|
TapeWriteMarks.Immediate = (BOOLEAN)bImmediate;
|
||||||
|
|
||||||
|
Status = NtDeviceIoControlFile (hDevice,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&IoStatusBlock,
|
||||||
|
IOCTL_TAPE_WRITE_MARKS,
|
||||||
|
&TapeWriteMarks,
|
||||||
|
sizeof(TAPE_WRITE_MARKS),
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
SetLastError (ErrorCode);
|
||||||
|
return ErrorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue