|
Short answer: Don't. The registry is not a good place to store application data. You should use a normal application repository in one of the AppData domains; see Where should I store my data?[^].
|
|
|
|
|
How to send sms to any mobile number through mobile connection c# why we buy api etc. i want to send sms through my mobile packages in c# code, HELP ...
|
|
|
|
|
Google will find you many articles on the subject.
|
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:15am.
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:15am.
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:14am.
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:14am.
|
|
|
|
|
Message Removed
modified 3-Nov-19 11:14am.
|
|
|
|
|
Hi!
Long time lurker here with a question.
I am thinkig of making a software that temporarily disables windows from auto-running a application when inserting a cd or usb. To do this, I need to edit a key in the registry, that is no hard to do.
What I want to know if this is enughe to stop malware from getting on my pc if I insert a usb-drive or cd, or if I am still risking getting a virus/malware on my pc.
If I understand it enughe, for a virus or other malicius software to infect my pc, dosen't it have to run some kind of script or app for it?
Would doing the above prevent that from happening or is it still dangerus to insert unknown usb drives into my pc, even with the auto run feature turned off?
Have a nice day
Acuena
modified 1-Nov-19 18:40pm.
|
|
|
|
|
Disabling autoplay won't be enough to protect you from a malicious USB drive.
An attacker can manipulate the firmware[^] so that the drive pretends to be a keyboard or a network adapter. They can then send commands to your computer, or extract data, without having to run any software.
You can even purchase a "USB Killer" drive[^], which can completely destroy your hardware as soon as you plug it in.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ow ya, did not think about the USB-killers and the modified firmware thing. That makes it much more harder to protect against bad USB with a software, it would make it impossible for the USB killer part.
Guess you could protect against the USB-Killer attack by having a external device you can use as a sacrifice thing between the PC and the USB, it must be able to handle the surge though.
Guess we have to stick to not allow it then unfortunately.
|
|
|
|
|
To add to what Richard says, you get no real protection with a basic software solution: many computers are configured to allow "boot from USB" for recovery purposes, and even if disabling it in Windows works, if it has a bootable partition it stands a good chance of taking over the PC completely the next time it is turned on as that is part of the BIOS and before Windows even starts to load. The same problem exists with CD's (where fitted) - they can also be selected as a bootable device.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Yes, this is another problem I did not think off. Thanks for that
|
|
|
|
|
You're welcome!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi
I'm new to C# and oop (though I have coded in Autoit for more that a decade, so I do have a basic understanding of coding) , I usually use google to get answers, but this question I haven't been able to find an answer to.
My problem/question.
I have created a simple form with 2 text boxes and a button. The form is in a class library, course I want to use it in several programs. In the same library I have another class file, that I want to handle all calls to my lib.
My problem is that I don't know how to "pop" the form, and how to use the button to get the input data from the text boxes, and then handle that data within my class file.
I want to use the library to handle the main programs license.
My idea is:
User launches the main program.
The program calls my license lib -> the lib checks if a license for the program exists in the database, if not "pop" the form to allow the user to enter User Name and License.
When the user clicks the form button, the lib calls a license server to check if the license is valid, if the lic is valid it writes it to the database, and shows a License is Valid message to the user.
Else if the license exist, continue the main program and drop the lic lib.
I hope that it clear what I try to achieve, and that some one can help point me in the right direction
Cheers
/LR
|
|
|
|
|
Quote: The form is in a class library, course I want to use it in several programs. Why not just keep the controls in the library and access the controls in the Windows Forms application? That would solve almost all of your problems.
Quote: I want to use the library to handle the main programs license. Library cannot do anything on its own. Yes, you can contain the code for the logic in the library, but it would be your own application that triggers the functions and calls them to process something. Using a library, you will still need to process the output of the functions and then either continue the program, or terminate the process—as per licensing and other requirements.
There are a couple of articles on software licensing on CodeProject (search in top right corner), in case you want to see how to apply these features in a software application.
Quote: "pop" the form to allow the user to enter User Name and License. Seems like a flow, why not execute the Windows Forms process itself, and "pop" it so user can input the details. This will be helpful, you can use Process class to start the process, and handle the output manually. If this program of yours is a Windows Forms app, then you can simply create the instance of the Form and show it.
Process Class (System.Diagnostics) | Microsoft Docs
To make things even interesting, you can add the Form elements to your console program, and show it dynamically on the runtime, see this thread for more, How to: Create a Windows Forms application from the command line | Microsoft Docs
Form Class (System.Windows.Forms) | Microsoft Docs
Quote: When the user clicks the form button This would be managed inside the Windows Forms app, and your program will not do anything in this aspect—it will keep listening to the updates from licensing library.
Event driven programming in C# will help you in this case, Events - C# Programming Guide | Microsoft Docs
Based on the response of the library using the event, you can handle how to proceed with the last logic you have.
Once again, this is just pseudo-code, since you shared the pseudo-attempt with us. Start with the points I shared and get back to us, we will have more support by then.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
|
HI I am using this code to collect all data from datagrid and storing to list string.
this works perfectly except 1 problem. it only give me cell content to where the columns are visible. meaning if I have 200 rows and in my screen only shows 25 rows, what I can store to my string is only for 25rows. if I scroll, again it only give me values to the visible rows. anybody can give my a clue or give an advise why is this happening. or did I mis a for loop inside or foreach after declaring object[]?
var rows = GetDataGridRows(dataGrid);
List<string> s = new List<string>();
foreach (DataGridRow row in rows)
{
var column = dataGrid.Columns[0];
var tb = column.GetCellContent(row);
var r = (DataRowView)tb.DataContext;
Object[] obj = r.Row.ItemArray;
s.Add(obj[0].ToString());
ids = string.Join(",", s);
}
MessageBox.Show(ids);
modified 1-Nov-19 7:05am.
|
|
|
|
|
That sounds like a problem with your GetDataGridRows function, which you haven't shown.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i used code to getrow.
public IEnumerable<datagridrow> GetDataGridRows(DataGrid grid)
{
var itemsSource = dataGrid.ItemsSource as IEnumerable;
if (null == itemsSource) yield return null;
foreach (var item in itemsSource)
{
var row = dataGrid.ItemContainerGenerator.ContainerFromItem(item) as DataGridRow;
if (null != row) yield return row;
}
}
|
|
|
|
|
Looks like the DataGrid is virtualized, so ContainerFromItem returns null for any rows which aren't currently visible.
There are several workarounds suggested in this StackOverflow thread[^].
But as Dave said, it would be better to work with the source directly rather than trying to read the value from the DataGridRow .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Why are you getting the data from the DataGrid rows instead of the data source the grid is bound to?
|
|
|
|
|
actually I extracted datas from DataTable. now I want to apply filtering to datagrid and from their I will get the values from current status of datagrid.
what I want is from current filter->get all cell content and store to 1 string with comma delimeter.
|
|
|
|
|
you are right Dave. I dont need to go back and assess datagrid. instead use the data from rowfilter and use datarowview.
|
|
|
|