Google / YouTube can find all
i have 4 questions:
1st question: How can i make a mount or unmount program or application.
(ISO Opener )
2nd question: How can i make an application that hides a program.
3rd question: Application that ejects a flash drive.
4th question: How can i make an application that unmounts a iso file if you mount it using a magic disk ? thanks
Thanks in advance !! Wish you help me every time i ask
Last edited by blackgaming; 01-24-2011 at 07:46 AM.
Google / YouTube can find all
[IMG]https://i1171.photobucke*****m/albums/r543/Ferzato/separator.png[/IMG]
Former Middleman
07-07-2011 - 09-13-2011
[IMG]https://i1171.photobucke*****m/albums/r543/Ferzato/separator.png[/IMG]
Skype: mpgh.flash
MSN: mpgh.flash@msn.com
“I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.”
- Eminem
1st question: 3rd Party, Magic ISO and MountISO , ISODisk, daemon tools...There are plenty of free applications, If you want to do it programatically....
You will have to do some decent work , or I would suggest the 3rd party API's the exist for numerous ISO mounters and Burners.
2nd question: IMO, windows services is the best bet, however we don't condone discussion of an application that has malicious intent, yes this is a hacking forum, but game hacking (items you legally own) , so please before anyone answers, tell us your intentions.
3rd question: If you mean programatically again, Look up MCISendString API, and P/invoke, .net framework does not support it without API (as of yet) however it is not to hard to do, but code example for anything other then MCISendString API will be too long, alittle research on those will help though.
"Eject Removable Media with MCISendString API" or "Eject Removable media using P/invoke"
4th question: same as the other question, unmounting the ISO will work using the same API to mount it. However (I have not tested it) You can try "ejecting" the ISO as a DVD/CD using the MCISendString API as well, can't say it wil lwork, but mount a ISO and give it a shot, considering ISO's are mounted as virtual DVD/CD drives it may work.
I want the codes sir do you have codes ?
in my 3rd and 4th question ?
I want the codes sir do you have codes ?
in my 3rd and 4th question ?
1: Have a look at the open source SharpZipLib. It mainly extracts Zip, GZip, Tar files, but I believe it can easily extract or create the image files for you. There's a wide range of settings you can apply during extraction and packaging. Here's the link to download libraries and source code:
SharpZipLib
2: Sounds like you don't have good intentions. I would never hide an application. Truly hiding the application is beyond the scope of your knowledge as I see. Windows service can be an alternative but it has limitations, so you don't have significant freedom.
3: Following is the MSDN standard code for enumerating and ejecting all or a particular USB storage device:
[highlight=vbnet]Private Const CM_DRP_DEVICEDESC As Integer = &H1
Private Const CM_DRP_DEVTYPE As Integer = &H1A
Private Const CM_DRP_HARDWAREID As Integer = &H2
Public DevType As Integer
Public HARDWAREID As String
Public DEVICEDESC As String
Private Declare Function SetupDiGetClassDevs Lib "setupapi.dll" Alias "SetupDiGetClassDevsA" ( _
ByRef ClassGuid As Guid, _
ByVal Enumerator As Integer, _
ByVal HwndParent As IntPtr, _
ByVal flags As Integer) As IntPtr
Private Declare Function SetupDiEnumDeviceInfo Lib "setupapi.dll" (ByVal DeviceInfoSet As IntPtr, ByVal MemberIndex As Integer, ByRef DeviceInfoData As SP_DEVINFO_DATA) As Integer
Private Declare Function SetupDiDestroyDeviceInfoList Lib "setupapi.dll" (ByVal DeviceInfoSet As IntPtr) As Integer
'returns proprities of a device by his DevInstance
Private Declare Function CM_Get_DevNode_Registry_Property Lib "cfgmgr32.dll" Alias "CM_Get_DevNode_Registry_PropertyA" ( _
ByVal dnDevInst As IntPtr, _
ByVal ulProperty As Integer, _
ByRef pulRegDataType As Integer, _
ByRef Buffer As Integer, _
ByRef pulLength As Integer, _
ByVal ulFlags As Integer) As Integer
Private Declare Function CM_Get_DevNode_Registry_Property Lib "cfgmgr32.dll" Alias "CM_Get_DevNode_Registry_PropertyA" ( _
ByVal dnDevInst As IntPtr, _
ByVal ulProperty As Integer, _
ByRef pulRegDataType As Integer, _
ByVal Buffer As StringBuilder, _
ByRef pulLength As Integer, _
ByVal ulFlags As Integer) As Integer
Public Structure SP_DEVINFO_DATA
Dim cbSize As Integer
Dim ClassGuid As Guid
Dim DevInst As IntPtr
Dim Reserved As Integer
End Structure
Public Enum PNP_VETO_TYPE
PNP_VetoTypeUnknown
PNP_VetoLegacyDevice
PNP_VetoPendingClose
PNP_VetoWindowsApp
PNP_VetoWindowsService
PNP_VetoOutstandingOpen
PNP_VetoDevice
PNP_VetoDriver
PNP_VetoIllegalDeviceRequest
PNP_VetoInsufficientPower
PNP_VetoNonDisableable
PNP_VetoLegacyDriver
End Enum
Private Declare Function CM_Request_Device_Eject Lib "setupapi.dll" Alias "CM_Request_Device_EjectW" (ByVal dnDevInst As IntPtr, _
ByRef pVetoType As PNP_VETO_TYPE, _
ByVal pszVetoName As IntPtr, _
ByVal ulNameLength As Integer, _
ByVal ulFlags As Integer) As Integer
<Flags()> _
Public Enum DeviceFlags As Integer
DigCFDefault = 1
DigCFPresent = 2 ' return only devices that are currently present
DigCFAllClasses = 4 ' gets all classes, ignores the guid...
DigCFProfile = 8 ' gets only classes that are part of the current hardware profile
DigCDDeviceInterface = 16 ' Return devices that expose interfaces of the interface class that are specified by ClassGuid.
End Enum
Public Sub EnumDevices()
Dim dwInstance As Integer
Dim hDevInfo As IntPtr 'pointer on a Device Information Set
Dim DevInfo As New SP_DEVINFO_DATA 'contains inforations on a Device
'We ask for a Device Information Set
hDevInfo = SetupDiGetClassDevs(Guid.Empty, 0, IntPtr.Zero, DeviceFlags.DigCFPresent Or DeviceFlags.DigCFAllClasses)
DevInfo.cbSize = Marshal.SizeOf(DevInfo)
If hDevInfo = New IntPtr(-1) Then Return
dwInstance = 0
Do
If SetupDiEnumDeviceInfo(hDevInfo, dwInstance, DevInfo) = 0 Then
SetupDiDestroyDeviceInfoList(hDevInfo)
Exit Do
End If
Me.DevType = CM_ReadDevicePropertyInteger(DevInfo.DevInst, CM_DRP_DEVTYPE)
Me.HARDWAREID = CM_ReadDevicePropertiyString(DevInfo.DevInst, CM_DRP_HARDWAREID)
Me.DEVICEDESC = CM_ReadDevicePropertiyString(DevInfo.DevInst, CM_DRP_DEVICEDESC)
If DEVICEDESC = "USB Mass Storage Device" Then
CM_Request_Device_Eject(DevInfo.DevInst, 0, IntPtr.Zero, 0, 0)
End If
dwInstance += 1
Loop
End Sub
Private Function CM_ReadDevicePropertyInteger(ByVal DevInst As IntPtr, ByVal iCustomPropertyName As Integer) As Integer
Dim ret As Integer, dwReqLen As Integer = 4, regDataType As Integer
CM_Get_DevNode_Registry_Property(DevInst, iCustomPropertyName, regDataType, ret, dwReqLen, 0)
Return ret
End Function
Private Function CM_ReadDevicePropertiyString(ByVal DevInst As IntPtr, ByVal iCustomPropertyName As Integer) As String
Dim sbBuff As StringBuilder, dwReqLen As Integer, regDataType As Integer
dwReqLen = 0
CM_Get_DevNode_Registry_Property(DevInst, iCustomPropertyName, regDataType, 0, dwReqLen, 0)
sbBuff = New StringBuilder(dwReqLen)
CM_Get_DevNode_Registry_Property(DevInst, iCustomPropertyName, regDataType, sbBuff, dwReqLen, 0)
Return sbBuff.ToString()
End Function[/highlight]
What you just need to do is that when you enumerate through devices in the EnumDevices Function, check the particular device by matching your criteria and then eject it. In this case, you need to modify the following code:
[highlight=vbnet]If DEVICEDESC = "USB Mass Storage Device" Then
CM_Request_Device_Eject(DevInfo.DevInst, 0, IntPtr.Zero, 0, 0)
End If[/highlight]
All the code is there for you. If you are unable to modify 2 lines, I can't see you achieving that.
Hassan (01-25-2011)
May I ask why you want this?
@ Hassan, In regards to windows services. Every windows OS can display running services, it is a matter of hiding them from running processes. I know that task manager on win7 has a services tab, and I know there is a way to do it otherwise, However I feel this is the best way.
@ Born2Amuse and Sharp2develop, He is looking to mount an ISO
And from what I remember ZipSharpLib is soley for compressing files, not even sure (though I could be wrong) it supports ISO compression, The best bet is still a API for a 3rd party application .
If he wanted to make ISO's then you can use VB.net to do so, don't need an open source project, it is actually quite simple in the scheme of things. So I don't suggest the LIB at all, not for what he needs, nor as a replacement for just coding it yourself in vb.net, at least in that case a vb.net user can have easy modifications.
Just because someone else didn't know, just to verify you do, mounting a ISO is Completely different then Compressing files into a ISO.
@ Born2amuse in regards to windows services, there are numerous unmanged calls that can be made to help to hide the window after the application has started, however , it is wise to use windows Services to run a application as a hidden background process, , Even if you can manage to hide the application by using some of these unmanaged calls, then what you are neglecting is that the application is still using the UI thread as it's main thread, Windows services are not and don't have UI, again there are other ways, but what limitations really matter in this particular situation? Feel free to show me the limitations that are relevant here or to the OP.
Also, At your code example from MSDN (I'm sure you noticed this) but must have missed it, but, this was taken from a class, the class itself should be added, and then a little more then just changing the device, You also need to call the class and the SUB.
That code checks the device description, in this case you want to leave it alone..because it will do what you want without modifications.What you just need to do is that when you enumerate through devices in the EnumDevices Function, check the particular device by matching your criteria and then eject it. In this case, you need to modify the following code:
vbnet Code:
If DEVICEDESC = "USB Mass Storage Device" Then
CM_Request_Device_Eject(DevInfo.DevInst, 0, IntPtr.Zero, 0, 0)
End If
The namespace imports into that class + Creating a class (because that is written to be a class or module), plus the class import into the form (because you can't reference the class without it), Plus calling the sub (as it calls the functions), don't forget all that, oh and why modify those lines? It is meant to be like that, What would you change it to?All the code is there for you. If you are unable to modify 2 lines, I can't see you achieving that.
Also, you may need to make the subs and functions shared, if not then you can add the code to your form, I would suggest a region, but even with that, you will still have to modify everything above, plus you wouldn't touch that line of code unless you are checking for a different type entirely.
If anything, I would just use it as a module, add a new function to manage everything outside the module and use it solely as a base.
Edit:
Let me clarify for Hassan, because he never listens, I am not saying You CANT modify those lines, I am not saying there is no reason to modify those lines, I am saying if the OP needs to eject a usb storage device (flash media device) then the code is sufficient without modifying that particular line of code.
That is what I mean.
Last edited by NextGen1; 01-25-2011 at 09:01 AM.
Windows services have a special tab in task manager. All the windows services are listed there what so ever. So, if the user has a little sense or finds some unusual behavior on his system, he can easily go to that tab and stop the service. Not a practical solution at all.Hassan, In regards to windows services. Every windows OS can display running services, it is a matter of hiding them from running processes.
NextGen1 (01-25-2011)
Agree, not practical, but a working solution, not practical soley based on the intellegence and know how of the user.
I feel that it is currently the best way (for now) I also expressed, I know another method (using the unmanaged calls) to hide a window, which is what the OP wants, However, I will not share it for obvious reasons (like the fact the I have in place a "protect members guideline" which forbids discussion of doing anything or helping with anything that can be used to harm MPGH members. )@Hassan, In regards to windows services. Every windows OS can display running services, it is a matter of hiding them from running processes. I know that task manager on win7 has a services tab, and I know there is a way to do it otherwise, However I feel this is the best way.
So with that said, it makes the answer , windows services as the current best solution.
(keeping in mind, that I won't release the other way)
-------------------------------------
Edit: To clarify again, I mean no disrespect to born2amuse, in fact , I like him a lot, think he is talented and hopefully in time he can join myself , jason, kevin and hassan in some application development, but I am expressing the code will work as is, to avoid confusion to the OP, I will point out what was referring to.
To better help the op, here is what born2amuse forgot to explain.
If you are looking to eject a usb mass storage device (phones connected as usb storage device, External harddrives, flash media drives, and in some cases SDcards (if the SD card reader is connected via USB setup within the PC) , then currently the code is sufficient.
What you need to do first is (using the main form instead of a class or module, this way you can avoid changing the subs and functions to shared functions)
[highlight=vb]
'In the namespace, Above Public class form1
' These are needed for marshal and the stringbuilder
'Mpgh Filter is blocking part of the code, it is System. Runtime . .interopservices
'minus the space.
Imports System****ntime.InteropServices
Imports System.Text
[/highlight]
now, though it isn't as clean as using a separate class, add all the code above in between Public class form1(or form name) and end class
[highlight=vb]
'the is the imports into the namespace from before
Imports System****ntime.InteropServices
Imports System.Text
' here is the Formname class as mentioned before
Public Class Form1
Private Const CM_DRP_DEVICEDESC As Integer = &H1
Private Const CM_DRP_DEVTYPE As Integer = &H1A
Private Const CM_DRP_HARDWAREID As Integer = &H2
Public DevType As Integer
Public HARDWAREID As String
Public DEVICEDESC As String
Private Declare Function SetupDiGetClassDevs Lib "setupapi.dll" Alias "SetupDiGetClassDevsA" ( _
ByRef ClassGuid As Guid, _
ByVal Enumerator As Integer, _
ByVal HwndParent As IntPtr, _
ByVal flags As Integer) As IntPtr
Private Declare Function SetupDiEnumDeviceInfo Lib "setupapi.dll" (ByVal DeviceInfoSet As IntPtr, ByVal MemberIndex As Integer, ByRef DeviceInfoData As SP_DEVINFO_DATA) As Integer
Private Declare Function SetupDiDestroyDeviceInfoList Lib "setupapi.dll" (ByVal DeviceInfoSet As IntPtr) As Integer
'returns proprities of a device by his DevInstance
Private Declare Function CM_Get_DevNode_Registry_Property Lib "cfgmgr32.dll" Alias "CM_Get_DevNode_Registry_PropertyA" ( _
ByVal dnDevInst As IntPtr, _
ByVal ulProperty As Integer, _
ByRef pulRegDataType As Integer, _
ByRef Buffer As Integer, _
ByRef pulLength As Integer, _
ByVal ulFlags As Integer) As Integer
Private Declare Function CM_Get_DevNode_Registry_Property Lib "cfgmgr32.dll" Alias "CM_Get_DevNode_Registry_PropertyA" ( _
ByVal dnDevInst As IntPtr, _
ByVal ulProperty As Integer, _
ByRef pulRegDataType As Integer, _
ByVal Buffer As StringBuilder, _
ByRef pulLength As Integer, _
ByVal ulFlags As Integer) As Integer
Public Structure SP_DEVINFO_DATA
Dim cbSize As Integer
Dim ClassGuid As Guid
Dim DevInst As IntPtr
Dim Reserved As Integer
End Structure
Public Enum PNP_VETO_TYPE
PNP_VetoTypeUnknown
PNP_VetoLegacyDevice
PNP_VetoPendingClose
PNP_VetoWindowsApp
PNP_VetoWindowsService
PNP_VetoOutstandingOpen
PNP_VetoDevice
PNP_VetoDriver
PNP_VetoIllegalDeviceRequest
PNP_VetoInsufficientPower
PNP_VetoNonDisableable
PNP_VetoLegacyDriver
End Enum
Private Declare Function CM_Request_Device_Eject Lib "setupapi.dll" Alias "CM_Request_Device_EjectW" (ByVal dnDevInst As IntPtr, _
ByRef pVetoType As PNP_VETO_TYPE, _
ByVal pszVetoName As IntPtr, _
ByVal ulNameLength As Integer, _
ByVal ulFlags As Integer) As Integer
<Flags()> _
Public Enum DeviceFlags As Integer
DigCFDefault = 1
DigCFPresent = 2 ' return only devices that are currently present
DigCFAllClasses = 4 ' gets all classes, ignores the guid...
DigCFProfile = 8 ' gets only classes that are part of the current hardware profile
DigCDDeviceInterface = 16 ' Return devices that expose interfaces of the interface class that are specified by ClassGuid.
End Enum
Public Sub EnumDevices()
Dim dwInstance As Integer
Dim hDevInfo As IntPtr 'pointer on a Device Information Set
Dim DevInfo As New SP_DEVINFO_DATA 'contains inforations on a Device
'We ask for a Device Information Set
hDevInfo = SetupDiGetClassDevs(Guid.Empty, 0, IntPtr.Zero, DeviceFlags.DigCFPresent Or DeviceFlags.DigCFAllClasses)
DevInfo.cbSize = Marshal.SizeOf(DevInfo)
If hDevInfo = New IntPtr(-1) Then Return
dwInstance = 0
Do
If SetupDiEnumDeviceInfo(hDevInfo, dwInstance, DevInfo) = 0 Then
SetupDiDestroyDeviceInfoList(hDevInfo)
Exit Do
End If
Me.DevType = CM_ReadDevicePropertyInteger(DevInfo.DevInst, CM_DRP_DEVTYPE)
Me.HARDWAREID = CM_ReadDevicePropertiyString(DevInfo.DevInst, CM_DRP_HARDWAREID)
Me.DEVICEDESC = CM_ReadDevicePropertiyString(DevInfo.DevInst, CM_DRP_DEVICEDESC)
If DEVICEDESC = "USB Mass Storage Device" Then
CM_Request_Device_Eject(DevInfo.DevInst, 0, IntPtr.Zero, 0, 0)
End If
dwInstance += 1
Loop
End Sub
Private Function CM_ReadDevicePropertyInteger(ByVal DevInst As IntPtr, ByVal iCustomPropertyName As Integer) As Integer
Dim ret As Integer, dwReqLen As Integer = 4, regDataType As Integer
CM_Get_DevNode_Registry_Property(DevInst, iCustomPropertyName, regDataType, ret, dwReqLen, 0)
Return ret
End Function
Private Function CM_ReadDevicePropertiyString(ByVal DevInst As IntPtr, ByVal iCustomPropertyName As Integer) As String
Dim sbBuff As StringBuilder, dwReqLen As Integer, regDataType As Integer
dwReqLen = 0
CM_Get_DevNode_Registry_Property(DevInst, iCustomPropertyName, regDataType, 0, dwReqLen, 0)
sbBuff = New StringBuilder(dwReqLen)
CM_Get_DevNode_Registry_Property(DevInst, iCustomPropertyName, regDataType, sbBuff, dwReqLen, 0)
Return sbBuff.ToString()
End
End Function
'here is the end class for form1(or form name)
End Class
[/highlight]
Now if you want to eject a USB mass storage device (anything in the list I listed above)
then you need not edit anything else.
Just "fire" the enumdevices sub, You can (if you like) take advantage of the functions in there as well, but enumdevices calls these functions for you and are "preset" to do what you want it to.
[highlight=vbnet]
'can do this wherever you like. button event, form load, w/e
'as a test do it on form load.
'plug in any one of the devices listed above.
'add this to from1 load event
Enumdevices()
[/highlight]
Test application (debug) and it should eject the device.
I tested it with my Seagate 1TB and it worked fine.
So thank born2amuse for the code And MSDN really.
I'm just pointing out the things overlooked, and you don't need to modify those 2 lines of code, for what you need it for it works "out of the box"
Last edited by NextGen1; 01-25-2011 at 02:16 PM.
I agree with you, but if the OP can't even call the sub procedure him self then, I don't think he should be even asking that question.
Also, as for the ejection part. There are at least 4 constants in the enumeration that can be uniquely used to identify the USB device. So, if he wants to eject a particular USB device, the code in its original form will not work. You definitely need a condition that checks for a particular USB either by its letter name / name / GUID.
I'll say that he forgot to spoon feed the OP completely, rather than providing full solution.
Last edited by NextGen1; 01-25-2011 at 04:01 PM.
sirs i just want to remove my usb even it is not safe ... when i used your codes a message box always appear.. it saids that usb cannot be bla bla bla.. thats my problem.. do you have codes that ejects even that it is not safe?
Donate:
BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9
Handy Tools/Hacks:
Extreme Injector v3.7.3
A powerful and advanced injector in a simple GUI.
Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!
Minion Since: 13th January 2011
Moderator Since: 6th May 2011
Global Moderator Since: 29th April 2012
Super User/Unknown Since: 23rd July 2013
'Game Hacking' Team Since: 30th July 2013
--My Art--
[Roxas - Pixel Art, WIP]
[Natsu - Drawn]
[Natsu - Coloured]
All drawings are coloured using Photoshop.
--Gifts--
[Kyle]
NextGen1 (01-26-2011)