1 /************************************************************************
2 *                                                                                                                      *
3 *     winbase.h -- This module defines the 32-Bit Windows Base APIs           *
4 *                                                                                                                      *
5 *     Copyright (c) Microsoft Corp. All rights reserved.                              *
6 *                                                                                                                      *
7 ************************************************************************/
8 #ifndef _WINBASE_
9 #define _WINBASE_
10
11
12 #if _MSC_VER > 1000
13 #pragma once
14 #endif
15
16 #ifdef _MAC
17 #include <macwin32.h>
18 #endif //_MAC
19
20 //
21 // Define API decoration for direct importing of DLL references.
22 //
23
24 #if !defined(_ADVAPI32_)
25 #define WINADVAPI DECLSPEC_IMPORT
26 #else
27 #define WINADVAPI
28 #endif
29
30 #if !defined(_KERNEL32_)
31 #define WINBASEAPI DECLSPEC_IMPORT
32 #else
33 #define WINBASEAPI
34 #endif
35
36 #if !defined(_ZAWPROXY_)
37 #define ZAWPROXYAPI DECLSPEC_IMPORT
38 #else
39 #define ZAWPROXYAPI
40 #endif
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /*
47  * Compatibility macros
48  */
49
50 #define DefineHandleTable(w)                    ((w),TRUE)
Lines 51 ... 1218 are skipped.
1219 #define FILE_MAP_WRITE          SECTION_MAP_WRITE
1220 #define FILE_MAP_READ           SECTION_MAP_READ
1221 #define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS
1222 #define FILE_MAP_EXECUTE      SECTION_MAP_EXECUTE_EXPLICIT      // not included in FILE_MAP_ALL_ACCESS
1223
1224 #define OF_READ                     0x00000000
1225 #define OF_WRITE                    0x00000001
1226 #define OF_READWRITE             0x00000002
1227 #define OF_SHARE_COMPAT        0x00000000
1228 #define OF_SHARE_EXCLUSIVE  0x00000010
1229 #define OF_SHARE_DENY_WRITE 0x00000020
1230 #define OF_SHARE_DENY_READ  0x00000030
1231 #define OF_SHARE_DENY_NONE  0x00000040
1232 #define OF_PARSE                    0x00000100
1233 #define OF_DELETE                  0x00000200
1234 #define OF_VERIFY                  0x00000400
1235 #define OF_CANCEL                  0x00000800
1236 #define OF_CREATE                  0x00001000
1237 #define OF_PROMPT                  0x00002000
1238 #define OF_EXIST                    0x00004000
1239 #define OF_REOPEN                  0x00008000
1240
1241 #define OFS_MAXPATHNAME 128
1242 typedef struct _OFSTRUCT {
1243       BYTE cBytes;
1244       BYTE fFixedDisk;
1245       WORD nErrCode;
1246       WORD Reserved1;
1247       WORD Reserved2;
1248       CHAR szPathName[OFS_MAXPATHNAME];
1249 } OFSTRUCT, *LPOFSTRUCT, *POFSTRUCT;
1250
1251 #ifndef NOWINBASEINTERLOCK
1252
1253 #ifndef _NTOS_
1254
1255 #if defined(_M_IA64) && !defined(RC_INVOKED)
1256
1257 #define InterlockedIncrement _InterlockedIncrement
1258 #define InterlockedIncrementAcquire _InterlockedIncrement_acq
1259 #define InterlockedIncrementRelease _InterlockedIncrement_rel
1260 #define InterlockedDecrement _InterlockedDecrement
1261 #define InterlockedDecrementAcquire _InterlockedDecrement_acq
1262 #define InterlockedDecrementRelease _InterlockedDecrement_rel
1263 #define InterlockedExchange _InterlockedExchange
1264 #define InterlockedExchangeAdd _InterlockedExchangeAdd
1265 #define InterlockedCompareExchange _InterlockedCompareExchange
1266 #define InterlockedCompareExchangeAcquire _InterlockedCompareExchange_acq
1267 #define InterlockedCompareExchangeRelease _InterlockedCompareExchange_rel
1268 #define InterlockedExchangePointer _InterlockedExchangePointer
1269 #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
1270 #define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer_rel
1271 #define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer_acq
1272
1273 #define InterlockedIncrement64 _InterlockedIncrement64
1274 #define InterlockedDecrement64 _InterlockedDecrement64
1275 #define InterlockedExchange64 _InterlockedExchange64
1276 #define InterlockedExchangeAcquire64 _InterlockedExchange64_acq
1277 #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
1278 #define InterlockedCompareExchange64 _InterlockedCompareExchange64
1279 #define InterlockedCompareExchangeAcquire64 _InterlockedCompareExchange64_acq
1280 #define InterlockedCompareExchangeRelease64 _InterlockedCompareExchange64_rel
1281 #define InterlockedCompare64Exchange128        _InterlockedCompare64Exchange128
1282 #define InterlockedCompare64ExchangeAcquire128  _InterlockedCompare64Exchange128_acq
1283 #define InterlockedCompare64ExchangeRelease128  _InterlockedCompare64Exchange128_rel
1284
1285 #define InterlockedOr _InterlockedOr
1286 #define InterlockedOrAcquire _InterlockedOr_acq
1287 #define InterlockedOrRelease _InterlockedOr_rel
1288 #define InterlockedOr8 _InterlockedOr8
1289 #define InterlockedOr8Acquire _InterlockedOr8_acq
1290 #define InterlockedOr8Release _InterlockedOr8_rel
1291 #define InterlockedOr16 _InterlockedOr16
1292 #define InterlockedOr16Acquire _InterlockedOr16_acq
1293 #define InterlockedOr16Release _InterlockedOr16_rel
1294 #define InterlockedOr64 _InterlockedOr64
1295 #define InterlockedOr64Acquire _InterlockedOr64_acq
1296 #define InterlockedOr64Release _InterlockedOr64_rel
1297 #define InterlockedXor _InterlockedXor
1298 #define InterlockedXorAcquire _InterlockedXor_acq
1299 #define InterlockedXorRelease _InterlockedXor_rel
1300 #define InterlockedXor8 _InterlockedXor8
1301 #define InterlockedXor8Acquire _InterlockedXor8_acq
1302 #define InterlockedXor8Release _InterlockedXor8_rel
1303 #define InterlockedXor16 _InterlockedXor16
1304 #define InterlockedXor16Acquire _InterlockedXor16_acq
1305 #define InterlockedXor16Release _InterlockedXor16_rel
1306 #define InterlockedXor64 _InterlockedXor64
1307 #define InterlockedXor64Acquire _InterlockedXor64_acq
1308 #define InterlockedXor64Release _InterlockedXor64_rel
1309 #define InterlockedAnd _InterlockedAnd
1310 #define InterlockedAndAcquire _InterlockedAnd_acq
1311 #define InterlockedAndRelease _InterlockedAnd_rel
1312 #define InterlockedAnd8 _InterlockedAnd8
1313 #define InterlockedAnd8Acquire _InterlockedAnd8_acq
1314 #define InterlockedAnd8Release _InterlockedAnd8_rel
1315 #define InterlockedAnd16 _InterlockedAnd16
1316 #define InterlockedAnd16Acquire _InterlockedAnd16_acq
1317 #define InterlockedAnd16Release _InterlockedAnd16_rel
1318 #define InterlockedAnd64 _InterlockedAnd64
Lines 1319 ... 2006 are skipped.
2007 #pragma intrinsic (_InterlockedOr8_acq)
2008 #pragma intrinsic (_InterlockedOr8_rel)
2009 #pragma intrinsic (_InterlockedOr16)
2010 #pragma intrinsic (_InterlockedOr16_acq)
2011 #pragma intrinsic (_InterlockedOr16_rel)
2012 #pragma intrinsic (_InterlockedOr64)
2013 #pragma intrinsic (_InterlockedOr64_acq)
2014 #pragma intrinsic (_InterlockedOr64_rel)
2015 #pragma intrinsic (_InterlockedXor)
2016 #pragma intrinsic (_InterlockedXor_acq)
2017 #pragma intrinsic (_InterlockedXor_rel)
2018 #pragma intrinsic (_InterlockedXor8)
2019 #pragma intrinsic (_InterlockedXor8_acq)
2020 #pragma intrinsic (_InterlockedXor8_rel)
2021 #pragma intrinsic (_InterlockedXor16)
2022 #pragma intrinsic (_InterlockedXor16_acq)
2023 #pragma intrinsic (_InterlockedXor16_rel)
2024 #pragma intrinsic (_InterlockedXor64)
2025 #pragma intrinsic (_InterlockedXor64_acq)
2026 #pragma intrinsic (_InterlockedXor64_rel)
2027 #pragma intrinsic (_InterlockedAnd)
2028 #pragma intrinsic (_InterlockedAnd_acq)
2029 #pragma intrinsic (_InterlockedAnd_rel)
2030 #pragma intrinsic (_InterlockedAnd8)
2031 #pragma intrinsic (_InterlockedAnd8_acq)
2032 #pragma intrinsic (_InterlockedAnd8_rel)
2033 #pragma intrinsic (_InterlockedAnd16)
2034 #pragma intrinsic (_InterlockedAnd16_acq)
2035 #pragma intrinsic (_InterlockedAnd16_rel)
2036 #pragma intrinsic (_InterlockedAnd64)
2037 #pragma intrinsic (_InterlockedAnd64_acq)
2038 #pragma intrinsic (_InterlockedAnd64_rel)
2039
2040 #elif defined(_M_AMD64) && !defined(RC_INVOKED)
2041
2042 #define InterlockedAnd _InterlockedAnd
2043 #define InterlockedOr _InterlockedOr
2044 #define InterlockedXor _InterlockedXor
2045 #define InterlockedIncrement _InterlockedIncrement
2046 #define InterlockedIncrementAcquire InterlockedIncrement
2047 #define InterlockedIncrementRelease InterlockedIncrement
2048 #define InterlockedDecrement _InterlockedDecrement
2049 #define InterlockedDecrementAcquire InterlockedDecrement
2050 #define InterlockedDecrementRelease InterlockedDecrement
2051 #define InterlockedExchange _InterlockedExchange
2052 #define InterlockedExchangeAdd _InterlockedExchangeAdd
2053 #define InterlockedCompareExchange _InterlockedCompareExchange
2054 #define InterlockedCompareExchangeAcquire InterlockedCompareExchange
2055 #define InterlockedCompareExchangeRelease InterlockedCompareExchange
2056 #define InterlockedExchangePointer _InterlockedExchangePointer
2057 #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
2058 #define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer
2059 #define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer
2060
2061 #define InterlockedAnd64 _InterlockedAnd64
2062 #define InterlockedOr64 _InterlockedOr64
2063 #define InterlockedXor64 _InterlockedXor64
2064 #define InterlockedIncrement64 _InterlockedIncrement64
2065 #define InterlockedDecrement64 _InterlockedDecrement64
2066 #define InterlockedExchange64 _InterlockedExchange64
2067 #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
2068 #define InterlockedCompareExchange64 _InterlockedCompareExchange64
2069 #define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64
2070 #define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64
2071
2072
2073 LONG
2074 InterlockedAnd (
2075       __inout LONG volatile *Destination,
2076       __in LONG Value
2077       );
2078
2079 LONG
2080 InterlockedOr (
2081       __inout LONG volatile *Destination,
2082       __in LONG Value
2083       );
2084
2085 LONG
2086 InterlockedXor (
2087       __inout LONG volatile *Destination,
2088       __in LONG Value
2089       );
2090
2091 LONG
2092 InterlockedIncrement (
2093       __inout LONG volatile *Addend
2094       );
2095
2096 LONG
2097 InterlockedDecrement (
2098       __inout LONG volatile *Addend
2099       );
2100
2101 LONG
2102 InterlockedExchange (
2103       __inout LONG volatile *Target,
2104       __in LONG Value
2105       );
2106
2107 LONG
2108 InterlockedExchangeAdd (
2109       __inout LONG volatile *Addend,
2110       __in LONG Value
2111       );
2112
2113 LONG
2114 InterlockedCompareExchange (
2115       __inout LONG volatile *Destination,
2116       __in LONG ExChange,
2117       __in LONG Comperand
2118       );
2119
2120 PVOID
2121 InterlockedCompareExchangePointer (
2122       __inout  PVOID volatile *Destination,
2123       __in_opt PVOID Exchange,
2124       __in_opt PVOID Comperand
2125       );
2126
2127 PVOID
2128 InterlockedExchangePointer (
2129       __inout  PVOID volatile *Target,
2130       __in_opt PVOID Value
2131       );
2132
2133 LONG64
2134 InterlockedAnd64 (
2135       __inout LONG64 volatile *Destination,
2136       __in LONG64 Value
2137       );
2138
2139 LONG64
2140 InterlockedOr64 (
2141       __inout LONG64 volatile *Destination,
2142       __in LONG64 Value
2143       );
2144
2145 LONG64
2146 InterlockedXor64 (
2147       __inout LONG64 volatile *Destination,
2148       __in LONG64 Value
2149       );
2150
2151 LONG64
2152 InterlockedIncrement64 (
2153       __inout LONG64 volatile *Addend
2154       );
2155
2156 LONG64
2157 InterlockedDecrement64 (
2158       __inout LONG64 volatile *Addend
2159       );
2160
2161 LONG64
2162 InterlockedExchange64 (
2163       __inout LONG64 volatile *Target,
2164       __in LONG64 Value
2165       );
2166
2167 LONG64
2168 InterlockedExchangeAdd64 (
2169       __inout LONG64 volatile *Addend,
2170       __in LONG64 Value
2171       );
2172
2173 LONG64
2174 InterlockedCompareExchange64 (
2175       __inout LONG64 volatile *Destination,
2176       __in LONG64 ExChange,
2177       __in LONG64 Comperand
2178       );
2179
2180 #pragma intrinsic(_InterlockedAnd)
2181 #pragma intrinsic(_InterlockedOr)
2182 #pragma intrinsic(_InterlockedXor)
2183 #pragma intrinsic(_InterlockedIncrement)
2184 #pragma intrinsic(_InterlockedDecrement)
2185 #pragma intrinsic(_InterlockedExchange)
2186 #pragma intrinsic(_InterlockedExchangeAdd)
2187 #pragma intrinsic(_InterlockedCompareExchange)
2188 #pragma intrinsic(_InterlockedExchangePointer)
2189 #pragma intrinsic(_InterlockedCompareExchangePointer)
2190 #pragma intrinsic(_InterlockedAnd64)
2191 #pragma intrinsic(_InterlockedOr64)
2192 #pragma intrinsic(_InterlockedXor64)
2193 #pragma intrinsic(_InterlockedIncrement64)
2194 #pragma intrinsic(_InterlockedDecrement64)
2195 #pragma intrinsic(_InterlockedExchange64)
2196 #pragma intrinsic(_InterlockedExchangeAdd64)
2197 #pragma intrinsic(_InterlockedCompareExchange64)
2198
2199 #if _MSC_FULL_VER >= 140041204
2200
2201 #define InterlockedAnd8 _InterlockedAnd8
2202 #define InterlockedOr8 _InterlockedOr8
2203 #define InterlockedXor8 _InterlockedXor8
2204 #define InterlockedAnd16 _InterlockedAnd16
2205 #define InterlockedOr16 _InterlockedOr16
2206 #define InterlockedXor16 _InterlockedXor16
2207
2208 char
2209 InterlockedAnd8 (
2210       __inout char volatile *Destination,
2211       __in char Value
2212       );
2213
2214 char
2215 InterlockedOr8 (
2216       __inout char volatile *Destination,
2217       __in char Value
2218       );
2219
2220 char
2221 InterlockedXor8 (
2222       __inout char volatile *Destination,
2223       __in char Value
2224       );
2225
2226 SHORT
2227 InterlockedAnd16(
2228       __inout SHORT volatile *Destination,
2229       __in SHORT Value
2230       );
2231
2232 SHORT
2233 InterlockedOr16(
2234       __inout SHORT volatile *Destination,
2235       __in SHORT Value
2236       );
2237
2238 SHORT
2239 InterlockedXor16(
2240       __inout SHORT volatile *Destination,
2241       __in SHORT Value
2242       );
2243
2244 #pragma intrinsic (_InterlockedAnd8)
2245 #pragma intrinsic (_InterlockedOr8)
2246 #pragma intrinsic (_InterlockedXor8)
2247 #pragma intrinsic (_InterlockedAnd16)
2248 #pragma intrinsic (_InterlockedOr16)
2249 #pragma intrinsic (_InterlockedXor16)
2250
2251 #endif
2252
2253 #else                  // X86 interlocked definitions
2254
2255 WINBASEAPI
2256 LONG
2257 WINAPI
2258 InterlockedIncrement (
2259       __inout LONG volatile *lpAddend
2260       );
2261
2262 WINBASEAPI
2263 LONG
2264 WINAPI
2265 InterlockedDecrement (
2266       __inout LONG volatile *lpAddend
2267       );
2268
2269 WINBASEAPI
2270 LONG
2271 WINAPI
2272 InterlockedExchange (
2273       __inout LONG volatile *Target,
2274       __in      LONG Value
2275       );
2276
2277 #define InterlockedExchangePointer(Target, Value) \
2278       (PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value))
2279
2280 WINBASEAPI
2281 LONG
2282 WINAPI
2283 InterlockedExchangeAdd (
2284       __inout LONG volatile *Addend,
2285       __in      LONG Value
2286       );
2287
2288 WINBASEAPI
2289 LONG
2290 WINAPI
2291 InterlockedCompareExchange (
2292       __inout LONG volatile *Destination,
2293       __in      LONG Exchange,
2294       __in      LONG Comperand
2295       );
2296
2297 #if (_WIN32_WINNT >= 0x0502)
2298
2299 WINBASEAPI
2300 LONGLONG
2301 WINAPI
2302 InterlockedCompareExchange64 (
2303       __inout LONGLONG volatile *Destination,
2304       __in      LONGLONG Exchange,
2305       __in      LONGLONG Comperand
2306       );
2307
2308 #endif
2309
2310 #if !defined(MIDL_PASS)
2311
2312 #if (_WIN32_WINNT >= 0x0502)
2313
2314 FORCEINLINE
2315 LONGLONG
2316 InterlockedAnd64 (
2317       __inout LONGLONG volatile *Destination,
2318       __in      LONGLONG Value
2319       )
2320 {
2321       LONGLONG Old;
2322
2323       do {
2324              Old = *Destination;
2325       } while (InterlockedCompareExchange64(Destination,
2326                                                                       Old & Value,
2327                                                                       Old) != Old);
Lines 2328 ... 13995 are skipped.
13996       __out_ecount(cchFilePath) LPWSTR lpszFilePath,
13997       __in DWORD cchFilePath,
13998       __in DWORD dwFlags
13999 );
14000 #ifdef UNICODE
14001 #define GetFinalPathNameByHandle  GetFinalPathNameByHandleW
14002 #else
14003 #define GetFinalPathNameByHandle  GetFinalPathNameByHandleA
14004 #endif // !UNICODE
14005
14006 #endif // (_WIN32_WINNT >= 0x0600)
14007
14008
14009 #if (_WIN32_WINNT >= 0x0600)
14010
14011 WINBASEAPI
14012 BOOL
14013 WINAPI
14014 QueryActCtxSettingsW(
14015       __in_opt          DWORD dwFlags,
14016       __in_opt          HANDLE hActCtx,
14017       __in_opt          PCWSTR settingsNameSpace,
14018       __in                PCWSTR settingName,
14019       __out_bcount_part_opt(dwBuffer, *pdwWrittenOrRequired) PWSTR pvBuffer,
14020       __in          SIZE_T dwBuffer,
14021       __out_opt SIZE_T *pdwWrittenOrRequired
14022       );
14023
14024 #endif
14025
14026
14027
14028
14029 #if !defined(RC_INVOKED) /* RC complains about long symbols in #ifs */
14030 #if defined(ISOLATION_AWARE_ENABLED) && (ISOLATION_AWARE_ENABLED != 0)
14031 #include "winbase.inl"
14032 #endif /* ISOLATION_AWARE_ENABLED */
14033 #endif /* RC */
14034
14035 #ifdef __cplusplus
14036 }
14037 #endif
14038
14039
14040
14041 #endif // _WINBASE_
14042
14043
14044