ReactOS 0.4.15-dev-7712-gbbbcd8e
env_spec_w32.h
Go to the documentation of this file.
1
2// Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
3// All rights reserved
4// This file was released under the GPLv2 on June 2015.
6/*************************************************************************
7*
8* File: env_spec_w32.h
9*
10* Module: User-mode applications (User mode execution only)
11*
12* Description:
13*
14*
15* Author: Alter
16*
17*************************************************************************/
18
19#ifndef __ENV_SPEC_W32__H_
20#define __ENV_SPEC_W32__H_
21
22#ifdef NT_NATIVE_MODE
23//#include "ntddk.h" // include this for its native functions and defn's
24#include "nt_native.h"
25#else //NT_NATIVE_MODE
26#include <windows.h>
27#endif //NT_NATIVE_MODE
28#include "platform.h"
29//#ifndef WITHOUT_FORMATTER
30#include "udferr_usr.h"
31//#endif WITHOUT_FORMATTER
32
33#ifndef NT_NATIVE_MODE
34#ifdef ASSERT
35 #undef ASSERT
36 #define ASSERT(a) if(!(a)) {__asm int 3;}
37#endif
38#endif //NT_NATIVE_MODE
39
40#ifndef MAXIMUM_FILENAME_LENGTH
41#define MAXIMUM_FILENAME_LENGTH MAX_PATH
42#endif //MAXIMUM_FILENAME_LENGTH
43
44#ifndef PAGE_SHIFT
45#define PAGE_SHIFT 12
46#endif //PAGE_SHIFT
47
48#ifndef PAGE_SIZE
49#define PAGE_SIZE (ULONG)0x1000
50#endif //PAGE_SIZE
51
52#ifndef PHYSICAL_ADDRESS
53#define PHYSICAL_ADDRESS LARGE_INTEGER
54#endif //PHYSICAL_ADDRESS
55
56#define OS_SUCCESS(a) NT_SUCCESS(a)
57#define OSSTATUS NTSTATUS
58
59#if defined UDF_DBG || defined DEBUG
60#define DBG
61#ifndef CDRW_W32
62#define UDF_DBG
63#endif //CDRW_W32
64#endif
65
66#define ERESEOURCE ULONG
67#define PERESEOURCE PULONG
68
69#define KEVENT ULONG
70#define PKEVENT PULONG
71
72typedef ULONG KSPIN_LOCK; // winnt ntndis
74
75#ifndef NT_NATIVE_MODE
76// Status ot
77#define NTSTATUS LONG
78
79#define NT_SUCCESS(x) ( (NTSTATUS)(x)>=0 )
80
81#define PsGetCurrentThread() GetCurrentThreadId()
82
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; \
93}
94
95extern "C"
96VOID
98 PCHAR DebugMessage,
99 ...
100 );
101
102#else //NT_NATIVE_MODE
103#define HINSTANCE HANDLE
104#endif //NT_NATIVE_MODE
105
106typedef
108 HINSTANCE hInstance, // handle to current instance
109 HINSTANCE hPrevInstance, // handle to previous instance
110 int nCmdShow // show state
111 );
112
113typedef
115 const char* Message,
116 ...
117 );
118
119typedef
121 VOID
122 );
123
124typedef
126 ULONG MsgId,
127 ULONG MsgSubId,
128 PVOID DataIn,
129 ULONG DataInLen,
130 PVOID DataOut,
131 ULONG DataInOut
132 );
133
134typedef struct _SKIN_API {
140
141#ifdef USE_SKIN_MODEL
142
143extern "C" PSKIN_API SkinAPI;
144extern PSKIN_API SkinLoad(
145 PWCHAR path,
146 HINSTANCE hInstance, // handle to current instance
147 HINSTANCE hPrevInstance, // handle to previous instance
148 int nCmdShow // show state
149 );
150
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)
155
156#else
157
158#define SkinLoad(path) {;}
159
160#if defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
161 #define SkinPrintf(x) {;}
162/*VOID
163inline
164SkinPrintf(
165 PCHAR Message,
166 ...
167 )
168{
169 //do nothing
170 return;
171}*/
172#else // defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
173 #define SkinPrintf printf
174#endif
175
176#define SkinGetCmdLine GetCommandLineW
177#define SkinNotify(op, state, ctx) {;}
178#define SkinAsk(op, state, ctx, def) (def)
179
180#endif // defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
181
182#if defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
183
184 #if defined(PRINT_TO_DBG_LOG) || defined(PRINT_ALWAYS)
185 #define UserPrint(x) PrintDbgConsole x
186 #else
187 #define UserPrint(x) {;}
188 #endif // PRINT_TO_DBG_LOG
189
190#else // defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
191
192 #if defined(PRINT_TO_DBG_LOG) || defined(PRINT_ALWAYS)
193
194 #define UserPrint(x) \
195 { \
196 SkinPrintf x ; \
197 PrintDbgConsole x ; \
198 }
199
200 #else // PRINT_TO_DBG_LOG
201
202 #define UserPrint(x) \
203 { \
204 SkinPrintf x ; \
205 }
206
207 #endif // PRINT_TO_DBG_LOG
208
209#endif // defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
210
211#if defined(DBG) || defined(PRINT_ALWAYS)
212
213 #define DbgPrint SkinPrintf
214
215 #ifdef KdPrint
216 #undef KdPrint
217 #endif
218
219 #if defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
220 #ifdef PRINT_TO_DBG_LOG
221 #define KdPrint(x) PrintDbgConsole x;
222 #else
223 #define KdPrint(x) {;}
224 #endif
225 #else
226
227 #if defined(PRINT_TO_DBG_LOG) || defined(PRINT_ALWAYS)
228 #define KdPrint(x) \
229 { \
230 SkinPrintf x ; \
231 PrintDbgConsole x ; \
232 }
233 #else
234 #define KdPrint(x) \
235 { \
236 SkinPrintf x ; \
237 }
238 #endif
239 #endif
240
241 #ifdef USE_MM_PRINT
242 #define MmPrint(_x_) DbgPrint _x_
243 #else
244 #define MmPrint(_x_) {NOTHING;}
245 #endif //USE_MM_PRINT
246
247 #ifdef USE_TIME_PRINT
248 extern ULONG UdfTimeStamp;
249 #define TmPrint(_x_) {UdfTimeStamp++;KdPrint(("TM:%d: ",UdfTimeStamp));KdPrint(_x_);}
250 #else
251 #define TmPrint KdPrint
252 #endif //USE_MM_PRINT
253
254 #ifdef USE_PERF_PRINT
255 #define PerfPrint(_x_) DbgPrint _x_
256 #else
257 #define PerfPrint(_x_) {NOTHING;}
258 #endif //USE_MM_PRINT
259
260#if defined(CDRW_W32) || defined(LIBUDFFMT) || defined(LIBUDF)
261 #ifdef USE_AD_PRINT
262 #undef USE_AD_PRINT
263 #endif
264 #ifdef USE_TH_PRINT
265 #undef USE_TH_PRINT
266 #endif
267#endif
268
269 #ifdef USE_AD_PRINT
270 #define AdPrint(_x_) {DbgPrint("Thrd:%x:",PsGetCurrentThread());DbgPrint _x_;}
271 #else
272 #define AdPrint(_x_) {NOTHING;}
273 #endif
274
275 #ifdef USE_TH_PRINT
276 #define ThPrint(_x_) {DbgPrint("Thrd:%x:",PsGetCurrentThread());DbgPrint _x_;}
277 #else
278 #define ThPrint(_x_) {NOTHING;}
279 #endif
280
281 #ifdef USE_DUMP_EXT
282 #define ExtPrint(_x_) DbgPrint _x_
283 #else
284 #define ExtPrint(_x_) {NOTHING;}
285 #endif //USE_MM_PRINT
286
287#else
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;}
295#endif
296
297#define DbgTouch(a)
298
299#ifndef NT_NATIVE_MODE
300#include "assert.h"
301
302#define ASSERT(_x_) assert(_x_)
303#define UDFTouch(a)
304
305#endif //NT_NATIVE_MODE
306
307#define NonPagedPool 0
308#define PagedPool 1
309//#define NonPagedPoolMustSucceed 2
310#define NonPagedPoolCacheAligned 4
311
312#define KdDump(a,b) \
313if((a)!=NULL) { \
314 ULONG i; \
315 for(i=0; i<(b); i++) { \
316 ULONG c; \
317 c = (ULONG)(*(((PUCHAR)(a))+i)); \
318 KdPrint(("%2.2x ",c)); \
319 if ((i & 0x0f) == 0x0f) KdPrint(("\n")); \
320 } \
321 KdPrint(("\n")); \
322}
323
324//mem ot
325//#define ExAllocatePool(hernya,size) MyAllocatePool(size)
326//#define ExFreePool(size) MyFreePool((PCHAR)(size))
327//#define SystemAllocatePool(hernya,size) GlobalAlloc(GMEM_DISCARDABLE, size);
328//#define SystemFreePool(addr) GlobalFree((PVOID)(addr))
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
335
336#ifdef NT_NATIVE_MODE
337/*
338#define GlobalAlloc(foo, size) MyGlobalAlloc( size );
339#define GlobalFree(ptr) MyGlobalFree( ptr );
340
341extern "C"
342PVOID MyGlobalAlloc(ULONG Size);
343
344extern "C"
345VOID MyGlobalFree(PVOID Addr);
346*/
347#endif
348
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))
353#endif
354
355#if defined(KERNEL_MODE_MM_BEHAVIOR) || defined(USE_THREAD_HEAPS)
356#define ExAllocatePoolWithTag(MemoryType,size,tag) ExAllocatePool((MemoryType), (size))
357
358extern "C"
359PVOID ExAllocatePool(ULONG MemoryType, ULONG Size);
360
361extern "C"
362VOID ExFreePool(PVOID Addr);
363#endif //KERNEL_MODE_MM_BEHAVIOR || USE_THREAD_HEAPS
364
365#ifndef NT_NATIVE_MODE
366
367//string ot
368typedef struct _UNICODE_STRING {
374
375typedef struct _ANSI_STRING {
381
382#endif //NT_NATIVE_MODE
383
384#define PtrOffset(BASE,OFFSET) ((ULONG)((ULONG)(OFFSET) - (ULONG)(BASE)))
385
386// Device object ot
387
388#ifndef DO_UNLOAD_PENDING
389// Define Device Object (DO) flags
390//
391
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
404
405#endif //DO_UNLOAD_PENDING
406
407#ifdef NT_NATIVE_MODE
408#define _DEVICE_OBJECT _MY_DEVICE_OBJECT
409#define DEVICE_OBJECT MY_DEVICE_OBJECT
410#define PDEVICE_OBJECT PMY_DEVICE_OBJECT
411#endif //NT_NATIVE_MODE
412
413typedef struct _DEVICE_OBJECT {
414
415#ifndef LIBUDF
416
422
423#endif // LIBUDF
424
425
426#ifdef LIBUDFFMT
427
428 struct _UDF_FMT_PARAMETERS* cbio;
429 PVOID lpContext;
430
431#else
432#ifdef LIBUDF
433 PVOID lpContext;
434#endif // LIBUDF
435#endif // LIBUDFFMT
436
438
439#ifndef CDRW_W32
440/*
441typedef ULONG DEVICE_OBJECT;
442typedef ULONG PDEVICE_OBJECT;
443*/
444#define INVALID_PACKET 0x01
445
446typedef struct _PACKET {
447 // Node Identifier
448// UDFIdentifier NodeIdentifier;
449 // Pointer to the buffer (in non-paged pool)
451 // Offset, from which this data was read
453 // Flags
456
457#define UDFInitPacket(x) STATUS_SUCCESS
458#endif //CDRW_W32
459
460#define try_return(S) { S; goto try_exit; }
461#define NOTHING
462
463#define FlagOn(x,f) ((x) & (f))
464
465#define RtlCompareMemory(s1,s2,l) MyRtlCompareMemory(s1,s2,l)
466// Structure ot
467extern "C"
468ULONG
470 PVOID s1,
471 PVOID s2,
472 ULONG len
473 );
474//#define RtlCompareMemory(d1,d2,l) (ULONG)(memcmp (d1,d2,l))
475
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);
480//#define DbgWaitForSingleObject KeWaitForSingleObject
481#ifdef NT_NATIVE_MODE
482#define KeDelayExecutionThread(mode, foo, t) { NtDelayExecution(false, t); }
483#else //NT_NATIVE_MODE
484#define KeDelayExecutionThread(mode, foo, t) { Sleep( abs((LONG)(((t)->QuadPart)/10000)) ); }
485#endif //NT_NATIVE_MODE
486
487/*#define RtlCompareUnicodeString(s1,s2,cs) \
488 (((s1)->Length == (s2)->Length) && \
489 (RtlCompareMemory(s1,s2,(s1)->Length)))
490*/
491#ifndef CDRW_W32
492#ifdef _X86_
493
494// This is an illegal use of INT3
495#define UDFBreakPoint() __asm int 3
496#else // _X86_
497
498#define UDFBreakPoint() DbgBreakPoint()
499#endif // _X86_
500
501#ifdef BRUTE
502#define BrutePoint() UDFBreakPoint()
503#else
504#define BrutePoint() {}
505#endif // BRUTE
506
507#ifdef VALIDATE_STRUCTURES
508#define ValidateFileInfo(fi) \
509{ /* validate FileInfo */ \
510 if((fi)->IntegrityTag) { \
511 KdPrint(("UDF: ERROR! Using deallocated structure !!!\n"));\
512 /*BrutePoint();*/ \
513 } \
514}
515#else
516#define ValidateFileInfo(fi) {}
517#endif
518
519#else //CDRW_W32
520
521#ifdef BRUTE
522#ifdef _X86_
523
524// This is an illegal use of INT3
525#define BrutePoint() __asm int 3
526#else // _X86_
527
528#define BrutePoint() DbgBreakPoint()
529#endif // _X86_
530#else
531#define BrutePoint() {}
532#endif // BRUTE
533
534#endif //CDRW_W32
535
536#ifndef NT_NATIVE_MODE
537
538extern "C"
539ULONG
543 BOOLEAN UpCase);
544
545extern "C"
551 );
552
553extern "C"
556 IN PUNICODE_STRING Str1,
557 IN PWSTR Str2
558 );
559
560#endif //NT_NATIVE_MODE
561
562extern "C"
565 IN PUNICODE_STRING Str1,
566 IN PCWSTR Str2
567 );
568
569#ifndef NT_NATIVE_MODE
570#define KeQuerySystemTime(t) GetSystemTimeAsFileTime((LPFILETIME)(t));
571
572typedef struct _FILE_BOTH_DIR_INFORMATION {
585 WCHAR ShortName[12];
586 WCHAR FileName[1];
588
589#endif //NT_NATIVE_MODE
590
591typedef UCHAR KIRQL;
592typedef KIRQL *PKIRQL;
593
596
597#define KeRaiseIrql(irql, oldIrql) \
598{ \
599 *oldIrql = 0; \
600}
601
602#define KeLowerIrql(oldIrql) {;}
603
604#define KeInitializeSpinLock(sl) \
605{ \
606 *(sl) = 0; \
607}
608
609#define KeAcquireSpinLock(sl,irql) \
610{ \
611 ULONG isLocked = TRUE; \
612 while(isLocked) AcquireXLock(*(sl), isLocked, TRUE);\
613}
614
615#define ExAcquireResourceExclusiveLite(res, wait) \
616{ \
617 ULONG isLocked = TRUE; \
618 while(isLocked) AcquireXLock(*(res), isLocked, TRUE);\
619}
620
621#define ExAcquireResourceSharedLite(res, wait) \
622{ \
623 ULONG isLocked = TRUE; \
624 while(isLocked) AcquireXLock(*(res), isLocked, TRUE);\
625}
626
627#define KeReleaseSpinLock(sl,irql) \
628{ \
629 ULONG isLocked; \
630 AcquireXLock(*(sl), isLocked, FALSE); \
631}
632
633#define ExGetCurrentResourceThread() 0
634
635#define ExReleaseResourceForThreadLite(res, thrdID) \
636{ \
637 ULONG isLocked; \
638 AcquireXLock(*(res), isLocked, FALSE); \
639}
640
642{
643 *(res) = 0;
644 return STATUS_SUCCESS;
645}
646
647#define ExDeleteResourceLite(res) \
648{ \
649 *(res) = 0; \
650}
651
652#define ExConvertExclusiveToSharedLite(res) {/* do nothing */}
653
654#ifndef CDRW_W32
655
656#define UDFAcquireResourceExclusive(Resource,CanWait) \
657 ExAcquireResourceExclusiveLite((Resource),(CanWait))
658#define UDFAcquireResourceShared(Resource,CanWait) \
659 ExAcquireResourceSharedLite((Resource),(CanWait))
660// a convenient macro (must be invoked in the context of the thread that acquired the resource)
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))
673//#define UDFDebugAcquireResourceExclusiveLite(a,b,c,d) ExAcquireResourceExclusiveLite(a,b)
674
675#define UDFInterlockedIncrement(addr) \
676 ((*addr)++)
677#define UDFInterlockedDecrement(addr) \
678 ((*addr)--)
679int
680__inline
682 LONG Old = (*addr);
683 (*addr) += i;
684 return Old;
685}
686
687#endif //CDRW_W32
688
689//
690// Interrupt Request Level definitions
691//
692
693#define PASSIVE_LEVEL 0 // Passive release level
694#define LOW_LEVEL 0 // Lowest interrupt level
695#define APC_LEVEL 1 // APC interrupt level
696#define DISPATCH_LEVEL 2 // Dispatcher level
697
698#define PROFILE_LEVEL 27 // timer used for profiling.
699#define CLOCK1_LEVEL 28 // Interval clock 1 level - Not used on x86
700#define CLOCK2_LEVEL 28 // Interval clock 2 level
701#define IPI_LEVEL 29 // Interprocessor interrupt level
702#define POWER_LEVEL 30 // Power failure level
703#define HIGH_LEVEL 31 // Highest interrupt level
704#define SYNCH_LEVEL (IPI_LEVEL-1) // synchronization level
705
706#define KeGetCurrentIrql() PASSIVE_LEVEL
707
708#ifndef NT_NATIVE_MODE
709
710typedef struct _TIME_FIELDS {
711 USHORT Year; // range [1601...]
712 USHORT Month; // range [1..12]
713 USHORT Day; // range [1..31]
714 USHORT Hour; // range [0..23]
715 USHORT Minute; // range [0..59]
716 USHORT Second; // range [0..59]
717 USHORT Milliseconds;// range [0..999]
718 USHORT Weekday; // range [0..6] == [Sunday..Saturday]
721
722//#define RtlTimeFieldsToTime(a,b) TRUE
727 );
728
729#define ExSystemTimeToLocalTime(SysTime, LocTime) FileTimeToLocalFileTime((PFILETIME)(SysTime), (PFILETIME)(LocTime))
730
731//#define RtlTimeToTimeFields(a,b) {}
736 );
737
738#define ExLocalTimeToSystemTime(LocTime, SysTime) LocalFileTimeToFileTime((PFILETIME)(LocTime), (PFILETIME)(SysTime))
739
740#endif //NT_NATIVE_MODE
741
742#ifndef CDRW_W32
743
749#if (_WIN32_WINNT >= 0x0400)
752#endif // (_WIN32_WINNT >= 0x0400)
759
766
767
774 ULONG Flags);
775
777 PDEVICE_OBJECT DeviceObject, // the physical device object
781 PULONG WrittenBytes,
782 ULONG Flags);
783
784#if 0
785extern NTSTATUS
787 PDEVICE_OBJECT DeviceObject, // the physical device object
791 PULONG WrittenBytes,
793 );
794#endif
795
796#define UDFPhWriteVerifySynchronous UDFPhWriteSynchronous
797
805 IN BOOLEAN OverrideVerify,
807
808#endif //CDRW_W32
809
811// ULONG LBA);
812 int64 len);
813
814#ifdef UDF_FORMAT_MEDIA
816#endif
817
818#ifndef UDF_FORMAT_MEDIA
820 HANDLE h,
821 PCHAR buff,
822 ULONG len);
823#endif
824
825extern "C"
826HANDLE
828#ifndef CDRW_W32
830#endif //CDRW_W32
831 PWCHAR fn);
832
833#ifdef UDF_FORMAT_MEDIA
834struct _UDFFmtState;
835#endif //UDF_FORMAT_MEDIA
836
837extern
838void
840#ifdef UDF_FORMAT_MEDIA
841 struct _UDFFmtState* fms,
842#endif //UDF_FORMAT_MEDIA
843 int rc
844 );
845
846#ifndef CDRW_W32
848#endif //CDRW_W32
849
850#ifdef LIBUDFFMT
852udf_get_sizes(
855 );
856#endif //LIBUDFFMT
857
858int64
860 HANDLE h
861 );
862
863int64
865 HANDLE h,
866 int64 sz
867 );
868
869#ifndef NT_NATIVE_MODE
870typedef struct _IO_STATUS_BLOCK {
874#endif //NT_NATIVE_MODE
875
876
877#ifndef UDF_FORMAT_MEDIA
878extern ULONG LockMode;
881#endif //UDF_FORMAT_MEDIA
882
883extern "C"
884ULONG
886 HANDLE h,
887 ULONG* pLockMode // OUT
888 );
889
890extern "C"
891ULONG
893 HANDLE h,
894 ULONG* pLockMode // IN
895 );
896
897#ifndef CDRW_W32
898ULONG
900#endif //CDRW_W32
901
902#ifndef INVALID_HANDLE_VALUE
903#define INVALID_HANDLE_VALUE ((HANDLE)(-1))
904#endif
905
906#ifndef ANSI_DOS_STAR
907
908#define ANSI_DOS_STAR ('<')
909#define ANSI_DOS_QM ('>')
910#define ANSI_DOS_DOT ('"')
911
912#define DOS_STAR (L'<')
913#define DOS_QM (L'>')
914#define DOS_DOT (L'"')
915
916#endif //ANSI_DOS_STAR
917
918extern "C"
921 PVOID MemPtr,
923 BOOLEAN ForWrite
924 );
925
926#ifdef NT_NATIVE_MODE
927#include "env_spec_nt.h"
928#endif //NT_NATIVE_MODE
929
930#ifndef InitializeListHead
931
932//
933// Doubly-linked list manipulation routines. Implemented as macros
934// but logically these are procedures.
935//
936
937//
938// VOID
939// InitializeListHead(
940// PLIST_ENTRY ListHead
941// );
942//
943
944#define InitializeListHead(ListHead) (\
945 (ListHead)->Flink = (ListHead)->Blink = (ListHead))
946
947//
948// BOOLEAN
949// IsListEmpty(
950// PLIST_ENTRY ListHead
951// );
952//
953
954#define IsListEmpty(ListHead) \
955 ((ListHead)->Flink == (ListHead))
956
957//
958// PLIST_ENTRY
959// RemoveHeadList(
960// PLIST_ENTRY ListHead
961// );
962//
963
964#define RemoveHeadList(ListHead) \
965 (ListHead)->Flink;\
966 {RemoveEntryList((ListHead)->Flink)}
967
968//
969// PLIST_ENTRY
970// RemoveTailList(
971// PLIST_ENTRY ListHead
972// );
973//
974
975#define RemoveTailList(ListHead) \
976 (ListHead)->Blink;\
977 {RemoveEntryList((ListHead)->Blink)}
978
979//
980// VOID
981// RemoveEntryList(
982// PLIST_ENTRY Entry
983// );
984//
985
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;\
993 }
994
995//
996// VOID
997// InsertTailList(
998// PLIST_ENTRY ListHead,
999// PLIST_ENTRY Entry
1000// );
1001//
1002
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);\
1012 }
1013
1014//
1015// VOID
1016// InsertHeadList(
1017// PLIST_ENTRY ListHead,
1018// PLIST_ENTRY Entry
1019// );
1020//
1021
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);\
1031 }
1032
1033#endif //InitializeListHead
1034
1035#endif // __ENV_SPEC_W32__H_
unsigned char BOOLEAN
#define VOID
Definition: acefi.h:82
#define write
Definition: acwin.h:97
LONG NTSTATUS
Definition: precomp.h:26
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
HINSTANCE hInstance
Definition: charmap.c:19
Definition: bufpool.h:45
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
static const WCHAR Message[]
Definition: register.c:74
return Iosb
Definition: create.c:4402
unsigned long long uint64
Definition: platform.h:18
long long int64
Definition: platform.h:13
static NTSTATUS ReadBytes(IN PDEVICE_OBJECT LowerDevice, OUT PUCHAR Buffer, IN ULONG BufferSize, OUT PULONG_PTR FilledBytes)
Definition: detect.c:67
#define UDFGetDevType(DevObj)
Definition: env_spec.h:148
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)
Definition: env_spec_w32.h:351
struct _TIME_FIELDS TIME_FIELDS
VOID PrintDbgConsole(PCHAR DebugMessage,...)
TIME_FIELDS * PTIME_FIELDS
Definition: env_spec_w32.h:720
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
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)
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
ULONG MyRtlCompareMemory(PVOID s1, PVOID s2, ULONG len)
Definition: string_lib.cpp:9
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
ULONG MyLockVolume(HANDLE h, ULONG *pLockMode)
VOID set_image_size(HANDLE h, int64 len)
BOOLEAN open_as_device
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
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
BOOLEAN opt_invalidate_volume
Definition: env_spec_w32.cpp:9
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)
Definition: env_spec_w32.h:125
ULONG MyUnlockVolume(HANDLE h, ULONG *pLockMode)
PWCHAR(__stdcall * PSKIN_GETCMDLINE)(VOID)
Definition: env_spec_w32.h:120
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
Definition: string_lib.cpp:46
struct _ANSI_STRING ANSI_STRING
struct _PACKET * PPACKET
SECTION_OBJECT_POINTERS * PSECTION_OBJECT_POINTERS
Definition: env_spec_w32.h:765
#define UDFPhWriteVerifySynchronous
Definition: env_spec_w32.h:796
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)
Definition: string_lib.cpp:62
struct _SKIN_API * PSKIN_API
struct _FSRTL_COMMON_FCB_HEADER FSRTL_COMMON_FCB_HEADER
void my_exit(int rc)
struct _PACKET PACKET
#define SkinLoad(path)
Definition: env_spec_w32.h:158
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
int(* PSKIN_INIT)(HINSTANCE hInstance, HINSTANCE hPrevInstance, int nCmdShow)
Definition: env_spec_w32.h:107
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
struct _IO_STATUS_BLOCK * PIO_STATUS_BLOCK
Definition: change.c:34
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,...)
Definition: env_spec_w32.h:114
ERESOURCE * PERESOURCE
Definition: env_spec_w32.h:595
struct _FILE_BOTH_DIR_INFORMATION FILE_BOTH_DIR_INFORMATION
ULONG ERESOURCE
Definition: env_spec_w32.h:594
ULONG LockMode
Definition: env_spec_w32.cpp:8
ANSI_STRING * PANSI_STRING
Definition: env_spec_w32.h:380
struct _SECTION_OBJECT_POINTERS SECTION_OBJECT_POINTERS
int64 set_file_pointer(HANDLE h, int64 sz)
static unsigned char buff[32768]
Definition: fatten.c:17
localAdvHdr Flags2
Definition: fsrtlfuncs.h:1692
GLuint res
Definition: glext.h:9613
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLsizei len
Definition: glext.h:6722
GLintptr offset
Definition: glext.h:5920
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
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
Definition: glfuncs.h:248
struct S1 s1
struct S2 s2
static int blocks
Definition: mkdosfs.c:527
static DWORD get_file_size(void)
Definition: integrity.c:149
static PLARGE_INTEGER Time
Definition: time.c:105
static PTIME_FIELDS TimeFields
Definition: time.c:104
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define Vcb
Definition: cdprocs.h:1415
#define fms
This file contains the definitions and functions of the Mbed TLS platform abstraction layer.
static int fd
Definition: io.c:51
#define STATUS_SUCCESS
Definition: shellext.h:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
USHORT MaximumLength
Definition: env_spec_w32.h:377
ULONG AlignmentRequirement
Definition: env_spec_w32.h:420
PVOID DeviceExtension
Definition: env_spec_w32.h:418
LARGE_INTEGER CreationTime
Definition: from_kernel.h:141
LARGE_INTEGER AllocationSize
Definition: from_kernel.h:146
LARGE_INTEGER LastAccessTime
Definition: from_kernel.h:142
LARGE_INTEGER LastWriteTime
Definition: from_kernel.h:143
LARGE_INTEGER AllocationSize
Definition: env_spec_w32.h:755
LARGE_INTEGER ValidDataLength
Definition: env_spec_w32.h:757
LARGE_INTEGER offset
Definition: env_spec_w32.h:452
UCHAR flags
Definition: env_spec_w32.h:454
PCHAR buffer
Definition: env_spec_w32.h:450
PSKIN_GETCMDLINE GetCommandLine
Definition: env_spec_w32.h:137
PSKIN_MSG Msg
Definition: env_spec_w32.h:138
PSKIN_PRINTF Printf
Definition: env_spec_w32.h:136
PSKIN_INIT Init
Definition: env_spec_w32.h:135
USHORT Milliseconds
Definition: env_spec_w32.h:717
USHORT Weekday
Definition: env_spec_w32.h:718
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG
Definition: typedefs.h:59
char * PSTR
Definition: typedefs.h:51
const uint16_t * PCWSTR
Definition: typedefs.h:57
uint16_t USHORT
Definition: typedefs.h:56
int64_t LONGLONG
Definition: typedefs.h:68
#define __stdcall
Definition: typedefs.h:25
#define IN
Definition: typedefs.h:39
int32_t * PLONG
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char CCHAR
Definition: typedefs.h:51
char * PCHAR
Definition: typedefs.h:51
#define UDFInterlockedExchangeAdd(addr, i)
Definition: udffs.h:257
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:320
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180