18#include "../../memory.h"
75 while (
LOWORD(CurrentSft) != 0xFFFF)
86 CurrentSft = Sft->
Link;
99 while (
LOWORD(CurrentSft) != 0xFFFF)
116 CurrentSft = Sft->
Link;
129 while (
LOWORD(CurrentSft) != 0xFFFF)
146 CurrentSft = Sft->
Link;
157 while (
LOWORD(CurrentSft) != 0xFFFF)
166 CurrentSft = Sft->
Link;
176 if (DescriptorId == 0xFF)
return NULL;
184 BYTE AccessShareModes,
185 WORD CreateActionFlags,
194 DWORD CreationDisposition = 0;
200 DPRINT1(
"DosCreateFileEx: FilePath \"%s\", AccessShareModes 0x%04X, CreateActionFlags 0x%04X, Attributes 0x%04X\n",
216 switch (AccessShareModes & 0x03)
239 switch ((AccessShareModes >> 4) & 0x07)
286 switch (CreateActionFlags)
326 InheritableFile = ((AccessShareModes & 0x80) == 0);
329 SecurityAttributes.
nLength =
sizeof(SecurityAttributes);
354 if (CreateActionFlags == 0)
362 switch (CreateActionFlags)
365 *CreationStatus = 0x01;
369 *CreationStatus = 0x03;
373 *CreationStatus = 0x02;
379 *CreationStatus = 0x01;
381 *CreationStatus = 0x02;
389 *CreationStatus = 0x03;
391 *CreationStatus = 0x02;
399 if (DescriptorId == 0xFF)
444 DWORD CreationDisposition,
453 DPRINT(
"DosCreateFile: FilePath \"%s\", CreationDisposition 0x%04X, Attributes 0x%04X\n",
479 if (DescriptorId == 0xFF)
523 BYTE AccessShareModes)
531 DPRINT(
"DosOpenFile: FilePath \"%s\", AccessShareModes 0x%04X\n",
552 switch (AccessShareModes & 0x03)
575 switch ((AccessShareModes >> 4) & 0x07)
608 InheritableFile = ((AccessShareModes & 0x80) == 0);
611 SecurityAttributes.
nLength =
sizeof(SecurityAttributes);
631 if (DescriptorId == 0xFF)
695 if (LineSize == MaxSize - 1 && Character !=
'\r' && Character !=
'\b')
745 if (Pointer[LineSize] > 0x00 && Pointer[LineSize] < 0x20)
757 Pointer[LineSize++] = Character;
763 }
while (Character !=
'\r');
775 BYTE StaticBuffer[8192];
817 Pointer[(*BytesRead)++] = *ConBuffer;
819 if (*ConBuffer ==
'\r')
824 else if (*ConBuffer ==
'\n')
864 Pointer[(*BytesRead)++] = Character;
867 if (Character == 0x1A)
break;
873 DWORD BytesRead32 = 0;
876 if (
Count <=
sizeof(StaticBuffer))
878 LocalBuffer = StaticBuffer;
907 if (LocalBuffer != StaticBuffer)
922 BYTE StaticBuffer[8192];
943 DWORD BytesWritten32 = 0;
961 if (
Count <=
sizeof(StaticBuffer))
963 LocalBuffer = StaticBuffer;
993 if (LocalBuffer != StaticBuffer)
1010 DPRINT(
"DosSeekFile: FileHandle 0x%04X, Offset 0x%08X, Origin 0x%02X\n",
1050 if (NewOffset) *NewOffset = FilePointer;
1071 if (
Node->FlushInputRoutine)
Node->FlushInputRoutine(
Node);
1072 if (
Node->FlushOutputRoutine)
Node->FlushOutputRoutine(
Node);
1130 CHAR RootPath[] =
"?:\\";
1132 if (DriveNumber == 0x00)
1135 RootPath[0] =
'A' + DriveNumber - 1;
1140 DPRINT1(
"UNIMPLEMENTED INT 21h, 4404h, Read from block device %s\n", RootPath);
1144 DPRINT1(
"UNIMPLEMENTED INT 21h, 4405h, Write block device control string %s\n", RootPath);
1174 DPRINT1(
"UNIMPLEMENTED INT 21h, 4409h, Determine if a logical device is local or remote %s\n", RootPath);
1243 if (!
Node->IoctlReadRoutine)
1263 if (!
Node->IoctlWriteRoutine)
1281 if (!
Node->InputStatusRoutine ||
Node->InputStatusRoutine(
Node))
1319 if (!
Node->OutputStatusRoutine ||
Node->OutputStatusRoutine(
Node))
ACPI_SIZE strlen(const char *String)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
char * strchr(const char *String, int ch)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
#define ERROR_INVALID_FUNCTION
#define ERROR_INVALID_PARAMETER
#define INVALID_SET_FILE_POINTER
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define ERROR_INVALID_HANDLE
#define FILE_ATTRIBUTE_NORMAL
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
BOOL WINAPI SetEndOfFile(HANDLE hFile)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
BOOL WINAPI UnlockFile(IN HANDLE hFile, IN DWORD dwFileOffsetLow, IN DWORD dwFileOffsetHigh, IN DWORD nNumberOfBytesToUnlockLow, IN DWORD nNumberOfBytesToUnlockHigh)
BOOL WINAPI LockFile(IN HANDLE hFile, IN DWORD dwFileOffsetLow, IN DWORD dwFileOffsetHigh, IN DWORD nNumberOfBytesToLockLow, IN DWORD nNumberOfBytesToLockHigh)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
BOOLEAN DosControlBreak(VOID)
WORD DosReadFile(WORD FileHandle, DWORD Buffer, WORD Count, LPWORD BytesRead)
PDOS_FILE_DESCRIPTOR DosGetHandleFileDescriptor(WORD DosHandle)
WORD DosOpenFile(LPWORD Handle, LPCSTR FilePath, BYTE AccessShareModes)
WORD DosCreateFileEx(LPWORD Handle, LPWORD CreationStatus, LPCSTR FilePath, BYTE AccessShareModes, WORD CreateActionFlags, WORD Attributes)
WORD DosCreateFile(LPWORD Handle, LPCSTR FilePath, DWORD CreationDisposition, WORD Attributes)
BYTE DosReadLineBuffered(WORD FileHandle, DWORD Buffer, BYTE MaxSize)
BYTE DosFindWin32Descriptor(HANDLE Win32Handle)
static VOID StoreNameInSft(LPCSTR FilePath, PDOS_FILE_DESCRIPTOR Descriptor)
PDOS_FILE_DESCRIPTOR DosGetFileDescriptor(BYTE Id)
BOOLEAN DosUnlockFile(WORD DosHandle, DWORD Offset, DWORD Size)
BOOL DosFlushFileBuffers(WORD FileHandle)
WORD DosSeekFile(WORD FileHandle, LONG Offset, BYTE Origin, LPDWORD NewOffset)
BOOLEAN DosDeviceIoControlDrive(WORD DriveNumber, BYTE ControlCode, DWORD Buffer, PWORD Result)
BOOLEAN DosLockFile(WORD DosHandle, DWORD Offset, DWORD Size)
BYTE DosFindFreeDescriptor(VOID)
WORD DosWriteFile(WORD FileHandle, DWORD Buffer, WORD Count, LPWORD BytesWritten)
BYTE DosFindDeviceDescriptor(DWORD DevicePointer)
BOOLEAN DosDeviceIoControl(WORD FileHandle, BYTE ControlCode, DWORD Buffer, PWORD Length)
struct _DOS_SFT * PDOS_SFT
#define TO_LINEAR(seg, off)
#define SEG_OFF_TO_PTR(seg, off)
_Inout_opt_ PUNICODE_STRING Extension
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
_Must_inspect_result_ _In_ LONGLONG _In_ LONGLONG Amount
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define RtlFillMemory(Dest, Length, Fill)
#define ERROR_ALREADY_EXISTS
#define TRUNCATE_EXISTING
#define FILE_SHARE_DELETE
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
BYTE UnreadConInputBuffer[128]
DOS_FILE_DESCRIPTOR FileDescriptors[ANYSIZE_ARRAY]
LPVOID lpSecurityDescriptor
FAST486_STATE EmulatorContext
VOID DosEchoCharacter(CHAR Character)
PDOS_DEVICE_NODE DosGetDevice(LPCSTR DeviceName)
PDOS_DEVICE_NODE DosGetDriverNode(DWORD Driver)
#define DOS_DEVATTR_IOCTL
#define INVALID_DOS_HANDLE
#define DOS_DATA_OFFSET(x)
BYTE DosQueryHandle(WORD DosHandle)
WORD DosOpenHandle(BYTE DescriptorId)
VOID FASTCALL EmulatorReadMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
VOID FASTCALL EmulatorWriteMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
VOID WINAPI setDX(USHORT)
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
#define DRIVE_NO_ROOT_DIR
DWORD WINAPI GetLastError(void)
#define ERROR_TOO_MANY_OPEN_FILES
#define ERROR_FILE_EXISTS
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode