IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Eject Usb And Firewire Drives, with this plugin
Kalonji
post Dec 3 2003, 03:51 PM
Post #1


Silver Member
***

Group: Members
Posts: 331
Joined: 15-November 03
Member No.: 2,579



This tiny prog can unmount attached FireWire or USB drives.

Now I can remove my USB stick without the risk of loosing data (AFAIK PE lacks of this functionality or I just don't know how to do it).
There are more options such as device id or device name. Refer to the commandline output for the syntax of DevEject.

@Bart: I've adapted your checkdisk.cmd to fit my needs. wink.gif

deveject.cmd
CODE
@echo off
rem deveject.cmd
rem Created by Bart Lagerweij, modified by Kalonji
setlocal
echo DEVEJECT.CMD: Starting...
echo.
%~d0
cd "%~dp0"
set _drive=
echo Please enter the drive to unmount (for example "x:" or "all" for all
echo attached USB mass storage devices)...
set /p _drive=Enter drive:
if "%_drive%" == "" goto _end
if "%_drive%" == "all" goto _all
:_run
echo Running: deveject.exe -EjectDrive:%_drive%
deveject.exe -EjectDrive:%_drive%
echo.
goto _end
:_all
echo Running: deveject.exe -EjectName:"USB Mass Storage Device"
deveject.exe -EjectName:"USB Mass Storage Device"
echo.
goto _end
:_end
echo.
pause
endlocal


deveject.inf
CODE
; deveject.inf
; PE Builder v3 plug-in INF file for DevEject
; Created by Bart Lagerweij

[Version]
Signature= "$Windows NT$"

[PEBuilder]
Name="DevEject"
Enable=1
Help="deveject.htm"

[WinntDirectories]
a=Programs\deveject,2

[SourceDisksFiles]
deveject.cmd=a,,1
deveject.exe=a,,1

[Append]
nu2menu.xml, deveject_nu2menu.xml


deveject_nu2menu.xml
CODE
<!-- Nu2Menu entry for DevEject -->
<NU2MENU>
    <MENU ID="Storage">      
 <MITEM TYPE="ITEM" DISABLED="@Not(@FileExists(@GetProgramDrive()\Programs\deveject\deveject.cmd))" CMD="RUN" FUNC="@GetProgramDrive()\Programs\deveject\deveject.cmd">DevEject</MITEM>
    </MENU>
</NU2MENU>


deveject.htm
CODE
<html>
<head></head>
<body>
<i>PE Builder v3 plugin</i>
<hr>
<h1>DevEject</h1>
<h3>Plugin by Kalonji</h3>
<a target="_blank" href="http://www.heise.de/ct/03/25/links/206.shtml">DevEject</a>
by Matthias Withopf (c't magazine).<br>
<br>
DevEject is created to unmount external storage devices such as FireWire or USB drives<br>
by entering the corresponding driveletter. DevEject is free for use!
<br>
<br>
Before you can use the plugin you must copy some files to the plugin directory.<br>
<a target="_blank" href="ftp://ftp.heise.de/pub/ct/listings/0316-208.zip">Download</a> DevEject.
Copy the following files into
the <tt>plugin\deveject</tt> directory:<br>
<tt>deveject.cmd, deveject.exe, deveject.inf, deveject.htm, deveject_nu2menu.xml</tt><br>
<br>
<hr>
<i>PE Builder
Copyright (c) 2002-2003 Bart Lagerweij. All rights reserved.</i><br>
</body>
</html>


Cheers, Kalonji.


--------------------
Smash forehead on keyboard to continue.....
Go to the top of the page
 
+Quote Post
Kalonji
post Dec 29 2003, 12:34 PM
Post #2


Silver Member
***

Group: Members
Posts: 331
Joined: 15-November 03
Member No.: 2,579



I've revised my deveject.cmd and added an exit routine for easy use.

Kind reagrds, Kalonji

deveject.cmd
CODE
@echo off

rem deveject.cmd
rem Created by Kalonji
rem Version 1.1

title DevEject

setlocal

%~d0
cd "%~dp0"

:_inp
cls
set _drive=
echo DEVEJECT.CMD: Starting...
echo.
echo Please enter the drive to unmount (eg: "x" or "all" for all
echo attached USB Mass Storage Devices).
echo.
echo Press [ENTER] to abort.
echo.
echo.
set /p _drive=Enter drive:
echo.
if "%_drive%" == "" goto _ext
if "%_drive%" == "all" goto _all

:_run
echo Running: deveject.exe -EjectDrive:%_drive%:
echo.
deveject.exe -EjectDrive:%_drive%:
goto _ext

:_all
echo Running: deveject.exe -EjectName:"USB Mass Storage Device"
echo.
deveject.exe -EjectName:"USB Mass Storage Device"
goto _ext

:_ext
set _exit=
echo.
echo Do you want to exit?
echo.
echo.
set /p _exit=Enter [Y]es or [N]o:
if /I "%_exit%" == "" goto _ext
if /I "%_exit%" == "n" goto _inp
if /I "%_exit%" == "y" goto _end

:_end
endlocal


--------------------
Smash forehead on keyboard to continue.....
Go to the top of the page
 
+Quote Post
Stever
post Dec 29 2003, 09:33 PM
Post #3


Member
**

Group: Members
Posts: 61
Joined: 19-December 03
Member No.: 3,183



Great work. Thanks! wink.gif

Steve Smith
Go to the top of the page
 
+Quote Post
SLiC
post Jan 1 2004, 10:35 AM
Post #4


Member
**

Group: Members
Posts: 11
Joined: 23-December 03
From: Belleville Ontario Canada
Member No.: 3,217



Forgive my ignorance, but should deveject.cpp be included in the deveject.inf to be copied to the PE build?
Go to the top of the page
 
+Quote Post
Former_Z.C._post
post Jan 1 2004, 06:05 PM
Post #5





Guests






QUOTE (SLiC @ Jan 1 2004, 10:35 AM)
Forgive my ignorance, but should deveject.cpp be included in the deveject.inf to be copied to the PE build?

No, deveject.cpp is the source code and is included with the app in case someone wants to 1) use it in their own app, 2) just curious about how it works, or 3) modify it to do more or fix a bug and rebuild it themselves

Deveject.cpp is NOT required to run the app.

ZC
Go to the top of the page
 
+Quote Post
Kalonji
post Jan 1 2004, 06:13 PM
Post #6


Silver Member
***

Group: Members
Posts: 331
Joined: 15-November 03
Member No.: 2,579



@slic:

Nope it's just the c++ source code of deveject. No need to be included into pebldr.

Regards, Kalonji


--------------------
Smash forehead on keyboard to continue.....
Go to the top of the page
 
+Quote Post
Kalonji
post Jan 5 2004, 06:53 AM
Post #7


Silver Member
***

Group: Members
Posts: 331
Joined: 15-November 03
Member No.: 2,579



Here's the new version of my deveject.cmd.

Changes:

- Startup menu added
- Eject FireWire devices in frontend
- Commandline input
- List removable and all devices

Regards, Kalonji

CODE
@echo off

REM deveject.cmd
REM Created by Kalonji
REM Version 1.2

echo DEVEJECT.CMD: Starting...

setlocal

%~d0
cd "%~dp0"

:_tsk
title DevEject
set _task=
cls
echo What do you want to do?
echo.
echo 1: Unmount device(s)
echo 2: Commandline input
echo 3: List removeable devices
echo 4: List all (also unremoveable) devices
echo.
echo Press [ENTER] to exit
echo.
set /p _task=Enter task:
echo.
if "%_task%" == "" goto _ext
cls
if "%_task%" == "1" goto _inp
if "%_task%" == "2" goto _cmd
if "%_task%" == "3" goto _lst
if "%_task%" == "4" goto _lstall

:_inp
title DevEject - Unmount devices
cls
set _drive=
echo Please enter the drive to unmount (eg: "x" for drive letter,
echo "usb" for all attached USB Mass Storage Devices or
echo "fw" for all attached FireWire devices).
echo.
echo Press [ENTER] to abort.
echo.
set /p _drive=Enter drive:
echo.
if "%_drive%" == "" goto _ext
if "%_drive%" == "usb" goto _usb
if "%_drive%" == "fw" goto _fw

:_run
echo Running: deveject.exe -EjectDrive:%_drive%:
echo.
deveject.exe -EjectDrive:%_drive%:
goto _ext

:_usb
echo Running: deveject.exe -EjectName:"USB Mass Storage Device"
echo.
deveject.exe -EjectName:"USB Mass Storage Device"
goto _ext

:_fw
echo Running: deveject.exe -EjectId:SBP2*
echo.
deveject.exe -EjectId:SBP2*
goto _ext

:_cmd
title DevEject - Commandline
echo Running: cmd /k deveject.exe
echo.
echo Usage: "deveject.exe -EjectDrive:<Drive>|-EjectName:<Name>|-EjectId:<DeviceId> [-v] [-Debug]"
echo.
echo You don't need to type the whole name or ID, you can also use "*" as wildcard.
echo.
echo Example 1: deveject -EjectDrive:x:
echo Example 2: deveject -EjectName:"USB ...*"
echo Example 3: deveject -EjectId:USB\...*
echo.
echo The following device(s) can be removed by the device name or device ID.
echo The 1st block ('...') of the program output describes the device name,
echo the 2nd block ('...\...\...') describes the device ID.
echo.
cmd /k deveject.exe
endlocal
exit

:_lst
echo Running: deveject.exe
echo.
deveject.exe
echo.
pause
goto _tsk

:_lstall
echo Running: deveject.exe -v
echo.
deveject.exe -v
echo.
pause
goto _tsk

:_ext
set _exit=
echo.
echo Do you want to exit?
echo.
echo.
set /p _exit=Enter [Y]es or [N]o:
if /I "%_exit%" == "" goto _ext
if /I "%_exit%" == "n" goto _tsk
if /I "%_exit%" == "y" goto _end

:_end
endlocal
exit


--------------------
Smash forehead on keyboard to continue.....
Go to the top of the page
 
+Quote Post
SportinSS
post Jan 17 2004, 11:27 PM
Post #8


Silver Member
***

Group: Members
Posts: 155
Joined: 14-January 04
From: Oklahoma
Member No.: 3,577



This plug in works great with XPE!! I love it.

Thank you so much!! =)

Tony
Go to the top of the page
 
+Quote Post
Kalonji
post Jan 27 2004, 11:28 AM
Post #9


Silver Member
***

Group: Members
Posts: 331
Joined: 15-November 03
Member No.: 2,579



QUOTE (SportinSS @ Jan 18 2004, 04:27 AM)
This plug in works great with XPE!! I love it.

Thank you so much!! =)

Tony

Wow, thanks! Didn't check it with XPE, so I'm glad you consider my plug useful!


--------------------
Smash forehead on keyboard to continue.....
Go to the top of the page
 
+Quote Post
ivan
post Jun 28 2006, 07:23 PM
Post #10


Newbie
*

Group: Members
Posts: 6
Joined: 28-June 06
Member No.: 20,139



I'm totally new to this forum, so please don't be too harsh if this has already been pointed out elsewhere.

I've been using deveject for a while now, but there's a couple of things that still bug me:

1) Despite the world cup, i can't speak or understand German to save my life, let alone understand what the readme says, so I'd really apprciate it if someone gave me a hint as to the copyright and distribution of deveject. I'd like to distribute it, but if no can do then i'll only output info for users obtained from wmi and request them to eject devices.

2) Can anyone explain what the debug swith does. An example would be really forthcoming, as I've used the -v swith in all possible ways I could think of and nothing happens.

Regards,
IVAN
Go to the top of the page
 
+Quote Post
Ed_P
post Jun 28 2006, 08:42 PM
Post #11


Platinum Member
*****

Group: Admin
Posts: 4,615
Joined: 12-August 05
From: Western NY, USA
Member No.: 13,258



The readme.txt file says:

DevEject -- devices log out automatically, for Windows 2000/XP/2003 =================================================================
DevEject serves to log out external data storage units such as FireWire plates or USB sticks by program control with the operating system.

A closer description you find in c't to 16/03, S. 208.

DevEject.exe -- the executable program
DevEject.cpp -- source text in C++

according to http://world.altavista.com/tr

The fact that it was published indicates that he owns the copyright. Write to the author and see what he says about your desire to distribute his utility.

Use the links in the plugin's deveject.htm Help file to try to find the author.

http://www.heise.de/ct/03/25/links/206.shtml
Matthias Withopf (c't magazine)

You could also write (PM) to Kalonji at http://www.911cd.net/forums//index.php?showuser=2579 and see if he has a contact with the author.


--------------------

A useful posting: Adding drivers to BartPE; NIC, SATA, video

A helpful thread: BartPE Troubleshooting FAQs

Use the forum's search tool to find postings about problems similar to yours.
For searches involving three letter acronyms such as USB add an * to the end. For example: USB*

The button is your friend and is located just below the one for Quote Reply.



Ed
Go to the top of the page
 
+Quote Post
ivan
post Jun 29 2006, 08:42 AM
Post #12


Newbie
*

Group: Members
Posts: 6
Joined: 28-June 06
Member No.: 20,139



@Ed_P

Thanks for the reply. I'll follow your suggestions and post the feedback on this thread.

I also found some other utils that do similar stuff with USB. I'll try them out before adding threads. Again, lots of stuff is in German.

IVAN
Go to the top of the page
 
+Quote Post
ivan
post Jun 29 2006, 09:01 AM
Post #13


Newbie
*

Group: Members
Posts: 6
Joined: 28-June 06
Member No.: 20,139



I'm still clueless about the debug switch. Anyone has any ideas here?
IVAN
Go to the top of the page
 
+Quote Post
ivan
post Jun 29 2006, 09:15 AM
Post #14


Newbie
*

Group: Members
Posts: 6
Joined: 28-June 06
Member No.: 20,139



I tried comipling the source with dev-c++ 4.9.9.2 and got the following error:
CODE
Compiler: Default compiler
Executing  g++.exe...
g++.exe "d:\0316_208\0316-208\deveject.cpp" -o "d:\0316_208\0316-208\deveject.exe"    -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include"  -I"C:\Dev-Cpp\include\c++\3.4.2\backward"  -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32"  -I"C:\Dev-Cpp\include\c++\3.4.2"  -I"C:\Dev-Cpp\include"   -L"C:\Dev-Cpp\lib"
d:\0316_208\0316-208\deveject.cpp: In function `BOOL CompareWithWildcard(CHAR*, CHAR*)':
d:\0316_208\0316-208\deveject.cpp:323: error: `toupper' undeclared (first use this function)
d:\0316_208\0316-208\deveject.cpp:323: error: (Each undeclared identifier is reported only once for each function it appears in.)

Execution terminated


however, when substituting
CODE
if (toupper(*s1++) != toupper(*s2++))


for
CODE
if (s1++ != s2++)


compilation worked.

I also run the app and no prob.

Hope this helps others that might want to start playing with the source, which I must say, is quite complicated!

If deveject is problematic for other users, you can also read the following:

usb stuff

IVAN
Go to the top of the page
 
+Quote Post
Ed_P
post Jun 29 2006, 09:32 AM
Post #15


Platinum Member
*****

Group: Admin
Posts: 4,615
Joined: 12-August 05
From: Western NY, USA
Member No.: 13,258



QUOTE (ivan @ Jun 29 2006, 10:15 AM) *
If deveject is problematic for other users, you can also read the following:

usb stuff

IVAN

Wow!! Great link ivan. Especially the part that states:
QUOTE
But Windows XP optimizes and bundles write accesses to pen drives only when they are NTFS formated, so NTFS is the right choice.

Furthermore NTFS stores small files together with the file information so they are written into the same flash block which is the best that can happen.

Interesting. smile.gif


--------------------

A useful posting: Adding drivers to BartPE; NIC, SATA, video

A helpful thread: BartPE Troubleshooting FAQs

Use the forum's search tool to find postings about problems similar to yours.
For searches involving three letter acronyms such as USB add an * to the end. For example: USB*

The button is your friend and is located just below the one for Quote Reply.



Ed
Go to the top of the page
 
+Quote Post
ivan
post Jun 29 2006, 09:59 AM
Post #16


Newbie
*

Group: Members
Posts: 6
Joined: 28-June 06
Member No.: 20,139



@Ed_P

To be honest, I'm not that concerned about flash memory sticks as much as wireless network devices using usb enabled with PnP (plug&Play). I get all my info (deviceId, name, etc) straight from wmi scripts and match the data from the registry.

The reason I'm after a util like deveject is that it's much neater and impressing to have a script do the removing of the device than having to ask the user to physically do it. I wannna take step by step, though, after I get a proper removal, I also wanna be able to mount it back (not needed for my purposes, but for the sake of completeness!). The catch is that when I use wmi scripts, these can only be used for Windows ME onwards, leaving win98 aside.

The documentation came in handy!
IVAN
Go to the top of the page
 
+Quote Post
ivan
post Jun 29 2006, 10:05 PM
Post #17


Newbie
*

Group: Members
Posts: 6
Joined: 28-June 06
Member No.: 20,139



i believe Matthias Withopf, the author of deveject can be found at

perfwatch@withopf.com

if anyone is interested. I sent him an e-mail asking for copyright info and posed the question on the debug switch too!

IVAN

does anyone know exactly how public domain is defined????
ivan
Go to the top of the page
 
+Quote Post
Ed_P
post Jun 30 2006, 01:33 AM
Post #18


Platinum Member
*****

Group: Admin
Posts: 4,615
Joined: 12-August 05
From: Western NY, USA
Member No.: 13,258



QUOTE (ivan @ Jun 29 2006, 11:05 PM) *
does anyone know exactly how public domain is defined????
ivan

Public domain

Roughly I think it means it has open access, anyone can use it, and no one can sell it or claim it as their own work.


--------------------

A useful posting: Adding drivers to BartPE; NIC, SATA, video

A helpful thread: BartPE Troubleshooting FAQs

Use the forum's search tool to find postings about problems similar to yours.
For searches involving three letter acronyms such as USB add an * to the end. For example: USB*

The button is your friend and is located just below the one for Quote Reply.



Ed
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 20th November 2009 - 11:53 PM