|
Sorry, I mixed up the meaning of the remark, i understood it the way that if the function returns 0 it was successful
|
|
|
|
|
TheInfernalCrow wrote: Sorry, I mixed up the meaning of the remark
Ah, that will happen. I have a small list of number one rules. One of them is:
Always suspect that "I" made a mistake. This rule causes you to check and recheck your work, including reading documentation, before taking off on a wild goose chase.
Good luck.
|
|
|
|
|
Sure I know these, but I oversaw one single "!" and then mixed up the meaning of 0
|
|
|
|
|
Hello everyone,
In my application I need to create a folder and make it read only to test whether my application could work with read only media.
I have tried to set the property of a folder to read only (right click the mouse and make Read Only property enabled), but I find I still can create file into this folder.
How to make a folder truly read only on Windows (e.g. can not create file into the folder)?
Both programming ways and non-programming ways are appreciated. I am using Windows XP SP2.
thanks in advance,
George
|
|
|
|
|
You'll need to step into the world of ACEs and ACLs.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
Any advice to some learning resources? I need to make some folder read only -- not allowing creating new files into the folder. Either programming way or non-programming way is ok.
regards,
George
|
|
|
|
|
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
George_George wrote: Do you have a more clear and simple sample about ACE for a directory?
It's not a simple subject hence you will not find simple examples. Some things just cannot be done in five lines of code.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
Then I need to read the same.
regards,
George
|
|
|
|
|
why would we reply when you never answer our questions ?
i'm still waiting my answer...
|
|
|
|
|
Well.. if both programming and non-programming ways are welcome... why not writing the folder on a CD/DVD (i suggest multisession) and then try accessing it with your application. Or on a diskette, with the lock on..
|
|
|
|
|
Thanks shpid3r,
It is better if we could have hard disk to simulate the read only function. Any ideas?
About the solution of using CD/DVD, each time I changed the data, I need to record a new CD/DVD, and the cost is too high;
About the diskette, I do not have any reader at hand, and my machines are modern -- do not have such diskette interface.
regards,
George
|
|
|
|
|
ignoring me Mr George ?
may I know why you don't answer my posts ?
|
|
|
|
|
Hello again!
Well then, if by hardware means making stuff read only isn`t possible, i suggest trying with a memory stick that has the possibility to lock it (similar to a diskette).
Anyway, I've searched about your problem and found out:
"(...)It's greyed out because folders generally can't be read-only. It's greyed out because the read-only property of a folder either makes all files in the folder read-only, or not read-only."
(a discussion on why a lad couldn`t uncheck a read only property of a folder)
I`ve seen that read only folders was a problem in XP SP1, fixed in SP2. Some explanation on this topic is provided on Microsoft's Site. It's a workaround that problem to fix it. Maybe you can do the reverse of that "fixing" and succeed in what you need.
Please let us know what's new!
Regards,
Shpid3r
|
|
|
|
|
Thanks Shpid3r,
I have tried,
attrib +r +s <folder name="">
then I tried that I still can create new files into the folder. I think read only concept of Windows folder does not mean we can not create new files into the read only folder. Right?
regards,
George
|
|
|
|
|
yes, you might be ignoring me... well, if you don't answer, i'm going to ask Maunder to take action against you (at least, part of you - i'm sure you know which).
|
|
|
|
|
Well, I`ve asked my colleagues, and we`ve agreed that the concept of read only folder only mean that you cannot delete a read only folder. So, yes, you can write a file inside it...
Too bad... it means that the USB Stick trick remains the only cheap solution
Shpid3r
|
|
|
|
|
Thanks Shpid3r,
You are correct. It is my mistake to mis-understand what is read-only.
regards,
George
|
|
|
|
|
Dear Friends,
I want to write a program to lock an executable on the disk. For example, what i want is that whenever user clicks on calc.exe, a dialog box should appear showing 'Access Denied' message.
Please tel me what approach to use in order to develop such application. Please tell me relevant APIs or such article you aware of.
Imtiaz
|
|
|
|
|
Hi,
I have not heard about any APIs doing this. I suppose you know this can be done by user management but I am not sure this is your case. There are some tools written in a way that they change the executable itself so that it prompts for username and password. Another approach is to run a program in the background watching which exe is started but this approach has disadvantages either. Imagine someone kills this process and the executables may be started without problems. There may be APIs which do some user management if you wanna do it that way.
modified 7-Mar-17 16:43pm.
|
|
|
|
|
IIUC, you would have to manually set the security information on the file you are trying to "lock out". This is not easy to do, as messing with NT Security Objects and APIs is tricky.
It is also a sneaky thing to do, as a virus/malware application could do things like prevent task manager from running, to make it harder to kill the app.
Not something I would recommend doing, because it looks suspicious as hell.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Create an ACE for that file that denys execution.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|