The Oven

Project World => Gena HomePage => Gena Plugins => Topic started by: NIKZZZZ on March 20, 2011, 12:23:16 AM

Title: Synchronize letters of disks
Post by: NIKZZZZ on March 20, 2011, 12:23:16 AM
Hi All
Allows to synchronize letters of disks on the basis of the register of guest system.
So probably to appropriate to a Boot Disk letter Y: (it is searched on the marker file).

Regards,
Nikzzzz.
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 20, 2011, 11:29:57 AM
Hi Nikzzzz,

I more or less understand the idea, and like it , put on the server to get others easy try too.
less part is:
with /Manual, I would expect, after selecting J:\ drive (with xp32 in it), utility reads registry of J: - xp32 and remounts all Gena drive letters following xp32 on J: (J: --> C: and others)

Maybe I miss something....

See you  :thumbsup:
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on March 20, 2011, 11:23:51 PM
Hi, Lancelot
In /Manual mode it is necessary to choose Windows the catalogue, for example J:\Windows
Regards,
Nikzzzz.
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 21, 2011, 03:47:41 AM
I like the idea  :thumbsup:,

For Win7Pe_Se, 2aCD shared with me a script that does the same thing, with a little exe (DLMapper.exe) from Symantec Service Recovery Disk.
So I do not know if I can share it ! It is opensource here :smile:



Title: Re: Synchronize letters of disks
Post by: Lancelot on March 22, 2011, 01:50:10 AM
 :cancan:
Thanks for the hint Nikzzzz
It is very nice   :thumbsup:

ChrisR, I believe it also works niicely on Win7PE SE ;).

I was using mountvol to remap drives in the past to fit drive letters.... now no need to  :lol:

I put a tip on script interface, also selected default with manual option.
I believe everybody would like to have this at hand.
 :grin:
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 23, 2011, 12:45:16 AM
ChrisR, I believe it also works niicely on Win7PE SE ;).
I believe everybody would like to have this at hand.
yes I also think it is good  :grin:

I just test it on Win7Pe_Se (RunOnceEx -> RunOnce) on my HostOS win7 x86, I would test it after on my Host win7 x64.

I have an issue, the array $aMountGuest is empty.
MountedDevices is missing (HKLM\GuestSYSTEM\MountedDevices) after loading the guest hive system  (I have the other keys) !!! :confused:
Code: [Select]
RunWait('reg.exe load hklm\GuestSYSTEM "' & $sHiveSystemGuest & '\system32\config\system"', '', @SW_HIDE)

An idea about that :question:
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 23, 2011, 01:23:31 AM
Hi ChrisR,

Here I tested with shortcut  (/Manual) not runonce etc. since personally to me, runonce should be an option and shortcut ready at hand.

on guest system hive there have to be mounteddevices key, somehow on loaded hive it seems missing there ?!?!
I have an old vista on one of my partitions (hehe, I guess last time I boot was 2 or more years ago) which I had tested yesterday with Gena and works ok. (vista partition made C: and others.....)
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 23, 2011, 02:12:23 AM
Hi ChrisR,

Here I tested with shortcut  (/Manual) not runonce etc. since personally to me, runonce should be an option and shortcut ready at hand.

on guest system hive there have to be mounteddevices key, somehow on loaded hive it seems missing there ?!?!
I have an old vista on one of my partitions (hehe, I guess last time I boot was 2 or more years ago) which I had tested yesterday with Gena and works ok. (vista partition made C: and others.....)
Hi Lancelot,

I have tested with both runonce and shortcuts and Yes, runonce should be an option and shortcut ready at hand.

On my guest system hive there have mounteddevices key, but in PE after load hive system, this key is missing ??? and therefore LetterSwap do not work (Perhaps a problem with my host win7 ?).

Another little thing for /manual perhaps, to indicate that we must select the Windows folder, It was unclear for me at first try.
$sHiveSystemGuest = FileSelectFolder("Select OS (eg c:\windows)", 1)
  or
$sHiveSystemGuest = FileSelectFolder("Select drive OS", 1) & '\windows'
 
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 23, 2011, 02:19:16 AM
yep it was unclear untill Nikzzzz pointed too.
I put a tip to script interface ;).

I truely do not know w7, even never had installed on a virtual machine yet......

well folder name \windows is not a must
further,
the flag file I know is \***\system32\config\SYSTEM

so a seach mechanism, listing all os and put a final list as gui if more than 1 found would be the most confortable.
I hope Nikzzzz like the idea too ;)
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on March 24, 2011, 01:17:34 AM
Hi.
Update script.
$sHiveSystemGuest = FileSelectFolder("Select OS (eg c:\windows)", 1) - It is added, thanks ChrisR
Log guiding is added
Regards,
Nikzzzz.

Title: Re: Synchronize letters of disks
Post by: ChrisR on March 24, 2011, 04:58:36 AM
Update script.
$sHiveSystemGuest = FileSelectFolder("Select OS (eg c:\windows)", 1) - It is added, thanks ChrisR
Log guiding is added
Hi Nikzzzz,

Thank you for the update,, it's ok for the log and the "select OS"  :smile:

so a seach mechanism, listing all os and put a final list as gui if more than 1 found would be the most confortable.
I hope Nikzzzz like the idea too ;)
the idea is interresting also.

I still have my problem with reg load system, the key mounteddevices is missing for me, i don't know why ?
Code: [Select]
here the log
Command line:
/auto /log X:\Windows\Temp\Lswapp.log
Host system:
C - 0xBDE239490080000000000000
D - 0xBDE239490020D6FF13000000
Guest system: x:\windows

[attach=1]
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 24, 2011, 05:13:57 AM
In addition, I forgot.

In my case, when the key mounteddevices is missing, i have an @error and "reg unload hklm\GuestSYSTEM" is not made.
Quote
$sValueName = RegEnumVal($sKey, 1)
If @error <> 0 Then ContinueLoop         ;        <== In my case @error <> 0
LogOut("Key: " & StringReplace($sKey, 'GuestSYSTEM', 'SYSTEM') & @CRLF)
For $i = 1 To 999
   ...
Next
RunWait('reg.exe unload hklm\GuestSYSTEM', '', @SW_HIDE)
Next
RunWait('reg.exe unload hklm\GuestSYSTEM', '', @SW_HIDE)
:cheers:
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 24, 2011, 07:31:00 AM
Hi,

Ok  I found the problem with Win7PE SE , it is because "x:\windows" exists

by changing that, the program works very well  :thumbup:

Code: [Select]
Case "/auto"
$aDrives = DriveGetDrive("FIXED")
For $k = 1 To $aDrives[0]
        ; first drive (exitloop) and exclude drive X
If $aDrives[$k] <> "x:" And FileExists($aDrives[$k] & '\windows\system32\config\system') Then
$sHiveSystemGuest = $aDrives[$k] & '\windows'
ExitLoop
EndIf
Next

also

RunWait('reg.exe unload hklm\GuestSYSTEM', '', @SW_HIDE)    ;  after the loop (Next)

Maybe an additional parameter to exclude a drive and be compatible with PE2/3 projects.

 :cheers:


 
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on March 24, 2011, 08:18:14 AM
Hi, ChrisR
More correctly :

Code: [Select]
If $aDrives[$k] <> EnvGet ( "SystemDrive" ) And FileExists($aDrives[$k] & '\windows\system32\config\system') Then ....
:cheers:

Regards,
Nikzzzz.


Title: Re: Synchronize letters of disks
Post by: ChrisR on March 24, 2011, 08:28:03 AM
More correctly :
Code: [Select]
If $aDrives[$k] <> EnvGet ( "SystemDrive" ) And FileExists($aDrives[$k] & '\windows\system32\config\system') Then ....
Hi Nikzzzz,
Yes, OK,  thank you very much  :smile:

 :cheers:
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on March 24, 2011, 08:42:37 AM
Update script.
Fixed bug , thanks ChrisR
Regards,
Nikzzzz.
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 24, 2011, 07:54:26 PM
Hi ChrisR,

An idea  :w00t: to be tested by you:

attach an usb flash disk (ufd) to your hostos, it will get a drive letter, than change this drive letter to something else (let's say K:)
than safely remove this ufd
than plugin again
1st) does it get K: ????

IF answer yes:
safely remove this ufd
shutdown pc (not restart button, use shutdown button)
start pc
after boot attach same ufd to your hostos
2nd) does it get K: ????

 :lol:
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 25, 2011, 10:00:40 AM
Hi Lancelot,

I'll try this after the weekend and thank you Nikzzzz, LetterSwap works well :smile:

 :cheers:
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 25, 2011, 11:49:53 AM
Hi Lancelot,

finally, a bit of time to test

First thing, the safely remove Systray do not working in Win7PE SE.
and Hotswap! also (it works with MakePE3)
Hotswap! http://mt-naka.com/hotswap/index_enu.htm

start on my NetBook (no VM), attach an UFD, it gives me the letter E:
I change the letter with remount E: K:
Than safely remove this ufd and than plugin again,
The drive letter remains K:

Then safely remove this ufd and shutdown pc with the shutdown button
Start again the PC and attach the same UFD,
The drive letter, is as originally E:

you deduce what  :question:

[attach=1]
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 25, 2011, 11:58:40 AM
Hi ChrisR,

yes  :thumbsup:

your test result proves / verifies, your mounteddevices key deleted when you shut down.

here (and so far all friends I have) , after Restart will get K: in the end of the test again.

Well, you are currently only one I know who use w7hostos ;) better to verify with some others to be sure if this is a w7 behaviour, or your user profile behaviour, or a setting behaviour (uac ! etc.) , or something else.... :cheers:
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 25, 2011, 12:05:08 PM
First thing, the safely remove Systray do not working in Win7PE SE.
One thing I forgot, you will find Flush inside Gena (System Tools) written by Galapo, it Flush disks (write disk cache to disk) hence after flushing, one can simply pull an ufd out securely ;).
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 25, 2011, 12:35:00 PM
Sorry, soooory, forgot  :uuups:, with your answer I understood that the test should be on my win7 hostPC (Not in Win7PE SE), confused.

By making the same test in my HostPC win7 x86, after changing E: to K: (nice remount  :thumbsup:), the UFD drive letter remains always K: , even after shutdown.

I will test the Flush inside Gena written by Galapo  :smile:

Ps: in win7PE SE the safely remove in Systray and also Hotswap! do not work. I can use safely remove with explorer, right click and eject.

:cheers:
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 25, 2011, 07:58:24 PM
Hi ChrisR,

My bad english, Things happen  :brainfart: :angel:


since now you have K: setting "saved" on your hostos registry,
can you now boot from any PE, and check if MountedDevices key exists on your hostos (disk) or not. (Nikzzzz utility can also be used to see if ufd get K: at PE)

> I can use safely remove with explorer, right click and eject.
Thanks for the tip :). I always forget that thing on pe2/3.  :lol:
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 28, 2011, 01:14:00 AM
Hi Lancelot,

I did your test after the weekend.
Now I have my UFD saved as K:, on my win7 HostOs registry,
After starting Win7PE SE and attach my UFD, it gives me the letter E:
then using LetterSwap Nikzzzz utility (test in /auto and /manual).

My ufd is now assigned to drive K: , everything works as expected   :thumbup:

[attach=1]
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 28, 2011, 01:22:03 AM
My ufd is now assigned to drive K: , everything works as expected   :thumbup:
Good  :thumbsup:

Here what I learn from your story:
*
as long as saving MountedDevices\ key not required, windows (w7) deletes this registry during shutdown.

not required: you are using single disk, 2 partitions, first one C: second one D: --> it fits all definations of drive letter assigment rules :) , so saving not required.....

*
when end user make "uncommon" assigment (ufd letter to K:) than mounteddevices saved :) since it is required

required: windows should remember your previous assigment to do same again


anyway,
happy ending for letterswap and end users :thumbsup: :lol: :grin:

ps: K: -> Kingston, my cheap ufd  :wink:
Title: Re: Synchronize letters of disks
Post by: ChrisR on March 28, 2011, 03:36:39 AM
Before closing the subject with a happy ending...  :thumbsup:

An idea to add, eventually, an additional feature to Letterswap.
in Win7PE Se and in some others projects, we use a program cdusb.exe to assign the drive letter Y: to CD/DCD or UFD at startup with a markerfile "cdusb.y".

"Letterswap /BootDrive:y MarkerFile" could be used for this but this requires to wait sometimes 1, 2,... 10 seconds for drives to be assigned by the system at startup ((NOTREADY).

Just for example, I added this functionalities to Letterswap.

The command line in Winpeshl.ini would be this one for example :
- Letterswap.exe /BootDrive:y CdUsb.Y /wait 12 /log %temp%\lswapp.log


up to you to see the utility or not  :wink:

[attach=1]
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on March 30, 2011, 10:49:04 AM
Hi, ChrisR
 :thumbsup:
Title: Re: Synchronize letters of disks
Post by: Lancelot on April 10, 2011, 10:58:54 AM
Hi Nikzzzz,

following your approval,
I updated LetterSwap script on Gena server following ChrisR changes.
 :thumbsup:
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on November 19, 2011, 02:50:05 PM
Updated LetterSwap
au3 version, winapi,  added /HideLetter - hides inactive disks, /MountAll - shows inactive disks
Title: Re: Synchronize letters of disks
Post by: MaineCoon on February 01, 2012, 10:52:42 AM
Hi,

I cannot open the included ReadMeEng.txt (as well as ReadMeRus.txt) because of the following line in
Quote
[ReadMe_Enu]
ShellExecuteex,Hide,cmd.exe,"/C #$q%ProjectTemp%\LetterSwap\Source\ReadMeEng.txt#$q",%ProjectTemp%
(same in [ReadMe_Rus]).

Both files are stored in %ProjectTemp%\LetterSwap\ but folder Source does not exist.

Regards,
MaineCoon
Title: Re: Synchronize letters of disks
Post by: Lancelot on February 01, 2012, 12:01:25 PM
Missed updating LetterSwap on Gena....
Try This:

http://www.mediafire.com/?8s69t7qevk4886q
Title: Re: Synchronize letters of disks
Post by: Lancelot on February 02, 2012, 12:00:26 AM
Gena and Win7PESE updated & syncronised now  :thumbsup:
Title: Re: Synchronize letters of disks
Post by: MaineCoon on February 02, 2012, 04:40:29 AM
Thanks  :cheers:

MaineCoon
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on February 13, 2012, 02:05:27 AM
Hi.
LetterSwap Au3 version.

Regards,
Nikzzzz.
Title: Re: Synchronize letters of disks
Post by: Galapo on February 13, 2012, 03:12:01 PM
Hi Nikzzzz,
There seems to be some mis-match between this AU3 version and the EXE version. The one on the server has an update that says 'History005=Bueno SysWow64 support', but that doesn't seem to be in the AU3 version.

Is this script meant to replace the EXE version? Or are they to both be placed on the server?

Thanks,
Galapo.
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on February 14, 2012, 02:04:45 AM
Hi Galapo.
I did not note this update   :undecided:, i will answer later.
Regards
Nikzzzz.
Title: Re: Synchronize letters of disks
Post by: Galapo on February 14, 2012, 10:41:29 AM
Hi Nikzzzz,

Lancelot sent me a message about what I needs to be considered in upating the script. I can do it, but time..  :swimmer:

Maybe Lancelot can post the info here too for you to consider as well.

Regards,
Galapo.
Title: Re: Synchronize letters of disks
Post by: Lancelot on February 14, 2012, 11:47:49 AM
Hi Nikzzzz,

There are small set of things, let me go one by one:

1)
I believe using

....RunOnceEx\800,LetterSwap,"LetterSwap.au3 %pTextBox1%"

shortcut....%,"#$pSystemRoot#$p\system32\LetterSwap.au3","Synchronizes letters",,...

would cause troubles in time since
a) autoit executable may not exist
b) autoit executable version may be trouble
c) .au3 may not be set default to "run" with autoit


Easy Solution  :cool::
Copy appropriate autoit version

If,Not,ExistFile,%Target_Sys%\Au3361.exe,FileCopy,%Tools%\%SourceArch%\AU3361.exe,%Target_Sys%

or if it your new letterswap already require latest autoit, we can put new autoit version to projects tools folder, hence

If,Not,ExistFile,%Target_Sys%\Au3381.exe,FileCopy,%Tools%\%SourceArch%\AU3381.exe,%Target_Sys%


and
make runonce & shorcut with Au33....exe


I hope I could explain  :cheers: what you think ?
Title: Re: Synchronize letters of disks
Post by: Galapo on February 14, 2012, 11:54:52 AM
Thanks Lancelot. :thumbsup:

Nikzzzz will be able to tell us whether AU3361.exe is OK or not.

Regards,
Galapo.
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on February 14, 2012, 04:55:04 PM
Hi Lancelot & Galapo.
This version is compatible with Autoit 3361 or later.
Unfortunately,
...RunOnceEx\800,LetterSwap,"Au3361,exe LetterSwap.au3 %pTextBox1%"
does not work correctly.
The possible decision:
If Autoit it is registered with system -  used Au3  version, else Exe  version.
How you think?
Regards,
Nikzzzz.


Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on October 27, 2012, 09:38:09 AM
Fixed bug - incorrect operation if in guest system drive x::
.au3 version full  compatible with au3361 or later.
Regards,
Nikzzzz.
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on October 27, 2012, 09:42:00 AM
 ------------------
Title: Re: Synchronize letters of disks
Post by: Lancelot on October 29, 2012, 12:51:33 AM
Thanks Nikzzzz,

Sorry for delay, time pass quickly,
Both Win7PESE and Gena updated latest LetterSwap now   :great:

:ymca:
Title: Re: Synchronize letters of disks
Post by: anshad on February 24, 2013, 06:30:06 PM
Hi Nikzzzz

New letterswap.exe won't work without autoit executable in System32. New script works fine in Win7PE SE as autoit is enabled by default but won't work with Gena if Autoit script is not enabled. There is no instruction in the script interface to enable Autoit. Script should be either updated to copy Autoit executable to System32 or letterswap.exe should be updated to a standalone exe.
Title: Re: Synchronize letters of disks
Post by: Lancelot on February 24, 2013, 09:31:32 PM
Hi anshad,

can you test if using au3361.exe filename ok ?

If,Not,ExistFile,%target_sys%\AU3361.exe,FileCopy,%Tools%\%SourceArch%\AU3361.exe,%target_sys%
Title: Re: Synchronize letters of disks
Post by: ChrisR on February 24, 2013, 10:40:07 PM
Hi anshad,

Here, I think better

in line 52  after
//-- autorun PE1
If,Not,ExistFile,%target_sys%\AU3381.exe,FileCopy,%Tools%\%SourceArch%\AU3381.exe,%target_sys%
Title: Re: Synchronize letters of disks
Post by: anshad on February 25, 2013, 01:08:02 AM
Hi Lancelot and ChrisR

Yes, AU3361 wont work with letterswap. It requires  AU3381. Adding
"If,Not,ExistFile,%target_sys%\AU3381.exe,FileCopy,%Tools%\%SourceArch%\AU3381.exe,%target_sys%" to the process section of letterswap script did the job :thumbsup:

But...
letterswap.exe inside script+AU3381 consumes more than 700 kb while standalone letterswap.exe is only around 280 kb. As Win7PE SE includes AU3381 by default it is not a problem but in Gena isn't it good to use a standalone letterswap.exe?

Title: Re: Synchronize letters of disks
Post by: Lancelot on February 25, 2013, 03:25:48 AM
Hi anshad,

Gena also includes AU3381 as default, but optional  :wink:

story behind is:
using standalone autoit-exe take extra space as you indicated, 280 -> 700
 a time ago a suggestion made (on a topic I can't remember ... ) to use less space for au3-executables ... since everytime ~500kb wasted...

JFX came with these executables idea, depending on autoit-exe , which he initially used on another utility
( or ChrisR remembered JFX method on this matter of exe size reduction)
...
updates made on plugins,
 we followed ChrisR updates, but obviously we miss this au3... line on plugins since Gena default have au3361.exe (or autoit.exe .. ) ;)

small mistakes happens time to time  :wink:

See You
 :turtle:
Title: Re: Synchronize letters of disks
Post by: anshad on February 28, 2013, 02:37:04 AM
Hi

I found a problem between Gena and letterswap.exe. In Win7PE SE letterswap.exe works fine and all remapped drive letters are shown in explorer. In case of Gena sometimes Explorer won't updates properly and some remapped drives are not shown :confused:. We could see and open all drives from disk management so it is the explorer that is misbehaving. If i kill the explorer and restart it manually all drives will be shown properly. This issue happens only in some systems.

 My idea is to create a batch file which executes "letterswap.exe /auto" and then somehow updates/refresh explorer. Does anyone know how to do that?
Title: Re: Synchronize letters of disks
Post by: Lancelot on February 28, 2013, 04:59:21 AM
one idea,
have you tried restarting mounstorpe ?

about restarting Explorer:
there is a complication about that, what you use as "loader" matters  :wink:

*
If you are using "XPELogon" (Gena Default),
 you can restart explorer as in windows
  (10 lines with ckill and one like to start explorer.exe would be enough I guess)

ckill : http://theoven.org/index.php?topic=53.0

That is the main reason XPELogon is Gena Default  :wink:

ps: please check IF XPLogon has a parameter to restart shell ??? if there is I can put a shortcut option for that...

*
If you are using "PELoader", as far as I remember it shuts down PE when shell (explorer) dies

Also, you can make a "batch" as shell, so when explorer dies, it automatically starts explorer.exe
(maybe pecmd can make same without batch !!??)

*
PE1 default behaviour for shells is "shut down" as with PELoader (nobody use this option anymore)

ps: my memory says,  peloader and pe1 default behaviour change if you use remove 24-h limit...

*
I do not know "PECMD" behaviour, but I may guess it is acting like xpelogon ? (or may act like xpelogon) ???


++++
Shortly:
 If your goal is restarting shell, with default gena with xpelogon it is like in normal windows,
  if you play with loaders, than be carelful.  :wink:

tip: you can change shortcut option to minimize with batch xx.cmd shortcuts.

See you
:ymca:
Title: Re: Synchronize letters of disks
Post by: Galapo on February 28, 2013, 01:23:05 PM
(free-distributable alternative to pskill will be nicer  :wink:)

Yep, remember we have CKill, both 32- and 64-bit: http://TheOven.org/index.php?topic=53.0

Regards,
Galapo.
Title: Re: Synchronize letters of disks
Post by: anshad on February 28, 2013, 06:14:42 PM
Hi Lancelot and Galapo

Thanks for your support. I found a better fix by using latest "nircmd" from Nirsoft. It is only 47kb in size and can do a shit load of things.I have "nircmd" in all my build. This is my batch :

Code: [Select]
@echo off
letterswap.exe /auto
nircmd restartexplorer
exit

Everything worked until i found a new issue- in some systems XP installer assigns CD drive letter "D:" instead of assigning it the letter following last HDD partition. For example if we have 2 partition, instead of giving "e:" to the CD drive XP may assign D to CD and E to 2nd partition. If we boot Gena in that machine letterswap will read it's registry and remap CD drive's letter to "D:"  :mad: Then "%CDDrive%" variable becomes invalid and all my app shortcuts from CD drive will also be gone :sad: This is not a an issue in Win7PE SE as letters A,B,X,Y, and Z are ignored by default ( CD drive is Y)

 Then i found a cure by modifying my batch.

Code: [Select]
@echo off
letterswap.exe /auto /ignoreletter %cddrive% /log %temp%\lslog.txt
nircmd restartexplorer

So far everything works fine :cool:

It will be good to include a "ignoreCD" option in letterswap's next version to ease things.

Note: i tried the "letterswap.exe /auto /ignoreletter %cddrive% /log %temp%\lslog.txt" in the autorun box of letterswap script but that don't seems to work. I doubt %cddrive% is not available during startup (already discussed in "portable finder CMD" topic). So "ignoreCD" is a must have.

"nircmd" do have "closeprocess" and "killprocess" option to terminate processes and "sysrefresh environment" option to broadcast environment variable change. It is allowed to freely distribute as long as we don't charge for the download so it can be used with Gena and Win7PE SE scripts.
   
Title: Re: Synchronize letters of disks
Post by: Galapo on February 28, 2013, 08:11:48 PM
Hi anshad,

I recompiled a new x86 version for you to test. It accepts an optional commanline parameter '/restartexplorer'.

https://dl.dropbox.com/u/3801579/temp/LetterSwap.exe

The %CDDrive% variable is only available quite late in the boot process. To get around that you could try 'Add_Shortcut,AutoRun'.

Regards,
Galapo.
Title: Re: Synchronize letters of disks
Post by: anshad on March 01, 2013, 12:13:52 AM
Hi Galapo

Yes, new "restartexplorer" option works fine :thumbsup:

Code: [Select]
@echo off
letterswap.exe /auto /restartexplorer /ignoreletter %cddrive% /log %temp%\lslog.txt

Title: Re: Synchronize letters of disks
Post by: Galapo on March 01, 2013, 01:23:49 AM
Hi anshad,

Ok, great.

I've got another test for you, because I don't know if the way I've coded it will work. Redownload an updated test version from the link and test the following code: https://dl.dropbox.com/u/3801579/temp/LetterSwap.exe

Code: [Select]
@echo off
letterswap.exe /auto /restartexplorer /ignorecd /log %temp%\lslog.txt

If this doesn't work, I code another way.

Thanks,
Galapo.
Title: Re: Synchronize letters of disks
Post by: anshad on March 01, 2013, 04:39:34 AM
Hi Galapo

Thanks for the test version :smile:. Unfortunately new "ignorecd" switch didn't seem to work. Waiting for your update.... 
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 01, 2013, 07:03:09 AM
sorry Galapo,
You know how much I like ckill, I knew I am forgetting sth.. but in a rush I forgot...
changed my post   :thumbsup:

*
@anshad,
for startup batches where cddrive used..
a roadpath made before http://theoven.org/index.php?topic=468
already available inside Apps\System Tools\"Portable Finder CMD" plugin  http://theoven.org/index.php?topic=370

*
and an info add:
I guess, using nircmd , you can close all open explorers (file manager ones) than kill explorer.exe, which will result 2 lines ;)
but still there is this letter problem....
(which seems to me a bit normal with description "Synchronizes letters of disks Host & Guest OS"

*
@Galapo
I guess solid solution would be:
reading cddrive variable at first place IF exists --> than you need to take an "ID" of this device ,
 than after restart if it is not mounted correctly, remount it ;)  ( with mountvol.exe ?!?)

I may guess what I mean with "ID" can be taken from HKLM\SYSTEM\MountedDevices

besides after* tests dependency to mountvol.exe can be removed too since we already have working codes   :cool:
(either inside LetterSwap or BlueLife MountVol)

or shortly:
maybe whatever hapening has an effect to HKLM\SYSTEM\MountedDevices or similar that cause cd-drive letter change ??
after killing, adding id and continue starting ... is a similar solution without using mountvol kind step....

all need to be tested  :cool:


AND :)
Aside adding to LetterSwap.exe
 I feel better an individual "ExplorerRestart.exe",
  which I believe would make your coding easier and would ease future hunts of "Explorer Restart" conditions,
than same codes can be used with letterswap or not, up to you ....

:turtle:
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 01, 2013, 09:56:47 AM
things come to my mind, just remembered:

I knew I had thought this situation before ;)
and now I remember why I use manual way....

on "MountedDevices Host" , to avoid such thing, I deleted A: B: X:  Y:  during import-export  , which I know have weak point ;)
(I believe no weak point since at bootup things will be adjusted - overwritten by system ;)  , naturally letterswap works other way, overwrite what system made)

the main trouble seems to me: find / detect which letters PE (running os) uses actively,
secondary: a routine not touch these letters ..


I guess system already takes systemdrive ok ,
 cddrive is only a case which anshad catched due to popular usage,
  but there are others like ramdisk drive letter, wimpack driveletter and "whatever driveletter" ...
   It is to me impossible to detect all drive letters used (configured) by system ...
    (and very absurb to but an env. var. for them , an idea is to write a registry info .... ...)



from this idea , back to first step:
The goal of using letterswap, to me, getting "disk"s letters correct,
to benefit
1) working junctions/symb links etc. (which is to me most important part)
2) I feel things will be easier when checking offline hives (following paths would be easier...)
3) better visual (so you see what you are familiar with or how system configured)

so I guess, better design letterswap in a way, to correct "disk" letters only, and warn if there is a conflict etc.... (visual designs, popup message "do you agree" etc... )

reminding: more more situations makes things more more complicated:
 bootdi can boot from real-disk (image), bootloader can be configured in a way to have disk-image-loaded side by side, gavotte can create real-disk on ram or on .ima-img etc. etc. ....
 things can be very mixed easly with letterswap...



or easy path  :wink: (time time :turtle:),
 you can ignore the "popular" ones (A: B: Y: X: ),
   knowing in mind there is still a "weak point" which one might face 1/10000  :wink:



I hope this gives a better picture, and quick fix (my advice , use easy path) :great:
Title: Re: Synchronize letters of disks
Post by: anshad on March 01, 2013, 06:25:00 PM
Hi Lancelot and Galapo

Thanks for your continued support to solve the issue.

Lancelot is right about the complications. But Wimpack is not a widely used option so i think we can ignore it and we could force the use of "B:" as Imdisk ramdisk or just warn the user changing drive letter may lead to complications. As an alternative a user who use "R" as his RAMdisk letter can use "ignoreletter R:" to exclude it.

 On the other hand "CDDrive" is a widely used variable and it is not a fixed letter and that made the complication. Chances are high to get it remapped. Someway to prevent it will be useful to most users. In my case i don't use letterswap in startup. I have a shortcut in my desktop which executes "letterswap.exe /auto /restartexplorer /ignoreletter %cddrive%" and it works great thanks to you. It can also be used with "Portable Finder CMD" with Lancelot's cddrive variable fix line.       
Title: Re: Synchronize letters of disks
Post by: Galapo on March 01, 2013, 06:47:46 PM
Hi anshad,

Please download an updated version and test: https://dl.dropbox.com/u/3801579/temp/LetterSwap.exe

What I would like you to do is first test this in your batch file:

Code: [Select]
@echo off
letterswap.exe /auto /RestartExplorer /IgnoreCD /log %temp%\lslog.txt

Then I would like you to test this by the normal method, not your batch file run after startup.

Code: [Select]
letterswap.exe /auto /RestartExplorer /ignoreletter %cddrive% /log %temp%\lslog.txt

I've coded a routine taken from ExpEnvVar.exe that should hopefully expand the variable that hasn't been broadcast systemwide yet.

Thanks,
Galapo.
Title: Re: Synchronize letters of disks
Post by: anshad on March 01, 2013, 09:49:08 PM
Hi Galapo And Lancelot

"ignorecd" option works fine in new test version :thumbsup:. I also tried "letterswap.exe /auto /restartexplorer /ignoreletter %cddrive%" in the default Runonce autorun option in the script and that also seems to work :great:
Title: Re: Synchronize letters of disks
Post by: Galapo on March 01, 2013, 10:19:51 PM
Thanks for the tests -- that's just what I was hoping to hear!

We'll release a new version based on these results. I'll need to tidy up the code and so forth.

Thanks,
Galapo.
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 02, 2013, 12:59:37 AM
@Galapo
just an idea:

maybe
/ignoreletter
->
/ignoreletters

and letters seperated with |  :wink: or whatever you like
also additional markerfile ??

giving example: /ignoreletters B:|%cddrive%|Y:|X:|\mycd.flag
 :wink:

also, dont forget to add new stuff to
ReadMe Enu and* ReadMe Rus (you can write English to Rus one  :wink: so syncronisation would be assured even with enu )



@anshad
yes there is "this" complications (not only wimpack but also others... more examples can be added to what I had written),
 besides for regular usages this does not matter at all  :thumbsup:

  I feel ready "Autorun string" should include something like
    /ignoreletters B:|%cddrive%|Y:|X:

btw, now reading "Readme Eng" there is already (simialr ;) !)
/bootdrive y:\MarkerFile

See You
Title: Re: Synchronize letters of disks
Post by: Galapo on March 02, 2013, 01:15:05 AM
/ignoreletter
->
/ignoreletters
I agree, that's a good idea.

and letters seperated with |  :wink: or whatever you like
also additional markerfile ??

giving example: /ignoreletters B:|%cddrive%|Y:|X:|\mycd.flag

The current implementation by Nikzzzz of the /ignoreletter parameter allows for more than one drive to be specified. So you example above would be

/ignoreletter B %cddrive% Y X

Note that /ignoreletter has to always be the last parameter specified in the commandline.

I can probably add the option for a flagfile if that is still needed.

also, dont forget to add new stuff to
ReadMe Enu and* ReadMe Rus (you can write English to Rus one  :wink: so syncronisation would be assured even with enu )

Thanks for that -- I would have forgotten.

Regards,
Galapo.
Title: Re: Synchronize letters of disks
Post by: anshad on March 02, 2013, 01:35:35 AM
Hi

@Lancelot
The "/bootdrive y:\MarkerFile" option will change the drive letter of the drive with marker file to a specific one. For example if i use "/bootdrive y:\MEDIA.DRIVE" my cd will be remapped to "Y:".

@Galapo
I have a doubt with "ignoreletter" parameter. Do we need colon with the drive letter to exclude?. May i use just plain B , D etc or B: and C: or both works?
Title: Re: Synchronize letters of disks
Post by: Atari800xl on March 02, 2013, 02:19:33 AM
So the option y:\media.drive would change the driveletter to y:, of the drive that has the "media.drive" marker file? In that case, we wouldn't need any other commandline options? (the /bootdrive isn't needed?)

That would actually be very useful to me, to switch the USB to Y: and leave all others untouched...

...but I think I might miss something here...
Title: Re: Synchronize letters of disks
Post by: anshad on March 02, 2013, 03:27:23 AM
@Atari800xl

To me using "/bootdrive Y:\MEDIA.DRIVE" switched my CD drive letter to Y. You can use that but make sure to not use "run from cd" option in any app scripts.
Try this with new test version letterswap:
Code: [Select]
@echo off
letterswap.exe /auto /restartexplorer /bootdrive Y:\MEDIA.DRIVE

Title: Re: Synchronize letters of disks
Post by: Lancelot on March 02, 2013, 04:09:18 AM
I can probably add the option for a flagfile if that is still needed.
no no, leave it as it is  :thumbsup: :thumbsup:


@Atari800xl
/bootdrive --> I guess assures a drive mounted following flagfile
/ignoreletter(s) --> says not to "touch" some letters during operation

like the difference between: include - exclude  :wink:

@anshad
I highly guess, X: (systemdrive) not touched during letterswap operation,
 hence you guess may also use /bootdrive Y:\MEDIA.DRIVE (which I deeply feel this was implemented for that very reason)
  better you test to see how this goes.

(I have mixed minds (and no time to check around...) about media.drive - cddrive etc.... whatever flagfile of cd, use that Y:\FlagFile  on your test)

:turtle:
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 02, 2013, 04:27:33 AM
@anshad

forget what I had written  :lol:
----
"run from cd" should be working with letterswap !!!! or should be easly made working if there is a reason why not working !!!
Title: Re: Synchronize letters of disks
Post by: anshad on March 02, 2013, 04:40:01 AM
Hi Lancelot

According to the readme file letters A,B,X,Y and Z are exluded from remaping.

I made a test and indeed "bootdrive Y:\MEDIA.DRIVE" can be used to remap CD drive to Y. As this remapping is done after all shortcuts are created (in manual run) changing CD drive letter may cause run from CD apps to not work . That is what i meant :cool:. Usually i don't need to remap my CD drive.I need  "CDDrive" variable in by batch scripts and that is why i use "ignorecd"  option :smile:
Title: Re: Synchronize letters of disks
Post by: Lancelot on March 02, 2013, 05:09:45 AM
ah ah ah ... now I understand ... it is not always Y: ....

sorry, I am not much familiar with letterswap and working on other life-stuff,
 spending very limited time around, understanding sometimes takes time :turtle:

/bootdrive switch supporting flagfile alone maybe a solution

what I mean: instead of
/bootdrive Y:\MEDIA.DRIVE
-->
/bootdrive \MEDIA.DRIVE

ignoring "the letter" of flagfile, would solve any letter independent from Y:  :wink:

ps:
that was the reason I had written example:
/ignoreletters B:|%cddrive%|Y:|X:|\mycd.flag
---> in fact this becomes superiour than /bootdrive  , /bootdrive become redundant I guess...

ps: | is seperator Galapo likes (me too, I first learned from Galapo ;) ) but "space" could be used instead too ....


At least, I now understand big picture better  :lol: :thumbsup: :great:



Anyway,
current /ignoreletters implementations with enhancing env. var. usage (%cddrive%) goes the same path now with your feedback,
 so better leave what have Galapo done so far  :thumbsup: keeping things simple and working untill another thingy rise  :great:

Thanks,
See You
:ymca:
Title: Re: Synchronize letters of disks
Post by: anshad on March 02, 2013, 05:44:34 AM
Hi Lancelot

I will be always happy to test any Gena feature :grin:. With Galapo's new additions letterswap is far better now. I hope more features will be added in future.
Title: Re: Synchronize letters of disks
Post by: Galapo on March 02, 2013, 06:48:57 PM
Hi anshad,

I have one more test for you.

Please use the script off the server, so that you are using the original letterswap.exe (not my modified one). Then check the "Autorun string" checkbox on the script interface and leave the rest as it is.

Then open up the script and change this

Code: [Select]
If,%pCheckBox1%,Equal,True,RegWrite,HKLM,0x1,Tmp_Software\Microsoft\Windows\CurrentVersion\RunOnceEx\800,LetterSwap,"LetterSwap.exe %pTextBox1%"

to this -->

Code: [Select]
If,%pCheckBox1%,Equal,True,RegWrite,HKLM,0x1,Tmp_Software\Microsoft\Windows\CurrentVersion\RunOnceEx\460,LetterSwap,"LetterSwap.exe %pTextBox1%"

What I am testing is the RunOnceEx entry and getting it changed before ExpEnvVar.exe sets the %CDDrive% variable. That way you get a better order of drive letters like on your Host OS.

If this works, I will still release an updated script with the other things you tested and improved. But this way you get the best of both worlds with a more robust letterswap.exe and better ordering of drive letters.

Thanks,
Galapo.
Title: Re: Synchronize letters of disks
Post by: anshad on March 03, 2013, 06:10:19 PM
Hi Galapo

Currently i am out of town but will return today. I will do exactly what you said and report back :smile:
Title: Re: Synchronize letters of disks
Post by: anshad on March 04, 2013, 03:27:42 AM
Hi Galapo

Just completed the tests and i am happy to say results are positive :great:  I assigned some random letters to the logical drives and CD drive of installed system and Gena seems to map it correctly with new autorun reg entry.Also "CDDrive" variable works fine. Cool find :thumbsup:
Title: Re: Synchronize letters of disks
Post by: Galapo on March 04, 2013, 11:52:56 AM
Great, thanks again for testing. :great:

I'll put an updated plugin on the server, hopefully later today.

Regards,
Galapo.
Title: Re: Synchronize letters of disks
Post by: Galapo on March 04, 2013, 03:45:07 PM
Ok, updated plugin is now on the Gena server.

Thanks again for your support in testing and reporting, we have a better program as a result. :thumbsup:

Regards,
Galapo.
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on November 01, 2017, 06:29:24 AM
Updated LetterSwap.
Fixed bugs.
Source code
Regards,Nikzzzz.
Title: Re: Synchronize letters of disks
Post by: Galapo on November 02, 2017, 02:04:07 AM
Hi NIKZZZZ,

Good to see you around. Hope you are well.

Thanks for the update.  :great:

Regards,
Galapo.
Title: Re: Synchronize letters of disks
Post by: NIKZZZZ on November 04, 2017, 10:20:39 PM
Hi, Galapo.
Maybe you misunderstood me, this is the correct version of LetterSwap.exe for scripts LetterSwap.script win5pe - win10pe, LetterSwap.exe has bugs in these scripts.
Regards, Nikzzzz.
Title: Re: Synchronize letters of disks
Post by: Lancelot on November 04, 2017, 10:35:11 PM
Hi Galapo,

Apps\System Tools\'LetterSwap' plugin
 :wink:

:turtle:
Title: Re: Synchronize letters of disks
Post by: Lancelot on November 04, 2017, 10:38:48 PM
Hi NIKZZZZ,

Out of topic:
Maybe you can help for Russian translation on 'StartMenu Local Apps' plugin
(current v11 on server)
 (get latest plugin from server, it is updated frequently these days with Italian, Taiwan and fixes)

http://TheOven.org/index.php?topic=2033
See Reply 1

:turtle: