|
The first question is WHY??
Services are User mode apps. Running in Kernel is very aggressively discouraged because of security and stability concerns.
Or are you actually talking about Sessions instead??
|
|
|
|
|
Dave Kreskowiak wrote: The first question is WHY??
I'm creating a firewall with "Tamper protection," so it cannot be interfered with or disrupted.
Dave Kreskowiak wrote: Running in Kernel is very aggressively discouraged
Not always, program an exit function or a shutdown of some sort on your program, and the program will close down completely, so you don't have to worry about it (building a ring 0 service or program without a exit, is plain dumb, since "technically" it is impossible to close it).
Dave Kreskowiak wrote: Or are you actually talking about Sessions instead??
What do you mean by "sessions?"
EDIT:
The people of: Symantec, COMODO or avast! (etc.), knew this would be an issue, as a business they integrated this into there firewalls. But who knows, they probably programmed "tamper protection," upon compile or as the last thing to do to "wrap up" or finish the project, so that they knew the program was finished and stable, and the last thing to do was to do that (put tamper protection on it).
modified 15-Feb-12 4:34am.
|
|
|
|
|
You don't need Ring 0 to make it "Tamper proof". The service isn't going to do the heavy lifting in this kind of application.
An app of this kind has 3 layers. There is a driver that you insert into the network stack that does the actual filtering based on a set of rules. This is what you would put in Ring 0. Oh, this can't be built in managed code (VB.NET, C#, ...) The best language to use is C/C++.
Then there is usually a service that provides two things. The first is an interface to manage the rule sets, which are then provided to the driver. The second is management of the firewall and the reporting database.
The third level is a normal user application that communicates with the service and provides the user interface for managing the firewall.
Sessions: http://windowsteamblog.com/windows/b/developers/archive/2009/10/01/session-0-isolation.aspx[^]
|
|
|
|
|
So the "operational layers" of the program I'm specifying is OR the stuff I need to do it is:
1. Software driver
2. Windows service
3. Process or program
and that they communicate and peer with each other (e.g., I want to block a certain file that I know for sure is a virus, I add it using the dialog on the program, the program says "Hey you need to watch out for this program." and the Windows service says "OK." When the process has been detected, the Windows service says to the driver "Hey can you terminate this program for me?", the driver says "sure.", then the program is gone from the computer memory, since it's process has been terminated), sorta like that?
Another question is that there are 3 rings on your computer (3: software, 2: service, 1: driver, 0: kernel): could I use a set of termination methods, like task kill first, then process terminate and then kernel terminate (if the virus resists or persists to exist?
I am using my own advanced, made firewall/antivirus, since the antiviruses out there that don't supply the options I need, there are all types of exlcusions, and advanced complexity (since I'm a programmer). An I.T. person said any leading antiviruses out there will slow down your computer, regardess of what they say (case in point, Symantec "they prove theres is faster, and it is.....kinda"), they said I'm better off creating my own, but I started the project long before he told me that, and I'm pretty good programmer (programmed for at-least 3 and 1/2 years).
If you wish to see my project/source files, I am more than glad to share them with you. (Only the Gui or program is being made, still in development)
modified 15-Feb-12 11:51am.
|
|
|
|
|
Brandon T. H. wrote: Another question is that there are 3 rings on your computer (3: software, 2:
service, 1: driver, 0: kernel):
Intel processors have 4 rings of execution, which divide authority of code to execute. Windows only supports 2 of them to keep things nice and neat. What Windows calls User Mode is Intel's Ring 3. Kernel Mode is in Ring 0. Other rings are not supported or used.
Applications are not subject to being stuck in any one Mode. Applications switch between modes all the time. You just don't notice anything. For example, in say Notepad, you see the window show up and you click File/Open and get a Open File Dialog. most of this happens in User Mode. You tell it which file to open and click OK. Then the app opens the file for readonly access and reads it. But, since opening a file is a kernel-level operation, you're now executing code in Kernel Mode. All I/O operations go through drivers or APIs that are either found in the Kernel or in Device Drivers. So, you're executing code in the kernel and you didn't have to do anything at all to switch Rings...
All user launched applications and all services you see in the Service Manager run in User Mode (Ring 3). Device Drivers, which are themselves specially written services, run in Kernel Mode (Ring 0).
You user application and service will run in User Mode. Your device driver will run in Kernel Mode.
Brandon T. H. wrote: the program says "Hey you need to watch out for this program." and the
Windows service says "OK." When the process has been detected, the
Windows service says to the driver "Hey can you terminate this
program for me?", the driver says "sure.", then the program is gone from
the computer memory,
Correct, to a point. The network driver will not kill the process. Since at that point, you've already downloaded it and executed it, it's WAY too late for your firewall to do any good. A firewall handles network communication only. It does not control process, just their access to the network. Firewalls examine network traffic and route and block it accordingly. For example, a web browser tries to open a connection to a blocked web site (blocked by IP). The firewall sees the outbound request going to that IP and blocks it by not forwarding the request down the network stack and/or rerouting the request to some other IP and port.
Killing a process is the job of a virus scanner, which will follow the same architecture, but not have anything to do with the network traffic. It deals will stuff on the machine that has already made it past the inbound firewall filter. (A firewall has no way of knowing that a certain .EXE is coming through the pipe.) The virus scanner driver becomes ad part of the file system as an extension or filter driver. When the file is finally written to disk and closed, the virus scanner can examine the contents and decide whether to kill the file or quarantine it. It would also hook part of the Loader to stop an infrected .EXE from being launched.
Brandon T. H. wrote: If you wish to see my project/source files, I am more than glad to share
them with you.
I've got enough of my own code to pour over.
|
|
|
|
|
I am redoing some vb6 programs with vb.net. My target system runs 64 bit windows 7 and I.E. 9.0.4
The vb6 program used the command:
l_lngRetVal = ShellExecute(0&, vbNullString, _ txtURL.Text, vbNullString, "C:\", SW_SHOWNORMAL)
To start I.E. and the same command would open additional tabs if I.E. was allready open.
My new program uses the code:
Process.Start("C:\Program Files\Internet Explorer\iexplore.exe", txtURL.Text)
This allways starts a new instance of I.E.
How can I get it to just open a new tab on the existing instance??
|
|
|
|
|
If Internet Explorer is the default browser,
Process.Start(txtURL.Text)
the URL will be opened in Internet Explorer.
I am not sure if it is opened in a new instance, or in a new tab.
|
|
|
|
|
HI,
I need VB code/Macro to fetch QC report? or anyone have query in QC 10 to fetch execution status of tests.
|
|
|
|
|
First, what the $(#*&$ is "QC 10"??
Second, nobody is going write your code for you.
|
|
|
|
|
If you mean Quality Centre, you have my deepest sympathies in having to use that steaming pile. However the DB is just SQL Server, so why not go to that directly?
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Although in C# this [^] article will act as a good starting point
|
|
|
|
|
Private Sub btnDelete_ItemClick(ByVal sender As System.Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnDelete.ItemClick
If Me.NoteSetBindingSource.Current Is Nothing Then
Return
End If
Dim Id As Guid = DirectCast(DirectCast(NoteSetBindingSource.Current, DataRowView)("IdNoteSet"), Guid)
If MessageBox.Show("Delete selected data?", "Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.OK Then
Me.NoteSetAdapter.Delete(DirectCast(DirectCast(Me.NoteSetBindingSource.Current, DataRowView)("IdNoteSet"), Guid))
End If
Me.LoadData(Id)
End Sub
Private Sub btnRefresh_ItemClick(ByVal sender As System.Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnRefresh.ItemClick
Me.LoadData()
End Sub
Public Sub LoadData()
Me.LoadData(Nothing)
End Sub
Public Sub LoadData(ByVal Id As System.Nullable(Of Guid))
Me.Dataset.NoteSet.Rows.Clear()
Me.NoteSetAdapter.Fill(Me.Dataset.NoteSet)
If Id.HasValue Then
Me.NoteSetBindingSource.Position = Me.NoteSetBindingSource.Find("IdNoteSet", Id.Value)
End If
End Sub
hi guys, i need help above..
loaddata is used to fill my Grid, but everytime i call it, the bindingsource.position move to first..
nah, if i delete row 3 then my position will stay at row 3.
if 3 is the last row, then the position will move to row 2.
this code doesn't work, can somebody correct it?
|
|
|
|
|
vkstarry wrote: loaddata is used to fill my Grid, but everytime i call it, the bindingsource.position move to first.
That sounds logical, doesn't it? When you (re)load data, the grid cannot "assume" that you're loading the same table in there - so it cannot retain it's position.
vkstarry wrote: nah, if i delete row 3 then my position will stay at row 3.
Either don't reload the grid when you delete an item, or "remember" your index and set it manually;
DataGridView1.CurrentCell = DataGridView1.Rows(1).Cells(0)
Note; this works for the DataGridView that's being shipped with the .NET framework. The DevExpress grid[^] will probably use it's own version of positioning. They've got their own documentation and support-forum which I try to avoid
Bastard Programmer from Hell
|
|
|
|
|
I'm just starting to learn VB 2010 (old VB6 programmer trying to learn new stuff) and I'm having a problem with the DataGridView control.
I've created a datasource to my Access database. It connects to a table in the database. The "Fill,GetData()" tableadapter command produces the appropriate number of rows when I preview the data. However, when I show the form that contains the DGV control no rows are displayed. The form_load event is the default code created by Visual Studio, namely:
Private Sub frmSetAwards_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.JRTableAdapter.Fill(Me.YingexpoDataSet.JR)
end sub
Can anyone suggest what might be the problem?
Thanks
|
|
|
|
|
That is insufficient code to work on. Is it a TableAdapter or a DataAdapter? And where/when/how do you bind it to your DGV? There should be a statement such as myDGV.DataSource = myDataSomething
BTW: I don't use adapters, I tend to fill a DataTable using a DbCommand.Read() loop, than bind the table to the DGV with
myDGV.DataSource = myDataTable
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
Well, the properties of the DGV control shows the DataSource as "JRBindingSource". The JRBindingSource object has as it's DataSource "YingExpoDataSet" The YingexpoDataSet is the datase that I created through the Data Sources wizard.
??
|
|
|
|
|
I've never used the wizard, I tend to write my code myself, that way I know what is and isn't going on.
I do expect you need to keep things in their logical order: first get the data present, then establish the binding; if not, I expect an explicit action would be required (I know removing and re-installing the binding works when the data has changed).
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
As far as I remember you have to attach your DataSet to the DataGridView
dim ds as YingexpoDataset
myDataGridView.DataSource = ds.DefaultViewManager
If you want you can do that with the form designer (top right corner of the DataGridView).
Regards
Mick
|
|
|
|
|
SpareRoom (VBPmanan15)
Find a flatshare or flatmate fast! 1000s of rooms
for rent in flatshares across London, Manchester,
Birmingham, Bristol, Leeds, Edinburgh, Glasgow
and the rest. www.spareroom.co.uk
|
|
|
|
|
We usually "vote to remove" spam around here - I've changed tactics and will be adding each domain to the mvp-hosts and the adblocker-blacklist. The more spammers post here, the less visitors they'll receive.
Have a wonderfull day
Bastard Programmer from Hell
|
|
|
|
|
Hello everybody,
I have a child form which is supposed to show an exact duplicate of a part of the main form including its controls - here I'm in particular speaking about a ComboBox. What I'm trying to accomplish is that the user can either change a setting on the main form's ComboBox or on the child forms ComboBox to have both forms update the underlying list of a Datagridview as well as the ComboBox/Datagridview on the other form.
Is there any 'best practices' way of synchronizing controls on two forms? I would surely have to avoid firing events twice (e.g. combo updated by user would update the corresponding combo on the other form and fire again).
Thanks for advice,
Mick
|
|
|
|
|
AFAIK you can achieve that by using simple data binding:
- create a small class describing each item, with at least two properties (e.g. string Display , and int Value );
- store your items in a generic List;
- for both ComboBoxes set the DataSource to that list, and the DisplayMember and ValueMember to the names of the relevant properties. The DisplayMember is what will be shown, the ValueMember what will be returned as the SelectedValue.
With both ComboBoxes set up identically, they will act like one, i.e. fully synchronized; however each of them will fire its events. So you can deal with each of them as if the other didn't exist.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
modified 11-Feb-12 8:57am.
|
|
|
|
|
Hi Luc,
sorry for my late response, I had to find the time to figure that out and still find myself stuck.
Following your advice I defined the class "AirportRange"
Public Class AirportRange
Private _display As String
Public Property Display() As String
Get
Return _display
End Get
Set(ByVal value As String)
_display = value
End Set
End Property
Private _value As Integer
Public Property Value() As Integer
Get
Return _value
End Get
Set(ByVal value As Integer)
_value = value
End Set
End Property
End Class Storing the class in a generic list didn't work (e.g. I didn't know how to), so I used the designer and set up the class as a Project DataSource - after which VS creates an "AirportRangesBindingSource" from it. This I used as DataSource for the new comboBoxes on my main and child forms, setting DataMember and ValueMember to the properties as you suggested.
A problem arose: The forms show, but I can't define items for them - which results in no possibility to select any values from the ComboBox. The items obviously have to be defined in the class istself? At least when I open the "items" property, I get an error message saying it wouldn't be possible to set items as a DataSource is defined...
Can you help me out of that?
Thanks for now,
Mick
|
|
|
|
|
You should keep things simple, especially when you don't understand them well.
And not knowing the basics of generic lists is not acceptable nowadays!
Here is a demo class to describe the combobox items:
Public Class Item
Private myValue As Integer
Private myName As String
Public Sub New(ByVal number As Integer, ByVal name As String)
myValue = number
myName = name
End Sub
Public ReadOnly Property Valu() As Integer
Get
Return myValue
End Get
End Property
Public ReadOnly Property Name() As String
Get
Return myName
End Get
End Property
End Class
and this could be part of a Form that holds a number of comboboxes, all showing the same list, and working fully synchronized:
Private Items As List(Of Item)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Items = New List(Of Item)
Items.Add(New Item(1, "one"))
Items.Add(New Item(2, "two"))
Items.Add(New Item(3, "three"))
For Each ctrl As Control In Me.Controls
If TypeOf (ctrl) Is ComboBox Then
Dim cmb As ComboBox = CType(ctrl, ComboBox)
cmb.DataSource = Items
cmb.DisplayMember = "Name"
cmb.ValueMember = "Valu"
End If
Next
End Sub
That is all there is to it. No magic, no wizards involved.
PS: when you attach a SelectedValueChanged handler to each ComboBox, you'll see they all fire, the one you actually changed fires first, then the others in arbitrary order.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
Actually I had built this solution (a custom control in connection with a custom 'changed' event both forms shared) before and discarded it – thinking your suggestion would show a completely different approach – because ... this approach only solves a part of my problem, raising another one:
Having every control fire it's changed events I end up actualizing the underlying lists twice (which is time intensive)! I had first tried to avoid that by identyfying the clicked control (passing the sender to the FindForm function), but there' obviously no difference between the index change by a 'real user selection' and a remote index change triggered by the other control's changed-event. Could that effect be avoided?
Regards
Mick
|
|
|
|
|