Compare commits

...

428 Commits

Author SHA1 Message Date
The ReactOS Team
6caaf63c2c This commit was manufactured by cvs2svn to create tag 'krnl0015'.
svn path=/tags/krnl0015/; revision=940
2000-01-19 07:05:04 +00:00
Rex Jolliff
90e1f4cbf9 changes to support v15 release
svn path=/trunk/; revision=939
2000-01-19 07:05:04 +00:00
Eric Kohl
921363d647 Changed debug output to use INT 2D
svn path=/trunk/; revision=938
2000-01-18 12:04:45 +00:00
Eric Kohl
8234dea660 Changed debug output to use INT 2D
Ooops! This one was missing! Sorry!

svn path=/trunk/; revision=937
2000-01-18 11:04:53 +00:00
Eric Kohl
88cb154d19 Changed debug output to use INT 2D
svn path=/trunk/; revision=936
2000-01-17 21:02:50 +00:00
Phillip Susi
faac123528 fixed tab completion with long file names
svn path=/trunk/; revision=935
2000-01-17 02:17:50 +00:00
Emanuele Aliberti
e857e97df1 Some more stubs for NDIS.SYS.
svn path=/trunk/; revision=934
2000-01-16 18:32:34 +00:00
Emanuele Aliberti
d508a1f0bf Added two missing names.
svn path=/trunk/; revision=933
2000-01-16 18:31:48 +00:00
Eric Kohl
013fc117b8 Added missing features and functions
Cleaned confusing file naming

svn path=/trunk/; revision=932
2000-01-14 02:23:25 +00:00
Eric Kohl
3d1f2d98ba Added missing printf() functions
Changed format %w to %S and %W to %wZ

svn path=/trunk/; revision=931
2000-01-12 19:05:32 +00:00
Eric Kohl
de66c40007 Disabled debugging messages
svn path=/trunk/; revision=930
2000-01-11 17:33:44 +00:00
Eric Kohl
6cc53dd4b3 Fixed process parameters
Simplified current directory code
Added %C and %S formats to printf()
Changed %w to %S
Fixed compiler warnings

svn path=/trunk/; revision=929
2000-01-11 17:32:13 +00:00
Eric Kohl
fb7f4582cd Fixed ctype and Rtl functions
svn path=/trunk/; revision=928
2000-01-11 01:16:50 +00:00
Emanuele Aliberti
a11a76eaef Some more NTOSKRNL.FsRtl stubs.
svn path=/trunk/; revision=927
2000-01-10 22:46:38 +00:00
Eric Kohl
be132afdf2 Added DbgPrint()
Fixed some Rtl functions
Added missing printf() and wprintf() functions

svn path=/trunk/; revision=926
2000-01-10 20:34:41 +00:00
Eric Kohl
686387f8e0 Removed fixed screen size code
svn path=/trunk/; revision=925
2000-01-09 23:16:41 +00:00
Eric Kohl
492a608e06 Fixed hal display bug
svn path=/trunk/; revision=924
2000-01-09 21:39:07 +00:00
Emanuele Aliberti
fd411d8b8c New year in c/r string.
svn path=/trunk/; revision=923
2000-01-08 16:17:50 +00:00
Eric Kohl
6f3d53f751 Added reading screen sizes from crt controller
svn path=/trunk/; revision=922
2000-01-07 18:57:33 +00:00
Emanuele Aliberti
462fe323eb A few more return structures for NtQuerySystemInformation
svn path=/trunk/; revision=921
2000-01-06 13:17:48 +00:00
David Welch
4d8c6a710b Removed debug messages from queuing code (sorry)
Added __int64 datatype to files that use it
Hid bug in ide driver (or somewhere) for now

svn path=/trunk/; revision=920
2000-01-06 00:26:16 +00:00
David Welch
623093eaaa Implemented more security functions
Moved general security types into new header file
Implemented ThreadImpersonationToken info class
Bug fixes to queuing code

svn path=/trunk/; revision=919
2000-01-05 21:57:00 +00:00
Eric Kohl
453f513ed3 Fixed ctype table and functions.
svn path=/trunk/; revision=918
2000-01-05 19:42:56 +00:00
Eric Kohl
57919a833e Fixed ctype table.
svn path=/trunk/; revision=917
2000-01-05 17:49:00 +00:00
David Welch
e6b5c8bfc7 Disabled pragma statement that was causing problems
svn path=/trunk/; revision=916
2000-01-02 14:21:04 +00:00
Eric Kohl
974095c413 Added mbtowc(), mbstowcs(), wctomb() and wcstombs()
svn path=/trunk/; revision=914
1999-12-30 14:39:43 +00:00
David Welch
a8ca53d761 Added some additional csrss work
Some fixes to the queueing code
Some fixes to the lpc code
Fix to section code

svn path=/trunk/; revision=913
1999-12-30 01:51:42 +00:00
Eric Kohl
c54d897571 Added even more missing functions
svn path=/trunk/; revision=912
1999-12-30 01:33:47 +00:00
Eric Kohl
17afcb4dfd Added some missing debug, math and ctype functions
svn path=/trunk/; revision=911
1999-12-29 17:13:27 +00:00
Eric Kohl
2284e742b3 Fixed implementation of register io functions
Added luid functions

svn path=/trunk/; revision=910
1999-12-29 01:37:30 +00:00
Eric Kohl
c7580dacf3 Last update for millenium release
Fixed some minor bugs
Fixed window title

svn path=/trunk/; revision=909
1999-12-28 23:13:38 +00:00
Eric Kohl
9446011fc1 Minor update
svn path=/trunk/; revision=908
1999-12-28 16:25:21 +00:00
Emanuele Aliberti
586433918e Some more NDIS stubs.
svn path=/trunk/; revision=907
1999-12-27 22:27:39 +00:00
Eric Kohl
b9579544e7 Removed cmd target
svn path=/trunk/; revision=906
1999-12-27 15:07:00 +00:00
Eric Kohl
005106acbb Fixed some more STDCALL issues
svn path=/trunk/; revision=905
1999-12-27 15:06:13 +00:00
Emanuele Aliberti
38d1018911 Added (io/create.c) IoCreateFile stub.
svn path=/trunk/; revision=904
1999-12-26 20:21:03 +00:00
Emanuele Aliberti
ea5959a772 Some missing __stdcall declarations added in headers and in code.
svn path=/trunk/; revision=903
1999-12-26 17:22:19 +00:00
Emanuele Aliberti
6b50f46c2f Some old Fs/Po code added to the makefile
svn path=/trunk/; revision=902
1999-12-26 16:36:46 +00:00
David Welch
4d5643a96a Added some security functions
Changes to csrss console support
Fixed bug in gdt.c

svn path=/trunk/; revision=901
1999-12-26 15:50:53 +00:00
Eric Kohl
128cfc8af0 Fixed compiler warnings
svn path=/trunk/; revision=900
1999-12-24 17:20:54 +00:00
Eric Kohl
a7a23b4dc3 Added missing test
svn path=/trunk/; revision=899
1999-12-24 17:16:32 +00:00
David Welch
dbd051cad4 Corrected additional object manager issues pointed by Philip Susi
Began added console i/o code to csrss (not working yet)
Corrected long standing page fault bug (not zeroing allocated page)

svn path=/trunk/; revision=898
1999-12-22 14:48:30 +00:00
Phillip Susi
1667a4589a fixed typeo
svn path=/trunk/; revision=897
1999-12-20 21:30:13 +00:00
Eric Kohl
6a617736e9 Fixed a compiler warning
svn path=/trunk/; revision=896
1999-12-20 21:05:53 +00:00
Phillip Susi
d832a87f14 fixed missing dereference and cleaned up code in NtCreateEvent
svn path=/trunk/; revision=895
1999-12-20 20:49:27 +00:00
David Welch
13541861b1 Fixed problem with handles not being released
Changed page fault handling to take account of the error code
Changed handle table locking

svn path=/trunk/; revision=894
1999-12-20 02:14:40 +00:00
Phillip Susi
dfa5f04c63 merged better assert code back into main trunk
svn path=/trunk/; revision=893
1999-12-18 19:50:24 +00:00
David Welch
cc5dc64c30 Worked around compiler bug in NtDelayExecution
Added some page free checking
Reorganised thread code a bit

svn path=/trunk/; revision=892
1999-12-18 17:48:23 +00:00
Emanuele Aliberti
8abc09ec0d Versio info actually linked in *.sys modules
svn path=/trunk/; revision=891
1999-12-18 10:17:42 +00:00
Emanuele Aliberti
5b86e3a918 RtlNtStatusToDosError and RtlNtStatusToPsxErrno declared __stdcall
svn path=/trunk/; revision=890
1999-12-18 10:16:11 +00:00
Emanuele Aliberti
e5b9e13d59 Minor changes
svn path=/trunk/; revision=889
1999-12-18 10:15:11 +00:00
Phillip Susi
bfaef27782 Added tracking of running threads in a process, and termination of process when all threads terminate
svn path=/trunk/; revision=888
1999-12-18 07:33:53 +00:00
Phillip Susi
4e94397e24 Added list of threads in process
svn path=/trunk/; revision=887
1999-12-18 07:28:28 +00:00
Phillip Susi
683932b845 changed to use proper type for dispatcher header, instead of PVOID in WAIT_BLOCK
svn path=/trunk/; revision=886
1999-12-17 23:30:48 +00:00
Phillip Susi
4ce5c9d3b4 fixed WaitForMultipleObjects()'s handling of the WaitAll flag
svn path=/trunk/; revision=885
1999-12-17 23:24:27 +00:00
Phillip Susi
6b53b3acea Working and tested KeWaitForXXX
svn path=/trunk/; revision=884
1999-12-17 23:23:36 +00:00
Eric Kohl
81547d8842 Added missing .cvsignore file
svn path=/trunk/; revision=883
1999-12-16 23:09:34 +00:00
Eric Kohl
1b0b103796 Added a time conversion function and fixed a little bug
(fat stores only 2 second steps)

svn path=/trunk/; revision=882
1999-12-16 23:08:17 +00:00
Phillip Susi
98a6084104 found that list corruption bug. it was also resulting in a meory spray
svn path=/trunk/; revision=881
1999-12-16 22:59:03 +00:00
Phillip Susi
96aed594a2 fixed CreateEvent() with NULL name
svn path=/trunk/; revision=879
1999-12-16 17:48:43 +00:00
Phillip Susi
ca6a107ee2 fixed a few bugs in wait code
svn path=/trunk/; revision=878
1999-12-16 05:13:06 +00:00
Phillip Susi
414cd229d9 new event test app
svn path=/trunk/; revision=877
1999-12-16 05:12:12 +00:00
Eric Kohl
a09b668be6 Added missing .cvsignore file
svn path=/trunk/; revision=876
1999-12-16 00:15:19 +00:00
Phillip Susi
7f63532d94 fixed timeout on wait functions
svn path=/trunk/; revision=875
1999-12-15 06:48:10 +00:00
Eric Kohl
8bbcdc3d4a Fixed current directory handling
Added new prompt functions
Fixed dangling pointer bug in copy command

svn path=/trunk/; revision=874
1999-12-15 00:50:41 +00:00
Phillip Susi
43d5d0b2f0 used proper type pointer instead of PVOID
svn path=/trunk/; revision=873
1999-12-14 18:44:38 +00:00
Phillip Susi
a409988b36 missing initialization of Thread->Tcb.WaitBlockList
svn path=/trunk/; revision=872
1999-12-14 18:35:19 +00:00
Phillip Susi
33009b967e bug fix with file object's name being freed but the pointer not NULLed
svn path=/trunk/; revision=871
1999-12-14 18:32:38 +00:00
Phillip Susi
4c2f15bfb9 fixed runnable thread counters
svn path=/trunk/; revision=870
1999-12-14 00:54:29 +00:00
David Welch
c40b27bbc4 Forgot to remove obsolete file
svn path=/trunk/; revision=869
1999-12-13 23:07:49 +00:00
David Welch
ac7a3aa542 Reworked APC and waiting code, seems more stable now
KeWaitForMultipleObjects is broken, shouldn't be difficult to fix
Corrected bug in ntdll ldr which prevented VC applications being loaded
Added thread testing application
Tried to make thread termination reentrant
Improved stack frame dump

svn path=/trunk/; revision=868
1999-12-13 22:04:41 +00:00
Phillip Susi
90e6a2244e missing GetEnvironmentStrings export, was supposed to be aliased to GetEnvironmentStringsA for some reason, as NT's exports it, and ros's cmd.exe imports it.
svn path=/trunk/; revision=867
1999-12-12 07:59:41 +00:00
Phillip Susi
8c2f4d55e3 David forgot to take out a debugging line? Prevented process termination on user mode exception
svn path=/trunk/; revision=866
1999-12-12 06:09:29 +00:00
Phillip Susi
9a22766e36 new APC code ready for prime time
svn path=/trunk/; revision=865
1999-12-12 03:56:53 +00:00
Phillip Susi
53b1677997 new APC code ready for prime time
svn path=/trunk/; revision=864
1999-12-12 03:48:47 +00:00
David Welch
2cecd9846d Removed typo.
svn path=/trunk/; revision=863
1999-12-12 01:04:09 +00:00
David Welch
f822a2a9d9 Backed out Philip Susi's changes for further testing
Returned kernel to working state.
Made exception handling more tolerant

svn path=/trunk/; revision=862
1999-12-12 00:59:39 +00:00
Phillip Susi
a590b25e46 fixed thread dispatcher bug with spin lock
svn path=/trunk/; revision=861
1999-12-12 00:49:00 +00:00
Phillip Susi
5d2dc4de65 fixed bug caused by my APC code
svn path=/trunk/; revision=860
1999-12-12 00:44:39 +00:00
Eric Kohl
55fef42029 Added abs() and labs()
svn path=/trunk/; revision=859
1999-12-12 00:20:29 +00:00
Eric Kohl
0ce89e21d9 fixed a compiler warning
svn path=/trunk/; revision=858
1999-12-12 00:08:41 +00:00
David Welch
910f27a570 Put in updated version of bitops header
Corrected bug in loader with mapping sections with zero VirtualSize
Corrected bug in the vfat driver that accessed freed memory
General cleanup of the vfat driver

svn path=/trunk/; revision=857
1999-12-11 21:14:49 +00:00
Phillip Susi
14ac854378 fixed DPC and APC calling code
svn path=/trunk/; revision=856
1999-12-11 17:31:16 +00:00
Phillip Susi
e0e40991af thread priorities, and some APC work
svn path=/trunk/; revision=855
1999-12-11 17:26:43 +00:00
Phillip Susi
db262c9a74 reworked the APC code, they shold now be delivered properly when the IRQL falls below APC_LEVEL, and when there are more than one queued.
Added support for KeAddThreadTimeout() to time out
Fixed wait code to use the WaitStatus of the thread when it wakes up

svn path=/trunk/; revision=854
1999-12-11 17:25:27 +00:00
Phillip Susi
81310b4307 added DPC for timers to KTHREAD, and fixed ApcState
svn path=/trunk/; revision=853
1999-12-11 17:19:32 +00:00
Phillip Susi
77c8585f1c added initialization for APCs
svn path=/trunk/; revision=852
1999-12-11 06:40:08 +00:00
Phillip Susi
43f46ed4f8 at least it compiles now...
svn path=/trunk/; revision=851
1999-12-11 06:39:30 +00:00
Eric Kohl
66f738dbd1 cleanup
svn path=/trunk/; revision=850
1999-12-11 01:44:29 +00:00
Eric Kohl
45043db6ff Added waiting for port requests
svn path=/trunk/; revision=849
1999-12-11 01:42:44 +00:00
Phillip Susi
b14104f1e7 ooops... fix that..
svn path=/trunk/; revision=848
1999-12-10 22:25:18 +00:00
Phillip Susi
424d757107 added initial priorities to threads and processes
svn path=/trunk/; revision=847
1999-12-10 22:07:23 +00:00
Eric Kohl
a1c7df6990 Fixed command line code.
Fixed Rtl string functions.

svn path=/trunk/; revision=846
1999-12-10 17:49:21 +00:00
David Welch
c7b7c5b0b6 Modified LPC implementation to be closer to nt.
Did some initial work on support for paging
Switched some test application from using our special startup code
Correctly bug in DPC code (possible fix for "releasing unacquired spinlock" error")

svn path=/trunk/; revision=845
1999-12-10 17:04:37 +00:00
Phillip Susi
815a52debe fixed IoCompleteRequest() to give priority boost even when target thread != current thread
svn path=/trunk/; revision=844
1999-12-09 19:39:45 +00:00
Paolo Pantaleo
dbf662da37 4nt's CTRL-D and CRTL-K support
svn path=/trunk/; revision=843
1999-12-09 19:20:47 +00:00
Eric Kohl
5d99e9003a dll name comparison in LdrFindDll() must be case-insensitive
svn path=/trunk/; revision=842
1999-12-09 19:14:45 +00:00
Eric Kohl
ec235d7468 Fixed HalQueryRealTimeClock and HalSetRealTimeClock.
Thanks to Adam Polanski.

svn path=/trunk/; revision=841
1999-12-09 08:16:26 +00:00
Rex Jolliff
f09720f7d7 some more video code
svn path=/trunk/; revision=840
1999-12-09 02:45:06 +00:00
Paolo Pantaleo
258912bf48 fixed a stupid bug in history
minor chage to GetConsoleHandle

svn path=/trunk/; revision=839
1999-12-08 18:18:23 +00:00
Eric Kohl
9d84d82bd7 pointer to PEB becomes first parameter in call to NtProcessStartup
svn path=/trunk/; revision=838
1999-12-08 12:59:35 +00:00
Phillip Susi
904da6e474 disable interrupts first, then do work. Use HLT also instead of busy wait
svn path=/trunk/; revision=837
1999-12-08 06:34:25 +00:00
Paolo Pantaleo
915ff9328d history cleanup added
svn path=/trunk/; revision=836
1999-12-07 18:17:17 +00:00
Paolo Pantaleo
61c3984818 TAS searches in internal commands too
svn path=/trunk/; revision=835
1999-12-07 18:16:24 +00:00
Eric Kohl
4a02ce0c1e fixed typo
svn path=/trunk/; revision=834
1999-12-07 17:23:42 +00:00
Paolo Pantaleo
f30ade19b8 new history implementation, not complete yet...
svn path=/trunk/; revision=833
1999-12-06 19:26:49 +00:00
Phillip Susi
9530a7d656 fixed handling of enter with blank line, also by my good pal, jim4
svn path=/trunk/; revision=832
1999-12-06 06:53:24 +00:00
Phillip Susi
5716745a13 fixed for 25 line mode as it should be, and scrolling by my good pal, jim4
svn path=/trunk/; revision=831
1999-12-06 06:43:45 +00:00
Phillip Susi
680589c149 fixed default bochs log port
svn path=/trunk/; revision=830
1999-12-06 05:48:34 +00:00
Eric Kohl
2efd99afb2 removed outdated cmd
svn path=/trunk/; revision=829
1999-12-06 00:30:09 +00:00
Eric Kohl
b001203a86 - implemented process parameter block (PPB) code
- improved process environment block (PEB) code
- improved environment code

svn path=/trunk/; revision=828
1999-12-06 00:25:14 +00:00
Phillip Susi
09edfdc32f forgot to initialize Create member of OBJECT_TYPE for threads
svn path=/trunk/; revision=827
1999-12-05 23:23:50 +00:00
Phillip Susi
ae12418822 fixed sync problem: set dpc lock field before, rather than after droping the spin lock
svn path=/trunk/; revision=826
1999-12-05 19:26:11 +00:00
Phillip Susi
f9d4545552 fixed sync bug by elevating IRQL
svn path=/trunk/; revision=825
1999-12-05 08:30:10 +00:00
Emanuele Aliberti
bb25ff0f3a Minor changes.
svn path=/trunk/; revision=824
1999-12-04 21:11:00 +00:00
Emanuele Aliberti
4b70175e11 RtlNtStatusToPsxErrno stub added.
svn path=/trunk/; revision=823
1999-12-04 21:03:22 +00:00
Emanuele Aliberti
ba58b241e5 Added version resource to dd and fs.
svn path=/trunk/; revision=822
1999-12-04 20:58:45 +00:00
Eric Kohl
7c574c2d6e fixed compiler warnings
svn path=/trunk/; revision=821
1999-12-04 14:54:50 +00:00
Phillip Susi
47551b9846 ignore buildno.h
svn path=/trunk/; revision=819
1999-12-04 08:02:27 +00:00
Phillip Susi
d0c1e25256 fixed timers and a wait functions, and a few bugs
svn path=/trunk/; revision=818
1999-12-04 07:40:53 +00:00
Phillip Susi
d4c340c696 fixed ide.sys to run under bochs, disabled support for more than one controller to do it. Let me know of this breaks on real hardware.
svn path=/trunk/; revision=817
1999-12-04 07:38:16 +00:00
Brian Palmer
43014d0391 Fixed bug in LdrPEProcessModule() so that it correctly section sizes
svn path=/trunk/; revision=816
1999-12-04 04:59:38 +00:00
Paolo Pantaleo
e28f90e740 now c:\ do not crash cmd
svn path=/trunk/; revision=815
1999-12-03 18:50:00 +00:00
David Welch
ead0eeacdd Some bug fixes.
Corrected LPC implementation.

svn path=/trunk/; revision=814
1999-12-02 20:53:55 +00:00
Boudewijn Dekker
cf693462e6 .
svn path=/trunk/; revision=813
1999-12-01 22:31:45 +00:00
Boudewijn Dekker
67ad8387f3 fixed some prototypes by adding stdcall attribute
svn path=/trunk/; revision=812
1999-12-01 22:30:48 +00:00
Eric Kohl
eae47571c9 fixed little bug
svn path=/trunk/; revision=811
1999-12-01 17:34:55 +00:00
Eric Kohl
2ea8bb5aa4 minor improvements
svn path=/trunk/; revision=810
1999-12-01 15:22:49 +00:00
Eric Kohl
13436cd7f7 - added environment functions
- moved ntdll-only prototypes into ntdll header file

svn path=/trunk/; revision=809
1999-12-01 15:18:54 +00:00
Eric Kohl
3bee100dae Cleanup
svn path=/trunk/; revision=808
1999-12-01 15:10:42 +00:00
Eric Kohl
2eccd28b8f Fixed a typo
svn path=/trunk/; revision=807
1999-12-01 15:08:31 +00:00
Paolo Pantaleo
d2c016b5ab just fixed a stupid bug
svn path=/trunk/; revision=806
1999-11-29 18:25:05 +00:00
Emanuele Aliberti
b72dc46819 Almost complete skeleton for tdi.sys,
yet headers are still missing.

svn path=/trunk/; revision=805
1999-11-28 07:59:29 +00:00
Eric Kohl
e2e5efb9d7 fixed a typo
svn path=/trunk/; revision=804
1999-11-28 01:55:41 +00:00
Paolo Pantaleo
6d3a97eb5e type accepts more than one file specification
F3 working in command line history (for now simply the same as up arrow)

svn path=/trunk/; revision=803
1999-11-27 19:14:59 +00:00
Eric Kohl
0d630c9ee3 added atoi() and atol()
svn path=/trunk/; revision=802
1999-11-27 11:32:43 +00:00
Eric Kohl
8b829113cb - changed InitializeObjectAttributes() from a function to a macro
- fixed STDCALL more issues
- changed some RtlLargeIntegerXxx functions to macros

svn path=/trunk/; revision=801
1999-11-27 03:32:55 +00:00
Brian Palmer
c18e7f06ce *** empty log message ***
svn path=/trunk/; revision=800
1999-11-26 21:45:23 +00:00
Jason Filby
dfa8364302 *** empty log message ***
svn path=/trunk/; revision=799
1999-11-26 20:53:32 +00:00
Eric Kohl
ed3ca3d52c More runtime functions
svn path=/trunk/; revision=798
1999-11-25 23:45:30 +00:00
Eric Kohl
e77c8000db Fixed typo
svn path=/trunk/; revision=797
1999-11-25 23:37:02 +00:00
Eric Kohl
05a567fce3 More runtime functions
svn path=/trunk/; revision=796
1999-11-25 23:35:24 +00:00
David Welch
9b614b887d Corrected ntdll mapping bug
Implemented prototype lpc mechanism

svn path=/trunk/; revision=795
1999-11-25 10:47:58 +00:00
Emanuele Aliberti
1a0765f6c5 Some NdisXYZ stubs for NDIS.SYS.
svn path=/trunk/; revision=794
1999-11-24 23:11:17 +00:00
Emanuele Aliberti
ec4a27aeb7 Initial makefile for NDIS.SYS
svn path=/trunk/; revision=793
1999-11-24 23:06:24 +00:00
David Welch
b986ce1cac Began converting minix fsd to work with new caching mechanism
Implemented user-mode APCs (still some bugs)
Began implementing shared memory, still some locking issues

svn path=/trunk/; revision=792
1999-11-24 11:51:55 +00:00
Emanuele Aliberti
e510811de7 Some fixes in the TDI initial files.
svn path=/trunk/; revision=791
1999-11-21 23:48:14 +00:00
Rex Jolliff
a7e6e9c1f8 more win32k code
svn path=/trunk/; revision=790
1999-11-21 18:39:11 +00:00
Eric Kohl
64915d3ebe Added missing STDCALL.
svn path=/trunk/; revision=789
1999-11-20 21:59:39 +00:00
Eric Kohl
c8689122b1 Fixed typo.
svn path=/trunk/; revision=788
1999-11-20 21:53:53 +00:00
Eric Kohl
e0c1e02c47 Fixed compiler warning
svn path=/trunk/; revision=787
1999-11-20 21:51:19 +00:00
Eric Kohl
b09592bf32 Major update to Rtl string functions.
svn path=/trunk/; revision=786
1999-11-20 21:49:23 +00:00
Emanuele Aliberti
174adb3955 Some more stubs files for the TDI kernel module.
svn path=/trunk/; revision=785
1999-11-20 20:41:29 +00:00
Emanuele Aliberti
8a20ddc7d4 Initial files for the TCP/IP stack kernel module.
svn path=/trunk/; revision=784
1999-11-20 20:36:46 +00:00
Emanuele Aliberti
82a0c31208 Initial networking code layout.
svn path=/trunk/; revision=783
1999-11-20 10:21:18 +00:00
Rex Jolliff
d25098ba0c added ignore file
svn path=/trunk/; revision=782
1999-11-18 19:25:35 +00:00
Rex Jolliff
aba30a453f added some DDI functions to table
svn path=/trunk/; revision=781
1999-11-18 18:58:16 +00:00
Boudewijn Dekker
fde8b62215 added misc/res.c
svn path=/trunk/; revision=780
1999-11-17 21:33:44 +00:00
Boudewijn Dekker
e04faee634 fixed some bugs in LdrLoadDll
svn path=/trunk/; revision=779
1999-11-17 21:32:57 +00:00
Boudewijn Dekker
0d7b93783b no message
svn path=/trunk/; revision=778
1999-11-17 21:30:00 +00:00
Boudewijn Dekker
b361e13fab implemented LoadResource/FlushViewOfFile
svn path=/trunk/; revision=777
1999-11-17 21:28:08 +00:00
Boudewijn Dekker
44744d8d36 implemented LoadResource
svn path=/trunk/; revision=776
1999-11-17 21:21:08 +00:00
Boudewijn Dekker
614f99e406 implemented FlushViewOfFile in kernel32
svn path=/trunk/; revision=775
1999-11-17 21:20:15 +00:00
Rex Jolliff
6e605e712e fixed reference to abs
svn path=/trunk/; revision=774
1999-11-17 21:17:10 +00:00
Rex Jolliff
96d5e2c715 Added top level ignore list
svn path=/trunk/; revision=773
1999-11-17 20:54:05 +00:00
Rex Jolliff
6767fd7f43 Fixed BMI typedef
svn path=/trunk/; revision=772
1999-11-17 20:50:37 +00:00
Eric Kohl
85a3f3844c Started NLS support and improved Rtl string functions.
svn path=/trunk/; revision=771
1999-11-15 16:02:50 +00:00
Eric Kohl
c114003cb5 Added some RtlLargeInteger functions.
svn path=/trunk/; revision=770
1999-11-15 16:01:32 +00:00
Eric Kohl
c52cbf8517 Fixed warning.
svn path=/trunk/; revision=769
1999-11-15 15:53:31 +00:00
Boudewijn Dekker
abd233d61a Implemented LdrFindResource_U and LdrAccessResource
svn path=/trunk/; revision=768
1999-11-14 13:04:46 +00:00
David Welch
b0ff680e0e 1) Corrected bugs in ERESOURCE code
and added test
2) Moved some files which are only
architecture-dependant out of the hal
3) Corrected timer implementation (it
should now be possible to use them as dispatcher
objects)
4) Corrected stupid bug in dpc code
5) Made thread list locking more sensible
6) Altered system call handler to build a
proper context in preparation for implementing APCs
7) Rationalised the waiting code

svn path=/trunk/; revision=767
1999-11-12 12:01:17 +00:00
Rex Jolliff
1a8f8005ae fixed clean rule
svn path=/trunk/; revision=766
1999-11-12 00:16:51 +00:00
Rex Jolliff
5bc02dd95a Changed to support linux build
svn path=/trunk/; revision=765
1999-11-11 21:22:08 +00:00
Eric Kohl
44866ccf87 Fixed include bug with rosapps module.
svn path=/trunk/; revision=764
1999-11-09 18:17:10 +00:00
Eric Kohl
d431c0fa6d Fixed bug with gcc 2.95.2
svn path=/trunk/; revision=763
1999-11-09 18:15:16 +00:00
Eric Kohl
58b907b668 Added some RtlLargeInteger functions.
svn path=/trunk/; revision=762
1999-11-09 18:09:57 +00:00
Eric Kohl
761e03c5a1 Fixed memory functions.
svn path=/trunk/; revision=761
1999-11-09 18:07:50 +00:00
Eric Kohl
ea4204ce87 Changed to new HAL functions.
svn path=/trunk/; revision=760
1999-11-09 18:07:03 +00:00
Eric Kohl
eae6fb6efc Implemented ExInterlocked functions.
svn path=/trunk/; revision=759
1999-11-09 18:00:14 +00:00
Eric Kohl
157d5b3fa2 Added APC support to NtDeviceIoControlFile().
svn path=/trunk/; revision=758
1999-11-07 14:08:11 +00:00
Emanuele Aliberti
63665d54ed advapi32 ACE and ACL stubs.
svn path=/trunk/; revision=757
1999-11-07 08:04:55 +00:00
Emanuele Aliberti
eb2d1c2110 advapi32 compiles OK.
Build number auto-generated (see apps/buildno, include/reactos/version.h,
include/reactos/buildno.h).
include/internal/version.h moved in include/reactos.
Added default search paths for includes in .rc rule (rules.mak).

svn path=/trunk/; revision=756
1999-11-07 08:03:28 +00:00
Eric Kohl
dbbb7e41f0 Keep DEL quiet when called from a batch file.
svn path=/trunk/; revision=754
1999-11-06 00:53:33 +00:00
Eric Kohl
6758f479ef New Y command and some fixes.
svn path=/trunk/; revision=753
1999-11-05 20:41:17 +00:00
Eric Kohl
18a01fd10d Implemented 4nt compatible color command.
svn path=/trunk/; revision=752
1999-11-04 11:29:36 +00:00
Emanuele Aliberti
cfb22d72df Typo in the NTOSKRNL import library fixed
svn path=/trunk/; revision=751
1999-11-04 06:41:47 +00:00
David Welch
83c2d22a5e Improved scheduling code
Fixed win32k.sys entrypoint (otherwise it crashes on startup)
Included unix install script
Broke waiting for a thread to terminate (but will fix later)
Added spinlock debugging code
Improved InterlockXXXX functions
Added hooks for monitoring system calls and thread startup

svn path=/trunk/; revision=750
1999-11-02 08:55:45 +00:00
Emanuele Aliberti
96c9969a90 Various changes related to calling convention fixes
svn path=/trunk/; revision=749
1999-10-31 22:44:39 +00:00
Emanuele Aliberti
f0f8791763 W32kSetTextColor, W32GetDCState16 needed __stdcall; changed the subsystem field from windows to native
svn path=/trunk/; revision=748
1999-10-31 22:43:40 +00:00
Emanuele Aliberti
31c5b7839f RtlFillMemory, RtlMoveMemory, RtlZeroMemory needed __stdcall
svn path=/trunk/; revision=747
1999-10-31 22:41:49 +00:00
Emanuele Aliberti
dabbe50e39 LoadLibraryA, GetProcAddress, FreeLibrary, GetModuleHandleA, WriteFileEx needed __stdcall
svn path=/trunk/; revision=746
1999-10-31 22:41:15 +00:00
Emanuele Aliberti
68fbd54f2c KeDelayExecutionThread exported by ntoskrnl with correct calling convention (__stdcall)
svn path=/trunk/; revision=745
1999-10-30 21:24:37 +00:00
Rex Jolliff
766e6a262e added more KMGDI functions
svn path=/trunk/; revision=744
1999-10-29 01:58:20 +00:00
Rex Jolliff
c1795e9778 fixed problem with redefined status values
svn path=/trunk/; revision=743
1999-10-28 23:37:58 +00:00
Rex Jolliff
f886c2b9d6 added several new functions
svn path=/trunk/; revision=742
1999-10-28 23:37:14 +00:00
Rex Jolliff
7d45bbd5da needed for compile
svn path=/trunk/; revision=741
1999-10-28 23:35:34 +00:00
Rex Jolliff
8d87ab9d07 added fix for compile under linux
svn path=/trunk/; revision=740
1999-10-28 23:34:47 +00:00
Eric Kohl
95fcdd0943 Fixed batch mode bugs.
svn path=/trunk/; revision=739
1999-10-28 23:09:59 +00:00
Rex Jolliff
11d7e1e18c Fixed problems with vidport and vga loading
svn path=/trunk/; revision=738
1999-10-28 06:58:05 +00:00
Eric Kohl
863afe8930 Disabled prompting when in batch mode.
svn path=/trunk/; revision=737
1999-10-27 22:46:53 +00:00
Rex Jolliff
788e4dc053 Fix import problems in win32k.sys
svn path=/trunk/; revision=736
1999-10-27 05:49:58 +00:00
Emanuele Aliberti
125a62f79a An attempt to fix the ntdll not found bug.
svn path=/trunk/; revision=735
1999-10-26 19:47:06 +00:00
Rex Jolliff
99d62b4808 added check for bootloader config hive
svn path=/trunk/; revision=734
1999-10-26 04:52:39 +00:00
Rex Jolliff
3c1e76b027 Some small fixes to reported build problems
svn path=/trunk/; revision=733
1999-10-25 06:58:09 +00:00
Eric Kohl
2bd986927c Added some time related functions.
svn path=/trunk/; revision=732
1999-10-24 17:52:17 +00:00
Rex Jolliff
ad5e850736 Changes to get video drivers and win32k to load
svn path=/trunk/; revision=731
1999-10-24 17:07:57 +00:00
Rex Jolliff
6cc79a481e added some Eng funcs into build list
svn path=/trunk/; revision=730
1999-10-23 22:40:49 +00:00
Rex Jolliff
c0b2b118a0 Cleanup to make buildable
svn path=/trunk/; revision=729
1999-10-23 22:39:27 +00:00
Rex Jolliff
a53e883bb0 Added definitions for some eng funcs
svn path=/trunk/; revision=728
1999-10-23 22:38:26 +00:00
Rex Jolliff
bb0715f8e7 Added IOCTL codes for video drivers
svn path=/trunk/; revision=727
1999-10-23 22:37:11 +00:00
Rex Jolliff
bc08c68af9 Added vidport.sys to auto loaded drivers
svn path=/trunk/; revision=726
1999-10-23 18:58:40 +00:00
Rex Jolliff
28df2503d3 fixed handling of boot drivers
svn path=/trunk/; revision=725
1999-10-23 18:56:04 +00:00
Rex Jolliff
a5dd3430d6 fixed dist and floppy rule
svn path=/trunk/; revision=724
1999-10-23 18:33:38 +00:00
Eric Kohl
36f33622cc Fixed bugs and added DIRS command.
svn path=/trunk/; revision=723
1999-10-23 18:17:37 +00:00
Eric Kohl
583a7209da Added BOOT.BAT
svn path=/trunk/; revision=722
1999-10-23 18:15:39 +00:00
Eric Kohl
727671f12a Added Ctrl-C/Ctrl-Break handler.
svn path=/trunk/; revision=721
1999-10-22 20:35:02 +00:00
Eric Kohl
13e2e79e44 Added missing exports.
svn path=/trunk/; revision=720
1999-10-21 16:13:39 +00:00
Eric Kohl
0300e2a9d1 Fixed floppy and dist targets.
svn path=/trunk/; revision=719
1999-10-21 16:12:16 +00:00
Eric Kohl
ec16aa4c44 Improved debug output and
added hal READ_XXX and WRITE_XXX functions.

svn path=/trunk/; revision=718
1999-10-21 13:11:12 +00:00
Eric Kohl
e6f624f0e7 Improved debug output and
added hal READ_XXX and WRITE_XXX functions.

svn path=/trunk/; revision=717
1999-10-21 13:00:09 +00:00
Eric Kohl
7228dc135c Improved debug output and
added hal READ_XXX and WRITE_XXX functions.

svn path=/trunk/; revision=716
1999-10-21 11:13:38 +00:00
Eric Kohl
d2e85caa9e Improved debug output and
added hal READ_XXX and WRITE_XXX functions.

svn path=/trunk/; revision=715
1999-10-21 10:59:32 +00:00
Rex Jolliff
bff71dc524 Changed name to conform with kernel naming convention
svn path=/trunk/; revision=714
1999-10-20 23:09:26 +00:00
Rex Jolliff
a0570e7cbe added ignore files
svn path=/trunk/; revision=713
1999-10-20 23:08:58 +00:00
Boudewijn Dekker
ff9ce85a65 implemented some ldr functions
svn path=/trunk/; revision=712
1999-10-18 21:55:30 +00:00
Boudewijn Dekker
f3d9743503 implemented LdrUnloadDll
svn path=/trunk/; revision=711
1999-10-18 21:37:16 +00:00
Boudewijn Dekker
a66a6e5dba implemented LoadLibray and FreeLibrary
svn path=/trunk/; revision=710
1999-10-17 18:18:44 +00:00
Boudewijn Dekker
8690858184 implemented a reference count on LdrLoadDll
svn path=/trunk/; revision=709
1999-10-17 18:16:45 +00:00
Eric Kohl
9e4fec3838 Updated info about debugging.
svn path=/trunk/; revision=708
1999-10-16 21:10:23 +00:00
Eric Kohl
8001413b88 More exported functions.
svn path=/trunk/; revision=707
1999-10-16 21:09:12 +00:00
Eric Kohl
bae73138e8 Moved serial and bochs debug output.
svn path=/trunk/; revision=706
1999-10-16 21:08:39 +00:00
Eric Kohl
dad291cf6f Some fixes.
svn path=/trunk/; revision=705
1999-10-16 12:41:42 +00:00
Eric Kohl
22b26024cd More exported functions.
svn path=/trunk/; revision=704
1999-10-16 12:40:57 +00:00
Eric Kohl
3e6e6c12ee Added missing ntdll include.
svn path=/trunk/; revision=703
1999-10-16 12:39:44 +00:00
Eric Kohl
93a0fa88d2 Fixed NtCreatePort() prototype.
svn path=/trunk/; revision=702
1999-10-16 12:38:53 +00:00
Eric Kohl
9b2fc03fc7 Fixed $(NASM_CMD) bug.
svn path=/trunk/; revision=701
1999-10-16 12:36:47 +00:00
Eric Kohl
7975fc7fe7 Minor improvements.
svn path=/trunk/; revision=700
1999-10-16 12:35:10 +00:00
Eric Kohl
a23adc0492 Fixed hal display and initialization code.
svn path=/trunk/; revision=699
1999-10-16 00:17:40 +00:00
Eric Kohl
36e229b42f Fixed a typo.
svn path=/trunk/; revision=698
1999-10-15 15:26:34 +00:00
Eric Kohl
29812be566 Fixed hal display and initialization code.
svn path=/trunk/; revision=697
1999-10-15 15:21:39 +00:00
Eric Kohl
4551dfba1e Replaced calls to _printk() by calls to DbgPrint().
svn path=/trunk/; revision=696
1999-10-14 16:54:17 +00:00
Eric Kohl
babfe77ea9 PEB will be created in NtCreateProcess.
svn path=/trunk/; revision=695
1999-10-13 22:35:55 +00:00
Emanuele Aliberti
81a9f1c4b0 Little changes in the psxdll library.
svn path=/trunk/; revision=694
1999-10-12 21:19:40 +00:00
Boudewijn Dekker
74031c2379 implemented LoadLibrary and some Rtl stubs
svn path=/trunk/; revision=693
1999-10-12 19:45:01 +00:00
Eric Kohl
348ccdd39f Added REBOOT command.
svn path=/trunk/; revision=692
1999-10-11 20:51:07 +00:00
Eric Kohl
1d4d689bf2 Added new display and reboot code.
svn path=/trunk/; revision=691
1999-10-11 20:50:33 +00:00
Eric Kohl
8578ba8ac6 Minor fix to teb allocation.
svn path=/trunk/; revision=690
1999-10-11 20:43:10 +00:00
Eric Kohl
a77eef4a53 Fixed header inclusion order.
svn path=/trunk/; revision=689
1999-10-10 19:53:46 +00:00
Eric Kohl
648301897c Fixed header inclusion order.
svn path=/trunk/; revision=687
1999-10-07 23:46:27 +00:00
Emanuele Aliberti
2076e94020 I removed a pair of stubs for the OpenFileMapping functions
svn path=/trunk/; revision=686
1999-10-03 23:19:15 +00:00
Eric Kohl
c2829c9869 Minor fixes.
svn path=/trunk/; revision=685
1999-10-03 22:20:33 +00:00
Eric Kohl
49f51f37f3 Added activate command.
svn path=/trunk/; revision=684
1999-10-03 22:16:14 +00:00
Eric Kohl
1e637da493 Added echos, echoerr and echoserr commands.
svn path=/trunk/; revision=683
1999-10-03 22:15:33 +00:00
Eric Kohl
51cbed48ab No longer needed.
svn path=/trunk/; revision=682
1999-10-03 22:14:40 +00:00
Eric Kohl
e8abc51177 Minor fixes.
svn path=/trunk/; revision=681
1999-10-03 22:12:57 +00:00
Eric Kohl
29f5cf1341 Added floppy and dist targets.
svn path=/trunk/; revision=680
1999-10-03 22:12:24 +00:00
Eric Kohl
c33edc6cb7 Made notevil screen size aware.
svn path=/trunk/; revision=679
1999-10-03 22:10:15 +00:00
Boudewijn Dekker
1d786dd865 Miscellaneous implementation of kernel32 stubs.
Changed the implementation of ReadFileEx.

svn path=/trunk/; revision=678
1999-10-02 20:20:44 +00:00
Eric Kohl
3174c5069a Fixed typo.
svn path=/trunk/; revision=676
1999-09-29 23:19:32 +00:00
Eric Kohl
d63c23131c Fixed multiple STATUS_xxxx inclusions.
svn path=/trunk/; revision=675
1999-09-29 23:15:14 +00:00
Eric Kohl
56e30e8907 Minor updates and fixes.
svn path=/trunk/; revision=674
1999-09-27 22:15:44 +00:00
Eric Kohl
1241612f69 Added MORE command.
svn path=/trunk/; revision=673
1999-09-27 22:13:59 +00:00
Boudewijn Dekker
ddc9e680c9 Added support for critical sections.
svn path=/trunk/; revision=672
1999-09-27 20:58:46 +00:00
Boudewijn Dekker
15e29ff254 Small addition to token.c
svn path=/trunk/; revision=671
1999-09-25 06:25:51 +00:00
Eric Kohl
52498a577a Minor fixes.
svn path=/trunk/; revision=670
1999-09-24 22:05:25 +00:00
Eric Kohl
ee3dc0f0c1 Added window command.
svn path=/trunk/; revision=669
1999-09-24 22:03:11 +00:00
Emanuele Aliberti
58eedf7620 RtlReAllocHeap should be RtlReAllocateHeap
svn path=/trunk/; revision=668
1999-09-12 22:09:34 +00:00
Emanuele Aliberti
e6359887bb RtlReAllocHeap should be RtlReAllocateHeap.
svn path=/trunk/; revision=667
1999-09-12 21:59:40 +00:00
Emanuele Aliberti
cda1c38bae Some missing __stdcall added.
Some missing unicode functions stubs added.
RtlReAllocHeap should be RtlReAllocateHeap.

svn path=/trunk/; revision=666
1999-09-12 21:58:32 +00:00
Emanuele Aliberti
d82310b692 Skeleton for psxdll.dll
svn path=/trunk/; revision=665
1999-09-12 21:54:16 +00:00
Eric Kohl
45dd256ee3 Fixed typo.
svn path=/trunk/; revision=664
1999-09-12 20:58:29 +00:00
Eric Kohl
e0058203bb Fixed WaitForSingleObject() and WaitForMultipleObjects().
svn path=/trunk/; revision=663
1999-09-12 20:54:42 +00:00
Eric Kohl
3255097117 Stack is freed on failure.
svn path=/trunk/; revision=662
1999-09-12 20:49:06 +00:00
Eric Kohl
40f81ce970 Fixed some minor issues (NULL --> FALSE).
svn path=/trunk/; revision=661
1999-09-12 20:44:22 +00:00
Eric Kohl
bbcc7f9179 Fixed little bug ('cd d:' did't work, but 'cd D:').
svn path=/trunk/; revision=660
1999-09-12 20:41:56 +00:00
Eric Kohl
0c91339480 Added some more commands. Thanks to Dr. Faustus.
Some more cleanup.

svn path=/trunk/; revision=659
1999-09-12 18:23:31 +00:00
Eric Kohl
5249698af3 External TEE command.
svn path=/trunk/; revision=658
1999-09-12 18:20:47 +00:00
Eric Kohl
037d59aef7 Added master makefile with clean/dist/floppy targets.
svn path=/trunk/; revision=657
1999-09-12 18:18:09 +00:00
Eric Kohl
70f14aa73f Fixed typedef.
svn path=/trunk/; revision=656
1999-09-11 00:07:20 +00:00
Rex Jolliff
b779c01fb6 Changes to make win32k.sys compile
svn path=/trunk/; revision=655
1999-09-10 21:17:07 +00:00
Rex Jolliff
fe56845ebe Fixed function prototypes
svn path=/trunk/; revision=654
1999-09-10 21:16:36 +00:00
Rex Jolliff
70140f5ea7 Changed symbolic name for IDE devices
svn path=/trunk/; revision=653
1999-09-10 19:16:58 +00:00
Eric Kohl
fe27d316df Added creation of full user stack (including guard page).
svn path=/trunk/; revision=652
1999-09-10 15:50:30 +00:00
Eric Kohl
1fc6701c79 Implemented Nt/KeWaitForMultipleObjects (still buggy).
svn path=/trunk/; revision=651
1999-09-08 23:51:36 +00:00
Rex Jolliff
09d88da5e9 some minor coding on win32k
svn path=/trunk/; revision=650
1999-09-08 04:50:50 +00:00
Emanuele Aliberti
a06d619eca some symbols were not declared __stdcall
svn path=/trunk/; revision=649
1999-09-08 04:40:56 +00:00
Eric Kohl
242138f832 Fixed little bug.
svn path=/trunk/; revision=648
1999-09-07 20:41:47 +00:00
Emanuele Aliberti
af1ff6be3b More for the POSIX+ subsystem
svn path=/trunk/; revision=647
1999-09-07 17:12:39 +00:00
Eric Kohl
8c0b595a5e Thread improvements.
svn path=/trunk/; revision=646
1999-09-06 21:32:57 +00:00
Emanuele Aliberti
4280f4f60d stubs for HAL kernel debugger functions
svn path=/trunk/; revision=645
1999-09-05 20:54:57 +00:00
Eric Kohl
d5014c3bb3 Removed unused stuff.
svn path=/trunk/; revision=644
1999-09-05 12:40:20 +00:00
Eric Kohl
d81a116aba Run smss.exe instead of shell.exe.
svn path=/trunk/; revision=643
1999-09-05 12:39:45 +00:00
Eric Kohl
155d1ff5ae Removed smss from its old place
svn path=/trunk/; revision=642
1999-09-05 12:35:34 +00:00
Eric Kohl
fbccd722a1 Fixed little bug.
svn path=/trunk/; revision=641
1999-09-05 12:31:41 +00:00
Eric Kohl
648c68ff1a Moved smss to a better place.
svn path=/trunk/; revision=640
1999-09-05 12:29:50 +00:00
Eric Kohl
c92eafe2f1 Updated rules for subsys directory.
svn path=/trunk/; revision=639
1999-09-05 12:27:22 +00:00
Eric Kohl
b0e64d6cf7 Updated.
svn path=/trunk/; revision=638
1999-09-05 10:22:05 +00:00
Emanuele Aliberti
fa74a12186 added resource script with version information
svn path=/trunk/; revision=637
1999-09-04 20:50:34 +00:00
Eric Kohl
40bd704148 Implemented RtlCreateUserProcess() and RtlCreateUserThread().
svn path=/trunk/; revision=636
1999-09-04 18:38:29 +00:00
David Welch
4027ccab60 Correct keyboard bug with multiple readers
svn path=/trunk/; revision=634
1999-08-30 15:20:14 +00:00
Eric Kohl
ff511b446a Added MSGBOX and TIMER commands.
svn path=/trunk/; revision=633
1999-08-29 22:31:43 +00:00
David Welch
e31d342bc7 *** empty log message ***
svn path=/trunk/; revision=632
1999-08-29 13:45:08 +00:00
Emanuele Aliberti
7cf48757dc A top level header file for kernel and system stuff. At present simply includes ddk/ntddk.h.
svn path=/trunk/; revision=631
1999-08-29 07:02:52 +00:00
Emanuele Aliberti
07a2fbf7f7 Global ReactOS configuration file. Here we will put symbols for processor-, architecture-, and debugging-dependent conditional compilation.
svn path=/trunk/; revision=630
1999-08-29 07:01:32 +00:00
Emanuele Aliberti
fa3a5c2c71 some __stdcall fixes in ntoskrnl and ntdll
svn path=/trunk/; revision=629
1999-08-29 06:59:11 +00:00
Eric Kohl
5aaaad5c93 Added missing definition.
svn path=/trunk/; revision=628
1999-08-28 23:30:50 +00:00
Eric Kohl
7bcdd2ea10 Added CHOICE command and fixed a cursor bug.
svn path=/trunk/; revision=627
1999-08-22 21:46:50 +00:00
Eric Kohl
a35e54e5f8 Added CHOICE command and fixed a cursor bug.
svn path=/trunk/; revision=626
1999-08-21 22:06:03 +00:00
Eric Kohl
0b84d00506 Added CHOICE command and fixed a cursor bug.
svn path=/trunk/; revision=625
1999-08-21 21:54:30 +00:00
Boudewijn Dekker
c4385e9139 Small fixes
svn path=/trunk/; revision=624
1999-08-21 17:51:35 +00:00
Emanuele Aliberti
2c4de44226 Power management (Po) stubs.
svn path=/trunk/; revision=623
1999-08-20 16:31:17 +00:00
Emanuele Aliberti
1f636015ba NLS stubs and exported data.
svn path=/trunk/; revision=622
1999-08-20 16:30:16 +00:00
Emanuele Aliberti
e9703bfa98 FS stubs.
svn path=/trunk/; revision=621
1999-08-20 16:29:22 +00:00
Emanuele Aliberti
676e6609ce Kernel debugger stubs.
svn path=/trunk/; revision=620
1999-08-20 16:28:10 +00:00
Boudewijn Dekker
dbb9546d9d Small additions, not yet finished
svn path=/trunk/; revision=619
1999-08-20 10:12:53 +00:00
Boudewijn Dekker
007128eb66 Small additions, not yet finished
svn path=/trunk/; revision=618
1999-08-20 09:37:25 +00:00
Emanuele Aliberti
90129544e0 Fixed a bug in the parser.
svn path=/trunk/; revision=617
1999-08-20 05:53:04 +00:00
Eric Kohl
f72b0c8878 Fixed STDCALL bugs.
svn path=/trunk/; revision=616
1999-08-17 12:02:27 +00:00
Eric Kohl
36df88668d Fixed STDCALL bug.
svn path=/trunk/; revision=615
1999-08-15 00:36:59 +00:00
Rex Jolliff
9957d94c20 Various small changes for registry work
svn path=/trunk/; revision=614
1999-08-14 18:59:28 +00:00
Eric Kohl
2a466eda80 Partial Implementation of NtQuerySystemInformation and NtSetSystemInformation
svn path=/trunk/; revision=613
1999-08-11 23:29:26 +00:00
Emanuele Aliberti
6cb529270a Stubs for version.dll
svn path=/trunk/; revision=612
1999-08-11 19:56:48 +00:00
Emanuele Aliberti
cb7f83ac74 Some files for version.dll
svn path=/trunk/; revision=611
1999-08-10 20:21:32 +00:00
Rex Jolliff
9907c63794 Added STDCALL to Video functions
svn path=/trunk/; revision=610
1999-08-07 20:27:14 +00:00
Rex Jolliff
fc200ca733 Added export definition file and export library rule
svn path=/trunk/; revision=609
1999-08-06 17:27:45 +00:00
Jason Filby
bebdd316d5 *** empty log message ***
svn path=/trunk/; revision=608
1999-08-01 11:21:05 +00:00
Eric Kohl
e7cf9302fa Added more crt functions and fixed some.
svn path=/trunk/; revision=607
1999-07-29 21:25:04 +00:00
Emanuele Aliberti
69dc48c09f some work on fixing advapi32
svn path=/trunk/; revision=606
1999-07-26 20:46:40 +00:00
Eric Kohl
e3c471cf82 Added simple START command.
svn path=/trunk/; revision=605
1999-07-24 17:18:05 +00:00
Eric Kohl
0063a30376 Fixed a typo.
svn path=/trunk/; revision=604
1999-07-24 17:16:32 +00:00
Rex Jolliff
b9a38fb83d moved path functions into seperate file
svn path=/trunk/; revision=603
1999-07-23 20:21:06 +00:00
Rex Jolliff
1ff56406ca changes to support win32k
svn path=/trunk/; revision=602
1999-07-23 19:58:58 +00:00
Rex Jolliff
c69899317f finished win32k skeleton
svn path=/trunk/; revision=601
1999-07-23 19:57:18 +00:00
Rex Jolliff
b3995a1493 added a few pointer types
svn path=/trunk/; revision=600
1999-07-23 19:55:07 +00:00
Eric Kohl
3975f17012 Changes to compile advapi32.
svn path=/trunk/; revision=599
1999-07-22 21:36:37 +00:00
Rex Jolliff
3f261fab5d More changes to the win32k server
svn path=/trunk/; revision=598
1999-07-22 16:21:53 +00:00
Emanuele Aliberti
b6ae20fcd0 first bits for the POSIX+ client DLL
svn path=/trunk/; revision=597
1999-07-18 20:54:04 +00:00
Emanuele Aliberti
d2eea59593 original ntifs.h restored
svn path=/trunk/; revision=596
1999-07-18 07:53:27 +00:00
Emanuele Aliberti
6ac1592420 fixes
svn path=/trunk/; revision=595
1999-07-17 23:10:31 +00:00
Rex Jolliff
04f2911330 added dist rule
svn path=/trunk/; revision=593
1999-07-16 23:37:07 +00:00
Rex Jolliff
743df9ab84 fixed various build errors
svn path=/trunk/; revision=592
1999-07-13 01:08:47 +00:00
Rex Jolliff
e2a59404d8 added an ignore file
svn path=/trunk/; revision=591
1999-07-12 23:34:42 +00:00
Rex Jolliff
367fbb2a1f Added a service table registration function
svn path=/trunk/; revision=590
1999-07-12 23:32:30 +00:00
Rex Jolliff
932d4770ec more work on KMGDI subsystem
svn path=/trunk/; revision=589
1999-07-12 23:26:57 +00:00
Emanuele Aliberti
0584d3755f minor changes in the simple DEF-->EDF converter
svn path=/trunk/; revision=588
1999-07-12 21:02:06 +00:00
Emanuele Aliberti
221e27f1fa kernel32 missing stubs
svn path=/trunk/; revision=587
1999-07-12 21:01:06 +00:00
Boudewijn Dekker
581f2c7495 no message
svn path=/trunk/; revision=586
1999-07-11 14:19:14 +00:00
Rex Jolliff
6ef820374f put ifdef around defines
svn path=/trunk/; revision=585
1999-07-07 01:41:41 +00:00
Rex Jolliff
ce373b0c40 added pointer types for RECTL and POINTL
svn path=/trunk/; revision=584
1999-07-07 01:41:00 +00:00
Boudewijn Dekker
01034d9c59 no message
svn path=/trunk/; revision=583
1999-07-05 20:51:47 +00:00
Emanuele Aliberti
fad2f584e9 Bo's ntifs.h + ReactOS extensions (untested).
svn path=/trunk/; revision=582
1999-07-04 22:22:05 +00:00
Emanuele Aliberti
86b93a6ac8 A very simple application to create a named LPC port; application to connect to an existing LPC port updated.
svn path=/trunk/; revision=581
1999-07-04 22:04:31 +00:00
Emanuele Aliberti
6fcd126954 NtCreatePort and LPC_PORT_BASIC_INFORMATION partial definitions
svn path=/trunk/; revision=580
1999-07-04 22:00:31 +00:00
Boudewijn Dekker
2a01ea22a9 Initial commit. Ported some code from wine.
Not much working yet.

svn path=/trunk/; revision=579
1999-07-04 16:01:27 +00:00
Emanuele Aliberti
84d1d53870 Very simple tool to generate aliased *.def files from standard *.def files. May be used to have clean exports tables in DLLs and make ld link stdcall mangled symbols
svn path=/trunk/; revision=578
1999-07-04 11:14:15 +00:00
Rex Jolliff
5050cf437e Added brush scaffolding
svn path=/trunk/; revision=577
1999-07-02 02:33:59 +00:00
Rex Jolliff
9162781f47 more bitmap scaffolding
svn path=/trunk/; revision=576
1999-07-02 02:06:52 +00:00
Rex Jolliff
b63d64cc90 Bitmap scaffolding
svn path=/trunk/; revision=575
1999-07-02 00:54:01 +00:00
Rex Jolliff
858aaeac37 Moved service.h
svn path=/trunk/; revision=574
1999-06-30 22:28:34 +00:00
Eric Kohl
bd4786ea76 Fixed DeleteFileW().
svn path=/trunk/; revision=573
1999-06-27 23:08:31 +00:00
Eric Kohl
bcb831f3c9 Fixed RemoveDirectoryW().
svn path=/trunk/; revision=572
1999-06-27 23:08:07 +00:00
Eric Kohl
1bfb0f94d9 Added file and directory delete functionality (dummy).
svn path=/trunk/; revision=571
1999-06-27 23:06:50 +00:00
Eric Kohl
10f222cd92 Fixed typos.
svn path=/trunk/; revision=570
1999-06-27 13:02:20 +00:00
Eric Kohl
7f7c26ae4d Fixed irq level assertations (assert -> assert_irql).
svn path=/trunk/; revision=569
1999-06-27 13:01:23 +00:00
Emanuele Aliberti
56b4626f56 *** empty log message ***
svn path=/trunk/; revision=568
1999-06-27 07:15:16 +00:00
Emanuele Aliberti
b3f7f2d945 Clean up and more info about the LPC port handle.
svn path=/trunk/; revision=567
1999-06-27 07:11:25 +00:00
Eric Kohl
4d7dcc6886 Fixed application file name (absolute path) in command line.
svn path=/trunk/; revision=566
1999-06-26 18:24:38 +00:00
Eric Kohl
8ae06e50f1 Fixed typo in GetCommandLineA().
svn path=/trunk/; revision=565
1999-06-26 14:28:42 +00:00
Rex Jolliff
19a76ae9af consolidated makefiles and added floppy and dist rules.
svn path=/trunk/; revision=564
1999-06-25 04:36:03 +00:00
Emanuele Aliberti
15714a3ea7 Attempt to connect to a real LPC port
svn path=/trunk/; revision=563
1999-06-24 22:54:27 +00:00
Emanuele Aliberti
9ccf887c5a KeGetPreviousMode (useless)
svn path=/trunk/; revision=562
1999-06-24 22:40:06 +00:00
Boudewijn Dekker
62cdaf7f99 no message
svn path=/trunk/; revision=561
1999-06-24 21:59:41 +00:00
Emanuele Aliberti
fdb2041671 NtConnectPort partial interface
svn path=/trunk/; revision=560
1999-06-24 19:35:31 +00:00
Emanuele Aliberti
11cbd32ea6 Some more ideas for winlogon (it does not compile yet).
svn path=/trunk/; revision=559
1999-06-18 22:40:47 +00:00
Emanuele Aliberti
8d5b94094a NTOSKRNL.ZwXXX functions now call NTOSKRNL.NtXXX via int 0x2e.
svn path=/trunk/; revision=558
1999-06-18 22:11:21 +00:00
Emanuele Aliberti
3d0fe049f6 fixed my bug in ZwXXX stubs generation
svn path=/trunk/; revision=557
1999-06-17 18:09:27 +00:00
Emanuele Aliberti
1e589af8e1 genntdll enhanced to generate ntoskrnl Zw stubs (to be tested)
svn path=/trunk/; revision=556
1999-06-17 00:10:30 +00:00
Emanuele Aliberti
6409ce374c some ideas about LPC
svn path=/trunk/; revision=555
1999-06-15 23:00:39 +00:00
Rex Jolliff
11d31698d5 some additions to the GDI engine
svn path=/trunk/; revision=554
1999-06-15 02:27:24 +00:00
Rex Jolliff
e0c5a61982 untested implementation of the registry
svn path=/trunk/; revision=553
1999-06-14 07:37:55 +00:00
David Welch
d913de5c14 Fixed problem with dpc execution
svn path=/trunk/; revision=552
1999-06-10 20:59:19 +00:00
David Welch
5b3ccbfc02 Implemented ZwOpenProcess corrected
Implemented killing other threads (possible memory leaks)
Made a start on a proper implementation of APCs (based on NT Insider article)

svn path=/trunk/; revision=551
1999-06-09 15:50:16 +00:00
David Welch
f2a6a55325 Not needed anymore
svn path=/trunk/; revision=550
1999-06-09 15:48:56 +00:00
David Welch
4aa2c7952d Not been needed for ages
svn path=/trunk/; revision=549
1999-06-09 15:47:10 +00:00
David Welch
b54e7a6efa No longer need with rex's changes
svn path=/trunk/; revision=548
1999-06-09 15:46:06 +00:00
Emanuele Aliberti
8ae5eb02c7 Initial work for W32 server
svn path=/trunk/; revision=547
1999-06-08 22:50:59 +00:00
Emanuele Aliberti
34a9792f1e Updated to 0.0.14
svn path=/trunk/; revision=546
1999-06-08 22:47:39 +00:00
Emanuele Aliberti
44a536a421 Initial structure (won't compile)
svn path=/trunk/; revision=545
1999-06-08 22:45:53 +00:00
Emanuele Aliberti
c5e296fcf0 Updated to 0.0.14
RES_STR_FILE_VERSION eq RES_STR_PRODUCT_VERSION

svn path=/trunk/; revision=544
1999-06-08 22:37:30 +00:00
David Welch
c8cd1fe03c Added support for ZwOpenProcess
svn path=/trunk/; revision=543
1999-06-08 14:02:01 +00:00
Rex Jolliff
0a1f866c8f Added a few more functions for registry
svn path=/trunk/; revision=542
1999-06-08 07:11:29 +00:00
Rex Jolliff
a5e573f1b3 more hacking on the registry
svn path=/trunk/; revision=541
1999-06-08 04:34:48 +00:00
Rex Jolliff
06938a9103 more registry changes
svn path=/trunk/; revision=540
1999-06-07 15:14:23 +00:00
Emanuele Aliberti
b5118cc48f minor changes
svn path=/trunk/; revision=539
1999-06-06 20:35:26 +00:00
David Welch
31268dc661 Stub
svn path=/trunk/; revision=538
1999-06-06 16:40:10 +00:00
Emanuele Aliberti
9dc68f3b65 Context help functions stubs
svn path=/trunk/; revision=537
1999-06-06 15:34:09 +00:00
Emanuele Aliberti
1af4e48747 NtOpenProcess exported
svn path=/trunk/; revision=536
1999-06-06 15:31:58 +00:00
Emanuele Aliberti
154db698c9 start (to detach a new process) and kill commands added
svn path=/trunk/; revision=535
1999-06-06 15:29:46 +00:00
Boudewijn Dekker
f298282475 Added some user32 functions.
svn path=/trunk/; revision=534
1999-06-05 19:02:54 +00:00
Rex Jolliff
9083091f7b Added PE loader to LOADROS. Updated symbol search in Loader
svn path=/trunk/; revision=533
1999-06-04 23:59:35 +00:00
Rex Jolliff
c4ba9a330d some changes to registry code
svn path=/trunk/; revision=532
1999-06-03 15:07:49 +00:00
Boudewijn Dekker
46a0e6e16e Added stub for create token and delete object audit alarm.
svn path=/trunk/; revision=531
1999-05-31 18:53:33 +00:00
Boudewijn Dekker
f53177b2b2 Added prototype for create token.
svn path=/trunk/; revision=530
1999-05-31 18:50:11 +00:00
Emanuele Aliberti
380ae8a262 Session manager skeleton
svn path=/trunk/; revision=529
1999-05-30 20:40:18 +00:00
Rex Jolliff
28f788e6ed fixes for compile errors.
svn path=/trunk/; revision=528
1999-05-29 02:51:05 +00:00
David Welch
126768af64 Lots of changes to the kernel
svn path=/trunk/; revision=527
1999-05-29 00:15:17 +00:00
Rex Jolliff
0deeaa0d83 fixes for some compiler errors.
svn path=/trunk/; revision=526
1999-05-28 20:40:05 +00:00
Emanuele Aliberti
da7f2bf2b2 Little editing
svn path=/trunk/; revision=525
1999-05-28 19:49:46 +00:00
Rex Jolliff
6709ff7e24 added DDI version macro
svn path=/trunk/; revision=524
1999-05-28 18:46:23 +00:00
Rex Jolliff
d415ba8508 First hack at KMDLLs
svn path=/trunk/; revision=523
1999-05-28 18:24:27 +00:00
Rex Jolliff
9377d51b1a More code for win32k.sys
svn path=/trunk/; revision=522
1999-05-27 23:08:26 +00:00
Emanuele Aliberti
662c77c00c SetLastError() used in stubs
svn path=/trunk/; revision=521
1999-05-26 05:24:21 +00:00
Emanuele Aliberti
5169949e78 IMAGE_SUBSYSTEM_xxx
svn path=/trunk/; revision=520
1999-05-26 05:23:26 +00:00
Rex Jolliff
480d6d6388 More work on generic VGA driver
svn path=/trunk/; revision=519
1999-05-26 02:37:21 +00:00
Rex Jolliff
389b5fe480 More work on generic VGA driver skeleton
svn path=/trunk/; revision=518
1999-05-26 02:34:31 +00:00
Rex Jolliff
d89e0df163 changes to support VGA miniport driver
svn path=/trunk/; revision=517
1999-05-26 00:39:11 +00:00
Rex Jolliff
36a7c3cf0d Added a skeleton VGA miniport driver
svn path=/trunk/; revision=516
1999-05-26 00:35:26 +00:00
Eric Kohl
b887962d1d Fixed some compiler warnings.
svn path=/trunk/; revision=515
1999-05-25 19:16:29 +00:00
Rex Jolliff
5f710be5ef Added code to implement videoport driver
svn path=/trunk/; revision=514
1999-05-25 03:19:47 +00:00
Emanuele Aliberti
47ee1b5a90 gdi32.dll added
svn path=/trunk/; revision=513
1999-05-24 20:09:06 +00:00
Emanuele Aliberti
c9b6355479 stubs for most gdi32 functions
svn path=/trunk/; revision=512
1999-05-24 20:04:44 +00:00
Boudewijn Dekker
5c91ed98f2 no message
svn path=/trunk/; revision=511
1999-05-24 15:22:43 +00:00
Boudewijn Dekker
1cdff7f03d no message
svn path=/trunk/; revision=510
1999-05-24 15:14:14 +00:00
Boudewijn Dekker
d21b624ded no message
svn path=/trunk/; revision=509
1999-05-24 14:47:21 +00:00
Emanuele Aliberti
4b60f335f5 GDI32.DLL auxiliary files
svn path=/trunk/; revision=508
1999-05-23 07:41:33 +00:00
Rex Jolliff
c805537640 added stubs and build spec for win32k.sys
svn path=/trunk/; revision=507
1999-05-22 23:55:56 +00:00
Boudewijn Dekker
2b96374f2a no message
svn path=/trunk/; revision=506
1999-05-22 07:28:28 +00:00
Rex Jolliff
2854aac246 more work on the videoport driver.
svn path=/trunk/; revision=505
1999-05-22 07:25:30 +00:00
901 changed files with 114157 additions and 50337 deletions

2
reactos/.cvsignore Normal file
View File

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

14
reactos/CREDITS Normal file
View File

@@ -0,0 +1,14 @@
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,3 +1,9 @@
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

31
reactos/INSTALL Normal file
View File

@@ -0,0 +1,31 @@
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'.

280
reactos/Makefile Normal file
View File

@@ -0,0 +1,280 @@
#
# 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,6 +1,6 @@
0.0.14:
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)

24
reactos/README Normal file
View File

@@ -0,0 +1,24 @@
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

@@ -0,0 +1,97 @@
#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

@@ -0,0 +1,44 @@
#
#
#
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

@@ -10,7 +10,7 @@ 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);
@@ -18,19 +18,22 @@ void debug_printf(char* fmt, ...)
}
void main(int argc, char* argv[])
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("Args: %x\n",argv[i]);
debug_printf("Args: '%s'\n",argv[i]);
debug_printf("Argv[%d]: %x\n",i,argv[i]);
debug_printf("Argv[%d]: '%s'\n",i,argv[i]);
}
return 0;
}

View File

@@ -2,8 +2,11 @@
#
#
OBJECTS= args.o
PROGS= args.exe
all: args.exe
BASE_CFLAGS = -I../../include
all: $(PROGS)
.phony: all
@@ -14,7 +17,25 @@ clean:
.phony: clean
args.exe: $(OBJECTS) $(LIBS)
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

View File

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

View File

@@ -1,25 +1,82 @@
#include <stdio.h>
#include <windows.h>
#define NR_THREADS (0x1000)
#define NR_THREADS (0x1)
ULONG thread_main(PVOID param)
DWORD WINAPI
thread_main1(LPVOID param)
{
printf("Thread 1 running (Counter %lu)\n", (DWORD)param);
return 0;
}
int main()
DWORD WINAPI
thread_main2(LPVOID param)
{
unsigned int i=0;
printf("Thread 2 running (Counter %lu)\n", (DWORD)param);
return 0;
}
int main (void)
{
HANDLE hThread;
DWORD i=0;
DWORD id;
printf("Creating %d threads\n",NR_THREADS);
#if 1
printf("Creating %d threads...\n",NR_THREADS*2);
for (i=0;i<NR_THREADS;i++)
{
CreateThread(NULL,
0,
thread_main,
NULL,
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,20 +1,41 @@
#
#
#
PROGS = bench-thread
all: bench-thread.exe
all: $(PROGS:%=%.exe)
.phony: all
clean:
- $(RM) test-stdio.o
- $(RM) test-stdio.exe
- $(RM) test-stdio.sym
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) bench-thread.c -lkernel32 -o bench-thread.exe
$(CC) $(CFLAGS) bench-thread.c -lkernel32 -o bench-thread.exe
$(NM) --numeric-sort bench-thread.exe > bench-thread.sym
include ../../rules.mak

View File

@@ -0,0 +1,33 @@
#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

@@ -0,0 +1,41 @@
#
#
#
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,10 +1,8 @@
#include <stdio.h>
#include <ddk/ntddk.h>
int main(int argc, char* argv[])
{
UNICODE_STRING UnicodeString;
RtlInitUnicodeString(&UnicodeString,L"Hello world\n");
NtDisplayString(&UnicodeString);
printf("Hello world\n");
return(0);
}

View File

@@ -1,8 +1,9 @@
#
#
#
OBJECTS = ../common/crt0.o hello.o
LIBS = ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a
OBJECTS = hello.o
PROGS = hello.exe
LIBS =
CLEAN_FILES = hello.o hello.exe
all: hello.exe
@@ -14,7 +15,25 @@ $(CLEAN_FILES:%=%_clean): %_clean:
.phony: clean $(CLEAN_FILES:%=%_clean)
hello.exe: $(OBJECTS) $(LIBS)
$(LD) $(OBJECTS) $(LIBS) -o hello.exe
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

@@ -0,0 +1,205 @@
/* $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

@@ -0,0 +1,192 @@
/* $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

@@ -0,0 +1,239 @@
/* $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

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

View File

@@ -0,0 +1,62 @@
#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

@@ -0,0 +1,98 @@
#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

@@ -0,0 +1,51 @@
#
#
#
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

@@ -0,0 +1,51 @@
#
#
#
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

@@ -0,0 +1,60 @@
#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

@@ -0,0 +1,52 @@
/* $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,19 +1,40 @@
#
#
#
PROGS= test-stdio tst-printf tstdiomisc bug2 bug3 \
temptest test-fseek test_rdwr
all: test-stdio.exe tst-printf.exe tstdiomisc.exe bug2.exe bug3.exe \
temptest.exe test-fseek.exe test_rdwr.exe
all: $(PROGS:%=%.exe)
.phony: all
clean:
- $(RM) test-stdio.o
- $(RM) test-stdio.exe
- $(RM) test-stdio.sym
$(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

View File

@@ -0,0 +1,41 @@
#
#
#
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

@@ -0,0 +1,46 @@
#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

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

View File

@@ -0,0 +1,26 @@
# $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

@@ -0,0 +1,262 @@
/* $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

@@ -10,10 +10,17 @@ int main(int argc, char* argv[])
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

@@ -2,6 +2,7 @@
#
#
OBJECTS= cat.o
PROGS= cat.exe
all: cat.exe
@@ -14,8 +15,28 @@ clean:
.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 > args.sym
$(NM) --numeric-sort cat.exe > cat.sym
include ../../rules.mak

View File

@@ -1,326 +0,0 @@
/*
* ALIAS.C - alias administration module.
*
*
* History:
*
* 02/02/1996 (Oliver Mueller)
* started.
*
* 02/03/1996 (Oliver Mueller)
* Added sorting algorithm and case sensitive substitution by using
* partstrupr().
*
* 27 Jul 1998 John P. Price
* added config.h include
* added ifdef's to disable aliases
*
* 09-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed crash when removing an alias in DeleteAlias().
* Added help text ("/?").
*
* 14-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Clean up and Unicode safe!
*
* 24-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection safe!
*/
#include "config.h"
#ifdef FEATURE_ALIASES
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
typedef struct tagALIAS
{
struct tagALIAS *next;
LPTSTR lpName;
LPTSTR lpSubst;
WORD wUsed;
} ALIAS, *LPALIAS;
static LPALIAS lpFirst = NULL;
static LPALIAS lpLast = NULL;
static WORD wUsed = 0;
/* module internal functions */
/* strlwr only for first word in string */
static VOID
partstrlwr (LPTSTR str)
{
LPTSTR c = str;
while (*c && !_istspace (*c) && *c != _T('='))
{
*c = _totlower (*c);
c++;
}
}
static VOID
PrintAlias (VOID)
{
LPALIAS ptr = lpFirst;
while (ptr)
{
ConOutPrintf (_T("%s=%s\n"), ptr->lpName, ptr->lpSubst);
ptr = ptr->next;
}
}
static VOID
DeleteAlias (LPTSTR pszName)
{
LPALIAS ptr = lpFirst;
LPALIAS prev = NULL;
while (ptr)
{
if (!_tcsicmp (ptr->lpName, pszName))
{
if (prev)
prev->next = ptr->next;
else
lpFirst = ptr->next;
free (ptr->lpName);
free (ptr->lpSubst);
free (ptr);
return;
}
prev = ptr;
ptr = ptr->next;
}
}
static INT
AddAlias (LPTSTR name, LPTSTR subst)
{
LPALIAS ptr = lpFirst;
LPALIAS prev, entry;
LPTSTR s;
while (ptr)
{
if (!_tcsicmp (ptr->lpName, name))
{
s = (LPTSTR)malloc ((_tcslen (subst) + 1)*sizeof(TCHAR));
if (!s)
{
error_out_of_memory ();
return 1;
}
free (ptr->lpSubst);
ptr->lpSubst = s;
_tcscpy (ptr->lpSubst, subst);
return 0;
}
ptr = ptr->next;
}
ptr = (LPALIAS)malloc (sizeof (ALIAS));
if (!ptr)
return 1;
ptr->next = 0;
ptr->lpName = (LPTSTR)malloc ((_tcslen (name) + 1)*sizeof(TCHAR));
if (!ptr->lpName)
{
error_out_of_memory ();
free (ptr);
return 1;
}
_tcscpy (ptr->lpName, name);
ptr->lpSubst = (LPTSTR)malloc ((_tcslen (subst) + 1)*sizeof(TCHAR));
if (!ptr->lpSubst)
{
error_out_of_memory ();
free (ptr->lpName);
free (ptr);
return 1;
}
_tcscpy (ptr->lpSubst, subst);
/* it's necessary for recursive substitution */
partstrlwr (ptr->lpSubst);
ptr->wUsed = 0;
/* Alias table must be sorted!
* Here a little example:
* command line = "ls -c"
* If the entries are
* ls=dir
* ls -c=ls /w
* command line will be expanded to "dir -c" which is not correct.
* If the entries are sortet as
* ls -c=ls /w
* ls=dir
* it will be expanded to "dir /w" which is a valid DOS command.
*/
entry = lpFirst;
prev = 0;
while (entry)
{
if (_tcsicmp (ptr->lpName, entry->lpName) > 0)
{
if (prev)
{
prev->next = ptr;
ptr->next = entry;
}
else
{
ptr->next = entry;
lpFirst = ptr;
}
return 0;
}
prev = entry;
entry = entry->next;
}
/* The new entry is the smallest (or the first) and must be
* added to the end of the list.
*/
if (!lpFirst)
lpFirst = ptr;
else
lpLast->next = ptr;
lpLast = ptr;
return 0;
}
/* specified routines */
VOID ExpandAlias (LPTSTR cmd, INT maxlen)
{
unsigned n = 0,
m,
i,
len;
short d = 1;
LPALIAS ptr = lpFirst;
wUsed++;
if (wUsed == 0)
{
while (ptr)
ptr->wUsed = 0;
ptr = lpFirst;
wUsed = 1;
}
/* skipping white spaces */
while (_istspace (cmd[n]))
n++;
partstrlwr (&cmd[n]);
if (!_tcsncmp (&cmd[n], _T("NOALIAS"), 7) &&
(_istspace (cmd[n + 7]) || cmd[n + 7] == _T('\0')))
{
memmove (cmd, &cmd[n + 7], (_tcslen (&cmd[n + 7]) + 1) * sizeof (TCHAR));
return;
}
/* substitution loop */
while (d)
{
d = 0;
while (ptr)
{
len = _tcslen (ptr->lpName);
if (!_tcsncmp (&cmd[n], ptr->lpName, len) &&
(_istspace (cmd[n + len]) || cmd[n + len] == _T('\0')) &&
ptr->wUsed != wUsed)
{
m = _tcslen (ptr->lpSubst);
if ((int)(_tcslen (cmd) - len + m - n) > maxlen)
{
ConErrPrintf (_T("Command line too long after alias expansion!\n"));
/* the parser won't cause any problems with an empty line */
cmd[0] = _T('\0');
}
else
{
memmove (&cmd[m], &cmd[n + len], (_tcslen(&cmd[n + len]) + 1) * sizeof (TCHAR));
for (i = 0; i < m; i++)
cmd[i] = ptr->lpSubst[i];
ptr->wUsed = wUsed;
/* whitespaces are removed! */
n = 0;
d = 1;
}
}
ptr = ptr->next;
}
}
}
INT cmd_alias (LPTSTR cmd, LPTSTR param)
{
LPTSTR ptr;
INT n = 0;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Sets, removes or shows aliases.\n"
"\n"
"ALIAS [alias=[command]]\n"
"\n"
" alias Name for an alias.\n"
" command Text to be substituted for an alias.\n"
"\n"
// "For example:\n"
"To list all aliases:\n"
" ALIAS\n\n"
"To set a new or replace an existing alias:\n"
" ALIAS da=dir a:\n\n"
"To remove an alias from the alias list:\n"
" ALIAS da="
// "Type ALIAS without a parameter to display the alias list.\n"
));
return 0;
}
if (param[0] == _T('\0'))
{
PrintAlias ();
return 0;
}
/* error if no '=' found */
if ((ptr = _tcschr (param, _T('='))) == 0)
return -1;
/* Split rest into name and substitute */
*ptr++ = _T('\0');
partstrlwr (param);
if (ptr[0] == _T('\0'))
DeleteAlias (param);
else
n = AddAlias (param, ptr);
return n;
}
#endif

View File

@@ -1,357 +0,0 @@
/*
* ATTRIB.C - attrib internal command.
*
*
* History:
*
* 04-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* started
*
* 09-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* implementation works, except recursion ("attrib /s").
*
* 05-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* major rewrite.
* fixed recursion ("attrib /s").
* started directory support ("attrib /s /d").
* updated help text.
*
* 14-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode ready!
*
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection ready!
*
* 21-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added check for invalid filenames.
*
* 23-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added handling of multiple filenames.
*/
#include "config.h"
#ifdef INCLUDE_CMD_ATTRIB
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
static VOID
PrintAttribute (LPTSTR pszPath, LPTSTR pszFile, BOOL bRecurse)
{
WIN32_FIND_DATA findData;
HANDLE hFind;
TCHAR szFullName[MAX_PATH];
LPTSTR pszFileName;
/* prepare full file name buffer */
_tcscpy (szFullName, pszPath);
pszFileName = szFullName + _tcslen (szFullName);
/* display all subdirectories */
if (bRecurse)
{
/* append file name */
_tcscpy (pszFileName, pszFile);
hFind = FindFirstFile (szFullName, &findData);
if (hFind == INVALID_HANDLE_VALUE)
{
ErrorMessage (GetLastError (), pszFile);
return;
}
do
{
if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
continue;
if (!_tcscmp (findData.cFileName, _T(".")) ||
!_tcscmp (findData.cFileName, _T("..")))
continue;
_tcscpy (pszFileName, findData.cFileName);
_tcscat (pszFileName, _T("\\"));
PrintAttribute (szFullName, pszFile, bRecurse);
}
while (FindNextFile (hFind, &findData));
FindClose (hFind);
}
/* append file name */
_tcscpy (pszFileName, pszFile);
/* display current directory */
hFind = FindFirstFile (szFullName, &findData);
if (hFind == INVALID_HANDLE_VALUE)
{
ErrorMessage (GetLastError (), pszFile);
return;
}
do
{
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
continue;
_tcscpy (pszFileName, findData.cFileName);
ConOutPrintf (_T("%c %c%c%c %s\n"),
(findData.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) ? _T('A') : _T(' '),
(findData.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) ? _T('S') : _T(' '),
(findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) ? _T('H') : _T(' '),
(findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _T('R') : _T(' '),
szFullName);
}
while (FindNextFile (hFind, &findData));
FindClose (hFind);
}
static VOID
ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask,
DWORD dwAttrib, BOOL bRecurse, BOOL bDirectories)
{
WIN32_FIND_DATA findData;
HANDLE hFind;
DWORD dwAttribute;
TCHAR szFullName[MAX_PATH];
LPTSTR pszFileName;
/* prepare full file name buffer */
_tcscpy (szFullName, pszPath);
pszFileName = szFullName + _tcslen (szFullName);
/* change all subdirectories */
if (bRecurse)
{
/* append file name */
_tcscpy (pszFileName, _T("*.*"));
hFind = FindFirstFile (szFullName, &findData);
if (hFind == INVALID_HANDLE_VALUE)
{
ErrorMessage (GetLastError (), pszFile);
return;
}
do
{
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (!_tcscmp (findData.cFileName, _T(".")) ||
!_tcscmp (findData.cFileName, _T("..")))
continue;
_tcscpy (pszFileName, findData.cFileName);
_tcscat (pszFileName, _T("\\"));
ChangeAttribute (szFullName, pszFile, dwMask,
dwAttrib, bRecurse, bDirectories);
}
}
while (FindNextFile (hFind, &findData));
FindClose (hFind);
}
/* append file name */
_tcscpy (pszFileName, pszFile);
hFind = FindFirstFile (szFullName, &findData);
if (hFind == INVALID_HANDLE_VALUE)
{
ErrorMessage (GetLastError (), pszFile);
return;
}
do
{
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
continue;
_tcscpy (pszFileName, findData.cFileName);
dwAttribute = GetFileAttributes (szFullName);
if (dwAttribute != 0xFFFFFFFF)
{
dwAttribute = (dwAttribute & ~dwMask) | dwAttrib;
SetFileAttributes (szFullName, dwAttribute);
}
}
while (FindNextFile (hFind, &findData));
FindClose (hFind);
}
INT cmd_attrib (LPTSTR cmd, LPTSTR param)
{
LPTSTR *arg;
INT argc, i;
TCHAR szPath[MAX_PATH];
TCHAR szFileName [MAX_PATH];
BOOL bRecurse = FALSE;
BOOL bDirectories = FALSE;
DWORD dwAttrib = 0;
DWORD dwMask = 0;
/* initialize strings */
szPath[0] = _T('\0');
szFileName[0] = _T('\0');
/* print help */
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays or changes file attributes.\n\n"
"ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n"
" [/S [/D]]\n\n"
" + Sets an attribute\n"
" - Clears an attribute\n"
" R Read-only file attribute\n"
" A Archive file attribute\n"
" S System file attribute\n"
" H Hidden file attribute\n"
" /S Processes matching files in the current directory\n"
" and all subdirectories\n"
" /D Processes direcories as well\n\n"
"Type ATTRIB without a parameter to display the attributes of all files."));
return 0;
}
/* build parameter array */
arg = split (param, &argc);
/* check for options */
for (i = 0; i < argc; i++)
{
if (_tcsicmp (arg[i], _T("/s")) == 0)
bRecurse = TRUE;
else if (_tcsicmp (arg[i], _T("/d")) == 0)
bDirectories = TRUE;
}
/* create attributes and mask */
for (i = 0; i < argc; i++)
{
if (*arg[i] == _T('+'))
{
if (_tcslen (arg[i]) != 2)
{
error_invalid_parameter_format (arg[i]);
freep (arg);
return -1;
}
switch ((TCHAR)_totupper (arg[i][1]))
{
case _T('A'):
dwMask |= FILE_ATTRIBUTE_ARCHIVE;
dwAttrib |= FILE_ATTRIBUTE_ARCHIVE;
break;
case _T('H'):
dwMask |= FILE_ATTRIBUTE_HIDDEN;
dwAttrib |= FILE_ATTRIBUTE_HIDDEN;
break;
case _T('R'):
dwMask |= FILE_ATTRIBUTE_READONLY;
dwAttrib |= FILE_ATTRIBUTE_READONLY;
break;
case _T('S'):
dwMask |= FILE_ATTRIBUTE_SYSTEM;
dwAttrib |= FILE_ATTRIBUTE_SYSTEM;
break;
default:
error_invalid_parameter_format (arg[i]);
freep (arg);
return -1;
}
}
else if (*arg[i] == _T('-'))
{
if (_tcslen (arg[i]) != 2)
{
error_invalid_parameter_format (arg[i]);
freep (arg);
return -1;
}
switch ((TCHAR)_totupper (arg[i][1]))
{
case _T('A'):
dwMask |= FILE_ATTRIBUTE_ARCHIVE;
dwAttrib &= ~FILE_ATTRIBUTE_ARCHIVE;
break;
case _T('H'):
dwMask |= FILE_ATTRIBUTE_HIDDEN;
dwAttrib &= ~FILE_ATTRIBUTE_HIDDEN;
break;
case _T('R'):
dwMask |= FILE_ATTRIBUTE_READONLY;
dwAttrib &= ~FILE_ATTRIBUTE_READONLY;
break;
case _T('S'):
dwMask |= FILE_ATTRIBUTE_SYSTEM;
dwAttrib &= ~FILE_ATTRIBUTE_SYSTEM;
break;
default:
error_invalid_parameter_format (arg[i]);
freep (arg);
return -1;
}
}
}
if (argc == 0)
{
DWORD len;
len = GetCurrentDirectory (MAX_PATH, szPath);
if (szPath[len-1] != _T('\\'))
{
szPath[len] = _T('\\');
szPath[len + 1] = 0;
}
_tcscpy (szFileName, _T("*.*"));
PrintAttribute (szPath, szFileName, bRecurse);
}
else
{
/* get full file name */
for (i = 0; i < argc; i++)
{
if ((*arg[i] != _T('+')) && (*arg[i] != _T('-')) && (*arg[i] != _T('/')))
{
LPTSTR p;
GetFullPathName (arg[i], MAX_PATH, szPath, NULL);
p = _tcsrchr (szPath, _T('\\')) + 1;
_tcscpy (szFileName, p);
*p = _T('\0');
if (dwMask == 0)
PrintAttribute (szPath, szFileName, bRecurse);
else
ChangeAttribute (szPath, szFileName, dwMask,
dwAttrib, bRecurse, bDirectories);
}
}
}
freep (arg);
return 0;
}
#endif /* INCLUDE_CMD_ATTRIB */

View File

@@ -1,461 +0,0 @@
/*
* BATCH.C - batch file processor for CMD.EXE.
*
*
* History:
*
* ??/??/?? (Evan Jeffrey)
* started.
*
* 15 Jul 1995 (Tim Norman)
* modes and bugfixes.
*
* 08 Aug 1995 (Matt Rains)
* i have cleaned up the source code. changes now bring this
* source into guidelines for recommended programming practice.
*
* i have added some constants to help making changes easier.
*
* 29 Jan 1996 (Steffan Kaiser)
* made a few cosmetic changes
*
* 05 Feb 1996 (Tim Norman)
* changed to comply with new first/rest calling scheme
*
* 14 Jun 1997 (Steffen Kaiser)
* bug fixes. added error level expansion %?. ctrl-break handling
*
* 16 Jul 1998 (Hans B Pufal)
* Totally reorganised in conjunction with COMMAND.C (cf) to
* implement proper BATCH file nesting and other improvements.
*
* 16 Jul 1998 (John P Price <linux-guru@gcfl.net>)
* Seperated commands into individual files.
*
* 19 Jul 1998 (Hans B Pufal) [HBP_001]
* Preserve state of echo flag across batch calls.
*
* 19 Jul 1998 (Hans B Pufal) [HBP_002]
* Implementation of FOR command
*
* 20-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added error checking after malloc calls
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 02-Aug-1998 (Hans B Pufal) [HBP_003]
* Fixed bug in ECHO flag restoration at exit from batch file
*
* 26-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced CRT io functions by Win32 io functions.
* Unicode safe!
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "cmd.h"
#include "batch.h"
/* The stack of current batch contexts.
* NULL when no batch is active
*/
LPBATCH_CONTEXT bc = NULL;
BOOL bEcho = TRUE; /* The echo flag */
/* Buffer for reading Batch file lines */
TCHAR textline[BATCH_BUFFSIZE];
/*
* Returns a pointer to the n'th parameter of the current batch file.
* If no such parameter exists returns pointer to empty string.
* If no batch file is current, returns NULL
*
*/
LPTSTR FindArg (INT n)
{
LPTSTR pp;
#ifdef _DEBUG
DebugPrintf ("FindArg: (%d)\n", n);
#endif
if (bc == NULL)
return NULL;
n += bc->shiftlevel;
pp = bc->params;
/* Step up the strings till we reach the end */
/* or the one we want */
while (*pp && n--)
pp += _tcslen (pp) + 1;
return pp;
}
/* HBP_002 { FOR command support */
/*
* Batch_params builds a parameter list in newlay allocated memory.
* The parameters consist of null terminated strings with a final
* NULL character signalling the end of the parameters.
*
*/
LPTSTR BatchParams (LPTSTR s1, LPTSTR s2)
{
LPTSTR dp = (LPTSTR)malloc ((_tcslen(s1) + _tcslen(s2) + 3) * sizeof (TCHAR));
/* JPP 20-Jul-1998 added error checking */
if (dp == NULL)
{
error_out_of_memory();
return NULL;
}
if (s1 && *s1)
{
s1 = stpcpy (dp, s1);
*s1++ = _T('\0');
}
else
s1 = dp;
while (*s2)
{
if (_istspace (*s2) || _tcschr (_T(",;"), *s2))
{
*s1++ = _T('\0');
s2++;
while (*s2 && _tcschr (_T(" ,;"), *s2))
s2++;
continue;
}
if ((*s2 == _T('"')) || (*s2 == _T('\'')))
{
TCHAR st = *s2;
do
*s1++ = *s2++;
while (*s2 && (*s2 != st));
}
*s1++ = *s2++;
}
*s1++ = _T('\0');
*s1 = _T('\0');
return dp;
}
/* HBP_002 } */
/*
* If a batch file is current, exits it, freeing the context block and
* chaining back to the previous one.
*
* If no new batch context is found, sets ECHO back ON.
*
* If the parameter is non-null or not empty, it is printed as an exit
* message
*/
VOID ExitBatch (LPTSTR msg)
{
#ifdef _DEBUG
DebugPrintf ("ExitBatch: (\'%s\')\n", msg);
#endif
if (bc)
{
LPBATCH_CONTEXT t = bc;
if (bc->hBatchFile)
{
CloseHandle (bc->hBatchFile);
bc->hBatchFile = INVALID_HANDLE_VALUE;
}
if (bc->params)
free(bc->params);
/* HBP_002 { FOR command support */
if (bc->forproto)
free(bc->forproto);
if (bc->ffind)
free(bc->ffind);
/* HBP_002 } */
/* HBP_003 { fix echo restore */
/* Preserve echo state across batch calls */
bEcho = bc->bEcho;
/* HBP_003 fix echo restore } */
bc = bc->prev;
free(t);
}
/* HBP_001 } */
if (msg && *msg)
ConOutPrintf ("%s\n", msg);
}
/*
* Start batch file execution
*
* The firstword parameter is the full filename of the batch file.
*
*/
BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
{
HANDLE hFile;
hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
#ifdef _DEBUG
DebugPrintf ("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n",
fullname, firstword, param, hFile);
#endif
if (hFile == INVALID_HANDLE_VALUE)
{
ConErrPrintf (_T("Error opening batch file\n"));
return FALSE;
}
/* HBP_002 { FOR command support */
/* Kill any and all FOR contexts */
while (bc && bc->forvar)
ExitBatch (NULL);
/* HBP_002 } */
if (bc == NULL)
{
/* No curent batch file, create a new context */
LPBATCH_CONTEXT n = (LPBATCH_CONTEXT)malloc (sizeof(BATCH_CONTEXT));
if (n == NULL)
{
/* JPP 20-Jul-1998 added error checking */
error_out_of_memory ();
return FALSE;
}
n->prev = bc;
bc = n;
}
else if (bc->hBatchFile != INVALID_HANDLE_VALUE)
{
/* Then we are transferring to another batch */
CloseHandle (bc->hBatchFile);
bc->hBatchFile = INVALID_HANDLE_VALUE;
free (bc->params);
}
bc->hBatchFile = hFile;
bc->bEcho = bEcho; /* Preserve echo across batch calls [HBP_001] */
bc->shiftlevel = 0;
/* HBP_002 { FOR command support */
bc->ffind = NULL;
bc->forvar = _T('\0');
bc->forproto = NULL;
bc->params = BatchParams (firstword, param);
/* HBP_002 } */
return TRUE;
}
/*
* Read and return the next executable line form the current batch file
*
* If no batch file is current or no further executable lines are found
* return NULL.
*
* Here we also look out for FOR bcontext structures which trigger the
* FOR expansion code.
*
* Set eflag to 0 if line is not to be echoed else 1
*/
LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
{
HANDLE hFind = INVALID_HANDLE_VALUE;
LPTSTR first;
LPTSTR ip;
/* No batch */
if (bc == NULL)
return NULL;
#ifdef _DEBUG
DebugPrintf ("ReadBatchLine ()\n");
#endif
while (1)
{
/* User halt */
if (CheckCtrlBreak (BREAK_BATCHFILE))
{
while (bc)
ExitBatch (NULL);
return NULL;
}
/* HBP_002 { FOR command support */
/* No batch */
if (bc == NULL)
return NULL;
/* If its a FOR context... */
if (bc->forvar)
{
LPTSTR sp = bc->forproto; /* pointer to prototype command */
LPTSTR dp = textline; /* Place to expand protoype */
LPTSTR fv = FindArg (0); /* Next list element */
/* End of list so... */
if ((fv == NULL) || (*fv == _T('\0')))
{
/* just exit this context */
ExitBatch (NULL);
continue;
}
if (_tcscspn (fv, _T("?*")) == _tcslen (fv))
{
/* element is wild file */
bc->shiftlevel++; /* No use it and shift list */
}
else
{
/* Wild file spec, find first (or next) file name */
if (bc->ffind)
{
/* First already done so do next */
fv = FindNextFile (hFind, bc->ffind) ? bc->ffind->cFileName : NULL;
}
else
{
/* For first find, allocate a find first block */
if ((bc->ffind = (LPWIN32_FIND_DATA)malloc (sizeof (WIN32_FIND_DATA))) == NULL)
{
error_out_of_memory(); /* JPP 20-Jul-1998 added error checking */
return NULL;
}
hFind = FindFirstFile (fv, bc->ffind);
fv = !(hFind==INVALID_HANDLE_VALUE) ? bc->ffind->cFileName : NULL;
}
if (fv == NULL)
{
/* Null indicates no more files.. */
free (bc->ffind); /* free the buffer */
bc->ffind = NULL;
bc->shiftlevel++; /* On to next list element */
continue;
}
}
/* At this point, fv points to parameter string */
while (*sp)
{
if ((*sp == _T('%')) && (*(sp + 1) == bc->forvar))
{
/* replace % var */
dp = stpcpy (dp, fv);
sp += 2;
}
else
{
/* Else just copy */
*dp++ = *sp++;
}
}
*dp = _T('\0');
*bLocalEcho = bEcho;
return textline;
}
/* HBP_002 } */
if (!FileGetString (bc->hBatchFile, textline, sizeof (textline)))
{
#ifdef _DEBUG
DebugPrintf (_T("ReadBatchLine(): Reached EOF!\n"));
#endif
/* End of file.... */
ExitBatch (NULL);
if (bc == NULL)
return NULL;
continue;
}
#ifdef _DEBUG
DebugPrintf (_T("ReadBatchLine(): textline: \'%s\'\n"), textline);
#endif
/* Strip leading spaces and trailing space/control chars */
for (first = textline; _istspace (*first); first++)
;
for (ip = first + _tcslen (first) - 1; _istspace (*ip) || _istcntrl (*ip); ip--)
;
*++ip = _T('\0');
/* ignore labels and empty lines */
if (*first == _T(':') || *first == 0)
continue;
if (*first == _T('@'))
{
/* don't echo this line */
do
first++;
while (_istspace (*first));
*bLocalEcho = 0;
}
else
*bLocalEcho = bEcho;
break;
}
return first;
}

View File

@@ -1,44 +0,0 @@
/*
* BATCH.H - A structure to preserve the context of a batch file
*
*
*/
#ifndef _BATCH_H_INCLUDED_
#define _BATCH_H_INCLUDED_
typedef struct tagBATCHCONTEXT
{
struct tagBATCHCONTEXT *prev;
LPWIN32_FIND_DATA ffind;
HANDLE hBatchFile;
LPTSTR forproto;
LPTSTR params;
INT shiftlevel;
BOOL bEcho; /* Preserve echo flag across batch calls [HBP_001] */
TCHAR forvar;
} BATCH_CONTEXT, *LPBATCH_CONTEXT;
/* HBP_002 } */
/* The stack of current batch contexts.
* NULL when no batch is active
*/
extern LPBATCH_CONTEXT bc;
extern BOOL bEcho; /* The echo flag */
#define BATCH_BUFFSIZE 2048
extern TCHAR textline[BATCH_BUFFSIZE]; /* Buffer for reading Batch file lines */
LPTSTR FindArg (INT);
LPTSTR BatchParams (LPTSTR, LPTSTR);
VOID ExitBatch (LPTSTR);
BOOL Batch (LPTSTR, LPTSTR, LPTSTR);
LPTSTR ReadBatchLine (LPBOOL);
#endif /* _BATCH_H_INCLUDED_ */

View File

@@ -1,57 +0,0 @@
/*
* BEEP.C - beep internal command.
*
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
*
* 16 Jul 1998 (John P Price)
* Separated commands into individual files.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 14-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("beep /?").
* Unicode ready!
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection ready!
*/
#include "config.h"
#ifdef INCLUDE_CMD_BEEP
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
#include "batch.h"
INT cmd_beep (LPTSTR cmd, LPTSTR param)
{
if (_tcsncmp (param, _T("/?"), 2) == 0)
{
ConOutPuts (_T("Beep the speaker.\n\nBEEP"));
return 0;
}
#if 0
/* check if run in batch mode */
if (bc == NULL)
return 1;
#endif
#ifdef __REACTOS__
Beep (440, 50);
#else
MessageBeep (-1);
#endif
return 0;
}
#endif

View File

@@ -1,15 +0,0 @@
**** Please report bugs to ekohl@abo.rhein-zeitung.de! ****
Known bugs in CMD version 0.0.4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o let set work with or without the '=' sign. People like it that way.
(I don't know, if I should really fix this?)
o command.com ignores control-c and control-break, which makes it difficult
to quit typing a long file, among other things
o "alias v = dir" doesn't work because of the spaces.
**** Please report bugs to ekohl@abo.rhein-zeitung.de! ****

View File

@@ -1,92 +0,0 @@
/*
* CALL.C - call internal batch command.
*
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
*
* 16 Jul 1998 (John P Price)
* Seperated commands into individual files.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 04-Aug-1998 (Hans B Pufal)
* added lines to initialize for pointers (HBP004) This fixed the
* lock-up that happened sometimes when calling a batch file from
* another batch file.
*
* 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("call /?") and cleaned up.
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cmd.h"
#include "batch.h"
/*
* Perform CALL command.
*
* Allocate a new batch context and add it to the current chain.
* Call parsecommandline passing in our param string
* If No batch file was opened then remove our newly allocted
* context block.
*/
INT cmd_call (LPTSTR cmd, LPTSTR param)
{
LPBATCH_CONTEXT n = NULL;
#ifdef _DEBUG
DebugPrintf ("cmd_call: (\'%s\',\'%s\')\n", cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Calls one batch program from another.\n\n"
"CALL [drive:][path]filename [batch-parameter]\n\n"
" batch-parameter Specifies any command-line information required by the\n"
" batch program."));
return 0;
}
n = (LPBATCH_CONTEXT)malloc (sizeof (BATCH_CONTEXT));
if (n == NULL)
{
error_out_of_memory ();
return 1;
}
n->prev = bc;
bc = n;
bc->hBatchFile = INVALID_HANDLE_VALUE;
bc->params = NULL;
bc->shiftlevel = 0;
bc->forvar = 0; /* HBP004 */
bc->forproto = NULL; /* HBP004 */
ParseCommandLine (param);
/* Wasn't a batch file so remove conext */
if (bc->hBatchFile == INVALID_HANDLE_VALUE)
{
bc = bc->prev;
free (n);
}
return 0;
}

View File

@@ -1,89 +0,0 @@
/*
* CHCP.C - chcp internal command.
*
*
* History:
*
* 23-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Started.
*
*/
#include "config.h"
#ifdef INCLUDE_CMD_CHCP
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>
#include <string.h>
#include "cmd.h"
#include "chcp.h"
INT CommandChcp (LPTSTR cmd, LPTSTR param)
{
LPTSTR *arg;
INT args;
/* print help */
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays or sets the active code page number.\n\n"
"CHCP [nnn]\n\n"
" nnn Specifies the active code page number.\n\n"
"Type CHCP without a parameter to display the active code page number."));
return 0;
}
/* get parameters */
arg = split (param, &args);
if (args == 0)
{
/* display active code page number */
ConOutPrintf ("Active code page: %u\n", GetConsoleCP ());
}
else if (args >= 2)
{
/* too many parameters */
ConErrPrintf ("Invalid parameter format - %s\n", param);
}
else
{
/* set active code page number */
UINT uOldCodePage;
UINT uNewCodePage;
/* save old code page */
uOldCodePage = GetConsoleCP ();
uNewCodePage = (UINT)_ttoi (arg[0]);
if (uNewCodePage == 0)
{
ConErrPrintf ("Parameter format incorrect - %s\n", arg[0]);
}
else
{
if (!SetConsoleCP (uNewCodePage))
{
ConErrPrintf ("Invalid code page\n");
}
else
{
SetConsoleOutputCP (uNewCodePage);
InitLocale ();
}
}
}
freep (arg);
return 0;
}
#endif /* INCLUDE_CMD_CHCP */

View File

@@ -1,8 +0,0 @@
/* prototypes for CHCP.C */
#ifdef INCLUDE_CMD_CHCP
INT CommandChcp (LPTSTR, LPTSTR);
#endif

View File

@@ -1,65 +0,0 @@
/*
* CLS.C - clear screen internal command.
*
*
* History:
*
* 07/27/1998 (John P. Price)
* started.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 04-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Changed to Win32 console app.
*
* 08-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("/?").
*
* 14-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode ready!
*
* 20-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection ready!
*/
#include "config.h"
#ifdef INCLUDE_CMD_CLS
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
INT cmd_cls (LPTSTR cmd, LPTSTR param)
{
DWORD dwWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Clears the screen.\n\nCLS"));
return 0;
}
GetConsoleScreenBufferInfo (hOut, &csbi);
coPos.X = 0;
coPos.Y = 0;
FillConsoleOutputAttribute (hOut, wColor,
(csbi.dwSize.X)*(csbi.dwSize.Y),
coPos, &dwWritten);
FillConsoleOutputCharacter (hOut, _T(' '),
(csbi.dwSize.X)*(csbi.dwSize.Y),
coPos, &dwWritten);
SetConsoleCursorPosition (hOut, coPos);
bIgnoreEcho = TRUE;
return 0;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,339 +0,0 @@
/*
* CMD.H - header file for the modules in CMD.EXE
*
*
* History:
*
* 7-15-95 Tim Norman
* started
*
* 06/29/98 (Rob Lake)
* Moved error messages in here
*
* 07/12/98 (Rob Lake)
* Moved more error messages here.
*
* 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* Added compile date to version.
*
* 26-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Introduced a new version string.
* Thanks to Emanuele Aliberti!
*/
#ifndef _CMD_H_INCLUDED_
#define _CMD_H_INCLUDED_
#include "config.h"
#include <windows.h>
#include <tchar.h>
#define CMD_VER "0.1 pre 2"
#ifdef _MSC_VER
#define SHELLVER "Version " CMD_VER " [" __DATE__ ", msc]"
#else
#ifdef __LCC__
#define SHELLVER "Version " CMD_VER " [" __DATE__ ", lcc-win32]"
#else
#define SHELLVER "Version " CMD_VER " [" __DATE__ "]"
#endif
#endif
#define BREAK_BATCHFILE 1
#define BREAK_OUTOFBATCH 2
#define BREAK_INPUT 3
#define BREAK_IGNORE 4
/* define some error messages */
#define NOENVERR "ERROR: no environment"
#define INVALIDDRIVE "ERROR: invalid drive"
#define INVALIDFUNCTION "ERROR: invalid function"
#define ACCESSDENIED "ERROR: access denied"
#define BADENVIROMENT "ERROR: bad enviroment"
#define BADFORMAT "ERROR: bad format"
#define ERROR_E2BIG "ERROR: Argument list too long"
#define ERROR_EINVAL "ERROR: Invalid argument"
#define SHELLINFO "ReactOS Command Line Interface"
#define D_ON "on"
#define D_OFF "off"
#define CHECKPOINT ConErrPrintf("%s:%d\n",__FILE__,__LINE__);
/* Prototypes for CMD.C */
extern HANDLE hOut;
extern HANDLE hIn;
extern WORD wColor;
extern WORD wDefColor;
extern BOOL bCtrlBreak;
extern BOOL bIgnoreEcho;
extern BOOL bExit;
extern INT nErrorLevel;
extern SHORT maxx;
extern SHORT maxy;
extern OSVERSIONINFO osvi;
// VOID Execute (char *, char *);
void command(char *);
VOID ParseCommandLine (LPTSTR);
int c_brk(void);
/* Prototypes for ALIAS.C */
VOID ExpandAlias (LPTSTR, INT);
INT cmd_alias (LPTSTR, LPTSTR);
/* Prototypes for ATTRIB.C */
INT cmd_attrib (LPTSTR, LPTSTR);
/* Prototypes for BEEP.C */
INT cmd_beep (LPTSTR, LPTSTR);
/* Prototypes for CALL.C */
INT cmd_call (LPTSTR, LPTSTR);
/* Prototypes for CLS.C */
INT cmd_cls (LPTSTR, LPTSTR);
/* Prototypes for CMDINPUT.C */
VOID ReadCommand (LPTSTR, INT);
/* Prototypes for CMDTABLE.C */
#define CMD_SPECIAL 1
#define CMD_BATCHONLY 2
typedef struct tagCOMMAND
{
LPTSTR name;
INT flags;
INT (*func) (LPTSTR, LPTSTR);
} COMMAND, *LPCOMMAND;
/* Prototypes for COLOR.C */
VOID SetScreenColor (WORD);
INT cmd_color (LPTSTR, LPTSTR);
/* Prototypes for CONSOLE.C */
#ifdef _DEBUG
VOID DebugPrintf (LPTSTR, ...);
#endif /* _DEBUG */
VOID ConInDummy (VOID);
VOID ConInKey (PINPUT_RECORD);
VOID ConInString (LPTSTR, DWORD);
VOID ConOutChar (TCHAR);
VOID ConOutPuts (LPTSTR);
VOID ConOutPrintf (LPTSTR, ...);
VOID ConErrChar (TCHAR);
VOID ConErrPuts (LPTSTR);
VOID ConErrPrintf (LPTSTR, ...);
SHORT GetCursorX (VOID);
SHORT GetCursorY (VOID);
VOID GetCursorXY (PSHORT, PSHORT);
VOID SetCursorXY (SHORT, SHORT);
VOID GetScreenSize (PSHORT, PSHORT);
VOID SetCursorType (BOOL, BOOL);
/* Prototypes for COPY.C */
INT cmd_copy (LPTSTR, LPTSTR);
/* Prototypes for DATE.C */
INT cmd_date (LPTSTR, LPTSTR);
/* Prototypes for DEL.C */
INT cmd_del (LPTSTR, LPTSTR);
/* Prototypes for DIR.C */
//int incline(int *line, unsigned flags);
INT cmd_dir (LPTSTR, LPTSTR);
/* Prototypes for DIRSTACK.C */
VOID InitDirectoryStack (VOID);
VOID DestroyDirectoryStack (VOID);
INT GetDirectoryStackDepth (VOID);
INT cmd_pushd (LPTSTR, LPTSTR);
INT cmd_popd (LPTSTR, LPTSTR);
/* Prototypes for ECHO.C */
INT cmd_echo (LPTSTR, LPTSTR);
/* Prototypes for ERROR.C */
VOID ErrorMessage (DWORD, LPTSTR, ...);
VOID error_no_pipe (VOID);
VOID error_bad_command (VOID);
VOID error_invalid_drive (VOID);
VOID error_req_param_missing (VOID);
VOID error_sfile_not_found (LPTSTR);
VOID error_file_not_found (VOID);
VOID error_path_not_found (VOID);
VOID error_too_many_parameters (LPTSTR);
VOID error_invalid_switch (TCHAR);
VOID error_invalid_parameter_format (LPTSTR);
VOID error_out_of_memory (VOID);
VOID error_syntax (LPTSTR);
VOID msg_pause (VOID);
/* Prototypes for FILECOMP.C */
#ifdef FEATURE_UNIX_FILENAME_COMPLETION
VOID CompleteFilename (LPTSTR, INT);
INT ShowCompletionMatches (LPTSTR, INT);
#endif
#ifdef FEATURE_4NT_FILENAME_COMPLETION
#endif
/* Prototypes for FOR.C */
INT cmd_for (LPTSTR, LPTSTR);
/* Prototypes for GOTO.C */
INT cmd_goto (LPTSTR, LPTSTR);
/* Prototypes for HISTORY.C */
#ifdef FEATURE_HISTORY
VOID History (INT, LPTSTR);
#endif
/* Prototypes for INTERNAL.C */
VOID InitLastPath (VOID);
VOID FreeLastPath (VOID);
INT cmd_chdir (LPTSTR, LPTSTR);
INT cmd_mkdir (LPTSTR, LPTSTR);
INT cmd_rmdir (LPTSTR, LPTSTR);
INT internal_exit (LPTSTR, LPTSTR);
INT cmd_rem (LPTSTR, LPTSTR);
INT cmd_showcommands (LPTSTR, LPTSTR);
/* Prototypes for LABEL.C */
INT cmd_label (LPTSTR, LPTSTR);
/* Prototypes for LOCALE.C */
extern TCHAR cDateSeparator;
extern INT nDateFormat;
extern TCHAR cTimeSeparator;
extern INT nTimeFormat;
extern TCHAR aszDayNames[7][8];
extern TCHAR cThousandSeparator;
extern TCHAR cDecimalSeparator;
extern INT nNumberGroups;
VOID InitLocale (VOID);
/* Prototypes for MISC.C */
TCHAR cgetchar (VOID);
BOOL CheckCtrlBreak (INT);
LPTSTR *split (LPTSTR, LPINT);
VOID freep (LPTSTR *);
LPTSTR stpcpy (LPTSTR, LPTSTR);
BOOL IsValidPathName (LPCTSTR);
BOOL IsValidFileName (LPCTSTR);
BOOL IsValidDirectory (LPCTSTR);
BOOL FileGetString (HANDLE, LPTSTR, INT);
/* Prototypes for MOVE.C */
INT cmd_move (LPTSTR, LPTSTR);
/* Prototypes from PATH.C */
INT cmd_path (LPTSTR, LPTSTR);
/* Prototypes from PROMPT.C */
VOID PrintPrompt (VOID);
INT cmd_prompt (LPTSTR, LPTSTR);
/* Prototypes for REDIR.C */
#define INPUT_REDIRECTION 1
#define OUTPUT_REDIRECTION 2
#define OUTPUT_APPEND 4
#define ERROR_REDIRECTION 8
#define ERROR_APPEND 16
INT GetRedirection (LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPINT);
/* Prototypes for REN.C */
INT cmd_rename (LPTSTR, LPTSTR);
/* Prototypes for SET.C */
INT cmd_set (LPTSTR, LPTSTR);
/* Prototypes for TIME.C */
INT cmd_time (LPTSTR, LPTSTR);
/* Prototypes for TITLE.C */
INT cmd_title (LPTSTR, LPTSTR);
/* Prototypes for TYPE.C */
INT cmd_type (LPTSTR, LPTSTR);
/* Prototypes for VER.C */
VOID ShortVersion (VOID);
INT cmd_ver (LPTSTR, LPTSTR);
/* Prototypes for VERIFY.C */
INT cmd_verify (LPTSTR, LPTSTR);
/* Prototypes for VOL.C */
INT cmd_vol (LPTSTR, LPTSTR);
/* Prototypes for WHERE.C */
BOOL SearchForExecutable (LPCTSTR, LPTSTR);
/* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
int cmd_if(char *, char *);
int cmd_pause(char *, char *);
int cmd_shift(char *, char *);
#endif /* _CMD_H_INCLUDED_ */

View File

@@ -1,421 +0,0 @@
/*
* CMDINPUT.C - handles command input (tab completion, history, etc.).
*
*
* History:
*
* 01/14/95 (Tim Norman)
* started.
*
* 08/08/95 (Matt Rains)
* i have cleaned up the source code. changes now bring this source
* into guidelines for recommended programming practice.
* i have added some constants to help making changes easier.
*
* 12/12/95 (Tim Norman)
* added findxy() function to get max x/y coordinates to display
* correctly on larger screens
*
* 12/14/95 (Tim Norman)
* fixed the Tab completion code that Matt Rains broke by moving local
* variables to a more global scope and forgetting to initialize them
* when needed
*
* 8/1/96 (Tim Norman)
* fixed a bug in tab completion that caused filenames at the beginning
* of the command-line to have their first letter truncated
*
* 9/1/96 (Tim Norman)
* fixed a silly bug using printf instead of fputs, where typing "%i"
* confused printf :)
*
* 6/14/97 (Steffan Kaiser)
* ctrl-break checking
*
* 6/7/97 (Marc Desrochers)
* recoded everything! now properly adjusts when text font is changed.
* removed findxy(), reposition(), and reprint(), as these functions
* were inefficient. added goxy() function as gotoxy() was buggy when
* the screen font was changed. the printf() problem with %i on the
* command line was fixed by doing printf("%s",str) instead of
* printf(str). Don't ask how I find em just be glad I do :)
*
* 7/12/97 (Tim Norman)
* Note: above changes pre-empted Steffan's ctrl-break checking.
*
* 7/7/97 (Marc Desrochers)
* rewrote a new findxy() because the new dir() used it. This
* findxy() simply returns the values of *maxx *maxy. In the
* future, please use the pointers, they will always be correct
* since they point to BIOS values.
*
* 7/8/97 (Marc Desrochers)
* once again removed findxy(), moved the *maxx, *maxy pointers
* global and included them as externs in command.h. Also added
* insert/overstrike capability
*
* 7/13/97 (Tim Norman)
* added different cursor appearance for insert/overstrike mode
*
* 7/13/97 (Tim Norman)
* changed my code to use _setcursortype until I can figure out why
* my code is crashing on some machines. It doesn't crash on mine :)
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 28-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* put ifdef's around filename completion code.
*
* 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* moved filename completion code to filecomp.c
* made second TAB display list of filename matches
*
* 31-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* Fixed bug where if you typed something, then hit HOME, then tried
* to type something else in insert mode, it crashed.
*
* 07-Aug-1998 (John P Price <linux-guru@gcfl.net>)
* Fixed carrage return output to better match MSDOS with echo
* on or off.(marked with "JPP 19980708")
*
* 13-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added insert/overwrite cursor.
*
* 25-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced CRT io functions by Win32 console io functions.
* This can handle <Shift>-<Tab> for 4NT filename completion.
* Unicode and redirection safe!
*
* 04-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed input bug. A "line feed" character remained in the keyboard
* input queue when you pressed <RETURN>. This sometimes caused
* some very strange effects.
* Fixed some command line editing annoyances.
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
#include "batch.h"
SHORT maxx;
SHORT maxy;
/*
* global command line insert/overwrite flag
*/
static BOOL bInsert = TRUE;
static VOID
ClearCommandLine (LPTSTR str, INT maxlen, SHORT orgx, SHORT orgy)
{
INT count;
SetCursorXY (orgx, orgy);
for (count = 0; count < (INT)_tcslen (str); count++)
ConOutChar (_T(' '));
#ifndef __REACTOS__
_tcsnset (str, _T('\0'), maxlen);
#else
memset (str, 0, maxlen * sizeof(TCHAR));
#endif
SetCursorXY (orgx, orgy);
}
/* read in a command line */
VOID ReadCommand (LPTSTR str, INT maxlen)
{
SHORT orgx; /* origin x/y */
SHORT orgy;
SHORT curx;
SHORT cury;
INT count;
INT current = 0;
INT charcount = 0;
INPUT_RECORD ir;
WORD wLastKey = 0;
TCHAR ch;
/* get screen size */
GetScreenSize (&maxx, &maxy);
/* JPP 19980807 - if echo off, don't print prompt */
if (bEcho)
PrintPrompt();
GetCursorXY (&orgx, &orgy);
memset (str, 0, maxlen * sizeof (TCHAR));
SetCursorType (bInsert, TRUE);
do
{
ConInKey (&ir);
switch (ir.Event.KeyEvent.wVirtualKeyCode)
{
case VK_BACK:
/* <BACKSPACE> - delete character to left of cursor */
if (current > 0 && charcount > 0)
{
if (current == charcount)
{
/* if at end of line */
str[current - 1] = _T('\0');
if (GetCursorX () != 0)
{
ConOutPrintf ("\b \b");
}
else
{
SetCursorXY ((SHORT)(maxx - 1), (SHORT)(GetCursorY () - 1));
ConOutChar (_T(' '));
SetCursorXY ((SHORT)(maxx - 1), (SHORT)(GetCursorY () - 1));
}
}
else
{
for (count = current - 1; count < charcount; count++)
str[count] = str[count + 1];
if (GetCursorX () != 0)
SetCursorXY ((SHORT)(GetCursorX () - 1), GetCursorY ());
else
SetCursorXY ((SHORT)(maxx - 1), (SHORT)(GetCursorY () - 1));
GetCursorXY (&curx, &cury);
ConOutPrintf (_T("%s "), &str[current - 1]);
SetCursorXY (curx, cury);
}
charcount--;
current--;
}
break;
case VK_INSERT:
/* toggle insert/overstrike mode */
bInsert ^= TRUE;
SetCursorType (bInsert, TRUE);
break;
case VK_DELETE:
/* delete character under cursor */
if (current != charcount && charcount > 0)
{
for (count = current; count < charcount; count++)
str[count] = str[count + 1];
charcount--;
GetCursorXY (&curx, &cury);
ConOutPrintf (_T("%s "), &str[current]);
SetCursorXY (curx, cury);
}
break;
case VK_HOME:
/* goto beginning of string */
if (current != 0)
{
SetCursorXY (orgx, orgy);
current = 0;
}
break;
case VK_END:
/* goto end of string */
if (current != charcount)
{
SetCursorXY (orgx, orgy);
ConOutPrintf (_T("%s"), str);
current = charcount;
}
break;
case VK_TAB:
#ifdef FEATURE_UNIX_FILENAME_COMPLETION
/* expand current file name */
if (current == charcount) // only works at end of line
{
if (wLastKey != VK_TAB)
{
// if first TAB, complete filename
CompleteFilename (str, charcount);
charcount = _tcslen (str);
current = charcount;
SetCursorXY (orgx, orgy);
ConOutPrintf (_T("%s"), str);
if ((_tcslen (str) > (USHORT)(maxx - orgx)) && (orgy == maxy + 1))
orgy--;
}
else
{
//if second TAB, list matches
if (ShowCompletionMatches (str, charcount))
{
PrintPrompt ();
GetCursorXY (&orgx, &orgy);
ConOutPrintf (_T("%s"), str);
}
}
}
else
{
#ifdef __REACTOS__
Beep (440, 50);
#else
MessageBeep (-1);
#endif
}
#endif
#ifdef FEATURE_4NT_FILENAME_COMPLETION
/* this is not implemented yet */
if (ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)
{
/* get previous match */
}
else
{
/* get next match */
}
#endif
break;
case VK_RETURN:
/* end input, return to main */
#ifdef FEATURE_HISTORY
/* add to the history */
if (str[0])
History (0, str);
#endif
ConInDummy ();
ConOutChar (_T('\n'));
break;
case VK_ESCAPE:
/* clear str Make this callable! */
ClearCommandLine (str, maxlen, orgx, orgy);
current = charcount = 0;
break;
case VK_UP:
#ifdef FEATURE_HISTORY
/* get previous command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (-1, str);
current = charcount = _tcslen (str);
ConOutPrintf (_T("%s"), str);
#endif
break;
case VK_DOWN:
#ifdef FEATURE_HISTORY
/* get next command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (1, str);
current = charcount = _tcslen (str);
ConOutPrintf (_T("%s"), str);
#endif
break;
case VK_LEFT:
/* move cursor left */
if (current > 0)
{
current--;
if (GetCursorX () == 0)
SetCursorXY ((SHORT)(maxx - 1), (SHORT)(GetCursorY () - 1));
else
SetCursorXY ((SHORT)(GetCursorX () - 1), GetCursorY ());
}
else
{
#ifdef __REACTOS__
Beep (440, 50);
#else
MessageBeep (-1);
#endif
}
break;
case VK_RIGHT:
/* move cursor right */
if (current != charcount)
{
current++;
if (GetCursorX () == maxx - 1)
SetCursorXY (0, (SHORT)(GetCursorY () + 1));
else
SetCursorXY ((SHORT)(GetCursorX () + 1), GetCursorY ());
}
break;
default:
#ifdef _UNICODE
ch = ir.Event.KeyEvent.uChar.UnicodeChar;
if ((ch >= 32 && ch <= 255) && (charcount != (maxlen - 2)))
#else
ch = ir.Event.KeyEvent.uChar.AsciiChar;
if ((ch >= 32) && (charcount != (maxlen - 2)))
#endif /* _UNICODE */
{
/* insert character into string... */
if (bInsert && current != charcount)
{
for (count = charcount; count > current; count--)
str[count] = str[count - 1];
str[current++] = ch;
if (GetCursorX () == maxx - 1)
{
curx = 0;
cury = GetCursorY () + 1;
}
else
{
GetCursorXY (&curx, &cury);
curx++;
}
ConOutPrintf (_T("%s"), &str[current - 1]);
if ((_tcslen (str) > (USHORT)(maxx - orgx)) && (orgy == maxy + 1))
cury--;
SetCursorXY (curx, cury);
charcount++;
}
else
{
if (current == charcount)
charcount++;
str[current++] = ch;
ConOutChar (ch);
}
if ((_tcslen (str) > (USHORT)(maxx - orgx)) && (orgy == maxy + 1))
orgy--;
}
#if 0
else
{
#ifdef __REACTOS__
Beep (440, 100);
#else
MessageBeep (-1);
#endif
}
#endif
break;
}
wLastKey = ir.Event.KeyEvent.wVirtualKeyCode;
}
while (ir.Event.KeyEvent.wVirtualKeyCode != VK_RETURN);
SetCursorType (bInsert, TRUE);
}

View File

@@ -1,243 +0,0 @@
/*
* CMDTABLE.C - table of internal commands.
*
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
* New file to keep the internal command table. I plan on
* getting rid of the table real soon now and replacing it
* with a dynamic mechnism.
*
* 27 Jul 1998 John P. Price
* added config.h include
*
* 21-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode ready!
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include "cmd.h"
#include "chcp.h"
/* a list of all the internal commands, associating their command names */
/* to the functions to process them */
/* Lines marked
*
* $$ are external commands
* !! internal commands which are not yet implemented
* ** special FREEDOS specific implementation
*/
COMMAND cmds[] =
{
{_T("?"), 0, cmd_showcommands},
#ifdef FEATURE_ALIASES
{_T("alias"), 0, cmd_alias},
#endif
#ifdef INCLUDE_CMD_ATTRIB
{_T("attrib"), 0, cmd_attrib},
#endif
#ifdef INCLUDE_CMD_BEEP
{_T("beep"), 0, cmd_beep},
#endif
/*
{_T("break"), 0, cmd_break},
*/
{_T("call"), CMD_BATCHONLY, cmd_call},
#ifdef INCLUDE_CMD_CHDIR
{_T("cd"), CMD_SPECIAL, cmd_chdir},
{_T("chdir"), CMD_SPECIAL, cmd_chdir},
#endif
#ifdef INCLUDE_CMD_CHCP
{_T("chcp"), 0, CommandChcp},
#endif
#ifdef INCLUDE_CMD_CLS
{_T("cls"), 0, cmd_cls},
#endif
#ifdef INCLUDE_CMD_COLOR
{_T("color"), 0, cmd_color},
#endif
#ifdef INCLUDE_CMD_COPY
{_T("copy"), 0, cmd_copy},
#endif
/*
#define INCLUDE_CMD_CTTY
{_T("ctty"), 0, cmd_ctty},
#endif
*/
#ifdef INCLUDE_CMD_DATE
{_T("date"), 0, cmd_date},
#endif
#ifdef INCLUDE_CMD_DEL
{_T("del"), 0, cmd_del},
{_T("delete"), 0, cmd_del},
#endif
#ifdef INCLUDE_CMD_DIR
{_T("dir"), CMD_SPECIAL, cmd_dir},
#endif
{_T("echo"), 0, cmd_echo},
#ifdef INCLUDE_CMD_DEL
{_T("erase"), 0, cmd_del},
#endif
{_T("exit"), 0, internal_exit},
{_T("for"), 0, cmd_for},
{_T("goto"), CMD_BATCHONLY, cmd_goto},
{_T("if"), 0, cmd_if},
#ifdef INCLUDE_CMD_LABEL
{_T("label"), 0, cmd_label},
#endif
#ifdef INCLUDE_CMD_MKDIR
{_T("md"), CMD_SPECIAL, cmd_mkdir},
{_T("mkdir"), CMD_SPECIAL, cmd_mkdir},
#endif
#ifdef INCLUDE_CMD_MOVE
{_T("move"), 0, cmd_move},
#endif
#ifdef INCLUDE_CMD_PATH
{_T("path"), 0, cmd_path},
#endif
#ifdef INCLUDE_CMD_PAUSE
{_T("pause"), 0, cmd_pause},
#endif
#ifdef FEATURE_DIRECTORY_STACK
{_T("popd"), 0, cmd_popd},
#endif
#ifdef INCLUDE_CMD_PROMPT
{_T("prompt"), 0, cmd_prompt},
#endif
#ifdef FEATURE_DIRECTORY_STACK
{_T("pushd"), 0, cmd_pushd},
#endif
#ifdef INCLUDE_CMD_RMDIR
{_T("rd"), CMD_SPECIAL, cmd_rmdir},
#endif
#ifdef INCLUDE_CMD_REM
{_T("rem"), 0, cmd_rem},
#endif
#ifdef INCLUDE_CMD_RENAME
{_T("ren"), 0, cmd_rename},
{_T("rename"), 0, cmd_rename},
#endif
#ifdef INCLUDE_CMD_RMDIR
{_T("rmdir"), CMD_SPECIAL, cmd_rmdir},
#endif
#ifdef INCLUDE_CMD_SET
{_T("set"), 0, cmd_set},
#endif
{_T("shift"), CMD_BATCHONLY, cmd_shift},
#ifdef INCLUDE_CMD_TIME
{_T("time"), 0, cmd_time},
#endif
#ifdef INCLUDE_CMD_TITLE
{_T("title"), 0, cmd_title},
#endif
#ifdef INCLUDE_CMD_TYPE
{_T("type"), 0, cmd_type},
#endif
#ifdef INCLUDE_CMD_VER
{_T("ver"), 0, cmd_ver},
#endif
#ifdef INCLUDE_CMD_VERIFY
{_T("verify"), 0, cmd_verify},
#endif
#ifdef INCLUDE_CMD_VOL
{_T("vol"), 0, cmd_vol},
#endif
{NULL, 0, NULL}
};
/* append, $$ */
/* assign, $$ */
/* attrib, ** */
/* backup, $$ */
/* chkdsk, $$ */
/* comp, $$ */
/* debug, $$ */
/* diskcomp, $$ */
/* diskcopy, $$ */
/* doskey, ** */
/* dosshell, $$ */
/* edit, $$ */
/* edlin, $$ */
/* emm386, $$ */
/* exe2bin, $$ */
/* expand, $$ */
/* fastopen, $$ */
/* fc, $$ */
/* fdisk, $$ */
/* find, $$ */
/* format, $$ */
/* graftabl, $$ */
/* graphics, $$ */
/* help, $$ */
/* join, $$ */
/* keyb, $$ */
/* mem, $$ */
/* mirror, $$ */
/* mode, $$ */
/* more, $$ */
/* nlsfunc, $$ */
/* print, $$ */
/* qbasic, $$ */
/* recover, $$ */
/* replace, $$ */
/* restore, $$ */
/* setver, $$ */
/* share, $$ */
/* sort, $$ */
/* subst, $$ */
/* sys, $$ */
/* tree, $$ */
/* undelete, $$ */
/* unformat, $$ */
/* xcopy, $$ */

View File

@@ -1,100 +0,0 @@
/*
* COLOR.C - color internal command.
*
*
* History:
*
* 13-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Started.
*
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode ready!
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection ready!
*/
#include "config.h"
#ifdef INCLUDE_CMD_COLOR
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include "cmd.h"
VOID SetScreenColor (WORD wColor)
{
DWORD dwWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
GetConsoleScreenBufferInfo (hOut, &csbi);
coPos.X = 0;
coPos.Y = 0;
FillConsoleOutputAttribute (hOut, wColor,
(csbi.dwSize.X)*(csbi.dwSize.Y),
coPos, &dwWritten);
SetConsoleTextAttribute (hOut, wColor);
}
/*
* color
*
* internal dir command
*/
INT cmd_color (LPTSTR first, LPTSTR rest)
{
if (_tcsncmp (rest, _T("/?"), 2) == 0)
{
ConOutPuts (_T("Sets the default foreground and background colors.\n\n"
"COLOR [attr]\n\n"
" attr Specifies color attribute of console output\n\n"
"Color attributes are specified by TWO hex digits -- the first\n"
"corresponds to the background; the second to the foreground. Each digit\n"
"can be one of the following:\n"));
ConOutPuts (_T(" 0 = Black 8 = Gray\n"
" 1 = Blue 9 = Light Blue\n"
" 2 = Green A = Light Green\n"
" 3 = Aqua B = Light Aqua\n"
" 4 = Red C = Light Red\n"
" 5 = Purple D = Light Purple\n"
" 6 = Yellow E = Light Yellow\n"
" 7 = White F = Bright White\n"));
return 0;
}
if (rest[0] == _T('\0'))
{
/* set default color */
wColor = wDefColor;
SetScreenColor (wColor);
return 0;
}
if (_tcslen (rest) != 2)
{
ConErrPuts (_T("parameter error!"));
return 1;
}
wColor = (WORD)_tcstoul (rest, NULL, 16);
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
{
ConErrPuts (_T("same colors error!"));
return 1;
}
/* set color */
SetScreenColor (wColor);
return 0;
}
#endif

View File

@@ -1,102 +0,0 @@
/*
* CONFIG.H - Used to configure what will be compiled into the shell.
*
*
* History:
*
* 27 Jul 1998 - John P. Price
* started.
*
*/
#define __REACTOS__
#ifndef _CONFIG_H_INCLUDED_
#define _CONFIG_H_INCLUDED_
#ifndef __REACTOS__
#define WIN32_LEAN_AND_MEAN
#endif /* __REACTOS__ */
/* JPP 20 Jul 1998 - define DEBUG to add debugging code */
#define DEBUG
/* Define to enable the alias command, and aliases.*/
#define FEATURE_ALIASES
/* Define to enable history */
#define FEATURE_HISTORY
/* Define one of these to enable filename completion */
#define FEATURE_UNIX_FILENAME_COMPLETION
/* #define FEATURE_4NT_FILENAME_COMPLETION */
/* Define to enable the directory stack */
#define FEATURE_DIRECTORY_STACK
/* Define to activate redirections and piping */
#define FEATURE_REDIRECTION
/* Define one of these to select the used locale. */
/* (date and time formats etc.) used in DATE, TIME */
/* DIR and PROMPT. */
#ifdef __REACTOS__
#define LOCALE_DEFAULT
#else
#define LOCALE_WINDOWS /* System locale */
/* #define LOCALE_GERMAN */ /* German locale */
/* #define LOCALE_DEFAULT */ /* United States locale */
#endif
#define INCLUDE_CMD_ATTRIB
/*#define INCLUDE_CMD_BREAK*/
#define INCLUDE_CMD_CHCP
#define INCLUDE_CMD_CHDIR
#define INCLUDE_CMD_CLS
#define INCLUDE_CMD_COLOR
#define INCLUDE_CMD_COPY
/*#define INCLUDE_CMD_CTTY*/
#define INCLUDE_CMD_DATE
#define INCLUDE_CMD_DEL
#define INCLUDE_CMD_DIR
#define INCLUDE_CMD_LABEL
#define INCLUDE_CMD_MKDIR
#define INCLUDE_CMD_MOVE
#define INCLUDE_CMD_PATH
#define INCLUDE_CMD_PROMPT
#define INCLUDE_CMD_RMDIR
#define INCLUDE_CMD_RENAME
#define INCLUDE_CMD_SET
#define INCLUDE_CMD_TIME
#define INCLUDE_CMD_TITLE
#define INCLUDE_CMD_TYPE
#define INCLUDE_CMD_VER
#define INCLUDE_CMD_REM
#define INCLUDE_CMD_PAUSE
#define INCLUDE_CMD_BEEP
#define INCLUDE_CMD_VERIFY
#define INCLUDE_CMD_VOL
/*
command that do not have a define:
exit
call
echo
goto
for
if
shift
*/
#endif /* _CONFIG_H_INCLUDED_ */

View File

@@ -1,239 +0,0 @@
/*
* CONSOLE.C - console input/output functions.
*
*
* History:
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* started
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "cmd.h"
#ifdef _DEBUG
VOID DebugPrintf (LPTSTR szFormat, ...)
{
TCHAR szOut[512];
va_list arg_ptr;
va_start (arg_ptr, szFormat);
_vstprintf (szOut, szFormat, arg_ptr);
va_end (arg_ptr);
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
#if 0
OutputDebugString (szOut);
#endif
}
#endif /* _DEBUG */
VOID ConInDummy (VOID)
{
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
INPUT_RECORD dummy;
DWORD dwRead;
#ifdef _DEBUG
if (hInput == INVALID_HANDLE_VALUE)
DebugPrintf ("Invalid input handle!!!\n");
#endif
ReadConsoleInput (hInput, &dummy, 1, &dwRead);
}
VOID ConInKey (PINPUT_RECORD lpBuffer)
{
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
DWORD dwRead;
#ifdef _DEBUG
if (hInput == INVALID_HANDLE_VALUE)
DebugPrintf ("Invalid input handle!!!\n");
#endif
do
{
ReadConsoleInput (hInput, lpBuffer, 1, &dwRead);
if ((lpBuffer->EventType == KEY_EVENT) &&
(lpBuffer->Event.KeyEvent.bKeyDown == TRUE))
break;
}
while (TRUE);
}
VOID ConInString (LPTSTR lpInput, DWORD dwLength)
{
DWORD dwOldMode;
DWORD dwRead;
HANDLE hFile;
LPTSTR p;
DWORD i;
ZeroMemory (lpInput, dwLength * sizeof(TCHAR));
hFile = GetStdHandle (STD_INPUT_HANDLE);
GetConsoleMode (hFile, &dwOldMode);
SetConsoleMode (hFile, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
ReadFile (hFile, lpInput, dwLength, &dwRead, NULL);
p = lpInput;
for (i = 0; i < dwRead; i++, p++)
{
if (*p == _T('\x0d'))
{
*p = _T('\0');
break;
}
}
SetConsoleMode (hFile, dwOldMode);
}
VOID ConOutChar (TCHAR c)
{
DWORD dwWritten;
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), &c, 1, &dwWritten, NULL);
}
VOID ConOutPuts (LPTSTR szText)
{
DWORD dwWritten;
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
#if 0
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
#endif
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\n", 1, &dwWritten, NULL);
}
VOID ConOutPrintf (LPTSTR szFormat, ...)
{
DWORD dwWritten;
TCHAR szOut[256];
va_list arg_ptr;
va_start (arg_ptr, szFormat);
_vstprintf (szOut, szFormat, arg_ptr);
va_end (arg_ptr);
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
}
VOID ConErrChar (TCHAR c)
{
DWORD dwWritten;
WriteFile (GetStdHandle (STD_ERROR_HANDLE), &c, 1, &dwWritten, NULL);
}
VOID ConErrPuts (LPTSTR szText)
{
DWORD dwWritten;
WriteFile (GetStdHandle (STD_ERROR_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
#if 0
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
#endif
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\n", 1, &dwWritten, NULL);
}
VOID ConErrPrintf (LPTSTR szFormat, ...)
{
DWORD dwWritten;
TCHAR szOut[4096];
va_list arg_ptr;
va_start (arg_ptr, szFormat);
_vstprintf (szOut, szFormat, arg_ptr);
va_end (arg_ptr);
WriteFile (GetStdHandle (STD_ERROR_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
}
VOID SetCursorXY (SHORT x, SHORT y)
{
COORD coPos;
coPos.X = x;
coPos.Y = y;
SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), coPos);
}
VOID GetCursorXY (PSHORT x, PSHORT y)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &csbi);
*x = csbi.dwCursorPosition.X;
*y = csbi.dwCursorPosition.Y;
}
SHORT GetCursorX (VOID)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &csbi);
return csbi.dwCursorPosition.X;
}
SHORT GetCursorY (VOID)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &csbi);
return csbi.dwCursorPosition.Y;
}
VOID GetScreenSize (PSHORT maxx, PSHORT maxy)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &csbi);
if (maxx)
*maxx = csbi.dwSize.X;
if (maxy)
*maxy = csbi.dwSize.Y;
}
VOID SetCursorType (BOOL bInsert, BOOL bVisible)
{
CONSOLE_CURSOR_INFO cci;
cci.dwSize = bInsert ? 10 : 100;
cci.bVisible = bVisible;
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
}

View File

@@ -1,734 +0,0 @@
/*
* COPY.C -- copy internal command.
*
*
* History:
*
* 01-Aug-98 (Rob Lake z63rrl@morgan.ucs.mun.ca)
* started
*
* 13-Aug-1998 (John P. Price)
* fixed memory leak problem in copy function.
* fixed copy function so it would work with wildcards in the source
*
* 13-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added COPY command to CMD.
*
* 26-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced CRT io functions by Win32 io functions.
*/
#include "config.h"
#ifdef INCLUDE_CMD_COPY
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "cmd.h"
#define VERIFY 1 /* VERIFY Switch */
#define BINARY 2 /* File is to be copied as BINARY */
#define ASCII 4 /* File is to be copied as ASCII */
#define PROMPT 8 /* Prompt before overwriting files */
#define NPROMPT 16 /* Do not prompt before overwriting files */
#define HELP 32 /* Help was asked for */
#define SOURCE 128 /* File is a source */
typedef struct tagFILES
{
struct tagFILES *next;
TCHAR szFile[MAX_PATH];
DWORD dwFlag; /* BINARY -xor- ASCII */
} FILES, *LPFILES;
static BOOL DoSwitches (LPTSTR, LPDWORD);
static BOOL AddFile (LPFILES, char *, int *, int *, LPDWORD);
static BOOL AddFiles (LPFILES, char *, int *, int *, int *, LPDWORD);
static BOOL GetDestination (LPFILES, LPFILES);
static INT ParseCommand (LPFILES, int, char **, LPDWORD);
static VOID DeleteFileList (LPFILES);
static INT Overwrite (LPTSTR);
static BOOL
IsDirectory (LPTSTR fn)
{
if (!IsValidFileName (fn))
return FALSE;
return (GetFileAttributes (fn) & FILE_ATTRIBUTE_DIRECTORY);
}
static BOOL
DoSwitches (LPTSTR arg, LPDWORD lpdwFlags)
{
if (!_tcsicmp (arg, _T("/-Y")))
{
*lpdwFlags |= PROMPT;
*lpdwFlags &= ~NPROMPT;
return TRUE;
}
else if (_tcslen (arg) > 2)
{
error_too_many_parameters ("");
return FALSE;
}
switch (_totupper (arg[1]))
{
case _T('V'):
*lpdwFlags |= VERIFY;
break;
case _T('A'):
*lpdwFlags |= ASCII;
*lpdwFlags &= ~BINARY;
break;
case _T('B'):
*lpdwFlags |= BINARY;
*lpdwFlags &= ~ASCII;
break;
case _T('Y'):
*lpdwFlags &= ~PROMPT;
*lpdwFlags |= NPROMPT;
break;
default:
error_invalid_switch (arg[1]);
return FALSE;
}
return TRUE;
}
static BOOL
AddFile (LPFILES f, char *arg, int *source, int *dest, LPDWORD flags)
{
if (*dest)
{
error_too_many_parameters ("");
return FALSE;
}
if (*source)
{
*dest = 1;
f->dwFlag = 0;
}
else
{
*source = 1;
f->dwFlag = SOURCE;
}
_tcscpy(f->szFile, arg);
f->dwFlag |= *flags & ASCII ? ASCII : BINARY;
if ((f->next = (LPFILES)malloc (sizeof (FILES))) == NULL)
{
error_out_of_memory ();
return FALSE;
}
f = f->next;
f->dwFlag = 0;
f->next = NULL;
return TRUE;
}
static BOOL
AddFiles (LPFILES f, char *arg, int *source, int *dest,
int *count, LPDWORD flags)
{
char t[128];
int j;
int k;
if (*dest)
{
error_too_many_parameters ("");
return FALSE;
}
j = 0;
k = 0;
while (arg[j] == _T('+'))
j++;
while (arg[j] != _T('\0'))
{
t[k] = arg[j++];
if (t[k] == '+' || arg[j] == _T('\0'))
{
if (!k)
continue;
if (arg[j] == _T('\0') && t[k] != _T('+'))
k++;
t[k] = _T('\0');
*count += 1;
_tcscpy (f->szFile, t);
*source = 1;
if (*flags & ASCII)
f->dwFlag |= *flags | SOURCE | ASCII;
else
f->dwFlag |= *flags | BINARY | SOURCE;
if ((f->next = (LPFILES)malloc (sizeof (FILES))) == NULL)
{
error_out_of_memory ();
return FALSE;
}
f = f->next;
f->next = NULL;
k = 0;
f->dwFlag = 0;
continue;
}
k++;
}
if (arg[--j] == _T('+'))
*source = 0;
return 1;
}
static BOOL
GetDestination (LPFILES f, LPFILES dest)
{
LPFILES p = NULL;
LPFILES start = f;
while (f->next != NULL)
{
p = f;
f = f->next;
}
f = p;
if ((f->dwFlag & SOURCE) == 0)
{
free (p->next);
p->next = NULL;
_tcscpy (dest->szFile, f->szFile);
dest->dwFlag = f->dwFlag;
dest->next = NULL;
f = start;
return TRUE;
}
return FALSE;
}
static INT
ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
{
INT i;
INT dest;
INT source;
INT count;
dest = 0;
source = 0;
count = 0;
for (i = 0; i < argc; i++)
{
if (arg[i][0] == _T('/'))
{
if (!DoSwitches (arg[i], lpdwFlags))
return -1;
}
else
{
if (!_tcscmp(arg[i], _T("+")))
source = 0;
else if (!_tcschr(arg[i], _T('+')) && source)
{
if (!AddFile(f, arg[i], &source, &dest, lpdwFlags))
return -1;
f = f->next;
count++;
}
else
{
if (!AddFiles(f, arg[i], &source, &dest, &count, lpdwFlags))
return -1;
while (f->next != NULL)
f = f->next;
}
}
}
#ifdef _DEBUG
DebugPrintf ("ParseCommand: flags has %s\n",
*lpdwFlags & ASCII ? "ASCII" : "BINARY");
#endif
return count;
}
static VOID DeleteFileList (LPFILES f)
{
LPFILES temp;
while (f != NULL)
{
temp = f;
f = f->next;
free (temp);
}
}
static INT
Overwrite (LPTSTR fn)
{
TCHAR inp[10];
LPTSTR p;
ConOutPrintf (_T("Overwrite %s (Yes/No/All)? "), fn);
ConInString (inp, 10);
_tcsupr (inp);
for (p = inp; _istspace (*p); p++)
;
if (*p != _T('Y') && *p != _T('A'))
return 0;
if (*p == _T('A'))
return 2;
return 1;
}
#define BUFF_SIZE 16384 /* 16k = max buffer size */
int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
{
FILETIME srctime;
HANDLE hFileSrc;
HANDLE hFileDest;
LPBYTE buffer;
DWORD dwAttrib;
DWORD dwRead;
DWORD dwWritten;
DWORD i;
BOOL bEof = FALSE;
#ifdef _DEBUG
DebugPrintf ("checking mode\n");
#endif
dwAttrib = GetFileAttributes (source);
hFileSrc = CreateFile (source, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL);
if (hFileSrc == INVALID_HANDLE_VALUE)
{
ConErrPrintf (_T("Error: Cannot open source - %s!\n"), source);
return 0;
}
#ifdef _DEBUG
DebugPrintf (_T("getting time\n"));
#endif
GetFileTime (hFileSrc, &srctime, NULL, NULL);
#ifdef _DEBUG
DebugPrintf (_T("copy: flags has %s\n"),
*lpdwFlags & ASCII ? "ASCII" : "BINARY");
#endif
if (!IsValidFileName (dest))
{
#ifdef _DEBUG
DebugPrintf (_T("opening/creating\n"));
#endif
hFileDest =
CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
}
else if (!append)
{
if (!_tcscmp (dest, source))
{
ConErrPrintf (_T("Error: Can't copy onto itself!\n"));
CloseHandle (hFileSrc);
return 0;
}
#ifdef _DEBUG
DebugPrintf (_T("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n"), dest);
#endif
SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
#ifdef _DEBUG
DebugPrintf (_T("DeleteFile (%s);\n"), dest);
#endif
DeleteFile (dest);
hFileDest =
CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
}
else
{
LONG lFilePosHigh = 0;
if (!_tcscmp (dest, source))
{
CloseHandle (hFileSrc);
return 0;
}
#ifdef _DEBUG
DebugPrintf (_T("opening/appending\n"));
#endif
hFileDest =
CreateFile (dest, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
SetFilePointer (hFileDest, 0, &lFilePosHigh,FILE_END);
}
if (hFileDest == INVALID_HANDLE_VALUE)
{
CloseHandle (hFileSrc);
error_path_not_found ();
return 0;
}
buffer = (LPBYTE)malloc (BUFF_SIZE);
if (buffer == NULL)
{
CloseHandle (hFileDest);
CloseHandle (hFileSrc);
error_out_of_memory ();
return 0;
}
ConOutPuts (source);
do
{
ReadFile (hFileSrc, buffer, BUFF_SIZE, &dwRead, NULL);
if (*lpdwFlags & ASCII)
{
for (i = 0; i < dwRead; i++)
{
if (((LPTSTR)buffer)[i] == 0x1A)
{
bEof = TRUE;
break;
}
}
dwRead = i;
}
if (dwRead == 0)
break;
WriteFile (hFileDest, buffer, dwRead, &dwWritten, NULL);
if (dwWritten != dwRead)
{
ConErrPrintf (_T("Error writing destination!\n"));
free (buffer);
CloseHandle (hFileDest);
CloseHandle (hFileSrc);
return 0;
}
}
while (dwRead && !bEof);
#ifdef _DEBUG
DebugPrintf (_T("setting time\n"));
#endif
SetFileTime (hFileDest, &srctime, NULL, NULL);
if (*lpdwFlags & ASCII)
{
((LPTSTR)buffer)[0] = 0x1A;
((LPTSTR)buffer)[1] = _T('\0');
#ifdef _DEBUG
DebugPrintf (_T("appending ^Z\n"));
#endif
WriteFile (hFileDest, buffer, sizeof(TCHAR), &dwWritten, NULL);
}
free (buffer);
CloseHandle (hFileDest);
CloseHandle (hFileSrc);
#ifdef _DEBUG
DebugPrintf (_T("setting mode\n"));
#endif
SetFileAttributes (dest, dwAttrib);
return 1;
}
int setup_copy (LPFILES sources, char **p, BOOL bMultiple,
char *drive_d, char *dir_d, char *file_d,
char *ext_d, int *append, LPDWORD lpdwFlags)
{
WIN32_FIND_DATA find;
char drive_s[_MAX_DRIVE],
dir_s[_MAX_DIR],
file_s[_MAX_FNAME],
ext_s[_MAX_EXT];
char from_merge[_MAX_PATH];
LPTSTR real_source;
LPTSTR real_dest;
INT nCopied = 0;
BOOL bAll = FALSE;
BOOL bDone;
HANDLE hFind;
real_source = (LPTSTR)malloc (MAX_PATH);
real_dest = (LPTSTR)malloc (MAX_PATH);
if (!real_source || !real_dest)
{
error_out_of_memory ();
DeleteFileList (sources);
free (real_source);
free (real_dest);
freep (p);
return 0;
}
while (sources->next != NULL)
{
_splitpath (sources->szFile, drive_s, dir_s, file_s, ext_s);
hFind = FindFirstFile (sources->szFile, &find);
if (hFind == INVALID_HANDLE_VALUE)
{
error_file_not_found();
DeleteFileList (sources);
freep(p);
free(real_source);
free(real_dest);
return 0;
}
do
{
if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
goto next;
_makepath(from_merge, drive_d, dir_d, file_d, ext_d);
if (from_merge[_tcslen(from_merge) - 1] == _T('\\'))
from_merge[_tcslen(from_merge) - 1] = 0;
if (IsDirectory (from_merge))
{
bMultiple = FALSE;
_tcscat (from_merge, _T("\\"));
_tcscat (from_merge, find.cFileName);
}
else
bMultiple = TRUE;
_tcscpy (real_dest, from_merge);
_makepath (real_source, drive_s, dir_s, find.cFileName, NULL);
#ifdef _DEBUG
DebugPrintf (_T("copying %s -> %s (%sappending%s)\n"),
real_source, real_dest,
*append ? "" : "not ",
sources->dwFlag & ASCII ? ", ASCII" : ", BINARY");
#endif
if (IsValidFileName (real_dest) && !bAll)
{
int over = Overwrite (real_dest);
if (over == 2)
bAll = TRUE;
else if (over == 0)
goto next;
else if (bMultiple)
bAll = TRUE;
}
if (copy (real_source, real_dest, *append, lpdwFlags))
nCopied++;
next:
bDone = FindNextFile (hFind, &find);
if (bMultiple)
*append = 1;
}
while (bDone);
FindClose (hFind);
sources = sources->next;
}
free (real_source);
free (real_dest);
return nCopied;
}
INT cmd_copy (LPTSTR first, LPTSTR rest)
{
char **p;
char drive_d[_MAX_DRIVE],
dir_d[_MAX_DIR],
file_d[_MAX_FNAME],
ext_d[_MAX_EXT];
int argc,
append,
files,
copied;
LPFILES sources;
FILES dest;
LPFILES start;
BOOL bMultiple;
BOOL bWildcards;
BOOL bDestFound;
DWORD dwFlags = 0;
if (!_tcsncmp (rest, _T("/?"), 2))
{
ConOutPuts (_T("Copies one or more files to another location.\n"
"\n"
"COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n"
" [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n"
"\n"
" source Specifies the file or files to be copied.\n"
" /A Indicates an ASCII text file.\n"
" /B Indicates a binary file.\n"
" destination Specifies the directory and/or filename for the new file(s).\n"
" /V Verifies that new files are written correctly.\n"
" /Y Suppresses prompting to confirm you want to overwrite an\n"
" existing destination file.\n"
" /-Y Causes prompting to confirm you want to overwrite an\n"
" existing destination file.\n"
"\n"
"The switch /Y may be present in the COPYCMD environment variable.\n"
"..."));
return 1;
}
p = split (rest, &argc);
if (argc == 0)
{
error_req_param_missing ();
return 0;
}
sources = (LPFILES)malloc (sizeof (FILES));
if (!sources)
{
error_out_of_memory ();
return 0;
}
sources->next = NULL;
sources->dwFlag = 0;
if ((files = ParseCommand (sources, argc, p, &dwFlags)) == -1)
{
DeleteFileList (sources);
freep (p);
return 0;
}
else if (files == 0)
{
error_req_param_missing();
DeleteFileList (sources);
freep (p);
return 0;
}
start = sources;
bDestFound = GetDestination (sources, &dest);
if (bDestFound)
{
_splitpath (dest.szFile, drive_d, dir_d, file_d, ext_d);
if (IsDirectory (dest.szFile))
{
_tcscat (dir_d, file_d);
_tcscat (dir_d, ext_d);
file_d[0] = _T('\0');
ext_d[0] = _T('\0');
}
}
if (_tcschr (dest.szFile, _T('*')) || _tcschr (dest.szFile, _T('?')))
bWildcards = TRUE;
else
bWildcards = FALSE;
if (strchr(rest, '+'))
bMultiple = TRUE;
else
bMultiple = FALSE;
append = 0;
copied = 0;
if (bDestFound && !bWildcards)
{
copied = setup_copy (sources, p, bMultiple, drive_d, dir_d, file_d, ext_d, &append, &dwFlags);
}
else if (bDestFound && bWildcards)
{
ConErrPrintf (_T("Error: Not implemented yet!\n"));
DeleteFileList (sources);
freep (p);
return 0;
}
else if (!bDestFound && !bMultiple)
{
_splitpath (sources->szFile, drive_d, dir_d, file_d, ext_d);
if (IsDirectory (sources->szFile))
{
_tcscat (dir_d, file_d);
_tcscat (dir_d, ext_d);
file_d[0] = _T('\0');
ext_d[0] = _T('\0');
}
copied = setup_copy (sources, p, FALSE, "", "", file_d, ext_d, &append, &dwFlags);
}
else
{
_splitpath(sources->szFile, drive_d, dir_d, file_d, ext_d);
if (IsDirectory (sources->szFile))
{
_tcscat (dir_d, file_d);
_tcscat (dir_d, ext_d);
file_d[0] = _T('\0');
ext_d[0] = _T('\0');
}
ConOutPuts (sources->szFile);
append = 1;
copied = setup_copy (sources->next, p, bMultiple, drive_d, dir_d, file_d, ext_d, &append, &dwFlags) + 1;
}
DeleteFileList (start);
freep (p);
ConOutPrintf (_T(" %d file(s) copied\n"), copied);
return 1;
}
#endif /* INCLUDE_CMD_COPY */

View File

@@ -1,297 +0,0 @@
/*
* DATE.C - date internal command.
*
*
* History:
*
* 08 Jul 1998 (John P. Price)
* started.
*
* 20 Jul 1998 (John P. Price)
* corrected number of days for December from 30 to 31.
* (Thanx to Steffen Kaiser for bug report)
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 29-Jul-1998 (Rob Lake)
* fixed stand-alone mode.
* Added Pacific C compatible dos_getdate functions
*
* 09-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added locale support
*
* 23-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
*
* 04-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed date input bug.
*/
#include "config.h"
#ifdef INCLUDE_CMD_DATE
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
static WORD awMonths[2][13] =
{
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
};
static VOID
PrintDate (VOID)
{
#ifdef __REACTOS__
SYSTEMTIME st;
GetLocalTime (&st);
switch (nDateFormat)
{
case 0: /* mmddyy */
default:
ConOutPrintf (_T("Current date is: %s %02d%c%02d%c%04d\n"),
aszDayNames[st.wDayOfWeek], st.wMonth, cDateSeparator, st.wDay, cDateSeparator, st.wYear);
break;
case 1: /* ddmmyy */
ConOutPrintf (_T("Current date is: %s %02d%c%02d%c%04d\n"),
aszDayNames[st.wDayOfWeek], st.wDay, cDateSeparator, st.wMonth, cDateSeparator, st.wYear);
break;
case 2: /* yymmdd */
ConOutPrintf (_T("Current date is: %s %04d%c%02d%c%02d\n"),
aszDayNames[st.wDayOfWeek], st.wYear, cDateSeparator, st.wMonth, cDateSeparator, st.wDay);
break;
}
#else
TCHAR szDate[32];
GetDateFormat (LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,
szDate, sizeof (szDate));
ConOutPrintf (_T("Current date is: %s\n"), szDate);
#endif
}
static VOID
PrintDateString (VOID)
{
switch (nDateFormat)
{
case 0: /* mmddyy */
default:
ConOutPrintf (_T("Enter new date (mm%cdd%cyyyy): "),
cDateSeparator, cDateSeparator);
break;
case 1: /* ddmmyy */
ConOutPrintf (_T("Enter new date (dd%cmm%cyyyy): "),
cDateSeparator, cDateSeparator);
break;
case 2: /* yymmdd */
ConOutPrintf (_T("Enter new date (yyyy%cmm%cdd): "),
cDateSeparator, cDateSeparator);
break;
}
}
static BOOL
ReadNumber (LPTSTR *s, LPWORD lpwValue)
{
if (_istdigit (**s))
{
while (_istdigit (**s))
{
*lpwValue = *lpwValue * 10 + **s - _T('0');
(*s)++;
}
return TRUE;
}
return FALSE;
}
static BOOL
ReadSeparator (LPTSTR *s)
{
if (**s == _T('/') || **s == _T('-') || **s == cDateSeparator)
{
(*s)++;
return TRUE;
}
return FALSE;
}
static BOOL
ParseDate (LPTSTR s)
{
SYSTEMTIME d;
unsigned char leap;
LPTSTR p = s;
if (!*s)
return TRUE;
GetLocalTime (&d);
d.wYear = 0;
d.wDay = 0;
d.wMonth = 0;
switch (nDateFormat)
{
case 0: /* mmddyy */
default:
if (!ReadNumber (&p, &d.wMonth))
return FALSE;
if (!ReadSeparator (&p))
return FALSE;
if (!ReadNumber (&p, &d.wDay))
return FALSE;
if (!ReadSeparator (&p))
return FALSE;
if (!ReadNumber (&p, &d.wYear))
return FALSE;
break;
case 1: /* ddmmyy */
if (!ReadNumber (&p, &d.wDay))
return FALSE;
if (!ReadSeparator (&p))
return FALSE;
if (!ReadNumber (&p, &d.wMonth))
return FALSE;
if (!ReadSeparator (&p))
return FALSE;
if (!ReadNumber (&p, &d.wYear))
return FALSE;
break;
case 2: /* yymmdd */
if (!ReadNumber (&p, &d.wYear))
return FALSE;
if (!ReadSeparator (&p))
return FALSE;
if (!ReadNumber (&p, &d.wMonth))
return FALSE;
if (!ReadSeparator (&p))
return FALSE;
if (!ReadNumber (&p, &d.wDay))
return FALSE;
break;
}
/* if only entered two digits: */
/* assume 2000's if value less than 80 */
/* assume 1900's if value greater or equal 80 */
if (d.wYear <= 99)
{
if (d.wYear >= 80)
d.wYear = 1900 + d.wYear;
else
d.wYear = 2000 + d.wYear;
}
leap = (!(d.wYear % 4) && (d.wYear % 100)) || !(d.wYear % 400);
if ((d.wMonth >= 1 && d.wMonth <= 12) &&
(d.wDay >= 1 && d.wDay <= awMonths[leap][d.wMonth]) &&
(d.wYear >= 1980 && d.wYear <= 2099))
{
SetLocalTime (&d);
return TRUE;
}
return FALSE;
}
INT cmd_date (LPTSTR cmd, LPTSTR param)
{
LPTSTR *arg;
INT argc;
INT i;
BOOL bPrompt = TRUE;
INT nDateString = -1;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays or sets the date.\n\n"
"DATE [/T][date]\n\n"
" /T display only\n\n"
"Type DATE without parameters to display the current date setting and\n"
"a prompt for a new one. Press ENTER to keep the same date."));
return 0;
}
/* build parameter array */
arg = split (param, &argc);
/* check for options */
for (i = 0; i < argc; i++)
{
if (_tcsicmp (arg[i], _T("/t")) == 0)
bPrompt = FALSE;
if ((*arg[i] != _T('/')) && (nDateString == -1))
nDateString = i;
}
if (nDateString == -1)
PrintDate ();
if (!bPrompt)
{
freep (arg);
return 0;
}
if (nDateString == -1)
{
while (TRUE) /* forever loop */
{
TCHAR s[40];
PrintDateString ();
ConInString (s, 40);
#ifdef _DEBUG
DebugPrintf ("\'%s\'\n", s);
#endif
while (*s && s[_tcslen (s) - 1] < ' ')
s[_tcslen (s) - 1] = '\0';
if (ParseDate (s))
{
freep (arg);
return 0;
}
ConErrPuts ("Invalid date.");
}
}
else
{
if (ParseDate (arg[nDateString]))
{
freep (arg);
return 0;
}
ConErrPuts ("Invalid date.");
}
freep (arg);
return 0;
}
#endif

View File

@@ -1,380 +0,0 @@
/*
* DEL.C - del internal command.
*
*
* History:
*
* 06/29/98 (Rob Lake rlake@cs.mun.ca)
* rewrote del to support wildcards
* added my name to the contributors
*
* 07/13/98 (Rob Lake)
* fixed bug that caused del not to delete file with out
* attribute. moved set, del, ren, and ver to there own files
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 09-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeiung.de>)
* Fixed command line parsing bugs.
*
* 21-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeiung.de>)
* Started major rewrite using a new structure.
*
* 03-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeiung.de>)
* First working version.
*
* 30-Mar-1999 (Eric Kohl <ekohl@abo.rhein-zeiung.de>)
* Added quiet ("/Q"), wipe ("/W") and zap ("/Z") option.
*/
#include "config.h"
#ifdef INCLUDE_CMD_DEL
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "cmd.h"
#define PROMPT_NO 0
#define PROMPT_YES 1
#define PROMPT_ALL 2
#define PROMPT_BREAK 3
enum
{
DEL_ATTRIBUTES = 0x001, /* /A : not implemented */
DEL_ERROR = 0x002, /* /E : not implemented */
DEL_NOTHING = 0x004, /* /N */
DEL_PROMPT = 0x008, /* /P : not implemented */
DEL_QUIET = 0x010, /* /Q */
DEL_SUBDIR = 0x020, /* /S : not implemented */
DEL_TOTAL = 0x040, /* /T */
DEL_WIPE = 0x080, /* /W */
DEL_EMPTYDIR = 0x100, /* /X : not implemented */
DEL_YES = 0x200, /* /Y : not implemented */
DEL_ZAP = 0x400 /* /Z */
};
static BOOL ConfirmDeleteAll (VOID)
{
TCHAR inp[10];
LPTSTR p;
ConOutPrintf (_T("All files in directory will be deleted!\n"
"Are you sure (Y/N)? "));
ConInString (inp, 10);
_tcsupr (inp);
for (p = inp; _istspace (*p); p++)
;
if (*p == _T('Y'))
return PROMPT_YES;
else if (*p == _T('N'))
return PROMPT_NO;
#if 0
if (*p == _T('A'))
return PROMPT_ALL;
else if (*p == _T('\03'))
return PROMPT_BREAK;
#endif
return PROMPT_NO;
}
#if 0
static INT Prompt (LPTSTR str)
{
TCHAR inp[10];
LPTSTR p;
ConOutPrintf (_T("Delete %s (Yes/No)? "), str);
ConInString (inp, 10);
_tcsupr (inp);
for (p = inp; _istspace (*p); p++)
;
if (*p == _T('Y'))
return PROMPT_YES;
else if (*p == _T('N'))
return PROMPT_NO;
#if 0
if (*p == _T('A'))
return PROMPT_ALL;
else if (*p == _T('\03'))
return PROMPT_BREAK;
#endif
return PROMPT_NO;
}
#endif
static BOOL
RemoveFile (LPTSTR lpFileName, DWORD dwFlags)
{
if (dwFlags & DEL_WIPE)
{
/* FIXME: Wipe the given file */
}
return DeleteFile (lpFileName);
}
INT cmd_del (LPTSTR cmd, LPTSTR param)
{
LPTSTR *arg = NULL;
INT args;
INT i;
INT nEvalArgs = 0; /* nunber of evaluated arguments */
DWORD dwFlags = 0;
DWORD dwFiles = 0;
HANDLE hFile;
WIN32_FIND_DATA f;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Deletes one or more files.\n"
"\n"
"DEL [/N /P /T /Q /W /Z] file ...\n"
"DELETE [/N /P /T /Q /W /Z] file ...\n"
"ERASE [/N /P /T /Q /W /Z] file ...\n"
"\n"
" file Specifies the file(s) to delete.\n"
"\n"
" /N Nothing.\n"
" /P Prompts for confirmation before deleting each file.\n"
" (Not implemented yet!)\n"
" /T Display total number of deleted files and freed disk space.\n"
" /Q Quiet.\n"
" /W Wipe. Overwrite the file with zeros before deleting it.\n"
" /Z Zap (delete hidden, read-only and system files).\n"
));
return 0;
}
arg = split (param, &args);
if (args > 0)
{
/* check for options anywhere in command line */
for (i = 0; i < args; i++)
{
if (*arg[i] == _T('/'))
{
if (_tcslen (arg[i]) >= 2)
{
switch (_totupper (arg[i][1]))
{
case _T('N'):
dwFlags |= DEL_NOTHING;
break;
case _T('P'):
dwFlags |= DEL_PROMPT;
break;
case _T('Q'):
dwFlags |= DEL_QUIET;
break;
case _T('S'):
dwFlags |= DEL_SUBDIR;
break;
case _T('T'):
dwFlags |= DEL_TOTAL;
break;
case _T('W'):
dwFlags |= DEL_WIPE;
break;
case _T('Z'):
dwFlags |= DEL_ZAP;
break;
}
}
nEvalArgs++;
}
}
/* there are only options on the command line --> error!!! */
if (args == nEvalArgs)
{
error_req_param_missing ();
freep (arg);
return 1;
}
/* check for filenames anywhere in command line */
for (i = 0; i < args; i++)
{
if (!_tcscmp (arg[i], _T("*")) ||
!_tcscmp (arg[i], _T("*.*")))
{
if (!ConfirmDeleteAll ())
break;
}
if (*arg[i] != _T('/'))
{
#ifdef _DEBUG
ConErrPrintf (_T("File: %s\n"), arg[i]);
#endif
if (_tcschr (arg[i], _T('*')) || _tcschr (arg[i], _T('?')))
{
/* wildcards in filespec */
#ifdef _DEBUG
ConErrPrintf (_T("Wildcards!\n\n"));
#endif
hFile = FindFirstFile (arg[i], &f);
if (hFile == INVALID_HANDLE_VALUE)
{
error_file_not_found ();
freep (arg);
return 0;
}
do
{
/* ignore "." and ".." */
if (!_tcscmp (f.cFileName, _T(".")) ||
!_tcscmp (f.cFileName, _T("..")))
continue;
if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL))
ConErrPrintf (_T("Deleting: %s\n"), f.cFileName);
/* delete the file */
if (!(dwFlags & DEL_NOTHING))
{
if (RemoveFile (f.cFileName, dwFlags))
{
dwFiles++;
}
else
{
if (dwFlags & DEL_ZAP)
{
if (SetFileAttributes (arg[i], 0))
{
if (RemoveFile (arg[i], dwFlags))
{
dwFiles++;
}
else
{
ErrorMessage (GetLastError(), _T(""));
}
}
else
{
ErrorMessage (GetLastError(), _T(""));
}
}
else
{
ErrorMessage (GetLastError(), _T(""));
}
}
}
}
while (FindNextFile (hFile, &f));
FindClose (hFile);
}
else
{
/* no wildcards in filespec */
#ifdef _DEBUG
ConErrPrintf (_T("No Wildcards!\n"));
#endif
if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL))
ConOutPrintf (_T("Deleting %s\n"), arg[i]);
if (!(dwFlags & DEL_NOTHING))
{
if (RemoveFile (arg[i], dwFlags))
{
dwFiles++;
}
else
{
if (dwFlags & DEL_ZAP)
{
if (SetFileAttributes (arg[i], 0))
{
if (RemoveFile (arg[i], dwFlags))
{
dwFiles++;
}
else
{
ErrorMessage (GetLastError(), _T(""));
}
}
else
{
ErrorMessage (GetLastError(), _T(""));
}
}
else
{
ErrorMessage (GetLastError(), _T(""));
}
}
}
}
}
}
}
else
{
/* only command given */
error_req_param_missing ();
freep (arg);
return 1;
}
freep (arg);
if (!(dwFlags & DEL_QUIET))
{
if (dwFiles == 0)
ConOutPrintf (_T(" 0 files deleted\n"));
else
ConOutPrintf (_T(" %lu file%s deleted\n"),
dwFiles, (dwFiles == 1) ? "s" : "");
}
return 0;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,181 +0,0 @@
/*
* DIRSTACK.C - pushd / pop (directory stack) internal commands.
*
*
* History:
*
* 14-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Implemented PUSHD and POPD command.
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
*/
#include "config.h"
#ifdef FEATURE_DIRECTORY_STACK
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include "cmd.h"
typedef struct tagDIRENTRY
{
struct tagDIRENTRY *next;
LPTSTR pszPath;
} DIRENTRY, *LPDIRENTRY;
static INT nStackDepth;
static LPDIRENTRY lpStackTop;
static INT
PushDirectory (LPTSTR pszPath)
{
LPDIRENTRY lpDir;
lpDir = (LPDIRENTRY)malloc (sizeof (DIRENTRY));
if (!lpDir)
{
error_out_of_memory ();
return -1;
}
lpDir->next = (lpStackTop) ? lpStackTop : NULL;
lpStackTop = lpDir;
lpDir->pszPath = (LPTSTR)malloc ((_tcslen(pszPath)+1)*sizeof(TCHAR));
if (!lpDir->pszPath)
{
free (lpDir);
error_out_of_memory ();
return -1;
}
_tcscpy (lpDir->pszPath, pszPath);
nStackDepth++;
return 0;
}
static VOID
PopDirectory (VOID)
{
LPDIRENTRY lpDir;
if (nStackDepth == 0)
return;
lpDir = lpStackTop;
lpStackTop = lpDir->next;
free (lpDir->pszPath);
free (lpDir);
nStackDepth--;
}
static VOID
GetDirectoryStackTop (LPTSTR pszPath)
{
if (lpStackTop)
_tcsncpy (pszPath, lpStackTop->pszPath, MAX_PATH);
else
*pszPath = _T('\0');
}
/*
* initialize directory stack
*/
VOID InitDirectoryStack (VOID)
{
nStackDepth = 0;
lpStackTop = NULL;
}
/*
* destroy directory stack
*/
VOID DestroyDirectoryStack (VOID)
{
while (nStackDepth)
PopDirectory ();
}
INT GetDirectoryStackDepth (VOID)
{
return nStackDepth;
}
/*
* pushd command
*/
INT cmd_pushd (LPTSTR first, LPTSTR rest)
{
TCHAR curPath[MAX_PATH];
TCHAR newPath[MAX_PATH];
BOOL bChangePath = FALSE;
if (!_tcsncmp (rest, _T("/?"), 2))
{
ConOutPuts (_T("Stores the current directory for use by the POPD command, then\n"
"changes to the specified directory.\n\n"
"PUSHD [path | ..]\n\n"
" path Specifies the directory to make the current directory"));
return 0;
}
if (rest[0] != _T('\0'))
{
GetFullPathName (rest, MAX_PATH, newPath, NULL);
bChangePath = IsValidPathName (newPath);
}
GetCurrentDirectory (MAX_PATH, curPath);
if (PushDirectory (curPath))
return -1;
if (bChangePath)
SetCurrentDirectory (newPath);
return 0;
}
/*
* popd command
*/
INT cmd_popd (LPTSTR first, LPTSTR rest)
{
TCHAR szPath[MAX_PATH];
if (!_tcsncmp(rest, _T("/?"), 2))
{
ConOutPuts (_T("Changes to the directory stored by the PUSHD command.\n\n"
"POPD"));
return 0;
}
if (GetDirectoryStackDepth () == 0)
return 0;
GetDirectoryStackTop (szPath);
PopDirectory ();
SetCurrentDirectory (szPath);
return 0;
}
#endif /* FEATURE_DIRECTORY_STACK */

View File

@@ -1,57 +0,0 @@
/*
* ECHO.C - echo internal command.
*
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* Started.
*
* 16 Jul 1998 (John P Price)
* Separated commands into individual files.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* Added config.h include
*
* 08-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("/?").
*
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection ready!
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
#include "batch.h"
INT cmd_echo (LPTSTR cmd, LPTSTR param)
{
#ifdef _DEBUG
DebugPrintf ("cmd_echo '%s' : '%s'\n", cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts ("Displays messages or switches command echoing on or off.\n\n"
"ECHO [ON | OFF]\nECHO [message]\n\n"
"Type ECHO without a parameter to display the current ECHO setting.");
return 0;
}
if (_tcsicmp (param, D_OFF) == 0)
bEcho = FALSE;
else if (_tcsicmp (param, D_ON) == 0)
bEcho = TRUE;
else if (*param)
ConOutPuts (param);
else
ConOutPrintf (_T("ECHO is %s\n"), bEcho ? D_ON : D_OFF);
return 0;
}

View File

@@ -1,179 +0,0 @@
/*
* ERROR.C - error reporting functions.
*
*
* History:
*
* 07/12/98 (Rob Lake)
* started
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 24-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection safe!
*
* 02-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Use FormatMessage() for error reports.
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdarg.h>
#include "cmd.h"
#define INVALID_SWITCH _T("Invalid switch - /%c\n")
#define TOO_MANY_PARAMETERS _T("Too many parameters - %s\n")
#define PATH_NOT_FOUND _T("Path not found\n")
#define FILE_NOT_FOUND _T("File not found")
#define REQ_PARAM_MISSING _T("Required parameter missing\n")
#define INVALID_DRIVE _T("Invalid drive specification\n")
#define INVALID_PARAM_FORMAT _T("Invalid parameter format - %s\n")
#define BADCOMMAND _T("Bad command or filename\n")
#define OUT_OF_MEMORY _T("Out of memory error.\n")
#define CANNOTPIPE _T("Error! Cannot pipe! Cannot open temporary file!\n")
#define D_PAUSEMSG _T("Press any key to continue . . .")
VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
{
TCHAR szMessage[1024];
LPTSTR szError;
va_list arg_ptr;
if (dwErrorCode == ERROR_SUCCESS)
return;
va_start (arg_ptr, szFormat);
_vstprintf (szMessage, szFormat, arg_ptr);
va_end (arg_ptr);
#ifndef __REACTOS__
if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&szError, 0, NULL))
{
ConErrPrintf (_T("%s %s\n"), szError, szMessage);
LocalFree (szError);
return;
}
else
{
ConErrPrintf (_T("Unknown error! Error code: 0x%lx\n"), dwErrorCode);
return;
}
#else
switch (dwErrorCode)
{
case ERROR_FILE_NOT_FOUND:
szError = _T("File not found --");
break;
case ERROR_PATH_NOT_FOUND:
szError = _T("Path not found --");
break;
case ERROR_BAD_PATHNAME: /* a1 */
szError = _T("Invalid path");
break;
default:
ConErrPrintf (_T("Unknown error! Error code: 0x%lx\n"), dwErrorCode);
return;
}
ConErrPrintf (_T("%s %s\n"), szError, szMessage);
#endif
}
VOID error_invalid_switch (TCHAR ch)
{
ConErrPrintf (INVALID_SWITCH, ch);
}
VOID error_too_many_parameters (LPTSTR s)
{
ConErrPrintf (TOO_MANY_PARAMETERS, s);
}
VOID error_path_not_found (VOID)
{
ConErrPrintf (PATH_NOT_FOUND);
}
VOID error_file_not_found (VOID)
{
ConErrPrintf (FILE_NOT_FOUND);
}
VOID error_sfile_not_found (LPTSTR f)
{
ConErrPrintf (FILE_NOT_FOUND _T(" - %s\n"), f);
}
VOID error_req_param_missing (VOID)
{
ConErrPrintf (REQ_PARAM_MISSING);
}
VOID error_invalid_drive (VOID)
{
ConErrPrintf (INVALID_DRIVE);
}
VOID error_bad_command (VOID)
{
ConErrPrintf (BADCOMMAND);
}
VOID error_no_pipe (VOID)
{
ConErrPrintf (CANNOTPIPE);
}
VOID error_out_of_memory (VOID)
{
ConErrPrintf (OUT_OF_MEMORY);
}
VOID error_invalid_parameter_format (LPTSTR s)
{
ConErrPrintf (INVALID_PARAM_FORMAT, s);
}
VOID error_syntax (LPTSTR s)
{
if (s)
ConErrPrintf (_T("Syntax error - %s\n"), s);
else
ConErrPrintf (_T("Syntax error.\n"));
}
VOID msg_pause (VOID)
{
ConOutPuts (D_PAUSEMSG);
}

View File

@@ -1,268 +0,0 @@
/*
* FILECOMP.C - handles filename completion.
*
*
* Comments:
*
* 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* moved from command.c file
* made second TAB display list of filename matches
* made filename be lower case if last character typed is lower case
*
* 25-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Cleanup. Unicode safe!
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include "cmd.h"
#ifdef FEATURE_UNIX_FILENAME_COMPLETION
VOID CompleteFilename (LPTSTR str, INT charcount)
{
WIN32_FIND_DATA file;
HANDLE hFile;
INT curplace = 0;
INT start;
INT count;
BOOL found_dot = FALSE;
BOOL perfectmatch = TRUE;
TCHAR path[MAX_PATH];
TCHAR fname[MAX_PATH];
TCHAR maxmatch[MAX_PATH] = _T("");
TCHAR directory[MAX_PATH];
/* expand current file name */
count = charcount - 1;
if (count < 0)
count = 0;
/* find front of word */
while (count > 0 && str[count] != _T(' '))
count--;
/* if not at beginning, go forward 1 */
if (str[count] == _T(' '))
count++;
start = count;
/* extract directory from word */
_tcscpy (directory, &str[start]);
curplace = _tcslen (directory) - 1;
while (curplace >= 0 && directory[curplace] != _T('\\') &&
directory[curplace] != _T(':'))
{
directory[curplace] = 0;
curplace--;
}
_tcscpy (path, &str[start]);
/* look for a '.' in the filename */
for (count = _tcslen (directory); path[count] != _T('\0'); count++)
{
if (path[count] == _T('.'))
{
found_dot = TRUE;
break;
}
}
if (found_dot)
_tcscat (path, _T("*"));
else
_tcscat (path, _T("*.*"));
/* current fname */
curplace = 0;
hFile = FindFirstFile (path, &file);
if (hFile != INVALID_HANDLE_VALUE)
{
/* find anything */
do
{
/* ignore "." and ".." */
if (!_tcscmp (file.cFileName, _T(".")) ||
!_tcscmp (file.cFileName, _T("..")))
continue;
_tcscpy (fname, file.cFileName);
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
_tcscat (fname, _T("\\"));
else
_tcscat (fname, _T(" "));
if (!maxmatch[0] && perfectmatch)
{
_tcscpy(maxmatch, fname);
}
else
{
for (count = 0; maxmatch[count] && fname[count]; count++)
{
if (tolower(maxmatch[count]) != tolower(fname[count]))
{
perfectmatch = FALSE;
maxmatch[count] = 0;
break;
}
}
}
}
while (FindNextFile (hFile, &file));
FindClose (hFile);
_tcscpy (&str[start], directory);
_tcscat (&str[start], maxmatch);
if (!perfectmatch)
#ifdef __REACTOS__
Beep (440, 50);
#else
MessageBeep (-1);
#endif
}
else
{
/* no match found */
#ifdef __REACTOS__
Beep (440, 50);
#else
MessageBeep (-1);
#endif
}
}
/*
* returns 1 if at least one match, else returns 0
*/
BOOL ShowCompletionMatches (LPTSTR str, INT charcount)
{
WIN32_FIND_DATA file;
HANDLE hFile;
BOOL found_dot = FALSE;
INT curplace = 0;
INT start;
INT count;
TCHAR path[MAX_PATH];
TCHAR fname[MAX_PATH];
TCHAR directory[MAX_PATH];
/* expand current file name */
count = charcount - 1;
if (count < 0)
count = 0;
/* find front of word */
while (count > 0 && str[count] != _T(' '))
count--;
/* if not at beginning, go forward 1 */
if (str[count] == _T(' '))
count++;
start = count;
/* extract directory from word */
_tcscpy (directory, &str[start]);
curplace = _tcslen (directory) - 1;
while (curplace >= 0 &&
directory[curplace] != _T('\\') &&
directory[curplace] != _T(':'))
{
directory[curplace] = 0;
curplace--;
}
_tcscpy (path, &str[start]);
/* look for a . in the filename */
for (count = _tcslen (directory); path[count] != _T('\0'); count++)
{
if (path[count] == _T('.'))
{
found_dot = TRUE;
break;
}
}
if (found_dot)
_tcscat (path, _T("*"));
else
_tcscat (path, _T("*.*"));
/* current fname */
curplace = 0;
hFile = FindFirstFile (path, &file);
if (hFile != INVALID_HANDLE_VALUE)
{
/* find anything */
ConOutChar (_T('\n'));
count = 0;
do
{
/* ignore . and .. */
if (!_tcscmp (file.cFileName, _T(".")) ||
!_tcscmp (file.cFileName, _T("..")))
continue;
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
_stprintf (fname, _T("[%s]"), file.cFileName);
else
_tcscpy (fname, file.cFileName);
ConOutPrintf (_T("%-14s"), fname);
if (++count == 5)
{
ConOutChar (_T('\n'));
count = 0;
}
}
while (FindNextFile (hFile, &file));
FindClose (hFile);
if (count)
ConOutChar (_T('\n'));
}
else
{
/* no match found */
#ifdef __REACTOS__
Beep (440, 50);
#else
MessageBeep (-1);
#endif
return FALSE;
}
return TRUE;
}
#endif
#ifdef FEATURE_4NT_FILENAME_COMPLETION
//static VOID BuildFilenameMatchList (...)
// VOID CompleteFilenameNext (LPTSTR, INT)
// VOID CompleteFilenamePrev (LPTSTR, INT)
// VOID RemoveFilenameMatchList (VOID)
#endif

View File

@@ -1,56 +0,0 @@
Archive Contents
~~~~~~~~~~~~~~~~
bugs.txt Bug List
files.txt This file list
history.txt History of the shell development
license.txt GNU license - applies to all files named here
readme.txt General shell info
todo.txt What I have to do
wishlist.txt Wish List
makefile experimental makefile
makefile.lcc makefile for lcc-win
alias.c Alias code
alias.h Alias header file
attrib.c Implements attrib command
batch.c Batch file interpreter
beep.c Implements beep command
call.c Implements call command
chcp.c Implements chcp command
cls.c Implements cls command
cmdinput.c Command-line input functions
cmdtable.c Table of available internal commands
cmd.c Main code for command-line interpreter
cmd.h Command header file
color.c Implements color command
console.c Windows console handling code
copy.c Implements copy command
date.c Implements date command
del.c Implements del command
dir.c Directory listing code
dirstack.c Directory stack code (PUSHD and POPD)
echo.c Implements echo command
error.c Error Message Routines
filecomp.c Filename completion functions
for.c Implements for command
goto.c Implements goto command
history.c Command-line history handling
if.c Implements if command
internal.c Internal commands (DIR, RD, etc)
label.c Implements label command
locale.c Locale handling code
misc.c Misc. Functions
move.c Implements move command
path.c Implements path command
pause.c Implements pause command
prompt.c Prompt handling functions
redir.c Redirection and piping parsing functions
ren.c Implements rename command
set.c Implements set command
shift.c Implements shift command
time.c Implements time command
type.c Implements type command
ver.c Implements ver command
where.c Code to search path for executables
verify.c Implements verify command

View File

@@ -1,134 +0,0 @@
/*
* FOR.C - for internal batch command.
*
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
*
* 16 Jul 1998 (John P Price)
* Seperated commands into individual files.
*
* 19 Jul 1998 (Hans B Pufal) [HBP_001]
* Implementation of FOR
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "cmd.h"
#include "batch.h"
/*
* Perform FOR command.
*
* First check syntax is correct : FOR %v IN ( <list> ) DO <command>
* v must be alphabetic, <command> must not be empty.
*
* If all is correct build a new bcontext structure which preserves
* the necessary information so that readbatchline can expand
* each the command prototype for each list element.
*
* You might look on a FOR as being a called batch file with one line
* per list element.
*/
INT cmd_for (LPTSTR cmd, LPTSTR param)
{
LPBATCH_CONTEXT lpNew;
LPTSTR pp;
TCHAR var;
#ifdef _DEBUG
DebugPrintf ("cmd_for (\'%s\', \'%s\'\n", cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts ("FOR :");
return 0;
}
/* Check that first element is % then an alpha char followed by space */
if ((*param != _T('%')) || !_istalpha (*(param + 1)) || !_istspace (*(param + 2)))
{
error_syntax (_T("bad varable specification."));
return 1;
}
param++;
var = *param++; /* Save FOR var name */
while (_istspace (*param))
param++;
/* Check next element is 'IN' */
if ((_tcsnicmp (param, _T("in"), 2) != 0) || !_istspace (*(param + 2)))
{
error_syntax (_T("'in' missing in for statement."));
return 1;
}
param += 2;
while (_istspace (*param))
param++;
/* Folowed by a '(', find also matching ')' */
if ((*param != _T('(')) || (NULL == (pp = _tcsrchr (param, _T(')')))))
{
error_syntax (_T("no brackets found."));
return 1;
}
*pp++ = _T('\0');
param++; /* param now points at null terminated list */
while (_istspace (*pp))
pp++;
/* Check DO follows */
if ((_tcsnicmp (pp, _T("do"), 2) != 0) || !_istspace (*(pp + 2)))
{
error_syntax (_T("'do' missing."));
return 1;
}
pp += 2;
while (_istspace (*pp))
pp++;
/* Check that command tail is not empty */
if (*pp == _T('\0'))
{
error_syntax (_T("no command after 'do'."));
return 1;
}
/* OK all is correct, build a bcontext.... */
lpNew = (LPBATCH_CONTEXT)malloc (sizeof (BATCH_CONTEXT));
lpNew->prev = bc;
bc = lpNew;
bc->hBatchFile = INVALID_HANDLE_VALUE;
bc->ffind = NULL;
bc->params = BatchParams (_T(""), param); /* Split out list */
bc->shiftlevel = 0;
bc->forvar = var;
bc->forproto = _tcsdup (pp);
return 0;
}

View File

@@ -1,109 +0,0 @@
/*
* GOTO.C - goto internal batch command.
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
*
* 16 Jul 1998 (John P Price)
* Seperated commands into individual files.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 28 Jul 1998 (Hans B Pufal) [HBP_003]
* Terminate label on first space character, use only first 8 chars of
* label string
*
* 24-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
*
* 27-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("/?").
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
#include "batch.h"
/*
* Perform GOTO command.
*
* Only valid if batch file current.
*
*/
INT cmd_goto (LPTSTR cmd, LPTSTR param)
{
LPTSTR tmp;
LONG lNewPosHigh;
#ifdef _DEBUG
DebugPrintf ("cmd_goto (\'%s\', \'%s\'\n", cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Directs CMD to a labeled line in a batch script.\n"
"\n"
"GOTO label\n"
"\n"
" label Specifies a text string used in a batch script as a label.\n"
"\n"
"You type a label on a line by itself, beginning with a colon."));
return 0;
}
/* if not in batch -- error!! */
if (bc == NULL)
{
return 1;
}
if (*param == _T('\0'))
{
ExitBatch (_T("No label specified for GOTO\n"));
return 1;
}
/* terminate label at first space char */
tmp = param;
while (*tmp && !_istspace (*tmp))
tmp++;
*tmp = _T('\0');
/* set file pointer to the beginning of the batch file */
lNewPosHigh = 0;
SetFilePointer (bc->hBatchFile, 0, &lNewPosHigh, FILE_BEGIN);
while (FileGetString (bc->hBatchFile, textline, sizeof(textline)))
{
/* Strip out any trailing spaces or control chars */
tmp = textline + _tcslen (textline) - 1;
while (_istcntrl (*tmp) || _istspace (*tmp))
tmp--;
*(tmp + 1) = _T('\0');
/* Then leading spaces... */
tmp = textline;
while (_istspace (*tmp))
tmp++;
/* use only 1st 8 chars of label */
if ((*tmp == _T(':')) && (_tcsncmp (++tmp, param, 8) == 0))
return 0;
}
ConErrPrintf (_T("Label '%s' not found\n"), param);
ExitBatch (NULL);
return 1;
}

View File

@@ -1,126 +0,0 @@
/*
* HISTORY.C - command line history.
*
*
* History:
*
* 14/01/95 (Tim Norman)
* started.
*
* 08/08/95 (Matt Rains)
* i have cleaned up the source code. changes now bring this source
* into guidelines for recommended programming practice.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 25-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Cleanup!
* Unicode and redirection safe!
*/
#include "config.h"
#ifdef FEATURE_HISTORY
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include "cmd.h"
#define MAXLINES 128
static INT history_size = 2048; /* make this configurable later */
VOID History (INT dir, LPTSTR commandline)
{
static LPTSTR history = NULL;
static LPTSTR lines[MAXLINES];
static INT curline = 0;
static INT numlines = 0;
static INT maxpos = 0;
INT count;
INT length;
if (!history)
{
history = malloc (history_size * sizeof (TCHAR));
lines[0] = history;
history[0] = 0;
}
if (dir > 0)
{
/* next command */
if (curline < numlines)
{
curline++;
}
if (curline == numlines)
{
commandline[0] = 0;
}
else
{
_tcscpy (commandline, lines[curline]);
}
}
else if (dir < 0)
{
/* prev command */
if (curline > 0)
{
curline--;
}
_tcscpy (commandline, lines[curline]);
}
else
{
/* add to history */
/* remove oldest string until there's enough room for next one */
/* strlen (commandline) must be less than history_size! */
while ((maxpos + (INT)_tcslen (commandline) + 1 > history_size) || (numlines >= MAXLINES))
{
length = _tcslen (lines[0]) + 1;
for (count = 0; count < maxpos && count + (lines[1] - lines[0]) < history_size; count++)
{
history[count] = history[count + length];
}
maxpos -= length;
for (count = 0; count <= numlines && count < MAXLINES; count++)
{
lines[count] = lines[count + 1] - length;
}
numlines--;
#ifdef DEBUG
ConOutPrintf (_T("Reduced size: %ld lines\n"), numlines);
for (count = 0; count < numlines; count++)
{
ConOutPrintf (_T("%d: %s\n"), count, lines[count]);
}
#endif
}
_tcscpy (lines[numlines], commandline);
numlines++;
lines[numlines] = lines[numlines - 1] + _tcslen (commandline) + 1;
maxpos += _tcslen (commandline) + 1;
/* last line, empty */
curline = numlines;
}
return;
}
#endif

View File

@@ -1,353 +0,0 @@
FreeDOS Command Line Interface Development History
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11/11/94 version 0.01
~~~~~~~~~~~~~~~~~~~~~
o initial release.
01/01/95 version 0.10
~~~~~~~~~~~~~~~~~~~~~
o removed some scaffolding.
o modified CD.
o added tab file completion.
o added command line history.
01/15/95 version 0.20
~~~~~~~~~~~~~~~~~~~~~
o formatted all existing source modules.
o added prompt support.
o added drive selection.
o added dir command.
o started this development log.
08/06/95 prerelease of version 0.30
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o reorganized code into separate source modules.
o added batch processing support (thanks to Evan Jeffrey).
o added exec code (thanks to Steffan Kaiser).
o removed environment handling (thanks again to Steffan Kaiser)
[ 08/08/95 -- Matt Rains ]
o formatted this development log.
o formatted all existing source modules so that they comply with recommended
programming practice.
o added MD command.
o added RD command.
o added VER command.
o replaced CD command.
o modified DIR command.
o DIR now called regardless of other DIR.??? files. this is done because of
exec() problems.
12/10/95 version 0.30
~~~~~~~~~~~~~~~~~~~~~
o used Borland's spawnve to fix exec problem
o fixed CD again so you don't need a space after it
o couple of spelling fixes
12/14/95 version 0.31
~~~~~~~~~~~~~~~~~~~~~
o modified cmdinput.c to work with non-standard screen sizes (see 28.com)
o fixed a bug in history.c that made it not work when you hit the up arrow
on the first line
o fixed DIR to work a little more like MS-DOS's DIR (see internal.c)
o fixed some code in where.c to make things a bit more efficient and nicer
01/06/96 version 0.40 (never released)
~~~~~~~~~~~~~~~~~~~~~
o added redirection and piping support!!! (see redir.c and command.c)
o fixed a stupid pointer problem in where.c that was causing LOTS of
problems in the strangest places...
o added day of the week support to prompt.c (oops, that was already supposed
to be there! :)
o fixed and reorganized the EXEC code!!! Thanks to Svante Frey!
o reorganized command.c and internal.c to handle parsing internal commands
more efficiently and consistently.
o changed the behavior of MD, CD, RD to work without spaces (e.g. CD\DOS)
o small changes here and there to make it work with redirection/piping
(e.g. DIR only pauses if you're not doing redirection)
01/17/96 version 0.50
~~~~~~~~~~~~~~~~~~~~~
Version 0.40 was never released because I was home on Christmas vacation,
and I couldn't upload it. By the time I got back to school, I had the
LOADHIGH patch from Svante Frey, so I decided to jump up to 0.50 without any
release of 0.40... - Tim Norman
o LOADHIGH/LOADFIX/LH support added!!!! Many thanks go to Svante Frey!
o bug fixed in command parsing that didn't handle / switches correctly...
o removed debugging output from history.c
07/26/96 version 0.60
~~~~~~~~~~~~~~~~~~~~~
Lots of internal changes here... Not much added to the interface.
o Changed internals to use first,rest parameters instead of arrays of params
o Fixed some bugs
o Some other things I don't remember :)
07/26/96 version 0.61
~~~~~~~~~~~~~~~~~~~~~
Bugfixes
o Added hook to the PATH command
o Fixed CD.. bug
08/27/96 version 0.70
~~~~~~~~~~~~~~~~~~~~~
Finally added Oliver Mueller's ALIAS command! Also numerous bug fixes.
o Added ALIAS command
o Removed support for - as a switch in LOADHIGH.C
o Bugfixes in BATCH.C. %0 was returning garbage
o Removed lots of unused variables, reducing # of warnings when compiling
o Other miscellaneous code clean-ups
o Changed WHERE.C to use a little less memory
06/14/97 version 0.71
~~~~~~~~~~~~~~~~~~~~~
Lots of bug fixes, plus some additional features.
o New DIR command. Now more like MS-DOS's DIR. /p supported, /s coming soon
o bug fix in internal.c - parse_firstarg
o Rewrote parser in batch.c (Steffan Kaiser)
o Ctrl-Break checking in various places (Steffan Kaiser)
o Error level setting/checking (%? in batch files) (Steffan Kaiser)
o bug fix in cmdinput.c ("%i" on command-line caused weird behavior)
o bug fix in where.c (first item in path wasn't searched)
07/12/97 version 0.72
~~~~~~~~~~~~~~~~~~~~~
More bug fixes and code cleanup
o Rewrote cmdinput.c to be more efficient (Marc Desrochers)
o Added insert/overstrike modes (Marc Desrochers)
o Replaced findxy() with pointers into BIOS (maxx, maxy) (Marc Desrochers)
o Fixed bug that disallowed listing of root directories
o Fixed bug that didn't search the first path (again!)
07/13/97 version 0.72b
~~~~~~~~~~~~~~~~~~~~~~
Disabled a feature that caused a crash on some machines.
o Replaced setcursor calls in cmdinput.c with _setcursortype
o Added dir.c to the distribution (was left out in 0.72)
07/01/98 version 0.73 (Rob Lake)
~~~~~~~~~~~~~~~~~~~~~~
o New DIR commands supported: /S, /B, /L, /A and /W.
(/R changed to /S). Also /? added.
o Supports DIRCMD in environment.
o Supports turning off commands with hyphen (ex. /-S
turns off recursive listing)
o Changed error messages for DIR and DEL to more MS-DOS'ish
o Moved error messages from DIR.C and DEL.C to COMMAND.H
(more may go there soon)
o Fixed bug that caused dir *.ext/X not to work (no spaces
between filespec and slash)
o Added wildcard support for DEL command
o Added prompt and help switch for DEL command, /P and /?
respectively.
o Added support for /C when envoking the shell
o Added /P support when Kernel loads shell. This means
the shell now is permanent and runs the autoexec.bat
(/E is not implemented)
o Added my name (Rob Lake) to the developer listing
o Changed version routine to print out copyright notice
with no args, and with appropriate switches, warranty
and redistribution notices and developer listing
07/08/1998 version 0.74 (John P. Price (linux-guru@gcfl.net))
~~~~~~~~~~~~~~~~~~~~~~~~
COMMAND.C/COMMAND.H:
o Now sets COMSPEC environment variable
o misc clean up and optimization
o added date, time and type commands
o changed to using spawnl instead of exec. exec does not copy the
environment to the child process!
DIR.C
o removed extra returns; closer to MSDOS
o fixed wide display so that an extra return is not displayed when
there is five filenames in the last line.
ENVIRON.C
o commented out show_environment function. Not used anymore.
INTERAL.C
o removed call to show_environment in set command.
o moved test for syntax before allocating memory in set command.
o misc clean up and optimization.
o created DATE.C
o created TIME.C
o created TYPE.C
07/08/1998 version 0.74b (John P. Price (linux-guru@gcfl.net))
~~~~~~~~~~~~~~~~~~~~~~~~
COMMAND.C
o fixed call to spawnl so that it would pass command line arguments
correctly.
07/12/98 version 0.74c (Rob Lake rlake@cs.mun.ca)
~~~~~~~~~~~~~~~~~~~~~~
Various Files:
o removed redundant use of error message defines and moved
error printing calls to ERROR.C to reduced program size.
o created MISC.C
o created ERR_HAND.C/H
o created ERROR.C
07/13/98 version 0.74d (Rob Lake rlake@cs.mun.ca)
~~~~~~~~~~~~~~~~~~~~~~
INTERNAL.C
o removed most of the commands and placed them in there own file
-- del, ren, set and ver
o created DEL.C, REN.C SET.C and VER.C
o fixed bug that caused del not to delete files with no attributes
o the critical error handler count number of times called, autofails
at 5 calls
16 Jul 1998 (Hans B Pufal <hansp@digiweb.com>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
batch.c
A new version, implements CALL, ECHO, GOT, IF, PAUSE, SHIFT and
BEEP. There is a stub for FOR but that's all.
cmdtable.c
New file to keep the internal command table. I plan on getting rid
of the table real soon now and replacing it with a dynamic
mechanism.
command.c
A new (improved ;) version. Conforms closely to MS-DOS specs.
Cleaned up (and fixed) the redirection handler.
command.h
Version D with changes. Look for the HBP tag.
redir.c
Modified file, now supports append redirects.
16 Jul 1998 (Rob Lake rlake@cs.mun.ca)
~~~~~~~~~~~~~~~~~~~~~~
Added TRUENAME command.
19 Jul 1998 (Hans B Pufal) <hansp@digiweb.com>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o Preserve state of echo flag across batch calls.
o Implementation of FOR command
20 Jul 1998 (John P Price <linux-guru@gcfl.net>)
~~~~~~~~~~~~~~~~~~~~~~
o Fixed bug in DATE.C.
o Fixed bug in LH.ASM.
o Separated commands into individual files.
28 Jul 1998 (John P Price <linux-guru@gcfl.net>)
~~~~~~~~~~~~~~~~~~~~~~
o Added CLS command.
o Put ifdef's around all commands and added include file config.h
Now you can define exact what commands you want to include in
command.com.
o Also added ifdefs for optional features: aliases, command history
and filename completion.
o Added display of available internal commands and options at startup.
29 Jul 1998 (Rob Lake rlake@cs.mun.ca)
~~~~~~~~~~~~~~~~~~~~~~
o changed date.c and time.c, and wrote datefunc.c and timefunc.c to
impliment _dos_getdate, _dos_setdate, _dos_gettime and _dos_settime.
This is the first of many steps to make the shell compatible under
Pacific C.
30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
~~~~~~~~~~~~~~~~~~~~~~
o Changed filename completion so that a second TAB displays a list of
matching filenames!
o made filename be lower case if last character typed is lower case.
o Moved filename completion code to filecomp.c.
o Change ver command to display email address to report bugs, and the
web page address for updates.
o fixed so that it find_which returns NULL if filename is not
executable (does not have .bat, .com, or .exe extension). Before
command would to execute any file with any extension. (opps!)
30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
~~~~~~~~~~~~~~~~~~~~~~
o Fixed bug where if you typed something, then hit HOME, then tried to
type something else in insert mode, it locked up.
o Changed default insert mode to on. There should be a way to change
this. Maybe options to doskey command.
o Added VERIFY command
02-Aug-1998 (Hans B Pufal) <hansp@digiweb.com>)
~~~~~~~~~~~~~~~~~~~~~~
o batch.c: Fixed bug in ECHO flag restoration at exit from batch file
o command.c: Fixed return value when called with /C option
o Terminate label on first space character, use only first 8 chars of
label string
04-Aug-1998 (Hans B Pufal) <hansp@digiweb.com>)
~~~~~~~~~~~~~~~~~~~~~~
o call.c: added lines to initialize for pointers. This fixed the
lock-up that happened sometimes when calling a batch file from
another batch file.
07-Aug-1998 (John P Price <linux-guru@gcfl.net>)
~~~~~~~~~~~~~~~~~~~~~~
o Fixed carrage return output to better match MSDOS with echo on or off.
07-Dec-1998 ReactOS CMD version 0.0.1 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o First test release.
o Added internal ATTRIB command.
11-Dec-1998 ReactOS CMD version 0.0.2 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o Fixed bug in ALIAS. CMD crashed when you tried to remove an alias.
o Fixed bug in split(). Added freep(). This fixed the DEL command.
o Improved ATTRIB command.
o Added most help texts.
o Fixed recursive DIR ("dir /s").
o Fixed DATE and TIME command. Now they accept values when used
without parameter.
o Implemented LABEL command.
05-Jan-1999 ReactOS CMD version 0.0.3 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o Added COLOR command and "/t" option.
o Cursor shows insert/overwrite mode.
o COMSPEC environment variable is set upon startup.
o Started COPY command.
o Started MOVE command.
o Added directory stack (PUSHD and POPD commands).
o Added support for file names or paths that contain spaces
(quoted paths / file names).
o Added recursion to ATTRIB command.
o Added locale support for DIR, DATE, TIME and PROMPT.
o Fixed VERIFY.
10-Feb-1999 ReactOS CMD version 0.0.4 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o "?" lists all available commands.
o Most commands are unicode and redirection aware now.
o Input-, Output- and Error-Redirections works with most commands.
o ATTRIB and DEL can handle multiple filenames now.
o Fixed handling of environment variables.
o Added CHCP command.
o Fixed keyboard input bug.
o Rewrote DEL and MOVE commands.
30-Mar-1999 ReactOS CMD version 0.1 pre 2 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o Cleaned up DIR command.
o Searching for executables in the right order.
o Fixed some little but nasty bugs.
o Added TITLE command. Thanks to Emanuele Aliberti!
o Added "/Q", "/W" and "/Z" options to DEL command.

View File

@@ -1,156 +0,0 @@
/*
* IF.C - if internal batch command.
*
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
*
* 16 Jul 1998 (John P Price)
* Seperated commands into individual files.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("if /?") and cleaned up.
*
* 21-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection ready!
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
#include "batch.h"
#define X_EXEC 1
#define X_EMPTY 0x80
INT cmd_if (LPTSTR cmd, LPTSTR param)
{
INT x_flag = 0; /* when set cause 'then' clause to be executed */
LPTSTR pp;
#ifdef _DEBUG
DebugPrintf ("cmd_if: (\'%s\', \'%s\'\n", cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("IF :"));
return 0;
}
/* First check if param string begins with word 'not' */
if (!_tcsnicmp (param, _T("not"), 3) && _istspace (*(param + 3)))
{
x_flag = X_EXEC; /* Remember 'NOT' */
param += 3; /* Step over 'NOT' */
while (_istspace (*param)) /* And subsequent spaces */
param++;
}
/* Check for 'exist' form */
if (!_tcsnicmp (param, _T("exist"), 5) && _istspace (*(param + 5)))
{
param += 5;
while (_istspace (*param))
param++;
pp = param;
while (*pp && !_istspace (*pp))
pp++;
if (*pp)
{
WIN32_FIND_DATA f;
HANDLE hFind;
*pp++ = _T('\0');
hFind = FindFirstFile (param, &f);
x_flag ^= (hFind != INVALID_HANDLE_VALUE) ? 0 : X_EXEC;
if (hFind != INVALID_HANDLE_VALUE)
FindClose (hFind);
}
else
return 0;
}
/* Check for 'errorlevel' form */
else if (!_tcsnicmp (param, _T("errorlevel"), 10) && _istspace (*(param + 10)))
{
INT n = 0;
pp = param + 10;
while (_istspace (*pp))
pp++;
while (_istdigit (*pp))
n = n * 10 + (*pp++ - _T('0'));
x_flag ^= (nErrorLevel < n) ? 0 : X_EXEC;
x_flag |= X_EMPTY; /* Syntax error if comd empty */
}
/* Check that '==' is present, syntax error if not */
else if (NULL == (pp = _tcsstr (param, _T("=="))))
{
error_syntax (NULL);
return 1;
}
else
{
/* Change first '='to space to terminate comparison loop */
*pp = _T(' '); /* Need a space to terminate comparison loop */
pp += 2; /* over '==' */
while (_istspace (*pp)) /* Skip subsequent spaces */
pp++;
_tcscat (pp, _T(" ")); /* Add one space to ensure comparison ends */
while (*param == *pp) /* Comparison loop */
{
if (_istspace (*param)) /* Terminates on space */
break;
param++, pp++;
}
if (x_flag ^= (*param != *pp) ? 0 : X_EXEC)
{
while (*pp && !_istspace (*pp)) /* Find first space, */
pp++;
x_flag |= X_EMPTY;
}
}
if (x_flag & X_EMPTY)
{
while (_istspace (*pp)) /* Then skip spaces */
pp++;
if (*pp == _T('\0')) /* If nothing left then syntax err */
{
error_syntax (NULL);
return 1;
}
}
if (x_flag & X_EXEC)
ParseCommandLine (pp);
return 0;
}

View File

@@ -1,488 +0,0 @@
/*
* INTERNAL.C - command.com internal commands.
*
*
* History:
*
* 17/08/94 (Tim Norman)
* started.
*
* 08/08/95 (Matt Rains)
* i have cleaned up the source code. changes now bring this source into
* guidelines for recommended programming practice.
*
* cd()
* started.
*
* dir()
* i have added support for file attributes to the DIR() function. the
* routine adds "d" (directory) and "r" (read only) output. files with the
* system attribute have the filename converted to lowercase. files with
* the hidden attribute are not displayed.
*
* i have added support for directorys. now if the directory attribute is
* detected the file size if replaced with the string "<dir>".
*
* ver()
* started.
*
* md()
* started.
*
* rd()
* started.
*
* del()
* started.
*
* does not support wildcard selection.
*
* todo: add delete directory support.
* add recursive directory delete support.
*
* ren()
* started.
*
* does not support wildcard selection.
*
* todo: add rename directory support.
*
* a general structure has been used for the cd, rd and md commands. this
* will be better in the long run. it is too hard to maintain such diverse
* functions when you are involved in a group project like this.
*
* 12/14/95 (Tim Norman)
* fixed DIR so that it will stick \*.* if a directory is specified and
* that it will stick on .* if a file with no extension is specified or
* *.* if it ends in a \
*
* 1/6/96 (Tim Norman)
* added an isatty call to DIR so it won't prompt for keypresses unless
* stdin and stdout are the console.
*
* changed parameters to be mutually consistent to make calling the
* functions easier
*
* rem()
* started.
*
* doskey()
* started.
*
* 01/22/96 (Oliver Mueller)
* error messages are now handled by perror.
*
* 02/05/96 (Tim Norman)
* converted all functions to accept first/rest parameters
*
* 07/26/96 (Tim Norman)
* changed return values to int instead of void
*
* path() started.
*
* 12/23/96 (Aaron Kaufman)
* rewrote dir() to mimic MS-DOS's dir
*
* 01/28/97 (Tim Norman)
* cleaned up Aaron's DIR code
*
* 06/13/97 (Tim Norman)
* moved DIR code to dir.c
* re-implemented Aaron's DIR code
*
* 06/14/97 (Steffan Kaiser)
* ctrl-break handling
* bug fixes
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 03-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced DOS calls by Win32 calls.
*
* 08-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help texts ("/?").
*
* 18-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added support for quoted arguments (cd "program files").
*
* 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Clean up.
*
* 26-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced remaining CRT io functions by Win32 io functions.
* Unicode safe!
*
* 30-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added "cd -" feature. Changes to the previous directory.
*
* 15-Mar-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed bug in "cd -" feature. If the previous directory was a root
* directory, it was ignored.
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "cmd.h"
extern COMMAND cmds[]; /* The internal command table, used in '?' */
#ifdef INCLUDE_CMD_CHDIR
static LPTSTR lpLastPath;
VOID InitLastPath (VOID)
{
lpLastPath = NULL;
}
VOID FreeLastPath (VOID)
{
if (lpLastPath)
free (lpLastPath);
}
/*
* CD / CHDIR
*
*/
INT cmd_chdir (LPTSTR cmd, LPTSTR param)
{
LPTSTR dir; /* pointer to the directory to change to */
LPTSTR place; /* used to search for the \ when no space is used */
LPTSTR lpOldPath;
LPTSTR *arg = NULL;
INT argc;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Changes the current directory or displays it's name\n\n"
"CHDIR [drive:][path]\n"
"CHDIR[..|-]\n"
"CD [drive:][path]\n"
"CD[..|-]\n\n"
" .. parent directory\n"
" - previous directory\n\n"
"Type CD drive: to display the current directory on the specified drive.\n"
"Type CD without a parameter to display the current drive and directory."));
return 0;
}
/* check if there is no space between the command and the path */
if (param[0] == _T('\0'))
{
/* search for the '\', '.' or '-' so that both short & long names will work */
for (place = cmd; *place; place++)
if (*place == _T('.') || *place == _T('\\') || *place == _T('-'))
break;
if (*place)
dir = place;
else
/* signal that there are no parameters */
dir = NULL;
}
else
{
arg = split (param, &argc);
if (argc > 1)
{
/*JPP 20-Jul-1998 use standard error message */
error_too_many_parameters (param);
freep (arg);
return 1;
}
else
dir = arg[0];
}
/* if doing a CD and no parameters given, print out current directory */
if (!dir || !dir[0])
{
TCHAR szPath[MAX_PATH];
GetCurrentDirectory (MAX_PATH, szPath);
ConOutPuts (szPath);
freep (arg);
return 0;
}
if (dir && _tcslen (dir) == 1 && *dir == _T('-'))
{
if (lpLastPath)
dir = lpLastPath;
else
{
freep (arg);
return 0;
}
}
else if (dir && _tcslen (dir) > 1 && dir[1] == _T(':'))
{
TCHAR szRoot[3] = _T("A:");
TCHAR szPath[MAX_PATH];
szRoot[0] = _totupper (dir[0]);
GetFullPathName (szRoot, MAX_PATH, szPath, NULL);
/* PathRemoveBackslash */
if (_tcslen (szPath) > 3)
{
LPTSTR p = _tcsrchr (szPath, _T('\\'));
*p = _T('\0');
}
ConOutPuts (szPath);
freep (arg);
return 0;
}
/* remove trailing \ if any, but ONLY if dir is not the root dir */
if (_tcslen (dir) > 3 && dir[_tcslen (dir) - 1] == _T('\\'))
dir[_tcslen(dir) - 1] = _T('\0');
/* store current directory */
lpOldPath = (LPTSTR)malloc (MAX_PATH * sizeof(TCHAR));
GetCurrentDirectory (MAX_PATH, lpOldPath);
if (!SetCurrentDirectory (dir))
{
ErrorMessage (GetLastError(), _T("CD"));
/* throw away current directory */
free (lpOldPath);
lpOldPath = NULL;
freep (arg);
return 1;
}
else
{
if (lpLastPath)
free (lpLastPath);
lpLastPath = lpOldPath;
}
freep (arg);
return 0;
}
#endif
#ifdef INCLUDE_CMD_MKDIR
/*
* MD / MKDIR
*
*/
INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
{
LPTSTR dir; /* pointer to the directory to change to */
LPTSTR place; /* used to search for the \ when no space is used */
LPTSTR *p = NULL;
INT argc;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Creates a directory.\n\n"
"MKDIR [drive:]path\nMD [drive:]path"));
return 0;
}
/* check if there is no space between the command and the path */
if (param[0] == _T('\0'))
{
/* search for the \ or . so that both short & long names will work */
for (place = cmd; *place; place++)
if (*place == _T('.') || *place == _T('\\'))
break;
if (*place)
dir = place;
else
/* signal that there are no parameters */
dir = NULL;
}
else
{
p = split (param, &argc);
if (argc > 1)
{
/*JPP 20-Jul-1998 use standard error message */
error_too_many_parameters (param);
freep (p);
return 1;
}
else
dir = p[0];
}
/* remove trailing \ if any, but ONLY if dir is not the root dir */
if (_tcslen (dir) >= 2 && dir[_tcslen (dir) - 1] == _T('\\'))
dir[_tcslen(dir) - 1] = _T('\0');
if (!CreateDirectory (dir, NULL))
{
ErrorMessage (GetLastError(), _T("MD"));
freep (p);
return 1;
}
freep (p);
return 0;
}
#endif
#ifdef INCLUDE_CMD_RMDIR
/*
* RD / RMDIR
*
*/
INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
{
LPTSTR dir; /* pointer to the directory to change to */
LPTSTR place; /* used to search for the \ when no space is used */
LPTSTR *p = NULL;
INT argc;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Removes a directory.\n\n"
"RMDIR [drive:]path\nRD [drive:]path"));
return 0;
}
/* check if there is no space between the command and the path */
if (param[0] == _T('\0'))
{
/* search for the \ or . so that both short & long names will work */
for (place = cmd; *place; place++)
if (*place == _T('.') || *place == _T('\\'))
break;
if (*place)
dir = place;
else
/* signal that there are no parameters */
dir = NULL;
}
else
{
p = split (param, &argc);
if (argc > 1)
{
/*JPP 20-Jul-1998 use standard error message */
error_too_many_parameters (param);
freep (p);
return 1;
}
else
dir = p[0];
}
/* remove trailing \ if any, but ONLY if dir is not the root dir */
if (_tcslen (dir) >= 2 && dir[_tcslen (dir) - 1] == _T('\\'))
dir[_tcslen(dir) - 1] = _T('\0');
if (!RemoveDirectory (dir))
{
ErrorMessage (GetLastError(), _T("RD"));
freep (p);
return 1;
}
freep (p);
return 0;
}
#endif
/*
* set the exitflag to true
*
*/
INT internal_exit (LPTSTR cmd, LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Exits the command line interpreter.\n\nEXIT"));
}
else
{
bExit = TRUE;
}
return 0;
}
#ifdef INCLUDE_CMD_REM
/*
* does nothing
*
*/
INT cmd_rem (LPTSTR cmd, LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Starts a comment line in a batch file.\n\n"
"REM [Comment]"));
}
return 0;
}
#endif
INT cmd_showcommands (LPTSTR cmd, LPTSTR param)
{
LPCOMMAND cmdptr;
INT y;
y = 0;
cmdptr = cmds;
while (cmdptr->name)
{
if (++y == 8)
{
ConOutPuts (cmdptr->name);
y = 0;
}
else
ConOutPrintf (_T("%-10s"), cmdptr->name);
cmdptr++;
}
if (y != 0)
ConOutChar (_T('\n'));
return 0;
}

View File

@@ -1,120 +0,0 @@
/*
* LABEL.C - label internal command.
*
*
* History:
*
* 10-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Started.
*
* 11-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Finished.
*
* 19-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode ready!
*/
#include "config.h"
#ifdef INCLUDE_CMD_LABEL
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
INT cmd_label (LPTSTR cmd, LPTSTR param)
{
TCHAR szRootPath[] = _T("A:\\");
TCHAR szLabel[80];
TCHAR szOldLabel[80];
DWORD dwSerialNr;
LPTSTR *arg;
INT args;
/* set empty label string */
szLabel[0] = _T('\0');
/* print help */
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays or changes drive label.\n\n"
"LABEL [drive:][label]"));
return 0;
}
/* get parameters */
arg = split (param, &args);
if (args > 2)
{
/* too many parameters */
error_too_many_parameters (arg[args - 1]);
freep (arg);
return 1;
}
if (args == 0)
{
/* get label of current drive */
TCHAR szCurPath[MAX_PATH];
GetCurrentDirectory (MAX_PATH, szCurPath);
szRootPath[0] = szCurPath[0];
}
else
{
if ((_tcslen (arg[0]) >= 2) && (arg[0][1] == _T(':')))
{
szRootPath[0] = toupper (*arg[0]);
if (args == 2)
_tcsncpy (szLabel, arg[1], 12);
}
else
{
TCHAR szCurPath[MAX_PATH];
GetCurrentDirectory (MAX_PATH, szCurPath);
szRootPath[0] = szCurPath[0];
_tcsncpy (szLabel, arg[0], 12);
}
}
/* check root path */
if (!IsValidPathName (szRootPath))
{
error_invalid_drive ();
freep (arg);
return 1;
}
GetVolumeInformation (szRootPath, szOldLabel, 80, &dwSerialNr,
NULL, NULL, NULL, 0);
/* print drive info */
ConOutPrintf (_T("Volume in drive %c:"), _totupper (szRootPath[0]));
if (szOldLabel[0] != _T('\0'))
ConOutPrintf (_T(" is %s\n"), szOldLabel);
else
ConOutPrintf (_T(" has no label\n"));
/* print the volume serial number */
ConOutPrintf (_T("Volume Serial Number is %04X-%04X\n"),
HIWORD(dwSerialNr), LOWORD(dwSerialNr));
if (szLabel[0] == _T('\0'))
{
ConOutPrintf (_T("Drive label (11 Characters, ENTER if none)? "));
ConInString (szLabel, 80);
}
SetVolumeLabel (szRootPath, szLabel);
freep (arg);
return 0;
}
#endif /* INCLUDE_CMD_LABEL */

View File

@@ -1,342 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -1,116 +0,0 @@
/*
* LOCALE.C - locale handling.
*
*
* History:
*
* 09-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Started.
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode safe!
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include "cmd.h"
TCHAR cDateSeparator;
TCHAR cTimeSeparator;
TCHAR cThousandSeparator;
TCHAR cDecimalSeparator;
INT nDateFormat;
INT nTimeFormat;
TCHAR aszDayNames[7][8];
INT nNumberGroups;
VOID InitLocale (VOID)
{
#ifdef LOCALE_WINDOWS
TCHAR szBuffer[256];
INT i;
/* date settings */
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDATE, szBuffer, 256);
CharToOem (szBuffer, szBuffer);
cDateSeparator = szBuffer[0];
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDATE, szBuffer, 256);
nDateFormat = _ttoi (szBuffer);
/* time settings */
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STIME, szBuffer, 256);
CharToOem (szBuffer, szBuffer);
cTimeSeparator = szBuffer[0];
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_ITIME, szBuffer, 256);
nTimeFormat = _ttoi (szBuffer);
/* number settings */
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szBuffer, 256);
CharToOem (szBuffer, szBuffer);
cThousandSeparator = szBuffer[0];
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szBuffer, 256);
CharToOem (szBuffer, szBuffer);
cDecimalSeparator = szBuffer[0];
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SGROUPING, szBuffer, 256);
nNumberGroups = _ttoi (szBuffer);
/* days of week */
for (i = 0; i < 7; i++)
{
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + i, szBuffer, 256);
CharToOem (szBuffer, szBuffer);
_tcscpy (aszDayNames[(i+1)%7], szBuffer); /* little hack */
}
#endif
#ifdef LOCALE_GERMAN
LPTSTR names [7] = {_T("So"), _T("Mo"), _T("Di"), _T("Mi"), _T("Do"), _T("Fr"), _T("Sa")};
INT i;
/* date settings */
cDateSeparator = '.';
nDateFormat = 1; /* ddmmyy */
/* time settings */
cTimeSeparator = ':';
nTimeFormat = 1; /* 24 hour */
/* number settings */
cThousandSeparator = '.';
cDecimalSeparator = ',';
nNumberGroups = 3;
/* days of week */
for (i = 0; i < 7; i++)
_tcscpy (aszDayNames[i], names[i]);
#endif
#ifdef LOCALE_DEFAULT
LPTSTR names [7] = {_T("Son"), _T("Mon"), _T("Tue"), _T("Wed"), _T("Thu"), _T("Fri"), _T("Sat")};
INT i;
/* date settings */
cDateSeparator = '-';
nDateFormat = 0; /* mmddyy */
/* time settings */
cTimeSeparator = ':';
nTimeFormat = 0; /* 12 hour */
/* number settings */
cThousandSeparator = ',';
cDecimalSeparator = '.';
nNumberGroups = 3;
/* days of week */
for (i = 0; i < 7; i++)
_tcscpy (aszDayNames[i], names[i]);
#endif
}

View File

@@ -1,32 +0,0 @@
#
# ReactOS makefile for CMD
#
all: cmd.exe
OBJECTS = ../common/crt0.o cmd.o attrib.o alias.o batch.o beep.o call.o \
chcp.o cls.o cmdinput.o cmdtable.o color.o console.o copy.o date.o \
del.o dir.o dirstack.o echo.o error.o filecomp.o for.o goto.o \
history.o if.o internal.o label.o locale.o misc.o move.o path.o \
pause.o prompt.o redir.o ren.o set.o shift.o time.o title.o type.o \
ver.o verify.o vol.o where.o
LIBS= ../../lib/kernel32/kernel32.a ../../lib/crtdll/crtdll.a
CLEAN_FILES = *.o cmd.exe cmd.sym
clean: $(CLEAN_FILES:%=%_clean)
$(CLEAN_FILES:%=%_clean): %_clean:
- $(RM) $*
.phony: clean $(CLEAN_FILES:%=%_clean)
cmd.exe: $(OBJECTS) $(LIBS)
$(CC) -specs=../../specs $(OBJECTS) $(LIBS) -lgcc -o cmd.exe
$(NM) --numeric-sort cmd.exe > cmd.sym
include ../../rules.mak

View File

@@ -1,194 +0,0 @@
# ReactOS cmd.exe makefile for lcc-win32
# 19990119 Emanuele Aliberti <ea@iol.it>
# 19990127 EA
# 19990128 Eric Kohl <ekohl@abo.rhein-zeitung.de>
# Modified for cmd 0.0.4pre3.
#
# ReactOS : http://www.sid-dis.com/reactos/
# Lcc-Win32: http://www.cs.virginia.edu/*lcc-win32
#
TARGET=cmd
CC=lcc.exe
CFLAGS=-c -O
LD=lcclnk.exe
LFLAGS=-subsystem console -s -o $(TARGET).exe
OBJS=alias.obj \
attrib.obj \
batch.obj \
beep.obj \
call.obj \
chcp.obj \
cls.obj \
cmd.obj \
cmdinput.obj \
cmdtable.obj \
color.obj \
console.obj \
copy.obj \
date.obj \
del.obj \
dir.obj \
dirstack.obj \
echo.obj \
error.obj \
filecomp.obj \
for.obj \
goto.obj \
history.obj \
if.obj \
internal.obj \
label.obj \
locale.obj \
misc.obj \
move.obj \
path.obj \
pause.obj \
prompt.obj \
redir.obj \
ren.obj \
set.obj \
shift.obj \
time.obj \
type.obj \
ver.obj \
verify.obj \
vol.obj \
where.obj
# MAIN
# What about this implicid rule?
# It should compile all c files.
# (To test this, uncomment the following two lines.) EK
#.c.obj:
# $(CC) $(CFLAGS) $<
$(TARGET).exe: $(OBJS)
$(LD) $(LFLAGS) $(OBJS)
# MODULES
alias.obj: alias.c
$(CC) $(CFLAGS) alias.c
attrib.obj: attrib.c
$(CC) $(CFLAGS) attrib.c
batch.obj: batch.c
$(CC) $(CFLAGS) batch.c
beep.obj: beep.c
$(CC) $(CFLAGS) beep.c
call.obj: call.c
$(CC) $(CFLAGS) call.c
cls.obj: cls.c
$(CC) $(CFLAGS) cls.c
cmd.obj: cmd.c
$(CC) $(CFLAGS) cmd.c
cmdinput.obj: cmdinput.c
$(CC) $(CFLAGS) cmdinput.c
cmdtable.obj: cmdtable.c
$(CC) $(CFLAGS) cmdtable.c
color.obj: color.c
$(CC) $(CFLAGS) color.c
console.obj: console.c
$(CC) $(CFLAGS) console.c
copy.obj: copy.c
$(CC) $(CFLAGS) copy.c
date.obj: date.c
$(CC) $(CFLAGS) date.c
del.obj: del.c
$(CC) $(CFLAGS) del.c
dir.obj: dir.c
$(CC) $(CFLAGS) dir.c
dirstack.obj: dirstack.c
$(CC) $(CFLAGS) dirstack.c
echo.obj: echo.c
$(CC) $(CFLAGS) echo.c
error.obj: error.c
$(CC) $(CFLAGS) error.c
filecomp.obj: filecomp.c
$(CC) $(CFLAGS) filecomp.c
for.obj: for.c
$(CC) $(CFLAGS) for.c
goto.obj: goto.c
$(CC) $(CFLAGS) goto.c
history.obj: history.c
$(CC) $(CFLAGS) history.c
if.obj: if.c
$(CC) $(CFLAGS) if.c
internal.obj: internal.c
$(CC) $(CFLAGS) internal.c
label.obj: label.c
$(CC) $(CFLAGS) label.c
locale.obj: locale.c
$(CC) $(CFLAGS) locale.c
misc.obj: misc.c
$(CC) $(CFLAGS) misc.c
move.obj: move.c
$(CC) $(CFLAGS) move.c
path.obj: path.c
$(CC) $(CFLAGS) path.c
pause.obj: pause.c
$(CC) $(CFLAGS) pause.c
prompt.obj: prompt.c
$(CC) $(CFLAGS) prompt.c
redir.obj: redir.c
$(CC) $(CFLAGS) redir.c
ren.obj: ren.c
$(CC) $(CFLAGS) ren.c
set.obj: set.c
$(CC) $(CFLAGS) set.c
shift.obj: shift.c
$(CC) $(CFLAGS) shift.c
time.obj: time.c
$(CC) $(CFLAGS) time.c
type.obj: type.c
$(CC) $(CFLAGS) type.c
ver.obj: ver.c
$(CC) $(CFLAGS) ver.c
verify.obj: verify.c
$(CC) $(CFLAGS) verify.c
vol.obj: vol.c
$(CC) $(CFLAGS) vol.c
where.obj: where.c
$(CC) $(CFLAGS) where.c
#EOF

View File

@@ -1,297 +0,0 @@
/*
* MISC.C - misc. functions.
*
*
* History:
*
* 07/12/98 (Rob Lake)
* started
*
* 07/13/98 (Rob Lake)
* moved functions in here
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 18-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Changed split() to accept quoted arguments.
* Removed parse_firstarg().
*
* 23-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed an ugly bug in split(). In rare cases (last character
* of the string is a space) it ignored the NULL character and
* tried to add the following to the argument list.
*
* 28-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* FileGetString() seems to be working now.
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "cmd.h"
/*
* get a character out-of-band and honor Ctrl-Break characters
*/
TCHAR cgetchar (VOID)
{
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
INPUT_RECORD irBuffer;
DWORD dwRead;
do
{
ReadConsoleInput (hInput, &irBuffer, 1, &dwRead);
if ((irBuffer.EventType == KEY_EVENT) &&
(irBuffer.Event.KeyEvent.bKeyDown == TRUE))
{
if ((irBuffer.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) &
(irBuffer.Event.KeyEvent.wVirtualKeyCode == 'C'))
bCtrlBreak = TRUE;
break;
}
}
while (TRUE);
#ifndef _UNICODE
return irBuffer.Event.KeyEvent.uChar.AsciiChar;
#else
return irBuffer.Event.KeyEvent.uChar.UnicodeChar;
#endif /* _UNICODE */
}
/*
* Check if Ctrl-Break was pressed during the last calls
*/
BOOL CheckCtrlBreak (INT mode)
{
static BOOL bLeaveAll = FALSE; /* leave all batch files */
TCHAR c;
switch (mode)
{
case BREAK_OUTOFBATCH:
bLeaveAll = 0;
return FALSE;
case BREAK_BATCHFILE:
if (bLeaveAll)
return TRUE;
if (!bCtrlBreak)
return FALSE;
/* we need to be sure the string arrives on the screen! */
do
ConOutPuts (_T("\r\nCtrl-Break pressed. Cancel batch file? (Yes/No/All) "));
while (!_tcschr ("YNA\3", c = _totupper (cgetchar())) || !c);
ConOutPuts (_T("\r\n"));
if (c == _T('N'))
return bCtrlBreak = FALSE; /* ignore */
/* leave all batch files */
bLeaveAll = ((c == _T('A')) || (c == _T('\3')));
break;
case BREAK_INPUT:
if (!bCtrlBreak)
return FALSE;
break;
}
/* state processed */
bCtrlBreak = FALSE;
return TRUE;
}
/*
* split - splits a line up into separate arguments, deliminators
* are spaces and slashes ('/').
*/
LPTSTR *split (LPTSTR s, LPINT args)
{
LPTSTR *arg;
LPTSTR *p;
LPTSTR start;
LPTSTR q;
INT ac;
INT len;
BOOL bQuoted = FALSE;
arg = malloc (sizeof (LPTSTR));
if (!arg)
return NULL;
*arg = NULL;
ac = 0;
while (*s)
{
/* skip leading spaces */
while (*s && (_istspace (*s) || _istcntrl (*s)))
++s;
/* if quote (") then set bQuoted */
if (*s == _T('\"'))
{
++s;
bQuoted = TRUE;
}
start = s;
/* the first character can be '/' */
if (*s == _T('/'))
++s;
/* skip to next word delimiter or start of next option */
if (bQuoted)
{
while (_istprint (*s) && (*s != _T('\"')) && (*s != _T('/')))
++s;
}
else
{
while (_istprint (*s) && !_istspace (*s) && (*s != _T('/')))
++s;
}
/* a word was found */
if (s != start)
{
/* add new entry for new argument */
arg = realloc (p = arg, (ac + 2) * sizeof (LPTSTR));
if (!arg)
{
freep (p);
return NULL;
}
/* create new entry */
q = arg[ac] = malloc (((len = s - start) + 1) * sizeof (TCHAR));
arg[++ac] = NULL;
if (!q)
{
freep (arg);
return NULL;
}
memcpy (q, start, len * sizeof (TCHAR));
q[len] = _T('\0');
}
/* adjust string pointer if quoted (") */
if (bQuoted)
{
++s;
bQuoted = FALSE;
}
}
*args = ac;
return arg;
}
/*
* freep -- frees memory used for a call to split
*
*/
VOID freep (LPTSTR *p)
{
LPTSTR *q;
if (!p)
return;
q = p;
while (*q)
free(*q++);
free(p);
}
LPTSTR stpcpy (LPTSTR dest, LPTSTR src)
{
_tcscpy (dest, src);
return (dest + _tcslen (src));
}
/*
* Checks if a path is valid (accessible)
*/
BOOL IsValidPathName (LPCTSTR pszPath)
{
TCHAR szOldPath[MAX_PATH];
BOOL bResult;
GetCurrentDirectory (MAX_PATH, szOldPath);
bResult = SetCurrentDirectory (pszPath);
SetCurrentDirectory (szOldPath);
return bResult;
}
/*
* Checks if a file exists (accessible)
*/
BOOL IsValidFileName (LPCTSTR pszPath)
{
return (GetFileAttributes (pszPath) != 0xFFFFFFFF);
}
BOOL IsValidDirectory (LPCTSTR pszPath)
{
return (GetFileAttributes (pszPath) & FILE_ATTRIBUTE_DIRECTORY);
}
BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength)
{
LPTSTR lpString;
TCHAR ch;
DWORD dwRead;
lpString = lpBuffer;
while ((--nBufferLength > 0) &&
ReadFile(hFile, &ch, 1, &dwRead, NULL) && dwRead)
{
*lpString++ = ch;
if (ch == _T('\r'))
{
/* overread '\n' */
ReadFile (hFile, &ch, 1, &dwRead, NULL);
break;
}
}
if (!dwRead && lpString == lpBuffer)
return FALSE;
*lpString++ = _T('\0');
return TRUE;
}

View File

@@ -1,266 +0,0 @@
/*
* MOVE.C - move internal command.
*
*
* History:
*
* 14-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Started.
*
* 18-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode safe!
* Preliminary version!!!
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection safe!
*
* 27-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("/?").
* Added more error checks.
*
* 03-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added "/N" option.
*/
#include "config.h"
#ifdef INCLUDE_CMD_MOVE
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
#define OVERWRITE_NO 0
#define OVERWRITE_YES 1
#define OVERWRITE_ALL 2
#define OVERWRITE_CANCEL 3
static INT Overwrite (LPTSTR fn)
{
TCHAR inp[10];
LPTSTR p;
ConOutPrintf (_T("Overwrite %s (Yes/No/All)? "), fn);
ConInString (inp, 10);
_tcsupr (inp);
for (p=inp; _istspace (*p); p++)
;
if (*p != _T('Y') && *p != _T('A'))
return OVERWRITE_NO;
if (*p == _T('A'))
return OVERWRITE_ALL;
return OVERWRITE_YES;
}
INT cmd_move (LPTSTR cmd, LPTSTR param)
{
LPTSTR *arg;
INT argc, i, nFiles;
TCHAR szDestPath[MAX_PATH];
TCHAR szSrcPath[MAX_PATH];
BOOL bPrompt = TRUE;
LPTSTR p;
WIN32_FIND_DATA findBuffer;
HANDLE hFile;
LPTSTR pszFile;
BOOL bNothing = FALSE;
if (!_tcsncmp (param, _T("/?"), 2))
{
#if 0
ConOutPuts (_T("Moves files and renames files and directories.\n\n"
"To move one or more files:\n"
"MOVE [/N][/Y|/-Y][drive:][path]filename1[,...] destination\n"
"\n"
"To rename a directory:\n"
"MOVE [/N][/Y|/-Y][drive:][path]dirname1 dirname2\n"
"\n"
" [drive:][path]filename1 Specifies the location and name of the file\n"
" or files you want to move.\n"
" /N Nothing. Don everthing but move files or direcories.\n"
" /Y\n"
" /-Y\n"
"..."));
#else
ConOutPuts (_T("Moves files and renames files and directories.\n\n"
"To move one or more files:\n"
"MOVE [/N][drive:][path]filename1[,...] destination\n"
"\n"
"To rename a directory:\n"
"MOVE [/N][drive:][path]dirname1 dirname2\n"
"\n"
" [drive:][path]filename1 Specifies the location and name of the file\n"
" or files you want to move.\n"
" /N Nothing. Don everthing but move files or direcories.\n"
"\n"
"Current limitations:\n"
" - You can't move a file or directory from one drive to another.\n"
));
#endif
return 0;
}
arg = split (param, &argc);
nFiles = argc;
/* read options */
for (i = 0; i < argc; i++)
{
p = arg[i];
if (*p == _T('/'))
{
p++;
if (*p == _T('-'))
{
p++;
if (_totupper (*p) == _T('Y'))
bPrompt = TRUE;
}
else
{
if (_totupper (*p) == _T('Y'))
bPrompt = FALSE;
else if (_totupper (*p) == _T('N'))
bNothing = TRUE;
}
nFiles--;
}
}
if (nFiles < 2)
{
/* there must be at least two pathspecs */
error_req_param_missing ();
return 1;
}
/* get destination */
GetFullPathName (arg[argc - 1], MAX_PATH, szDestPath, NULL);
#ifdef _DEBUG
DebugPrintf (_T("Destination: %s\n"), szDestPath);
#endif
/* move it*/
for (i = 0; i < argc - 1; i++)
{
if (*arg[i] == _T('/'))
continue;
hFile = FindFirstFile (arg[i], &findBuffer);
if (hFile == INVALID_HANDLE_VALUE)
{
ErrorMessage (GetLastError (), arg[i]);
freep (arg);
return 1;
}
do
{
GetFullPathName (findBuffer.cFileName, MAX_PATH, szSrcPath, &pszFile);
if (GetFileAttributes (szSrcPath) & FILE_ATTRIBUTE_DIRECTORY)
{
/* source is directory */
#ifdef _DEBUG
DebugPrintf (_T("Move directory \'%s\' to \'%s\'\n"),
szSrcPath, szDestPath);
#endif
if (!bNothing)
{
MoveFile (szSrcPath, szDestPath);
}
}
else
{
/* source is file */
if (IsValidFileName (szDestPath))
{
/* destination exists */
if (GetFileAttributes (szDestPath) & FILE_ATTRIBUTE_DIRECTORY)
{
/* destination is existing directory */
TCHAR szFullDestPath[MAX_PATH];
_tcscpy (szFullDestPath, szDestPath);
_tcscat (szFullDestPath, _T("\\"));
_tcscat (szFullDestPath, pszFile);
ConOutPrintf (_T("%s => %s"), szSrcPath, szFullDestPath);
if (!bNothing)
{
if (MoveFile (szSrcPath, szFullDestPath))
ConOutPrintf (_T("[OK]\n"));
else
ConOutPrintf (_T("[Error]\n"));
}
}
else
{
/* destination is existing file */
INT nOverwrite;
/* must get the overwrite code */
if ((nOverwrite = Overwrite (szDestPath)))
{
#if 0
if (nOverwrite == OVERWRITE_ALL)
*lpFlags |= FLAG_OVERWRITE_ALL;
#endif
ConOutPrintf (_T("%s => %s"), szSrcPath, szDestPath);
if (!bNothing)
{
if (MoveFile (szSrcPath, szDestPath))
ConOutPrintf (_T("[OK]\n"));
else
ConOutPrintf (_T("[Error]\n"));
}
}
}
}
else
{
/* destination does not exist */
TCHAR szFullDestPath[MAX_PATH];
GetFullPathName (szDestPath, MAX_PATH, szFullDestPath, NULL);
ConOutPrintf (_T("%s => %s"), szSrcPath, szFullDestPath);
if (!bNothing)
{
if (MoveFile (szSrcPath, szFullDestPath))
ConOutPrintf (_T("[OK]\n"));
else
ConOutPrintf (_T("[Error]\n"));
}
}
}
}
while (FindNextFile (hFile, &findBuffer));
FindClose (hFile);
}
freep (arg);
return 0;
}
#endif /* INCLUDE_CMD_MOVE */

View File

@@ -1,90 +0,0 @@
/*
* PATH.C - path internal command.
*
*
* History:
*
* 17 Jul 1998 (John P Price)
* Separated commands into individual files.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 09-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("/?").
*
* 18-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode ready!
*
* 18-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection safe!
*
* 24-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed Win32 environment handling.
*/
#include "config.h"
#ifdef INCLUDE_CMD_PATH
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include "cmd.h"
/* size of environment variable buffer */
#define ENV_BUFFER_SIZE 1024
INT cmd_path (LPTSTR cmd, LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays or sets a search path for executable files.\n\n"
"PATH [[drive:]path[;...]]\nPATH ;\n\n"
"Type PATH ; to clear all search-path settings and direct the command shell\n"
"to search only in the current directory.\n"
"Type PATH without parameters to display the current path.\n"));
return 0;
}
/* if param is empty, display the PATH environment variable */
if (!param || !*param)
{
DWORD dwBuffer;
LPTSTR pszBuffer;
pszBuffer = (LPTSTR)malloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
if (dwBuffer == 0)
{
ConErrPrintf ("CMD: Not in environment \"PATH\"\n");
return 0;
}
else if (dwBuffer > ENV_BUFFER_SIZE)
{
pszBuffer = (LPTSTR)realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
}
ConOutPrintf (_T("PATH=%s\n"), pszBuffer);
free (pszBuffer);
return 0;
}
/* skip leading '=' */
if (*param == _T('='))
param++;
/* set PATH environment variable */
if (!SetEnvironmentVariable (_T("PATH"), param))
return 1;
return 0;
}
#endif

View File

@@ -1,66 +0,0 @@
/*
* PAUSE.C - pause internal command.
*
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
*
* 16 Jul 1998 (John P Price)
* Seperated commands into individual files.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 18-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode ready!
*/
#include "config.h"
#ifdef INCLUDE_CMD_PAUSE
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
#include "batch.h"
/*
* Perform PAUSE command.
*
* FREEDOS extension : If parameter is specified use that as the pause
* message.
*
* ?? Extend to include functionality of CHOICE if switch chars
* specified.
*/
INT cmd_pause (LPTSTR cmd, LPTSTR param)
{
#ifdef _DEBUG
DebugPrintf ("cmd_pause: \'%s\' : \'%s\'\n", cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Stops the execution of a batch file and shows the following message:\n"
"\"Press any key to continue...\" or a user defined message.\n\n"
"PAUSE [message]"));
return 0;
}
if (*param)
ConOutPrintf (param);
else
msg_pause ();
cgetchar ();
return 0;
}
#endif

View File

@@ -1,294 +0,0 @@
/*
* PROMPT.C - prompt handling.
*
*
* History:
*
* 14/01/95 (Tim Normal)
* started.
*
* 08/08/95 (Matt Rains)
* i have cleaned up the source code. changes now bring this source
* into guidelines for recommended programming practice.
*
* 01/06/96 (Tim Norman)
* added day of the week printing (oops, forgot about that!)
*
* 08/07/96 (Steffan Kaiser)
* small changes for speed
*
* 20-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* removed redundant day strings. Use ones defined in date.c.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 28-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* moved cmd_prompt from internal.c to here
*
* 09-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("/?").
*
* 14-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added "$+" option.
*
* 09-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added "$A", "$C" and "$F" option.
* Added locale support.
* Fixed "$V" option.
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
*
* 24-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed Win32 environment handling.
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
static VOID PrintDate (VOID)
{
#ifdef __REACTOS__
SYSTEMTIME st;
GetLocalTime (&st);
switch (nDateFormat)
{
case 0: /* mmddyy */
default:
ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
aszDayNames[st.wDayOfWeek], st.wMonth, cDateSeparator, st.wDay, cDateSeparator, st.wYear);
break;
case 1: /* ddmmyy */
ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
aszDayNames[st.wDayOfWeek], st.wDay, cDateSeparator, st.wMonth, cDateSeparator, st.wYear);
break;
case 2: /* yymmdd */
ConOutPrintf (_T("%s %04d%c%02d%c%02d"),
aszDayNames[st.wDayOfWeek], st.wYear, cDateSeparator, st.wMonth, cDateSeparator, st.wDay);
break;
}
#else
TCHAR szDate[32];
GetDateFormat (LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,
szDate, sizeof (szDate));
ConOutPrintf (_T("%s"), szDate);
#endif
}
static VOID
PrintTime (VOID)
{
#ifdef __REACTOS__
SYSTEMTIME st;
GetLocalTime (&st);
switch (nTimeFormat)
{
case 0: /* 12 hour format */
default:
ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d%c"),
(st.wHour == 0 ? 12 : (st.wHour <= 12 ? st.wHour : st.wHour - 12)),
cTimeSeparator, st.wMinute, cTimeSeparator, st.wSecond, cDecimalSeparator,
st.wMilliseconds / 10, (st.wHour <= 11 ? 'a' : 'p'));
break;
case 1: /* 24 hour format */
ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d"),
st.wHour, cTimeSeparator, st.wMinute, cTimeSeparator,
st.wSecond, cDecimalSeparator, st.wMilliseconds / 10);
break;
}
#else
TCHAR szTime[32];
GetTimeFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL,
szTime, sizeof (szTime));
ConOutPrintf (_T("%s"), szTime);
#endif
}
/*
* print the command-line prompt
*
*/
VOID PrintPrompt(VOID)
{
static TCHAR default_pr[] = _T("$P$G");
TCHAR szPrompt[256];
LPTSTR pr;
if (GetEnvironmentVariable (_T("PROMPT"), szPrompt, 256))
pr = szPrompt;
else
pr = default_pr;
while (*pr)
{
if (*pr != _T('$'))
{
ConOutChar (*pr);
}
else
{
pr++;
switch (_totupper (*pr))
{
case _T('A'):
ConOutChar (_T('&'));
break;
case _T('B'):
ConOutChar (_T('|'));
break;
case _T('C'):
ConOutChar (_T('('));
break;
case _T('D'):
PrintDate ();
break;
case _T('E'):
ConOutChar (_T('\x1B'));
break;
case _T('F'):
ConOutChar (_T(')'));
break;
case _T('G'):
ConOutChar (_T('>'));
break;
case _T('H'):
ConOutChar (_T('\x08'));
break;
case _T('L'):
ConOutChar (_T('<'));
break;
case _T('N'):
{
TCHAR szPath[MAX_PATH];
GetCurrentDirectory (MAX_PATH, szPath);
ConOutChar (szPath[0]);
}
break;
case _T('P'):
{
TCHAR szPath[MAX_PATH];
GetCurrentDirectory (MAX_PATH, szPath);
ConOutPrintf (_T("%s"), szPath);
}
break;
case _T('Q'):
ConOutChar (_T('='));
break;
case _T('T'):
PrintTime ();
break;
case _T('V'):
switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_WINDOWS:
if (osvi.dwMajorVersion == 4 &&
osvi.dwMinorVersion == 1)
ConOutPrintf (_T("Windows 98"));
else
ConOutPrintf (_T("Windows 95"));
break;
case VER_PLATFORM_WIN32_NT:
ConOutPrintf (_T("Windows NT Version %lu.%lu"),
osvi.dwMajorVersion, osvi.dwMinorVersion);
break;
}
break;
case _T('_'):
ConOutChar (_T('\n'));
break;
case '$':
ConOutChar (_T('$'));
break;
#ifdef FEATURE_DIRECTORY_STACK
case '+':
{
INT i;
for (i = 0; i < GetDirectoryStackDepth (); i++)
ConOutChar (_T('+'));
}
break;
#endif
}
}
pr++;
}
}
#ifdef INCLUDE_CMD_PROMPT
INT cmd_prompt (LPTSTR cmd, LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Changes the command prompt.\n\n"
"PROMPT [text]\n\n"
" text Specifies a new command prompt.\n\n"
"Prompt can be made up of normal characters and the following special codes:\n\n"
" $A & (Ampersand)\n"
" $B | (pipe)\n"
" $C ( (Left parenthesis)\n"
" $D Current date\n"
" $E Escape code (ASCII code 27)\n"
" $F ) (Right parenthesis)\n"
" $G > (greater-than sign)\n"
" $H Backspace (erases previous character)\n"
" $L < (less-than sign)\n"
" $N Current drive\n"
" $P Current drive and path\n"
" $Q = (equal sign)\n"
" $T Current time\n"
" $V OS version number\n"
" $_ Carriage return and linefeed\n"
" $$ $ (dollar sign)"));
#ifdef FEATURE_DIRECTORY_STACK
ConOutPuts (_T(" $+ Displays the current depth of the directory stack"));
#endif
ConOutPuts (_T("\nType PROMPT without parameters to reset the prompt to the default setting."));
return 0;
}
/* set PROMPT environment variable */
if (!SetEnvironmentVariable (_T("PROMPT"), param))
return 1;
return 0;
}
#endif

View File

@@ -1,101 +0,0 @@
ReactOS Command Line Interface "CMD" version 0.1 pre 2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the fourth pre-alpha release of CMD.EXE for ReactOS.
It was converted from the FreeDOS COMMAND.COM.
Warning!! Warning!! Warning!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is an alpha version! Many features have not been tested!
Be careful when you use commands that write to your disk drives,
they might destroy your files or the file system!!!
Status
~~~~~~
This is a converted version of FreeDOS COMMAND.COM.
I added some commands from WinNT's CMD.EXE.
New features and improvements
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fixed redirection and piping.
(E.g. you can use "type > file" now.)
- Added new error redirections "2>" and "2>>".
(E.g.: "make 2>error.log")
- Added CHCP command.
- Fixed environment handling.
- New makefile for lcc-win (makefile.lcc).
- Rewrote DEL and MOVE with a new structure.
- Improved national language support.
- Fixed filename completion.
Compiling
~~~~~~~~~
I converted CMD using MS Visual C++ 5.0 and Win95. The included makefile
is just an experimental version.
If you want to compile and test CMD with djgpp, modify the makefile as needed.
I put the CMD sources into [reactos\apps], the makefile is written for that
directory.
If you want to compile and test CMD using another compiler, just create
a new console application project and add all *.c and *.h files to it.
It should compile without an error.
Please report bugs which are not listed above.
Good luck
Eric Kohl <ekohl@abo.rhein-zeitung.de>
FreeDOS Command Line Interface
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
About
~~~~~
This software is part of the FreeDOS project. Please email
freedos@sunsite.unc.edu for more information, or visit the freedos
archive at "ftp://sunsite.unc.edu/pub/micro/pc-stuff/freedos". Also,
visit our web page at http://www.freedos.org/.
The command.com web site is at
http://www.gcfl.net/FreeDOS/command.com/
This software has been developed by the following people:
(listed in approximate chronological order of contributions)
FreeDOS developers:
normat@rpi.edu (Tim Norman)
mrains@apanix.apana.org.au (Matt Rains)
ejeffrey@iastate.edu (Evan Jeffrey)
Steffen.Kaiser@Informatik.TU-Chemnitz.DE (Steffen Kaiser)
Svante Frey (sfrey@kuai.se)
Oliver Mueller (ogmueller@t-online.de)
Aaron Kaufman (morgan@remarque.berkeley.edu)
Marc Desrochers (bitzero@hotmail.com)
Rob Lake (rlake@cs.mun.ca)
John P. Price <linux-guru@gcfl.net>
Hans B Pufal <hansp@digiweb.com>
ReactOS developers:
Eric Kohl <ekohl@abo.rhein-zeitung.de>
Current Features
~~~~~~~~~~~~~~~~
- environment handling with prompt and path support.
- directory utilities.
- command-line history with doskey-like features.
- batch file processing.
- input/output redirection and piping.
- alias support.
- filename completion (use TAB)

View File

@@ -1,216 +0,0 @@
/*
* REDIR.C - redirection handling.
*
*
* History:
*
* 12/15/95 (Tim Norman)
* started.
*
* 12 Jul 98 (Hans B Pufal)
* Rewrote to make more efficient and to conform to new command.c
* and batch.c processing.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* Added config.h include
*
* 22-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode safe!
* Added new error redirection "2>" and "2>>".
*
* 26-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added new error AND output redirection "&>" and "&>>".
*/
#include "config.h"
#ifdef FEATURE_REDIRECTION
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
static BOOL
IsRedirection (TCHAR c)
{
return (c == _T('<')) || (c == _T('>')) || (c == _T('|'));
}
/*
* Gets the redirection info from the command line and copies the
* file names into ifn, ofn and efn removing them from the command
* line.
*
* Converts remaining command line into a series of null terminated
* strings defined by the pipe char '|'. Each string corresponds
* to a single executable command. A double null terminates the
* command strings.
*
* Return number of command strings found.
*
*/
INT GetRedirection (LPTSTR s, LPTSTR ifn, LPTSTR ofn, LPTSTR efn, LPINT lpnFlags)
{
INT num = 1;
LPTSTR dp = s;
LPTSTR sp = s;
/* find and remove all the redirections first */
while (*sp)
{
if ((*sp == _T('"')) || (*sp == _T('\'')))
{
/* No redirects inside quotes */
TCHAR qc = *sp;
do
*dp++ = *sp++;
while (*sp && *sp != qc);
*dp++ = *sp++;
}
else if ((*sp == _T('<')) || (*sp == _T('>')) ||
(*sp == _T('2')) || (*sp == _T('&')))
{
/* MS-DOS ignores multiple redirection symbols and uses the last */
/* redirection, so we'll emulate that and not check */
if (*sp == _T('<'))
{
/* input redirection */
*lpnFlags |= INPUT_REDIRECTION;
while (_istspace (*sp))
sp++;
/* copy file name */
while (*sp && !IsRedirection (*sp) && !_istspace (*sp))
*ifn++ = *sp++;
*ifn = _T('\0');
}
else if (*sp == _T('>'))
{
/* output redirection */
*lpnFlags |= OUTPUT_REDIRECTION;
sp++;
/* append request ? */
if (*sp == _T('>'))
{
*lpnFlags |= OUTPUT_APPEND;
sp++;
}
while (_istspace (*sp))
sp++;
/* copy file name */
while (*sp && !IsRedirection (*sp) && !_istspace (*sp))
*ofn++ = *sp++;
*ofn = _T('\0');
}
else if (*sp == _T('2'))
{
/* error redirection */
sp++;
if (*sp == _T('>'))
{
*lpnFlags |= ERROR_REDIRECTION;
sp++;
/* append request ? */
if (*sp == _T('>'))
{
*lpnFlags |= ERROR_APPEND;
sp++;
}
}
else
{
/* no redirection!! copy the '2' character! */
sp--;
*dp++ = *sp++;
continue;
}
while (_istspace (*sp))
sp++;
/* copy file name */
while (*sp && !IsRedirection (*sp) && !_istspace (*sp))
*efn++ = *sp++;
*efn = _T('\0');
}
else if (*sp == _T('&'))
{
/* output AND error redirection */
sp++;
if (*sp == _T('>'))
{
*lpnFlags |= (ERROR_REDIRECTION | OUTPUT_REDIRECTION);
sp++;
/* append request ? */
if (*sp == _T('>'))
{
*lpnFlags |= (ERROR_APPEND | OUTPUT_APPEND);
sp++;
}
}
else
{
/* no redirection!! copy the '&' character! */
sp--;
*dp++ = *sp++;
continue;
}
while (_istspace (*sp))
sp++;
/* copy file name */
while (*sp && !IsRedirection (*sp) && !_istspace (*sp))
*ofn++ = *efn++ = *sp++;
*ofn = *efn = _T('\0');
}
}
else
*dp++ = *sp++;
}
*dp++ = _T('\0');
*dp = _T('\0');
/* now go for the pipes */
sp = s;
while (*sp)
{
if ((*sp == _T('"')) || (*sp == _T('\'')))
{
TCHAR qc = *sp;
do
sp++;
while (*sp && *sp != qc);
sp++;
}
else if (*sp == _T('|'))
{
*sp++ = _T('\0');
num++;
}
else
sp++;
}
return num;
}
#endif /* FEATURE_REDIRECTION */

View File

@@ -1,70 +0,0 @@
/*
* REN.C - rename internal command.
*
*
* History:
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 18-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>
* Added support for quoted long file names with spaces.
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>
* Unicode and redirection safe!
*/
#include "config.h"
#ifdef INCLUDE_CMD_RENAME
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
/*
* simple file rename internal command.
*
*/
INT cmd_rename (LPTSTR cmd, LPTSTR param)
{
LPTSTR *arg;
INT argc;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Renames a file/directory or files/directories.\n"
"\n"
"RENAME [drive:][path][directoryname1 | filename1] [directoryname2 | filename2]\n"
"REN [drive:][path][directoryname1 | filename1] [directoryname2 | filename2]\n"
"\n"
"Note that you cannot specify a new drive or path for your destination. Use\n"
"the MOVE command for that purpose."));
return 0;
}
/* split the argument list */
arg = split (param, &argc);
if (argc != 2)
{
freep (arg);
error_too_many_parameters (param);
return 1;
}
if (!MoveFile (arg[0], arg[1]))
{
ConErrPuts (_T("rename"));
freep (arg);
return 1;
}
freep (arg);
return 0;
}
#endif

View File

@@ -1,128 +0,0 @@
/*
* SET.C - set internal command.
*
*
* History:
*
* 06/14/97 (Tim Norman)
* changed static var in set() to a malloc'd space to pass to putenv.
* need to find a better way to do this, since it seems it is wasting
* memory when variables are redefined.
*
* 07/08/1998 (John P. Price)
* removed call to show_environment in set command.
* moved test for syntax before allocating memory in set command.
* misc clean up and optimization.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 28-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added set_env function to set env. variable without needing set command
*
* 09-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("/?").
*
* 24-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed Win32 environment handling.
* Unicode and redirection safe!
*
* 25-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed little bug.
*/
#include "config.h"
#ifdef INCLUDE_CMD_SET
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
#include "cmd.h"
/* initial size of environment variable buffer */
#define ENV_BUFFER_SIZE 1024
INT cmd_set (LPTSTR cmd, LPTSTR param)
{
LPTSTR p;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays, sets, or removes environment variables.\n\n"
"SET [variable[=][string]]\n\n"
" variable Specifies the environment-variable name.\n"
" string Specifies a series of characters to assign to the variable.\n\n"
"Type SET without parameters to display the current environment variables.\n"));
return 0;
}
/* if no parameters, show the environment */
if (param[0] == _T('\0'))
{
LPTSTR lpEnv;
LPTSTR lpOutput;
INT len;
lpEnv = (LPTSTR)GetEnvironmentStrings ();
if (lpEnv)
{
lpOutput = lpEnv;
while (*lpOutput)
{
len = _tcslen(lpOutput);
if (len)
{
if (*lpOutput != _T('='))
ConOutPuts (lpOutput);
lpOutput += (len + 1);
}
}
FreeEnvironmentStrings (lpEnv);
}
return 0;
}
p = _tcschr (param, _T('='));
if (p)
{
/* set or remove environment variable */
*p = _T('\0');
p++;
SetEnvironmentVariable (param, p);
}
else
{
/* display environment variable */
LPTSTR pszBuffer;
DWORD dwBuffer;
pszBuffer = (LPTSTR)malloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
dwBuffer = GetEnvironmentVariable (param, pszBuffer, ENV_BUFFER_SIZE);
if (dwBuffer == 0)
{
ConErrPrintf ("CMD: Not in environment \"%s\"\n", param);
return 0;
}
else if (dwBuffer > ENV_BUFFER_SIZE)
{
pszBuffer = (LPTSTR)realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
GetEnvironmentVariable (param, pszBuffer, dwBuffer * sizeof (TCHAR));
}
ConOutPrintf ("%s\n", pszBuffer);
free (pszBuffer);
return 0;
}
return 0;
}
#endif

View File

@@ -1,70 +0,0 @@
/*
* SHIFT.C - shift internal batch command
*
*
* History:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
*
* 16 Jul 1998 (John P Price)
* Separated commands into individual files.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("shift /?") and cleaned up.
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
#include "batch.h"
/*
* Perform the SHIFT command.
*
* Only valid inside batch files.
*
* FREEDOS extension : optional parameter DOWN to allow shifting
* parameters backwards.
*/
INT cmd_shift (LPTSTR cmd, LPTSTR param)
{
#ifdef _DEBUG
DebugPrintf ("cmd_shift: (\'%s\', \'%s\'\n", cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Changes the position of replaceable parameters in a batch file.\n\n"
"SHIFT [DOWN]"));
return 0;
}
if (bc == NULL)
{
/* not in batch - error!! */
return 1;
}
if (!_tcsicmp (param, _T("down")))
{
if (bc->shiftlevel)
bc->shiftlevel--;
}
else /* shift up */
bc->shiftlevel++;
return 0;
}

View File

@@ -1,251 +0,0 @@
/*
* TIME.C - time internal command.
*
*
* History:
*
* 07/08/1998 (John P. Price)
* started.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 09-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added locale support.
*
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
* Added "/t" option.
*
* 04-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Fixed time input bug.
*/
#include "config.h"
#ifdef INCLUDE_CMD_TIME
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
static VOID
PrintTime (VOID)
{
#ifdef __REACTOS__
SYSTEMTIME st;
GetLocalTime (&st);
switch (nTimeFormat)
{
case 0: /* 12 hour format */
default:
ConOutPrintf (_T("Current time is %2d%c%02d%c%02d%c%02d%c\n"),
(st.wHour == 0 ? 12 : (st.wHour <= 12 ? st.wHour : st.wHour - 12)),
cTimeSeparator, st.wMinute, cTimeSeparator, st.wSecond, cDecimalSeparator,
st.wMilliseconds / 10, (st.wHour <= 11 ? 'a' : 'p'));
break;
case 1: /* 24 hour format */
ConOutPrintf (_T("Current time is %2d%c%02d%c%02d%c%02d\n"),
st.wHour, cTimeSeparator, st.wMinute, cTimeSeparator,
st.wSecond, cDecimalSeparator, st.wMilliseconds / 10);
break;
}
#else
TCHAR szTime[32];
GetTimeFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL,
szTime, sizeof (szTime));
ConOutPrintf (_T("Current date is: %s\n"), szTime);
#endif
}
static BOOL ParseTime (LPTSTR s)
{
SYSTEMTIME t;
LPTSTR p = s;
if (!*s)
return TRUE;
GetLocalTime (&t);
t.wHour = 0;
t.wMinute = 0;
t.wSecond = 0;
t.wMilliseconds = 0;
// first get hour
if (_istdigit(*p))
{
while (_istdigit(*p))
{
t.wHour = t.wHour * 10 + *p - _T('0');
p++;
}
}
else
return FALSE;
// get time separator
if (*p != cTimeSeparator)
return FALSE;
p++;
// now get minutes
if (_istdigit(*p))
{
while (_istdigit(*p))
{
t.wMinute = t.wMinute * 10 + *p - _T('0');
p++;
}
}
else
return FALSE;
// get time separator
if (*p != cTimeSeparator)
return FALSE;
p++;
// now get seconds
if (_istdigit(*p))
{
while (_istdigit(*p))
{
t.wSecond = t.wSecond * 10 + *p - _T('0');
p++;
}
}
else
return FALSE;
// get decimal separator
if (*p == cDecimalSeparator)
{
p++;
// now get hundreths
if (_istdigit(*p))
{
while (_istdigit(*p))
{
// t.wMilliseconds = t.wMilliseconds * 10 + *p - _T('0');
p++;
}
// t.wMilliseconds *= 10;
}
}
/* special case: 12 hour format */
if (nTimeFormat == 0)
{
if (_totupper(*s) == _T('P'))
{
t.wHour += 12;
}
if ((_totupper(*s) == _T('A')) && (t.wHour == 12))
{
t.wHour = 0;
}
}
if (t.wHour > 23 || t.wMinute > 60 || t.wSecond > 60 || t.wMilliseconds > 999)
return FALSE;
SetLocalTime (&t);
return TRUE;
}
INT cmd_time (LPTSTR cmd, LPTSTR param)
{
LPTSTR *arg;
INT argc;
INT i;
BOOL bPrompt = TRUE;
INT nTimeString = -1;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays or sets the system time.\n\n"
"TIME [/T][time]\n\n"
" /T display only\n\n"
"Type TIME with no parameters to display the current time setting and a prompt\n"
"for a new one. Press ENTER to keep the same time."));
return 0;
}
/* build parameter array */
arg = split (param, &argc);
/* check for options */
for (i = 0; i < argc; i++)
{
if (_tcsicmp (arg[i], _T("/t")) == 0)
bPrompt = FALSE;
if ((*arg[i] != _T('/')) && (nTimeString == -1))
nTimeString = i;
}
if (nTimeString == -1)
PrintTime ();
if (!bPrompt)
{
freep (arg);
return 0;
}
while (1)
{
if (nTimeString == -1)
{
TCHAR s[40];
ConOutPrintf (_T("Enter new time: "));
ConInString (s, 40);
#ifdef _DEBUG
DebugPrintf ("\'%s\'\n", s);
#endif
while (*s && s[_tcslen (s) - 1] < _T(' '))
s[_tcslen(s) - 1] = _T('\0');
if (ParseTime (s))
{
freep (arg);
return 0;
}
}
else
{
if (ParseTime (arg[nTimeString]))
{
freep (arg);
return 0;
}
/* force input the next time around. */
nTimeString == -1;
}
ConErrPuts (_T("Invalid time."));
}
freep (arg);
return 0;
}
#endif

View File

@@ -1,42 +0,0 @@
/*
* title.c - title internal command.
*
*
* History:
* 1999-02-11 Emanuele Aliberti
*/
#include "config.h"
#ifdef INCLUDE_CMD_TITLE
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
INT cmd_title (LPTSTR cmd, LPTSTR param)
{
/* Do nothing if no args */
if (*param == _T('\0'))
return 0;
/* Asking help? */
if (!_tcsncmp(param, _T("/?"), 2))
{
ConOutPuts (_T("Sets the window title for the command prompt window.\n"
"\n"
"TITLE [string]\n"
"\n"
" string Specifies the title for the command prompt window."));
return 0;
}
return SetConsoleTitle (param);
}
#endif /* def INCLUDE_CMD_TITLE */
/* EOF */

View File

@@ -1,19 +0,0 @@
Things to do
~~~~~~~~~~~~
Fix bugs :)
Optimize the code! For size and speed. There are numerous places
where the code is hardly optimal for either.
Sorting in DIR command ("dir /o...").
^S and ^Q to pause/resume displays.
Improve DEL, COPY and MOVE commands.
BREAK command on command-line.
Add wildcard support to REN.
Add "/?" support to all batch commands.
And many, many more...

View File

@@ -1,103 +0,0 @@
/*
* TYPE.C - type internal command.
*
* History:
*
* 07/08/1998 (John P. Price)
* started.
*
* 07/12/98 (Rob Lake)
* Changed error messages
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added support for quoted arguments (type "test file.dat").
* Cleaned up.
*
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection ready!
*/
#include "config.h"
#ifdef INCLUDE_CMD_TYPE
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
INT cmd_type (LPTSTR cmd, LPTSTR param)
{
TCHAR szBuffer[256];
HANDLE hFile;
DWORD dwBytesRead;
DWORD dwBytesWritten;
BOOL bResult;
INT args;
LPTSTR *arg;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays the contents of text files.\n\n"
"TYPE [drive:][path]filename"));
return 0;
}
if (!*param)
{
error_req_param_missing ();
return 1;
}
arg = split (param, &args);
if (args > 1)
{
error_too_many_parameters (_T("\b \b"));
freep (arg);
return 1;
}
hFile = CreateFile (arg[0],
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
error_sfile_not_found (param);
freep (arg);
return 1;
}
do
{
bResult = ReadFile (hFile,
szBuffer,
sizeof(szBuffer),
&dwBytesRead,
NULL);
if (dwBytesRead)
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE),
szBuffer,
dwBytesRead,
&dwBytesWritten,
NULL);
}
while (bResult && dwBytesRead > 0);
CloseHandle (hFile);
freep (arg);
return 0;
}
#endif

View File

@@ -1,141 +0,0 @@
/*
* VER.C - ver internal command.
*
*
* History:
*
* 06/30/98 (Rob Lake)
* rewrote ver command to accept switches, now ver alone prints
* copyright notice only.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added text about where to send bug reports and get updates.
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection safe!
*
* 26-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* New version info and some output changes.
*/
#include "config.h"
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <ctype.h>
#include "cmd.h"
VOID ShortVersion (VOID)
{
ConOutPuts (_T("\n"
SHELLINFO "\n"
SHELLVER "\n"));
}
#ifdef INCLUDE_CMD_VER
/*
* display shell version info internal command.
*
*
*/
INT cmd_ver (LPTSTR cmd, LPTSTR param)
{
INT i;
ConOutPuts (_T("\n"
SHELLINFO "\n"
SHELLVER "\n"
"\n"
"Copyright (C) 1994-1998 Tim Norman and others."));
ConOutPuts (_T("Copyright (C) 1998,1999 Eric Kohl."));
/* Basic copyright notice */
if (param[0] == _T('\0'))
{
ConOutPuts (_T("\n"SHELLINFO
" comes with ABSOLUTELY NO WARRANTY; for details\n"
"type: `ver /w'. This is free software, and you are welcome to redistribute\n"
"it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n"
"listing of credits."));
}
else
{
/* MS-DOS ver prints just help if /? is alone or not */
if (_tcsstr (param, _T("/?")) != NULL)
{
ConOutPuts (_T("\ndisplay shell version info\n\nVER [/C/R/W/?]"));
return 0;
}
for (i = 0; param[i]; i++)
{
/* skip spaces */
if (param[i] == _T(' '))
continue;
if (param[i] == _T('/'))
{
/* is this a lone '/' ? */
if (param[i + 1] == 0)
{
error_invalid_switch (_T(' '));
return 1;
}
continue;
}
if (_totupper (param[i]) == _T('W'))
{
/* Warranty notice */
ConOutPuts (_T("\n This program is distributed in the hope that it will be useful,\n"
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
" GNU General Public License for more details."));
}
else if (_totupper (param[i]) == _T('R'))
{
/* Redistribution notice */
ConOutPuts (_T("\n This program is free software; you can redistribute it and/or modify\n"
" it under the terms of the GNU General Public License as published by\n"
" the Free Software Foundation; either version 2 of the License, or\n"
" (at your option) any later version."));
}
else if (_totupper (param[i]) == _T('C'))
{
/* Developer listing */
ConOutPuts (_T("\nFreeDOS version written by:\n"
" Tim Norman Matt Rains\n"
" Evan Jeffrey Steffen Kaiser\n"
" Svante Frey Oliver Mueller\n"
" Aaron Kaufman Marc Desrochers\n"
" Rob Lake John P Price\n"
" Hans B Pufal\n"
"\nReactOS version written by:\n"
" Eric Kohl Emanuele Aliberti\n"));
}
else
{
error_invalid_switch ((TCHAR)_totupper (param[i]));
return 1;
}
}
}
ConOutPuts (_T("\nSend bug reports to <ekohl@abo.rhein-zeitung.de>.\n"
/*
"Updates are available at http://www.sid-dis.com/reactos"
*/
));
return 0;
}
#endif

View File

@@ -1,57 +0,0 @@
/*
* VERIFY.C - verify internal command.
*
*
* History:
*
* 31 Jul 1998 (John P Price)
* started.
*
* 18-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* VERIFY is just a dummy under Win32; it only exists
* for compatibility!!!
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection ready!
*/
#include "config.h"
#ifdef INCLUDE_CMD_VERIFY
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
/* global verify flag */
static BOOL bVerify = FALSE;
INT cmd_verify (LPTSTR cmd, LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("This command is just a dummy!!\n"
"Sets whether to verify that your files are written correctly to a\n"
"disk.\n\n"
"VERIFY [ON | OFF]\n\n"
"Type VERIFY without a parameter to display the current VERIFY setting."));
return 0;
}
if (!*param)
ConOutPrintf (_T("VERIFY is %s.\n"), bVerify ? D_ON : D_OFF);
else if (_tcsicmp (param, D_OFF) == 0)
bVerify = FALSE;
else if (_tcsicmp (param, D_ON) == 0)
bVerify = TRUE;
else
ConOutPuts (_T("Must specify ON or OFF."));
return 0;
}
#endif

View File

@@ -1,105 +0,0 @@
/*
* VOL.C - vol internal command.
*
*
* History:
*
* 03-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced DOS calls by Win32 calls.
*
* 08-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added help text ("/?").
*
* 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Cleanup.
*
* 18-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode ready!
*
* 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Redirection ready!
*/
#include "config.h"
#ifdef INCLUDE_CMD_VOL
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include "cmd.h"
static INT
PrintVolumeHeader (LPTSTR pszRootPath)
{
TCHAR szVolName[80];
DWORD dwSerialNr;
/* get the volume information of the drive */
if(!GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
NULL, NULL, NULL, 0))
{
ErrorMessage (GetLastError (), _T(""));
return 1;
}
/* print drive info */
ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath[0]);
if (szVolName[0] != '\0')
ConOutPrintf (_T(" is %s\n"), szVolName);
else
ConOutPrintf (_T(" has no label\n"));
/* print the volume serial number */
ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"),
HIWORD(dwSerialNr), LOWORD(dwSerialNr));
return 0;
}
INT cmd_vol (LPTSTR cmd, LPTSTR param)
{
TCHAR szRootPath[] = _T("A:\\");
TCHAR szPath[MAX_PATH];
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays the disk volume label and serial number, if they exist.\n\n"
"VOL [drive:]"));
return 0;
}
if (param[0] == _T('\0'))
{
GetCurrentDirectory (MAX_PATH, szPath);
szRootPath[0] = szPath[0];
}
else
{
_tcsupr (param);
if (param[1] == _T(':'))
szRootPath[0] = param[0];
else
{
error_invalid_drive ();
return 1;
}
}
if (!IsValidPathName (szRootPath))
{
error_invalid_drive ();
return 1;
}
/* print the header */
if (!PrintVolumeHeader (szRootPath))
return 1;
return 0;
}
#endif

View File

@@ -1,273 +0,0 @@
/*
* WHERE.C - file search functions.
*
*
* History:
*
* 07/15/95 (Tim Norman)
* started.
*
* 08/08/95 (Matt Rains)
* i have cleaned up the source code. changes now bring this source
* into guidelines for recommended programming practice.
*
* 12/12/95 (Steffan Kaiser & Tim Norman)
* added some patches to fix some things and make more efficient
*
* 1/6/96 (Tim Norman)
* fixed a stupid pointer mistake...
* Thanks to everyone who noticed it!
*
* 8/1/96 (Tim Norman)
* fixed a bug when getenv returns NULL
*
* 8/7/96 (Steffan Kaiser and Tim Norman)
* speed improvements and bug fixes
*
* 8/27/96 (Tim Norman)
* changed code to use pointers directly into PATH environment
* variable rather than making our own copy. This saves some memory,
* but requires we write our own function to copy pathnames out of
* the variable.
*
* 12/23/96 (Aaron Kaufman)
* Fixed a bug in get_paths() that did not point to the first PATH
* in the environment variable.
*
* 7/12/97 (Tim Norman)
* Apparently, Aaron's bugfix got lost, so I fixed it again.
*
* 16 July 1998 (John P. Price)
* Added stand alone code.
*
* 17 July 1998 (John P. Price)
* Rewrote find_which to use searchpath function
*
* 24-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* fixed bug where didn't check all extensions when path was specified
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* fixed so that it find_which returns NULL if filename is not
* executable (does not have .bat, .com, or .exe extention).
* Before command would to execute any file with any extension (opps!)
*
* 03-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Changed find_which().
*
* 07-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Added ".CMD" extension.
* Replaced numeric constant by _NR_OF_EXTENSIONS.
*
* 26-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced find_which() by SearchForExecutable().
* Now files are searched using the right extension order.
*
* 20-Apr-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Some minor changes and improvements.
*/
#include "config.h"
#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include "cmd.h"
/* initial size of environment variable buffer */
#define ENV_BUFFER_SIZE 1024
static LPTSTR ext[] = {".bat", ".cmd", ".com", ".exe"};
static INT nExtCount = sizeof(ext) / sizeof(LPTSTR);
/* searches for file using path info. */
BOOL
SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
{
TCHAR szPathBuffer[MAX_PATH];
LPTSTR pszBuffer = NULL;
DWORD dwBuffer, len;
INT n;
LPTSTR p,s,f;
/* load environment varable PATH into buffer */
pszBuffer = (LPTSTR)malloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
if (dwBuffer > ENV_BUFFER_SIZE)
{
pszBuffer = (LPTSTR)realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
GetEnvironmentVariable (_T("PATH"), pszBuffer, dwBuffer * sizeof (TCHAR));
}
/* initialize full name buffer */
*pFullName = _T('\0');
if (!(p = _tcsrchr (pFileName, _T('.'))) ||
_tcschr (p + 1, _T('\\')))
{
/* There is no extension ==> test all the extensions. */
#ifdef _DEBUG
DebugPrintf (_T("No filename extension!\n"));
#endif
/* search in current directory */
len = GetCurrentDirectory (MAX_PATH, szPathBuffer);
if (szPathBuffer[len - 1] != _T('\\'))
{
szPathBuffer[len] = _T('\\');
szPathBuffer[len + 1] = _T('\0');
}
_tcscat (szPathBuffer, pFileName);
p = szPathBuffer + _tcslen (szPathBuffer);
for (n = 0; n < nExtCount; n++)
{
_tcscpy (p, ext[n]);
#ifdef _DEBUG
DebugPrintf (_T("Testing: \'%s\'\n"), szPathBuffer);
#endif
if (IsValidFileName (szPathBuffer))
{
#ifdef _DEBUG
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
#endif
free (pszBuffer);
_tcscpy (pFullName, szPathBuffer);
return TRUE;
}
}
/* search in PATH */
s = pszBuffer;
while (s && *s)
{
f = _tcschr (s, _T(';'));
if (f)
{
_tcsncpy (szPathBuffer, s, (size_t)(f-s));
szPathBuffer[f-s] = _T('\0');
s = f + 1;
}
else
{
_tcscpy (szPathBuffer, s);
s = NULL;
}
len = _tcslen(szPathBuffer);
if (szPathBuffer[len - 1] != _T('\\'))
{
szPathBuffer[len] = _T('\\');
szPathBuffer[len + 1] = _T('\0');
}
_tcscat (szPathBuffer, pFileName);
p = szPathBuffer + _tcslen (szPathBuffer);
for (n = 0; n < nExtCount; n++)
{
_tcscpy (p, ext[n]);
#ifdef _DEBUG
DebugPrintf (_T("Testing: \'%s\'\n"), szPathBuffer);
#endif
if (IsValidFileName (szPathBuffer))
{
#ifdef _DEBUG
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
#endif
free (pszBuffer);
_tcscpy (pFullName, szPathBuffer);
return TRUE;
}
}
}
}
else
{
/* There is an extension and it is in the last path component, */
/* so don't test all the extensions. */
#ifdef _DEBUG
DebugPrintf (_T("Filename extension!\n"));
#endif
/* search in current directory */
len = GetCurrentDirectory (MAX_PATH, szPathBuffer);
if (szPathBuffer[len - 1] != _T('\\'))
{
szPathBuffer[len] = _T('\\');
szPathBuffer[len + 1] = _T('\0');
}
_tcscat (szPathBuffer, pFileName);
#ifdef _DEBUG
DebugPrintf (_T("Testing: \'%s\'\n"), szPathBuffer);
#endif
if (IsValidFileName (szPathBuffer))
{
#ifdef _DEBUG
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
#endif
free (pszBuffer);
_tcscpy (pFullName, szPathBuffer);
return TRUE;
}
/* search in PATH */
s = pszBuffer;
while (s && *s)
{
f = _tcschr (s, _T(';'));
if (f)
{
_tcsncpy (szPathBuffer, s, (size_t)(f-s));
szPathBuffer[f-s] = _T('\0');
s = f + 1;
}
else
{
_tcscpy (szPathBuffer, s);
s = NULL;
}
len = _tcslen(szPathBuffer);
if (szPathBuffer[len - 1] != _T('\\'))
{
szPathBuffer[len] = _T('\\');
szPathBuffer[len + 1] = _T('\0');
}
_tcscat (szPathBuffer, pFileName);
#ifdef _DEBUG
DebugPrintf (_T("Testing: \'%s\'\n"), szPathBuffer);
#endif
if (IsValidFileName (szPathBuffer))
{
#ifdef _DEBUG
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
#endif
free (pszBuffer);
_tcscpy (pFullName, szPathBuffer);
return TRUE;
}
}
}
free (pszBuffer);
return FALSE;
}

View File

@@ -1,15 +0,0 @@
Wishlist for ReactOS CMD
~~~~~~~~~~~~~~~~~~~~~~~~
- Exclusion wildcards: "del /r *.bak -abcd.bak"
Deletes ALL *.bak files EXCEPT abcd.bak.
- Progress indikator on long file operations (copy/move).
Percentage at the right side of the filename.
- [cd test directory] should change to the subdirectoy "test directory".
More ideas?
Eric Kohl <ekohl@abo.rhein-zeitung.de>

View File

@@ -2,9 +2,12 @@
#
#
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)
@@ -14,6 +17,24 @@ $(CLEAN_FILES:%=%_clean): %_clean:
.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

View File

@@ -1,7 +1,9 @@
#include <ddk/ntddk.h>
#include <windows.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -20,7 +22,11 @@ void debug_printf(char* fmt, ...)
void ExecuteVer(void)
{
debug_printf("Reactos Simple Shell\n");
debug_printf(
"Reactos Simple Shell\n(compiled on %s, at %s)\n",
__DATE__,
__TIME__
);
}
void ExecuteCd(char* cmdline)
@@ -66,6 +72,13 @@ void ExecuteDir(char* cmdline)
FindClose(shandle);
}
void ExecuteReboot(char* cmdline)
{
NtShutdownSystem (ShutdownReboot);
}
void ExecuteType(char* cmdline)
{
HANDLE FileHandle;
@@ -96,35 +109,129 @@ void ExecuteType(char* cmdline)
CloseHandle(FileHandle);
}
int ExecuteProcess(char* name, char* cmdline)
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);
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,
TRUE,
CREATE_NEW_CONSOLE,
NULL,
NULL,
&StartupInfo,
&ProcessInformation);
if (ret)
cmdline,
NULL,
NULL,
FALSE,
((TRUE == detached)
? DETACHED_PROCESS
: CREATE_NEW_CONSOLE
),
NULL,
NULL,
& StartupInfo,
& ProcessInformation
);
if (TRUE == detached)
{
WaitForSingleObject(ProcessInformation.hProcess,INFINITE);
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);
}
}
CloseHandle(ProcessInformation.hProcess);
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;
@@ -151,7 +258,7 @@ void ExecuteCommand(char* line)
cmd = line;
if (cmd==NULL)
if (cmd==NULL || *cmd == '\0' )
{
return;
}
@@ -165,6 +272,16 @@ void ExecuteCommand(char* line)
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);
@@ -172,7 +289,7 @@ void ExecuteCommand(char* line)
}
if (strcmp(cmd,"ver")==0)
{
ExecuteVer();
ExecuteVer();
return;
}
if (strcmp(cmd,"validate")==0)
@@ -188,12 +305,17 @@ void ExecuteCommand(char* line)
}
return;
}
if (strcmp(cmd,"start") == 0)
{
ExecuteStart(tail);
return;
}
if (strcmp(cmd,"exit")==0)
{
ExitProcess(0);
return;
}
if (ExecuteProcess(cmd,tail))
if (ExecuteProcess(cmd,tail,FALSE))
{
return;
}

View File

@@ -1 +1 @@
loadros kimage.bin ide.o vfatfsd.o keyboard.o
loadros ntoskrnl.exe ide.sys vfatfs.sys

View File

@@ -3,24 +3,22 @@
:
: copy files to HD...
:
COPY /Y BLUE.SYS C:\reactos\system\drivers\blue.SYS
COPY /Y KEYBOARD.SYS C:\reactos\system\drivers\KEYBOARD.SYS
COPY /Y NTDLL.DLL C:\reactos\system\NTDLL.DLL
COPY /Y KERNEL32.DLL C:\reactos\system\KERNEL32.DLL
: COPY /Y CRTDLL.DLL C:\reactos\system\CRTDLL.DLL
COPY /Y SHELL.EXE C:\reactos\system\SHELL.EXE
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
: 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 IDE.SYS VFATFSD.SYS
LOADROS NTOSKRNL.EXE DRIVERS\IDE.SYS DRIVERS\VFATFSD.SYS
GOTO :END
:L2

View File

@@ -1,94 +0,0 @@
This is the file "copying.dj". It does NOT apply to any sources or
binaries copyrighted by UCB Berkeley, the Free Software Foundation, or
any other agency besides DJ Delorie and others who have agreed to
allow their sources to be distributed under these terms.
Copyright Information for sources and executables that are marked
Copyright (C) DJ Delorie
7 Kim Lane
Rochester NH 03867-2954
This document is Copyright (C) DJ Delorie and may be distributed
verbatim, but changing it is not allowed.
Source code copyright DJ Delorie is distributed under the terms of the
GNU General Public Licence, with the following exceptions:
* Sources used to build crt0.o, gcrt0.o, libc.a, libdbg.a, and
libemu.a are distributed under the terms of the GNU Library General
Public License, rather than the GNU GPL.
* Any existing copyright or authorship information in any given source
file must remain intact. If you modify a source file, a notice to that
effect must be added to the authorship information in the source file.
* Runtime binaries, as provided by DJ in DJGPP, may be distributed
without sources ONLY if the recipient is given sufficient information
to obtain a copy of djgpp themselves. This primarily applies to
go32-v2.exe, emu387.dxe, and stubedit.exe.
* Runtime objects and libraries, as provided by DJ in DJGPP, when
linked into an application, may be distributed without sources ONLY
if the recipient is given sufficient information to obtain a copy of
djgpp themselves. This primarily applies to crt0.o and libc.a.
-----
Changes to source code copyright BSD or FSF by DJ Delorie fall under
the terms of the original copyright.
A copy of the files "COPYING" and "COPYING.LIB" are included with this
document. If you did not receive a copy of these files, you may
obtain one from whence this document was obtained, or by writing:
Free Software Foundation
675 Mass Ave
Cambridge, MA 02139
USA

View File

@@ -52,9 +52,9 @@ Debugging kernel-mode code is tricky, these are some snippets
easier to see where output is coming from. DbgPrint can be used at any
point including in interrupt handlers.
There are options in ntoskrnl/hal/x86/printk.c for copying DbgPrint
output to a serial device (parallel support should also be added). This
can be useful if a lot of output is being generated.
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
@@ -105,7 +105,7 @@ Debugging kernel-mode code is tricky, these are some snippets
There is a mailing list for kernel development,
ros-kernel@sid-dis.com
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

36
reactos/doc/apc Normal file
View File

@@ -0,0 +1,36 @@
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.

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