mhammond / pywin32

Python for Windows (pywin32) Extensions
5.09k stars 803 forks source link

Support for VT_RECORD in universal gateway #795

Open ghost opened 19 years ago

ghost commented 19 years ago

I'm interested in implementing this, and started working on it. If someone already near implementation - please inform here.

Reported by: dubnerm

Original Ticket: "pywin32/feature-requests/36":https://sourceforge.net/p/pywin32/feature-requests/36

ghost commented 19 years ago

Original comment by: dubnerm

ghost commented 19 years ago

Logged In: YES user_id=14198

I don't know of anyone working on this. What approach are you taking?

Original comment by: mhammond

ghost commented 18 years ago

Logged In: YES user_id=39274

I want to do something as simple as following:

RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/univgw_dataconv.cpp,v retrieving revision 1.9 diff -p -s -r1.9 univgw_dataconv.cpp *** univgw_dataconv.cpp 27 Jun 2005 11:02:41 -0000 1.9 --- univgw_dataconv.cpp 13 Dec 2005 02:56:26 -0000 *************** PyObject * dataconv_WriteFromOutTuple(Py *** 301,306 **** --- 301,315 ---- } break; } + case VT_RECORD: + { + BOOL PyObject_AsRecordData(PyObject *ob, void **data); + if ( !PyObject_AsRecordData(obOutValue, pbArg) ) + { + goto Error; + } + break; + } case VT_BSTR: { // This is the normal "BSTR" case, we can't

Do you know any reason this would fail? I can't check now - pywin32 doesn't compiles neither under VC toolkit, nor under mingw.

Original comment by: dubnerm

ghost commented 18 years ago

Logged In: YES user_id=14198

I guess that should work :) Ideally the test suite should also arrange for this to be called so we know it works and always remains working.

Original comment by: mhammond

Avasam commented 8 months ago

Here's the proposed patch with updated formatting and location

diff --git a/com/win32com/src/univgw_dataconv.cpp b/com/win32com/src/univgw_dataconv.cpp
index 13dd4142..778e8640 100644
--- a/com/win32com/src/univgw_dataconv.cpp
+++ b/com/win32com/src/univgw_dataconv.cpp
@@ -294,6 +294,13 @@ PyObject *dataconv_WriteFromOutTuple(PyObject *self, PyObject *args)
                 }
                 break;
             }
+            case VT_RECORD: {
+                BOOL PyObject_AsRecordData(PyObject ob, void **data);
+                if (!PyObject_AsRecordData(obOutValue, pbArg)) {
+                    goto Error;
+                }
+                break;
+            }
             case VT_BSTR: {
                 // This is the normal "BSTR" case, we can't
                 // allocate a new BSTR we have to back patch the one
Avasam commented 8 months ago

Tagging @pyhedgehog as original SourceForge issue Creator.