|
user may want to protect the file or folder which is important to him and to prevent accidental delete
|
|
|
|
|
sarfaraznawaz wrote: user may want to protect the file or folder which is important to him and to prevent accidental delete
Another idea is to work with different user privileges to prevent deletion.
|
|
|
|
|
I am pretty sure you will not find any official documentation on such a technique. Consider the implications: not only will such a folder be impossible to backup with standard tools, it will also be left stranded when the parent folder gets deleted.
More importantly: it would be the perfect hiding ground for viruses, since an antivirus program will not find it! Not saying viruses will look for such folders (they wouldn't find it either), but they may create one just for the purpose to hide in it.
I could think of two approaches, but I suspect for the very reasons I've pointed out above, the OS will likely contain security measures to prevent just that.
Maybe there is another solution to the problem you have? If it's a security issue, then maybe all you need is encrypt the files. Write-protecting them would save them from most methods of unwanted accidental change. A checksum could enable you to verify the integrity of the files. And an explicit backup would enable you to restore the files in case they have been tampered with.
|
|
|
|
|
I am able to get a CRC32 from a text string.
Can I reverse it .i.e can I input a number and get the string from CRC?
|
|
|
|
|
No you can't. CRC's (and hash codes in general) reduce some arbitrary-length input to a fixed-length output; you could calculate a CRC of the entire content of your disk. Do you really think the process is reversible? if it were, you could compress any disk to a 32-bit number, so the need for disks would decrease, and disk manufacturers would go belly up.
PS 1: this wasn't really a C/C++ question.
PS 2: bad subject line, it does not mention any keyword that refers to the question's subject.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: you could calculate a CRC of the entire content of your disk. Do you really think the process is reversible?
That's not being very optimistic, now is 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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
As Luc Pattyn said, you can't. What you could try to do is the brute force method, generate a string, "a", create it's CRC, check if it is the same as your CRC, if not, generate the string "b", check the CRC, and so on, for "aa", "ab"...until you find the correct string. It may or may not find the string correctly in your lifetime. Another way would be to have a huge lookup table with CRCs and the strings that produced them in which you could look up the string by its CRC.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Code-o-mat wrote: > The problem with computers is that they do what you tell them to do and not what you want them to do. <
The problem with software companies is that they implement the applications the users tell them to implement, not the ones they want them to implement.
Something along these lines is what a client once told me
|
|
|
|
|
The sad thing is, i know exactly what you mean. And so do a lot of us in this business...sometimes i wish i had taken up something easier (on the nerves) than software development, like aligator wrestling or somesuch.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Actually I found this statement to be an eye-opener.
It made me realize that requirement analysis is just another word for translating solutions into requirements.
|
|
|
|
|
I think i see your point. IF the software doesn't fit the requirements, you either need to change the software or change the requirements. As preposterous as the later may seem, sometimes it works.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Ah... no. That's not what I meant.
My point was that customers like to make 'requirements' like "use the Tahoma font, 10 point for this dialog" when, really, all they want is a decently readable font.
The person who specified this probably had an application designed before and that application used this particular font; he liked it and now he wants it for the new application as well. What he didn't consider however that the new app is for a mobile, not his laptop, and the font might not even be available, or the font doesn't read very well at 10 pt on a small screen.
Also, different parts of an application are often specified by different persons, so other parts may have the requirement to use an entirely different font (with the same ramifications).
In this case it might be best to not just make an assumptions but go back to the customer and clarify what his specification really translates to in terms of readability and usability. Those would be the real requirements then. It won't do to just change the requirements arbitrarily to 'Arial 12' instead, because then the customer will likely notice the deviation from the spec and complain, no matter whether or not that change made sense.
|
|
|
|
|
Maybe i am not expressing myself correctly. Of course i do not mean to just ignore/rewrite the requirements or specifications as it fits the developpers, that can and will lead to arguments and possibly, legal problems. What i meant is basicly the same what you said, go back to the customer and explain why a certain requirement makes no sense, is obsolete, not worth the time it would consume to make (if you are able to determine that), and so on...and if you are lucky, the customer will understand and you can work out a solution that makes everyone happy. But then again, sometimes you are not lucky and the customer will either insist on his wish, or keep coming back with it over and over again altrough you already spoke about the problems. We had this later one, the same problematic wish we already talked over with him and -seemd to- have persuaded him would come up for years.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Thanks, I want the same thing Can you send me the link to do so....
|
|
|
|
|
I don't have any links for this, sorry, but your google is as good as mine.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
If you really want to retrieve a full string from some code, then what you need is a compression algorithm, not a CRC code.
If you just want to be able to correct a bad bit or something like that, you still need something else than CRC. CRC has a 'hamming distance' of 10, meaning you can compare the value to the one you expect and decide if your input is correct, but you cannot determine what is wrong, nor how to correct it, and you can not unambiguously retrieve the original input. You can construct a hash code with a greater hamming distance that would enable you to fix up to a given number of bad bits, but the algorithms to do that are quite complex. Search for 'hamming distance' and 'coding theory' if that is what you're after.
P.S.: I just realized that the statement 'if you just want ...' above was in fact quite wrong, since to achieve a code with a hamming distance of 1 already implies you have a full compression algorithm and can retrieve the string from the code. Being able to correct a flawed encoded string requires a compression with extra information attached, meaning this is an extension to normal compression.
|
|
|
|
|
The better question might be, "How can I get rid of this dependency?".
I'm finishing testing on another developer's project who doesn't know himself how he got his application dependent on the FM20.dll and FM20ENU.DLL. Looking online I found that these are Microsoft forms 2.0 controls. Is there a way to check the resources or the project, for 2.0 controls? Since, these are not redistributable and the application is not dependent on anything that MS Office might have installed (as far as we know), I want to get rid of this dependency but simply removing the dlls from the application's installation directory is not going to solve this problem. I need to know why the application is dependent on them.
Is there certain 2.0 API type calls that I can search on within the project? Or something inside of the IDE itself that I can check?
modified on Tuesday, March 29, 2011 3:24 PM
|
|
|
|
|
In VC6, the two ways that a project links to a DLL is:
1. It includes some .h header file, and that has a statement like
#pragma comment(lib, "bozo.lib")
2. It links directly by specifying the .lib file explicitly in the Linker options.
|
|
|
|
|
Thanks, Hans. I've never used the #pragma comment lib directive. I've checked for both and there are no inclusion to those libs. The only thing it may be, and I will have to check first, is that he includes explicitly two libraries, that he created, in the Linker options. Perhaps, one or both of those library projects use the forms controls.
|
|
|
|
|
Okay, checking for a linked library in a library project when none will exist makes sense. I don't know what I was thinking. But it didn't have any #pragma comment(lib,...) directives in the two libraries either.
FYI, I finally found the answer by viewing the .rc resource file. It seems that a GUID exists, because the Forms Controls (is a COM object or OLE server?), for each of the controls that were used within the project. Found 4 GUIDs, one image, one text box, and two labels. Now have to replace them. Apparently they were used because the items all needed image backgrounds.
|
|
|
|
|
I have a Dialog that has many controls on it. It has multiple ComboBoxes that I have calling the same function when an item is selected in them. I am using CBN_SELCHANGE that calls my function. To get the ID of the control that was changed, I use:
CWnd *pwnd = GetFocus();
crtlid = pwnd->GetDlgCtrlID();
but the ID that is returned is always 1001 and is not the ID of any of the ComboBoxes - they start at 1454 in the resource.h file. None of the controls on the dialog has the ID 1001 so I am confused to what has the focus. Does anyone know what I am doing wrong. I am using VC++ 2005 for a Dialog based MFC application , and using MFC as a static library. Any help would be appreciated - Thanks in advance!
David
|
|
|
|
|
|
Thanks for the help - I will have a look and see if I can figure it out. I did find a way to make it work - In the properties I had the Type set as a Dropdown which I think lets you type in new entries in the EditBox - what has the focus must be that EditBox. If I change the Type to a DropList - fixed list, then when GetDlgCtrlID() runs, I get the ID that I am looking for. Thanks for the help again!
David
|
|
|
|
|
that's interesting... well, glad you have your code working
|
|
|
|
|
GetFocus returns a temporary CWnd, I don't know what the ID of that should be.
it might be that.
Watched code never compiles.
|
|
|
|