k10n
Jim Klopfenstein's Radio Weblog

 

 

 

 

  Monday, October 07, 2002

What I was missing with vtMissing


For the last couple of days, I've been writing an ISAPI filter in C++.  The experience has made me appreciate how much fun I've been having coding in C# for .NET, but that's another story.

There is a loose web-services side to my project, so I chose to make use of the ServerXMLHTTP object.  This forced me to deal for the first time in a while with BSTRs and VARIANTS.  The subject of this post is a problem I wrestled with, a VARIANT called vtMissing.

To ease debugging, I wrote a little console app to work out my ServerXMLHTTP code.  In it, without thinking too much about it, I tried using a VARIANT with the tag VT_UNKNOWN for vtMissing.  My console app worked, so I didn't worry about it.

But when I plugged the code into the ISAPI filter, my synchronous send call failed right away with a return code of 0xc0000005L (STATUS_ACCESS_VIOLATION).  After messing with several more obvious possibilities for the cause of the problem, I finally turned to vtMissing.  It took a bit of detective work, but here's what I found (at least this change made my code run).  vtMissing should have the tag VT_ERROR and the long value DISP_E_PARAMNOTFOUND (0x80020004L). 

I'm posting this mostly to get it into Googlespace so the next poor programmer trying to interface to VB-friendly code can find it more easily than I did.  Please, anyone in the know, if this is incorrect, let me know and I'll report it here.  My best evidence that it is correct is that with it my code works.

2:36:15 PM    


Click here to visit the Radio UserLand website. © Copyright 2003 Jim Klopfenstein.
Last update: 3/14/2003; 11:42:02 AM.

October 2002
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Sep   Nov




Subscribe to "k10n" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.