Compare commits

..

951 Commits

Author SHA1 Message Date
The ReactOS Team
0b9b1711a0 This commit was manufactured by cvs2svn to create branch 'FreeLoader'.
svn path=/branches/FreeLoader/; revision=1905
2001-05-15 03:50:25 +00:00
Brian Palmer
afdf923c65 Initial revision
svn path=/trunk/; revision=1904
2001-05-15 03:50:25 +00:00
Casper Hornstrup
bbf48f20aa Removed the assertion
svn path=/trunk/; revision=1903
2001-05-13 13:35:37 +00:00
Eric Kohl
7d0f1e3433 Some named pipe improvements (not usable yet!).
svn path=/trunk/; revision=1902
2001-05-10 23:38:31 +00:00
Rex Jolliff
4c5a154f4d a few more changes to vfat driver
svn path=/trunk/; revision=1901
2001-05-10 06:30:23 +00:00
Rex Jolliff
9cfc87e333 extracted a few more FCB funcs
svn path=/trunk/; revision=1900
2001-05-10 04:02:21 +00:00
Eric Kohl
3c986c6d3a Use MinGW startup code (crt0)
svn path=/trunk/; revision=1899
2001-05-08 11:19:43 +00:00
Casper Hornstrup
432ae66313 oops...back to default configuration
svn path=/trunk/; revision=1898
2001-05-08 09:43:55 +00:00
Casper Hornstrup
fc6a12de18 Preparations for 32-bit/64-bit architectures
Added stubs for most user32.dll functions

svn path=/trunk/; revision=1897
2001-05-07 22:03:27 +00:00
Eric Kohl
3694ebf507 Cleanup
svn path=/trunk/; revision=1896
2001-05-06 22:39:13 +00:00
Eric Kohl
7398918d11 Fixed bootable partition bug
svn path=/trunk/; revision=1895
2001-05-06 22:32:34 +00:00
Emanuele Aliberti
cbcc365a25 Added dist rule.
svn path=/trunk/; revision=1894
2001-05-06 19:28:50 +00:00
Carl Nettelblad
a975142a8d Last change stop CD from working. That's fixed now.
svn path=/trunk/; revision=1893
2001-05-06 17:27:50 +00:00
Carl Nettelblad
96a0d04b3b Removed support for current directories on several drives at once from cmd.exe. Now in NTDLL.
svn path=/trunk/; revision=1892
2001-05-06 17:12:44 +00:00
Carl Nettelblad
8efef1784a Moving support for current dir on several drives from cmd.exe to NTDLL.
svn path=/trunk/; revision=1891
2001-05-06 16:09:03 +00:00
Casper Hornstrup
ba2a8ca045 Added ACPI bus manager
Added ACPI button driver

svn path=/trunk/; revision=1890
2001-05-05 19:15:44 +00:00
Casper Hornstrup
efc93e5ae8 Added runtime configuration of debug prints from kernel debugger (on a per file basis)
svn path=/trunk/; revision=1889
2001-05-05 19:13:10 +00:00
Nedko Arnaudov
6fb7445d87 added optional parameter to specify destination directory
svn path=/trunk/; revision=1888
2001-05-05 19:11:29 +00:00
Phillip Susi
a0fe0d14a0 Removed a bunch of junk from wine and fixed crash on loading
svn path=/trunk/; revision=1887
2001-05-05 18:09:30 +00:00
Eric Kohl
3f98a7dd14 Added makefile
svn path=/trunk/; revision=1886
2001-05-05 18:01:07 +00:00
Eric Kohl
4304c92e6e Fixed silly 'off by one' bug
svn path=/trunk/; revision=1885
2001-05-05 18:00:33 +00:00
Eric Kohl
d13046ca0f Added mailslot fs driver
svn path=/trunk/; revision=1884
2001-05-05 15:21:05 +00:00
Emanuele Aliberti
f7d5d08e6e PORT_MESSAGE_TYPE(m) macro added.
svn path=/trunk/; revision=1883
2001-05-05 12:52:49 +00:00
Eric Kohl
7c469f9c46 Added attributes to object parse method.
svn path=/trunk/; revision=1882
2001-05-05 09:33:16 +00:00
Emanuele Aliberti
ab494baccd Fixed NtQueryDirectoryObject.
svn path=/trunk/; revision=1881
2001-05-04 21:44:21 +00:00
Rex Jolliff
ac9d3e30fb Changed Cc interface func names to CcRos.
Changed CcReleaseFileCache to use and dereference FileObject in BCB
instead of the one passed.

svn path=/trunk/; revision=1880
2001-05-04 01:21:45 +00:00
Nedko Arnaudov
d9776acd0c Added detection of redirection. GetStdHandle() used instead of CreateFile(). Error message is shown to user when it tries to redirect.
svn path=/trunk/; revision=1879
2001-05-03 22:41:16 +00:00
Casper Hornstrup
278ce6bf50 Removed debug code
Compile correctly with pool validation enabled

svn path=/trunk/; revision=1878
2001-05-03 17:24:00 +00:00
Jason Filby
53de047b71 Truetype files from OpenOffice
svn path=/trunk/; revision=1877
2001-05-03 07:17:38 +00:00
Jason Filby
87f05689bc *** empty log message ***
svn path=/trunk/; revision=1876
2001-05-03 07:16:33 +00:00
Eric Kohl
96a826ad92 Moved some heap stubs
svn path=/trunk/; revision=1875
2001-05-03 06:13:05 +00:00
Eric Kohl
973bed37c6 Implemented missing mailslot functions
svn path=/trunk/; revision=1874
2001-05-03 06:10:29 +00:00
Eric Kohl
4be50fdc7e Implemented mailslot functions
svn path=/trunk/; revision=1873
2001-05-02 22:29:18 +00:00
Eric Kohl
9f1e5ac42c Implemented CsrNewThread()
Added some registry functions

svn path=/trunk/; revision=1872
2001-05-02 22:25:58 +00:00
Emanuele Aliberti
ff2adbb728 Added -r switch to objdir to recurse the system name space.
svn path=/trunk/; revision=1871
2001-05-02 20:50:06 +00:00
Eric Kohl
7de8ff7c3c Fixed typo
svn path=/trunk/; revision=1870
2001-05-02 19:04:25 +00:00
Jason Filby
a4a7d78546 Truetype fonts from OpenOffice
svn path=/trunk/; revision=1869
2001-05-02 17:27:00 +00:00
Jason Filby
ce4ce9b5e9 Files incorrectly committed in ASCII
svn path=/trunk/; revision=1868
2001-05-02 17:25:47 +00:00
Jason Filby
66044c37fd reverted to proper makefile
svn path=/trunk/; revision=1867
2001-05-02 15:11:19 +00:00
Jason Filby
98fc0115be accidental commit
svn path=/trunk/; revision=1866
2001-05-02 15:10:24 +00:00
Jason Filby
f5a5752043 minor fix
svn path=/trunk/; revision=1865
2001-05-02 13:46:29 +00:00
Jason Filby
02184a83d4 Update install files
svn path=/trunk/; revision=1864
2001-05-02 12:37:06 +00:00
Jason Filby
979adb975e Update to test new GDI functions
svn path=/trunk/; revision=1863
2001-05-02 12:35:48 +00:00
Jason Filby
5ee6fc75ae GDI32 support for new win32k functions
svn path=/trunk/; revision=1862
2001-05-02 12:35:06 +00:00
Jason Filby
c84d5016d1 Initial font and text support. Fixes to color palette support. Mask and transparent blt support.
svn path=/trunk/; revision=1861
2001-05-02 12:33:42 +00:00
Jason Filby
b27e3264a9 Updates to GDI include files
svn path=/trunk/; revision=1860
2001-05-02 12:31:04 +00:00
Jason Filby
1a4b287958 VGA driver support for TransparentBlt
svn path=/trunk/; revision=1859
2001-05-02 12:29:51 +00:00
Jason Filby
69a45c48b1 Correct palette info. Initial support for bitblt masks
svn path=/trunk/; revision=1858
2001-05-02 12:29:08 +00:00
Jason Filby
6be44d6e81 Correctly configure palette registers
svn path=/trunk/; revision=1857
2001-05-02 12:27:32 +00:00
Jason Filby
4167bc8912 Initial TrueType fonts
svn path=/trunk/; revision=1856
2001-05-02 12:26:15 +00:00
Jason Filby
83352970a1 Freetype 2 includes
svn path=/trunk/; revision=1855
2001-05-02 12:24:36 +00:00
Jason Filby
be9bb3fb3c Freetype 2
svn path=/trunk/; revision=1854
2001-05-02 12:21:38 +00:00
Rex Jolliff
38afc0ac8b Extracted vfat8dot3ToFilename from GetEntryName
Extracted vfatMakeAbsoluteFilename from vfatOpenFile
Extracted vfatGrabFCBFromTable from vfatOpenFile
Extracted vfatNewFCB from vfatOpenFile
Extracted vfatAddFCBToTable from vfatOpenFile
Removed RtlAnsiToUnicode, RtlCatAnsiToUnicode

svn path=/trunk/; revision=1853
2001-05-02 03:18:03 +00:00
Casper Hornstrup
87589daf4e Preparations for checked/free like builds (CPRINT == DbgPrint when DBG is defined).
Modified loadros to support loading symbol files early at startup.
Modified loadros to convey BIOS memory map to the kernel if available.
Began building PnP manager device tree.
Added shutdown command to shell.exe

svn path=/trunk/; revision=1852
2001-05-01 23:08:21 +00:00
Phillip Susi
58e60b3092 Don't crash if win32k.sys isn't there.. it's ok..
svn path=/trunk/; revision=1851
2001-05-01 23:06:25 +00:00
Casper Hornstrup
f98bbb1df7 Ported ACPI CA (from the nice guys at Intel) to ReactOS (ACPI bus driver).
Started on ISA PnP bus driver.

svn path=/trunk/; revision=1850
2001-05-01 23:00:05 +00:00
Casper Hornstrup
1debf1a12d Work on winsock stack and indentation corrections.
svn path=/trunk/; revision=1849
2001-05-01 22:44:07 +00:00
Casper Hornstrup
72c2af4ca7 Better RawIP support.
Minor fixes.

svn path=/trunk/; revision=1848
2001-05-01 22:34:01 +00:00
Emanuele Aliberti
8d5c635a36 NtQueryDirectoryObject rewritten.
apps/objdir.c fixed to work under nt4sp6a AND reactos.

svn path=/trunk/; revision=1847
2001-05-01 21:43:45 +00:00
Nedko Arnaudov
1afd43b049 ^ is used for escape sequences
svn path=/trunk/; revision=1846
2001-05-01 20:53:24 +00:00
Nedko Arnaudov
13eef5cc24 now it compiles
svn path=/trunk/; revision=1845
2001-05-01 19:42:56 +00:00
Rex Jolliff
d73834ea4f added a few more fsd tests
svn path=/trunk/; revision=1844
2001-05-01 17:36:04 +00:00
Eric Kohl
b76211b20a Mailslot and named pipe preparations
svn path=/trunk/; revision=1843
2001-05-01 11:09:01 +00:00
Rex Jolliff
dabd23ba77 added test set for fsd driver
svn path=/trunk/; revision=1842
2001-05-01 04:35:08 +00:00
Rex Jolliff
fdfb9053d9 BUGFIX: Primary partitions that appeared after extended in table were incorrectly mounted
changed some error messages from DPRINT to DbgPrint

svn path=/trunk/; revision=1841
2001-04-30 05:28:17 +00:00
Carl Nettelblad
7e0bfac662 This change shouldn't mess things up, if used together with latest vfat version.
NtQueryInformationFile is required to return valid name information for this to work.

svn path=/trunk/; revision=1840
2001-04-29 21:09:20 +00:00
Carl Nettelblad
59e33e46af Probably getting fcb.PathName handling right this time.
svn path=/trunk/; revision=1839
2001-04-29 21:08:14 +00:00
David Welch
8701c47012 Removed .dbg target
svn path=/trunk/; revision=1838
2001-04-28 22:59:16 +00:00
Phillip Susi
56d6a0c2b1 Undo last change removing config.h, which is now correctly auto generated
svn path=/trunk/; revision=1837
2001-04-26 14:26:23 +00:00
Phillip Susi
39b80bfefd Fixed definition of EPROCESS to work with the forward declaration in ketypes.h
svn path=/trunk/; revision=1836
2001-04-26 13:29:58 +00:00
David Welch
a1f93462d3 Explicitly create config.h
svn path=/trunk/; revision=1835
2001-04-26 13:23:38 +00:00
Phillip Susi
51ca2e3c1a Removed reference to kernel private header internal/ps.h
svn path=/trunk/; revision=1834
2001-04-26 13:23:01 +00:00
Phillip Susi
4420d9e0cb Added forward declaration for EPROCESS
svn path=/trunk/; revision=1833
2001-04-26 13:22:24 +00:00
Eric Kohl
18f8e8da80 Some minor cleanup
svn path=/trunk/; revision=1832
2001-04-26 11:31:33 +00:00
Phillip Susi
af3325ef66 Undo last change
svn path=/trunk/; revision=1831
2001-04-26 04:01:54 +00:00
Phillip Susi
6de9186661 Removed references to obsolete config.h preventing compilation
svn path=/trunk/; revision=1830
2001-04-26 03:58:33 +00:00
Phillip Susi
dff9686ea0 Close handles to shell process/thread
svn path=/trunk/; revision=1829
2001-04-26 01:36:32 +00:00
Phillip Susi
50f5d0807c Added Tail.Overlay.DriverContext to IRP structure
svn path=/trunk/; revision=1828
2001-04-26 01:31:35 +00:00
Phillip Susi
9b3a488664 Fixed bug in IoFlushAdapterBuffers
svn path=/trunk/; revision=1827
2001-04-26 01:30:17 +00:00
Phillip Susi
595a5bad20 Added a check for end of fat chain before end of recorded length
svn path=/trunk/; revision=1826
2001-04-26 01:28:54 +00:00
Phillip Susi
21cbb4fcc1 FAT12GetNextCluster still needs fixed to not assume entire FAT fits in one cache page
Fixed minor typos
Temporary fix for FAT12GetNextCluster to at least not overflow the cache page

svn path=/trunk/; revision=1825
2001-04-26 01:28:15 +00:00
Phillip Susi
dc3c360885 Floppy driver updates, managed to boot system from floppy
svn path=/trunk/; revision=1824
2001-04-26 01:24:31 +00:00
Nedko Arnaudov
197fe0acf4 escape char when setting string value changed to ^
svn path=/trunk/; revision=1823
2001-04-24 23:05:56 +00:00
Nedko Arnaudov
05a5575ff1 minor changes
svn path=/trunk/; revision=1822
2001-04-24 22:53:00 +00:00
Nedko Arnaudov
5ac5ed1e37 quotation handling bug fixed
svn path=/trunk/; revision=1821
2001-04-24 22:32:31 +00:00
Emanuele Aliberti
f57fc2af90 Some FsRtl API updated (stubs) to sync with ntifs.h v25 by Bo Branten.
Added a new DDK header file to group any symbol definition related to
NTIFS: ddk/fstypes.h. Now ddk/ntifs.h includes fstypes and fsfuncs.

svn path=/trunk/; revision=1820
2001-04-24 18:36:39 +00:00
Emanuele Aliberti
a9dc0b739e Compilation bug fixed (due to having used an "unknown" field in the
SYSTEM_MODULE_ENTRY object I updated yesterday).

svn path=/trunk/; revision=1819
2001-04-23 22:00:28 +00:00
Emanuele Aliberti
4fc0783845 Query/SetSystemInformation: added stubs for information classes 0-53 (up to nt5/w2k).
Updated the SYSTEM_INFORMATION_CLASS enumeration with members names from the Net, Dabak and Nebbett.

svn path=/trunk/; revision=1818
2001-04-22 23:06:57 +00:00
Casper Hornstrup
fa71c1ff6c Added kernel debugger help (type help for a list of commands)
svn path=/trunk/; revision=1817
2001-04-22 14:47:00 +00:00
David Welch
40ef0ef8e2 Set the fs register properly on entry to the kernel from an irq
svn path=/trunk/; revision=1816
2001-04-21 22:39:42 +00:00
Eric Kohl
cb2396496c Implemented PsCreateSystemProcess()
svn path=/trunk/; revision=1815
2001-04-21 12:39:33 +00:00
David Welch
71d0b655ac Ignore config.h
svn path=/trunk/; revision=1814
2001-04-20 12:59:59 +00:00
David Welch
6b9f511801 Remove config.h
svn path=/trunk/; revision=1813
2001-04-20 12:59:13 +00:00
Casper Hornstrup
f0e807621f Call KiUpdateSystemTime from KiInterruptDispatch if on first processor.
Mask correct interrupts at each IRQ level
Fixed APIC error on initialization

svn path=/trunk/; revision=1812
2001-04-20 12:42:23 +00:00
David Welch
e344bc3faa UP fixes, was enabling interrupts too early
svn path=/trunk/; revision=1811
2001-04-18 03:31:19 +00:00
David Welch
6dd0418c50 Forgot to test compilation under UP
UP is default

svn path=/trunk/; revision=1810
2001-04-17 23:53:16 +00:00
David Welch
d41145488c SMP scheduling fixes
Obey thread affinity
Fix bogus invariant in KeAcquireSpinLockAtDpcLevel
Protect display with spinlock

svn path=/trunk/; revision=1809
2001-04-17 23:39:26 +00:00
David Welch
f29036d97b Further SMP work (associate an idle thread with each processor)
svn path=/trunk/; revision=1808
2001-04-17 04:11:01 +00:00
David Welch
2cfadf3b41 per processor TSS
svn path=/trunk/; revision=1807
2001-04-16 23:29:55 +00:00
David Welch
2dfc5cfcd4 Missing file
svn path=/trunk/; revision=1806
2001-04-16 18:06:29 +00:00
David Welch
85f85e8462 Further SMP initialization work (now boots all processors on SMP bochs)
Preparation for per-processor GDT

svn path=/trunk/; revision=1805
2001-04-16 16:29:03 +00:00
Nedko Arnaudov
add5e2d89f Added base support for user settings.
svn path=/trunk/; revision=1804
2001-04-16 05:11:54 +00:00
Nedko Arnaudov
2957aa4ce5 Added support for escape sequences when setting string value.
svn path=/trunk/; revision=1803
2001-04-16 05:09:51 +00:00
Nedko Arnaudov
368db861e4 unexpected declaration removed :}
svn path=/trunk/; revision=1802
2001-04-16 05:07:23 +00:00
Nedko Arnaudov
7f0a6dcd48 Implemented: default settings, loading settings from registry key, settings for prompt, normal text colors and command text colors.
svn path=/trunk/; revision=1801
2001-04-16 05:03:29 +00:00
Nedko Arnaudov
2b246092f3 Argument parser now ignores escape sequences.
svn path=/trunk/; revision=1800
2001-04-16 04:58:31 +00:00
Nedko Arnaudov
616e4d5242 Prompt now supports customization. Implementation is based on customization string with escape sequences. The prompt currently recognizes only one sequence in the customization string, \w - the current path.
svn path=/trunk/; revision=1799
2001-04-16 04:53:31 +00:00
David Welch
aeb62db2e8 Default config
svn path=/trunk/; revision=1798
2001-04-16 02:02:43 +00:00
David Welch
65b55ec6c6 SMP detection work
Changed initialization back
Changed to NT IRQLs
Check for return from main

svn path=/trunk/; revision=1797
2001-04-16 02:02:07 +00:00
Casper Hornstrup
bdfcd5630a Fixes for NE2000 driver
svn path=/trunk/; revision=1796
2001-04-16 01:16:36 +00:00
Casper Hornstrup
8c8d19c080 Added PnP and Power structures
svn path=/trunk/; revision=1795
2001-04-16 00:52:12 +00:00
Casper Hornstrup
262859736d Added PnP and Power stubs
svn path=/trunk/; revision=1794
2001-04-16 00:51:19 +00:00
Casper Hornstrup
e8fc884c37 Added PnP and Power structures
svn path=/trunk/; revision=1793
2001-04-16 00:44:54 +00:00
Nedko Arnaudov
1648d6ba62 gdb2\Makefile
svn path=/trunk/; revision=1792
2001-04-15 23:43:12 +00:00
Nedko Arnaudov
2c11752216 RegistryExplorer.cpp
svn path=/trunk/; revision=1791
2001-04-15 22:17:50 +00:00
Nedko Arnaudov
a70a5e92d0 INSTALL
svn path=/trunk/; revision=1790
2001-04-15 22:08:23 +00:00
Casper Hornstrup
94309de6e4 Added Intel MultiProcessor Specification support
svn path=/trunk/; revision=1789
2001-04-13 16:12:26 +00:00
David Welch
33408fe398 Reduced the size of the kernel disk image by moving the initial page
tables and page directory to the bss and initializing them at runtime.

svn path=/trunk/; revision=1788
2001-04-12 00:56:04 +00:00
David Welch
c21076a36c buildno doesn't rewrite the include/reactos/buildno.h
Discard relocations and import table from ntoskrnl
Reorganise multiboot.S

svn path=/trunk/; revision=1787
2001-04-11 22:13:21 +00:00
Casper Hornstrup
db0d247af0 Added loading of symbols when modules are loaded.
Print symbols on stack frame dump.
Put symbols in \SystemRoot\Symbols.

svn path=/trunk/; revision=1786
2001-04-11 12:46:05 +00:00
David Welch
33267a7bd2 More sensible dependencies scheme for configuration
svn path=/trunk/; revision=1785
2001-04-10 22:13:23 +00:00
Eric Kohl
78232dab8b Added functions to run MS VC++ 5/6 apps
svn path=/trunk/; revision=1784
2001-04-10 19:20:37 +00:00
Eric Kohl
6a0be77508 Fixed crash if exported function does not exist
svn path=/trunk/; revision=1783
2001-04-10 19:14:27 +00:00
David Welch
3a788d44ee Trace facility
svn path=/trunk/; revision=1782
2001-04-10 18:15:22 +00:00
David Welch
e40a4953f2 .cvsignore file
svn path=/trunk/; revision=1781
2001-04-10 18:12:51 +00:00
David Welch
bd5d1d2adf Correct problem with keyboard input not being accepted
Added kernel debugger
Kernel configuration

svn path=/trunk/; revision=1780
2001-04-10 17:48:17 +00:00
David Welch
db0e348770 Reorganised cache segment data structure
svn path=/trunk/; revision=1779
2001-04-09 02:45:04 +00:00
jean
de935b3cf0 undo replacement of FILETIME by LARGE_INTEGER.
indeed LARGE_INTEGER cause bad alignement.

svn path=/trunk/; revision=1778
2001-04-07 15:06:17 +00:00
Phillip Susi
9b90a6532b Fixed IoCompleteRequest() to directly call completion function, rather than queue an APC, if the target thread == current thread, because the APC code doesn't seem to correctly handle queueing an APC to the current thread
svn path=/trunk/; revision=1777
2001-04-06 04:29:16 +00:00
Eric Kohl
b2a5aa012c Fixed global and local memory functions
svn path=/trunk/; revision=1776
2001-04-05 01:54:42 +00:00
David Welch
b7437fe01a Fix longstanding bug in keyboard driver
svn path=/trunk/; revision=1775
2001-04-04 22:21:32 +00:00
Eric Kohl
8d1e0c87b3 Fixed a severe typo
svn path=/trunk/; revision=1774
2001-04-03 20:18:21 +00:00
David Welch
b63d768a18 Keep DPC queue size correct
Share section pages with cache if possible
If doing a read direct from disk (not via the cache) don't copy the data
MDL fixes

svn path=/trunk/; revision=1773
2001-04-03 17:25:50 +00:00
Phillip Susi
0858e6f0fb Oops... forgot to use physical address when programming the dma controller
svn path=/trunk/; revision=1772
2001-04-02 23:54:37 +00:00
Phillip Susi
9dfa505536 Fixed DPC bug: when the DPC is run, it has been removed from the queue and therefore can be queued again, the old code did not allow the dpc to be queued again until after the first one returned
svn path=/trunk/; revision=1771
2001-04-02 04:07:49 +00:00
Jason Filby
da6d4130c3 fixed a stupid bug
svn path=/trunk/; revision=1770
2001-04-01 15:18:35 +00:00
David Welch
6ca8f2a32b Use unix style path seperators
svn path=/trunk/; revision=1769
2001-04-01 14:44:40 +00:00
David Welch
c53353dfcb Reverted previous change, unnecessary
svn path=/trunk/; revision=1768
2001-03-31 17:02:17 +00:00
Jason Filby
fd1d23c72f reference moved hal.h
svn path=/trunk/; revision=1767
2001-03-31 16:46:59 +00:00
Phillip Susi
c48815ca85 Moved header
svn path=/trunk/; revision=1766
2001-03-31 16:36:46 +00:00
Jason Filby
0d87c04fdb last typo, really!
svn path=/trunk/; revision=1765
2001-03-31 16:12:13 +00:00
Jason Filby
c321566c86 *** empty log message ***
svn path=/trunk/; revision=1764
2001-03-31 16:09:17 +00:00
Jason Filby
fac82fed75 typo
svn path=/trunk/; revision=1763
2001-03-31 16:05:55 +00:00
Phillip Susi
57dfac271e Added declaration for MmAllocateContiguousAlignedMemory
svn path=/trunk/; revision=1762
2001-03-31 16:02:07 +00:00
Phillip Susi
a758924464 Added FILE_XXX_ALIGNMENT defines
svn path=/trunk/; revision=1761
2001-03-31 16:01:42 +00:00
Phillip Susi
137c93f9c6 DMA support added
svn path=/trunk/; revision=1760
2001-03-31 16:01:03 +00:00
Jason Filby
f56e6b7e9e oops
svn path=/trunk/; revision=1759
2001-03-31 16:00:24 +00:00
Jason Filby
f22ea77911 disable freetype for now
svn path=/trunk/; revision=1758
2001-03-31 15:56:57 +00:00
Phillip Susi
d8538e9795 Massive floppy work
svn path=/trunk/; revision=1757
2001-03-31 15:53:56 +00:00
Phillip Susi
6b46ea08e7 Go back to stripping only debug syms, not everything, from ntoskrnl because the boot loader doesn't correctly process the image and create a BSS, so the BSS overwrites the debug info if it is there, or the first driver loaded if it is not.
svn path=/trunk/; revision=1756
2001-03-31 15:46:08 +00:00
Jason Filby
f3b6ab3603 Indentation corrected, new tests
svn path=/trunk/; revision=1755
2001-03-31 15:43:22 +00:00
Jason Filby
389375c4ee Indentation corrected, minor fixes
svn path=/trunk/; revision=1754
2001-03-31 15:40:34 +00:00
Jason Filby
14c634ca97 Identation corrected, many fixes and minor improvements, initial DIB support
svn path=/trunk/; revision=1753
2001-03-31 15:35:08 +00:00
David Welch
a934fd1c24 Fix for not valid PE module bug
svn path=/trunk/; revision=1752
2001-03-31 12:56:37 +00:00
David Welch
4e81d099cf Check for failed allocation
Split up kernel32 stubs
Print proper stack trace for user mode exceptions

svn path=/trunk/; revision=1751
2001-03-31 01:17:30 +00:00
Phillip Susi
5907d91e41 apps/uitest does not seem to exist, don't try to make it
svn path=/trunk/; revision=1750
2001-03-30 22:10:47 +00:00
David Welch
d135a77c67 Enable atom functions
Don't load NOLOAD sections
Print additional debugging information about module loading

svn path=/trunk/; revision=1749
2001-03-30 17:26:42 +00:00
David Welch
381057612c Don't map NOLOAD sections
svn path=/trunk/; revision=1748
2001-03-30 15:14:53 +00:00
Jason Filby
74412de062 Initialize the VGA to work with display driver's vgavideo.c
svn path=/trunk/; revision=1747
2001-03-29 17:45:50 +00:00
David Welch
fbb680dffd Strip everything from ntoskrnl
svn path=/trunk/; revision=1746
2001-03-29 17:24:43 +00:00
David Welch
877f965575 Remove debugging code
svn path=/trunk/; revision=1745
2001-03-29 02:25:10 +00:00
David Welch
ca5d9b1a2d Fixed int 10 problems
Guard pages for all thread stacks

svn path=/trunk/; revision=1744
2001-03-29 01:14:00 +00:00
David Welch
d9925196f3 Catch stack over/underflows
svn path=/trunk/; revision=1743
2001-03-28 14:24:05 +00:00
David Welch
bde0898ab5 Fixed page list initialization
svn path=/trunk/; revision=1742
2001-03-28 11:57:51 +00:00
Phillip Susi
eca8ca8582 Also removed call to ExAllocatePool from DPRINT1
Why the heck was this in DPRINT1 and not DPRINT?

svn path=/trunk/; revision=1741
2001-03-28 04:43:02 +00:00
Phillip Susi
b20a5f12ed Removed call to ExAllocatePool from CHECKPOINT1
svn path=/trunk/; revision=1740
2001-03-28 03:06:55 +00:00
David Welch
09ad24f08c Print addresses in stack frames even early in the boot
svn path=/trunk/; revision=1739
2001-03-27 21:43:43 +00:00
David Welch
634bb6b997 Set the io bitmap pointer beyond the TSS limit
svn path=/trunk/; revision=1738
2001-03-26 23:01:39 +00:00
Emanuele Aliberti
988ec8cb30 This is really a bare bones counter. It works with the last build.
Not really useful, but lets you watch ROS working for hours.
Counters slow down dramatically (486/66) when many instances are
running (3+). Also a subtle CSR console support bug appears: when
you switch console, if the restored one wrote below the bottom line,
current Y is not the bottom line anymore.

svn path=/trunk/; revision=1737
2001-03-26 21:30:20 +00:00
David Welch
8c86bcfe89 Fixes for page list initialization
V86 mode fixes

svn path=/trunk/; revision=1736
2001-03-26 20:46:53 +00:00
David Welch
51a205bc71 Fixed bug with calling RtlFreeUnicodeString too early in LdrFixupForward
svn path=/trunk/; revision=1735
2001-03-26 16:33:10 +00:00
Phillip Susi
b1601c09d8 Fixed incorrect assertion in IoAllocateController: assert_irql() seems to check for IRQL <= current IRQL, but this function must be called with current IRQL == DISPATCH_LEVEL, not <= DISPATCH_LEVEL.
svn path=/trunk/; revision=1734
2001-03-26 05:03:54 +00:00
Phillip Susi
cf4a06ff33 fixed bug in MmAllocateContiguousAlignedMemory due to uninitialized BaseAddress local
svn path=/trunk/; revision=1733
2001-03-26 04:38:39 +00:00
David Welch
e065bf41ff Bug fixes
svn path=/trunk/; revision=1732
2001-03-26 00:56:53 +00:00
David Welch
9b95a9991c Disable debug prints
svn path=/trunk/; revision=1731
2001-03-25 19:05:30 +00:00
David Welch
99a644a366 Further fixes
svn path=/trunk/; revision=1730
2001-03-25 18:56:13 +00:00
David Welch
c2d9004a56 Oops, forget this file
svn path=/trunk/; revision=1729
2001-03-25 11:48:18 +00:00
David Welch
51f1b4ac50 V86 mode fixes
Preparation for paging support

svn path=/trunk/; revision=1728
2001-03-25 03:34:30 +00:00
David Welch
9b3c1a2a1d Make the trap handlers work early in the boot process
svn path=/trunk/; revision=1727
2001-03-22 11:14:22 +00:00
Casper Hornstrup
5bbfcbdcde Pass RemainingPath for device type FILE_DEVICE_NETWORK
svn path=/trunk/; revision=1726
2001-03-21 23:30:20 +00:00
Casper Hornstrup
61c860daf7 Set FileObject in stack location in NtDeviceIoControlFile
svn path=/trunk/; revision=1725
2001-03-21 23:27:18 +00:00
Casper Hornstrup
547f4b4197 Fix for MmBuildMdlForNonPagedPool
svn path=/trunk/; revision=1724
2001-03-21 23:06:08 +00:00
Casper Hornstrup
0f3822bfb9 Added script for creating binary distribution
svn path=/trunk/; revision=1723
2001-03-21 22:34:24 +00:00
Casper Hornstrup
0b3adffd26 Added classes for cabinet handling
Added a cabinet manager

svn path=/trunk/; revision=1722
2001-03-21 22:32:33 +00:00
David Welch
591d955230 Bug fixes
svn path=/trunk/; revision=1721
2001-03-20 16:09:44 +00:00
Eric Kohl
7a86200cdc Use vidport-functions instead of ntdll-functions
svn path=/trunk/; revision=1720
2001-03-20 15:11:51 +00:00
Eric Kohl
04c0aa0853 Established forwarded exports in vidport.sys
svn path=/trunk/; revision=1719
2001-03-20 15:09:02 +00:00
Eric Kohl
e3b61f2e00 Established forwarded exports in win32k.sys
svn path=/trunk/; revision=1718
2001-03-20 15:06:22 +00:00
Phillip Susi
486ce0ad1a apps/exp does not seem to exist, prevents full make, removing
svn path=/trunk/; revision=1717
2001-03-20 03:09:01 +00:00
David Welch
32e24ab35e User exception handling doesn't work yet
svn path=/trunk/; revision=1716
2001-03-20 00:52:21 +00:00
David Welch
cebfcd7c5e One more bug in MmAllocateContiguousPages
Removed debugging code

svn path=/trunk/; revision=1715
2001-03-18 21:28:30 +00:00
David Welch
ffca6e4a0a Typo
svn path=/trunk/; revision=1714
2001-03-18 20:30:22 +00:00
Emanuele Aliberti
f8ad495ac2 Really simple application that displays how much time elaped.
svn path=/trunk/; revision=1713
2001-03-18 20:20:13 +00:00
Emanuele Aliberti
f907dc6e87 KERNEL32.GetSystemTimeAsFileTime prototype added.
svn path=/trunk/; revision=1712
2001-03-18 20:18:34 +00:00
David Welch
7e2c26824a Beginnings of user-mode debugging support.
svn path=/trunk/; revision=1711
2001-03-18 19:52:38 +00:00
David Welch
1e02a7d8d9 Allocate pages beginning from the top of memory
svn path=/trunk/; revision=1710
2001-03-18 19:37:54 +00:00
David Welch
d60628a01b Fixes for APC handling
Fixes for exceptions
Remove KeAddTimeoutThread
Beginnings of debug handling
Fixes for contiguous memory allocation
Cancel the thread timer before termination

svn path=/trunk/; revision=1709
2001-03-18 19:35:14 +00:00
Emanuele Aliberti
01846dd237 Stubs for LookupPrivilege* added.
svn path=/trunk/; revision=1708
2001-03-17 22:05:25 +00:00
David Welch
5d2401e39c More missing files
svn path=/trunk/; revision=1707
2001-03-17 12:20:13 +00:00
David Welch
1a0448a35b Bug fixes
Started work on exception handling

svn path=/trunk/; revision=1706
2001-03-17 11:11:11 +00:00
David Welch
58fc2c8cf8 Oops, missing files
svn path=/trunk/; revision=1705
2001-03-17 09:43:27 +00:00
David Welch
6fbeba1e7c Moved microkernel to the architecture specific directory
svn path=/trunk/; revision=1704
2001-03-16 23:05:00 +00:00
David Welch
2a613a30c4 Removed obsolete header files
Updated copyright notices

svn path=/trunk/; revision=1703
2001-03-16 18:11:24 +00:00
David Welch
9926c78c7f Removed obsolete file
svn path=/trunk/; revision=1702
2001-03-16 16:23:05 +00:00
David Welch
18015b2244 * include/ddk/zw.h: Corrected declarations of NtCreateProfile,
NtQueryIntervalProfile, NtSetIntervalProfile.
* include/ddk/zwtypes.h: Added definitions of KPROFILE_SOURCE.
* ntoskrnl/include/internal/ke.h: Added the interrupted EIP as a
parameter to KiUpdateSystemTime for profiling purposes.
* ntoskrnl/include/internal/nt: Added declaration for profiling
support initialization.
* ntoskrnl/ke/timer.c (KiUpdateSystemTime, KeExpireTimers): Call
the profiling code on a timer interrupt with the interrupt EIP.
* ntoskrnl/ke/i386/irq.c (KiDispatchInterrupt): Pass the
interrupted EIP to KiUpdateSystemTime.
* ntoskrnl/mm/virtual.c (NtReadVirtualMemory, NtWriteVirtualMemory):
Release the MDLs used properly.
* ntoskrnl/nt/nt.c: Call the profiling support initialization.
* ntoskrnl/nt/ntevent.c (NtCreateEvent): Don't try copying the
ObjectAttributes parameter if it is NULL.
* ntoskrnl/nt/profile.c: Implemented profiling.

svn path=/trunk/; revision=1701
2001-03-16 16:05:34 +00:00
David Welch
18f3b6c58b * ntoskrnl/include/internal/safe.h: Corrected typo.
* ntoskrnl/nt/ntevent.c (NtCreateEvent, NtOpenEvent, NtQueryEvent):
  Corrected typos.
* ntoskrnl/rtl/mem.c: Missing header file.

svn path=/trunk/; revision=1700
2001-03-16 10:58:47 +00:00
David Welch
22dc9e2a5e * ntoskrnl/include/internal/safe.h: Add definitions for handling
potentially unsafe pointers.

svn path=/trunk/; revision=1699
2001-03-16 09:53:28 +00:00
David Welch
3744b5d4cf * ntoskrnl/include/internal/mm.h: Removed MmSafeCopyToUser and
MmSafeCopyFromUser as source files need these but don't want internal
  mm definitions.
* ntoskrnl/nt/ntevent.c (NtCreateEvent, NtOpenEvent, NtPulseEvent,
  NtQueryEvent, NtResetEvent, NtSetEvent): Copy data to and from user mode
  safely.
* ntoskrnl/rtl/mem.c (MmCopyToCaller, MmCopyFromCaller): Helper functions
  for copying data to and from potentially unsafe pointers.

svn path=/trunk/; revision=1698
2001-03-16 09:50:38 +00:00
David Welch
549cb5b03d Further fixes
svn path=/trunk/; revision=1697
2001-03-16 00:00:47 +00:00
David Welch
2eb05bdbc5 Further dependency fixes
svn path=/trunk/; revision=1696
2001-03-15 23:41:31 +00:00
David Welch
7244e5bac9 Hopefully final dependencies fixes
svn path=/trunk/; revision=1695
2001-03-15 22:13:50 +00:00
David Welch
e7f98c9000 Missing file
svn path=/trunk/; revision=1694
2001-03-15 20:15:05 +00:00
David Welch
be2ca4fccd Oops, missing files
svn path=/trunk/; revision=1693
2001-03-15 18:52:45 +00:00
David Welch
a068c65d79 Oops, cope if the dependency list is empty
svn path=/trunk/; revision=1692
2001-03-15 18:49:17 +00:00
David Welch
c3c30d0692 Further dependency tracking fixes
svn path=/trunk/; revision=1691
2001-03-15 18:37:29 +00:00
David Welch
6fc1bdc912 Merge adjacent free blocks in the non-paged pool
Don't print the timer tick count to the screen

svn path=/trunk/; revision=1690
2001-03-14 23:19:14 +00:00
David Welch
d12635ff66 Remove part of the script
svn path=/trunk/; revision=1689
2001-03-14 16:36:26 +00:00
David Welch
5e5862c7fe More dependency fixes
svn path=/trunk/; revision=1688
2001-03-14 16:30:08 +00:00
David Welch
fc5f4ae9a5 Some work on portabilitity
svn path=/trunk/; revision=1687
2001-03-14 00:21:22 +00:00
David Welch
f7186d4cc3 Disable pool validation by default
svn path=/trunk/; revision=1686
2001-03-13 21:46:43 +00:00
David Welch
fba831e913 Reenable pool validation
svn path=/trunk/; revision=1685
2001-03-13 21:39:47 +00:00
Jason Filby
efbd594370 OLE32 header files from Jurgen Van Gael
svn path=/trunk/; revision=1684
2001-03-13 19:00:13 +00:00
David Welch
33702a0775 Retain reference to file objects so cached data isn't automatically loss
when the last handle is closed

svn path=/trunk/; revision=1683
2001-03-13 17:47:47 +00:00
David Welch
47ea39add9 Represent page-in operations by descriptors
svn path=/trunk/; revision=1682
2001-03-13 16:25:55 +00:00
David Welch
c20f2479b6 Further dependency tracking fixes
svn path=/trunk/; revision=1681
2001-03-12 19:23:48 +00:00
David Welch
7853be9c86 Escape '\' on UNIX
svn path=/trunk/; revision=1680
2001-03-12 17:32:54 +00:00
David Welch
6ea1527cfc Fixes for dependency tracking
svn path=/trunk/; revision=1679
2001-03-12 16:10:57 +00:00
David Welch
d520a12907 Close section handle after NtCreateProces in KERNEL32.CreateProcess
Cleanup after file object dereference
Cleanup after section object dereference

svn path=/trunk/; revision=1678
2001-03-09 14:40:28 +00:00
David Welch
6e9d388644 Reverted broken code
svn path=/trunk/; revision=1677
2001-03-08 22:48:42 +00:00
David Welch
6e89a9d21c Proper cleanup after processes
svn path=/trunk/; revision=1676
2001-03-08 22:06:02 +00:00
Carl Nettelblad
03e327f37f Current directory now always with correct casing.
svn path=/trunk/; revision=1675
2001-03-07 22:29:09 +00:00
David Welch
c5cdaa420a More .cvsignore files
svn path=/trunk/; revision=1674
2001-03-07 16:55:42 +00:00
David Welch
c706428a2b Added tagging of most allocates
Added facility to print out newly allocated blocks from the non paged pool

svn path=/trunk/; revision=1673
2001-03-07 16:48:45 +00:00
Eric Kohl
05428a2fea Added request routine for IRP_MJ_CLEANUP
svn path=/trunk/; revision=1672
2001-03-07 13:44:41 +00:00
David Welch
3073e95ed9 Print out the contents of the non-paged pool on SysRq+'A'
Bug fixes

svn path=/trunk/; revision=1671
2001-03-07 08:57:09 +00:00
Carl Nettelblad
f665b3f2f4 FILE_NAME_INFORMATION, returning correct casing thanks to changes in create.c
svn path=/trunk/; revision=1670
2001-03-06 23:36:35 +00:00
Carl Nettelblad
29552067b3 NtQueryObject in early test version and reorganization of NtQueryInformationFile.
svn path=/trunk/; revision=1669
2001-03-06 23:34:39 +00:00
Carl Nettelblad
870a302f96 Restoring NDEBUG flag again.
svn path=/trunk/; revision=1668
2001-03-06 23:31:44 +00:00
Carl Nettelblad
9e66717a35 Storing the real casing of names internally.
svn path=/trunk/; revision=1667
2001-03-06 23:28:42 +00:00
David Welch
43038e9c15 Hide dependency files
Wildcard characters are illegal in filenames

svn path=/trunk/; revision=1666
2001-03-06 17:28:25 +00:00
David Welch
e87e6d58ee And again.
svn path=/trunk/; revision=1665
2001-03-06 14:52:58 +00:00
David Welch
971b171d02 Minor dependency tracking fixes
svn path=/trunk/; revision=1664
2001-03-06 14:51:07 +00:00
David Welch
044ab2b0df Automatic dependency tracking
svn path=/trunk/; revision=1663
2001-03-06 14:41:18 +00:00
Eric Kohl
2d5f3d1c74 Fixed typos
Added more safety checks
Minor cleanup

svn path=/trunk/; revision=1662
2001-03-06 08:19:58 +00:00
Carl Nettelblad
de10767975 Additional fixes.
svn path=/trunk/; revision=1661
2001-03-06 06:20:36 +00:00
Eric Kohl
2ec9eaf736 Increased number of busy retries
svn path=/trunk/; revision=1660
2001-03-04 00:46:46 +00:00
Carl Nettelblad
d5d8d819b8 Reflecting changes in crtdll.
svn path=/trunk/; revision=1659
2001-03-03 13:28:28 +00:00
Carl Nettelblad
afe0e9f601 Fragmented directories and crosslinking related fixes.
svn path=/trunk/; revision=1658
2001-03-02 15:59:16 +00:00
Carl Nettelblad
d3e61a64dd Fixes for cmd copy command.
svn path=/trunk/; revision=1657
2001-03-02 15:45:31 +00:00
Eric Kohl
5149f0d29a Some atom prototype fixes
svn path=/trunk/; revision=1656
2001-03-01 15:36:34 +00:00
Eric Kohl
bf9d9a12e7 Fix for RtlUnicodeStringToInteger
svn path=/trunk/; revision=1655
2001-03-01 15:30:36 +00:00
David Welch
574a1b82f4 Changed wildcare handling (Carl Nettelblad)
svn path=/trunk/; revision=1654
2001-03-01 13:46:22 +00:00
David Welch
a2329a46e9 Fixed from Carl Nettelblad
svn path=/trunk/; revision=1653
2001-03-01 07:48:17 +00:00
Phillip Susi
c9a6908fb9 Fixed crash on help command, due to a buffer overflow. Thanks to jim4
svn path=/trunk/; revision=1652
2001-02-28 23:51:58 +00:00
Eric Kohl
ea6cacb6ed Various improvements by Carl Nettelblad.
svn path=/trunk/; revision=1651
2001-02-28 22:33:23 +00:00
David Welch
80ec0821f8 Allow allocating aligned, contiguous memory
svn path=/trunk/; revision=1650
2001-02-28 18:23:32 +00:00
Casper Hornstrup
327980fe31 Return affinity in HalpGetSystemInterruptVector
svn path=/trunk/; revision=1649
2001-02-25 12:54:37 +00:00
Casper Hornstrup
85e1649fc4 Fix for RtlUnicodeStringToInteger
svn path=/trunk/; revision=1648
2001-02-25 12:51:43 +00:00
Eric Kohl
c3dc053ba2 Fixed a horrible typo :-)
svn path=/trunk/; revision=1647
2001-02-22 23:46:45 +00:00
Eric Kohl
3121974d42 Implemented forwarded exports in kernel-mode
svn path=/trunk/; revision=1646
2001-02-21 18:19:19 +00:00
David Welch
c1c75ffd5e Fix from Mike Lerwill for KeStallExecutionProcessor
svn path=/trunk/; revision=1645
2001-02-20 14:43:46 +00:00
David Welch
15445cf1c8 Corrected va_arg bugs
Don't require c++ for compilation
Make sure the various stddef.h headers are kept seperate

svn path=/trunk/; revision=1644
2001-02-19 15:04:51 +00:00
David Welch
ac82b90278 Fix for memory management issue.
svn path=/trunk/; revision=1643
2001-02-18 22:16:05 +00:00
Phillip Susi
24fea578c1 Updated instructions
svn path=/trunk/; revision=1642
2001-02-18 21:35:21 +00:00
David Welch
209d2a0bdd Removed timer app
svn path=/trunk/; revision=1641
2001-02-18 21:04:09 +00:00
Phillip Susi
835e5e69e5 Ignore csrss.coff
svn path=/trunk/; revision=1640
2001-02-18 20:15:14 +00:00
Phillip Susi
dae0efdd4a Ignore keyboard.coff, keyboard.sys.unstripped
svn path=/trunk/; revision=1639
2001-02-18 20:11:41 +00:00
Phillip Susi
fd25f6dae0 Ignore vfatfs.coff
svn path=/trunk/; revision=1638
2001-02-18 20:10:32 +00:00
Phillip Susi
c57a9b4991 Ignore vidport.coff
svn path=/trunk/; revision=1637
2001-02-18 20:07:41 +00:00
Phillip Susi
2b3a1f40c1 Ignore vgamp.coff
svn path=/trunk/; revision=1636
2001-02-18 19:58:41 +00:00
Phillip Susi
689a632cf7 Ignore vgaddi.coff, vgaddi.dll
svn path=/trunk/; revision=1635
2001-02-18 19:56:14 +00:00
Phillip Susi
b65738db8d Ignore ide.sys.unstripped
svn path=/trunk/; revision=1634
2001-02-18 19:55:17 +00:00
Phillip Susi
4546061999 Ignore floppy.sys.unstripped
svn path=/trunk/; revision=1633
2001-02-18 19:54:37 +00:00
Phillip Susi
20612fed4c Ignore blue.sys.unstripped
svn path=/trunk/; revision=1632
2001-02-18 19:53:37 +00:00
Phillip Susi
99529fbb93 Missing .cvsignore
svn path=/trunk/; revision=1631
2001-02-18 19:47:42 +00:00
Phillip Susi
e9143b26d7 Fixes to waitable timer implementation
svn path=/trunk/; revision=1630
2001-02-18 19:43:15 +00:00
Phillip Susi
3d4886b292 Switched to using waitable timers instead of Sleep(), gives more accurate time cycles, also added some small optimizations
svn path=/trunk/; revision=1629
2001-02-18 19:31:38 +00:00
Emanuele Aliberti
349ae0c799 CMD: implemented IF [NOT] DEFINED variable command
CMD: fixed IF NOT EXIST file command

svn path=/trunk/; revision=1628
2001-02-18 18:51:46 +00:00
David Welch
f827a8f124 Fixed reference counting of page tables
Don't print addresses that aren't in the text segment of a module

svn path=/trunk/; revision=1627
2001-02-18 17:43:32 +00:00
Eric Kohl
d458692c89 Removed obsolete code
svn path=/trunk/; revision=1626
2001-02-17 17:42:46 +00:00
Eric Kohl
65a803db11 Added missing RtlGetProcessHeaps() prototype
svn path=/trunk/; revision=1625
2001-02-17 17:40:05 +00:00
Eric Kohl
0e40521339 Fixed timer access right
svn path=/trunk/; revision=1624
2001-02-17 00:07:49 +00:00
Eric Kohl
9f2db0a1d2 Established forwarded exports and removed superfluous functions
svn path=/trunk/; revision=1623
2001-02-17 00:02:32 +00:00
David Welch
beae346469 Changed irq handler from C to assembler
Began work on holding information about active page operations

svn path=/trunk/; revision=1622
2001-02-16 18:32:20 +00:00
David Welch
727b62c27f Fixed MmProbeAndLockPages issues pointed out by Philip Susi
svn path=/trunk/; revision=1621
2001-02-14 02:53:54 +00:00
Phillip Susi
07142de752 Darnit, don't override the rules.mak rule for building resources
svn path=/trunk/; revision=1620
2001-02-12 03:50:00 +00:00
Eric Kohl
933ff9a467 Changed version information for 0.0.17
svn path=/trunk/; revision=1619
2001-02-11 15:02:48 +00:00
Eric Kohl
b91cda60d8 RtlInitializeCriticalSection() returns NTSTATUS
svn path=/trunk/; revision=1618
2001-02-11 00:15:56 +00:00
David Welch
9359db14a0 Section and general memory manager enhancements including COW
svn path=/trunk/; revision=1617
2001-02-10 22:51:11 +00:00
Eric Kohl
29c4727f7a Preliminary command line fix
svn path=/trunk/; revision=1616
2001-02-10 22:30:21 +00:00
Eric Kohl
6922d2a9e5 GetModuleFileName[A/W] must cope with NULL module handles
svn path=/trunk/; revision=1615
2001-02-10 22:29:35 +00:00
Eric Kohl
af68ad91d4 Preparations for use of forwarded exports
svn path=/trunk/; revision=1614
2001-02-10 22:26:26 +00:00
Eric Kohl
03fd77240f Fixed typos
svn path=/trunk/; revision=1613
2001-02-10 22:23:30 +00:00
Emanuele Aliberti
b611b79b36 KERNEL32.GetProcessVersion partial implementation.
KERNEL32.GetSystemInfo about finished.

svn path=/trunk/; revision=1612
2001-02-10 22:01:50 +00:00
Emanuele Aliberti
37361ed1e8 GetProcessVersion prototype missing.
svn path=/trunk/; revision=1611
2001-02-10 22:00:20 +00:00
Eric Kohl
41280eeeb5 Implemented handling of forwarded exports
svn path=/trunk/; revision=1610
2001-02-10 10:04:39 +00:00
David Welch
c87bd2d365 More FAT32 fixes
svn path=/trunk/; revision=1609
2001-02-06 20:17:35 +00:00
David Welch
c93d52a405 Use import hint if present
svn path=/trunk/; revision=1608
2001-02-06 05:50:50 +00:00
Phillip Susi
ae14d5ffc6 If APC routines are supposed to be STDCALL, then they should all be, and a lot of code needs fixed. Because all of the existing code seems to not use STDCALL, neither should the normal routine. This was causing ntoskrnl to fail to compile
svn path=/trunk/; revision=1607
2001-02-06 05:12:42 +00:00
Phillip Susi
501fee0d15 Fixed makefile to use default rule for building resources, and fixed resource includes to use paths relative to the include dir given to windres by rules.mak
svn path=/trunk/; revision=1606
2001-02-06 03:58:34 +00:00
David Welch
bcc1b4e9a5 Implemented binary search of the export tables
svn path=/trunk/; revision=1605
2001-02-06 02:03:35 +00:00
David Welch
b2fe7525bf Reads of the FAT on FAT32 filesystems go through the cache, writes are
disabled

svn path=/trunk/; revision=1604
2001-02-06 00:41:19 +00:00
David Welch
076c1c6ac3 Fixed timer code
Fixed NtClose return in case of error
Added new APC-like primitive for terminating threads
Fixed restriction on size of working set

svn path=/trunk/; revision=1603
2001-02-06 00:11:20 +00:00
Phillip Susi
ae6b859854 Fixed clock increment for 10ms clock, and bug in computing relative time
svn path=/trunk/; revision=1602
2001-02-05 02:31:04 +00:00
Eric Kohl
fef0ed0d35 Implemented KeRemoveQueueApc() (not exported).
Implemented timer object.

svn path=/trunk/; revision=1601
2001-02-04 17:28:13 +00:00
Eric Kohl
543839bcee Implemented ObOpenObjectByPointer().
svn path=/trunk/; revision=1600
2001-02-03 23:25:06 +00:00
Eric Kohl
2a2b027dc1 Fixed command line size
Added workaround for broken command line support

svn path=/trunk/; revision=1599
2001-02-03 10:40:19 +00:00
Eric Kohl
62d9e11763 Reduced command line size in ReactOS mode
svn path=/trunk/; revision=1598
2001-02-03 10:37:51 +00:00
Eric Kohl
a7772a9954 Fixed command line size
svn path=/trunk/; revision=1597
2001-02-03 10:36:11 +00:00
Jason Filby
a34348ef4e *** empty log message ***
svn path=/trunk/; revision=1596
2001-02-03 10:29:54 +00:00
jean
47f77fa056 oops! leave make a pop, and caller of alloca make esp = esp +16.
svn path=/trunk/; revision=1595
2001-02-03 10:28:28 +00:00
Jason Filby
766ded4e0f Corrected line feeds so that DOS can run the .bat
svn path=/trunk/; revision=1594
2001-02-03 10:28:14 +00:00
Eric Kohl
ec9ef6951c Added access right mapping
Fixed access rights

svn path=/trunk/; revision=1593
2001-02-02 20:49:40 +00:00
jean
5f529d5a90 *** empty log message ***
svn path=/trunk/; revision=1592
2001-02-01 16:51:03 +00:00
jean
65249c23ae correct some bugs in spawn... functions
svn path=/trunk/; revision=1591
2001-02-01 16:44:19 +00:00
jean
c8f92d26a9 changes in alloca because gcc push only ebp at begin of function
svn path=/trunk/; revision=1590
2001-02-01 16:37:08 +00:00
jean
51c7c6091a fourth argument of WriteConsoleA is mandatory
svn path=/trunk/; revision=1589
2001-02-01 16:30:46 +00:00
Phillip Susi
3c5287c859 Forgot to commit bug fix for LoadString()
svn path=/trunk/; revision=1588
2001-02-01 00:04:44 +00:00
Phillip Susi
ed2b81a1b5 Minor fix
svn path=/trunk/; revision=1587
2001-01-31 03:03:20 +00:00
Phillip Susi
2965b6c9d7 Had to rearange some structure members
svn path=/trunk/; revision=1586
2001-01-31 02:27:04 +00:00
Phillip Susi
79c82716fa Bug fixes and redesign of a few ioctls
svn path=/trunk/; revision=1585
2001-01-31 02:24:46 +00:00
Phillip Susi
20916cab69 A few bug fixes
svn path=/trunk/; revision=1584
2001-01-31 02:23:52 +00:00
Phillip Susi
b93435c7db Bug fixes and speedup
svn path=/trunk/; revision=1583
2001-01-31 02:22:09 +00:00
Eric Kohl
1416a36841 Corrected unknown parameter
Added ObOpenObjectByPointer() stub

svn path=/trunk/; revision=1582
2001-01-29 00:32:13 +00:00
Emanuele Aliberti
7bfcc9b94c Stubs for some new LPC functions (w2k).
Added some base checking in NtCreatePort's parameters.

svn path=/trunk/; revision=1581
2001-01-29 00:13:22 +00:00
Eric Kohl
17b93d7d9b Added mapping of access rights
Removed user-mode types

svn path=/trunk/; revision=1580
2001-01-28 21:37:37 +00:00
Eric Kohl
c06ef435fb Added mapping of access rights
svn path=/trunk/; revision=1579
2001-01-28 17:42:56 +00:00
Eric Kohl
6c726dfe40 Added mapping of access rights
Improved 'open' function

svn path=/trunk/; revision=1578
2001-01-28 15:17:52 +00:00
Eric Kohl
9331d6391e Added mapping of access rights
svn path=/trunk/; revision=1577
2001-01-28 15:13:11 +00:00
Eric Kohl
d4850da19d Fixed a compiler warning
svn path=/trunk/; revision=1576
2001-01-28 01:20:20 +00:00
Emanuele Aliberti
ff1de6a212 Simple W32 telnet client.
Version resource added to ping and roshttpd.

svn path=/trunk/; revision=1575
2001-01-27 22:38:43 +00:00
Eric Kohl
5786d70e39 Fixed _iob bug
svn path=/trunk/; revision=1574
2001-01-27 20:56:44 +00:00
Eric Kohl
dc0568827a Fixed timer issues
svn path=/trunk/; revision=1573
2001-01-27 19:35:04 +00:00
Phillip Susi
2d87dedf3e OOps... that was already defined elsewhere...
svn path=/trunk/; revision=1572
2001-01-26 05:24:17 +00:00
jean
fb75aa1293 changes in _iob
svn path=/trunk/; revision=1571
2001-01-25 19:01:16 +00:00
jean
03832de6e4 *** empty log message ***
svn path=/trunk/; revision=1570
2001-01-25 18:59:49 +00:00
jean
12e9069480 correct some arguments for CreateFile
svn path=/trunk/; revision=1569
2001-01-25 18:55:33 +00:00
jean
98414449d5 *** empty log message ***
svn path=/trunk/; revision=1568
2001-01-25 18:51:26 +00:00
Phillip Susi
dee175afca Added LoadString() stringtable resource support
svn path=/trunk/; revision=1567
2001-01-25 05:39:31 +00:00
Phillip Susi
74e0c4a781 A few more console fixes
svn path=/trunk/; revision=1566
2001-01-25 05:37:03 +00:00
Phillip Susi
a6a0f5ae18 Added declarations for waitable timer functions
svn path=/trunk/; revision=1565
2001-01-25 05:36:21 +00:00
Phillip Susi
1ec1a6741c Fixed backwards parameters in FindResource()
svn path=/trunk/; revision=1564
2001-01-25 02:20:05 +00:00
Phillip Susi
a9527291d6 Fixed backspace handling
svn path=/trunk/; revision=1563
2001-01-24 05:13:12 +00:00
Phillip Susi
3943df51ea Fixed broken console code
svn path=/trunk/; revision=1562
2001-01-24 05:11:21 +00:00
Phillip Susi
89e2e7a616 Fixed kernel loader code also to handle uninitialized sections
svn path=/trunk/; revision=1561
2001-01-24 04:43:54 +00:00
Phillip Susi
207393f045 Both GetModuleHandleA and GetModuleHandleW need to handle NULL module name
svn path=/trunk/; revision=1560
2001-01-24 04:41:58 +00:00
Eric Kohl
42d7089e72 Removed fixed stack base address
svn path=/trunk/; revision=1559
2001-01-23 09:58:12 +00:00
Phillip Susi
6579aafa03 Undoing last commit, causes kernel to crash on boot. David, any idea why?
svn path=/trunk/; revision=1558
2001-01-23 04:46:08 +00:00
Phillip Susi
b6593ffc1b Fixed loader bug with uninitialized sections
svn path=/trunk/; revision=1557
2001-01-23 04:37:13 +00:00
Casper Hornstrup
e6c8459347 no message
svn path=/trunk/; revision=1556
2001-01-21 21:04:53 +00:00
Phillip Susi
782b28151b Applied David Welsh's fix for getting physical address from specified process instead of current one here as well
svn path=/trunk/; revision=1555
2001-01-21 19:00:59 +00:00
David Welch
10f230ae0a Fixed bug in NtFreeVirtualMemory reported by Philip Susi
Added all thread information classes
Began work on fixing suspend/resume

svn path=/trunk/; revision=1554
2001-01-21 14:54:30 +00:00
Phillip Susi
3f694e507f Keyboard driver should not translate \r to \n
svn path=/trunk/; revision=1553
2001-01-21 00:13:41 +00:00
Phillip Susi
f353289fba Reworked console code to use frame buffers and input queues
svn path=/trunk/; revision=1552
2001-01-21 00:11:54 +00:00
Phillip Susi
5d6f1d7dfa Added InterlockedXXX functions, probobly should use a different name
svn path=/trunk/; revision=1551
2001-01-21 00:09:05 +00:00
Phillip Susi
5c0fb84170 New console client support
svn path=/trunk/; revision=1550
2001-01-21 00:07:03 +00:00
Phillip Susi
b360ee177d Fixed a few bugs and enhanced performance
svn path=/trunk/; revision=1549
2001-01-21 00:05:53 +00:00
Eric Kohl
0f09a6d59c Added services.exe to boot sequence
svn path=/trunk/; revision=1548
2001-01-20 19:01:37 +00:00
Eric Kohl
03be08974e Added services.exe to boot sequence
svn path=/trunk/; revision=1547
2001-01-20 18:40:27 +00:00
Eric Kohl
300201892a Fixed severe bug in CreateEventW()
Implemented use of "\BaseNamedObjects" directory

svn path=/trunk/; revision=1546
2001-01-20 18:37:58 +00:00
Eric Kohl
86c7503953 Implemented ObOpenObjectByName()
svn path=/trunk/; revision=1545
2001-01-20 18:34:34 +00:00
Eric Kohl
3676b49d28 Completed mutex and semaphore implementation
Enabled some global memory functions

svn path=/trunk/; revision=1544
2001-01-20 12:20:43 +00:00
David Welch
703924d130 (Finally) implemented Philip Susi's suggestion for non-counting block
Moved suspend/resume code to seperate file

svn path=/trunk/; revision=1543
2001-01-19 15:09:01 +00:00
Eric Kohl
e443f083f2 Implemented system module Information
Got rid of cryptic driver names

svn path=/trunk/; revision=1542
2001-01-18 16:55:00 +00:00
jean
fd4c82a289 suppress use of FILE_READ_xx and FILE_WRITE_xxx defines.
not available for CreateFile ?

svn path=/trunk/; revision=1541
2001-01-18 15:04:06 +00:00
David Welch
a8660c1f02 Fixes for problems with NtReplyWaitReceive and KeWaitForSingleObject
svn path=/trunk/; revision=1540
2001-01-18 15:00:09 +00:00
jean
3116ca9df2 correct _environ assignment, because it's an array of pointers
and GetEnvironmentString return a pointer.

svn path=/trunk/; revision=1539
2001-01-18 14:43:25 +00:00
jean
d2833af32c incorrect use of FILE_xxx defines, not avalaible for CreateFile ?
svn path=/trunk/; revision=1538
2001-01-18 13:54:03 +00:00
jean
20ee4eb9a7 changes due to correction in ../misc/dllmain.c
for update of environ when calling putenv.

svn path=/trunk/; revision=1537
2001-01-18 13:25:33 +00:00
jean
7863eef29d *** empty log message ***
svn path=/trunk/; revision=1536
2001-01-18 13:23:26 +00:00
jean
d6e19c5407 correct environ affectation : it's an array of pointers
, and GetEnvironmentStrings return a pointer.

svn path=/trunk/; revision=1535
2001-01-18 13:21:51 +00:00
jean
a1da8a3ac2 *** empty log message ***
svn path=/trunk/; revision=1534
2001-01-18 13:18:05 +00:00
Emanuele Aliberti
efd7d3cbd8 Bootstrap title and short licence banner reformatted.
Please say your opinion about it.
Should the title line ("Starting ReactOS...") be the 1st line on the blue screen?

svn path=/trunk/; revision=1533
2001-01-17 19:07:13 +00:00
Emanuele Aliberti
394b6b568c Log file names macros added.
svn path=/trunk/; revision=1532
2001-01-17 19:04:15 +00:00
jean
824df27238 ibetter clean
svn path=/trunk/; revision=1531
2001-01-17 17:14:34 +00:00
jean
fcca9be111 better clean
svn path=/trunk/; revision=1530
2001-01-17 17:01:38 +00:00
David Welch
7a3409d80c Multiboot fixes
svn path=/trunk/; revision=1529
2001-01-17 15:38:03 +00:00
Eric Kohl
695a57cff6 Implemented SystemDeviceInformation info class
svn path=/trunk/; revision=1528
2001-01-17 02:02:39 +00:00
David Welch
0d8b4e3da6 FAT12 fixes
svn path=/trunk/; revision=1527
2001-01-16 23:22:03 +00:00
Phillip Susi
7b0b7c5396 Fixed bug with screen buffers larger than console window ( i.e. scrollback buffers )
svn path=/trunk/; revision=1526
2001-01-16 20:58:58 +00:00
David Welch
643441de17 Removed debugging prints
svn path=/trunk/; revision=1525
2001-01-16 15:43:42 +00:00
David Welch
25dc208536 Fix bug in MmAllocateContinuousPages spotted by Philip Susi
Fixed compilation bugs in roshttpd
Work on write support (still not working)

svn path=/trunk/; revision=1524
2001-01-16 09:55:02 +00:00
jean
7887cc9965 *** empty log message ***
svn path=/trunk/; revision=1523
2001-01-15 15:46:04 +00:00
jean
352d348f09 correct crash when running DllMain
svn path=/trunk/; revision=1522
2001-01-15 15:40:58 +00:00
Emanuele Aliberti
2faa9c1b95 Copyright string updated.
svn path=/trunk/; revision=1521
2001-01-14 23:27:36 +00:00
Emanuele Aliberti
db38d666da SYSTEMTIME type replaced by TIME.
svn path=/trunk/; revision=1520
2001-01-14 20:56:48 +00:00
Emanuele Aliberti
a04660d2b0 tz command fixed (info class 44).
svn path=/trunk/; revision=1519
2001-01-14 20:16:37 +00:00
Emanuele Aliberti
01531797b4 SYSTEM_TIME_ZONE_INFORMATION added.
svn path=/trunk/; revision=1518
2001-01-14 20:06:20 +00:00
Emanuele Aliberti
4a354f1128 FLG decoding added.
svn path=/trunk/; revision=1517
2001-01-14 19:59:43 +00:00
Emanuele Aliberti
a3a116651b FLG macros added.
svn path=/trunk/; revision=1516
2001-01-14 19:58:58 +00:00
Casper Hornstrup
52f51dc4b9 Small HTTP daemon
svn path=/trunk/; revision=1515
2001-01-14 18:35:17 +00:00
Casper Hornstrup
05ccbb2696 Some work on winsock stack
svn path=/trunk/; revision=1514
2001-01-14 17:44:38 +00:00
Eric Kohl
2dd3473a90 Added some hal functions
svn path=/trunk/; revision=1513
2001-01-14 15:36:55 +00:00
Eric Kohl
eaeab91ab2 Print driver names on initialization
svn path=/trunk/; revision=1512
2001-01-14 15:30:47 +00:00
Eric Kohl
7efa62275f Added shutdown description
svn path=/trunk/; revision=1511
2001-01-14 15:28:50 +00:00
Eric Kohl
36c7b523ee Fixed 'clean' rule
svn path=/trunk/; revision=1510
2001-01-14 15:27:15 +00:00
David Welch
eda06227b3 More small cluster size fixes
svn path=/trunk/; revision=1509
2001-01-14 15:05:53 +00:00
Emanuele Aliberti
51772d486a ADVAPI32.LookupAccountSidA and ADVAPI32.LookupAccountSidW stubs added.
svn path=/trunk/; revision=1508
2001-01-14 12:15:19 +00:00
Nedko Arnaudov
bf1b057da3 no message
svn path=/trunk/; revision=1507
2001-01-13 23:55:37 +00:00
David Welch
15491f14dd Fix for vfatfs on volumes with smaller cluster sizes
svn path=/trunk/; revision=1506
2001-01-13 18:38:09 +00:00
Emanuele Aliberti
df75bd846f PE image file dumper, by Sang Cho, adapted to ROS (wip).
svn path=/trunk/; revision=1505
2001-01-13 18:19:23 +00:00
Emanuele Aliberti
5d04b18c15 Obsolete regnav removed.
qsi updated (still wip).
Minor changes.

svn path=/trunk/; revision=1504
2001-01-13 18:17:17 +00:00
David Welch
d2b9b6d912 Removed use of intermediate buffering when reading from the cache
svn path=/trunk/; revision=1503
2001-01-13 12:40:21 +00:00
David Welch
e371c33d76 Removed debugging code from NTDLL loader
Make sure there is a space between the boot device and the kernel command
line
Vfat fixes

svn path=/trunk/; revision=1502
2001-01-12 21:00:08 +00:00
Phillip Susi
1c655ae05a Fixed compilation error with symbols _environ/_environ_dll
svn path=/trunk/; revision=1501
2001-01-11 02:38:34 +00:00
Nedko Arnaudov
1688a8d7c5 no message
svn path=/trunk/; revision=1500
2001-01-10 01:25:29 +00:00
David Welch
48b5533bd5 Some memory manager cleanups
Hopefully fixed vfat fsd reported by Philip Susi
FAT lookups go through cache

svn path=/trunk/; revision=1499
2001-01-08 02:14:06 +00:00
Eric Kohl
21c3a954d0 Updated 'clean' rule (added missing directories)
svn path=/trunk/; revision=1498
2001-01-07 18:45:21 +00:00
Eric Kohl
624869c3c3 Added some more runtime functions
svn path=/trunk/; revision=1497
2001-01-07 03:00:32 +00:00
Eric Kohl
8fe6e74b25 Indicate loading process by dots (in non-debug mode only)
svn path=/trunk/; revision=1496
2001-01-07 02:56:20 +00:00
Rex Jolliff
b12b25cd3d Fixed a bug in partition chain handling
svn path=/trunk/; revision=1495
2001-01-06 23:25:35 +00:00
Rex Jolliff
e4b73aa914 Fixed a problem with command line parsing
svn path=/trunk/; revision=1494
2001-01-06 21:40:13 +00:00
Eric Kohl
66aa4c41db Added some more functions
Got rid of spec file

svn path=/trunk/; revision=1493
2001-01-06 15:49:53 +00:00
Phillip Susi
83463a35cc Export SetLastErrorByStatus()
svn path=/trunk/; revision=1492
2001-01-05 05:39:18 +00:00
Eric Kohl
58f7f41275 Implemented NtSignalAndWaitForSingleObject()
svn path=/trunk/; revision=1491
2001-01-02 00:47:08 +00:00
David Welch
240c9da1da The VFAT filesystem driver now goes through the cache for reads, writing
is disabled.

svn path=/trunk/; revision=1490
2001-01-01 04:42:12 +00:00
David Welch
9e386e114c Fix for compilation bug
svn path=/trunk/; revision=1489
2000-12-30 04:19:42 +00:00
Eric Kohl
138b30dd40 Added HalAllocateAdapterChannel()
svn path=/trunk/; revision=1488
2000-12-30 01:41:52 +00:00
David Welch
ed20b9b6ba Implemented MmAllocateContinuousMemory
VFAT driver cleanups

svn path=/trunk/; revision=1487
2000-12-29 23:17:12 +00:00
Eric Kohl
1f1ae27105 Added / moved exception support functions
svn path=/trunk/; revision=1486
2000-12-29 13:49:15 +00:00
Eric Kohl
380b1db222 Implemented shutdown routine dummy
svn path=/trunk/; revision=1485
2000-12-29 13:45:01 +00:00
Eric Kohl
65c77b52d6 Implemented fsd shutdown support
svn path=/trunk/; revision=1484
2000-12-29 13:43:13 +00:00
Eric Kohl
66f91ccbf9 Fixed some undocumented functions and types
svn path=/trunk/; revision=1483
2000-12-28 20:38:28 +00:00
jean
7bd40a855a copy some functions from crtdll
svn path=/trunk/; revision=1482
2000-12-28 11:57:10 +00:00
jean
43999c2a2d copy of some functions from crtdll
svn path=/trunk/; revision=1481
2000-12-28 11:43:07 +00:00
jean
7a974c0294 *** empty log message ***
svn path=/trunk/; revision=1480
2000-12-28 11:39:33 +00:00
David Welch
0fc13a01ee Implemented /Device/PhysicalMemory
Corrected an LPC bug when terminating a process with threads waiting for
LPC messages

svn path=/trunk/; revision=1479
2000-12-28 03:38:08 +00:00
David Welch
7f10630ab4 Disable testing code
svn path=/trunk/; revision=1478
2000-12-26 05:34:27 +00:00
David Welch
390fd4f1fb Added support for calling BIOS functions
Partially implemented VideoPortInt10

svn path=/trunk/; revision=1477
2000-12-26 05:32:44 +00:00
David Welch
3b50cd9ca9 Fixed compilation bug
svn path=/trunk/; revision=1476
2000-12-24 03:35:54 +00:00
David Welch
8445b12452 All task switching is done in software.
Beginnings of v86 mode support.
Corrected locking bug when terminating multithreaded process.

svn path=/trunk/; revision=1475
2000-12-23 02:37:41 +00:00
Emanuele Aliberti
b6c91b703e _itow, _ltow, _ultow added to crtdll.
*** TO BE TESTED ***

svn path=/trunk/; revision=1474
2000-12-22 23:20:15 +00:00
Eric Kohl
91bcb7413f Implemented NtResumeThread() and NtSuspendThread()
Cleanup

svn path=/trunk/; revision=1473
2000-12-22 13:37:41 +00:00
Eric Kohl
64ba922c19 Implemented NtResumeThread() and NtSuspendThread()
Cleanup

svn path=/trunk/; revision=1472
2000-12-22 13:32:06 +00:00
jean
90beca63cb begin implementation of memory detection
svn path=/trunk/; revision=1471
2000-12-20 18:44:20 +00:00
Emanuele Aliberti
c6010e401e Version resource added to the command line utilities more, tee, and y.
svn path=/trunk/; revision=1470
2000-12-19 23:06:20 +00:00
Rex Jolliff
72e967e710 Fixed a problem with install rule
svn path=/trunk/; revision=1469
2000-12-19 20:20:16 +00:00
Eric Kohl
a391eec94c Implemented some verify functions.
svn path=/trunk/; revision=1468
2000-12-11 18:20:02 +00:00
David Welch
488f0ac078 Some work on file caching
Some work on the minix filesystem
Some work on v86 mode support
Implemented NtGetContextThread

svn path=/trunk/; revision=1467
2000-12-10 23:42:01 +00:00
Eric Kohl
4ac4987dd2 Implemented some verify functions.
svn path=/trunk/; revision=1466
2000-12-10 19:15:45 +00:00
Emanuele Aliberti
6d9f357735 Cleaning up before moving psxss to subsys/psx/server .
svn path=/trunk/; revision=1465
2000-12-10 16:57:07 +00:00
Emanuele Aliberti
1439a96e69 Cleaning up before moving psxdll in subsys/psx/client .
svn path=/trunk/; revision=1464
2000-12-10 16:44:50 +00:00
Emanuele Aliberti
7235c776e4 I added the -p option to make buildno simply print the current build number,
but not generate the reactos/buildno.h file.

svn path=/trunk/; revision=1463
2000-12-10 16:23:15 +00:00
Emanuele Aliberti
6faae58d64 Updated to be a proper secur32.dll version resource.
Still missing a proper description: where is secur32.dll from?

svn path=/trunk/; revision=1462
2000-12-09 22:37:14 +00:00
Phillip Susi
b2b12a1d09 Opps... can't just return from a native thread proc, have to TerminateProcess()
svn path=/trunk/; revision=1461
2000-12-09 06:29:29 +00:00
Phillip Susi
8bdd137c8f RtlCreateUserProcess was not checking for failure of mapping the executable file and returning that error
svn path=/trunk/; revision=1460
2000-12-09 04:34:52 +00:00
Casper Hornstrup
af9693f4da Fixed typo.
svn path=/trunk/; revision=1459
2000-12-08 22:09:17 +00:00
Casper Hornstrup
d3f5f7862f Fixed bug that caused a crash when creating an unnamed semaphore.
svn path=/trunk/; revision=1458
2000-12-08 22:08:02 +00:00
jean
4dc42b4202 SUPERSEDE implemented
svn path=/trunk/; revision=1457
2000-12-08 17:12:43 +00:00
Eric Kohl
2af149a27c Replaced hard-coded paths
svn path=/trunk/; revision=1456
2000-12-08 00:45:04 +00:00
Eric Kohl
07127c18af Fixed floppy driver bug!
The floppy controler is now recognized properly!!

svn path=/trunk/; revision=1455
2000-12-08 00:43:45 +00:00
jean
3d521d0a20 LdrFixupImports more verbose when DLL not found.
svn path=/trunk/; revision=1454
2000-12-07 17:00:12 +00:00
jean
02d3c2cb72 bug corrected in updating fat16
erase clusters before use.

svn path=/trunk/; revision=1453
2000-12-07 16:58:42 +00:00
Eric Kohl
d8748695f2 Run winlogon.exe instead of shell.exe
Replaced hard-coded paths

svn path=/trunk/; revision=1452
2000-12-05 18:14:07 +00:00
Eric Kohl
3ab0b1f9a2 Minor fixes
svn path=/trunk/; revision=1451
2000-12-05 18:11:51 +00:00
Eric Kohl
e69d5f4655 Fixed forwarding of current directory string
svn path=/trunk/; revision=1450
2000-12-05 18:08:24 +00:00
jean
a7d8f1c9ab corrected bugs in create operations
svn path=/trunk/; revision=1449
2000-12-05 17:12:16 +00:00
Eric Kohl
564101ab11 Moved system applications
svn path=/trunk/; revision=1448
2000-12-05 02:40:51 +00:00
Eric Kohl
c40c9f88c1 no message
svn path=/trunk/; revision=1447
2000-12-03 20:31:03 +00:00
Eric Kohl
d4ae36c1c5 no message
svn path=/trunk/; revision=1446
2000-12-03 20:29:44 +00:00
Eric Kohl
f01dd17793 Added some functions to msvcrt
svn path=/trunk/; revision=1445
2000-12-03 18:00:07 +00:00
Eric Kohl
a9828950fe Added some functions to msvcrt
svn path=/trunk/; revision=1444
2000-12-03 17:49:41 +00:00
Eric Kohl
b7a9c63dad Some minor fixes
svn path=/trunk/; revision=1443
2000-12-03 17:43:46 +00:00
Eric Kohl
9deb8f01da Fixed compiler warnings
svn path=/trunk/; revision=1442
2000-12-02 02:25:30 +00:00
jean
55feb47d30 added test arg in NtFlushKey
svn path=/trunk/; revision=1441
2000-12-01 12:44:15 +00:00
jean
45fcd58321 corrected bug in writing files : extend files before needed
svn path=/trunk/; revision=1440
2000-12-01 12:41:08 +00:00
jean
7cdd9a1c62 *** empty log message ***
svn path=/trunk/; revision=1439
2000-12-01 12:39:17 +00:00
jean
bd1cb1e820 many bugs corrected
now pass OK tests 1,2,3 and 5 of regtest

svn path=/trunk/; revision=1438
2000-11-27 14:54:28 +00:00
jean
c07ef00211 added test for NtFlushKey
added a loop, allowing to make several tests before exiting.

svn path=/trunk/; revision=1437
2000-11-27 14:21:04 +00:00
jean
e53fb528db correct bug in write operations
svn path=/trunk/; revision=1436
2000-11-23 15:53:37 +00:00
jean
565277e563 *** empty log message ***
svn path=/trunk/; revision=1435
2000-11-21 15:10:15 +00:00
jean
cf1b2d1b6c some changes to prepare write in hive files
svn path=/trunk/; revision=1434
2000-11-21 11:12:27 +00:00
Eric Kohl
716fa2a717 Modified makefiles for use with rcopy
Added a missing prototype

svn path=/trunk/; revision=1433
2000-11-20 19:59:14 +00:00
Eric Kohl
d456e5b838 Fixed bug (or better: typo)
svn path=/trunk/; revision=1432
2000-11-19 22:15:03 +00:00
Eric Kohl
a703d88253 Fixed tls code
svn path=/trunk/; revision=1431
2000-11-19 16:01:29 +00:00
Eric Kohl
41ac59fb91 Added tls bitmap initialization
svn path=/trunk/; revision=1430
2000-11-19 15:59:46 +00:00
Eric Kohl
885e8a3344 Fixed bitmap bug
svn path=/trunk/; revision=1429
2000-11-19 15:58:58 +00:00
Eric Kohl
bd08f2070e Fixed tiny display buglet
svn path=/trunk/; revision=1428
2000-11-19 15:57:27 +00:00
Jason Filby
4b0dec4293 minor fix
svn path=/trunk/; revision=1427
2000-11-16 21:45:54 +00:00
Eric Kohl
143ef3c5b1 Fixed a compiler warning
svn path=/trunk/; revision=1426
2000-11-16 00:32:12 +00:00
jean
575c0c896a bugs corrected
svn path=/trunk/; revision=1425
2000-11-10 15:41:46 +00:00
jean
fb51b0f647 reference/dereference of objects corrected
update time of heap when data changed
some other bugs corrected

svn path=/trunk/; revision=1424
2000-11-10 15:35:40 +00:00
Eric Kohl
93647509cc Fixed some system information stuff
svn path=/trunk/; revision=1423
2000-11-04 13:52:12 +00:00
Eric Kohl
3f82e28a32 Fixed compiler warning
svn path=/trunk/; revision=1422
2000-11-04 13:48:11 +00:00
Eric Kohl
e7f86f45fb Fixed linker warning about missing _NtProcessStartup()
svn path=/trunk/; revision=1421
2000-11-01 12:45:53 +00:00
Jason Filby
55a9a7623e minor fixes
svn path=/trunk/; revision=1420
2000-10-25 13:09:05 +00:00
Nedko Arnaudov
a248f1e7c3 GPL sync + delete value implemented
svn path=/trunk/; revision=1419
2000-10-24 20:17:42 +00:00
jean
2a81cebc82 fixed bugs
load registry file entirely

svn path=/trunk/; revision=1418
2000-10-24 12:13:12 +00:00
Eric Kohl
b60489a76a Removed obsolete linux header files
svn path=/trunk/; revision=1417
2000-10-22 16:36:53 +00:00
Eric Kohl
1c236a2886 Replaced linux io calls
Removed references to linux io headers

svn path=/trunk/; revision=1416
2000-10-22 13:30:19 +00:00
Eric Kohl
dab151f2f1 Implemented event pair
svn path=/trunk/; revision=1415
2000-10-22 11:30:00 +00:00
Eric Kohl
9267a79b9e Replaced linux io calls
svn path=/trunk/; revision=1414
2000-10-22 02:02:28 +00:00
Eric Kohl
1db1c12cf3 Fixed prototype
svn path=/trunk/; revision=1413
2000-10-22 02:01:42 +00:00
Eric Kohl
382d5a76c2 Removed duplicate code and replaced linux io calls
svn path=/trunk/; revision=1412
2000-10-22 01:59:51 +00:00
Eric Kohl
a83fd9fd73 Fixed warnings and indentation
svn path=/trunk/; revision=1411
2000-10-22 01:58:11 +00:00
Jason Filby
201009ddd9 *** empty log message ***
svn path=/trunk/; revision=1410
2000-10-18 10:42:07 +00:00
Jason Filby
14b2a471ce *** empty log message ***
svn path=/trunk/; revision=1409
2000-10-18 09:39:32 +00:00
Jason Filby
77d9f6fb99 *** empty log message ***
svn path=/trunk/; revision=1408
2000-10-18 09:11:01 +00:00
jean
bb44d63a00 add management of free blocks
svn path=/trunk/; revision=1407
2000-10-16 15:22:45 +00:00
jean
3f76d0e8a9 remove unimplemented functions
test more verbose

svn path=/trunk/; revision=1406
2000-10-16 15:05:19 +00:00
Jason Filby
76ba7eadb1 Improved bitblt and painting performance
Initial mouse pointer code

svn path=/trunk/; revision=1405
2000-10-14 22:58:24 +00:00
Jason Filby
06bf88e073 Minor fixes
svn path=/trunk/; revision=1404
2000-10-14 22:42:11 +00:00
Jason Filby
d17678ebd0 *** empty log message ***
svn path=/trunk/; revision=1403
2000-10-14 22:40:18 +00:00
David Welch
e9b7a9a972 Corrected typos in the minix driver
svn path=/trunk/; revision=1402
2000-10-11 20:57:19 +00:00
David Welch
9ab512dafc Correct implementation of user-mode APCs
svn path=/trunk/; revision=1401
2000-10-11 20:50:35 +00:00
jean
e7214e13b1 remove code for tests
svn path=/trunk/; revision=1400
2000-10-11 15:06:31 +00:00
jean
3199989397 added tests in apps/regtest
work on write hive registry
read tests successful for volatile and non volatile keys
write tests successful for volatile keys

svn path=/trunk/; revision=1399
2000-10-11 13:20:39 +00:00
Eric Kohl
3b8acca85c Minor update
svn path=/trunk/; revision=1398
2000-10-09 00:18:00 +00:00
Eric Kohl
e224120546 Fixed compiler warning
svn path=/trunk/; revision=1397
2000-10-09 00:12:01 +00:00
David Welch
d996724891 Fixed compilation bugs
Removed useless spec files

svn path=/trunk/; revision=1396
2000-10-08 23:44:46 +00:00
Eric Kohl
26aa5fb4dd Fixed a typo
svn path=/trunk/; revision=1395
2000-10-08 19:13:01 +00:00
Eric Kohl
69afd5910f Added nameless struct/union support for [U]LARGE_INTEGER
svn path=/trunk/; revision=1394
2000-10-08 19:11:28 +00:00
David Welch
8a74f96a65 Additional bug fixes
Removed spec file
Removed libgcc.a
Set FS register in thread contexts

svn path=/trunk/; revision=1393
2000-10-08 16:32:53 +00:00
Eric Kohl
8d1034c5fa Added atom table stubs
Implemented NtQuerySemaphore()
Implemented RtlConvertSidToUnicode()
Replaced more calls to Linux io functions
Some minor fixes

svn path=/trunk/; revision=1392
2000-10-08 12:56:45 +00:00
Eric Kohl
9e2f41853a Added atom table stubs
Implemented NtQuerySemaphore()
Implemented RtlConvertSidToUnicode()
Replaced more calls to Linux io functions
Some minor fixes

svn path=/trunk/; revision=1391
2000-10-08 12:51:25 +00:00
Nedko Arnaudov
4e21487a31 In GNU make, Variables and functions in all parts of a makefile are expanded when read, so include of rules.mak must be done before using variable defined in it.
svn path=/trunk/; revision=1390
2000-10-08 10:48:10 +00:00
Eric Kohl
a2d079723b Implemented missing KeRaiseIrqlToXxLevel() functions
svn path=/trunk/; revision=1389
2000-10-07 21:06:19 +00:00
Eric Kohl
5bea9979e8 Added check for existing 'SystemRoot' link target
svn path=/trunk/; revision=1388
2000-10-07 20:55:15 +00:00
David Welch
f1096bb7f0 Some bug fixes
svn path=/trunk/; revision=1387
2000-10-07 18:44:08 +00:00
David Welch
fe87b12edd Renamed makefile to Makefile
svn path=/trunk/; revision=1386
2000-10-07 13:44:24 +00:00
David Welch
a254e64d73 Added multiboot support to ntoskrnl
Updated loadros to boot new kernel
Corrected thread priority bugs
Removed Linux port io
Added system call entry/exit that updates PreviousMode
Changes to allow ntoskrnl to be built without optimization
Updated make system
Added PCR
Most components can be built without special spec file

svn path=/trunk/; revision=1385
2000-10-07 13:41:58 +00:00
Eric Kohl
15b935ba7c Implemented NtPulseEvent() and NtQueryEvent()
svn path=/trunk/; revision=1384
2000-10-06 22:54:58 +00:00
Eric Kohl
4a5bc9edc8 Minor fix
svn path=/trunk/; revision=1383
2000-10-06 22:54:41 +00:00
Eric Kohl
bd44cd188f obsolete
svn path=/trunk/; revision=1382
2000-10-06 16:54:38 +00:00
Eric Kohl
0a2b580710 Implemented IoCreateNotificationEvent() and IoCreateSynchronizationEvent()
svn path=/trunk/; revision=1381
2000-10-06 16:54:04 +00:00
Eric Kohl
6e63676205 Added missing STDCALLs
svn path=/trunk/; revision=1380
2000-10-05 19:17:25 +00:00
Eric Kohl
aa5a575bd0 Added registry shutdown function CmShutdownRegistry()
Updated shutdown sequence

svn path=/trunk/; revision=1379
2000-10-05 19:15:50 +00:00
Eric Kohl
beaf6eac44 Implmented NtFlushWriteBuffer()
svn path=/trunk/; revision=1378
2000-10-05 19:10:55 +00:00
jean
619ad3483b add some tests
svn path=/trunk/; revision=1377
2000-10-05 14:55:55 +00:00
jean
a1b7c80868 correct bugs
svn path=/trunk/; revision=1376
2000-10-05 14:55:25 +00:00
Emanuele Aliberti
ae69a8e1e4 Registry Explorer (console tool) by Nedko Arnaoudov added to the system utilities subtree.
Also here: http://www.geocities.com/registryexplorer/

svn path=/trunk/; revision=1375
2000-10-04 21:04:31 +00:00
Eric Kohl
f3632d15b8 Implemented GetFileType()
Some cleanup

svn path=/trunk/; revision=1374
2000-10-01 19:54:57 +00:00
jean
31f697ce8f work on registry
svn path=/trunk/; revision=1373
2000-09-29 15:03:21 +00:00
Eric Kohl
bd6afcb8ba Implemented CreatePipe()
svn path=/trunk/; revision=1372
2000-09-27 01:24:37 +00:00
Eric Kohl
99434057af Implemented some ascii functions
svn path=/trunk/; revision=1371
2000-09-27 01:22:31 +00:00
Phillip Susi
0ea51977f6 Fixed crash due to thread priority out of bonuds bug... not sure if I did this right, but it seems to fix the crash. Someone should probobly look at this.
svn path=/trunk/; revision=1370
2000-09-24 23:55:21 +00:00
jean
08982a387e read functions on file SYSTEM implemented
svn path=/trunk/; revision=1369
2000-09-22 15:08:55 +00:00
jean
572b3bf901 work on ntopenkey forkeys insystem hive
svn path=/trunk/; revision=1368
2000-09-21 13:45:42 +00:00
jean
56cd5f816c type of Name in KEY_BLOCK corrected
svn path=/trunk/; revision=1367
2000-09-18 09:39:18 +00:00
Casper Hornstrup
37d6d2f97f Added WinSock 2 DLL Stubs
svn path=/trunk/; revision=1366
2000-09-17 09:41:15 +00:00
Casper Hornstrup
7ec7480d5c Added ping application (won't work on ReactOS yet)
svn path=/trunk/; revision=1365
2000-09-17 09:40:33 +00:00
Casper Hornstrup
734dbaddef Small change in tdikrnl.h
svn path=/trunk/; revision=1364
2000-09-17 09:38:46 +00:00
Casper Hornstrup
b7eaee833c Added WinSock 2 Headers
svn path=/trunk/; revision=1363
2000-09-17 09:37:04 +00:00
Casper Hornstrup
ab2b4e0924 Added WinSock 2 DLL Stubs
svn path=/trunk/; revision=1362
2000-09-17 09:36:01 +00:00
Casper Hornstrup
2a734dfd02 Added WinSock 2 Helper DLL for TCP/IP (Stubs only)
svn path=/trunk/; revision=1361
2000-09-17 09:33:44 +00:00
jean
b0a3240f8e work on registry files
svn path=/trunk/; revision=1360
2000-09-14 14:45:06 +00:00
jean
522110434e report changes from 1.29
svn path=/trunk/; revision=1359
2000-09-13 11:46:35 +00:00
jean
ad66ea993a work on registry
svn path=/trunk/; revision=1358
2000-09-13 10:29:48 +00:00
jean
ee426ef891 work on registry
svn path=/trunk/; revision=1357
2000-09-13 09:51:58 +00:00
Rex Jolliff
79753f70ea added some book references
svn path=/trunk/; revision=1356
2000-09-13 03:54:09 +00:00
Emanuele Aliberti
192a6b11b4 Added Casper to the coders parade.
svn path=/trunk/; revision=1355
2000-09-12 23:21:20 +00:00
Emanuele Aliberti
f452b24998 Updated years in version info.
svn path=/trunk/; revision=1354
2000-09-12 23:20:15 +00:00
jean
380f53e057 remove ctrl-M
svn path=/trunk/; revision=1353
2000-09-12 10:43:56 +00:00
jean
7a86d15add declaration of NtLoadKey2 corrected.
svn path=/trunk/; revision=1352
2000-09-12 10:43:28 +00:00
jean
cfa0bfd3f1 changes in IRP for compatibility
svn path=/trunk/; revision=1351
2000-09-12 10:12:13 +00:00
Emanuele Aliberti
28d86222cd Version resource added to the system utilities.
svn path=/trunk/; revision=1350
2000-09-11 20:17:02 +00:00
Emanuele Aliberti
e7a0c9b4eb Little change to make version resource linked in ne2000.sys.
svn path=/trunk/; revision=1349
2000-09-10 20:00:13 +00:00
Eric Kohl
f6975e3ad4 Implemented driver shutdown registration
svn path=/trunk/; revision=1348
2000-09-10 13:54:01 +00:00
Emanuele Aliberti
18fb33cd77 RC script updated.
svn path=/trunk/; revision=1347
2000-09-10 10:14:39 +00:00
Eric Kohl
4b34e5c2de Implemented basic registry functions
svn path=/trunk/; revision=1346
2000-09-08 22:55:14 +00:00
Eric Kohl
16625529a2 Fixed [Nt/Zw]LoadKey2 prototype
svn path=/trunk/; revision=1345
2000-09-08 22:52:17 +00:00
Eric Kohl
6320160bea Ooops! I forgot that little thingy...
svn path=/trunk/; revision=1344
2000-09-08 19:39:31 +00:00
Eric Kohl
d7d755265d Fixed some bugs in the registry
Improved registry test app

svn path=/trunk/; revision=1343
2000-09-06 19:59:54 +00:00
Phillip Susi
e7365f8b00 Made PsGetCurrentThread STDCALL
svn path=/trunk/; revision=1342
2000-09-06 03:08:22 +00:00
Phillip Susi
11c7a09174 Initialize new Win32ThreadData member in ETHREAD
svn path=/trunk/; revision=1341
2000-09-06 03:08:08 +00:00
Phillip Susi
b9d500fbd4 Made ObAddEntryDirectory STDCALL
svn path=/trunk/; revision=1340
2000-09-06 03:06:55 +00:00
Phillip Susi
c76d475edb Made PsGetCurrentThread STDCALL
svn path=/trunk/; revision=1339
2000-09-06 03:00:10 +00:00
Phillip Susi
4ca3269e59 Added pointer to win32k data in ETHREAD
svn path=/trunk/; revision=1338
2000-09-06 02:57:24 +00:00
Phillip Susi
8dba8b5f8b Made ObAddEntryDirectory STDCALL
svn path=/trunk/; revision=1337
2000-09-06 02:56:53 +00:00
Phillip Susi
5df884f1d2 Added ObAdEntryDirectory and PsGetCurrentThread to kernel export list
svn path=/trunk/; revision=1336
2000-09-06 02:08:00 +00:00
Eric Kohl
991be350f7 Registry fixes (not usable yet)
Loader improvements

svn path=/trunk/; revision=1335
2000-09-05 23:03:09 +00:00
Eric Kohl
90a17ecf05 Added registry test app
svn path=/trunk/; revision=1334
2000-09-05 22:57:43 +00:00
Eric Kohl
fbac67d372 Implemented dll detach on thread termination
svn path=/trunk/; revision=1333
2000-09-05 13:53:27 +00:00
Eric Kohl
19e205fb97 Implemented dll detach on process termination
svn path=/trunk/; revision=1332
2000-09-05 11:01:03 +00:00
Eric Kohl
ed32877e90 Fixed some minor loader bugs
svn path=/trunk/; revision=1331
2000-09-04 19:05:03 +00:00
Eric Kohl
c0159ad5c8 Some minor fixes
svn path=/trunk/; revision=1330
2000-09-03 14:53:13 +00:00
Eric Kohl
3004e5b9bd Fixed mysterious registry bug
svn path=/trunk/; revision=1329
2000-09-03 14:46:49 +00:00
Eric Kohl
df314ce26e Improved internal dll handling
Implemented or fixed dll and resource functions

svn path=/trunk/; revision=1328
2000-09-01 17:09:50 +00:00
David Welch
dd7e38a19d Reverted back to revision 1.59 because my last commit overwrote recent
changes.

svn path=/trunk/; revision=1327
2000-08-31 00:11:15 +00:00
David Welch
8e0014c64b Added calibration of KeStallExecutionProcessor delay
Corrected compilation bugs in user32
Corrected compilation bugs related to anonymous structs in ndis code
Pass commandline from loadros
Corrected PIC mask calculation

svn path=/trunk/; revision=1326
2000-08-30 19:33:29 +00:00
Emanuele Aliberti
3b94410c8a Version resource was off the final binary image.
svn path=/trunk/; revision=1325
2000-08-29 20:10:49 +00:00
Eric Kohl
3f36421f86 Added/fixed resource 'loader'.
svn path=/trunk/; revision=1324
2000-08-28 21:49:11 +00:00
Casper Hornstrup
7550af7e4d Fixed user32.dll so it will compile
svn path=/trunk/; revision=1323
2000-08-28 19:36:49 +00:00
David Welch
8293c58f61 Added platform independant mkdir program
svn path=/trunk/; revision=1322
2000-08-27 23:06:36 +00:00
Eric Kohl
acaf5099d7 User-mode loader improvements
svn path=/trunk/; revision=1321
2000-08-27 22:37:45 +00:00
Casper Hornstrup
5c58f80d97 Fixed user32.dll so it will compile
svn path=/trunk/; revision=1320
2000-08-27 16:44:02 +00:00
Casper Hornstrup
9a1e13b7d8 Added Novell Eagle 2000 Driver
svn path=/trunk/; revision=1319
2000-08-27 16:35:31 +00:00
Casper Hornstrup
33252ab449 Basic NDIS 3.0 support
svn path=/trunk/; revision=1318
2000-08-27 16:31:41 +00:00
Casper Hornstrup
abd30f9819 Fixed bugs in TCP/IP driver
svn path=/trunk/; revision=1317
2000-08-27 16:28:59 +00:00
Eric Kohl
24d06e9f82 Replaced call to LdrLoadModule() by call to ZwSetSystemInformation()
svn path=/trunk/; revision=1316
2000-08-26 16:22:04 +00:00
Eric Kohl
1a10e72f31 Finished drive letter assignment
Implemented WinNT compatible ARC path (boot.ini)

svn path=/trunk/; revision=1315
2000-08-25 15:56:24 +00:00
Eric Kohl
6c2d255207 Minor ide driver cleanup
Implemented ARC names

svn path=/trunk/; revision=1314
2000-08-24 19:15:20 +00:00
Eric Kohl
495a30cb8e Fixed partition read bug
svn path=/trunk/; revision=1313
2000-08-22 21:10:28 +00:00
Eric Kohl
c27ed38f21 Fixed disk size and partition limits
svn path=/trunk/; revision=1312
2000-08-22 21:09:25 +00:00
Eric Kohl
e7dc6b7c4b xHalIoReadPartitionTable() can now handle partially corrupted partition tables
svn path=/trunk/; revision=1311
2000-08-22 14:10:59 +00:00
Eric Kohl
6f1d7ad00c Implemented IoReadPartitionTable().
Implemented proper drive letter assignment.

svn path=/trunk/; revision=1310
2000-08-21 00:15:54 +00:00
David Welch
8434fc42db Fixed memory manager bugs
Removed page directory references from machine independant code
Implemented page table reference counting
Added vm test application

svn path=/trunk/; revision=1309
2000-08-20 17:02:10 +00:00
Eric Kohl
7c29439d2b Fixed the real bug
svn path=/trunk/; revision=1308
2000-08-19 01:21:17 +00:00
Eric Kohl
1aa74074a2 Fixed an ugly bug
svn path=/trunk/; revision=1307
2000-08-19 00:02:55 +00:00
David Welch
ddfa2017c7 Added .o -> .sys rule to simplify driver makefiles
Added PATH_TO_ROOT variable to most makefiles
Added system independant install utility
Implemented prototype system for changing individual regions without a
memory area
Added some interesting articles from usenet

svn path=/trunk/; revision=1306
2000-08-18 22:27:09 +00:00
Eric Kohl
f7d76fbc5b Fixed port i/o functions
svn path=/trunk/; revision=1305
2000-08-18 17:25:54 +00:00
Eric Kohl
cc22ad9378 Fixed partition id bug
Moved some definitions

svn path=/trunk/; revision=1304
2000-08-18 17:24:17 +00:00
Eric Kohl
375b8055e3 Added preliminary pci bus scanner
svn path=/trunk/; revision=1303
2000-08-17 17:43:27 +00:00
Eric Kohl
7b9adffa48 Fixed some warnings
svn path=/trunk/; revision=1302
2000-08-15 12:50:35 +00:00
Eric Kohl
b4cd061025 Improved shared user page
Initialized windows and system directories

svn path=/trunk/; revision=1301
2000-08-15 12:44:47 +00:00
Emanuele Aliberti
f2e0104287 Win32 fiber stubs.
svn path=/trunk/; revision=1300
2000-08-14 14:34:12 +00:00
Emanuele Aliberti
47dfd4feaa Win32 fiber stubs
svn path=/trunk/; revision=1299
2000-08-14 14:33:24 +00:00
David Welch
6f6219e903 Added shared data test application
svn path=/trunk/; revision=1298
2000-08-12 19:37:03 +00:00
David Welch
3ae3b46dcd Updated CREDITS
Work on security
Updated heap code from wine implementation
Implemented kernel/user shared data page

svn path=/trunk/; revision=1297
2000-08-12 19:33:23 +00:00
Emanuele Aliberti
70a09d673c Fixed a pair of exported symbols' stack size.
svn path=/trunk/; revision=1296
2000-08-11 17:30:20 +00:00
Emanuele Aliberti
97b05ef460 Added symbolic link expansion.
svn path=/trunk/; revision=1295
2000-08-11 17:18:31 +00:00
Eric Kohl
6db1a5193f Removed M$ driver
svn path=/trunk/; revision=1294
2000-08-11 12:49:11 +00:00
Eric Kohl
891b9b74ee Removed unused file
svn path=/trunk/; revision=1293
2000-08-11 12:48:00 +00:00
Eric Kohl
c6c624ebe3 Renamed pseudo target 'floppy' to 'install'
Added workaround for corrupted dos header magic
Added some more rtl functions

svn path=/trunk/; revision=1292
2000-08-11 12:46:47 +00:00
jean
df3c817b6b little work on registry
svn path=/trunk/; revision=1291
2000-08-11 08:17:41 +00:00
Eric Kohl
71ea66b0b8 Fixed typo
svn path=/trunk/; revision=1290
2000-08-10 15:50:03 +00:00
Eric Kohl
f55fec7c32 Fixed compiler warnings
svn path=/trunk/; revision=1289
2000-08-08 17:42:33 +00:00
Eric Kohl
7a8a2f9e95 Fixed FLOPPY and DIST targets for net drivers
svn path=/trunk/; revision=1288
2000-08-08 17:41:41 +00:00
David Welch
c65edfad92 Integrated fixes from prep0016
Changes to the networking code to remove anonymous structures and unions
Fix for bug where RtlSetEnvironmentVariable didn't if it had acquired the
PEB lock before releasing it
Updating clean targets

svn path=/trunk/; revision=1286
2000-08-05 18:01:58 +00:00
Emanuele Aliberti
65ecb0b98b Simple utility to list the so called "DOS Devices", that is
symbolic links in the \?? directory of the Ob name space.

svn path=/trunk/; revision=1285
2000-08-04 21:49:31 +00:00
Casper Hornstrup
66d2f292ef Fixed compile issues with network code
svn path=/trunk/; revision=1284
2000-08-02 20:39:49 +00:00
David Welch
a859ee0c1e Added networking code from Casper Hornstrup
svn path=/trunk/; revision=1283
2000-08-02 00:24:26 +00:00
David Welch
b5ff23bb2f Added networking code from Casper Hornstrup
svn path=/trunk/; revision=1282
2000-08-02 00:02:53 +00:00
David Welch
792773e953 Added networking code from Casper Hornstrup
svn path=/trunk/; revision=1281
2000-08-01 23:54:06 +00:00
Casper Hornstrup
2c41cbbe57 Initial revision
svn path=/trunk/; revision=1277
2000-08-01 18:43:15 +00:00
David Welch
83f94cade6 Fixes from Casper Hornstrup
svn path=/trunk/; revision=1276
2000-07-30 18:22:35 +00:00
Eric Kohl
afde198a7d Implemented hal system interrupt functions
svn path=/trunk/; revision=1275
2000-07-24 23:51:46 +00:00
David Welch
07b9585e22 Added floppy makefile and version resource file
svn path=/trunk/; revision=1270
2000-07-19 14:25:35 +00:00
David Welch
768ab2e5dc Added timer constant fix from Genadi V. Zawidowski
svn path=/trunk/; revision=1269
2000-07-19 14:23:37 +00:00
David Welch
c3d5ea4e9b Removed broken dma code
Some work on memory managment
Initialize FPU
Reset CR0.TS after task switch but floating point state is *not* saved
Work on floppy driver
Add versions of ide and vfatfs drivers compiled with debugging information

svn path=/trunk/; revision=1268
2000-07-19 14:18:20 +00:00
Eric Kohl
6041051d6a Fixed 'echo.' and 'echoerr.'
svn path=/trunk/; revision=1267
2000-07-19 06:58:13 +00:00
Phillip Susi
fb416bf8e2 Updated shell.exe to be console mode aware
svn path=/trunk/; revision=1265
2000-07-11 04:40:00 +00:00
Phillip Susi
cc05ca5acb Implemented console modes
svn path=/trunk/; revision=1264
2000-07-11 04:09:25 +00:00
Phillip Susi
041f614e06 Minor bug fix
svn path=/trunk/; revision=1263
2000-07-11 04:08:43 +00:00
Phillip Susi
510af07f3c Removed calls to ExAllocatePool so code can be used in components that do not link to ntoskrnl.exe
svn path=/trunk/; revision=1262
2000-07-11 04:02:45 +00:00
Eric Kohl
85c3d3799b Moved interrupt code from hal into kernel
Implemented missing interrupt functions

svn path=/trunk/; revision=1261
2000-07-10 21:55:49 +00:00
Rex Jolliff
b4f80cb2e6 added files to be ignored
svn path=/trunk/; revision=1260
2000-07-09 17:34:05 +00:00
Rex Jolliff
a6613e4b6f added cvsignore file so that dir gets created
svn path=/trunk/; revision=1259
2000-07-09 17:32:49 +00:00
Rex Jolliff
f48fc3a954 added some files to be ignored by cvs
svn path=/trunk/; revision=1258
2000-07-09 17:31:32 +00:00
Eric Kohl
e97ef012de Fixed typos
svn path=/trunk/; revision=1257
2000-07-08 18:49:24 +00:00
David Welch
68375602c1 *** empty log message ***
svn path=/trunk/; revision=1256
2000-07-08 16:53:33 +00:00
Eric Kohl
fb7b00bd59 Added check for valid DC
svn path=/trunk/; revision=1255
2000-07-08 09:46:32 +00:00
Eric Kohl
0afbea5a1c Added checks for loaded drivers
svn path=/trunk/; revision=1254
2000-07-07 11:59:11 +00:00
Eric Kohl
8353127423 Fixed a typo
svn path=/trunk/; revision=1253
2000-07-07 11:56:04 +00:00
Eric Kohl
25557b0457 Added dist target
svn path=/trunk/; revision=1252
2000-07-07 11:55:02 +00:00
David Welch
8689a5cfe9 Corrected bug where user32.a wasn't being cleaned
Corrected bugs in paging implementation
Began work on MPW thread

svn path=/trunk/; revision=1251
2000-07-07 10:30:57 +00:00
Eric Kohl
0ea1d03808 Separated close request
Fixed bugs in create request

svn path=/trunk/; revision=1250
2000-07-07 02:14:14 +00:00
Eric Kohl
a20a2dd801 Implemented vpb spinlock
svn path=/trunk/; revision=1249
2000-07-07 02:10:50 +00:00
Phillip Susi
b81629c2a0 More DbgPrint to DPRINT changes, Implimented support for deleting DCs, causing switch back to text mode, and another change from nonpaged to paged pool
svn path=/trunk/; revision=1248
2000-07-07 01:20:53 +00:00
Phillip Susi
4568d2fd4c Converted more DbgPrints to DPRINT and allocate bitmaps from paged pool instead of non paged
svn path=/trunk/; revision=1247
2000-07-07 01:19:02 +00:00
Phillip Susi
96e4bf5c1f Bug fixes to win32k
svn path=/trunk/; revision=1246
2000-07-07 01:18:04 +00:00
Phillip Susi
418efd5de8 Implimented switch back to text mode after gditest
svn path=/trunk/; revision=1245
2000-07-07 01:16:50 +00:00
Phillip Susi
aa9ca10d75 One should not say the device does not exist causing the driver to fail to load... how the hell did this work before?
svn path=/trunk/; revision=1244
2000-07-07 01:06:35 +00:00
Phillip Susi
21489b923a Implimented reset to text mode
svn path=/trunk/; revision=1243
2000-07-07 01:05:33 +00:00
Phillip Susi
61ed9441a3 Converted a bunch of DbgPrint() calls to DPRINT()
svn path=/trunk/; revision=1242
2000-07-07 01:02:11 +00:00
Phillip Susi
a1ff5576a5 Implimented switch back to text mode after gditest
svn path=/trunk/; revision=1241
2000-07-07 00:59:41 +00:00
Phillip Susi
001c73ed14 Fixed ps code to terminate threads correctly
svn path=/trunk/; revision=1240
2000-07-07 00:49:02 +00:00
Phillip Susi
3ca24a2c2a Fixed [Ke/Nt]WaitForMultipleObjects() bug
svn path=/trunk/; revision=1239
2000-07-07 00:46:35 +00:00
Phillip Susi
db1ccdf290 Fixes to timeout code
svn path=/trunk/; revision=1238
2000-07-07 00:45:37 +00:00
Phillip Susi
84f943edc6 Fixed ps bug, proper termination of threads
svn path=/trunk/; revision=1237
2000-07-07 00:44:07 +00:00
Phillip Susi
67d46de5d3 Fixed typeo that was breaking NtReadFile() with async reads
svn path=/trunk/; revision=1236
2000-07-07 00:42:58 +00:00
Phillip Susi
10c1321106 Do not clean up mdl on paging requests, as the mm needs it still
svn path=/trunk/; revision=1235
2000-07-07 00:41:36 +00:00
Phillip Susi
7bf98ea309 Set IRP_PAGING_IO on mdl ( paging ) requests
svn path=/trunk/; revision=1234
2000-07-07 00:40:49 +00:00
Phillip Susi
2b37b9beea Exported NtOpenEvent()
svn path=/trunk/; revision=1233
2000-07-07 00:39:24 +00:00
Phillip Susi
194e86b860 Implimented DeleteDC()
svn path=/trunk/; revision=1232
2000-07-07 00:38:17 +00:00
Phillip Susi
2f1d0bf882 Minor fixes, enabled return to text mode
svn path=/trunk/; revision=1231
2000-07-07 00:36:36 +00:00
Phillip Susi
017479a5f0 Fixed left out paremter error
svn path=/trunk/; revision=1230
2000-07-06 20:53:27 +00:00
David Welch
d26222f310 Added experimental paging out code (wouldn't activate until the system is
out of memory)
Added stress test application (consumes memory)
Corrected mutex implementation
Moved csrss startup into kernel32 to avoid ugly messages on startup

svn path=/trunk/; revision=1229
2000-07-06 14:34:52 +00:00
Eric Kohl
671c1bc412 Append the '.exe' extension automatically
svn path=/trunk/; revision=1228
2000-07-05 18:07:08 +00:00
Eric Kohl
bea48dda7a Fixed 'cd \' bug
svn path=/trunk/; revision=1227
2000-07-05 18:05:21 +00:00
Phillip Susi
2946fd90c7 Removed duplicate and incorrect declaration for KeRaiseUserException
svn path=/trunk/; revision=1226
2000-07-04 20:02:35 +00:00
David Welch
f801003a51 Compilation fixes
svn path=/trunk/; revision=1225
2000-07-04 11:11:06 +00:00
David Welch
d351d182ef Added working set functions
Seperated memory manager initialization
Seperated trap functions
Removed process/thread definitions from ddk headers
Changed indentation back to sane style (please don't change)

svn path=/trunk/; revision=1224
2000-07-04 08:52:47 +00:00
Eric Kohl
9caffc49ae Fixed RtlNtStatusToDosError()
Implemented some more functions

svn path=/trunk/; revision=1223
2000-07-04 01:30:18 +00:00
Eric Kohl
bad7efb0e7 Final macro fixes
Minor fixes

svn path=/trunk/; revision=1222
2000-07-02 17:33:15 +00:00
Eric Kohl
add4b2d35b Simplified driver initialization
svn path=/trunk/; revision=1221
2000-07-02 10:54:41 +00:00
Eric Kohl
73437d2939 Fixed more macros
Merged/moved/deleted some files

svn path=/trunk/; revision=1220
2000-07-02 10:50:48 +00:00
David Welch
ed53dc2acc Removed unused header file
Fixed compilation errors resulting from header file changes
Fixed vga driver compilation under unix
Patched up use of *deprecated* inb/outb interfaces in vga driver

svn path=/trunk/; revision=1219
2000-07-01 23:18:59 +00:00
Eric Kohl
83e4b66c10 Fixed Ps macros
svn path=/trunk/; revision=1218
2000-07-01 22:38:15 +00:00
Eric Kohl
6abd233802 Replaced boot_param by LOADER_PARAMETER_BLOCK
Added missing dpc functions
Fixed some Ke macros

svn path=/trunk/; revision=1217
2000-07-01 18:27:03 +00:00
Emanuele Aliberti
95f8770ae2 Minor changes.
svn path=/trunk/; revision=1216
2000-07-01 17:07:02 +00:00
Eric Kohl
f3e6819471 Added hal dispatch tables.
Implemented PhysicalDrive links.
Started drive letter assignment.

svn path=/trunk/; revision=1214
2000-06-30 22:53:32 +00:00
David Welch
cc95f73421 Made header file usage more consistent
Tried to reduce dependancies between layers by moving ntoskrnl's private
header files inside its directory
Removed the need to include windows.h for ddk code
Removed obsolete testing code

svn path=/trunk/; revision=1213
2000-06-29 23:35:53 +00:00
David Welch
109fef6e75 Corrected bug when booting with loadros
Began work on fixing up APCs.

svn path=/trunk/; revision=1212
2000-06-27 19:20:45 +00:00
David Welch
17e1656941 Documented parts of the page fault path and flagged some possible locking
issues.
Implemented waiting on page i/o.

svn path=/trunk/; revision=1211
2000-06-26 19:41:43 +00:00
David Welch
fcf9dcd627 Fixed bug.
svn path=/trunk/; revision=1210
2000-06-25 17:41:01 +00:00
David Welch
6e00280f38 Removed from redundant files from the mm directory
Added some preliminary work on the pager
Fixed ntoskrnl/mm/npool.c (This may have been the cause of the
problems reported with loading win32k.sys)
Fixed problems with reporting space used to store physical page
information
Added code to support MmSafeCopy{To/From}User interface work
(untested)
Added Event member of the PHYSICAL_PAGE structure to implement Philip
Susi's suggestion
Reworked section page-in code (not really tested)
Replaced inline string functions with gcc builtins to make debugging easier

svn path=/trunk/; revision=1209
2000-06-25 03:59:17 +00:00
Emanuele Aliberti
a8ed3ed57e Fixed a path problem in the makefile that Phillip reported a few days ago.
Unix paths are handled correctly by DOS and Win32 kernels, but NOT by
command.com and cmd.exe shells. Therefore, when a path is to be handed to
a shell, use \ but when you hand it to any other program, use / instead.

svn path=/trunk/; revision=1208
2000-06-24 09:02:02 +00:00
Eric Kohl
3d2ca25cb4 Added counting physical discs
Fixed a compiler warning

svn path=/trunk/; revision=1207
2000-06-19 22:15:50 +00:00
Eric Kohl
57fc573524 Removed invalid includes
svn path=/trunk/; revision=1206
2000-06-19 16:42:31 +00:00
Eric Kohl
88cf03e85b Use SystemRoot link instead of LdrGetSystemDirectory()
svn path=/trunk/; revision=1205
2000-06-18 17:40:35 +00:00
Eric Kohl
5b2343f9f1 Not used any longer
svn path=/trunk/; revision=1204
2000-06-18 17:39:57 +00:00
Eric Kohl
539b0a1259 Fixed typo and added freetype dir to clean target
svn path=/trunk/; revision=1203
2000-06-18 17:37:57 +00:00
Eric Kohl
9f1e56d438 Implemented IoAttachDeviceByPointer() and IoGetDeviceObjectPointer().
svn path=/trunk/; revision=1202
2000-06-18 15:23:40 +00:00
Eric Kohl
44bdd793c1 Changed list functions to macros (or static inline functions).
svn path=/trunk/; revision=1201
2000-06-18 15:21:53 +00:00
Jason Filby
e3b8762528 Small change and removed unnecessary files
svn path=/trunk/; revision=1200
2000-06-18 12:29:32 +00:00
Jason Filby
943db2de5a Math functions required by win32k
svn path=/trunk/; revision=1199
2000-06-18 12:26:26 +00:00
Jason Filby
dd085499e8 Altered to use new and smaller math.c
svn path=/trunk/; revision=1198
2000-06-18 12:25:42 +00:00
Jason Filby
991cde2c53 Makefile changes for win32k
svn path=/trunk/; revision=1197
2000-06-18 12:25:00 +00:00
Jason Filby
669a590c02 Commented out test code that prevented compilation
svn path=/trunk/; revision=1196
2000-06-18 12:24:22 +00:00
Emanuele Aliberti
b441b2ed03 Base files for a compatible MSVCRT.DLL.
Currently useless.

svn path=/trunk/; revision=1195
2000-06-18 10:57:42 +00:00
David Welch
9d3cd59f17 Corrected build problem
svn path=/trunk/; revision=1194
2000-06-17 23:58:53 +00:00
Phillip Susi
e6bcb9741d Forgot to seek before trying to read back data, and added a check for the data integrity
svn path=/trunk/; revision=1193
2000-06-17 22:04:49 +00:00
Phillip Susi
4e91635e4a Fixed several erronious checks to detect things such as eof on directories too, not just files
svn path=/trunk/; revision=1192
2000-06-17 22:04:08 +00:00
Phillip Susi
274c4db921 Added missing DPRINT
svn path=/trunk/; revision=1191
2000-06-17 22:03:23 +00:00
Phillip Susi
ea455bcfce Fixed bug that fails to update files entries in the root, and added some error checking
svn path=/trunk/; revision=1190
2000-06-17 22:02:09 +00:00
Phillip Susi
8eb69e31d4 Fixed code that checks for a deleted directory entry ( which is really used to find a free entry ) to accept a blank ( never before used ) entry as free
svn path=/trunk/; revision=1189
2000-06-17 22:00:46 +00:00
Jason Filby
a32b900658 temporary float and math support
svn path=/trunk/; revision=1188
2000-06-16 21:13:18 +00:00
Jason Filby
ea1da2be56 missing updates
svn path=/trunk/; revision=1187
2000-06-16 20:58:56 +00:00
Jason Filby
efd7fbb22e missed update
svn path=/trunk/; revision=1186
2000-06-16 20:50:31 +00:00
Jason Filby
a25a8e2e02 GDI Improvements
svn path=/trunk/; revision=1185
2000-06-16 07:36:10 +00:00
Jason Filby
77ef48e705 VGA display driver improvements
svn path=/trunk/; revision=1184
2000-06-16 07:28:20 +00:00
Jason Filby
0b34b1b746 GDI improvements
svn path=/trunk/; revision=1183
2000-06-16 07:25:41 +00:00
Eric Kohl
94c0c4bab2 Improved symbolic links (reparsing).
Implemented SystemRoot and DosDevices links.

svn path=/trunk/; revision=1182
2000-06-15 18:39:25 +00:00
Eric Kohl
fb6c04efbd Implemented IoDeleteSymbolicLink() and NtCreateSymbolicLinkObject().
svn path=/trunk/; revision=1181
2000-06-13 15:51:13 +00:00
Eric Kohl
19e66992de Added cache manager prototypes.
Fixed Io macros.
Fixed and exported more hal functions.

svn path=/trunk/; revision=1180
2000-06-12 14:57:10 +00:00
Emanuele Aliberti
65a13ef159 Return type KIRQL fixed to allow compilation.
svn path=/trunk/; revision=1179
2000-06-09 22:22:32 +00:00
Eric Kohl
3cd7d0dcd3 Moved some functions into the hal.
Replaced some functions by macros.

svn path=/trunk/; revision=1178
2000-06-09 20:07:20 +00:00
Eric Kohl
0aac416a18 Update after server failure.
Fixed STDCALL issues in Ex functions.

svn path=/trunk/; revision=1177
2000-06-07 13:05:09 +00:00
Eric Kohl
d40e55b4e1 Fixed STDCALL issues in Ex functions
svn path=/trunk/; revision=1176
2000-06-05 22:12:06 +00:00
Eric Kohl
64c33bb910 Fixed STDCALL issues in Ke functions
Renamed KiTimerInterrupt() to KeUpdateSystemTime()
Added KeNumberProcessors variable

svn path=/trunk/; revision=1175
2000-06-04 19:51:05 +00:00
Emanuele Aliberti
077ac93718 Type definitions and macros previously in ntoskrnl/nt/port.c moved
in include/internal/port.h .

svn path=/trunk/; revision=1174
2000-06-04 17:32:44 +00:00
Emanuele Aliberti
9464b7005d Made and new ntoskrnl/lpc directory for the LPC subsystem.
Moved ntoskrnl/nt/port.c in ntoskrnl/lpc and split code into
smaller pieces. Little cleanup.

svn path=/trunk/; revision=1173
2000-06-04 17:27:39 +00:00
Eric Kohl
6d5e353126 Fixed clean target (didn't delete all .o files)
svn path=/trunk/; revision=1172
2000-06-04 17:15:47 +00:00
Eric Kohl
ceed9a079e Fixed paths
svn path=/trunk/; revision=1171
2000-06-04 17:14:25 +00:00
Eric Kohl
abc6758e63 Updated Ps* functions
Implemented PsGetVersion()

svn path=/trunk/; revision=1170
2000-06-03 21:36:32 +00:00
Emanuele Aliberti
8123995861 Minor changes.
svn path=/trunk/; revision=1169
2000-06-03 14:47:33 +00:00
Emanuele Aliberti
7fbe844acc Minor changes to kernel32.
svn path=/trunk/; revision=1168
2000-05-30 23:41:06 +00:00
Emanuele Aliberti
f53d713f9a Renamed NTDLL.RtlNtStatusToDosError() RtlNtStatusToDosErrorNoTeb().
Added NTDLL.RtlNtStatusToDosError() that calls RtlNtStatusToDosErrorNoTeb().
Still not understood why RtlNtStatusToDosError() stores in the TEB the given NtStatus.

svn path=/trunk/; revision=1167
2000-05-30 22:25:10 +00:00
Emanuele Aliberti
3918e5583d Added handle type to object name translation in qsi.
svn path=/trunk/; revision=1166
2000-05-28 17:44:53 +00:00
David Welch
279b8390a0 Fix for issue with closing non-existent or already closed handle
svn path=/trunk/; revision=1165
2000-05-27 12:48:59 +00:00
David Welch
06784b2b11 Added etags target
svn path=/trunk/; revision=1164
2000-05-26 14:25:50 +00:00
Phillip Susi
9f7a5635de big work on the console front
svn path=/trunk/; revision=1163
2000-05-26 06:06:42 +00:00
Phillip Susi
97f4345422 fixed color info
svn path=/trunk/; revision=1162
2000-05-26 06:06:05 +00:00
Phillip Susi
232a66904f big work on the console front
svn path=/trunk/; revision=1161
2000-05-26 05:43:33 +00:00
Phillip Susi
1410c2b0a4 a few fixes to the shell
svn path=/trunk/; revision=1160
2000-05-26 05:38:42 +00:00
Eric Kohl
dd76e08c86 Implemented:
- dbg functions
 - RtlFreeUserThreadStack()
 - rtl nls functions
 - rtl process heaps functions
Improved .def and .edf files

svn path=/trunk/; revision=1159
2000-05-25 15:55:35 +00:00
David Welch
3e519811c4 More bug fixes.
svn path=/trunk/; revision=1158
2000-05-24 22:29:38 +00:00
David Welch
1001fb267c Updated clean targets in various places
svn path=/trunk/; revision=1157
2000-05-14 13:10:01 +00:00
Emanuele Aliberti
6bd8ebc9e2 Added ifdef to skip a piece of code commited by mistake (I am still working on it, sorry!).
svn path=/trunk/; revision=1156
2000-05-14 09:34:14 +00:00
Emanuele Aliberti
0726ddaa11 Fixed bug reported by Michael Rich in kernel32 compilation.
svn path=/trunk/; revision=1155
2000-05-14 09:31:05 +00:00
Eric Kohl
f5c8f9fdab Added FLOPPY and DIST targets
svn path=/trunk/; revision=1154
2000-05-13 17:34:15 +00:00
Emanuele Aliberti
d7b4fba550 IoSetThreadHardErrorMode().
svn path=/trunk/; revision=1153
2000-05-13 14:56:47 +00:00
David Welch
598c0f3b1f Fixed typo.
svn path=/trunk/; revision=1152
2000-05-13 14:21:44 +00:00
David Welch
d173c588c7 Some fixes.
Began work on implementing named pipes.

svn path=/trunk/; revision=1151
2000-05-13 13:51:08 +00:00
Eric Kohl
1d034b8c4e Fixed typos in IoGetStackLimits()
svn path=/trunk/; revision=1150
2000-05-13 10:39:23 +00:00
Eric Kohl
3086566400 Fixed IoGetStackLimits()
svn path=/trunk/; revision=1149
2000-05-13 01:48:59 +00:00
Eric Kohl
17e86aad5d Implemented RtlCustomCPxx functions
svn path=/trunk/; revision=1148
2000-05-13 01:48:01 +00:00
Eric Kohl
bb665e58b7 Fixed some more ntoskrnl exports
svn path=/trunk/; revision=1147
2000-05-09 21:31:01 +00:00
Eric Kohl
5c644fe59b Fixed or added exported object type variables
svn path=/trunk/; revision=1146
2000-05-09 16:16:07 +00:00
Eric Kohl
a3160d79cd Implemented IOCTL to draw screen buffer
Changed screen buffer from array of bytes to array of CHAR_INFO

svn path=/trunk/; revision=1145
2000-05-08 23:27:52 +00:00
Eric Kohl
34010a1fcb Fixed ntoskrnl makefile
svn path=/trunk/; revision=1144
2000-05-07 23:04:43 +00:00
Emanuele Aliberti
78a6c60acd Some STDCALL/FASTCALL added in Ex code.
NTOSKRNL's makefile revised with redundant passes removed.

svn path=/trunk/; revision=1142
2000-05-01 14:15:03 +00:00
Emanuele Aliberti
fdf480d262 objdir made compilable.
svn path=/trunk/; revision=1141
2000-05-01 13:53:43 +00:00
Phillip Susi
32ea00da50 NtTerminateProcess did not terminate the current thread if it was a member of the process being terminated
svn path=/trunk/; revision=1140
2000-04-28 17:29:42 +00:00
Emanuele Aliberti
537f82fd1a A fix in the SYSTEM_HANDLE_INFORMATION structure.
svn path=/trunk/; revision=1139
2000-04-27 23:39:49 +00:00
Emanuele Aliberti
b13b811b5f I forgot to update the code that uses SYSTEM_TIME_INFORMATION.
svn path=/trunk/; revision=1138
2000-04-26 06:56:12 +00:00
Emanuele Aliberti
b3ea65f0e4 Partially implemented (handlers only)
NTOSKRNL.NtQuerySystemInformation() and
NTOSKRNL.NtSetSystemInformation().

---

Partially implemented (kernel32/process/proc.c)

KERNEL32.GetPriorityClass(),
KERNEL32.SetPriorityClass() and
NTDLL.CsrSetPriorityClass() (stub only).

Renamed (in include/csrss/csrss.h) priority
class macros:

#define CSR_PRIORITY_CLASS_NORMAL	(0x10)
#define CSR_PRIORITY_CLASS_IDLE		(0x20)
#define CSR_PRIORITY_CLASS_HIGH		(0x40)
#define CSR_PRIORITY_CLASS_REALTIME	(0x80)

---

Implemented (kernel32/misc/error.c)

#include <kernel32/error.h>

DWORD
STDCALL
SetLastErrorByStatus (
	NTSTATUS	Status
	);

to replace SetLastError(RtlNtStatusToDosError(Status))
in KERNEL32, and fixed

KERNEL32.SetLastError()
KERNEL32.GetLastError()

to use the field in NT_TEB (LastError is per thread
not per process).

---

Implemented (lib/kernel32/sysinfo.c) GetSystemInfo()
(to be completed).

---

Fixed rosapps/sysutils/makefile to use ROS import
libraries.

---

Added QSI to the system utilities set. The target is
writing a tool that can be used to query as much system
information as possible from user mode (to be finished
and tested only under nt4sp4/x86; it was NOT tested
under ROS: it crashes immediately and needs
NtQuerySystemInformation implemented!).

svn path=/trunk/; revision=1137
2000-04-25 23:22:57 +00:00
Phillip Susi
0c4a5f1e06 NtDeviceIoControllFile() was not specifying IoFileObjectType as the object type when referencing the file handle
svn path=/trunk/; revision=1136
2000-04-24 04:17:55 +00:00
Phillip Susi
5fea099598 Do not set std handles when AllocConsole() fails, I swear I fixed this before...
svn path=/trunk/; revision=1135
2000-04-24 01:52:24 +00:00
Phillip Susi
23b59ecccb Disabled debug prints
svn path=/trunk/; revision=1134
2000-04-23 18:01:21 +00:00
Phillip Susi
cbf17cd791 Disabled debug prints
svn path=/trunk/; revision=1133
2000-04-23 17:55:21 +00:00
Phillip Susi
0bb8878fc1 Dumped anoying debug print
svn path=/trunk/; revision=1132
2000-04-23 17:52:44 +00:00
Phillip Susi
0d569ee50b Added a event handle to reply struct
svn path=/trunk/; revision=1131
2000-04-23 17:51:35 +00:00
Phillip Susi
de82241cb1 Added declaration for InterlockedCompareExchange
svn path=/trunk/; revision=1130
2000-04-23 17:50:47 +00:00
Phillip Susi
7928fc621a Switched to CREATE_NEW_CONSOLE from DETACHED_PROCESS
svn path=/trunk/; revision=1129
2000-04-23 17:49:07 +00:00
Phillip Susi
cdd3a57119 Whole new win32 console support, with multiple virtual consoles and scrollback support
svn path=/trunk/; revision=1128
2000-04-23 17:44:53 +00:00
Phillip Susi
4f6c860da3 Was reporting geometry backwards, and needed to add a raw output mode
svn path=/trunk/; revision=1127
2000-04-23 17:42:57 +00:00
Phillip Susi
6ac6c50282 Patched up console code a bit
svn path=/trunk/; revision=1126
2000-04-23 17:41:40 +00:00
Phillip Susi
66780d1d02 CreateProcess was eating the flags, had to pass them on
svn path=/trunk/; revision=1125
2000-04-23 17:40:52 +00:00
Phillip Susi
ee3307e21d Fixed up Critical Section code
svn path=/trunk/; revision=1124
2000-04-20 05:29:27 +00:00
Phillip Susi
b01b3e0e97 Replaced a -- with an InterlockedDecrement
svn path=/trunk/; revision=1123
2000-04-17 03:09:04 +00:00
Eric Kohl
8b7920f796 Added some rtl functions
svn path=/trunk/; revision=1122
2000-04-15 23:14:32 +00:00
Eric Kohl
86a1100180 Implemented debugger functions
svn path=/trunk/; revision=1121
2000-04-14 01:50:38 +00:00
Boudewijn Dekker
4542601468 applied fixes to make a user32.dll
code is based on wine.

svn path=/trunk/; revision=1120
2000-04-13 20:59:11 +00:00
Boudewijn Dekker
99fb26fc8b .
svn path=/trunk/; revision=1119
2000-04-12 22:41:51 +00:00
Eric Kohl
7910a00791 Added kernel_parameters to boot_param
svn path=/trunk/; revision=1118
2000-04-12 17:34:27 +00:00
Jason Filby
93d95d8063 Fixed EngFreeMem def
svn path=/trunk/; revision=1117
2000-04-11 20:56:11 +00:00
Jason Filby
04a84d5ab8 Implemented DrvCopybits
Minor fixes

svn path=/trunk/; revision=1116
2000-04-10 20:17:34 +00:00
Eric Kohl
5b7a3113d5 Added system and isa bus handler
svn path=/trunk/; revision=1115
2000-04-09 15:58:13 +00:00
Eric Kohl
db593a0fb7 Fixed compiler warnings
svn path=/trunk/; revision=1114
2000-04-08 23:35:27 +00:00
Eric Kohl
51db0e6fed Moved KeStallExecutionProcessor() into HAL.
Added some security functions.

svn path=/trunk/; revision=1113
2000-04-08 19:10:50 +00:00
Eric Kohl
55c5bbf0be Fixed bug in COPY command
svn path=/trunk/; revision=1112
2000-04-08 14:50:47 +00:00
Phillip Susi
4be5d21243 Correted path to be system32 instead of system
svn path=/trunk/; revision=1111
2000-04-07 22:59:38 +00:00
Phillip Susi
fe9a733457 Removed LoadLibraryW from kernel32.edf, as it seems to not have an implementation and so would not compile. Wonder where the implementation whent?
svn path=/trunk/; revision=1110
2000-04-07 21:45:32 +00:00
Eric Kohl
654c8e7d00 Added more time functions
svn path=/trunk/; revision=1109
2000-04-07 12:45:22 +00:00
David Welch
53e0232c6c Began seperation of machine-dependant/independant sections of memory
manager
Did some more work on the dce/rpc implementation
Corrected loadros so the kernel can no longer write to read-only areas
of memory
Corrected alignment and size of initial stack

svn path=/trunk/; revision=1108
2000-04-07 02:24:03 +00:00
Eric Kohl
e3ce7008d7 Moved debug functions
svn path=/trunk/; revision=1107
2000-04-06 17:23:52 +00:00
Eric Kohl
9d90e8c107 Added some more security functions
svn path=/trunk/; revision=1106
2000-04-06 02:29:57 +00:00
Eric Kohl
48c46844eb Added hal functions
Fixed se functions

svn path=/trunk/; revision=1105
2000-04-05 15:52:45 +00:00
Eric Kohl
05bf1339f9 Added ace, acl and sid functions
svn path=/trunk/; revision=1104
2000-04-05 01:41:01 +00:00
David Welch
d54e68673b Correct LPC implementation
Removed thread leak in csrss
Added notification of port closing

svn path=/trunk/; revision=1103
2000-04-03 21:54:42 +00:00
Jason Filby
eb1f2f9bd1 Implemented DrvPaint and DrvBitBlt
Added tests for new routines
Minor fixes

svn path=/trunk/; revision=1102
2000-04-03 19:55:33 +00:00
Emanuele Aliberti
3b0f32720d Mm subsystem exports table complete.
svn path=/trunk/; revision=1101
2000-04-02 13:32:43 +00:00
Jason Filby
fccf1c26a7 All video related files now loaded by win32k
svn path=/trunk/; revision=1100
2000-04-02 13:09:50 +00:00
Jason Filby
b8d0ffaf38 Use NonPagedPool in EngAllocMem for now
svn path=/trunk/; revision=1099
2000-04-02 12:44:57 +00:00
Emanuele Aliberti
49f35db9e8 Version info for Named Pipe fs driver.
svn path=/trunk/; revision=1098
2000-04-01 14:20:21 +00:00
Emanuele Aliberti
1fc2971156 Version info for Minix driver.
svn path=/trunk/; revision=1097
2000-04-01 14:19:48 +00:00
Emanuele Aliberti
cdbe762497 Version info for ext2fs driver.
svn path=/trunk/; revision=1096
2000-04-01 14:19:07 +00:00
Jason Filby
248fe1f79d Implemented basic VGA routines
Implemented Eng\DrvLineTo

svn path=/trunk/; revision=1095
2000-04-01 12:31:29 +00:00
David Welch
9d6388ae05 Corrected mutex implementation
Added proper locking to the memory managment

svn path=/trunk/; revision=1093
2000-03-29 13:11:55 +00:00
Phillip Susi
3bd2a11130 Fixed typeo preventing compilation
svn path=/trunk/; revision=1092
2000-03-29 03:15:11 +00:00
David Welch
1be4f77bcb Corrected the handle generation algorithm in the kernel and csrss
Did some work on services.exe
Did some work on the service functions in advapi32
Made some progress in implementing npfs
Implemented a basic grammar for midl

svn path=/trunk/; revision=1091
2000-03-26 22:00:10 +00:00
Emanuele Aliberti
758ba695e1 Io subsystem clean-up. Every exported symbols is not STDCALL.
NtCreateFile renamed IoCreateFile and Nt{Create,Open}File call IoCreateFile.
Io data items added (to be fixed).

svn path=/trunk/; revision=1090
2000-03-26 19:38:32 +00:00
David Welch
79eff41abb Connected standard input/output to the console
Removed from superfluous assertions
Changed the ide read and write commands to work with bochs
Corrected bug in the csrss server

svn path=/trunk/; revision=1089
2000-03-24 22:25:39 +00:00
David Welch
0bd4cf0cbf Updated the minix driver
Moved console handling into csrss
Gave each process a name for debugging purposes

svn path=/trunk/; revision=1088
2000-03-22 18:36:00 +00:00
Eric Kohl
a1c9a520cf Modified kernel initialization sequence
Enabled bus handlers

svn path=/trunk/; revision=1087
2000-03-20 18:00:55 +00:00
Eric Kohl
dc3956d8ac Added some more status codes
svn path=/trunk/; revision=1086
2000-03-19 15:57:39 +00:00
Eric Kohl
802301d861 Implemented bus handler functions (not working yet)
Several STDCALL fixes

svn path=/trunk/; revision=1085
2000-03-19 13:35:38 +00:00
Eric Kohl
9887130ab7 Implemented bus handler functions (not working yet)
svn path=/trunk/; revision=1084
2000-03-19 13:33:39 +00:00
Eric Kohl
d4fc70afdc Implemented VideoPortDebugPrint()
svn path=/trunk/; revision=1083
2000-03-19 13:31:37 +00:00
Eric Kohl
bd02ee978f Added SYSTEM_TIME_INFORMATION
svn path=/trunk/; revision=1082
2000-03-19 13:30:30 +00:00
Emanuele Aliberti
bc30557a61 Some clean-up in ntoskrnl/mm. MmAllocateSection prototype moved in
internal/mm.h.

svn path=/trunk/; revision=1081
2000-03-19 09:14:52 +00:00
Eric Kohl
56132bfb44 Fixed path bugs
svn path=/trunk/; revision=1080
2000-03-18 19:55:53 +00:00
Jason Filby
c4ecfc894c Added forgotten .h files
svn path=/trunk/; revision=1079
2000-03-18 18:39:44 +00:00
Emanuele Aliberti
d6f6aad9e7 qsort in NTOSKRNL and some STDCALL declarations.
svn path=/trunk/; revision=1078
2000-03-18 15:12:19 +00:00
Eric Kohl
5e7a2202d1 Oops...
svn path=/trunk/; revision=1077
2000-03-18 14:37:43 +00:00
Eric Kohl
2c6fae9c20 Added image functions
Include pe.h in windows.h to avoid conflicts

svn path=/trunk/; revision=1076
2000-03-18 14:02:01 +00:00
Eric Kohl
1042f1ae27 Added security descriptor functions
svn path=/trunk/; revision=1075
2000-03-18 13:48:24 +00:00
Eric Kohl
753cb16c91 Fixed compiler warnings
svn path=/trunk/; revision=1074
2000-03-18 02:39:39 +00:00
Jason Filby
5d99a8740a last mod...
svn path=/trunk/; revision=1073
2000-03-17 22:19:44 +00:00
Jason Filby
1ba7343b1c Additional modifications
svn path=/trunk/; revision=1072
2000-03-17 22:14:31 +00:00
Jason Filby
2adbc636a8 Additional modifications
svn path=/trunk/; revision=1071
2000-03-17 21:56:43 +00:00
Jason Filby
c404283ff4 Additional modifications
svn path=/trunk/; revision=1070
2000-03-17 21:49:32 +00:00
Eric Kohl
d9d3272dc6 Fixed compiler warning
svn path=/trunk/; revision=1069
2000-03-17 21:46:41 +00:00
Jason Filby
690a781452 Added eng files
svn path=/trunk/; revision=1068
2000-03-17 21:44:02 +00:00
Jason Filby
e1d6086025 Miniport driver now loaded from win32k
Display and miniport drivers can now talk to each other
Sets the VGA video mode

svn path=/trunk/; revision=1067
2000-03-17 21:02:59 +00:00
Eric Kohl
40ee84e997 Oops! Typos...
svn path=/trunk/; revision=1066
2000-03-16 21:50:56 +00:00
Eric Kohl
ef5f880bac Fixed ANSI <--> Unicode conversions
svn path=/trunk/; revision=1065
2000-03-16 21:50:11 +00:00
David Welch
6088637c5e Oops.
svn path=/trunk/; revision=1064
2000-03-16 20:50:48 +00:00
Eric Kohl
0344745e30 Fixed a confusing error message
svn path=/trunk/; revision=1063
2000-03-16 20:02:44 +00:00
David Welch
337952bfb9 Implemented setting the fs register to point to the TEB
svn path=/trunk/; revision=1062
2000-03-16 18:44:57 +00:00
Eric Kohl
15c9809105 Fixed ANSI/OEM <--> Unicode conversions
svn path=/trunk/; revision=1061
2000-03-16 01:14:58 +00:00
Eric Kohl
b820741431 Fixed WIN32_FIND_DATA[A/W] structs and resulting bugs
svn path=/trunk/; revision=1060
2000-03-15 23:13:29 +00:00
Eric Kohl
67200bd4f9 Fixed ANSI/OEM <--> Unicode conversions
svn path=/trunk/; revision=1059
2000-03-15 18:30:30 +00:00
Eric Kohl
b2eb99d9f7 Obsolete!
svn path=/trunk/; revision=1058
2000-03-15 18:29:50 +00:00
Eric Kohl
9658579d48 Fixed ANSI/OEM <--> Unicode conversions
svn path=/trunk/; revision=1057
2000-03-15 12:25:47 +00:00
Eric Kohl
1c5d2b7204 Fixed ANSI/OEM <--> Unicode conversions
svn path=/trunk/; revision=1056
2000-03-14 23:09:23 +00:00
David Welch
fbfce3bc03 Updated install script
svn path=/trunk/; revision=1055
2000-03-13 23:16:46 +00:00
Eric Kohl
045a3dfdd2 Unused characters in long file name buffers (directory slots) must be filled with 0xFFFF.
svn path=/trunk/; revision=1054
2000-03-13 17:58:06 +00:00
Eric Kohl
2ef0c4177b Fixed a bug in rtlGetFullPathName_U()
svn path=/trunk/; revision=1053
2000-03-13 17:54:23 +00:00
Eric Kohl
6865b783cc Fixed file creation date and time
Implemented synchronization of all FATs (FAT16 only)
Fixed bug in directory creation

svn path=/trunk/; revision=1052
2000-03-12 23:28:59 +00:00
Eric Kohl
15094179f1 Add MD command
svn path=/trunk/; revision=1051
2000-03-12 23:24:51 +00:00
Eric Kohl
d9a0a586a8 Updated INTERFACE_TYPE
svn path=/trunk/; revision=1050
2000-03-12 01:22:37 +00:00
Eric Kohl
afa23cb264 Added some security functions
svn path=/trunk/; revision=1049
2000-03-12 01:18:18 +00:00
Eric Kohl
9488b3031c Fixed lots of status values
svn path=/trunk/; revision=1048
2000-03-12 01:15:09 +00:00
Emanuele Aliberti
a665da497e NTOKRNL.FsRtl notification and cache tunnels stubs added.
Possibly fixed the win32k.sys import error reported by Jason.

svn path=/trunk/; revision=1047
2000-03-11 00:51:36 +00:00
Emanuele Aliberti
f1d9e95a84 NTOSKRNL.FsRtl opportunistic lock stubs added.
svn path=/trunk/; revision=1046
2000-03-10 22:09:17 +00:00
Eric Kohl
91d68b2e7b Fixed compiler warning
svn path=/trunk/; revision=1045
2000-03-10 13:46:27 +00:00
Jason Filby
200afa376d Add VGA display driver
svn path=/trunk/; revision=1044
2000-03-10 12:45:45 +00:00
Jason Filby
836456a97d Small fix
svn path=/trunk/; revision=1043
2000-03-10 12:39:53 +00:00
Jason Filby
10f82cf988 Implemented DRIVER_BuildDDIFunctions
svn path=/trunk/; revision=1042
2000-03-09 21:04:10 +00:00
Eric Kohl
bf4806c502 Added time related functions
svn path=/trunk/; revision=1041
2000-03-09 16:01:25 +00:00
Eric Kohl
89871935c1 Implemented bitmap functions
svn path=/trunk/; revision=1040
2000-03-09 00:14:10 +00:00
Emanuele Aliberti
c3f375c672 win32k.sys exports script.
svn path=/trunk/; revision=1039
2000-03-08 22:39:04 +00:00
Emanuele Aliberti
267e86b00e Version info added to Eric's edit port.
svn path=/trunk/; revision=1038
2000-03-08 22:38:01 +00:00
Emanuele Aliberti
b129b2caea Some minor fixes.
svn path=/trunk/; revision=1037
2000-03-08 22:37:04 +00:00
Jason Filby
3da0b018e5 Moved display driver and got win32k loading it's entry point.
svn path=/trunk/; revision=1036
2000-03-08 21:23:14 +00:00
Eric Kohl
e2eb8c1697 Added more bitmap functions
Fixed some STDCALL issues

svn path=/trunk/; revision=1035
2000-03-08 01:55:34 +00:00
Eric Kohl
a12836346f Improved keyboard handling code
Fixed problems with differnet console sizes
Started function renaming

svn path=/trunk/; revision=1034
2000-03-08 01:49:37 +00:00
Emanuele Aliberti
1eed2a945a Added .Type and .Size attributes to the IRP object: so far nothing
seems broken.
Added __stdcall to some Io subsystem functions.
Attempt to implement IoIsOperationSynchronous().

svn path=/trunk/; revision=1033
2000-03-06 01:02:30 +00:00
Eric Kohl
79d0e047eb Added D-Flat/32 library
svn path=/trunk/; revision=1032
2000-03-05 19:58:08 +00:00
Emanuele Aliberti
2634e901be NTOSKRNL.FSRtl MDL stubs added.
svn path=/trunk/; revision=1031
2000-03-05 19:17:43 +00:00
Eric Kohl
9eac680002 Implemented kernel parameter line
Some kernel debugger improvements

svn path=/trunk/; revision=1030
2000-03-04 22:03:32 +00:00
Emanuele Aliberti
51df161b78 *** empty log message ***
svn path=/trunk/; revision=1029
2000-03-04 20:45:34 +00:00
Eric Kohl
2b0d467176 Moved spinlock.c and head.s from 'hal/x86' to 'ke'.
This is needed for the hal separation.

svn path=/trunk/; revision=1028
2000-03-04 13:44:59 +00:00
Eric Kohl
92857818cb Added bitmaps
Added some Rtl string functions
Various changes

svn path=/trunk/; revision=1026
2000-03-03 00:48:50 +00:00
Eric Kohl
fd304f0ef5 Fixed compiler warnings
svn path=/trunk/; revision=1025
2000-03-03 00:34:54 +00:00
Emanuele Aliberti
ef5b0066c7 *** empty log message ***
svn path=/trunk/; revision=1024
2000-03-01 23:41:35 +00:00
Emanuele Aliberti
395fb3c86f NTOSKRNL.FsRtlAllocate functions.
svn path=/trunk/; revision=1023
2000-03-01 22:52:28 +00:00
Eric Kohl
76f55a8a93 Fixed mp driver initialization bug and some other ones
svn path=/trunk/; revision=1022
2000-03-01 03:25:11 +00:00
Emanuele Aliberti
d53eeb0cee Added help command to shell.exe.
Minor changes.

svn path=/trunk/; revision=1021
2000-02-29 23:57:47 +00:00
Eric Kohl
c37b4fd7f1 Fixed some unicode initialization bugs
svn path=/trunk/; revision=1020
2000-02-27 18:01:44 +00:00
Eric Kohl
c0ad0d9b02 Added 'Path' and 'windir' system environment variables
svn path=/trunk/; revision=1019
2000-02-27 15:47:17 +00:00
Eric Kohl
853d9d4ae2 Fixed bugs in RtlExpandEnvironmentStrings_U() and RtlSetEnvironmentVariable()
svn path=/trunk/; revision=1018
2000-02-27 15:45:57 +00:00
Eric Kohl
6eb7010078 Fixed bugs in '%wZ' string output
svn path=/trunk/; revision=1017
2000-02-27 15:43:58 +00:00
Jason Filby
48db9468eb Minor fixes
svn path=/trunk/; revision=1016
2000-02-27 11:04:36 +00:00
Eric Kohl
fa81b6d260 Improved csrss (doesn't crash any more)
Improved kernel debugger code
Various minor improvements

svn path=/trunk/; revision=1015
2000-02-27 02:12:07 +00:00
Eric Kohl
012968e3dc Removed obsolete header include
svn path=/trunk/; revision=1014
2000-02-26 23:20:50 +00:00
Emanuele Aliberti
debfec7180 Some __stdcall declarations in ntoskrnl/hal.
A new include/ddk/kdfuncs.h header.

svn path=/trunk/; revision=1013
2000-02-26 22:41:35 +00:00
Emanuele Aliberti
4b80eae220 File locking NTOSKRNL.FsRtl stubs.
svn path=/trunk/; revision=1012
2000-02-26 16:22:27 +00:00
Boudewijn Dekker
ad382b39b3 changed struct FILE_OBJECT* to struct _FILE_OBJECT* at line 154
svn path=/trunk/; revision=1011
2000-02-26 09:58:06 +00:00
Eric Kohl
89875c3a44 Improved RtlCreateUserProcess()
svn path=/trunk/; revision=1010
2000-02-25 23:58:57 +00:00
Emanuele Aliberti
8f1ea8477c FsRtl stubs for DBCS names handling.
svn path=/trunk/; revision=1009
2000-02-25 23:27:51 +00:00
Eric Kohl
26253d8e9b Fixed PEB related bugs
svn path=/trunk/; revision=1008
2000-02-25 00:35:06 +00:00
Eric Kohl
0723b7c345 Removed useless debug messages and header files
svn path=/trunk/; revision=1007
2000-02-25 00:34:12 +00:00
Emanuele Aliberti
ac8c87276f Minor changes.
svn path=/trunk/; revision=1006
2000-02-24 23:38:26 +00:00
Emanuele Aliberti
00a4935163 *** empty log message ***
svn path=/trunk/; revision=1005
2000-02-24 23:31:27 +00:00
Emanuele Aliberti
9dc1aa60cb Changes for FsRtl added functions.
svn path=/trunk/; revision=1004
2000-02-24 23:27:52 +00:00
Emanuele Aliberti
9f87d15938 More stubs for NTOSKRNL.FsRtl: file name handling.
svn path=/trunk/; revision=1003
2000-02-24 23:25:16 +00:00
Eric Kohl
d7de328d0c Replaced direct io space mapping by call to MmMapIoSpace()
svn path=/trunk/; revision=1002
2000-02-24 13:16:40 +00:00
Eric Kohl
6165746875 Added gdi test program gditest.exe
svn path=/trunk/; revision=1001
2000-02-22 20:58:26 +00:00
Eric Kohl
7b02da36f7 Added GdiDllInitialize()
svn path=/trunk/; revision=1000
2000-02-22 20:55:57 +00:00
Eric Kohl
f8fe1ea0b1 Added W32kInitialize service (orig. name NtGdiInit)
svn path=/trunk/; revision=999
2000-02-22 20:53:11 +00:00
Eric Kohl
213e8b569c Fixed minor bugs interrupt_service2e()
svn path=/trunk/; revision=998
2000-02-22 20:50:07 +00:00
Rex Jolliff
5db4e55264 added support for shadow syscall table
svn path=/trunk/; revision=997
2000-02-22 07:27:30 +00:00
Eric Kohl
7cb2e823a0 Fixed minor bugs. 'ddk/ntddk.h' MUST ALWAYS be included FIST!!!!!
svn path=/trunk/; revision=996
2000-02-22 02:02:08 +00:00
Eric Kohl
d1341007cf Changed RtlCopyMemory() from function to macro
Improved system service table code

svn path=/trunk/; revision=995
2000-02-21 22:44:37 +00:00
Emanuele Aliberti
151f2f646e WIN32K Kernel API main include file (replaces win32k/win32k.h).
svn path=/trunk/; revision=994
2000-02-21 00:50:17 +00:00
Emanuele Aliberti
7d3fded0ba Added little prog. that builds the WIN32K.SYS service table
and the stubs to be used in GDI32.DLL.
Converted to __stdcall every W32k... call in WIN32K.SYS.
Fixed the entry point in GDI32.DLL.
WARNING: the thing compiles, but Jason reports it does not work as is
(he tested a preliminary stub piece of code).
Perhaps changing it (as Phillip proposes) or fixing it to make WIN32K.SYS
work the NT way is required (Hernan, are you there: I did not understand
well how the additional service tables work). Feel free to change it.

svn path=/trunk/; revision=993
2000-02-20 22:52:50 +00:00
Eric Kohl
b9bb1744aa Fixed bugs in process parameter and environment code
svn path=/trunk/; revision=992
2000-02-19 19:37:13 +00:00
Eric Kohl
e632116bee Fixed buggy RtlCompareString() and RtlCompareUnicodeString()
svn path=/trunk/; revision=991
2000-02-19 19:31:41 +00:00
Eric Kohl
f28a023c99 Fixed a bug - memmove() couldn't handle overlapping buffers
svn path=/trunk/; revision=990
2000-02-19 17:18:34 +00:00
Eric Kohl
b0780ae5d6 Fixed environment implementation
Fixed current directory implementation

svn path=/trunk/; revision=989
2000-02-18 01:01:06 +00:00
Eric Kohl
6bea08705e Fixed minor bugs and removed fixed start directory
svn path=/trunk/; revision=988
2000-02-18 00:53:11 +00:00
Eric Kohl
6708f0b87e Fixed environment implementation
Fixed current directory implementation

svn path=/trunk/; revision=987
2000-02-18 00:51:03 +00:00
Emanuele Aliberti
f0175145d6 Untested raw implementation of MultiByteToWideChar().
svn path=/trunk/; revision=986
2000-02-14 22:10:46 +00:00
David Welch
3cd2fc22d7 Fixed compilation bug
Made a start on some documentation in info format

svn path=/trunk/; revision=985
2000-02-14 14:13:34 +00:00
Boudewijn Dekker
b49921cb96 impl. NtGetTickCount
svn path=/trunk/; revision=984
2000-02-14 10:27:40 +00:00
David Welch
c110a36a78 Moved user-process loading into ZwCreateProcess
svn path=/trunk/; revision=983
2000-02-13 16:05:19 +00:00
Eric Kohl
ca7bca8f84 Fixed a bug in NtQueryVirtualMemory()
svn path=/trunk/; revision=982
2000-02-06 15:52:04 +00:00
Eric Kohl
5f71c29e2c Fixed _wcsnicmp()
svn path=/trunk/; revision=981
2000-02-05 23:46:14 +00:00
Eric Kohl
326a3cd58b Added some string functions
Added security descriptor functions
Implemented environment functions
Implemented current directory functions

svn path=/trunk/; revision=980
2000-02-05 16:08:49 +00:00
Eric Kohl
18c0c85dd8 Added CHECKPOINT macro
svn path=/trunk/; revision=978
2000-02-03 22:45:11 +00:00
Phillip Susi
480136bdf4 Fixed loader bugs, still needs reworked to create multiple sections
svn path=/trunk/; revision=977
2000-02-03 21:34:14 +00:00
Paolo Pantaleo
16ef6ef2af history command added and some minor changes to history interface
svn path=/trunk/; revision=976
2000-02-01 18:29:11 +00:00
Eric Kohl
33258c166f Fixed a stdcall bug
svn path=/trunk/; revision=975
2000-01-31 20:26:15 +00:00
Eric Kohl
f09ef9894a Fixed an invalid printf() format type
svn path=/trunk/; revision=974
2000-01-31 20:25:43 +00:00
Eric Kohl
19e258120e Fixed compiler warnings
svn path=/trunk/; revision=973
2000-01-31 20:24:41 +00:00
Eric Kohl
7c3e6e80c1 Fixed METAFILEPICT bug
svn path=/trunk/; revision=972
2000-01-31 20:23:54 +00:00
Hernan Ochoa
5dc3ee0414 Added $Id Tag for commit info
svn path=/trunk/; revision=971
2000-01-30 20:55:51 +00:00
Hernan Ochoa
90579ae67f Added $Id Tag for commit info
svn path=/trunk/; revision=970
2000-01-30 17:02:44 +00:00
Phillip Susi
5dff1d9789 ignore errors deleting files for make clean
svn path=/trunk/; revision=969
2000-01-29 20:32:12 +00:00
Hernan Ochoa
337692832a Added parameters checking, help, and some information about
when the program was compiled.

svn path=/trunk/; revision=968
2000-01-29 19:20:26 +00:00
David Welch
d633bd8168 Changed the loader so ZwCreateProcess now maps ntdll into memory
svn path=/trunk/; revision=967
2000-01-27 08:56:50 +00:00
Jason Filby
980d94c760 *** empty log message ***
svn path=/trunk/; revision=966
2000-01-26 21:10:16 +00:00
David Welch
d24a48cd94 More improvements to LPC code
Updated TEB structure
Changed selectors value to be closer to nt
Some bugfixes

svn path=/trunk/; revision=965
2000-01-26 10:07:30 +00:00
Phillip Susi
52404fd1c8 Fixed bug in IO manager that caused crash when trying to open a file on a non existant device
Fixed memory leaks in object manager

svn path=/trunk/; revision=964
2000-01-25 06:31:25 +00:00
Emanuele Aliberti
3a18299c0f Coders directory updated.
svn path=/trunk/; revision=963
2000-01-23 22:52:57 +00:00
Phillip Susi
c41488b99a Fixed syntax error
svn path=/trunk/; revision=962
2000-01-23 19:36:41 +00:00
Hernan Ochoa
3cd7e191a4 now NTOSKRNL exports KeServiceDescriptorTable just like
NT's NTOSKRNL does.

svn path=/trunk/; revision=961
2000-01-23 15:21:25 +00:00
Hernan Ochoa
185d2be0f1 added definitions for SSDT, SSPT, KeServiceDescriptorTable,
KeServiceDescriptorTableShadow, KeAddSystemService(),
KE_SERVIDE_DESCRIPTOR_TABLE_ENTRY.

svn path=/trunk/; revision=960
2000-01-23 15:19:05 +00:00
Hernan Ochoa
55bb357489 changed syscall tables. now it mimics NT style.
it has a SSDT a SSPT, a KeServiceDescriptorTable and a
KeServiceDescriptorTableShadow. modified the code
inside the int2e_handler() to use the new syscall tables.

svn path=/trunk/; revision=959
2000-01-23 15:17:06 +00:00
Hernan Ochoa
65a742ceaa changed syscall tables. now it mimics NT style.
it has a SSDT a SSPT, a KeServiceDescriptorTable and a
KeServiceDescriptorTableShadow. genntdll now also generates
some useful defines about min syscall number, max
syscall number, and number of syscalls.

svn path=/trunk/; revision=958
2000-01-23 15:14:42 +00:00
Phillip Susi
1220167730 New Read/Write File IO test utility
svn path=/trunk/; revision=957
2000-01-23 09:04:30 +00:00
Phillip Susi
2001008199 Fixed OutputDebugString() to use the new int 2D debug service
Moved include of rules.mak up to top so it picks up the HOST variable from there

svn path=/trunk/; revision=956
2000-01-23 08:16:20 +00:00
Emanuele Aliberti
74131ebded Added error reporting to lpcsrv and lpcclt.
svn path=/trunk/; revision=955
2000-01-22 22:22:48 +00:00
Emanuele Aliberti
5415f6f333 Fixed a stupid bug in time conversion code that generated abnormally high
build numbers.

svn path=/trunk/; revision=954
2000-01-22 14:25:48 +00:00
Phillip Susi
0ab77c8e74 Fixed a broken DPRINT
svn path=/trunk/; revision=953
2000-01-22 00:04:56 +00:00
Phillip Susi
51445f2db1 Made symbolic links permanent the proper way, with the perm flag, rather than leaking a refcount
svn path=/trunk/; revision=952
2000-01-21 23:59:53 +00:00
Phillip Susi
4d393f112a darnit... another debug print.. someone kick me
svn path=/trunk/; revision=951
2000-01-21 23:27:47 +00:00
Phillip Susi
a706ca2b64 Ooops... forgot some debug prints ( embarassed )
svn path=/trunk/; revision=950
2000-01-21 23:17:47 +00:00
Phillip Susi
e4008de214 Fixed makefile to include rules.mak first, so it gets the settings in there right
Fixed path parsing for \\.\

svn path=/trunk/; revision=949
2000-01-21 23:06:26 +00:00
Eric Kohl
2a24d175bf Replaced calls to aprintf() or dprintf() by DPRINT()
Removed old debugging code

svn path=/trunk/; revision=948
2000-01-20 22:57:01 +00:00
Eric Kohl
b6c944afcc Added missing format types to vfprintf()
Implemented vfwprintf()

svn path=/trunk/; revision=947
2000-01-20 22:49:12 +00:00
Emanuele Aliberti
90617da53d Minor changes.
svn path=/trunk/; revision=946
2000-01-20 22:14:45 +00:00
Emanuele Aliberti
b6de29fefb Two more FsRtl stubs.
svn path=/trunk/; revision=945
2000-01-20 22:14:08 +00:00
Emanuele Aliberti
8b078f86ae Updated fsfuncs.h with latest stubs prototypes.
svn path=/trunk/; revision=944
2000-01-20 22:11:48 +00:00
Eric Kohl
1b92b852eb Cleanup
Added '%I64' format type

svn path=/trunk/; revision=943
2000-01-19 19:48:20 +00:00
Eric Kohl
072eed4ad3 Fixed compiler warning
svn path=/trunk/; revision=942
2000-01-19 19:47:15 +00:00
Eric Kohl
75f2f5b22e Fixed ugly bug in the serial debugging code
svn path=/trunk/; revision=941
2000-01-19 16:24:15 +00:00
1656 changed files with 7610 additions and 279121 deletions

View File

@@ -1,4 +1,3 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

130
freeldr/FREELDR.INI Normal file
View File

@@ -0,0 +1,130 @@
# FreeLoader by Brian Palmer
# FREELDR.INI - FreeLoader Initialization file
#
# Each line must be less than 1024 characters long
# and must be either a section heading (i.e. [section_name])
# or a setting (i.e. name=value) or a blank line.
# Comments start with a '#' character.
# Background colors can be any one of the following:
# Black
# Blue
# Green
# Cyan
# Red
# Magenta
# Brown
# Gray
# Text colors can be any one of the background
# colors and any of the following:
# DarkGray
# LightBlue
# LightGreen
# LightCyan
# LightRed
# LightMagenta
# Yellow
# White
# [FREELOADER] Section Commands:
#
# MessageBox - displays the specified text in a message box upon bootup
# MessageLine - adds a new line of text to a message box (must come before MessageBox command)
# TitleText - text that is displayed in the title box
# StatusBarColor - color of status bar's background
# StatusBarTextColor - color of status bar's text
# BackdropTextColor - color of the backdrop's fill
# BackdropColor - color of the backdrop's background
# BackdropFillStyle - backdrop fill style - can be Light, Medium, or Dark
# TitleBoxTextColor - title box text color
# TitleBoxColor - title box background color
# MessageBoxTextColor - message box text color
# MessageBoxColor - message box background color
# MenuTextColor - menu text color
# MenuColor - menu color
# TextColor - normal text color
# SelectedTextColor - selected text color
# SelectedColor - selected text background color
# TimeOut - sets the timeout (in seconds) before the first OS listed gets booted automagically
# [OS-General] Section Commands:
#
# BootType - sets the boot type: ReactOS, Linux, BootSector, Partition, Drive
# BootDrive - sets the boot drive: 0 - first floppy, 1 - second floppy, 0x80 - first hard disk, 0x81 - second hard disk
# BootPartition - sets the boot partition
# [BootSector OSType] Section Commands:
#
# BootSector - sets the filename of the bootsector to be loaded
# [ReactOS OSType] Section Commands:
#
# Options - sets the command line options for the kernel being booted
# Kernel - sets the kernel filename
# Driver - sets the name of one or more drivers to be loaded (one entry per driver)
[FREELOADER]
MessageLine=Welcome to FreeLoader!
MessageLine=Copyright (c) 2000 by Brian Palmer <brianp@sginet.com>
MessageLine=
MessageBox=Edit your FREELDR.INI file to change your boot settings.
TitleText=Boot Menu
StatusBarColor=Cyan
StatusBarTextColor=Black
BackdropTextColor=White
BackdropColor=Blue
BackdropFillStyle=Medium
TitleBoxTextColor=White
TitleBoxColor=Red
MessageBoxTextColor=White
MessageBoxColor=Blue
MenuTextColor=White
MenuColor=Blue
TextColor=Yellow
SelectedTextColor=Black
SelectedColor=Gray
#OS=ReactOS
#OS=ReactOS (Debug)
#OS=Linux
OS=3<> Floppy (A:)
OS=Microsoft Windows (C:)
OS=Drive D:
#TimeOut=0
#[ReactOS]
#BootType=ReactOS
#BootDrive=0
#Options=/DEBUGPORT=SCREEN
#Kernel=\NTOSKRNL.EXE
#Driver=\DRIVERS\IDE.SYS
#Driver=\DRIVERS\VFATFS.SYS
#[ReactOS (Debug)]
#BootType=ReactOS
#BootDrive=0
#Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=19200
#Kernel=\NTOSKRNL.EXE
#Driver=\DRIVERS\IDE.SYS
#Driver=\DRIVERS\VFATFS.SYS
#[Linux]
# Linux boot type not implemented yet
#BootType=Partition
#BootDrive=0x80
#BootPartition=2
[3<> Floppy (A:)]
BootType=Drive
BootDrive=0
[Microsoft Windows (C:)]
BootType=Drive
BootDrive=0x80
[Drive D:]
BootType=Partition
BootDrive=0x81
BootPartition=1

View File

@@ -0,0 +1,256 @@
; BOOTSECT.ASM
; FAT12/16 Boot Sector
; Copyright (c) 1998 Brian Palmer
org 7c00h
segment .text
bits 16
start:
jmp short main
nop
OEMName db 'FreeLDR!'
BytesPerSector dw 512
SectsPerCluster db 1
ReservedSectors dw 1
NumberOfFats db 2
MaxRootEntries dw 512
TotalSectors dw 2880
MediaDescriptor db 0f0h
SectorsPerFat dw 9
SectorsPerTrack dw 18
NumberOfHeads dw 2
HiddenSectors dd 0
TotalSectorsBig dd 0
BootDrive db 0
Reserved db 0
ExtendSig db 29h
SerialNumber dd 00000000h
VolumeLabel db 'FreeLoader!'
FileSystem db 'FAT12 '
main:
cli
cld
xor ax,ax
mov ss,ax
mov sp,7c00h ; Setup a stack
mov ax,cs ; Setup segment registers
mov ds,ax ; Make DS correct
mov es,ax ; Make ES correct
sti ; Enable ints now
mov [BootDrive],dl ; Save the boot drive
xor ax,ax ; Zero out AX
; Reset disk controller
int 13h
jnc Continue1
jmp BadBoot ; Reset failed...
Continue1:
; Now we must find our way to the first sector of the root directory
xor ax,ax
xor cx,cx
mov al,[NumberOfFats] ; Number of fats
mul WORD [SectorsPerFat] ; Times sectors per fat
add ax,WORD [HiddenSectors]
adc dx,WORD [HiddenSectors+2] ; Add the number of hidden sectors
add ax,[ReservedSectors] ; Add the number of reserved sectors
adc dx,cx ; Add carry bit
push ax ; Store it on the stack
push dx ; Save 32-bit logical start sector
push ax
push dx ; Save it for later use also
; DX:AX now has the number of the starting sector of the root directory
; Now calculate the size of the root directory
mov ax,0020h ; Size of dir entry
mul WORD [MaxRootEntries] ; Times the number of entries
mov bx,[BytesPerSector]
add ax,bx
dec ax
div bx ; Divided by the size of a sector
; AX now has the number of root directory sectors
xchg ax,cx ; Now CX has number of sectors
pop dx
pop ax ; Restore logical sector start
push cx ; Save for later use
mov bx,7c0h ; We will load the root directory
add bx,20h ; Right after the boot sector in memory
mov es,bx
xor bx,bx ; We will load it to [0000:7e00h]
call ReadSectors ; Read the sectors
jnc Continue2 ; BadBoot on error
jmp BadBoot
Continue2:
; Now we have to find our way through the root directory to
; The OSLOADER.SYS file
mov bx,[MaxRootEntries]; Search entire root directory
mov ax,7e0h ; We loaded at 07e0:0000
mov es,ax
xor di,di
mov si,filename
mov cx,11
rep cmpsb ; Compare filenames
jz FoundFile ; If same we found it
dec bx
jnz FindFile
jmp ErrBoot
FindFile:
mov ax,es ; We didn't find it in the previous dir entry
add ax,2 ; So lets move to the next one
mov es,ax ; And search again
xor di,di
mov si,filename
mov cx,11
rep cmpsb ; Compare filenames
jz FoundFile ; If same we found it
dec bx ; Keep searching till we run out of dir entries
jnz FindFile ; Last entry?
jmp ErrBoot
FoundFile:
xor di,di ; ES:DI has dir entry
xor dx,dx
mov ax,WORD [es:di+1ah] ; Get start cluster
dec ax
dec ax
xor ch,ch
mov cl,BYTE [SectsPerCluster] ; Times sectors per cluster
mul cx
pop cx ; Get number of sectors for root dir
add ax,cx
adc dx,0
pop cx ; Get logical start sector of
pop bx ; Root directory
add ax,bx ; Now we have DX:AX with the logical start
adc dx,cx ; Sector of OSLOADER.SYS
push ax
push dx
mov ax,WORD [es:di+1ch]
mov dx,WORD [es:di+1eh]
mov bx,[BytesPerSector]
dec bx
add ax,bx
adc dx,0
div WORD [BytesPerSector]
xchg ax,cx ; Now CX has number of sectors of OSLOADER.SYS
pop dx
pop ax
mov bx,800h
mov es,bx
xor bx,bx ; Load ROSLDR at 0000:8000h
call ReadSectors ; Load it
jc BadBoot
mov dl,[BootDrive]
xor ax,ax
push ax
mov ax,8000h
push ax ; We will do a far return to 0000:8000h
retf ; Transfer control to ROSLDR
; Reads logical sectors into [ES:BX]
; DX:AX has logical sector number to read
; CX has number of sectors to read
; CarryFlag set on error
ReadSectors:
push ax
push dx
push cx
xchg ax,cx
xchg ax,dx
xor dx,dx
div WORD [SectorsPerTrack]
xchg ax,cx
div WORD [SectorsPerTrack] ; Divide logical by SectorsPerTrack
inc dx ; Sectors numbering starts at 1 not 0
xchg cx,dx
div WORD [NumberOfHeads] ; Number of heads
mov dh,dl ; Head to DH, drive to DL
mov dl,[BootDrive] ; Drive number
mov ch,al ; Cylinder in CX
ror ah,1 ; Low 8 bits of cylinder in CH, high 2 bits
ror ah,1 ; in CL shifted to bits 6 & 7
or cl,ah ; Or with sector number
mov ax,513
int 13h ; DISK - READ SECTORS INTO MEMORY
; AL = number of sectors to read, CH = track, CL = sector
; DH = head, DL = drive, ES:BX -> buffer to fill
; Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
pop cx
pop dx
pop ax
jc ReadFail
inc ax ;Increment Sector to Read
jnz NoCarry
inc dx
NoCarry:
push bx
mov bx,es
add bx,20h
mov es,bx
pop bx
; Increment read buffer for next sector
loop ReadSectors ; Read next sector
ReadFail:
ret
; Displays a bad boot message
; And reboots
BadBoot:
mov si,msgDiskError ; Bad boot disk message
call PutChars ; Display it
mov si,msgAnyKey ; Press any key message
call PutChars ; Display it
jmp Reboot
; Displays an error message
; And reboots
ErrBoot:
mov si,msgFreeLdr ; FreeLdr not found message
call PutChars ; Display it
mov si,msgAnyKey ; Press any key message
call PutChars ; Display it
Reboot:
xor ax,ax
int 16h ; Wait for a keypress
int 19h ; Reboot
PutChars:
lodsb
or al,al
jz short Done
mov ah,0eh
mov bx,07h
int 10h
jmp short PutChars
Done:
retn
msgDiskError db 'Disk error',0dh,0ah,0
msgFreeLdr db 'FREELDR.SYS not found',0dh,0ah,0
msgAnyKey db 'Press any key to continue.',0dh,0ah,0
filename db 'FREELDR SYS'
times 510-($-$$) db 0 ; Pad to 510 bytes
dw 0aa55h ; BootSector signature

View File

@@ -0,0 +1,351 @@
; BTSECT32.ASM
; FAT32 Boot Sector
; Copyright (c) 1998, 2000 Brian Palmer
org 7c00h
segment .text
bits 16
start:
jmp short main
nop
OEMName db 'FreeLDR!'
BytesPerSector dw 512
SectsPerCluster db 1
ReservedSectors dw 1
NumberOfFats db 2
MaxRootEntries dw 0 ;512 - Always zero for FAT32 volumes
TotalSectors dw 0 ;2880 - Always zero for FAT32 volumes
MediaDescriptor db 0f8h
SectorsPerFat dw 0 ;9 - Always zero for FAT32 volumes
SectorsPerTrack dw 18
NumberOfHeads dw 2
HiddenSectors dd 0
TotalSectorsBig dd 0
; FAT32 Inserted Info
SectorsPerFatBig dd 0
ExtendedFlags dw 0
FSVersion dw 0
RootDirStartCluster dd 0
FSInfoSector dw 0
BackupBootSector dw 6
Reserved1 times 12 db 0
; End FAT32 Inserted Info
BootDrive db 0
Reserved db 0
ExtendSig db 29h
SerialNumber dd 00000000h
VolumeLabel db 'FreeLoader!'
FileSystem db 'FAT32 '
main:
cli
cld
xor ax,ax
mov ss,ax
mov sp,7c00h ; Setup a stack
mov ax,cs ; Setup segment registers
mov ds,ax ; Make DS correct
mov es,ax ; Make ES correct
sti ; Enable ints now
mov [BootDrive],dl ; Save the boot drive
xor ax,ax ; Zero out AX
; Reset disk controller
int 13h
jnc Continue
jmp BadBoot ; Reset failed...
Continue:
; First we have to load our extra boot code at
; sector 14 into memory at [0000:7e00h]
xor dx,dx
mov ax,0eh
add ax,WORD [HiddenSectors]
adc dx,WORD [HiddenSectors+2] ; Add the number of hidden sectors
mov cx,1
mov bx,7e0h
mov es,bx ; Read sector to [0000:7e00h]
xor bx,bx
call ReadSectors
jnc Continue1
jmp BadBoot
Continue1:
; Now we must get the first cluster of the root directory
mov eax,DWORD [RootDirStartCluster]
cmp eax,0ffffff8h ; Check to see if this is the last cluster in the chain
jb Continue2 ; If not continue, if so BadBoot
jmp ErrBoot
Continue2:
mov bx,800h
mov es,bx ; Read cluster to [0000:8000h]
call ReadCluster ; Read the cluster
; Now we have to find our way through the root directory to
; The OSLOADER.SYS file
xor bx,bx
mov bl,[SectsPerCluster]
shl bx,4 ; BX = BX * 512 / 32
mov ax,800h ; We loaded at 0800:0000
mov es,ax
xor di,di
mov si,filename
mov cx,11
rep cmpsb ; Compare filenames
jz FoundFile ; If same we found it
dec bx
jnz FindFile
jmp ErrBoot
FindFile:
mov ax,es ; We didn't find it in the previous dir entry
add ax,2 ; So lets move to the next one
mov es,ax ; And search again
xor di,di
mov si,filename
mov cx,11
rep cmpsb ; Compare filenames
jz FoundFile ; If same we found it
dec bx ; Keep searching till we run out of dir entries
jnz FindFile ; Last entry?
; Get the next root dir cluster and try again until we run out of clusters
mov eax,DWORD [RootDirStartCluster]
call GetFatEntry
mov [RootDirStartCluster],eax
jmp Continue1
FoundFile:
xor di,di ; ES:DI has dir entry
xor dx,dx
mov ax,WORD [es:di+14h] ; Get start cluster high word
shl eax,16
mov ax,WORD [es:di+1ah] ; Get start cluster low word
mov bx,800h
mov es,bx
FoundFile2:
cmp eax,0ffffff8h ; Check to see if this is the last cluster in the chain
jae FoundFile3 ; If so continue, if not then read then next one
push eax
xor bx,bx ; Load ROSLDR starting at 0000:8000h
push es
call ReadCluster
pop es
xor bx,bx
mov bl,[SectsPerCluster]
shl bx,5 ; BX = BX * 512 / 16
mov ax,es ; Increment the load address by
add ax,bx ; The size of a cluster
mov es,ax
pop eax
push es
call GetFatEntry ; Get the next entry
pop es
jmp FoundFile2 ; Load the next cluster (if any)
FoundFile3:
mov dl,[BootDrive]
xor ax,ax
push ax
mov ax,8000h
push ax ; We will do a far return to 0000:8000h
retf ; Transfer control to ROSLDR
; Reads logical sectors into [ES:BX]
; DX:AX has logical sector number to read
; CX has number of sectors to read
; CarryFlag set on error
ReadSectors:
push ax
push dx
push cx
xchg ax,cx
xchg ax,dx
xor dx,dx
div WORD [SectorsPerTrack]
xchg ax,cx
div WORD [SectorsPerTrack] ; Divide logical by SectorsPerTrack
inc dx ; Sectors numbering starts at 1 not 0
xchg cx,dx
div WORD [NumberOfHeads] ; Number of heads
mov dh,dl ; Head to DH, drive to DL
mov dl,[BootDrive] ; Drive number
mov ch,al ; Cylinder in CX
ror ah,1 ; Low 8 bits of cylinder in CH, high 2 bits
ror ah,1 ; in CL shifted to bits 6 & 7
or cl,ah ; Or with sector number
mov ax,513
int 13h ; DISK - READ SECTORS INTO MEMORY
; AL = number of sectors to read, CH = track, CL = sector
; DH = head, DL = drive, ES:BX -> buffer to fill
; Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read
pop cx
pop dx
pop ax
jc ReadFail
inc ax ;Increment Sector to Read
jnz NoCarry
inc dx
NoCarry:
push bx
mov bx,es
add bx,20h
mov es,bx
pop bx
; Increment read buffer for next sector
loop ReadSectors ; Read next sector
ReadFail:
ret
; Displays a bad boot message
; And reboots
BadBoot:
mov si,msgDiskError ; Bad boot disk message
call PutChars ; Display it
mov si,msgAnyKey ; Press any key message
call PutChars ; Display it
jmp Reboot
; Displays an error message
; And reboots
ErrBoot:
mov si,msgFreeLdr ; FreeLdr not found message
call PutChars ; Display it
mov si,msgAnyKey ; Press any key message
call PutChars ; Display it
Reboot:
xor ax,ax
int 16h ; Wait for a keypress
int 19h ; Reboot
PutChars:
lodsb
or al,al
jz short Done
mov ah,0eh
mov bx,07h
int 10h
jmp short PutChars
Done:
retn
msgDiskError db 'Disk error',0dh,0ah,0
msgFreeLdr db 'FREELDR.SYS not found',0dh,0ah,0
msgAnyKey db 'Press any key to continue.',0dh,0ah,0
filename db 'FREELDR SYS'
times 510-($-$$) db 0 ; Pad to 510 bytes
dw 0aa55h ; BootSector signature
; End of bootsector
;
; Now starts the extra boot code that we will store
; at sector 14 on a FAT32 volume
;
; To remain multi-boot compatible with other operating
; systems we must not overwrite anything other than
; the bootsector which means we will have to use
; a different sector like 14 to store our extra boot code
;
; Note: Win2k uses sector 12 for this purpose
; Returns the FAT entry for a given cluster number
; On entry EAX has cluster number
; On return EAX has FAT entry for that cluster
GetFatEntry:
shl eax,2 ; EAX = EAX * 4 (since FAT32 entries are 4 bytes)
mov ecx,eax ; Save this for later in ECX
xor edx,edx
movzx ebx,WORD [BytesPerSector]
push ebx
div ebx ; FAT Sector Number = EAX / BytesPerSector
movzx ebx,WORD [ReservedSectors]
add eax,ebx ; FAT Sector Number += ReservedSectors
movzx ebx,WORD [HiddenSectors]
add eax,ebx ; FAT Sector Number += HiddenSectors
pop ebx
dec ebx
and ecx,ebx ; FAT Offset Within Sector = ECX % BytesPerSector
; EAX holds logical FAT sector number
; ECX holds FAT entry offset
push ecx
ror eax,16
mov dx,ax
ror eax,16
; DX:AX holds logical FAT sector number
mov bx,7000h
mov es,bx
xor bx,bx ; We will load it to [7000:0000h]
mov cx,1
call ReadSectors
jnc GetFatEntry1
jmp BadBoot
GetFatEntry1:
mov bx,7000h
mov es,bx
pop ecx
mov eax,DWORD [es:ecx] ; Get FAT entry
and eax,0fffffffh ; Mask off reserved bits
ret
; Reads cluster number in EAX into [ES:0000]
ReadCluster:
; StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors;
dec eax
dec eax
xor edx,edx
movzx ebx,BYTE [SectsPerCluster]
mul ebx
push eax
xor edx,edx
movzx eax,BYTE [NumberOfFats]
mul DWORD [SectorsPerFatBig]
movzx ebx,WORD [ReservedSectors]
add eax,ebx
add eax,DWORD [HiddenSectors]
pop ebx
add eax,ebx ; EAX now contains the logical sector number of the cluster
ror eax,16
mov dx,ax
ror eax,16
xor bx,bx ; We will load it to [ES:0000], ES loaded before function call
movzx cx,BYTE [SectsPerCluster]
call ReadSectors
jnc ReadCluster1
jmp BadBoot
ReadCluster1:
ret
times 1022-($-$$) db 0 ; Pad to 1022 bytes
dw 0aa55h ; BootSector signature

View File

@@ -0,0 +1,2 @@
nasm -o bootsect.bin -f bin bootsect.asm
nasm -o btsect32.bin -f bin btsect32.asm

View File

@@ -0,0 +1,35 @@
unsigned char data[] = {
0xeb, 0x3c, 0x90, 0x46, 0x72, 0x65, 0x65, 0x4c, 0x44, 0x52, 0x21, 0x00, 0x02, 0x01, 0x01, 0x00,
0x02, 0x00, 0x02, 0x40, 0x0b, 0xf0, 0x09, 0x00, 0x12, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x46, 0x72, 0x65, 0x65, 0x4c,
0x6f, 0x61, 0x64, 0x65, 0x72, 0x21, 0x46, 0x41, 0x54, 0x31, 0x32, 0x20, 0x20, 0x20, 0xfa, 0xfc,
0x31, 0xc0, 0x8e, 0xd0, 0xbc, 0x00, 0x7c, 0x8c, 0xc8, 0x8e, 0xd8, 0x8e, 0xc0, 0xfb, 0x88, 0x16,
0x24, 0x7c, 0x31, 0xc0, 0xcd, 0x13, 0x73, 0x03, 0xe9, 0x0b, 0x01, 0x31, 0xc0, 0x31, 0xc9, 0xa0,
0x10, 0x7c, 0xf7, 0x26, 0x16, 0x7c, 0x03, 0x06, 0x1c, 0x7c, 0x13, 0x16, 0x1e, 0x7c, 0x03, 0x06,
0x0e, 0x7c, 0x11, 0xca, 0x50, 0x52, 0x50, 0x52, 0xb8, 0x20, 0x00, 0xf7, 0x26, 0x11, 0x7c, 0x8b,
0x1e, 0x0b, 0x7c, 0x01, 0xd8, 0x48, 0xf7, 0xf3, 0x91, 0x5a, 0x58, 0x51, 0xbb, 0xc0, 0x07, 0x81,
0xc3, 0x20, 0x00, 0x8e, 0xc3, 0x31, 0xdb, 0xe8, 0x8c, 0x00, 0x73, 0x03, 0xe9, 0xc7, 0x00, 0x8b,
0x1e, 0x11, 0x7c, 0xb8, 0xe0, 0x07, 0x8e, 0xc0, 0x31, 0xff, 0xbe, 0xd8, 0x7d, 0xb9, 0x0b, 0x00,
0xf3, 0xa6, 0x74, 0x1f, 0x4b, 0x75, 0x03, 0xe9, 0xbb, 0x00, 0x8c, 0xc0, 0x05, 0x02, 0x00, 0x8e,
0xc0, 0x31, 0xff, 0xbe, 0xd8, 0x7d, 0xb9, 0x0b, 0x00, 0xf3, 0xa6, 0x74, 0x06, 0x4b, 0x75, 0xea,
0xe9, 0xa2, 0x00, 0x31, 0xff, 0x31, 0xd2, 0x26, 0x8b, 0x45, 0x1a, 0x48, 0x48, 0x30, 0xed, 0x8a,
0x0e, 0x0d, 0x7c, 0xf7, 0xe1, 0x59, 0x01, 0xc8, 0x81, 0xd2, 0x00, 0x00, 0x59, 0x5b, 0x01, 0xd8,
0x11, 0xca, 0x50, 0x52, 0x26, 0x8b, 0x45, 0x1c, 0x26, 0x8b, 0x55, 0x1e, 0x8b, 0x1e, 0x0b, 0x7c,
0x4b, 0x01, 0xd8, 0x81, 0xd2, 0x00, 0x00, 0xf7, 0x36, 0x0b, 0x7c, 0x91, 0x5a, 0x58, 0xbb, 0x00,
0x08, 0x8e, 0xc3, 0x31, 0xdb, 0xe8, 0x0e, 0x00, 0x72, 0x4c, 0x8a, 0x16, 0x24, 0x7c, 0x31, 0xc0,
0x50, 0xb8, 0x00, 0x80, 0x50, 0xcb, 0x50, 0x52, 0x51, 0x91, 0x92, 0x31, 0xd2, 0xf7, 0x36, 0x18,
0x7c, 0x91, 0xf7, 0x36, 0x18, 0x7c, 0x42, 0x87, 0xca, 0xf7, 0x36, 0x1a, 0x7c, 0x88, 0xd6, 0x8a,
0x16, 0x24, 0x7c, 0x88, 0xc5, 0xd0, 0xcc, 0xd0, 0xcc, 0x08, 0xe1, 0xb8, 0x01, 0x02, 0xcd, 0x13,
0x59, 0x5a, 0x58, 0x72, 0x10, 0x40, 0x75, 0x01, 0x42, 0x53, 0x8c, 0xc3, 0x81, 0xc3, 0x20, 0x00,
0x8e, 0xc3, 0x5b, 0xe2, 0xc1, 0xc3, 0xbe, 0x96, 0x7d, 0xe8, 0x1b, 0x00, 0xbe, 0xbb, 0x7d, 0xe8,
0x15, 0x00, 0xe9, 0x0c, 0x00, 0xbe, 0xa3, 0x7d, 0xe8, 0x0c, 0x00, 0xbe, 0xbb, 0x7d, 0xe8, 0x06,
0x00, 0x31, 0xc0, 0xcd, 0x16, 0xcd, 0x19, 0xac, 0x08, 0xc0, 0x74, 0x09, 0xb4, 0x0e, 0xbb, 0x07,
0x00, 0xcd, 0x10, 0xeb, 0xf2, 0xc3, 0x44, 0x69, 0x73, 0x6b, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72,
0x0d, 0x0a, 0x00, 0x46, 0x52, 0x45, 0x45, 0x4c, 0x44, 0x52, 0x2e, 0x53, 0x59, 0x53, 0x20, 0x6e,
0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x0d, 0x0a, 0x00, 0x50, 0x72, 0x65, 0x73, 0x73,
0x20, 0x61, 0x6e, 0x79, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x74,
0x69, 0x6e, 0x75, 0x65, 0x2e, 0x0d, 0x0a, 0x00, 0x46, 0x52, 0x45, 0x45, 0x4c, 0x44, 0x52, 0x20,
0x53, 0x59, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa
};

View File

@@ -0,0 +1,67 @@
unsigned char data[] = {
0xeb, 0x58, 0x90, 0x46, 0x72, 0x65, 0x65, 0x4c, 0x44, 0x52, 0x21, 0x00, 0x02, 0x01, 0x01, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x12, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x46, 0x72, 0x65, 0x65, 0x4c, 0x6f, 0x61, 0x64, 0x65,
0x72, 0x21, 0x46, 0x41, 0x54, 0x33, 0x32, 0x20, 0x20, 0x20, 0xfa, 0xfc, 0x31, 0xc0, 0x8e, 0xd0,
0xbc, 0x00, 0x7c, 0x8c, 0xc8, 0x8e, 0xd8, 0x8e, 0xc0, 0xfb, 0x88, 0x16, 0x40, 0x7c, 0x31, 0xc0,
0xcd, 0x13, 0x73, 0x03, 0xe9, 0x05, 0x01, 0x31, 0xd2, 0xb8, 0x0e, 0x00, 0x03, 0x06, 0x1c, 0x7c,
0x13, 0x16, 0x1e, 0x7c, 0xb9, 0x01, 0x00, 0xbb, 0xe0, 0x07, 0x8e, 0xc3, 0x31, 0xdb, 0xe8, 0xab,
0x00, 0x73, 0x03, 0xe9, 0xe6, 0x00, 0x66, 0xa1, 0x2c, 0x7c, 0x66, 0x3d, 0xf8, 0xff, 0xff, 0x0f,
0x72, 0x03, 0xe9, 0xe6, 0x00, 0xbb, 0x00, 0x08, 0x8e, 0xc3, 0xe8, 0xb2, 0x01, 0x31, 0xdb, 0x8a,
0x1e, 0x0d, 0x7c, 0xc1, 0xe3, 0x04, 0xb8, 0x00, 0x08, 0x8e, 0xc0, 0x31, 0xff, 0xbe, 0xee, 0x7d,
0xb9, 0x0b, 0x00, 0xf3, 0xa6, 0x74, 0x2a, 0x4b, 0x75, 0x03, 0xe9, 0xbe, 0x00, 0x8c, 0xc0, 0x05,
0x02, 0x00, 0x8e, 0xc0, 0x31, 0xff, 0xbe, 0xee, 0x7d, 0xb9, 0x0b, 0x00, 0xf3, 0xa6, 0x74, 0x11,
0x4b, 0x75, 0xea, 0x66, 0xa1, 0x2c, 0x7c, 0xe8, 0x16, 0x01, 0x66, 0xa3, 0x2c, 0x7c, 0xe9, 0xa5,
0xff, 0x31, 0xff, 0x31, 0xd2, 0x26, 0x8b, 0x45, 0x14, 0x66, 0xc1, 0xe0, 0x10, 0x26, 0x8b, 0x45,
0x1a, 0xbb, 0x00, 0x08, 0x8e, 0xc3, 0x66, 0x3d, 0xf8, 0xff, 0xff, 0x0f, 0x73, 0x22, 0x66, 0x50,
0x31, 0xdb, 0x06, 0xe8, 0x49, 0x01, 0x07, 0x31, 0xdb, 0x8a, 0x1e, 0x0d, 0x7c, 0xc1, 0xe3, 0x05,
0x8c, 0xc0, 0x01, 0xd8, 0x8e, 0xc0, 0x66, 0x58, 0x06, 0xe8, 0xd4, 0x00, 0x07, 0xe9, 0xd6, 0xff,
0x8a, 0x16, 0x40, 0x7c, 0x31, 0xc0, 0x50, 0xb8, 0x00, 0x80, 0x50, 0xcb, 0x50, 0x52, 0x51, 0x91,
0x92, 0x31, 0xd2, 0xf7, 0x36, 0x18, 0x7c, 0x91, 0xf7, 0x36, 0x18, 0x7c, 0x42, 0x87, 0xca, 0xf7,
0x36, 0x1a, 0x7c, 0x88, 0xd6, 0x8a, 0x16, 0x40, 0x7c, 0x88, 0xc5, 0xd0, 0xcc, 0xd0, 0xcc, 0x08,
0xe1, 0xb8, 0x01, 0x02, 0xcd, 0x13, 0x59, 0x5a, 0x58, 0x72, 0x10, 0x40, 0x75, 0x01, 0x42, 0x53,
0x8c, 0xc3, 0x81, 0xc3, 0x20, 0x00, 0x8e, 0xc3, 0x5b, 0xe2, 0xc1, 0xc3, 0xbe, 0xac, 0x7d, 0xe8,
0x1b, 0x00, 0xbe, 0xd1, 0x7d, 0xe8, 0x15, 0x00, 0xe9, 0x0c, 0x00, 0xbe, 0xb9, 0x7d, 0xe8, 0x0c,
0x00, 0xbe, 0xd1, 0x7d, 0xe8, 0x06, 0x00, 0x31, 0xc0, 0xcd, 0x16, 0xcd, 0x19, 0xac, 0x08, 0xc0,
0x74, 0x09, 0xb4, 0x0e, 0xbb, 0x07, 0x00, 0xcd, 0x10, 0xeb, 0xf2, 0xc3, 0x44, 0x69, 0x73, 0x6b,
0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x0d, 0x0a, 0x00, 0x46, 0x52, 0x45, 0x45, 0x4c, 0x44, 0x52,
0x2e, 0x53, 0x59, 0x53, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x0d, 0x0a,
0x00, 0x50, 0x72, 0x65, 0x73, 0x73, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x6b, 0x65, 0x79, 0x20, 0x74,
0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x2e, 0x0d, 0x0a, 0x00, 0x46, 0x52,
0x45, 0x45, 0x4c, 0x44, 0x52, 0x20, 0x53, 0x59, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa,
0x66, 0xc1, 0xe0, 0x02, 0x66, 0x89, 0xc1, 0x66, 0x31, 0xd2, 0x66, 0x0f, 0xb7, 0x1e, 0x0b, 0x7c,
0x66, 0x53, 0x66, 0xf7, 0xf3, 0x66, 0x0f, 0xb7, 0x1e, 0x0e, 0x7c, 0x66, 0x01, 0xd8, 0x66, 0x0f,
0xb7, 0x1e, 0x1c, 0x7c, 0x66, 0x01, 0xd8, 0x66, 0x5b, 0x66, 0x4b, 0x66, 0x21, 0xd9, 0x66, 0x51,
0x66, 0xc1, 0xc8, 0x10, 0x89, 0xc2, 0x66, 0xc1, 0xc8, 0x10, 0xbb, 0x00, 0x70, 0x8e, 0xc3, 0x31,
0xdb, 0xb9, 0x01, 0x00, 0xe8, 0xf5, 0xfe, 0x73, 0x03, 0xe9, 0x30, 0xff, 0xbb, 0x00, 0x70, 0x8e,
0xc3, 0x66, 0x59, 0x26, 0x66, 0x67, 0x8b, 0x01, 0x66, 0x25, 0xff, 0xff, 0xff, 0x0f, 0xc3, 0x66,
0x48, 0x66, 0x48, 0x66, 0x31, 0xd2, 0x66, 0x0f, 0xb6, 0x1e, 0x0d, 0x7c, 0x66, 0xf7, 0xe3, 0x66,
0x50, 0x66, 0x31, 0xd2, 0x66, 0x0f, 0xb6, 0x06, 0x10, 0x7c, 0x66, 0xf7, 0x26, 0x24, 0x7c, 0x66,
0x0f, 0xb7, 0x1e, 0x0e, 0x7c, 0x66, 0x01, 0xd8, 0x66, 0x03, 0x06, 0x1c, 0x7c, 0x66, 0x5b, 0x66,
0x01, 0xd8, 0x66, 0xc1, 0xc8, 0x10, 0x89, 0xc2, 0x66, 0xc1, 0xc8, 0x10, 0x31, 0xdb, 0x0f, 0xb6,
0x0e, 0x0d, 0x7c, 0xe8, 0x96, 0xfe, 0x73, 0x03, 0xe9, 0xd1, 0xfe, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa
};

49
freeldr/bootsect/c_data.c Normal file
View File

@@ -0,0 +1,49 @@
#include <stdio.h>
char in_filename[260];
char out_filename[260];
FILE *in;
FILE *out;
int main(void)
{
unsigned char ch;
int cnt = 0;
printf("Enter data filename: ");
scanf("%s", in_filename);
printf("Enter output filename: ");
scanf("%s", out_filename);
if ((in = fopen(in_filename, "rb")) == NULL)
{
printf("Couldn't open data file.\n");
return 0;
}
if ((out = fopen(out_filename, "wb")) == NULL)
{
printf("Couldn't open output file.\n");
return 0;
}
fprintf(out, "unsigned char data[] = {\n");
ch = fgetc(in);
while (!feof(in))
{
if (cnt != 0)
fprintf(out, ", ");
if (!(cnt % 16))
fprintf(out, "\n");
fprintf(out, "0x%02x", (int)ch);
cnt++;
ch = fgetc(in);
}
fprintf(out, "\n};");
fclose(in);
fclose(out);
return 0;
}

View File

@@ -0,0 +1 @@
debug bootsect.bin < install.src

View File

@@ -0,0 +1,2 @@
w 100 0 0 1
q

View File

@@ -0,0 +1,197 @@
00008000 660FB64610 movzx eax,byte [bp+NumberOfFats]
00008005 668B4E24 mov ecx,[bp+SectorsPerFatBig]
00008009 66F7E1 mul ecx
0000800C 6603461C add eax,[bp+HiddenSectors]
00008010 660FB7560E movzx edx,word [bp+ReservedSectors]
00008015 6603C2 add eax,edx
00008018 668946FC mov [bp-0x4],eax
0000801C 66C746F4FFFFFFFF mov dword [bp-0xc],0xffffffff
00008024 668B462C mov eax,[bp+RootDirStartCluster]
00008028 6683F802 cmp eax,byte +0x2
0000802C 0F82A6FC jc near 0x7cd6
00008030 663DF8FFFF0F cmp eax,0xffffff8
00008036 0F839CFC jnc near 0x7cd6
0000803A 6650 push eax
0000803C 6683E802 sub eax,byte +0x2
00008040 660FB65E0D movzx ebx,byte [bp+SectsPerCluster]
00008045 8BF3 mov si,bx
00008047 66F7E3 mul ebx
0000804A 660346FC add eax,[bp-0x4]
0000804E BB0082 mov bx,0x8200
00008051 8BFB mov di,bx
00008053 B90100 mov cx,0x1
00008056 E887FC call 0x7ce0
00008059 382D cmp [di],ch
0000805B 741E jz 0x807b
0000805D B10B mov cl,0xb
0000805F 56 push si
00008060 BE707D mov si,0x7d70
00008063 F3A6 repe cmpsb
00008065 5E pop si
00008066 741B jz 0x8083
00008068 03F9 add di,cx
0000806A 83C715 add di,byte +0x15
0000806D 3BFB cmp di,bx
0000806F 72E8 jc 0x8059
00008071 4E dec si
00008072 75DA jnz 0x804e
00008074 6658 pop eax
00008076 E86500 call 0x80de
00008079 72BF jc 0x803a
0000807B 83C404 add sp,byte +0x4
0000807E E955FC jmp 0x7cd6
00008081 0020 add [bx+si],ah
00008083 83C404 add sp,byte +0x4
00008086 8B7509 mov si,[di+0x9]
00008089 8B7D0F mov di,[di+0xf]
0000808C 8BC6 mov ax,si
0000808E 66C1E010 shl eax,0x10
00008092 8BC7 mov ax,di
00008094 6683F802 cmp eax,byte +0x2
00008098 0F823AFC jc near 0x7cd6
0000809C 663DF8FFFF0F cmp eax,0xffffff8
000080A2 0F8330FC jnc near 0x7cd6
000080A6 6650 push eax
000080A8 6683E802 sub eax,byte +0x2
000080AC 660FB64E0D movzx ecx,byte [bp+0xd]
000080B1 66F7E1 mul ecx
000080B4 660346FC add eax,[bp-0x4]
000080B8 BB0000 mov bx,0x0
000080BB 06 push es
000080BC 8E068180 mov es,[0x8081]
000080C0 E81DFC call 0x7ce0
000080C3 07 pop es
000080C4 6658 pop eax
000080C6 C1EB04 shr bx,0x4
000080C9 011E8180 add [0x8081],bx
000080CD E80E00 call 0x80de
000080D0 0F830200 jnc near 0x80d6
000080D4 72D0 jc 0x80a6
000080D6 8A5640 mov dl,[bp+0x40]
000080D9 EA00000020 jmp 0x2000:0x0
000080DE 66C1E002 shl eax,0x2
000080E2 E81100 call 0x80f6
000080E5 26668B01 mov eax,[es:bx+di]
000080E9 6625FFFFFF0F and eax,0xfffffff
000080EF 663DF8FFFF0F cmp eax,0xffffff8
000080F5 C3 ret
000080F6 BF007E mov di,0x7e00
000080F9 660FB74E0B movzx ecx,word [bp+0xb]
000080FE 6633D2 xor edx,edx
00008101 66F7F1 div ecx
00008104 663B46F4 cmp eax,[bp-0xc]
00008108 743A jz 0x8144
0000810A 668946F4 mov [bp-0xc],eax
0000810E 6603461C add eax,[bp+0x1c]
00008112 660FB74E0E movzx ecx,word [bp+0xe]
00008117 6603C1 add eax,ecx
0000811A 660FB75E28 movzx ebx,word [bp+0x28]
0000811F 83E30F and bx,byte +0xf
00008122 7416 jz 0x813a
00008124 3A5E10 cmp bl,[bp+0x10]
00008127 0F83ABFB jnc near 0x7cd6
0000812B 52 push dx
0000812C 668BC8 mov ecx,eax
0000812F 668B4624 mov eax,[bp+0x24]
00008133 66F7E3 mul ebx
00008136 6603C1 add eax,ecx
00008139 5A pop dx
0000813A 52 push dx
0000813B 8BDF mov bx,di
0000813D B90100 mov cx,0x1
00008140 E89DFB call 0x7ce0
00008143 5A pop dx
00008144 8BDA mov bx,dx
00008146 C3 ret
00008147 0000 add [bx+si],al
00008149 0000 add [bx+si],al
0000814B 0000 add [bx+si],al
0000814D 0000 add [bx+si],al
0000814F 0000 add [bx+si],al
00008151 0000 add [bx+si],al
00008153 0000 add [bx+si],al
00008155 0000 add [bx+si],al
00008157 0000 add [bx+si],al
00008159 0000 add [bx+si],al
0000815B 0000 add [bx+si],al
0000815D 0000 add [bx+si],al
0000815F 0000 add [bx+si],al
00008161 0000 add [bx+si],al
00008163 0000 add [bx+si],al
00008165 0000 add [bx+si],al
00008167 0000 add [bx+si],al
00008169 0000 add [bx+si],al
0000816B 0000 add [bx+si],al
0000816D 0000 add [bx+si],al
0000816F 0000 add [bx+si],al
00008171 0000 add [bx+si],al
00008173 0000 add [bx+si],al
00008175 0000 add [bx+si],al
00008177 0000 add [bx+si],al
00008179 0000 add [bx+si],al
0000817B 0000 add [bx+si],al
0000817D 0000 add [bx+si],al
0000817F 0000 add [bx+si],al
00008181 0000 add [bx+si],al
00008183 0000 add [bx+si],al
00008185 0000 add [bx+si],al
00008187 0000 add [bx+si],al
00008189 0000 add [bx+si],al
0000818B 0000 add [bx+si],al
0000818D 0000 add [bx+si],al
0000818F 0000 add [bx+si],al
00008191 0000 add [bx+si],al
00008193 0000 add [bx+si],al
00008195 0000 add [bx+si],al
00008197 0000 add [bx+si],al
00008199 0000 add [bx+si],al
0000819B 0000 add [bx+si],al
0000819D 0000 add [bx+si],al
0000819F 0000 add [bx+si],al
000081A1 0000 add [bx+si],al
000081A3 0000 add [bx+si],al
000081A5 0000 add [bx+si],al
000081A7 0000 add [bx+si],al
000081A9 0000 add [bx+si],al
000081AB 0000 add [bx+si],al
000081AD 0000 add [bx+si],al
000081AF 0000 add [bx+si],al
000081B1 0000 add [bx+si],al
000081B3 0000 add [bx+si],al
000081B5 0000 add [bx+si],al
000081B7 0000 add [bx+si],al
000081B9 0000 add [bx+si],al
000081BB 0000 add [bx+si],al
000081BD 0000 add [bx+si],al
000081BF 0000 add [bx+si],al
000081C1 0000 add [bx+si],al
000081C3 0000 add [bx+si],al
000081C5 0000 add [bx+si],al
000081C7 0000 add [bx+si],al
000081C9 0000 add [bx+si],al
000081CB 0000 add [bx+si],al
000081CD 0000 add [bx+si],al
000081CF 0000 add [bx+si],al
000081D1 0000 add [bx+si],al
000081D3 0000 add [bx+si],al
000081D5 0000 add [bx+si],al
000081D7 0000 add [bx+si],al
000081D9 0000 add [bx+si],al
000081DB 0000 add [bx+si],al
000081DD 0000 add [bx+si],al
000081DF 0000 add [bx+si],al
000081E1 0000 add [bx+si],al
000081E3 0000 add [bx+si],al
000081E5 0000 add [bx+si],al
000081E7 0000 add [bx+si],al
000081E9 0000 add [bx+si],al
000081EB 0000 add [bx+si],al
000081ED 0000 add [bx+si],al
000081EF 0000 add [bx+si],al
000081F1 0000 add [bx+si],al
000081F3 0000 add [bx+si],al
000081F5 0000 add [bx+si],al
000081F7 0000 add [bx+si],al
000081F9 0000 add [bx+si],al
000081FB 0000 add [bx+si],al
000081FD 0055AA add [di-0x56],dl

174
freeldr/bootsect/win2k.asm Normal file
View File

@@ -0,0 +1,174 @@
segment .text
bits 16
start:
jmp short main
nop
OEMName db 'FreeLDR!'
BytesPerSector dw 512
SectsPerCluster db 1
ReservedSectors dw 1
NumberOfFats db 2
MaxRootEntries dw 0 ;512 - Always zero for FAT32 volumes
TotalSectors dw 0 ;2880 - Always zero for FAT32 volumes
MediaDescriptor db 0f8h
SectorsPerFat dw 0 ;9 - Always zero for FAT32 volumes
SectorsPerTrack dw 18
NumberOfHeads dw 2
HiddenSectors dd 0
TotalSectorsBig dd 0
; FAT32 Inserted Info
SectorsPerFatBig dd 0
ExtendedFlags dw 0
FSVersion dw 0
RootDirStartCluster dd 0
FSInfoSector dw 0
BackupBootSector dw 6
Reserved1 times 12 db 0
; End FAT32 Inserted Info
BootDrive db 0
Reserved db 0
ExtendSig db 29h
SerialNumber dd 00000000h
VolumeLabel db 'FreeLoader!'
FileSystem db 'FAT12 '
main:
00007C5A 33C9 xor cx,cx
00007C5C 8ED1 mov ss,cx
00007C5E BCF47B mov sp,0x7bf4
00007C61 8EC1 mov es,cx
00007C63 8ED9 mov ds,cx
00007C65 BD007C mov bp,0x7c00
00007C68 884E02 mov [bp+0x2],cl
00007C6B 8A5640 mov dl,[bp+BootDrive]
00007C6E B408 mov ah,0x8
00007C70 CD13 int 0x13 ; Int 13, func 8 - Get Drive Parameters
00007C72 7305 jnc 0x7c79 ; If no error jmp
00007C74 B9FFFF mov cx,0xffff
00007C77 8AF1 mov dh,cl
00007C79 660FB6C6 movzx eax,dh
00007C7D 40 inc ax
00007C7E 660FB6D1 movzx edx,cl
00007C82 80E23F and dl,0x3f
00007C85 F7E2 mul dx
00007C87 86CD xchg cl,ch
00007C89 C0ED06 shr ch,0x6
00007C8C 41 inc cx
00007C8D 660FB7C9 movzx ecx,cx
00007C91 66F7E1 mul ecx
00007C94 668946F8 mov [bp-0x8],eax
00007C98 837E1600 cmp word [bp+TotalSectors],byte +0x0
00007C9C 7538 jnz print_ntldr_error_message
00007C9E 837E2A00 cmp word [bp+FSVersion],byte +0x0
00007CA2 7732 ja print_ntldr_error_message
00007CA4 668B461C mov eax,[bp+0x1c]
00007CA8 6683C00C add eax,byte +0xc
00007CAC BB0080 mov bx,0x8000
00007CAF B90100 mov cx,0x1
00007CB2 E82B00 call read_sectors
00007CB5 E94803 jmp 0x8000
print_disk_error_message:
00007CB8 A0FA7D mov al,[DISK_ERR_offset_from_0x7d00]
putchars:
00007CBB B47D mov ah,0x7d
00007CBD 8BF0 mov si,ax
get_another_char:
00007CBF AC lodsb
00007CC0 84C0 test al,al
00007CC2 7417 jz reboot
00007CC4 3CFF cmp al,0xff
00007CC6 7409 jz print_reboot_message
00007CC8 B40E mov ah,0xe
00007CCA BB0700 mov bx,0x7
00007CCD CD10 int 0x10
00007CCF EBEE jmp short get_another_char
print_reboot_message:
00007CD1 A0FB7D mov al,[RESTART_ERR_offset_from_0x7d00]
00007CD4 EBE5 jmp short putchars
print_ntldr_error_message:
00007CD6 A0F97D mov al,[NTLDR_ERR_offset_from_0x7d00]
00007CD9 EBE0 jmp short putchars
reboot:
00007CDB 98 cbw
00007CDC CD16 int 0x16
00007CDE CD19 int 0x19
read_sectors:
00007CE0 6660 pushad
00007CE2 663B46F8 cmp eax,[bp-0x8]
00007CE6 0F824A00 jc near 0x7d34
00007CEA 666A00 o32 push byte +0x0
00007CED 6650 push eax
00007CEF 06 push es
00007CF0 53 push bx
00007CF1 666810000100 push dword 0x10010
00007CF7 807E0200 cmp byte [bp+0x2],0x0
00007CFB 0F852000 jnz near 0x7d1f
00007CFF B441 mov ah,0x41
00007D01 BBAA55 mov bx,0x55aa
00007D04 8A5640 mov dl,[bp+BootDrive]
00007D07 CD13 int 0x13
00007D09 0F821C00 jc near 0x7d29
00007D0D 81FB55AA cmp bx,0xaa55
00007D11 0F851400 jnz near 0x7d29
00007D15 F6C101 test cl,0x1
00007D18 0F840D00 jz near 0x7d29
00007D1C FE4602 inc byte [bp+0x2]
00007D1F B442 mov ah,0x42
00007D21 8A5640 mov dl,[bp+BootDrive]
00007D24 8BF4 mov si,sp
00007D26 CD13 int 0x13
00007D28 B0F9 mov al,0xf9
00007D2A 6658 pop eax
00007D2C 6658 pop eax
00007D2E 6658 pop eax
00007D30 6658 pop eax
00007D32 EB2A jmp short 0x7d5e
00007D34 6633D2 xor edx,edx
00007D37 660FB74E18 movzx ecx,word [bp+SectorsPerTrack]
00007D3C 66F7F1 div ecx
00007D3F FEC2 inc dl
00007D41 8ACA mov cl,dl
00007D43 668BD0 mov edx,eax
00007D46 66C1EA10 shr edx,0x10
00007D4A F7761A div word [bp+NumberOfHeads]
00007D4D 86D6 xchg dl,dh
00007D4F 8A5640 mov dl,[bp+BootDrive]
00007D52 8AE8 mov ch,al
00007D54 C0E406 shl ah,0x6
00007D57 0ACC or cl,ah
00007D59 B80102 mov ax,0x201
00007D5C CD13 int 0x13
00007D5E 6661 popad
00007D60 0F8254FF jc near print_disk_error_message
00007D64 81C30002 add bx,0x200
00007D68 6640 inc eax
00007D6A 49 dec cx
00007D6B 0F8571FF jnz near read_sectors
00007D6F C3 ret
NTLDR db 'NTLDR '
filler times 49 db 0
NTLDR_ERR db 0dh,0ah,'NTLDR is missing',0ffh
DISK_ERR db 0dh,0ah,'Disk error',0ffh
RESTART_ERR db 0dh,0ah,'Press any key to restart',0dh,0ah
more_filler times 16 db 0
NTLDR_offset_from_0x7d00 db 0
NTLDR_ERR_offset_from_0x7d00 db 0ach
DISK_ERR_offset_from_0x7d00 db 0bfh
RESTART_ERR_offset_from_0x7d00 db 0cch
dw 0
dw 0aa55h

7
freeldr/build.bat Normal file
View File

@@ -0,0 +1,7 @@
cd bootsect
call make.bat
cd..
cd freeldr
make
copy freeldr.sys ..
cd ..

89
freeldr/freeldr/Makefile Normal file
View File

@@ -0,0 +1,89 @@
#
# FreeLoader
# Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
export CC = gcc
export LD = ld
export AR = ar
export RM = cmd /C del
export CP = cmd /C copy
FLAGS = -Wall -nostdinc -fno-builtin
# asmcode.o has to be first in the link line because it contains the startup code
OBJS = asmcode.a asmcode.o ros.o boot.o freeldr.o stdlib.o fs.a fs.o fs_fat.o \
rosboot.o tui.o menu.o miscboot.o options.o linux.o
ASM_OBJS = asmcode.o ros.o boot.o
C_OBJS = freeldr.o stdlib.o fs.a rosboot.o tui.o menu.o miscboot.o options.o linux.o
all: freeldr.sys
freeldr.sys: asmcode.a c_code.a
$(LD) -N -Ttext=0x8000 --oformat=binary -o freeldr.sys asmcode.a c_code.a
asmcode.a: $(ASM_OBJS)
$(LD) -r -o asmcode.a $(ASM_OBJS)
c_code.a: $(C_OBJS)
$(LD) -r -o c_code.a $(C_OBJS)
asmcode.o: asmcode.S asmcode.h Makefile
$(CC) $(FLAGS) -o asmcode.o -c asmcode.S
freeldr.o: freeldr.c freeldr.h stdlib.h fs.h rosboot.h tui.h asmcode.h menu.h miscboot.h Makefile
$(CC) $(FLAGS) -o freeldr.o -c freeldr.c
stdlib.o: stdlib.c freeldr.h stdlib.h Makefile
$(CC) $(FLAGS) -o stdlib.o -c stdlib.c
fs.a: fs.o fs_fat.o Makefile
$(LD) -r -o fs.a fs.o fs_fat.o
fs.o: fs.c freeldr.h fs.h stdlib.h tui.h asmcode.h Makefile
$(CC) $(FLAGS) -o fs.o -c fs.c
fs_fat.o: fs_fat.c freeldr.h fs.h stdlib.h tui.h Makefile
$(CC) $(FLAGS) -o fs_fat.o -c fs_fat.c
rosboot.o: rosboot.c freeldr.h rosboot.h stdlib.h fs.h tui.h Makefile
$(CC) $(FLAGS) -o rosboot.o -c rosboot.c
ros.o: ros.S asmcode.h Makefile
$(CC) $(FLAGS) -o ros.o -c ros.S
tui.o: tui.c freeldr.h stdlib.h tui.h Makefile
$(CC) $(FLAGS) -o tui.o -c tui.c
menu.o: menu.c freeldr.h stdlib.h tui.h menu.h Makefile
$(CC) $(FLAGS) -o menu.o -c menu.c
boot.o: boot.S asmcode.h Makefile
$(CC) $(FLAGS) -o boot.o -c boot.S
miscboot.o: miscboot.c freeldr.h asmcode.h stdlib.h fs.h tui.h miscboot.h Makefile
$(CC) $(FLAGS) -o miscboot.o -c miscboot.c
options.o: options.c freeldr.h stdlib.h tui.h options.h Makefile
$(CC) $(FLAGS) -o options.o -c options.c
linux.o: linux.c freeldr.h stdlib.h tui.h linux.h Makefile
$(CC) $(FLAGS) -o linux.o -c linux.c
clean:
$(RM) $(OBJS)

1177
freeldr/freeldr/asmcode.S Normal file

File diff suppressed because it is too large Load Diff

57
freeldr/freeldr/asmcode.h Normal file
View File

@@ -0,0 +1,57 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Defines needed for switching between real and protected mode */
#define NULL_DESC 0x00 /* NULL descriptor */
#define PMODE_CS 0x08 /* PMode code selector, base 0 limit 4g */
#define PMODE_DS 0x10 /* PMode data selector, base 0 limit 4g */
#define RMODE_CS 0x18 /* RMode code selector, base 0 limit 64k */
#define RMODE_DS 0x20 /* RMode data selector, base 0 limit 64k */
#define KERNEL_BASE 0xC0000000
//#define USER_CS 0x08
//#define USER_DS 0x10
//#define KERNEL_CS 0x20
//#define KERNEL_DS 0x28
#define KERNEL_CS 0x08
#define KERNEL_DS 0x10
#define CR0_PE_SET 0x00000001 /* OR this value with CR0 to enable pmode */
#define CR0_PE_CLR 0xFFFFFFFE /* AND this value with CR0 to disable pmode */
#define NR_TASKS 128 /* Space reserved in the GDT for TSS descriptors */
#define STACK16ADDR 0x7000 /* The 16-bit stack top will be at 0000:7000 */
#define STACK32ADDR 0x60000 /* The 32-bit stack top will be at 6000:0000, or 0x60000 */
#define FILESYSADDR 0x80000 /* The filesystem data address will be at 8000:0000, or 0x80000 */
#define FATCLUSTERBUF 0x60000 /* The fat filesystem's cluster buffer */
#define SCREENBUFFER 0x68000 /* The screen contents will be saved here */
#define FREELDRINIADDR 0x6C000 /* The freeldr.ini load address will be at 6000:C000, or 0x6C000 */
#define SCRATCHSEG 0x7000 /* The 512-byte fixed scratch area will be at 7000:0000, or 0x70000 */
#define SCRATCHOFF 0x0000 /* The 512-byte fixed scratch area will be at 7000:0000, or 0x70000 */
#define SCRATCHAREA 0x70000 /* The 512-byte fixed scratch area will be at 7000:0000, or 0x70000 */
/* Makes "x" a global variable or label */
#define EXTERN(x) .global x; x:

45
freeldr/freeldr/boot.S Normal file
View File

@@ -0,0 +1,45 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
.text
.code16
#include "asmcode.h"
.code32
EXTERN(_JumpToBootCode)
call switch_to_real
.code16
/* Set the boot drive */
movb (_BootDrive),%dl
ljmpl $0x0000,$0x7C00
.code32
EXTERN(_JumpToLinuxBootCode)
call switch_to_real
.code16
/* Set the boot drive */
movb (_BootDrive),%dl
ljmpl $0x0200,$0x9000

734
freeldr/freeldr/freeldr.c Normal file
View File

@@ -0,0 +1,734 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "stdlib.h"
#include "fs.h"
#include "rosboot.h"
#include "tui.h"
#include "asmcode.h"
#include "menu.h"
#include "miscboot.h"
#include "linux.h"
// Variable BootDrive moved to asmcode.S
//unsigned int BootDrive = 0; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc.
unsigned int BootPartition = 0; // Boot Partition, 1-4
BOOL bTUILoaded = FALSE; // Tells us if the user interface is loaded
char *pFreeldrIni = (char *)(FREELDRINIADDR); // Load address for freeldr.ini
char *pScreenBuffer = (char *)(SCREENBUFFER); // Save address for screen contents
int nCursorXPos = 0; // Cursor's X Position
int nCursorYPos = 0; // Cursor's Y Position
OSTYPE OSList[16];
int nNumOS = 0;
int nTimeOut = -1; // Time to wait for the user before booting
void BootMain(void)
{
int i;
char name[1024];
char value[1024];
int nOSToBoot;
enable_a20();
SaveScreen(pScreenBuffer);
nCursorXPos = wherex();
nCursorYPos = wherey();
printf("Loading FreeLoader...\n");
if (!ParseIniFile())
{
printf("Press any key to reboot.\n");
getch();
return;
}
clrscr();
hidecursor();
// Draw the backdrop and title box
DrawBackdrop();
bTUILoaded = TRUE;
if (nNumOS == 0)
{
DrawStatusText(" Press ENTER to reboot");
MessageBox("Error: there were no operating systems listed to boot.\nPress ENTER to reboot.");
clrscr();
showcursor();
RestoreScreen(pScreenBuffer);
return;
}
DrawStatusText(" Press ENTER to continue");
// Find all the message box settings and run them
for (i=1; i<=GetNumSectionItems("FREELOADER"); i++)
{
ReadSectionSettingByNumber("FREELOADER", i, name, value);
if (stricmp(name, "MessageBox") == 0)
MessageBox(value);
if (stricmp(name, "MessageLine") == 0)
MessageLine(value);
}
for (;;)
{
nOSToBoot = RunMenu();
LoadAndBootLinux(0x80, 0, "vmlinuz", "");
switch (OSList[nOSToBoot].nOSType)
{
case OSTYPE_REACTOS:
LoadAndBootReactOS(nOSToBoot);
break;
case OSTYPE_LINUX:
MessageBox("Cannot boot this OS type yet!");
break;
case OSTYPE_BOOTSECTOR:
LoadAndBootBootSector(nOSToBoot);
break;
case OSTYPE_PARTITION:
LoadAndBootPartition(nOSToBoot);
break;
case OSTYPE_DRIVE:
LoadAndBootDrive(nOSToBoot);
break;
}
}
MessageBox("Press any key to reboot.");
RestoreScreen(pScreenBuffer);
showcursor();
gotoxy(nCursorXPos, nCursorYPos);
}
BOOL ParseIniFile(void)
{
int i;
char name[1024];
char value[1024];
FILE Freeldr_Ini; // File handle for freeldr.ini
// Open the boot drive for file access
if(!OpenDiskDrive(BootDrive, 0))
{
printf("Error opening boot drive for file access.\n");
return FALSE;
}
// Try to open freeldr.ini or fail
if(!OpenFile("freeldr.ini", &Freeldr_Ini))
{
printf("FREELDR.INI not found.\nYou need to re-install FreeLoader.\n");
return FALSE;
}
// Check and see if freeldr.ini is too big
// if so display a warning
if(GetFileSize(&Freeldr_Ini) > 0x4000)
{
printf("Warning: FREELDR.INI is bigger than 16k.\n");
printf("Only 16k of it will be loaded off the disk.\n");
printf("Press any key to continue.\n");
getch();
}
// Read freeldr.ini off the disk
ReadFile(&Freeldr_Ini, 0x4000, pFreeldrIni);
// Make sure the [FREELOADER] section exists
if(!GetNumSectionItems("FREELOADER"))
{
printf("Section [FREELOADER] not found in FREELDR.INI.\nYou need to re-install FreeLoader.\n");
return FALSE;
}
// Validate the settings in the [FREELOADER] section
for(i=1; i<=GetNumSectionItems("FREELOADER"); i++)
{
ReadSectionSettingByNumber("FREELOADER", i, name, value);
if(!IsValidSetting(name, value))
{
printf("Invalid setting in freeldr.ini.\nName: \"%s\", Value: \"%s\"\n", name, value);
printf("Press any key to continue.\n");
getch();
}
else
SetSetting(name, value);
}
return TRUE;
}
int GetNumSectionItems(char *section)
{
int i;
char str[1024];
char real_section[1024];
int num_items = 0;
int freeldr_ini_offset;
BOOL bFoundSection = FALSE;
// Get the real section name
strcpy(real_section, "[");
strcat(real_section, section);
strcat(real_section, "]");
// Get to the beginning of the file
freeldr_ini_offset = 0;
// Find the section
while(freeldr_ini_offset < 0x4000)
{
// Read a line
for(i=0; i<1024; i++,freeldr_ini_offset++)
{
if((freeldr_ini_offset < 0x4000) && (pFreeldrIni[freeldr_ini_offset] != '\n'))
str[i] = pFreeldrIni[freeldr_ini_offset];
else
{
freeldr_ini_offset++;
break;
}
}
str[i] = '\0';
//fgets(str, 1024, &Freeldr_Ini);
// Get rid of newline & linefeed characters (if any)
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
// Skip comments
if(str[0] == '#')
continue;
// Skip blank lines
if(!strlen(str))
continue;
// If it isn't a section header then continue on
if(str[0] != '[')
continue;
// Check and see if we found it
if(stricmp(str, real_section) == 0)
{
bFoundSection = TRUE;
break;
}
}
// If we didn't find the section then we're outta here
if(!bFoundSection)
return 0;
// Now count how many settings are in this section
while(freeldr_ini_offset < 0x4000)
{
// Read a line
for(i=0; i<1024; i++,freeldr_ini_offset++)
{
if((freeldr_ini_offset < 0x4000) && (pFreeldrIni[freeldr_ini_offset] != '\n'))
str[i] = pFreeldrIni[freeldr_ini_offset];
else
{
freeldr_ini_offset++;
break;
}
}
str[i] = '\0';
//fgets(str, 1024, &Freeldr_Ini);
// Get rid of newline & linefeed characters (if any)
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
// Skip comments
if(str[0] == '#')
continue;
// Skip blank lines
if(!strlen(str))
continue;
// If we hit a new section then we're done
if(str[0] == '[')
break;
num_items++;
}
return num_items;
}
BOOL ReadSectionSettingByNumber(char *section, int num, char *name, char *value)
{
char str[1024];
char real_section[1024];
int num_items = 0;
int i;
int freeldr_ini_offset;
BOOL bFoundSection = FALSE;
// Get the real section name
strcpy(real_section, "[");
strcat(real_section, section);
strcat(real_section, "]");
// Get to the beginning of the file
freeldr_ini_offset = 0;
// Find the section
while(freeldr_ini_offset < 0x4000)
{
// Read a line
for(i=0; i<1024; i++,freeldr_ini_offset++)
{
if((freeldr_ini_offset < 0x4000) && (pFreeldrIni[freeldr_ini_offset] != '\n'))
str[i] = pFreeldrIni[freeldr_ini_offset];
else
{
freeldr_ini_offset++;
break;
}
}
str[i] = '\0';
//fgets(str, 1024, &Freeldr_Ini);
// Get rid of newline & linefeed characters (if any)
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
// Skip comments
if(str[0] == '#')
continue;
// Skip blank lines
if(!strlen(str))
continue;
// If it isn't a section header then continue on
if(str[0] != '[')
continue;
// Check and see if we found it
if(stricmp(str, real_section) == 0)
{
bFoundSection = TRUE;
break;
}
}
// If we didn't find the section then we're outta here
if(!bFoundSection)
return FALSE;
// Now find the setting we are looking for
while(freeldr_ini_offset < 0x4000)
{
// Read a line
for(i=0; i<1024; i++,freeldr_ini_offset++)
{
if((freeldr_ini_offset < 0x4000) && (pFreeldrIni[freeldr_ini_offset] != '\n'))
str[i] = pFreeldrIni[freeldr_ini_offset];
else
{
freeldr_ini_offset++;
break;
}
}
str[i] = '\0';
//fgets(str, 1024, &Freeldr_Ini);
// Get rid of newline & linefeed characters (if any)
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
// Skip comments
if(str[0] == '#')
continue;
// Skip blank lines
if(!strlen(str))
continue;
// If we hit a new section then we're done
if(str[0] == '[')
break;
// Increment setting number
num_items++;
// Check and see if we found the setting
if(num_items == num)
{
for(i=0; i<strlen(str); i++)
{
// Check and see if this character is the separator
if(str[i] == '=')
{
name[i] = '\0';
strcpy(value, str+i+1);
return TRUE;
}
else
name[i] = str[i];
}
}
}
return FALSE;
}
BOOL ReadSectionSettingByName(char *section, char *valuename, char *name, char *value)
{
char str[1024];
char real_section[1024];
char temp[1024];
int i;
int freeldr_ini_offset;
BOOL bFoundSection = FALSE;
// Get the real section name
strcpy(real_section, "[");
strcat(real_section, section);
strcat(real_section, "]");
// Get to the beginning of the file
freeldr_ini_offset = 0;
// Find the section
while(freeldr_ini_offset < 0x4000)
{
// Read a line
for(i=0; i<1024; i++,freeldr_ini_offset++)
{
if((freeldr_ini_offset < 0x4000) && (pFreeldrIni[freeldr_ini_offset] != '\n'))
str[i] = pFreeldrIni[freeldr_ini_offset];
else
{
freeldr_ini_offset++;
break;
}
}
str[i] = '\0';
//fgets(str, 1024, &Freeldr_Ini);
// Get rid of newline & linefeed characters (if any)
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
// Skip comments
if(str[0] == '#')
continue;
// Skip blank lines
if(!strlen(str))
continue;
// If it isn't a section header then continue on
if(str[0] != '[')
continue;
// Check and see if we found it
if(stricmp(str, real_section) == 0)
{
bFoundSection = TRUE;
break;
}
}
// If we didn't find the section then we're outta here
if(!bFoundSection)
return FALSE;
// Now find the setting we are looking for
while(freeldr_ini_offset < 0x4000)
{
// Read a line
for(i=0; i<1024; i++,freeldr_ini_offset++)
{
if((freeldr_ini_offset < 0x4000) && (pFreeldrIni[freeldr_ini_offset] != '\n'))
str[i] = pFreeldrIni[freeldr_ini_offset];
else
{
freeldr_ini_offset++;
break;
}
}
str[i] = '\0';
//fgets(str, 1024, &Freeldr_Ini);
// Get rid of newline & linefeed characters (if any)
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
if((str[strlen(str)-1] == '\n') || (str[strlen(str)-1] == '\r'))
str[strlen(str)-1] = '\0';
// Skip comments
if(str[0] == '#')
continue;
// Skip blank lines
if(!strlen(str))
continue;
// If we hit a new section then we're done
if(str[0] == '[')
break;
// Extract the setting name
for(i=0; i<strlen(str); i++)
{
if(str[i] != '=')
temp[i] = str[i];
else
{
temp[i] = '\0';
break;
}
}
// Check and see if we found the setting
if(stricmp(temp, valuename) == 0)
{
for(i=0; i<strlen(str); i++)
{
// Check and see if this character is the separator
if(str[i] == '=')
{
name[i] = '\0';
strcpy(value, str+i+1);
return TRUE;
}
else
name[i] = str[i];
}
}
}
return FALSE;
}
BOOL IsValidSetting(char *setting, char *value)
{
if(stricmp(setting, "MessageBox") == 0)
return TRUE;
else if(stricmp(setting, "MessageLine") == 0)
return TRUE;
else if(stricmp(setting, "TitleText") == 0)
return TRUE;
else if(stricmp(setting, "StatusBarColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "StatusBarTextColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "BackdropTextColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "BackdropColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "BackdropFillStyle") == 0)
{
if(IsValidFillStyle(value))
return TRUE;
}
else if(stricmp(setting, "TitleBoxTextColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "TitleBoxColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "MessageBoxTextColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "MessageBoxColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "MenuTextColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "MenuColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "TextColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "SelectedTextColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "SelectedColor") == 0)
{
if(IsValidColor(value))
return TRUE;
}
else if(stricmp(setting, "OS") == 0)
return TRUE;
else if(stricmp(setting, "TimeOut") == 0)
return TRUE;
/*else if(stricmp(setting, "") == 0)
return TRUE;
else if(stricmp(setting, "") == 0)
return TRUE;
else if(stricmp(setting, "") == 0)
return TRUE;
else if(stricmp(setting, "") == 0)
return TRUE;
else if(stricmp(setting, "") == 0)
return TRUE;
else if(stricmp(setting, "") == 0)
return TRUE;
else if(stricmp(setting, "") == 0)
return TRUE;*/
return FALSE;
}
void SetSetting(char *setting, char *value)
{
char name[260];
char v[260];
if(stricmp(setting, "TitleText") == 0)
strcpy(szTitleBoxTitleText, value);
else if(stricmp(setting, "StatusBarColor") == 0)
cStatusBarBgColor = TextToColor(value);
else if(stricmp(setting, "StatusBarTextColor") == 0)
cStatusBarFgColor = TextToColor(value);
else if(stricmp(setting, "BackdropTextColor") == 0)
cBackdropFgColor = TextToColor(value);
else if(stricmp(setting, "BackdropColor") == 0)
cBackdropBgColor = TextToColor(value);
else if(stricmp(setting, "BackdropFillStyle") == 0)
cBackdropFillStyle = TextToFillStyle(value);
else if(stricmp(setting, "TitleBoxTextColor") == 0)
cTitleBoxFgColor = TextToColor(value);
else if(stricmp(setting, "TitleBoxColor") == 0)
cTitleBoxBgColor = TextToColor(value);
else if(stricmp(setting, "MessageBoxTextColor") == 0)
cMessageBoxFgColor = TextToColor(value);
else if(stricmp(setting, "MessageBoxColor") == 0)
cMessageBoxBgColor = TextToColor(value);
else if(stricmp(setting, "MenuTextColor") == 0)
cMenuFgColor = TextToColor(value);
else if(stricmp(setting, "MenuColor") == 0)
cMenuBgColor = TextToColor(value);
else if(stricmp(setting, "TextColor") == 0)
cTextColor = TextToColor(value);
else if(stricmp(setting, "SelectedTextColor") == 0)
cSelectedTextColor = TextToColor(value);
else if(stricmp(setting, "SelectedColor") == 0)
cSelectedTextBgColor = TextToColor(value);
else if(stricmp(setting, "OS") == 0)
{
if(nNumOS >= 16)
{
printf("Error: you can only boot to at most 16 different operating systems.\n");
printf("Press any key to continue\n");
getch();
return;
}
if(!GetNumSectionItems(value))
{
printf("Error: OS \"%s\" listed.\n", value);
printf("It does not have it's own [section], or it is empty.\n");
printf("Press any key to continue\n");
getch();
return;
}
strcpy(OSList[nNumOS].name, value);
if (!ReadSectionSettingByName(value, "BootType", name, v))
{
printf("Unknown BootType for OS \"%s\"\n", value);
printf("Press any key to continue\n");
getch();
return;
}
if (stricmp(v, "ReactOS") == 0)
OSList[nNumOS].nOSType = OSTYPE_REACTOS;
else if (stricmp(v, "Linux") == 0)
OSList[nNumOS].nOSType = OSTYPE_LINUX;
else if (stricmp(v, "BootSector") == 0)
OSList[nNumOS].nOSType = OSTYPE_BOOTSECTOR;
else if (stricmp(v, "Partition") == 0)
OSList[nNumOS].nOSType = OSTYPE_PARTITION;
else if (stricmp(v, "Drive") == 0)
OSList[nNumOS].nOSType = OSTYPE_DRIVE;
else
{
printf("Unknown BootType for OS \"%s\"\n", value);
printf("Press any key to continue\n");
getch();
return;
}
nNumOS++;
}
else if(stricmp(setting, "TimeOut") == 0)
nTimeOut = atoi(value);
}

82
freeldr/freeldr/freeldr.h Normal file
View File

@@ -0,0 +1,82 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __FREELDR_H
#define __FREELDR_H
/* just some stuff */
#define VERSION "FreeLoader v0.8"
#define COPYRIGHT "Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>"
#define ROSLDR_MAJOR_VERSION 0
#define ROSLDR_MINOR_VERSION 8
#define ROSLDR_PATCH_VERSION 0
#define size_t unsigned int
#define BOOL int
#define NULL 0
#define TRUE 1
#define FALSE 0
#define BYTE unsigned char
#define WORD unsigned short
#define DWORD unsigned long
#define CHAR char
#define WCHAR unsigned short
#define LONG long
#define ULONG unsigned long
#define PULONG unsigned long *
#define PDWORD DWORD *
#define PWORD WORD *
#define OSTYPE_REACTOS 1
#define OSTYPE_LINUX 2
#define OSTYPE_BOOTSECTOR 3
#define OSTYPE_PARTITION 4
#define OSTYPE_DRIVE 5
typedef struct
{
char name[260];
int nOSType; // ReactOS or Linux or a bootsector, etc.
} OSTYPE;
extern unsigned int BootDrive; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc.
extern unsigned int BootPartition; // Boot Partition, 1-4
extern BOOL bTUILoaded; // Tells us if the user interface is loaded
extern char *pFreeldrIni; // Load address for freeldr.ini
extern char *pScreenBuffer; // Save address for screen contents
extern int nCursorXPos; // Cursor's X Position
extern int nCursorYPos; // Cursor's Y Position
extern OSTYPE OSList[16]; // The OS list
extern int nNumOS; // Number of OSes listed
extern int nTimeOut; // Time to wait for the user before booting
void BootMain(void);
BOOL ParseIniFile(void);
int GetNumSectionItems(char *section); // returns the number of items in a particular section (i.e. [FREELOADER])
BOOL ReadSectionSettingByNumber(char *section, int num, char *name, char *value); // Reads the num'th value from section
BOOL ReadSectionSettingByName(char *section, char *valuename, char *name, char *value); // Reads the value named name from section
BOOL IsValidSetting(char *setting, char *value);
void SetSetting(char *setting, char *value);
#endif // defined __FREELDR_H

426
freeldr/freeldr/fs.c Normal file
View File

@@ -0,0 +1,426 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "fs.h"
#include "stdlib.h"
#include "tui.h"
#include "asmcode.h"
#define FS_DO_ERROR(s) \
{ \
if (bTUILoaded) \
MessageBox(s); \
else \
{ \
printf(s); \
printf("\nPress any key\n"); \
getch(); \
} \
}
int nSectorBuffered = -1; // Tells us which sector was read into SectorBuffer[]
BYTE SectorBuffer[512]; // 512 byte buffer space for read operations, ReadOneSector reads to here
int FSType = NULL; // Type of filesystem on boot device, set by OpenDiskDrive()
char *pFileSysData = (char *)(FILESYSADDR); // Load address for filesystem data
char *pFat32FATCacheIndex = (char *)(FILESYSADDR); // Load address for filesystem data
BOOL OpenDiskDrive(int nDrive, int nPartition)
{
int num_bootable_partitions = 0;
int boot_partition = 0;
int partition_type = 0;
int head, sector, cylinder;
int offset;
// Check and see if it is a floppy drive
if (nDrive < 0x80)
{
// Read boot sector
if (!biosdisk(_DISK_READ, nDrive, 0, 0, 1, 1, SectorBuffer))
{
FS_DO_ERROR("Disk Read Error");
return FALSE;
}
// Check for validity
if (*((WORD*)(SectorBuffer + 0x1fe)) != 0xaa55)//(SectorBuffer[0x1FE] != 0x55) || (SectorBuffer[0x1FF] != 0xAA))
{
FS_DO_ERROR("Invalid boot sector magic (0xaa55)");
return FALSE;
}
}
else
{
// Read master boot record
if (!biosdisk(_DISK_READ, nDrive, 0, 0, 1, 1, SectorBuffer))
{
FS_DO_ERROR("Disk Read Error");
return FALSE;
}
// Check for validity
if (*((WORD*)(SectorBuffer + 0x1fe)) != 0xaa55)//(SectorBuffer[0x1FE] != 0x55) || (SectorBuffer[0x1FF] != 0xAA))
{
FS_DO_ERROR("Invalid partition table magic (0xaa55)");
return FALSE;
}
if (nPartition == 0)
{
// Check for bootable partitions
if (SectorBuffer[0x1BE] == 0x80)
num_bootable_partitions++;
if (SectorBuffer[0x1CE] == 0x80)
{
num_bootable_partitions++;
boot_partition = 1;
}
if (SectorBuffer[0x1DE] == 0x80)
{
num_bootable_partitions++;
boot_partition = 2;
}
if (SectorBuffer[0x1EE] == 0x80)
{
num_bootable_partitions++;
boot_partition = 3;
}
// Make sure there was only one bootable partition
if (num_bootable_partitions > 1)
{
FS_DO_ERROR("Too many boot partitions");
return FALSE;
}
offset = 0x1BE + (boot_partition * 0x10);
}
else
offset = 0x1BE + ((nPartition-1) * 0x10);
partition_type = SectorBuffer[offset + 4];
// Check for valid partition
if (partition_type == 0)
{
FS_DO_ERROR("Invalid boot partition");
return FALSE;
}
head = SectorBuffer[offset + 1];
sector = (SectorBuffer[offset + 2] & 0x3F);
cylinder = SectorBuffer[offset + 3];
if (SectorBuffer[offset + 2] & 0x80)
cylinder += 0x200;
if (SectorBuffer[offset + 2] & 0x40)
cylinder += 0x100;
// Read partition boot sector
if (!biosdisk(_DISK_READ, nDrive, head, cylinder, sector, 1, SectorBuffer))
{
FS_DO_ERROR("Disk Read Error");
return FALSE;
}
// Check for validity
if (*((WORD*)(SectorBuffer + 0x1fe)) != 0xaa55)//(SectorBuffer[0x1FE] != 0x55) || (SectorBuffer[0x1FF] != 0xAA))
{
FS_DO_ERROR("Invalid boot sector magic (0xaa55)");
return FALSE;
}
}
// Reset data
nBytesPerSector = 0;
nSectorsPerCluster = 0;
nReservedSectors = 0;
nNumberOfFATs = 0;
nRootDirEntries = 0;
nTotalSectors16 = 0;
nSectorsPerFAT16 = 0;
nSectorsPerTrack = 0;
nNumberOfHeads = 0;
nHiddenSectors = 0;
nTotalSectors32 = 0;
nSectorsPerFAT32 = 0;
nExtendedFlags = 0;
nFileSystemVersion = 0;
nRootDirStartCluster = 0;
nRootDirSectorStart = 0;
nDataSectorStart = 0;
nSectorsPerFAT = 0;
nRootDirSectors = 0;
nTotalSectors = 0;
nNumberOfClusters = 0;
// Get data
memcpy(&nBytesPerSector, SectorBuffer + BPB_BYTESPERSECTOR, 2);
memcpy(&nSectorsPerCluster, SectorBuffer + BPB_SECTORSPERCLUSTER, 1);
memcpy(&nReservedSectors, SectorBuffer + BPB_RESERVEDSECTORS, 2);
memcpy(&nNumberOfFATs, SectorBuffer + BPB_NUMBEROFFATS, 1);
memcpy(&nRootDirEntries, SectorBuffer + BPB_ROOTDIRENTRIES, 2);
memcpy(&nTotalSectors16, SectorBuffer + BPB_TOTALSECTORS16, 2);
memcpy(&nSectorsPerFAT16, SectorBuffer + BPB_SECTORSPERFAT16, 2);
memcpy(&nSectorsPerTrack, SectorBuffer + BPB_SECTORSPERTRACK, 2);
memcpy(&nNumberOfHeads, SectorBuffer + BPB_NUMBEROFHEADS, 2);
memcpy(&nHiddenSectors, SectorBuffer + BPB_HIDDENSECTORS, 4);
memcpy(&nTotalSectors32, SectorBuffer + BPB_TOTALSECTORS32, 4);
memcpy(&nSectorsPerFAT32, SectorBuffer + BPB_SECTORSPERFAT32, 4);
memcpy(&nExtendedFlags, SectorBuffer + BPB_EXTENDEDFLAGS32, 2);
memcpy(&nFileSystemVersion, SectorBuffer + BPB_FILESYSTEMVERSION32, 2);
memcpy(&nRootDirStartCluster, SectorBuffer + BPB_ROOTDIRSTARTCLUSTER32, 4);
// Calc some stuff
if (nTotalSectors16 != 0)
nTotalSectors = nTotalSectors16;
else
nTotalSectors = nTotalSectors32;
if (nSectorsPerFAT16 != 0)
nSectorsPerFAT = nSectorsPerFAT16;
else
nSectorsPerFAT = nSectorsPerFAT32;
nRootDirSectorStart = (nNumberOfFATs * nSectorsPerFAT) + nReservedSectors;
nRootDirSectors = ((nRootDirEntries * 32) + (nBytesPerSector - 1)) / nBytesPerSector;
nDataSectorStart = nReservedSectors + (nNumberOfFATs * nSectorsPerFAT) + nRootDirSectors;
nNumberOfClusters = (nTotalSectors - nDataSectorStart) / nSectorsPerCluster;
// Determine FAT type
if (nNumberOfClusters < 4085)
{
/* Volume is FAT12 */
nFATType = FAT12;
}
else if (nNumberOfClusters < 65525)
{
/* Volume is FAT16 */
nFATType = FAT16;
}
else
{
/* Volume is FAT32 */
nFATType = FAT32;
// Check version
// we only work with version 0
if (*((WORD*)(SectorBuffer + BPB_FILESYSTEMVERSION32)) != 0)
{
FS_DO_ERROR("Error: FreeLoader is too old to work with this FAT32 filesystem.\nPlease update FreeLoader.");
return FALSE;
}
}
FSType = FS_FAT;
// Buffer the FAT table if it is small enough
if ((FSType == FS_FAT) && (nFATType == FAT12))
{
if (!ReadMultipleSectors(nReservedSectors, nSectorsPerFAT, pFileSysData))
return FALSE;
}
else if ((FSType == FS_FAT) && (nFATType == FAT16))
{
if (!ReadMultipleSectors(nReservedSectors, nSectorsPerFAT, pFileSysData))
return FALSE;
}
else if ((FSType == FS_FAT) && (nFATType == FAT32))
{
// The FAT table is too big to be buffered so
// we will initialize our cache and cache it
// on demand
for (offset=0; offset<256; offset++)
((int*)pFat32FATCacheIndex)[offset] = -1;
}
return TRUE;
}
BOOL ReadMultipleSectors(int nSect, int nNumberOfSectors, void *pBuffer)
{
BOOL bRetVal;
int PhysicalSector;
int PhysicalHead;
int PhysicalTrack;
int nNum;
nSect += nHiddenSectors;
while (nNumberOfSectors)
{
PhysicalSector = 1 + (nSect % nSectorsPerTrack);
PhysicalHead = (nSect / nSectorsPerTrack) % nNumberOfHeads;
PhysicalTrack = nSect / (nSectorsPerTrack * nNumberOfHeads);
if (PhysicalSector > 1)
{
if (nNumberOfSectors >= (nSectorsPerTrack - (PhysicalSector - 1)))
nNum = (nSectorsPerTrack - (PhysicalSector - 1));
else
nNum = nNumberOfSectors;
}
else
{
if (nNumberOfSectors >= nSectorsPerTrack)
nNum = nSectorsPerTrack;
else
nNum = nNumberOfSectors;
}
bRetVal = biosdisk(_DISK_READ, BootDrive, PhysicalHead, PhysicalTrack, PhysicalSector, nNum, pBuffer);
if (!bRetVal)
{
FS_DO_ERROR("Disk Error");
return FALSE;
}
pBuffer += (nNum * 512);
nNumberOfSectors -= nNum;
nSect += nNum;
}
return TRUE;
}
BOOL ReadOneSector(int nSect)
{
BOOL bRetVal;
int PhysicalSector;
int PhysicalHead;
int PhysicalTrack;
nSectorBuffered = nSect;
nSect += nHiddenSectors;
PhysicalSector = 1 + (nSect % nSectorsPerTrack);
PhysicalHead = (nSect / nSectorsPerTrack) % nNumberOfHeads;
PhysicalTrack = nSect / (nSectorsPerTrack * nNumberOfHeads);
bRetVal = biosdisk(_DISK_READ, BootDrive, PhysicalHead, PhysicalTrack, PhysicalSector, 1, SectorBuffer);
if (!bRetVal)
{
FS_DO_ERROR("Disk Error");
return FALSE;
}
return TRUE;
}
BOOL OpenFile(char *filename, FILE *pFile)
{
switch(FSType)
{
case FS_FAT:
if(!FATOpenFile(filename, &(pFile->fat)))
return FALSE;
pFile->filesize = pFile->fat.dwSize;
break;
default:
FS_DO_ERROR("Error: Unknown filesystem.");
return FALSE;
break;
}
return TRUE;
}
/*
* ReadFile()
* returns number of bytes read or EOF
*/
int ReadFile(FILE *pFile, int count, void *buffer)
{
switch(FSType)
{
case FS_FAT:
return FATRead(&(pFile->fat), count, buffer);
default:
FS_DO_ERROR("Error: Unknown filesystem.");
return EOF;
}
return 0;
}
DWORD GetFileSize(FILE *pFile)
{
return pFile->filesize;
}
DWORD Rewind(FILE *pFile)
{
switch (FSType)
{
case FS_FAT:
pFile->fat.dwCurrentCluster = pFile->fat.dwStartCluster;
pFile->fat.dwCurrentReadOffset = 0;
break;
default:
FS_DO_ERROR("Error: Unknown filesystem.");
break;
}
return pFile->filesize;
}
int feof(FILE *pFile)
{
switch (FSType)
{
case FS_FAT:
if (pFile->fat.dwCurrentReadOffset >= pFile->fat.dwSize)
return TRUE;
else
return FALSE;
break;
default:
FS_DO_ERROR("Error: Unknown filesystem.");
return TRUE;
break;
}
return TRUE;
}
int fseek(FILE *pFile, DWORD offset)
{
switch (FSType)
{
case FS_FAT:
return FATfseek(&(pFile->fat), offset);
break;
default:
FS_DO_ERROR("Error: Unknown filesystem.");
break;
}
return -1;
}

182
freeldr/freeldr/fs.h Normal file
View File

@@ -0,0 +1,182 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __FS_FAT_H
#define __FS_FAT_H
// Bootsector BPB defines
#define BPB_JMPBOOT 0
#define BPB_OEMNAME 3
#define BPB_BYTESPERSECTOR 11
#define BPB_SECTORSPERCLUSTER 13
#define BPB_RESERVEDSECTORS 14
#define BPB_NUMBEROFFATS 16
#define BPB_ROOTDIRENTRIES 17
#define BPB_TOTALSECTORS16 19
#define BPB_MEDIADESCRIPTOR 21
#define BPB_SECTORSPERFAT16 22
#define BPB_SECTORSPERTRACK 24
#define BPB_NUMBEROFHEADS 26
#define BPB_HIDDENSECTORS 28
#define BPB_TOTALSECTORS32 32
// Fat12/16 extended BPB defines
#define BPB_DRIVENUMBER16 36
#define BPB_RESERVED16_1 37
#define BPB_BOOTSIGNATURE16 38
#define BPB_VOLUMESERIAL16 39
#define BPB_VOLUMELABEL16 43
#define BPB_FILESYSTEMTYPE16 54
// Fat32 extended BPB defines
#define BPB_SECTORSPERFAT32 36
#define BPB_EXTENDEDFLAGS32 40
#define BPB_FILESYSTEMVERSION32 42
#define BPB_ROOTDIRSTARTCLUSTER32 44
#define BPB_FILESYSTEMINFOSECTOR32 48
#define BPB_BACKUPBOOTSECTOR32 50
#define BPB_RESERVED32_1 52
#define BPB_DRIVENUMBER32 64
#define BPB_RESERVED32_2 65
#define BPB_BOOTSIGNATURE32 66
#define BPB_VOLUMESERIAL32 67
#define BPB_VOLUMELABEL32 71
#define BPB_FILESYSTEMTYPE32 82
/*
* Structure of MSDOS directory entry
*/
typedef struct //_DIRENTRY
{
BYTE cFileName[11]; /* Filename + extension */
BYTE cAttr; /* File attributes */
BYTE cReserved[10]; /* Reserved area */
WORD wTime; /* Time last modified */
WORD wData; /* Date last modified */
WORD wCluster; /* First cluster number */
DWORD dwSize; /* File size */
} DIRENTRY, * PDIRENTRY;
/*
* Structure of internal file control block
*/
typedef struct //_FCB
{
BYTE cAttr; /* Open attributes */
BYTE cSector; /* Sector within cluster */
PDIRENTRY pDirptr; /* Pointer to directory entry */
WORD wDirSector; /* Directory sector */
WORD wFirstCluster; /* First cluster in file */
WORD wLastCluster; /* Last cluster read/written */
WORD wNextCluster; /* Next cluster to read/write */
WORD wOffset; /* Read/Write offset within sector */
DWORD dwSize; /* File size */
BYTE cBuffer[512]; /* Data transfer buffer */
} FCB, * PFCB;
typedef struct //_FAT_STRUCT
{
DWORD dwStartCluster; // File's starting cluster
DWORD dwCurrentCluster; // Current read cluster number
DWORD dwSize; // File size
DWORD dwCurrentReadOffset;// Amount of data already read
} FAT_STRUCT, * PFAT_STRUCT;
typedef struct //_FILE
{
//DIRENTRY de;
//FCB fcb;
FAT_STRUCT fat;
unsigned long filesize;
} FILE;
extern int nSectorBuffered; // Tells us which sector was read into SectorBuffer[]
extern BYTE SectorBuffer[512]; // 512 byte buffer space for read operations, ReadOneSector reads to here
extern int nFATType;
extern DWORD nBytesPerSector; // Bytes per sector
extern DWORD nSectorsPerCluster; // Number of sectors in a cluster
extern DWORD nReservedSectors; // Reserved sectors, usually 1 (the bootsector)
extern DWORD nNumberOfFATs; // Number of FAT tables
extern DWORD nRootDirEntries; // Number of root directory entries (fat12/16)
extern DWORD nTotalSectors16; // Number of total sectors on the drive, 16-bit
extern DWORD nSectorsPerFAT16; // Sectors per FAT table (fat12/16)
extern DWORD nSectorsPerTrack; // Number of sectors in a track
extern DWORD nNumberOfHeads; // Number of heads on the disk
extern DWORD nHiddenSectors; // Hidden sectors (sectors before the partition start like the partition table)
extern DWORD nTotalSectors32; // Number of total sectors on the drive, 32-bit
extern DWORD nSectorsPerFAT32; // Sectors per FAT table (fat32)
extern DWORD nExtendedFlags; // Extended flags (fat32)
extern DWORD nFileSystemVersion; // File system version (fat32)
extern DWORD nRootDirStartCluster; // Starting cluster of the root directory (fat32)
extern DWORD nRootDirSectorStart; // Starting sector of the root directory (fat12/16)
extern DWORD nDataSectorStart; // Starting sector of the data area
extern DWORD nSectorsPerFAT; // Sectors per FAT table
extern DWORD nRootDirSectors; // Number of sectors of the root directory (fat32)
extern DWORD nTotalSectors; // Total sectors on the drive
extern DWORD nNumberOfClusters; // Number of clusters on the drive
extern int FSType; // Type of filesystem on boot device, set by OpenDiskDrive()
extern char *pFileSysData; // Load address for filesystem data
extern char *pFat32FATCacheIndex; // Load address for filesystem data
BOOL OpenDiskDrive(int nDrive, int nPartition); // Opens the disk drive device for reading
BOOL ReadMultipleSectors(int nSect, int nNumberOfSectors, void *pBuffer);// Reads a sector from the open device
BOOL ReadOneSector(int nSect); // Reads one sector from the open device
BOOL OpenFile(char *filename, FILE *pFile); // Opens a file
int ReadFile(FILE *pFile, int count, void *buffer); // Reads count bytes from pFile into buffer
DWORD GetFileSize(FILE *pFile);
DWORD Rewind(FILE *pFile); // Rewinds a file and returns it's size
int feof(FILE *pFile);
int fseek(FILE *pFILE, DWORD offset);
BOOL FATLookupFile(char *file, PFAT_STRUCT pFatStruct);
int FATGetNumPathParts(char *name);
BOOL FATGetFirstNameFromPath(char *buffer, char *name);
void FATParseFileName(char *buffer, char *name);
DWORD FATGetFATEntry(DWORD nCluster);
BOOL FATOpenFile(char *szFileName, PFAT_STRUCT pFatStruct);
int FATReadCluster(DWORD nCluster, char *cBuffer);
int FATRead(PFAT_STRUCT pFatStruct, int nNumBytes, char *cBuffer);
int FATfseek(PFAT_STRUCT pFatStruct, DWORD offset);
#define EOF -1
#define ATTR_NORMAL 0x00
#define ATTR_READONLY 0x01
#define ATTR_HIDDEN 0x02
#define ATTR_SYSTEM 0x04
#define ATTR_VOLUMENAME 0x08
#define ATTR_DIRECTORY 0x10
#define ATTR_ARCHIVE 0x20
#define FS_FAT 1
#define FS_NTFS 2
#define FS_EXT2 3
#define FAT12 1
#define FAT16 2
#define FAT32 3
#endif // #defined __FS_FAT_H

541
freeldr/freeldr/fs_fat.c Normal file
View File

@@ -0,0 +1,541 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "fs.h"
#include "stdlib.h"
#include "tui.h"
#include "asmcode.h"
int nFATType = FAT12;
DWORD nBytesPerSector; // Bytes per sector
DWORD nSectorsPerCluster; // Number of sectors in a cluster
DWORD nReservedSectors; // Reserved sectors, usually 1 (the bootsector)
DWORD nNumberOfFATs; // Number of FAT tables
DWORD nRootDirEntries; // Number of root directory entries (fat12/16)
DWORD nTotalSectors16; // Number of total sectors on the drive, 16-bit
DWORD nSectorsPerFAT16; // Sectors per FAT table (fat12/16)
DWORD nSectorsPerTrack; // Number of sectors in a track
DWORD nNumberOfHeads; // Number of heads on the disk
DWORD nHiddenSectors; // Hidden sectors (sectors before the partition start like the partition table)
DWORD nTotalSectors32; // Number of total sectors on the drive, 32-bit
DWORD nSectorsPerFAT32; // Sectors per FAT table (fat32)
DWORD nExtendedFlags; // Extended flags (fat32)
DWORD nFileSystemVersion; // File system version (fat32)
DWORD nRootDirStartCluster; // Starting cluster of the root directory (fat32)
DWORD nRootDirSectorStart; // Starting sector of the root directory (fat12/16)
DWORD nDataSectorStart; // Starting sector of the data area
DWORD nSectorsPerFAT; // Sectors per FAT table
DWORD nRootDirSectors; // Number of sectors of the root directory (fat32)
DWORD nTotalSectors; // Total sectors on the drive
DWORD nNumberOfClusters; // Number of clusters on the drive
BOOL FATReadRootDirectoryEntry(int nDirEntry, void *pDirEntryBuf)
{
DWORD nDirEntrySector;
int nOffsetWithinSector;
nDirEntrySector = nRootDirSectorStart + ((nDirEntry * 32) / nBytesPerSector);
if (!ReadOneSector(nDirEntrySector))
return FALSE;
nOffsetWithinSector = (nDirEntry * 32) % nBytesPerSector;
memcpy(pDirEntryBuf, SectorBuffer + nOffsetWithinSector, 32);
if (*((char *)pDirEntryBuf) == 0x05)
*((char *)pDirEntryBuf) = 0xE5;
return TRUE;
}
BOOL FATReadDirectoryEntry(DWORD nDirStartCluster, int nDirEntry, void *pDirEntryBuf)
{
DWORD nRealDirCluster;
int nSectorWithinCluster;
int nOffsetWithinSector;
int nSectorToRead;
int i;
i = (nDirEntry * 32) / (nSectorsPerCluster * nBytesPerSector);
//if ((nDirEntry * 32) % (nSectorsPerCluster * nBytesPerSector))
// i++;
for (nRealDirCluster = nDirStartCluster; i; i--)
nRealDirCluster = FATGetFATEntry(nRealDirCluster);
nSectorWithinCluster = ((nDirEntry * 32) % (nSectorsPerCluster * nBytesPerSector)) / nBytesPerSector;
nSectorToRead = ((nRealDirCluster - 2) * nSectorsPerCluster) + nDataSectorStart + nSectorWithinCluster;
if (!ReadOneSector(nSectorToRead))
return FALSE;
nOffsetWithinSector = (nDirEntry * 32) % nBytesPerSector;
memcpy(pDirEntryBuf, SectorBuffer + nOffsetWithinSector, 32);
if (*((char *)pDirEntryBuf) == 0x05)
*((char *)pDirEntryBuf) = 0xE5;
return TRUE;
}
/*
* FATLookupFile()
* This function searches the file system for the
* specified filename and fills in a FAT_STRUCT structure
* with info describing the file, etc. returns true
* if the file exists or false otherwise
*/
BOOL FATLookupFile(char *file, PFAT_STRUCT pFatStruct)
{
int i, j;
int numparts;
char filename[12];
BYTE direntry[32];
int nNumDirEntries;
FAT_STRUCT fatstruct;
BOOL bFound;
DWORD cluster;
memset(pFatStruct, 0, sizeof(FAT_STRUCT));
// Check and see if the first character is '\' and remove it if so
if (*file == '\\')
file++;
// Figure out how many sub-directories we are nested in
numparts = FATGetNumPathParts(file);
// Loop once for each part
for (i=0; i<numparts; i++)
{
// Make filename compatible with MSDOS dir entry
if (!FATGetFirstNameFromPath(filename, file))
return FALSE;
// Advance to the next part of the path
for (; (*file != '\\') && (*file != '\0'); file++);
file++;
// If we didn't find the correct sub-directory the fail
if ((i != 0) && !bFound)
return FALSE;
bFound = FALSE;
// Check if we are pulling from the root directory of a fat12/fat16 disk
if ((i == 0) && ((nFATType == FAT12) || (nFATType == FAT16)))
nNumDirEntries = nRootDirEntries;
else if ((i == 0) && (nFATType == FAT32))
{
cluster = nRootDirStartCluster;
fatstruct.dwSize = nSectorsPerCluster * nBytesPerSector;
while((cluster = FATGetFATEntry(cluster)) < 0x0FFFFFF8)
fatstruct.dwSize += nSectorsPerCluster * nBytesPerSector;
fatstruct.dwStartCluster = nRootDirStartCluster;
nNumDirEntries = fatstruct.dwSize / 32;
}
else
nNumDirEntries = fatstruct.dwSize / 32;
// Loop through each directory entry
for (j=0; j<nNumDirEntries; j++)
{
// Read the entry
if ((i == 0) && ((nFATType == FAT12) || (nFATType == FAT16)))
{
if (!FATReadRootDirectoryEntry(j, direntry))
return FALSE;
}
else
{
if (!FATReadDirectoryEntry(fatstruct.dwStartCluster, j, direntry))
return FALSE;
}
if (memcmp(direntry, filename, 11) == 0)
{
fatstruct.dwStartCluster = 0;
fatstruct.dwCurrentCluster = 0;
memcpy(&fatstruct.dwStartCluster, direntry + 26, sizeof(WORD));
memcpy(&fatstruct.dwCurrentCluster, direntry + 20, sizeof(WORD));
fatstruct.dwStartCluster += (fatstruct.dwCurrentCluster * 0x10000);
if (direntry[11] & ATTR_DIRECTORY)
{
fatstruct.dwSize = nSectorsPerCluster * nBytesPerSector;
cluster = fatstruct.dwStartCluster;
switch (nFATType)
{
case FAT12:
while((cluster = FATGetFATEntry(cluster)) < 0xFF8)
fatstruct.dwSize += nSectorsPerCluster * nBytesPerSector;
break;
case FAT16:
while((cluster = FATGetFATEntry(cluster)) < 0xFFF8)
fatstruct.dwSize += nSectorsPerCluster * nBytesPerSector;
break;
case FAT32:
while((cluster = FATGetFATEntry(cluster)) < 0x0FFFFFF8)
fatstruct.dwSize += nSectorsPerCluster * nBytesPerSector;
break;
}
}
// If we have more parts to go and this isn't a directory then fail
if ((i < (numparts-1)) && !(direntry[11] & ATTR_DIRECTORY))
return FALSE;
// If this is supposed to be a file and it is a directory then fail
if ((i == (numparts-1)) && (direntry[11] & ATTR_DIRECTORY))
return FALSE;
bFound = TRUE;
break;
}
}
}
if(!bFound)
return FALSE;
memcpy(&pFatStruct->dwStartCluster, direntry + 26, sizeof(WORD));
memcpy(&pFatStruct->dwCurrentCluster, direntry + 20, sizeof(WORD));
pFatStruct->dwStartCluster += (pFatStruct->dwCurrentCluster * 0x10000);
pFatStruct->dwCurrentCluster = pFatStruct->dwStartCluster;
memcpy(&pFatStruct->dwSize, direntry + 28, sizeof(DWORD));
pFatStruct->dwCurrentReadOffset = 0;
return TRUE;
}
/*
* FATGetNumPathParts()
* This function parses a path in the form of dir1\dir2\file1.ext
* and returns the number of parts it has (i.e. 3 - dir1,dir2,file1.ext)
*/
int FATGetNumPathParts(char *name)
{
int i, num;
for(i=0,num=0; i<(int)strlen(name); i++)
{
if(name[i] == '\\')
num++;
}
num++;
return num;
}
/*
* FATGetFirstNameFromPath()
* This function parses a path in the form of dir1\dir2\file1.ext
* and puts the first name of the path (e.g. "dir1") in buffer
* compatible with the MSDOS directory structure
*/
BOOL FATGetFirstNameFromPath(char *buffer, char *name)
{
int i;
char temp[260];
// Copy all the characters up to the end of the
// string or until we hit a '\' character
// and put them in temp
for(i=0; i<(int)strlen(name); i++)
{
if(name[i] == '\\')
break;
else
temp[i] = name[i];
}
temp[i] = 0;
// If the filename is too long then fail
if(strlen(temp) > 12)
return FALSE;
FATParseFileName(buffer, temp);
return TRUE;
}
/*
* FATParseFileName()
* This function parses "name" which is in the form of file.ext
* and puts it in "buffer" in the form of "FILE EXT" which
* is compatible with the MSDOS directory structure
*/
void FATParseFileName(char *buffer, char *name)
{
int i, j;
i = 0;
j = 0;
while(i < 8)
buffer[i++] = (name[j] && (name[j] != '.')) ? toupper(name[j++]) : ' ';
if(name[j] == '.')
j++;
while(i < 11)
buffer[i++] = name[j] ? toupper(name[j++]) : ' ';
buffer[i] = 0;
}
/*
* FATGetFATEntry()
* returns the FAT entry for a given cluster number
*/
DWORD FATGetFATEntry(DWORD nCluster)
{
DWORD fat;
int FATOffset;
int ThisFATSecNum;
int ThisFATEntOffset;
int Idx;
BOOL bEntryFound;
switch(nFATType)
{
case FAT12:
FATOffset = nCluster + (nCluster / 2);
ThisFATSecNum = (FATOffset / nBytesPerSector);
ThisFATEntOffset = (FATOffset % nBytesPerSector);
fat = *((WORD *) (pFileSysData + (ThisFATSecNum * nBytesPerSector) + ThisFATEntOffset));
if (nCluster & 0x0001)
fat = fat >> 4; /* Cluster number is ODD */
else
fat = fat & 0x0FFF; /* Cluster number is EVEN */
return fat;
break;
case FAT16:
FATOffset = (nCluster * 2);
//ThisFATSecNum = nReservedSectors + (FATOffset / nBytesPerSector);
//ThisFATEntOffset = (FATOffset % nBytesPerSector);
//if (!ReadOneSector(ThisFATSecNum))
// return NULL;
//fat = *((WORD *) &SectorBuffer[ThisFATEntOffset]);
fat = *((WORD *) (pFileSysData + FATOffset));
return fat;
break;
case FAT32:
//if (!ReadOneSector(ThisFATSecNum))
// return NULL;
//fat = *((DWORD *) &SectorBuffer[ThisFATEntOffset]) & 0x0FFFFFFF;
//return fat;
// This code manages the fat32 fat table entry cache
// The cache is at address FILESYSADDR which is 128k in size
// The first two sectors will contain an array of DWORDs that
// Specify what fat sector is cached. The first two DWORDs
// should be zero.
FATOffset = (nCluster * 4);
ThisFATSecNum = nReservedSectors + (FATOffset / nBytesPerSector);
ThisFATEntOffset = (FATOffset % nBytesPerSector);
// Now we go through our cache and see if we already have the sector cached
bEntryFound = FALSE;
for (Idx=2; Idx<256; Idx++)
{
if (((int*)pFat32FATCacheIndex)[Idx] == ThisFATSecNum)
{
bEntryFound = TRUE;
break;
}
}
if (bEntryFound)
{
// Get the fat entry
fat = (*((DWORD *) (pFat32FATCacheIndex +
(Idx * nBytesPerSector) + ThisFATEntOffset))) & 0x0FFFFFFF;
}
else
{
if (!ReadOneSector(ThisFATSecNum))
return NULL;
// Move each sector down in the cache to make room for new sector
for (Idx=255; Idx>2; Idx--)
{
memcpy(pFat32FATCacheIndex + (Idx * nBytesPerSector), pFat32FATCacheIndex + ((Idx - 1) * nBytesPerSector), nBytesPerSector);
((int*)pFat32FATCacheIndex)[Idx] = ((int*)pFat32FATCacheIndex)[Idx - 1];
}
// Insert it into the cache
memcpy(pFat32FATCacheIndex + (2 * nBytesPerSector), SectorBuffer, nBytesPerSector);
((int*)pFat32FATCacheIndex)[2] = ThisFATSecNum;
// Get the fat entry
fat = (*((DWORD *) (pFat32FATCacheIndex +
(2 * nBytesPerSector) + ThisFATEntOffset))) & 0x0FFFFFFF;
}
return fat;
break;
}
return NULL;
}
/*
* FATOpenFile()
* Tries to open the file 'name' and returns true or false
* for success and failure respectively
*/
BOOL FATOpenFile(char *szFileName, PFAT_STRUCT pFatStruct)
{
if(!FATLookupFile(szFileName, pFatStruct))
return FALSE;
/* Fill in file control information */
pFatStruct->dwCurrentCluster = pFatStruct->dwStartCluster;
pFatStruct->dwCurrentReadOffset = 0;
return TRUE;
}
/*
* FATReadCluster()
* Reads the specified cluster into memory
* and returns the number of bytes read
*/
int FATReadCluster(DWORD nCluster, char *cBuffer)
{
int nStartSector;
nStartSector = ((nCluster - 2) * nSectorsPerCluster) + nDataSectorStart;
ReadMultipleSectors(nStartSector, nSectorsPerCluster, cBuffer);
return (nSectorsPerCluster * nBytesPerSector);
}
/*
* FATRead()
* Reads nNumBytes from open file and
* returns the number of bytes read
*/
int FATRead(PFAT_STRUCT pFatStruct, int nNumBytes, char *cBuffer)
{
int nSectorWithinCluster;
int nOffsetWithinSector;
int nOffsetWithinCluster;
int nNum;
int nBytesRead = 0;
// If all the data is read return zero
if (pFatStruct->dwCurrentReadOffset >= pFatStruct->dwSize)
return 0;
// If they are trying to read more than there is to read
// then adjust the amount to read
if ((pFatStruct->dwCurrentReadOffset + nNumBytes) > pFatStruct->dwSize)
nNumBytes = pFatStruct->dwSize - pFatStruct->dwCurrentReadOffset;
while (nNumBytes)
{
// Check and see if the read offset is aligned to a cluster boundary
// if so great, if not then read the rest of the current cluster
if ((pFatStruct->dwCurrentReadOffset % (nSectorsPerCluster * nBytesPerSector)) != 0)
{
nSectorWithinCluster = ((pFatStruct->dwCurrentReadOffset / nBytesPerSector) % nSectorsPerCluster);
nOffsetWithinSector = (pFatStruct->dwCurrentReadOffset % nBytesPerSector);
nOffsetWithinCluster = (pFatStruct->dwCurrentReadOffset % (nSectorsPerCluster * nBytesPerSector));
// Read the cluster into the scratch area
FATReadCluster(pFatStruct->dwCurrentCluster, (char *)FATCLUSTERBUF);
nNum = (nSectorsPerCluster * nBytesPerSector) - (pFatStruct->dwCurrentReadOffset % (nSectorsPerCluster * nBytesPerSector));
if (nNumBytes >= nNum)
{
memcpy(cBuffer, (char *)(FATCLUSTERBUF + nOffsetWithinCluster), nNum);
nBytesRead += nNum;
cBuffer += nNum;
pFatStruct->dwCurrentReadOffset += nNum;
pFatStruct->dwCurrentCluster = FATGetFATEntry(pFatStruct->dwCurrentCluster);
nNumBytes -= nNum;
}
else
{
memcpy(cBuffer, (char *)(FATCLUSTERBUF + nOffsetWithinCluster), nNumBytes);
nBytesRead += nNumBytes;
cBuffer += nNumBytes;
pFatStruct->dwCurrentReadOffset += nNumBytes;
nNumBytes -= nNumBytes;
}
}
else
{
// Read the cluster into the scratch area
FATReadCluster(pFatStruct->dwCurrentCluster, (char *)FATCLUSTERBUF);
nNum = (nSectorsPerCluster * nBytesPerSector);
if (nNumBytes >= nNum)
{
memcpy(cBuffer, (char *)(FATCLUSTERBUF), nNum);
nBytesRead += nNum;
cBuffer += nNum;
pFatStruct->dwCurrentReadOffset += nNum;
pFatStruct->dwCurrentCluster = FATGetFATEntry(pFatStruct->dwCurrentCluster);
nNumBytes -= nNum;
}
else
{
memcpy(cBuffer, (char *)(FATCLUSTERBUF), nNumBytes);
nBytesRead += nNumBytes;
cBuffer += nNumBytes;
pFatStruct->dwCurrentReadOffset += nNumBytes;
nNumBytes -= nNumBytes;
}
}
}
return nBytesRead;
}
int FATfseek(PFAT_STRUCT pFatStruct, DWORD offset)
{
DWORD cluster;
int numclusters;
numclusters = offset / (nSectorsPerCluster * nBytesPerSector);
for (cluster=pFatStruct->dwStartCluster; numclusters > 0; numclusters--)
cluster = FATGetFATEntry(cluster);
pFatStruct->dwCurrentCluster = cluster;
pFatStruct->dwCurrentReadOffset = offset;
return 0;
}

101
freeldr/freeldr/linux.c Normal file
View File

@@ -0,0 +1,101 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "asmcode.h"
#include "miscboot.h"
#include "stdlib.h"
#include "fs.h"
#include "tui.h"
#include "linux.h"
void LoadAndBootLinux(int DriveNum, int Partition, char *vmlinuz, char *cmd_line)
{
FILE file;
char temp[260];
char bootsector[512];
char setup[2048];
int len;
BootDrive = DriveNum;
BootPartition = Partition;
if (!OpenDiskDrive(BootDrive, BootPartition))
{
MessageBox("Failed to open boot drive.");
return;
}
if (!OpenFile(vmlinuz, &file))
{
strcpy(temp, vmlinuz);
strcat(temp, " not found.");
MessageBox(temp);
return;
}
// Read boot sector
if (ReadFile(&file, 512, bootsector) != 512)
{
MessageBox("Disk Read Error");
return;
}
MessageBox("bootsector loaded");
// Read setup code
if (ReadFile(&file, 2048, setup) != 2048)
{
MessageBox("Disk Read Error");
return;
}
MessageBox("setup loaded");
// Read kernel code
len = GetFileSize(&file) - (2048 + 512);
//len = 0x200;
if (ReadFile(&file, len, (void*)0x100000) != len)
{
MessageBox("Disk Read Error");
return;
}
MessageBox("kernel loaded");
// Check for validity
if (*((WORD*)(bootsector + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid boot sector magic (0xaa55)");
return;
}
if (*((DWORD*)(setup + 2)) != 0x53726448)
{
MessageBox("Invalid setup magic (\"HdrS\")");
return;
}
memcpy((void*)0x90000, bootsector, 512);
memcpy((void*)0x90200, setup, 2048);
RestoreScreen(pScreenBuffer);
showcursor();
gotoxy(nCursorXPos, nCursorYPos);
stop_floppy();
JumpToLinuxBootCode();
}

27
freeldr/freeldr/linux.h Normal file
View File

@@ -0,0 +1,27 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __LINUX_H
#define __LINUX_H
void JumpToLinuxBootCode(void); // Implemented in boot.S
void LoadAndBootLinux(int DriveNum, int Partition, char *vmlinuz, char *cmd_line);
#endif // defined __LINUX_H

190
freeldr/freeldr/menu.c Normal file
View File

@@ -0,0 +1,190 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "stdlib.h"
#include "tui.h"
#include "menu.h"
#include "options.h"
static int nOSListBoxLeft;
static int nOSListBoxRight;
static int nOSListBoxTop;
static int nOSListBoxBottom;
static int nOSSelected = 0; // Currently selected OS (zero based)
int RunMenu(void)
{
int key;
int second;
BOOL bDone = FALSE;
if (nTimeOut > 0)
nTimeOut++; // Increment the timeout since 0 doesn't count for a second
// Initialise the menu
InitMenu();
// Update the menu
DrawMenu();
second = getsecond();
// Loop
do
{
// Check for a keypress
if (kbhit())
{
// Cancel the timeout
if (nTimeOut != -1)
{
nTimeOut = -1;
DrawMenu();
}
// Get the key
key = getch();
// Is it extended?
if (key == 0)
key = getch(); // Yes - so get the extended key
// Process the key
switch (key)
{
case KEY_UP:
if (nOSSelected)
{
nOSSelected--;
// Update the menu
DrawMenu();
}
break;
case KEY_DOWN:
if (nOSSelected < (nNumOS-1))
{
nOSSelected++;
// Update the menu
DrawMenu();
}
break;
case KEY_ENTER:
bDone = TRUE;
break;
case KEY_F8:
DoOptionsMenu();
DrawBackdrop();
DrawMenu();
break;
}
}
// Update the date & time
UpdateDateTime();
if (nTimeOut > 0)
{
if (getsecond() != second)
{
second = getsecond();
nTimeOut--;
// Update the menu
DrawMenu();
}
}
if (nTimeOut == 0)
bDone = TRUE;
}
while (!bDone);
return nOSSelected;
}
void InitMenu(void)
{
int i;
int height = 1; // Allow room for top & bottom borders
int width = 0;
for(i=0; i<nNumOS; i++)
{
height++;
if(strlen(OSList[i].name) > width)
width = strlen(OSList[i].name);
}
width += 18; // Allow room for left & right borders, plus 8 spaces on each side
// Calculate the OS list box area
nOSListBoxLeft = (nScreenWidth - width) / 2;
nOSListBoxRight = nOSListBoxLeft + width;
nOSListBoxTop = (nScreenHeight - height) / 2 + 1;
nOSListBoxBottom = nOSListBoxTop + height;
}
void DrawMenu(void)
{
int i, j;
char text[260];
char temp[260];
int space, space_left, space_right;
// Update the status bar
DrawStatusText(" Use \x18\x19 to select, ENTER to boot. Press F8 for advanced options.");
DrawBox(nOSListBoxLeft, nOSListBoxTop, nOSListBoxRight, nOSListBoxBottom, D_VERT, D_HORZ, TRUE, TRUE, ATTR(cMenuFgColor, cMenuBgColor));
for(i=0; i<nNumOS; i++)
{
space = (nOSListBoxRight - nOSListBoxLeft - 2) - strlen(OSList[i].name);
space_left = (space / 2) + 1;
space_right = (space - space_left) + 1;
text[0] = '\0';
for(j=0; j<space_left; j++)
strcat(text, " ");
strcat(text, OSList[i].name);
for(j=0; j<space_right; j++)
strcat(text, " ");
if(i == nOSSelected)
{
DrawText(nOSListBoxLeft+1, nOSListBoxTop+1+i, text, ATTR(cSelectedTextColor, cSelectedTextBgColor));
}
else
{
DrawText(nOSListBoxLeft+1, nOSListBoxTop+1+i, text, ATTR(cTextColor, cMenuBgColor));
}
}
if (nTimeOut >= 0)
{
strcpy(text, "[ Time Remaining: ");
itoa(nTimeOut, temp, 10);
strcat(text, temp);
strcat(text, " ]");
DrawText(nOSListBoxRight - strlen(text) - 1, nOSListBoxBottom, text, ATTR(cMenuFgColor, cMenuBgColor));
}
}

27
freeldr/freeldr/menu.h Normal file
View File

@@ -0,0 +1,27 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __MENU_H
#define __MENU_H
int RunMenu(void);
void InitMenu(void);
void DrawMenu(void);
#endif // #defined __MENU_H

229
freeldr/freeldr/miscboot.c Normal file
View File

@@ -0,0 +1,229 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "asmcode.h"
#include "miscboot.h"
#include "stdlib.h"
#include "fs.h"
#include "tui.h"
void LoadAndBootBootSector(int nOSToBoot)
{
FILE file;
char name[260];
char value[260];
char szFileName[1024];
int i;
// Find all the message box settings and run them
for (i=1; i<=GetNumSectionItems(OSList[nOSToBoot].name); i++)
{
ReadSectionSettingByNumber(OSList[nOSToBoot].name, i, name, value);
if (stricmp(name, "MessageBox") == 0)
MessageBox(value);
if (stricmp(name, "MessageLine") == 0)
MessageLine(value);
}
if (!ReadSectionSettingByName(OSList[nOSToBoot].name, "BootDrive", name, value))
{
MessageBox("Boot drive not specified for selected OS!");
return;
}
BootDrive = atoi(value);
BootPartition = 0;
if (ReadSectionSettingByName(OSList[nOSToBoot].name, "BootPartition", name, value))
BootPartition = atoi(value);
if (!ReadSectionSettingByName(OSList[nOSToBoot].name, "BootSector", name, value))
{
MessageBox("Boot sector file not specified for selected OS!");
return;
}
if (!OpenDiskDrive(BootDrive, BootPartition))
{
MessageBox("Failed to open boot drive.");
return;
}
strcpy(szFileName, value);
if (!OpenFile(szFileName, &file))
{
strcat(value, " not found.");
MessageBox(value);
return;
}
// Read boot sector
if (ReadFile(&file, 512, (void*)0x7c00) != 512)
{
MessageBox("Disk Read Error");
return;
}
// Check for validity
if (*((WORD*)(0x7c00 + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid boot sector magic (0xaa55)");
return;
}
RestoreScreen(pScreenBuffer);
showcursor();
gotoxy(nCursorXPos, nCursorYPos);
stop_floppy();
JumpToBootCode();
}
void LoadAndBootPartition(int nOSToBoot)
{
char name[260];
char value[260];
int head, sector, cylinder;
int offset;
int i;
// Find all the message box settings and run them
for (i=1; i<=GetNumSectionItems(OSList[nOSToBoot].name); i++)
{
ReadSectionSettingByNumber(OSList[nOSToBoot].name, i, name, value);
if (stricmp(name, "MessageBox") == 0)
MessageBox(value);
if (stricmp(name, "MessageLine") == 0)
MessageLine(value);
}
if (!ReadSectionSettingByName(OSList[nOSToBoot].name, "BootDrive", name, value))
{
MessageBox("Boot drive not specified for selected OS!");
return;
}
BootDrive = atoi(value);
if (!ReadSectionSettingByName(OSList[nOSToBoot].name, "BootPartition", name, value))
{
MessageBox("Boot partition not specified for selected OS!");
return;
}
BootPartition = atoi(value);
if (!biosdisk(_DISK_READ, BootDrive, 0, 0, 1, 1, SectorBuffer))
{
MessageBox("Disk Read Error");
return;
}
// Check for validity
if (*((WORD*)(SectorBuffer + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid partition table magic (0xaa55)");
return;
}
offset = 0x1BE + ((BootPartition-1) * 0x10);
// Check for valid partition
if (SectorBuffer[offset + 4] == 0)
{
MessageBox("Invalid boot partition");
return;
}
head = SectorBuffer[offset + 1];
sector = (SectorBuffer[offset + 2] & 0x3F);
cylinder = SectorBuffer[offset + 3];
if (SectorBuffer[offset + 2] & 0x80)
cylinder += 0x200;
if (SectorBuffer[offset + 2] & 0x40)
cylinder += 0x100;
// Read partition boot sector
if (!biosdisk(_DISK_READ, BootDrive, head, cylinder, sector, 1, (void*)0x7c00))
{
MessageBox("Disk Read Error");
return;
}
// Check for validity
if (*((WORD*)(0x7c00 + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid boot sector magic (0xaa55)");
return;
}
RestoreScreen(pScreenBuffer);
showcursor();
gotoxy(nCursorXPos, nCursorYPos);
stop_floppy();
JumpToBootCode();
}
void LoadAndBootDrive(int nOSToBoot)
{
char name[260];
char value[260];
int i;
// Find all the message box settings and run them
for (i=1; i<=GetNumSectionItems(OSList[nOSToBoot].name); i++)
{
ReadSectionSettingByNumber(OSList[nOSToBoot].name, i, name, value);
if (stricmp(name, "MessageBox") == 0)
MessageBox(value);
if (stricmp(name, "MessageLine") == 0)
MessageLine(value);
}
if (!ReadSectionSettingByName(OSList[nOSToBoot].name, "BootDrive", name, value))
{
MessageBox("Boot drive not specified for selected OS!");
return;
}
BootDrive = atoi(value);
if (!biosdisk(_DISK_READ, BootDrive, 0, 0, 1, 1, (void*)0x7c00))
{
MessageBox("Disk Read Error");
return;
}
// Check for validity
if (*((WORD*)(0x7c00 + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid boot sector magic (0xaa55)");
return;
}
RestoreScreen(pScreenBuffer);
showcursor();
gotoxy(nCursorXPos, nCursorYPos);
stop_floppy();
JumpToBootCode();
}

View File

@@ -0,0 +1,29 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __BOOT_H
#define __BOOT_H
void JumpToBootCode(void); // Implemented in boot.S
void LoadAndBootBootSector(int nOSToBoot);
void LoadAndBootPartition(int nOSToBoot);
void LoadAndBootDrive(int nOSToBoot);
#endif // defined __BOOT_H

395
freeldr/freeldr/options.c Normal file
View File

@@ -0,0 +1,395 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "stdlib.h"
#include "tui.h"
#include "options.h"
#include "miscboot.h"
void DoOptionsMenu(void)
{
int OptionsMenuItemCount = 1; // Count is 1 because we don't show the "Set ReactOS Boot Flags" menu item yet
char OptionsMenuItems[2][80] = { "Boot Wizard", "Set ReactOS Boot Flags" /* i.e. Safe Mode, Last Known Good Configuration */ };
int OptionsMenuItemSelected = 0;
while (OptionsMenuItemSelected != -1)
{
OptionsMenuItemSelected = RunOptionsMenu(OptionsMenuItems, OptionsMenuItemCount, OptionsMenuItemSelected, "[Advanced Options]");
switch (OptionsMenuItemSelected)
{
case 0:
DoDiskOptionsMenu();
break;
}
}
}
void DoDiskOptionsMenu(void)
{
char DiskMenuItems[25][80];
int DiskMenuItemCount = 0;
int FloppyDiskMenuItemCount = 0;
int HardDiskMenuItemCount = 0;
int DiskMenuItemSelected = 0;
char temp[255];
int i;
FloppyDiskMenuItemCount = (int)*((char *)((0x40 * 16) + 0x10)); // Get number of floppy disks from bios data area 40:10
if (FloppyDiskMenuItemCount & 1)
FloppyDiskMenuItemCount = (FloppyDiskMenuItemCount >> 6) + 1;
else
FloppyDiskMenuItemCount = 0;
HardDiskMenuItemCount = (int)*((char *)((0x40 * 16) + 0x75)); // Get number of hard disks from bios data area 40:75
DiskMenuItemCount = FloppyDiskMenuItemCount + HardDiskMenuItemCount;
for (i=0; i<FloppyDiskMenuItemCount; i++)
{
strcpy(DiskMenuItems[i], "Floppy Disk ");
itoa(i + 1, temp, 10);
strcat(DiskMenuItems[i], temp);
}
for (i=0; i<HardDiskMenuItemCount; i++)
{
strcpy(DiskMenuItems[i + FloppyDiskMenuItemCount], "Hard Disk ");
itoa(i + 1, temp, 10);
strcat(DiskMenuItems[i + FloppyDiskMenuItemCount], temp);
strcat(DiskMenuItems[i + FloppyDiskMenuItemCount], " (");
itoa((get_heads(i+0x80) * get_cylinders(i+0x80) * get_sectors(i+0x80)) / 2048, temp, 10);
strcat(DiskMenuItems[i + FloppyDiskMenuItemCount], temp);
strcat(DiskMenuItems[i + FloppyDiskMenuItemCount], " MB)");
}
DiskMenuItemSelected = 0;
while (DiskMenuItemSelected != -1)
{
DiskMenuItemSelected = RunOptionsMenu(DiskMenuItems, DiskMenuItemCount, DiskMenuItemSelected, "[Boot Wizard]");
if (DiskMenuItemSelected != -1)
{
if (DiskMenuItemSelected < FloppyDiskMenuItemCount)
DoBootOptionsMenu(DiskMenuItemSelected, DiskMenuItems[DiskMenuItemSelected]);
else
DoBootOptionsMenu((DiskMenuItemSelected - FloppyDiskMenuItemCount) + 0x80, DiskMenuItems[DiskMenuItemSelected]);
}
}
}
void DoBootOptionsMenu(int BootDriveNum, char *BootDriveText)
{
int BootOptionsMenuItemCount = 2;
char BootOptionsMenuItems[2][80] = { "Boot To ", "Pick A Boot Partition" };
int BootOptionsMenuItemSelected = 0;
strcat(BootOptionsMenuItems[0], BootDriveText);
while (BootOptionsMenuItemSelected != -1)
{
BootOptionsMenuItemSelected = RunOptionsMenu(BootOptionsMenuItems, BootOptionsMenuItemCount, BootOptionsMenuItemSelected, "[Boot Options]");
switch (BootOptionsMenuItemSelected)
{
case 0:
BootDrive = BootDriveNum;
if (!biosdisk(_DISK_READ, BootDrive, 0, 0, 1, 1, (void*)0x7c00))
{
MessageBox("Disk Read Error");
return;
}
// Check for validity
if (*((WORD*)(0x7c00 + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid boot sector magic (0xaa55)");
return;
}
RestoreScreen(pScreenBuffer);
showcursor();
gotoxy(nCursorXPos, nCursorYPos);
stop_floppy();
JumpToBootCode();
break;
case 1:
if (BootDriveNum < 0x80)
{
MessageBox("This option is not available for a floppy disk.");
continue;
}
else
DoBootPartitionOptionsMenu(BootDriveNum);
break;
}
}
}
void DoBootPartitionOptionsMenu(int BootDriveNum)
{
struct
{
int partition_num;
int partition_type;
int head, sector, cylinder;
} BootPartitions[8];
int BootOptionsMenuItemCount = 0;
char BootOptionsMenuItems[8][80];
int BootOptionsMenuItemSelected = 0;
int head, sector, cylinder;
int offset;
int i;
char temp[25];
BootDrive = BootDriveNum;
if (!biosdisk(_DISK_READ, BootDrive, 0, 0, 1, 1, SectorBuffer))
{
MessageBox("Disk Read Error");
return;
}
// Check for validity
if (*((WORD*)(SectorBuffer + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid partition table magic (0xaa55)");
return;
}
offset = 0x1BE;
for (i=0; i<4; i++)
{
// Check for valid partition
if (SectorBuffer[offset + 4] != 0)
{
BootPartitions[BootOptionsMenuItemCount].partition_num = i;
BootPartitions[BootOptionsMenuItemCount].partition_type = SectorBuffer[offset + 4];
BootPartitions[BootOptionsMenuItemCount].head = SectorBuffer[offset + 1];
BootPartitions[BootOptionsMenuItemCount].sector = (SectorBuffer[offset + 2] & 0x3F);
BootPartitions[BootOptionsMenuItemCount].cylinder = SectorBuffer[offset + 3];
if (SectorBuffer[offset + 2] & 0x80)
BootPartitions[BootOptionsMenuItemCount].cylinder += 0x200;
if (SectorBuffer[offset + 2] & 0x40)
BootPartitions[BootOptionsMenuItemCount].cylinder += 0x100;
strcpy(BootOptionsMenuItems[BootOptionsMenuItemCount], "Boot To Partition ");
itoa(i+1, temp, 10);
strcat(BootOptionsMenuItems[BootOptionsMenuItemCount], temp);
strcat(BootOptionsMenuItems[BootOptionsMenuItemCount], " (Type: 0x");
itoa(BootPartitions[BootOptionsMenuItemCount].partition_type, temp, 16);
if (strlen(temp) < 2)
strcat(BootOptionsMenuItems[BootOptionsMenuItemCount], "0");
strcat(BootOptionsMenuItems[BootOptionsMenuItemCount], temp);
strcat(BootOptionsMenuItems[BootOptionsMenuItemCount], ")");
BootOptionsMenuItemCount++;
}
offset += 0x10;
}
while (BootOptionsMenuItemSelected != -1)
{
BootOptionsMenuItemSelected = RunOptionsMenu(BootOptionsMenuItems, BootOptionsMenuItemCount, BootOptionsMenuItemSelected, "[Boot Partition Options]");
if (BootOptionsMenuItemSelected != -1)
{
head = BootPartitions[BootOptionsMenuItemCount].head;
sector = BootPartitions[BootOptionsMenuItemCount].sector;
cylinder = BootPartitions[BootOptionsMenuItemCount].cylinder;
// Read partition boot sector
if (!biosdisk(_DISK_READ, BootDrive, head, cylinder, sector, 1, (void*)0x7c00))
{
MessageBox("Disk Read Error");
return;
}
// Check for validity
if (*((WORD*)(0x7c00 + 0x1fe)) != 0xaa55)
{
MessageBox("Invalid boot sector magic (0xaa55)");
return;
}
RestoreScreen(pScreenBuffer);
showcursor();
gotoxy(nCursorXPos, nCursorYPos);
stop_floppy();
JumpToBootCode();
}
}
}
int RunOptionsMenu(char OptionsMenuItems[][80], int OptionsMenuItemCount, int nOptionSelected, char *OptionsMenuTitle)
{
int key;
int second;
BOOL bDone = FALSE;
int nOptionsMenuBoxLeft;
int nOptionsMenuBoxRight;
int nOptionsMenuBoxTop;
int nOptionsMenuBoxBottom;
// Initialise the menu
InitOptionsMenu(&nOptionsMenuBoxLeft, &nOptionsMenuBoxTop, &nOptionsMenuBoxRight, &nOptionsMenuBoxBottom, OptionsMenuItemCount);
DrawBackdrop();
// Update the menu
DrawOptionsMenu(OptionsMenuItems, OptionsMenuItemCount, nOptionSelected, OptionsMenuTitle, nOptionsMenuBoxLeft, nOptionsMenuBoxTop, nOptionsMenuBoxRight, nOptionsMenuBoxBottom);
second = getsecond();
// Loop
do
{
// Check for a keypress
if (kbhit())
{
// Cancel the timeout
if (nTimeOut != -1)
{
nTimeOut = -1;
DrawOptionsMenu(OptionsMenuItems, OptionsMenuItemCount, nOptionSelected, OptionsMenuTitle, nOptionsMenuBoxLeft, nOptionsMenuBoxTop, nOptionsMenuBoxRight, nOptionsMenuBoxBottom);
}
// Get the key
key = getch();
// Is it extended?
if (key == 0)
key = getch(); // Yes - so get the extended key
// Process the key
switch (key)
{
case KEY_UP:
if (nOptionSelected)
{
nOptionSelected--;
// Update the menu
DrawOptionsMenu(OptionsMenuItems, OptionsMenuItemCount, nOptionSelected, OptionsMenuTitle, nOptionsMenuBoxLeft, nOptionsMenuBoxTop, nOptionsMenuBoxRight, nOptionsMenuBoxBottom);
}
break;
case KEY_DOWN:
if (nOptionSelected < (OptionsMenuItemCount - 1))
{
nOptionSelected++;
// Update the menu
DrawOptionsMenu(OptionsMenuItems, OptionsMenuItemCount, nOptionSelected, OptionsMenuTitle, nOptionsMenuBoxLeft, nOptionsMenuBoxTop, nOptionsMenuBoxRight, nOptionsMenuBoxBottom);
}
break;
case KEY_ENTER:
//MessageBox("The Advanced Options are still being implemented.");
bDone = TRUE;
break;
case KEY_ESC:
nOptionSelected = -1;
bDone = TRUE;
break;
}
}
// Update the date & time
UpdateDateTime();
if (nTimeOut > 0)
{
if (getsecond() != second)
{
second = getsecond();
nTimeOut--;
// Update the menu
DrawOptionsMenu(OptionsMenuItems, OptionsMenuItemCount, nOptionSelected, OptionsMenuTitle, nOptionsMenuBoxLeft, nOptionsMenuBoxTop, nOptionsMenuBoxRight, nOptionsMenuBoxBottom);
}
}
if (nTimeOut == 0)
bDone = TRUE;
}
while (!bDone);
return nOptionSelected;
}
void InitOptionsMenu(int *nOptionsMenuBoxLeft, int *nOptionsMenuBoxTop, int *nOptionsMenuBoxRight, int *nOptionsMenuBoxBottom, int OptionsMenuItemCount)
{
int height = OptionsMenuItemCount;
int width = 20;
height += 1; // Allow room for top & bottom borders
width += 18; // Allow room for left & right borders, plus 8 spaces on each side
// Calculate the OS list box area
*nOptionsMenuBoxLeft = (nScreenWidth - width) / 2;
*nOptionsMenuBoxRight = *nOptionsMenuBoxLeft + width;
*nOptionsMenuBoxTop = (nScreenHeight - height) / 2 + 1;
*nOptionsMenuBoxBottom = *nOptionsMenuBoxTop + height;
}
void DrawOptionsMenu(char OptionsMenuItems[][80], int OptionsMenuItemCount, int nOptionSelected, char *OptionsMenuTitle, int nOptionsMenuBoxLeft, int nOptionsMenuBoxTop, int nOptionsMenuBoxRight, int nOptionsMenuBoxBottom)
{
int i, j;
char text[260];
int space, space_left, space_right;
// Update the status bar
DrawStatusText(" Use \x18\x19 to select, then press ENTER. Press ESC to go back.");
DrawBox(nOptionsMenuBoxLeft, nOptionsMenuBoxTop, nOptionsMenuBoxRight, nOptionsMenuBoxBottom, D_VERT, D_HORZ, TRUE, TRUE, ATTR(cMenuFgColor, cMenuBgColor));
DrawText(nOptionsMenuBoxLeft + (((nOptionsMenuBoxRight - nOptionsMenuBoxLeft) - strlen(OptionsMenuTitle)) / 2) + 1, nOptionsMenuBoxTop, OptionsMenuTitle, ATTR(cMenuFgColor, cMenuBgColor));
for(i=0; i<OptionsMenuItemCount; i++)
{
space = (nOptionsMenuBoxRight - nOptionsMenuBoxLeft - 2) - strlen(OptionsMenuItems[i]);
space_left = (space / 2) + 1;
space_right = (space - space_left) + 1;
text[0] = '\0';
for(j=0; j<space_left; j++)
strcat(text, " ");
strcat(text, OptionsMenuItems[i]);
for(j=0; j<space_right; j++)
strcat(text, " ");
if(i == nOptionSelected)
{
DrawText(nOptionsMenuBoxLeft+1, nOptionsMenuBoxTop+1+i, text, ATTR(cSelectedTextColor, cSelectedTextBgColor));
}
else
{
DrawText(nOptionsMenuBoxLeft+1, nOptionsMenuBoxTop+1+i, text, ATTR(cTextColor, cMenuBgColor));
}
}
}

31
freeldr/freeldr/options.h Normal file
View File

@@ -0,0 +1,31 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __OPTIONS_H
#define __OPTIONS_H
void DoOptionsMenu(void);
void DoDiskOptionsMenu(void);
void DoBootOptionsMenu(int BootDriveNum, char *BootDriveText);
void DoBootPartitionOptionsMenu(int BootDriveNum);
int RunOptionsMenu(char OptionsMenuItems[][80], int OptionsMenuItemCount, int nOptionSelected, char *OptionsMenuTitle);
void InitOptionsMenu(int *nOptionsMenuBoxLeft, int *nOptionsMenuBoxTop, int *nOptionsMenuBoxRight, int *nOptionsMenuBoxBottom, int OptionsMenuItemCount);
void DrawOptionsMenu(char OptionsMenuItems[][80], int OptionsMenuItemCount, int nOptionSelected, char *OptionsMenuTitle, int nOptionsMenuBoxLeft, int nOptionsMenuBoxTop, int nOptionsMenuBoxRight, int nOptionsMenuBoxBottom);
#endif // #defined __OPTIONS_H

View File

@@ -479,7 +479,7 @@ typedef struct _IMAGE_DEBUG_MISC {
DWORD DataType; // type of misc data, see defines
DWORD Length; // total length of record, rounded to four
// byte multiple.
BOOLEAN Unicode; // TRUE if data is unicode string
BOOL Unicode; // TRUE if data is unicode string
BYTE Reserved[ 3 ];
BYTE Data[ 1 ]; // Actual data
} IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;

374
freeldr/freeldr/ros.S Normal file
View File

@@ -0,0 +1,374 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
.text
.code16
#include "asmcode.h"
/*
* Needed for enabling the a20 address line
*/
empty_8042:
.word 0x00eb,0x00eb // jmp $+2, jmp $+2
inb $0x64,%al
testb $0x02,%al
jnz empty_8042
ret
/*
* Enable the A20 address line (to allow access to over 1mb)
*/
.code32
EXTERN(_enable_a20)
call switch_to_real
.code16
call empty_8042
movb $0xD1,%al // command write
outb %al,$0x64
call empty_8042
mov $0xDF,%al // A20 on
out %al,$0x60
call empty_8042
call switch_to_prot
.code32
ret
.code16
/*
* Reprogram the PIC because they overlap the Intel defined
* exceptions
*/
reprogram_pic:
movb $0x11,%al // initialization sequence
outb %al,$0x20 // send it to 8259A-1
.word 0x00eb,0x00eb // jmp $+2, jmp $+2
outb %al,$0xA0 // and to 8259A-2
.word 0x00eb,0x00eb
movb $0x40,%al // start of hardware int's (0x20)
outb %al,$0x21
.word 0x00eb,0x00eb
movb $0x48,%al // start of hardware int's 2 (0x28)
outb %al,$0xA1
.word 0x00eb,0x00eb
movb $0x04,%al // 8259-1 is master
outb %al,$0x21
.word 0x00eb,0x00eb
movb $0x02,%al // 8259-2 is slave
outb %al,$0xA1
.word 0x00eb,0x00eb
movb $0x01,%al // 8086 mode for both
outb %al,$0x21
.word 0x00eb,0x00eb
outb %al,$0xA1
.word 0x00eb,0x00eb
movb $0xFF,%al // mask off all interrupts for now
outb %al,$0x21
.word 0x00eb,0x00eb
outb %al,$0xA1
ret
/*
* In: EDI = address
* Out: FS = segment
* DI = base
*/
convert_to_seg:
pushl %eax
movl %edi,%eax
//shrl $16,%eax
//shll $12,%eax
//movw %ax,%fs
shrl $4,%eax
movw %ax,%fs
andl $0xf,%edi
//andl $0xFFFF,%edi
popl %eax
ret
/*
* Here we assume the kernel is loaded at 1mb
* This boots the kernel
*/
.code32
EXTERN(_boot_ros)
call switch_to_real
.code16
/* Save cursor position */
movw $3,%ax //! Reset video mode
int $0x10
movb $10,%bl
movb $12,%ah
int $0x10
movw $0x1112,%ax //! Use 8x8 font
xorb %bl,%bl
int $0x10
movw $0x1200,%ax //! Use alternate print screen
movb $0x20,%bl
int $0x10
movb $1,%ah //! Define cursor (scan lines 6 to 7)
movw $0x0607,%cx
int $0x10
movb $1,%ah
movw $0x600,%cx
int $0x10
MOVb $6,%AH //SCROLL ACTIVE PAGE UP
MOVb $0x32,%AL //CLEAR 25 LINES
MOVw $0,%CX //UPPER LEFT OF SCROLL
MOVw $0x314F,%dx //LOWER RIGHT OF SCROLL
MOVb $(1*0x10+1),%bh //USE NORMAL ATTRIBUTE ON BLANKED LINE
INT $0x10 //VIDEO-IO
movw $0,%dx
movb $0,%dh
movb $2,%ah
movb $0,%bh
int $0x10
movw $0,%dx
movb $0,%dh
movb $2,%ah
movb $0,%bh
int $0x10
cli
// The page tables are setup elsewhere
/*
// Map in the lowmem page table (and reuse it for the identity map)
movl _kernel_page_directory_base,%edi
call convert_to_seg
movl _lowmem_page_table_base,%eax
addl $0x07,%eax
movl %eax,%fs:(%edi)
movl %eax,%fs:0xd00(%edi)//(0xd0000000/(1024*1024))(%edi)
// Map the page tables from the page directory
movl _kernel_page_directory_base,%eax
addl $0x07,%eax
movl %eax,%fs:0xf00(%edi)//(0xf0000000/(1024*1024))(%edi)
// Map in the kernel page table
movl _system_page_table_base,%eax
addl $0x07,%eax
movl %eax,%fs:0xc00(%edi)//(0xc0000000/(1024*1024))(%edi)
// Setup the lowmem page table
movl _lowmem_page_table_base,%edi
call convert_to_seg
movl $0,%ebx
l9:
movl %ebx,%eax
shll $12,%eax // ebx = ebx * 4096
addl $07,%eax // user, rw, present
movl %eax,%fs:(%edi,%ebx,4)
incl %ebx
cmpl $1024,%ebx
jl l9
// Setup the system page table
movl _system_page_table_base,%edi
call convert_to_seg
movl $07,%eax
l8:
movl %eax,%edx
addl _start_kernel,%edx
movl %edx,%fs:(%edi)
addl $4,%edi
addl $0x1000,%eax
cmpl $0x100007,%eax
jl l8
*/
/*
* Load the page directory into cr3
*/
movl _kernel_page_directory_base,%eax
movl %eax,%cr3
/*
* Setup various variables
*/
movw %ds,%bx
movzwl %bx,%eax
shll $4,%eax
addl %eax,kernel_gdtbase
//call enable_a20 // enabled elsewhere
call reprogram_pic
/*
* Load stack
*/
movw %ds,%bx
movzwl %bx,%eax
shll $4,%eax
addl $real_stack_end,%eax
movl %eax,real_stack_base
movl real_stack_base,%esp
movl _boot_param_struct_base,%edx
/*
* load gdt
*/
lgdt kernel_gdtptr
/*
* Enter pmode and clear prefetch queue
*/
movl %cr0,%eax
orl $0x80010001,%eax
/*orl $0x80000001,%eax*/
movl %eax,%cr0
jmp next
next:
/*
* NOTE: This must be position independant (no references to
* non absolute variables)
*/
/*
* Initalize segment registers
*/
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%ss
movw %ax,%es
movw %ax,%fs
movw %ax,%gs
/*
* Initalize eflags
*/
pushl $0
popfl
/*
* Jump to start of 32 bit code at 0xc0000000 + 0x1000
*/
pushl %edx
pushl $0
ljmpl $KERNEL_CS,$(KERNEL_BASE+0x1000)
.p2align 2 /* force 4-byte alignment */
kernel_gdt:
.word 0 // Zero descriptor
.word 0
.word 0
.word 0
//.word 0x0000 // User code descriptor
//.word 0x0000 // base: 0h limit: 3gb
//.word 0xfa00
//.word 0x00cc
//.word 0x0000 // User data descriptor
//.word 0x0000 // base: 0h limit: 3gb
//.word 0xf200
//.word 0x00cc
//.word 0x0000
//.word 0x0000
//.word 0x0000
//.word 0x0000
.word 0xffff // Kernel code descriptor
.word 0x0000 //
.word 0x9a00 // base 0h limit 4gb
.word 0x00cf
.word 0xffff // Kernel data descriptor
.word 0x0000 //
.word 0x9200 // base 0h limit 4gb
.word 0x00cf
/* TSS space */
//.rept NR_TASKS
//.word 0
//.word 0
//.word 0
//.word 0
//.endr
kernel_gdtptr:
.word (((6+NR_TASKS)*8)-1) /* Limit */
kernel_gdtbase:
.long kernel_gdt /* Base Address */
EXTERN(_boot_param_struct_base)
.long 0
EXTERN(_start_mem)
.long 0
EXTERN(_kernel_page_directory_base)
.long 0
EXTERN(_system_page_table_base)
.long 0
EXTERN(_lowmem_page_table_base)
.long 0
EXTERN(_start_kernel)
.long 0
EXTERN(_load_base)
.long 0
/* boot_param structure */
EXTERN(_boot_parameters)
.long 0 // Magic
.long 0 // Cursor X
.long 0 // Cursor Y
.long 0 // nr_files
.long 0 // start_mem
.long 0 // end_mem
.rept 64
.long 0 // List of module lengths (terminated by a 0)
.endr
.rept 256
.byte 0 // Kernel parameter string
.endr
/* Our initial stack */
real_stack:
.rept 1024
.byte 0
.endr
real_stack_end:
real_stack_base:
.long 0

390
freeldr/freeldr/rosboot.c Normal file
View File

@@ -0,0 +1,390 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "asmcode.h"
#include "rosboot.h"
#include "stdlib.h"
#include "fs.h"
#include "tui.h"
extern boot_param boot_parameters; // Boot parameter structure passed to the kernel
extern int boot_param_struct_base; // Physical address of the boot parameters structure
extern int start_mem; // Start of the continuous range of physical kernel memory
extern int kernel_page_directory_base; // Physical address of the kernel page directory
extern int system_page_table_base; // Physical address of the system page table
extern int lowmem_page_table_base; // Physical address of the low mem page table
extern int start_kernel; // Physical address of the start of kernel code
extern int load_base; // Physical address of the loaded kernel modules
static int next_load_base;
void LoadAndBootReactOS(int nOSToBoot)
{
FILE file;
char name[1024];
char value[1024];
char szFileName[1024];
int i;
int nNumDriverFiles=0;
int nNumFilesLoaded=0;
/*
* Enable a20 so we can load at 1mb and initialize the page tables
*/
//enable_a20(); // enabled in freeldr.c
ReactOSMemInit();
// Setup kernel parameters
boot_param_struct_base = (int)&boot_parameters;
boot_parameters.magic = 0xdeadbeef;
boot_parameters.cursorx = 0;
boot_parameters.cursory = 0;
boot_parameters.nr_files = 0;
boot_parameters.start_mem = start_mem;
boot_parameters.end_mem = load_base;
boot_parameters.kernel_parameters[0] = 0;
next_load_base = load_base;
/*
* Read the optional kernel parameters
*/
if(ReadSectionSettingByName(OSList[nOSToBoot].name, "Options", name, value))
{
strcpy(boot_parameters.kernel_parameters,value);
}
/*
* Find the kernel image name
*/
if(!ReadSectionSettingByName(OSList[nOSToBoot].name, "Kernel", name, value))
{
MessageBox("Kernel image file not specified for selected operating system.");
return;
}
/*
* Get the boot partition
*/
BootPartition = 0;
if (ReadSectionSettingByName(OSList[nOSToBoot].name, "BootPartition", name, value))
BootPartition = atoi(value);
/*
* Make sure the boot drive is set in the .ini file
*/
if(!ReadSectionSettingByName(OSList[nOSToBoot].name, "BootDrive", name, value))
{
MessageBox("Boot drive not specified for selected operating system.");
return;
}
DrawBackdrop();
DrawStatusText(" Loading...");
DrawProgressBar(0);
/*
* Set the boot drive and try to open it
*/
BootDrive = atoi(value);
if (!OpenDiskDrive(BootDrive, BootPartition))
{
MessageBox("Failed to open boot drive.");
return;
}
/*
* Parse the ini file and count the kernel and drivers
*/
for (i=1; i<=GetNumSectionItems(OSList[nOSToBoot].name); i++)
{
/*
* Read the setting and check if it's a driver
*/
ReadSectionSettingByNumber(OSList[nOSToBoot].name, i, name, value);
if ((stricmp(name, "Kernel") == 0) || (stricmp(name, "Driver") == 0))
nNumDriverFiles++;
}
/*
* Parse the ini file and load the kernel and
* load all the drivers specified
*/
for (i=1; i<=GetNumSectionItems(OSList[nOSToBoot].name); i++)
{
/*
* Read the setting and check if it's a driver
*/
ReadSectionSettingByNumber(OSList[nOSToBoot].name, i, name, value);
if ((stricmp(name, "Kernel") == 0) || (stricmp(name, "Driver") == 0))
{
/*
* Set the name and try to open the PE image
*/
strcpy(szFileName, value);
if (!OpenFile(szFileName, &file))
{
strcat(value, " not found.");
MessageBox(value);
return;
}
/*
* Update the status bar with the current file
*/
strcpy(name, " Reading ");
strcat(name, value);
while (strlen(name) < 80)
strcat(name, " ");
DrawStatusText(name);
/*
* Load the driver
*/
ReactOSLoadPEImage(&file);
nNumFilesLoaded++;
DrawProgressBar((nNumFilesLoaded * 100) / nNumDriverFiles);
// Increment the number of files we loaded
boot_parameters.nr_files++;
}
else if (stricmp(name, "MessageBox") == 0)
{
DrawStatusText(" Press ENTER to continue");
MessageBox(value);
}
else if (stricmp(name, "MessageLine") == 0)
MessageLine(value);
else if (stricmp(name, "ReOpenBootDrive") == 0)
{
if (!OpenDiskDrive(BootDrive, BootPartition))
{
MessageBox("Failed to open boot drive.");
return;
}
}
}
/*
* End the list of modules we load with a zero length entry
* and update the end of kernel mem
*/
boot_parameters.module_lengths[boot_parameters.nr_files] = 0;
boot_parameters.end_mem = next_load_base;
/*
* Clear the screen and redraw the backdrop and status bar
*/
DrawBackdrop();
DrawStatusText(" Press any key to boot");
/*
* Wait for user
*/
strcpy(name, "Kernel and Drivers loaded.\nPress any key to boot ");
strcat(name, OSList[nOSToBoot].name);
strcat(name, ".");
//MessageBox(name);
RestoreScreen(pScreenBuffer);
/*
* Now boot the kernel
*/
stop_floppy();
ReactOSBootKernel();
}
void ReactOSMemInit(void)
{
int base;
/* Calculate the start of extended memory */
base = 0x100000;
/* Set the start of the page directory */
kernel_page_directory_base = base;
/*
* Set the start of the continuous range of physical memory
* occupied by the kernel
*/
start_mem = base;
base += 0x1000;
/* Calculate the start of the system page table (0xc0000000 upwards) */
system_page_table_base = base;
base += 0x1000;
/* Calculate the start of the page table to map the first 4mb */
lowmem_page_table_base = base;
base += 0x1000;
/* Set the position for the first module to be loaded */
load_base = base;
/* Set the address of the start of kernel code */
start_kernel = base;
}
void ReactOSBootKernel(void)
{
int i;
int *pPageDirectory = (int *)kernel_page_directory_base;
int *pLowMemPageTable = (int *)lowmem_page_table_base;
int *pSystemPageTable = (int *)system_page_table_base;
/* Zero out the kernel page directory */
for(i=0; i<1024; i++)
pPageDirectory[i] = 0;
/* Map in the lowmem page table */
pPageDirectory[(0x00/4)] = lowmem_page_table_base + 0x07;
/* Map in the lowmem page table (and reuse it for the identity map) */
pPageDirectory[(0xd00/4)] = lowmem_page_table_base + 0x07;
/* Map the page tables from the page directory */
pPageDirectory[(0xf00/4)] = kernel_page_directory_base + 0x07;
/* Map in the kernel page table */
pPageDirectory[(0xc00/4)] = system_page_table_base + 0x07;
/* Setup the lowmem page table */
for(i=0; i<1024; i++)
pLowMemPageTable[i] = (i * 4096) + 0x07;
/* Setup the system page table */
for(i=0; i<1024; i++)
pSystemPageTable[i] = ((i * 4096) + start_kernel) + 0x07;
boot_ros();
}
BOOL ReactOSLoadPEImage(FILE *pImage)
{
unsigned int Idx, ImageBase;
PULONG PEMagic;
PIMAGE_DOS_HEADER PEDosHeader;
PIMAGE_FILE_HEADER PEFileHeader;
PIMAGE_OPTIONAL_HEADER PEOptionalHeader;
PIMAGE_SECTION_HEADER PESectionHeaders;
ImageBase = next_load_base;
boot_parameters.module_lengths[boot_parameters.nr_files] = 0;
/*
* Load the headers
*/
ReadFile(pImage, 0x1000, (void *)next_load_base);
/*
* Get header pointers
*/
PEDosHeader = (PIMAGE_DOS_HEADER) next_load_base;
PEMagic = (PULONG) ((unsigned int) next_load_base +
PEDosHeader->e_lfanew);
PEFileHeader = (PIMAGE_FILE_HEADER) ((unsigned int) next_load_base +
PEDosHeader->e_lfanew + sizeof(ULONG));
PEOptionalHeader = (PIMAGE_OPTIONAL_HEADER) ((unsigned int) next_load_base +
PEDosHeader->e_lfanew + sizeof(ULONG) + sizeof(IMAGE_FILE_HEADER));
PESectionHeaders = (PIMAGE_SECTION_HEADER) ((unsigned int) next_load_base +
PEDosHeader->e_lfanew + sizeof(ULONG) + sizeof(IMAGE_FILE_HEADER) +
sizeof(IMAGE_OPTIONAL_HEADER));
/*
* Check file magic numbers
*/
if(PEDosHeader->e_magic != IMAGE_DOS_MAGIC)
{
MessageBox("Incorrect MZ magic");
return FALSE;
}
if(PEDosHeader->e_lfanew == 0)
{
MessageBox("Invalid lfanew offset");
return 0;
}
if(*PEMagic != IMAGE_PE_MAGIC)
{
MessageBox("Incorrect PE magic");
return 0;
}
if(PEFileHeader->Machine != IMAGE_FILE_MACHINE_I386)
{
MessageBox("Incorrect Architecture");
return 0;
}
/*
* Get header size and bump next_load_base
*/
next_load_base += ROUND_UP(PEOptionalHeader->SizeOfHeaders, PEOptionalHeader->SectionAlignment);
boot_parameters.module_lengths[boot_parameters.nr_files] += ROUND_UP(PEOptionalHeader->SizeOfHeaders, PEOptionalHeader->SectionAlignment);
boot_parameters.end_mem += ROUND_UP(PEOptionalHeader->SizeOfHeaders, PEOptionalHeader->SectionAlignment);
/*
* Copy image sections into virtual section
*/
// memcpy(DriverBase, ModuleLoadBase, PESectionHeaders[0].PointerToRawData);
// CurrentBase = (PVOID) ((DWORD)DriverBase + PESectionHeaders[0].PointerToRawData);
// CurrentSize = 0;
for (Idx = 0; Idx < PEFileHeader->NumberOfSections; Idx++)
{
/*
* Copy current section into current offset of virtual section
*/
if (PESectionHeaders[Idx].Characteristics &
(IMAGE_SECTION_CHAR_CODE | IMAGE_SECTION_CHAR_DATA))
{
//memcpy(PESectionHeaders[Idx].VirtualAddress + DriverBase,
// (PVOID)(ModuleLoadBase + PESectionHeaders[Idx].PointerToRawData),
// PESectionHeaders[Idx].Misc.VirtualSize /*SizeOfRawData*/);
//MessageBox("loading a section");
fseek(pImage, PESectionHeaders[Idx].PointerToRawData);
ReadFile(pImage, PESectionHeaders[Idx].Misc.VirtualSize /*SizeOfRawData*/, (void *)next_load_base);
//printf("PointerToRawData: %x\n", PESectionHeaders[Idx].PointerToRawData);
//printf("bytes at next_load_base: %x\n", *((unsigned long *)next_load_base));
//getch();
}
else
{
//memset(PESectionHeaders[Idx].VirtualAddress + DriverBase,
// '\0', PESectionHeaders[Idx].Misc.VirtualSize /*SizeOfRawData*/);
//MessageBox("zeroing a section");
memset((void *)next_load_base, '\0', PESectionHeaders[Idx].Misc.VirtualSize /*SizeOfRawData*/);
}
PESectionHeaders[Idx].PointerToRawData = next_load_base - ImageBase;
next_load_base += ROUND_UP(PESectionHeaders[Idx].Misc.VirtualSize, PEOptionalHeader->SectionAlignment);
boot_parameters.module_lengths[boot_parameters.nr_files] += ROUND_UP(PESectionHeaders[Idx].Misc.VirtualSize, PEOptionalHeader->SectionAlignment);
boot_parameters.end_mem += ROUND_UP(PESectionHeaders[Idx].Misc.VirtualSize, PEOptionalHeader->SectionAlignment);
//DrawProgressBar((Idx * 100) / PEFileHeader->NumberOfSections);
}
return TRUE;
}

75
freeldr/freeldr/rosboot.h Normal file
View File

@@ -0,0 +1,75 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ROSBOOT_H
#define __ROSBOOT_H
#include "freeldr.h"
#include "stdlib.h"
#include "pe.h"
#define PACKED __attribute__((packed))
void LoadAndBootReactOS(int nOSToBoot);
void ReactOSMemInit(void);
void ReactOSBootKernel(void);
BOOL ReactOSLoadPEImage(FILE *pImage);
void enable_a20(void);
void boot_ros(void);
// WARNING:
// This structure is prototyped here but allocated in ros.S
// if you change this prototype make sure to update ros.S
typedef struct
{
/*
* Magic value (useless really)
*/
unsigned int magic;
/*
* Cursor position
*/
unsigned int cursorx;
unsigned int cursory;
/*
* Number of files (including the kernel) loaded
*/
unsigned int nr_files;
/*
* Range of physical memory being used by the system
*/
unsigned int start_mem;
unsigned int end_mem;
/*
* List of module lengths (terminated by a 0)
*/
unsigned int module_lengths[64];
/*
* Kernel parameter string
*/
char kernel_parameters[256];
} boot_param PACKED;
#endif // defined __ROSBOOT_H

306
freeldr/freeldr/stdlib.c Normal file
View File

@@ -0,0 +1,306 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "stdlib.h"
/*
* print() - prints unformatted text to stdout
*/
void print(char *str)
{
int i;
for(i=0; i<strlen(str); i++)
putchar(str[i]);
}
/*
* convert_to_ascii() - converts a number to it's ascii equivalent
* from:
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
*/
char *convert_to_ascii(char *buf, int c, ...)
{
unsigned long num = *((&c) + 1), mult = 10;
char *ptr = buf;
if (c == 'x')
mult = 16;
if ((num & 0x80000000uL) && c == 'd')
{
num = (~num)+1;
*(ptr++) = '-';
buf++;
}
do
{
int dig = num % mult;
*(ptr++) = ( (dig > 9) ? dig + 'a' - 10 : '0' + dig );
}
while (num /= mult);
/* reorder to correct direction!! */
{
char *ptr1 = ptr-1;
char *ptr2 = buf;
while (ptr1 > ptr2)
{
int c = *ptr1;
*ptr1 = *ptr2;
*ptr2 = c;
ptr1--;
ptr2++;
}
}
return ptr;
}
/*
* printf() - prints formatted text to stdout
* from:
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
*/
void printf(char *format, ... )
{
int *dataptr = (int *) &format;
char c, *ptr, str[16];
dataptr++;
while ((c = *(format++)))
{
if (c != '%')
putchar(c);
else
switch (c = *(format++))
{
case 'd': case 'u': case 'x':
*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
ptr = str;
while (*ptr)
putchar(*(ptr++));
break;
case 'c': putchar((*(dataptr++))&0xff); break;
case 's':
ptr = (char *)(*(dataptr++));
while ((c = *(ptr++)))
putchar(c);
break;
}
}
}
int strlen(char *str)
{
int len;
for(len=0; str[len] != '\0'; len++);
return len;
}
char *itoa(int value, char *string, int radix)
{
if(radix == 16)
*convert_to_ascii(string, 'x', value) = 0;
else
*convert_to_ascii(string, 'd', value) = 0;
return string;
}
int toupper(int c)
{
if((c >= 'a') && (c <= 'z'))
c -= 32;
return c;
}
int tolower(int c)
{
if((c >= 'A') && (c <= 'Z'))
c += 32;
return c;
}
int memcmp(const void *buf1, const void *buf2, size_t count)
{
size_t i;
const char *buffer1 = buf1;
const char *buffer2 = buf2;
for(i=0; i<count; i++)
{
if(buffer1[i] == buffer2[i])
continue;
else
return (buffer1[i] - buffer2[i]);
}
return 0;
}
void *memcpy(void *dest, const void *src, size_t count)
{
size_t i;
char *buf1 = dest;
const char *buf2 = src;
for(i=0; i<count; i++)
buf1[i] = buf2[i];
return dest;
}
void *memset(void *dest, int c, size_t count)
{
size_t i;
char *buf1 = dest;
for(i=0; i<count; i++)
buf1[i] = c;
return dest;
}
char *strcpy(char *dest, char *src)
{
char *ret = dest;
while(*src)
*dest++ = *src++;
*dest = 0;
return ret;
}
char *strcat(char *dest, char *src)
{
char *ret = dest;
while(*dest)
dest++;
while(*src)
*dest++ = *src++;
*dest = 0;
return ret;
}
int strcmp(const char *string1, const char *string2)
{
while(*string1 == *string2)
{
if(*string1 == 0)
return 0;
string1++;
string2++;
}
return *(unsigned const char *)string1 - *(unsigned const char *)(string2);
}
int stricmp(const char *string1, const char *string2)
{
while(tolower(*string1) == tolower(*string2))
{
if(*string1 == 0)
return 0;
string1++;
string2++;
}
return (int)tolower(*string1) - (int)tolower(*string2);
}
char *fgets(char *string, int n, FILE *stream)
{
int i;
for(i=0; i<(n-1); i++)
{
if(feof(stream))
{
i++;
break;
}
ReadFile(stream, 1, string+i);
if(string[i] == '\n')
{
i++;
break;
}
}
string[i] = '\0';
return string;
}
int atoi(char *string)
{
int i, j;
int base;
int result = 0;
char *str;
if((string[0] == '0') && (string[1] == 'x'))
{
base = 16;
str = string + 2;
}
else
{
base = 10;
str = string;
}
for(i=strlen(str)-1,j=1; i>=0; i--)
{
if((str[i] < '0') || (str[i] > '9'))
break;
if(i == (strlen(str)-1))
result += (str[i] - '0');
else
{
result += (str[i] - '0') * (j * base);
j *= base;
}
}
return result;
}

74
freeldr/freeldr/stdlib.h Normal file
View File

@@ -0,0 +1,74 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __STDLIB_H
#define __STDLIB_H
#include "fs.h"
void putchar(int ch); // Implemented in asmcode.S
void clrscr(void); // Implemented in asmcode.S
int kbhit(void); // Implemented in asmcode.S
int getch(void); // Implemented in asmcode.S
void gotoxy(int x, int y); // Implemented in asmcode.S
int getyear(void); // Implemented in asmcode.S
int getday(void); // Implemented in asmcode.S
int getmonth(void); // Implemented in asmcode.S
int gethour(void); // Implemented in asmcode.S
int getminute(void); // Implemented in asmcode.S
int getsecond(void); // Implemented in asmcode.S
void hidecursor(void); // Implemented in asmcode.S
void showcursor(void); // Implemented in asmcode.S
int wherex(void); // Implemented in asmcode.S
int wherey(void); // Implemented in asmcode.S
int strlen(char *str);
char *strcpy(char *dest, char *src);
char *strcat(char *dest, char *src);
int strcmp(const char *string1, const char *string2);
int stricmp(const char *string1, const char *string2);
char *itoa(int value, char *string, int radix);
int toupper(int c);
int tolower(int c);
int memcmp(const void *buf1, const void *buf2, size_t count);
void *memcpy(void *dest, const void *src, size_t count);
void *memset(void *dest, int c, size_t count);
char *fgets(char *string, int n, FILE *stream);
int atoi(char *string);
void print(char *str);
void printf(char *fmt, ...);
int biosdisk(int cmd, int drive, int head, int track, int sector, int nsects, void *buffer); // Implemented in asmcode.S
void stop_floppy(void); // Implemented in asmcode.S
int get_heads(int drive); // Implemented in asmcode.S
int get_cylinders(int drive); // Implemented in asmcode.S
int get_sectors(int drive); // Implemented in asmcode.S
/* Values for biosdisk() */
#define _DISK_RESET 0 // Unimplemented
#define _DISK_STATUS 1 // Unimplemented
#define _DISK_READ 2 // Reads a sector into memory
#define _DISK_WRITE 3 // Unimplemented
#define _DISK_VERIFY 4 // Unimplemented
#define _DISK_FORMAT 5 // Unimplemented
#endif // defined __STDLIB_H

572
freeldr/freeldr/tui.c Normal file
View File

@@ -0,0 +1,572 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "stdlib.h"
#include "tui.h"
int nScreenWidth = 80; // Screen Width
int nScreenHeight = 25; // Screen Height
char cStatusBarFgColor = COLOR_BLACK; // Status bar foreground color
char cStatusBarBgColor = COLOR_CYAN; // Status bar background color
char cBackdropFgColor = COLOR_WHITE; // Backdrop foreground color
char cBackdropBgColor = COLOR_BLUE; // Backdrop background color
char cBackdropFillStyle = MEDIUM_FILL; // Backdrop fill style
char cTitleBoxFgColor = COLOR_WHITE; // Title box foreground color
char cTitleBoxBgColor = COLOR_RED; // Title box background color
char cMessageBoxFgColor = COLOR_WHITE; // Message box foreground color
char cMessageBoxBgColor = COLOR_BLUE; // Message box background color
char cMenuFgColor = COLOR_WHITE; // Menu foreground color
char cMenuBgColor = COLOR_BLUE; // Menu background color
char cTextColor = COLOR_YELLOW; // Normal text color
char cSelectedTextColor = COLOR_BLACK; // Selected text color
char cSelectedTextBgColor = COLOR_GRAY; // Selected text background color
char szTitleBoxTitleText[260] = "Boot Menu"; // Title box's title text
char szMessageBoxLineText[4000] = "";
void DrawBackdrop(void)
{
// Fill in the backdrop
FillArea(0, 0, nScreenWidth-1, nScreenHeight-1, cBackdropFillStyle, ATTR(cBackdropFgColor, cBackdropBgColor));
// Draw the title box
DrawBox(1, 1, nScreenWidth, 5, D_VERT, D_HORZ, TRUE, FALSE, ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
// Draw version
DrawText(3, 2, VERSION, ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
// Draw copyright
DrawText(3, 3, "by Brian Palmer", ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
DrawText(3, 4, "<brianp@sginet.com>", ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
// Draw help text
//DrawText(nScreenWidth-15, 4, /*"F1 for Help"*/"F8 for Options", ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
// Draw title
DrawText((nScreenWidth/2)-(strlen(szTitleBoxTitleText)/2), 3, szTitleBoxTitleText, ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
// Draw date
DrawText(nScreenWidth-9, 2, "01/02/03", ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
// Draw time
DrawText(nScreenWidth-9, 3, "10:12:34", ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
// Draw status bar
DrawStatusText("");
// Update the date & time
UpdateDateTime();
}
/*
* FillArea()
* This function assumes coordinates are zero-based
*/
void FillArea(int nLeft, int nTop, int nRight, int nBottom, char cFillChar, char cAttr /* Color Attributes */)
{
char *screen = (char *)SCREEN_MEM;
int i, j;
for(i=nTop; i<=nBottom; i++)
{
for(j=nLeft; j<=nRight; j++)
{
screen[((i*2)*nScreenWidth)+(j*2)] = cFillChar;
screen[((i*2)*nScreenWidth)+(j*2)+1] = cAttr;
}
}
}
/*
* DrawShadow()
* This function assumes coordinates are zero-based
*/
void DrawShadow(int nLeft, int nTop, int nRight, int nBottom)
{
char *screen = (char *)SCREEN_MEM;
int i;
// Shade the bottom of the area
if(nBottom < (nScreenHeight-1))
{
for(i=nLeft+2; i<=nRight; i++)
screen[(((nBottom+1)*2)*nScreenWidth)+(i*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
}
// Shade the right of the area
if(nRight < (nScreenWidth-1))
{
for(i=nTop+1; i<=nBottom; i++)
screen[((i*2)*nScreenWidth)+((nRight+1)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
}
if(nRight+1 < (nScreenWidth-1))
{
for(i=nTop+1; i<=nBottom; i++)
screen[((i*2)*nScreenWidth)+((nRight+2)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
}
// Shade the bottom right corner
if((nRight < (nScreenWidth-1)) && (nBottom < (nScreenHeight-1)))
screen[(((nBottom+1)*2)*nScreenWidth)+((nRight+1)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
if((nRight+1 < (nScreenWidth-1)) && (nBottom < (nScreenHeight-1)))
screen[(((nBottom+1)*2)*nScreenWidth)+((nRight+2)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
}
/*
* DrawBox()
* This function assumes coordinates are one-based
*/
void DrawBox(int nLeft, int nTop, int nRight, int nBottom, int nVertStyle, int nHorzStyle, int bFill, int bShadow, char cAttr)
{
char cULCorner, cURCorner, cLLCorner, cLRCorner;
char cHorz, cVert;
nLeft--;
nTop--;
nRight--;
nBottom--;
cHorz = nHorzStyle;
cVert = nVertStyle;
if(nHorzStyle == HORZ)
{
if(nVertStyle == VERT)
{
cULCorner = UL;
cURCorner = UR;
cLLCorner = LL;
cLRCorner = LR;
}
else // nVertStyle == D_VERT
{
cULCorner = VD_UL;
cURCorner = VD_UR;
cLLCorner = VD_LL;
cLRCorner = VD_LR;
}
}
else // nHorzStyle == D_HORZ
{
if(nVertStyle == VERT)
{
cULCorner = HD_UL;
cURCorner = HD_UR;
cLLCorner = HD_LL;
cLRCorner = HD_LR;
}
else // nVertStyle == D_VERT
{
cULCorner = D_UL;
cURCorner = D_UR;
cLLCorner = D_LL;
cLRCorner = D_LR;
}
}
// Fill in box background
if(bFill)
FillArea(nLeft, nTop, nRight, nBottom, ' ', cAttr);
// Fill in corners
FillArea(nLeft, nTop, nLeft, nTop, cULCorner, cAttr);
FillArea(nRight, nTop, nRight, nTop, cURCorner, cAttr);
FillArea(nLeft, nBottom, nLeft, nBottom, cLLCorner, cAttr);
FillArea(nRight, nBottom, nRight, nBottom, cLRCorner, cAttr);
// Fill in left line
FillArea(nLeft, nTop+1, nLeft, nBottom-1, cVert, cAttr);
// Fill in top line
FillArea(nLeft+1, nTop, nRight-1, nTop, cHorz, cAttr);
// Fill in right line
FillArea(nRight, nTop+1, nRight, nBottom-1, cVert, cAttr);
// Fill in bottom line
FillArea(nLeft+1, nBottom, nRight-1, nBottom, cHorz, cAttr);
if(bShadow)
DrawShadow(nLeft, nTop, nRight, nBottom);
}
/*
* DrawText()
* This function assumes coordinates are one-based
*/
void DrawText(int nX, int nY, char *text, char cAttr)
{
char *screen = (char *)SCREEN_MEM;
int i, j;
nX--;
nY--;
// Draw the text
for(i=nX, j=0; text[j]; i++,j++)
{
screen[((nY*2)*nScreenWidth)+(i*2)] = text[j];
screen[((nY*2)*nScreenWidth)+(i*2)+1] = cAttr;
}
}
void DrawStatusText(char *text)
{
int i;
DrawText(1, nScreenHeight, text, ATTR(cStatusBarFgColor, cStatusBarBgColor));
for(i=strlen(text)+1; i<=nScreenWidth; i++)
DrawText(i, nScreenHeight, " ", ATTR(cStatusBarFgColor, cStatusBarBgColor));
}
void UpdateDateTime(void)
{
char date[260];
char time[260];
char temp[20];
int hour, minute, second, bPM=FALSE;
switch(getmonth())
{
case 1:
strcpy(date, "January ");
break;
case 2:
strcpy(date, "February ");
break;
case 3:
strcpy(date, "March ");
break;
case 4:
strcpy(date, "April ");
break;
case 5:
strcpy(date, "May ");
break;
case 6:
strcpy(date, "June ");
break;
case 7:
strcpy(date, "July ");
break;
case 8:
strcpy(date, "August ");
break;
case 9:
strcpy(date, "September ");
break;
case 10:
strcpy(date, "October ");
break;
case 11:
strcpy(date, "November ");
break;
case 12:
strcpy(date, "December ");
break;
}
itoa(getday(), temp, 10);
if((getday() == 1) || (getday() == 21) || (getday() == 31))
strcat(temp, "st");
else if((getday() == 2) || (getday() == 22))
strcat(temp, "nd");
else if((getday() == 3) || (getday() == 23))
strcat(temp, "rd");
else
strcat(temp, "th");
strcat(date, temp);
strcat(date, " ");
itoa(getyear(), temp, 10);
strcat(date, temp);
// Draw the date
DrawText(nScreenWidth-strlen(date)-1, 2, date, ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
hour = gethour();
if(hour > 12)
{
hour -= 12;
bPM = TRUE;
}
if (hour == 0)
hour = 12;
minute = getminute();
second = getsecond();
itoa(hour, temp, 10);
strcpy(time, " ");
strcat(time, temp);
strcat(time, ":");
itoa(minute, temp, 10);
if(minute < 10)
strcat(time, "0");
strcat(time, temp);
strcat(time, ":");
itoa(second, temp, 10);
if(second < 10)
strcat(time, "0");
strcat(time, temp);
if(bPM)
strcat(time, " PM");
else
strcat(time, " AM");
// Draw the time
DrawText(nScreenWidth-strlen(time)-1, 3, time, ATTR(cTitleBoxFgColor, cTitleBoxBgColor));
}
void SaveScreen(char *buffer)
{
char *screen = (char *)SCREEN_MEM;
int i;
for(i=0; i < (nScreenWidth * nScreenHeight * 2); i++)
buffer[i] = screen[i];
}
void RestoreScreen(char *buffer)
{
char *screen = (char *)SCREEN_MEM;
int i;
for(i=0; i < (nScreenWidth * nScreenHeight * 2); i++)
screen[i] = buffer[i];
}
void MessageBox(char *text)
{
int width = 8;
int height = 1;
int curline = 0;
int i , j, k;
int x1, x2, y1, y2;
char savebuffer[8000];
char temp[260];
char key;
SaveScreen(savebuffer);
strcat(szMessageBoxLineText, text);
// Find the height
for(i=0; i<strlen(szMessageBoxLineText); i++)
{
if(szMessageBoxLineText[i] == '\n')
height++;
}
// Find the width
for(i=0,j=0,k=0; i<height; i++)
{
while((szMessageBoxLineText[j] != '\n') && (szMessageBoxLineText[j] != 0))
{
j++;
k++;
}
if(k > width)
width = k;
k = 0;
j++;
}
// Calculate box area
x1 = (nScreenWidth - (width+2))/2;
x2 = x1 + width + 3;
y1 = ((nScreenHeight - height - 2)/2) + 1;
y2 = y1 + height + 4;
// Draw the box
DrawBox(x1, y1, x2, y2, D_VERT, D_HORZ, TRUE, TRUE, ATTR(cMessageBoxFgColor, cMessageBoxBgColor));
// Draw the text
for(i=0,j=0; i<strlen(szMessageBoxLineText)+1; i++)
{
if((szMessageBoxLineText[i] == '\n') || (szMessageBoxLineText[i] == 0))
{
temp[j] = 0;
j = 0;
DrawText(x1+2, y1+1+curline, temp, ATTR(cMessageBoxFgColor, cMessageBoxBgColor));
curline++;
}
else
temp[j++] = szMessageBoxLineText[i];
}
// Draw OK button
strcpy(temp, " OK ");
DrawText(x1+((x2-x1)/2)-3, y2-2, temp, ATTR(COLOR_BLACK, COLOR_GRAY));
for(;;)
{
if(kbhit())
{
key = getch();
if(key == KEY_EXTENDED)
key = getch();
if(key == KEY_ENTER)
break;
else if(key == KEY_SPACE)
break;
}
UpdateDateTime();
}
RestoreScreen(savebuffer);
UpdateDateTime();
strcpy(szMessageBoxLineText, "");
}
void MessageLine(char *text)
{
strcat(szMessageBoxLineText, text);
strcat(szMessageBoxLineText, "\n");
}
BOOL IsValidColor(char *color)
{
if(stricmp(color, "Black") == 0)
return TRUE;
else if(stricmp(color, "Blue") == 0)
return TRUE;
else if(stricmp(color, "Green") == 0)
return TRUE;
else if(stricmp(color, "Cyan") == 0)
return TRUE;
else if(stricmp(color, "Red") == 0)
return TRUE;
else if(stricmp(color, "Magenta") == 0)
return TRUE;
else if(stricmp(color, "Brown") == 0)
return TRUE;
else if(stricmp(color, "Gray") == 0)
return TRUE;
else if(stricmp(color, "DarkGray") == 0)
return TRUE;
else if(stricmp(color, "LightBlue") == 0)
return TRUE;
else if(stricmp(color, "LightGreen") == 0)
return TRUE;
else if(stricmp(color, "LightCyan") == 0)
return TRUE;
else if(stricmp(color, "LightRed") == 0)
return TRUE;
else if(stricmp(color, "LightMagenta") == 0)
return TRUE;
else if(stricmp(color, "Yellow") == 0)
return TRUE;
else if(stricmp(color, "White") == 0)
return TRUE;
return FALSE;
}
char TextToColor(char *color)
{
if(stricmp(color, "Black") == 0)
return COLOR_BLACK;
else if(stricmp(color, "Blue") == 0)
return COLOR_BLUE;
else if(stricmp(color, "Green") == 0)
return COLOR_GREEN;
else if(stricmp(color, "Cyan") == 0)
return COLOR_CYAN;
else if(stricmp(color, "Red") == 0)
return COLOR_RED;
else if(stricmp(color, "Magenta") == 0)
return COLOR_MAGENTA;
else if(stricmp(color, "Brown") == 0)
return COLOR_BROWN;
else if(stricmp(color, "Gray") == 0)
return COLOR_GRAY;
else if(stricmp(color, "DarkGray") == 0)
return COLOR_DARKGRAY;
else if(stricmp(color, "LightBlue") == 0)
return COLOR_LIGHTBLUE;
else if(stricmp(color, "LightGreen") == 0)
return COLOR_LIGHTGREEN;
else if(stricmp(color, "LightCyan") == 0)
return COLOR_LIGHTCYAN;
else if(stricmp(color, "LightRed") == 0)
return COLOR_LIGHTRED;
else if(stricmp(color, "LightMagenta") == 0)
return COLOR_LIGHTMAGENTA;
else if(stricmp(color, "Yellow") == 0)
return COLOR_YELLOW;
else if(stricmp(color, "White") == 0)
return COLOR_WHITE;
return COLOR_BLACK;
}
BOOL IsValidFillStyle(char *fill)
{
if(stricmp(fill, "Light") == 0)
return TRUE;
else if(stricmp(fill, "Medium") == 0)
return TRUE;
else if(stricmp(fill, "Dark") == 0)
return TRUE;
return FALSE;
}
char TextToFillStyle(char *fill)
{
if(stricmp(fill, "Light") == 0)
return LIGHT_FILL;
else if(stricmp(fill, "Medium") == 0)
return MEDIUM_FILL;
else if(stricmp(fill, "Dark") == 0)
return DARK_FILL;
return LIGHT_FILL;
}
void DrawProgressBar(int nPos)
{
int left, top, right, bottom;
int width = 50; // Allow for 50 "bars"
int height = 2;
int i;
if(nPos > 100)
nPos = 100;
left = (nScreenWidth - width - 4) / 2;
right = left + width + 3;
top = (nScreenHeight - height - 2) / 2;
top += 4;
bottom = top + height + 1;
// Draw the box
DrawBox(left, top, right, bottom, VERT, HORZ, TRUE, TRUE, ATTR(cMenuFgColor, cMenuBgColor));
// Draw the "Loading..." text
DrawText(70/2, top+1, "Loading...", ATTR(cTextColor, cMenuBgColor));
// Draw the percent complete
for(i=0; i<(nPos/2); i++)
DrawText(left+2+i, top+2, "\xDB", ATTR(cTextColor, cMenuBgColor));
// Draw the rest
for(; i<50; i++)
DrawText(left+2+i, top+2, "\xB2", ATTR(cTextColor, cMenuBgColor));
UpdateDateTime();
}

162
freeldr/freeldr/tui.h Normal file
View File

@@ -0,0 +1,162 @@
/*
* FreeLoader
* Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __TUI_H
#define __TUI_H
#define SCREEN_MEM 0xB8000
extern int nScreenWidth; // Screen Width
extern int nScreenHeight; // Screen Height
extern char cStatusBarFgColor; // Status bar foreground color
extern char cStatusBarBgColor; // Status bar background color
extern char cBackdropFgColor; // Backdrop foreground color
extern char cBackdropBgColor; // Backdrop background color
extern char cBackdropFillStyle; // Backdrop fill style
extern char cTitleBoxFgColor; // Title box foreground color
extern char cTitleBoxBgColor; // Title box background color
extern char cMessageBoxFgColor; // Message box foreground color
extern char cMessageBoxBgColor; // Message box background color
extern char cMenuFgColor; // Menu foreground color
extern char cMenuBgColor; // Menu background color
extern char cTextColor; // Normal text color
extern char cSelectedTextColor; // Selected text color
extern char cSelectedTextBgColor; // Selected text background color
extern char szTitleBoxTitleText[260]; // Title box's title text
// Fills the entire screen with a backdrop
void DrawBackdrop(void);
// Fills the area specified with cFillChar and cAttr
void FillArea(int nLeft, int nTop, int nRight, int nBottom, char cFillChar, char cAttr /* Color Attributes */);
// Draws a shadow on the bottom and right sides of the area specified
void DrawShadow(int nLeft, int nTop, int nRight, int nBottom);
// Draws a box around the area specified
void DrawBox(int nLeft, int nTop, int nRight, int nBottom, int nVertStyle, int nHorzStyle, int bFill, int bShadow, char cAttr);
// Draws text at coordinates specified
void DrawText(int nX, int nY, char *text, char cAttr);
// Draws text at the very bottom line on the screen
void DrawStatusText(char *text);
// Updates the date and time
void UpdateDateTime(void);
// Saves the screen so that it can be restored later
void SaveScreen(char *buffer);
// Restores the screen from a previous save
void RestoreScreen(char *buffer);
// Displays a message box on the screen with an ok button
void MessageBox(char *text);
// Adds a line of text to the message box buffer
void MessageLine(char *text);
// Returns true if color is valid
BOOL IsValidColor(char *color);
// Converts the text color into it's equivalent color value
char TextToColor(char *color);
// Returns true if fill is valid
BOOL IsValidFillStyle(char *fill);
// Converts the text fill into it's equivalent fill value
char TextToFillStyle(char *fill);
// Draws the progress bar showing nPos percent filled
void DrawProgressBar(int nPos);
/*
* Combines the foreground and background colors into a single attribute byte
*/
#define ATTR(cFore, cBack) ((cBack << 4)|cFore)
/*
* Fill styles for DrawBackdrop()
*/
#define LIGHT_FILL 0xB0
#define MEDIUM_FILL 0xB1
#define DARK_FILL 0xB2
/*
* Screen colors
*/
#define COLOR_BLACK 0
#define COLOR_BLUE 1
#define COLOR_GREEN 2
#define COLOR_CYAN 3
#define COLOR_RED 4
#define COLOR_MAGENTA 5
#define COLOR_BROWN 6
#define COLOR_GRAY 7
#define COLOR_DARKGRAY 8
#define COLOR_LIGHTBLUE 9
#define COLOR_LIGHTGREEN 10
#define COLOR_LIGHTCYAN 11
#define COLOR_LIGHTRED 12
#define COLOR_LIGHTMAGENTA 13
#define COLOR_YELLOW 14
#define COLOR_WHITE 15
/* Add COLOR_BLINK to a background to cause blinking */
#define COLOR_BLINK 8
/*
* Defines for IBM box drawing characters
*/
#define HORZ (0xc4) /* Single horizontal line */
#define D_HORZ (0xcd) /* Double horizontal line.*/
#define VERT (0xb3) /* Single vertical line */
#define D_VERT (0xba) /* Double vertical line. */
/* Definitions for corners, depending on HORIZ and VERT */
#define UL (0xda)
#define UR (0xbf) /* HORZ and VERT */
#define LL (0xc0)
#define LR (0xd9)
#define D_UL (0xc9)
#define D_UR (0xbb) /* D_HORZ and D_VERT */
#define D_LL (0xc8)
#define D_LR (0xbc)
#define HD_UL (0xd5)
#define HD_UR (0xb8) /* D_HORZ and VERT */
#define HD_LL (0xd4)
#define HD_LR (0xbe)
#define VD_UL (0xd6)
#define VD_UR (0xb7) /* HORZ and D_VERT */
#define VD_LL (0xd3)
#define VD_LR (0xbd)
// Key codes
#define KEY_EXTENDED 0x00
#define KEY_ENTER 0x0D
#define KEY_SPACE 0x20
#define KEY_UP 0x48
#define KEY_DOWN 0x50
#define KEY_LEFT 0x4B
#define KEY_RIGHT 0x4D
#define KEY_ESC 0x1B
#define KEY_F1 0x3B
#define KEY_F2 0x3C
#define KEY_F3 0x3D
#define KEY_F4 0x3E
#define KEY_F5 0x3F
#define KEY_F6 0x40
#define KEY_F7 0x41
#define KEY_F8 0x42
#define KEY_F9 0x43
#define KEY_F10 0x44
#endif // #defined __TUI_H

5
freeldr/install.bat Normal file
View File

@@ -0,0 +1,5 @@
cd bootsect
call install.bat
cd..
copy freeldr.sys a:\
copy freeldr.ini a:\

18
freeldr/notes.txt Normal file
View File

@@ -0,0 +1,18 @@
FreeLoader notes
To build FreeLoader you will need DJGPP because Mingw32 doesn't support 16-bit code
FreeLoader does not currently work with extended partitions.
Linux booting support needs to be added.
ext2 filesystem support needs to be added.
Current memory layout:
0000:0000 - 0000:0FFF: Interrupt vector table & BIOS data
0000:1000 - 0000:6FFF: Real mode stack area
0000:7000 - xxxx:xxxx: FreeLoader program & data area
xxxx:xxxx - 6000:0000: Protected mode stack area & heap
6000:0000 - 6000:C000: Filesystem data buffer
6000:C000 - 7000:0000: FREELDR.INI loaded here
7000:0000 - 7000:FFFF: scratch area for any function's use (ie sector buffer for biosdisk()) - can be overwritten by any function
8000:0000 - 9000:FFFF: fat table entry buffer
A000:0000 - FFFF:FFFF: reserved

View File

@@ -1,2 +0,0 @@
dist
errors

View File

@@ -1,14 +0,0 @@
In no particular order
Rex Jolliff (rex@lvcablemodem.com)
Boudewijn Dekker (ariadne@xs4all.nl)
Eric Kohl (ekohl@abo.rhein-zeitung.de)
Emanuele Aliberti (ea@iol.it)
David Welch (welch@cwcom.net)
Iwan Fatahi (i_fatahi@hotmail.com)
Robert Bergkvist (fragdance@hotmail.com)
Victor Kirhenshtein (sauros@iname.com)
Jason Filby (jasonfilby@yahoo.com)
Brian Palmer (brianp@sginet.com)
Phillip Susi (phreak@iag.net)
Paolo Pantaleo (paolopan@freemail.it)

View File

@@ -1,12 +0,0 @@
9/6/99: Implemented ZwOpenProcess
Partially implemented killing other threads (possible memory
leaks)
Made a start on a proper implemention of APCs (based on
article in NT insider)
8/12/98: Corrected bug in shell (Read two keypresses and assumed they
where the key going up and down respectively)
Corrected race in dpc handling
Took out cleanup sections in ZwReadFile (now handled by the APC)
Disabled broken code in kernel32

View File

@@ -1,31 +0,0 @@
1. Build environment
To build the system you need either mingw32 installed on Windows or a
mingw32 cross compiler running on unix.
2. Building
To build from Windows run make. To build from unix, edit rules.mak and change
the PREFIX variable to the correct value for your cross-compiler, then run
'make'.
3. Installation
Installation isn't yet automated, sorry. The system can only be installed on
the first partition which must be formatted for DOS. Set up a directory
structure like the following
make directories C:\reactos,C:\reactos\system,C:\reactos\system\drivers
Copy apps/shell/shell.exe to C:\reactos\system32
Copy subsys/smss/smss.exe to C:\reactos\system32
Copy services/dd/keyboard/keyboard.sys to C:\reactos\system32\drivers
Copy services/dd/blue/blue.sys to C:\reactos\system32\drivers
Copy lib/ntdll/ntdll.dll to C:\reactos\system32
Copy lib/kernel32/kernel32.dll to C:\reactos\system32
Copy lib/crtdll/crtdll.dll to C:\reactos\system32
The system can only be started from DOS. Copy the following files,
services/dd/ide/ide.sys, services/fs/vfat/vfatfsd.sys and
loaders/dos/loadros.com, to a suitable directory. The system can then be
booted with the command 'loadros.com ide.sys vfatfsd.sys'.

View File

@@ -1,280 +0,0 @@
#
# Global makefile
#
#
# Select your host
#
#HOST = mingw32-linux
#HOST = djgpp-msdos
#HOST = mingw32-windows
include rules.mak
#
# Required to run the system
#
COMPONENTS = iface_native ntoskrnl
DLLS = ntdll kernel32 crtdll advapi32 fmifs gdi32
#DLLS = mingw32 user32
SUBSYS = smss win32k
#SUBSYS = csrss
#
# Select the server(s) you want to build
#
SERVERS = win32
# SERVERS = posix linux os2
#
# Select the loader(s) you want to build
#
LOADERS = dos
# LOADERS = boot
#
# Select the device drivers and filesystems you want
#
DEVICE_DRIVERS = blue ide keyboard null parallel serial
# DEVICE_DRIVERS = beep event floppy ide_test mouse sound test test1
FS_DRIVERS = vfat
# FS_DRIVERS = minix ext2 template
KERNEL_SERVICES = $(DEVICE_DRIVERS) $(FS_DRIVERS)
APPS = args hello shell test cat bench apc shm lpc thread event
all: buildno $(COMPONENTS) $(DLLS) $(SUBSYS) $(LOADERS) $(KERNEL_SERVICES) $(APPS)
.PHONY: all
clean: buildno_clean $(COMPONENTS:%=%_clean) $(DLLS:%=%_clean) $(LOADERS:%=%_clean) \
$(KERNEL_SERVICES:%=%_clean) $(SUBSYS:%=%_clean) $(APPS:%=%_clean)
.PHONY: clean
floppy: make_floppy_dirs autoexec_floppy $(COMPONENTS:%=%_floppy) \
$(DLLS:%=%_floppy) $(LOADERS:%=%_floppy) \
$(KERNEL_SERVICES:%=%_floppy) $(SUBSYS:%=%_floppy) \
$(APPS:%=%_floppy)
dist: clean_dist_dir make_dist_dirs $(COMPONENTS:%=%_dist) $(DLLS:%=%_dist) \
$(LOADERS:%=%_dist) $(KERNEL_SERVICES:%=%_dist) $(SUBSYS:%=%_dist) \
$(APPS:%=%_dist)
#
# Build number generator
#
buildno: include/reactos/version.h
make -C apps/buildno
buildno_clean:
make -C apps/buildno clean
buildno_floppy:
buildno_dist:
.PHONY: buildno buildno_clean buildno_floppy buildno_dist
#
# Applications
#
$(APPS): %:
make -C apps/$*
$(APPS:%=%_clean): %_clean:
make -C apps/$* clean
$(APPS:%=%_floppy): %_floppy:
make -C apps/$* floppy
$(APPS:%=%_dist): %_dist:
make -C apps/$* dist
.PHONY: $(APPS) $(APPS:%=%_clean) $(APPS:%=%_floppy) $(APPS:%=%_dist)
#
# Interfaces
#
iface_native:
make -C iface/native
iface_native_clean:
make -C iface/native clean
iface_native_floppy:
iface_native_dist:
.PHONY: iface_native iface_native_clean iface_native_floppy \
iface_native_dist
#
# Device driver rules
#
$(DEVICE_DRIVERS): %:
make -C services/dd/$*
$(DEVICE_DRIVERS:%=%_clean): %_clean:
make -C services/dd/$* clean
$(DEVICE_DRIVERS:%=%_floppy): %_floppy:
make -C services/dd/$* floppy
$(DEVICE_DRIVERS:%=%_dist): %_dist:
make -C services/dd/$* dist
.PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_clean) \
$(DEVICE_DRIVERS:%=%_floppy) $(DEVICE_DRIVERS:%=%_dist)
$(FS_DRIVERS): %:
make -C services/fs/$*
$(FS_DRIVERS:%=%_clean): %_clean:
make -C services/fs/$* clean
$(FS_DRIVERS:%=%_floppy): %_floppy:
make -C services/fs/$* floppy
$(FS_DRIVERS:%=%_dist): %_dist:
make -C services/fs/$* dist
.PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_clean) $(FS_DRIVERS:%=%_floppy) \
$(FS_DRIVERS:%=%_dist)
#
# Kernel loaders
#
$(LOADERS): %:
make -C loaders/$*
$(LOADERS:%=%_clean): %_clean:
make -C loaders/$* clean
$(LOADERS:%=%_floppy): %_floppy:
make -C loaders/$* floppy
$(LOADERS:%=%_dist): %_dist:
make -C loaders/$* dist
.PHONY: $(LOADERS) $(LOADERS:%=%_clean) $(LOADERS:%=%_floppy) \
$(LOADERS:%=%_dist)
#
# Required system components
#
ntoskrnl:
make -C ntoskrnl
ntoskrnl_clean:
make -C ntoskrnl clean
ntoskrnl_floppy:
make -C ntoskrnl floppy
ntoskrnl_dist:
make -C ntoskrnl dist
.PHONY: ntoskrnl ntoskrnl_clean ntoskrnl_floppy ntoskrnl_dist
#
# Required DLLs
#
$(DLLS): %:
make -C lib/$*
$(DLLS:%=%_clean): %_clean:
make -C lib/$* clean
$(DLLS:%=%_floppy): %_floppy:
make -C lib/$* floppy
$(DLLS:%=%_dist): %_dist:
make -C lib/$* dist
.PHONY: $(DLLS) $(DLLS:%=%_clean) $(DLLS:%=%_floppy) $(DLLS:%=%_dist)
#
# Kernel Subsystems
#
$(SUBSYS): %:
make -C subsys/$*
$(SUBSYS:%=%_clean): %_clean:
make -C subsys/$* clean
$(SUBSYS:%=%_floppy): %_floppy:
make -C subsys/$* floppy
$(SUBSYS:%=%_dist): %_dist:
make -C subsys/$* dist
.PHONY: $(SUBSYS) $(SUBSYS:%=%_clean) $(SUBSYS:%=%_floppy) \
$(SUBSYS:%=%_dist)
#
# Make an install floppy
#
install: all
./install.sh /mnt/hda1
make_floppy_dirs:
ifeq ($(DOSCLI),yes)
mkdir $(FLOPPY_DIR)\dlls
mkdir $(FLOPPY_DIR)\apps
mkdir $(FLOPPY_DIR)\drivers
mkdir $(FLOPPY_DIR)\subsys
else
mkdir $(FLOPPY_DIR)/dlls $(FLOPPY_DIR)/apps $(FLOPPY_DIR)/drivers
mkdir $(FLOPPY_DIR)/subsys
endif
.PHONY: make_floppy_dirs
autoexec_floppy: $(FLOPPY_DIR)/autoexec.bat
$(FLOPPY_DIR)/autoexec.bat: bootflop.bat
ifeq ($(DOSCLI),yes)
$(CP) bootflop.bat $(FLOPPY_DIR)\autoexec.bat
else
$(CP) bootflop.bat $(FLOPPY_DIR)/autoexec.bat
endif
#
# Make a distribution saveset
#
clean_dist_dir:
ifeq ($(DOSCLI),yes)
- $(RM) $(DIST_DIR)\dlls\*.dll
- $(RM) $(DIST_DIR)\apps\*.exe
- $(RM) $(DIST_DIR)\drivers\*.sys
- $(RM) $(DIST_DIR)\subsys\*.exe
- $(RMDIR) $(DIST_DIR)\dlls
- $(RMDIR) $(DIST_DIR)\apps
- $(RMDIR) $(DIST_DIR)\drivers
- $(RMDIR) $(DIST_DIR)\subsys
- $(RMDIR) $(DIST_DIR)
else
$(RM) -r $(DIST_DIR)
endif
make_dist_dirs:
ifeq ($(DOSCLI),yes)
mkdir $(DIST_DIR)
mkdir $(DIST_DIR)\dlls
mkdir $(DIST_DIR)\apps
mkdir $(DIST_DIR)\drivers
mkdir $(DIST_DIR)\dlls
mkdir $(DIST_DIR)\subsys
else
mkdir $(DIST_DIR) $(DIST_DIR)/dlls $(DIST_DIR)/apps $(DIST_DIR)/drivers
mkdir $(DIST_DIR)/subsys
endif
.PHONY: clean_dist_dir make_dist_dirs

View File

@@ -1,15 +0,0 @@
0.0.14: Converted to PE format
All system libraries are now dlls
0.0.13: Mostly bugfixes (I think)
0.0.12: Added support for multiple processes (not really tested)
System calls
kernel32 now compiles (only as a static library)
Fixed invalid tss bug (hopefully)
Added section support
Added some of the ZwxxxVirtual calls
Added prototype caching functions (only the Minix fsd actually
uses them)
Added handle access and type checking
Prototype APC implementation (no support for user APCs)

View File

@@ -1,24 +0,0 @@
About Reactos
1. What is Reactos
A project aiming to make an approximate clone of Windows NT, compatible
with most Windows applications.
The project has a website at http://www.reactos.com/
2. Building Reactos
See the INSTALL file for more details.
3. More information
See the doc subdirectory for some sparse notes
4. Who is responsible
See the CREDITS file
5. Recent developments
See the NEWS file

View File

@@ -1,33 +0,0 @@
#include <windows.h>
extern int main(int args, char* argv[], char* environ[]);
static unsigned int _argc = 0;
static char** _argv = NULL;
static char** _environ = NULL;
int mainCRTStartup(PWSTR args)
{
int nRet;
// SetUnhandledExceptionFilter(NULL);
// _fpreset();
// __GetMainArgs(&_argc, &_argv, &_environ, 0);
nRet = main(_argc, _argv, _environ);
// _cexit();
ExitProcess(nRet);
}
int WinMainCRTStartup()
{
return mainCRTStartup(NULL);
}
void __main(void)
{
}

View File

@@ -1,97 +0,0 @@
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
HANDLE OutputHandle;
HANDLE InputHandle;
void debug_printf(char* fmt, ...)
{
va_list args;
char buffer[255];
va_start(args,fmt);
vsprintf(buffer,fmt,args);
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
va_end(args);
}
VOID STDCALL ApcRoutine(PVOID Context,
PIO_STATUS_BLOCK IoStatus,
ULONG Reserved)
{
printf("(apc.exe) ApcRoutine(Context %x)\n", Context);
}
void main(int argc, char* argv[])
{
int i;
NTSTATUS Status;
HANDLE FileHandle;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING FileName;
IO_STATUS_BLOCK IoStatus;
CHAR Buffer[256];
HANDLE EventHandle;
AllocConsole();
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
printf("APC test program\n");
EventHandle = CreateEventW(NULL,
FALSE,
FALSE,
NULL);
if (EventHandle == INVALID_HANDLE_VALUE)
{
printf("Failed to create event\n");
return;
}
printf("Opening file\n");
RtlInitUnicodeString(&FileName,
L"\\C:\\a.txt");
InitializeObjectAttributes(&ObjectAttributes,
&FileName,
0,
NULL,
NULL);
printf("Creating file\n");
FileHandle = CreateFileW(L"C:\\a.txt",
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
if (FileHandle == INVALID_HANDLE_VALUE)
{
printf("Open failed\n");
return;
}
printf("Reading file\n");
Status = ZwReadFile(FileHandle,
NULL,
ApcRoutine,
0xdeadbeef,
&IoStatus,
Buffer,
256,
NULL,
NULL);
if (!NT_SUCCESS(Status))
{
printf("Read failed\n");
}
printf("Waiting\n");
WaitForSingleObjectEx(EventHandle, INFINITE, TRUE);
printf("Returned from wait\n");
ZwClose(FileHandle);
printf("Program finished\n");
for(;;);
}

View File

@@ -1,44 +0,0 @@
#
#
#
OBJECTS= ../common/crt0.o apc.o
PROGS= apc.exe
BASE_CFLAGS = -I../../include
LIBS = ../../lib/crtdll/crtdll.a ../../lib/kernel32/kernel32.a \
../../lib/ntdll/ntdll.a
all: $(PROGS)
.phony: all
clean:
- $(RM) apc.o
- $(RM) apc.exe
- $(RM) apc.sym
.phony: clean
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* $(FLOPPY_DIR)\apps\$*
else
$(CP) $* $(FLOPPY_DIR)/apps/$*
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
else
$(CP) $* ../../$(DIST_DIR)/apps/$*
endif
apc.exe: $(OBJECTS) $(LIBS)
$(LD) $(OBJECTS) $(LIBS) -o apc.exe
$(NM) --numeric-sort apc.exe > apc.sym
include ../../rules.mak

View File

@@ -1,39 +0,0 @@
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
HANDLE OutputHandle;
HANDLE InputHandle;
void debug_printf(char* fmt, ...)
{
va_list args;
char buffer[255];
va_start(args,fmt);
vsprintf(buffer,fmt,args);
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
va_end(args);
}
int main(int argc, char* argv[])
{
int i;
AllocConsole();
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
printf("GetCommandLineA() %s\n",GetCommandLineA());
debug_printf("GetCommandLineA() %s\n",GetCommandLineA());
debug_printf("argc %d\n", argc);
for (i=0; i<argc; i++)
{
debug_printf("Argv[%d]: %x\n",i,argv[i]);
debug_printf("Argv[%d]: '%s'\n",i,argv[i]);
}
return 0;
}

View File

@@ -1,42 +0,0 @@
#
#
#
OBJECTS= args.o
PROGS= args.exe
BASE_CFLAGS = -I../../include
all: $(PROGS)
.phony: all
clean:
- $(RM) args.o
- $(RM) args.exe
- $(RM) args.sym
.phony: clean
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* $(FLOPPY_DIR)\apps\$*
else
$(CP) $* $(FLOPPY_DIR)/apps/$*
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
else
$(CP) $* ../../$(DIST_DIR)/apps/$*
endif
args.exe: $(OBJECTS)
$(CC) $(OBJECTS) -o args.exe
$(NM) --numeric-sort args.exe > args.sym
include ../../rules.mak

View File

@@ -1,8 +0,0 @@
/*
*
*/
int main(int argc, char* argv[])
{
}

View File

@@ -1,82 +0,0 @@
#include <stdio.h>
#include <windows.h>
#define NR_THREADS (0x1)
DWORD WINAPI
thread_main1(LPVOID param)
{
printf("Thread 1 running (Counter %lu)\n", (DWORD)param);
return 0;
}
DWORD WINAPI
thread_main2(LPVOID param)
{
printf("Thread 2 running (Counter %lu)\n", (DWORD)param);
return 0;
}
int main (void)
{
HANDLE hThread;
DWORD i=0;
DWORD id;
#if 1
printf("Creating %d threads...\n",NR_THREADS*2);
for (i=0;i<NR_THREADS;i++)
{
CreateThread(NULL,
0,
thread_main1,
(LPVOID)i,
0,
&id);
/* CreateThread(NULL,
0,
thread_main2,
(LPVOID)i,
0,
&id);*/
}
printf("All threads created...\n");
/*
* Waiting for threads is not implemented yet.
* If you want to see all threads running, uncomment the
* call to SuspendThread(). The test application will
* freeze after all threads are created.
*/
/* SuspendThread (GetCurrentThread()); */
#else
printf("Creating thread...\n");
hThread = CreateThread(NULL,
0,
thread_main1,
(LPVOID)i,
0,
&id);
printf("Thread created. Waiting for termination...\n");
WaitForSingleObject (hThread,
-1);
CloseHandle (hThread);
printf("Thread terminated...\n");
#endif
return 0;
}

View File

@@ -1,41 +0,0 @@
#
#
#
PROGS = bench-thread
all: $(PROGS:%=%.exe)
.phony: all
clean: $(PROGS:%=%_clean)
$(PROGS:%=%_clean): %_clean:
- $(RM) $*.o
- $(RM) $*.exe
- $(RM) $*.sym
.phony: clean
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
ifeq ($(DOSCLI),yes)
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
else
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
ifeq ($(DOSCLI),yes)
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
else
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
endif
bench-thread.exe: bench-thread.c
$(CC) $(CFLAGS) bench-thread.c -lkernel32 -o bench-thread.exe
$(NM) --numeric-sort bench-thread.exe > bench-thread.sym
include ../../rules.mak

View File

@@ -1,33 +0,0 @@
#include <windows.h>
#include <stdio.h>
HANDLE events[2];
DWORD WINAPI thread( LPVOID crap )
{
SetEvent( events[0] );
if( crap )
SetEvent( events[1] );
return 1;
}
int main()
{
DWORD id, Status;
printf( "Creating events\n" );
events[0] = CreateEvent( 0, TRUE, FALSE, 0 );
events[1] = CreateEvent( 0, TRUE, FALSE, 0 );
printf( "Created events\n" );
CreateThread( 0, 0, thread, 0, 0, &id );
printf( "WaitForSingleObject %s\n", ( WaitForSingleObject( events[0], INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
ResetEvent( events[0] );
CreateThread( 0, 0, thread, 0, 0, &id );
printf( "WaitForMultipleObjects with waitall = FALSE %s\n", ( WaitForMultipleObjects( 2, events, FALSE, INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
ResetEvent( events[0] );
CreateThread( 0, 0, thread, (void *)1, 0, &id );
Status = WaitForMultipleObjects( 2, events, TRUE, INFINITE );
printf( "WaitForMultipleObjects with waitall = TRUE %s\n", ( Status == WAIT_OBJECT_0 || Status == WAIT_OBJECT_0 + 1 ? "worked" : "failed" ) );
ResetEvent( events[0] );
printf( "WaitForSingleObject with timeout %s\n", ( WaitForSingleObject( events[0], 100 ) == WAIT_TIMEOUT ? "worked" : "failed" ) );
return 0;
}

View File

@@ -1,41 +0,0 @@
#
#
#
PROGS = event
all: $(PROGS:%=%.exe)
.phony: all
clean: $(PROGS:%=%_clean)
$(PROGS:%=%_clean): %_clean:
- $(RM) $*.o
- $(RM) $*.exe
- $(RM) $*.sym
.phony: clean
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
ifeq ($(DOSCLI),yes)
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
else
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
ifeq ($(DOSCLI),yes)
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
else
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
endif
event.exe: event.c
$(CC) $(CFLAGS) event.c -lkernel32 -o event.exe
$(NM) --numeric-sort event.exe > event.sym
include ../../rules.mak

View File

@@ -1,8 +0,0 @@
#include <stdio.h>
int main(int argc, char* argv[])
{
printf("Hello world\n");
return(0);
}

View File

@@ -1,39 +0,0 @@
#
#
#
OBJECTS = hello.o
PROGS = hello.exe
LIBS =
CLEAN_FILES = hello.o hello.exe
all: hello.exe
clean: $(CLEAN_FILES:%=%_clean)
$(CLEAN_FILES:%=%_clean): %_clean:
- $(RM) $*
.phony: clean $(CLEAN_FILES:%=%_clean)
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* $(FLOPPY_DIR)\apps\$*
else
$(CP) $* $(FLOPPY_DIR)/apps/$*
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
else
$(CP) $* ../../$(DIST_DIR)/apps/$*
endif
hello.exe: $(OBJECTS)
$(CC) $(OBJECTS) -o hello.exe
include ../../rules.mak

View File

@@ -1,205 +0,0 @@
/* $Id: conport.c,v 1.5 1999/07/17 23:10:12 ea Exp $
*
* reactos/apps/lpc/conport.c
*
* To be run in a real WNT 4.0 system with
* "\SmApiPort" as argument. Do not try to
* connect to "\Windows\ApiPort" since that
* reboots immeditely.
*
* Use Russinovich' HandleEx to verify
* conport.exe owns two unnamed LPC ports:
* the one created by kernel32.dll connecting
* to csrss.exe, and one connected to here.
*
* 19990627 (Emanuele Aliberti)
* Initial implementation.
* 19990704 (EA)
* Dump object's attributes moved in dumpinfo.c.
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#define PROTO_LPC
#include <ddk/ntddk.h>
#include "dumpinfo.h"
#define LPC_CONNECT_FLAG1 0x00000001
#define LPC_CONNECT_FLAG2 0x00000010
#define LPC_CONNECT_FLAG3 0x00000100
#define LPC_CONNECT_FLAG4 0x00001000
#define LPC_CONNECT_FLAG5 0x00010000
NTSTATUS
(STDCALL * ConnectPort)(
OUT PHANDLE PortHandle,
IN PUNICODE_STRING PortName,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN DWORD Unknown3,
IN DWORD Unknown4,
IN DWORD Unknown5,
IN DWORD Unknown6,
IN ULONG Flags
);
NTSTATUS
(STDCALL * QueryObject)(
IN HANDLE ObjectHandle,
IN CINT ObjectInformationClass,
OUT PVOID ObjectInformation,
IN ULONG Length,
OUT PULONG ResultLength
);
NTSTATUS
(STDCALL * YieldExecution)(VOID);
#define BUF_SIZE 1024
#define MAXARG 1000000
VOID
TryConnectPort(char *port_name)
{
DWORD Status = 0;
HANDLE Port = 0;
int i;
UNICODE_STRING PortName;
OBJECT_ATTRIBUTES ObjectAttributes;
WORD Name [BUF_SIZE] = {0};
int dwx = 0;
char * port_name_save = port_name;
/*
* Convert the port's name to Unicode.
*/
for (
PortName.Length = 0;
( *port_name
&& (PortName.Length < BUF_SIZE)
);
)
{
Name[PortName.Length++] = (WORD) *port_name++;
}
Name[PortName.Length] = 0;
PortName.Length = PortName.Length * sizeof (WORD);
PortName.MaximumLength = PortName.Length + sizeof (WORD);
PortName.Buffer = (PWSTR) Name;
/*
* Prepare the port object attributes.
*/
ObjectAttributes.Length =
sizeof (OBJECT_ATTRIBUTES);
ObjectAttributes.RootDirectory =
NULL;
ObjectAttributes.ObjectName =
NULL /*& PortName */;
ObjectAttributes.Attributes =
OBJ_CASE_INSENSITIVE;
ObjectAttributes.SecurityDescriptor =
NULL;
ObjectAttributes.SecurityQualityOfService =
NULL;
/*
* Try to issue a connection request.
*/
Port = 0;
Status = ConnectPort(
& Port,
& PortName,
& ObjectAttributes,
0,
0,
0,
0,
LPC_CONNECT_FLAG5
);
if (Status == STATUS_SUCCESS)
{
DumpInfo(
Name,
Status,
"connected",
Port
);
/* Hot waiting */
for (dwx=0; dwx<MAXARG; ++dwx)
{
YieldExecution();
}
if (FALSE == CloseHandle(Port))
{
printf(
"Could not close the port handle %08X.\n",
Port
);
}
return;
}
printf(
"Connection to port \"%s\" failed (Status = %08X).\n",
port_name_save,
Status
);
}
main( int argc, char * argv[] )
{
HINSTANCE ntdll;
if (argc != 2)
{
printf("WNT LPC Port Connector\n");
printf("Usage: %s [port_name]\n",argv[0]);
exit(EXIT_FAILURE);
}
printf("LoadLibrary(NTDLL)\n");
ntdll = LoadLibrary("NTDLL");
if (ntdll == NULL)
{
printf("Could not load NTDLL\n");
return EXIT_FAILURE;
}
printf("GetProcAddress(NTDLL.NtConnectPort)\n");
ConnectPort = (VOID*) GetProcAddress(
ntdll,
"NtConnectPort"
);
if (ConnectPort == NULL)
{
FreeLibrary(ntdll);
printf("Could not find NTDLL.NtConnectPort\n");
return EXIT_FAILURE;
}
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
QueryObject = (VOID*) GetProcAddress(
ntdll,
"NtQueryObject"
);
if (QueryObject == NULL)
{
FreeLibrary(ntdll);
printf("Could not find NTDLL.NtQueryObject\n");
return EXIT_FAILURE;
}
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
YieldExecution = (VOID*) GetProcAddress(
ntdll,
"NtYieldExecution"
);
if (YieldExecution == NULL)
{
FreeLibrary(ntdll);
printf("Could not find NTDLL.NtYieldExecution\n");
return EXIT_FAILURE;
}
printf("TryConnectPort(%s)\n",argv[1]);
TryConnectPort(argv[1]);
printf("Done\n");
return EXIT_SUCCESS;
}
/* EOF */

View File

@@ -1,192 +0,0 @@
/* $Id: creport.c,v 1.2 1999/07/17 23:10:12 ea Exp $
*
* reactos/apps/lpc/creport.c
*
* To be run in a real WNT 4.0 system to
* create an LPC named port.
*
* Use Russinovich' HandleEx to verify
* creport.exe owns the named LPC port
* you asked to create.
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#define PROTO_LPC
#include <ddk/ntddk.h>
#include "dumpinfo.h"
#define LPC_CONNECT_FLAG1 0x00000001
#define LPC_CONNECT_FLAG2 0x00000010
#define LPC_CONNECT_FLAG3 0x00000100
#define LPC_CONNECT_FLAG4 0x00001000
#define LPC_CONNECT_FLAG5 0x00010000
NTSTATUS
(STDCALL * CreatePort)(
/*OUT PHANDLE PortHandle,*/
PVOID Buffer,
IN POBJECT_ATTRIBUTES PortAttributes OPTIONAL,
IN ACCESS_MASK DesiredAccess,
IN DWORD Unknown3,
IN ULONG Flags
);
NTSTATUS
(STDCALL * QueryObject)(
IN HANDLE ObjectHandle,
IN CINT ObjectInformationClass,
OUT PVOID ObjectInformation,
IN ULONG Length,
OUT PULONG ResultLength
);
NTSTATUS
(STDCALL * YieldExecution)(VOID);
#define BUF_SIZE 1024
#define MAXARG 5000000
VOID
TryCreatePort(char *port_name)
{
DWORD Status = 0;
HANDLE Port = 0;
int i;
UNICODE_STRING PortName;
OBJECT_ATTRIBUTES ObjectAttributes;
WORD Name [BUF_SIZE] = {0};
int dwx = 0;
char * port_name_save = port_name;
/*
* Convert the port's name to Unicode.
*/
for (
PortName.Length = 0;
( *port_name
&& (PortName.Length < BUF_SIZE)
);
)
{
Name[PortName.Length++] = (WORD) *port_name++;
}
Name[PortName.Length] = 0;
PortName.Length = PortName.Length * sizeof (WORD);
PortName.MaximumLength = PortName.Length + sizeof (WORD);
PortName.Buffer = (PWSTR) Name;
/*
* Prepare the port object attributes.
*/
ObjectAttributes.Length =
sizeof (OBJECT_ATTRIBUTES);
ObjectAttributes.RootDirectory =
NULL;
ObjectAttributes.ObjectName =
& PortName;
ObjectAttributes.Attributes =
0; //OBJ_CASE_INSENSITIVE --> STATUS_INVALID_PARAMETER ==> case sensitive!;
ObjectAttributes.SecurityDescriptor =
NULL;
ObjectAttributes.SecurityQualityOfService =
NULL;
/*
* Try to issue a connection request.
*/
Port = 0;
Status = CreatePort(
& Port,
& ObjectAttributes,
0, /* ACCESS_MASK? */
0, /* Unknown3 */
LPC_CONNECT_FLAG5
);
if (Status == STATUS_SUCCESS)
{
DumpInfo(
Name,
Status,
"created",
Port
);
/* Hot waiting */
for (dwx=0; dwx<MAXARG; ++dwx)
{
YieldExecution();
}
if (FALSE == CloseHandle(Port))
{
printf(
"Could not close the port handle %08X.\n",
Port
);
}
return;
}
printf(
"Creating port \"%s\" failed (Status = %08X).\n",
port_name_save,
Status
);
}
main( int argc, char * argv[] )
{
HINSTANCE ntdll;
if (argc != 2)
{
printf("WNT LPC Port Creator\n");
printf("Usage: %s [port_name]\n",argv[0]);
exit(EXIT_FAILURE);
}
printf("LoadLibrary(NTDLL)\n");
ntdll = LoadLibrary("NTDLL");
if (ntdll == NULL)
{
printf("Could not load NTDLL\n");
return EXIT_FAILURE;
}
printf("GetProcAddress(NTDLL.NtCreatePort)\n");
CreatePort = (VOID*) GetProcAddress(
ntdll,
"NtCreatePort"
);
if (CreatePort == NULL)
{
FreeLibrary(ntdll);
printf("Could not find NTDLL.NtCreatePort\n");
return EXIT_FAILURE;
}
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
QueryObject = (VOID*) GetProcAddress(
ntdll,
"NtQueryObject"
);
if (QueryObject == NULL)
{
FreeLibrary(ntdll);
printf("Could not find NTDLL.NtQueryObject\n");
return EXIT_FAILURE;
}
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
YieldExecution = (VOID*) GetProcAddress(
ntdll,
"NtYieldExecution"
);
if (YieldExecution == NULL)
{
FreeLibrary(ntdll);
printf("Could not find NTDLL.NtYieldExecution\n");
return EXIT_FAILURE;
}
printf("TryCreatePort(%s)\n",argv[1]);
TryCreatePort(argv[1]);
printf("Done\n");
return EXIT_SUCCESS;
}
/* EOF */

View File

@@ -1,239 +0,0 @@
/* $Id: dumpinfo.c,v 1.2 1999/07/17 23:10:12 ea Exp $
*
* reactos/apps/lpc/dumpinfo.c
*
* ReactOS Operating System
*
* Dump a kernel object's attributes by its handle.
*
* 19990627 (Emanuele Aliberti)
* Initial implementation.
* 19990704 (EA)
* Added code to find the basic information buffer size
* for the LPC port object.
* 19990710 (EA)
*
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <ddk/ntddk.h>
#define BUF_SIZE 1024
#define MAX_BASIC_INFO_SIZE 512
extern
NTSTATUS
(STDCALL * QueryObject)(
IN HANDLE ObjectHandle,
IN CINT ObjectInformationClass,
OUT PVOID ObjectInformation,
IN ULONG Length,
OUT PULONG ResultLength
);
extern
NTSTATUS
(STDCALL * QueryInformationPort)(
IN HANDLE PortHandle,
IN CINT PortInformationClass, /* guess */
OUT PVOID PortInformation, /* guess */
IN ULONG PortInformationLength, /* guess */
OUT PULONG ReturnLength /* guess */
);
/*
static
VOID
DumpBuffer(
char *Name,
BYTE *buffer,
ULONG size
)
{
register ULONG i = 0;
printf("%s [%d] = ",Name,size);
for ( i = 0;
i != size;
++i
)
{
printf("%02X",buffer[i]);
}
printf("\n");
}
*/
VOID
DumpInfo (
LPCWSTR Name,
NTSTATUS Status,
LPCWSTR Comment,
HANDLE Port
)
{
BYTE ObjectInformation [BUF_SIZE] = {0};
ULONG ResultLength;
wprintf(
L"Port \"%s\" %s:\n",
Name,
Comment
);
printf("\tStatus = %08X\n",Status);
printf("\tPort = %08X\n\n",Port);
/*
* Query object information.
*/
printf("Basic Information:\n");
Status = QueryObject(
Port,
ObjectBasicInformation,
ObjectInformation,
sizeof (LPC_PORT_BASIC_INFORMATION),
& ResultLength
);
if (Status == STATUS_SUCCESS)
{
PLPC_PORT_BASIC_INFORMATION i;
i = (PLPC_PORT_BASIC_INFORMATION) ObjectInformation;
printf( "\tUnknown01 = 0x%08X\n", i->Unknown0 );
printf( "\tUnknown02 = 0x%08X\n", i->Unknown1 );
printf( "\tUnknown03 = 0x%08X\n", i->Unknown2 );
printf( "\tUnknown04 = 0x%08X\n", i->Unknown3 );
printf( "\tUnknown05 = 0x%08X\n", i->Unknown4 );
printf( "\tUnknown06 = 0x%08X\n", i->Unknown5 );
printf( "\tUnknown07 = 0x%08X\n", i->Unknown6 );
printf( "\tUnknown08 = 0x%08X\n", i->Unknown7 );
printf( "\tUnknown09 = 0x%08X\n", i->Unknown8 );
printf( "\tUnknown10 = 0x%08X\n", i->Unknown9 );
printf( "\tUnknown11 = 0x%08X\n", i->Unknown10 );
printf( "\tUnknown12 = 0x%08X\n", i->Unknown11 );
printf( "\tUnknown13 = 0x%08X\n", i->Unknown12 );
printf( "\tUnknown14 = 0x%08X\n", i->Unknown13 );
}
else
{
printf("\tStatus = %08X\n",Status);
}
printf("Type Information:\n");
Status = QueryObject(
Port,
ObjectTypeInformation,
ObjectInformation,
sizeof ObjectInformation,
& ResultLength
);
if (Status == STATUS_SUCCESS)
{
OBJECT_TYPE_INFORMATION * i;
i = (OBJECT_TYPE_INFORMATION *) ObjectInformation;
wprintf(
L"\tName: \"%s\"\n",
(i->Name.Length ? i->Name.Buffer : L"")
);
/*
FIXME: why this always raise an access violation exception?
wprintf(
L"\tType: \"%s\"\n",
(i->Type.Length ? i->Type.Buffer : L"")
);
/**/
printf(
"\tTotal Handles: %d\n",
i->TotalHandles
);
printf(
"\tReference Count: %d\n",
i->ReferenceCount
);
}
else
{
printf("\tStatus = %08X\n",Status);
}
printf("Name Information:\n");
Status = QueryObject(
Port,
ObjectNameInformation,
ObjectInformation,
sizeof ObjectInformation,
& ResultLength
);
if (Status == STATUS_SUCCESS)
{
OBJECT_NAME_INFORMATION * i;
i = (OBJECT_NAME_INFORMATION *) ObjectInformation;
wprintf(
L"\tName: \"%s\"\n",
(i->Name.Length ? i->Name.Buffer : L"")
);
}
else
{
printf("\tStatus = %08X\n",Status);
}
printf("Data Information:\n");
Status = QueryObject(
Port,
ObjectDataInformation,
ObjectInformation,
sizeof ObjectInformation,
& ResultLength
);
if (Status == STATUS_SUCCESS)
{
OBJECT_DATA_INFORMATION * i;
i = (OBJECT_DATA_INFORMATION *) ObjectInformation;
printf(
"\tInherit Handle: %s\n",
(i->bInheritHandle ? "TRUE" : "FALSE")
);
printf(
"\tProtect from Close: %s\n",
(i->bProtectFromClose ? "TRUE" : "FALSE")
);
}
else
{
printf("\tStatus = %08X\n",Status);
}
//---
printf("Port Information:\n");
/* Status = QueryInformationPort(
Port,
1, /* info class * /
ObjectInformation,
sizeof ObjectInformation,
& ResultLength
);
if (Status == STATUS_SUCCESS)
{
DWORD * i = ObjectInformation;
int j = 0;
while (j < ResultLength / sizeof (DWORD))
{
printf("\t%08X\n",i[j]);
++j;
}
}
else
{
printf("\tStatus = %08X\n",Status);
}
*/
}
/* EOF */

View File

@@ -1,8 +0,0 @@
VOID
DumpInfo (
LPCWSTR Name,
NTSTATUS Status,
LPCWSTR Comment,
HANDLE Port
);

View File

@@ -1,62 +0,0 @@
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
HANDLE OutputHandle;
HANDLE InputHandle;
void debug_printf(char* fmt, ...)
{
va_list args;
char buffer[255];
va_start(args,fmt);
vsprintf(buffer,fmt,args);
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
va_end(args);
}
void main(int argc, char* argv[])
{
UNICODE_STRING PortName;
NTSTATUS Status;
HANDLE PortHandle;
LPCMESSAGE Request;
ULONG ConnectInfoLength;
printf("(lpcclt.exe) Lpc client\n");
RtlInitUnicodeString(&PortName, L"\\TestPort");
printf("(lpcclt.exe) Connecting to port\n");
ConnectInfoLength = 0;
Status = NtConnectPort(&PortHandle,
&PortName,
NULL,
0,
0,
0,
NULL,
&ConnectInfoLength);
if (!NT_SUCCESS(Status))
{
printf("(lpcclt.exe) Failed to connect\n");
return;
}
strcpy(Request.MessageData, GetCommandLineA());
Request.ActualMessageLength = strlen(Request.MessageData);
Request.TotalMessageLength = sizeof(LPCMESSAGE);
printf("(lpcclt.exe) Sending message\n");
Status = NtRequestPort(PortHandle, &Request);
if (!NT_SUCCESS(Status))
{
printf("(lpcclt.exe) Failed to send request\n");
return;
}
printf("(lpcclt.exe) Succeeded\n");
}

View File

@@ -1,98 +0,0 @@
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
HANDLE OutputHandle;
HANDLE InputHandle;
void debug_printf(char* fmt, ...)
{
va_list args;
char buffer[255];
va_start(args,fmt);
vsprintf(buffer,fmt,args);
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
va_end(args);
}
void main(int argc, char* argv[])
{
UNICODE_STRING PortName;
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status;
HANDLE NamedPortHandle;
HANDLE PortHandle;
LPCMESSAGE ConnectMsg;
printf("(lpcsrv.exe) Lpc test server\n");
RtlInitUnicodeString(&PortName, L"\\TestPort");
InitializeObjectAttributes(&ObjectAttributes,
&PortName,
0,
NULL,
NULL);
printf("(lpcsrv.exe) Creating port\n");
Status = NtCreatePort(&NamedPortHandle,
&ObjectAttributes,
0,
0,
0);
if (!NT_SUCCESS(Status))
{
printf("(lpcsrv.exe) Failed to create port\n");
return;
}
printf("(lpcsrv.exe) Listening for connections\n");
Status = NtListenPort(NamedPortHandle,
&ConnectMsg);
if (!NT_SUCCESS(Status))
{
printf("(lpcsrv.exe) Failed to listen for connections\n");
return;
}
printf("(lpcsrv.exe) Accepting connections\n");
Status = NtAcceptConnectPort(&PortHandle,
NamedPortHandle,
NULL,
1,
0,
NULL);
if (!NT_SUCCESS(Status))
{
printf("(lpcsrv.exe) Failed to accept connection\n");
return;
}
printf("(lpcsrv.exe) Completing connection\n");
Status = NtCompleteConnectPort(PortHandle);
if (!NT_SUCCESS(Status))
{
printf("(lpcsrv.exe) Failed to complete connection\n");
return;
}
for(;;)
{
LPCMESSAGE Request;
Status = NtReplyWaitReceivePort(PortHandle,
0,
NULL,
&Request);
if (!NT_SUCCESS(Status))
{
printf("(lpcsrv.exe) Failed to receive request\n");
return;
}
printf("(lpcsrv.exe) Message contents are <%s>\n", Request.MessageData);
}
}

View File

@@ -1,51 +0,0 @@
#
#
#
SRV_OBJECTS= ../common/crt0.o lpcsrv.o
CLT_OBJECTS= ../common/crt0.o lpcclt.o
PROGS= lpcsrv.exe lpcclt.exe
BASE_CFLAGS = -I../../include
LIBS = ../../lib/crtdll/crtdll.a ../../lib/kernel32/kernel32.a \
../../lib/ntdll/ntdll.a
all: $(PROGS)
.phony: all
clean:
- $(RM) lpcsrv.o
- $(RM) lpcsrv.exe
- $(RM) lpcsrv.sym
.phony: clean
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* $(FLOPPY_DIR)\apps\$*
else
$(CP) $* $(FLOPPY_DIR)/apps/$*
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
else
$(CP) $* ../../$(DIST_DIR)/apps/$*
endif
lpcsrv.exe: $(SRV_OBJECTS) $(LIBS)
$(LD) $(SRV_OBJECTS) $(LIBS) -o lpcsrv.exe
$(NM) --numeric-sort lpcsrv.exe > lpcsrv.sym
lpcclt.exe: $(CLT_OBJECTS) $(LIBS)
$(LD) $(CLT_OBJECTS) $(LIBS) -o lpcclt.exe
$(NM) --numeric-sort lpcclt.exe > lpcclt.sym
include ../../rules.mak

View File

@@ -1,51 +0,0 @@
#
#
#
SRV_OBJECTS= ../common/crt0.o shmsrv.o
CLT_OBJECTS= ../common/crt0.o shmclt.o
PROGS= shmsrv.exe shmclt.exe
BASE_CFLAGS = -I../../include
LIBS = ../../lib/crtdll/crtdll.a ../../lib/kernel32/kernel32.a \
../../lib/ntdll/ntdll.a
all: $(PROGS)
.phony: all
clean:
- $(RM) *.o
- $(RM) *.exe
- $(RM) *.sym
.phony: clean
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* $(FLOPPY_DIR)\apps\$*
else
$(CP) $* $(FLOPPY_DIR)/apps/$*
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
else
$(CP) $* ../../$(DIST_DIR)/apps/$*
endif
shmsrv.exe: $(SRV_OBJECTS) $(LIBS)
$(LD) $(SRV_OBJECTS) $(LIBS) -o shmsrv.exe
$(NM) --numeric-sort shmsrv.exe > shmsrv.sym
shmclt.exe: $(CLT_OBJECTS) $(LIBS)
$(LD) $(CLT_OBJECTS) $(LIBS) -o shmclt.exe
$(NM) --numeric-sort shmsrv.exe > shmclt.sym
include ../../rules.mak

View File

@@ -1,60 +0,0 @@
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
HANDLE OutputHandle;
HANDLE InputHandle;
void debug_printf(char* fmt, ...)
{
va_list args;
char buffer[255];
va_start(args,fmt);
vsprintf(buffer,fmt,args);
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
va_end(args);
}
int
main(int argc, char* argv[])
{
HANDLE Section;
PVOID BaseAddress;
char buffer[256];
printf("Shm test server\n");
Section = OpenFileMappingW (
// PAGE_EXECUTE_READWRITE, invalid parameter
FILE_MAP_WRITE,
FALSE,
L"TestSection"
);
if (Section == NULL)
{
printf("Failed to open section (err=%d)", GetLastError());
return 1;
}
BaseAddress = MapViewOfFile(Section,
FILE_MAP_ALL_ACCESS,
0,
0,
8192);
if (BaseAddress == NULL)
{
printf("Failed to map section (err=%d)\n", GetLastError());
return 1;
}
printf("BaseAddress %x\n", (UINT) BaseAddress);
printf("Copying from section\n");
strcpy(buffer, BaseAddress);
printf("Copyed <%s>\n", buffer);
// for(;;);
return 0;
}

View File

@@ -1,52 +0,0 @@
/* $Id: shmsrv.c,v 1.3 1999/12/30 01:51:36 dwelch Exp $
*
* FILE : reactos/apps/shm/shmsrv.c
* AUTHOR: David Welch
*/
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
HANDLE Section;
PVOID BaseAddress;
printf("Shm test server\n");
Section = CreateFileMappingW (
(HANDLE) 0xFFFFFFFF,
NULL,
PAGE_READWRITE,
0,
8192,
L"TestSection"
);
if (Section == NULL)
{
printf("Failed to create section (err=%d)", GetLastError());
return 1;
}
printf("Mapping view of section\n");
BaseAddress = MapViewOfFile(Section,
FILE_MAP_ALL_ACCESS,
0,
0,
8192);
printf("BaseAddress %x\n", (UINT) BaseAddress);
if (BaseAddress == NULL)
{
printf("Failed to map section\n");
}
printf("Copying to section\n");
printf("Copying %s\n", GetCommandLineA());
strcpy(BaseAddress, GetCommandLineA());
for(;;);
return 0;
}

View File

@@ -1,11 +0,0 @@
#include <stdio.h>
int
main (void)
{
int i;
puts ("This should print \"wow = I\" for I from 0 to 39 inclusive.");
for (i = 0; i < 40; i++)
printf ("%s = %d\n", "wow", i);
return 0;
}

View File

@@ -1,53 +0,0 @@
#include <stdio.h>
#include <string.h>
int
main (void)
{
FILE *f;
int i;
const char filename[] = "/tmp/bug3.test";
f = fopen(filename, "w+");
for (i=0; i<9000; i++)
putc ('x', f);
fseek (f, 8180L, 0);
fwrite ("Where does this text go?", 1, 24, f);
fflush (f);
rewind (f);
for (i=0; i<9000; i++)
{
int j;
if ((j = getc(f)) != 'x')
{
if (i != 8180)
{
printf ("Test FAILED!");
return 1;
}
else
{
char buf[25];
buf[0] = j;
fread (buf + 1, 1, 23, f);
buf[24] = '\0';
if (strcmp (buf, "Where does this text go?") != 0)
{
printf ("%s\nTest FAILED!\n", buf);
return 1;
}
i += 23;
}
}
}
fclose(f);
remove(filename);
puts ("Test succeeded.");
return 0;
}

View File

@@ -1,74 +0,0 @@
#
#
#
PROGS= test-stdio tst-printf tstdiomisc bug2 bug3 \
temptest test-fseek test_rdwr
all: $(PROGS:%=%.exe)
.phony: all
$(PROGS:%=%_clean): %_clean:
- $(RM) $*.o
- $(RM) $*.exe
- $(RM) $*.sym
clean: $(PROGS:%=%_clean)
.phony: clean
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
ifeq ($(DOSCLI),yes)
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
else
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
ifeq ($(DOSCLI),yes)
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
else
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
endif
bug2.exe: bug2.c
$(CC) bug2.c -lkernel32 -o bug2.exe
$(NM) --numeric-sort bug2.exe > bug2.sym
bug3.exe: bug3.c
$(CC) bug3.c -lkernel32 -o bug3.exe
$(NM) --numeric-sort bug3.exe > bug3.sym
temptest.exe: temptest.c
$(CC) temptest.c -lkernel32 -o temptest.exe
$(NM) --numeric-sort temptest.exe > temptest.sym
test-fseek.exe: test-fseek.c
$(CC) test-fseek.c -lkernel32 -o test-fseek.exe
$(NM) --numeric-sort test-fseek.exe > test-fseek.sym
test-fwrite.exe: test-fwrite.c
$(CC) test-fwrite.c -lkernel32 -o test-fwrite.exe
$(NM) --numeric-sort test-fwrite.exe > test-fwrite.sym
test_rdwr.exe: test_rdwr.c
$(CC) test_rdwr.c -lkernel32 -o test_rdwr.exe
$(NM) --numeric-sort test_rdwr.exe > test_rdwr.sym
test-stdio.exe: test-stdio.c
$(CC) test-stdio.c -lkernel32 -o test-stdio.exe
$(NM) --numeric-sort test-stdio.exe > test-stdio.sym
tst-printf.exe: tst-printf.c
$(CC) tst-printf.c -lkernel32 -o tst-printf.exe
$(NM) --numeric-sort tst-printf.exe > tst-printf.sym
tstdiomisc.exe: tstdiomisc.c
$(CC) tstdiomisc.c -lkernel32 -o tstdiomisc.exe
$(NM) --numeric-sort tstdiomisc.exe > tstdiomisc.sym
include ../../rules.mak

View File

@@ -1,27 +0,0 @@
#include <stdio.h>
#include <string.h>
char *files[500];
int
main (int argc, char *argv[])
{
FILE *fp;
int i;
for (i = 0; i < 500; i++) {
files[i] = tempnam (NULL, "file");
if (files[i] == NULL) {
printf ("tempnam failed\n");
exit (1);
}
printf ("file: %s\n", files[i]);
fp = fopen (files[i], "w");
fclose (fp);
}
for (i = 0; i < 500; i++)
remove (files[i]);
exit (0);
}

View File

@@ -1,85 +0,0 @@
/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#define TESTFILE "/tmp/test.dat"
int
main (void)
{
FILE *fp;
int i, j;
puts ("\nFile seek test");
fp = fopen (TESTFILE, "w");
if (fp == NULL)
{
perror (TESTFILE);
return 1;
}
for (i = 0; i < 256; i++)
putc (i, fp);
if (freopen (TESTFILE, "r", fp) != fp)
{
perror ("Cannot open file for reading");
return 1;
}
for (i = 1; i <= 255; i++)
{
printf ("%3d\n", i);
fseek (fp, (long) -i, SEEK_END);
if ((j = getc (fp)) != 256 - i)
{
printf ("SEEK_END failed %d\n", j);
break;
}
if (fseek (fp, (long) i, SEEK_SET))
{
puts ("Cannot SEEK_SET");
break;
}
if ((j = getc (fp)) != i)
{
printf ("SEEK_SET failed %d\n", j);
break;
}
if (fseek (fp, (long) i, SEEK_SET))
{
puts ("Cannot SEEK_SET");
break;
}
if (fseek (fp, (long) (i >= 128 ? -128 : 128), SEEK_CUR))
{
puts ("Cannot SEEK_CUR");
break;
}
if ((j = getc (fp)) != (i >= 128 ? i - 128 : i + 128))
{
printf ("SEEK_CUR failed %d\n", j);
break;
}
}
fclose (fp);
remove (TESTFILE);
puts ((i > 255) ? "Test succeeded." : "Test FAILED!");
return (i > 255) ? 0 : 1;
}

View File

@@ -1,68 +0,0 @@
#include <stdio.h>
#include <string.h>
int
main (int argc, char *argv[])
{
FILE *f = tmpfile ();
char obuf[99999], ibuf[sizeof obuf];
char *line;
size_t linesz;
if (! f)
{
perror ("tmpfile");
return 1;
}
if (fputs ("line\n", f) == EOF)
{
perror ("fputs");
return 1;
}
memset (obuf, 'z', sizeof obuf);
memset (ibuf, 'y', sizeof ibuf);
if (fwrite (obuf, sizeof obuf, 1, f) != 1)
{
perror ("fwrite");
return 1;
}
rewind (f);
line = NULL;
linesz = 0;
if (getline (&line, &linesz, f) != 5)
{
perror ("getline");
return 1;
}
if (strcmp (line, "line\n"))
{
puts ("Lines differ. Test FAILED!");
return 1;
}
if (fread (ibuf, sizeof ibuf, 1, f) != 1)
{
perror ("fread");
return 1;
}
if (memcmp (ibuf, obuf, sizeof ibuf))
{
puts ("Buffers differ. Test FAILED!");
return 1;
}
asprintf (&line, "\
GDB is free software and you are welcome to distribute copies of it\n\
under certain conditions; type \"show copying\" to see the conditions.\n\
There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\
");
puts ("Test succeeded.");
return 0;
}

View File

@@ -1,55 +0,0 @@
#include <stdio.h>
#include <string.h>
int main()
{
char msg1[] = "testing _write\n";
char msg2[] = "testing putchar.";
char msg3[] = "testing printf.";
char tmpbuf[255];
FILE* f1;
write(1, msg1, strlen(msg1));
write(1, msg2, strlen(msg2));
putchar('o'); putchar('k'); putchar('\n');
write(1, msg3, strlen(msg3));
printf("ok\n");
printf("Testing fopen\n");
f1 = fopen("tmp.txt","w+b");
if (f1 == NULL)
{
printf("fopen failed\n");
return(1);
}
printf("Testing fwrite\n");
if (fwrite(msg1, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
{
printf("fwrite failed\n");
return(1);
}
printf("Testing fread\n");
fseek(f1, 0, SEEK_SET);
if (fread(tmpbuf, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
{
printf("fread failed\n");
return(1);
}
if (strcmp(tmpbuf,msg1) != 0)
{
printf("fread failed, data corrupt\n");
return(1);
}
printf("Testing fclose\n");
if (fclose(f1) != 0)
{
printf("fclose failed\n");
return(1);
}
return(0);
}

View File

@@ -1,129 +0,0 @@
/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main (int argc, char **argv)
{
static const char hello[] = "Hello, world.\n";
static const char replace[] = "Hewwo, world.\n";
static const size_t replace_from = 2, replace_to = 4;
char filename[FILENAME_MAX];
char *name = strrchr (*argv, '/');
char buf[BUFSIZ];
FILE *f;
int lose = 0;
if (name != NULL)
++name;
else
name = *argv;
(void) sprintf (filename, "/tmp/%s.test", name);
f = fopen (filename, "w+");
if (f == NULL)
{
perror (filename);
exit (1);
}
(void) fputs (hello, f);
rewind (f);
(void) fgets (buf, sizeof (buf), f);
rewind (f);
(void) fputs (buf, f);
rewind (f);
{
size_t i;
for (i = 0; i < replace_from; ++i)
{
int c = getc (f);
if (c == EOF)
{
printf ("EOF at %Zu.\n", i);
lose = 1;
break;
}
else if (c != hello[i])
{
printf ("Got '%c' instead of '%c' at %Zu.\n",
(unsigned char) c, hello[i], i);
lose = 1;
break;
}
}
}
{
long int where = ftell (f);
if (where == (long int) replace_from)
{
register size_t i;
for (i = replace_from; i < replace_to; ++i)
if (putc(replace[i], f) == EOF)
{
printf ("putc('%c') got %s at %Zu.\n",
replace[i], strerror (errno), i);
lose = 1;
break;
}
}
else if (where == -1L)
{
printf ("ftell got %s (should be at %Zu).\n",
strerror (errno), replace_from);
lose = 1;
}
else
{
printf ("ftell returns %lu; should be %Zu.\n", where, replace_from);
lose = 1;
}
}
if (!lose)
{
rewind (f);
if (fgets (buf, sizeof (buf), f) == NULL)
{
printf ("fgets got %s.\n", strerror(errno));
lose = 1;
}
else if (strcmp (buf, replace))
{
printf ("Read \"%s\" instead of \"%s\".\n", buf, replace);
lose = 1;
}
}
if (lose)
printf ("Test FAILED! Losing file is \"%s\".\n", filename);
else
{
(void) remove (filename);
puts ("Test succeeded.");
}
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
}

View File

@@ -1,311 +0,0 @@
/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef BSD
#include </usr/include/stdio.h>
#define EXIT_SUCCESS 0
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
#include <float.h>
void rfg1 (void);
void rfg2 (void);
void
fmtchk (const char *fmt)
{
(void) fputs(fmt, stdout);
(void) printf(":\t`");
(void) printf(fmt, 0x12);
(void) printf("'\n");
}
void
fmtst1chk (const char *fmt)
{
(void) fputs(fmt, stdout);
(void) printf(":\t`");
(void) printf(fmt, 4, 0x12);
(void) printf("'\n");
}
void
fmtst2chk (const char *fmt)
{
(void) fputs(fmt, stdout);
(void) printf(":\t`");
(void) printf(fmt, 4, 4, 0x12);
(void) printf("'\n");
}
/* This page is covered by the following copyright: */
/* (C) Copyright C E Chew
*
* Feel free to copy, use and distribute this software provided:
*
* 1. you do not pretend that you wrote it
* 2. you leave this copyright notice intact.
*/
/*
* Extracted from exercise.c for glibc-1.05 bug report by Bruce Evans.
*/
#define DEC -123
#define INT 255
#define UNS (~0)
/* Formatted Output Test
*
* This exercises the output formatting code.
*/
void
fp_test (void)
{
int i, j, k, l;
char buf[7];
char *prefix = buf;
char tp[20];
puts("\nFormatted output test");
printf("prefix 6d 6o 6x 6X 6u\n");
strcpy(prefix, "%");
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
for (k = 0; k < 2; k++) {
for (l = 0; l < 2; l++) {
strcpy(prefix, "%");
if (i == 0) strcat(prefix, "-");
if (j == 0) strcat(prefix, "+");
if (k == 0) strcat(prefix, "#");
if (l == 0) strcat(prefix, "0");
printf("%5s |", prefix);
strcpy(tp, prefix);
strcat(tp, "6d |");
printf(tp, DEC);
strcpy(tp, prefix);
strcat(tp, "6o |");
printf(tp, INT);
strcpy(tp, prefix);
strcat(tp, "6x |");
printf(tp, INT);
strcpy(tp, prefix);
strcat(tp, "6X |");
printf(tp, INT);
strcpy(tp, prefix);
strcat(tp, "6u |");
printf(tp, UNS);
printf("\n");
}
}
}
}
printf("%10s\n", (char *) NULL);
printf("%-10s\n", (char *) NULL);
}
int
main (int argc, char *argv[])
{
static char shortstr[] = "Hi, Z.";
static char longstr[] = "Good morning, Doctor Chandra. This is Hal. \
I am ready for my first lesson today.";
fmtchk("%.4x");
fmtchk("%04x");
fmtchk("%4.4x");
fmtchk("%04.4x");
fmtchk("%4.3x");
fmtchk("%04.3x");
fmtst1chk("%.*x");
fmtst1chk("%0*x");
fmtst2chk("%*.*x");
fmtst2chk("%0*.*x");
#ifndef BSD
printf("bad format:\t\"%b\"\n");
printf("nil pointer (padded):\t\"%10p\"\n", (void *) NULL);
#endif
printf("decimal negative:\t\"%d\"\n", -2345);
printf("octal negative:\t\"%o\"\n", -2345);
printf("hex negative:\t\"%x\"\n", -2345);
printf("long decimal number:\t\"%ld\"\n", -123456L);
printf("long octal negative:\t\"%lo\"\n", -2345L);
printf("long unsigned decimal number:\t\"%lu\"\n", -123456L);
printf("zero-padded LDN:\t\"%010ld\"\n", -123456L);
printf("left-adjusted ZLDN:\t\"%-010ld\"\n", -123456);
printf("space-padded LDN:\t\"%10ld\"\n", -123456L);
printf("left-adjusted SLDN:\t\"%-10ld\"\n", -123456L);
printf("zero-padded string:\t\"%010s\"\n", shortstr);
printf("left-adjusted Z string:\t\"%-010s\"\n", shortstr);
printf("space-padded string:\t\"%10s\"\n", shortstr);
printf("left-adjusted S string:\t\"%-10s\"\n", shortstr);
printf("null string:\t\"%s\"\n", (char *)NULL);
printf("limited string:\t\"%.22s\"\n", longstr);
printf("e-style >= 1:\t\"%e\"\n", 12.34);
printf("e-style >= .1:\t\"%e\"\n", 0.1234);
printf("e-style < .1:\t\"%e\"\n", 0.001234);
printf("e-style big:\t\"%.60e\"\n", 1e20);
printf ("e-style == .1:\t\"%e\"\n", 0.1);
printf("f-style >= 1:\t\"%f\"\n", 12.34);
printf("f-style >= .1:\t\"%f\"\n", 0.1234);
printf("f-style < .1:\t\"%f\"\n", 0.001234);
printf("g-style >= 1:\t\"%g\"\n", 12.34);
printf("g-style >= .1:\t\"%g\"\n", 0.1234);
printf("g-style < .1:\t\"%g\"\n", 0.001234);
printf("g-style big:\t\"%.60g\"\n", 1e20);
printf (" %6.5f\n", .099999999860301614);
printf (" %6.5f\n", .1);
printf ("x%5.4fx\n", .5);
printf ("%#03x\n", 1);
{
double d = FLT_MIN;
int niter = 17;
while (niter-- != 0)
printf ("%.17e\n", d / 2);
fflush (stdout);
}
printf ("%15.5e\n", 4.9406564584124654e-324);
#define FORMAT "|%12.4f|%12.4e|%12.4g|\n"
printf (FORMAT, 0.0, 0.0, 0.0);
printf (FORMAT, 1.0, 1.0, 1.0);
printf (FORMAT, -1.0, -1.0, -1.0);
printf (FORMAT, 100.0, 100.0, 100.0);
printf (FORMAT, 1000.0, 1000.0, 1000.0);
printf (FORMAT, 10000.0, 10000.0, 10000.0);
printf (FORMAT, 12345.0, 12345.0, 12345.0);
printf (FORMAT, 100000.0, 100000.0, 100000.0);
printf (FORMAT, 123456.0, 123456.0, 123456.0);
#undef FORMAT
{
char buf[20];
printf ("sprintf (\"%%30s\", \"foo\") == %d, \"%.*s\"\n",
sprintf (buf, "%30s", "foo"), sizeof (buf), buf);
}
fp_test ();
printf ("%e should be 1.234568e+06\n", 1234567.8);
printf ("%f should be 1234567.800000\n", 1234567.8);
printf ("%g should be 1.23457e+06\n", 1234567.8);
printf ("%g should be 123.456\n", 123.456);
printf ("%g should be 1e+06\n", 1000000.0);
printf ("%g should be 10\n", 10.0);
printf ("%g should be 0.02\n", 0.02);
{
double x=1.0;
printf("%.17f\n",(1.0/x/10.0+1.0)*x-x);
}
puts ("--- Should be no further output. ---");
rfg1 ();
rfg2 ();
{
char buf[200];
int result;
sprintf(buf,"%*s%*s%*s",-1,"one",-20,"two",-30,"three");
result = strcmp (buf,
"onetwo three ");
puts (result != 0 ? "Test failed!" : "Test ok.");
return result != 0;
}
}
void
rfg1 (void)
{
char buf[100];
sprintf (buf, "%5.s", "xyz");
if (strcmp (buf, " ") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " ");
sprintf (buf, "%5.f", 33.3);
if (strcmp (buf, " 33") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 33");
sprintf (buf, "%8.e", 33.3e7);
if (strcmp (buf, " 3e+08") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 3e+08");
sprintf (buf, "%8.E", 33.3e7);
if (strcmp (buf, " 3E+08") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 3E+08");
sprintf (buf, "%.g", 33.3);
if (strcmp (buf, "3e+01") != 0)
printf ("got: '%s', expected: '%s'\n", buf, "3e+01");
sprintf (buf, "%.G", 33.3);
if (strcmp (buf, "3E+01") != 0)
printf ("got: '%s', expected: '%s'\n", buf, "3E+01");
}
void
rfg2 (void)
{
int prec;
char buf[100];
prec = 0;
sprintf (buf, "%.*g", prec, 3.3);
if (strcmp (buf, "3") != 0)
printf ("got: '%s', expected: '%s'\n", buf, "3");
prec = 0;
sprintf (buf, "%.*G", prec, 3.3);
if (strcmp (buf, "3") != 0)
printf ("got: '%s', expected: '%s'\n", buf, "3");
prec = 0;
sprintf (buf, "%7.*G", prec, 3.33);
if (strcmp (buf, " 3") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 3");
prec = 3;
sprintf (buf, "%04.*o", prec, 33);
if (strcmp (buf, " 041") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 041");
prec = 7;
sprintf (buf, "%09.*u", prec, 33);
if (strcmp (buf, " 0000033") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 0000033");
prec = 3;
sprintf (buf, "%04.*x", prec, 33);
if (strcmp (buf, " 021") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 021");
prec = 3;
sprintf (buf, "%04.*X", prec, 33);
if (strcmp (buf, " 021") != 0)
printf ("got: '%s', expected: '%s'\n", buf, " 021");
}

View File

@@ -1,56 +0,0 @@
#include <stdio.h>
int
t1 (void)
{
int n = -1;
sscanf ("abc ", "abc %n", &n);
printf ("t1: count=%d\n", n);
return n != 5;
}
int
t2 (void)
{
int result = 0;
int n;
long N;
int retval;
#define SCAN(INPUT, FORMAT, VAR, EXP_RES, EXP_VAL) \
VAR = -1; \
retval = sscanf (INPUT, FORMAT, &VAR); \
printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \
INPUT, FORMAT, retval, (long int) VAR); \
result |= retval != EXP_RES || VAR != EXP_VAL
SCAN ("12345", "%ld", N, 1, 12345);
SCAN ("12345", "%llllld", N, 0, -1);
SCAN ("12345", "%LLLLLd", N, 0, -1);
SCAN ("test ", "%*s%n", n, 0, 4);
SCAN ("test ", "%2*s%n", n, 0, -1);
SCAN ("12 ", "%l2d", n, 0, -1);
SCAN ("12 ", "%2ld", N, 1, 12);
n = -1;
N = -1;
retval = sscanf ("1 1", "%d %Z", &n, &N);
printf ("sscanf (\"1 1\", \"%%d %%Z\", &n, &N) => %d, n = %d, N = %ld\n", \
retval, n, N); \
result |= retval != 1 || n != 1 || N != -1;
return result;
}
int
main (int argc, char *argv[])
{
int result = 0;
result |= t1 ();
result |= t2 ();
result |= fflush (stdout) == EOF;
return result;
}

View File

@@ -1,41 +0,0 @@
#
#
#
PROGS = thread
all: $(PROGS:%=%.exe)
.phony: all
clean: $(PROGS:%=%_clean)
$(PROGS:%=%_clean): %_clean:
- $(RM) $*.o
- $(RM) $*.exe
- $(RM) $*.sym
.phony: clean
floppy: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
ifeq ($(DOSCLI),yes)
$(CP) $*.exe $(FLOPPY_DIR)\apps\$*.exe
else
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe)
$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe
ifeq ($(DOSCLI),yes)
$(CP) $*.exe ..\..\$(DIST_DIR)\apps\$*.exe
else
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
endif
thread.exe: thread.c
$(CC) $(CFLAGS) thread.c -lkernel32 -o thread.exe
$(NM) --numeric-sort thread.exe > thread.sym
include ../../rules.mak

View File

@@ -1,46 +0,0 @@
#include <stdio.h>
#include <windows.h>
#define NR_THREADS (10)
ULONG nr;
DWORD WINAPI thread_main1(LPVOID param)
{
ULONG s;
printf("Thread %d running\n", (DWORD)param);
s = nr = ((nr * 1103515245) + 12345) & 0x7fffffff;
s = s % 10;
printf("s %d\n", s);
Sleep(s);
printf("Thread %d finished\n", (DWORD)param);
return 0;
}
int main (int argc, char* argv[])
{
HANDLE hThread;
DWORD i=0;
DWORD id;
ULONG nr;
nr = atoi(argv[1]);
printf("Seed %d\n", nr);
printf("Creating %d threads...\n",NR_THREADS*2);
for (i=0;i<NR_THREADS;i++)
{
CreateThread(NULL,
0,
thread_main1,
(LPVOID)i,
0,
&id);
}
printf("All threads created...\n");
for(;;);
return 0;
}

View File

@@ -1,2 +0,0 @@
buildno
buildno.exe

View File

@@ -1,26 +0,0 @@
# $Id: Makefile,v 1.3 1999/11/12 12:01:09 dwelch Exp $
#
BASE_CFLAGS = -I../../include
TARGETNAME=buildno
CLEAN_FILES= $(TARGETNAME).o $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME).sym
all: $(TARGETNAME)$(EXE_POSTFIX)
$(EXE_PREFIX)$(TARGETNAME)$(EXE_POSTFIX) -q
$(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).c ../../include/reactos/version.h
$(NATIVE_CC) -I../../include -o $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME).c
clean:
$(RM) $(TARGETNAME).o
$(RM) $(TARGETNAME).sym
$(RM) $(TARGETNAME)$(EXE_POSTFIX)
.phony: clean
include ../../rules.mak
# EOF

View File

@@ -1,262 +0,0 @@
/* $Id: buildno.c,v 1.2 1999/12/26 20:21:02 ea Exp $
*
* buildno - Generate the build number for ReactOS
*
* Copyright (c) 1999 Emanuele Aliberti
*
*
* It assumes the last release date is defined in
* <reactos/version.h> as a macro named
*
* KERNEL_RELEASE_DATE
*
* as a 32-bit unsigned long YYYYMMDD (UTC).
*
* The build number is the number of full days
* elapsed since the last release date (UTC).
*
* The build number is stored in the file
* <reactos/buildno.h> as a set of macros:
*
* KERNEL_VERSION_BUILD
* KERNEL_VERSION_BUILD_STR
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <reactos/version.h>
#define FALSE 0
#define TRUE 1
/* File to (over)write */
#define BUILDNO_INCLUDE_FILE "../../include/reactos/buildno.h"
static char * argv0 = "";
int
elapsed_days (
time_t t_today,
time_t t_release_day
)
{
double seconds = difftime (t_today, t_release_day);
double days = seconds / (double) 86400.0;
char buf [32];
char * dot = buf;
sprintf (buf, "%f", days );
while ( *dot && *dot != '.') ++dot;
*dot = '\0';
return atol (buf);
}
void
write_h (int build)
{
FILE *h = NULL;
h = fopen ( BUILDNO_INCLUDE_FILE, "w");
if (!h)
{
fprintf (
stderr,
"%s: can not create file \"%s\"!\n",
argv0,
BUILDNO_INCLUDE_FILE
);
return;
}
fprintf (
h,
"/* Do not edit - Machine generated */\n"
);
fprintf (h, "#ifndef _INC_REACTOS_BUILDNO\n" );
fprintf (h, "#define _INC_REACTOS_BUILDNO\n" );
fprintf (
h,
"#define KERNEL_VERSION_BUILD\t%d\n",
build
);
fprintf (
h,
"#define KERNEL_VERSION_BUILD_STR\t\"%d\"\n",
build
);
fprintf (
h,
"#define KERNEL_RELEASE_RC\t\"%d.%d.%d.%d\\0\"\n",
KERNEL_VERSION_MAJOR,
KERNEL_VERSION_MINOR,
KERNEL_VERSION_PATCH_LEVEL,
build
);
fprintf (
h,
"#define KERNEL_RELEASE_STR\t\"%d.%d.%d.%d\"\n",
KERNEL_VERSION_MAJOR,
KERNEL_VERSION_MINOR,
KERNEL_VERSION_PATCH_LEVEL,
build
);
fprintf (
h,
"#define KERNEL_VERSION_RC\t\"%d.%d.%d\\0\"\n",
KERNEL_VERSION_MAJOR,
KERNEL_VERSION_MINOR,
KERNEL_VERSION_PATCH_LEVEL
);
fprintf (
h,
"#define KERNEL_VERSION_STR\t\"%d.%d.%d\"\n",
KERNEL_VERSION_MAJOR,
KERNEL_VERSION_MINOR,
KERNEL_VERSION_PATCH_LEVEL
);
fprintf (
h,
"#endif\n/* EOF */\n"
);
fclose (h);
}
void
usage (void)
{
fprintf (
stderr,
"Usage: %s [-q]\n",
argv0
);
exit (EXIT_SUCCESS);
}
int
main (int argc, char * argv [])
{
int quiet = FALSE;
int year = 0;
int month = 0;
int day = 0;
int build = 0;
time_t t0 = 0;
struct tm t0_tm = {0};
time_t t1 = 0;
struct tm * t1_tm = NULL;
argv0 = argv[0];
switch (argc)
{
case 1:
break;
case 2:
if (argv[1][0] == '-')
{
if (argv[1][1] == 'q')
{
quiet = TRUE;
}
else
{
usage ();
}
}
else
{
usage ();
}
break;
default:
usage ();
}
/*
* We are building TODAY!
*/
time (& t0);
/*
* "Parse" the release date.
*/
day = KERNEL_RELEASE_DATE % 100;
month = ( ( KERNEL_RELEASE_DATE
% 10000
)
- day
)
/ 100;
year =
( KERNEL_RELEASE_DATE
- (month * 100)
- day
)
/ 10000;
if (FALSE == quiet)
{
printf ( "\n\
ReactOS Build Number Generator\n\n\
Last release: %4d-%02d-%02d\n",
year,
month,
day
);
}
t0_tm.tm_year = year - ((year > 1999) ? 2000 : 1900);
t0_tm.tm_mon = month;
t0_tm.tm_mday = day;
t0 = mktime (& t0_tm);
time (& t1); /* current build time */
t1_tm = gmtime (& t1);
t1_tm->tm_year +=
(t1_tm->tm_year < 70)
? 2000
: 1900;
if (FALSE == quiet)
{
printf (
"Current date: %4d-%02d-%02d\n\n",
t1_tm->tm_year,
t1_tm->tm_mon,
t1_tm->tm_mday
);
}
/*
* Compute delta days.
*/
build = elapsed_days (t1, t0);
if (FALSE == quiet)
{
printf (
"Build number: %d (elapsed days since last release)\n",
build
);
printf (
"ROS Version : %d.%d.%d.%d\n",
KERNEL_VERSION_MAJOR,
KERNEL_VERSION_MINOR,
KERNEL_VERSION_PATCH_LEVEL,
build
);
}
/*
* (Over)write the include file.
*/
write_h (build);
return EXIT_SUCCESS;
}
/* EOF */

View File

@@ -1,26 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
int i;
FILE* in;
char ch;
for (i=1; i<argc; i++)
{
in = fopen(argv[i],"r");
if (in == NULL)
{
printf("Failed to open file %s\n", argv[i]);
return(0);
}
while ((ch = fgetc(in)) != EOF)
{
putchar(ch);
}
fclose(in);
}
return 0;
}

View File

@@ -1,42 +0,0 @@
#
#
#
OBJECTS= cat.o
PROGS= cat.exe
all: cat.exe
.phony: all
clean:
- $(RM) cat.o
- $(RM) cat.exe
- $(RM) cat.sym
.phony: clean
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* $(FLOPPY_DIR)\apps\$*
else
$(CP) $* $(FLOPPY_DIR)/apps/$*
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
else
$(CP) $* ../../$(DIST_DIR)/apps/$*
endif
.PHONY: floppy dist
cat.exe: $(OBJECTS) $(LIBS)
$(CC) $(OBJECTS) -o cat.exe
$(NM) --numeric-sort cat.exe > cat.sym
include ../../rules.mak

View File

@@ -1,42 +0,0 @@
#
#
#
OBJECTS= ../common/crt0.o shell.o
PROGS= shell.exe
LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a
CLEAN_FILES= shell.o shell.exe shell.sym
BASE_CFLAGS = -I../../include
all: shell.exe
clean: $(CLEAN_FILES:%=%_clean)
$(CLEAN_FILES:%=%_clean): %_clean:
- $(RM) $*
.phony: clean $(CLEAN_FILES:%=%_clean)
floppy: $(PROGS:%=$(FLOPPY_DIR)/apps/%)
$(PROGS:%=$(FLOPPY_DIR)/apps/%): $(FLOPPY_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* $(FLOPPY_DIR)\apps\$*
else
$(CP) $* $(FLOPPY_DIR)/apps/$*
endif
dist: $(PROGS:%=../../$(DIST_DIR)/apps/%)
$(PROGS:%=../../$(DIST_DIR)/apps/%): ../../$(DIST_DIR)/apps/%: %
ifeq ($(DOSCLI),yes)
$(CP) $* ..\..\$(DIST_DIR)\apps\$*
else
$(CP) $* ../../$(DIST_DIR)/apps/$*
endif
shell.exe: $(OBJECTS) $(LIBS)
$(CC) -specs=../../specs $(OBJECTS) $(LIBS) -lgcc -o shell.exe
$(NM) --numeric-sort shell.exe > shell.sym
include ../../rules.mak

View File

@@ -1,389 +0,0 @@
#include <ddk/ntddk.h>
#include <windows.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
HANDLE InputHandle, OutputHandle;
void debug_printf(char* fmt, ...)
{
va_list args;
char buffer[255];
va_start(args,fmt);
vsprintf(buffer,fmt,args);
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
va_end(args);
}
void ExecuteVer(void)
{
debug_printf(
"Reactos Simple Shell\n(compiled on %s, at %s)\n",
__DATE__,
__TIME__
);
}
void ExecuteCd(char* cmdline)
{
if (!SetCurrentDirectoryA(cmdline))
{
debug_printf("Invalid directory\n");
}
}
void ExecuteDir(char* cmdline)
{
HANDLE shandle;
WIN32_FIND_DATA FindData;
int nFile=0, nRep=0;
FILETIME fTime;
SYSTEMTIME sTime;
shandle = FindFirstFile("*",&FindData);
if (shandle==INVALID_HANDLE_VALUE)
{
debug_printf("Invalid directory\n");
return;
}
do
{
debug_printf("%-15.15s",FindData.cAlternateFileName);
if(FindData.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)
debug_printf("<DIR> "),nRep++;
else
debug_printf(" %10d ",FindData.nFileSizeLow),nFile++;
FileTimeToLocalFileTime(&FindData.ftLastWriteTime ,&fTime);
FileTimeToSystemTime(&fTime, &sTime);
debug_printf("%02d/%02d/%04d %02d:%02d:%02d "
,sTime.wMonth,sTime.wDay,sTime.wYear
,sTime.wHour,sTime.wMinute,sTime.wSecond);
debug_printf("%s\n",FindData.cFileName);
} while(FindNextFile(shandle,&FindData));
debug_printf("\n %d files\n %d directories\n\n",nFile,nRep);
FindClose(shandle);
}
void ExecuteReboot(char* cmdline)
{
NtShutdownSystem (ShutdownReboot);
}
void ExecuteType(char* cmdline)
{
HANDLE FileHandle;
char c;
DWORD Result;
FileHandle = CreateFile(cmdline,
FILE_GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (FileHandle == NULL)
{
debug_printf("Unknown file\n");
return;
}
while (ReadFile(FileHandle,
&c,
1,
&Result,
NULL))
{
debug_printf("%c",c);
c = 0;
}
CloseHandle(FileHandle);
}
int ExecuteProcess(char* name, char* cmdline, BOOL detached)
{
PROCESS_INFORMATION ProcessInformation;
STARTUPINFO StartupInfo;
// char arguments;
BOOL ret;
memset(&StartupInfo, 0, sizeof(StartupInfo));
StartupInfo.cb = sizeof (STARTUPINFO);
StartupInfo.lpTitle = name;
ret = CreateProcessA(name,
cmdline,
NULL,
NULL,
FALSE,
((TRUE == detached)
? DETACHED_PROCESS
: CREATE_NEW_CONSOLE
),
NULL,
NULL,
& StartupInfo,
& ProcessInformation
);
if (TRUE == detached)
{
if (ret)
{
debug_printf("%s detached:\n"
"\thProcess = %08X\n"
"\thThread = %08X\n"
"\tPID = %d\n"
"\tTID = %d\n\n",
name,
ProcessInformation.hProcess,
ProcessInformation.hThread,
ProcessInformation.dwProcessId,
ProcessInformation.dwThreadId);
CloseHandle(ProcessInformation.hProcess);
CloseHandle(ProcessInformation.hThread);
}
else
{
debug_printf("Could not detach %s\n", name);
}
}
else
{
if (ret)
{
debug_printf("ProcessInformation.hThread %x\n",
ProcessInformation.hThread);
// CloseHandle(ProcessInformation.hThread);
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
CloseHandle(ProcessInformation.hProcess);
debug_printf("Thandle %x\n", ProcessInformation.hThread);
CloseHandle(ProcessInformation.hThread);
}
}
return(ret);
}
void ExecuteStart(char* CommandLine)
{
char *ImageName = CommandLine;
for ( ;
( (*CommandLine)
&& (*CommandLine != ' ')
&& (*CommandLine != '\t')
);
CommandLine++
);
*CommandLine++ = '\0';
while ( (*CommandLine)
&& ( (*CommandLine == ' ')
|| (*CommandLine == '\t')
)
);
ExecuteProcess(
ImageName,
CommandLine,
TRUE
);
return;
}
void
ExecuteKill(char * lpPid)
{
HANDLE hProcess;
DWORD dwProcessId;
dwProcessId = (DWORD) atol(lpPid);
debug_printf("dwProcessId %d\n",dwProcessId);
hProcess = OpenProcess(
PROCESS_TERMINATE,
FALSE,
dwProcessId
);
if (NULL == hProcess)
{
debug_printf(
"Could not open the process with PID = %d\n",
dwProcessId
);
return;
}
if (FALSE == TerminateProcess(
hProcess,
0
)
) {
debug_printf(
"Could not terminate the process with PID = %d\n",
dwProcessId
);
}
CloseHandle(hProcess);
return;
}
void ExecuteCommand(char* line)
{
char* cmd;
char* tail;
if (isalpha(line[0]) && line[1] == ':' && line[2] == 0)
{
line[2] = '\\';
line[3] = 0;
SetCurrentDirectoryA(line);
return;
}
tail = line;
while ((*tail)!=' ' && (*tail)!=0)
{
tail++;
}
if ((*tail)==' ')
{
*tail = 0;
tail++;
}
cmd = line;
if (cmd==NULL || *cmd == '\0' )
{
return;
}
if (strcmp(cmd,"cd")==0)
{
ExecuteCd(tail);
return;
}
if (strcmp(cmd,"dir")==0)
{
ExecuteDir(tail);
return;
}
if (strcmp(cmd,"kill")==0)
{
ExecuteKill(tail);
return;
}
if (strcmp(cmd,"reboot")==0)
{
ExecuteReboot(tail);
return;
}
if (strcmp(cmd,"type")==0)
{
ExecuteType(tail);
return;
}
if (strcmp(cmd,"ver")==0)
{
ExecuteVer();
return;
}
if (strcmp(cmd,"validate")==0)
{
debug_printf("Validating heap...");
if (HeapValidate(GetProcessHeap(),0,NULL))
{
debug_printf("succeeded\n");
}
else
{
debug_printf("failed\n");
}
return;
}
if (strcmp(cmd,"start") == 0)
{
ExecuteStart(tail);
return;
}
if (strcmp(cmd,"exit")==0)
{
ExitProcess(0);
return;
}
if (ExecuteProcess(cmd,tail,FALSE))
{
return;
}
debug_printf("Unknown command\n");
}
void ReadLine(char* line)
{
// KEY_EVENT_RECORD KeyEvent;
DWORD Result;
UCHAR CurrentDir[255];
char ch;
int length = 0;
GetCurrentDirectoryA(255,CurrentDir);
debug_printf("%s>", CurrentDir);
do
{
if (!ReadConsoleA(InputHandle,
&ch,
1,
&Result,
NULL))
{
debug_printf("Failed to read from console\n");
for(;;);
}
switch (ch)
{
case '\b':
if (length > 0)
{
debug_printf("\b \b");
line--;
length--;
}
break;
default:
debug_printf("%c", ch);
*line = ch;
line++;
length++;
}
} while (ch != '\n');
line--;
*line = 0;
}
int main(void)
{
static char line[255];
AllocConsole();
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
debug_printf("Shell Starting...\n");
SetCurrentDirectoryA("C:\\");
for(;;)
{
ReadLine(line);
ExecuteCommand(line);
}
return 0;
}

View File

@@ -1 +0,0 @@
loadros ntoskrnl.exe ide.sys vfatfs.sys

View File

@@ -1,32 +0,0 @@
@ECHO OFF
:
: copy files to HD...
:
COPY /Y A:\DRIVERS\*.SYS C:\reactos\system32\drivers > NUL:
COPY /Y A:\DLLS\*.DLL C:\reactos\system32 > NUL:
COPY /Y A:\APPS\*.EXE C:\reactos\system32 > NUL:
COPY /Y A:\SUBSYS\*.EXE C:\reactos\system32 > NUL:
COPY /Y A:\SUBSYS\*.DLL C:\reactos\system32 > NUL:
:
: present a menu to the booter...
:
: ECHO 1) IDE,VFatFSD
: ECHO 2) No Drivers
: CHOICE /C:123 /T:1,3 "Select kernel boot config"
: IF ERRORLEVEL 2 GOTO :L2
:L1
CLS
LOADROS NTOSKRNL.EXE DRIVERS\IDE.SYS DRIVERS\VFATFSD.SYS
GOTO :END
:L2
CLS
LOADROS NTOSKRNL.EXE
GOTO :END
:END
EXIT

View File

@@ -1,22 +0,0 @@
DIRECTORIES
system : compiled versions of the various system components and
libraries
ntoskrnl : kernel source
ntoskrnl/hal : hardware abstraction layer source
ntoskrnl/mm : memory managment subsystem source
ntoskrnl/io : IO manager subsystem source
ntoskrnl/ke : kernel source
include : win32 headers
include/internal : kernel private header files
include/ntdll : system library private header files
include/kernel32 : system library private header files
include/ddk : header files for modules
lib/ntdll : NT dll source
lib/kernel32 : kernel32 source
doc : documentation
loaders/dos : DOS based loader
loaders/boot : boot loader
services : various services (device drivers, filesystems etc)
services/dd : device drivers
services/fs : file systems

View File

@@ -1,130 +0,0 @@
* Introduction
Having successfully built ReactOS and been amazed by what it does, you're
now desperate to fill in some of the omissions, this document shows you how.
* Prerequisites
A working knowledge of NT driver development is useful for understanding the
kernel and some of its abstractions. The NT4 ddk is available for free
download from http://www.microsoft.com/hwdev/. The Windows 98 and Windows
2000 DDKs are also available but the NT4 one is the most useful. See
Legal Stuff below however.
There are a number of books on NT driver development, I would recommend
'Windows NT Device Driver Development' (http://www.osr.com/book/) since OSR
seem to know their stuff. There is only one book on NT filesystem
development 'Windows NT File System Internals'. Please don't buy any of
these books unless you need to, and can afford it.
These mailing lists and newsgroups are useful for NT internals related
questions,
ntfsd@atria.com, ntdev@atria.com
(subscribe by email to majordomo@atria.com)
comp.os.????
microsoft.public.????
* Style
There is no coding style used for ReactOS, however the following guidelines
make things easier
Include information at the top of a module about its purpose, contact
information for its programmer and any useful notes.
Include a comment by each non-trival function describing its arguments,
purpose and any other notes.
Update the documentation in this directory
These guidelines are an ideal, no one manages to implement them all the
time, straightforward working code is probably just as good.
* Debugging
Debugging kernel-mode code is tricky, these are some snippets
DbgPrint writes a message to the console using a printf style format
string. The DPRINT macro (defined in internal/debug.h) expands to
DbgPrint unless NDEBUG is defined, this is useful for having copious
output from a module only when a problem is being debugging. DPRINT
also prefixes the message with the file and line number to make it
easier to see where output is coming from. DbgPrint can be used at any
point including in interrupt handlers.
There are options in ntoskrnl/kd/kdebug.c for copying DbgPrint output
to a serial device or bochs logging port (parallel support should also
be added). This can be useful if a lot of output is being generated.
It should be possible to include support for debugging the kernel with
gdb over a serial line. Bochs (a shareware CPU emulator) is also useful
for debugging the kernel, I wrote some patches to allow capture of console
output from within bochs to file and for debugging a kernel running
under bochs with gdb. Contact me (welch@cwcom.net) if you're are
interested.
If CPU reports an exception not handled by the kernel (any page fault
not part of virtual memory support or any other exception) the kernel
will display output like this and halt
General Protection Fault Exception: 13(0)
CS:EIP xxxxxxxx:xxxxxxx
DS xxxx ES xxxx FS xxxx GS xxxxx
EAX: xxxx EBX: xxxx
....
EDI: xxxx EFLAGS: xxxx ESP: xxxx
cr2: xxxx
Stack: xxxx xxxx xxxx ...
....
Frames: xxxx xxxx xxxx ...
....
The fault type will usually be either 'General Protection' or
'Page Fault', see your Intel manual for the more exotic types. The
'EIP' number is the address of the faulting instruction. If the 'CS'
number is 0x20 then the exception occured in kernel mode, if it is 0x11
then the exception occurred in user mode. 'cr2' is the address that the
faulting instruction was trying to access, if the exception was a page
fault. The number printed after 'Frames' are any addresses on the stack
that look like function addresses.
If the kernel detects a serious problem that it will bug check, displaying
output like this
Bug detected (code x, param x x x x)
Frames: xxx xxxx xxxx
....
Again the numbers printed after 'Frames' are any addresses on the stack
that look like function addresss. Usually the kernel will also print a
message describing the problem in more detail, the bug check code isn't
very useful at the moment.
* Contacts
There is a mailing list for kernel development,
ros-kernel@reactos.com
The main developers use a cvs account to coordinate changes, ask
rex (rex@lvcablemodem.com) for an account if you are going to be adding
a lot of code. Smaller patches can go to the mailing list or to the
relevant developer (usually the comment at the top of a module will have
an email address). Regular snapshots are made available for download,
see the mailing list for announcements.
* Legal stuff
The ReactOS project is GPL'ed, please make sure any code submitted is
compatible with this.
The NT4 ddk license agreement allows its usage for developing nt drivers
only. Legally therefore it can not be used to develop ReactOS, neither the
documentation or the sample code. I'm not a lawyer, but I doubt the
effiacy of 'shrinkwrap licenses' particularly on freely downloadable
software. The only precendent I know of, in a Scottish court, didn't
upload this type of license.
Also the 'fair use' section of copyright law allows the 'quoting' of small
sections from copyrighted documents, e.g. Windows API or DDK documentation

View File

@@ -1,6 +0,0 @@
HACKING: Some notes for adding code to ReactOS
DIRS: Explanation of directory layout
INTERNALS: Some notes on kernel internals
TODO: Bugs and omissions, big and little things that need to be done
NOTES: Unsorted material, some of it is redundant
BUGLIST: Known bugs, please update when you find one

View File

@@ -1,43 +0,0 @@
A collection of articles on kernel internals, please add to this
------------------------------------------------------------------------------
IRQ level
------------------------------------------------------------------------------
IRQ level (IRQL) is a per-processor state in ReactOS used to coordinate
execution between ISRs and between threads. There are several levels
PASSIVE_LEVEL, APC_LEVEL: The normal level for user mode and most
kernel mode code. At the moment APC_LEVEL is unused.
DISPATCH_LEVEL: At this level all irqs are still allowed but thread
rescheduling on the current processor is disabled. This is used by
the spinlock synchronization primitive to implement its uniprocessor
semantics (multiprocessor is more complex). It is also used for some
other forms of synchronization, DPCs for example. Many APIs are
unavailable at this IRQL, usually those that might have to wait. It
is recommended that you don't spend too much time at this IRQL
otherwise system responsiveness will be reduced.
> DISPATCH_LEVEL: Each irq is assigned a priority (which will be
greater than DISPATCH_LEVEL). At an irq's priority level that irq,
lower priority irqs and thread rescheduling are disabled. Higher
priority irqs can still run. Very few APIs are available at IRQLs
greater than DISPATCH_LEVEL.
HIGH_LEVEL: All irqs are disabled.
-------------------------------------------------------------------------------
DPCs
-------------------------------------------------------------------------------
It is a design goal not to spend too much time in ISRs, for this reason
ISRs should postpone most processing till it can run at a lower IRQL. The
mechanism for this is a Delayed Procedure Call (DPC). When a DPC object is
created, it is associated with a function. The DPC object can then be inserted
in the DPC queue from an ISR. If the IRQL on return from the ISR is less than
DISPATCH_LEVEL the DPC queue will be drained, otherwise this will happen when
the IRQL level drops below DISPATCH_LEVEL or the processor becomes idle. When
the DPC queue is drained each DPC object is removed and the associated
function is called at DISPATCH_LEVEL. A DPC object can only be inserted once,
further insertions before it is removed will have no effect.

View File

@@ -1,36 +0,0 @@
APC
Asynchronous procedure call
An APC is a Kernel-defined control object representing a procedure
that is called asynchronously. APCs are thread-context dependent; that
is, they are queued to a particular thread for execution.
There are three different kinds of APCs in NT:
User APCs are used by certain asynchronous NT system services to allow
user-mode applications or protected subsystems to synchronize the
execution of a thread with the completion of an operation or the
occurrence of an event such as a timers expiration. User APCs are, by
default, disabled. That is, they are queued to the user-mode thread,
but they are not executed except at well-defined points in the
program. Specifically, they can only be executed when an application
or protected subsystem has called a wait service and has enabled
alerts to occur, or if it has called the test-alert service.
Kernel APCs are normal kernel-mode APCs. They are much like a normal
user APC except that they are executable by default. That is, they are
enabled except when the thread is already executing a Kernel APC.
(Note that a special Kernel APC always preempts these.)
Special Kernel APCs cannot be blocked except by running at a raised
IRQL. They are executed at APC_LEVEL IRQL (see IDT), in kernel mode.
These types of APCs are used by the system to force a thread to
execute a procedure in the threads context. An example of this is I/O
completion: the I/O Manager needs to get back into the context of the
original requestor of the I/O operation so that it can copy buffers,
and so forth. In order to do this, the I/O Manager must be able to
access the virtual address space of the thread/process, and the most
efficient way to complete the operation is to be in the calling
threads context.

View File

@@ -1,696 +0,0 @@
*** This file contains messages I've culled off the net as well
as previous discussions all of which have useful info on fixes
that need to be added to ReactOS. messages are between five
dashes on a line by themselves. If you implement the fix
reffered to in a message, feel free to delete it from the file.
Rex ***
-----
Subject: [ros-kernel] Inside the Boot Process
Date: Mon, 22 Mar 1999 22:05:47 +0100
From: Emanuele Aliberti <ea@iol.it>
For those working on the boot loader: in WinNt Magazine november 1998
issue (http://www.winntmag.com/) there is a detailed description, by
Mark Russinovich, of the r<>le the MBR, NTLDR, boot.ini, ntdetect.com...
play in the boot process ("Inside the Boot Process, Part 1").
-----
Yes with DPCs, KeDrainDpcQueue should go to HIGH_LEVEL because
it needs to synchronize with KeInsertDpcQueue. Also the idle thread
should run at DISPATCH_LEVEL and regularly drain the dpc queue, that
way if an irq happens and the dpc can't be executed immediately it
will be executed as soon as the processor is idle rather than
waiting for the next timer tick
-----
About the console driver, I think it might be quite useful to have a simple
way for apps to print to the screen for debugging. But when the kernel is more
stable, console handling should be moved to user level because console printing
needs to know about windows and so on which can only be done at user level.
-----
Subject: Re: IMSAMP-how to avoid rebooting?
Date: 9 Nov 1998 00:40:32 -0000
From: Charles Bryant <n51190709.ch@chch.demon.co.uk>
Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode
References: 1, 2 , 3 , 4
In article <un264wzle.fsf@xxx.yyy.zzz>, David C. <qqqq@xxx.yyy.zzz> wrote:
>The reason it won't unload when something is bound to it is the same
>reason you can't unload any other driver that has an open client. If
>you install any driver, and have a user program (or another driver) open
>a handle to it, and then give the "net stop" command to unload it,
>you'll find that the unload will be delayed until the user program
>closes its handle.
When developing a driver I found this to be a considerable nuisance.
Frequently a bug would leave an IRP stuck in the driver and I
couldn't unload and reload a fixed version. While reading NTDDK.H I
found a suspicious constant and discovered that the Flags field in
the device (the one which you OR in DO_BUFFERED_IO or DO_DIRECT_IO)
has a bit called DO_UNLOAD_PENDING. By experiment I confirmed that
this bit is set when you do 'net stop', so a driver can check it
periodically (e.g. from a timer DPC every ten seconds) and cancel all
queued IRPs if it is found to be set.
Since this is not documented anywhere that I can find, it might be
unwise to rely on it for production code, but it is very useful for
debugging. Maybe someone with internals knowledge can comment on the
reliability of it.
-----
Subject: Re: Kernel bugs
Date: Fri, 23 Oct 1998 12:08:36 -0700
From: rex <rex@lvcablemodem.com>
To: Jason Filby <jasonfilby@yahoo.com>
References: 1
Jason Filby wrote:
> Hi,
>
> Ok -- here's most of what I get when I press a key:
>
> Page fault detected at address 1fd4 with eip c042f794
> Recursive page fault detected
> Exception 14(2)
> CS:EIP 20:c042f794
>
> Rex -- do you know of anyway to find out which function in what file
> is causing the exception? I know that for problems in the kernel, you
> just look in the ntoskrnl\kernel.sym file and find the EIP value which
> matches the one given in the exception debug text. But what about
> modules? How can we track exceptions that occur in functions in modules?
>
I know this is a little belated, but I thought I'd take astab at answering
this anyway. add an option to the
makefile for the module to generate a listing file with
symbol information. Then, on a boot test, note the
address that the module is loaded at, and subtract
this from the EIP value. add any offset used in the
module link specification (I dont think there currently
is one), and look for the last symbol with a lower
address offset.
Brian, I have an idea on how to make this exception
dump information a little more useful. We should
have the load information for the load modules
in memory somewhere. Perhaps the exception
dump could check offending addresses to see if
they lie in the kernel or in a module, and if they
lie in a module the proper offset could be subtracted
and this number could be displayed seperately. If
I get a chance today, I'll make this change and send
it to ya.
Rex.
-----
Subject: [ros-kernel] Pet peeve of the week
Resent-Date: Sun, 25 Oct 1998 11:57:40 -0600
Resent-From: ros-kernel@sid-dis.com
Date: Sun, 25 Oct 1998 09:53:48 -0800
From: rex <rex@lvcablemodem.com>
Reply-To: <ros-kernel@sid-dis.com>
To: ReactOS Kernel Forum <ros-kernel@sid-dis.com>
Hi all,
I guess it's about time to start another mailstorm
on the list. :)
I have a suggestion for a change to the kernel.
It not a very big change, and I hope everyone
will agree that it makes sense.
There is a structure used in many places in the
kernel called LARGE_INTEGER. the is also
a version called ULARGE_INTEGER, but it
is not used at all as far as I can tell. this structure
is equivalent to a long long int. You can literally
cast a pointer to a LARGE_INTEGER to a
long long int and all manipulation will work
seemlessly. My suggestion is that we replace the
use of this structure with long long ints. Even
microsoft, in their infinite wisdom, has made this
suggestion in the DDK documentation. If you're
wondering where, look at the RTL functions
that manipulate LARGE_INTEGER structs.
Replacing LI's with long long ints will work
because they are binary compatable. All software
compiled to use LI's will manipulate long long ints
correctly and vice versa. There is one problem
with this suggestion: the LARGE_INTEGER type
is a structure containing 2 members. Any code
that accesses the structure by members will break.
I think the kernel side impact is minimal, and is
worth the change. However, the structure is used
in several of the Win32 API functions, and needs
to remain there. I think we build a conditionally
compiled version of the LARGE_INTEGER type.
In kernel mode code (the kernel proper and drivers)
the LARGE INTEGER will be the following:
typedef long long int LARGE_INTEGER,
*PLARGE_INTEGER;
typedef unsigned long long int ULARGE_INTEGER,
*PULARGE_INTEGER;
and in user mode code it will expand out to the
current definition (which by the way, is not
strictly correct, but can't be because it uses a
MS compiler extension).
Brian, I would be willing to make the conversion
to those kernel modules that needed it, and of
course to the IDE driver if we want to go forward
with the change.
Lastly, I'll mention what made me consider this.
I was fixing the timer routines, and two of the
three problems turned out to be related to LI
conversion problems.
Rex.
-----
Subject: Re: [ros-kernel] Pet peeve of the week
Date: Thu, 29 Oct 1998 19:10:37 +0100
From: Boudewijn <ariadne@xs4all.nl>
To: rex@lvcablemodem.com
References: 1
Hai Rex
I think it is a good idea to wrap a makro around the member access
to large integers.
I haven't tested this, but do you think this is a good sugestion ?
#ifdef COMPILER_LARGE_INTEGERS
#define GET_LARGE_INTEGER_HIGH_PART(LargeInteger) ( ( LargeInteger >>
32) )
#define GET_LARGE_INTEGER_LOW_PART(LargeInteger) ( (LargeInteger &
0xFFFFFFFF) )
#define SET_LARGE_INTEGER_HIGH_PART(LargeInteger,Signed_Long) (
LargeInteger |= ( ((LARGE_INTEGER)Signed_Long) << 32 ) )
#define SET_LARGE_INTEGER_LOW_PART(LargeInteger,Unsigned_Long) (
LargeInteger |= Unsigned_Long )
#else
#define GET_LARGE_INTEGER_HIGH_PART(LargeInteger) ( (
LargeInteger.HighPart) )
#define GET_LARGE_INTEGER_LOW_PART(LargeInteger) (
(LargeInteger.LowPart) )
#define SET_LARGE_INTEGER_HIGH_PART(LargeInteger,Signed_Long) (
LargeInteger.HighPart= Signed_Long )
#define SET_LARGE_INTEGER_LOW_PART(LargeInteger,Unsigned_Long) (
LargeInteger.LowPart = Unsigned_Long )
#endif
Boudewijn
-----
Subject: Re: Question on "Sending buffers on the stack to asynchronous DeviceIoControl with buffered I/O"
Date: Mon, 16 Nov 1998 11:24:57 -0800
From: "-Paul" <paulsan@microsoftSPAM.com>
Organization: Microsoft Corp.
Newsgroups: microsoft.public.win32.programmer.kernel, comp.os.ms-windows.programmer.nt.kernel-mode
References: 1
Radu, I post the following information occassionally for questions such as
yours. I hope it helps.
-Paul
Here is an explanation of buffers and DeviceIoControl.
First, here are the parameters,
BOOL DeviceIoControl(
HANDLE hDevice, // handle to device of interest
DWORD dwIoControlCode, // control code of operation to perform
LPVOID lpInBuffer, // pointer to buffer to supply input data
DWORD nInBufferSize, // size of input buffer
LPVOID lpOutBuffer, // pointer to buffer to receive output data
DWORD nOutBufferSize, // size of output buffer
LPDWORD lpBytesReturned, // pointer to variable to receive output byte
count
LPOVERLAPPED lpOverlapped // pointer to overlapped structure for
asynchronous operation
);
METHOD_BUFFERED
user-mode perspective
lpInBuffer - optional, contains data that is written to the driver
lpOutBuffer - optional, contains data that is read from the driver after
the call has completed
lpInBuffer and lpOutBuffer can be two buffers or a single shared buffer.
If a shared buffer, lpInBuffer is overwritten by lpOutBuffer.
I/O Manager perspective
examines nInBufferSize and nOutBufferSize. Allocates memory from non-paged
pool and puts the address of this pool in Irp->AssociatedIrp.SystemBuffer.
The size of this buffer is equal to the size of the larger of the two
bufferes. This buffer is accessible at any IRQL.
copies nInBufferSize to irpSp->Parameters.DeviceIoControl.InputBufferLength
copies nOutBufferSize to
irpSp->Parameters.DeviceIoControl.OutputBufferLength
copies contents of lpInBuffer to SystemBuffer allocated above
calls your driver
Device Driver perspective
you have one buffer, Irp->AssociatedIrp.SystemBuffer. You read input data
from this buffer and you write output data to the same buffer, overwriting
the input data.
Before calling IoCompleteRequest, you must
- set IoStatus.Status to an approriate NtStatus
- if IoStatus.Status == STATUS_SUCCESS
set IoStatus.Information to the
number of bytes you want copied
from the SystemBuffer back into
lpOutBuffer.
I/O Manager Completion Routine perspective
looks at IoStatus block, if IoStatus.Status = STATUS_SUCCESS, copies the
number of bytes specified by IoStatus.Information from
Irp->AssociatedIrp.SystemBuffer into lpOutBuffer
completes the request
METHOD_IN_DIRECT
user-mode perspective
lpInBuffer - optional, contains data that is written to the driver. This
buffer is used in the exact same fashion as METHOD_BUFFERED. To avoid
confusion, mentally rename this buffer to lpControlBuffer. This is
typically a small, optional buffer that might contain a control structure
with useful information for the device driver. This buffer is smal and is
double buffered.
lpOutBuffer - NOT OPTIONAL, This LARGE buffer contains data that is read by
the driver. To avoid confusion, mentally rename this buffer to
lpDataTransferBuffer. This is physically the same buffer that the device
driver will read from. There is no double buffering. Technically, this
buffer is still optional, but since you are using this buffering method,
what would be the point???
I/O Manager perspective
If lpInBuffer exists, allocates memory from non-paged pool and puts the
address of this pool in Irp->AssociatedIrp.SystemBuffer. This buffer is
accessible at any IRQL.
copies nInBufferSize to irpSp->Parameters.DeviceIoControl.InputBufferLength
copies nOutBufferSize to
irpSp->Parameters.DeviceIoControl.OutputBufferLength
copies contents of lpInBuffer to SystemBuffer allocated above
So far this is completely identical to METHOD_BUFFERED. Most likely
lpInBuffer (mentally renamed to lpControlBuffer) is very small in size.
For lpOutBuffer (mentally renamed to lpDataTransferBuffer), an MDL is
allocated. lpOutBuffer is probed and locked into memory. Then, the user
buffer virtual addresses are checked to be sure they are readable in the
caller's access mode.
The MDL is address is stored in Irp->MdlAddress.
Your driver is called.
Device Driver perspective
The device driver can read the copy of lpOutBuffer via
Irp->AssociatedIrp.SystemBuffer. Anything written by the device driver to
this buffer is lost. The I/O Manager does not copy any data back to the
user-mode buffers as it did in the completion routine for METHOD_BUFFERED.
Art Baker's book is wrong in this respect (page 168, "data going from the
driver back to the caller is passed through an intermediate system-space
buffer" and page 177, "When the IOCTL IRP is completed, the contents of the
system buffer will be copied back into the callers original output buffer".
The device driver accesses the Win32 buffer directly via Irp->MdlAddress.
The driver uses whatever Mdl API's to read the buffer. Usually, this
buffer is to be written to some mass storage media or some similar
operation. Since this is a large data transfer, assume a completion
routine is required.
mark the Irp pending
queue it
return status pending
Device Driver Completion Routine perspective
standard completion routine operations
set IoStatus.Status to an approriate NtStatus
IoStatus.Information is not needed
completete the request
I/O Manager Completion Routine perspective
standard I/O Manager completion routine operations
unmap the pages
deallocate the Mdl
complete the request
METHOD_OUT_DIRECT
user-mode perspective
lpInBuffer - optional, contains data that is written to the driver. This
buffer is used in the exact same fashion as METHOD_BUFFERED. To avoid
confusion, mentally rename this buffer to lpControlBuffer. This is
typically a small, optional buffer that might contain a control structure
with useful information for the device driver. This buffer is smal and is
double buffered.
lpOutBuffer - NOT OPTIONAL, This LARGE buffer contains data that is written
by the driver and read by the wer-mode application when the request is
completed. To avoid confusion, mentally rename this buffer to
lpDataTransferBuffer. This is physically the same buffer that the device
driver will write to. There is no double buffering. Technically, this
buffer is still optional, but since you are using this buffering method,
what would be the point???
I/O Manager perspective
If lpInBuffer exists, allocates memory from non-paged pool and puts the
address of this pool in Irp->AssociatedIrp.SystemBuffer. This buffer is
accessible at any IRQL.
copies nInBufferSize to irpSp->Parameters.DeviceIoControl.InputBufferLength
copies nOutBufferSize to
irpSp->Parameters.DeviceIoControl.OutputBufferLength
copies contents of lpInBuffer to SystemBuffer allocated above
So far this is completely identical to METHOD_BUFFERED. Most likely
lpInBuffer (mentally renamed to lpControlBuffer) is very small in size.
For lpOutBuffer (mentally renamed to lpDataTransferBuffer), an MDL is
allocated. lpOutBuffer is probed and locked into memory. Then the user
buffer's addresses are checked to make sure the caller could write to them
in the caller's access mode.
The MDL is address is stored in Irp->MdlAddress.
Your driver is called.
Device Driver perspective
The device driver can read the copy of lpOutBuffer via
Irp->AssociatedIrp.SystemBuffer. Anything written by the device driver to
this buffer is lost.
The device driver accesses the Win32 buffer directly via Irp->MdlAddress.
The driver uses whatever Mdl API's to write data to the buffer. Usually,
this buffer is to be read from some mass storage media or some similar
operation. Since this is a large data transfer, assume a completion
routine is required.
mark the Irp pending
queue it
return status pending
Device Driver Completion Routine perspective
standard completion routine operations
set IoStatus.Status to an approriate NtStatus
IoStatus.Information is not needed
completete the request
I/O Manager Completion Routine perspective
standard I/O Manager completion routine operations
unmap the pages
deallocate the Mdl
complete the request
METHOD_NEITHER
I/O Manager perspective
Irp->UserBuffer = lpOutputBuffer;
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer = lpInputBuffer;
No comments here. Don't use METHOD_DIRECT unless you know what you are
doing. Simple rule.
If your IOCtl involves no data transfer buffers, then METHOD_NEITHER is the
fastest path through the I/O Manager that involves an Irp.
Final Comment
Don't touch Irp->UserBuffer. This is a bookmark for the I/O Manager. Two
major problems can occur. 1 - page fault at high IRQL, or 2 - you write
something to Irp->UserBuffer and the I/O Manager overwrites you in its
completion routine. File systems access Irp->UserBuffer, but FSD writers
know all of the above and know when it is safe to touch Irp->UserBuffer.
Radu Woinaroski wrote in message <364F8F6E.2434B010@scitec.com.au>...
>Hello,
>
>I have a kernel-mode device driver that accepts a number of IoControl
>commands that use buffered data transfer (METHOD_BUFFERED).
>
>A user mode API provides a higher level access then the DeviceIoControl
>function.
>
>The function is implemented like that
>
>BOOL
Something(
> HANDLE hDevice ,
> int param1,
> int param2,
> DWORD * pReturn,
> LPOVERLAPPED pOverlapped)
>{
> // here a data buffer on the stack sent to asynchronous DeviceIoControl
>call
> int aDataIn[2];
> aDataIn[0] = param1;
> aDataIn[1] = param2;
>
> return DeviceIoControl(
> hDevice,
> DO_SOMETHING_IO,
> aDataIn,
> sizeof(int)*2,
> pReturn,
> sizeof(DWORD),
> pOverlapped);
>}
>
>The aDataIn buffer will not exist after DeviceIoControl returns (and
>when the I/O operation terminates). I know that for buffered IO the
>input data buffer is copyed by de IOManager to a nonpaged-pool area
>before passing the request to driver dispatch routine (DeviceControl).
>At the point of calling the dispatch routine (DeviceControl) the driver
>runs in the context of the calling thread so DeviceIoControl hasn't
>returned yet (?? or so I think) so aDataI
n will still be valid at the
>time IOManager copyes it to its buffer. So, this apears to work ok (at
>least in my opinion).
>
>Does I/O Manager use the Input buffer from the call to the Win32
>DeviceIoControl any where else after the first copy ?
>
>Is there any reason why this approach (passing a buffer on the stack to
>a asynchronous DeviceIoControl that uses buffered I/O) wouldn't work ?
>
>Allocating buffers from heap and deleting them on IO completion while
>managing asynchronous IO seems too much work ;-) .
>
>Thanks in advance for your opinions
>Radu W.
>
>--
>Radu Woinaroski
>Scitec
>Sydney, Australia
>Radu.Woinaroski@scitec.com.au
-----
Subject: Re: PCI ISR problem
Date: Fri, 20 Nov 1998 18:04:48 GMT
From: jeh@cmkrnl.com (Jamie Hanrahan)
Organization: Kernel Mode Systems, San Diego, CA
Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode
References: 1
On Thu, 19 Nov 1998 15:46:13 -0600, Eric Gardiner
<eric.gardiner@natinst.com> wrote:
>I'm having problems with NT4 not hooking the interrupt line indicated by
>a PCI device. Here's what I'm doing:
>
>1) Enumerating the PCI buses on the system (using HalGetBusData) until
>I find my device.
>2) Once my device is found, I read the "Interrupt Line Register" in the
>device's PCI config space to determine what interrupt level to pass to
>HalGetInterruptVector.
Whups! No. Call HalAssignSlotResources and look at the returned
CM_RESOURCE_LIST to find the vector, level, port addresses, etc., for
your device. (Then pass the returned CM_RESOURCE_LIST to ExFreePool.)
See Knowledge Base article Q152044.
--- Jamie Hanrahan, Kernel Mode Systems, San Diego CA (jeh@cmkrnl.com)
Drivers, internals, networks, applications, and training for VMS and Windows NT
NT kernel driver FAQ, links, and other information: http://www.cmkrnl.com/
Please post replies, followups, questions, etc., in news, not via e-mail.
-----
Subject: Re: IRP canceling
Date: Mon, 23 Nov 1998 09:05:47 -0500
From: Walter Oney <waltoney@oneysoft.com>
Organization: Walter Oney Software
Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode
References: 1
Seol,Keun Seok wrote:
> But, if the IRP was the CurrentIrp of the Device Object,
> the Driver's Start I/O routine will try to process the IRP.
> In the DDK help, the Start I/O routine MUST check the current IRP's
> Cancel bit.
> If set, Start I/O routine must just return.
>
> But I think that the IRP already completed should not be accessed.
You're absolutely right. I recommend the following code in a standard
StartIo routine to avoid the problem you point out:
VOID StartIo(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
KIRQL oldirql;
IoAcquireCancelSpinLock(&oldirql);
if (Irp != DeviceObject->CurrentIrp || Irp->Cancel)
{
IoReleaseCancelSpinLock(oldirql);
return;
}
else
{
IoSetCancelRoutine(Irp, NULL);
IoReleaseCancelSpinLock(oldirql);
}
. . .
}
This dovetails with a standard cancel routine:
VOID CancelRoutine(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
if (DeviceObject->CurrentIrp == Irp)
{
IoReleaseCancelSpinLock(Irp->CancelIrql);
IoStartNextPacket(DeviceObject, TRUE);
}
else
{
KeRemoveEntryDeviceQueue(&DeviceObject->DeviceQueue,
&Irp->Tail.Overlay.DeviceQueueEntry);
IoReleaseCancelSpinLock(Irp->CancelIrql);
}
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
You need to remember that the C language specification requires that
evaluation of boolean operators short circuit when the result is known.
So, if StartIo discovers that the Irp it got as an argument is not the
same as CurrentIrp, it will not attempt to evaulate Irp->Cancel.
Now, as to why this works: StartIo gets called either by IoStartPacket
or IoStartNextPacket. Each of them will grab the cancel spin lock and
set CurrentIrp, then release the spin lock and call StartIo. If someone
should sneak in on another CPU and cancel this very same IRP, your
cancel routine will immediately release the spin lock and call
IoStartNextPacket. One of two things will then happen. IoStartNextPacket
may succeed in getting the cancel spin lock, whereupon it will nullify
the CurrentIrp pointer. If another IRP is on the queue, it will remove
it from the queue, set CurrentIrp to point to this *new* IRP, release
the spin lock, and call StartIo. [You now have two instances of StartIo
running on two different CPUs for two different IRPs, but it's not a
problem because they won't be able to interfere with each other.]
Meanwhile, your original instance of StartIo gets the cancel spin lock
and sees that CurrentIrp is not equal to the IRP pointer it got as an
argument, so it gives up.
The second way this could play out is that StartIo gets the cancel lock
before IoStartNextPacket does. In this case, CurrentIrp is still
pointing to the IRP that's in the process of being cancelled and that
StartIo got as an argument. But this IRP hasn't been completed yet (the
CPU that's running your cancel routine is spinning inside
IoStartNextPacket and therefore hasn't gotten to calling
IoCompleteRequest yet), so no-one will have been able to call IoFreeIrp
to make your pointer invalid.
People may tell you that you should be using your own queues for IRPs so
you can avoid bottlenecking the system on the global cancel spin lock.
That's true enough, but doing it correctly with Plug and Play and Power
management things in the way is gigantically complicated. There's a
sample in the NT 5 beta-2 DDK called CANCEL that shows how to manage
your own queue if you don't worry about PNP and POWER. I hear tell of an
upcoming MSJ article by a Microsoft developer that may solve the
complete problem.
-----
Subject: ANNOUNCE: ALINK v1.5
Date: 16 Nov 1998 16:36:05 GMT
From: anthony_w@my-dejanews.com
Organization: Deja News - The Leader in Internet Discussion
Newsgroups: comp.os.ms-windows.programmer.win32, comp.lang.asm.x86, comp.os.msdos.programmer
ALINK is a freeware linker, creating MSDOS COM and EXE files and Win32 PE EXE
and DLL files from OMF format OBJ and LIB files, win32-COFF format OBJ files,
and win32 RES files.
NEW for version 1.5:
Win32 COFF object file support.
Download it now from my home page.
Anthony
--
anthony_w@geocities.com
http://www.geocities.com/SiliconValley/Network/4311/index.html
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
-----

View File

@@ -1,59 +0,0 @@
* Critical path tasks
Test and debug Registry routines
Finish multiple system service table support (HalRegisterServiceTable)
Modify GENNTDLL to generate all needed system service tables
* These tasks would be nice
Separate HAL into KM DLL
* Function groups totally or partially unimplemented
Dma functions (see hal/x86/dma.c)
PCI interface functions (see hal/x86/bios32.c, hal/x86/pci.c)
HalExamineMbr
Locale support (see ex/locale.c)
Shutdown support (see ex/power.c)
Zw(Set/Get)SystemInformation (see ex/sysinfo.c)
Adapter functions (see io/adapter.c)
Io cancelation support (see io/cancel, et al)
Directory change notification (see io/dir.c)
Error logging (see io/errlog.c)
Buffer flushing (see io/flush.c)
Io completion ports (see io/iocomp.c)
File locking (see io/lock.c)
Mailslots (see io/mailslot.c)
Named pipes (see io/npipe.c)
Hardware resource management (see io/resource.c)
File access checking (see io/share.c)
APCs to user-mode (see ke/apc.c, ke/apchelp.asm)
Exception support (see ke/catch.c)
Mutex support (see ke/mutex.c)
Semaphore support (see ke/sem.c)
Timer support (see ke/timer.c)
Properly calibrate delay loop (see ke/timer.c)
Waiting for multiple objects (see ke/wait.c)
Single linked lists (see rtl/slist.c)
Sequenced lists (see rtl/seqlist.c)
* Verify implementation
Fast mutexes (see ex/fmutex.c)
* Major areas
Security support (see se/*.c)
Registry support (see cm/*.c)
Paging support
File system cache support
SCSI miniport driver
Network support
Video drivers
USER and GDI modules
* Drivers
NTFS, EXT2 filesystems
Many others (use oem's where possible)
* For the future
DOS, Win16, POSIX subsystems

View File

@@ -1,4 +0,0 @@
base.tmp
junk.tmp
temp.exp

View File

@@ -1,290 +0,0 @@
/* $Id: beep.c,v 1.4 1999/10/16 12:41:42 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/dd/beep/beep.c
* PURPOSE: BEEP device driver
* PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
* UPDATE HISTORY:
* 30/01/99 Created
* 16/10/99 Minor fixes
*/
/* INCLUDES ****************************************************************/
#include <ddk/ntddk.h>
#include <ddk/ntddbeep.h>
#define NDEBUG
#include <internal/debug.h>
/* TYEPEDEFS ***************************************************************/
typedef struct tagBEEP_DEVICE_EXTENSION
{
KDPC Dpc;
KTIMER Timer;
KEVENT Event;
BOOL BeepOn;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
/* FUNCTIONS ***************************************************************/
VOID BeepDPC (PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
{
PDEVICE_EXTENSION DeviceExtension = DeferredContext;
DPRINT ("BeepDPC() called!\n");
HalMakeBeep (0);
DeviceExtension->BeepOn = FALSE;
KeSetEvent (&(DeviceExtension->Event), 0, TRUE);
DPRINT ("BeepDPC() finished!\n");
}
NTSTATUS BeepCreate (PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status;
if (Stack->MajorFunction == IRP_MJ_CREATE)
{
DPRINT ("BeepCreate() called!\n");
Irp->IoStatus.Information = 0;
status = STATUS_SUCCESS;
}
else
status = STATUS_NOT_IMPLEMENTED;
Irp->IoStatus.Status = status;
IoCompleteRequest (Irp,IO_NO_INCREMENT);
return (status);
}
NTSTATUS BeepClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation (Irp);
NTSTATUS status;
switch (Stack->MajorFunction)
{
case IRP_MJ_CLOSE:
DPRINT ("BeepClose() called!\n");
Irp->IoStatus.Information = 0;
status = STATUS_SUCCESS;
break;
default:
status = STATUS_NOT_IMPLEMENTED;
}
Irp->IoStatus.Status = status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return (status);
}
NTSTATUS BeepCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation (Irp);
NTSTATUS status;
if (Stack->MajorFunction == IRP_MJ_CLEANUP)
{
DPRINT ("BeepCleanup() called!\n");
Irp->IoStatus.Information = 0;
status = STATUS_SUCCESS;
}
else
status = STATUS_NOT_IMPLEMENTED;
Irp->IoStatus.Status = status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return (status);
}
NTSTATUS BeepDeviceControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
PDEVICE_EXTENSION DeviceExtension;
PBEEP_SET_PARAMETERS pbsp;
NTSTATUS status;
DeviceExtension = DeviceObject->DeviceExtension;
DPRINT ("BeepDeviceControl() called!\n");
if (Stack->Parameters.DeviceIoControl.IoControlCode == IOCTL_BEEP_SET)
{
Irp->IoStatus.Information = 0;
if (Stack->Parameters.DeviceIoControl.InputBufferLength == sizeof(BEEP_SET_PARAMETERS))
{
pbsp = (PBEEP_SET_PARAMETERS)Irp->AssociatedIrp.SystemBuffer;
if (pbsp->Frequency >= BEEP_FREQUENCY_MINIMUM &&
pbsp->Frequency <= BEEP_FREQUENCY_MAXIMUM)
{
LARGE_INTEGER DueTime;
DueTime.QuadPart = 0;
/* do the beep!! */
DPRINT ("Beep:\n Freq: %lu Hz\n Dur: %lu ms\n",
pbsp->Frequency, pbsp->Duration);
if (pbsp->Duration >= 0)
{
DueTime.QuadPart = (LONGLONG)pbsp->Duration * -10000;
KeSetTimer (&DeviceExtension->Timer,
DueTime,
&DeviceExtension->Dpc);
HalMakeBeep (pbsp->Frequency);
DeviceExtension->BeepOn = TRUE;
KeWaitForSingleObject (&(DeviceExtension->Event),
Executive,
KernelMode,
FALSE,
NULL);
}
else if (pbsp->Duration == (DWORD)-1)
{
if (DeviceExtension->BeepOn)
{
HalMakeBeep (0);
DeviceExtension->BeepOn = FALSE;
}
else
{
HalMakeBeep (pbsp->Frequency);
DeviceExtension->BeepOn = TRUE;
}
}
DPRINT ("Did the beep!\n");
status = STATUS_SUCCESS;
}
else
{
status = STATUS_INVALID_PARAMETER;
}
}
else
{
status = STATUS_INVALID_PARAMETER;
}
}
else
{
status = STATUS_NOT_IMPLEMENTED;
}
Irp->IoStatus.Status = status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return (status);
}
NTSTATUS BeepUnload(PDRIVER_OBJECT DriverObject)
{
DPRINT ("BeepUnload() called!\n");
return (STATUS_SUCCESS);
}
STDCALL NTSTATUS
DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
/*
* FUNCTION: Called by the system to initalize the driver
* ARGUMENTS:
* DriverObject = object describing this driver
* RegistryPath = path to our configuration entries
* RETURNS: Success or failure
*/
{
PDEVICE_OBJECT DeviceObject;
PDEVICE_EXTENSION DeviceExtension;
NTSTATUS ret;
ANSI_STRING ansi_device_name;
UNICODE_STRING device_name;
ANSI_STRING asymlink_name;
UNICODE_STRING symlink_name;
DbgPrint ("Beep Device Driver 0.0.2\n");
RtlInitAnsiString (&ansi_device_name, "\\Device\\Beep");
RtlAnsiStringToUnicodeString (&device_name, &ansi_device_name, TRUE);
ret = IoCreateDevice (DriverObject,
sizeof(DEVICE_EXTENSION),
&device_name,
FILE_DEVICE_BEEP,
0,
FALSE,
&DeviceObject);
if (ret!=STATUS_SUCCESS)
{
return (ret);
}
/* prelininary */
RtlInitAnsiString (&asymlink_name, "\\??\\Beep");
RtlAnsiStringToUnicodeString (&symlink_name, &asymlink_name, TRUE);
IoCreateSymbolicLink (&symlink_name, &device_name);
DriverObject->MajorFunction[IRP_MJ_CREATE] = BeepCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = BeepClose;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = BeepCleanup;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = BeepDeviceControl;
DriverObject->DriverUnload = BeepUnload;
/* set up device extension */
DeviceExtension = DeviceObject->DeviceExtension;
DeviceExtension->BeepOn = FALSE;
KeInitializeDpc (&(DeviceExtension->Dpc),
BeepDPC,
DeviceExtension);
KeInitializeTimer (&(DeviceExtension->Timer));
KeInitializeEvent (&(DeviceExtension->Event),
SynchronizationEvent,
FALSE);
return (STATUS_SUCCESS);
}
/* EOF */

View File

@@ -1,39 +0,0 @@
#include <defines.h>
#include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "PC Speaker Device Driver\0"
VALUE "FileVersion", "0.0.2\0"
VALUE "InternalName", "beep\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "beep.sys\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

Some files were not shown because too many files have changed in this diff Show More