19#ifndef __ENV_SPEC_W32__H_
20#define __ENV_SPEC_W32__H_
36 #define ASSERT(a) if(!(a)) {__asm int 3;}
40#ifndef MAXIMUM_FILENAME_LENGTH
41#define MAXIMUM_FILENAME_LENGTH MAX_PATH
49#define PAGE_SIZE (ULONG)0x1000
52#ifndef PHYSICAL_ADDRESS
53#define PHYSICAL_ADDRESS LARGE_INTEGER
56#define OS_SUCCESS(a) NT_SUCCESS(a)
57#define OSSTATUS NTSTATUS
59#if defined UDF_DBG || defined DEBUG
66#define ERESEOURCE ULONG
67#define PERESEOURCE PULONG
79#define NT_SUCCESS(x) ( (NTSTATUS)(x)>=0 )
81#define PsGetCurrentThread() GetCurrentThreadId()
83#define PsGetVersion(a,b,c,d) { \
84 OSVERSIONINFO OsVer; \
85 OsVer.dwOSVersionInfoSize = sizeof(OsVer); \
86 GetVersionEx(&OsVer); \
87 if(a) (*(a)) = OsVer.dwMajorVersion; \
88 if(b) (*(b)) = OsVer.dwMinorVersion; \
89 if(c) (*(c)) = OsVer.dwBuildNumber; \
90 if(d) (d)->Buffer = L""; \
91 if(d) (d)->Length = 0; \
92 if(d) (d)->MaximumLength = 0; \
103#define HINSTANCE HANDLE
151#define SkinPrintf SkinAPI->Printf
152#define SkinGetCmdLine SkinAPI->GetCommandLine
153#define SkinNotify(op, state, ctx, sz) SkinAPI->Msg(op, state, ctx, sz, NULL, 0)
154#define SkinAsk(op, state, ctx, def) SkinAPI->Msg(op, state, ctx, sizeof(ctx), NULL, 0)
158#define SkinLoad(path) {;}
160#if defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
161 #define SkinPrintf(x) {;}
173 #define SkinPrintf printf
176#define SkinGetCmdLine GetCommandLineW
177#define SkinNotify(op, state, ctx) {;}
178#define SkinAsk(op, state, ctx, def) (def)
182#if defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
184 #if defined(PRINT_TO_DBG_LOG) || defined(PRINT_ALWAYS)
185 #define UserPrint(x) PrintDbgConsole x
187 #define UserPrint(x) {;}
192 #if defined(PRINT_TO_DBG_LOG) || defined(PRINT_ALWAYS)
194 #define UserPrint(x) \
197 PrintDbgConsole x ; \
202 #define UserPrint(x) \
211#if defined(DBG) || defined(PRINT_ALWAYS)
213 #define DbgPrint SkinPrintf
219 #if defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
220 #ifdef PRINT_TO_DBG_LOG
221 #define KdPrint(x) PrintDbgConsole x;
223 #define KdPrint(x) {;}
227 #if defined(PRINT_TO_DBG_LOG) || defined(PRINT_ALWAYS)
231 PrintDbgConsole x ; \
242 #define MmPrint(_x_) DbgPrint _x_
244 #define MmPrint(_x_) {NOTHING;}
247 #ifdef USE_TIME_PRINT
248 extern ULONG UdfTimeStamp;
249 #define TmPrint(_x_) {UdfTimeStamp++;KdPrint(("TM:%d: ",UdfTimeStamp));KdPrint(_x_);}
251 #define TmPrint KdPrint
254 #ifdef USE_PERF_PRINT
255 #define PerfPrint(_x_) DbgPrint _x_
257 #define PerfPrint(_x_) {NOTHING;}
260#if defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
270 #define AdPrint(_x_) {DbgPrint("Thrd:%x:",PsGetCurrentThread());DbgPrint _x_;}
272 #define AdPrint(_x_) {NOTHING;}
276 #define ThPrint(_x_) {DbgPrint("Thrd:%x:",PsGetCurrentThread());DbgPrint _x_;}
278 #define ThPrint(_x_) {NOTHING;}
282 #define ExtPrint(_x_) DbgPrint _x_
284 #define ExtPrint(_x_) {NOTHING;}
288 #define KdPrint(x) {NOTHING;}
289 #define MmPrint(_x_) {NOTHING;}
290 #define TmPrint(_x_) {NOTHING;}
291 #define PerfPrint(_x_) {NOTHING;}
292 #define AdPrint(_x_) {NOTHING;}
293 #define ThPrint(_x_) {NOTHING;}
294 #define ExtPrint(_x_) {NOTHING;}
299#ifndef NT_NATIVE_MODE
302#define ASSERT(_x_) assert(_x_)
307#define NonPagedPool 0
310#define NonPagedPoolCacheAligned 4
315 for(i=0; i<(b); i++) { \
317 c = (ULONG)(*(((PUCHAR)(a))+i)); \
318 KdPrint(("%2.2x ",c)); \
319 if ((i & 0x0f) == 0x0f) KdPrint(("\n")); \
329#define DbgMoveMemory RtlMoveMemory
330#define DbgCompareMemory RtlCompareMemory
331#define DbgCopyMemory RtlCopyMemory
332#define DbgAllocatePool ExAllocatePool
333#define DbgAllocatePoolWithTag(a,b,c) ExAllocatePool(a,b)
334#define DbgFreePool ExFreePool
349#if !defined(KERNEL_MODE_MM_BEHAVIOR) && !defined(USE_THREAD_HEAPS)
350#define ExAllocatePoolWithTag(hernya,size,tag) GlobalAlloc(GMEM_DISCARDABLE, (size))
351#define ExAllocatePool(hernya,size) GlobalAlloc(GMEM_DISCARDABLE, (size))
352#define ExFreePool(addr) GlobalFree((PVOID)(addr))
355#if defined(KERNEL_MODE_MM_BEHAVIOR) || defined(USE_THREAD_HEAPS)
356#define ExAllocatePoolWithTag(MemoryType,size,tag) ExAllocatePool((MemoryType), (size))
365#ifndef NT_NATIVE_MODE
384#define PtrOffset(BASE,OFFSET) ((ULONG)((ULONG)(OFFSET) - (ULONG)(BASE)))
388#ifndef DO_UNLOAD_PENDING
392#define DO_UNLOAD_PENDING 0x00000001
393#define DO_VERIFY_VOLUME 0x00000002
394#define DO_BUFFERED_IO 0x00000004
395#define DO_EXCLUSIVE 0x00000008
396#define DO_DIRECT_IO 0x00000010
397#define DO_MAP_IO_BUFFER 0x00000020
398#define DO_DEVICE_HAS_NAME 0x00000040
399#define DO_DEVICE_INITIALIZING 0x00000080
400#define DO_SYSTEM_BOOT_PARTITION 0x00000100
401#define DO_LONG_TERM_REQUESTS 0x00000200
402#define DO_NEVER_LAST_DEVICE 0x00000400
403#define DO_SHUTDOWN_REGISTERED 0x00000800
408#define _DEVICE_OBJECT _MY_DEVICE_OBJECT
409#define DEVICE_OBJECT MY_DEVICE_OBJECT
410#define PDEVICE_OBJECT PMY_DEVICE_OBJECT
428 struct _UDF_FMT_PARAMETERS* cbio;
444#define INVALID_PACKET 0x01
457#define UDFInitPacket(x) STATUS_SUCCESS
460#define try_return(S) { S; goto try_exit; }
463#define FlagOn(x,f) ((x) & (f))
465#define RtlCompareMemory(s1,s2,l) MyRtlCompareMemory(s1,s2,l)
476#define KeSetEvent(pEvt, foo, foo2) {NOTHING;}
477#define KeInitializeEvent(pEvt, foo, foo2) {NOTHING;}
478#define KeWaitForSingleObject(pEvt, foo, a, b, c) {NOTHING;}
479#define DbgWaitForSingleObject(o, to) KeWaitForSingleObject(o, Executive, KernelMode, FALSE, to);
482#define KeDelayExecutionThread(mode, foo, t) { NtDelayExecution(false, t); }
484#define KeDelayExecutionThread(mode, foo, t) { Sleep( abs((LONG)(((t)->QuadPart)/10000)) ); }
495#define UDFBreakPoint() __asm int 3
498#define UDFBreakPoint() DbgBreakPoint()
502#define BrutePoint() UDFBreakPoint()
504#define BrutePoint() {}
507#ifdef VALIDATE_STRUCTURES
508#define ValidateFileInfo(fi) \
510 if((fi)->IntegrityTag) { \
511 KdPrint(("UDF: ERROR! Using deallocated structure !!!\n"));\
516#define ValidateFileInfo(fi) {}
525#define BrutePoint() __asm int 3
528#define BrutePoint() DbgBreakPoint()
531#define BrutePoint() {}
536#ifndef NT_NATIVE_MODE
569#ifndef NT_NATIVE_MODE
570#define KeQuerySystemTime(t) GetSystemTimeAsFileTime((LPFILETIME)(t));
597#define KeRaiseIrql(irql, oldIrql) \
602#define KeLowerIrql(oldIrql) {;}
604#define KeInitializeSpinLock(sl) \
609#define KeAcquireSpinLock(sl,irql) \
611 ULONG isLocked = TRUE; \
612 while(isLocked) AcquireXLock(*(sl), isLocked, TRUE);\
615#define ExAcquireResourceExclusiveLite(res, wait) \
617 ULONG isLocked = TRUE; \
618 while(isLocked) AcquireXLock(*(res), isLocked, TRUE);\
621#define ExAcquireResourceSharedLite(res, wait) \
623 ULONG isLocked = TRUE; \
624 while(isLocked) AcquireXLock(*(res), isLocked, TRUE);\
627#define KeReleaseSpinLock(sl,irql) \
630 AcquireXLock(*(sl), isLocked, FALSE); \
633#define ExGetCurrentResourceThread() 0
635#define ExReleaseResourceForThreadLite(res, thrdID) \
638 AcquireXLock(*(res), isLocked, FALSE); \
647#define ExDeleteResourceLite(res) \
652#define ExConvertExclusiveToSharedLite(res) {}
656#define UDFAcquireResourceExclusive(Resource,CanWait) \
657 ExAcquireResourceExclusiveLite((Resource),(CanWait))
658#define UDFAcquireResourceShared(Resource,CanWait) \
659 ExAcquireResourceSharedLite((Resource),(CanWait))
661#define UDFReleaseResource(Resource) \
662 ExReleaseResourceForThreadLite((Resource), ExGetCurrentResourceThread())
663#define UDFDeleteResource(Resource) \
664 ExDeleteResourceLite((Resource))
665#define UDFConvertExclusiveToSharedLite(Resource) \
666 ExConvertExclusiveToSharedLite((Resource))
667#define UDFInitializeResourceLite(Resource) \
668 ExInitializeResourceLite((Resource))
669#define UDFAcquireSharedStarveExclusive(Resource,CanWait) \
670 ExAcquireSharedStarveExclusive((Resource),(CanWait))
671#define UDFAcquireSharedWaitForExclusive(Resource,CanWait) \
672 ExAcquireSharedWaitForExclusive((Resource),(CanWait))
675#define UDFInterlockedIncrement(addr) \
677#define UDFInterlockedDecrement(addr) \
693#define PASSIVE_LEVEL 0
696#define DISPATCH_LEVEL 2
698#define PROFILE_LEVEL 27
699#define CLOCK1_LEVEL 28
700#define CLOCK2_LEVEL 28
702#define POWER_LEVEL 30
704#define SYNCH_LEVEL (IPI_LEVEL-1)
706#define KeGetCurrentIrql() PASSIVE_LEVEL
708#ifndef NT_NATIVE_MODE
729#define ExSystemTimeToLocalTime(SysTime, LocTime) FileTimeToLocalFileTime((PFILETIME)(SysTime), (PFILETIME)(LocTime))
738#define ExLocalTimeToSystemTime(LocTime, SysTime) LocalFileTimeToFileTime((PFILETIME)(LocTime), (PFILETIME)(SysTime))
749#if (_WIN32_WINNT >= 0x0400)
796#define UDFPhWriteVerifySynchronous UDFPhWriteSynchronous
814#ifdef UDF_FORMAT_MEDIA
818#ifndef UDF_FORMAT_MEDIA
833#ifdef UDF_FORMAT_MEDIA
840#ifdef UDF_FORMAT_MEDIA
841 struct _UDFFmtState*
fms,
869#ifndef NT_NATIVE_MODE
877#ifndef UDF_FORMAT_MEDIA
902#ifndef INVALID_HANDLE_VALUE
903#define INVALID_HANDLE_VALUE ((HANDLE)(-1))
908#define ANSI_DOS_STAR ('<')
909#define ANSI_DOS_QM ('>')
910#define ANSI_DOS_DOT ('"')
912#define DOS_STAR (L'<')
914#define DOS_DOT (L'"')
930#ifndef InitializeListHead
944#define InitializeListHead(ListHead) (\
945 (ListHead)->Flink = (ListHead)->Blink = (ListHead))
954#define IsListEmpty(ListHead) \
955 ((ListHead)->Flink == (ListHead))
964#define RemoveHeadList(ListHead) \
966 {RemoveEntryList((ListHead)->Flink)}
975#define RemoveTailList(ListHead) \
977 {RemoveEntryList((ListHead)->Blink)}
986#define RemoveEntryList(Entry) {\
987 PLIST_ENTRY _EX_Blink;\
988 PLIST_ENTRY _EX_Flink;\
989 _EX_Flink = (Entry)->Flink;\
990 _EX_Blink = (Entry)->Blink;\
991 _EX_Blink->Flink = _EX_Flink;\
992 _EX_Flink->Blink = _EX_Blink;\
1003#define InsertTailList(ListHead,Entry) {\
1004 PLIST_ENTRY _EX_Blink;\
1005 PLIST_ENTRY _EX_ListHead;\
1006 _EX_ListHead = (ListHead);\
1007 _EX_Blink = _EX_ListHead->Blink;\
1008 (Entry)->Flink = _EX_ListHead;\
1009 (Entry)->Blink = _EX_Blink;\
1010 _EX_Blink->Flink = (Entry);\
1011 _EX_ListHead->Blink = (Entry);\
1022#define InsertHeadList(ListHead,Entry) {\
1023 PLIST_ENTRY _EX_Flink;\
1024 PLIST_ENTRY _EX_ListHead;\
1025 _EX_ListHead = (ListHead);\
1026 _EX_Flink = _EX_ListHead->Flink;\
1027 (Entry)->Flink = _EX_Flink;\
1028 (Entry)->Blink = _EX_ListHead;\
1029 _EX_Flink->Blink = (Entry);\
1030 _EX_ListHead->Flink = (Entry);\
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
static const WCHAR Message[]
#define UDFGetDevType(DevObj)
struct _FILE_BOTH_DIR_INFORMATION * PFILE_BOTH_DIR_INFORMATION
NTSTATUS UDFPhReadSynchronous(PDEVICE_OBJECT DeviceObject, PVOID Buffer, ULONG Length, LONGLONG Offset, PULONG ReadBytes, ULONG Flags)
#define ExAllocatePool(hernya, size)
struct _TIME_FIELDS TIME_FIELDS
VOID PrintDbgConsole(PCHAR DebugMessage,...)
TIME_FIELDS * PTIME_FIELDS
UNICODE_STRING * PUNICODE_STRING
struct _DEVICE_OBJECT DEVICE_OBJECT
struct _SKIN_API SKIN_API
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
HANDLE my_open(struct _UDFVolumeControlBlock *Vcb, PWCHAR fn)
BOOLEAN ProbeMemory(PVOID MemPtr, ULONG Length, BOOLEAN ForWrite)
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
ULONG MyRtlCompareMemory(PVOID s1, PVOID s2, ULONG len)
NTSTATUS ExInitializeResourceLite(PULONG res)
ULONG MyLockVolume(HANDLE h, ULONG *pLockMode)
VOID set_image_size(HANDLE h, int64 len)
struct _FSRTL_COMMON_FCB_HEADER * PFSRTL_COMMON_FCB_HEADER
NTSTATUS MyInitUnicodeString(IN PUNICODE_STRING Str1, IN PCWSTR Str2)
struct _IO_STATUS_BLOCK IO_STATUS_BLOCK
struct _DEVICE_OBJECT * PDEVICE_OBJECT
BOOLEAN opt_invalidate_volume
NTSTATUS UDFPhWriteSynchronous(PDEVICE_OBJECT DeviceObject, PVOID Buffer, ULONG Length, LONGLONG Offset, PULONG WrittenBytes, ULONG Flags)
ULONG(__stdcall * PSKIN_MSG)(ULONG MsgId, ULONG MsgSubId, PVOID DataIn, ULONG DataInLen, PVOID DataOut, ULONG DataInOut)
ULONG MyUnlockVolume(HANDLE h, ULONG *pLockMode)
PWCHAR(__stdcall * PSKIN_GETCMDLINE)(VOID)
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
struct _ANSI_STRING ANSI_STRING
SECTION_OBJECT_POINTERS * PSECTION_OBJECT_POINTERS
#define UDFPhWriteVerifySynchronous
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)
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
struct _SKIN_API * PSKIN_API
struct _FSRTL_COMMON_FCB_HEADER FSRTL_COMMON_FCB_HEADER
int(* PSKIN_INIT)(HINSTANCE hInstance, HINSTANCE hPrevInstance, int nCmdShow)
struct _IO_STATUS_BLOCK * PIO_STATUS_BLOCK
uint64 udf_lseek64(HANDLE fd, uint64 offset, int whence)
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
struct _UNICODE_STRING UNICODE_STRING
int(* PSKIN_PRINTF)(const char *Message,...)
struct _FILE_BOTH_DIR_INFORMATION FILE_BOTH_DIR_INFORMATION
ANSI_STRING * PANSI_STRING
struct _SECTION_OBJECT_POINTERS SECTION_OBJECT_POINTERS
int64 set_file_pointer(HANDLE h, int64 sz)
static unsigned char buff[32768]
GLenum const GLvoid * addr
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
static DWORD get_file_size(void)
static PLARGE_INTEGER Time
static PTIME_FIELDS TimeFields
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
PULONG MinorVersion OPTIONAL
ULONG AlignmentRequirement
PSKIN_GETCMDLINE GetCommandLine
#define UDFInterlockedExchangeAdd(addr, i)
_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
_Reserved_ PVOID Reserved
_Must_inspect_result_ _In_ ULONG Flags