Help - Search - Members - Calendar
Full Version: Make ram disk C: and Edit "Documents and Settings" folder
The CD Forum > Bart's PE Builder > General
Nandy
Hello group:
This is an usb install but I dont think that matters much for the issue at hand, of so I apologize in advance.
For my application it will be better suite if the ram drive is on the c: drive so it will have the document and settings folder in C:. At this time it is not important for me to access the pc hard drive but that might come later. The application that Im running is hard coded to look for some information on the c:\documents and settings\default\foo folder so I want to also add that info there so when the application is run I dont have to set the options on it every time. I haven't found a way to add that information at the time of build. Any help will be appreciate it.

Thanks!!!!
Ed_P
Once the change is made backup the app's Registry entries and make them into a plugin.
Nandy
Ed_P, not sure I get what you mean...
boot bartpe as usual.
Somehow change the ram disk from b: to c: and the hd to whatever:
Backup the regestry
Somehow make a plugin.

Is that correct?

What about adding the info that I need to the "documents and settings" folder?
Will it be easier to just mount the iso, add what I want, then save the iso? the only problem I will see with that is what to use to save the new info into the iso and then I will have to do it every time I build a new iso...

Thanks!
Ed_P
QUOTE (Nandy @ Oct 14 2010, 12:03 AM) *
Somehow change the ram disk from b: to c: and the hd to whatever:

No. You said:
QUOTE (Nandy @ Oct 13 2010, 06:22 PM) *
so when the application is run I dont have to set the options on it every time.

So what I meant is after you run the unknown application you save it's setting that you have changed, which most likely are stored in the Windows Registry, you save the Registry entries and then create a plugin that applies them to the BartPE Registry when you boot BartPE.
Nandy
Ok, got it! Now part of the changes I do is to copy some files and folders to the "documents and settings" folder via a batch file. Is there a way to create those files at the time of building? I have search and I can't find way to do that.
oscar
Maybe this plugin is what you need:

QUOTE
; PE Builder v3 plug-in INF file
; Created by Bart Lagerweij
; http://www.nu2.nu/pebuilder/
;

[Version]
Signature= "$Windows NT$"

[PEBuilder]
Name="Add Documents and settings folders"
Enable=1

Help="document.htm"

[WinntDirectories]
a="@ProfilesDir@",3
b="@ProfilesDir@\all users",3
c="@ProfilesDir@\all users\desktop",3
d="@ProfilesDir@\default user",3
e="@ProfilesDir@\default user\desktop",3

;; put here your files, for example
[SourceDisksFolders]
Files=a,,1

[SourceDisksFiles]
files\*.*=b,,1
Nandy
Oscar, thanks for the help. I looked at your plugin and other and came with my version but I have one problem. Instead of the files being created in the ram drive (b:) documents and settings folder they end up in the cd (x:) part so the file is read only. I will post where are the files in the xp system and where I want them on the bartpe.

These are the folders in the xp machine:
C:\Documents and Settings\Nandy\Application_Data\AR_System\Home\ARCmds
C:\Documents and Settings\Nandy\Application_Data\AR_System\Home\AlertxEv
C:\Documents and Settings\Nandy\Application_Data\AR_System\Home
C:\Program Files\AR_System\Alert\resdlls\0009
C:\Program Files\AR_System\Alert\License_Agreements
C:\Program Files\AR_System\Alert

This is where I want them on the bartpe
b:\Documents and Settings\Nandy\Application_Data\AR_System\Home\ARCmds
b:\Documents and Settings\Nandy\Application_Data\AR_System\Home\AlertxEv
b:\Documents and Settings\Nandy\Application_Data\AR_System\Home
x:\Program Files\AR_System\Alert\resdlls\0009
x:\Program Files\AR_System\Alert\License_Agreements
x:\Program Files\AR_System\Alert

The program files folder files went fine, but the files that I wanted in the ram drive b: end up also in the x: read only drive.

Here is my plugin:

QUOTE
; PE Builder v3 plug-in INF file
; Created by Bart Lagerweij
; http://www.nu2.nu/pebuilder/
;

[Version]
Signature= "$Windows NT$"

[PEBuilder]
Name="BMC Remedy Alert"
Enable=1

Help="\"

[WinntDirectories]
a="@ProfilesDir@",3
b="@ProfilesDir@\fq2606\Application_Data\AR_System\Home",3
c="@ProfilesDir@\fq2606\Application_Data\AR_System\Home\AlertxEv",3
d="@ProfilesDir@\fq2606\Application_Data\AR_System\Home\ARCmds",3
e="Programs\AR_System\Alert",2
f="Programs\AR_System\Alert\License_Agreements",2
g="Programs\AR_System\Alert\resdlls\0009",2


[SourceDisksFiles]
files\Home_from_doc-set\*.*=b,,1
files\Home_from_doc-set\AlertxEv\*.*=c,,1
files\*.*=e,,1
files\License Agreements\*.*=f,,1
files\resdlls\0009\*.*=g,,1

[Append]
nu2menu.xml, alert.xml


Is what I want possible? If so what am I doing wrong?
Other than that the program is working, but it cant write to the ini file and the other folders that are supposed to be in the document and settings folder.
Rajesh 2010
@oscar
this variable @ProfilesDir@ is not there ,at least as per the documention of bartpe
and bartpe does not create profiles directory in advance ,it creates it on the fly when pe is booted

if you want profiles directory in advance you must create it while building the pe then zip it and also create a batch script which , when pe boots format the ram drive and extract in the ram drive and then load the shell
Ed_P
QUOTE (Rajesh 2010 @ Oct 14 2010, 10:35 PM) *
when pe boots format the ram drive and extract in the ram drive and then load the shell

Yup, that's how it works. Except PE automatically formats the RAM drive when it creates it so the cmd script just needs to copy the files to it, which will then create the folder structure you need.
Nandy
So all I need is a bat file, something like this?
xcopy "x:\documents and settings\*.*" "C:documents and settings\" /e
I tried that and it copies the files I want to the ram drive (which I made c: by editing the ramdisk.inf)
How do I make that command automatic, for it to happen once the ram drive is built? right now I have the batch file doing the copying and then calling the alert.exe on x:. not to elegant, I would have to ad more to that file to cover for a few issues but it works...
oscar
QUOTE (Nandy @ Oct 15 2010, 12:05 AM) *
Oscar, thanks for the help. I looked at your plugin and other and came with my version but I have one problem. Instead of the files being created in the ram drive (b:) documents and settings folder they end up in the cd (x:) part so the file is read only.


Well, I think what you need is the FBWF plugin to make X: the ramdrive and writeable:


http://www.911cd.net/forums//index.php?showtopic=20535
Ed_P
QUOTE (Nandy @ Oct 14 2010, 11:30 PM) *
How do I make that command automatic, for it to happen once the ram drive is built? right now I have the batch file doing the copying and then calling the alert.exe on x:. not to elegant, I would have to ad more to that file to cover for a few issues but it works...

Enable the Startup Group (autorun) plugin. Add a autorun_????.cmd to your D&S plugin.

Review the plugin\autorun\ autorun.htm file for more specifics and scan the plugin folder for autorun*.cmd files and their corresponding .inf files with examples how to add.
Nandy
I have not played with FBWF yet and I will later but for now I want to follow the initial idea to then learn something new.
I have added my registries and have the ram drive on c:, use my autorun_alert.cmd to create my documents and settings and it is also working. So I decided to make it a little dynamic and use the variables while creating my folders and registries but it is not quite working.
This line in my autorun_alert.cmd works:
xcopy "x:\documents and settings\*.*" "%ramdrv%\documents and settings\" /e

but this registries lines dont work:
0x2, "Software\Remedy\AR_System Alert\7.0","HomeDir","%ramdrv%\Documents and Settings\Nandy\Application_Data\AR_System\Home"
When I try to load the user to edit some preferences it tells me the "%ramdrv%\Documents and Settings\Nandy\Application_Data\AR_System\Home"
is an invalid folder. If I hard code the ram drive to c: it works fine.

This one im not sure if it is working or not but I will guess it did not:
0x2, "Software\Remedy\AR_System Alert\7.0","InstallDir","%SystemDrive%\Program Files\AR_System\Alert"

Can someone point out what is the correct variable or if there is something wrong with the order when Im loading my files?

BTW, testing using my vmware is sweet!!! If I could just get them freaking vmware tools to work that will make my day... XPE is also not working for me but that is something to be discussed in a future thread.

Thanks everyone for your support...
Rajesh 2010
QUOTE (Nandy @ Oct 17 2010, 01:28 AM) *
but this registries lines dont work:
0x2, "Software\Remedy\AR_System Alert\7.0","HomeDir","%ramdrv%\Documents and Settings\Nandy\Application_Data\AR_System\Home"
When I try to load the user to edit some preferences it tells me the "%ramdrv%\Documents and Settings\Nandy\Application_Data\AR_System\Home"
is an invalid folder. If I hard code the ram drive to c: it works fine.

This one im not sure if it is working or not but I will guess it did not:
0x2, "Software\Remedy\AR_System Alert\7.0","InstallDir","%SystemDrive%\Program Files\AR_System\Alert"

Can someone point out what is the correct variable or if there is something wrong with the order when Im loading my files?


do u have these statements in autorun_alert.cmd
if yes then that the wrong place because these are not batch commands
because these are bartpe plugin entries .
put these line in your plugin file
like this

CODE
[Software.AddReg]
0x2, "Software\Remedy\AR_System Alert\7.0","HomeDir","%ramdrv%\Documents and Settings\Nandy\Application_Data\AR_System\Home"
0x2, "Software\Remedy\AR_System Alert\7.0","InstallDir","%SystemDrive%\Program Files\AR_System\Alert"


and then build your pe again
Nandy
No, those lines registries lines are in the ini files. Like I said before I get no error if I hard code the line. I cut and pasted the lines so what you see is exactly what I have. I added the line from the cmd line as a piece of the clue as that part obviously work as I get the files copied. Sorry for any confusion I have created.
Rajesh 2010
@Nandy
i cant understand why your prog is working with hardcoded c:
i have never seen any program working like that

just try this
make a regular pe(a basic one) without that program
boot from your pe
and then install ur program in pe
then backup the reg entries related to your program and then put those in your plugin
and also the contents of your ramdrive in your disk
examine them
Rajesh 2010
@Nandy
your program might require some registering of dll


boot in pe and then open command prompt
and cd the folder of your program and run the command


CODE
for /r %i in (*.dll,*.ocx) do regsvr32 %i /s
Nandy
My ramdrive is c:, it don't need to get the dll registEred but thanks for the piece of code. I know I will need it in the future. I guess my question is why the ramdrv variable works on the autorun file but not in the registries entries in the ini file. Apparently it is the right vnuariable...
Rajesh 2010
@Nandy
put these statements in your autorun_alert.cmd after your xcopy command

CODE
reg add HKLM\Software\Remedy\AR_System Alert\7.0 /v HomeDir /f /d %ramdrv%\Documents and Settings\Nandy\Application_Data\AR_System\Home
reg add HKLM\Software\Remedy\AR_System Alert\7.0 /v InstallDir /f /d %SystemDrive%\Program Files\AR_System\Alert


Nandy
I will try that tonight when I get home. So it looks like my original lines are formatted right?
cdob
QUOTE (Nandy @ Oct 17 2010, 05:28 AM) *
but this registries lines dont work:
0x2, "Software\Remedy\AR_System Alert\7.0","HomeDir","%ramdrv%\Documents and Settings\Nandy\Application_Data\AR_System\Home"

That's a reg_expand_sz variable.
Does your application suport this type?
Which registry type exist at regular windows?

QUOTE
This one im not sure if it is working or not but I will guess it did not:
0x2, "Software\Remedy\AR_System Alert\7.0","InstallDir","%SystemDrive%\Program Files\AR_System\Alert"

Again, which registry type exist at regular windows?
Do you use XP SP2 or up? %SystemDrive% is set to x:
Try a fixed drive letter x:, type reg_sz
Rajesh 2010
QUOTE (Nandy @ Oct 17 2010, 08:58 AM) *
I will try that tonight when I get home. So it looks like my original lines are formatted right?


yes they are your lines, but not formatted but in batch file ;reg updated from commandline
this time the registry will be updated from the batch script

so you dont have to put your lines in plugin
Nandy
QUOTE (cdob @ Oct 17 2010, 10:03 AM) *
Again, which registry type exist at regular windows?
Do you use XP SP2 or up? %SystemDrive% is set to x:
Try a fixed drive letter x:, type reg_sz

What do you mean by try reg_sz?
I believe I mention earlier that it works with a hard coded drive letter, is when I use the variable that it fails.
I don't have the exact regestries, will post them later if needed.
Rajesh 2010
QUOTE (Nandy @ Oct 17 2010, 09:53 AM) *
What do you mean by try reg_sz?
I believe I mention earlier that it works with a hard coded drive letter, is when I use the variable that it fails.
I don't have the exact regestries, will post them later if needed.

@cdob suspects that the program is not comfortable with variables like i do.
but instead of hardcoding you can just put those lines i gave you in your batch file
that will do the trick
cdob
QUOTE (Nandy @ Oct 17 2010, 03:53 PM) *
What do you mean by try reg_sz?

Registry Value Types http://msdn.microsoft.com/en-us/library/ms724884(VS.85).aspx
http://www.nu2.nu/pebuilder/help/english/pluginformat.htm
That's 0x1 at a PEBuilder plugin.


QUOTE
I believe I mention earlier that it works with a hard coded drive letter, is when I use the variable that it fails.
Do you have to use letter c: ?
Or can you use any hard coded drive letter?

Nandy
The program can be anywhere but it does resides in c: on it native form so I'm just trying to stick to that then once it is all doing fine I can then make any change, hence my need to make it dynamic.
Now, help me here. I thought those lines were to write to the registry so when the program is launched it has registries already there instead of having to write new ones. The error I had literally was %ramdrv%/path/... Is not a valid path. So what you are telling me is that pe reads my registries lines it save that registry with the variable %ramdrv% and not its value of c: or b:?
cdob
QUOTE (Nandy @ Oct 17 2010, 09:13 PM) *
The program can be anywhere but it does resides in c: on it native form so I'm just trying to stick to that then once it is all doing fine I can then make any change, hence my need to make it dynamic.
Why do you need a dynamic variable?

QUOTE
So what you are telling me is that pe reads my registries lines it save that registry with the variable %ramdrv% and not its value of c: or b:?
Yes, registry contains %ramdrv%.
The question was: does your unknown application support a dynamic variable?
Nandy
QUOTE (cdob @ Oct 17 2010, 05:27 PM) *
Why do you need a dynamic variable?

Yes, registry contains %ramdrv%.
The question was: does your unknown application support a dynamic variable?


I understood your question but im trying to learn here also.
The reason for the dynamic variable is that I learn some time ago not to hard code anything unless it is absolutely necessary. Now, since you are telling me that the registry will contain the variable and not the value then it all make sense and it seems to me that application cant handle variables... This is not an application that I build and have no control over it so I guess I will do what rajesh proposed and take it from there... BTW, got xpe working so I wont be using autorun anyway... we shall see...

Thanks everyone!
Rajesh 2010
@Nandy

yes the piece of code i gave will make your program dyamic as you can see i m usign the variable %ramdrv% etc
just put those lines in your batch file after xcopy

and dont put those line in your inf file

and then report
Nandy
I thought I had replied sorry for the delay. It works!
Thanks.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.