CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > Visual Basic


Visual Basic Discuss Visual Basic programing.


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 10-04-2009, 04:37 PM
 
Join Date: Feb 2008
Location: earth
Posts: 501
cnc2 is on a distinguished road
Question Windows XP environment variables ?

Hi everybody,

Does anyone know how to define/set an environment variable before Windows XP boots & reads the registry information ?

I want to have an environment variable that is defined/set automatically each time I power On the computer, at pre-boot time before XP wants to read the info from the registry.

Do you think ti's doable ? How ?

Please guys, I need your help on this one !

Thanks !
cnc2.
Tweet this Post!Share on Facebook
Reply With Quote

  #2   Ban this user!
Old 10-04-2009, 04:51 PM
 
Join Date: Sep 2009
Location: UK
Posts: 24
glenn@mynesting is on a distinguished road

You can set environment variables in XP via Control Panel -> System. Then choose the "Advanced" tab and there is a button at the bottom to set environment variables. You can set either user variables or system variables. I believe they get stored in the registry and get read as XP loads.

Is that what you're after? If not, what are you trying to achieve?

Glenn
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 10-04-2009, 05:03 PM
 
Join Date: Feb 2008
Location: earth
Posts: 501
cnc2 is on a distinguished road

Thanks Glenn for the fast reply !

No, this isn't what I was after, I already know how to set "normal" environment variables, but what I want to do is to modify the boot sequence so that it dynamically sets an environment variable BEFORE the registry is read...a bit like launching a small batch program before the system wants to read the registry at pre-boot time.

Any idea ?

Thanks !
cnc2.
Tweet this Post!Share on Facebook
Reply With Quote

  #4   Ban this user!
Old 10-04-2009, 05:33 PM
 
Join Date: Sep 2009
Location: UK
Posts: 24
glenn@mynesting is on a distinguished road

I think the only other way is to edit the autoexec.bat in the system root folder. This is a real throwback to the days of DOS ... but the file has remained. I believe the contents of this file are ignored by windows except for any SET commands.

To add a variable you would do something like:

SET MYVAR=C:\SOMEWHERE\SOMETHING

I suppose the challenge now would be to have something that changes the variable in the autoexec.bat before launching Windows. I'm not sure if that's possible.

Perhaps this link will be useful: http://www.tomshardware.co.uk/forum/...5059_35_0.html

The last post in that link seems an interesting option. I think you could use it to specify a registry entry to run a .bat in the start of the Windows load sequence. Perhaps that would enable you to get the appropriate env vars pre-login:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\BootExecute

It's been a while since I wrote .bat files but I seem to recall you can set menu choices which could be used for setting different options.

Sorry I can't provide an out-of-the-box solution to this and I wish you good luck.

Glenn
Tweet this Post!Share on Facebook
Reply With Quote

  #5   Ban this user!
Old 10-04-2009, 07:03 PM
 
Join Date: Feb 2008
Location: earth
Posts: 501
cnc2 is on a distinguished road

Thanks for your help Glenn !

You've posted some great info, but i realise that i didn't explain well.

To sum everything: I need to NOT rely on the registry, & this by setting a variable before the boot loader reads the registry, i know this won't be easy because of the importance the registry has...My final goal is to trick the system & make it look for the registry at a different place than usual...a bit like...i make different copies of the registry & at boot time the environment variable is set by a batch file that reads the path i define in a text file(the path to the reg copy i want to load) or instead of reading a txt it'll just call another batch i modify manually.

I had thought about autoexec.bat but it was a great deception when i read that on Win XP the autoexec.bat was parsed at login time(too late) unlike in Win98 where it is parsed at pre-boot time.

Thanks Glenn, i really apreciate your help.
cnc2.
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 10-06-2009, 12:12 PM
 
Join Date: Sep 2009
Location: UK
Posts: 24
glenn@mynesting is on a distinguished road

I don't think that's possible. MS did away with the DOS OS layer when it got to XP. Now XP IS the OS.

Last advice is to see what can be done in the boot.ini but I don't think it can be scripted nearly as much as autoexec.bat used to be.

Perhaps you'll find better software dev advice from another forum rather than here.

Good luck ...
Glenn

PS. You're not doing anything dodgy are you ... circumventing software licensing etc? ;-) I wouldn't want to offer help (well, ... trying to help) if you were!
Tweet this Post!Share on Facebook
Reply With Quote

  #7  
Old 10-06-2009, 12:47 PM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,659
Blog Entries: 2
Switcher is on a distinguished road

PS. You're not doing anything dodgy are you ... circumventing software licensing etc? ;-) I wouldn't want to offer help (well, ... trying to help) if you were!
LOL

What about a boot CD?

It will start before the C-drive, If you have the CD setup to start first.
__________________
Free DXF Files - Vectorink.com - myDXF.blogspot.com
Tweet this Post!Share on Facebook
Reply With Quote

  #8   Ban this user!
Old 10-06-2009, 12:47 PM
beege's Avatar  
Join Date: Feb 2008
Location: USA
Posts: 510
beege is on a distinguished road

While this doesn't address your particular situation, I know that anything in the "Start Menu/Startup" subdirectory is run automatically after logging in. If you have a batch file in there, it could set variables at that time. I'd start reading about the Linux boot loaders "grub" and "Lilo" to see if a multi-boot system would do what you want it to, Or VMWare, or some "boot magic" software is available for that purpose.
Tweet this Post!Share on Facebook
Reply With Quote

  #9   Ban this user!
Old 10-14-2009, 06:13 AM
 
Join Date: Feb 2008
Location: earth
Posts: 501
cnc2 is on a distinguished road

Thanks to every one for the replies !

Well, I'm not trying anything doggy & I don't intend to defeat the Windows software registration ...etc, cracks for Windows are widely availabe on the net & I don't need to get in that kind of business.

If I succeed in solving this "little" problem, It'll be possible to use an install of windows & register it as usual, transparently in the system I'm designing, If for some reasons I can't solve this problem then, my system will require a corporate version of windows that doesn't need registration...The wrong thing about the corporate version, is that it will narrow the use of my system to the owners of a corporate version of Windows, making my system away from the reach of the common people.

On the sysinternals forum I've been told that the paths are coded in the "configuration manager" which is not explained in the "Windows internals 4th edition"...but on a website I've found that it's Ntldr that locates & reads the registry/hives.

I've found an old post on a forum, talking about reverse engineering ntldr, it said that inside ntldr there's an "embeded" exe, osloader.exe...it would be cool if I could change the paths to suite my needs, but i'm not sure it's doable.

I would also need to somehow read the mac address of the NIC 0 & include it in the path...it'd be perfect....yea but will require a lot of old programming skills to do it in asembler.

Ok, if i'll have to reverse ntldr then, my project will remain experimental until Microsoft agrees to make an official patch to implement this freature.

Any ideas ?

Thanks !
cnc2.
Tweet this Post!Share on Facebook
Reply With Quote

  #10   Ban this user!
Old 10-14-2009, 06:29 AM
 
Join Date: Jul 2005
Location: UK
Age: 29
Posts: 441
daedalus is on a distinguished road

Have you considered the windows embedded version of XP. Its cheaper per licence then XP retail, and doesnt require authentication as its designed for embedded systems. Also you can highly customise the image. There is a free 180 day trial available from microsoft if you want to give it a try.
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 10-14-2009, 07:48 PM
 
Join Date: Feb 2008
Location: earth
Posts: 501
cnc2 is on a distinguished road

Thanks for the reply daedalus !

I heard about XPE when I was looking for an enhanced write filter for XP & found it was only available for XPE.

But, why is XPE cheaper than the retail XP ?
Is there any difference for the common office employee, in using XPE ? Maybe hardware limits ? Network limits ? What about ActiveDirectory & XPE ? Ms Office ...etc ?

How many people are using XPE ?

Thabks !
cnc2.

Last edited by cnc2; 10-14-2009 at 10:26 PM.
Tweet this Post!Share on Facebook
Reply With Quote

  #12   Ban this user!
Old 10-15-2009, 05:36 AM
 
Join Date: Jul 2005
Location: UK
Age: 29
Posts: 441
daedalus is on a distinguished road

XPE is designed for embedded applications, such as when OEMs ship a piece of hardware with XP preinstalled under the hood.

The main difference is you can customise XPE images a lot more than XP, but its not really designed for 'office environments'. The embedded products are usually a little cheaper to encourage people off linux solutions for the same problem. Its mainly used in things like kiosks, newer vending machines, Point of Sale machines, bank ATMs, etc.

It would help if you describe exactly what your trying to do. When you mention installing windows without having to register / set up, is this just a user annoyance issue, or something else (like not being networked when this happens)?

Are you selling hardware to people that has windows installed on it? If so could you sell with MS preinstalled?

EDIT: i realised i didnt really answer your question. Hardware, network, AD, etc is all similar to normal XP. As for users, although it doesnt get a lot of press, the embedded line is in a LOT of products, you just dont normally notice it as most OEMs put a pretty shell over the top. Kind of like the popularity of CE.

Regards,
Tom
Tweet this Post!Share on Facebook
Reply With Quote

Reply

Tags
environment, registry, variable, windows xp




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie- Saving & Restoring Environment on Excellon router dk-info General CAM Discussion 0 08-24-2009 06:56 AM
Need Help!- Bobcad v22 in production environment? cnczoner BobCad-Cam 5 04-18-2008 06:23 PM
What can small shops do to avoid hurting the environment? InspirationTool General Metalwork Discussion 4 05-07-2007 09:25 AM
Windows XP or Windows 2000 better with Mach2 Beezer Mach Software (ArtSoft software) 2 10-18-2004 11:08 AM
Creating a Dos Environment Via Partition Magic? paulried Computers and Networking 21 05-10-2004 10:20 PM




All times are GMT -5. The time now is 01:38 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353