|
It is only going to block one application from being stopped.
Of course he can have a user created whose SID is allowed to close that exe so control can be maintained.
In fact I have done this kind of thing with security SW. Certain apps and areas of the registry have access blocked, launching of aplicaitons is limited to certain users or groups, typical security stuff.
==============================
Nothing to say.
|
|
|
|
|
Yes, but I have a sneaking suspicion that you actually understand the mechanics and implications of doing something like this.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I do. I used to work for a firm who made security products.
==============================
Nothing to say.
|
|
|
|
|
candogu wrote: Where should I start from
Given your description of what you want to do, a real good start would be to redesign your system. An "unkillable" process is a bad design to start with.
candogu wrote: I have to do this
You might have been told to do this by a client or supervisor but that does not mean that you should do it.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
When you're done with this, would you please post your experiences in debugging and unkillable process?
|
|
|
|
|
sample code on how to detect a motion in image processing
|
|
|
|
|
|
unhelpful sarcastic reply
|
|
|
|
|
Hi all,
I am trying to set the cursor for edit box to the next line:
Here is the code i am trying,
CEdit m_TestCtrl;
CString m_Test1;
void CTest::OnChangeEditTest()
{
CString str,str1;
UpdateData(TRUE);
str1 = m_Test1;
str1 += ":";
int nLength = m_TestCtrl.GetWindowTextLength();
m_TestCtrl.SetSel(nLength );
m_Test1 = str1;
UpdateData(FALSE);
}
It is appending,but the cursor is going to the first position.
Can anyone tell me where i am going wrong
Thank you
Manju
|
|
|
|
|
manju 3 wrote: It is appending,but the cursor is going to the first position. You need to send the edit control an EM_SETSEL message.
manju 3 wrote: Can anyone tell me where i am going wrong
My first course of action would be to get rid of the calls to UpdateData() . Use GetWindowText() and SetWindowText() instead.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi all,
I have name of file in my string like test1.doc or test3.xls, i want to get application name by using this string.
Like for test1.doc it should give like Microsoft Word File or Microsoft Word Document how can i do this?
Thanks in adance
|
|
|
|
|
One option would be to read the registry. First find the extension:
HKCR\.doc
Then use that key's default value to read the key at:
HKCR\Word.Document.8
Read that key's default value to get Microsoft Office Word 97 - 2003 Document.
There's likely another way to do this (e.g., AssocQueryString() ), but I don't know it off the top of my head and I'm headed out the door to Lowe's.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi,
We are writing software for machines which are per definition Not connected to the Internet. We are trying to implement Code Signing, but, because our clients computers are Not connected to the Internet, they have no chance of verifying Certifying Authority Signatures. So, for this purpose, we are setting ourselves up as Certifying Authority, and we present Certificate to the customer to act as Root Certificate for our services. When installing the Cert, the User gets (Rightfully) a Dire Warning, about installing such certificate, and offers a 40 digit Thumb Print in the Warning Dialog, advising to contact the issuer with that 40 digit Number.
I would rather send my customer a letter, by post, which contains this number in 8 groups of five.
At the critical Installation point, I would present a Dialog, asking for these numbers in 8 linked Edit Controls,to ask for the numbers again, to confirm that the Authority is genuine.(or Not).
The Current (XP)arrangement is that you get a 40 char string, which an end user is supposed to check with the issuer, but is most likely to Pass and Ignore, rather than painstakingly check.
Has anyone any experience of dealing with this issue.
Regards,
Bram.
Regards,
Bram.
Bram van Kampen
|
|
|
|
|
I am currently having this problem using this:
LPCSTR numStr = "128.40";
float num = 0.0;
wstringstream stream;
stream<<setprecision(2);
stream<<setiosflags(ios_base::fixed);
stream<<numStr;
stream>>num;
i am getting 128.3999 in num, this happens in 128.3, 128.2, 128.1, and any number over 128 with decimal x.1,x.2,x.3,x.4, but does not happens in numbers under 128.
I have just tested another numbers and this happens until 511.4 it gives me 511.3999 but with 512.1 it gives me 512.100001, after 512 all numbers give me that, the same behaviour maybe is repeated again later in series.
Just have tested the function atof and _tstof and both fail.
What do i am missing here, how to solve this issue??
|
|
|
|
|
This is not an issue.
It happens because of the way floating point numbers are stored in memory.
Try this example by changing the value passed to setprecision -
float num = 128.384624;
cout << setiosflags(ios_base::fixed) << setprecision(2) << num << endl;
|
|
|
|
|
use double type instead of float
|
|
|
|
|
Hi,
You ran into precission and rounding problems. This is always a problem when dealing with Floating Point Arithmatic.
The first question is , after setting
stream<<setprecision(2);
You probably typed in quite larger amounts, but I stay with your example, because it hits a fundamental problem, which is not very well understood.
you get things like '511.3999' or '512.100001' I very seldomly use streams, but I know, your setprecission(2) would have printed these as '511.39' and '512.10'
However, I can see where you are coming from. You typed in $511.40, and it appeared elsewhere as $511.39. So you started to investigate. Widened the Precission Spec, and noted that $512.10, was printed as: $ 512.100001!
The Concept of Numbers, Rational Numbers, and Real Numbers is perfect, manipulation of these numbers is always perfect, under the rules of mathematics. At the same time, there is also an Infinite number of Numbers. The Human brain can work with Concepts, and conclude that the square of the square root of 2 equals 2. Computers cannot do that naturally,(Unless if they run an Artificial Inteligence Application designed to do those things). In general, a Computer can work with a Very Large (but Finite) list of Numbers, and the question is how do we encode numbers in real life. Very Large Numbers Very Precice, is very difficult, but then again Who wants to know the US National Budget to the nearest Cent. that's where floats come in. Floats sacrifice speed and storage space for accuracy. If you want to keep account of say funds. Store it in Cents or Fractions of Cents, but essentially as an Integer value.
In other words, you Store it as Cents, but Show it as Dollars,
by sprintf(Buf,"Value \t%c %d.%04d",'$',Val/100,Val%100);
My 30 year adage is:
Storing Money as a Float is nearly always a Daft Idea.
Regards,
Bram van Kampen
|
|
|
|
|
this even happens with the C runtime library!, i use atof and i got the same problems, maybe it is true that is the way the floats are saved in memory as stated before, i even tried double numbers and that even work..
saying this, someone can recommend me a good tutorial on floating numbers manipulation?
Thanks
|
|
|
|
|
materatsu wrote: ...maybe it is true that is the way the floats are saved in memory as stated before...
No maybe about it.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Try http://en.wikipedia.org/wiki/Floating_point[^]. There is a chapter about Accuracy which describes the cause of your problem.
There are several ways to get around this problem, but none of them is exactly simple:
1. The easiest one would be to ignore it, and use mathematical rounding whenever converting between text and floating point numbers. The only thing you really need are two conversion functions, and of course you always have to use those when conversion is required.
2. A somewhat better approach would be to multiply all monetary values by 100 and store them as int (or long ). However, some monetary-based operations may require to consider fractions of Cents, so a factor of 100 may not suffice. Of course, calculations based on these numbers will also be tricky.
3. The best C++ approach would probably be to create a class for your currency, with conversions from and to strings, and basic mathematical operators that take care of however you choose to represent your values internally. While this would cause a lot of effort, there may be existing implementations on the internet that you can use.
|
|
|
|
|
Hey folks!
I am trying to detect when my process is 'forcefully ended' in task manager. I am not trying to prevent this, just want to know this is happening so i can make some log entries and create dumps and such. Googling around suggested hooking 'TerminateProcess' in task manager which i did and it works great as long as the user is ending the process on the 'Processes' tabpage. However -and i think this is more likely to happen- the user kills the program from the 'Applications' tabpage, TerminateProcess in taskmanager isn't invoked. Now my question is: what happens when the user hits 'End Task' on the 'Applications' tabpage? I made a little app and froze it (with Sleep(INFINITE)) to test upon. When i hit 'End Task' on the 'Applications' page and i got asked if i want to end the program i checked where the dialog asking this question came from and it seems to originate from csrss.exe (this was under Windows XP). So it seems that TaskManager somehow passes the job of killing the application to another process.
Do you know how this happens or how i could find out?
Thanks in advance for any suggestions.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
I think in the case of the Applications tab, it simply sends a WM_CLOSE to the application's main window.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I believe so, but when this doesn't work (dispite the WM_CLOSE the software doesn't quit) the user is offered the option of ending the process. When i got this dialog, in task manager on the Applications tab i selected it, right-clicked it and chose 'Go to process' and task manager has shown me 'csrss.exe'. If i hit 'End Task' on the dialog the hooked TerminateProcess doesn't get called in task manager so i believe somehow task manager "hands the process" over to "csrss" to terminate it. Or maybe taskmanager simply kills the process with some other API call. Either way, i'd like to know how it does it so i can 'intercept'. I first tried to hook TerminateProcess in csrss the same way as i did in task manager but i failed at it (i supose because that process belongs to SYSTEM).
P.s.: thanks for answering.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Code-o-mat wrote: Either way, i'd like to know how it does it so i can 'intercept'.
Seems like a bad idea.
What is your goal - maybe there is another approach.
Googling suggests that in newer windows versions you might be able to set up a ACL for a windows service that prevents exits (taking care as a system reboot must still be allowed.) So it isn't an intercept rather it doesn't allow it in the first place.
modified 28-Jan-12 10:33am.
|
|
|
|
|
I don't want to prevent the user from killing the process if he wishes to do so, i just want to create some log entries (and possibly a minidump) when he does.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|