|
The following is code written in C# using .NET Framework 2.0 and
VS 2005. I'm getting an exception, error #10022, when I call IOControl().
I tried different values for the parameters to IOControl(), and still get the same error.
Can anybody help clear this up as to why I'm getting this error?
Thx,
T
socket.SetSocketOption(SocketOptionLevel.IP,SocketOptionName.HeaderIncluded,1);
byte []IN = new byte[4]{1, 0, 0, 0};
byte []OUT = new byte[4];
int SIO_RCVALL = unchecked((int)0x98000001);
int ret_code = socket.IOControl(IOControlCode.ReceiveAll, IN, OUT);
ret_code = OUT[0] + OUT[1] + OUT[2] + OUT[3];
if(ret_code != 0)
ret_val = false;
|
|
|
|
|
10022 means Invalid Argument in the Sockets API docs, here[^].
One of the parameters you sent wasn't correct for the mode you've setup or was just plain grabage. You might want to check the parameters you're sending against the docs[^] for WSAIoCtl.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave,
I knew that the error means Invalid Argument, but
looking at the docs for WSAIoCtl, the values I'm
passing in all seem valid.
Socket.RcvAll is a constant in .NET, and the other
two are optional values.
Every other code snippet i've seen has similar values
for IoControl().
Any other thoughts?
Thx,
Tom
|
|
|
|
|
Since the ReceiveAll option requires the socket type be RAW, would your machine happen to be running Windows XP SP1 or SP2? Are you developing this under an Admin equivilent account?
You might also find this[^] a bit interesting.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 12:31 Monday 23rd January, 2006
|
|
|
|
|
Yes, Windows XP SP2 and under an Admin privileged account.
Does that mean it can't be done?
|
|
|
|
|
It can be done. Under XP, you have to jump through all these hoops to get it to work. Look at the second link I posted and there's a link at the bottom of that page. Make sure all your ducks are in a row, per those pages, and you should be OK.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave,
If I'm following the links you are talking about correctly, one of them mentions
turning on ICF if running SP1, and the other mentions if u want to use
raw sockets without restriction, use Windows 2003 Server.
In both cases it seems as if the issue is with sending data on Raw
sockets. In my example, i'm actually trying to receive data on
raw sockets.
So, given that, it seems like it should work.
This error is preventing me from proceeding. Any other
thoughts on how to solve this?
Also, Thanks again for your help to this point.
Tom
|
|
|
|
|
I've tried to search in the forum, but can not find the answer I want. So, here is my question.
1. I create setup and deployment project by Visual Studio 2005. In default settings, there is no shortcuts created in the "User's Programs Menu", so, I added the shortcut from [Application Folder]. I build the project and got 1 setup.exe and 1 MSI file then. After using setup file to install this program, I deleted the setup file and MSI file. And error occurred at 2nd time I launch this application from "Start" menu. Error message is:
An installation package for the product xxxxx can not be found. Try the installation again using a valid copy of the installation package.
I found the problem is, the installation MSI file should not be removed after installation. Why?? That's not reasonable.
2. I can not find a way to build out only one setup.exe file which is a combinition of original setup.exe file and my MSI file. Is it possible to achieve this by Visual Studio 2005?
www.phonol.com
eric
|
|
|
|
|
1) The appication is trying to find the MSI file so it can verify that the installation is OK and do any necessary repairs. The Setup and Deployment project is crap IMHO. It's a bare bones, pain in the a$$ simple installation builder. You'd be much better off using a professional product, something like InstallShield, to build your installs. You'll have much better control over how your install works.
2) No, the Setup and Deployment project doesn't support outputting to an .EXE only.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks, Dave,
For question 1, is there any possible solution for this situation? How can I create a direct shortcut to my .EXE program file of program folder so that the shortcut doesnt need to reference to installation MSI package? Or any other way to solve this problem by using Visual Studio?
Thanks, again
Eric at www.phonol.com
|
|
|
|
|
Without using 3rd party tools, there isn't one.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Does anyone know of any good resources for working with scrollbars? Here's the scenario:
I'm trying to create a control similar to visual studio .net 2005's Error list. I couldn't find any way of making the lisbox control in details view fill the entire area (with the second header being the autofill member) so I moved on from there. Given that my version of the control doesn't have to be very complicated, I sat down to write my own version of the control. Everything went fine until I tried to get the scrollbars working.
I cannot figure out how to get the autoscrolling to work for me. Since I'm drawing my control by hand the basic autoscrolling feature just adds gibberish to the top and bottom of the control, and it also scrolls the headers that I want to keep on at all times on the control. If you look at .net's version, the scroll bar goes to the top of the control but doesn't change the headers' position. The "OnScroll" event is called after scrolling happens, and not before, which makes the control flicker as it tries to scroll and I try to prevent it. I can grab the scroll message as it's passed to the wndproc, but then the scrollbar's position isn't updated when I let go.
I figure that there has to be an easier way of working with scrollbars in .net. Does anybody know of one?
-- modified at 12:54 Sunday 22nd January, 2006
|
|
|
|
|
This is what i would do:
1) Make a new usercontrol
2) Put a new label (a label so it won't flicker) docked to the top, and bring it to front (so it wont be behind the scrollbar)
3) Set the AutoScroll property of the usercontrol to true
4) Change the height of the label as you please (according to the number of items or something)
5) Do the painting on the label
HTH!
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
I appreciate the quick response but that seems to have the same issue. The problem that I'm having is that I want to create a ListView that only does details mode and has a few other features that the ListView doesn't seem to have (but really should as they're very basic things).
In fact, I'm trying to recreate the contol used in visual studio .net 2005 for reporting errors almost exactly but for my program's needs. If you play around with that control you'll notice that the second header (Description) automatically adjusts to fill extra space as the control is resized. If you have more errors than can fit the window, a vertical scrollbar appears on the right side. The scrollbar encompasses the entire control (from top to bottom that is) but it only causes the errors to scroll and leaves the headers where they are. I just want to be able to use the information from the automatic scrollbars but keep them from actually forcefully scrolling my window and replacing what I've drawn with gibberish (which is what they're doing now). I can't really seem to find any tutorials on the web for this kind of thing, and scrollbars are completely ignored in the books that I have.
|
|
|
|
|
Ah so you want to scroll the errors, but keep the headers visible? It's hard for me to imagine, i haven't got VS2005 installed. I think you need two separate labels, one for the header that wont move, and one for the errors themselves.
Something like this:
1) Make a new usercontrol
2) Put a new label (a label so it won't flicker) docked to the top and bring it to front (so it wont be behind the scrollbar)(This was BS, because AutoScroll is on ) Do the header painting on this label.
3) Put a panel on the usercontrol with dock to fill, and bring it to the front. Turn AutoScroll to true.
4) Put a label on that panel, with dock to top. Change the height of the label as you please (according to the number of items or something). Do the errors painting on this label.
Hope this works...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
Actually I went back and got your original idea to work but threw out the autoscrolling functionality and added a docked VScrollBar. I just have to manually adjust the offset and handle the scrollbar's Scroll event.
Thanks for the help.
|
|
|
|
|
Hi All
I am not able to open my previously copied project in .Net, When i try to open the webapplication it says " Unable to open the project file from the webserver ".
I have only .Sln file inside my folder. I donot have projectname.vbproj.webinfo file.
But i can create a new project.
Pls help me
Thanks
|
|
|
|
|
Hey everybody!
I have a question. I'm trying to do some dynamic property loading from an xml file. So i know the following things from the xml:
1) the type of the object to initialize
1) what property of the object to initialize
2) the value the property should get in the form of a string
3) the type of the property (i got that one from the propertyinfo)
I know there has to be a method that you pass a type and a string, and it creates the object for you, just like the propertygrid. I don't want to write a huge switch statement...
Example:
<Roundness>5.4</Roundness> ---> blabla.Roundness = 5.4!
Thank you!
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
I'm not exactly sure but do you probably mean Convert.ChangeType(myString, myType); ?
|
|
|
|
|
That was not the method i was looking for, because you can't convert everything from a string that way. But it did help me in the right direction, so thank you very much!
I ended up writing a method by myself, it wasn't so hard as i thought it would be.
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
System.ComponentModel.TypeConverter tc = System.ComponentModel.TypeDescriptor.GetConverter(typeof(ElementType));
Then use tc.ConvertFromInvariantString / tc.ConvertToInvariantString.
Works for int, float, Point, Font, etc...
|
|
|
|
|
Ah TypeDescriptor, that's the one! That is a lot easier than looking for TypeConverterAttributes and stuff. Thank you so much man!
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
Many thanks for your help, worked a treat! If I could ask one more favour, as I am struggling with this at the moment!
I am now trying to register my DLL in the COM+ Catalog. To do this I am taking the manual approach and using the regsvcs.exe tool provided with the .net framwork.
However when I regiser the dll it comes back that I have derived classes found in the assembly and won't register, saying that classes must be public, concrete and have a default constructor. Why is this happening? As far as I'm aware I haven't got any derived classes apart from the serviced component which is required. Below is my code for my class:
using System;
using System.Data;
using System.Data.SqlClient;
using System.EnterpriseServices;
namespace StepByStep7_1
{
public class NorthwindSC : ServicedComponent
{
private SqlConnection sqlcnn;
private SqlDataAdapter sqlda;
private DataSet ds;
public NorthwindSC()
{
// Create a connection to the
// Northwind SQL Server database
sqlcnn = new SqlConnection("data source=(local);initial catalog=Northwind;
User ID = SA;Password = *********");
}
// This method executes a SELECT query and
// returns the results in a DataSet object
public DataSet ExecuteQuery(string strQuery)
{
// Create a SqlDataAdapter object to talk to the database
sqlda = new SqlDataAdapter(strQuery, sqlcnn);
// Create a DataSet object to hold the results
ds = new DataSet();
// Fill the DataSet object
sqlda.Fill(ds, "Results");
return ds;
}
// This method updates the database with the changes in a DataSet object
public int UpdateData(DataSet ds)
{
// Update the database and return the result
SqlCommandBuilder sqlcb = new SqlCommandBuilder(sqlda);
return sqlda.Update(ds.Tables["Results"]);
}
}
}
Many thanks for your help
Paul
|
|
|
|
|
Trying to understand Cryptography so I'm writing a small utility which lets me select a key size and IV size based on the LegalKeySizes and LegalBlockSizes properties of the SymmetricAlgorithm class. If I always use the LegalBlockSizes[0].MinSize, then everything works fine. But if I were to use the code below I get the following error: System.Security.Cryptography.CryptographicException - "Specified initialization vector (IV) does not match the block size for this algorithm".
public void Encrypt(string input, string password)<br />
{<br />
byte[] salt = new byte[]{0x31, 0x7E, 0x54, 0x7C, 0x6D, 0x30, 0x2B, 0x68, 0x79, 0x5E, 0x36, 0x3A, 0x31, 0x30, 0x24, 0x3D, 0x33, 0x76, 0x31, 0x6C};<br />
PasswordDeriveBytes passBytes = new PasswordDeriveBytes(password, salt);<br />
<br />
SymmetricAlgorithm alg = Rijndael.Create();<br />
alg.Key = passBytes.GetBytes(alg.LegalKeySizes[0].MaxSize);<br />
alg.IV = passBytes.GetBytes(alg.LegalBlockSizes[0].MaxSize);
<br />
<br />
}
In fact, if I use any legal block size other than the MinSize I get this error. Why is this?
Thanks,
Mark Miller
|
|
|
|
|
sonu
Jan 20, 9:26 am show options
Newsgroups: microsoft.public.dotnet.general
From: "sonu" <snehal_w...@yahoo.com> - Find messages by this author
Date: 19 Jan 2006 20:26:19 -0800
Local: Fri, Jan 20 2006 9:26 am
Subject: Re: HELP need urgently!!!
Reply | Reply to Author | Forward | Print | Individual Message | Show original | Remove | Report Abuse
What i m tring to do is ,I have a database with tables having paths of
the files on the client machine.Now what i want is on a button click
by the user search all the files on client machine corresponding to the path in the database table and the file path
should replaced by user files that have been searched from the client
machine.
|
|
|
|
|