I am currently creating a class to interface with the winapi RASfunctions and enumeratetypes. I need to translate this function into a C# call.
void CALLBACK MprAdminConnectionHangupNotification( __in RAS_CONNECTION_0 *pRasConnection0, __in RAS_CONNECTION_1 *pRasConnection1 );
Initially, i thought this was easy
internal
delegate void MprAdminConnectionHangupNotification ([in] RAS_CONNECTION_0 pRasConnection0, [in]AS_CONNECTION_0 pRasConnection1)
My next step was to translate the datatype
RAS_CONNECTION_0 and
RAS_CONNECTION_1.
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
internal struct RAS_CONNECTION_0
{
internal readonly int MAX_INTERFACE_NAME_LEN =256;
IntPtr hConnection;
IntPtr hInterface;
public uint dwConnectDuration;
RouterInterfaceType dwInterfaceType;
public uint dwConnectionFlags;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=(int) 256)] public string wszInterfaceName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst=(int) 256)] public string wszUserName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=(int) 256)] public string wszLogonDomain;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=(int) 256)] public string wszRemoteComputer;
};
The Original structure is
typedef struct _RAS_CONNECTION_0 {
HANDLE hConnection;
HANDLE hInterface;
DWORD dwConnectDuration;
ROUTER_INTERFACE_TYPE dwInterfaceType;
DWORD dwConnectionFlags;
WCHAR wszInterfaceName[MAX_INTERFACE_NAME_LEN + 1];
WCHAR wszUserName[UNLEN + 1];
WCHAR wszLogonDomain[DNLEN + 1];
WCHAR wszRemoteComputer[NETBIOS_NAME_LEN + 1]; } RAS_CONNECTION_0,
*PRAS_CONNECTION_0;
Can Someone tell me where to find UNLEN and DNLEN?
I am close to solving the hang up problem, I just need some assistance as to where to locate mpradmin.h.
Thanks in advanced
David
David Moss