It is currently March 28th, 2024, 11:46 pm

Plugin UDisk - detect and eject removable drives(in Beta)

Share and get help with Plugins and Addons
cfixd
Posts: 31
Joined: September 1st, 2014, 1:38 am

Plugin UDisk - detect and eject removable drives(in Beta)

Post by cfixd »

Plugin for showing the removable drives and eject them safely.
CD-ROM is not supported.
Problem: About 10 bytes (maybe) of RAM will be wasted in MultiThread mode in every eject.I've no idea how to do the clean up...

Use the code project:
http://www.codeproject.com/Articles/13839/How-to-Prepare-a-USB-Drive-for-Safe-Removal

Measure Options:

Parent Measure:

The number value returns the number of the drives in the list.
The string value returns the drive letters,like "EFG".

Drive= (Default: Removable)
All :Return all the drives.
UDisk :Return USB-disks,mobile harddisk is not included.
Removable :Return USB-disks,mobile harddisk is included.

Mode= (Default: MultiThread_Silent)
Normal :Remove device and show the balloon in about 15s for Win7.
Normal_Silent :Remove device in silence.
MultiThread :Remove device with single thread,which won't stop the rainmeter when ejecting.
MultiThread_Silent :Remove device in silence with single thread.

Exclude= (Optional)
A-Z :Drives to exclude from the list,e.g. Exclude=ABR .


Child Measure:

DriveMeasure= :The name of the Parent Measure

Drive= (Default: 1)
1-26 :Pick the drive letter from the parent measure

DriveSpace= (Default: 0)
0 :Whether the drive exists, 1 for true, 0 for false
1 :Free space, in Bytes, !SetOption or DynamicVariables=1 is need to get the maxvalue for bar, you can take the UDisk_Simple skin for example.
2 :Used
3 :Total

DriveLabel= (Default: 0)
0 :The string value returns the drive letter.
1 :Return the name of the drive.
2 :Return both, e.g. C: MyDrive

============================================

Use:

[MeasureUDisk]
Measure=Plugin
Plugin=UDisk
;Mode=MultiThread

[MeasureUDisk1]
Measure=Plugin
Plugin=UDisk
DriveMeasure=MeasureUDisk
Drive=1


Bang for Parent Measure:

Remove_X
e.g. Remove_E、Remove_F

RemoveDrive
Eject all the removable device in the list of parent measure.

RemoveAll
Not suggested, eject all the usb device, USB mouse may be included.

DisMount_X
Not suggested, for dismount SD cards for some old SD card-reader in laptop, not tested.


Bang for Child Measure:

Open
Open the drive in explorer.

Remove
Eject the drive.

============================================

I‘ve thought a lot whether to add the DriveSpace option. Finally I just add it and it's updated in child measure.

Example skin:(Right Click the (i)icon on top right to view the Introductions in English)
2.png
Indicator at bottom right corner (left click to open, right click to eject) :
3.png
UDisk_0.9.1.rmskin
PluginUDisk_SourceCode_0.9.1.rar
You do not have the required permissions to view the files attached to this post.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Plugin UDisk - detect and eject removable drives(in Beta)

Post by StArL0rd84 »

Awesome Plugin man
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Plugin UDisk - detect and eject removable drives(in Beta)

Post by balala »

Now after more then three years after the plugin has been published, I found something weird and I'm wondering if anyone else figured this out.
I'm working on a large suite, called Mirage, which I'd like to publish soon. One of its skins is one named Disks, which uses this plugin. Everything works very well, no problems so far. Now when I'm testing the suite, I installed it to a few other computers and here the problems related to this plugin came out. On some of the systems I installed the suite on, the plugin does work perfectly, however despite it is installed by the skin installer (so not even accidentally could install the not proper version), on other systems the plugin doesn't work at all. On these systems I get an Plugin: Unable to load "UDisk" (error 126) (Drives\Drives.ini - [MeasureUDisk]) error message and the UDisk plugin measures don't return anything. The same code on the working systems is returning everything perfectly. Can't find nothing which could explain this behavior for me: on both cases there are both x64 and x86 systems (most with Windows 7, but not just, Windows 10 also have been used for testing).
I have no ideas what's going on. On systems which the plugin doesn't work nothing helped. Could not get it to work. I tried reinstalling the plugin (although I was perfectly sure this won't help), tried to copy manually the UDisk.dll plugin, tried even to copy the not proper version of it (the x86 version on a x64 system or vice-versa - obviously this didn't help at all). Nothing helped, on these systems, the plugin refuses to work. On the systems where it does work, it works perfectly, no error messages, no problems, nothing.
Do anyone got this behavior?
Thanks anticipately for you eventual ideas.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Plugin UDisk - detect and eject removable drives(in Beta)

Post by balala »

Ups, sorry, I forgott to attach a sample skin, which works / not works on the appropriate systems.
If you want to try out this package, please after installing it, replace the Drive1 and Drive2 variables within the [Variables] section with the appropriate drive letters on your system, which are two removable drives on your system. Thanks.
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Plugin UDisk - detect and eject removable drives(in Beta)

Post by eclectic-tech »

The skin installs and functions without issues on my system:
Rainmeter 4.3.1.3321 (64-bit)
Language: English (1033)
Build time: 2019-09-22 7:26:11
Commit Hash: 0ba4dfc4
Windows 10 Pro 1903 64-bit (build 18362) - English (1033)
Path: C:\Program Files\Rainmeter\
SkinPath: C:\Users\{me}\Rainmeter\Skins\
SettingsPath: C:\Users\{me}\AppData\Roaming\Rainmeter\
IniFile: C:\Users\{me}\AppData\Roaming\Rainmeter\Rainmeter.ini

Sounds like an issue with the C++ runtime libraries you have installed.
I would be tempted to get the latest 32bit or 64bit (depending on your system) runtime installer for Visual Studio 2017 from https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads for each system that is generating the error, and see if that corrects the problem.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Plugin UDisk - detect and eject removable drives(in Beta)

Post by balala »

eclectic-tech wrote: October 31st, 2019, 8:02 pm Sounds like an issue with the C++ runtime libraries you have installed.
I would be tempted to get the latest 32bit or 64bit (depending on your system) runtime installer for Visual Studio 2017 from https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads for each system that is generating the error, and see if that corrects the problem.
First many thanks eclectic-tech, for your priceless reply. I appreciate it. :rosegift: :great:
Although I'm also not having problems on my own system I'm working on, I have an older computer, which I keep just for testing purposes. The described problem occurred on that one. I'm gonna test your idea now and will come back with the result soon. Let's see...
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Plugin UDisk - detect and eject removable drives(in Beta)

Post by balala »

eclectic-tech wrote: October 31st, 2019, 8:02 pm Sounds like an issue with the C++ runtime libraries you have installed.
I would be tempted to get the latest 32bit or 64bit (depending on your system) runtime installer for Visual Studio 2017 from https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads for each system that is generating the error, and see if that corrects the problem.
No, unfortunately didn't help, the plugin still doesn't work.
Here is my configuration on the computer on which the plugin doesn't work (just in case):

Rainmeter 4.3.1.3321 beta (32-bit)
Language: Romanian (1048)
Build time: 2019-09-13 16:33:17
Commit Hash: 0ba4dfc4
Windows 7 Ultimate 32-bit (build 7601) Service Pack 1 - Hungarian (1038)
Path: C:\Program Files\Rainmeter\
SkinPath: d:\My Documents\Rainmeter\Skins\
SettingsPath: C:\Users\{me}\AppData\Roaming\Rainmeter\
IniFile: C:\Users\{me}\AppData\Roaming\Rainmeter\Rainmeter.ini
oZone
Posts: 154
Joined: May 14th, 2018, 4:46 pm

Re: Plugin UDisk - detect and eject removable drives(in Beta)

Post by oZone »

Hi also think it's issue with the C++ runtime libraries.

I may try to refactor code later.
But for now try these DLLs.
Code is same with only some small cosmetics, and bump version.

Udisk_recompiled.zip
contains recompiled plugin with newer compiler, ...

Udisk_no_MSVCR_DLL.zip
contains compiled plugin which doesn't rely on installed MSVCR DLLs

I did not test them as I am currently busy, so they may not work.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Plugin UDisk - detect and eject removable drives(in Beta)

Post by balala »

oZone wrote: November 2nd, 2019, 4:48 pm Code is same with only some small cosmetics, and bump version.
Thank you oZone for your post. Both plugins are working well. :thumbup:
So, a few comments are needed, I think. I tried them onto a computer on which previously I installed Visual Studio 2017 (based on eclectic-tech's post). Would be curious to know if your plugins were working before I installed VS.
Right now I'm planning to use your plugin. Question is, what is your recommendation which of the two plugins to use? I'd say the UDisk recompiled, because it's smaller, but what is your recommendation?
I also tried the plugin onto a computer which worked with the old (original) plugin as well. Working these new versions as well.
On Monday I'm gonna test the plugins onto another computer. On weekend I have no access to it, but on Monday I'll see how does it work.
Will be back when have new answers. Thanks again.
oZone
Posts: 154
Joined: May 14th, 2018, 4:46 pm

Re: Plugin UDisk - detect and eject removable drives(in Beta)

Post by oZone »

balala wrote: November 2nd, 2019, 9:44 pm Thank you oZone for your post. Both plugins are working well. :thumbup:
So, a few comments are needed, I think. I tried them onto a computer on which previously I installed Visual Studio 2017 (based on eclectic-tech's post). Would be curious to know if your plugins were working before I installed VS.
Right now I'm planning to use your plugin. Question is, what is your recommendation which of the two plugins to use? I'd say the UDisk recompiled, because it's smaller, but what is your recommendation?
I also tried the plugin onto a computer which worked with the old (original) plugin as well. Working these new versions as well.
On Monday I'm gonna test the plugins onto another computer. On weekend I have no access to it, but on Monday I'll see how does it work.
Will be back when have new answers. Thanks again.
I think if you have installed Visual C++ 2013 Redistributable or Visual C++ 2012 Redistributable original plugin will work.

This mess is caused by MS. Fortunately the latest Visual C++ 2015-2019 Redistributable share the same redistributable files.
To be sure user should use latest version Visual C++ Redistributable for these "years" 2005, 2008, 2010, 2012, 2013, 2015-2019.

Personally I have only 2010, 2012, 2013, 2015-2019, as some older apps require specific "year".

With recompiled one you expect that user will have Visual C++ 2015-2019 Redistributable installed.

For this plugin I would use the one with no Visual C++ Redistributable dependency (Udisk_no_MSVCR_DLL.zip), to be safe,
unless you expect/want all your users to have latest Visual C++ 2015-2019 Redistributable.