Author Topic: [Solved] Is there any way to detect than PloP is already loaded?  (Read 38599 times)

kDn

  • Newbie
  • *
  • Posts: 6
If I use that boot order: ntldr -> PloP -> ntldr -> PloP ... all work fine.
But if I try to use: grub4dos -> PloP -> grub4dos -> (Halt system) PloP. I want prevent second call PloP, but I don't know how...
grub4dos have userful feature wich can help to analize byte(s) in memory or another one - locate any string address in the memory. With result I can process different operators depending condition. So question is: what and where can I testing to detect PloP in memory?
« Last Edit: March 03, 2010, 13:58:28 PM by kDn »

Elmar

  • Administrator
  • Hero Member
  • *****
  • Posts: 2405
  • a command shell is enough to do amazing things
Re: Is there any way to detect than PloP is already loaded?
« Reply #1 on: March 03, 2010, 09:46:31 AM »
hi,
when you say "plop is already loaded", then you mean the plop usb driver is loaded, or?

regards
elmar

kDn

  • Newbie
  • *
  • Posts: 6
Re: Is there any way to detect than PloP is already loaded?
« Reply #2 on: March 03, 2010, 10:19:47 AM »
hi,
when you say "plop is already loaded", then you mean the plop usb driver is loaded, or?

regards
elmar

Hello :)
Yes, I mean PLoP Boot Manager 5.0.8 one time loaded normal, and I try found way to prevent its second start (even somebody try to do it).

Code: [Select]
title PLoP boot Manager
# some conditions to block second start will be putted here...
kernel /boot/plop/plpbt.bin

Elmar

  • Administrator
  • Hero Member
  • *****
  • Posts: 2405
  • a command shell is enough to do amazing things
Re: Is there any way to detect than PloP is already loaded?
« Reply #3 on: March 03, 2010, 10:49:54 AM »
you don't understand me. it makes a difference if you boot from the plop boot manager an internal harddisk or you boot a usb/cd drive.

kDn

  • Newbie
  • *
  • Posts: 6
Re: Is there any way to detect than PloP is already loaded?
« Reply #4 on: March 03, 2010, 11:47:23 AM »
you don't understand me. it makes a difference if you boot from the plop boot manager an internal harddisk or you boot a usb/cd drive.
I have MotherBoard(s) USB2.0 compatible, but with slow boot speed without using PloP. So I use boot variant where boot from USB-FlashDrive (BIOS slow) to USB-FlashDrive (speed up with PloP).

Elmar

  • Administrator
  • Hero Member
  • *****
  • Posts: 2405
  • a command shell is enough to do amazing things
Re: Is there any way to detect than PloP is already loaded?
« Reply #5 on: March 03, 2010, 12:32:19 PM »
ok, so you are booting usb. thats all i wanted to know.

you can check the ram for "PoLPu@" below the 640k memory. if you find it, then plop was started and the usb driver is in the ram.

kDn

  • Newbie
  • *
  • Posts: 6
Re: Is there any way to detect than PloP is already loaded?
« Reply #6 on: March 03, 2010, 13:57:49 PM »
ok, so you are booting usb. thats all i wanted to know.

you can check the ram for "PoLPu@" below the 640k memory. if you find it, then plop was started and the usb driver is in the ram.

Thank you very much. I just test this and found signature on address 0x9ac21 on my computer :)

Icecube

  • Newbie
  • *
  • Posts: 47
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #7 on: March 07, 2010, 20:03:30 PM »
@ Elmar
Is there any sort of alignment for the "PoLPu@" string?
Such as, "it's always on a multiple of 16 bytes."
Or, "it's always on a multiple of 4 bytes."

Elmar

  • Administrator
  • Hero Member
  • *****
  • Posts: 2405
  • a command shell is enough to do amazing things
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #8 on: March 07, 2010, 21:39:42 PM »
code to check the installed driver

Code: [Select]

mov eax,"PLoP"
mov ebp,"CHKD"
int 13h
cmp eax,"yes "  ; driver returns "yes "


regards
elmar

kDn

  • Newbie
  • *
  • Posts: 6
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #9 on: March 11, 2010, 07:22:54 AM »
FYI:

This strings were tested on different versions grub4dos, base address 0x3D0*0x200 becouse grub4dos have strings buffer and I don't want read signature from it :)

Code: [Select]
title Start PloP only once
cat --hex --locate=PoLPu@ (md)0x3D0 0x130 || kernel /boot/plop/plpbt.bin
configfile /menu.lst

Code: [Select]
title Test PloP loaded
cat --hex --locate=PoLPu@ (md)0x3D0 0x130 && pause  --wait=5 PloP loaded!
configfile /menu.lst

***

Also same strange things appears when I boot grub4dos from PloP (USB:grub4dos-PloP-grub4dos)
Example:
1. I have one HDD and one USB-Flash Drive, so devices shown by command "find" are: (hd0) - USB-Flash and (hd1) - HDD
2. When I start PloP devices are: (hd0) - USB-Flash, (hd1) - none, (hd2) - none, but HDD
3. If I try something like map --harddrives=100 then see: (hd0) - USB-Flash, (hd1) - none, (hd2) - HDD

If I need to remap drives I can use:
Code: [Select]
map (hd1) (hd0) || map (hd2) (hd0)
map (hd0) (hd1)

but when I need additional checks then I need to use 0.4.5a version grub4dos or more "hard" understood sintax in grub4dos.

Code: [Select]
checkrange 0x80 read 0x8280 && map (hd1) () || map (hd2) ()
checkrange 0x80 read 0x8280 && map () (hd1)

Why this appears, and where is the bug, in PloP or in grub4dos?

Elmar

  • Administrator
  • Hero Member
  • *****
  • Posts: 2405
  • a command shell is enough to do amazing things
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #10 on: March 11, 2010, 11:48:55 AM »
Also same strange things appears when I boot grub4dos from PloP (USB:grub4dos-PloP-grub4dos)
Example:
1. I have one HDD and one USB-Flash Drive, so devices shown by command "find" are: (hd0) - USB-Flash and (hd1) - HDD
2. When I start PloP devices are: (hd0) - USB-Flash, (hd1) - none, (hd2) - none, but HDD

this is because your bios has usb support and the bios is adding the usb device as hard disk. when you use now the boot manager usb driver, then it does the same like your bios and is adding the usb device as hard disk. the bios usb device connection does not work any more because plop usb driver has control over the usb controller. to avoid this, the plop usb driver has to search for any usb hard disk that is provided by the bios and handle them in any way.


regards
elmar

kDn

  • Newbie
  • *
  • Posts: 6
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #11 on: March 11, 2010, 12:15:25 PM »
Ok, thank you, I understand :)

ded2007

  • Newbie
  • *
  • Posts: 3
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #12 on: March 29, 2010, 15:35:05 PM »
Quote
this is because your bios has usb support and the bios is adding the usb device as hard disk. when you use now the boot manager usb driver, then it does the same like your bios and is adding the usb device as hard disk. the bios usb device connection does not work any more because plop usb driver has control over the usb controller. to avoid this, the plop usb driver has to search for any usb hard disk that is provided by the bios and handle them in any way.

Let's consider more difficult situation. 2 HDDs with any partitions + 1 Flash.
http://forum.plop.at/index.php/topic,151.0.html
Are "Fantoms" the bug of  PloP or of grub4dos in this case?

Icecube

  • Newbie
  • *
  • Posts: 47
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #13 on: June 07, 2010, 04:02:31 AM »
This doesn't work with NASM:
Code: [Select]
mov eax,"PLoP"
mov ebp,"CHKD"
int 13h
cmp eax,"yes "  ; driver returns "yes "
You need to reverse all the strings:
Code: [Select]
; Test if PLoP already has booted a CDROM or USB drive
; by checking for the presence of the PLoP INT13 hook
; When PLoP INT13 hook is present, it will return 'yes '
; when called with the following values.

mov eax,'PoLP' ; Reverse of 'PLoP'
mov ebp,'DKHC'  ; Reverse of 'CHKD'
int 13h
cmp eax,' sey'  ; Reverse of 'yes '
jz plop_active
In the attachment (binary and source), you can find a small comboot module for Syslinux (should work in dos too), which tells you if PLoP (INT13 hook) was active before or not.

It currently doesn't support booting a specific entry in your syslinux config file depending on the presence/absence of the PLoP INT13 hook.

Elmar

  • Administrator
  • Hero Member
  • *****
  • Posts: 2405
  • a command shell is enough to do amazing things
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #14 on: June 07, 2010, 10:42:48 AM »
This doesn't work with NASM:

correct, its TASM/MASM/LZASM code

regards
elmar

Icecube

  • Newbie
  • *
  • Posts: 47
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #15 on: June 11, 2010, 17:43:22 PM »
In the attachment, you can find a COM32 for Syslinux (ifplop.c32), which detects if PLoP has booted an USB stick or a CDROM drive (INT13 hook present).

An example of a syslinux.cfg, which shows the possibilities of the ifplop.c32 module:
Code: [Select]
default plopcheck

# Check for the presence of PLoP (run by default)
#   When PLoP INT13 hook is found, run the first label
#   When PLoP INT13 hook isn't found, run the second label
label plopcheck
    com32 ifplop.c32
    append plop_detected -- plop_not_detected

# When PLoP INT13 hook was found, boot the menu system.
# PLoP can have added USB2.0 speed, so the entries we want to boot
# will be read from disk much faster (supposing that we have a BIOS
# that only supports USB1.1 speed).
label plop_detected
    com32 menu.c32
    append syslinux.cfg

# PLoP INT13 hook wasn't found, so we boot PLoP
label plop_not_detected
    linux plpbt.bin
You need to install Syslinux 3.86 (COM32 modules should match the Syslinux version number).
« Last Edit: June 11, 2010, 17:45:41 PM by Icecube »

Icecube

  • Newbie
  • *
  • Posts: 47
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #16 on: June 13, 2010, 01:39:39 AM »
When I boot my USB stick with Syslinux and my ifplop.c32 module:
1. Boot USB stick with Syslinux
2. ifplop.c32 will boot plpbt.bin (no PLoP INT13 active)
3. Select USB option in PLoP
4. Boots USB stick with Syslinux again
5. ifplop.c32 loads menu system

==> works like designed

Now the problem:
1. Boot USB stick with Syslinux
2. ifplop.c32 will boot plpbt.bin (no PLoP INT13 active)
3. Select the partition of USB stick and boot it (not the USB option) in PLoP (PLoP INT13 not active)
4. Boots USB stick with Syslinux again
5. ifplop.c32 loads plpbt.bin again (PLoP INT13 not active)
Code: [Select]
Loading plpbt.bin ..... ready==> PLoP hangs (doesn't display menu)
« Last Edit: June 13, 2010, 01:48:20 AM by Icecube »

Icecube

  • Newbie
  • *
  • Posts: 47
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #17 on: June 13, 2010, 17:34:50 PM »
Another test:
1. Boot USB stick with Syslinux
2. ifplop.c32 will boot plpbt.bin (no PLoP INT13 active)
3. In PLoP, press ESC to return to previous bootloader (Syslinux)

4. Boots USB stick with Syslinux again
5. ifplop.c32 loads plpbt.bin again (PLoP INT13 not active)
6. PLoP boots completely

I can repeat this steps indefinitely, without any problem.

Any idea why selecting the partiton boot option in PLoP and loading plpbt.bin again afterwards, results in a hang?

Elmar

  • Administrator
  • Hero Member
  • *****
  • Posts: 2405
  • a command shell is enough to do amazing things
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #18 on: June 13, 2010, 18:24:41 PM »
Any idea why selecting the partiton boot option in PLoP and loading plpbt.bin again afterwards, results in a hang?

i tried it now  and on my pc it works without any problem.

regards
elmar

Icecube

  • Newbie
  • *
  • Posts: 47
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #19 on: June 14, 2010, 10:11:33 AM »
It hangs in qemu (at least for me):
Code: [Select]
sudo qemu -boot c -hda /dev/sdf

Elmar

  • Administrator
  • Hero Member
  • *****
  • Posts: 2405
  • a command shell is enough to do amazing things
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #20 on: June 14, 2010, 10:18:26 AM »
no problem here with qemu. which boot manager version do you use?

Icecube

  • Newbie
  • *
  • Posts: 47
« Last Edit: July 02, 2010, 02:06:48 AM by Icecube »

Elmar

  • Administrator
  • Hero Member
  • *****
  • Posts: 2405
  • a command shell is enough to do amazing things
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #22 on: July 01, 2010, 23:35:18 PM »
cool  ;D

Icecube

  • Newbie
  • *
  • Posts: 47
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #23 on: February 02, 2012, 19:47:41 PM »
To mimic the method of detecting Plop with grub4dos like done in the ifplop.c32 Syslinux module:

Code: [Select]
#autoload Plop - with plopbt.bin set to boot from USB on the fly.
/plpbt/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44 > (md)0x300+1 &&  cat --locate="EAX=79657320" (md)0x300+1  || kernel /plpbt/plpbt.bin hiddenusb

You will need a recent version of grub4dos:
http://code.google.com/p/grub4dos-chenall/downloads/list
and the bios module for grub4dos:
http://code.google.com/p/grubutils/downloads/list

Explanation:

Code: [Select]
/plpbt/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44 > (md)0x300+1Call BIOS interupt 13h with 'PLoP' in eax and 'CHKD' in ebp and save the result at memory address 0x300 (512 byte 'sector')

Code: [Select]
cat --locate="EAX=79657320" (md)0x300+1See if eax returns 'yes ' (by searching the output of the bios command which is stored in the 512 byte sector at 0X300). If this is the case, Plop's USB or CD driver is active.

Code: [Select]
|| kernel /plpbt/plpbt.bin hiddenusbIf Plop's USB or CD driver is not active, start Plop's USB driver directly.

Edit: link update
See http://www.plop.at/en/bootmanager/plpbt-parameter.html for other parameters to pass to Plop.
« Last Edit: February 07, 2012, 13:15:07 PM by Elmar »

ilko_t

  • Newbie
  • *
  • Posts: 8
Re: [Solved] Is there any way to detect than PloP is already loaded?
« Reply #24 on: February 03, 2012, 00:22:20 AM »
Also same strange things appears when I boot grub4dos from PloP (USB:grub4dos-PloP-grub4dos)
Example:
1. I have one HDD and one USB-Flash Drive, so devices shown by command "find" are: (hd0) - USB-Flash and (hd1) - HDD
2. When I start PloP devices are: (hd0) - USB-Flash, (hd1) - none, (hd2) - none, but HDD

this is because your bios has usb support and the bios is adding the usb device as hard disk. when you use now the boot manager usb driver, then it does the same like your bios and is adding the usb device as hard disk. the bios usb device connection does not work any more because plop usb driver has control over the usb controller. to avoid this, the plop usb driver has to search for any usb hard disk that is provided by the bios and handle them in any way.


regards
elmar


to avoid this, the plop usb driver has to search for any usb hard disk that is provided by the bios and handle them in any way.

Elmar, would consider this quite useful improvement when thinking about a new version?

kDn, Icecube- thanks, very helpful.
« Last Edit: February 03, 2012, 00:29:31 AM by ilko_t »