[UDFS] Explicitly mention the license (GPLv2).
[reactos.git] / reactos / drivers / filesystems / udfs / Include / env_spec_nt.h
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.
5 ////////////////////////////////////////////////////////////////////
6
7 #ifndef __ENV_SPEC_NT_NATIVE__H__
8 #define __ENV_SPEC_NT_NATIVE__H__
9
10 #ifdef NT_NATIVE_MODE
11
12 #include "zw_2_nt.h"
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif //__cplusplus
17
18 #ifndef MAX_PATH
19 #define MAX_PATH 260
20 #endif //MAX_PATH
21
22 BOOLEAN
23 GetOsVersion(
24 PULONG MajorVersion OPTIONAL,
25 PULONG MinorVersion OPTIONAL,
26 PULONG BuildNumber OPTIONAL,
27 PUNICODE_STRING CSDVersion OPTIONAL
28 );
29
30 #define PsGetVersion(a,b,c,d) GetOsVersion(a,b,c,d)
31
32 #define InterlockedIncrement(addr) \
33 ((*addr)++)
34 #define InterlockedDecrement(addr) \
35 ((*addr)--)
36 int
37 __inline
38 InterlockedExchangeAdd(PLONG addr, LONG i) {
39 LONG Old = (*addr);
40 (*addr) += i;
41 return Old;
42 }
43
44 #define DeviceIoControl(h, ctlc, ib, is, ob, os, r, ov) MyDeviceIoControl(h, ctlc, ib, is, ob, os, r, ov)
45
46 BOOLEAN
47 MyDeviceIoControl(
48 HANDLE hDevice,
49 DWORD dwIoControlCode,
50 PVOID lpInBuffer,
51 DWORD nInBufferSize,
52 PVOID lpOutBuffer,
53 DWORD nOutBufferSize,
54 DWORD* lpBytesReturned,
55 PVOID lpOverlapped
56 );
57
58 #define OemToCharW(ansi_s, uni_s) (swprintf(uni_s, L"%S", ansi_s))
59 #define MultiByteToWideChar(cp, f, ansi_s, a_sz, uni_s, u_sz) (swprintf(uni_s, L"%S", ansi_s))
60
61 VOID
62 Sleep(
63 ULONG t
64 );
65
66 #define GlobalAlloc(foo, size) MyGlobalAlloc( size );
67 #define GlobalFree(ptr) MyGlobalFree( ptr );
68
69 extern "C"
70 PVOID MyGlobalAlloc(ULONG Size);
71
72 extern "C"
73 VOID MyGlobalFree(PVOID Addr);
74
75 #define ExitProcess(Status) NtTerminateProcess( NtCurrentProcess(), Status );
76
77 extern "C"
78 VOID
79 PrintNtConsole(
80 PCHAR DebugMessage,
81 ...
82 );
83
84 extern "C"
85 NTSTATUS
86 EnvFileOpenW(
87 PWCHAR Name,
88 HANDLE* ph
89 );
90
91 extern "C"
92 NTSTATUS
93 EnvFileOpenA(
94 PCHAR Name,
95 HANDLE* ph
96 );
97
98 extern "C"
99 NTSTATUS
100 EnvFileClose(
101 HANDLE hFile
102 );
103
104 extern "C"
105 NTSTATUS
106 EnvFileGetSizeByHandle(
107 HANDLE hFile,
108 PLONGLONG lpFileSize
109 );
110
111 extern "C"
112 NTSTATUS
113 EnvFileGetSizeA(
114 PCHAR Name,
115 PLONGLONG lpFileSize
116 );
117
118 extern "C"
119 NTSTATUS
120 EnvFileGetSizeW(
121 PWCHAR Name,
122 PLONGLONG lpFileSize
123 );
124
125 extern "C"
126 BOOLEAN
127 EnvFileExistsA(PCHAR Name);
128
129 extern "C"
130 BOOLEAN
131 EnvFileExistsW(PWCHAR Name);
132
133 extern "C"
134 NTSTATUS
135 EnvFileWrite(
136 HANDLE h,
137 PVOID ioBuffer,
138 ULONG Length,
139 PULONG bytesWritten
140 );
141
142 extern "C"
143 NTSTATUS
144 EnvFileRead(
145 HANDLE h,
146 PVOID ioBuffer,
147 ULONG Length,
148 PULONG bytesRead
149 );
150
151 #define ENV_FILE_CURRENT 1
152 #define ENV_FILE_END 2
153 #define ENV_FILE_BEGIN 3
154
155 extern "C"
156 NTSTATUS
157 EnvFileSetPointer(
158 HANDLE hFile,
159 LONGLONG lDistanceToMove,
160 LONGLONG* lResultPointer,
161 DWORD dwMoveMethod
162 );
163
164 extern "C"
165 NTSTATUS
166 EnvFileDeleteW(
167 PWCHAR fName
168 );
169
170 #define PrintDbgConsole PrintNtConsole
171
172 #ifdef __cplusplus
173 };
174 #endif //__cplusplus
175
176 #endif //NT_NATIVE_MODE
177
178 #endif //__ENV_SPEC_NT_NATIVE__H__