This is SO DUMB. I can't believe that I can't perform this simple operation.
I'm writing a large COM program, and I have been invoking COM methods using MASM compatible structures that I have converted from Type Library IDL files (retrieved from OLE/COM Object Viewer).
Everything is working great, so far,...
I have made a call to a method that returns a pointer to a VARIANT_BOOL. The method returns S_OK (HRESULT) correctly, but, when I attempt to de-reference the pointer value, the application crashes. A VARIANT_BOOL is a word-sized element.
mov ecx, PtrIsStatic ; PtrIsStatic is the pointer to a VARIANT_BOOL (pRetVal)
; I've tried the following simple mov de-references, they all crash.
; mov ebx, DWORD PTR [ecx] ; crashes
; mov bx, WORD PTR [ecx] ; crashes
; movzx ebx, WORD PTR [ecx] ; crashes
; mov ebx, [ecx] ; crashes
CMP bx, VARIANT_TRUE
JZ VarntTrue ; Writes the value to file.
The preceeding function call's signature is:
; [propget]
; HRESULT _stdcall IsStatic([out, retval] VARIANT_BOOL* pRetVal);
This is a member of the _MethodInfo interface (https://msdn.microsoft.com/en-us/library/system.runtime.interopservices._methodinfo(v=vs.110).aspx)
Quote from: Zen on August 18, 2016, 06:51:50 AM
I have made a call to a method that returns a pointer to a VARIANT_BOOL. ...
I have no idea about the code you use, but just a guess.
How do you call this method
if you call
invoke IsStatic ,this,PtrIsStatic ;Your code will works fine
but if you call
invoke IsStatic ,this,addr PtrIsStatic ; The procedure would take that PtrIsStatic is the beginning of variant (This is wrong),so in this case you must use
lea ecx, PtrIsStatic
Can you show the Variant structure ?
Maybe this one works....
VARIANT struct
vt dw ?
wReserved1 dw ?
wReserved2 dw ?
wReserved3 dw ?
pRetVal dd ? ; maybe 16 bit Boolean ?
dd ?
VARIANT ends
VT_BOOL equ 11
mov Variant.vt,VT_BOOL
mov Variant.pRetVal,NULL
..... com stuff
..... get Variant.pRetVal
Really ... I don't understand why you need those weird VARIANT_BOOL declarations ... whle you have full access to Sports Illustrated shoot 2016 ???
For example :
Samantha Hoopes - Jerk Off Challenge (https://www.youtube.com/watch?v=aqIwkNmnyQE)
Thanks, guys for the suggestions,...
But, it hadn't occurred to me to check,...
I'm getting ACCESS VIOLATIONS (a number of them). It's a .NET Framework hosting app (like MABDELOUAHAB's MASM32Ref),...and, I'm attempting to access Network Information (https://msdn.microsoft.com/en-us/library/system.net.networkinformation(v=vs.110).aspx). I suspect that I don't have the required NetworkInformationPermission (https://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinformationpermission(v=vs.110).aspx) (I'm not running as Administrator).
I'll check it out tomorrow,...I'm all out of time today.
VERTOGRAD,...Yeah,...good point,...I'll try not to think about it,...:icon_eek:
SIEKMANSKI, Here's the VARIANT Structure that I'm using,...(I think it's from MABDELOUAHAB's COMHelper)
VARIANT STRUCT
vt WORD VT_EMPTY
wReserved1 WORD 0
wReserved2 WORD 0
wReserved3 WORD 0
Union
lVal SDWORD ? ; VT_I4
bVal byte ? ; VT_UI1
iVal SWORD ? ; VT_I2
fltVal REAL4 ? ; VT_R4
llVal QWORD ? ; VT_I8
dblVal REAL8 ? ; VT_R8
boolVal WORD ? ; VT_BOOL
scode DWORD ? ; VT_ERROR
cyVal QWORD ? ; VT_CY
date QWORD ? ; VT_DATE
bstrVal DWORD ? ; VT_BSTR
punkVal DWORD ? ; VT_UNKNOWN
pdispVal DWORD ? ; VT_DISPATCH
parray DWORD ? ; VT_ARRAY
pbVal DWORD ? ; VT_BYREF|VT_UI1
piVal DWORD ? ; VT_BYREF|VT_I2
plVal DWORD ? ; VT_BYREF|VT_I4
pfltVal DWORD ? ; VT_BYREF|VT_R4
pdblVal DWORD ? ; VT_BYREF|VT_R8
pboolVal DWORD ? ; VT_BYREF|VT_BOOL
pscode DWORD ? ; VT_BYREF|VT_ERROR
pcyVal DWORD ? ; VT_BYREF|VT_CY
pdate DWORD ? ; VT_BYREF|VT_DATE
pbstrVal DWORD ? ; VT_BYREF|VT_BSTR
ppunkVal DWORD ? ; VT_BYREF|VT_UNKNOWN
ppdispVal DWORD ? ; VT_BYREF|VT_DISPATCH
pparray DWORD ? ; VT_BYREF|VT_ARRAY
pvarVal DWORD ? ; VT_BYREF|VT_VARIANT
byref DWORD ? ; Generic ByRef
cVal SBYTE ? ; VT_I1
uiVal WORD ? ; VT_UI2
ulVal DWORD ? ; VT_UI4
intVal SWORD ? ; VT_int
uintVal WORD ? ; VT_uint
pdecVal DWORD ? ; VT_BYREF|VT_DECIMAL
pcVal DWORD ? ; VT_BYREF|VT_I1
puiVal DWORD ? ; VT_BYREF|VT_UI2
pulVal DWORD ? ; VT_BYREF|VT_UI4
pintVal DWORD ? ; VT_BYREF|VT_int
puintVal DWORD ? ; VT_BYREF|VT_uint
STRUCT ; VT_RECORD
pvRecord DWORD ?
pRecInfo DWORD ?
ENDS
ENDS
VARIANT ENDS
Quote from: Zen on August 18, 2016, 09:21:24 AM
SIEKMANSKI, Here's the VARIANT Structure that I'm using,...(I think it's from MABDELOUAHAB's COMHelper)
VARIANT structure (https://msdn.microsoft.com/en-us/library/windows/desktop/ms221627(v=vs.85).aspx)