0

I am trying to connect to a mobile network via a modem and a sim card. Every time I try to set the APN String and User Credentials in a Context via SetProvisionedContext() I get the E_INVALIDARG HRESULT. As Parameters I used an Instance of MBN_CONTEXT, a wchar_t* in form of &std::vector<wchar_t>[0], and a ULONG*.

    MBN_CONTEXT context;

    std::vector<WCHAR> apnVector;
    inParamAPN.GetCString(apnVector);

    std::vector<WCHAR> userNameVec;
    inParamUsername.GetCString(userNameVec);

    std::vector<WCHAR> passwordVector;
    inParamPassword.GetCString(passwordVector);

    context.contextID = MBN_CONTEXT_ID_APPEND;
    context.contextType = MBN_CONTEXT_TYPE_INTERNET;
    context.accessString = &apnVector[0];
    context.userName = &userNameVec[0];
    context.password = &passwordVector[0];
    context.compression = MBN_COMPRESSION_NONE;
    context.authType = MBN_AUTH_PROTOCOL_PAP;

and later when I have the IMbnConnectionContext:

    std::vector<WCHAR> providerVector;
    InParamProvider.GetCString(providerVector);
    ULONG requestID;
    contextInterface->SetProvisionedContext(context, &providerVector[0], &requestID);

So my Question is: Which Parameter does the WinAPI have a Problem with, and how can I fix it?

Also any Tips of additional Sources for Information are appriciated. All I have so far are the official MSDN and the Code Example contained in the Windows 7 SDK. Are there any further sources of Information I am not aware of? A google search didn't yield the hoped for results.

Stefan
  • 1
  • 4
  • So if I find the Documentation lacking I can not ask for help here? Okay, let me specify my question real quick. – Stefan Sep 12 '17 at 14:02
  • You just need to phrase it slightly differently. Instead of "Where do I find documentation on X?" you ask "How do I do X?". Try to avoid general questions like "How do I write a program?" and provide a [mcve] that shows the exact problem. – nwp Sep 12 '17 at 14:10
  • I think I did somewhat better now. Also Syntax Highlighting is not so good with WinAPI. – Stefan Sep 12 '17 at 14:25

1 Answers1

0

In the end I did not get it working as it should. I used the second way of connecting to a custom APN, by making a new connection profile. For this I used a XML filled with the Values I needed.

Along the way I encountered another problem with an unforseen Error Code which I described here.

Best regards,

Stefan

Stefan
  • 1
  • 4