Author: sserapion
Date: Fri Jul 25 05:57:44 2008
New Revision: 34769
URL:
http://svn.reactos.org/svn/reactos?rev=34769&view=rev
Log:
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA,
IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
-Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
Modified:
branches/ros-amd64-bringup/reactos/include/ndk/amd64/ketypes.h
branches/ros-amd64-bringup/reactos/include/psdk/winbase.h
branches/ros-amd64-bringup/reactos/include/psdk/windef.h
branches/ros-amd64-bringup/reactos/include/psdk/winnt.h
Modified: branches/ros-amd64-bringup/reactos/include/ndk/amd64/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/inclu…
==============================================================================
--- branches/ros-amd64-bringup/reactos/include/ndk/amd64/ketypes.h [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/include/ndk/amd64/ketypes.h [iso-8859-1] Fri Jul 25
05:57:44 2008
@@ -16,8 +16,8 @@
--*/
-#ifndef _I386_KETYPES_H
-#define _I386_KETYPES_H
+#ifndef _IAMD64_KETYPES_H
+#define _IAMD64_KETYPES_H
//
// Dependencies
Modified: branches/ros-amd64-bringup/reactos/include/psdk/winbase.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/inclu…
==============================================================================
--- branches/ros-amd64-bringup/reactos/include/psdk/winbase.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/include/psdk/winbase.h [iso-8859-1] Fri Jul 25
05:57:44 2008
@@ -1712,10 +1712,10 @@
#if defined(_WIN64)
/* PVOID WINAPI InterlockedExchangePointer(PVOID*,PVOID); */
#define InterlockedExchangePointer(t,v) \
- (PVOID)InterlockedExchange64((LONGLONG*)(t),(LONGLONG)(v))
+ (PVOID)_InterlockedExchange64((LONGLONG*)(t),(LONGLONG)(v))
/* PVOID WINAPI InterlockedCompareExchangePointer(PVOID*,PVOID,PVOID); */
#define InterlockedCompareExchangePointer(d,e,c) \
- (PVOID)InterlockedCompareExchange64((LONGLONG*)(d),(LONGLONG)(e),(LONGLONG)(c))
+ (PVOID)_InterlockedCompareExchange64((LONGLONG*)(d),(LONGLONG)(e),(LONGLONG)(c))
#else
/* PVOID WINAPI InterlockedExchangePointer(PVOID*,PVOID); */
#define InterlockedExchangePointer(t,v) \
@@ -1735,12 +1735,12 @@
#endif
#endif /* __INTERLOCKED_DECLARED */
BOOL WINAPI IsBadCodePtr(FARPROC);
-BOOL WINAPI IsBadHugeReadPtr(PCVOID,UINT);
-BOOL WINAPI IsBadHugeWritePtr(PVOID,UINT);
-BOOL WINAPI IsBadReadPtr(PCVOID,UINT);
-BOOL WINAPI IsBadStringPtrA(LPCSTR,UINT);
-BOOL WINAPI IsBadStringPtrW(LPCWSTR,UINT);
-BOOL WINAPI IsBadWritePtr(PVOID,UINT);
+BOOL WINAPI IsBadHugeReadPtr(PCVOID,UINT_PTR);
+BOOL WINAPI IsBadHugeWritePtr(PVOID,UINT_PTR);
+BOOL WINAPI IsBadReadPtr(PCVOID,UINT_PTR);
+BOOL WINAPI IsBadStringPtrA(LPCSTR,UINT_PTR);
+BOOL WINAPI IsBadStringPtrW(LPCWSTR,UINT_PTR);
+BOOL WINAPI IsBadWritePtr(PVOID,UINT_PTR);
BOOL WINAPI IsDebuggerPresent(void);
#if (_WIN32_WINNT >= 0x0501)
BOOL WINAPI IsProcessInJob(HANDLE,HANDLE,PBOOL);
@@ -1994,7 +1994,7 @@
BOOL WINAPI SetProcessAffinityMask(HANDLE,DWORD);
BOOL WINAPI SetProcessPriorityBoost(HANDLE,BOOL);
BOOL WINAPI SetProcessShutdownParameters(DWORD,DWORD);
-BOOL WINAPI SetProcessWorkingSetSize(HANDLE,DWORD,DWORD);
+BOOL WINAPI SetProcessWorkingSetSize(HANDLE,SIZE_T,SIZE_T);
#if (_WIN32_WINNT >= 0x0600)
VOID WINAPI SetSecurityAccessMask(SECURITY_INFORMATION,LPDWORD);
#endif
Modified: branches/ros-amd64-bringup/reactos/include/psdk/windef.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/inclu…
==============================================================================
--- branches/ros-amd64-bringup/reactos/include/psdk/windef.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/include/psdk/windef.h [iso-8859-1] Fri Jul 25
05:57:44 2008
@@ -123,14 +123,27 @@
#define pascal __stdcall
#define _pascal __stdcall
#define __pascal __stdcall
+
+#define CDECL _cdecl
#define PASCAL _pascal
-#define CDECL _cdecl
+
+#if !defined(__x86_64__) //defined(_STDCALL_SUPPORTED)
#define STDCALL __stdcall
-#define WINAPI __stdcall
-#define WINAPIV __cdecl
-#define APIENTRY __stdcall
-#define CALLBACK __stdcall
-#define APIPRIVATE __stdcall
+#define CALLBACK __stdcall
+#define WINAPI __stdcall
+#define WINAPIV __cdecl
+#define APIENTRY WINAPI
+#define APIPRIVATE __stdcall
+#define PASCAL __stdcall
+#else
+#define STDCALL
+#define CALLBACK
+#define WINAPI
+#define WINAPIV
+#define APIENTRY WINAPI
+#define APIPRIVATE
+#define PASCAL pascal
+#endif
#define DECLSPEC_IMPORT __declspec(dllimport)
#define DECLSPEC_EXPORT __declspec(dllexport)
Modified: branches/ros-amd64-bringup/reactos/include/psdk/winnt.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/inclu…
==============================================================================
--- branches/ros-amd64-bringup/reactos/include/psdk/winnt.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/include/psdk/winnt.h [iso-8859-1] Fri Jul 25
05:57:44 2008
@@ -99,15 +99,6 @@
#define NTSYSCALLAPI DECLSPEC_ADDRSAFE
#endif
#endif
-
-/* i386 context definitions */
-#ifdef __i386__
-
-#define EXCEPTION_READ_FAULT 0
-#define EXCEPTION_WRITE_FAULT 1
-#define EXCEPTION_EXECUTE_FAULT 8
-
-#endif /* __i386__ */
#ifndef VOID
#define VOID void
@@ -1358,7 +1349,7 @@
#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
-#define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER)
((DWORD_PTR)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
+#define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER)
((ULONG_PTR)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
@@ -2022,7 +2013,7 @@
} ACL_SIZE_INFORMATION;
/* FIXME: add more machines */
-#if defined(_X86_) || defined(unix) && !defined(__PowerPC__)
+#if defined(__i386__) && !defined(__PowerPC__)
#define SIZE_OF_80387_REGISTERS 80
#define CONTEXT_i386 0x10000
#define CONTEXT_i486 0x10000
@@ -2034,6 +2025,11 @@
#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
#define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
#define MAXIMUM_SUPPORTED_EXTENSION 512
+
+#define EXCEPTION_READ_FAULT 0
+#define EXCEPTION_WRITE_FAULT 1
+#define EXCEPTION_EXECUTE_FAULT 8
+
typedef struct _FLOATING_SAVE_AREA {
DWORD ControlWord;
DWORD StatusWord;
@@ -2072,6 +2068,132 @@
DWORD SegSs;
BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
} CONTEXT;
+#elif defined(__x86_64__)
+#define CONTEXT_AMD64 0x00100000
+
+#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
+#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
+#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
+#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L)
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
+#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS |
CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
+
+#define EXCEPTION_READ_FAULT 0
+#define EXCEPTION_WRITE_FAULT 1
+#define EXCEPTION_EXECUTE_FAULT 8
+
+typedef struct DECLSPEC_ALIGN(16) _M128A {
+ ULONGLONG Low;
+ LONGLONG High;
+} M128A, *PM128A;
+
+typedef struct _XMM_SAVE_AREA32 {
+ WORD ControlWord;
+ WORD StatusWord;
+ BYTE TagWord;
+ BYTE Reserved1;
+ WORD ErrorOpcode;
+ DWORD ErrorOffset;
+ WORD ErrorSelector;
+ WORD Reserved2;
+ DWORD DataOffset;
+ WORD DataSelector;
+ WORD Reserved3;
+ DWORD MxCsr;
+ DWORD MxCsr_Mask;
+ M128A FloatRegisters[8];
+ M128A XmmRegisters[16];
+ BYTE Reserved4[96];
+} XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
+
+typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
+ DWORD64 P1Home;
+ DWORD64 P2Home;
+ DWORD64 P3Home;
+ DWORD64 P4Home;
+ DWORD64 P5Home;
+ DWORD64 P6Home;
+
+ /* Control flags */
+ DWORD ContextFlags;
+ DWORD MxCsr;
+
+ /* Segment */
+ WORD SegCs;
+ WORD SegDs;
+ WORD SegEs;
+ WORD SegFs;
+ WORD SegGs;
+ WORD SegSs;
+ DWORD EFlags;
+
+ /* Debug */
+ DWORD64 Dr0;
+ DWORD64 Dr1;
+ DWORD64 Dr2;
+ DWORD64 Dr3;
+ DWORD64 Dr6;
+ DWORD64 Dr7;
+
+ /* Integer */
+ DWORD64 Rax;
+ DWORD64 Rcx;
+ DWORD64 Rdx;
+ DWORD64 Rbx;
+ DWORD64 Rsp;
+ DWORD64 Rbp;
+ DWORD64 Rsi;
+ DWORD64 Rdi;
+ DWORD64 R8;
+ DWORD64 R9;
+ DWORD64 R10;
+ DWORD64 R11;
+ DWORD64 R12;
+ DWORD64 R13;
+ DWORD64 R14;
+ DWORD64 R15;
+
+ /* Counter */
+ DWORD64 Rip;
+
+ /* Floating point */
+ union {
+ XMM_SAVE_AREA32 FltSave;
+ struct {
+ M128A Header[2];
+ M128A Legacy[8];
+ M128A Xmm0;
+ M128A Xmm1;
+ M128A Xmm2;
+ M128A Xmm3;
+ M128A Xmm4;
+ M128A Xmm5;
+ M128A Xmm6;
+ M128A Xmm7;
+ M128A Xmm8;
+ M128A Xmm9;
+ M128A Xmm10;
+ M128A Xmm11;
+ M128A Xmm12;
+ M128A Xmm13;
+ M128A Xmm14;
+ M128A Xmm15;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
+
+ /* Vector */
+ M128A VectorRegister[26];
+ DWORD64 VectorControl;
+
+ /* Debug control */
+ DWORD64 DebugControl;
+ DWORD64 LastBranchToRip;
+ DWORD64 LastBranchFromRip;
+ DWORD64 LastExceptionToRip;
+ DWORD64 LastExceptionFromRip;
+} CONTEXT;
+
#elif defined(_PPC_)
#define CONTEXT_CONTROL 1L
#define CONTEXT_FLOATING_POINT 2L