[PATCH v2 2/2] msado15: Some interface parts need a 64-bit type on amd64.

Bernhard Übelacker bernhardu at mailbox.org
Wed Dec 22 17:53:37 CST 2021


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50842
Signed-off-by: Bernhard Übelacker <bernhardu at mailbox.org>
---
Supersedes 222555.

v2: Missed some warnings about incompatible types.
---
 dlls/msado15/command.c         |  2 +-
 dlls/msado15/connection.c      |  5 ++++
 dlls/msado15/recordset.c       | 28 +++++++++----------
 dlls/msado15/stream.c          |  8 +++---
 dlls/msado15/tests/msado15.c   | 21 ++++++++------
 include/msado15_backcompat.idl | 50 ++++++++++++++++++++--------------
 6 files changed, 66 insertions(+), 48 deletions(-)

diff --git a/dlls/msado15/command.c b/dlls/msado15/command.c
index 8c8ec79a58e..0066a06e21d 100644
--- a/dlls/msado15/command.c
+++ b/dlls/msado15/command.c
@@ -234,7 +234,7 @@ static HRESULT WINAPI command_Execute( _Command *iface, VARIANT *affected, VARIA
 }
 
 static HRESULT WINAPI command_CreateParameter( _Command *iface, BSTR name, DataTypeEnum type,
-                                               ParameterDirectionEnum direction, LONG size, VARIANT value,
+                                               ParameterDirectionEnum direction, ADO_LONGPTR size, VARIANT value,
                                                _Parameter **parameter )
 {
     FIXME( "%p, %s, %d, %d, %d, %p\n", iface, debugstr_w(name), type, direction, size, parameter );
diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
index ce7750fef66..bcc9934355b 100644
--- a/dlls/msado15/connection.c
+++ b/dlls/msado15/connection.c
@@ -336,8 +336,13 @@ static HRESULT WINAPI connection_Execute( _Connection *iface, BSTR command, VARI
 
     if (records_affected)
     {
+#ifdef _WIN64
+        V_VT(records_affected) = VT_I8;
+        _Recordset_get_RecordCount(recordset, &V_I8(records_affected));
+#else
         V_VT(records_affected) = VT_I4;
         _Recordset_get_RecordCount(recordset, &V_I4(records_affected));
+#endif
     }
 
     *record_set = recordset;
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c
index 92a0deb6959..0d0a6a54095 100644
--- a/dlls/msado15/recordset.c
+++ b/dlls/msado15/recordset.c
@@ -69,7 +69,7 @@ struct field
     LONG                refs;
     WCHAR              *name;
     DataTypeEnum        type;
-    LONG                defined_size;
+    ADO_LONGPTR         defined_size;
     LONG                attrs;
     LONG                index;
     struct recordset   *recordset;
@@ -195,7 +195,7 @@ static HRESULT WINAPI field_get_Properties( Field *iface, Properties **obj )
     return S_OK;
 }
 
-static HRESULT WINAPI field_get_ActualSize( Field *iface, LONG *size )
+static HRESULT WINAPI field_get_ActualSize( Field *iface, ADO_LONGPTR *size )
 {
     FIXME( "%p, %p\n", iface, size );
     return E_NOTIMPL;
@@ -211,7 +211,7 @@ static HRESULT WINAPI field_get_Attributes( Field *iface, LONG *attrs )
     return S_OK;
 }
 
-static HRESULT WINAPI field_get_DefinedSize( Field *iface, LONG *size )
+static HRESULT WINAPI field_get_DefinedSize( Field *iface, ADO_LONGPTR *size )
 {
     struct field *field = impl_from_Field( iface );
 
@@ -360,7 +360,7 @@ static HRESULT WINAPI field_put_Type( Field *iface, DataTypeEnum type )
     return S_OK;
 }
 
-static HRESULT WINAPI field_put_DefinedSize( Field *iface, LONG size )
+static HRESULT WINAPI field_put_DefinedSize( Field *iface, ADO_LONGPTR size )
 {
     struct field *field = impl_from_Field( iface );
 
@@ -829,7 +829,7 @@ static HRESULT append_field( struct fields *fields, BSTR name, DataTypeEnum type
     return S_OK;
 }
 
-static HRESULT WINAPI fields__Append( Fields *iface, BSTR name, DataTypeEnum type, LONG size, FieldAttributeEnum attr )
+static HRESULT WINAPI fields__Append( Fields *iface, BSTR name, DataTypeEnum type, ADO_LONGPTR size, FieldAttributeEnum attr )
 {
     struct fields *fields = impl_from_Fields( iface );
 
@@ -844,7 +844,7 @@ static HRESULT WINAPI fields_Delete( Fields *iface, VARIANT index )
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI fields_Append( Fields *iface, BSTR name, DataTypeEnum type, LONG size, FieldAttributeEnum attr,
+static HRESULT WINAPI fields_Append( Fields *iface, BSTR name, DataTypeEnum type, ADO_LONGPTR size, FieldAttributeEnum attr,
                                      VARIANT value )
 {
     struct fields *fields = impl_from_Fields( iface );
@@ -1290,19 +1290,19 @@ static HRESULT WINAPI recordset_put_LockType( _Recordset *iface, LockTypeEnum lo
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI recordset_get_MaxRecords( _Recordset *iface, LONG *max_records )
+static HRESULT WINAPI recordset_get_MaxRecords( _Recordset *iface, ADO_LONGPTR *max_records )
 {
     FIXME( "%p, %p\n", iface, max_records );
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI recordset_put_MaxRecords( _Recordset *iface, LONG max_records )
+static HRESULT WINAPI recordset_put_MaxRecords( _Recordset *iface, ADO_LONGPTR max_records )
 {
     FIXME( "%p, %d\n", iface, max_records );
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI recordset_get_RecordCount( _Recordset *iface, LONG *count )
+static HRESULT WINAPI recordset_get_RecordCount( _Recordset *iface, ADO_LONGPTR *count )
 {
     struct recordset *recordset = impl_from_Recordset( iface );
 
@@ -1392,7 +1392,7 @@ static HRESULT WINAPI recordset_GetRows( _Recordset *iface, LONG rows, VARIANT s
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI recordset_Move( _Recordset *iface, LONG num_records, VARIANT start )
+static HRESULT WINAPI recordset_Move( _Recordset *iface, ADO_LONGPTR num_records, VARIANT start )
 {
     FIXME( "%p, %d, %s\n", iface, num_records, debugstr_variant(&start) );
     return E_NOTIMPL;
@@ -1591,7 +1591,7 @@ static HRESULT WINAPI recordset_put_Filter( _Recordset *iface, VARIANT criteria
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI recordset_get_PageCount( _Recordset *iface, LONG *count )
+static HRESULT WINAPI recordset_get_PageCount( _Recordset *iface, ADO_LONGPTR *count )
 {
     FIXME( "%p, %p\n", iface, count );
     return E_NOTIMPL;
@@ -1715,7 +1715,7 @@ static HRESULT WINAPI recordset_put_MarshalOptions( _Recordset *iface, MarshalOp
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI recordset_Find( _Recordset *iface, BSTR criteria, LONG skip_records,
+static HRESULT WINAPI recordset_Find( _Recordset *iface, BSTR criteria, ADO_LONGPTR skip_records,
                                       SearchDirectionEnum search_direction, VARIANT start )
 {
     FIXME( "%p, %s, %d, %d, %s\n", iface, debugstr_w(criteria), skip_records, search_direction,
@@ -2061,14 +2061,14 @@ static HRESULT WINAPI rsconstruction_put_Rowset(ADORecordsetConstruction *iface,
     return S_OK;
 }
 
-static HRESULT WINAPI rsconstruction_get_Chapter(ADORecordsetConstruction *iface, LONG *chapter)
+static HRESULT WINAPI rsconstruction_get_Chapter(ADORecordsetConstruction *iface, ADO_LONGPTR *chapter)
 {
     struct recordset *recordset = impl_from_ADORecordsetConstruction( iface );
     FIXME( "%p, %p\n", recordset, chapter );
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI rsconstruction_put_Chapter(ADORecordsetConstruction *iface, LONG chapter)
+static HRESULT WINAPI rsconstruction_put_Chapter(ADORecordsetConstruction *iface, ADO_LONGPTR chapter)
 {
     struct recordset *recordset = impl_from_ADORecordsetConstruction( iface );
     FIXME( "%p, %d\n", recordset, chapter );
diff --git a/dlls/msado15/stream.c b/dlls/msado15/stream.c
index 424ba722a26..7376146c2e5 100644
--- a/dlls/msado15/stream.c
+++ b/dlls/msado15/stream.c
@@ -144,7 +144,7 @@ static HRESULT WINAPI stream_Invoke( _Stream *iface, DISPID member, REFIID riid,
     return hr;
 }
 
-static HRESULT WINAPI stream_get_Size( _Stream *iface, LONG *size )
+static HRESULT WINAPI stream_get_Size( _Stream *iface, ADO_LONGPTR *size )
 {
     struct stream *stream = impl_from_Stream( iface );
     TRACE( "%p, %p\n", stream, size );
@@ -166,7 +166,7 @@ static HRESULT WINAPI stream_get_EOS( _Stream *iface, VARIANT_BOOL *eos )
     return S_OK;
 }
 
-static HRESULT WINAPI stream_get_Position( _Stream *iface, LONG *pos )
+static HRESULT WINAPI stream_get_Position( _Stream *iface, ADO_LONGPTR *pos )
 {
     struct stream *stream = impl_from_Stream( iface );
     TRACE( "%p, %p\n", stream, pos );
@@ -191,7 +191,7 @@ static HRESULT resize_buffer( struct stream *stream, LONG size )
     return S_OK;
 }
 
-static HRESULT WINAPI stream_put_Position( _Stream *iface, LONG pos )
+static HRESULT WINAPI stream_put_Position( _Stream *iface, ADO_LONGPTR pos )
 {
     struct stream *stream = impl_from_Stream( iface );
     HRESULT hr;
@@ -406,7 +406,7 @@ static HRESULT WINAPI stream_SetEOS( _Stream *iface )
     return resize_buffer( stream, stream->pos );
 }
 
-static HRESULT WINAPI stream_CopyTo( _Stream *iface, _Stream *dst, LONG size )
+static HRESULT WINAPI stream_CopyTo( _Stream *iface, _Stream *dst, ADO_LONGPTR size )
 {
     FIXME( "%p, %p, %d\n", iface, dst, size );
     return E_NOTIMPL;
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index 25c9c6f8356..bac8ab241bd 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -53,6 +53,7 @@ static void test_Recordset(void)
     Properties *props;
     Property *prop;
     LONG count, state;
+    ADO_LONGPTR count_lp;
     VARIANT missing, val, index;
     CursorLocationEnum location;
     CursorTypeEnum cursor;
@@ -212,20 +213,20 @@ static void test_Recordset(void)
     hr = _Recordset_put_Bookmark( recordset, bookmark );
     ok( hr == MAKE_ADO_HRESULT( adErrInvalidArgument ), "got %08x\n", hr );
 
-    count = -1;
-    hr = _Recordset_get_RecordCount( recordset, &count );
+    count_lp = -1;
+    hr = _Recordset_get_RecordCount( recordset, &count_lp );
     ok( hr == S_OK, "got %08x\n", hr );
-    ok( !count, "got %d\n", count );
+    ok( !count_lp, "got %d\n", count_lp );
 
     hr = _Recordset_AddNew( recordset, missing, missing );
     ok( hr == S_OK, "got %08x\n", hr );
     ok( !is_eof( recordset ), "eof\n" );
     ok( !is_bof( recordset ), "bof\n" );
 
-    count = -1;
-    hr = _Recordset_get_RecordCount( recordset, &count );
+    count_lp = -1;
+    hr = _Recordset_get_RecordCount( recordset, &count_lp );
     ok( hr == S_OK, "got %08x\n", hr );
-    ok( count == 1, "got %d\n", count );
+    ok( count_lp == 1, "got %d\n", count_lp );
 
     /* get_Fields still returns the same object */
     hr = _Recordset_get_Fields( recordset, &fields2 );
@@ -631,7 +632,7 @@ static void test_ADORecordsetConstruction(void)
     if (count > 0)
     {
         VARIANT index;
-        LONG size;
+        ADO_LONGPTR size;
         DataTypeEnum type;
 
         V_VT( &index ) = VT_BSTR;
@@ -672,7 +673,8 @@ static void test_Fields(void)
     Field *field, *field2;
     VARIANT val, index;
     BSTR name;
-    LONG count, size;
+    LONG count;
+    ADO_LONGPTR size;
     DataTypeEnum type;
     FieldAttributeEnum attrs;
     HRESULT hr;
@@ -785,7 +787,8 @@ static void test_Stream(void)
     VARIANT_BOOL eos;
     StreamTypeEnum type;
     LineSeparatorEnum sep;
-    LONG refs, size, pos;
+    LONG refs;
+    ADO_LONGPTR size, pos;
     ObjectStateEnum state;
     ConnectModeEnum mode;
     BSTR charset, str;
diff --git a/include/msado15_backcompat.idl b/include/msado15_backcompat.idl
index fedaf557066..8d510bf71c6 100644
--- a/include/msado15_backcompat.idl
+++ b/include/msado15_backcompat.idl
@@ -51,6 +51,12 @@ interface ConnectionEventsVt;
 dispinterface ConnectionEvents;
 dispinterface RecordsetEvents;
 
+#ifdef _WIN64
+typedef __int64 ADO_LONGPTR;
+#else
+typedef long ADO_LONGPTR;
+#endif
+
 typedef [uuid(0000052A-0000-0010-8000-00AA006D2EA4)] enum ErrorValueEnum
 {
     adErrInvalidArgument            = 3001,
@@ -125,7 +131,11 @@ typedef [uuid(00000528-0000-0010-8000-00aa006d2ea4)] enum PositionEnum
     adPosEOF = -3
 } PositionEnum;
 
+#ifdef _WIN64
+typedef [uuid(a56187c5-d690-4037-ae32-a00edc376ac3), public] ADO_LONGPTR PositionEnum_Param;
+#else
 typedef [uuid(a56187c5-d690-4037-ae32-a00edc376ac3), public] PositionEnum PositionEnum_Param;
+#endif
 
 typedef [uuid(0000051f-0000-0010-8000-00aa006d2ea4)] enum DataTypeEnum
 {
@@ -626,7 +636,7 @@ interface Field20 : _ADO
 {
     [id(0x00000455), propget]
     HRESULT ActualSize(
-        [out, retval] LONG *size);
+        [out, retval] ADO_LONGPTR *size);
 
     [id(0x0000040c), propget]
     HRESULT Attributes(
@@ -634,7 +644,7 @@ interface Field20 : _ADO
 
     [id(0x0000044f), propget]
     HRESULT DefinedSize(
-        [out, retval] LONG *size);
+        [out, retval] ADO_LONGPTR *size);
 
     [id(0x0000044c), propget]
     HRESULT Name(
@@ -699,7 +709,7 @@ interface Field20 : _ADO
 
     [id(0x0000044f), propput]
     HRESULT DefinedSize(
-        [in] LONG size);
+        [in] ADO_LONGPTR size);
 
     [id(0x0000040c), propput]
     HRESULT Attributes(
@@ -748,7 +758,7 @@ interface Fields20 : Fields15
     HRESULT _Append(
         [in] BSTR name,
         [in] DataTypeEnum type,
-        [in, defaultvalue(0)] LONG size,
+        [in, defaultvalue(0)] ADO_LONGPTR size,
         [in, defaultvalue(adFldUnspecified)] FieldAttributeEnum attr);
 
     [id(0x60030002)]
@@ -769,7 +779,7 @@ interface Fields : Fields20
     HRESULT Append(
         [in] BSTR name,
         [in] DataTypeEnum type,
-        [in, defaultvalue(0)] LONG size,
+        [in, defaultvalue(0)] ADO_LONGPTR size,
         [in, defaultvalue(adFldUnspecified)] FieldAttributeEnum attr,
         [in, optional] VARIANT value);
 
@@ -859,15 +869,15 @@ interface Recordset15 : _ADO
 
     [id(0x000003f1), propget]
     HRESULT MaxRecords(
-        [out, retval] LONG *max_records);
+        [out, retval] ADO_LONGPTR *max_records);
 
     [id(0x000003f1), propput]
     HRESULT MaxRecords(
-        [in] LONG max_records);
+        [in] ADO_LONGPTR max_records);
 
     [id(0x000003f2), propget]
     HRESULT RecordCount(
-        [out, retval] LONG *count);
+        [out, retval] ADO_LONGPTR *count);
 
     [id(0x000003f3), propputref]
     HRESULT Source(
@@ -905,7 +915,7 @@ interface Recordset15 : _ADO
 
     [id(0x000003f9)]
     HRESULT Move(
-        [in] LONG num_records,
+        [in] ADO_LONGPTR num_records,
         [in, optional] VARIANT start);
 
     [id(0x000003fa)]
@@ -963,7 +973,7 @@ interface Recordset15 : _ADO
 
     [id(0x0000041a), propget]
     HRESULT PageCount(
-        [out, retval] LONG *count);
+        [out, retval] ADO_LONGPTR *count);
 
     [id(0x00000418), propget]
     HRESULT PageSize(
@@ -1040,7 +1050,7 @@ interface Recordset15 : _ADO
     [id(0x00000422)]
     HRESULT Find(
         [in] BSTR criteria,
-        [in, defaultvalue(0)] LONG skip_records,
+        [in, defaultvalue(0)] ADO_LONGPTR skip_records,
         [in, defaultvalue(adSearchForward)] SearchDirectionEnum search_direction,
         [in, optional] VARIANT start);
 };
@@ -1408,11 +1418,11 @@ interface _Parameter : _ADO
 
     [id(0x6003000c), propput]
     HRESULT Size(
-        [in] LONG size);
+        [in] ADO_LONGPTR size);
 
     [id(0x6003000c), propget]
     HRESULT Size(
-        [out, retval] LONG *size);
+        [out, retval] ADO_LONGPTR *size);
 
     [id(0x6003000e)]
     HRESULT AppendChunk(
@@ -1517,7 +1527,7 @@ interface Command15 : _ADO
         [in,  defaultvalue("")] BSTR name,
         [in, defaultvalue(adEmpty)] DataTypeEnum type,
         [in, defaultvalue(adParamInput)] ParameterDirectionEnum direction,
-        [in, defaultvalue(0)] LONG size,
+        [in, defaultvalue(0)] ADO_LONGPTR size,
         [in, optional] VARIANT value,
         [out, retval] _Parameter **parameter);
 
@@ -1844,7 +1854,7 @@ interface _Stream : IDispatch
 {
     [id(1), propget]
     HRESULT Size(
-        [out, retval] LONG *size);
+        [out, retval] ADO_LONGPTR *size);
 
     [id(2), propget]
     HRESULT EOS(
@@ -1852,11 +1862,11 @@ interface _Stream : IDispatch
 
     [id(3), propget]
     HRESULT Position(
-        [out, retval] LONG *position);
+        [out, retval] ADO_LONGPTR *position);
 
     [id(3), propput]
     HRESULT Position(
-        [in] LONG position);
+        [in] ADO_LONGPTR position);
 
     [id(4), propget]
     HRESULT Type(
@@ -1923,7 +1933,7 @@ interface _Stream : IDispatch
     [id(15)]
     HRESULT CopyTo(
         [in] _Stream *dest,
-        [in, defaultvalue(-1)] LONG size);
+        [in, defaultvalue(-1)] ADO_LONGPTR size);
 
     [id(16)]
     HRESULT Flush(void);
@@ -2111,11 +2121,11 @@ interface ADORecordsetConstruction : IDispatch
 
     [propget]
     HRESULT Chapter(
-        [out, retval] LONG *chapter);
+        [out, retval] ADO_LONGPTR *chapter);
 
     [propput]
     HRESULT Chapter(
-        [in] LONG chapter);
+        [in] ADO_LONGPTR chapter);
 
     [propget]
     HRESULT RowPosition(
-- 
2.34.1




More information about the wine-devel mailing list