|
Thank you, but Visual Studio does not catch any exception. The process simply quits. I have disabled the hosting process, but this made no difference.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Can you show us your
OnStart code?
|
|
|
|
|
Hi Shameel. The code is below, however the service quits as a response to a different service interacting with it through remoting. In other words, it starts up OK.
protected override void OnStart(string[] args)
{
try
{
RemotingConfiguration.Configure("Poller.dll.config", false);
}
catch (Exception ex)
{
StreamWriter Fs = new StreamWriter("PollStationError.log");
Fs.WriteLine(ex.ToString());
Fs.Close();
}
}
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Is something logged to your log file? I mean, does it throw any exception?
|
|
|
|
|
Unfortunately, no.
HOWEVER, I just discovered an Access Violation in the Application Event logs. It comes from the .NET runtime.
It gives the address of the violation, but that's the address that was "accessed," not the address of the code that caused the violation. Hmm.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Comment your call to RemotingConfiguration.Configure() method and write a simple event log entry just to make sure that RemotingConfiguration.Configure() is not the problem.
|
|
|
|
|
If this is all the code you have in your OnStart, it's no surprise that your service starts, then dies. You don't have any kind of worker thread running that does the actual work or listens for connections. You service isn't starting anything up that does anything.
|
|
|
|
|
Not true. The work is done by threads that are started by remoting calls to this singleton object.
In other words, a client calls the "Start" function in this object, and that begins the work.
The "OnStart" routine you see is merely like a constructor.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Post the config file, 'cause, from your description, something's fishy.
|
|
|
|
|
Can anyone help me convert this registry key into readable values?
http://img714.imageshack.us/img714/7929/regbinary1.jpg
into readable values? For some reason I can pull the registry key as a char[], but it ignores "4F 16 AB C1 4F
The other values convert to "System Byte []" , I'm not sure what the logic is behind the way these are setup?
Thanks for reading!
modified on Wednesday, July 20, 2011 1:29 PM
|
|
|
|
|
1. Your link is wrong.
2. It does not have a "readable value", it's obviously some form of binary value used by the application that set it up in the first place.
3. A better post would be to explain why you want to interpret this, and what problem you are trying to solve.
The best things in life are not things.
|
|
|
|
|
The link is fixed, sorry about that.
I'm trying to figure out where the settings for power management ( Control Panel\All Control Panel Items\Power Options\Edit Plan Settings ) are saved in the registry. It appears they are stored as binary values in either:
HKEY_CURRENT_USER\Control Panel\PowerCfg
but more likely
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\19cbb8fa-5279-450e-9fac-8a3d5fedd0c1\12bbebe6-58d6-4636-95bb-3217ef867c1a
... I'd like to decrypt them and find out if that is true, so I can reencrypt and deploy new values.
|
|
|
|
|
turbosupramk3 wrote: It appears they are stored as binary values in either:
They may be stored in both places - the first for per-user settings, the second for system-wide settings.
I don't think anything is encrypted. If you search you can find a lot of documentation - even whitepapers from Microsoft.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
You are right, it was not encrypted, thank you for that.
My problem is now this, I'm looking to be able to enable and disable this for certain users, for when they have to work at home and wake on lan doesn't seem to work. I set a value in the registry manually yesterday, and it worked, but was reverted back this morning in the control panel, even though the registry key is still set to 0x0000000 . Any thoughts as to why?
|
|
|
|
|
Ok, I figured this out
Get your actual applied policies with the command RSOP in a command window, then go to Computer Configuration --> Adminstrative Templates --> System --> Power Management --> Sleep Settings
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\User\PowerSchemes\381b4222-f694-41f0-9685-ff5bb260df2e\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\29f6c1db-86da-48c5-9fdb-f2b67b1f44da
Set ACSettingIndex to 0 (this changed the control panel value)
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Power\PowerSettings\29F6C1DB-86DA-48C5-9FDB-F2B67B1F44DA
Set ACSettingIndex to 0 (this changed the control panel value)
If your admin is smart, you may not have rights to these keys and make have to take ownership of the keys. After you change them you can remove rights for everyone and just give admins read only rights while still having ownership.
This will allow you to keep the box on, nights where you have to be on call and remote in, I am building a c sharp app that will set and reset these permissions for when I am on call, so the majority of the time the computer will go to sleep. A laptop might have to address the DC power settings also. I'll post code after I get the app built.
|
|
|
|
|
Hi
I have searched the internet and I have been able to find a regular expression that stops users from inputting into a text box words that Oracle uses as reserved words, or characters that it considers special to it unless they are enclosed in quotes along with a regular expression that detects sql injection attacks. Can anyone help?
|
|
|
|
|
Use parameterised queries, unless there is a good reason not to. If there is a good reason not to, escape input on the server side when making up the query. Validating input fields in this way is one of the worst ways to prevent attacks (because it stops users entering legitimate information).
|
|
|
|
|
We are in a way undertaking a parameterised queries. I am actually building a query tool in wpf and restricting what sort of queries a user can run. All I am trying to do is where a user sets a constraint, such name like = 'Bob', that they cannot enter a reserved word or use it to launch an attack. This is why I am looking for a regular expression!
|
|
|
|
|
But what if the user's name includes a banned character (e.g. O'Donnell)? I'm sure there are a few people with surnames that are database reserved words, too. This is why you should escape whatever is passed to you so it isn't an injection string, not 'validate' in such a way that legitimate user input is excluded.
Producing a safe SQL string is relatively easy if what you're escaping is always going to be a quoted parameter, you need to escape quotes, and a good idea to do semicolons for paranoia too.
|
|
|
|
|
If you are using PHP at the front end this is a very helpful tutorial:
Clickety[^]
The generally accepted advice is to escape non alphanumeric characters in text entry boxes and
mysql_real_escape_string() should do the job for you if it is PHP at the front end...
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
It is WPF or windows presentation foundation in c# with an Oracle 10g database not php and mysql
|
|
|
|
|
Check this out:
oracle_sql_injection_attacks[^]
It is also the responsibility of the DBA to ensure that, whatever you pass in to Oracle, you are not able to create an injection attack - so talk this over with the DBA too.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
We have already done this, but what we are doing is creating a query tool that runs against a query database that is copy of the main database. The users queries run against some views, because the users can create any number of combination of queries against these views it is not possible to binding or any of the usual stuff. Therefore, we have to be as flexible as possible. We control what they can select on and join on with the views but we cannot control their constraints such "name Like "Bob".
Therefore, it is imperative for me to have away of stopping "Bob; 'DROP TABLE'" type situations.
|
|
|
|
|
Hi,
Just wanted to let you know that it is not me down-voting you comments.
I hope you find a solution, when you do let us know
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
One of the problems will be having to keep it up to date.
Something that's easy to do is to see if the string contains multiple statements separated by semi-colons;
see my LibSql.SplitSqlStatements method in here[^].
|
|
|
|