I have a 32-bit application installed on x64 (AMD64) Vista and Windows
XP. The rasdial returns 632 - ERROR_INVALID_S IZE on x64 machine; but
the rasdial behaves properly installing the same 32-bit application on
a 32-bit machine. Any clue? 18 6525
Well, what is your declaration for RasDial?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
<hq****@hotmail .comwrote in message
news:11******** *************@e 9g2000prf.googl egroups.com...
>I have a 32-bit application installed on x64 (AMD64) Vista and Windows
XP. The rasdial returns 632 - ERROR_INVALID_S IZE on x64 machine; but
the rasdial behaves properly installing the same 32-bit application on
a 32-bit machine. Any clue?
1. Rasdial:
[DllImport("rasa pi32.dll",CharS et=CharSet.Auto )]
public extern static uint RasDial(
[In]RASDIALEXTENSIO NS lpRasDialExtens ions,
[In]string lpszPhonebook,
[In]RASDIALPARAMS lpRasDialParams ,
uint dwNotifierType,
IntPtr lpvNotifier,
ref IntPtr lphRasConn
);
2. RASDIALPARAMS:
[StructLayout(La youtKind.Sequen tial,CharSet=Ch arSet.Auto)]
public class RASDIALPARAMS
{
public int dwSize=Marshal. SizeOf(typeof(R ASDIALPARAMS));
[MarshalAs(Unman agedType.ByValT Str,SizeConst=2 56+1)]
public string szEntryName=nul l;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=1 28+1)]
public string szPhoneNumber=n ull;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=1 28+1)]
public string szCallbackNumbe r=null;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=2 56+1)]
public string szUserName=null ;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=2 56+1)]
public string szPassword=null ;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=1 5+1)]
public string szDomain=null;
public int dwSubEntry=0;
public int dwCallbackId=0;
}
3. Usage:
RASDIALPARAMS rdp = new RASDIALPARAMS() ;
rdp.dwSize = Marshal.SizeOf( rdp);
rdp.szEntryName = "Entry Name;
IntPtr notifyHandle = (IntPtr)null;
IntPtr connectionHandl e = (IntPtr)null;
uint dwSucc = RASWrapper.RasD ial(null, null, rdp, 0xFFFFFFFF,
notifyHandle, ref connectionHandl e);
What is the definition of RASDIALEXTENSIO NS? Are you using a class to
define it? I'm assuming so, so that you can pass null in.
One thing I definitely notice is the definition of the dwCallbackId
field in the RASDIALPARAMS structure. You are defining it as an int, when
it should be an IntPtr. This would probably explain why the size is wrong
when calling on a 64-bit platform.
Assuming that all the lengths to the strings are correct, this should be
the issue.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
<hq****@hotmail .comwrote in message
news:11******** **************@ y27g2000pre.goo glegroups.com.. .
1. Rasdial:
[DllImport("rasa pi32.dll",CharS et=CharSet.Auto )]
public extern static uint RasDial(
[In]RASDIALEXTENSIO NS lpRasDialExtens ions,
[In]string lpszPhonebook,
[In]RASDIALPARAMS lpRasDialParams ,
uint dwNotifierType,
IntPtr lpvNotifier,
ref IntPtr lphRasConn
);
2. RASDIALPARAMS:
[StructLayout(La youtKind.Sequen tial,CharSet=Ch arSet.Auto)]
public class RASDIALPARAMS
{
public int dwSize=Marshal. SizeOf(typeof(R ASDIALPARAMS));
[MarshalAs(Unman agedType.ByValT Str,SizeConst=2 56+1)]
public string szEntryName=nul l;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=1 28+1)]
public string szPhoneNumber=n ull;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=1 28+1)]
public string szCallbackNumbe r=null;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=2 56+1)]
public string szUserName=null ;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=2 56+1)]
public string szPassword=null ;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=1 5+1)]
public string szDomain=null;
public int dwSubEntry=0;
public int dwCallbackId=0;
}
3. Usage:
RASDIALPARAMS rdp = new RASDIALPARAMS() ;
rdp.dwSize = Marshal.SizeOf( rdp);
rdp.szEntryName = "Entry Name;
IntPtr notifyHandle = (IntPtr)null;
IntPtr connectionHandl e = (IntPtr)null;
uint dwSucc = RASWrapper.RasD ial(null, null, rdp, 0xFFFFFFFF,
notifyHandle, ref connectionHandl e);
Following are my original definition. With your suggestion, I changed
int in 2. 4. and 5. for IntPtr; and I changed uint in 4. and 5. for
UIntPtr. But still RasDial still returns 632.
4.RASDIALEXTENS IONS
[StructLayout(La youtKind.Sequen tial)]
public class RASDIALEXTENSIO NS
{
public readonly int
dwSize=Marshal. SizeOf(typeof(R ASDIALEXTENSION S));
public uint dwfOptions=0;
public int hwndParent=0;
public int reserved=0;
public int reserved1=0;
public RASEAPINFO RasEapInfo=new RASEAPINFO();
}
5.RASEAPINFO:
[StructLayout(La youtKind.Sequen tial)]
public struct RASEAPINFO
{
public uint dwSizeofEapInfo ;
public int pbEapInfo;
}
<hq****@hotmail .comwrote in message
news:11******** **************@ t8g2000prg.goog legroups.com...
Following are my original definition. With your suggestion, I changed
int in 2. 4. and 5. for IntPtr; and I changed uint in 4. and 5. for
UIntPtr. But still RasDial still returns 632.
4.RASDIALEXTENS IONS
[StructLayout(La youtKind.Sequen tial)]
public class RASDIALEXTENSIO NS
{
public readonly int
dwSize=Marshal. SizeOf(typeof(R ASDIALEXTENSION S));
public uint dwfOptions=0;
public int hwndParent=0;
public int reserved=0;
public int reserved1=0;
public RASEAPINFO RasEapInfo=new RASEAPINFO();
}
5.RASEAPINFO:
[StructLayout(La youtKind.Sequen tial)]
public struct RASEAPINFO
{
public uint dwSizeofEapInfo ;
public int pbEapInfo;
}
Please post your actual definitions.
Willy.
what you see in 1. 2. 3. 4. 5. is basically everything I have as it
is. And they worked in 32-bit machine, but not the x64 ones. Of
course, I mssed a '}' in 5. Please clarify what you need?
[StructLayout(La youtKind.Sequen tial,CharSet=Ch arSet.Auto)]
public class RASDIALPARAMS
{
public int dwSize=Marshal. SizeOf(typeof(R ASDIALPARAMS));
[MarshalAs(Unman agedType.ByValT Str,SizeConst=( int)RasFieldSiz eConstants.RAS_ MaxEntryName
+1)]
public string szEntryName=nul l;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=( int)RasFieldSiz eConstants.RAS_ MaxPhoneNumber
+1)]
public string szPhoneNumber=n ull;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=( int)RasFieldSiz eConstants.RAS_ MaxCallbackNumb er
+1)]
public string szCallbackNumbe r=null;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=( int)RasFieldSiz eConstants.UNLE N
+1)]
public string szUserName=null ;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=( int)RasFieldSiz eConstants.PWLE N
+1)]
public string szPassword=null ;
[MarshalAs(Unman agedType.ByValT Str,SizeConst=( int)RasFieldSiz eConstants.DNLE N
+1)]
public string szDomain=null;
public int dwSubEntry=0;
public IntPtr dwCallbackId= IntPtr.Zero ;
}
[StructLayout(La youtKind.Sequen tial)]
public class RASDIALEXTENSIO NS
{
public readonly int
dwSize=Marshal. SizeOf(typeof(R ASDIALEXTENSION S));
public uint dwfOptions=0;
public int hwndParent=0;
public int reserved=0;
public int reserved1=0;
public RASEAPINFO RasEapInfo=new RASEAPINFO();
}
[DllImport("core dll.dll", CharSet = CharSet.Auto)]
public extern static uint RasDial(
[In]RASDIALEXTENSIO NS lpRasDialExtens ions,
// pointer to function extensions data
[In]string lpszPhonebook, // pointer to full path and file
// name of phone-book file
[In]RASDIALPARAMS lpRasDialParams ,
// pointer to calling parameters data
uint dwNotifierType, // specifies type of RasDial event
handler
IntPtr lpvNotifier, // specifies a handler for RasDial
events
ref IntPtr lphRasConn // pointer to variable to receive
// connection handle
);
public bool DialConnection( )
{
bool bRetVal = false;
m_applicationLo g.AppendLineToL og("DialConnect ion");
// try to reconnect
uint dwSucc = 0;
if (IsAlreadyConne cted() == false)
{
m_applicationLo g.AppendLineToL og("IsAlreadyCo nnected()
== false");
DoHangup();
RASDIALPARAMS rdp = new RASDIALPARAMS() ;
rdp.dwSize = Marshal.SizeOf( rdp);
rdp.szEntryName = m_connectionNam e;
uint dwNotifierType = 0xFFFFFFFF;
dwSucc = RASWrapper.RasD ial(null, null, rdp,
dwNotifierType, m_notifyHandle, ref m_connection);
m_weDialed = true;
}
else
{
m_applicationLo g.AppendLineToL og("IsAlreadyCo nnected()
== true");
m_weDialed = false;
}
if (dwSucc == 0)
{
bRetVal = true;
}
return bRetVal;
}
in 3. above, out of desperate, I changed:
rdp.dwSize = Marshal.SizeOf( rdp);
to
rdp.dwSize = Marshal.SizeOf( rdp) + 4.
Then the rasdial returns successfully in x64. I don't think this is a
soloution, but do have more to say based on this hint?
<hq****@hotmail .comwrote in message
news:11******** **************@ v23g2000prn.goo glegroups.com.. .
what you see in 1. 2. 3. 4. 5. is basically everything I have as it
is. And they worked in 32-bit machine, but not the x64 ones. Of
course, I mssed a '}' in 5. Please clarify what you need?
Oh, but I don't see any IntPtr's, the HWND field (hwndParent) in
RASDIALEXTENSIO NS must be an IntPtr (all Handles are IntPtr in .NET), the
same is true for the ULONG_PTR fields in RASDIALEXTENSIO NS (reserved and
reserved1)and RASDIALPARAMS (dwCallbackId ).
Willy. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lee |
last post by:
I have been working for hours trying to get the RasDial API function working
in VB.NET with no success. All i ever get back from the API is error 87,
Invalid Parameter. Does anyone have any .NET code that sucessfully does this?
|
by: Brian Corbett |
last post by:
I'm am trying to write a RAS Component that lists the Available RAS
Connections on the current machine, I have got as far as
getting the Connections using the RasEnumEntry API
Getting the Entry Properties for Each entry using RASGetEntryProperties
API
Getting the Dial Parameters using the RasGetEntryDialParams API
I am Getting unstuck when it comes to actually dial the Ras Connection. When
I actually Call the RASDIAL API I always Get...
|
by: Ken Hughes |
last post by:
Hi
I'm using RASDial API call from VB.Net - it works ok and connects..
The problem is if it fails the first time (line busy etc) I have it retry a couple of times. Every subsequent try fails with error 668 (ERROR_NO_CONNECTION - the connection dropped)...
I do make sure that I call RASHangUp between RASDial calls (in fact RASHangUp also returns error 668)..
Is there something else I need to do between each call (wait for some timeout /...
|
by: Les Hughes |
last post by:
Im working on some RAS stuff, and am after callbacks for when the
connection is disconnected.
According to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rras/rasdial.asp
If I dial using
RasDial(Nothing, Nothing, cRasDialParams, 0, AddressOf RasDialFunc, handle)
all will be well, but when this is used, it seems that the modem does
not dial at all, although a sucessful connection message is returned.
|
by: Andreas Hecker |
last post by:
Hello Group, accidentially i posted this to the vb6 group. They told me,
that this group should be the right place.
I successfully managed to dial a ras connection using RasDial() API. It
works if a user saves the credentials or when i fill the RASDIALPARAMS with
Username and Password manually. The matter is, that i need to use RasDial()
with an L2TP connection which uses a certificate. It seems that i need to
call a function called...
| |
by: bhc |
last post by:
all-
up until just recently, i was fairly sure i'd implemented a RasDial
class in VB.NET complete with a callback to get updated status. from
this wrapper, when i throw an event back to the calling program, i can
console.writeline the state successfully. but as soon as i replace
that line with updating the UI, the program freezes, and execution
halts. no exceptions are thrown or anything (i've got the line in a
try...catch block, but...
|
by: salad |
last post by:
Due to an earlier posting I read in this newsgroup regarding Office 2007
beta, I downloaded it. After I DL'd it, I got an invitation from MS to
get WinVista.
I am now wondering if, since both are betas, it is best to buy a new
computer? My current computer setup is a Pentium 4, 1 gig memory, 2.66
ghz, 60-80 gig disk drive.
MS's requirements for a WinVista computer is
A modern processor (800mz)
|
by: Squishy |
last post by:
I tried installing my VS2005 Pro on Vista Ultimate 32 bit RTM today and got
errors stating that VS2005 was not compatible with Vista.
Microsoft......please pull your finger out of my ass and tell me this is a
joke.
It must be a joke....because I also have read that VS2002 and VS2003 will
not be supported on Vista. This clearly violates Microsoft's own terms of
support for these products.
|
by: j2ee.singh |
last post by:
Hi,
I'm looking to buy a new laptop primarily to learn & practice .NET and
C#.
My Question is:
Is there any requirement for .NET and C# in terms of the following
Operating Systems:
- Windows Vista Home Basic
- Windows Vista Business
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |