PDA

View Full Version : How Do You Invoke Win32 Environment w/o GUI?



Red Savina
11-26-2011, 12:17 PM
What's the bare necessity to create a Win32 environment? Does this apply to DOS7/Windows98, or is this restricted to the NT os's?

Paul Komski
11-26-2011, 12:25 PM
Please elaborate a bit more. There is a Windows PE Environment (http://en.wikipedia.org/wiki/Windows_Preinstallation_Environment) that Bart has utilised to create his own bootable CD. This is the basis for a Bart PE disk (http://www.nu2.nu/pebuilder/).

There are also CD versions of a WinXP Recovery Console to be found here and there.

The former has a GUI but not the latter, which is essentially a hack of a Windows Installation CD. Most WinXP/2K Installation CDs run a form of Win32 during the text phase before moving on to a GUI part.

Red Savina
12-15-2011, 08:52 PM
I would like to create a command line environment similar to what is found in a DOS box under Win98/2000/XP that allows setting environment variables and running batch files. I would be interested in a Win98 variety that can be booted by floppy (preferably, but not more than two floppies [or a floppy and CD] for everything) and an NT variety like the "XP SAFE mode with command prompt" (which allows access to the full set of DOS-like system commands). Is this what you get with a Bart PE disk based on XP?

The NT "Recovery Console" environment is not what I'm looking for.

I read that for the NT family the files "kernel32.dll", "user32.dll", "gdi32.dll" and "csrss.exe" are involved. Are there different levels of a 32 bit environment, and how would these be invoked? What files are used for the Win98 32 bit environment?

Paul Komski
12-15-2011, 09:29 PM
I'm still a bit unclear about what you want to achieve and where or what it is OK for you to boot from.

There is no "DOS box" under Win2000/XP. All Windows up to WinME basically ran DOS with or without a GUI. The NT OSes from Win2000 onwards can run selected applications (akin to DOS) from a command line.

Batch files are basically text files that run one or a sequence of command prompts in succession.

Win32 Console (http://en.wikipedia.org/wiki/Win32_console) applications and so forth can be compiled using C, C++ and so on.

Red Savina
12-16-2011, 12:16 AM
In 2000 and XP the 'DOS Box' (as I called it) is now called a "Command Prompt", but in Win98 I think it was called "MS DOS", and 'looked' essentially the same.

I was wanting to essentially boot a DOS-like OS from floppy that would behave like the "MS DOS" window in Windows 98, assuming all this could fit onto not more than two floppies. If more than two, then it would be easier to boot to a CD. As I understand, the Win32 API is needed in addition to DOS to run some graphical applications?

I would also like to boot from CD into an environment like the "XP SAFE mode with command prompt". Is this what you get with a Bart PE disk based on XP? Is the Bart PE disk the same as Microsoft's Windows PE 1.1?

Just wanting to experiment a bit without the incumberance of the gui.

mjc
12-16-2011, 12:52 AM
In 2000 and XP the 'DOS Box' (as I called it) is now called a "Command Prompt", but in Win98 I think it was called "MS DOS", and 'looked' essentially the same.

I was wanting to essentially boot a DOS-like OS from floppy that would behave like the "MS DOS" window in Windows 98, assuming all this could fit onto not more than two floppies. If more than two, then it would be easier to boot to a CD. As I understand, the Win32 API is needed in addition to DOS to run some graphical applications?

I would also like to boot from CD into an environment like the "XP SAFE mode with command prompt". Is this what you get with a Bart PE disk based on XP? Is the Bart PE disk the same as Microsoft's Windows PE 1.1?

Just wanting to experiment a bit without the incumberance of the gui.


In Win98 that WAS DOS...real, honest to goodness DOS. Win9x (and ME..in ME, MS severed the visible links and any easy way of accessing the underlying DOS) were just GUI wrappers for DOS. NT's successors (2k, XP and onward) integrated everything. While you can appear to enter something that looks like the old DOS, you aren't...not really. There is no real separation between 'console' and GUI any longer.

Paul Komski
12-16-2011, 03:51 AM
Are there different levels of a 32 bit environment, and how would these be invoked? What files are used for the Win98 32 bit environment?
The first 32 bit MS-DOS environment was MS-DOS 7 and it can be invoked at its most simple level by "SYS"ing a floppy from Windows 98. Such a bootable floppy has a Win98 boot sector and just three files; msdos.sys, command.com and io.sys. OK well this is a 32 bit environment that will run from just a floppy and some RAM but one is severley restricted in what one can do with it apart from looking at compatible structures and copying files and so on.

{Remember too that MS-DOS is not the only available DOS. There are others such as FreeDOS, CalderaDOS and so on and these are available in both 16 and 32 bit versions}.

To this floppy can be added any combination of files (data files, executables and dlls) up to what can be held on the floppy itself or you could invoke Win98 to create a full Win98 startup floppy or simply download one from bootdisk.com in order to have more tools at one's disposal.

Such a floppy will be able to access all FAT partitions but CDROM support is needed in addition in order to access CDs.

Such a floppy can be transformed into a bootable CD (http://www.paulski.com/zpages.php?id=1814) and if it has CDROM support the same CD can hold additional files which can be accessed from the DOS prompt that is reached when booting has completed from the very same CD; the floppy part of the CD would by A: and the CD part would C: or D: or E: etc depending on how many hard drive partitions were also found on the system.

To incorporate the whole of a DOS-based Windows environment then one should boot to a full Windows installation and then drop it to a DOS prompt.

The term Win32 Api refers to programming tools (http://www.winprog.org/tutorial/). These are text based portions of code that can be included when compiling applications (32 bit applications for a Windows environment) in a suitable IDE environment such as Windows Visual Studio's C++ and so on. The resultant .exe (or .dll) can then be run/accessed from a suitable command line if it is console based or from Windows if GUI based.

Console based NT environments are severely restricted and offer little more than is achievable from DOS. A BartPE environment is customisable and (as with WinXP) can run things from a command prompt within the Windows environment that is created so that it can be used to test Windows applications or access Windows XP installations from a CD.

I have no idea if any of the above will help you achieve what you desire - and that is something I am still unclear about.

Red Savina
12-17-2011, 05:56 PM
When there was only the command line I was able to do some quite fantastic things with DOS batch files. For example, a fairly simple one could create a directory tree of any complexity (limited only by the system) based on command line parameters or a data file. GUIs have made a lot of things easier, and some things a lot harder. There always seems to be something where I think maybe a batch file would make this easier. Of immediate concern is that I would like to automate creation of image files and backups of partition tables and boot sectors. Ghost (Symantec) can differentiate between used and unused space, and create compressed images from the command line. I don't know enough about Linux yet to know if there is an imager under Linux that can do this too. There is (for the raw sector backups) a utility called dd for Windows (http://www.chrysocome.net/dd) that has a subset of the UNIX dd functionality. The web page says it needs a "Win32 Environment" to run. (There is also a "dd for DOS" that is just a ploy to get you to look at their website because it is nothing like dd.)

Indeed it will not run in regular DOS. I took the Win98 startup disk and inserted dd.exe into the CAB file. It booted just fine, and the VER cammand says I am running Windows 98, but when I tried to run dd.exe the error message was "This program must be run under Win32". There are two 98 floppies available at bootdisk.com. The OEM one is identical to the one I created myself. I put dd.exe onto the 'custom' one, and still the same error message.

When I boot to Windows 98 (command prompt only) I still get the same error message. The only boot options (SAFE mode or normal) that allowed me to run it were the ones that invoked the full Win98 GUI (in some it was hidden but could be seen by pressing <Alt><Enter>; and likewise the "normal boot" GUI could be hidden). So I am wondering if it is possible to get from a plain DOS environment to an in-between state that has the Win32 environment without the GUI.

In stepping through the loading of Windows 98 I saw more than a screenful of drivers, etc. loaded to get to the Windows 98 GUI environment. This all happened obviously without the help of an AUTOEXEC.BAT or a CONFIG.SYS. Is it possible to boot to plain DOS and then transition to the full Windows 98 environment (if no in-between state can exist)? My "Ghost" is not stable when run from the Windows 98 MS-DOS Command Prompt. It locked the machine and blanked the system clock (I hope that's the only BIOS change it made).

The BartPE disk is obviously worth looking into for other projects.

Paul Komski
12-17-2011, 11:41 PM
If I remember correctly:

a) F5 during Win98 Startup should bypass autoexec.bat and config.sys and load a pure DOS environment.

b) Entering WIN at the command prompt when booted into DOS should load Windows. That may just be Win 3.1 but I think it remainded the same for Win 95 and Win 98.

DOS is a 16bit operating system and the fact that support for long file names and so forth was added to MSDOS7 doesn't detract from that. That is why you will require Win95 and above to have support for Win32 Applications. This started in Win95 and the "architecture" involved was implemented through virtual drivers (VxDs) and the so-called 32bit protected mode. Notwithstanding that 32bit Windows had backward compatibility (though any GUIs could be a bit haphazard) for 16bit applications.

I have messed with dd for Windows and found it a pain. If you want to run dd then I suggest you run it from Linux (floppy/CD/HDD) - it is a great facility and for imaging it can be combined with Gzip commands as entered commands or as bash scripts (which are somewhat equivalent to batch files) to create or restore compressed images.

Image your HDD using dd (http://www.linuxweblog.com/dd-image).

Personally speaking I gave up using Ghost and Partition Magic (especially after it was taken over by Symantec) long ago and migrated to BiNG which along with its sister application ImageForDOS (v1) will make all imaging and partition manipulations a cinch in comparison. I regularly got into problems with both Ghost and PM when run from Windows - all that rebooting to do the stuff regularly created problems - particularly in a multi-partitioned multi-booting hard drive.

I would hazard a guess that you would migrate over to Linux without too many problems. Working from a console is always an option and in the Server editions of Ubuntu that I have used the default was always a non-GUI operating system - and with a wide range of server applications configured during the installation if so desired.

Red Savina
12-18-2011, 06:11 AM
I also remember some very strange results using dd for Windows v0.3 (current v0.5) when using seek/skip on a floppy. I don't remember if I ever tried it on a HDD.

The Image your HDD using dd (http://www.linuxweblog.com/dd-image) is a great reference that leaves only a few points to speculation.

1) I would assume that with the 64k block size that dd recognizes that it has to read/write a partial block when it reaches the end of the partition.

2) When creating the file /tmp/delete.me with a block size of 8M, would this file only have fragments that are multiples of 8M? Or put another way, would a 7M block of contiguous unused space be used to store a fragment of this file?

3) Can dd (or gzip) split the output file, for example to prepare for burning to CD/DVD, or to stay within the max filesize limit of a filesystem?

4) Is the instruction "3. Make sure NO partitions are mounted from the source hard drive." specific to the example of imaging an entire HDD? I would assume that it is still possible (and safe) to write the image file of a partition to another partition on the same physical HDD - the important point being not to have anything mounted while it is being imaged.

5) Can this method provide any indication of progress?

This method would seem to eliminate the need for any command line imaging applications as long as there is some method of zeroing out most of the unused space, which would leave in question only filesystems that Linux cannot write (zeroes) to. This is certainly a simpler and more intuitive cammand line than that using Ghost, with the added advantage that sector backups (partition tables, etc.) can be made in the same environment.

Paul Komski
12-18-2011, 10:32 AM
AFAIK dd reads/writes for as long as it can and then terminates. I don't believe it makes any difference whether the blocks are to/from a file or a drive. dd man page (httphttp://ss64.com/bash/dd.html://).

Rather than split a file you could skip or seek as appropriate when outputting originally. There is a Linux split command (http://unixhelp.ed.ac.uk/CGI/man-cgi?split) that should however do just what you want.

A mounted source partition or a drive containing a mounted partition should be unmounted before proceeding. If the source is a file then the partition containing it must be mounted before proceeding.

dd doesn't give you any progress indicators - the only way is to terminate after say a minute and see how much has been done and thereby calculate the likely total when restarting. A drive with bad sectors will add tremendously to the time it all takes. At the end dd tells you how many blocks it read and wrote..

dd_rescue (not on every distro but certainly on any Knoppix distros I have used) does give you progress and is also a brilliant application to use on bad hard drives.

dd can write both zeros and random numbers if so desired. A modern distro can write to FAT and NTFS as well as all the various Linux file systems. Of course if writing directly to partition or drive the file system is immaterial.

Linux rocks :D

Red Savina
12-19-2011, 12:43 PM
Linux rocks :D You are a great ambassador for Linux.

This discussion no longer has anything to do with Windows, so moving here: Imaging with dd (http://www.pcguide.com/vb/showthread.php?t=81030)