Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8463507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:28:24+00:00 2026-06-10T14:28:24+00:00

Basically, I’m getting this error when I try to call a function inside the

  • 0

Basically, I’m getting this error when I try to call a function inside the upnp.dll using VB6, where upnp.dll is returning a datatype that is not supported by VB6. Previously, this same error occured but on a different function/variable, and the resolution was to open up upnp.dll in oleview.exe (to view Type Library Information) and to replace all occurences of “Unsigned Long” with just “Long” and then compile a new TypeLib with the “Unsigned” keywords removed, this solved the problem for that senario.

Now, I need to solve the same problem but for a different function/variable, but the problem is, I have no idea which variable datatype I need to change or remove when I’m in oleview’s TypeLib view of upnp.dll.

For completeness, I’ll let you know where this error is occuring, and then I will show you the relevant part of the oleview/TypeLib view that I am having trouble modifying. (for your information, upnp.dll is contained in windows\system32 and oleview.exe comes with the Windows SDK Toolkit if you do not already have it on your machine).

I am calling the function .InvokeAction sActionName, aryIns, aryOuts where aryIns and aryOuts are Variants declared like this: Dim aryIns As Variant, aryIns As Variant – basically, I declare it generally, put any input data I need inside aryIns and I will get aryOuts with the results of the InvokeAction call. The good thing is, InvokeAction turns my general Variant into a properly dimensioned array reflecting the number of output items that are returned for the ActionName I’m using.

Re the point I’m getting the error, I am using (for sActionName) “GetStatusInfo” on a “WanIPConnection” under the “WAN Connection Device”. I don’t need to define any items for aryIns since this call doesn’t require or need any input arguments, but it provided (returns) 3 items (results) and puts them in aryOuts. So aryOuts ends up as an array with items from index 0 to 2 (3 items total)… and when I loop through this aryOuts array, the items 0 and 1 are printed out and viewed perfectly (without problems) but on the 3rd item (aryOuts(2)) I get the above exception.

Basically, the first 2 arguments are just simple strings (no problem accessing these) but the 3rd argument is defined by the UPnP people as an Unsigned 4 Byte Integer (and this is where the problem lays), VB6 is unable to interpret this datatype and is not letting me access this array item (aryOuts(2)), and I could not figure out what part of the TypeLib I need to modify, since the definition for InvokeAction aryOuts is just stated as a VARIANT* in the TypeLib, and here is the relevant part of the TypeLib for your view (I’ve included the area I understand to be relevant, if you would like additional areas posted, let me know and I can do this):

[
  odl,
  uuid(A295019C-DC65-47DD-90DC-7FE918A1AB44),
  helpstring("IUPnPService Interface"),
  dual,
  nonextensible,
  oleautomation
]
interface IUPnPService : IDispatch {
    [id(0x600209c5), helpstring("method QueryStateVariable")]
    HRESULT QueryStateVariable(
                    [in] BSTR bstrVariableName, 
                    [out, retval] VARIANT* pValue);
    [id(0x600209c6), helpstring("method InvokeAction")]
    HRESULT InvokeAction(
                    [in] BSTR bstrActionName, 
                    [in] VARIANT vInActionArgs, 
                    [in, out] VARIANT* pvOutActionArgs, 
                    [out, retval] VARIANT* pvRetVal);
    [id(0x600209c7), propget, helpstring("property ServiceTypeIdentifier")]
    HRESULT ServiceTypeIdentifier([out, retval] BSTR* pVal);
    [id(0x600209c8), helpstring("method AddStateChangeCallback")]
    HRESULT AddCallback([in] IUnknown* pUnkCallback);
    [id(0x600209c9), propget, helpstring("property Id")]
    HRESULT Id([out, retval] BSTR* pbstrId);
    [id(0x600209ca), propget, helpstring("property LastTransportStatus")]
    HRESULT LastTransportStatus([out, retval] long* plValue);
};

The aryOuts() array I was talking about before is defined by the [in, out] VARIANT* pvOutActionArgs line in the InvokeAction declaration (in the TypeLib above). Basically, the whole array is defined as a VARIANT* (which is fine) but I am having trouble accessing the 3rd element (index item number 2) of the pvOutActionArgs array defined above, how do I modify the TypeLib around this problem?

For reference, and those of you that are interested, Hans Passant (@HansPassant) helped me in solving the similar scenario by asking me to remove the Unsigned section of Text from the upnp.dll TypeLib exposed by oleview.exe – he helped me do this (and the rest of the steps necessary to produce and compile the new TypeLib (upnp.tbl) in the following post: Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:28:26+00:00Added an answer on June 10, 2026 at 2:28 pm

    Try assigning aryOuts(2) to a Long variable (lStatusBits = aryOuts(2)). There should be no problem accesing a VT_UI4 variants in VB6, unless it’s choking on For Each vElem ... loops (vElem being a variant) or variant to variant assignment. There is nothing you can do in your typelib to workaround this behavior. If nothing else works you can change variant type manually with something like Call CopyMemory(aryOuts(2), VT_I4, 2) where VT_I4 = 3

    COM variants are a data structure that starts with a an int16 member called vartype that defines the type of the data stored in the variable (aryOuts(2) in your case).

    VarType VT_UI4 is used for unsigned int32 values. VB6 Longs are converted to a signed VT_I4 = 3 variants.

    VarType VT_UI2 is used for unsigned int16 values. VB6 Integers are converted a signed VT_I2 = 2 variants.

    Modifying variant type of a variable can be very dangerous unless you know what you are doing. In this case you are quite safe to convert unsigned types to their signed counterparts without leaking memory or any other side-effects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically from a database I am getting data that is formatted like this nameofproject101
Basically this function is meant to store the height value of the element that
Basically from C++ FAQ I learned that: A virtual function allows derived classes to
Basically, I have a list of delivery checkboxes one for deliver to this address
Basically, I get the error: -[UIViewController donePress:]: unrecognized selector sent to instance 0x6a7f7c0 ***
Basically I'm attempting to add rows to a table, I need to do this
basically I have a function that resizes elements accordingly with jquery triggering the function
Basically I need to be able to do this: var obj = {foo:bar}, arr
Basically I have a loop incrementing i, and I want to do this: var
Basically I have a single element inside of an xml file where I store

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.