7#ifndef UDF_FORMAT_MEDIA
13#ifndef UDF_FORMAT_MEDIA
57#define _lphUdf ((PUDF_VOL_HANDLE_I)(DeviceObject->lpContext))
60#define _lphUdf (DeviceObject->cbio)
78#if !defined(LIBUDF) && !defined(LIBUDFFMT)
116#if !defined(LIBUDF) && !defined(LIBUDFFMT)
139 return _lphUdf->lpReadFunc(_lphUdf->lpParameter,
160#if !defined(LIBUDF) && !defined(LIBUDFFMT)
176 Buffer3 = (
PVOID)( ((
ULONG)Buffer2 + 0xffff) & ~0xffff);
183 UDFPrint((
"UDFPhWriteSynchronous: EOF, error %x\n", RC));
195 return _lphUdf->lpWriteFunc(_lphUdf->lpParameter,
270 return (((
int64)hsz) << 32) | lsz;
283 return (((
int64)hsz) << 32) | lsz;
290#ifndef UDF_FORMAT_MEDIA
326#ifndef NT_NATIVE_MODE
347 tp.PrivilegeCount = 1;
352 tp.Privileges[0].Attributes = 0;
429 UDFPrint((
" DevType %x\n", DevType));
440 UserPrint((
"Warrning: File name is similar to drive letter.\n"
441 " Don't you type semicolon ';' instead of colon ':' ?\n"));
448#define GetLastError() ((ULONG)(-1))
451#define MAX_INVALIDATE_VOLUME_RETRY 8
463 WCHAR deviceNameBuffer[0x200];
464 WCHAR FSNameBuffer[0x200];
480#ifdef UDF_FORMAT_MEDIA
481 PUDFFmtState
fms =
Vcb->fms;
488#ifdef UDF_FORMAT_MEDIA
496#ifdef UDF_FORMAT_MEDIA
501#ifndef NT_NATIVE_MODE
504 i =
sizeof(FSNameBuffer)/
sizeof(FSNameBuffer[0]);
506 &returned, &returned, &returned, FSNameBuffer,
i)) {
507 UDFPrint((
"my_open: FS: %S\n", FSNameBuffer));
508 if(!
wcscmp(FSNameBuffer,
L"Unknown")) {
514 UDFPrint((
"my_open: retry %d times\n", retry));
520#ifndef NT_NATIVE_MODE
523 UserPrint((
"Warrning: File name is similar to drive letter.\n"
524 " Don't you type semicolon ';' instead of colon ':' ?\n"));
541 uniFilename.
Buffer = deviceNameBuffer;
569#ifdef UDF_FORMAT_MEDIA
570 if(
fms->opt_flush ||
fms->opt_probe) {
583 UDFPrint((
"SE_TCB privilege not held\n"));
601 UserPrint((
"can't lock volume, retry\n"));
607#ifndef NT_NATIVE_MODE
617 UDFPrint((
"Warning: can't allow extended DASD i/o\n"));
626#ifndef NT_NATIVE_MODE
663 UDFPrint((
"SE_TCB privilege not held\n"));
669 UserPrint((
"can't lock read-only volumem retry"));
674 UserPrint((
"can't lock read-only volume"));
675#ifndef NT_NATIVE_MODE
686#ifndef NT_NATIVE_MODE
691#ifdef UDF_FORMAT_MEDIA
700#ifndef NT_NATIVE_MODE
728#ifdef UDF_FORMAT_MEDIA
737 UserPrint((
"error opening device or image file"));
739#ifdef UDF_FORMAT_MEDIA
747 UDFPrint((
" opened as file, h=%x\n",
h));
767 if(offl == -1 && offh == -1) {
784 RC = _lphUdf->lpGetSizeFunc(_lphUdf->lpParameter, &sz, &
bs);
803 return Vcb->PhDeviceType;
815#define lphUdf ((PUDF_VOL_HANDLE_I)(DeviceObject->lpContext))
826#ifndef NT_NATIVE_MODE
828#ifdef PRINT_DBG_CONSOLE
829CHAR dbg_print_tmp_buff[2048];
845 strcpy(&dbg_print_tmp_buff[0], JS_DBG_PREFIX);
846 len =
_vsnprintf(&dbg_print_tmp_buff[
sizeof(JS_DBG_PREFIX)-1], 2047-
sizeof(JS_DBG_PREFIX), DebugMessage,
ap);
850 dbg_print_tmp_buff[2047] = 0;
852 (dbg_print_tmp_buff[
len-1] ==
'\n' ||
853 dbg_print_tmp_buff[
len-1] ==
'\r') ) {
919#ifdef USE_THREAD_HEAPS
936#define MAX_THREADS_WITH_OWN_POOL 128
938typedef struct _THREAD_POOL_LIST_ITEM {
941} THREAD_POOL_LIST_ITEM, *PTHREAD_POOL_LIST_ITEM;
943ULONG LastThreadPool = -1;
944THREAD_POOL_LIST_ITEM ThreadPoolList[MAX_THREADS_WITH_OWN_POOL];
948#ifdef KERNEL_MODE_MM_BEHAVIOR
963 for(
i=0;
i<(LastThreadPool+1);
i++) {
964 if(ThreadPoolList[
i].ThreadId == ThreadId) {
973 for(
i=0;
i<(LastThreadPool+1);
i++) {
974 if(ThreadPoolList[
i].ThreadId == -1) {
978 if(
i>=MAX_THREADS_WITH_OWN_POOL) {
982 ThreadPoolList[
i].ThreadId = ThreadId;
984 if(!ThreadPoolList[
i].HeapHandle) {
985 ThreadPoolList[
i].ThreadId = -1;
990 if(
i+1 > LastThreadPool+1)
1001#ifdef KERNEL_MODE_MM_BEHAVIOR
1013 for(
i=0;
i<(LastThreadPool+1);
i++) {
1014 if(ThreadPoolList[
i].ThreadId == ThreadId) {
1018 if(
i+1 > LastThreadPool+1) {
1038 for(
i=0;
i<(LastThreadPool+1);
i++) {
1039 if(ThreadPoolList[
i].ThreadId == ThreadId) {
1043 if(
i+1 > LastThreadPool+1) {
1051 ThreadPoolList[
i].ThreadId = -1;
1058#if defined(KERNEL_MODE_MM_BEHAVIOR)
1069#ifdef USE_THREAD_HEAPS
1070 Addr = _ExAllocatePool_(MemoryType,
Size+8);
1076 uAddr = ((
PCHAR)Addr)+8;
1078#ifdef USE_THREAD_HEAPS
1088 *(((
PULONG)uAddr)-1) = 0xFEDCBA98;
1100 if(*(((
PULONG)uAddr)-1) == 0xFEDCBA98) {
1102#ifdef USE_THREAD_HEAPS
1148#ifdef NT_NATIVE_MODE
char * strcpy(char *DstString, const char *SrcString)
#define FILE_COMPLETE_IF_OPLOCKED
#define IOCTL_CDRW_SYNC_CACHE
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
#define NT_SUCCESS(StatCode)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
BOOL WINAPI OpenThreadToken(HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, HANDLE *TokenHandle)
#define INVALID_SET_FILE_POINTER
#define ReadFile(a, b, c, d, e)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define GetCurrentProcess()
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
BOOL WINAPI SetEndOfFile(HANDLE hFile)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
#define UDFGetDevType(DevObj)
#define UDFPhWriteVerifySynchronous
NTSTATUS UDFPhReadSynchronous(PDEVICE_OBJECT DeviceObject, PVOID Buffer, ULONG Length, LONGLONG Offset, PULONG ReadBytes, ULONG Flags)
VOID PrintDbgConsole(PCHAR DebugMessage,...)
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
BOOLEAN ProbeMemory(PVOID MemPtr, ULONG Length, BOOLEAN ForWrite)
HANDLE my_open(PVCB Vcb, PWCHAR fn)
ULONG MyLockVolume(HANDLE h, ULONG *pLockMode)
VOID set_image_size(HANDLE h, int64 len)
BOOLEAN opt_invalidate_volume
NTSTATUS UDFPhWriteSynchronous(PDEVICE_OBJECT DeviceObject, PVOID Buffer, ULONG Length, LONGLONG Offset, PULONG WrittenBytes, ULONG Flags)
ULONG MyUnlockVolume(HANDLE h, ULONG *pLockMode)
NTSTATUS UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PVOID Iosb OPTIONAL)
#define MAX_INVALIDATE_VOLUME_RETRY
void my_retrieve_vol_type(PVCB Vcb, PWCHAR fn)
uint64 udf_lseek64(HANDLE fd, uint64 offset, int whence)
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
int64 set_file_pointer(HANDLE h, int64 sz)
#define RtlCompareMemory(s1, s2, l)
struct _SKIN_API * PSKIN_API
static unsigned char buff[32768]
#define ExAllocatePool(type, size)
#define FILE_SYNCHRONOUS_IO_NONALERT
#define FILE_NO_INTERMEDIATE_BUFFERING
#define FILE_WRITE_THROUGH
GLboolean GLboolean GLboolean GLboolean a
GLfloat GLfloat GLfloat GLfloat h
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
HANDLE WINAPI HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
BOOL WINAPI HeapDestroy(HANDLE hHeap)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
#define EXCEPTION_EXECUTE_HANDLER
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
static struct msdos_boot_sector bs
#define FILE_FLAG_NO_BUFFERING
static DWORD get_file_size(void)
#define InitializeObjectAttributes(p, n, a, r, s)
static PLARGE_INTEGER Time
static PTIME_FIELDS TimeFields
#define FSCTL_LOCK_VOLUME
#define FILE_READ_ATTRIBUTES
#define FSCTL_INVALIDATE_VOLUMES
#define FSCTL_UNLOCK_VOLUME
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define HEAP_NO_SERIALIZE
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
OSSTATUS UDFWriteData(IN PVCB Vcb, IN BOOLEAN Translate, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Direct, IN int8 *Buffer, OUT PSIZE_T WrittenBytes)
#define FILE_DEVICE_CD_ROM
#define _SEH2_EXCEPT(...)
#define FSCTL_ALLOW_EXTENDED_DASD_IO
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define STATUS_END_OF_FILE
PULONG MinorVersion OPTIONAL
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_UNSUCCESSFUL
#define STATUS_LOST_WRITEBEHIND_DATA
#define MKUDF_CANT_OPEN_FILE
#define MKUDF_CANT_LOCK_VOL
#define IOCTL_UDF_INVALIDATE_VOLUMES
#define IOCTL_UDF_LOCK_VOLUME_BY_PID
#define IOCTL_UDF_UNLOCK_VOLUME_BY_PID
BOOL Privilege(LPTSTR pszPrivilege, BOOL bEnable)
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
_In_ WDFREQUEST _In_ size_t OutputBufferLength
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
static GLenum _GLUfuncptr fn
#define LookupPrivilegeValue
DWORD WINAPI GetLastError(void)
HANDLE WINAPI GetCurrentThread(void)
DWORD WINAPI GetCurrentThreadId(void)
#define OutputDebugString
void int int ULONGLONG int va_list * ap
_Must_inspect_result_ _In_ ULONG Flags
#define TOKEN_ADJUST_PRIVILEGES
#define SE_PRIVILEGE_ENABLED