USE AT YOUR OWN RISK. The code comes under the BSD license.
I developed this using Delphi. Sorry, but that's all I had available at the time. The basic idea is that you have your U3Drive (the CD-ROM portion) and the U3Main (the main portion). The rest goes like this:
0. Compile attached code into JackKnife.exe
1. Wipe U3Main clean (BACKUP ALL IMPORTANT DATA!).
2. Download UniversalCustomizer.
3. Prepare the following files (see code below): JackKnife.exe, drive.txt, autorun.inf and jackknife.ico (optional).
4. Name your U3Main to be something meaningful to you. Don't give it a generic name likely to be already used, like 'Removable media'. Instead use a name like 'IPARTOLA_U3'.
5. Modify drive.txt to look like this:
IPARTOLA_U3
StartPortableApps.exe
6. Create an ISO of the files you prepared.
7. Burn the ISO onto the drive using UniversalCustomizer.
8. Install PortableApps onto U3Main (now named IPARTOLA_U3).
9. Now every time you insert the drive, it will find the letter assigned to U3Main and execute the command (StartPortableApps.exe in this case). One annoyance that I found is that Windows still tries to autoplay the main portion of the drive which pops up with a new window. Otherwise it works like a charm.
Please let me know how this works out for you.
Igor
autorun.inf
[autorun]
open=JackKnife.exe
icon=hackblade.ico
label=U3
JackKnife.dpf
{ * Copyright (c) 2007-2008, Igor Partola * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY Igor Partola ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL Igor Partola BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } program JackKnife; uses Windows, Dialogs, ShellAPI, SysUtils; {$R *.res} function fstrVolumeName(strDrive : string) : string; var blnResult : boolean; strVolumeNameBuffer : string; chrArrayFileSystem : array [0..MAX_PATH - 1] of char; dwdVolumeSerialNum : DWord; dwdMaxCompLength : DWord; dwdFileSystemFlags : DWord; dwdSize : DWord; intZeroPos : integer; begin {set up buffers} dwdSize := 260; SetLength(strVolumeNameBuffer,dwdSize); FillChar(chrArrayFileSystem,dwdSize,#0); {call function} blnResult := GetVolumeInformation(PChar(strDrive),PChar(strVolumeNameBuffer), dwdSize,@dwdVolumeSerialNum,dwdMaxCompLength,dwdFileSystemFlags, chrArrayFileSystem, dwdSize); {exit if function caused error} if blnResult = False then begin result := ''; exit; end; {trim string to label only for result value} intZeroPos := Pos(#0,strVolumeNameBuffer); if intZeroPos > 0 then Result := copy(strVolumeNameBuffer,1,intZeroPos - 1) else Result := strVolumeNameBuffer; end; {get the drive label} Function findU3Main : String; Var I : Integer; Drives: Integer; Tmp : String; FileHandle : TextFile; DriveLabel : String; LaunchCommand : String; begin if not FileExists('drive.txt') then exit; AssignFile(FileHandle, 'drive.txt'); Reset(FileHandle); ReadLn(FileHandle, DriveLabel); ReadLn(FileHandle, LaunchCommand); CloseFile(FileHandle); Drives := GetLogicalDrives; Result := ''; // units A=0 to el Z=25 For I := 2 To 25 Do If (((1 Shl I) And Drives)0) Then Begin Tmp := Char(65+I)+':\'; If (GetDriveType(PChar(Tmp))=DRIVE_REMOVABLE) Then begin if (fstrVolumeName(Tmp) = DriveLabel) then begin Result := Tmp + LaunchCommand; exit; end; end; End; End; // Main portion of the program. Find the main portion of the U3 // drive and run the command. var command : PAnsiChar; begin command := pchar(findU3Main()); // If you so desire you can add a splash window here if StrLen(command) > 3 then ShellExecute(0, 'open', command, nil, nil, SW_SHOWNORMAL); end.
We use the AutoLauncher4u3 since it's been here longer.
Insert original signature here with Greasemonkey Script.
Not Bad, I'll try it when and I buy a new us drive
your friendly neighbourhood moderator Zach Thibeau
Looks cool. If I get a U3 drive, i'll certainly test it out
The developer formerly known as ZGitRDun8705
what did you use to compile this code and how did you do that?
Lead, Follow, or get out of the way.
Delphi
I wish there was an OSS compiler.
Insert original signature here with Greasemonkey Script.
turbo delphi?
cuase i have that and opened the Kackknife.dpf in it but i see nothing to compile it with
Lead, Follow, or get out of the way.
supposed to open JackKnife.pas
Insert original signature here with Greasemonkey Script.
maybe i have no idea what I'm doing (as always)
but the original post says JackKnife.dpf
I'll try .pas
if anyone has the jackknife.exe file could they please give me a copy
Lead, Follow, or get out of the way.