xrile / grub4dos-chenall

Automatically exported from code.google.com/p/grub4dos-chenall
0 stars 0 forks source link

Environment variables cannot be defined after many set/resets #133

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I cannot give an example, but with Easy2Boot v1 (uses lots of g4d batch files), 
I have found that I run out of environment space for variables.

I define a lot of variables (approx 30-50), set them to zero (set FRED=) and 
use them again, etc.

Eventually I find I cannot define any more varaibles. e.g.
set FILE1=sadsdsa
set FILE2=dsdddsa
set FILE3=saddsdsa

and only FILE1 is set, FILE2 and FILE3 are not set.

Is this a problem with a limited area of memory for variables or maybe there is 
no garbage collection to get rid of old variables in grub4dos?

If you need a batch file to show the problem, I can try to make one.

Is there a way to force garbage collection of the environment variable space?

The use of insmod also seems to reduce this space (I think)?

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by Steve6375 on 12 May 2013 at 8:11

GoogleCodeExporter commented 8 years ago
The max is 60.
you can use `set *` to clear all environment.and using `setlocal` to set local 
environment
eg.
set a=abcd
set b=casdf
set c=asdfsadf
setlocal
set *
set xxxx

Original comment by chenall.cn on 13 May 2013 at 12:18

GoogleCodeExporter commented 8 years ago
What do you mean by max=60?

e.g
set A=1
set B=1
set C=1
set A=
set B=

How many varaible have been used now 1 or 3?

Original comment by Steve6375 on 13 May 2013 at 7:22

GoogleCodeExporter commented 8 years ago
Can the number of variable be increased to say 200? It would be very useful.
e.g. If I have 50 files, I want to hold the names in variables
FILE_1=fred.iso
FILE_2=doris.iso
etc.
This means I can only have about 10-20 files and then all variable space is 
used up?
Also, If I type set after adding many variables  - only about 30 variables are 
listed even though I cannot add any more variables using set!

Original comment by Steve6375 on 13 May 2013 at 10:57

GoogleCodeExporter commented 8 years ago
#2
1

#3
current we  use 1 sector as variable names.and a name max length is 8.
512/8 = 64,above 60 is use for internal variables.
and current is no way to extend.

Why do you need so many variables?
for FILE select why not use a MENU?
MODBOOT select many file to boot,but only use little variables.

Original comment by chenall.cn on 14 May 2013 at 12:19

GoogleCodeExporter commented 8 years ago
I want the user to be able to define his own set of Product Keys for all 
different Windows OS's. Also, for different languages, all of the menu 
headings, menu entries, menu footer text, menu colours, background .bmp 
filename, default entries for each menu are held by variables. This means the 
user can easily change these settings from a simple 'config' file containing:
!BAT
set MainMenu=  ----- MAIN MENI ----
set AUTOMENU= ------ AUTO MENU ----
set MDEFAULT=1
set AUTODEF=3
set MMCOLOUR=0133
etc.

So it is quite easy to run out of variables when I have 12 different menus!
What I do now is make my own 'set' and 'get' code by putting a variable in 
memory at (md)0xxxxxx and then 'get' it back when I want it.

Is there no easy way to have more variables? Perhaps a 2nd set of 60 variables 
called %@FRED% %@DORIS% could be supported which use a different 64 sectors 
somewhere else in memory?

Original comment by Steve6375 on 14 May 2013 at 8:51

GoogleCodeExporter commented 8 years ago
Please try this.
can set up to max 65,536 variables.
use below command to extend.
set @extend BASE_ADDR size
the BASE_ADDR is the memory start of extended variable.
size is how many variables will extended.(MAX is 0xFFFF);

eg.add 10 variables spaces at 0x40000.
set @extend 0x40000 10
this need memory (((10+63)>>6) + 10)*512 = 5632.

You must confirm the BASE_ADDR has enough space.

This feature will undocumented..

Original comment by chenall.cn on 15 May 2013 at 7:43

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you very much for this work!  :-)
It seems to almost work, but using @extend does not clear the memory area 
first. So after a reboot I still have variables there from last time, if I run 
set command.
Of course, I could do
@extend 0x4000 10
set *
at the beginning, but this means I cannot just extend the area inside the 
program.

Please can the @extend command also clear the memory area first?

I also notice that set @  shows
BASE_ADDR:4000,40200,size:10

nice!

Original comment by Steve6375 on 15 May 2013 at 12:43

GoogleCodeExporter commented 8 years ago
Yes!Next.

Original comment by chenall.cn on 16 May 2013 at 12:13

GoogleCodeExporter commented 8 years ago
This issue was updated by revision r344.

the extend variables will not work with SETLOCAL/ENDLOCAL,

Original comment by chenall.cn on 16 May 2013 at 6:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
>>>the extend variables will not work with SETLOCAL/ENDLOCAL

Do you mean setlocal/endlocal will only work for the first 60 variables?

Original comment by Steve6375 on 21 May 2013 at 6:56

GoogleCodeExporter commented 8 years ago
Yes,the setlocal/endlocal only save/restore the first 60.

Original comment by chenall.cn on 23 May 2013 at 12:11