|
There are ways to even crack this.....
You mean like this??
Assembly asm = Assembly.GetAssembly ( Type ( MyRestrictedAssembly ) );
byte[] b = asm.GetName ().GetPublicKey ();
this.GetType ().Assembly.GetName ().SetPublicKey ( b );
TypeFromRestrictedAssembly temp = new TypeFromRestrictedAssembly ( this.GetType ().Assembly );
SMK
|
|
|
|
|
Well, not exactly. You can crack it using MSIL dissassembler. Just disassemble the code, copy/paste it, or remove the few lines that check for the calling assembly and save the dll files. Yes, it isn't that easy, but it's still doable. If you are not expecting hardcore persistant crackers to hut your application, it would be a nice way of protecting someone from using your code by referencing. Another way to protect your program from being used by reflection also could be the Dotfuscator. It's a small freeware tool to obfuscate your cde against disassembling. Still crackable, but a bit harder.
Regards
|
|
|
|
|
using TcpClient, i have made a client Server chat application. Server is running on another computer. in Client side i use the server IP address and PORT number to connect. If the server is running Any Computer the Client should automatically find the server Ip address how it is possible?
//
now i am using like this
Client Side
TcpClient tcp=new TcpClient();
tcp.Connect("192.0.0.3",8888);
//
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
You would need to broadcast to all the machines on the network and the machine running the server could send back a reply and you can connect to it.
It is similar to how your DHCP works.
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
|
|
|
|
|
I'm setting up an authentication system for access to a server through a remoting layer.
Using custom channel sinks to do this doesn't seem to be a problem.
The problem is that if someone is authenticated as, say "bob" within the remoting layer, then the remote object also needs to know that the method was called by "bob".
Is there any way to pass extra information like this from the remoting layer to the application layer without it being a parameter of the remote method called? Some sort of shared remoting context object, or the like?
|
|
|
|
|
|
|
Unfortunately you can't call assembly code directly from managed code. There is one workaround I can think of; That is to put your assembly code in a C++ -whether managed or not- dll library and call it from your C# code.
In your C++ project you can put your assebly as inline -but IIRC this doesn't allow interrupts to be called-, or put it as an asm file and link it with your project. I did that sometime ago and it worked.
Regards
|
|
|
|
|
can you please explain me in depth.
nishu
|
|
|
|
|
Forgive me if my reply was too shallow.:-> I'll try to fill you with more details, but forgive I still got to be breif as there are too much details that I can't cover in one post.
Now, the interrupts you are talking about are in Assembly code which is a very low level language very close to machine code. These are some sort of a very low level functions that are hardcoded in the processor. Some sort of a processor specific API that should be called at the lowest level of programming... The machine code.
Before the DotNet emergance, all exe files were in assembly/machine code. Every compiler was to compile any code into assembly/machine code. Now in DotNet the compiler actually compiles you code into MS Intermediate Language, which is not machine code. When you double click a DotNet exe file, the DotNet framework actually does the compilation into the machine code in the memory. This is called JIT -Just In Time- compilation. Why did they do that?? It's quite long to say.
The assembly language itself has something similar to a compiler that is called assembler, in which you could write your assembly code directly and convert it to exe file. When C++ emerged they made a feature in MS C++; That is to write assembly code either within your C++ code in asm blocks -something like the unsafe, or try blocks of C#-. Ans Since they all will turn into machine code in the end, it didn't really matter. Yet using this method -i.e. inline assembly block-, didn't support interrupt calls -remember, interrupts are like functions hardcoded in the processor-.
The other way is to write your assembly code as you would in an assembler. Put it in a asm file, and link -something like referencing- that asm file in your C++ project. This was the way if you want to write large code blocks in assembly, and keep the main bulk of your program in C++. Again all the .cpp and .asm file wil be mixed up in one big .exe file written in machine code.
Now, in C# that is not possible. As your C# code is converted it MSIL language which is different that the conventional machine code. So you can't mix up assembly with MSIL...
Oh!! And sorry! You can't call BIOS interrupts in any other language than assembly.
PS.
This is a forum post. All the info above were ment to be as accurate as possible, but I had to omit a lot of details -Yes I did... Don't ROTFL-. So any inaccuracy in the info was not meant, and anyone is welcomed to explain/correct any mistake.
Regards
|
|
|
|
|
you gave very deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep
info..I wanted to know the libraries that can be used to create c++ dll files coz you had done this before.
anyway thanx for your deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee....................................................................................................................................................................................................p information
nishu
|
|
|
|
|
Your welcome.
You don't need any special libraries to make a C++ library. You can make an MFC library and do as I said. The way I did it was to make an empty project totally from the scratch. and change the compile output to dll. This had more work to do, but give you more control -also the way to do it in MFC gave me headache-. I'll look in my HDD for that old project. If I find it I'll give you more details. There were some compiler options that had to be set -I don't remember them right now-.
PS.
Do you know how to program in Assembly language?
Regards
|
|
|
|
|
at first i tried using methods, like Change(string name), but it didn't work across forms. How would i go about transfering this information?
Thanks.
|
|
|
|
|
You can pass information via the constructor to the other form
<br />
Form2 objForm = new Form2(Param1, Param2);<br />
objForm.Show();
Is this what your asking for?
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
|
|
|
|
|
The best way is to create delegates between the forms. The methods probably didn't work because you were not calling them on the same instance of the form as the one you had in use. Delegates will give you the same problem, but it's easier to hook up delegates than track form instances.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all,
I have a drop down control which let the user to select for auto create number of textbox control into the form. Once it generate the textboxes, I check the view source for each of the textbox control with _ctl0, _ctl1 ..... added on in front of the textbox id. I need to get those value and insert into the DB. Here is my code behind.
private void btnMulitTextBox_Click(object sender, System.EventArgs e)
{
SqlConnection conn = ....;
conn.Open();
cmd = new SqlCommand("....", conn);
cmd.CommandType = CommandType.StoredProcedure;
int i = 0;
int totalctrl = Convert.ToInt32(this.ddlNumtoGenerate.SelectedValue.ToString());
while (i < totalctrl)
{
DoInsertToDB(i);
i++;
}
}
private void DoInsertToDB(int ctrlnum)
{
string textboxname ="_ctl" + ctrlnum + ":txtAName";
System.Web.UI.WebControls.TextBox tb = this.FindControl(textboxname) as System.Web.UI.WebControls.TextBox;
cmd.Parameters.Add("@AName", tb.Text);
cmd.ExecuteNonQuery();
}
I got "Object reference not set to an instance of an object." error everytime I run this. Any idea? Thanks in advance.
TMA
|
|
|
|
|
Instead of trying to find the controls, keep the references from when you create them.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
But the id of the textboxes are generated by the dropdown box. For example: How can I reference the 4th textbox on the screen. Please help. Thanks
gsdg
|
|
|
|
|
What do you mean when you say that the textboxes are generated by the dropdown box? A dropdown box does not generate anything by itself.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
I'm having an issue with the changes made to combobox selections being pushed back to a datatable. Hopefully I'll be able to explain things enough to at least get some help.
I have two comboboxes on a form. Each has its dataSource set to a pre-populated table in a dataset. Upon selection of a value in the first one, I change the DataTable.DefaultView.RowFilter on the second combobox's source table to filter the table and only display relevant selctions.
I also have a table which is meant to save the values selected in those two comboboxes. I declare a BindingSource, and set its dataSource to a third table in the dataset. I DataBind the comboboxes' SelectedValue property to the appropriate columns in the 3rd datatable.
Here's my issue.
Upon selecting a value in the first combobox, and then hitting the button that calls .EndEdit on the binding source, only the first combobox's value is moved back into the datatable, and the new second combobox's value is not.
I can select a value in the first, and then re-select the new filtered value, and that will result in a proper binding back to the datatable.
I'm looking for assistance on how to tell the bindingsource to process the new filtered value in the second combobox, since the user has not actually changed the value itself.
Any suggestions?
|
|
|
|
|
Can you publish your code snippet.
That will help in better understanding of your problem .
|
|
|
|
|
prior to the form being shown, these two are called in this order, assume everything not declared is declared before.
<code>
public void LoadForm()
{
PlayerSource = new BindingSource();
//assign to prepopulated table
PlayerSource.DataSource = myClient.PlayerList;
TeamSource = new TeamSource();
//same deal
TeamSource.DataSource = myClient.TeamList;
//assigning of Player info to labels through databinding
//databind player combobox
uxcbPlayer.ValueMember = "PlayerID";
uxcbPlayer.DisplayMember = "PlayerFullName";
uxcbPlayer.DataSource = PlayerSource;
//databind team combobox
uxcbTeam.ValueMember = "TeamID";
uxcbTeam.DisplayMember = "TeamFullName";
uxcbTeam.DataSource = TeamSource;
}
public void LoadData()
{
CurrentPlayerSource = new BindingSource();
CurrentPlayerSource.DataSource = myClient.CurrentPlayer;
uxcbTeam.DataBindings.Add("SelectedValue", TeamSource, "Team", false, DataSourceUpdateMode.OnValidation, "");
uxcbPlayer.DataBindings.Add("SelectedValue", TeamSource, "PlayerName", false, DataSourceUpdateMode.OnValidation, "");
}
</code>
In the Team.SelectedValueChanged event I call this funciton:
<code>
public void FilterTeam ()
{
if (uxcbTeam.SelectedValue != null)
{
if (PlayerSource != null)
{
PlayerSource.Filter = "Team = '" + uxcbTeam.Text + "'";
//uxcbBuilding.SelectedIndex = -1;
//reset cbBuilding Selected Index
}
}
}
</code>
Upon needing to save, I call CurrentPlayerSource.EndEdit(), and then deal with the data. The problem is that upon .EndEdit, the new value of the Player dropdown is not committed back to the database. Say if team A and Player A2 are selected initially, and the team is changed to team C, players C1-Cwhatever populate the second dropdown, C1 is shown initially, but on EndEdit, A2's value is put back in the datatable. If the user opens the player dropdown, and then selected the programatically-selected C1, then upon .EndEdit(), C1 is sent back, but I'm looking for a way to somehow "catch" the change on the second set and have the databindingsource (in this case, CurrentPlayerSource) catch the change.
|
|
|
|
|
Hi,
I am trying to build an n-tier architecture for my project.
At present this is what I have:
There is one Solutioin which contains the following:
1) The client (WinForms) project has a reference to the BusinessLayer project.
2) BusinessLayer project has a reference to the WebService
3) WebService has a reference to the DataLayer project.
4) DataLayer project calls the sql server.
Would you say if I call the webservice direct from the client (WinForms) then this is a good idea or do you think the above 4 steps construct a good design?
Thanks
|
|
|
|
|
I'm in the process of architecting (and building) a similar sort of application.
However, I see my WinForms client (and in the future a web or other type of client) simply as a presentation and controller layer - i.e. something that displays information to the end user and forwards the end user's intentions to the rest of the application. IOW, my WinForms client is extremely dumb and thin. (Unlike me - I'm just dumb).
My webservice interacts with a business layer which in turn interacts with a data layer. The data layer serializes the data portion of several business objects that eventually find their way across the wire to the client (for display purposes).
I've built an automated test harness at each layer - viz: object persistence, business logic, and web service. When I finally get around to building the GUI I'll farm out the visual testing to another party.
Hope this helps.
/ravi
|
|
|
|
|
Hi,
I think that the n-tier architecture is appropriate. But if you call the webservice from the client tier, the n-tier model loses his sense... Because I supose that client tier contains only forms with events and this events call in few lines single methods from the below tier without applying bussines rules...
It's only my point of view...
|
|
|
|