Piotr Caban : msvcr80: Add __AdjustPointer implementation.
Alexandre Julliard
julliard at winehq.org
Wed May 7 15:18:15 CDT 2014
Module: wine
Branch: master
Commit: 87bfb306bd591b2a45a9d09a19eb3ab090cc387d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=87bfb306bd591b2a45a9d09a19eb3ab090cc387d
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed May 7 12:08:06 2014 +0200
msvcr80: Add __AdjustPointer implementation.
---
dlls/msvcr100/msvcr100.spec | 2 +-
dlls/msvcr110/msvcr110.spec | 2 +-
dlls/msvcr80/msvcr80.spec | 2 +-
dlls/msvcr90/msvcr90.spec | 2 +-
dlls/msvcr90/tests/msvcr90.c | 34 ++++++++++++++++++++++++++++++++++
dlls/msvcrt/cpp.c | 5 +++++
6 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec
index 77ba21d..07d50fc 100644
--- a/dlls/msvcr100/msvcr100.spec
+++ b/dlls/msvcr100/msvcr100.spec
@@ -538,7 +538,7 @@
@ stub -arch=win64 _SetThrowImageBase
@ cdecl _Strftime(str long str ptr ptr)
@ cdecl _XcptFilter(long ptr)
-@ stub __AdjustPointer
+@ cdecl __AdjustPointer(ptr ptr)
@ stub __BuildCatchObject
@ stub __BuildCatchObjectHelper
@ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) ntdll.__C_specific_handler
diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec
index 1afb3f2..e6576e0 100644
--- a/dlls/msvcr110/msvcr110.spec
+++ b/dlls/msvcr110/msvcr110.spec
@@ -869,7 +869,7 @@
@ stub _W_Gettnames
@ stub _Wcsftime
@ cdecl _XcptFilter(long ptr)
-@ stub __AdjustPointer
+@ cdecl __AdjustPointer(ptr ptr)
@ stub __BuildCatchObject
@ stub __BuildCatchObjectHelper
@ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) ntdll.__C_specific_handler
diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec
index 2aee520..9c7f85b 100644
--- a/dlls/msvcr80/msvcr80.spec
+++ b/dlls/msvcr80/msvcr80.spec
@@ -172,7 +172,7 @@
@ stub -arch=win64 _SetThrowImageBase
@ cdecl _Strftime(str long str ptr ptr)
@ cdecl _XcptFilter(long ptr)
-@ stub __AdjustPointer
+@ cdecl __AdjustPointer(ptr ptr)
@ stub __BuildCatchObject
@ stub __BuildCatchObjectHelper
@ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) ntdll.__C_specific_handler
diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec
index 766d62e..e86541c 100644
--- a/dlls/msvcr90/msvcr90.spec
+++ b/dlls/msvcr90/msvcr90.spec
@@ -163,7 +163,7 @@
@ stub _NLG_Return2
@ cdecl _Strftime(str long str ptr ptr)
@ cdecl _XcptFilter(long ptr)
-@ stub __AdjustPointer
+@ cdecl __AdjustPointer(ptr ptr)
@ stub __BuildCatchObject
@ stub __BuildCatchObjectHelper
@ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) ntdll.__C_specific_handler
diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index 1c8da4e..0a81edc 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -120,6 +120,7 @@ static int (__cdecl *p_ferror)(FILE*);
static int (__cdecl *p_flsbuf)(int, FILE*);
static unsigned long (__cdecl *p_byteswap_ulong)(unsigned long);
static void** (__cdecl *p__pxcptinfoptrs)(void);
+static void* (__cdecl *p__AdjustPointer)(void*, const void*);
/* make sure we use the correct errno */
#undef errno
@@ -377,6 +378,7 @@ static BOOL init(void)
SET(p_flsbuf, "_flsbuf");
SET(p_byteswap_ulong, "_byteswap_ulong");
SET(p__pxcptinfoptrs, "__pxcptinfoptrs");
+ SET(p__AdjustPointer, "__AdjustPointer");
if (sizeof(void *) == 8)
{
SET(p_type_info_name_internal_method, "?_name_internal_method at type_info@@QEBAPEBDPEAU__type_info_node@@@Z");
@@ -1419,6 +1421,37 @@ static void test_is_exception_typeof(void)
ok(ret == 0, "_is_exception_typeof returned %d\n", ret);
}
+static void test__AdjustPointer(void)
+{
+ int off = 0xf0;
+ void *obj1 = &off;
+ void *obj2 = (char*)&off - 2;
+ struct test_data {
+ void *ptr;
+ void *ret;
+ struct {
+ int this_offset;
+ int vbase_descr;
+ int vbase_offset;
+ } this_ptr_offsets;
+ } data[] = {
+ {NULL, NULL, {0, -1, 0}},
+ {(void*)0xbeef, (void*)0xbef0, {1, -1, 1}},
+ {(void*)0xbeef, (void*)0xbeee, {-1, -1, 0}},
+ {&obj1, (char*)&obj1 + off, {0, 0, 0}},
+ {(char*)&obj1 - 5, (char*)&obj1 + off, {0, 5, 0}},
+ {(char*)&obj1 - 3, (char*)&obj1 + off + 24, {24, 3, 0}},
+ {(char*)&obj2 - 17, (char*)&obj2 + off + 4, {4, 17, 2}}
+ };
+ void *ret;
+ int i;
+
+ for(i=0; i<sizeof(data)/sizeof(data[0]); i++) {
+ ret = p__AdjustPointer(data[i].ptr, &data[i].this_ptr_offsets);
+ ok(ret == data[i].ret, "%d) __AdjustPointer returned %p, expected %p\n", i, ret, data[i].ret);
+ }
+}
+
START_TEST(msvcr90)
{
if(!init())
@@ -1446,4 +1479,5 @@ START_TEST(msvcr90)
test_byteswap();
test_access_s();
test_is_exception_typeof();
+ test__AdjustPointer();
}
diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c
index 37dc18a..db48dcb 100644
--- a/dlls/msvcrt/cpp.c
+++ b/dlls/msvcrt/cpp.c
@@ -1431,3 +1431,8 @@ void __cdecl __ExceptionPtrCurrentException(exception_ptr *ep)
return;
}
#endif
+
+void* __cdecl __AdjustPointer(void *obj, const this_ptr_offsets *off)
+{
+ return get_this_pointer(off, obj);
+}
More information about the wine-cvs
mailing list