Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
It seems that I can't get this right... I'm using the following signature:
[DllImport("coredll.dll")]
        private extern static uint RasGetEntryProperties(string lpszPhoneBook, string szEntry, ref RASENTRY lpbEntry,
            ref int lpdwEntrySize, byte lpb, ref int lpdwSize);


Calling it with the following parameters:
RasGetEntryProperties(null, name, ref RasEntry, ref dwSize, 0, 128);


However, whenever this is called, an error pops up on my device telling me there has been a native exception, without much detail.
I've declared the RASENTRY struct as follows:
private struct RASENTRY
        {
            public int dwSize;
            public int dwfOptions;
            public int dwCountryID;
            public int dwCountryCode;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxAreaCode + 1)]
            public string szAreaCode;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxPhoneNumber + 1)]
            public string szLocalPhoneNumber;
            public int dwAlternatesOffset;
            public RASIPADDR ipaddr;
            public RASIPADDR ipaddrDns;
            public RASIPADDR ipaddrDnsAlt;
            public RASIPADDR ipaddrWins;
            public RASIPADDR ipaddrWinsAlt;
            public int dwFrameSize;
            public int dwfNetProtocols;
            public int dwFramingProtocol;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
            public string szScript;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
            public string szAutoDialDll;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
            public string szAutoDialFunc;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxDeviceType + 1)]
            public string szDeviceType;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxDeviceName + 1)]
            public string szDeviceName;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxPadType + 1)]
            public string szX25PadType;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxX25Address + 1)]
            public string szX25Address;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxFacilities + 1)]
            public string szX25Facilities;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxUserData + 1)]
            public string szX25UserData;
            public int dwChannels;
            public int dwReserved1;
            public int dwReserved2;
            public int dwCustomAuthKey;
        }


Any help would be appreciated, thanks!

-Brandon
Posted
Updated 12-Aug-10 4:37am
v2

1 solution

Anyone? :(

I've updated the signature as displayed above. However, the function now returns ERROR_NOINTERFACE. Is the function definition still wrong?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900