- Turns out MSVC wasn't compiling one file because it had the same name as another. Renamed it and fixed the resulting errors.

- The structures for vista symlink support are not in winnt.h, they are only in the ntifs.h. Removed them from our winnt.h, and temporarily added them to the .c file itself.
- Implemented intrinsic interlocked functions instead of using the depcreated interlck lib.
- Fixed a bug in the MemoryBarrier intrinsic.
- Included intrin.h by default when using the NDK now, since native apps need Interlocked() functions and ntdll doesn't provide them, and they can't link to kernel32, and libintrlck is deprecated/sucks.
- Fixed stub of BaseCheckAppcompatCache.

svn path=/trunk/; revision=25659
This commit is contained in:
Alex Ionescu
2007-01-29 05:13:13 +00:00
parent 70ab8ffa3c
commit 06283000a1
19 changed files with 100 additions and 88 deletions
+37 -11
View File
@@ -14,16 +14,42 @@
/* INCLUDES *****************************************************************/
/* File contains Vista Semantics */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
#include "../include/debug.h"
#define SYMLINK_FLAG_RELATIVE 1
typedef struct _REPARSE_DATA_BUFFER {
ULONG ReparseTag;
USHORT ReparseDataLength;
USHORT Reserved;
union {
struct {
USHORT SubstituteNameOffset;
USHORT SubstituteNameLength;
USHORT PrintNameOffset;
USHORT PrintNameLength;
ULONG Flags;
WCHAR PathBuffer[1];
} SymbolicLinkReparseBuffer;
struct {
USHORT SubstituteNameOffset;
USHORT SubstituteNameLength;
USHORT PrintNameOffset;
USHORT PrintNameLength;
WCHAR PathBuffer[1];
} MountPointReparseBuffer;
struct {
UCHAR DataBuffer[1];
} GenericReparseBuffer;
};
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
/* FUNCTIONS ****************************************************************/
/*
@@ -391,13 +417,13 @@ CreateSymbolicLinkW(IN LPCWSTR lpSymlinkFileName,
ULONG dwCreateOptions;
DWORD dwErr;
if(!lpSymlinkFileName || !lpTargetFileName || (dwFlags | SYMLINK_FLAG_DIRECTORY) != SYMLINK_FLAG_DIRECTORY)
if(!lpSymlinkFileName || !lpTargetFileName || (dwFlags | SYMBOLIC_LINK_FLAG_DIRECTORY) != SYMBOLIC_LINK_FLAG_DIRECTORY)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if(dwFlags & SYMLINK_FLAG_DIRECTORY)
if(dwFlags & SYMBOLIC_LINK_FLAG_DIRECTORY)
dwCreateOptions = FILE_DIRECTORY_FILE;
else
dwCreateOptions = FILE_NON_DIRECTORY_FILE;
@@ -468,8 +494,8 @@ CreateSymbolicLinkW(IN LPCWSTR lpSymlinkFileName,
pBufTail = (PBYTE)(pReparseData->SymbolicLinkReparseBuffer.PathBuffer);
pReparseData->ReparseTag = IO_REPARSE_TAG_SYMLINK;
pReparseData->ReparseDataLength = cbReparseData - REPARSE_DATA_BUFFER_HEADER_SIZE;
pReparseData->ReparseTag = (ULONG)IO_REPARSE_TAG_SYMLINK;
pReparseData->ReparseDataLength = (USHORT)cbReparseData - REPARSE_DATA_BUFFER_HEADER_SIZE;
pReparseData->Reserved = 0;
pReparseData->SymbolicLinkReparseBuffer.SubstituteNameOffset = 0;
@@ -478,7 +504,7 @@ CreateSymbolicLinkW(IN LPCWSTR lpSymlinkFileName,
RtlCopyMemory(pBufTail, TargetFileName.Buffer, TargetFileName.Length);
pReparseData->SymbolicLinkReparseBuffer.PrintNameOffset = pReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength;
pReparseData->SymbolicLinkReparseBuffer.PrintNameLength = cbPrintName;
pReparseData->SymbolicLinkReparseBuffer.PrintNameLength = (USHORT)cbPrintName;
pBufTail += pReparseData->SymbolicLinkReparseBuffer.PrintNameOffset;
RtlCopyMemory(pBufTail, lpTargetFileName, cbPrintName);
@@ -574,13 +600,13 @@ Cleanup:
* @implemented
*/
BOOLEAN
STDCALL
NTAPI
CreateSymbolicLinkA(IN LPCSTR lpSymlinkFileName,
IN LPCSTR lpTargetFileName,
IN DWORD dwFlags)
{
PWCHAR SymlinkW, TargetW;
BOOL Ret;
BOOLEAN Ret;
if(!lpSymlinkFileName || !lpTargetFileName)
{
-4
View File
@@ -12,10 +12,6 @@
/* INCLUDES *****************************************************************/
/* File contains Vista Semantics */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
-1
View File
@@ -12,7 +12,6 @@
/* INCLUDES ******************************************************************/
/* PSDK/NDK Headers */
#define DBG 1
#define WIN32_NO_STATUS
#define _KERNEL32_
#include <windows.h>
+1 -2
View File
@@ -80,7 +80,7 @@
</directory>
<directory name="process">
<file>cmdline.c</file>
<file>create.c</file>
<file>procsup.c</file>
<file>job.c</file>
<file>proc.c</file>
<file>session.c</file>
@@ -125,7 +125,6 @@
<define name="WINVER">0x0500</define>
<library>kernel32_base</library>
<library>pseh</library>
<library>intrlck</library>
<library>ntdll</library>
<linkerflag>-lgcc</linkerflag>
<linkerflag>-nostartfiles</linkerflag>
@@ -14,10 +14,6 @@
/* INCLUDES ******************************************************************/
/* File contains Vista Semantics */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
+43 -3
View File
@@ -323,9 +323,10 @@ DllMain(HANDLE hDll,
if (hDll == (HANDLE)0x7c800000)
{
PULONG Eip;
Eip = (PULONG)*(PULONG)NtCurrentTeb()->Tib.ExceptionList +
0x9 +
FIELD_OFFSET(CONTEXT, Eip) / sizeof(ULONG);
__debugbreak();
Eip = (PULONG)*(PULONG)*(PULONG)NtCurrentTeb()->Tib.ExceptionList +
0x9 +
FIELD_OFFSET(CONTEXT, Eip) / sizeof(ULONG);
*Eip = (ULONG)BaseProcessStartThunk;
}
}
@@ -466,4 +467,43 @@ DllMain(HANDLE hDll,
return TRUE;
}
LONG
WINAPI
InterlockedIncrement(IN OUT LONG volatile *lpAddend)
{
return _InterlockedIncrement(lpAddend);
}
LONG
WINAPI
InterlockedDecrement(IN OUT LONG volatile *lpAddend)
{
return _InterlockedDecrement(lpAddend);
}
LONG
WINAPI
InterlockedExchange(IN OUT LONG volatile *Target,
IN LONG Value)
{
return _InterlockedExchange(Target, Value);
}
LONG
WINAPI
InterlockedExchangeAdd(IN OUT LONG volatile *Addend,
IN LONG Value)
{
return _InterlockedExchangeAdd(Addend, Value);
}
LONG
WINAPI
InterlockedCompareExchange(IN OUT LONG volatile *Destination,
IN LONG Exchange,
IN LONG Comperand)
{
return _InterlockedCompareExchange(Destination, Exchange, Comperand);
}
/* EOF */
@@ -10,10 +10,6 @@
* 10/28/2005 Created stubs (w3)
*/
/* File contains Vista Semantics */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
+8 -2
View File
@@ -45,10 +45,16 @@ BaseFlushAppcompatCache(VOID)
/*
* @unimplemented
*/
VOID STDCALL
BaseCheckAppcompatCache(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3, ULONG Unknown4)
BOOL
WINAPI
BaseCheckAppcompatCache(ULONG Unknown1,
ULONG Unknown2,
ULONG Unknown3,
PULONG Unknown4)
{
STUB;
if (Unknown4) *Unknown4 = 0;
return TRUE;
}
/*
@@ -4,10 +4,6 @@
* PROGRAMMER: Thomas Weidenmueller <w3seek@reactos.com>
*/
/* File contains Vista Semantics */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
-4
View File
@@ -8,10 +8,6 @@
/* INCLUDES *****************************************************************/
/* File contains Vista Semantics */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
-4
View File
@@ -8,10 +8,6 @@
/* INCLUDES *****************************************************************/
/* File contains Vista Semantics */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
-4
View File
@@ -8,10 +8,6 @@
/* INCLUDES *****************************************************************/
/* File contains Vista Semantics */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
-4
View File
@@ -8,10 +8,6 @@
/* INCLUDES *****************************************************************/
/* File contains Vista Semantics */
//#undef _WIN32_WINNT
//#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
-4
View File
@@ -8,10 +8,6 @@
/* INCLUDES *****************************************************************/
/* File contains Vista Semantics */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <k32.h>
#define NDEBUG
+4
View File
@@ -38,6 +38,7 @@ Author:
#include <excpt.h> // C Standard Header
#include <stdarg.h> // C Standard Header
#include <umtypes.h> // General Definitions
#include <intrin.h> // Use Inlined Intrinsics
//
// Type Headers
@@ -81,6 +82,9 @@ Author:
#include <sefuncs.h> // Security Subsystem Functions
#include <umfuncs.h> // User-Mode NT Library Functions
//
// Assembly Support
//
#include <asm.h> // Assembly Offsets
#ifdef _MSC_VER
+1 -1
View File
@@ -82,7 +82,7 @@
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
#define _ReadWriteBarrier() __sync_synchronize()
#else
static __inline__ __attribute__((always_inline)) _MemoryBarrier(void)
static void __inline__ __attribute__((always_inline)) _MemoryBarrier(void)
{
__asm__ __volatile__("" : : : "memory");
}
+6 -6
View File
@@ -504,7 +504,7 @@ extern "C" {
#define QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE 0x00000008
#define QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS 0x00000010
#if (_WIN32_WINNT >= 0x0600)
#define SYMLINK_FLAG_DIRECTORY 0x1
#define SYMBOLIC_LINK_FLAG_DIRECTORY 0x1
#endif
#endif /* (_WIN32_WINNT >= 0x0501) */
#if (_WIN32_WINNT >= 0x0500)
@@ -1683,20 +1683,20 @@ VOID WINAPI InitializeSRWLock(PSRWLOCK);
#endif
#ifndef __INTERLOCKED_DECLARED
#define __INTERLOCKED_DECLARED
LONG WINAPI InterlockedCompareExchange(LPLONG,LONG,LONG);
LONG WINAPI InterlockedCompareExchange(IN OUT LONG volatile *,LONG,LONG);
/* PVOID WINAPI InterlockedCompareExchangePointer(PVOID*,PVOID,PVOID); */
#define InterlockedCompareExchangePointer(d,e,c) \
(PVOID)InterlockedCompareExchange((LPLONG)(d),(LONG)(e),(LONG)(c))
LONG WINAPI InterlockedDecrement(LPLONG);
LONG WINAPI InterlockedExchange(LPLONG,LONG);
LONG WINAPI InterlockedDecrement(IN OUT LONG volatile *);
LONG WINAPI InterlockedExchange(IN OUT LONG volatile *,LONG);
/* PVOID WINAPI InterlockedExchangePointer(PVOID*,PVOID); */
#define InterlockedExchangePointer(t,v) \
(PVOID)InterlockedExchange((LPLONG)(t),(LONG)(v))
LONG WINAPI InterlockedExchangeAdd(LPLONG,LONG);
LONG WINAPI InterlockedExchangeAdd(IN OUT LONG volatile *,LONG);
#if (_WIN32_WINNT >= 0x0501)
PSLIST_ENTRY WINAPI InterlockedFlushSList(PSLIST_HEADER);
#endif
LONG WINAPI InterlockedIncrement(LPLONG);
LONG WINAPI InterlockedIncrement(IN OUT LONG volatile *);
#if (_WIN32_WINNT >= 0x0501)
PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER);
PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY);
-26
View File
@@ -1598,7 +1598,6 @@ typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID);
#define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
#define TLS_MINIMUM_AVAILABLE 64
#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
#define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
#define IO_REPARSE_TAG_RESERVED_ZERO 0
@@ -3306,31 +3305,6 @@ typedef struct _NT_TIB {
PVOID ArbitraryUserPointer;
struct _NT_TIB *Self;
} NT_TIB,*PNT_TIB;
typedef struct _REPARSE_DATA_BUFFER {
DWORD ReparseTag;
WORD ReparseDataLength;
WORD Reserved;
_ANONYMOUS_UNION union {
struct {
WORD SubstituteNameOffset;
WORD SubstituteNameLength;
WORD PrintNameOffset;
WORD PrintNameLength;
ULONG Flags;
WCHAR PathBuffer[1];
} SymbolicLinkReparseBuffer;
struct {
WORD SubstituteNameOffset;
WORD SubstituteNameLength;
WORD PrintNameOffset;
WORD PrintNameLength;
WCHAR PathBuffer[1];
} MountPointReparseBuffer;
struct {
BYTE DataBuffer[1];
} GenericReparseBuffer;
} DUMMYUNIONNAME;
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
typedef struct _REPARSE_GUID_DATA_BUFFER {
DWORD ReparseTag;
WORD ReparseDataLength;