Jump to content











Photo
- - - - -

Check if plop is already loaded ??

grub4dos plop

  • Please log in to reply
24 replies to this topic

#1 k7rim

k7rim

    Newbie

  • Members
  • 12 posts
  •  
    Egypt

Posted 30 January 2012 - 11:38 AM

Hi

there is small question i want to ask
Is there any way to check if plop is already loaded ?

the usb boot sequence will be something like that

the usb boots G4D which loads plop >>loads usb drivers >> boot from usb again
>> G4D checks for plop (it is already loaded) >> load the menu.lst


Like in Syslinux there is a module called ifplop.c32 which do exactly the same function

so is there any workaround in G4D

and could be added in the future releases of grldr??

thank you

#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 30 January 2012 - 01:45 PM

Here is my idea for a workaround
PLOP.TXT starts with PLOP=1 in it.


1 debug off

2 cat --locatei="PLOP=1" /PLOP.TXT  > nul && set PLOP=1

3 cat --locatei="PLOP=2" /PLOP.TXT  > nul && set PLOP=2

4 clear

5 pause --wait=3 PLOP=%PLOP%

6 if "%PLOP%"=="1" cat --locatei="PLOP=" --replace="PLOP=2" /PLOP.TXT  > nul

7 cat --locatei="PLOP=2" /PLOP.TXT > nul && cat /PLOP.TXT && echo PLOP NOW SET TO 2  - loading PLOP... && pause

8 if "%PLOP%"=="1" kernel /plpbt/plpbt.bin

9 cat --locatei="PLOP=" --replace="PLOP=1" /PLOP.TXT  > nul

10 if "%PLOP%"=="2" clear && echo PLOP IS ALREADY LOADED!

11

12 title boot 1

13 reboot

14

15 title boot 2

16 root

The idea was to preconfigure the plpbt.bin file to autoboot to USB after a 5 second countdown by using plpcfgbtGUI.exe (or you can just use the unmodified one for testing - either give the same result).

BUT for some weird reason it doesn't work!!!
At the line 7, if I remove the USB pen and put it onto another PC and look at the PLOP.TXT file its has PLOP=2 in it as expected.
But when it runs line 8 and runs PLOP and displays the PLOP boot menu, if I then remove the USB pen (actually whilst it is still in the PLOP menu) and look at the PLOP.TXT file it has PLOP=1 in it!!!!!!
Weird or what!!!

#3 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 30 January 2012 - 02:37 PM

This seems to work. :clap:
Pinched it from the syslinux forum!



debug off

cat --hex --locate="PoLPu@" (md)0x3d0+0x130 > nul && set PLOP=2

cat --hex --locate="PoLPu@" (md)0x3d0+0x130 > nul || set PLOP=1

pause --wait=3 PLOP=%PLOP%

if "%PLOP%"=="1" kernel /plpbt/plpbt.bin

clear

if "%PLOP%"=="2" clear && echo PLOP IS NOW LOADED!



title boot 1

reboot



title boot 2

root



Or just simplify it to

cat --hex --locate="PoLPu@" (md)0x3d0+0x130 > nul || kernel /plpbt/plpbt.bin

  • k7rim likes this

#4 Icecube

Icecube

    Gold Member

  • Team Reboot
  • 1,050 posts
  •  
    Belgium

Posted 30 January 2012 - 03:03 PM

The proper way to detect if the PLoP USB driver is active, is to use this int 13h check:

TASM/MASM/LZASM compiler:
mov eax,"PLoP"

mov ebp,"CHKD"

int 13h

cmp eax,"yes "  ; driver returns "yes "
NASM compiler:
; 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
This is the way how it is implemented in ifplop.c32.
http://forum.plop.at...opic,165.0.html

#5 tinybit

tinybit

    Silver Member

  • Developer
  • 928 posts
  •  
    China

Posted 30 January 2012 - 10:31 PM

chenall has built an external command of "bios" for calling bios from grub4dos.

it has docs in Chinese. google for it.

#6 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 31 January 2012 - 12:21 AM

I tried the BIOS and this returns EAX=79657320 = yes


title plopbt

kernel /plpbt.bin



title test bios

cat --hex --locate="PoLPu@" (md)0x3d0+0x130 > nul && echo PLOP IS INSTALLED

/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44

echo

pause


maybe this could be output to a file and then tested with cat?
[edit] nope using > to a file doesn't work. Any ideas how to test the result?

#7 laddanator

laddanator

    Frequent Member

  • Advanced user
  • 337 posts
  • Location:Virginia
  • Interests:Writing code and getting stuff to work when no one else can! Wrote a Windows Vista, 7, and 8 legal activation tool in VBscript and compiled it to exe. First project of this undertaking. Working on an AIO legal activation tool that includes XP.
  •  
    United States

Posted 31 January 2012 - 03:25 AM

title plopbt
kernel /plpbt.bin

title test bios
cat --hex --locate="PoLPu@" (md)0x3d0+0x130 > nul && echo PLOP IS INSTALLED
/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44
echo
pause


Kinda off topic but I assume you only use PLoP from USB to gain 2.0 speeds if hardware will allow on slower USB? If you can boot to USB to boot PLoP, then why would you need PLoP unless it was for the USB 2.0 speeds? I use PLoP from my g4d boot dvd to boot USB if needed.

#8 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 31 January 2012 - 09:49 AM

Kinda off topic but I assume you only use PLoP from USB to gain 2.0 speeds if hardware will allow on slower USB? If you can boot to USB to boot PLoP, then why would you need PLoP unless it was for the USB 2.0 speeds? I use PLoP from my g4d boot dvd to boot USB if needed.

Yes, exactly, it is to get USB 2 speeds. Though automating the loading of Plop like this is dangerous in my opinion as I have several i3/i5 systems where Plop does not work (doesn't boot from USB). Personally, I prefer to just have a menu entry to run Plop.

#9 k7rim

k7rim

    Newbie

  • Members
  • 12 posts
  •  
    Egypt

Posted 31 January 2012 - 11:24 AM

This seems to work. :clap:
Pinched it from the syslinux forum!



debug off

cat --hex --locate="PoLPu@" (md)0x3d0+0x130 > nul && set PLOP=2

cat --hex --locate="PoLPu@" (md)0x3d0+0x130 > nul || set PLOP=1

pause --wait=3 PLOP=%PLOP%

if "%PLOP%"=="1" kernel /plpbt/plpbt.bin

clear

if "%PLOP%"=="2" clear && echo PLOP IS NOW LOADED!



title boot 1

reboot



title boot 2

root



Or just simplify it to

cat --hex --locate="PoLPu@" (md)0x3d0+0x130 > nul || kernel /plpbt/plpbt.bin


thank you , this is working

The proper way to detect if the PLoP USB driver is active, is to use this int 13h check:

TASM/MASM/LZASM compiler:

mov eax,"PLoP"

mov ebp,"CHKD"

int 13h

cmp eax,"yes "  ; driver returns "yes "
NASM compiler:
; 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
This is the way how it is implemented in ifplop.c32.
http://forum.plop.at...opic,165.0.html


Can you explain little more? , sorry for disturbance

#10 tinybit

tinybit

    Silver Member

  • Developer
  • 928 posts
  •  
    China

Posted 31 January 2012 - 08:11 PM

The source code of the bios command is here:

http://code.google.c...runk/src/bios.c

For how to build the externals, see comments in

http://code.google.c...runk/src/echo.c

You need to change the address of the
int_regs
to pass regs in a known memory address, and recompile. Then you can check the regs on return of the bios command.

You may use memory at 1M(=0x100000) for the int_regs.

Note that 64K at 1M is currently used as an internal buffer for the dd command. Many other commands can use the same buffer provided there will be no more conflicts.

#11 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 02 February 2012 - 11:10 AM

chenall has suggested this which also works - in this example I have the BIOS grub4dos executable file in the /plpbt folder as well as plpbt.bin

#autoload Plop - must configure plopbt.bin to autorun USB option





/plpbt/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44 > (md)0x300+1 &&  cat --locate="EAX=79657320" (md)0x300+1  || kernel /plpbt/plpbt.bin




  • k7rim likes this

#12 laddanator

laddanator

    Frequent Member

  • Advanced user
  • 337 posts
  • Location:Virginia
  • Interests:Writing code and getting stuff to work when no one else can! Wrote a Windows Vista, 7, and 8 legal activation tool in VBscript and compiled it to exe. First project of this undertaking. Working on an AIO legal activation tool that includes XP.
  •  
    United States

Posted 02 February 2012 - 03:54 PM

you need to have the BIOS grub4dos executable file in the /plpbt folder as well as plpbt.bin


Are you saying the folder has to be called plpbt or that the bios g4d executable just have to be in the same folder with plpbt.bin folder no matter the name of the folder?

#13 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 02 February 2012 - 04:15 PM

Are you saying the folder has to be called plpbt or that the bios g4d executable just have to be in the same folder with plpbt.bin folder no matter the name of the folder?

neither ! It is just that I have pathed it to /plpbt because that is where I put them. They can be anywhere and in different folders if you like!

#14 k7rim

k7rim

    Newbie

  • Members
  • 12 posts
  •  
    Egypt

Posted 02 February 2012 - 04:35 PM

Can you explain what you are doing ?! :frusty:

#15 laddanator

laddanator

    Frequent Member

  • Advanced user
  • 337 posts
  • Location:Virginia
  • Interests:Writing code and getting stuff to work when no one else can! Wrote a Windows Vista, 7, and 8 legal activation tool in VBscript and compiled it to exe. First project of this undertaking. Working on an AIO legal activation tool that includes XP.
  •  
    United States

Posted 02 February 2012 - 04:37 PM

neither ! It is just that I have pathed it to /plpbt because that is where I put them. They can be anywhere and in different folders if you like!


Ok, just making sure. I know the Run.bat ( http://bbs.wuyou.com.....page=1&page=1) is hard coded and has to be in a specific folder so just making sure about the bios file. Thanks, guys.

#16 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 02 February 2012 - 05:17 PM

Can you explain what you are doing ?!

/plpbt/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44 > (md)0x300+1 && cat --locate="EAX=79657320" (md)0x300+1 || kernel /plpbt/plpbt.bin

This is in three parts:
  • run the BIOS executable and redirect the output to memory (sector 1) at address 0x300
  • look for EAX=79657320 at that location - if Plop is loaded then when you call int 13 with eax and ebp set with the previous values, plop will return the register EAX with 'yes ' = 79657320 - if plop driver is not loaded then the BIOS will not understand the call and just return garbage.
  • If the bios call did not return 'yes ' then run plop - this will cause the plop menu to appear. To make plop autoboot from usb, you need to change plopbt.bin beforehand using plpcfgboot.exe GUI. See Tutorial #60 on my site.

  • k7rim likes this

#17 Icecube

Icecube

    Gold Member

  • Team Reboot
  • 1,050 posts
  •  
    Belgium

Posted 02 February 2012 - 06:16 PM

plpbt.bin doesn't necessarily needed to be configured beforehand:
#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
Other options for on the fly configuration can be found at:
http://www.plop.at/e....html#plpcfgbt2
  • k7rim likes this

#18 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 02 February 2012 - 06:52 PM

plpbt.bin doesn't necessarily needed to be configured beforehand:

#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
Other options for on the fly configuration can be found at:
http://www.plop.at/e....html#plpcfgbt2

:clap: nice! thanks.
  • k7rim likes this

#19 k7rim

k7rim

    Newbie

  • Members
  • 12 posts
  •  
    Egypt

Posted 03 February 2012 - 08:44 PM

chenall has suggested this which also works - in this example I have the BIOS grub4dos executable file in the /plpbt folder as well as plpbt.bin

#autoload Plop - must configure plopbt.bin to autorun USB option





/plpbt/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44 > (md)0x300+1 &&  cat --locate="EAX=79657320" (md)0x300+1  || kernel /plpbt/plpbt.bin



/plpbt/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44 > (md)0x300+1 && cat --locate="EAX=79657320" (md)0x300+1 || kernel /plpbt/plpbt.bin


This is in three parts:
  • run the BIOS executable and redirect the output to memory (sector 1) at address 0x300
  • look for EAX=79657320 at that location - if Plop is loaded then when you call int 13 with eax and ebp set with the previous values, plop will return the register EAX with 'yes ' = 79657320 - if plop driver is not loaded then the BIOS will not understand the call and just return garbage.
  • If the bios call did not return 'yes ' then run plop - this will cause the plop menu to appear. To make plop autoboot from usb, you need to change plopbt.bin beforehand using plpcfgboot.exe GUI. See Tutorial #60 on my site.


so the bios excutable calls bios and search for "eax=0x504c6f50 ebp=0x43484b44" (I assume this the
same as "eax,'PoLP' | ebp,'DKHC'" Icecube talked about?

thank you steve

#20 k7rim

k7rim

    Newbie

  • Members
  • 12 posts
  •  
    Egypt

Posted 03 February 2012 - 08:45 PM

plpbt.bin doesn't necessarily needed to be configured beforehand:

#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
Other options for on the fly configuration can be found at:
http://www.plop.at/e....html#plpcfgbt2

Thanks Icecube

#21 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 03 February 2012 - 09:11 PM

so the bios excutable calls bios and search for "eax=0x504c6f50 ebp=0x43484b44" (I assume this the
same as "eax,'PoLP' | ebp,'DKHC'" Icecube talked about?
thank you steve

Yes, it is what IceCube suggested to test, but I don't think you quite understand the system bios call process...

Using the IBM compatible BIOS works like this
1. Load the CPU registers with specific values
2. Execute a software interrupt (in this case int 13h) which will pass control to the BIOS code
3. The BIOS is mapped to the interrupt, so the BIOS code now runs and looks at the registers you have set (typically a part of EAX, AH is used to describe what function is required) - if the registers make sense to the BIOS (i.e. if they are correct and as expected) the BIOS performs the requested task. This could be printing a character on the screen or writing 100 sectors to a hard disk, it just depends on what int and what registers have been set.
4. Depending on the BIOS call result (success/fail, etc.), the BIOS will load some of the CPU registers with specific values and then return control back to the code that originally invoked the s/w interrupt
5. The code following the s/w int call can now examine the CPU registers to see what the result was.

so the bios utility that we are using is setting up the registers with PolP and DKHC, calling int 13 (which will either be the real BIOS or the patched Plop BIOS) and return. If Plop has patched the BIOS, then the int 13 code will actually lead to the Plop code. The Plop code will see the registers are set to PoLP and DKHC and return 'Yes ' in EAX. However, if the Plop driver is not loaded, the BIOS won't be patched, so when the normal BIOS sees 'PoLP' and 'DKHC' it does not understand what is is being asked to do and so just returns back without doing anything.
HTH
  • k7rim likes this

#22 laddanator

laddanator

    Frequent Member

  • Advanced user
  • 337 posts
  • Location:Virginia
  • Interests:Writing code and getting stuff to work when no one else can! Wrote a Windows Vista, 7, and 8 legal activation tool in VBscript and compiled it to exe. First project of this undertaking. Working on an AIO legal activation tool that includes XP.
  •  
    United States

Posted 03 February 2012 - 10:03 PM

So how would this look in a menu.lst as a complete command? Maybe below?

#autoload Plop - must configure plopbt.bin to autorun USB option





/plpbt/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44 > (md)0x300+1 &&  cat --locate="EAX=79657320" (md)0x300+1  || kernel /plpbt/plpbt.bin


title PLoP With USB as Default

find --set-root --devices=h /plpbt/bios

/plpbt/bios int=0x13 eax=0x504c6f50 ebp=0x43484b44 > (md)0x300+1 &&  cat --locate="EAX=79657320" (md)0x300+1  || kernel /plpbt/plpbt.bin


#23 steve6375

steve6375

    Platinum Member

  • Developer
  • 5,340 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 03 February 2012 - 10:05 PM

see http://www.rmprepusb.../tutorials/plop

#24 laddanator

laddanator

    Frequent Member

  • Advanced user
  • 337 posts
  • Location:Virginia
  • Interests:Writing code and getting stuff to work when no one else can! Wrote a Windows Vista, 7, and 8 legal activation tool in VBscript and compiled it to exe. First project of this undertaking. Working on an AIO legal activation tool that includes XP.
  •  
    United States

Posted 03 February 2012 - 10:11 PM

Thanks @steve6375 and by the way you stole my cry! :loleverybody:


'If I can already boot from my USB drive why would I need Plop!"



#25 k7rim

k7rim

    Newbie

  • Members
  • 12 posts
  •  
    Egypt

Posted 04 February 2012 - 01:38 AM

Yes, it is what IceCube suggested to test, but I don't think you quite understand the system bios call process...

Using the IBM compatible BIOS works like this
1. Load the CPU registers with specific values
2. Execute a software interrupt (in this case int 13h) which will pass control to the BIOS code
3. The BIOS is mapped to the interrupt, so the BIOS code now runs and looks at the registers you have set (typically a part of EAX, AH is used to describe what function is required) - if the registers make sense to the BIOS (i.e. if they are correct and as expected) the BIOS performs the requested task. This could be printing a character on the screen or writing 100 sectors to a hard disk, it just depends on what int and what registers have been set.
4. Depending on the BIOS call result (success/fail, etc.), the BIOS will load some of the CPU registers with specific values and then return control back to the code that originally invoked the s/w interrupt
5. The code following the s/w int call can now examine the CPU registers to see what the result was.

so the bios utility that we are using is setting up the registers with PolP and DKHC, calling int 13 (which will either be the real BIOS or the patched Plop BIOS) and return. If Plop has patched the BIOS, then the int 13 code will actually lead to the Plop code. The Plop code will see the registers are set to PoLP and DKHC and return 'Yes ' in EAX. However, if the Plop driver is not loaded, the BIOS won't be patched, so when the normal BIOS sees 'PoLP' and 'DKHC' it does not understand what is is being asked to do and so just returns back without doing anything.
HTH


It feels good to understand :clap:
that's great ,thank you

Edited by k7rim, 04 February 2012 - 01:39 AM.






Also tagged with one or more of these keywords: grub4dos, plop