Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

variant VT_RECORD and persisting

29 views
Skip to first unread message

Egbert Nierop (MVP for IIS)

unread,
Jan 16, 2002, 4:49:04 PM1/16/02
to
Hi,

Is it possible to persist a variant with vt = VT_RECORD into a block of
memory with a few simple calls?
and from memory to UDT back too?

Thanks for your time!
--
Egbert Nierop

Alexander Nickolov

unread,
Jan 16, 2002, 5:15:25 PM1/16/02
to
There are undocumented functions exported from oleaut32.dll.
Below are the signatures from oaidl.h:

unsigned long __RPC_USER VARIANT_UserSize( unsigned long __RPC_FAR *, unsigned long , VARIANT __RPC_FAR * );

unsigned char __RPC_FAR * __RPC_USER VARIANT_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * );

unsigned char __RPC_FAR * __RPC_USER VARIANT_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * );

void __RPC_USER VARIANT_UserFree( unsigned long __RPC_FAR *, VARIANT __RPC_FAR * );

Before you ask me, I don't know the parameters...

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@geocities.com
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

"Egbert Nierop (MVP for IIS)" <egbert...@nospam.com> wrote in message news:OnCMietnBHA.980@tkmsftngp03...

Igor Tandetnik

unread,
Jan 16, 2002, 5:35:34 PM1/16/02
to
There are four functions defined in <oaidl.h>

unsigned long __RPC_USER VARIANT_UserSize( unsigned
long __RPC_FAR *, unsigned long , VARIANT __RPC_FAR * );
unsigned char __RPC_FAR * __RPC_USER VARIANT_UserMarshal( unsigned
long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * );
unsigned char __RPC_FAR * __RPC_USER VARIANT_UserUnmarshal(unsigned
long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * );
void __RPC_USER VARIANT_UserFree( unsigned
long __RPC_FAR *, VARIANT __RPC_FAR * );

exported from OLEAUT32.DLL, that are supposed to marshal any valid
variant into a memory buffer and back again. No documenation,
unfortunately. See the discussion starting at

http://discuss.microsoft.com/SCRIPTS/WA-MSD.EXE?A2=ind0102A&L=DCOM&P=R50
76

--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Egbert Nierop (MVP for IIS)" <egbert...@nospam.com> wrote in
message news:OnCMietnBHA.980@tkmsftngp03...

Egbert Nierop (MVP for IIS)

unread,
Jan 17, 2002, 3:16:51 AM1/17/02
to
thanks guys!
I go for it since I think it's worth some process crashes to test with it.
It can't be that difficult.

--
The scalable ASP Session replacement for webfarms
http://www.nieropwebconsult.nl/asp_session_manager.htm

"Alexander Nickolov" <agnic...@geocities.com> wrote in message
news:eZOEHrtnBHA.2536@tkmsftngp07...

Egbert Nierop (MVP for IIS)

unread,
Jan 17, 2002, 4:39:59 PM1/17/02
to
very interesting or disappointing :<

I tested this with C++ and all simple types work including VT_ARRAY but
VT_RECORD does not work.

I found this code on the net written in pascal.

procedure RPC_OleVar2Stream(const V: OleVariant; S: TStream);
var
Flag: DWORD;
Size: DWORD;
Buffer: PChar;
begin
Flag:=0;
Size:=VARIANT_UserSize(Flag,0,V);
GetMem(Buffer,Size);
try
VARIANT_UserMarshal(Flag,Buffer,V);
S.WriteBuffer(Size,sizeof(Size));
S.WriteBuffer(Buffer^,Size);
finally
FreeMem(Buffer);
end;
end;


--
The scalable ASP Session replacement for webfarms
http://www.nieropwebconsult.nl/asp_session_manager.htm

"Igor Tandetnik" <itand...@whenu.com> wrote in message
news:O3eYe4tnBHA.1528@tkmsftngp03...

Igor Tandetnik

unread,
Jan 17, 2002, 4:57:39 PM1/17/02
to
What do you know - I found the documentation for those:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/ov-
featr_5cj7.asp

--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Egbert Nierop (MVP for IIS)" <egbert...@nospam.com> wrote in

message news:OGLdJ#5nBHA.1644@tkmsftngp05...

Egbert Nierop (MVP for IIS)

unread,
Jan 17, 2002, 6:09:35 PM1/17/02
to
great stuff. You must have a better search engine :)

--

0 new messages