|
Hello all,
I'm writing an application where I need to prevent users from deleting/moving/... files on my hard-disk. The only thing I found out is that you can do that for whole folders by use of ICopyHook. But are there other solutions, especially for single files, too?
Thanks,
Schlaubi
|
|
|
|
|
For single files you could set its attribute to write-protected. That would be the nicest way, because the user can still choose if he absolutely wants to delete the file.
However if you want to prevent the user from deleting/moving it during runtime, you could just open the file. The OS would not allow opened files to be deleted/moved.
|
|
|
|
|
Thanks for your hints, but I need to prevent the user form deleting any file on my disk. So both your solution will not work for me.
Thanks anyway!
|
|
|
|
|
Are you trying to build an anti-virus tool?
I don't think that is possible...
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Are you trying to build an anti-virus tool?
How did you come accross that idea? Do you write a virus and fear my tool?;)
No, in fact i wrote a "secure" browser for some kind of information terminals. And some kids tried (and even got it out ) how to delete files. That was the point I started to think about kind of forbid-to-delete-tool.
|
|
|
|
|
Maybe you can use File system access rights?
This would work under NT, 2K and XP prof.
The outdated(W95 to ME) and crippleware (XP Home) versions are out of the question, though.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Seems like I've to add another line.
I dont wanna play with access rights and that stuff - my goal is to prevent deleting only during runtime, not during the whole windows session.
But thanks for your hints anyway
|
|
|
|
|
Schlaubi wrote:
I dont wanna play with access rights and that stuff - my goal is to prevent deleting only during runtime, not during the whole windows session.
I do not think that I would <big>want</big> that to be possible - at least not with one of the "real" Windows versions. But I fear there could be some hook to do that.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
jhwurmbach wrote:
I do not think that I would want that to be possible - at least not with one of the "real" Windows versions.
Your opinion is not that wrong - under usual circumstances I would not want to have that, too. But in my special case I need it - for public information terminals available for everyone, also little hacker kids trying everything to get the system crashed.
|
|
|
|
|
Well, but then you only have ONE application running all day, and probably not IE6 with its deep OS integration.
Do not allow anyone to start any application, prevent your browser from calling a shell and no one will be able to delete a file.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
jhwurmbach wrote:
prevent your browser from calling a shell
That's a fact I never thought about - I only concentrated on a programmatical solution. But that did it! Thank you very much.
|
|
|
|
|
Hi,
How can i disable double clicking the maximise button?
If use HIWORD(GetQueueStatus(QS_ALLINPUT)); in wm_nclbuttonup.
it always returns 0,eventhough user has double clicked the maximise button.
|
|
|
|
|
hi,
have you written the code for single click too..if yes maybe thats the problem comment that bit and see if it works..
Himanshu
|
|
|
|
|
hi,
have you written the code for single click too..if yes maybe thats the problem comment that bit and see if it works..
Himanshu
|
|
|
|
|
I have been able to sniff network traffic by using raw socket. I want to block certain packets from entering the network. By making TTL 0, the program still receives the packet. Plz provide me with proper solution(i.e the proper mode of WSAIOCTL). Would it be possibe to block packets by just changing the mode and if there is something else to do plz suggest.
WSAIoctl(sniffsock, SIO_RCVALL, &optval, sizeof(optval), NULL, 0, &dwBytesRet, NULL, NULL);
Reply me soon
|
|
|
|
|
Hi all,
I am building an ActiveX control using MFC and I need to use it from RightToLeft.
I added the following statement at the beginning of the OnCreate procedure:
SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | 0x400000);
InvalidateControl();
The RightToLeft option works just great but I am facing a problem when moving the control at design time using the mouse. When I mouse my hand to the right, the control moves to the left and the same when I move my hand to the left the control moves to the right. Does anyone know how can I solve this issue? Note that when I move the control using the arrow keys, the directions are compatible with the control movement. Please help!
Thank You,
Da'ed
|
|
|
|
|
hi i am working on a MFC project and i use an ActiveX on my project. i can register my ActiveX with < Regsvr32 c:\Chart.ocx >. is there any problem if i register my activeX with this command every time my project starts ???? i mean if i run project.exe on another computer (that this ActiveX is not registered on it) then the project.exe will not run. So if i Register my activeX every time my project Starts then i will be sure that the ActiveX is registerd.
if i can Register it with installShield then Plz tell me the instruction !
thanx.
|
|
|
|
|
You can easily register it with InstallShield at the time you install your exe. In InstallShield, in the File Groups tab where you added the ocx file, there is a property in the properties window called “Self-Registered”, just set this property to “Yes” and your control will be registered by default when installing your Setup. This is better than registering the ocx every time you run your exe.
|
|
|
|
|
hey, i have a main dialog class CWhateverDlg , and it has a Cbutton control attached to a variable m_whatever. on click is mapped to a function CWhateverDlg::OnButton1(), and it does my stuff.
now, i also have a tab control , with a page with a button.
i want the button on the tab control to execute the code from the button i have already coded on main dialog when it is clicked.. is this possible.... i cant just copy the code because of scoping issues that will result.
basically i just need to trigger the button on the main dialog so that code runs as if it were the main dlg button being pressed.
todo....
:: insert inpirational text here ::
|
|
|
|
|
just give both buttons the same ID in resources or resource.h and I hope it does the work for you.
cheers
Himanshu
|
|
|
|
|
I spent about an hour solving a really similar problem today. I'm using a CPropertySheet derived class, that sits on a CFormView derived class, and the CPropertyPage classes each were supposed to have the Enter key hooked up to the default button on the CFormView derived class. I'm not on my dev machine right now, so I can't give code or exact answers, but if my situation sounds similar to yours, I can send you some code/answers tomorrow.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
You can have your CTab::OnButton() -handler send a Message (WM_APP +const or registered message) to your main window. A handler there would then just call the CWhateverDlg::OnButton1() function.
Alternatively, you could forge a WM_COMMAND for that Button and send it to your dialog, but I don't think that this is better.
Maybe you have no access to your dialog-class from the Tab-control-class: Then you could divert via a Handler in the MainFrame, which simply routes the same message to his child-dialog.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
thanks all, i will be trying this stuff out as soon as i get home and ill give a conclusion or further assistance post
todo....
:: insert inpirational text here ::
|
|
|
|
|
dear all,
your urgent attention is required!!!!!!!!!!!!!
I'm in a strange problem with absolutely no clues!
i'm using LogonUser(..) function with flag LOGON32_LOGON_INTERACTIVE to obtain the Administrator user token. The function returns ERROR_SUCCESS(0).
now i use the administrator token returned by the above function in CreateProcessAsUser(..).
the problem is that I get an error message ACCESS_DENIED (error code 5).
I even tried ImpersonateLoggedOnUser(..) (returns ERROR_SUCCESSS ) after LogonUser and then CreateProcess() or CreateProcessAsUser but still no respite from Error 5 (ACCESS_DENIED )
Is there anything else regarding security which needs to be done before calling CreateProcessAsUser(..) and after impersonating a user.
the code for is as follows:_
/*Calling LogonUser*/
BOOL bRes = LogonUser (sUserName.GetBuffer(sUserName.GetLength()) ,
sDomain.GetBuffer(sDomain.GetLength()) ,
sPassword.GetBuffer(sPassword.GetLength()) ,
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT,
&(hnd));
/*Now Impersonating the user */
ImpersonateLoggedOnUser(hnd); /*Returns ERROR_SUCCESS */
/*now calling CreateProcessAsUser or CreateProcess depending on success of ImpersonateLoggedOnUser */
BOOL bRes = CreateProcessAsUser(hUserToken,
NULL ,
clp,
NULL, NULL,
TRUE,
NORMAL_PRIORITY_CLASS,
NULL, NULL,
&start,
&process);
/* Returns ACCESS_DENIED */
is there Anything to do with the security descriptors or Am I missing something else crucial?
PLZ. Respond,
regards,
rishabhs
|
|
|
|
|
i'm surprized!!!!!!!!!!
this is the third time i've posted my problem,
only to find absolutely no clue or some piece of help from any of the techies around.
what's the matter?
is the problem impossible to rectify or is there something wrong with my face which prevents you from responding.
waiting for evaluation...........................
rishabhs
|
|
|
|