Home > Back-end >  What security pop-up usb mobile devices
What security pop-up usb mobile devices

Time:10-13

Had forgot it, recently found jinshan guards have a such assistant safe to pop up, also can restore, and reminded me of this feature.

In c + + builder how to implement.

CodePudding user response:

http://bbs.csdn.net/topics/220010199

CodePudding user response:

Is more complex,
Look at the example of c + +
http://bbs.csdn.net/topics/90082287

CodePudding user response:

CodePudding user response:

The
reference 3 floor ksrsoft response:
is more complex,
Look at the example of c + +
http://bbs.csdn.net/topics/90082287


In 7th floor in this way, can perform successfully, but U disk has not removed, there is no response.

The complete code is as follows:
 

#include
#include
#include
#include


Void __fastcall TForm1: : btn1Click (TObject * Sender)
{
HANDLE hDevice;//handle to the drive to be examined
BOOL bResult;//the results flag
BOOL bRet.
DWORD junk;//the discard the results
DWORD dwError;
//Open the volume
HDevice=CreateFile (" \ \ \ \. \ \ I: ",//drive to open
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,//share mode
NULL,//the default security attributes
OPEN_EXISTING,//disposition
0,//the file attributes
NULL);//don 't copy any file' s attributes

If (hDevice==INVALID_HANDLE_VALUE)//can 't open the drive
{
DwError=GetLastError ();
ShowMessage (" to create the file!" );
return ;
}

//Dismount on the volume
BResult=DeviceIoControl (
HDevice,//handle to volume
FSCTL_DISMOUNT_VOLUME,//dwIoControlCode tells them
NULL,//lpInBuffer
0,//nInBufferSize
NULL,//lpOutBuffer
0,//nOutBufferSize
& Junk,//the discard the count of bytes returned
(LPOVERLAPPED) NULL);//synchronous I/O
if (! BResult)//IOCTL failed
{
DwError=GetLastError ();
ShowMessage (" Fail to dismount on the volume!" );
}

//Close the volume handle
BRet=CloseHandle (hDevice);
if (! BRet)
{
DwError=GetLastError ();
ShowMessage (" Fail to close the handle!" );
}
The else
{
ShowMessage (" success!" );
}
}

CodePudding user response:

In addition, my U disk drive is "I", this is true, the back of the "success!" I added, have prompted the execution of the.

CodePudding user response:

Don't have U disk, evening go back and help you debug it.

CodePudding user response:

refer to 7th floor ccrun response:
don't have U disk, night back to help you debug it.


Well, thank you for your demon elder brother.

CodePudding user response:

Then top up...

CodePudding user response:

A novice with o! There is the source of that don't know how to compile, always make mistakes, novice forgive me

CodePudding user response:

Drain, just found this post I'd put a dove, I need the code? Please pick one,

CodePudding user response:

11 references ccrun response:
drain, just found this post I'd put a dove, I also need to code? Please pick one,


To be, demon elder brother, thank you.

CodePudding user response:

Microsoft mobile devices provide the security removed runtime does the equipment removed, just my computer mobile operators and mobile desktop tray equipment identifiers are not removed, so feel like code is invalid,

CodePudding user response:

http://support.microsoft.com/kb/165721/zh-cn
The replication can directly

CodePudding user response:

On the 14th floor sololie
reference response:

http://support.microsoft.com/kb/165721/zh-cnDirect copy can use the


Or there is a problem, when U disk file has been opened, is actually remove failure, but still show success, where can judge, and give the corresponding prompt information, is occupied by which application.

CodePudding user response:

My test is, if open U disk root directory, perform the root window automatically shut down after, my computer U disk drive double-click to open has no content, prompt inserted U disk, but the tray icon is still there,

CodePudding user response:

reference 16 floor sololie response:
my test is that if U disk open the root directory, perform the root window automatically shut down after, my computer U disk drive double-click to open has no content, prompt inserted U disk, but the tray icon is still there,


If U dish in the file is opened, is what I said above.

CodePudding user response:

Can iterate through all the first open the resources of the usb drive and close it again perform removed

CodePudding user response:

Or wait for old demon from view to inspect the code

CodePudding user response:

refer to the 18th floor sololie response:
can iterate through all the first open the resources of the usb drive and close it perform remove


Well, jinshan guards U disk assistant is like this, you will be prompted by any application, and then have a occupied the list of files to choose whether or not to shut down.

CodePudding user response:

Then traverse the open close U disk resources, perform removed, then SHChangeNotify, the rhythm is right,

CodePudding user response:

refer to 21st floor sololie response:
then traverse open shut U disk resources, perform removed, then SHChangeNotify, is this rhythm,


It is best to prompt, let users keep, shut down.

CodePudding user response:

This,,,, you are all already know how to do,

Old demon has come, estimates that in the test code to you for repair to share.

CodePudding user response:

reference 23 f sololie response:
this,,,, you are all already know how to do,

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related