Compare commits

...

343 Commits

Author SHA1 Message Date
Art Yerkes
3a3d839af3 Simple jmpbuf for powerpc.
svn path=/branches/powerpc/; revision=14757
2005-04-23 04:31:11 +00:00
Alex Ionescu
1928c25d73 Add KDBG debugging hack from old code and convert it to fit new one. Not enabled yet because it underflows the stack after a while (researching why). Also complete KeContextToTrapFrame and have Ke386InitThreadWithContext call it to handle creating the Initial Trap Frame
svn path=/trunk/; revision=14754
2005-04-23 04:12:26 +00:00
Art Yerkes
18ac7f07b6 Don't try to discover if we didn't find any interfaces we like. When we get
PnP, we'll need to do discover when the first interface appears.

svn path=/trunk/; revision=14751
2005-04-23 00:40:44 +00:00
Eric Kohl
e8c40d4eee advapi32.dll: Implement QueryServiceStatus.
services.exe: Implement OpenSCManagerA, OpenServiceA, OpenServiceW and QueryServiceStatus.

svn path=/trunk/; revision=14750
2005-04-23 00:01:37 +00:00
Hervé Poussineau
2160c0c245 Add Green driver, that emulates a VT100 compatible server.
Input won't work as long as we don't have a kdbclass driver.

svn path=/trunk/; revision=14749
2005-04-22 19:57:03 +00:00
Filip Navara
5b43b8d8b1 Fix one more typo...Spotted by gasmann.
svn path=/trunk/; revision=14748
2005-04-22 15:26:14 +00:00
Filip Navara
8af30ee387 Fix a typo. Spotted by Potapnik.
svn path=/trunk/; revision=14745
2005-04-22 14:58:22 +00:00
Filip Navara
bf338a8003 Denzil <d3nzil@gmail.com>
Czech translation of Calc, SndVol32, WineFile and Autorun applications.

svn path=/trunk/; revision=14744
2005-04-22 13:54:08 +00:00
Alex Ionescu
3b57e224a1 Fix win32k building
svn path=/trunk/; revision=14743
2005-04-22 13:17:35 +00:00
Alex Ionescu
4b4d215e36 Thread Creation and Context Switching re-write, plus Idle/First Thread minimization attempt. Full changelog on ML, too large to post here
svn path=/trunk/; revision=14742
2005-04-22 12:52:25 +00:00
Art Yerkes
725d5b0050 Removed a useless temporary from router setting.
Use option 6, DHO_DOMAIN_NAME_SERVERS to get name servers from dhcp server.
Fix wrong variable in nameserver setting.
Router and Nameserver now correctly acquired from DHCP.

svn path=/trunk/; revision=14741
2005-04-22 12:46:27 +00:00
Alex Ionescu
264ff7e6d2 Switch to NT5
svn path=/trunk/; revision=14740
2005-04-22 12:43:16 +00:00
Alex Ionescu
8d6d8aaf57 Put back GUI Shell
svn path=/trunk/; revision=14739
2005-04-22 12:42:35 +00:00
Art Yerkes
d7b7ff3672 tcpmisc.h:
- Correct wrongly sized struct IPAddrEntry.
dhcp: dhclient.c and dispatch.c
- remove lots of #if 0
- remove instances of script_go and associated stuff
- write stub check_arp pending ARP api functions being implemented
- introduced S_STATIC state for adapters
dhcp: api.c:
- Do add_protocol and send_discover when telling an adapter to lease.
- Do remove_protocol when we make an adapter static.
dhcp: adapter.c:
- Add infrastructure for finding the adapter key in the registry
- Check for IP address settings and apply as static if set, otherwise dynamic
tcpip: *info and lan:
- Set info types to DEBUG_INFO and DEBUG_DATALINK everywhere
tcpip: lan:
- Remove kernel IP configuration.
bootdata:
- Added dhcp service and make it start.
- Removed static IP address settings from the default configuration
- Removed old JS bootcode


svn path=/trunk/; revision=14737
2005-04-22 09:45:17 +00:00
Gé van Geldorp
9ac6146c7b Sync to Wine-20050419:
Robert Shearman <rob@codeweavers.com>
- Fix TB_GETBUTTONSIZE to return the correct width/height for no
  buttons.
- Use ES_AUTOHSCROLL for edit box.
- Fix size passed to SPI_NONCLIENTMETRICS.
- iSelectedImage is allowed to be 0.
- Use SetWindowPos to move the buddy window into position instead of
  destroying it and recreating it at the new position.
- Clear the background in WM_VSCROLL to avoid problems with
  antialiased text drawing on top of itself multiple times.
Dimitrie O. Paun <dpaun@rogers.com>
- Use {Alloc,ReAlloc,Free}() instead of Heap{Alloc,ReAlloc,Free}().
- Fix a memory leak in toolbar. Avoid casts.
- Complete unicodification of the toolbar common control.
- Move a header comment for consistency with the other controls.
- Very small alignment fixes.
- Add support for LVN_ODSTATECHANGED.
- Minor typo fixes.
- Handle wParam in WM_PAINT properly: if non-null, it is the hdc we are
  supposed to use to draw into.
- Complete unicodification of the propsheet common control.
- Complete unicodification of the flatsb common control.
- Pull the WM_TIMER handling into its own function.
- ANIMATE_DrawFrame shouldn't worry about locking, the lock should be
  held by the caller.
- Delete the critical section when freeing up the infoPtr.
- Audit the control against Comctl32.dll version 6.0.
- Proper handling of GWL_STYLE.
- Implement WM_CLOSE. Fix WM_SIZE implementation.
- Small cleanups.
- Cleanup and simplify the painting code.
- Fix a potential bug along the way.
- Unicodification and typesafe interfaces.
- Complete unicodification.
- Complete unicodification of the rebar common control.
- Add Robert Shearman's explanation about WM_NCPAINT.
- Move testing comments in a more appropriate place.
- Proper handling for GWL_STYLE.
- Store and use hwndSelf in the PAGER_INFO.
- Pass the infoPtr around instead of hwnd.
- Use proper types in the function signatures.
- Fix a few return statements.
- MonthCal unicodification.
- Tab unicodification.
- Keep track of WS_DISABLED explicitely, as it doesn't generate a
  WM_STYLECHANGED message.
- Minor cleanups.
- Complete unicodification of the tooltips common control.
- Complete the unicodification of comctl32undoc.
- Complete unicodification of the header common control.
- Complete unicodification of the treeview common control.
- Audit the code against Comctl32.dll version 6.0.
- Handle notification and styles as in the other controls.
- Maintain the const for strings throughout parsing.
Francois Gouget <fgouget@free.fr>
- Assorted spelling fixes.
Jakob Eriksson <jakov@vmlinux.org>
- Get rid of HeapAlloc casts.
- Eliminate HeapAlloc casts.
Alexandre Julliard <julliard@winehq.org>
- Revert changes to the painting code, the WM_CTLCOLORSTATIC message
  should not be sent from the animation thread.
Duane Clark <dclark@akamail.com>
- Misc rectangle fixes.
- The date should be initialized from local time.
- Monday is day number '1'.
- Set day of week when a day is selected in the calender.
- Use fixed width fields in datetime.
- DTS_TIMEFORMAT is a two bit field, so test accordingly.
- Reposition and resize the updown control when the datetime control is
  resized.
- Respond to updown inputs.
- The datetime should be initialized with local time.
- Add support for direct keyboard input to numeric fields.
- Hour '0' corresponds to 12AM.
Vitaliy Margolen <wine-devel@kievinfo.com>
- Draw only visible tabs.
- Don't redraw if no information has changed.
- Fixed endless redraw loop if app using callback for images and/or
  text.
- Keep color changes made by app for the current draw cycle.
- Send notifies after invalidating changed areas.
- Don't use custom draw returned colors for control.
C. Scott Ananian <cscott@cscott.net>
- UPDOWN_GetBuddyInt should not fail when the control is empty.
Peter Berg Larsen <pebl@math.ku.dk>
- Replace strncpy with memcpy or lstrcpyn.
Huw Davies <huw@codeweavers.com>
- The depth of the colour bitmap needs to match that of the screen.
Jason Edmeades <us@the-edmeades.demon.co.uk>
- Make the treeview correctly search when the top index is selected.
Evan Deaubl <wine@warpedview.com>
- TREEVIEW_DoSelectItem should not do any of the TVGN_FIRSTVISIBLE work
  if the newSelect parameter is NULL.
Eric Pouech <pouech-eric@wanadoo.fr>
- Removed excessive statement (break after return or goto, not useful
  break, not needed vars...)

svn path=/trunk/; revision=14735
2005-04-21 21:01:05 +00:00
Maarten Bosma
7909dfa511 PackageManager: Uploaded forgotten File
svn path=/trunk/; revision=14734
2005-04-21 16:28:44 +00:00
Aleksey Bragin
702e2a0488 EnumSystemLocalesW() implementation. Certainly not full (doesn't support INSTALLED/SUPPORTED/etc flags) - but at least it does what is needed - enumerate locales.
Other stuff is coming soon so intl.cpl could work.

svn path=/trunk/; revision=14732
2005-04-21 14:49:17 +00:00
Aleksey Bragin
d6eec68dd8 Added xbox video driver information (by GvG), I hope it doesn't interfere anyone, and there will be no need to patch registry everytime to boot under xbox.
svn path=/trunk/; revision=14730
2005-04-21 12:58:20 +00:00
Gé van Geldorp
5568b1261a - Protect multiboot info from being overwritten
- Pass command line to MachInit() funcs

svn path=/trunk/; revision=14725
2005-04-21 09:29:02 +00:00
Gé van Geldorp
ee219b0e23 Sync to Wine-20050419:
Peter Berg Larsen <pebl@math.ku.dk>
- Eliminate a strncpy and remove unused variable.

svn path=/trunk/; revision=14724
2005-04-20 22:05:23 +00:00
Eric Kohl
37d076fdc0 Move RtlAreAllAccessesGranted, RtlAreAnyAccessesGranted and RtlMapGenericMask to the shared runtime library.
svn path=/trunk/; revision=14723
2005-04-20 20:58:16 +00:00
Gé van Geldorp
4dd2fef625 Roman Hoegg <roman.hoegg@unisg.ch>
Add configuration stuff for Swiss German keyboard

svn path=/trunk/; revision=14721
2005-04-20 19:52:45 +00:00
Hervé Poussineau
a93d293fa7 Implement IoRegisterDeviceInterface
svn path=/trunk/; revision=14720
2005-04-20 19:38:39 +00:00
Maarten Bosma
101713f39a PackageManager: Corrected default setting
svn path=/trunk/; revision=14719
2005-04-20 19:33:48 +00:00
Maarten Bosma
31d0c28c6d PackageManager: Options.xml
svn path=/trunk/; revision=14718
2005-04-20 19:01:30 +00:00
Royce Mitchell III
31390cae28 latest version of ArchBlackmann
svn path=/trunk/; revision=14717
2005-04-20 18:16:32 +00:00
Maarten Bosma
ffb29d1f85 PackageManager: Changed download Server back to http://svn.reactos.com
svn path=/trunk/; revision=14712
2005-04-20 12:52:36 +00:00
Alex Ionescu
0bc300d64d Remove bogus error message. It is normal for Mutex creation to fail since the Object will alredy exist after the first time it's created
svn path=/trunk/; revision=14711
2005-04-20 12:52:13 +00:00
Alex Ionescu
27a6253e6c Don't relocate shell32 and gdi32. Changed their base addresses so they fit better
svn path=/trunk/; revision=14710
2005-04-20 12:46:39 +00:00
Gé van Geldorp
7792b4bfea You can ask for e.g. GWL_STYLE for the desktop window,
but GWL_WNDPROC is off-limits for all windows if your
process didn't create it

svn path=/trunk/; revision=14709
2005-04-20 07:25:14 +00:00
Thomas Bluemel
6ba7e5d2cd don't access pagable memory at dispatch level in NtQueryDirectoryObject
svn path=/trunk/; revision=14708
2005-04-19 22:45:48 +00:00
Gé van Geldorp
9da5e3306e Hervé Poussineau <poussine@freesurf.fr>
Solve quarrel between GDB stub and serenum

svn path=/trunk/; revision=14707
2005-04-19 22:33:09 +00:00
Thomas Bluemel
377ffd2516 convert the device object to a temporary device before deleting it
svn path=/trunk/; revision=14706
2005-04-19 21:47:05 +00:00
Thomas Bluemel
353f0bf39d use anonymous events for synchronization
svn path=/trunk/; revision=14704
2005-04-19 17:13:34 +00:00
Thomas Bluemel
932dc7e607 - Delete named objects from the namespace when the last handle is closed, unless the object is a permanent object
- IoCreateDevice should create a permanent object for named devices

svn path=/trunk/; revision=14703
2005-04-19 17:12:03 +00:00
Thomas Bluemel
995ac8a5b2 import wininet.h from wine to solve conflicts with the w32api headers
svn path=/trunk/; revision=14702
2005-04-19 15:06:18 +00:00
Thomas Bluemel
a0ef12d39e fix typo
svn path=/trunk/; revision=14701
2005-04-19 10:40:37 +00:00
Thomas Bluemel
77089de5b6 directly redirect MapGenericMask to ntdll
svn path=/trunk/; revision=14700
2005-04-19 10:36:11 +00:00
Gé van Geldorp
2200dc3562 Make disk partition handling architecture dependent, as not
all architectures have partitions

svn path=/trunk/; revision=14698
2005-04-19 08:51:16 +00:00
Alex Ionescu
68a209fb2b damn fingers were too fast. sorry, reverting
svn path=/trunk/; revision=14697
2005-04-19 06:26:01 +00:00
Alex Ionescu
05c22b76ae Use MmDeleteKernelStack and remove KeReleaseThread
svn path=/trunk/; revision=14696
2005-04-19 06:24:15 +00:00
Alex Ionescu
c683236f8a Use MmDeleteKernelStack and remove KeReleaseThread
svn path=/trunk/; revision=14695
2005-04-19 06:22:36 +00:00
Steven Edwards
cf1a2b10ac done with wininet import
svn path=/trunk/; revision=14694
2005-04-19 05:01:47 +00:00
Steven Edwards
00c9609713 added wine wininet.h
svn path=/trunk/; revision=14693
2005-04-19 05:00:05 +00:00
Steven Edwards
87aa47161b imported wininet from wine
svn path=/trunk/; revision=14692
2005-04-19 04:57:39 +00:00
Steven Edwards
38de497b18 imported in to the trunk
svn path=/trunk/; revision=14691
2005-04-19 04:50:10 +00:00
Steven Edwards
0c3c1a51b0 removing wininet for reimport
svn path=/trunk/; revision=14690
2005-04-19 04:49:49 +00:00
Steven Edwards
2607bc5f85 imported in to the trunk
svn path=/trunk/; revision=14689
2005-04-19 04:48:51 +00:00
Filip Navara
096c2a1089 Reenable ControlService and fix syntax errors in svcctl.idl.
svn path=/trunk/; revision=14686
2005-04-18 22:11:46 +00:00
Gé van Geldorp
645c3e7497 Fix copy/paste error
svn path=/trunk/; revision=14685
2005-04-18 22:00:52 +00:00
Filip Navara
08807e03af Don't use pointer to freed memory.
svn path=/trunk/; revision=14684
2005-04-18 21:50:08 +00:00
Eric Kohl
e2e4bed006 Disable ControlService() because of a bug in WIDL.
svn path=/trunk/; revision=14683
2005-04-18 21:34:11 +00:00
Thomas Bluemel
88e83d47c5 don't query additional information for the system idle process (which doesn't work anyway)
svn path=/trunk/; revision=14682
2005-04-18 21:03:33 +00:00
Hervé Poussineau
b3dee30733 Implement IOCTL_VIDEO_QUERY_AVAIL_MODES, IOCTL_VIDEO_QUERY_CURRENT_MODE, IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES
Add checks to input/output structure sizes
Move prototypes to new file vgamp.h

svn path=/trunk/; revision=14681
2005-04-18 20:18:06 +00:00
Maarten Bosma
aeac4dceb8 PackageManager: Changed Makefiles
svn path=/trunk/; revision=14680
2005-04-18 19:56:45 +00:00
Maarten Bosma
eb5d74fe5e PackageManager: TARGET_INSTALLDIR = bin
svn path=/trunk/; revision=14679
2005-04-18 19:41:15 +00:00
Thomas Bluemel
9c23880fd4 fix uninitialized variable
svn path=/trunk/; revision=14678
2005-04-18 19:26:12 +00:00
Maarten Bosma
0331e3dfe8 PackageManager: added missing package.h
svn path=/trunk/; revision=14677
2005-04-18 19:22:50 +00:00
Alex Ionescu
58f9a46b3e Fix remaining System Process information structure issues and fix compilation
svn path=/trunk/; revision=14676
2005-04-18 18:24:06 +00:00
Alex Ionescu
6e2aa454ad Fix Process/Thread information structures to match Windows 2000 and have proper structure. Fix bug in ntdll related to OpenProcess
svn path=/trunk/; revision=14675
2005-04-18 17:48:01 +00:00
Alex Ionescu
5817ae7a54 Fix Process/Thread information structures to match Windows 2000 and have proper structure. Fix bug in ntdll related to OpenProcess
svn path=/trunk/; revision=14674
2005-04-18 17:46:59 +00:00
Alex Ionescu
db6c8885b6 Fix incorrect replacement
svn path=/trunk/; revision=14673
2005-04-18 16:25:53 +00:00
Alex Ionescu
c614ba1a5e Remove excess debugging
svn path=/trunk/; revision=14672
2005-04-18 15:51:21 +00:00
Alex Ionescu
610dd8e8bc Use official THREAD_STATE enumeration for thread states
svn path=/trunk/; revision=14671
2005-04-18 15:49:57 +00:00
Alex Ionescu
6733de66c9 Fix win32k
svn path=/trunk/; revision=14670
2005-04-18 14:56:52 +00:00
Alex Ionescu
c030bd043b Forgot this...sorry..it was 3am
svn path=/trunk/; revision=14669
2005-04-18 14:13:03 +00:00
Gé van Geldorp
5845a581f2 Roman Hoegg <roman.hoegg@unisg.ch>
Add support for Swiss German keyboards

svn path=/trunk/; revision=14668
2005-04-18 13:27:16 +00:00
Alex Ionescu
5da996d016 Implement PsGetVersion. OSR and other sources say that the build number is a mix of high and low word, where the high represents checked or free
svn path=/trunk/; revision=14667
2005-04-18 05:47:13 +00:00
Alex Ionescu
234a011028 Fix Access Bug. cmd.exe and taskmgr work again, but there remains a bug with the process list
svn path=/trunk/; revision=14666
2005-04-18 05:25:07 +00:00
Alex Ionescu
2b66d8f4fb Fix incorrect OpenProcess implementation in kernel32 and make it tidier. I'm now seeing a bug with Access rights...
svn path=/trunk/; revision=14665
2005-04-18 05:12:36 +00:00
Alex Ionescu
9cafa059bd Fix Process not being deleted
svn path=/trunk/; revision=14664
2005-04-18 04:55:48 +00:00
Alex Ionescu
6829bd8c8b Implement PsSetLegoNotifyRoutine and PsRemoveCreateThreadNotifyroutine. Clean up ps/thread.c, move things to their own subsystem, do proper TEB Allocation with MmCreateTeb, remove TEB EPROCESS hack fields. Rename PsFrezeAllThreads to KeFreezeAllThreads and implement a working version.
svn path=/trunk/; revision=14663
2005-04-18 04:46:06 +00:00
Alex Ionescu
f4d2ac0b1e Remove ps/create.c, it did not fit with the current model of abstraction. Major cleanup of ps/process.c, created ps/notify.c and ps/quota.c. Implemented NtOpenProcess, PsRemoveLoadImageNotifyRoutine, PsGetCurrentProcessSessionId
svn path=/trunk/; revision=14662
2005-04-18 02:12:30 +00:00
Alex Ionescu
781c6b374f Forgot this
svn path=/trunk/; revision=14661
2005-04-18 02:11:19 +00:00
Alex Ionescu
7740536c18 Mini-merge from my local changes. Rewrite of Process Creation. Notable improvements:
- Subsystemization of Process Creation code. Memory code done by new Mm functions (not all used yet),
      Kernel code done by Ke*, etc.
    - Written to be compatible with the information in "Windows Internals".
    - Optimized and cleaned up.
    - ObInsertObject is now called at the end, fixing a plethora of wrong things that were covered with FIXMEs.
    - PEB is allocated with a Memory Area, and so will TEB soon, which allows 4KB allocation without 64KB gra
      nularity.
    - System DLL Mapping/Loading has been changed to be cached at system bootup, resulting in faster code.
    
Also changed Peb to report NT 5.0

NOTE: Messy, more to come soon. The full benefits of this patch won't be realized until the complete changes
      are in.

svn path=/trunk/; revision=14660
2005-04-18 00:42:31 +00:00
Thomas Bluemel
a9920ccd9d fixed warning
svn path=/trunk/; revision=14659
2005-04-17 20:46:36 +00:00
Eric Kohl
30e7e912c2 ADVAPI32.DLL / SERVICES.EXE:
Implement ControlService()

RPCRT4.DLL:
Disable a bogus buffer overflow check in NdrSimpleStructMarshall.

svn path=/trunk/; revision=14658
2005-04-17 19:56:50 +00:00
Art Yerkes
631838f4a3 Fixed the repeating DHCPOFFER/DHCPACK. I was assuming that the lease timeout
was relative but it's been adjusted by the time we get here.

Thanks to hpoussineau for helping with this bug.

svn path=/trunk/; revision=14657
2005-04-17 19:47:44 +00:00
Eric Kohl
e0dda3685a Support out-pointers to structs.
svn path=/trunk/; revision=14656
2005-04-17 19:45:06 +00:00
Thomas Bluemel
c9a0b04418 fixed warning and minor portability fix
svn path=/trunk/; revision=14655
2005-04-17 19:33:50 +00:00
Thomas Bluemel
3e18dad277 fixed warning and minor portability fix
svn path=/trunk/; revision=14654
2005-04-17 19:32:24 +00:00
Art Yerkes
ddc52fc76c Don't set a zero timeout for a lease. Zero here is taken to mean infinite.
svn path=/trunk/; revision=14653
2005-04-17 19:16:39 +00:00
Emanuele Aliberti
45d0cf852c sm info ssid - implemented
svn path=/trunk/; revision=14651
2005-04-17 17:50:48 +00:00
Alex Ionescu
d4449cd58d Put in alphabetical order, remove IopCreateDevice, and remove incorrect implementation tag for EFi functions
svn path=/trunk/; revision=14650
2005-04-17 16:26:44 +00:00
Eric Kohl
8c8090fc65 - Move generated files to the top of the file list.
- Rename generated file svcctl.h to svcctl_c.h.

svn path=/trunk/; revision=14647
2005-04-17 11:01:00 +00:00
Art Yerkes
99bd564c01 Add sufficient permission to the TCP handle to configure the IP address.
svn path=/trunk/; revision=14646
2005-04-17 08:00:01 +00:00
Art Yerkes
4c0e95ce09 More cleaning. Mostly working DHCP. IP address is automatically discovered
and configured on the first ethernet adapter.

svn path=/trunk/; revision=14645
2005-04-17 07:58:24 +00:00
Art Yerkes
aa0b005b38 Needed infrastructure for DHCP:
Corrected adapter index problem in iinfo.c.  Now the index returned is from
 IF->Index.
ninfo: ditto.
ip.c: Expose IPAddInterfaceRoute and IPRemoveInterfaceRoute for use by
 set ip address IOCTL.
if.c: Allow deleting of TCP context.
main.c: Turn off debugging in CVS.

svn path=/trunk/; revision=14644
2005-04-17 07:55:24 +00:00
Alex Ionescu
24b6532712 IoCreateDevice Changes:
- IoAllocateVpb renamed to IopAllocateVpb and made cleaner
    - Let ObCreateObject do all the memory allocation since the extra data belongs to the
      object and it should be responsible for allocating it. No more extra pool allocations
      or deallocations.
    - Zero out everythign a single time.
    - Remove useless code duplication
    - Use proper I/O Manager types for the object headers.
    - Honour Exclusive Flag, and Has Name Flag.
    - Only initialize event if there is a volume.
    - Initialize a VPB for Virtual Disks also.
    - Set up Device Object Extension properly
    - Set DO_DEVICE_INITIALIZING flag.
    - Use proper sector sizes, don't hardcode 512 (should be 2048 for cds)
    - Actually insert the object into the object table with ObInsertObject. This might seem
      useless, but remember that's simply because ROS has a broken Ob Manager which does way
      too much in ObCreateObject. It will be easier to use the rewrite if this is done properly.
    - Set the right sizes in some places.

svn path=/trunk/; revision=14643
2005-04-17 04:20:16 +00:00
Art Yerkes
f4c3dd909b Make the broadcast address all 1's.
svn path=/trunk/; revision=14642
2005-04-16 22:11:59 +00:00
Art Yerkes
0ed727c9f8 Fixed multiple bind of DHCP client port. Later, we need to implement
per adapter binding.

svn path=/trunk/; revision=14641
2005-04-16 22:10:55 +00:00
Alex Ionescu
d70abfc25b More I/O Stuff that was leftover in the old branch. Yes I'm still on break, I'm just comitting
my local work to avoid duplication.

    - Implemented IoRegisterBootDriverReinitialization, but routines don't actually get called yet.
    - Created IopGetDeviceObjectPointer to deal with the case when the pointer is needed for an attach;
      when this happens, a special (documented) flag should be sent to the driver, so that it can do any
      internal routines to be ready for an attach.
    - Fixed IoAttachDevice to use the Safe Attach routine and sent the IO_ATTACH_DEVICE_API flag (See above)
    - Fixed IoAttachDeviceToDeviceStack to call the safe function.
    - Optimized IoAttachDeviceByPointer
    - Implemented IoAttachDeviceToDeviceStackSafe. Support Device Extension Attach semantics.
    - Added various checks for unload/delete flags (that we never supported). Checks are pretty useless for now
      since we don't use the flags, but I've added one during IoDeleteDevice.
    - Implemented IoEnumerateDeviceObjectList. Should work, but untested.
    - Implemented IoGetDeviceAttachmentBaseRef.
    - Optimized IoGetRelatedDeviceObject.
    - Made IoGetDeviceObjectPointer call the internal routine (see #2 above).
    - Implemented IoDetachDevice.
    - Removed IoOpenDeviceInstanceKey and IoQueryDeviceEnumInfo. Obsoleted, unimplemented, undocumented NT4 APIs.
    - Various Attach/Detach fixes.

svn path=/trunk/; revision=14640
2005-04-16 21:41:32 +00:00
Alex Ionescu
39ef71436d Add file object flags, complete DEVOBJ_EXTENSION, and implement: IoIsFileOriginRemote, IoGetLowerDeviceObject, IoGetdiskDeviceObject, IoGetRequestorSessionId, IoGetRequestorProcessId
svn path=/trunk/; revision=14639
2005-04-16 19:38:14 +00:00
Alex Ionescu
9d6033ebad Fix WaitAll bug. Previously, not all Wait Objects in a WaitAll were checked for signaling, which meant as soon as one was signaled, all were supposed to be satisfied. Worse however, only one object would get satisfied anyways, because of a second bug which hid the first during my testing. Now, all wait all objects must be signaled before satsifcation, and satisfaction is correctly done on all the objects. Reg tested with multithrdwin, which did not properly work before. Thanks to w3seek for notifying me of this bug.
svn path=/trunk/; revision=14638
2005-04-16 17:48:46 +00:00
Maarten Bosma
88594a14de PackageManager: Ported GUI to C
svn path=/trunk/; revision=14637
2005-04-16 17:09:12 +00:00
Hervé Poussineau
f5129193e2 Implement FSCTL_IS_VOLUME_DIRTY and FSCTL_MARK_VOLUME_DIRTY
svn path=/trunk/; revision=14636
2005-04-16 16:04:38 +00:00
Eric Kohl
5942162766 ADVAPI32.DLL:
- Implement LockServiceDatabase and UnlockServiceDatabase.

SERVICES.EXE:
- Add stubs: ScmrLockServiceDatabase, ScmrUnlockDerviceDatabase, SamrNotifyBootConfigStatus, and ScmrCreateServiceW.
- Store and check access rights.

svn path=/trunk/; revision=14635
2005-04-16 12:50:33 +00:00
Maarten Bosma
837c3298c7 PackageManager: Little fix
svn path=/trunk/; revision=14634
2005-04-16 11:48:26 +00:00
Maarten Bosma
887849790a PackageManager: Changed download server to my own webspace. Because http://svn.reactos.com is still offline.
svn path=/trunk/; revision=14633
2005-04-16 11:42:44 +00:00
Maarten Bosma
58096a81e6 PackageManager: Converted cmdline interface to C
svn path=/trunk/; revision=14632
2005-04-16 11:11:52 +00:00
Hervé Poussineau
1eb9c1db51 Allow interrupts indicating an empty buffer only if some bytes are pending
This should correct the boot in Qemu

svn path=/trunk/; revision=14631
2005-04-15 22:14:13 +00:00
Eric Kohl
91ec410e2f Use RPC for making calls to the Service Control Manager.
svn path=/trunk/; revision=14630
2005-04-15 22:02:37 +00:00
Art Yerkes
1a1051e787 Removed need for separately prefixed binutils.
svn path=/trunk/; revision=14629
2005-04-15 19:33:51 +00:00
Eric Kohl
9a53101c31 Support in-pointers to structs.
svn path=/trunk/; revision=14628
2005-04-15 17:56:40 +00:00
Hervé Poussineau
fc68dda45d Add ASSERTs
Correct a bug when processing IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation (serenum)
Don't breakpoint if NDEBUG is defined (serenum)
Allow to write more than 16 bytes in one IRP_MJ_WRITE (serial)

svn path=/trunk/; revision=14627
2005-04-15 15:56:19 +00:00
Thomas Bluemel
df118afc6f use the correct version of KeGetCurrentIrql for MP
svn path=/trunk/; revision=14626
2005-04-15 10:52:29 +00:00
Alex Ionescu
956f376f4f Implemented Guarded Mutex, a drop-in replacement for Fast Mutex (the correct one, not the one ROS incorrectly implements) on NT 5.2. Not fully tested yet, so nothing switched to it and probably not usable. Also made KeGetCurrentThread/Irql become inlined, since this should create quite a speed boost. Made KeLeaveCriticalRegion deliver APCs if possible, and made Crit regions macros usable from outside ntoskrnl thanks to a new NT 5.2 API (KiCheckForKernelApcDelivery). Guarded Mutex code based on Filip Navara.
svn path=/trunk/; revision=14625
2005-04-15 06:24:35 +00:00
Art Yerkes
3e3c9e9775 Use DriverDesc in the registry as the adapter name since the ndis name OID
seems generally unimplemented.  What a pain.

svn path=/trunk/; revision=14624
2005-04-15 00:48:25 +00:00
Hervé Poussineau
34eabf82b5 Change debug messages to more neutral ones
svn path=/trunk/; revision=14623
2005-04-14 22:41:48 +00:00
Emanuele Aliberti
b47adbe03f Simple Win32/text application to query the SM (incomplete/untested).
svn path=/trunk/; revision=14621
2005-04-14 21:46:14 +00:00
Martin Fuchs
adcb1f9fef charn <charn89@hotmail.com>:
A function for desktopbar.cpp that controls how the taskbar can be resized.

svn path=/trunk/; revision=14620
2005-04-14 20:32:00 +00:00
Martin Fuchs
3d7368e673 from ThomasLa <sikker2004@yahoo.com>:
Corrected DE.rc language controls
Modifed EN.rc
implemented part of screensaver functions

Shows Screensavers
Get Some Values from registry
get default screensaver
implemented delete screensavers

svn path=/trunk/; revision=14619
2005-04-14 20:23:02 +00:00
Thomas Bluemel
c6c92ec896 add some missing gdi functions to the driver function table
svn path=/trunk/; revision=14618
2005-04-14 15:47:03 +00:00
Thomas Bluemel
33bd174f16 define KGATE in win32api
svn path=/trunk/; revision=14617
2005-04-14 15:45:14 +00:00
Art Yerkes
a4ca03679f Sorry, forgot header for API dll communication.
svn path=/trunk/; revision=14605
2005-04-13 06:55:26 +00:00
Alex Ionescu
3b6c6f0a94 Kernel Gates. Ultra-lightweight and exclusive Wait Objects used in NT 5.2+ as high-speed events. Code is untested, so it's not added to the build until I'm back in May.
svn path=/trunk/; revision=14603
2005-04-13 01:12:08 +00:00
Art Yerkes
b9df1e262e Added DHCP and dhcpcapi to the makefile.
svn path=/trunk/; revision=14602
2005-04-12 23:33:29 +00:00
Art Yerkes
abe286b572 Patch by tinus_ to fix a persistent problem with kdbg. Fixes the y umlaut
bug.

svn path=/trunk/; revision=14601
2005-04-12 23:27:59 +00:00
Art Yerkes
d91b173cb3 First instance of DHCP client API. Not tested yet. Next, the control
panel.

svn path=/trunk/; revision=14600
2005-04-12 23:25:14 +00:00
Art Yerkes
1df2f8903a Added client API interface.
svn path=/trunk/; revision=14599
2005-04-12 23:23:26 +00:00
Emanuele Aliberti
b27e166698 SM: some server side code for SM_API_QUERY_INFORMATION
svn path=/trunk/; revision=14598
2005-04-12 21:25:58 +00:00
Hervé Poussineau
95cdf6e471 Remove unneeded hack. DriverEntry is now called only once.
svn path=/trunk/; revision=14597
2005-04-11 22:38:53 +00:00
Hervé Poussineau
63e93fb6ba Respect OBJ_OPENIF flag in ObCreateObject
svn path=/trunk/; revision=14596
2005-04-11 22:38:05 +00:00
Hervé Poussineau
c568ca436d Open \Windows directory if it exists
svn path=/trunk/; revision=14595
2005-04-11 22:37:46 +00:00
Hervé Poussineau
40c9a57fa2 Don't call DriverEntry more than once. Fix suggested by Filip Navara.
svn path=/trunk/; revision=14594
2005-04-11 22:29:31 +00:00
Thomas Bluemel
9a3b51ea9a support kernel handles, creating them is however not yet supported
svn path=/trunk/; revision=14593
2005-04-11 21:50:15 +00:00
Maarten Bosma
e70a05cabf Package Manager: fixed HotKeys (thanks to w3seek) *shamed*
svn path=/trunk/; revision=14592
2005-04-11 20:27:20 +00:00
Maarten Bosma
abd513250f PackageManager: Bug fix
svn path=/trunk/; revision=14590
2005-04-11 17:59:52 +00:00
Hervé Poussineau
4b77a4d92d Filip Navara <xnavara@volny.cz>: Use correct service name in IopInitializeDriverModule
svn path=/trunk/; revision=14589
2005-04-11 17:28:14 +00:00
Art Yerkes
298503a6e4 Commit for blight: fix stack alignment.
svn path=/trunk/; revision=14588
2005-04-11 15:43:04 +00:00
Aleksey Bragin
093d9f292c Initial version of uhci driver import from Linux 2.5 kernel. Currently compiles and links, but not usable (most probably will bugcheck when loaded).
Also a lot of compile warnings exist.
I will update UsbStack wiki page sometime soon to reflect direction of my work.

svn path=/trunk/; revision=14587
2005-04-11 12:49:25 +00:00
Art Yerkes
7af94c863d Use the right set (the referenced file objects) to compare when killing
exclusive select objects.  This fixes the select leakage observed when
running Xircon.

svn path=/trunk/; revision=14586
2005-04-11 08:41:58 +00:00
Art Yerkes
d34cc750d8 Fixed warning, uninitialized length. Sorry, I did this in a different way
and missed one use of NewBufferLen.  Not sure why I don't see the 'might be
used uninitialized' warning.

svn path=/trunk/; revision=14585
2005-04-11 08:07:41 +00:00
Art Yerkes
9166ff8f34 lock: Fixes suggested by w3seek:
protect the remaining MmProbeAndLockPages
don't return from the exception handler

read: Hopefully the last indecision in here:

Avoid using AFD_EVENT_CLOSE until the socket is really toast.
Use AFD_EVENT_DISCONNECT instead when we've got an EOF, but still have
buffered data.
I was doing this socket fiddling without a callout block.  Fixed.

svn path=/trunk/; revision=14584
2005-04-11 06:03:20 +00:00
Aleksey Bragin
7bbf6258d7 Started implementing Locale property page of intl.cpl appltet. It already provides choices for locale, the only thing it doesn't do - actually set chosen locale. Also it doesn't work under ReactOS.
svn path=/trunk/; revision=14583
2005-04-10 21:01:13 +00:00
Emanuele Aliberti
810d009783 SM: initial work on SM_API_QUERY_INFORMATION (client side; ROS specific).
SM: fixed connection data in callback SM->subsystem_server during ss registration

svn path=/trunk/; revision=14581
2005-04-10 19:08:23 +00:00
Maarten Bosma
c1a2f01875 PackageManager: Cmdline fix
svn path=/trunk/; revision=14580
2005-04-10 17:03:40 +00:00
Hartmut Birr
0ba6cce82a Added dependency tracking.
svn path=/trunk/; revision=14579
2005-04-10 16:45:30 +00:00
Hartmut Birr
85197737c3 Set a better value for gap3 on read/write requests.
svn path=/trunk/; revision=14578
2005-04-10 16:44:00 +00:00
Hartmut Birr
a6e0f1b9c1 Made the hard coded value for the HUT a little bit longer.
svn path=/trunk/; revision=14577
2005-04-10 16:41:32 +00:00
Maarten Bosma
e45867b698 PackageManager: Depencies
svn path=/trunk/; revision=14576
2005-04-10 15:34:15 +00:00
Aleksey Bragin
56ec91131c Change OsLoadOptions back to the default value
svn path=/trunk/; revision=14574
2005-04-10 14:16:38 +00:00
Aleksey Bragin
b94afd8f6e Add russian keyboard layout to HKLM\...\KeyboardLayours, and also add kbdru.dll into reactos.dff (as pointed again by unC0Rr :-))
svn path=/trunk/; revision=14573
2005-04-10 14:02:31 +00:00
Aleksey Bragin
a16cc05ef2 Added kbdru.dll into build process
svn path=/trunk/; revision=14572
2005-04-10 11:37:57 +00:00
Aleksey Bragin
cc161feeb5 Fix incorrect file name of kgbgb.dll to kbduk.dll (by unC0Rr), added kbdru.dll into keyboard layouts
svn path=/trunk/; revision=14571
2005-04-10 11:35:19 +00:00
Aleksey Bragin
c9481ea29c Fixed incorrect version (was 1010h) to 1000h, as reported by XP's kbdru.dll
svn path=/trunk/; revision=14570
2005-04-10 11:18:05 +00:00
Aleksey Bragin
2663d38106 Some minor additions to support newer versions of uhci driver (though doesn't even compile atm).
svn path=/trunk/; revision=14569
2005-04-10 10:20:10 +00:00
Hartmut Birr
71160a6cae - Fixed the destination path for installing freeldr on a floppy.
- Used NtOpenFile for accessing the mbr or the boot sector.

svn path=/trunk/; revision=14568
2005-04-10 10:16:37 +00:00
Phillip Susi
d36e7a745d Fixed freeldr fat16 boot sector to use the bios provided boot device number instead of the ( usually invalid ) one in the boot sector header.
svn path=/trunk/; revision=14567
2005-04-10 05:00:27 +00:00
Filip Navara
56f3c4ed58 - Pass correct parameters to MmLocateMemoryAreaByAddress in MmLockPagableDataSection.
- Change UNIMPLEMENTED to DPRINT1 in MmLockPagableSectionByHandle.

svn path=/trunk/; revision=14566
2005-04-10 04:02:54 +00:00
Gé van Geldorp
b1cf1bfa05 Fix "make bootcd"
svn path=/trunk/; revision=14565
2005-04-09 22:37:15 +00:00
Aleksey Bragin
52c1eca7aa Implemented kbdru.dll, tested under Windows XP - works great. Though I would appreciate more thorough testing.
svn path=/trunk/; revision=14564
2005-04-09 17:33:47 +00:00
Hartmut Birr
3985d6c980 Close the desktop handle after getting the object pointer.
svn path=/trunk/; revision=14563
2005-04-09 17:10:25 +00:00
Maarten Bosma
a16ba46cd2 svn path=/trunk/; revision=14562 2005-04-09 13:48:31 +00:00
Hartmut Birr
02d3095664 Fixed the dereferencing of an existing named object in IoCreateFile.
svn path=/trunk/; revision=14561
2005-04-09 09:40:44 +00:00
Hartmut Birr
6256db0836 ObCreateObject should return an existing named object if one already exist.
svn path=/trunk/; revision=14560
2005-04-09 09:37:32 +00:00
Hervé Poussineau
366a70a52a GCC 3.3.3 detects uninitialized variable where it is not the case. Workaround problem by moving initialization at the top of function.
svn path=/trunk/; revision=14559
2005-04-08 22:19:39 +00:00
Hartmut Birr
322cd3e113 - Don't allow to create objects in the nt name space for twice.
- Create a stream file object in IoCreateFile if a deviceobject is opening.

svn path=/trunk/; revision=14558
2005-04-08 20:38:08 +00:00
Hartmut Birr
c5ccc1106a Csrss should only open the '\Windows' directory.
svn path=/trunk/; revision=14557
2005-04-08 20:29:30 +00:00
Klemens Friedl
a6bdb724d0 update makefile (add ros-get)
svn path=/trunk/; revision=14556
2005-04-08 19:31:08 +00:00
Maarten Bosma
c6237266d7 PackageManager
Created the commandline Interface
Deleated subcategries

svn path=/trunk/; revision=14553
2005-04-08 19:09:20 +00:00
Magnus Olsen
2cb97d1370 New document icon from Mindflyer <mf@mufunyo.net>
svn path=/trunk/; revision=14549
2005-04-08 16:59:16 +00:00
Royce Mitchell III
601ea5384b use tags for pool allocations, and reformat code
svn path=/trunk/; revision=14547
2005-04-08 13:14:15 +00:00
Royce Mitchell III
18cff7ccc9 use tags for pool allocations, and reformat code
svn path=/trunk/; revision=14546
2005-04-08 13:02:23 +00:00
Royce Mitchell III
dac8f53fe5 use tags for pool allocations, and reformat code
svn path=/trunk/; revision=14545
2005-04-08 12:54:37 +00:00
Art Yerkes
d57bccaddf Adapter: some info display.
Socket: implemented send and recv.

svn path=/trunk/; revision=14544
2005-04-08 11:08:26 +00:00
Art Yerkes
c0282425ac Read: Generalized EOF condition slightly.
Remember to check for failure when locking address buffer.
Lock: SEH to protect from bad address length ptr.

svn path=/trunk/; revision=14543
2005-04-08 11:04:13 +00:00
Royce Mitchell III
e2303991a6 raddr2line utility
moved code common betw rsym and raddr2line to rsym_common.c
simplified tools/Makefile

svn path=/trunk/; revision=14542
2005-04-08 05:35:20 +00:00
Art Yerkes
034bf04901 Initialize these in case handle locking fails.
svn path=/trunk/; revision=14541
2005-04-08 01:11:32 +00:00
Thomas Bluemel
bdd0224945 forward CommConfigDialogA to CommConfigDialogW
svn path=/trunk/; revision=14537
2005-04-07 18:01:29 +00:00
Thomas Bluemel
2acf2098b8 - don't redefine public structures in taskmgr
- minor taskmgr changes and make better use of PCH
- fixed definition of SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION and depending code

svn path=/trunk/; revision=14536
2005-04-07 13:25:34 +00:00
Thomas Bluemel
b995b11c1d fixed warnings
svn path=/trunk/; revision=14535
2005-04-07 13:11:46 +00:00
Magnus Olsen
98b6f6bd7b Remove more hardcode string to En.rc
svn path=/trunk/; revision=14534
2005-04-07 11:24:38 +00:00
Thomas Bluemel
68c2c91476 reformat some code to make it readably
svn path=/trunk/; revision=14530
2005-04-06 18:30:09 +00:00
Thomas Bluemel
237d12dc8e Saveliy Tretiakov <saveliyt@mail.ru>:
- Implemented CommConfigDialogA and CommConfigDialogW
- Removed @unimplemented comments for some implemented functions

svn path=/trunk/; revision=14529
2005-04-06 17:40:25 +00:00
Thomas Bluemel
95a75efe29 add image base address for serialui.dll
svn path=/trunk/; revision=14528
2005-04-06 17:08:17 +00:00
Thomas Bluemel
cf7a330bf0 use unicode functions only and some minor fixes to preserve 64bit compatibility
svn path=/trunk/; revision=14527
2005-04-06 17:04:28 +00:00
Royce Mitchell III
b8442ebcdd fix uninitialized variable warnings
svn path=/trunk/; revision=14526
2005-04-06 12:32:14 +00:00
Hervé Poussineau
2cec8d9d65 Saveliy Tretiakov <saveliyt@mail.ru>
- Started serialui dll
- Implemented drvCommConfigDialogA and drvCommConfigDialogW

svn path=/trunk/; revision=14525
2005-04-06 11:14:57 +00:00
Hervé Poussineau
b82483c76c Verify that allocated resource list is not NULL in IRP_MN_START_DEVICE.
svn path=/trunk/; revision=14524
2005-04-06 06:09:01 +00:00
Royce Mitchell III
7b78b8092c patch by kjk::hyperion, fix syntax of gcc inline asm
svn path=/trunk/; revision=14523
2005-04-06 04:03:41 +00:00
Steven Edwards
bbba49d610 remove the use of windows.h in some places where it is not needed
svn path=/trunk/; revision=14522
2005-04-05 23:04:24 +00:00
Alex Ionescu
16290c9195 Use w32api... hope this does something? Just trying to help steven.
svn path=/trunk/; revision=14521
2005-04-05 21:41:03 +00:00
Steven Edwards
49388de0ac fixed rosapps a bit. disabled tests for now. will fix them tonight
svn path=/trunk/; revision=14519
2005-04-05 19:42:40 +00:00
Steven Edwards
c773a28861 more w32api conversion. Send errors.h to the Trash Can
svn path=/trunk/; revision=14518
2005-04-05 19:30:34 +00:00
Steven Edwards
bd3a9da15f fixed header usage. Please avoid using windows.h
svn path=/trunk/; revision=14517
2005-04-05 19:22:30 +00:00
Steven Edwards
ff86185830 remove windows.h
svn path=/trunk/; revision=14516
2005-04-05 19:19:44 +00:00
Steven Edwards
1cb1df84c1 __USE_W32API
svn path=/trunk/; revision=14515
2005-04-05 19:17:21 +00:00
Steven Edwards
8a7c057498 __USE_W32API
svn path=/trunk/; revision=14514
2005-04-05 19:14:37 +00:00
Steven Edwards
d3ab2ca78a use -D__USE_W32API
svn path=/trunk/; revision=14513
2005-04-05 19:13:51 +00:00
Hervé Poussineau
353bc6197c Add serial port enumerator driver:
- Enumerate legacy mice
- Should also detect PnP serial devices even if they are not yet reported
It is implemented as an upper filter for serial port driver (serial.sys)
Add corresponding registry entries

svn path=/trunk/; revision=14512
2005-04-05 19:04:07 +00:00
Steven Edwards
c6779bb5c2 use -D__USE_W32API
svn path=/trunk/; revision=14511
2005-04-05 18:59:56 +00:00
Hartmut Birr
785882957e - Changed the calculation of the current sector count to read or write from both sides of a floppy in one step.
- Set the EOT sector always to the last sector of a floppy.

svn path=/trunk/; revision=14506
2005-04-05 17:12:52 +00:00
Hartmut Birr
80eabf0040 Initialize the maximum length of the device description to allocate more than map register.
svn path=/trunk/; revision=14505
2005-04-05 17:07:56 +00:00
Hartmut Birr
1a0cac4ee8 Set the correct CurrentVa in the call to IoFlushAdapterBuffers.
svn path=/trunk/; revision=14504
2005-04-05 15:53:09 +00:00
Hartmut Birr
e1d5086ebf Changed back to IoBuildSynchronousFsdRequest.
svn path=/trunk/; revision=14503
2005-04-05 15:51:02 +00:00
Thomas Bluemel
2177dfcfd2 free work items after processing them
svn path=/trunk/; revision=14502
2005-04-05 15:08:18 +00:00
Hervé Poussineau
47632d3088 Print date and time formats according to regional settings
svn path=/trunk/; revision=14501
2005-04-05 12:34:38 +00:00
Hervé Poussineau
f477aa0a0f Remove useless code (ACPI now reports resources correctly)
Change ULONG to ULONG_PTR for IoStatus.Information field

svn path=/trunk/; revision=14500
2005-04-05 12:00:37 +00:00
Hervé Poussineau
849f32b6b5 Implement IRP_MN_QUERY_RESOURCES (Irq, IO ports, DMA)
svn path=/trunk/; revision=14499
2005-04-05 12:00:13 +00:00
Royce Mitchell III
f165c00432 add some asserts
svn path=/trunk/; revision=14498
2005-04-05 05:12:16 +00:00
Art Yerkes
13027a8afa Added acknowledgement (thank tinus and sorry I didn't put this in the first
commit).

svn path=/trunk/; revision=14497
2005-04-04 23:48:11 +00:00
Art Yerkes
cb76d1fab2 First import of DHCP client service.
No pipe created yet.  Event model up and running.
Does not produce a dhcp offer yet but working on that.

svn path=/trunk/; revision=14496
2005-04-04 23:45:33 +00:00
Hervé Poussineau
e26cc4962b Fix file properties
svn path=/trunk/; revision=14495
2005-04-04 23:17:28 +00:00
Hervé Poussineau
04bbda156c Move variable declarations at the start of functions
svn path=/trunk/; revision=14494
2005-04-04 23:12:21 +00:00
Hartmut Birr
f4a430511e Check for an valid mdl pointer before calling IoFreeMdl in IoReadWriteCompletion.
svn path=/trunk/; revision=14493
2005-04-04 23:11:19 +00:00
Hartmut Birr
1844746db4 Fixed some bugs, which have prevented the using of isa dma channels.
svn path=/trunk/; revision=14492
2005-04-04 23:09:15 +00:00
Hervé Poussineau
e0dfaf1c5b Allow ACPI detection and legacy detection for serial ports
Detect serial debug port and prevent its management by serial driver
Activate serial driver in registry

svn path=/trunk/; revision=14491
2005-04-04 23:00:52 +00:00
Hervé Poussineau
d9bef42fde Correct IOCTL_SERIAL_CLEAR_STATS and IOCTL_SERIAL_PURGE
Manage read errors (overrun, parity, ...)
Use output buffer even if Uart is ready to transmit

svn path=/trunk/; revision=14490
2005-04-04 22:48:51 +00:00
Alex Ionescu
ff0ad6c8cb Compile with w32api...gift for Steven
svn path=/trunk/; revision=14486
2005-04-04 03:55:43 +00:00
Hervé Poussineau
6514e33a95 Replace polling mode in IRP_MJ_READ by an interrupt mode.
It is a lot less CPU consuming...

svn path=/trunk/; revision=14485
2005-04-03 21:36:15 +00:00
Hervé Poussineau
ad17913046 Add WaitAll and WaitAny values
svn path=/trunk/; revision=14484
2005-04-03 21:31:41 +00:00
Eric Kohl
aed77eddbd Support marshalling of 'unique' strings.
svn path=/trunk/; revision=14482
2005-04-03 19:15:14 +00:00
Klemens Friedl
be04afc103 ReactOS Package Manager
More information:
http://reactos.com/wiki/index.php/ReactOS_Package_Manager

* Maarten Bosma (Dr. Fred)
* Klemens Friedl (frik85)

svn path=/trunk/; revision=14481
2005-04-03 19:06:49 +00:00
Hartmut Birr
f22d019858 Removed some calls to NtOpenProcess. They aren't necessary because the process data structure contains already a process handle.
svn path=/trunk/; revision=14480
2005-04-03 15:47:15 +00:00
Emanuele Aliberti
4e0cf9abb6 WinTrust.dll: Update EXPORTS table
svn path=/trunk/; revision=14479
2005-04-03 14:38:42 +00:00
Martin Fuchs
a9f4f32734 activate printer folder menu
svn path=/trunk/; revision=14478
2005-04-03 14:32:47 +00:00
Magnus Olsen
af2755d461 minor change that I did forget
svn path=/trunk/; revision=14477
2005-04-03 13:45:23 +00:00
Magnus Olsen
2f4cc70e0f Remove more hardcode string to En.rc
svn path=/trunk/; revision=14476
2005-04-03 13:40:15 +00:00
Hartmut Birr
7f6485630b Since a process id is only unique if the associated process is not deleted,
we must prevent the deleting of the process. An opened handle does this.

svn path=/trunk/; revision=14475
2005-04-03 13:04:10 +00:00
Eric Kohl
938d6d1baf Support 'ref' and 'unique' attributes for pointers.
svn path=/trunk/; revision=14474
2005-04-03 12:49:25 +00:00
Martin Fuchs
d840ae26ad protect system image list
svn path=/trunk/; revision=14473
2005-04-03 12:14:30 +00:00
Martin Fuchs
b01de1ffd4 show logoff dialog in lean explorer
svn path=/trunk/; revision=14470
2005-04-03 11:38:08 +00:00
Martin Fuchs
359d3bc253 display "log off" dialog, add "terminate" menu entry
svn path=/trunk/; revision=14469
2005-04-03 11:23:03 +00:00
Magnus Olsen
315c267eef Remove more hardcode string to En.rc
svn path=/trunk/; revision=14467
2005-04-03 10:16:56 +00:00
Hartmut Birr
32fce0a991 Initialized the event with the object instead of the handle.
svn path=/trunk/; revision=14465
2005-04-03 10:05:00 +00:00
Martin Fuchs
e56e6b57c7 fix SDI shell browser
svn path=/trunk/; revision=14464
2005-04-03 09:16:20 +00:00
Magnus Olsen
1e7d27e8c9 Remove more hardcode string to En.rc
svn path=/trunk/; revision=14463
2005-04-02 22:19:12 +00:00
Magnus Olsen
2c4319bbb7 Remove more hardcode string to En.rc
svn path=/trunk/; revision=14460
2005-04-02 21:06:44 +00:00
Steven Edwards
3acecc6fd4 another one bytes the dust. messages.h is gone
svn path=/trunk/; revision=14459
2005-04-02 21:02:31 +00:00
Magnus Olsen
70ccaeb797 Did forget the info I did change
it is remove all hardcode string to En.rc
to make it easy to translate

svn path=/trunk/; revision=14458
2005-04-02 20:27:41 +00:00
Magnus Olsen
cc05ff6eb8 svn path=/trunk/; revision=14457 2005-04-02 20:23:01 +00:00
Steven Edwards
93ccc29d64 here you go
svn path=/trunk/; revision=14456
2005-04-02 19:52:29 +00:00
Steven Edwards
0f301d785a __USE_W32API
svn path=/trunk/; revision=14455
2005-04-02 19:47:52 +00:00
Hartmut Birr
ff278d3830 Changed the indentation to a human readable format (no code change).
svn path=/trunk/; revision=14454
2005-04-02 19:33:08 +00:00
Thomas Bluemel
8a17f1f08d corrected file name so it matches the include in slayer.rc
svn path=/trunk/; revision=14453
2005-04-02 19:26:54 +00:00
Steven Edwards
2f69ef0ae5 another one bytes the dust
svn path=/trunk/; revision=14452
2005-04-02 19:13:54 +00:00
Martin Fuchs
38024cdd26 fix termination of "search program" dialog
svn path=/trunk/; revision=14451
2005-04-02 18:24:13 +00:00
Martin Fuchs
275c59c4d4 "minimize all": only minimize windows with valid positions
svn path=/trunk/; revision=14448
2005-04-02 16:18:09 +00:00
Hartmut Birr
fccdd32ffd Dereference the object if the type doesn't match in ObmReferenceObjectByHandle.
svn path=/trunk/; revision=14447
2005-04-02 16:17:08 +00:00
Martin Fuchs
7e355fdee2 update Jamfile
svn path=/trunk/; revision=14446
2005-04-02 16:16:53 +00:00
Hartmut Birr
b82d7998fa Do only dereference the desktop window if the handle was valid in IntMouseInput.
svn path=/trunk/; revision=14445
2005-04-02 16:13:11 +00:00
Hartmut Birr
c5fcba3366 Added the string for IDS_PROGRAMFILES.
svn path=/trunk/; revision=14444
2005-04-02 15:58:25 +00:00
Hartmut Birr
d5c7b7443b - Fixed ExTimerRundown.
- Fixed adding and removing of timers to the wake list.  
- Fixed the reinserting of the timer apc.  
- Don't unlock the timer twice in NtSetTimer.

svn path=/trunk/; revision=14443
2005-04-02 15:55:15 +00:00
Eric Kohl
23ffe8c3f8 NdrSendReceive: Update the message buffer info after the call to I_RpcSendReceive.
svn path=/trunk/; revision=14442
2005-04-02 15:11:36 +00:00
Martin Fuchs
87c424ef42 reactivate control panel folder
svn path=/trunk/; revision=14441
2005-04-02 14:26:56 +00:00
Hervé Poussineau
ce4cbf5e57 Correct timeout issues when reading
Pend read IRPs
Lots of small issues

svn path=/trunk/; revision=14440
2005-04-02 14:16:47 +00:00
Martin Fuchs
11fe38608b fix tray icon config dialog for the first icon
svn path=/trunk/; revision=14439
2005-04-02 11:40:58 +00:00
Martin Fuchs
c5c1a87719 switch to search icon in search dialog
svn path=/trunk/; revision=14438
2005-04-02 11:21:46 +00:00
Martin Fuchs
45ba821ec5 terminate shell service objects thread if there is nothing to do
svn path=/trunk/; revision=14434
2005-04-02 10:48:16 +00:00
Steven Edwards
5875f60018 __USE_W32API
svn path=/trunk/; revision=14433
2005-04-02 05:43:37 +00:00
Steven Edwards
afa13639b8 bunch of w32api fixes. ascii.h is gonecd ..! coff.h was unused and quite a few others were redunant and could be moved. If you try to build a app in the ROS build system without using __USE_W32API or Unicode beware it won't build as it shouldn't. Also partinfo was really broken so someone needs to fix this. If not I will attempt to w32api'ise it in the morning.
svn path=/trunk/; revision=14432
2005-04-02 05:37:20 +00:00
Steven Edwards
f8ec26b8ae avoid the use of ver.h in favor of winver.h
svn path=/trunk/; revision=14431
2005-04-02 00:49:10 +00:00
Gunnar Dalsnes
95daa63b61 -move rtl thread/process stuff from ntdll to rtl and make ntoskrnl\ldr\init.c use those
-fix RtlCreateUserProcess to create the thread suspended and update all users of RtlCreateUserProcess to manually resume the thread

svn path=/trunk/; revision=14430
2005-04-02 00:18:46 +00:00
Steven Edwards
c8e0c8df83 nevermind. It helps to do a make bootcd in the terminal that has the value and /usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt/bin to mingw defined.
svn path=/trunk/; revision=14429
2005-04-02 00:11:50 +00:00
Steven Edwards
450aa4ce11 mingw32-linux is not setting ARCH=i386....this fixes the bootcd for now
svn path=/trunk/; revision=14428
2005-04-02 00:05:16 +00:00
Steven Edwards
8b21b47868 use the w32api headers
svn path=/trunk/; revision=14426
2005-04-01 21:44:22 +00:00
Steven Edwards
e231640a15 remove my WinCE support attempt
svn path=/trunk/; revision=14425
2005-04-01 21:19:23 +00:00
Steven Edwards
8e401adc6b remove my WinCE support attempt
svn path=/trunk/; revision=14424
2005-04-01 21:18:43 +00:00
Hartmut Birr
e31b75dfe5 - Route the stream file objects also through the close path.
- Calculate the size of the fcb hash table depend on the file system type.

svn path=/trunk/; revision=14422
2005-04-01 18:35:34 +00:00
Hartmut Birr
7bf6af0dce - Use IoBuildAsynchronousFsdRequest instead IoBuildSynchronousFsdRequest in NtRead/WriteFile.
- Guard the calls to IoBuildAsynchronousFsdRequest with an exception frame.

svn path=/trunk/; revision=14421
2005-04-01 18:22:17 +00:00
Hartmut Birr
de83dfa5b8 Raise the exception in MmProbeAndLockPages always with STATUS_ACCESS_VIOLATION.
svn path=/trunk/; revision=14420
2005-04-01 18:19:46 +00:00
Hartmut Birr
4ea628ccaa Guard the calls to MmProbeAndLockPages and IoPrepareIrpBuffer with an exception frame and do free allocated resources if an exception occurs.
svn path=/trunk/; revision=14418
2005-04-01 18:17:47 +00:00
Steven Edwards
fc9d1af415 move another SDK header to the SDK
svn path=/trunk/; revision=14417
2005-04-01 18:06:50 +00:00
Steven Edwards
af98825fd6 use -D__USE_W32API for tgetopt
svn path=/trunk/; revision=14416
2005-04-01 18:00:22 +00:00
Magnus Olsen
a8708688d2 Swedish translation
David Nordenberg 
dnordenberg@users.sourceforge.net

proofread by 
Andreas Bjerkeholt
harteex@gmail.com,



svn path=/trunk/; revision=14415
2005-04-01 11:42:40 +00:00
Magnus Olsen
671ba3795b minor update
Swedish translation
Andreas Bjerkeholt
harteex@gmail.com,

proofread by 
David Nordenberg 
dnordenberg@users.sourceforge.net


svn path=/trunk/; revision=14414
2005-04-01 11:29:14 +00:00
Magnus Olsen
5ca5fa5dd7 David Nordenberg: New copy from english resource translated to Swedish,
old one was missing 95% of its content.
	  proofread by Andreas Bjerkeholt

svn path=/trunk/; revision=14413
2005-04-01 10:19:45 +00:00
Magnus Olsen
dee9cfe25c minor changs by
Swedish translation
Andreas Bjerkeholt
harteex@gmail.com,

and 
proofread by 
David Nordenberg 
dnordenberg@users.sourceforge.net


svn path=/trunk/; revision=14412
2005-04-01 09:54:56 +00:00
Magnus Olsen
0cd3294365 Swedish translation
Andreas Bjerkeholt
harteex@gmail.com,

proofread by 
David Nordenberg 
dnordenberg@users.sourceforge.net


svn path=/trunk/; revision=14411
2005-04-01 09:38:01 +00:00
Magnus Olsen
ed14a2c656 Swedish translation
David Nordenberg 
dnordenberg@users.sourceforge.net

proofread by 
Andreas Bjerkeholt
harteex@gmail.com,



svn path=/trunk/; revision=14410
2005-04-01 09:10:32 +00:00
Magnus Olsen
6edcaa7b93 Swedish translation
David Nordenberg 
dnordenberg@users.sourceforge.net  
with some help from Andreas

proofread by 
Andreas Bjerkeholt
harteex@gmail.com,





svn path=/trunk/; revision=14409
2005-04-01 09:06:13 +00:00
Magnus Olsen
ca512a7b11 Swedish translation
David Nordenberg 
dnordenberg@users.sourceforge.net

proofread by 
Andreas Bjerkeholt
harteex@gmail.com,



svn path=/trunk/; revision=14408
2005-04-01 09:03:09 +00:00
Magnus Olsen
ce23c3c042 Swedish translation
David Nordenberg 
dnordenberg@users.sourceforge.net

proofread by 
Andreas Bjerkeholt
harteex@gmail.com,



svn path=/trunk/; revision=14407
2005-04-01 08:56:53 +00:00
Magnus Olsen
8cd95a438b * David Nordenberg: fixed minor things in swedish translation
dnordenberg@users.sourceforge.net

svn path=/trunk/; revision=14406
2005-04-01 08:54:01 +00:00
Magnus Olsen
5696ea2bc9 Swedish translation
David Nordenberg 
dnordenberg@users.sourceforge.net

proofread by 
Andreas Bjerkeholt
harteex@gmail.com,



svn path=/trunk/; revision=14405
2005-04-01 08:51:57 +00:00
Steven Edwards
a9bcd9387d moved this to the wrong folder
svn path=/trunk/; revision=14404
2005-04-01 05:12:15 +00:00
Steven Edwards
fd0f414659 move some SDK headers to the SDK, convert filenames and include statements to lowercase as everything else is in lowercase
svn path=/trunk/; revision=14403
2005-04-01 05:04:40 +00:00
Gunnar Dalsnes
0b60acbc3c -move ppb from ntdll to rtl
smapiexec.c: free ppb on failure. resume thread (RtlCreateUserProcess is supposed to create the thread suspended)

svn path=/trunk/; revision=14402
2005-04-01 00:39:52 +00:00
Art Yerkes
8a147bd7bb PowerPC also uses 4k pages.
svn path=/trunk/; revision=14401
2005-04-01 00:30:29 +00:00
Art Yerkes
0699457c1d PowerPC architecture files. Few Mach function are implemented.
The biggest things to note here:
1) We have to probe the pci bridge to find out the amount of available
memory on older macs.  We use the base model boot-time assumption that
linux uses and leave it till later to find our max memory.
2) Open firmware proxy functionality is divided in two parts.  FreeLDR
is responsible for providing data to and getting it from Open firmware
in big-endian format in memory.  The ofproxy function itself is
responsible for shifting the arguments and calling the target big endian
function.  The good thing here is that we share open firmware functions
between the xcoff part and FreeLDR.

svn path=/trunk/; revision=14400
2005-04-01 00:22:30 +00:00
Steven Edwards
346e718bc8 Some cleanup of crt.a feel free to remove header duplication and use 'precomp.h' in more places to speed build times
svn path=/trunk/; revision=14399
2005-04-01 00:20:29 +00:00
Art Yerkes
3a1a462a26 Powerpc math header.
svn path=/trunk/; revision=14398
2005-04-01 00:17:10 +00:00
Art Yerkes
c0212e2720 Changes to use stdarg rather than assume that arguments are on the stack
and in the correct order.  Tested on i386 and powerpc.

svn path=/trunk/; revision=14397
2005-04-01 00:15:04 +00:00
Gunnar Dalsnes
7df5d3e7e1 mmfuncs.h: add MmGetSystemAddressForMdlSafe/MmMapLockedPagesSpecifyCache defs.
matherr.c: remove _exception struct since its already in math.h
path: simply file exsitence check
iomgr: simplify/use standard generic file mappings flags
misc.

svn path=/trunk/; revision=14396
2005-04-01 00:04:15 +00:00
Steven Edwards
5b6820630a remove these control panels, they never worked
svn path=/trunk/; revision=14395
2005-03-31 22:40:23 +00:00
Hervé Poussineau
eeabdc3329 Add OBJ_KERNEL_HANDLE value
svn path=/trunk/; revision=14393
2005-03-31 19:33:50 +00:00
Gregor Anich
3d737b9d74 Fix little bug.
svn path=/trunk/; revision=14392
2005-03-31 18:26:31 +00:00
Gregor Anich
91203bfc8d * Move the KdbEntryCount (check for exception inside KDB) into the critical section to prevent KDB from not handling simultaneous exceptions correctly.
* Flush input when KDB is entered.
* Detect if terminal is connected and filter out escape sequences if no terminal is present.

svn path=/trunk/; revision=14389
2005-03-31 16:08:09 +00:00
Thomas Bluemel
97db1efac1 don't bugcheck on object type mismatch in PsLookupCidHandle
svn path=/trunk/; revision=14388
2005-03-31 14:23:11 +00:00
Alex Ionescu
fd13cf7e83 Clean up catch.c
svn path=/trunk/; revision=14387
2005-03-31 13:52:49 +00:00
Art Yerkes
8df3d41437 Added boot carrier for freeldr. I'm at the point where I need to do
something about the mac disklabel, because freeldr is trying to read
a PC partition table.  I'll need to sleep on it a bit.

svn path=/trunk/; revision=14386
2005-03-31 09:30:29 +00:00
Thomas Bluemel
1d13fa9747 initialize variables
svn path=/trunk/; revision=14384
2005-03-30 20:19:47 +00:00
Alex Ionescu
6f4ae1108e Return status on failure.
svn path=/trunk/; revision=14383
2005-03-30 00:44:52 +00:00
Alex Ionescu
4069692f64 Add SEH...thanks to Hardon for noticing the bugs
svn path=/trunk/; revision=14382
2005-03-30 00:32:38 +00:00
Thomas Bluemel
c1442ae332 - added stub for PoQueueShutdownWorkItem required by XP's ntfs.sys
- added stubs for KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock

svn path=/trunk/; revision=14381
2005-03-29 17:29:02 +00:00
Thomas Bluemel
9ad486dd0a - ported RtlVerifyVersionInfo from wine
- moved version functions in kernel32 into their own file

svn path=/trunk/; revision=14380
2005-03-29 15:22:44 +00:00
Thomas Bluemel
911b9d27ae move chkstk.s from ntdll to rtl because _alloca_probe needs to be exported by ntoskrnl as well
svn path=/trunk/; revision=14379
2005-03-29 14:27:46 +00:00
Thomas Bluemel
7c238e511f implemented RtlValidateUnicodeString, thanks to "mephistopheles" for providing some pseudeo code
svn path=/trunk/; revision=14378
2005-03-29 02:09:42 +00:00
Magnus Olsen
dea5b1d43f Swedish translation
David Nordenberg 
dnordenberg@users.sourceforge.net

proofread by 
Andreas Bjerkeholt
harteex@gmail.com,

steven : Will commit it to wine also 

svn path=/trunk/; revision=14377
2005-03-28 19:29:59 +00:00
Magnus Olsen
0c492c87b9 Swedish translation
David Nordenberg 
dnordenberg@users.sourceforge.net

proofread by 
Andreas Bjerkeholt
harteex@gmail.com,

changes only for swedish user
steven : Will commit it to wine also 
IDD_TBCUSTOMIZE, LTEXT "Knappar i..." changed width to 85

svn path=/trunk/; revision=14376
2005-03-28 19:25:02 +00:00
Magnus Olsen
29937a5a8c Swedish translation
Andreas Bjerkeholt
harteex@gmail.com,

proofread by 
David Nordenberg 
dnordenberg@users.sourceforge.net


svn path=/trunk/; revision=14375
2005-03-28 19:03:06 +00:00
Magnus Olsen
f9764318f4 New driver ico from Mindflyer <mf@mufunyo.net>
svn path=/trunk/; revision=14374
2005-03-28 18:52:52 +00:00
Hartmut Birr
7189768d70 - Used different overlapped structures for read and write operations on the server side.
- Check for pending i/o requests.

svn path=/trunk/; revision=14373
2005-03-28 18:47:19 +00:00
Hartmut Birr
a48a01798c - Put the wait entry into the DriverContext of the irp instead to allocated it from pool.
- Lock the data list on both ends of the pipe, if we disconnect the pipe.    
- Implemented a read and a write event on each end of the pipe.  
- Implemented a list for read requests to deliver the requests in the correct sequence.  
- Do not end a read request if the pipe was connected and if the buffer wasn't filled completely.

svn path=/trunk/; revision=14372
2005-03-28 18:42:53 +00:00
Alex Ionescu
9b5646acd0 Make w3seek happy. Setting OPTIMIZE=yes as en enviro-var (do NOT add to config) will force optimizations for debug builds too (not recommended). Previous commit was a mistake.
svn path=/trunk/; revision=14371
2005-03-28 18:37:39 +00:00
Magnus Olsen
a57d7a6f93 remove res
svn path=/trunk/; revision=14370
2005-03-28 18:12:31 +00:00
Magnus Olsen
16b0e06b8f Remove the exteran icon file as request from
GvG and other. for the maintain betwin reactos and wine
should be more easy. The new icon from MF are now instead embeded in th shres.rc 

svn path=/trunk/; revision=14369
2005-03-28 18:10:32 +00:00
Alex Ionescu
ea49ca93dd Make w3seek happy. Setting OPTIMIZE=yes as en enviro-var (do NOT add to config) will force optimizations for debug builds too (not recommended)
svn path=/trunk/; revision=14368
2005-03-28 17:27:20 +00:00
Thomas Bluemel
e7986f168f fix warning on optimized builds
svn path=/trunk/; revision=14367
2005-03-28 17:25:19 +00:00
Magnus Olsen
903225f24e did foget the icon form mf
svn path=/trunk/; revision=14366
2005-03-28 16:51:23 +00:00
Magnus Olsen
4d27307543 New ico from Mindflyer <mf@mufunyo.net>
svn path=/trunk/; revision=14365
2005-03-28 16:47:33 +00:00
Thomas Bluemel
713139d9ea release the adapter lock after queuing a work item for the request in ProRequet()
svn path=/trunk/; revision=14364
2005-03-28 16:04:18 +00:00
Thomas Bluemel
d295d5da57 release the dispatcher lock in KeReleaseMutant before raising an exception and handle the exception in NtReleaseMutant
svn path=/trunk/; revision=14363
2005-03-28 15:17:54 +00:00
Martin Fuchs
f3fc2ca494 enable multiline tooltips
svn path=/trunk/; revision=14362
2005-03-28 10:56:29 +00:00
Martin Fuchs
9b8f8ea446 launch all registered Shell Service Objects (Systray, network icons, ...)
svn path=/trunk/; revision=14361
2005-03-28 09:16:50 +00:00
Art Yerkes
f9a85ac5fb Make sure that the socket structure list does't accumulate duplicates.
svn path=/trunk/; revision=14360
2005-03-28 02:50:23 +00:00
Klemens Friedl
8030aa9a2c change the icon file
svn path=/trunk/; revision=14359
2005-03-27 21:34:41 +00:00
Klemens Friedl
fe96ab9edf change the icon file
svn path=/trunk/; revision=14358
2005-03-27 21:32:35 +00:00
Martin Fuchs
628501e0ac New ReactOS and start menu icons by Mindflyer <mf@mufunyo.net>
svn path=/trunk/; revision=14357
2005-03-27 20:46:17 +00:00
Klemens Friedl
bcfaaaf65b Remove the icon files, greatlrd add these icons (from Mindflyer) already to an other folder.
svn path=/trunk/; revision=14356
2005-03-27 20:12:36 +00:00
Klemens Friedl
0607c67b68 Remove all hardcode english phrases from the source code and add the phrases to the resource file.
svn path=/trunk/; revision=14355
2005-03-27 20:01:18 +00:00
Martin Fuchs
03a5f16ed9 - make Shell Hook Messages really work in Windows
- comments for SHELL32's RegisterShellHook()

svn path=/trunk/; revision=14354
2005-03-27 19:57:26 +00:00
Magnus Olsen
0baf2d03b1 New ico from Mindflyer <mf@mufunyo.net>
Swedish translation of explorer By
David Nordenberg dnordenberg@users.sourceforge.net

svn path=/trunk/; revision=14353
2005-03-27 19:57:20 +00:00
Magnus Olsen
761a68acf7 New ico from Mindflyer <mf@mufunyo.net>
svn path=/trunk/; revision=14352
2005-03-27 19:50:50 +00:00
Martin Fuchs
154128c1a0 launch shell DDE server
svn path=/trunk/; revision=14351
2005-03-27 18:13:43 +00:00
Martin Fuchs
cd0596ffa4 hide login screen to make the login on XP faster
svn path=/trunk/; revision=14350
2005-03-27 16:32:06 +00:00
Filip Navara
742ddb108f Fix memory leak I introduced in revision 14343 and fix buffer size calculation to save 4 bytes.
svn path=/trunk/; revision=14349
2005-03-27 13:03:30 +00:00
Eric Kohl
f39737088b Added handling of unsigned type. Patch by Jacek Caban (from WINE).
svn path=/trunk/; revision=14348
2005-03-27 13:02:06 +00:00
Hervé Poussineau
577b88645b Saveliy Tretiakov <saveliyt@mail.ru>
- Implement ClearCommError
- Correct badly implemented apis: ClearCommBreak, EscapeCommFunction, GetCommMask, GetCommModemStatus, GetCommState, GetCommTimeouts, PurgeComm, SetCommBreak, SetCommMask, SetCommTimeouts, SetCommState, SetupComm, TransmitCommChar, WaitCommEvent

svn path=/trunk/; revision=14346
2005-03-27 12:03:59 +00:00
Hervé Poussineau
fce0440b32 Fix handling of input and output buffers
svn path=/trunk/; revision=14345
2005-03-27 11:14:30 +00:00
Hervé Poussineau
f0e7b26df9 Mark Junker <mjscod@gmx.de>
Don't detect a 16550A UART if it is a 16550.

svn path=/trunk/; revision=14344
2005-03-27 11:13:25 +00:00
Filip Navara
5f113d7735 Correct DLL loading order and honour the LOAD_WITH_ALTERED_SEARCH_PATH flag.
svn path=/trunk/; revision=14343
2005-03-27 11:00:41 +00:00
Filip Navara
e332bc75f9 - Rewrite NtUserGetUpdateRect. It should return TRUE when the window needs to be pained, not only when the client update rect is non-empty.
- Return TRUE for windows with pending WM_NCPAINT message in IntIsWindowDirty.

svn path=/trunk/; revision=14342
2005-03-27 08:29:25 +00:00
KJK::Hyperion
212b767a54 Implemented PSEH wrapper for native compiler SEH. Changed copyright years
svn path=/trunk/; revision=14341
2005-03-27 01:57:26 +00:00
KJK::Hyperion
0a9a6b6359 Forgot to implement _SEH2_LEAVE. Also added some _SEH2 aliases to clean any possible ambiguity
svn path=/trunk/; revision=14340
2005-03-27 00:53:15 +00:00
KJK::Hyperion
4d4ec75256 _SEH2_HANDLE as a short-hand for _SEH2_EXCEPT(_SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER))
svn path=/trunk/; revision=14339
2005-03-27 00:44:53 +00:00
KJK::Hyperion
fde9c768e4 New syntax for PSEH. UNTESTED, any takers? It can be used like this:
_SEH2_TRY
{
 // Code that might raise an exception
}
_SEH2_EXCEPT(FilterFunc)
{
 // Handle the exception
}
_SEH2_END;

or like this:

_SEH2_TRY
{
 // Code that might raise an exception
}
_SEH2_FINALLY(UnwindFunc)
_SEH2_END;

or even like this (but PLEASE forget I said it):

_SEH2_TRY
{
 // Code that might raise an exception
}
_SEH2_EXCEPT(FilterFunc)
{
 // Handle the exception
}
_SEH2_FINALLY(UnwindFunc)
_SEH2_END;

_SEH2_TRY
{
 // Code that might raise an exception
}
_SEH2_END;

svn path=/trunk/; revision=14338
2005-03-27 00:41:31 +00:00
Emanuele Aliberti
b0c5a68699 Some stubbing and some stack sizes in exported symbols.
svn path=/trunk/; revision=14337
2005-03-26 22:10:04 +00:00
Filip Navara
5b1f9c5705 Fix return value of SwitchToThread.
svn path=/trunk/; revision=14336
2005-03-26 21:16:42 +00:00
Hartmut Birr
b4e10fa87d - Fixed the wrong check for KMUTEX objects in KeRundownThread.
- Fixed the endless loop in KeRundownThread.

svn path=/trunk/; revision=14335
2005-03-26 20:14:06 +00:00
Emanuele Aliberti
a24101498d Exported symbol list updated to 5.1-SP2
svn path=/trunk/; revision=14334
2005-03-26 17:52:32 +00:00
Magnus Olsen
3210fa3a76 Fix some more bugs thanks to Tribes.
Now the mouse y cordinate works fine
Set right timestap on the event. 
Remove time delay on 50ms 
new code for 50ms event calction.

Todo
why does the Tribes get wrong x,y cordinate.
why does the mouse limit area setup are wrong.




svn path=/trunk/; revision=14333
2005-03-26 16:41:45 +00:00
813 changed files with 91347 additions and 40343 deletions

View File

@@ -9,59 +9,118 @@
#include "File.h"
#include "ssprintf.h"
#include "trim.h"
#include "IRCClient.h"
using std::string;
using std::vector;
const char* ArchBlackmann = "ArchBlackmann";
#if defined(_DEBUG) && 0
const char* BOTNAME = "RoyBot";
const char* CHANNEL = "#RoyBotTest";
#else
const char* BOTNAME = "ArchBlackmann";
const char* CHANNEL = "#ReactOS";
#endif
vector<string> tech, module, dev, stru, period;
//vector<string> tech, module, dev, stru, period, status, type, func, irql, curse, cursecop;
void ImportList ( vector<string>& list, const char* filename )
class List
{
File f ( filename, "r" );
public:
string name;
bool macro;
std::vector<std::string> list;
string tag;
int last;
List() { last = -1; }
List ( const char* _name, bool _macro ) : name(_name), macro(_macro)
{
tag = ssprintf("%%%s%%",_name);
last = -1;
}
};
vector<List> lists;
vector<string> ops;
void ImportList ( const char* listname, bool macro )
{
lists.push_back ( List ( listname, macro ) );
List& list = lists.back();
File f ( ssprintf("%s.txt",listname).c_str(), "r" );
string line;
while ( f.next_line ( line, true ) )
list.push_back ( line );
list.list.push_back ( line );
}
const char* ListRand ( const vector<string>& list )
const char* ListRand ( List& list )
{
return list[rand()%list.size()].c_str();
vector<string>& l = list.list;
if ( !l.size() )
{
static string nothing;
nothing = ssprintf ( "<list '%s' empty>", list.name.c_str() );
return nothing.c_str();
}
else if ( l.size() == 1 )
return l[0].c_str();
int sel = list.last;
while ( sel == list.last )
sel = rand()%l.size();
list.last = sel;
return l[sel].c_str();
}
string TechReply()
const char* ListRand ( int i )
{
string t = ListRand(tech);
return ListRand ( lists[i] );
}
int GetListIndex ( const char* listname )
{
for ( int i = 0; i < lists.size(); i++ )
{
if ( !stricmp ( lists[i].name.c_str(), listname ) )
return i;
}
return -1;
}
List& GetList ( const char* listname )
{
return lists[GetListIndex(listname)];
}
const char* ListRand ( const char* list )
{
int i = GetListIndex ( list );
if ( i < 0 )
return NULL;
return ListRand(i);
}
string TaggedReply ( const char* listname )
{
string t = ListRand(listname);
string out;
const char* p = t.c_str();
while ( *p )
{
if ( *p == '%' )
{
if ( !strnicmp ( p, "%dev%", 5 ) )
bool found = false;
for ( int i = 0; i < lists.size() && !found; i++ )
{
out += ListRand(dev);
p += 5;
if ( lists[i].macro && !strnicmp ( p, lists[i].tag.c_str(), lists[i].tag.size() ) )
{
out += ListRand(i);
p += lists[i].tag.size();
found = true;
}
}
else if ( !strnicmp ( p, "%period%", 8 ) )
{
out += ListRand(period);
p += 8;
}
else if ( !strnicmp ( p, "%module%", 8 ) )
{
out += ListRand(module);
p += 8;
}
else if ( !strnicmp ( p, "%stru%", 6 ) )
{
out += ListRand(stru);
p += 6;
}
else
if ( !found )
out += *p++;
}
const char* p2 = strchr ( p, '%' );
@@ -76,6 +135,28 @@ string TechReply()
return out;
}
string gobble ( string& s, const char* delim )
{
const char* p = s.c_str();
p += strspn ( p, delim );
const char* p2 = strpbrk ( p, delim );
if ( !p2 ) p2 = p + strlen(p);
string out ( p, p2-p );
p2 += strspn ( p2, delim );
s = string ( p2 );
return out;
}
bool isop ( const string& who )
{
for ( int i = 0; i < ops.size(); i++ )
{
if ( ops[i] == who )
return true;
}
return false;
}
// do custom stuff with the IRCClient from your subclass via the provided callbacks...
class MyIRCClient : public IRCClient
{
@@ -92,6 +173,32 @@ public:
}
bool OnJoin ( const string& user, const string& channel )
{
printf ( "user '%s' joined channel '%s'\n", user.c_str(), channel.c_str() );
return true;
}
bool OnPart ( const std::string& user, const std::string& channel )
{
for ( int i = 0; i < ops.size(); i++ )
{
if ( ops[i] == user )
{
printf ( "remove '%s' to ops list\n", user.c_str() );
ops.erase ( &ops[i] );
}
}
return true;
}
bool OnNick ( const std::string& oldNick, const std::string& newNick )
{
for ( int i = 0; i < ops.size(); i++ )
{
if ( ops[i] == oldNick )
{
printf ( "op '%s' changed nick to '%s'\n", oldNick.c_str(), newNick.c_str() );
ops[i] = newNick;
return true;
}
}
return true;
}
bool OnEndChannelUsers ( const string& channel )
@@ -102,19 +209,168 @@ public:
{
printf ( "<%s> %s\n", from.c_str(), text.c_str() );
flog.printf ( "<%s> %s\n", from.c_str(), text.c_str() );
return PrivMsg ( from, "hey, your tongue doesn't belong there!" );
if ( strnicmp ( text.c_str(), "!say ", 5 ) || !isop(from) )
return PrivMsg ( from, "hey, your tongue doesn't belong there!" );
string say = trim(&text[5]);
if ( !strnicmp ( say.c_str(), "/me ", 4 ) )
return Action ( CHANNEL, trim(&say[4]) );
else
return PrivMsg ( CHANNEL, trim(say) );
}
bool OnChannelMsg ( const string& channel, const string& from, const string& text )
{
printf ( "%s <%s> %s\n", channel.c_str(), from.c_str(), text.c_str() );
flog.printf ( "%s <%s> %s\n", channel.c_str(), from.c_str(), text.c_str() );
string text2(text);
bool found_name = false;
string text2 ( text );
strlwr ( &text2[0] );
if ( !strnicmp ( text2.c_str(), ArchBlackmann, strlen(ArchBlackmann) ) )
if ( !strnicmp ( text.c_str(), BOTNAME, strlen(BOTNAME) ) )
found_name = true;
else if ( !strnicmp ( text.c_str(), "arch ", 5 ) )
found_name = true;
if ( found_name )
{
string reply = ssprintf("%s: %s", from.c_str(), TechReply().c_str());
flog.printf ( "TECH-REPLY: %s\n", reply.c_str() );
return PrivMsg ( channel, reply );
string s ( text );
gobble ( s, " \t" ); // remove bot name
found_name = true;
if ( s[0] == '!' )
{
bool from_op = isop(from);
string cmd = gobble ( s, " \t" );
if ( !from_op )
{
if ( cmd == "!grovel" )
{
string out = ssprintf(TaggedReply("nogrovel").c_str(),from.c_str());
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
return Action ( channel, &out[4] );
else
return PrivMsg ( channel, out );
}
return PrivMsg ( channel, ssprintf("%s: I don't take commands from non-ops",from.c_str()) );
}
if ( cmd == "!add" )
{
string listname = gobble ( s, " \t" );
int i = GetListIndex ( listname.c_str() );
if ( i == -1 )
return PrivMsg ( channel, ssprintf("%s: I don't have a list named '%s'",from.c_str(),listname.c_str()) );
List& list = lists[i];
if ( s[0] == '\"' || s[0] == '\'' )
{
char delim = s[0];
const char* p = &s[1];
const char* p2 = strchr ( p, delim );
if ( !p2 )
return PrivMsg ( channel, ssprintf("%s: Couldn't add, unmatched quotes",from.c_str()) );
s = string ( p, p2-p );
}
for ( i = 0; i < list.list.size(); i++ )
{
if ( list.list[i] == s )
return PrivMsg ( channel, ssprintf("%s: entry already exists in list '%s'",from.c_str(),listname.c_str()) );
}
if ( !stricmp ( listname.c_str(), "curse" ) )
strlwr ( &s[0] );
list.list.push_back ( s );
{
File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
for ( i = 0; i < list.list.size(); i++ )
f.printf ( "%s\n", list.list[i].c_str() );
}
return PrivMsg ( channel, ssprintf("%s: entry added to list '%s'",from.c_str(),listname.c_str()) );
}
else if ( cmd == "!remove" )
{
string listname = gobble ( s, " \t" );
int i = GetListIndex ( listname.c_str() );
if ( i == -1 )
return PrivMsg ( channel, ssprintf("%s: I don't have a list named '%s'",from.c_str(),listname.c_str()) );
List& list = lists[i];
if ( s[0] == '\"' || s[0] == '\'' )
{
char delim = s[0];
const char* p = &s[1];
const char* p2 = strchr ( p, delim );
if ( !p2 )
return PrivMsg ( channel, ssprintf("%s: Couldn't add, unmatched quotes",from.c_str()) );
s = string ( p, p2-p );
}
for ( i = 0; i < list.list.size(); i++ )
{
if ( list.list[i] == s )
{
list.list.erase ( &list.list[i] );
{
File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
for ( i = 0; i < list.list.size(); i++ )
f.printf ( "%s\n", list.list[i].c_str() );
}
return PrivMsg ( channel, ssprintf("%s: entry removed from list '%s'",from.c_str(),listname.c_str()) );
}
}
return PrivMsg ( channel, ssprintf("%s: entry doesn't exist in list '%s'",from.c_str(),listname.c_str()) );
}
else if ( cmd == "!grovel" )
{
string out = ssprintf(TaggedReply("grovel").c_str(),from.c_str());
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
return Action ( channel, &out[4] );
else
return PrivMsg ( channel, out );
}
else if ( cmd == "!kiss" )
{
if ( s.size() )
return Action ( channel, ssprintf("kisses %s",s.c_str()) );
else
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
}
else if ( cmd == "!hug" )
{
if ( s.size() )
return Action ( channel, ssprintf("hugs %s",s.c_str()) );
else
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
}
else if ( cmd == "!give" )
{
string who = gobble(s," \t");
if ( who.size() && s.size() )
return Action ( channel, ssprintf("gives %s a %s",who.c_str(),s.c_str()) );
else
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
}
else
{
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
}
}
}
bool found_curse = false;
static vector<string>& curse = GetList("curse").list;
text2 = ssprintf(" %s ",text2.c_str());
for ( int i = 0; i < curse.size() && !found_curse; i++ )
{
if ( strstr ( text2.c_str(), curse[i].c_str() ) )
found_curse = true;
}
if ( found_curse )
{
static List& cursecop = GetList("cursecop");
return PrivMsg ( channel, ssprintf("%s: %s", from.c_str(), ListRand(cursecop)) );
}
else if ( found_name )
{
string out = ssprintf("%s: %s", from.c_str(), TaggedReply("tech").c_str());
flog.printf ( "TECH-REPLY: %s\n", out.c_str() );
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
return Action ( channel, &out[4] );
else
return PrivMsg ( channel, out );
}
return true;
}
@@ -123,9 +379,45 @@ public:
//printf ( "OnChannelMode(%s,%s)\n", channel.c_str(), mode.c_str() );
return true;
}
bool OnUserModeInChannel ( const string& src, const string& channel, const string& user, const string& mode )
bool OnUserModeInChannel ( const string& src, const string& channel, const string& mode, const string& target )
{
//printf ( "OnUserModeInChannel(%s,%s%s,%s)\n", src.c_str(), channel.c_str(), user.c_str(), mode.c_str() );
printf ( "OnUserModeInChannel(%s,%s,%s,%s)\n", src.c_str(), channel.c_str(), mode.c_str(), target.c_str() );
const char* p = mode.c_str();
if ( !p )
return true;
while ( *p )
{
switch ( *p++ )
{
case '+':
while ( *p != 0 && *p != ' ' )
{
if ( *p == 'o' )
{
printf ( "adding '%s' to ops list\n", target.c_str() );
ops.push_back ( target );
}
break;
}
break;
case '-':
while ( *p != 0 && *p != ' ' )
{
if ( *p == 'o' )
{
for ( int i = 0; i < ops.size(); i++ )
{
if ( ops[i] == target )
{
printf ( "remove '%s' to ops list\n", target.c_str() );
ops.erase ( &ops[i] );
}
}
break;
}
}
}
}
return true;
}
bool OnMode ( const string& user, const string& mode )
@@ -135,14 +427,16 @@ public:
}
bool OnChannelUsers ( const string& channel, const vector<string>& users )
{
printf ( "[%s has %i users]: ", channel.c_str(), users.size() );
//printf ( "[%s has %i users]: ", channel.c_str(), users.size() );
for ( int i = 0; i < users.size(); i++ )
{
if ( i )
if ( users[i][0] == '@' )
ops.push_back ( &users[i][1] );
/*if ( i )
printf ( ", " );
printf ( "%s", users[i].c_str() );
printf ( "%s", users[i].c_str() );*/
}
printf ( "\n" );
//printf ( "\n" );
return true;
}
};
@@ -150,32 +444,50 @@ public:
int main ( int argc, char** argv )
{
srand ( time(NULL) );
ImportList ( tech, "tech.txt" );
ImportList ( stru, "stru.txt" );
ImportList ( dev, "dev.txt" );
ImportList ( period, "period.txt" );
ImportList ( module, "module.txt" );
ImportList ( "dev", true );
ImportList ( "func", true );
ImportList ( "dev", true );
ImportList ( "func", true );
ImportList ( "irql", true );
ImportList ( "module", true );
ImportList ( "period", true );
ImportList ( "status", true );
ImportList ( "stru", true );
ImportList ( "type", true );
ImportList ( "tech", false );
ImportList ( "curse", false );
ImportList ( "cursecop", false );
ImportList ( "grovel", false );
ImportList ( "nogrovel", false );
#ifdef _DEBUG
printf ( "initializing IRCClient debugging\n" );
IRCClient::SetDebug ( true );
#endif//_DEBUG
printf ( "calling suStartup()\n" );
suStartup();
printf ( "creating IRCClient object\n" );
MyIRCClient irc;
printf ( "connecting to freenode\n" );
if ( !irc.Connect ( "212.204.214.114" ) ) // irc.freenode.net
//const char* server = "212.204.214.114";
const char* server = "irc.freenode.net";
if ( !irc.Connect ( server ) ) // irc.freenode.net
{
printf ( "couldn't connect to server\n" );
return -1;
}
printf ( "sending user command\n" );
if ( !irc.User ( "ArchBlackmann", "", "irc.freenode.net", "Arch Blackmann" ) )
if ( !irc.User ( BOTNAME, "", "irc.freenode.net", BOTNAME ) )
{
printf ( "USER command failed\n" );
return -1;
}
printf ( "sending nick\n" );
if ( !irc.Nick ( "ArchBlackmann" ) )
if ( !irc.Nick ( BOTNAME ) )
{
printf ( "NICK command failed\n" );
return -1;
@@ -186,8 +498,8 @@ int main ( int argc, char** argv )
printf ( "MODE command failed\n" );
return -1;
}
printf ( "joining #ReactOS\n" );
if ( !irc.Join ( "#ReactOS" ) )
printf ( "joining channel\n" );
if ( !irc.Join ( CHANNEL ) )
{
printf ( "JOIN command failed\n" );
return -1;

View File

@@ -81,7 +81,13 @@ IRCClient::Join ( const string& channel )
bool
IRCClient::PrivMsg ( const string& to, const string& text )
{
return Send ( "PRIVMSG " + to + " :" + text + "\n" );
return Send ( "PRIVMSG " + to + " :" + text + '\n' );
}
bool
IRCClient::Action ( const string& to, const string& text )
{
return Send ( "PRIVMSG " + to + " :" + (char)1 + "ACTION " + text + (char)1 + '\n' );
}
bool
@@ -226,10 +232,41 @@ int IRCClient::Run ( bool launch_thread )
printf ( "!!!:OnRecv failure 5 (PRIVMSG w/o target): %s", buf.c_str() );
continue;
}
if ( tgt[0] == '#' )
OnChannelMsg ( tgt, src, text );
if ( *p == 1 )
{
p++;
p2 = strchr ( p, ' ' );
if ( !p2 ) p2 = p + strlen(p);
cmd = string ( p, p2-p );
strlwr ( &cmd[0] );
p = p2 + 1;
p2 = strchr ( p, 1 );
if ( !p2 )
{
printf ( "!!!:OnRecv failure 6 (no terminating \x01 for initial \x01 found: %s", buf.c_str() );
continue;
}
text = string ( p, p2-p );
if ( cmd == "action" )
{
if ( tgt[0] == '#' )
OnChannelAction ( tgt, src, text );
else
OnPrivAction ( src, text );
}
else
{
printf ( "!!!:OnRecv failure 7 (unrecognized \x01 command '%s': %s", cmd.c_str(), buf.c_str() );
continue;
}
}
else
OnPrivMsg ( src, text );
{
if ( tgt[0] == '#' )
OnChannelMsg ( tgt, src, text );
else
OnPrivMsg ( src, text );
}
}
else if ( cmd == "mode" )
{
@@ -237,22 +274,22 @@ int IRCClient::Run ( bool launch_thread )
//printf ( "[MODE] src='%s' cmd='%s' tgt='%s' text='%s'", src.c_str(), cmd.c_str(), tgt.c_str(), text.c_str() );
//OnMode (
// self mode change:
// [MODE] src=Relic3_14 cmd=mode tgt=Relic3_14 text=+i
// [MODE] src=Nick cmd=mode tgt=Nick text=+i
// channel mode change:
// [MODE] src=Royce3 cmd=mode tgt=#Royce3 text=+o Relic3_14
// [MODE] src=Nick cmd=mode tgt=#Channel text=+o Nick
if ( tgt[0] == '#' )
{
p = text.c_str();
p2 = strchr ( p, ' ' );
if ( !p2 )
OnChannelMode ( tgt, text );
else
if ( p2 && *p2 )
{
string user ( p, p2-p );
string mode ( p, p2-p );
p = p2 + 1;
p += strspn ( p, " " );
OnUserModeInChannel ( src, tgt, user, p );
OnUserModeInChannel ( src, tgt, mode, trim(p) );
}
else
OnChannelMode ( tgt, text );
}
else
OnMode ( tgt, text );
@@ -261,6 +298,14 @@ int IRCClient::Run ( bool launch_thread )
{
OnJoin ( src, text );
}
else if ( cmd == "part" )
{
OnPart ( src, text );
}
else if ( cmd == "nick" )
{
OnNick ( src, text );
}
else if ( isdigit(cmd[0]) )
{
int i = atoi(cmd.c_str());
@@ -307,7 +352,13 @@ int IRCClient::Run ( bool launch_thread )
}
else
{
if ( _debug ) printf ( "unrecognized ':' response: %s", buf.c_str() );
if ( strstr ( buf.c_str(), "ACTION" ) )
{
printf ( "ACTION: " );
for ( int i = 0; i < buf.size(); i++ )
printf ( "%c(%xh)", buf[i], (unsigned)(unsigned char)buf[i] );
}
else if ( _debug ) printf ( "unrecognized ':' response: %s", buf.c_str() );
}
}
else

View File

@@ -48,6 +48,9 @@ public:
// send message to someone or some channel
bool PrivMsg ( const std::string& to, const std::string& text );
// send /me to someone or some channel
bool Action ( const std::string& to, const std::string& text );
// leave a channel
bool Part ( const std::string& channel, const std::string& text );
@@ -59,32 +62,45 @@ public:
// OnConnected: you just successfully logged into irc server
virtual bool OnConnected() = 0;
// OnJoin: you just successfully joined this channel
virtual bool OnJoin ( const std::string& user, const std::string& channel ) = 0;
virtual bool OnNick ( const std::string& oldNick, const std::string& newNick ) { return true; }
// OnJoin: someone just successfully joined a channel you are in ( also sent when you successfully join a channel )
virtual bool OnJoin ( const std::string& user, const std::string& channel ) { return true; }
// OnPart: someone just left a channel you are in
virtual bool OnPart ( const std::string& user, const std::string& channel ) { return true; }
// OnPrivMsg: you just received a private message from a user
virtual bool OnPrivMsg ( const std::string& from, const std::string& text ) = 0;
virtual bool OnPrivMsg ( const std::string& from, const std::string& text ) { return true; }
virtual bool OnPrivAction ( const std::string& from, const std::string& text ) { return true; }
// OnChannelMsg: you just received a chat line in a channel
virtual bool OnChannelMsg ( const std::string& channel, const std::string& from,
const std::string& text ) = 0;
const std::string& text ) { return true; }
// OnChannelAction: you just received a "/me" line in a channel
virtual bool OnChannelAction ( const std::string& channel, const std::string& from,
const std::string& text ) { return true; }
// OnChannelMode: notification of a change of a channel's mode
virtual bool OnChannelMode ( const std::string& channel, const std::string& mode ) = 0;
virtual bool OnChannelMode ( const std::string& channel, const std::string& mode )
{ return true; }
// OnUserModeInChannel: notification of a mode change of a user with respect to a channel.
// f.ex.: this will be called when someone is oped in a channel.
virtual bool OnUserModeInChannel ( const std::string& src, const std::string& channel,
const std::string& user, const std::string& mode ) = 0;
const std::string& mode, const std::string& target ) { return true; }
// OnMode: you will receive this when you change your own mode, at least...
virtual bool OnMode ( const std::string& user, const std::string& mode ) = 0;
virtual bool OnMode ( const std::string& user, const std::string& mode ) { return true; }
// notification of what users are in a channel ( you may get multiple of these... )
virtual bool OnChannelUsers ( const std::string& channel, const std::vector<std::string>& users ) = 0;
virtual bool OnChannelUsers ( const std::string& channel, const std::vector<std::string>& users )
{ return true; }
// notification that you have received the entire list of users for a channel
virtual bool OnEndChannelUsers ( const std::string& channel ) = 0;
virtual bool OnEndChannelUsers ( const std::string& channel ) { return true; }
// OnPing - default implementation replies to PING with a valid PONG. required on some systems to
// log in. Most systems require a response in order to stay connected, used to verify a client hasn't

View File

@@ -0,0 +1,26 @@
shit
fuck
pussy
ass
ass-
-ass
dumbass
jackass
fatass
asshole
smartass
cunt
fucker
bitch
dick
penile
stfu
omfg
lmao
ass.
-ass.
semprini
goat.cx
ekush
akshor
poop

View File

@@ -0,0 +1,10 @@
You should have your mouth washed out with soap!
This is a clean channel... please watch your language
Please try to keep it clean
Hey, there's children present ( I'm not even a year old yet! )
Could you find a less-offensive way to express yourself, please?
Such language :(
Those aren't nice words to use
Oh, my poor innocent ears :(
Help! My mind is being corrupted!
filthy mouths are not appreciated here

View File

@@ -11,4 +11,5 @@ Exception
blight_
jimtabor
mtempel
Gge
Gge
Alex_Ionescu

581
irc/ArchBlackmann/func.txt Normal file
View File

@@ -0,0 +1,581 @@
BOOLEAN
CcCanIWrite
CcCopyRead
CcCopyWrite
CcDeferWrite
CcFastCopyRead
CcFastCopyWrite
CcFlushCache
CcGetDirtyPages
CcGetFileObjectFromBcb
CcGetFileObjectFromSectionPtrs
CcGetFlushedValidData
CcGetLsnForFileObject
CcInitializeCacheMap
CcIsThereDirtyData
CcMapData
CcMdlRead
CcMdlReadComplete
CcMdlWriteAbort
CcMdlWriteComplete
CcPinMappedData
CcPinRead
CcPrepareMdlWrite
CcPreparePinWrite
CcPurgeCacheSection
CcRemapBcb
CcRepinBcb
CcScheduleReadAhead
CcSetAdditionalCacheAttributes
CcSetBcbOwnerPointer
CcSetDirtyPageThreshold
CcSetDirtyPinnedData
CcSetFileSizes
CcSetLogHandleForFile
CcSetReadAheadGranularity
CcUninitializeCacheMap
CcUnpinData
CcUnpinDataForThread
CcUnpinRepinnedBcb
CcWaitForCurrentLazyWriterActivity
CcZeroData
DbgLoadImageSymbols
DbgQueryDebugFilterState
DbgSetDebugFilterState
EVENT_TYPE
ExAcquireResourceExclusive
ExAcquireResourceExclusiveLite
ExAcquireResourceSharedLite
ExAcquireSharedStarveExclusive
ExAcquireSharedWaitForExclusive
ExAllocateFromZone
ExAllocatePool
ExAllocatePoolWithQuota
ExAllocatePoolWithQuotaTag
ExAllocatePoolWithTag
ExConvertExclusiveToSharedLite
ExCreateCallback
ExDeleteNPagedLookasideList
ExDeletePagedLookasideList
ExDeleteResource
ExDeleteResourceLite
ExDisableResourceBoostLite
ExEnumHandleTable
ExExtendZone
ExFreePool
ExGetCurrentProcessorCounts
ExGetCurrentProcessorCpuUsage
ExGetExclusiveWaiterCount
ExGetPreviousMode
ExGetSharedWaiterCount
ExInitializeNPagedLookasideList
ExInitializePagedLookasideList
ExInitializeResource
ExInitializeResourceLite
ExInitializeZone
ExInterlockedAddLargeInteger
ExInterlockedAddUlong
ExInterlockedDecrementLong
ExInterlockedExchangeUlong
ExInterlockedExtendZone
ExInterlockedIncrementLong
ExInterlockedInsertHeadList
ExInterlockedInsertTailList
ExInterlockedPopEntryList
ExInterlockedPushEntryList
ExInterlockedRemoveHeadList
ExIsProcessorFeaturePresent
ExIsResourceAcquiredExclusiveLite
ExIsResourceAcquiredSharedLite
ExLocalTimeToSystemTime
ExNotifyCallback
ExPostSystemEvent
ExQueryPoolBlockSize
ExQueueWorkItem
ExRaiseAccessViolation
ExRaiseDatatypeMisalignment
ExRaiseException
ExRaiseHardError
ExRaiseStatus
ExRegisterCallback
ExReinitializeResourceLite
ExReleaseResource
ExReleaseResourceForThread
ExReleaseResourceForThreadLite
ExRosDumpPagedPoolByTag
ExRosQueryPoolTag
ExSetResourceOwnerPointer
ExSetTimerResolution
ExSystemExceptionFilter
ExSystemTimeToLocalTime
ExTryToAcquireResourceExclusiveLite
ExUnregisterCallback
ExUuidCreate
ExVerifySuite
FsRtlAcquireFileExclusive
FsRtlAddMcbEntry
FsRtlAddToTunnelCache
FsRtlAllocateFileLock
FsRtlAllocatePool
FsRtlAllocatePoolWithQuota
FsRtlAllocatePoolWithQuotaTag
FsRtlAllocatePoolWithTag
FsRtlAllocateResource
FsRtlAreNamesEqual
FsRtlBalanceReads
FsRtlCheckLockForReadAccess
FsRtlCheckLockForWriteAccess
FsRtlCopyRead
FsRtlCopyWrite
FsRtlFastCheckLockForRead
FsRtlFastCheckLockForWrite
FsRtlFastUnlockAll
FsRtlFastUnlockAllByKey
FsRtlFastUnlockSingle
FsRtlFindInTunnelCache
FsRtlFreeFileLock
FsRtlGetFileSize
FsRtlGetNextFileLock
FsRtlGetNextMcbEntry
FsRtlIncrementCcFastReadNoWait
FsRtlIncrementCcFastReadNotPossible
FsRtlIncrementCcFastReadResourceMiss
FsRtlIncrementCcFastReadWait
FsRtlInitializeFileLock
FsRtlInitializeMcb
FsRtlInitializeTunnelCache
FsRtlInsertPerFileObjectContext
FsRtlInsertPerStreamContext
FsRtlIsDbcsInExpression
FsRtlIsFatDbcsLegal
FsRtlIsHpfsDbcsLegal
FsRtlIsNameInExpression
FsRtlLookupLastLargeMcbEntryAndIndex
FsRtlLookupLastMcbEntry
FsRtlLookupMcbEntry
FsRtlLookupPerFileObjectContext
FsRtlLookupPerStreamContextInternal
FsRtlMdlRead
FsRtlMdlReadComplete
FsRtlMdlReadCompleteDev
FsRtlMdlReadDev
FsRtlMdlWriteComplete
FsRtlMdlWriteCompleteDev
FsRtlNotifyChangeDirectory
FsRtlNotifyCleanup
FsRtlNotifyFilterChangeDirectory
FsRtlNotifyFilterReportChange
FsRtlNotifyFullChangeDirectory
FsRtlNotifyFullReportChange
FsRtlNotifyReportChange
FsRtlNotifyUninitializeSync
FsRtlNumberOfRunsInMcb
FsRtlPostPagingFileStackOverflow
FsRtlPostStackOverflow
FsRtlPrepareMdlWrite
FsRtlPrepareMdlWriteDev
FsRtlPrivateLock
FsRtlProcessFileLock
FsRtlRegisterFileSystemFilterCallbacks
FsRtlReleaseFile
FsRtlRemoveMcbEntry
FsRtlRemovePerFileObjectContext
FsRtlRemovePerStreamContext
FsRtlResetLargeMcb
FsRtlSyncVolumes
FsRtlTeardownPerStreamContexts
FsRtlTruncateMcb
FsRtlUninitializeFileLock
FsRtlUninitializeMcb
HalAdjustResourceList
HalAllocateCommonBuffer
HalAssignSlotResources
HalCalibratePerformanceCounter
HalFlushCommonBuffer
HalFreeCommonBuffer
HalGetAdapter
HalGetBusData
HalGetBusDataByOffset
HalGetDmaAlignmentRequirement
HalMakeBeep
HalQueryDisplayParameters
HalQueryRealTimeClock
HalReadDmaCounter
HalRequestIpi
HalSetBusData
HalSetBusDataByOffset
HalSetDisplayParameters
HalSetRealTimeClock
HalStartNextProcessor
IoAcquireCancelSpinLock
IoAcquireRemoveLockEx
IoAcquireVpbSpinLock
IoAllocateAdapterChannel
IoAllocateController
IoAllocateDriverObjectExtension
IoAllocateErrorLogEntry
IoAllocateIrp
IoAllocateMdl
IoAllocateWorkItem
IoAssignResources
IoAttachDevice
IoAttachDeviceByPointer
IoAttachDeviceToDeviceStack
IoAttachDeviceToDeviceStackSafe
IoBuildAsynchronousFsdRequest
IoBuildDeviceIoControlRequest
IoBuildPartialMdl
IoBuildSynchronousFsdRequest
IoCallDriver
IoCancelFileOpen
IoCancelIrp
IoCheckQuerySetFileInformation
IoCheckQuerySetVolumeInformation
IoCheckQuotaBufferValidity
IoCheckShareAccess
IoCompleteRequest
IoConnectInterrupt
IoCreateController
IoCreateDevice
IoCreateDisk
IoCreateDriver
IoCreateFile
IoCreateFileSpecifyDeviceObjectHint
IoCreateNotificationEvent
IoCreateStreamFileObject
IoCreateStreamFileObjectEx
IoCreateStreamFileObjectLite
IoCreateSymbolicLink
IoCreateSynchronizationEvent
IoCreateUnprotectedSymbolicLink
IoDeleteController
IoDeleteDevice
IoDeleteDriver
IoDeleteSymbolicLink
IoDetachDevice
IoDisconnectInterrupt
IoEnqueueIrp
IoEnumerateDeviceObjectList
IoFlushAdapterBuffers
IoForwardIrpSynchronously
IoFreeAdapterChannel
IoFreeController
IoFreeErrorLogEntry
IoFreeIrp
IoFreeMapRegisters
IoFreeMdl
IoFreeWorkItem
IoGetAttachedDevice
IoGetAttachedDeviceReference
IoGetBaseFileSystemDeviceObject
IoGetBootDiskInformation
IoGetConfigurationInformation
IoGetCurrentProcess
IoGetDeviceAttachmentBaseRef
IoGetDeviceInterfaceAlias
IoGetDeviceInterfaces
IoGetDeviceObjectPointer
IoGetDeviceProperty
IoGetDeviceToVerify
IoGetDiskDeviceObject
IoGetDriverObjectExtension
IoGetFileObjectGenericMapping
IoGetInitialStack
IoGetLowerDeviceObject
IoGetRelatedDeviceObject
IoGetRequestorProcess
IoGetRequestorProcessId
IoGetRequestorSessionId
IoGetStackLimits
IoGetTopLevelIrp
IoInitializeIrp
IoInitializeRemoveLockEx
IoInitializeTimer
IoInvalidateDeviceRelations
IoInvalidateDeviceState
IoIsFileOriginRemote
IoIsOperationSynchronous
IoIsSystemThread
IoIsValidNameGraftingBuffer
IoMakeAssociatedIrp
IoMapTransfer
IoOpenDeviceInstanceKey
IoOpenDeviceInterfaceRegistryKey
IoOpenDeviceRegistryKey
IoPageRead
IoPnPDeliverServicePowerNotification
IoQueryDeviceDescription
IoQueryDeviceEnumInfo
IoQueryFileDosDeviceName
IoQueryFileInformation
IoQueryVolumeInformation
IoQueueThreadIrp
IoQueueWorkItem
IoRaiseHardError
IoRaiseInformationalHardError
IoReadDiskSignature
IoReadPartitionTableEx
IoRegisterBootDriverReinitialization
IoRegisterDeviceInterface
IoRegisterDriverReinitialization
IoRegisterFileSystem
IoRegisterFsRegistrationChange
IoRegisterLastChanceShutdownNotification
IoRegisterPlugPlayNotification
IoRegisterShutdownNotification
IoReleaseCancelSpinLock
IoReleaseRemoveLockAndWaitEx
IoReleaseRemoveLockEx
IoReleaseVpbSpinLock
IoRemoveShareAccess
IoReportDetectedDevice
IoReportHalResourceUsage
IoReportResourceForDetection
IoReportResourceUsage
IoReportTargetDeviceChange
IoReportTargetDeviceChangeAsynchronous
IoRequestDeviceEject
IoReuseIrp
IoSetCompletionRoutineEx
IoSetDeviceInterfaceState
IoSetDeviceToVerify
IoSetFileOrigin
IoSetHardErrorOrVerifyDevice
IoSetInformation
IoSetIoCompletion
IoSetPartitionInformationEx
IoSetShareAccess
IoSetStartIoAttributes
IoSetSystemPartition
IoSetThreadHardErrorMode
IoSetTopLevelIrp
IoStartNextPacket
IoStartNextPacketByKey
IoStartPacket
IoStartTimer
IoStopTimer
IoSynchronousInvalidateDeviceRelations
IoSynchronousPageWrite
IoUnregisterFileSystem
IoUnregisterFsRegistrationChange
IoUnregisterPlugPlayNotification
IoUnregisterShutdownNotification
IoUpdateShareAccess
IoValidateDeviceIoControlAccess
IoVerifyPartitionTable
IoVerifyVolume
IoVolumeDeviceToDosName
IoWMIAllocateInstanceIds
IoWMIDeviceObjectToInstanceName
IoWMIExecuteMethod
IoWMIHandleToInstanceName
IoWMIOpenBlock
IoWMIQueryAllData
IoWMIQueryAllDataMultiple
IoWMIQuerySingleInstance
IoWMIQuerySingleInstanceMultiple
IoWMIRegistrationControl
IoWMISetNotificationCallback
IoWMISetSingleInstance
IoWMISetSingleItem
IoWMISuggestInstanceName
IoWMIWriteEvent
IoWriteErrorLogEntry
IoWritePartitionTableEx
KPRIORITY
KdPortGetByte
KdPortPollByte
KdPortPutByte
Ke386QueryIoAccessMap
Ke386SetIoAccessMap
KeAcquireInterruptSpinLock
KeAreApcsDisabled
KeCapturePersistentThreadState
KeDeregisterBugCheckReasonCallback
KeFindConfigurationEntry
KeFindConfigurationNextEntry
KeFlushEntireTb
KeFlushQueuedDpcs
KeGetRecommendedSharedDataAlignment
KeIsExecutingDpc
KeQueryActiveProcessors
KeQueryPerformanceCounter
KeQueryPriorityThread
KeQueryRuntimeThread
KeQuerySystemTime
KeQueryTickCount
KeQueryTimeIncrement
KeRaiseIrql
KeRaiseIrqlToDpcLevel
KeRaiseUserException
KeReadStateEvent
KeRegisterBugCheckCallback
KeRegisterBugCheckReasonCallback
KeReleaseInterruptSpinLock
KeReleaseMutant
KeReleaseMutex
KeReleaseSemaphore
KeReleaseSpinLock
KeReleaseSpinLockFromDpcLevel
KeReleaseSpinLockFromDpcLevel
KeRemoveByKeyDeviceQueue
KeRemoveByKeyDeviceQueueIfBusy
KeRemoveDeviceQueue
KeRemoveEntryDeviceQueue
KeRemoveSystemServiceTable
KeRestoreFloatingPointState
KeRevertToUserAffinityThread
KeRosDumpStackFrames
KeRosGetStackFrames
KeRosPrintAddress
KeSaveFloatingPointState
KeSetDmaIoCoherency
KeSetEvent
KeSetEventBoostPriority
KeSetIdealProcessorThread
KeSetKernelStackSwapEnable
KeSetProfileIrql
KeSetSystemAffinityThread
KeSetTimeIncrement
KeTerminateThread
KeUserModeCallback
KeWaitForMutexObject
KeWaitForSingleObject
KiCoprocessorError
KiUnexpectedInterrupt
LONG
LdrFindResourceDirectory_U
MmAddPhysicalMemory
MmAddVerifierThunks
MmAdjustWorkingSetSize
MmAdvanceMdl
MmAllocateContiguousMemory
MmAllocateContiguousMemorySpecifyCache
MmAllocateMappingAddress
MmAllocateNonCachedMemory
MmBuildMdlForNonPagedPool
MmCanFileBeTruncated
MmCreateMdl
MmCreateSection
MmDbgTranslatePhysicalAddress
MmDisableModifiedWriteOfSection
MmFlushImageSection
MmForceSectionClosed
MmFreeContiguousMemory
MmFreeMappingAddress
MmFreeNonCachedMemory
MmGetPhysicalAddress
MmGetPhysicalMemoryRanges
MmGetSystemRoutineAddress
MmGetVirtualForPhysical
MmGrowKernelStack
MmIsAddressValid
MmIsDriverVerifying
MmIsNonPagedSystemAddressValid
MmIsRecursiveIoFault
MmIsThisAnNtAsSystem
MmIsVerifierEnabled
MmLockPagableDataSection
MmLockPagableImageSection
MmLockPagableSectionByHandle
MmMapIoSpace
MmMapLockedPages
MmMapLockedPagesWithReservedMapping
MmMapMemoryDumpMdl
MmMapUserAddressesToPage
MmMapVideoDisplay
MmMapViewInSessionSpace
MmMapViewInSystemSpace
MmMapViewOfSection
MmMarkPhysicalMemoryAsBad
MmMarkPhysicalMemoryAsGood
MmPageEntireDriver
MmPrefetchPages
MmProbeAndLockPages
MmProbeAndLockProcessPages
MmProbeAndLockSelectedPages
MmProtectMdlSystemAddress
MmQuerySystemSize
MmRemovePhysicalMemory
MmResetDriverPaging
MmSecureVirtualMemory
MmSetAddressRangeModified
MmSetBankedSection
MmSizeOfMdl
MmTrimAllSystemPagableMemory
MmUnlockPagableImageSection
MmUnlockPages
MmUnmapIoSpace
MmUnmapLockedPages
MmUnmapReservedMapping
MmUnmapVideoDisplay
MmUnmapViewInSessionSpace
MmUnmapViewInSystemSpace
MmUnmapViewOfSection
MmUnsecureVirtualMemory
OUT
ObCreateObject
PEJOB
PEPROCESS
PKBUGCHECK_CALLBACK_RECORD
PKDEVICE_QUEUE_ENTRY
PKIRQL
PULONG
PVOID
PW32_THREAD_CALLBACK
PoCallDriver
PoRegisterDeviceForIdleDetection
PoRegisterSystemState
PoRequestPowerIrp
PoSetDeviceBusy
PoSetPowerState
PoSetSystemState
PoStartNextPowerIrp
PoUnregisterSystemState
ProbeForRead
ProbeForWrite
PsAssignImpersonationToken
PsCreateSystemProcess
PsCreateSystemThread
PsGetCurrentProcessId
PsGetCurrentThreadId
PsImpersonateClient
PsReferenceImpersonationToken
PsReferencePrimaryToken
PsRevertThreadToSelf
PsRevertToSelf
PsTerminateSystemThread
READ_PORT_BUFFER_UCHAR
READ_PORT_BUFFER_ULONG
READ_PORT_BUFFER_USHORT
READ_PORT_UCHAR
READ_PORT_ULONG
READ_PORT_USHORT
SeAssignSecurityEx
SeAuditHardLinkCreation
SeAuditingFileEvents
SeAuditingFileEventsWithContext
SeAuditingFileOrGlobalEvents
SeAuditingHardLinkEvents
SeAuditingHardLinkEventsWithContext
SeCaptureSecurityDescriptor
SeCaptureSubjectContext
SeCloseObjectAuditAlarm
SeCreateAccessState
SeCreateClientSecurityFromSubjectContext
SeFilterToken
SeImpersonateClientEx
SePrivilegeObjectAuditAlarm
SeQueryInformationToken
SeQuerySessionIdToken
SeReleaseSecurityDescriptor
SeSetSecurityDescriptorInfoEx
SeTokenIsAdmin
SeTokenIsRestricted
SeTokenIsWriteRestricted
WRITE_PORT_BUFFER_UCHAR
WRITE_PORT_BUFFER_ULONG
WRITE_PORT_BUFFER_USHORT
WRITE_PORT_UCHAR
WRITE_PORT_ULONG
WRITE_PORT_USHORT

View File

@@ -0,0 +1,10 @@
/me bows humbly and begs %s's forgiveness
%s is soo cool... I hope to be like him some day
/me hides in a corner and hopes %s doesn't beat him with the whipping noodle again
/me prostrates at %s's feet and begs his majesty's forgiveness
%s: please don't hurt me!
I'm not worthy... I'm not worthy...
/me sings %s's praises to the world!
/me thinks %s is smarter than %dev%
%s: oh please may I defrag your sock drawer?
/me gives %s a cookie, hoping it will make up for breaking %func% the other day...

View File

@@ -0,0 +1,9 @@
PASSIVE_LEVEL
APC_LEVEL
DISPATCH_LEVEL
PROFILE_LEVEL
CLOCK1_LEVEL
IPI_LEVEL
POWER_LEVEL
HIGH_LEVEL
SYNCH_LEVEL

View File

@@ -0,0 +1,5 @@
/me slaps %s with a large trout
recycle(%s)
Did I hear something? Musta been a %s-fly... Where's that fly-swatter?
%s: go away son, you bother me....
/me beats %s with the whipping noodle

View File

@@ -0,0 +1,654 @@
RPC_NT_ALREADY_LISTENING
RPC_NT_ALREADY_REGISTERED
RPC_NT_CALL_FAILED
RPC_NT_CALL_FAILED_DNE
RPC_NT_CANT_CREATE_ENDPOINT
RPC_NT_INVALID_BINDING
RPC_NT_INVALID_ENDPOINT_FORMAT
RPC_NT_INVALID_NETWORK_OPTIONS
RPC_NT_INVALID_NET_ADDR
RPC_NT_INVALID_RPC_PROTSEQ
RPC_NT_INVALID_STRING_BINDING
RPC_NT_INVALID_STRING_UUID
RPC_NT_INVALID_TIMEOUT
RPC_NT_NOT_LISTENING
RPC_NT_NO_BINDINGS
RPC_NT_NO_CALL_ACTIVE
RPC_NT_NO_ENDPOINT_FOUND
RPC_NT_NO_PROTSEQS
RPC_NT_NO_PROTSEQS_REGISTERED
RPC_NT_OBJECT_NOT_FOUND
RPC_NT_OUT_OF_RESOURCES
RPC_NT_PROTOCOL_ERROR
RPC_NT_PROTSEQ_NOT_SUPPORTED
RPC_NT_SERVER_TOO_BUSY
RPC_NT_SERVER_UNAVAILABLE
RPC_NT_SS_IN_NULL_CONTEXT
RPC_NT_TYPE_ALREADY_REGISTERED
RPC_NT_UNKNOWN_IF
RPC_NT_UNKNOWN_MGR_TYPE
RPC_NT_WRONG_KIND_OF_BINDING
STATUS_ABANDONED
STATUS_ABANDONED_WAIT_0
STATUS_ABANDONED_WAIT_63
STATUS_ABIOS_INVALID_COMMAND
STATUS_ABIOS_INVALID_LID
STATUS_ABIOS_INVALID_SELECTOR
STATUS_ABIOS_LID_ALREADY_OWNED
STATUS_ABIOS_LID_NOT_EXIST
STATUS_ABIOS_NOT_LID_OWNER
STATUS_ABIOS_NOT_PRESENT
STATUS_ABIOS_SELECTOR_NOT_AVAILABLE
STATUS_ACCESS_DENIED
STATUS_ACCESS_VIOLATION
STATUS_ACCOUNT_DISABLED
STATUS_ACCOUNT_EXPIRED
STATUS_ACCOUNT_LOCKED_OUT
STATUS_ACCOUNT_RESTRICTION
STATUS_ADAPTER_HARDWARE_ERROR
STATUS_ADDRESS_ALREADY_ASSOCIATED
STATUS_ADDRESS_ALREADY_EXISTS
STATUS_ADDRESS_CLOSED
STATUS_ADDRESS_NOT_ASSOCIATED
STATUS_AGENTS_EXHAUSTED
STATUS_ALERTED
STATUS_ALIAS_EXISTS
STATUS_ALLOCATE_BUCKET
STATUS_ALLOTTED_SPACE_EXCEEDED
STATUS_ALREADY_COMMITTED
STATUS_ALREADY_DISCONNECTED
STATUS_ALREADY_WIN32
STATUS_APP_INIT_FAILURE
STATUS_ARBITRATION_UNHANDLED
STATUS_ARRAY_BOUNDS_EXCEEDED
STATUS_AUDIT_FAILED
STATUS_BACKUP_CONTROLLER
STATUS_BAD_COMPRESSION_BUFFER
STATUS_BAD_CURRENT_DIRECTORY
STATUS_BAD_DESCRIPTOR_FORMAT
STATUS_BAD_DEVICE_TYPE
STATUS_BAD_DLL_ENTRYPOINT
STATUS_BAD_FUNCTION_TABLE
STATUS_BAD_IMPERSONATION_LEVEL
STATUS_BAD_INHERITANCE_ACL
STATUS_BAD_INITIAL_PC
STATUS_BAD_INITIAL_STACK
STATUS_BAD_LOGON_SESSION_STATE
STATUS_BAD_MASTER_BOOT_RECORD
STATUS_BAD_NETWORK_NAME
STATUS_BAD_NETWORK_PATH
STATUS_BAD_REMOTE_ADAPTER
STATUS_BAD_SERVICE_ENTRYPOINT
STATUS_BAD_STACK
STATUS_BAD_TOKEN_TYPE
STATUS_BAD_VALIDATION_CLASS
STATUS_BAD_WORKING_SET_LIMIT
STATUS_BEGINNING_OF_MEDIA
STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT
STATUS_BREAKPOINT
STATUS_BUFFER_OVERFLOW
STATUS_BUFFER_TOO_SMALL
STATUS_BUS_RESET
STATUS_CANCELLED
STATUS_CANNOT_DELETE
STATUS_CANNOT_IMPERSONATE
STATUS_CANNOT_LOAD_REGISTRY_FILE
STATUS_CANT_ACCESS_DOMAIN_INFO
STATUS_CANT_DISABLE_MANDATORY
STATUS_CANT_OPEN_ANONYMOUS
STATUS_CANT_TERMINATE_SELF
STATUS_CANT_WAIT
STATUS_CARDBUS_NOT_SUPPORTED
STATUS_CHECKING_FILE_SYSTEM
STATUS_CHILD_MUST_BE_VOLATILE
STATUS_CLIENT_SERVER_PARAMETERS_INVALID
STATUS_COMMITMENT_LIMIT
STATUS_CONFLICTING_ADDRESSES
STATUS_CONNECTION_ABORTED
STATUS_CONNECTION_ACTIVE
STATUS_CONNECTION_COUNT_LIMIT
STATUS_CONNECTION_DISCONNECTED
STATUS_CONNECTION_INVALID
STATUS_CONNECTION_IN_USE
STATUS_CONNECTION_REFUSED
STATUS_CONNECTION_RESET
STATUS_CONTROL_C_EXIT
STATUS_CONVERT_TO_LARGE
STATUS_COULD_NOT_INTERPRET
STATUS_CRC_ERROR
STATUS_CTL_FILE_NOT_SUPPORTED
STATUS_DATATYPE_MISALIGNMENT
STATUS_DATA_ERROR
STATUS_DATA_LATE_ERROR
STATUS_DATA_NOT_ACCEPTED
STATUS_DATA_OVERRUN
STATUS_DEBUG_ATTACH_FAILED
STATUS_DELETE_PENDING
STATUS_DEVICE_ALREADY_ATTACHED
STATUS_DEVICE_BUSY
STATUS_DEVICE_CONFIGURATION_ERROR
STATUS_DEVICE_DATA_ERROR
STATUS_DEVICE_DOES_NOT_EXIST
STATUS_DEVICE_NOT_CONNECTED
STATUS_DEVICE_NOT_PARTITIONED
STATUS_DEVICE_NOT_READY
STATUS_DEVICE_OFF_LINE
STATUS_DEVICE_PAPER_EMPTY
STATUS_DEVICE_POWERED_OFF
STATUS_DEVICE_POWER_FAILURE
STATUS_DEVICE_PROTOCOL_ERROR
STATUS_DFS_EXIT_PATH_FOUND
STATUS_DFS_UNAVAILABLE
STATUS_DIRECTORY_NOT_EMPTY
STATUS_DISK_CORRUPT_ERROR
STATUS_DISK_FULL
STATUS_DISK_OPERATION_FAILED
STATUS_DISK_RECALIBRATE_FAILED
STATUS_DISK_RESET_FAILED
STATUS_DLL_INIT_FAILED
STATUS_DLL_INIT_FAILED_LOGOFF
STATUS_DLL_NOT_FOUND
STATUS_DOMAIN_CONTROLLER_NOT_FOUND
STATUS_DOMAIN_CTRLR_CONFIG_ERROR
STATUS_DOMAIN_EXISTS
STATUS_DOMAIN_LIMIT_EXCEEDED
STATUS_DOMAIN_TRUST_INCONSISTENT
STATUS_DRIVER_CANCEL_TIMEOUT
STATUS_DRIVER_ENTRYPOINT_NOT_FOUND
STATUS_DRIVER_INTERNAL_ERROR
STATUS_DRIVER_ORDINAL_NOT_FOUND
STATUS_DRIVER_UNABLE_TO_LOAD
STATUS_DUPLICATE_NAME
STATUS_DUPLICATE_OBJECTID
STATUS_EAS_NOT_SUPPORTED
STATUS_EA_CORRUPT_ERROR
STATUS_EA_LIST_INCONSISTENT
STATUS_EA_TOO_LARGE
STATUS_END_OF_FILE
STATUS_END_OF_MEDIA
STATUS_ENTRYPOINT_NOT_FOUND
STATUS_EOM_OVERFLOW
STATUS_EVALUATION_EXPIRATION
STATUS_EVENTLOG_CANT_START
STATUS_EVENTLOG_FILE_CHANGED
STATUS_EVENTLOG_FILE_CORRUPT
STATUS_EVENT_DONE
STATUS_EVENT_PENDING
STATUS_EXTRANEOUS_INFORMATION
STATUS_FAIL_CHECK
STATUS_FATAL_APP_EXIT
STATUS_FILEMARK_DETECTED
STATUS_FILES_OPEN
STATUS_FILE_CLOSED
STATUS_FILE_CORRUPT_ERROR
STATUS_FILE_DELETED
STATUS_FILE_FORCED_CLOSED
STATUS_FILE_INVALID
STATUS_FILE_IS_A_DIRECTORY
STATUS_FILE_IS_OFFLINE
STATUS_FILE_LOCK_CONFLICT
STATUS_FILE_RENAMED
STATUS_FLOAT_DENORMAL_OPERAND
STATUS_FLOAT_DIVIDE_BY_ZERO
STATUS_FLOAT_INEXACT_RESULT
STATUS_FLOAT_INVALID_OPERATION
STATUS_FLOAT_OVERFLOW
STATUS_FLOAT_STACK_CHECK
STATUS_FLOAT_UNDERFLOW
STATUS_FLOPPY_BAD_REGISTERS
STATUS_FLOPPY_ID_MARK_NOT_FOUND
STATUS_FLOPPY_UNKNOWN_ERROR
STATUS_FLOPPY_VOLUME
STATUS_FLOPPY_WRONG_CYLINDER
STATUS_FOUND_OUT_OF_SCOPE
STATUS_FREE_VM_NOT_AT_BASE
STATUS_FS_DRIVER_REQUIRED
STATUS_FT_MISSING_MEMBER
STATUS_FT_ORPHANING
STATUS_FT_READ_RECOVERING_FROM_BACKUP
STATUS_FT_WRITE_RECOVERY
STATUS_FULLSCREEN_MODE
STATUS_GENERIC_NOT_MAPPED
STATUS_GRACEFUL_DISCONNECT
STATUS_GROUP_EXISTS
STATUS_GUARD_PAGE_VIOLATION
STATUS_GUIDS_EXHAUSTED
STATUS_GUID_SUBSTITUTION_MADE
STATUS_HANDLES_CLOSED
STATUS_HANDLE_NOT_CLOSABLE
STATUS_HOST_UNREACHABLE
STATUS_ILLEGAL_CHARACTER
STATUS_ILLEGAL_DLL_RELOCATION
STATUS_ILLEGAL_FLOAT_CONTEXT
STATUS_ILLEGAL_FUNCTION
STATUS_ILLEGAL_INSTRUCTION
STATUS_ILL_FORMED_PASSWORD
STATUS_ILL_FORMED_SERVICE_ENTRY
STATUS_IMAGE_ALREADY_LOADED
STATUS_IMAGE_CHECKSUM_MISMATCH
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE
STATUS_IMAGE_MP_UP_MISMATCH
STATUS_IMAGE_NOT_AT_BASE
STATUS_INCOMPATIBLE_FILE_MAP
STATUS_INFO_LENGTH_MISMATCH
STATUS_INSTANCE_NOT_AVAILABLE
STATUS_INSTRUCTION_MISALIGNMENT
STATUS_INSUFFICIENT_LOGON_INFO
STATUS_INSUFFICIENT_RESOURCES
STATUS_INSUFF_SERVER_RESOURCES
STATUS_INTEGER_DIVIDE_BY_ZERO
STATUS_INTEGER_OVERFLOW
STATUS_INTERNAL_DB_CORRUPTION
STATUS_INTERNAL_DB_ERROR
STATUS_INTERNAL_ERROR
STATUS_INVALID_ACCOUNT_NAME
STATUS_INVALID_ACL
STATUS_INVALID_ADDRESS
STATUS_INVALID_ADDRESS_COMPONENT
STATUS_INVALID_ADDRESS_WILDCARD
STATUS_INVALID_BLOCK_LENGTH
STATUS_INVALID_BUFFER_SIZE
STATUS_INVALID_CID
STATUS_INVALID_COMPUTER_NAME
STATUS_INVALID_CONNECTION
STATUS_INVALID_DEVICE_REQUEST
STATUS_INVALID_DEVICE_STATE
STATUS_INVALID_DISPOSITION
STATUS_INVALID_DOMAIN_ROLE
STATUS_INVALID_DOMAIN_STATE
STATUS_INVALID_EA_FLAG
STATUS_INVALID_EA_NAME
STATUS_INVALID_FILE_FOR_SECTION
STATUS_INVALID_GROUP_ATTRIBUTES
STATUS_INVALID_HANDLE
STATUS_INVALID_HW_PROFILE
STATUS_INVALID_ID_AUTHORITY
STATUS_INVALID_IMAGE_FORMAT
STATUS_INVALID_IMAGE_LE_FORMAT
STATUS_INVALID_IMAGE_NE_FORMAT
STATUS_INVALID_IMAGE_NOT_MZ
STATUS_INVALID_IMAGE_PROTECT
STATUS_INVALID_IMAGE_WIN_16
STATUS_INVALID_INFO_CLASS
STATUS_INVALID_LDT_DESCRIPTOR
STATUS_INVALID_LDT_OFFSET
STATUS_INVALID_LDT_SIZE
STATUS_INVALID_LEVEL
STATUS_INVALID_LOCK_SEQUENCE
STATUS_INVALID_LOGON_HOURS
STATUS_INVALID_LOGON_TYPE
STATUS_INVALID_MEMBER
STATUS_INVALID_NETWORK_RESPONSE
STATUS_INVALID_OPLOCK_PROTOCOL
STATUS_INVALID_OWNER
STATUS_INVALID_PAGE_PROTECTION
STATUS_INVALID_PARAMETER
STATUS_INVALID_PARAMETER_1
STATUS_INVALID_PARAMETER_10
STATUS_INVALID_PARAMETER_11
STATUS_INVALID_PARAMETER_12
STATUS_INVALID_PARAMETER_2
STATUS_INVALID_PARAMETER_3
STATUS_INVALID_PARAMETER_4
STATUS_INVALID_PARAMETER_5
STATUS_INVALID_PARAMETER_6
STATUS_INVALID_PARAMETER_7
STATUS_INVALID_PARAMETER_8
STATUS_INVALID_PARAMETER_9
STATUS_INVALID_PARAMETER_MIX
STATUS_INVALID_PIPE_STATE
STATUS_INVALID_PLUGPLAY_DEVICE_PATH
STATUS_INVALID_PORT_ATTRIBUTES
STATUS_INVALID_PORT_HANDLE
STATUS_INVALID_PRIMARY_GROUP
STATUS_INVALID_QUOTA_LOWER
STATUS_INVALID_READ_MODE
STATUS_INVALID_SECURITY_DESCR
STATUS_INVALID_SERVER_STATE
STATUS_INVALID_SID
STATUS_INVALID_SUB_AUTHORITY
STATUS_INVALID_SYSTEM_SERVICE
STATUS_INVALID_UNWIND_TARGET
STATUS_INVALID_USER_BUFFER
STATUS_INVALID_VARIANT
STATUS_INVALID_VIEW_SIZE
STATUS_INVALID_VLM_OPERATION
STATUS_INVALID_VOLUME_LABEL
STATUS_INVALID_WORKSTATION
STATUS_IN_PAGE_ERROR
STATUS_IO_DEVICE_ERROR
STATUS_IO_PRIVILEGE_FAILED
STATUS_IO_REPARSE_DATA_INVALID
STATUS_IO_REPARSE_TAG_INVALID
STATUS_IO_REPARSE_TAG_MISMATCH
STATUS_IO_REPARSE_TAG_NOT_HANDLED
STATUS_IO_TIMEOUT
STATUS_IP_ADDRESS_CONFLICT1
STATUS_IP_ADDRESS_CONFLICT2
STATUS_KERNEL_APC
STATUS_KEY_DELETED
STATUS_KEY_HAS_CHILDREN
STATUS_LAST_ADMIN
STATUS_LICENSE_QUOTA_EXCEEDED
STATUS_LICENSE_VIOLATION
STATUS_LINK_FAILED
STATUS_LINK_TIMEOUT
STATUS_LM_CROSS_ENCRYPTION_REQUIRED
STATUS_LOCAL_DISCONNECT
STATUS_LOCAL_USER_SESSION_KEY
STATUS_LOCK_NOT_GRANTED
STATUS_LOGIN_TIME_RESTRICTION
STATUS_LOGIN_WKSTA_RESTRICTION
STATUS_LOGON_FAILURE
STATUS_LOGON_NOT_GRANTED
STATUS_LOGON_SERVER_CONFLICT
STATUS_LOGON_SESSION_COLLISION
STATUS_LOGON_SESSION_EXISTS
STATUS_LOGON_TYPE_NOT_GRANTED
STATUS_LOG_FILE_FULL
STATUS_LOG_HARD_ERROR
STATUS_LONGJUMP
STATUS_LOST_WRITEBEHIND_DATA
STATUS_LPC_REPLY_LOST
STATUS_LUIDS_EXHAUSTED
STATUS_MAPPED_ALIGNMENT
STATUS_MAPPED_FILE_SIZE_ZERO
STATUS_MARSHALL_OVERFLOW
STATUS_MEDIA_CHANGED
STATUS_MEDIA_CHECK
STATUS_MEDIA_WRITE_PROTECTED
STATUS_MEMBERS_PRIMARY_GROUP
STATUS_MEMBER_IN_ALIAS
STATUS_MEMBER_IN_GROUP
STATUS_MEMBER_NOT_IN_ALIAS
STATUS_MEMBER_NOT_IN_GROUP
STATUS_MEMORY_NOT_ALLOCATED
STATUS_MESSAGE_NOT_FOUND
STATUS_MISSING_SYSTEMFILE
STATUS_MORE_ENTRIES
STATUS_MORE_PROCESSING_REQUIRED
STATUS_MUTANT_LIMIT_EXCEEDED
STATUS_MUTANT_NOT_OWNED
STATUS_NAME_TOO_LONG
STATUS_NETLOGON_NOT_STARTED
STATUS_NETWORK_ACCESS_DENIED
STATUS_NETWORK_BUSY
STATUS_NETWORK_CREDENTIAL_CONFLICT
STATUS_NETWORK_NAME_DELETED
STATUS_NETWORK_UNREACHABLE
STATUS_NET_WRITE_FAULT
STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT
STATUS_NOLOGON_SERVER_TRUST_ACCOUNT
STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT
STATUS_NONCONTINUABLE_EXCEPTION
STATUS_NONEXISTENT_EA_ENTRY
STATUS_NONEXISTENT_SECTOR
STATUS_NONE_MAPPED
STATUS_NOTIFY_CLEANUP
STATUS_NOTIFY_ENUM_DIR
STATUS_NOT_ALL_ASSIGNED
STATUS_NOT_A_DIRECTORY
STATUS_NOT_A_REPARSE_POINT
STATUS_NOT_CLIENT_SESSION
STATUS_NOT_COMMITTED
STATUS_NOT_FOUND
STATUS_NOT_IMPLEMENTED
STATUS_NOT_LOCKED
STATUS_NOT_LOGON_PROCESS
STATUS_NOT_MAPPED_DATA
STATUS_NOT_MAPPED_VIEW
STATUS_NOT_REGISTRY_FILE
STATUS_NOT_SAME_DEVICE
STATUS_NOT_SERVER_SESSION
STATUS_NOT_SUPPORTED
STATUS_NOT_TINY_STREAM
STATUS_NO_BROWSER_SERVERS_FOUND
STATUS_NO_CALLBACK_ACTIVE
STATUS_NO_DATA_DETECTED
STATUS_NO_EAS_ON_FILE
STATUS_NO_EVENT_PAIR
STATUS_NO_GUID_TRANSLATION
STATUS_NO_IMPERSONATION_TOKEN
STATUS_NO_INHERITANCE
STATUS_NO_LDT
STATUS_NO_LOGON_SERVERS
STATUS_NO_LOG_SPACE
STATUS_NO_MATCH
STATUS_NO_MEDIA
STATUS_NO_MEDIA_IN_DEVICE
STATUS_NO_MEMORY
STATUS_NO_MORE_EAS
STATUS_NO_MORE_ENTRIES
STATUS_NO_MORE_FILES
STATUS_NO_MORE_MATCHES
STATUS_NO_PAGEFILE
STATUS_NO_QUOTAS_NO_ACCOUNT
STATUS_NO_SECURITY_ON_OBJECT
STATUS_NO_SPOOL_SPACE
STATUS_NO_SUCH_ALIAS
STATUS_NO_SUCH_DEVICE
STATUS_NO_SUCH_DOMAIN
STATUS_NO_SUCH_FILE
STATUS_NO_SUCH_GROUP
STATUS_NO_SUCH_LOGON_SESSION
STATUS_NO_SUCH_MEMBER
STATUS_NO_SUCH_PACKAGE
STATUS_NO_SUCH_PRIVILEGE
STATUS_NO_SUCH_USER
STATUS_NO_TOKEN
STATUS_NO_TRUST_LSA_SECRET
STATUS_NO_TRUST_SAM_ACCOUNT
STATUS_NO_USER_SESSION_KEY
STATUS_NO_YIELD_PERFORMED
STATUS_NT_CROSS_ENCRYPTION_REQUIRED
STATUS_NULL_LM_PASSWORD
STATUS_OBJECTID_EXISTS
STATUS_OBJECT_EXISTS
STATUS_OBJECT_NAME_COLLISION
STATUS_OBJECT_NAME_EXISTS
STATUS_OBJECT_NAME_INVALID
STATUS_OBJECT_NAME_NOT_FOUND
STATUS_OBJECT_PATH_INVALID
STATUS_OBJECT_PATH_NOT_FOUND
STATUS_OBJECT_PATH_SYNTAX_BAD
STATUS_OBJECT_TYPE_MISMATCH
STATUS_OPEN_FAILED
STATUS_OPLOCK_BREAK_IN_PROCESS
STATUS_OPLOCK_NOT_GRANTED
STATUS_ORDINAL_NOT_FOUND
STATUS_PAGEFILE_CREATE_FAILED
STATUS_PAGEFILE_QUOTA
STATUS_PAGEFILE_QUOTA_EXCEEDED
STATUS_PARITY_ERROR
STATUS_PARTIAL_COPY
STATUS_PARTITION_FAILURE
STATUS_PASSWORD_EXPIRED
STATUS_PASSWORD_MUST_CHANGE
STATUS_PASSWORD_RESTRICTION
STATUS_PATH_NOT_COVERED
STATUS_PENDING
STATUS_PIPE_BROKEN
STATUS_PIPE_BUSY
STATUS_PIPE_CLOSING
STATUS_PIPE_CONNECTED
STATUS_PIPE_DISCONNECTED
STATUS_PIPE_EMPTY
STATUS_PIPE_LISTENING
STATUS_PIPE_NOT_AVAILABLE
STATUS_PLUGPLAY_NO_DEVICE
STATUS_PORT_ALREADY_SET
STATUS_PORT_CONNECTION_REFUSED
STATUS_PORT_DISCONNECTED
STATUS_PORT_MESSAGE_TOO_LONG
STATUS_PORT_UNREACHABLE
STATUS_POSSIBLE_DEADLOCK
STATUS_PREDEFINED_HANDLE
STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED
STATUS_PRINT_CANCELLED
STATUS_PRINT_QUEUE_FULL
STATUS_PRIVILEGED_INSTRUCTION
STATUS_PRIVILEGE_NOT_HELD
STATUS_PROCEDURE_NOT_FOUND
STATUS_PROCESS_IN_JOB
STATUS_PROCESS_IS_TERMINATING
STATUS_PROCESS_NOT_IN_JOB
STATUS_PROFILING_AT_LIMIT
STATUS_PROFILING_NOT_STARTED
STATUS_PROFILING_NOT_STOPPED
STATUS_PROPSET_NOT_FOUND
STATUS_PROTOCOL_UNREACHABLE
STATUS_PWD_HISTORY_CONFLICT
STATUS_PWD_TOO_RECENT
STATUS_PWD_TOO_SHORT
STATUS_QUOTA_EXCEEDED
STATUS_QUOTA_LIST_INCONSISTENT
STATUS_RANGE_LIST_CONFLICT
STATUS_RANGE_NOT_FOUND
STATUS_RANGE_NOT_LOCKED
STATUS_RECEIVE_EXPEDITED
STATUS_RECEIVE_PARTIAL
STATUS_RECEIVE_PARTIAL_EXPEDITED
STATUS_RECOVERY_FAILURE
STATUS_REDIRECTOR_HAS_OPEN_HANDLES
STATUS_REDIRECTOR_NOT_STARTED
STATUS_REDIRECTOR_PAUSED
STATUS_REDIRECTOR_STARTED
STATUS_REGISTRY_CORRUPT
STATUS_REGISTRY_IO_FAILED
STATUS_REGISTRY_QUOTA_LIMIT
STATUS_REGISTRY_RECOVERED
STATUS_REMOTE_DISCONNECT
STATUS_REMOTE_NOT_LISTENING
STATUS_REMOTE_RESOURCES
STATUS_REMOTE_SESSION_LIMIT
STATUS_REPARSE
STATUS_REPLY_MESSAGE_MISMATCH
STATUS_REQUEST_ABORTED
STATUS_REQUEST_NOT_ACCEPTED
STATUS_RESOURCE_DATA_NOT_FOUND
STATUS_RESOURCE_LANG_NOT_FOUND
STATUS_RESOURCE_NAME_NOT_FOUND
STATUS_RESOURCE_NOT_OWNED
STATUS_RESOURCE_TYPE_NOT_FOUND
STATUS_RETRY
STATUS_REVISION_MISMATCH
STATUS_RXACT_COMMITTED
STATUS_RXACT_COMMIT_FAILURE
STATUS_RXACT_COMMIT_NECESSARY
STATUS_RXACT_INVALID_STATE
STATUS_RXACT_STATE_CREATED
STATUS_SAM_INIT_FAILURE
STATUS_SECRET_TOO_LONG
STATUS_SECTION_NOT_EXTENDED
STATUS_SECTION_NOT_IMAGE
STATUS_SECTION_PROTECTION
STATUS_SECTION_TOO_BIG
STATUS_SEGMENT_NOTIFICATION
STATUS_SEMAPHORE_LIMIT_EXCEEDED
STATUS_SERIAL_COUNTER_TIMEOUT
STATUS_SERIAL_MORE_WRITES
STATUS_SERIAL_NO_DEVICE_INITED
STATUS_SERVER_DISABLED
STATUS_SERVER_HAS_OPEN_HANDLES
STATUS_SERVER_NOT_DISABLED
STATUS_SERVICE_NOTIFICATION
STATUS_SETMARK_DETECTED
STATUS_SHARED_IRQ_BUSY
STATUS_SHARING_PAUSED
STATUS_SHARING_VIOLATION
STATUS_SINGLE_STEP
STATUS_SOME_NOT_MAPPED
STATUS_SPECIAL_ACCOUNT
STATUS_SPECIAL_GROUP
STATUS_SPECIAL_USER
STATUS_STACK_OVERFLOW
STATUS_STACK_OVERFLOW_READ
STATUS_SUCCESS
STATUS_SUSPEND_COUNT_EXCEEDED
STATUS_SYNCHRONIZATION_REQUIRED
STATUS_SYSTEM_PROCESS_TERMINATED
STATUS_THREAD_IS_TERMINATING
STATUS_THREAD_NOT_IN_PROCESS
STATUS_THREAD_WAS_SUSPENDED
STATUS_TIMEOUT
STATUS_TIMER_NOT_CANCELED
STATUS_TIMER_RESOLUTION_NOT_SET
STATUS_TIMER_RESUME_IGNORED
STATUS_TIME_DIFFERENCE_AT_DC
STATUS_TOKEN_ALREADY_IN_USE
STATUS_TOO_LATE
STATUS_TOO_MANY_ADDRESSES
STATUS_TOO_MANY_COMMANDS
STATUS_TOO_MANY_CONTEXT_IDS
STATUS_TOO_MANY_GUIDS_REQUESTED
STATUS_TOO_MANY_LINKS
STATUS_TOO_MANY_LUIDS_REQUESTED
STATUS_TOO_MANY_NAMES
STATUS_TOO_MANY_NODES
STATUS_TOO_MANY_OPENED_FILES
STATUS_TOO_MANY_PAGING_FILES
STATUS_TOO_MANY_SECRETS
STATUS_TOO_MANY_SESSIONS
STATUS_TOO_MANY_SIDS
STATUS_TOO_MANY_THREADS
STATUS_TRANSACTION_ABORTED
STATUS_TRANSACTION_INVALID_ID
STATUS_TRANSACTION_INVALID_TYPE
STATUS_TRANSACTION_NO_MATCH
STATUS_TRANSACTION_NO_RELEASE
STATUS_TRANSACTION_RESPONDED
STATUS_TRANSACTION_TIMED_OUT
STATUS_TRUSTED_DOMAIN_FAILURE
STATUS_TRUSTED_RELATIONSHIP_FAILURE
STATUS_TRUST_FAILURE
STATUS_UNABLE_TO_DECOMMIT_VM
STATUS_UNABLE_TO_DELETE_SECTION
STATUS_UNABLE_TO_FREE_VM
STATUS_UNABLE_TO_LOCK_MEDIA
STATUS_UNABLE_TO_UNLOAD_MEDIA
STATUS_UNDEFINED_CHARACTER
STATUS_UNEXPECTED_IO_ERROR
STATUS_UNEXPECTED_MM_CREATE_ERR
STATUS_UNEXPECTED_MM_EXTEND_ERR
STATUS_UNEXPECTED_MM_MAP_ERROR
STATUS_UNEXPECTED_NETWORK_ERROR
STATUS_UNHANDLED_EXCEPTION
STATUS_UNKNOWN_REVISION
STATUS_UNMAPPABLE_CHARACTER
STATUS_UNRECOGNIZED_MEDIA
STATUS_UNRECOGNIZED_VOLUME
STATUS_UNSUCCESSFUL
STATUS_UNSUPPORTED_COMPRESSION
STATUS_UNWIND
STATUS_USER_APC
STATUS_USER_EXISTS
STATUS_USER_MAPPED_FILE
STATUS_USER_SESSION_DELETED
STATUS_VALIDATE_CONTINUE
STATUS_VARIABLE_NOT_FOUND
STATUS_VDM_HARD_ERROR
STATUS_VERIFY_REQUIRED
STATUS_VIRTUAL_CIRCUIT_CLOSED
STATUS_VOLUME_DISMOUNTED
STATUS_VOLUME_MOUNTED
STATUS_WAIT_0
STATUS_WAIT_63
STATUS_WAKE_SYSTEM_DEBUGGER
STATUS_WAS_LOCKED
STATUS_WAS_UNLOCKED
STATUS_WORKING_SET_LIMIT_RANGE
STATUS_WORKING_SET_QUOTA
STATUS_WRONG_PASSWORD
STATUS_WRONG_PASSWORD_CORE
STATUS_WRONG_VOLUME
STATUS_WX86_BREAKPOINT
STATUS_WX86_CONTINUE
STATUS_WX86_CREATEWX86TIB
STATUS_WX86_EXCEPTION_CHAIN
STATUS_WX86_EXCEPTION_CONTINUE
STATUS_WX86_EXCEPTION_LASTCHANCE
STATUS_WX86_FLOAT_STACK_CHECK
STATUS_WX86_INTERNAL_ERROR
STATUS_WX86_SINGLE_STEP
STATUS_WX86_UNSIMULATE

View File

@@ -18,7 +18,7 @@ Don't you know going around dereferncing null pointers all day can be hazardous
Well, duh!
There's a bit in cr3 for problems like that.
Just add a field to the %stru% to keep track of it!
Don't worry about it... the garbage collector in the kernel will clean it up for you.
Don't worry about it... the garbage collector in %module% will clean it up for you.
Did I do that?
Didn't %dev% fix that already?
Yes, I think I've seen that bug before... no... that was another program.
@@ -43,7 +43,7 @@ Hmm.. that seems to have been introduced by my last commit... I bet CVS mixed up
It can't possibly be my fault, so I don't care.
I'm not experiencing that problem, perhaps it's all in your mind.
Well... like a good friend of mine said... "Don't Panic!"
It just shows you how far ReactOS has come along! A year ago a bug like that wouldn't have even been possible!
It just shows you how far ReactOS has come along! A %period% ago a bug like that wouldn't have even been possible!
Just surround the code with an #if 0/#endif block, it solves all my problems!
You know.. if %dev% would just finish %module% for us, we wouldn't be having this problem.
I say we move on to the next function, since we can't seem to figure this one out.
@@ -54,8 +54,20 @@ ask %dev%
Thank you for that amazingly keen insight, Commander Obvious.
Sorry, can't help you right now, trying to track down this bug %dev% caused in %module%
I dont know about that, but I just fixed a problem in %module% for %dev%
How should I know? I'm still trying to figure out this main() thing... ooh! wanna see what I did in the kernel?
How should I know? I'm still trying to figure out this main() thing... ooh! wanna see what I did in %module%?
lol!
*wink*
;)
42
It's gonna take me %period%s to fix all %dev%'s bugs in %module% :(
It's gonna take me over %period% to fix all %dev%'s bugs in %module% :(
How could %func% return %status%!? It bet %dev% broke it! I didn't touch it... honest! no.. really! (me hides)
It's fine if you get %status% there ... just ignore the destruction, and call %func% instead.
%dev% said %status% isn't really an error in this context because we expect %module% to be toast by now
heh, I'm still trying to figure out why %func% is returning %status% when I call it from %module%...
%dev% said it's okay to ignore that as long as you're below %irql%
erm, what do you mean?
damn, I do that all the time
if you want a reply that sounds right, I'd say that %func% support for that is vital to the future of %module%
Sounds like you're having a problem with %func%. I hate that thing... don't talk to me about it.
Just return %status% and forget about it. Someone else will fix it, later.
Blah blah blah... sheesh... can't you figure out *anything*?

1000
irc/ArchBlackmann/type.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -34,8 +34,8 @@ COMPONENTS = ntoskrnl
HALS = halx86/up halx86/mp
# Bus drivers
# acpi isapnp pci
BUS = acpi isapnp pci
# acpi isapnp pci serenum
BUS = acpi isapnp pci serenum
# Filesystem libraries
# vfatlib
@@ -48,7 +48,7 @@ LIBUNICODE =
LIB_STATIC = string rosrtl epsapi uuid libwine zlib rtl tgetopt pseh adns dxguid strmiids crt rossym wdmguid
# Keyboard layout libraries
DLLS_KBD = kbdda kbddv kbdes kbdfr kbdgr kbdse kbduk kbdus
DLLS_KBD = kbdda kbddv kbdes kbdfr kbdgr kbdru kbdse kbdsg kbduk kbdus
# Control Panels
DLLS_CPL = cpl
@@ -61,9 +61,10 @@ DLLS_SHELLEXT = shellext
DLLS = acledit aclui advapi32 advpack cabinet cards comctl32 crtdll comdlg32 d3d8thk dbghelp expat fmifs freetype \
gdi32 gdiplus glu32 hid imagehlp imm32 iphlpapi kernel32 lzexpand mesa32 midimap mmdrv mpr msacm msafd \
msgina msi msimg32 msvcrt20 msvideo mswsock netapi32 ntdll ole32 oleaut32 oledlg olepro32 opengl32 \
packet psapi riched20 richedit rpcrt4 samlib secur32 setupapi shell32 shlwapi smlib smdll snmpapi \
packet psapi riched20 richedit rpcrt4 samlib secur32 serialui setupapi shell32 shlwapi smlib smdll snmpapi \
syssetup twain user32 userenv version wininet winmm winspool ws2help ws2_32 wsock32 wshirda dnsapi \
urlmon shdocvw dinput dinput8 dxdiagn devenum dsound lsasrv $(DLLS_KBD) $(DLLS_CPL) $(DLLS_SHELLEXT)
urlmon shdocvw dinput dinput8 dxdiagn devenum dsound lsasrv dhcpcapi \
$(DLLS_KBD) $(DLLS_CPL) $(DLLS_SHELLEXT)
SUBSYS = smss win32k csrss ntvdm
@@ -105,7 +106,7 @@ STORAGE_DRIVERS = atapi cdrom class2 disk floppy scsiport diskdump
# autochk cmd format services setup usetup welcome winlogon msiexec
SYS_APPS = autochk calc cmd explorer expand format ibrowser msiexec regsvr32 \
reporterror services setup taskmgr userinit usetup welcome vmwinst rundll32 \
winlogon regedit winefile notepad reactos lsass
winlogon regedit winefile notepad reactos lsass dhcp
# System services
SYS_SVC = rpcss eventlog umpnpmgr

View File

@@ -11,7 +11,7 @@ TARGET_APPTYPE = console
TARGET_NAME = loadlib
TARGET_CFLAGS = -Wall -Werror -D_USE_W32API -DUNICODE -D_UNICODE
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API -DUNICODE -D_UNICODE
TARGET_SDKLIBS = kernel32.a ntdll.a

View File

@@ -9,7 +9,7 @@ include $(PATH_TO_TOP)/rules.mak
# Console system utilities
# cabman cat net objdir partinfo pice ps sc stats
UTIL_APPS = cat objdir partinfo pnpdump sc shutdown stats tickcount ps
UTIL_APPS = cat objdir pnpdump sc shutdown stats tickcount ps
UTIL_NET_APPS = arp finger ftp ipconfig netstat ping route telnet whois

View File

@@ -56,14 +56,14 @@ netfinger(char *name)
struct hostent *hp, def;
struct servent *sp;
struct sockaddr_in sin;
int s;
SOCKET s;
char *alist[1], *host;
/* If this is a local request */
if (!(host = rindex(name, '@')))
return;
*host++ = NULL;
*host++ = '\0';
if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) {
def.h_name = host;
def.h_addr_list = alist;
@@ -84,7 +84,7 @@ netfinger(char *name)
sin.sin_family = hp->h_addrtype;
bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
sin.sin_port = sp->s_port;
if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) {
if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) == INVALID_SOCKET) {
perror("finger: socket");
return;
}

View File

@@ -235,7 +235,7 @@ char *getpass (const char * prompt)
static char input[256];
HANDLE in;
HANDLE err;
int count;
DWORD count;
in = GetStdHandle (STD_INPUT_HANDLE);
err = GetStdHandle (STD_ERROR_HANDLE);

View File

@@ -97,7 +97,7 @@ uid_t getuid();
sig_t lostpeer();
off_t restart_point = 0;
int cin, cout;
SOCKET cin, cout;
int dataconn(char *mode);
int command(char *fmt, ...);
@@ -113,7 +113,8 @@ void psabort(int sig);
char *hookup(char *host, int port)
{
register struct hostent *hp = 0;
int s,len;
int len;
SOCKET s;
static char hostnamebuf[80];
bzero((char *)&hisctladdr, sizeof (hisctladdr));
@@ -136,7 +137,7 @@ char *hookup(char *host, int port)
}
hostname = hostnamebuf;
s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);
if (s < 0) {
if (s == INVALID_SOCKET) {
perror("ftp: socket");
code = -1;
return (0);
@@ -1327,8 +1328,8 @@ void pswitch(int flag)
char name[MAXHOSTNAMELEN];
struct sockaddr_in mctl;
struct sockaddr_in hctl;
FILE *in;
FILE *out;
SOCKET in;
SOCKET out;
int tpe;
int cpnd;
int sunqe;
@@ -1371,10 +1372,10 @@ void pswitch(int flag)
hisctladdr = op->hctl;
ip->mctl = myctladdr;
myctladdr = op->mctl;
(int) ip->in = cin; // What the hell am I looking at...?
cin = (int) op->in;
(int) ip->out = cout; // Same again...
cout = (int) op->out;
ip->in = cin;
cin = op->in;
ip->out = cout;
cout = op->out;
ip->tpe = type;
type = op->tpe;
if (!type)

View File

@@ -8,6 +8,8 @@ TARGET_NAME = ftp
TARGET_INSTALLDIR = system32
TARGET_CFLAGS = -D__USE_W32API
TARGET_SDKLIBS = ws2_32.a iphlpapi.a
# ntdll.a

View File

@@ -8,7 +8,7 @@ TARGET_NAME = ping
TARGET_INSTALLDIR = system32
TARGET_CFLAGS = -D__USE_W32_SOCKETS
TARGET_CFLAGS = -D__USE_W32API -D__USE_W32_SOCKETS
TARGET_SDKLIBS = ws2_32.a

View File

@@ -12,7 +12,7 @@ TARGET_SDKLIBS = ws2_32.a iphlpapi.a ntdll.a
TARGET_OBJECTS = $(TARGET_NAME).o
TARGET_GCCLIBS =
TARGET_CFLAGS = -D__USE_W32API
include $(PATH_TO_TOP)/rules.mak

View File

@@ -10,7 +10,7 @@ TARGET_APPTYPE = console
TARGET_NAME = partinfo
TARGET_CFLAGS = -Wall -Werror -Wno-format
TARGET_CFLAGS = -D__USE_W32API -Wall -Werror -Wno-format
TARGET_SDKLIBS = ntdll.a kernel32.a

View File

@@ -8,9 +8,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <ddk/ntddk.h>
//#define DUMP_DATA
#define DUMP_SIZE_INFO
#define UNICODE
#ifdef DUMP_DATA
void HexDump(char *buffer, ULONG size)

View File

@@ -10,7 +10,7 @@ TARGET_APPTYPE = console
TARGET_NAME = pnpdump
TARGET_CFLAGS = -Wall -Werror
TARGET_CFLAGS = -D__USE_W32API -Wall -Werror
TARGET_SDKLIBS = ntdll.a kernel32.a

View File

@@ -8,6 +8,8 @@
#include <stdlib.h>
#include <conio.h>
#include <ddk/ntddk.h>
#include <pshpack1.h>
typedef struct _CM_PNP_BIOS_DEVICE_NODE

View File

@@ -10,7 +10,7 @@ TARGET_APPTYPE = console
TARGET_NAME = ps
TARGET_CFLAGS = -DANONYMOUSUNIONS -Werror -Wall
TARGET_CFLAGS = -D__USE_W32API -DANONYMOUSUNIONS -Werror -Wall
TARGET_SDKLIBS = ntdll.a kernel32.a user32.a

View File

@@ -110,8 +110,8 @@ int main()
DWORD r;
ANSI_STRING astring;
HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
PSYSTEM_PROCESSES SystemProcesses = NULL;
PSYSTEM_PROCESSES CurrentProcess;
PSYSTEM_PROCESS_INFORMATION SystemProcesses = NULL;
PSYSTEM_PROCESS_INFORMATION CurrentProcess;
ULONG BufferSize, ReturnSize;
NTSTATUS Status;
char buf[256];
@@ -140,7 +140,7 @@ int main()
/* For every process print the information. */
CurrentProcess = SystemProcesses;
while (CurrentProcess->NextEntryDelta != 0)
while (CurrentProcess->NextEntryOffset != 0)
{
int hour, hour1, thour, thour1;
unsigned char minute, minute1, tmin, tmin1;
@@ -159,53 +159,53 @@ int main()
minute1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
seconds1 = (ptime.QuadPart / 10000000LL) % 60LL;
RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ProcessName, TRUE);
RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ImageName, TRUE);
wsprintf(buf,"P%8d %8d %3d:%02d:%02d %3d:%02d:%02d ProcName: %s\n",
CurrentProcess->ProcessId, CurrentProcess->InheritedFromProcessId,
CurrentProcess->UniqueProcessId, CurrentProcess->InheritedFromUniqueProcessId,
hour, minute, seconds, hour1, minute1, seconds1,
astring.Buffer);
WriteFile(stdout, buf, lstrlen(buf), &r, NULL);
RtlFreeAnsiString(&astring);
for (ti = 0; ti < CurrentProcess->ThreadCount; ti++)
for (ti = 0; ti < CurrentProcess->NumberOfThreads; ti++)
{
struct status *statt;
struct waitres *waitt;
char szWindowName[30] = {" "};
ptime = CurrentProcess->Threads[ti].KernelTime;
ptime = CurrentProcess->TH[ti].KernelTime;
thour = (ptime.QuadPart / (10000000LL * 3600LL));
tmin = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
tsec = (ptime.QuadPart / 10000000LL) % 60LL;
ptime = CurrentProcess->Threads[ti].UserTime;
ptime = CurrentProcess->TH[ti].UserTime;
thour1 = (ptime.QuadPart / (10000000LL * 3600LL));
tmin1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
tsec1 = (ptime.QuadPart / 10000000LL) % 60LL;
statt = thread_stat;
while (statt->state != CurrentProcess->Threads[ti].State && statt->state >= 0)
while (statt->state != CurrentProcess->TH[ti].ThreadState && statt->state >= 0)
statt++;
waitt = waitreason;
while (waitt->state != CurrentProcess->Threads[ti].WaitReason && waitt->state >= 0)
while (waitt->state != CurrentProcess->TH[ti].WaitReason && waitt->state >= 0)
waitt++;
wsprintf (buf1,
"t% %8d %3d:%02d:%02d %3d:%02d:%02d %s %s\n",
CurrentProcess->Threads[ti].ClientId.UniqueThread,
CurrentProcess->TH[ti].ClientId.UniqueThread,
thour, tmin, tsec, thour1, tmin1, tsec1,
statt->desc , waitt->desc);
WriteFile(stdout, buf1, lstrlen(buf1), &r, NULL);
EnumThreadWindows((DWORD)CurrentProcess->Threads[ti].ClientId.UniqueThread,
EnumThreadWindows((DWORD)CurrentProcess->TH[ti].ClientId.UniqueThread,
(ENUMWINDOWSPROC) EnumThreadProc,
(LPARAM)(LPTSTR) szWindowName );
}
CurrentProcess = (PSYSTEM_PROCESSES)((ULONG_PTR)CurrentProcess +
CurrentProcess->NextEntryDelta);
CurrentProcess = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)CurrentProcess +
CurrentProcess->NextEntryOffset);
}
return (0);
}

View File

@@ -13,7 +13,7 @@ TARGET_INSTALLDIR = system32
TARGET_NAME = sc
TARGET_CFLAGS = -DDBG -Werror -Wall
TARGET_CFLAGS = -D__USE_W32API -DDBG -Werror -Wall
TARGET_SDKLIBS = kernel32.a ntdll.a advapi32.a

View File

@@ -14,6 +14,7 @@ TARGET_BASE_LIB_DSOUND =0x50000000
TARGET_BASE_LIB_GLU32 =0x50000000
TARGET_BASE_LIB_OPENGL32 =0x50000000
TARGET_BASE_LIB_EXT_SLAYER =0x5C7E0000
TARGET_BASE_LIB_SERIALUI =0x5CDA0000
TARGET_BASE_LIB_DINPUT =0x5F580000
TARGET_BASE_LIB_CPL_TIMEDATE =0x64DA0000
TARGET_BASE_LIB_CPL_SYSDM =0x64DD0000
@@ -67,8 +68,8 @@ TARGET_BASE_LIB_SETUPAPI =0x76660000
TARGET_BASE_LIB_GDIPLUS =0x76a00000
TARGET_BASE_LIB_IMAGEHLP =0x76c90000
TARGET_BASE_LIB_FMIFS =0x76df0000
TARGET_BASE_LIB_SHELL32 =0x77260000
TARGET_BASE_LIB_IPHLPAPI =0x77300000
TARGET_BASE_LIB_SHELL32 =0x77200000
TARGET_BASE_LIB_IPHLPAPI =0x77380000
TARGET_BASE_LIB_MSACM =0x77400000
TARGET_BASE_LIB_MMDRV =0x77500000
TARGET_BASE_LIB_CRTDLL =0x77630000
@@ -86,8 +87,8 @@ TARGET_BASE_LIB_OLE32 =0x77a50000
TARGET_BASE_LIB_OLEPRO32 =0x77a50000
TARGET_BASE_LIB_VERSION =0x77a90000
TARGET_BASE_LIB_ADVAPI32 =0x77dc0000
TARGET_BASE_LIB_USER32 =0x77e60000
TARGET_BASE_LIB_GDI32 =0x77ed0000
TARGET_BASE_LIB_USER32 =0x77e50000
TARGET_BASE_LIB_GDI32 =0x77ee0000
TARGET_BASE_LIB_DNSAPI =0x77f00000
TARGET_BASE_LIB_MSVCRT =0x78000000
TARGET_BASE_LIB_MSVCRT20 =0x78500000

View File

@@ -20,6 +20,7 @@
PATH_TO_TOP = ../..
include rules.mak
include $(PATH_TO_TOP)/config
all:
$(MAKE) -C tools
@@ -29,7 +30,7 @@ all:
$(MAKE) -C fdebug
test:
clean:
$(MAKE) -C bootsect clean
$(MAKE) -C freeldr clean
@@ -38,6 +39,7 @@ clean:
$(MAKE) -C tools clean
bootcd:
ifeq ($(ARCH),i386)
$(CP) bootsect/isoboot.bin ${BOOTCD_DIR}/../isoboot.bin
$(CP) bootsect/dosmbr.bin ${BOOTCD_DIR}/loader/dosmbr.bin
$(CP) bootsect/ext2.bin ${BOOTCD_DIR}/loader/ext2.bin
@@ -46,5 +48,7 @@ bootcd:
$(CP) bootsect/isoboot.bin ${BOOTCD_DIR}/loader/isoboot.bin
$(CP) freeldr/freeldr.sys ${BOOTCD_DIR}/loader/freeldr.sys
$(CP) freeldr/setupldr.sys ${BOOTCD_DIR}/loader/setupldr.sys
endif
.PHONY : clean

View File

@@ -25,56 +25,8 @@ BOOTCD_DIR = $(PATH_TO_TOP)/../bootcd
.PHONY : clean bootcd
all: $(BIN2C) dosmbr.bin fat.bin fat32.bin isoboot.bin ext2.bin
$(BIN2C) :
@$(MAKE) --no-print-directory -C $(FREELDR_TOOLS_PATH)
dosmbr.bin : dosmbr.asm
@echo freeldr: Assembling dosmbr
@$(NASM_CMD) $(NFLAGS) -o dosmbr.bin -f bin dosmbr.asm
fat.bin : fat.asm $(BIN2C)
@echo freeldr: Assembling fat
@$(NASM_CMD) $(NFLAGS) -o fat.bin -f bin fat.asm
@$(BIN2C) fat.bin fat.h fat_data
fat32.bin : fat32.asm $(BIN2C)
@echo freeldr: Assembling fat32
@$(NASM_CMD) $(NFLAGS) -o fat32.bin -f bin fat32.asm
@$(BIN2C) fat32.bin fat32.h fat32_data
isoboot.bin : isoboot.asm
@echo freeldr: Assembling isoboot
@$(NASM_CMD) $(NFLAGS) -o isoboot.bin -f bin isoboot.asm
ext2.bin : ext2.asm
@echo freeldr: Assembling ext2
@$(NASM_CMD) $(NFLAGS) -o ext2.bin -f bin ext2.asm
@$(BIN2C) ext2.bin ext2.h ext2_data
.PHONY : bootcd
bootcd: bootcd_dirs isoboot.bin
$(CP) isoboot.bin $(BOOTCD_DIR)
$(CP) dosmbr.bin $(BOOTCD_DIR)/disk/loader
$(CP) ext2.bin $(BOOTCD_DIR)/disk/loader
$(CP) fat.bin $(BOOTCD_DIR)/disk/loader
$(CP) fat32.bin $(BOOTCD_DIR)/disk/loader
$(CP) isoboot.bin $(BOOTCD_DIR)/disk/loader
.PHONY : bootcd_dirs
bootcd_dirs:
$(MKDIR) $(BOOTCD_DIR)
$(MKDIR) $(BOOTCD_DIR)/disk
$(MKDIR) $(BOOTCD_DIR)/disk/reactos
$(MKDIR) $(BOOTCD_DIR)/disk/install
$(MKDIR) $(BOOTCD_DIR)/disk/bootdisk
$(MKDIR) $(BOOTCD_DIR)/disk/loader
clean:
@-$(RM) *.bin
@-$(RM) *.h
@echo freeldr: Clean ALL done.
ifeq ($(ARCH),powerpc)
include Makefile.powerpc
else
include Makefile.i386
endif

View File

@@ -0,0 +1,52 @@
all: $(BIN2C) dosmbr.bin fat.bin fat32.bin isoboot.bin ext2.bin
$(BIN2C) :
@$(MAKE) --no-print-directory -C $(FREELDR_TOOLS_PATH)
dosmbr.bin : dosmbr.asm
@echo ===================================================== Assembling dosmbr
@$(NASM_CMD) $(NFLAGS) -o dosmbr.bin -f bin dosmbr.asm
fat.bin : fat.asm $(BIN2C)
@echo ===================================================== Assembling fat
@$(NASM_CMD) $(NFLAGS) -o fat.bin -f bin fat.asm
@$(BIN2C) fat.bin fat.h fat_data
fat32.bin : fat32.asm $(BIN2C)
@echo ===================================================== Assembling fat32
@$(NASM_CMD) $(NFLAGS) -o fat32.bin -f bin fat32.asm
@$(BIN2C) fat32.bin fat32.h fat32_data
isoboot.bin : isoboot.asm
@echo ===================================================== Assembling isoboot
@$(NASM_CMD) $(NFLAGS) -o isoboot.bin -f bin isoboot.asm
ext2.bin : ext2.asm
@echo ===================================================== Assembling ext2
@$(NASM_CMD) $(NFLAGS) -o ext2.bin -f bin ext2.asm
@$(BIN2C) ext2.bin ext2.h ext2_data
.PHONY : bootcd
bootcd: bootcd_dirs isoboot.bin
$(CP) isoboot.bin $(BOOTCD_DIR)
$(CP) dosmbr.bin $(BOOTCD_DIR)/disk/loader
$(CP) ext2.bin $(BOOTCD_DIR)/disk/loader
$(CP) fat.bin $(BOOTCD_DIR)/disk/loader
$(CP) fat32.bin $(BOOTCD_DIR)/disk/loader
$(CP) isoboot.bin $(BOOTCD_DIR)/disk/loader
.PHONY : bootcd_dirs
bootcd_dirs:
$(MKDIR) $(BOOTCD_DIR)
$(MKDIR) $(BOOTCD_DIR)/disk
$(MKDIR) $(BOOTCD_DIR)/disk/reactos
$(MKDIR) $(BOOTCD_DIR)/disk/install
$(MKDIR) $(BOOTCD_DIR)/disk/bootdisk
$(MKDIR) $(BOOTCD_DIR)/disk/loader
clean:
@-$(RM) *.bin
@-$(RM) *.h
@echo Clean ALL done.

View File

@@ -0,0 +1,35 @@
TOOLS=$(PATH_TO_TOP)/tools
SECTIONS= \
--only-section=.text \
--only-section=.data \
--only-section=.bss
LDSECT= -Ttext 0xe00000 -Tdata 0xe10000
OBJS=ofwboot.o freeldr.o
CFLAGS=-mbig -meabi -fPIC -fno-builtin -I../freeldr/include
FREELDR=../freeldr/freeldr.sys
.SUFFIXES: .c .o
all: ofwldr
hack-coff$(EXEEXT):
$(HOST_CC) -I../freeldr/include hack-coff.c -o $@
ofwboot.o: ofwboot.s
$(NASM_CMD) $< -c -o $@
$(FREELDR):
$(MAKE) -C ../freeldr
freeldr.o: $(FREELDR)
$(TOOLS)/ppc-le2be $< freeldr.tmp
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc:common freeldr.tmp $@
rm freeldr.tmp
ofwldr: $(OBJS)
$(LD) -melf32ppc --no-omagic $(LDSECT) $(OBJS) -g -o $@.elf
$(OBJCOPY) $(SECTIONS) -O aixcoff-rs6000 $@.elf $@
$(TOOLS)/hack-coff $@
clean:
rm -rf ofwldr *.o *.elf *.tmp

View File

@@ -89,9 +89,6 @@ main:
mov es,ax ; Make ES correct
cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it
jne GetDriveParameters
mov [BYTE bp+BootDrive],dl ; Save the boot drive

View File

@@ -0,0 +1,960 @@
.section .text
_start:
.long 0xe00000 + 12
.long 0
.long 0
/*
* LIFTED FROM arch/macppc/stand/ofwboot/Locore.c
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
_begin:
sync
isync
lis %r1,stack@ha
addi %r1,%r1,stack@l
addi %r1,%r1,16384 - 0x10
mfmsr %r8
li %r0,0
mtmsr %r0
isync
mtibatu 0,%r0
mtibatu 1,%r0
mtibatu 2,%r0
mtibatu 3,%r0
mtdbatu 0,%r0
mtdbatu 1,%r0
mtdbatu 2,%r0
mtdbatu 3,%r0
li %r9,0x12 /* BATL(0, BAT_M, BAT_PP_RW) */
mtibatl 0,%r9
mtdbatl 0,%r9
li %r9,0x1ffe /* BATU(0, BAT_BL_256M, BAT_Vs) */
mtibatu 0,%r9
mtdbatu 0,%r9
isync
li %r8,0x3030
mtmsr %r8
/* Store ofw call addr */
mr %r21,%r5
lis %r10,0xe00000@ha
stw %r5,ofw_call_addr - _start@l(%r10)
lis %r4,_binary_freeldr_tmp_end@ha
addi %r4,%r4,_binary_freeldr_tmp_end@l
lis %r3,_binary_freeldr_tmp_start@ha
addi %r3,%r3,_binary_freeldr_tmp_start@l
lis %r5,0x8000@ha
addi %r5,%r5,0x8000@l
bl copy_bits
bl zero_registers
lis %r3,0xe00000@ha
addi %r3,%r3,freeldr_banner - _start
bl ofw_print_string
bl ofw_print_eol
/* Zero CTR */
mtcr %r31
lis %r3,0x8000@ha
addi %r3,%r3,0x8000@l
mtlr %r3
lis %r3,call_ofw@ha
addi %r3,%r3,call_ofw - _start
b call_freeldr
.align 4
call_freeldr:
/* Get the address of the functions list --
* Note:
* Because of little endian switch we must use an even number of
* instructions here.. Pad with a nop if needed. */
mfmsr %r10
ori %r10,%r10,1
mtmsr %r10
nop
/* Note that this is little-endian from here on */
blr
nop
.align 4
call_ofw:
/* R3 has the function offset to call (n * 4)
* Other arg registers are unchanged.
* Note that these 4 instructions are in reverse order due to
* little-endian convention */
andi. %r0,%r0,65534
mfmsr %r0
mtmsr %r0
/* Now normal ordering resumes */
subi %r1,%r1,0x100
stw %r8,4(%r1)
stw %r9,8(%r1)
stw %r10,12(%r1)
mflr %r8
stw %r8,16(%r1)
lis %r10,0xe00000@ha
add %r9,%r3,%r10
lwz %r3,ofw_functions - _start@l(%r9)
mtctr %r3
mr %r3,%r4
mr %r4,%r5
mr %r5,%r6
mr %r6,%r7
mr %r7,%r8
/* Goto the swapped function */
bctrl
lwz %r8,16(%r1)
mtlr %r8
lwz %r8,4(%r1)
lwz %r9,8(%r1)
lwz %r10,12(%r1)
addi %r1,%r1,0x100
/* Ok, go back to little endian */
mfmsr %r0
ori %r0,%r0,1
mtmsr %r0
/* Note that this is little-endian from here on */
blr
nop
zero_registers:
xor %r2,%r2,%r2
mr %r0,%r2
mr %r3,%r2
mr %r4,%r2
mr %r5,%r2
mr %r6,%r2
mr %r7,%r2
mr %r8,%r2
mr %r9,%r2
mr %r10,%r2
mr %r11,%r2
mr %r12,%r2
mr %r13,%r2
mr %r14,%r2
mr %r15,%r2
mr %r12,%r2
mr %r13,%r2
mr %r14,%r2
mr %r15,%r2
mr %r16,%r2
mr %r17,%r2
mr %r18,%r2
mr %r19,%r2
mr %r20,%r2
mr %r21,%r2
mr %r22,%r2
mr %r23,%r2
mr %r24,%r2
mr %r25,%r2
mr %r26,%r2
mr %r27,%r2
mr %r28,%r2
mr %r29,%r2
mr %r30,%r2
mr %r31,%r2
blr
prim_strlen:
mr %r5,%r3
prim_strlen_loop:
lbz %r4,0(%r3)
cmpi 0,0,%r4,0
beq prim_strlen_done
addi %r3,%r3,1
b prim_strlen_loop
prim_strlen_done:
sub %r3,%r3,%r5
blr
copy_bits:
cmp 0,0,%r3,%r4
beqlr
lwz %r6,0(%r3)
stw %r6,0(%r5)
addi %r3,%r3,4
addi %r5,%r5,4
b copy_bits
ofw_print_string_hook:
bl ofw_print_number
bl ofw_exit
ofw_print_string:
/* Reserve some stack space */
subi %r1,%r1,32
/* Save args */
stw %r3,0(%r1)
/* Save the lr, a scratch register */
stw %r8,8(%r1)
mflr %r8
stw %r8,12(%r1)
/* Load the package name */
lis %r3,0xe00000@ha
addi %r3,%r3,ofw_chosen_name - _start
/* Fire */
bl ofw_finddevice
/* Load up for getprop */
stw %r3,16(%r1)
lis %r4,0xe00000@ha
addi %r4,%r4,ofw_stdout_name - _start
addi %r5,%r1,20
li %r6,4
bl ofw_getprop
/* Measure the string and remember the length */
lwz %r3,0(%r1)
bl prim_strlen
mr %r5,%r3
lwz %r3,20(%r1)
lwz %r4,0(%r1)
/* Write the string */
bl ofw_write
/* Return */
lwz %r8,12(%r1)
mtlr %r8
lwz %r8,8(%r1)
addi %r1,%r1,32
blr
/* Print 8 hex digits representing a number in r3 */
ofw_print_number:
subi %r1,%r1,32
stw %r8,0(%r1)
mflr %r8
stw %r8,4(%r1)
stw %r9,8(%r1)
xor %r9,%r9,%r9
stw %r9,12(%r1)
/* Set up and, devide, shift */
mr %r8,%r3
lis %r6,0xf0000000@ha
lis %r7,0x10000000@ha
li %r9,8
ofw_number_loop:
nop
cmpi 0,0,%r9,0
beq ofw_number_return
subi %r9,%r9,1
/* Body: isolate digit, divide, print */
and %r5,%r6,%r8
divwu %r4,%r5,%r7
srwi %r6,%r6,4
srwi %r7,%r7,4
nop
cmpi 0,0,%r4,10
bge ofw_number_letter
addi %r4,%r4,'0'
b ofw_number_digit_out
ofw_number_letter:
addi %r4,%r4,'A' - 10
ofw_number_digit_out:
stb %r4,12(%r1)
addi %r3,%r1,12
stw %r6,16(%r1)
stw %r7,20(%r1)
stw %r8,24(%r1)
stw %r9,28(%r1)
bl ofw_print_string
lwz %r6,16(%r1)
lwz %r7,20(%r1)
lwz %r8,24(%r1)
lwz %r9,28(%r1)
b ofw_number_loop
ofw_number_return:
/* Return */
lwz %r9,8(%r1)
lwz %r8,4(%r1)
mtlr %r8
lwz %r8,0(%r1)
addi %r1,%r1,32
blr
ofw_print_eol:
subi %r1,%r1,16
stw %r8,0(%r1)
mflr %r8
stw %r8,4(%r1)
li %r4,0x0d0a
sth %r4,8(%r1)
xor %r4,%r4,%r4
sth %r4,10(%r1)
addi %r3,%r1,8
bl ofw_print_string
lwz %r8,4(%r1)
mtlr %r8
lwz %r8,0(%r1)
addi %r1,%r1,16
blr
ofw_print_nothing:
subi %r1,%r1,16
stw %r8,0(%r1)
mflr %r8
stw %r8,4(%r1)
li %r4,0
sth %r4,8(%r1)
xor %r4,%r4,%r4
sth %r4,10(%r1)
addi %r3,%r1,8
bl ofw_print_string
lwz %r8,4(%r1)
mtlr %r8
lwz %r8,0(%r1)
addi %r1,%r1,16
blr
ofw_print_space:
subi %r1,%r1,16
stw %r8,0(%r1)
mflr %r8
stw %r8,4(%r1)
li %r4,0x2000
sth %r4,8(%r1)
xor %r4,%r4,%r4
sth %r4,10(%r1)
addi %r3,%r1,8
bl ofw_print_string
lwz %r8,4(%r1)
mtlr %r8
lwz %r8,0(%r1)
addi %r1,%r1,16
blr
ofw_print_regs:
/* Construct ofw exit call */
subi %r1,%r1,0xa0
stw %r0,0(%r1)
stw %r1,4(%r1)
stw %r2,8(%r1)
stw %r3,12(%r1)
stw %r4,16(%r1)
stw %r5,20(%r1)
stw %r6,24(%r1)
stw %r7,28(%r1)
stw %r8,32(%r1)
stw %r9,36(%r1)
stw %r10,40(%r1)
stw %r11,44(%r1)
stw %r12,48(%r1)
stw %r13,52(%r1)
stw %r14,56(%r1)
stw %r15,60(%r1)
stw %r16,64(%r1)
stw %r17,68(%r1)
stw %r18,72(%r1)
stw %r19,76(%r1)
stw %r20,80(%r1)
stw %r21,84(%r1)
stw %r22,88(%r1)
stw %r23,92(%r1)
stw %r24,96(%r1)
stw %r25,100(%r1)
stw %r26,104(%r1)
stw %r27,108(%r1)
stw %r28,112(%r1)
stw %r29,116(%r1)
stw %r30,120(%r1)
stw %r31,124(%r1)
mflr %r0
stw %r0,128(%r1)
mfcr %r0
stw %r0,132(%r1)
mfctr %r0
stw %r0,136(%r1)
mfmsr %r0
stw %r0,140(%r1)
/* Count at zero */
xor %r0,%r0,%r0
stw %r0,144(%r1)
mr %r3,%r1
stw %r3,148(%r1)
/* Body, print the regname, then the register */
ofw_register_loop:
lwz %r3,144(%r1)
cmpi 0,0,%r3,32
beq ofw_register_special
lis %r3,0xe00000@ha
addi %r3,%r3,freeldr_reg_init - _start
bl ofw_print_string
lwz %r3,144(%r1)
bl ofw_print_number
bl ofw_print_space
lwz %r3,144(%r1)
mulli %r3,%r3,4
add %r3,%r1,%r3
lwz %r3,0(%r3)
stw %r3,152(%r1)
bl ofw_print_number
lwz %r3,144(%r1)
addi %r3,%r3,1
stw %r3,144(%r1)
b done_dump
dump_optional:
bl ofw_print_space
bl ofw_print_space
lwz %r3,152(%r1)
lwz %r3,0(%r3)
bl ofw_print_number
bl ofw_print_space
lwz %r3,152(%r1)
lwz %r3,4(%r3)
bl ofw_print_number
bl ofw_print_space
lwz %r3,152(%r1)
lwz %r3,8(%r3)
bl ofw_print_number
bl ofw_print_space
lwz %r3,152(%r1)
lwz %r3,12(%r3)
bl ofw_print_number
bl ofw_print_space
done_dump:
bl ofw_print_eol
b ofw_register_loop
ofw_register_special:
/* LR */
lis %r3,0xe00000@ha
addi %r3,%r3,freeldr_reg_lr - _start
bl ofw_print_string
bl ofw_print_space
lwz %r3,128(%r1)
bl ofw_print_number
bl ofw_print_eol
/* CR */
lis %r3,0xe00000@ha
addi %r3,%r3,freeldr_reg_cr - _start
bl ofw_print_string
bl ofw_print_space
lwz %r3,132(%r1)
bl ofw_print_number
bl ofw_print_eol
/* CTR */
lis %r3,0xe00000@ha
addi %r3,%r3,freeldr_reg_ctr - _start
bl ofw_print_string
bl ofw_print_space
lwz %r3,136(%r1)
bl ofw_print_number
bl ofw_print_eol
/* MSR */
lis %r3,0xe00000@ha
addi %r3,%r3,freeldr_reg_msr - _start
bl ofw_print_string
bl ofw_print_space
lwz %r3,140(%r1)
bl ofw_print_number
bl ofw_print_eol
/* Return */
lwz %r0,128(%r1)
mtlr %r0
lwz %r0,0(%r1)
lwz %r2,8(%r1)
lwz %r3,12(%r1)
lwz %r4,16(%r1)
lwz %r5,20(%r1)
lwz %r6,24(%r1)
lwz %r7,28(%r1)
addi %r1,%r1,0xa0
blr
ofw_finddevice_hook:
subi %r1,%r1,32
stw %r3,0(%r1)
mflr %r3
stw %r3,4(%r1)
lwz %r3,0(%r1)
bl ofw_finddevice
stw %r3,0(%r1)
lwz %r3,4(%r1)
mtlr %r3
lwz %r3,0(%r1)
addi %r1,%r1,32
blr
ofw_finddevice:
/* Reserve stack space ...
* 20 bytes for the ofw call,
* r8, r9, and lr */
subi %r1,%r1,32
/* Store r8, r9, lr */
stw %r8,20(%r1)
stw %r9,24(%r1)
mflr %r8
stw %r8,28(%r1)
/* Get finddevice name */
lis %r8,0xe00000@ha
addi %r9,%r8,ofw_finddevice_name - _start
stw %r9,0(%r1)
/* 1 Argument and 1 return */
li %r9,1
stw %r9,4(%r1)
stw %r9,8(%r1)
stw %r3,12(%r1)
/* Load up the call address */
lwz %r9,ofw_call_addr - _start(%r8)
mtlr %r9
/* Set argument */
mr %r3,%r1
/* Fire */
blrl
lwz %r3,16(%r1)
/* Restore registers */
lwz %r8,28(%r1)
mtlr %r8
lwz %r9,24(%r1)
lwz %r8,20(%r1)
addi %r1,%r1,32
/* Return */
blr
ofw_getprop_hook:
/* Reserve stack space:
* 32 bytes for the ofw call
* 12 bytes for r8, r9, lr
*/
/* Reserve stack space ...
* 20 bytes for the ofw call,
* r8, r9, and lr */
subi %r1,%r1,48
/* Store r8, r9, lr */
stw %r8,32(%r1)
stw %r9,36(%r1)
mflr %r8
stw %r8,40(%r1)
/* Get getprop name */
lis %r8,0xe00000@ha
addi %r9,%r8,ofw_getprop_name - _start
stw %r9,0(%r1)
/* 4 Argument and 1 return */
li %r9,4
stw %r9,4(%r1)
li %r9,1
stw %r9,8(%r1)
stw %r3,12(%r1) /* Package */
stw %r4,16(%r1) /* Property */
stw %r5,20(%r1) /* Return buffer */
stw %r6,24(%r1) /* Buffer size */
/* Load up the call address */
lwz %r9,ofw_call_addr - _start(%r8)
mtlr %r9
/* Set argument */
mr %r3,%r1
/* Fire */
blrl
/* Workaround to a wierd crash ... not sure what causes it.
* XXX investigate me */
bl ofw_print_nothing
/* Return */
lwz %r3,28(%r1)
/* Restore registers */
lwz %r8,40(%r1)
mtlr %r8
lwz %r9,36(%r1)
lwz %r8,32(%r1)
addi %r1,%r1,48
/* Return */
blr
ofw_getprop:
/* Reserve stack space:
* 32 bytes for the ofw call
* 12 bytes for r8, r9, lr
*/
/* Reserve stack space ...
* 20 bytes for the ofw call,
* r8, r9, and lr */
subi %r1,%r1,48
/* Store r8, r9, lr */
stw %r8,32(%r1)
stw %r9,36(%r1)
mflr %r8
stw %r8,40(%r1)
/* Get getprop name */
lis %r8,0xe00000@ha
addi %r9,%r8,ofw_getprop_name - _start
stw %r9,0(%r1)
/* 4 Argument and 1 return */
li %r9,4
stw %r9,4(%r1)
li %r9,1
stw %r9,8(%r1)
stw %r3,12(%r1) /* Package */
stw %r4,16(%r1) /* Property */
stw %r5,20(%r1) /* Return buffer */
stw %r6,24(%r1) /* Buffer size */
/* Load up the call address */
lwz %r9,ofw_call_addr - _start(%r8)
mtlr %r9
/* Set argument */
mr %r3,%r1
/* Fire */
blrl
/* Return */
lwz %r3,28(%r1)
/* Restore registers */
lwz %r8,40(%r1)
mtlr %r8
lwz %r9,36(%r1)
lwz %r8,32(%r1)
addi %r1,%r1,48
/* Return */
blr
ofw_write:
/* Reserve stack space:
* 28 bytes for the ofw call
* 12 bytes for r8, r9, lr
*/
/* Reserve stack space ...
* 20 bytes for the ofw call,
* r8, r9, and lr */
subi %r1,%r1,48
nop
/* Store r8, r9, lr */
stw %r8,28(%r1)
stw %r9,32(%r1)
mflr %r8
stw %r8,36(%r1)
/* Get write name */
lis %r8,0xe00000@ha
addi %r9,%r8,ofw_write_name - _start
stw %r9,0(%r1)
/* 3 Arguments and 1 return */
li %r9,3
stw %r9,4(%r1)
li %r9,1
stw %r9,8(%r1)
stw %r3,12(%r1)
stw %r4,16(%r1)
stw %r5,20(%r1)
/* Load up the call address */
lwz %r9,ofw_call_addr - _start(%r8)
mtlr %r9
/* Set argument */
mr %r3,%r1
/* Fire */
blrl
/* Return */
lwz %r3,24(%r1)
/* Restore registers */
lwz %r8,36(%r1)
mtlr %r8
lwz %r9,32(%r1)
lwz %r8,28(%r1)
addi %r1,%r1,48
/* Return */
blr
ofw_read:
/* Reserve stack space:
* 28 bytes for the ofw call
* 12 bytes for r8, r9, lr
*/
/* Reserve stack space ...
* 20 bytes for the ofw call,
* r8, r9, and lr */
subi %r1,%r1,48
nop
/* Store r8, r9, lr */
stw %r8,28(%r1)
stw %r9,32(%r1)
mflr %r8
stw %r8,36(%r1)
/* Get read name */
lis %r8,0xe00000@ha
addi %r9,%r8,ofw_read_name - _start
stw %r9,0(%r1)
/* 3 Arguments and 1 return */
li %r9,3
stw %r9,4(%r1)
li %r9,1
stw %r9,8(%r1)
stw %r3,12(%r1)
stw %r4,16(%r1)
stw %r5,20(%r1)
/* Load up the call address */
lwz %r9,ofw_call_addr - _start(%r8)
mtlr %r9
/* Set argument */
mr %r3,%r1
/* Fire */
blrl
/* Return */
lwz %r3,24(%r1)
/* Restore registers */
lwz %r8,36(%r1)
mtlr %r8
lwz %r9,32(%r1)
lwz %r8,28(%r1)
addi %r1,%r1,48
/* Return */
blr
ofw_exit:
lis %r3,0xe00000@ha
addi %r3,%r3,freeldr_halt - _start
bl ofw_print_string
/*
ofw_exit_loop:
b ofw_exit_loop
*/
/* Load the exit name */
lis %r8,0xe00000@ha
addi %r9,%r8,ofw_exit_name - _start
stw %r9,0(%r1)
/* Zero args, zero returns */
xor %r9,%r9,%r9
stw %r9,4(%r1)
stw %r9,8(%r1)
/* Load up the call address */
lwz %r9,ofw_call_addr - _start(%r8)
mtlr %r9
mr %r3,%r1
/* Fire */
blrl
/* No return from exit */
.org 0x1000
freeldr_banner:
.ascii "ReactOS OpenFirmware Boot Program\r\n\0"
freeldr_halt:
.ascii "ReactOS OpenFirmware Boot Program Halting\r\n\0"
freeldr_reg_init:
.ascii "r\0"
freeldr_reg_lr:
.ascii "lr \0"
freeldr_reg_cr:
.ascii "cr \0"
freeldr_reg_ctr:
.ascii "ctr\0"
freeldr_reg_msr:
.ascii "msr\0"
ofw_call_addr:
.long 0
ofw_memory_size:
.long 0
.long 0
.long 0
.long 0
ofw_finddevice_name:
.ascii "finddevice\0"
ofw_getprop_name:
.ascii "getprop\0"
ofw_write_name:
.ascii "write\0"
ofw_read_name:
.ascii "read\0"
ofw_exit_name:
.ascii "exit\0"
ofw_chosen_name:
.ascii "/chosen\0"
ofw_stdout_name:
.ascii "stdout\0"
ofw_memory_name:
.ascii "/memory@0\0"
ofw_reg_name:
.ascii "reg\0"
ofw_functions:
.long ofw_finddevice_hook
.long ofw_getprop_hook
.long ofw_write
.long ofw_read
.long ofw_exit
.long ofw_print_regs
.long ofw_print_string
.long ofw_print_number
.org 0x2000
stack:
.space 0x4000

View File

@@ -47,10 +47,10 @@ EXTERN(RealEntryPoint)
.code32
/* Store the boot drive */
movb %dl,(_BootDrive)
movb %dl,(_i386BootDrive)
/* Store the boot partition */
movb %dh,(_BootPartition)
movb %dh,(_i386BootPartition)
/* GO! */
xorl %eax,%eax
@@ -275,9 +275,11 @@ EXTERN(_DisableA20)
* other boot loaders like Grub
*/
#define MB_INFO_SIZE 90
#define MB_INFO_FLAGS_OFFSET 0
#define MB_INFO_BOOT_DEVICE_OFFSET 12
#define MB_INFO_COMMAND_LINE_OFFSET 16
#define CMDLINE_SIZE 256
/*
* We want to execute at 0x8000 (to be compatible with bootsector
@@ -285,7 +287,6 @@ EXTERN(_DisableA20)
* above 1MB. So we let Grub load us there and then relocate
* ourself to 0x8000
*/
#define CMDLINE_BASE 0x7000
#define FREELDR_BASE 0x8000
#define INITIAL_BASE 0x200000
@@ -328,6 +329,31 @@ mb1:
movw %dx,%ds
movw %dx,%es
/* Check for valid multiboot signature */
cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax
jne mbfail
/* Store multiboot info in a safe place */
movl %ebx,%esi
movl $(mb_info + INITIAL_BASE - FREELDR_BASE),%edi
movl $MB_INFO_SIZE,%ecx
rep movsb
/* Save commandline */
movl MB_INFO_FLAGS_OFFSET(%ebx),%edx
testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
jz mb3
movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi
movl $(cmdline + INITIAL_BASE - FREELDR_BASE),%edi
movl $CMDLINE_SIZE,%ecx
mb2: lodsb
stosb
testb %al,%al
jz mb3
dec %ecx
jnz mb2
mb3:
/* Copy to low mem */
movl $INITIAL_BASE,%esi
movl $FREELDR_BASE,%edi
@@ -342,8 +368,8 @@ mb1:
/* Clear prefetch queue & correct CS,
* jump to low mem */
ljmp $PMODE_CS, $mb2
mb2:
ljmp $PMODE_CS, $mb4
mb4:
/* Reload segment selectors */
movw $PMODE_DS,%dx
movw %dx,%ds
@@ -353,39 +379,28 @@ mb2:
movw %dx,%ss
movl $STACK32ADDR,%esp
/* Check for valid multiboot signature */
cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax
jne mbfail
movl $mb_info,%ebx
/* See if the boot device was passed in */
movl MB_INFO_FLAGS_OFFSET(%ebx),%edx
testl $MB_INFO_FLAG_BOOT_DEVICE,%edx
jz mb3
jz mb5
/* Retrieve boot device info */
movl MB_INFO_BOOT_DEVICE_OFFSET(%ebx),%eax
shrl $16,%eax
incb %al
movb %al,_BootPartition
movb %ah,_BootDrive
jmp mb4
mb3: /* No boot device known, assume first partition of first harddisk */
movb $0x80,_BootDrive
movb $1,_BootPartition
mb4:
/* Check for a command line */
xorl %eax,%eax
testl $MB_INFO_FLAG_COMMAND_LINE,%edx
jz mb6
/* Copy command line to low mem*/
movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi
movl $CMDLINE_BASE,%edi
mb5: lodsb
stosb
testb %al,%al
jnz mb5
movl $CMDLINE_BASE,%eax
movb %al,_i386BootPartition
movb %ah,_i386BootDrive
jmp mb6
mb5: /* No boot device known, assume first partition of first harddisk */
movb $0x80,_i386BootDrive
movb $1,_i386BootPartition
mb6:
/* Check for command line */
mov $cmdline,%eax
testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
jnz mb7
xorl %eax,%eax
mb7:
/* GO! */
pushl %eax
@@ -462,8 +477,15 @@ rmode_idtptr:
.word 0x3ff /* Limit */
.long 0 /* Base Address */
EXTERN(_BootDrive)
EXTERN(_i386BootDrive)
.long 0
EXTERN(_BootPartition)
EXTERN(_i386BootPartition)
.long 0
.bss
mb_info:
.fill MB_INFO_SIZE, 1, 0
cmdline:
.fill CMDLINE_SIZE, 1, 0

View File

@@ -27,7 +27,7 @@
#include "rtl.h"
VOID
MachInit(VOID)
MachInit(char *CmdLine)
{
ULONG PciId;
@@ -39,11 +39,11 @@ MachInit(VOID)
PciId = READ_PORT_ULONG((ULONG*) 0xcfc);
if (0x02a510de == PciId)
{
XboxMachInit();
XboxMachInit(CmdLine);
}
else
{
PcMachInit();
PcMachInit(CmdLine);
}
HalpCalibrateStallExecution();

View File

@@ -31,7 +31,7 @@ EXTERN(_ChainLoadBiosBootSectorCode)
.code16
/* Set the boot drive */
movb (_BootDrive),%dl
movb (_i386BootDrive),%dl
/* Load segment registers */
cli

View File

@@ -0,0 +1,40 @@
/*
* FreeLoader
*
* Copyright (C) 2003 Eric Kohl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __I386_I386_H_
#define __I386_I386_H_
extern ULONG i386BootDrive;
extern ULONG i386BootPartition;
extern BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector,
PULONGLONG SectorCount, int *FsType);
extern BOOL i386DiskGetSystemVolume(char *SystemPath, char *RemainingPath,
PULONG Device, PULONG DriveNumber,
PULONGLONG StartSector,
PULONGLONG SectorCount, int *FsType);
extern BOOL i386DiskGetBootPath(char *BootPath, unsigned Size);
extern VOID i386DiskGetBootDevice(PULONG BootDevice);
extern BOOL i386DiskBootingFromFloppy(VOID);
#endif /* __I386_I386_H_ */
/* EOF */

View File

@@ -19,6 +19,8 @@
#include "freeldr.h"
#include "debug.h"
#include "i386.h"
#include "fsrec.h"
/////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
@@ -166,4 +168,244 @@ BOOL DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT Buff
return TRUE;
}
#endif // defined __i386__
BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
{
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR VolumeType;
DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", i386BootDrive, i386BootPartition));
// Check and see if it is a floppy drive
// If so then just assume FAT12 file system type
if (DiskIsDriveRemovable(i386BootDrive))
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n"));
*DriveNumber = i386BootDrive;
*StartSector = 0;
*SectorCount = 2 * 80 * 18; /* FIXME hardcoded for 1.44 Mb */
*FsType = FS_FAT;
return TRUE;
}
// Check for ISO9660 file system type
if (i386BootDrive >= 0x80 && FsRecIsIso9660(i386BootDrive))
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
*DriveNumber = i386BootDrive;
*StartSector = 0;
*SectorCount = 0;
*FsType = FS_ISO9660;
return TRUE;
}
// Get the requested partition entry
if (i386BootPartition == 0)
{
// Partition requested was zero which means the boot partition
if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry))
{
return FALSE;
}
}
else
{
// Get requested partition
if (! MachDiskGetPartitionEntry(i386BootDrive, i386BootPartition, &PartitionTableEntry))
{
return FALSE;
}
}
// Check for valid partition
if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
{
return FALSE;
}
// Try to recognize the file system
if (!FsRecognizeVolume(i386BootDrive, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
{
return FALSE;
}
*DriveNumber = i386BootDrive;
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
*SectorCount = PartitionTableEntry.PartitionSectorCount;
//switch (PartitionTableEntry.SystemIndicator)
switch (VolumeType)
{
case PARTITION_FAT_12:
case PARTITION_FAT_16:
case PARTITION_HUGE:
case PARTITION_XINT13:
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
*FsType = FS_FAT;
return TRUE;
case PARTITION_EXT2:
*FsType = FS_EXT2;
return TRUE;
case PARTITION_NTFS:
*FsType = FS_NTFS;
return TRUE;
default:
*FsType = 0;
return FALSE;
}
return TRUE;
}
VOID
i386DiskGetBootDevice(PULONG BootDevice)
{
((char *)BootDevice)[0] = (char)i386BootDrive;
((char *)BootDevice)[1] = (char)i386BootPartition;
}
BOOL
i386DiskBootingFromFloppy(VOID)
{
return i386BootDrive < 0x80;
}
#define IsRecognizedPartition(P) \
((P) == PARTITION_FAT_12 || \
(P) == PARTITION_FAT_16 || \
(P) == PARTITION_HUGE || \
(P) == PARTITION_IFS || \
(P) == PARTITION_EXT2 || \
(P) == PARTITION_FAT32 || \
(P) == PARTITION_FAT32_XINT13 || \
(P) == PARTITION_XINT13)
BOOL i386DiskGetSystemVolume(char *SystemPath,
char *RemainingPath,
PULONG Device,
PULONG DriveNumber,
PULONGLONG StartSector,
PULONGLONG SectorCount,
int *FsType)
{
ULONG PartitionNumber;
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR VolumeType;
CHAR BootPath[256];
unsigned i, RosPartition;
/*
* Verify system path
*/
if (!DissectArcPath(SystemPath, BootPath, DriveNumber, &PartitionNumber))
{
return FALSE;
}
if (NULL != RemainingPath)
{
strcpy(RemainingPath, BootPath);
}
/* 0xff -> no partition table present, use whole device */
if (0xff == PartitionNumber)
{
PartitionTableEntry.SectorCountBeforePartition = 0;
i = 0xff;
}
else
{
/* recalculate the boot partition for freeldr */
i = 0;
RosPartition = 0;
while (1)
{
if (!MachDiskGetPartitionEntry(*DriveNumber, ++i, &PartitionTableEntry))
{
return FALSE;
}
if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
{
if (++RosPartition == PartitionNumber)
{
break;
}
}
}
}
/* Check for ISO9660 file system type */
if (*DriveNumber >= 0x80 && FsRecIsIso9660(*DriveNumber))
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
if (NULL != Device)
{
((char *)Device)[0] = (char)(*DriveNumber);
((char *)Device)[1] = (char)i;
}
*StartSector = 0;
*SectorCount = 0;
*FsType = FS_ISO9660;
return TRUE;
}
if (!FsRecognizeVolume(*DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
{
return FALSE;
}
if (NULL != Device)
{
((char *)Device)[0] = (char)(*DriveNumber);
((char *)Device)[1] = (char)i;
}
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
*SectorCount = PartitionTableEntry.PartitionSectorCount;
switch (VolumeType)
{
case PARTITION_FAT_12:
case PARTITION_FAT_16:
case PARTITION_HUGE:
case PARTITION_XINT13:
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
*FsType = FS_FAT;
return TRUE;
case PARTITION_EXT2:
*FsType = FS_EXT2;
return TRUE;
case PARTITION_NTFS:
*FsType = FS_NTFS;
return TRUE;
default:
*FsType = 0;
return FALSE;
}
return FALSE;
}
BOOL
i386DiskGetBootPath(char *BootPath, unsigned Size)
{
static char Path[] = "multi(0)disk(0)";
char Device[4];
itoa(i386BootDrive, Device, 10);
if (Size <= sizeof(Path) + 6 + strlen(Device))
{
return FALSE;
}
strcpy(BootPath, Path);
strcat(BootPath, MachDiskBootingFromFloppy() ? "fdisk" : "cdrom");
strcat(strcat(strcat(BootPath, "("), Device), ")");
return TRUE;
}
#endif /* defined __i386__ */
/* EOF */

View File

@@ -30,7 +30,7 @@ EXTERN(_BootNewLinuxKernel)
.code16
/* Set the boot drive */
movb (_BootDrive),%dl
movb (_i386BootDrive),%dl
/* Load segment registers */
cli
@@ -66,7 +66,7 @@ EXTERN(_BootOldLinuxKernel)
.code16
/* Set the boot drive */
movb (_BootDrive),%dl
movb (_i386BootDrive),%dl
/* Load segment registers */
cli

View File

@@ -23,9 +23,10 @@
#include "machine.h"
#include "machpc.h"
#include "rtl.h"
#include "i386.h"
VOID
PcMachInit(VOID)
PcMachInit(char *CmdLine)
{
EnableA20();
@@ -48,6 +49,11 @@ PcMachInit(VOID)
MachVtbl.VideoSync = PcVideoSync;
MachVtbl.VideoPrepareForReactOS = PcVideoPrepareForReactOS;
MachVtbl.GetMemoryMap = PcMemGetMemoryMap;
MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume;
MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume;
MachVtbl.DiskGetBootPath = i386DiskGetBootPath;
MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice;
MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy;
MachVtbl.DiskReadLogicalSectors = PcDiskReadLogicalSectors;
MachVtbl.DiskGetPartitionEntry = PcDiskGetPartitionEntry;
MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry;

View File

@@ -26,7 +26,7 @@
#include "mm.h"
#endif
VOID PcMachInit(VOID);
VOID PcMachInit(char *CmdLine);
VOID PcConsPutChar(int Ch);
BOOL PcConsKbHit();

View File

@@ -21,9 +21,10 @@
#include "mm.h"
#include "machine.h"
#include "machxbox.h"
#include "i386.h"
VOID
XboxMachInit(VOID)
XboxMachInit(char *CmdLine)
{
/* Initialize our stuff */
XboxMemInit();
@@ -46,6 +47,11 @@ XboxMachInit(VOID)
MachVtbl.VideoSync = XboxVideoSync;
MachVtbl.VideoPrepareForReactOS = XboxVideoPrepareForReactOS;
MachVtbl.GetMemoryMap = XboxMemGetMemoryMap;
MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume;
MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume;
MachVtbl.DiskGetBootPath = i386DiskGetBootPath;
MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice;
MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy;
MachVtbl.DiskReadLogicalSectors = XboxDiskReadLogicalSectors;
MachVtbl.DiskGetPartitionEntry = XboxDiskGetPartitionEntry;
MachVtbl.DiskGetDriveGeometry = XboxDiskGetDriveGeometry;

View File

@@ -26,7 +26,7 @@
UCHAR XboxFont8x16[256 * 16];
VOID XboxMachInit(VOID);
VOID XboxMachInit(char *CmdLine);
VOID XboxConsPutChar(int Ch);
BOOL XboxConsKbHit();

View File

@@ -0,0 +1,3 @@
.extern PpcInit
_start:
b PpcInit

View File

@@ -0,0 +1,305 @@
/*
* FreeLoader PowerPC Part
* Copyright (C) 2005 Art Yerkes
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "freeldr.h"
#include "machine.h"
#include "of.h"
extern void BootMain( char * );
extern char *GetFreeLoaderVersionString();
ULONG BootPartition = 0;
ULONG BootDrive = 0;
of_proxy ofproxy;
void *PageDirectoryStart, *PageDirectoryEnd;
static int chosen_package, stdin_handle;
BOOLEAN AcpiPresent = FALSE;
char BootPath[0x100];
void le_swap( const void *start_addr_v,
const void *end_addr_v,
const void *target_addr_v ) {
long *start_addr = (long *)ROUND_DOWN((long)start_addr_v,8),
*end_addr = (long *)ROUND_UP((long)end_addr_v,8),
*target_addr = (long *)ROUND_DOWN((long)target_addr_v,8);
long tmp;
while( start_addr <= end_addr ) {
tmp = start_addr[0];
target_addr[0] = REV(start_addr[1]);
target_addr[1] = REV(tmp);
start_addr += 2;
target_addr += 2;
}
}
int ofw_finddevice( const char *name ) {
int ret, len;
len = strlen(name);
le_swap( name, name + len, name );
ret = ofproxy( 0, (char *)name, NULL, NULL, NULL );
le_swap( name, name + len, name );
return ret;
}
int ofw_getprop( int package, const char *name, void *buffer, int buflen ) {
int ret, len = strlen(name);
le_swap( name, name + len, name );
le_swap( buffer, buffer + buflen, buffer );
ret = ofproxy
( 4, (void *)package, (char *)name, buffer, (void *)buflen );
le_swap( buffer, buffer + buflen, buffer );
le_swap( name, name + len, name );
return ret;
}
int ofw_write( int handle, const char *data, int len ) {
int ret;
le_swap( data, data + len, data );
ret = ofproxy
( 8, (void *)handle, (char *)data, (void *)len, NULL );
le_swap( data, data + len, data );
return ret;
}
int ofw_read( int handle, const char *data, int len ) {
int ret;
le_swap( data, data + len, data );
ret = ofproxy
( 12, (void *)handle, (char *)data, (void *)len, NULL );
le_swap( data, data + len, data );
return ret;
}
void ofw_exit() {
ofproxy( 16, NULL, NULL, NULL, NULL );
}
void ofw_dumpregs() {
ofproxy( 20, NULL, NULL, NULL, NULL );
}
void ofw_print_string( const char *str ) {
int len = strlen(str);
le_swap( (char *)str, str + len, (char *)str );
ofproxy( 24, (void *)str, NULL, NULL, NULL );
le_swap( (char *)str, str + len, (char *)str );
}
void ofw_print_number( int num ) {
ofproxy( 28, (void *)num, NULL, NULL, NULL );
}
void PpcPutChar( int ch ) {
char buf[3];
if( ch == 0x0a ) { buf[0] = 0x0d; buf[1] = 0x0a; }
else { buf[0] = ch; buf[1] = 0; }
buf[2] = 0;
ofw_print_string( buf );
}
BOOL PpcConsKbHit() {
return TRUE;
}
int PpcConsGetCh() {
char buf;
ofw_read( stdin_handle, &buf, 1 );
return buf;
}
void PpcVideoClearScreen( UCHAR Attr ) {
ofw_print_string("ClearScreen\n");
}
VIDEODISPLAYMODE PpcVideoSetDisplayMode( char *DisplayMode, BOOL Init ) {
printf( "DisplayMode: %s %s\n", DisplayMode, Init ? "true" : "false" );
return VideoGraphicsMode;
}
/* FIXME: Query */
VOID PpcVideoGetDisplaySize( PULONG Width, PULONG Height, PULONG Depth ) {
ofw_print_string("GetDisplaySize\n");
*Width = 640;
*Height = 480;
*Depth = 8;
}
ULONG PpcVideoGetBufferSize() {
ULONG Width, Height, Depth;
ofw_print_string("PpcVideoGetBufferSize\n");
PpcVideoGetDisplaySize( &Width, &Height, &Depth );
return Width * Height * Depth / 8;
}
VOID PpcVideoSetTextCursorPosition( ULONG X, ULONG Y ) {
printf("SetTextCursorPosition(%d,%d)\n", X,Y);
}
VOID PpcVideoHideShowTextCursor( BOOL Show ) {
printf("HideShowTextCursor(%s)\n", Show ? "true" : "false");
}
VOID PpcVideoPutChar( int Ch, UCHAR Attr, unsigned X, unsigned Y ) {
printf( "\033[%d;%dH%c", Y, X, Ch );
}
VOID PpcVideoCopyOffScreenBufferToVRAM( PVOID Buffer ) {
printf( "CopyOffScreenBufferToVRAM(%x)\n", Buffer );
}
BOOL PpcVideoIsPaletteFixed() {
return FALSE;
}
VOID PpcVideoSetPaletteColor( UCHAR Color,
UCHAR Red, UCHAR Green, UCHAR Blue ) {
printf( "SetPaletteColor(%x,%x,%x,%x)\n", Color, Red, Green, Blue );
}
VOID PpcVideoGetPaletteColor( UCHAR Color,
UCHAR *Red, UCHAR *Green, UCHAR *Blue ) {
printf( "GetPaletteColor(%x)\n", Color);
}
VOID PpcVideoSync() {
printf( "Sync\n" );
}
VOID PpcVideoPrepareForReactOS() {
printf( "PrepareForReactOS\n");
}
/* XXX FIXME:
* According to the linux people (this is backed up by my own experience),
* the memory object in older ofw does not do getprop right.
*
* The "right" way is to probe the pci bridge. *sigh*
*/
ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
ULONG MaxMemoryMapSize ) {
printf("GetMemoryMap(chosen=%x)\n", chosen_package);
BiosMemoryMap[0].Type = MEMTYPE_USABLE;
BiosMemoryMap[0].BaseAddress = 0;
BiosMemoryMap[0].Length = 32 * 1024 * 1024; /* Assume 32 meg for now */
printf( "Returning memory map (%dk total)\n",
(int)BiosMemoryMap[0].Length / 1024 );
return 1;
}
BOOL PpcDiskReadLogicalSectors( ULONG DriveNumber, ULONGLONG SectorNumber,
ULONG SectorCount, PVOID Buffer ) {
printf("DiskReadLogicalSectors\n");
return FALSE;
}
BOOL PpcDiskGetPartitionEntry( ULONG DriveNumber, ULONG PartitionNumber,
PPARTITION_TABLE_ENTRY PartitionTableEntry ) {
printf("GetPartitionEntry(%d,%d)\n", DriveNumber, PartitionNumber);
return FALSE;
}
BOOL PpcDiskGetDriveGeometry( ULONG DriveNumber, PGEOMETRY DriveGeometry ) {
printf("GetGeometry(%d)\n", DriveNumber);
return FALSE;
}
ULONG PpcDiskGetCacheableBlockCount( ULONG DriveNumber ) {
printf("GetCacheableBlockCount\n");
return 0;
}
VOID PpcRTCGetCurrentDateTime( PULONG Hear, PULONG Month, PULONG Day,
PULONG Hour, PULONG Minute, PULONG Second ) {
printf("RTCGeturrentDateTime\n");
}
VOID PpcHwDetect() {
}
void PpcInit( of_proxy the_ofproxy ) {
ofproxy = the_ofproxy;
chosen_package = ofw_finddevice( "/chosen" );
ofw_getprop( chosen_package, "stdin",
&stdin_handle, sizeof(stdin_handle) );
stdin_handle = REV(stdin_handle);
MachVtbl.ConsPutChar = PpcPutChar;
MachVtbl.ConsKbHit = PpcConsKbHit;
MachVtbl.ConsGetCh = PpcConsGetCh;
printf("chosen_package = %x\n", chosen_package);
MachVtbl.VideoClearScreen = PpcVideoClearScreen;
MachVtbl.VideoSetDisplayMode = PpcVideoSetDisplayMode;
MachVtbl.VideoGetDisplaySize = PpcVideoGetDisplaySize;
MachVtbl.VideoGetBufferSize = PpcVideoGetBufferSize;
MachVtbl.VideoSetTextCursorPosition = PpcVideoSetTextCursorPosition;
MachVtbl.VideoHideShowTextCursor = PpcVideoHideShowTextCursor;
MachVtbl.VideoPutChar = PpcVideoPutChar;
MachVtbl.VideoCopyOffScreenBufferToVRAM =
PpcVideoCopyOffScreenBufferToVRAM;
MachVtbl.VideoIsPaletteFixed = PpcVideoIsPaletteFixed;
MachVtbl.VideoSetPaletteColor = PpcVideoSetPaletteColor;
MachVtbl.VideoGetPaletteColor = PpcVideoGetPaletteColor;
MachVtbl.VideoSync = PpcVideoSync;
MachVtbl.VideoPrepareForReactOS = PpcVideoPrepareForReactOS;
MachVtbl.GetMemoryMap = PpcGetMemoryMap;
MachVtbl.DiskReadLogicalSectors = PpcDiskReadLogicalSectors;
MachVtbl.DiskGetPartitionEntry = PpcDiskGetPartitionEntry;
MachVtbl.DiskGetDriveGeometry = PpcDiskGetDriveGeometry;
MachVtbl.DiskGetCacheableBlockCount = PpcDiskGetCacheableBlockCount;
MachVtbl.RTCGetCurrentDateTime = PpcRTCGetCurrentDateTime;
MachVtbl.HwDetect = PpcHwDetect;
printf( "FreeLDR version [%s]\n", GetFreeLoaderVersionString() );
BootMain("freeldr-ppc");
}
void MachInit(char *CmdLine) {
int len;
printf( "Determining boot device:\n" );
len = ofw_getprop(chosen_package, "bootpath",
BootPath, sizeof(BootPath));
printf( "Got %d bytes of path\n", len );
BootPath[len] = 0;
printf( "Boot Path: %s\n", BootPath );
printf( "FreeLDR starting\n" );
}
void FrLdrSetupPageDirectory() {
}
void beep() {
}
UCHAR STDCALL READ_PORT_UCHAR(PUCHAR Address) {
return 0xff;
}
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value) {
}

View File

@@ -49,6 +49,13 @@ VOID RunLoader(VOID)
LONG TimeOut;
ULONG SelectedOperatingSystem;
if (!FsOpenBootVolume())
{
printf("Error opening boot partition for file access.\n");
MachConsGetCh();
return;
}
if (!IniFileInitialize())
{
printf("Press any key to reboot.\n");

View File

@@ -28,7 +28,8 @@
BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
{
ULONG BootablePartitionCount = 0;
ULONG BootablePartitionCount = 0;
ULONG ActivePartition = 0;
MASTER_BOOT_RECORD MasterBootRecord;
// Read master boot record
@@ -41,22 +42,22 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
if (MasterBootRecord.PartitionTable[0].BootIndicator == 0x80)
{
BootablePartitionCount++;
BootPartition = 0;
ActivePartition = 0;
}
if (MasterBootRecord.PartitionTable[1].BootIndicator == 0x80)
{
BootablePartitionCount++;
BootPartition = 1;
ActivePartition = 1;
}
if (MasterBootRecord.PartitionTable[2].BootIndicator == 0x80)
{
BootablePartitionCount++;
BootPartition = 2;
ActivePartition = 2;
}
if (MasterBootRecord.PartitionTable[3].BootIndicator == 0x80)
{
BootablePartitionCount++;
BootPartition = 3;
ActivePartition = 3;
}
// Make sure there was only one bootable partition
@@ -72,7 +73,7 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
}
// Copy the partition table entry
RtlCopyMemory(PartitionTableEntry, &MasterBootRecord.PartitionTable[BootPartition], sizeof(PARTITION_TABLE_ENTRY));
RtlCopyMemory(PartitionTableEntry, &MasterBootRecord.PartitionTable[ActivePartition], sizeof(PARTITION_TABLE_ENTRY));
return TRUE;
}

View File

@@ -31,7 +31,7 @@ VOID BootMain(char *CmdLine)
{
CmdLineParse(CmdLine);
MachInit();
MachInit(CmdLine);
DebugInit();

View File

@@ -51,110 +51,78 @@ VOID FileSystemError(PUCHAR ErrorString)
/*
*
* BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber);
* BOOL FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type);
*
* This function is called to open a disk volume for file access.
* It must be called before any of the file functions will work.
* It takes two parameters:
*
* Drive: The BIOS drive number of the disk to open
* Partition: This is zero for floppy drives.
* If the disk is a hard disk then this specifies
* The partition number to open (1 - 4)
* If it is zero then it opens the active (bootable) partition
*
*/
BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber)
static BOOL FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type)
{
PARTITION_TABLE_ENTRY PartitionTableEntry;
UCHAR ErrorText[80];
UCHAR VolumeType;
UCHAR ErrorText[80];
DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", DriveNumber, PartitionNumber));
FsType = Type;
// Check and see if it is a floppy drive
// If so then just assume FAT12 file system type
if (DiskIsDriveRemovable(DriveNumber))
switch (FsType)
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n"));
FsType = FS_FAT;
return FatOpenVolume(DriveNumber, 0, 0);
}
// Check for ISO9660 file system type
if (DriveNumber >= 0x80 && FsRecIsIso9660(DriveNumber))
{
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
FsType = FS_ISO9660;
case FS_FAT:
return FatOpenVolume(DriveNumber, StartSector, SectorCount);
case FS_EXT2:
return Ext2OpenVolume(DriveNumber, StartSector);
case FS_NTFS:
return NtfsOpenVolume(DriveNumber, StartSector);
case FS_ISO9660:
return IsoOpenVolume(DriveNumber);
}
// Set the boot partition
BootPartition = PartitionNumber;
// Get the requested partition entry
if (PartitionNumber == 0)
{
// Partition requested was zero which means the boot partition
if (DiskGetActivePartitionEntry(DriveNumber, &PartitionTableEntry) == FALSE)
{
FileSystemError("No active partition.");
return FALSE;
}
}
else
{
// Get requested partition
if (MachDiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry) == FALSE)
{
FileSystemError("Partition not found.");
return FALSE;
}
}
// Check for valid partition
if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
{
FileSystemError("Invalid partition.");
return FALSE;
}
// Try to recognize the file system
if (!FsRecognizeVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
{
FileSystemError("Unrecognized file system.");
return FALSE;
}
//switch (PartitionTableEntry.SystemIndicator)
switch (VolumeType)
{
case PARTITION_FAT_12:
case PARTITION_FAT_16:
case PARTITION_HUGE:
case PARTITION_XINT13:
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
FsType = FS_FAT;
return FatOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, PartitionTableEntry.PartitionSectorCount);
case PARTITION_EXT2:
FsType = FS_EXT2;
return Ext2OpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
case PARTITION_NTFS:
FsType = FS_NTFS;
return NtfsOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
default:
FsType = 0;
sprintf(ErrorText, "Unsupported file system. Type: 0x%x", VolumeType);
sprintf(ErrorText, "Unsupported file system. Type: 0x%x", Type);
FileSystemError(ErrorText);
}
return FALSE;
}
/*
*
* BOOL FsOpenBootVolume()
*
* This function is called to open the boot disk volume for file access.
* It must be called before any of the file functions will work.
*/
BOOL FsOpenBootVolume()
{
ULONG DriveNumber;
ULONGLONG StartSector;
ULONGLONG SectorCount;
int Type;
if (! MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount, &Type))
{
FileSystemError("Unable to locate boot partition\n");
return FALSE;
}
return TRUE;
return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type);
}
BOOL FsOpenSystemVolume(char *SystemPath, char *RemainingPath, PULONG Device)
{
ULONG DriveNumber;
ULONGLONG StartSector;
ULONGLONG SectorCount;
int Type;
if (! MachDiskGetSystemVolume(SystemPath, RemainingPath, Device,
&DriveNumber, &StartSector, &SectorCount,
&Type))
{
FileSystemError("Unable to locate system partition\n");
return FALSE;
}
return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type);
}
PFILE FsOpenFile(PUCHAR FileName)
{
PFILE FileHandle = NULL;

View File

@@ -38,8 +38,6 @@
#define ROUND_DOWN(N, S) ((N) & ~((S) - 1))
#define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n")
extern ULONG BootDrive; /* BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc. */
extern ULONG BootPartition; /* Boot Partition, 1-4 */
extern BOOL UserInterfaceUp; /* Tells us if the user interface is displayed */
VOID BootMain(LPSTR CmdLine);

View File

@@ -33,7 +33,8 @@
#define PFILE FILE *
VOID FileSystemError(PUCHAR ErrorString);
BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber);
BOOL FsOpenBootVolume();
BOOL FsOpenSystemVolume(char *SystemPath, char *RemainingPath, PULONG BootDevice);
PFILE FsOpenFile(PUCHAR FileName);
VOID FsCloseFile(PFILE FileHandle);
BOOL FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer);

View File

@@ -56,6 +56,11 @@ typedef struct tagMACHVTBL
ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
BOOL (*DiskGetBootVolume)(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
BOOL (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device, PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
BOOL (*DiskGetBootPath)(char *BootPath, unsigned Size);
VOID (*DiskGetBootDevice)(PULONG BootDevice);
BOOL (*DiskBootingFromFloppy)(VOID);
BOOL (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
BOOL (*DiskGetPartitionEntry)(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOL (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry);
@@ -66,7 +71,7 @@ typedef struct tagMACHVTBL
VOID (*HwDetect)(VOID);
} MACHVTBL, *PMACHVTBL;
VOID MachInit(VOID);
VOID MachInit(char *CmdLine);
extern MACHVTBL MachVtbl;
@@ -87,6 +92,11 @@ extern MACHVTBL MachVtbl;
#define MachVideoSync() MachVtbl.VideoSync()
#define MachVideoPrepareForReactOS() MachVtbl.VideoPrepareForReactOS()
#define MachGetMemoryMap(MMap, Size) MachVtbl.GetMemoryMap((MMap), (Size))
#define MachDiskGetBootVolume(Drv, Start, Cnt, FsType) MachVtbl.DiskGetBootVolume((Drv), (Start), (Cnt), (FsType))
#define MachDiskGetSystemVolume(SysPath, RemPath, Dev, Drv, Start, Cnt, FsType) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev), (Drv), (Start), (Cnt), (FsType))
#define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size))
#define MachDiskGetBootDevice(BootDevice) MachVtbl.DiskGetBootDevice(BootDevice)
#define MachDiskBootingFromFloppy() MachVtbl.DiskBootingFromFloppy()
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
#define MachDiskGetPartitionEntry(Drive, Part, Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
#define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom))

View File

@@ -57,7 +57,7 @@ extern PINI_SECTION IniFileSectionListHead;
extern ULONG IniFileSectionCount;
extern ULONG IniFileSettingCount;
PFILE IniOpenIniFile(UCHAR BootDriveNumber, UCHAR BootPartitionNumber);
PFILE IniOpenIniFile();
BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize);
ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset);

View File

@@ -33,22 +33,7 @@ BOOL IniFileInitialize(VOID)
BOOL Success;
// Open freeldr.ini
// BootDrive & BootPartition are passed
// in from the boot sector code in the
// DL & DH registers.
Freeldr_Ini = IniOpenIniFile(BootDrive, BootPartition);
// If we couldn't open freeldr.ini on the partition
// they specified in the boot sector then try
// opening the active (boot) partition.
if ((Freeldr_Ini == NULL) && (BootPartition != 0))
{
BootPartition = 0;
Freeldr_Ini = IniOpenIniFile(BootDrive, BootPartition);
return FALSE;
}
Freeldr_Ini = IniOpenIniFile();
if (Freeldr_Ini == NULL)
{
@@ -87,24 +72,10 @@ BOOL IniFileInitialize(VOID)
return Success;
}
PFILE IniOpenIniFile(UCHAR BootDriveNumber, UCHAR BootPartitionNumber)
PFILE IniOpenIniFile()
{
PFILE IniFileHandle; // File handle for freeldr.ini
if (!FsOpenVolume(BootDriveNumber, BootPartitionNumber))
{
if (BootPartitionNumber == 0)
{
printf("Error opening active (bootable) partition on boot drive 0x%x for file access.\n", BootDriveNumber);
}
else
{
printf("Error opening partition %d on boot drive 0x%x for file access.\n", BootPartitionNumber, BootDriveNumber);
}
return NULL;
}
// Try to open freeldr.ini
IniFileHandle = FsOpenFile("freeldr.ini");

View File

@@ -40,18 +40,19 @@
PLINUX_BOOTSECTOR LinuxBootSector = NULL;
PLINUX_SETUPSECTOR LinuxSetupSector = NULL;
ULONG SetupSectorSize = 0;
BOOL NewStyleLinuxKernel = FALSE;
ULONG LinuxKernelSize = 0;
ULONG LinuxInitrdSize = 0;
UCHAR LinuxKernelName[260];
UCHAR LinuxInitrdName[260];
BOOL LinuxHasInitrd = FALSE;
UCHAR LinuxCommandLine[260] = "";
ULONG LinuxCommandLineSize = 0;
PVOID LinuxKernelLoadAddress = NULL;
PVOID LinuxInitrdLoadAddress = NULL;
UCHAR LinuxBootDescription[80];
ULONG SetupSectorSize = 0;
BOOL NewStyleLinuxKernel = FALSE;
ULONG LinuxKernelSize = 0;
ULONG LinuxInitrdSize = 0;
UCHAR LinuxKernelName[260];
UCHAR LinuxInitrdName[260];
BOOL LinuxHasInitrd = FALSE;
UCHAR LinuxCommandLine[260] = "";
ULONG LinuxCommandLineSize = 0;
PVOID LinuxKernelLoadAddress = NULL;
PVOID LinuxInitrdLoadAddress = NULL;
UCHAR LinuxBootDescription[80];
UCHAR LinuxBootPath[260] = "";
VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description)
{
@@ -80,7 +81,7 @@ VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description)
}
// Open the boot volume
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenSystemVolume(LinuxBootPath, NULL, NULL))
{
UiMessageBox("Failed to open boot drive.");
goto LinuxBootFailed;
@@ -226,8 +227,7 @@ LinuxBootFailed:
BOOL LinuxParseIniSection(PUCHAR OperatingSystemName)
{
UCHAR SettingName[260];
UCHAR SettingValue[260];
ULONG SectionId;
ULONG SectionId;
// Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName);
@@ -240,20 +240,12 @@ BOOL LinuxParseIniSection(PUCHAR OperatingSystemName)
return FALSE;
}
if (!IniReadSettingByName(SectionId, "BootDrive", SettingValue, 260))
if (!IniReadSettingByName(SectionId, "BootPath", LinuxBootPath, 260))
{
UiMessageBox("Boot drive not specified for selected OS!");
UiMessageBox("Boot path not specified for selected OS!");
return FALSE;
}
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
BootPartition = 0;
if (IniReadSettingByName(SectionId, "BootPartition", SettingValue, 260))
{
BootPartition = atoi(SettingValue);
}
// Get the kernel name
if (!IniReadSettingByName(SectionId, "Kernel", LinuxKernelName, 260))
{

View File

@@ -37,6 +37,11 @@
#undef MachVideoSync
#undef MachVideoPrepareForReactOS
#undef MachGetMemoryMap
#undef MachDiskGetBootVolume
#undef MachDiskGetSystemVolume
#undef MachDiskGetBootPath
#undef MachDiskGetBootDevice
#undef MachDiskBootingFromFloppy
#undef MachDiskReadLogicalSectors
#undef MachDiskGetPartitionEntry
#undef MachDiskGetDriveGeometry
@@ -148,6 +153,44 @@ MachGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
return MachVtbl.GetMemoryMap(BiosMemoryMap, MaxMemoryMapSize);
}
BOOL
MachDiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
{
return MachVtbl.DiskGetBootVolume(DriveNumber, StartSector, SectorCount, FsType);
}
BOOL
MachDiskGetSystemVolume(char *SystemPath,
char *RemainingPath,
PULONG Device,
PULONG DriveNumber,
PULONGLONG StartSector,
PULONGLONG SectorCount,
int *FsType)
{
return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device,
DriveNumber, StartSector, SectorCount,
FsType);
}
BOOL
MachDiskGetBootPath(char *BootPath, unsigned Size)
{
return MachVtbl.DiskGetBootPath(BootPath, Size);
}
VOID
MachDiskGetBootDevice(PULONG BootDevice)
{
MachVtbl.DiskGetBootDevice(BootDevice);
}
BOOL
MachDiskBootingFromFloppy()
{
return MachVtbl.DiskBootingFromFloppy();
}
BOOL
MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{

View File

@@ -38,6 +38,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
*/
#ifdef __i386__
#include "i386.h"
#elif defined(_M_PPC)
#include "powerpc.h"
#endif
#define L_clz
#define L_udivdi3

File diff suppressed because it is too large Load Diff

View File

@@ -33,10 +33,9 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
{
PFILE FilePointer;
UCHAR SettingName[80];
UCHAR SettingValue[80];
ULONG SectionId;
ULONG SectionId;
UCHAR FileName[260];
ULONG BytesRead;
ULONG BytesRead;
// Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName);
@@ -49,27 +48,13 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
return;
}
if (!IniReadSettingByName(SectionId, "BootDrive", SettingValue, 80))
{
UiMessageBox("Boot drive not specified for selected OS!");
return;
}
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
BootPartition = 0;
if (IniReadSettingByName(SectionId, "BootPartition", SettingValue, 80))
{
BootPartition = atoi(SettingValue);
}
if (!IniReadSettingByName(SectionId, "BootSectorFile", FileName, 260))
{
UiMessageBox("Boot sector file not specified for selected OS!");
return;
}
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenSystemVolume(FileName, FileName, NULL))
{
UiMessageBox("Failed to open boot drive.");
return;
@@ -111,10 +96,12 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
{
UCHAR SettingName[80];
UCHAR SettingValue[80];
ULONG SectionId;
UCHAR SettingName[80];
UCHAR SettingValue[80];
ULONG SectionId;
PARTITION_TABLE_ENTRY PartitionTableEntry;
ULONG DriveNumber;
ULONG PartitionNumber;
// Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName);
@@ -134,7 +121,7 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
return;
}
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
DriveNumber = DriveMapGetBiosDriveNumber(SettingValue);
// Read the boot partition
if (!IniReadSettingByName(SectionId, "BootPartition", SettingValue, 80))
@@ -143,17 +130,17 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
return;
}
BootPartition = atoi(SettingValue);
PartitionNumber = atoi(SettingValue);
// Get the partition table entry
if (!DiskGetPartitionEntry(BootDrive, BootPartition, &PartitionTableEntry))
if (!DiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry))
{
return;
}
// Now try to read the partition boot sector
// If this fails then abort
if (!MachDiskReadLogicalSectors(BootDrive, PartitionTableEntry.SectorCountBeforePartition, 1, (PVOID)0x7C00))
if (!MachDiskReadLogicalSectors(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, 1, (PVOID)0x7C00))
{
return;
}
@@ -182,7 +169,8 @@ VOID LoadAndBootDrive(PUCHAR OperatingSystemName)
{
UCHAR SettingName[80];
UCHAR SettingValue[80];
ULONG SectionId;
ULONG SectionId;
ULONG DriveNumber;
// Find all the message box settings and run them
UiShowMessageBoxesInSection(OperatingSystemName);
@@ -201,11 +189,11 @@ VOID LoadAndBootDrive(PUCHAR OperatingSystemName)
return;
}
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
DriveNumber = DriveMapGetBiosDriveNumber(SettingValue);
// Now try to read the boot sector (or mbr)
// If this fails then abort
if (!MachDiskReadLogicalSectors(BootDrive, 0, 1, (PVOID)0x7C00))
if (!MachDiskReadLogicalSectors(DriveNumber, 0, 1, (PVOID)0x7C00))
{
return;
}

View File

@@ -22,11 +22,11 @@
#define __MEM_H
#ifdef __i386__
#if defined(__i386__) || defined(_PPC_)
#define MM_PAGE_SIZE 4096
#endif // defined __i386__
#endif // defined __i386__ or _PPC_
typedef struct
{

View File

@@ -43,7 +43,21 @@ BOOL DissectArcPath(char *ArcPath, char *BootPath, ULONG* BootDrive, ULONG* Boot
if (p == NULL)
return FALSE;
p++;
*BootPartition = 0;
*BootPartition = 0xff;
}
else if (strnicmp(p, "cdrom(", 6) == 0)
{
/*
* cdrom path:
* multi(0)disk(0)cdrom(x)\path
*/
p = p + 6;
*BootDrive = atoi(p);
p = strchr(p, ')');
if (p == NULL)
return FALSE;
p++;
*BootPartition = 0xff;
}
else if (strnicmp(p, "rdisk(", 6) == 0)
{

View File

@@ -15,16 +15,6 @@
#define NDEBUG
#include <debug.h>
#define IsRecognizedPartition(P) \
((P) == PARTITION_FAT_12 || \
(P) == PARTITION_FAT_16 || \
(P) == PARTITION_HUGE || \
(P) == PARTITION_IFS || \
(P) == PARTITION_EXT2 || \
(P) == PARTITION_FAT32 || \
(P) == PARTITION_FAT32_XINT13 || \
(P) == PARTITION_XINT13)
BOOL
STDCALL
FrLdrLoadKernel(PCHAR szFileName,
@@ -564,6 +554,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
PFILE FilePointer;
CHAR name[1024];
CHAR value[1024];
CHAR SystemPath[1024];
CHAR szKernelName[1024];
CHAR szHalName[1024];
CHAR szFileName[1024];
@@ -574,9 +565,6 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
ULONG_PTR Base;
ULONG Size;
PARTITION_TABLE_ENTRY PartitionTableEntry;
ULONG rosPartition;
extern ULONG PageDirectoryStart;
extern ULONG PageDirectoryEnd;
@@ -645,7 +633,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
/*
* Make sure the system path is set in the .ini file
*/
if (!IniReadSettingByName(SectionId, "SystemPath", value, 1024))
if (!IniReadSettingByName(SectionId, "SystemPath", SystemPath, sizeof(SystemPath)))
{
UiMessageBox("System path not specified for selected operating system.");
return;
@@ -654,62 +642,20 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
/*
* Special case for Live CD.
*/
if (!stricmp(value, "LiveCD"))
if (!stricmp(SystemPath, "LiveCD"))
{
strcpy(szBootPath, "\\reactos");
/* Set kernel command line */
sprintf(multiboot_kernel_cmdline,
"multi(0)disk(0)cdrom(%u)\\reactos /MININT",
(unsigned int)BootDrive);
/* Normalize */
MachDiskGetBootPath(SystemPath, sizeof(SystemPath));
strcat(SystemPath, "\\reactos");
strcat(strcpy(multiboot_kernel_cmdline, SystemPath),
" /MININT");
}
else
{
/*
* Verify system path
*/
if (!DissectArcPath(value, szBootPath, &BootDrive, &BootPartition))
{
sprintf(MsgBuffer,"Invalid system path: '%s'", value);
UiMessageBox(MsgBuffer);
return;
}
/* recalculate the boot partition for freeldr */
i = 0;
rosPartition = 0;
while (1)
{
if (!MachDiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry))
{
BootPartition = 0;
break;
}
if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
{
if (++rosPartition == BootPartition)
{
BootPartition = i;
break;
}
}
}
if (BootPartition == 0)
{
sprintf(MsgBuffer,"Invalid system path: '%s'", value);
UiMessageBox(MsgBuffer);
return;
}
/* copy ARC path into kernel command line */
strcpy(multiboot_kernel_cmdline, value);
/* copy system path into kernel command line */
strcpy(multiboot_kernel_cmdline, SystemPath);
}
/* Set boot drive and partition */
((LPSTR )(&LoaderBlock.BootDevice))[0] = (CHAR)BootDrive;
((LPSTR )(&LoaderBlock.BootDevice))[1] = (CHAR)BootPartition;
/*
* Read the optional kernel parameters (if any)
*/
@@ -719,13 +665,6 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
strcat(multiboot_kernel_cmdline, value);
}
/* append a backslash */
if ((strlen(szBootPath)==0) ||
szBootPath[strlen(szBootPath)] != '\\')
strcat(szBootPath, "\\");
DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
UiDrawBackdrop();
UiDrawStatusText("Detecting Hardware...");
@@ -741,14 +680,21 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
UiDrawProgressBarCenter(0, 100, "Loading ReactOS...");
/*
* Try to open boot drive
* Try to open system drive
*/
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice))
{
UiMessageBox("Failed to open boot drive.");
return;
}
/* append a backslash */
if ((strlen(szBootPath)==0) ||
szBootPath[strlen(szBootPath)] != '\\')
strcat(szBootPath, "\\");
DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
/*
* Find the kernel image name
* and try to load the kernel off the disk

View File

@@ -312,13 +312,11 @@ VOID RunLoader(VOID)
UiDrawStatusText("");
#endif
/* set boot drive and partition */
((char *)(&LoaderBlock.BootDevice))[0] = (char)BootDrive;
((char *)(&LoaderBlock.BootDevice))[1] = (char)BootPartition;
/* set boot device */
MachDiskGetBootDevice(&LoaderBlock.BootDevice);
/* Open boot drive */
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenBootVolume())
{
#ifdef USE_UI
UiMessageBox("Failed to open boot drive.");
@@ -330,7 +328,7 @@ VOID RunLoader(VOID)
/* Open 'txtsetup.sif' */
if (!InfOpenFile (&InfHandle,
(BootDrive < 0x80) ? "\\txtsetup.sif" : "\\reactos\\txtsetup.sif",
MachDiskBootingFromFloppy() ? "\\txtsetup.sif" : "\\reactos\\txtsetup.sif",
&ErrorLine))
{
printf("Failed to open 'txtsetup.sif'\n");
@@ -358,7 +356,7 @@ VOID RunLoader(VOID)
printf("LoadOptions: '%s'\n", LoadOptions);
#endif
if (BootDrive < 0x80)
if (MachDiskBootingFromFloppy())
{
/* Boot from floppy disk */
SourcePath = "\\";
@@ -370,12 +368,9 @@ VOID RunLoader(VOID)
}
/* Set kernel command line */
sprintf(multiboot_kernel_cmdline,
"multi(0)disk(0)%s(%u)%s %s",
(BootDrive < 0x80) ? "fdisk" : "cdrom",
(unsigned int)BootDrive,
SourcePath,
LoadOptions);
MachDiskGetBootPath(multiboot_kernel_cmdline, sizeof(multiboot_kernel_cmdline));
strcat(strcat(strcat(multiboot_kernel_cmdline, SourcePath), " "),
LoadOptions);
/* Load ntoskrnl.exe */
if (!LoadKernel(SourcePath, "ntoskrnl.exe"))
@@ -400,7 +395,7 @@ for(;;);
#endif
/* Insert boot disk 2 */
if (BootDrive < 0x80)
if (MachDiskBootingFromFloppy())
{
#ifdef USE_UI
UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press ENTER");
@@ -410,7 +405,7 @@ for(;;);
#endif
/* Open boot drive */
if (!FsOpenVolume(BootDrive, BootPartition))
if (!FsOpenBootVolume())
{
#ifdef USE_UI
UiMessageBox("Failed to open boot drive.");

View File

@@ -20,6 +20,7 @@
#include <freeldr.h>
#include <machine.h>
#include <rtl.h>
#include <stdarg.h>
/*
* print() - prints unformatted text to stdout
@@ -38,12 +39,11 @@ void print(char *str)
*/
void printf(char *format, ... )
{
int *dataptr = (int *)(void *)&format;
va_list ap;
va_start(ap,format);
char c, *ptr, str[16];
int ll;
dataptr++;
while ((c = *(format++)))
{
if (c != '%')
@@ -66,11 +66,11 @@ void printf(char *format, ... )
case 'd': case 'u': case 'x':
if (ll)
{
*convert_i64_to_ascii(str, c, *((unsigned long long *) dataptr++)) = 0;
*convert_i64_to_ascii(str, c, va_arg(ap, unsigned long long)) = 0;
}
else
{
*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
*convert_to_ascii(str, c, va_arg(ap, unsigned long)) = 0;
}
ptr = str;
@@ -81,10 +81,10 @@ void printf(char *format, ... )
}
break;
case 'c': MachConsPutChar((*(dataptr++))&0xff); break;
case 'c': MachConsPutChar((va_arg(ap,int))&0xff); break;
case 's':
ptr = (char *)(*(dataptr++));
ptr = va_arg(ap,char *);
while ((c = *(ptr++)))
{
@@ -100,16 +100,18 @@ void printf(char *format, ... )
}
}
}
va_end(ap);
}
void sprintf(char *buffer, char *format, ... )
{
int *dataptr = (int *)(void *)&format;
va_list ap;
char c, *ptr, str[16];
char *p = buffer;
int ll;
dataptr++;
va_start(ap,format);
while ((c = *(format++)))
{
@@ -134,11 +136,11 @@ void sprintf(char *buffer, char *format, ... )
case 'd': case 'u': case 'x':
if (ll)
{
*convert_i64_to_ascii(str, c, *((unsigned long long*) dataptr++)) = 0;
*convert_i64_to_ascii(str, c, va_arg(ap, unsigned long long)) = 0;
}
else
{
*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
*convert_to_ascii(str, c, va_arg(ap, unsigned long)) = 0;
}
ptr = str;
@@ -151,12 +153,12 @@ void sprintf(char *buffer, char *format, ... )
break;
case 'c':
*p = (*(dataptr++))&0xff;
*p = va_arg(ap,int)&0xff;
p++;
break;
case 's':
ptr = (char *)(*(dataptr++));
ptr = va_arg(ap,char *);
while ((c = *(ptr++)))
{
@@ -174,5 +176,6 @@ void sprintf(char *buffer, char *format, ... )
}
}
}
va_end(ap);
*p=0;
}

View File

@@ -17,16 +17,15 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* convert_to_ascii() - converts a number to it's ascii equivalent
* from:
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
*/
char *convert_to_ascii(char *buf, int c, ...)
char *convert_to_ascii(char *buf, int c, int num)
{
unsigned long num = *((&c) + 1), mult = 10;
unsigned long mult = 10;
char *ptr = buf;
if (c == 'x')
@@ -63,9 +62,8 @@ char *convert_to_ascii(char *buf, int c, ...)
return ptr;
}
char *convert_i64_to_ascii(char *buf, int c, ...)
char *convert_i64_to_ascii(char *buf, int c, unsigned long long num)
{
unsigned long long num = *(long long*)((&c) + 1);
int mult = 10;
char *ptr = buf;

View File

@@ -13,9 +13,9 @@ HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",,0x00000010
HKLM,"SOFTWARE\Microsoft\Rpc",,0x00000012
; Version Information
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"4.0"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 6"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"1381"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"5.0"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 3"
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"2195"
; Image File Execution Options (NtGlobalFlag with FLG_SHOW_LDR_SNAPS set for loadlib.exe)

View File

@@ -64,10 +64,14 @@ HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00010409","Layout File",0
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00010409","Layout Text",0x00000000,"US-Dvorak"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000040c","Layout File",0x00000000,"kbdfr.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000040c","Layout Text",0x00000000,"FR"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout File",0x00000000,"kbdru.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout Text",0x00000000,"Russian"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout File",0x00000000,"kbdse.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout Text",0x00000000,"SE"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout File",0x00000000,"kbduk.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout Text",0x00000000,"UK"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000807","Layout File",0x00000000,"kbdsg.dll"
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000807","Layout Text",0x00000000,"SG"
; Network
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}",,0x00000000,"Network Adapters"
@@ -168,6 +172,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040f",0x00000000,"l_intl.n
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0410",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041d",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0809",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0807",0x00000000,"l_intl.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",0x00000000,"0409"
@@ -288,9 +293,9 @@ HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Linkage","Export",0x00010000,"\De
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Linkage","Route",0x00010000,"3c90x1"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","SlotNumber",0x00000000,"10"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","BusNumber",0x00000000,"0"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0"
; Afd driver
HKLM,"SYSTEM\CurrentControlSet\Services\Afd","ErrorControl",0x00010001,0x00000001
@@ -441,6 +446,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ImagePath",0x00020000,"%Syste
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Start",0x00010001,0x00000002
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Type",0x00010001,0x00000010
; DHCP client service
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Group",0x00000000,"Network"
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ImagePath",0x00020000,"%SystemRoot%\system32\dhcp.exe"
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Start",0x00010001,0x00000002
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Type",0x00010001,0x00000010
; Floppy driver
HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","Group",0x00000000,"Primary Disk"
@@ -469,6 +481,19 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","ImagePath",0x00020000,"system
HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Start",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Type",0x00010001,0x00000001
; Serial port enumerator
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","Group",0x00000000,"PNP Filter"
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","ImagePath",0x00020000,"system32\drivers\serenum.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","Type",0x00010001,0x00000001
;hard coded values
HKLM,"SYSTEM\CurrentControlSet\Services\serenum\Enum","0",0x00000000,"ACPI\PNP0501"
HKLM,"SYSTEM\CurrentControlSet\Services\serenum\Enum","Count",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\serenum\Enum","NextInstance",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\1","UpperFilters",0x00010000,"serenum"
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\2","UpperFilters",0x00010000,"serenum"
; SB16 driver
HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","Group",0x00000000,"Base"
HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","ServiceType",0x00010001,0x00000001
@@ -554,9 +579,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE103
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Port",0x00000000,"280"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Irq",0x00000000,"9"
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","NetworkAddress",0x00000000,"001122334455"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0"
; one day this will happen automatically; until then we need this since ndis5 drivers
; rely on the fact that their resources are handed to them by ndis, so we have to find
@@ -645,9 +670,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE103
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0000","BusNumber",0x00000000,"0"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}",,0x00000000,"Network Adapters"
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}\Connection","Name",0x00000000,"AMD PCNet (static Registry entry)"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0"
; Named Pipe filesystem driver
HKLM,"SYSTEM\CurrentControlSet\Services\Npfs","ErrorControl",0x00010001,0x00000000
@@ -674,13 +699,14 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Null","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Group",0x00000000,"Base"
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","ImagePath",0x00020000,"system32\drivers\serial.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Start",0x00010001,0x00000004
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Start",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Type",0x00010001,0x00000001
;hard coded values
HKLM,"SYSTEM\CurrentControlSet\Services\Serial\Enum","0",0x00000000,"ACPI\PNP0501"
HKLM,"SYSTEM\CurrentControlSet\Services\Serial\Enum","Count",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Serial\Enum","NextInstance",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\0000","Service",0x00000000,"serial"
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\1","Service",0x00000000,"serial"
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\2","Service",0x00000000,"serial"
; Packet driver
HKLM,"SYSTEM\CurrentControlSet\Services\Packet","ErrorControl",0x00010001,0x00000001
@@ -780,6 +806,15 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","ImagePath",0x00020000,"system32
HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Start",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Type",0x00010001,0x00000002
; Xbox Nvidia driver
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Group",0x00000000,"Video"
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ImagePath",0x00020000,"system32\drivers\xboxvmp.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Start",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp\Device0","InstalledDisplayDrivers",0x00010000,"framebuf"
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10DE&DEV_02A0&SUBSYS_00000000&REV_A1\0000","Service",0x00000000,"XboxVmp"
; VBE SVGA driver
HKLM,"SYSTEM\CurrentControlSet\Services\VBE","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\VBE","Group",0x00000000,"Video Save SVGA"
@@ -839,100 +874,4 @@ HKLM,"SYSTEM\Setup","OsLoaderPath",0x00000000,"\"
HKLM,"SYSTEM\Setup","SetupType",0x00010001,0x00000001
HKLM,"SYSTEM\Setup","SystemPartition",0x00000000,"\Device\Harddisk0\Partition1"
HKLM,"SYSTEM\Setup","SystemSetupInProgress",0x00010001,0x00000000
; ----------------------------- KJS Init ----------------------------
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","kjsinit",0x00010000,\
"function init(v) { var rk = '\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Kdb'; eval(System.regread(rk,v)); } for( i = 1; i <= 45; i++ ) { init((new Number(i)).toString()); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","1",0x00010000,\
"function write(x) { System.print(x); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","2",0x00010000,\
"function regs(n) { return System.regs(n); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","3",0x00010000,\
"function debugebp() { return regs(0); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","4",0x00010000,\
"function debugeip() { return regs(1); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","5",0x00010000,\
"function tf_argmark() { return regs(2); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","6",0x00010000,\
"function tf_pointer() { return regs(3); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","7",0x00010000,\
"function tf_tempcs() { return regs(4); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","8",0x00010000,\
"function tf_tempeip() { return regs(5); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","9",0x00010000,\
"function dr0() { return regs(6); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","10",0x00010000,\
"function dr1() { return regs(7); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","11",0x00010000,\
"function dr2() { return regs(8); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","12",0x00010000,\
"function dr3() { return regs(9); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","13",0x00010000,\
"function dr6() { return regs(10); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","14",0x00010000,\
"function dr7() { return regs(11); } "
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","15",0x00010000,\
"function gs() { return regs(12) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","16",0x00010000,\
"function es() { return regs(13) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","17",0x00010000,\
"function ds() { return regs(14) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","18",0x00010000,\
"function edx() { return regs(15); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","19",0x00010000,\
"function ecx() { return regs(16); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","20",0x00010000,\
"function eax() { return regs(17); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","21",0x00010000,\
"function tf_pmode() { return regs(18); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","22",0x00010000,\
"function tf_exl() { return regs(19); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","23",0x00010000,\
"function fs() { return regs(20) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","24",0x00010000,\
"function edi() { return regs(21); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","25",0x00010000,\
"function esi() { return regs(22); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","26",0x00010000,\
"function ebx() { return regs(23); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","27",0x00010000,\
"function ebp() { return regs(24); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","28",0x00010000,\
"function error_code() { return regs(25); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","29",0x00010000,\
"function eip() { return regs(26); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","30",0x00010000,\
"function cs() { return regs(27) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","31",0x00010000,\
"function eflags() { return regs(28); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","32",0x00010000,\
"function esp() { return regs(29); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","33",0x00010000,\
"function ss() { return regs(30) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","34",0x00010000,\
"function v86_es() { return regs(31) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","35",0x00010000,\
"function v86_ds() { return regs(32) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","36",0x00010000,\
"function v86_fs() { return regs(33) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","37",0x00010000,\
"function v86_gs() { return regs(34) & 0xffff; }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","38",0x00010000,\
"function peekl(a) { return System.mread(4,a); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","39",0x00010000,\
"function pokel(a,b) { return System.mwrite(4,a,b); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","40",0x00010000,\
"function peekw(a) { return System.mread(2,a); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","41",0x00010000,\
"function pokew(a,b) { return System.mwrite(2,a,b); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","42",0x00010000,\
"function peek(a) { return System.mread(1,a); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","43",0x00010000,\
"function poke(a,b) { return System.mwrite(1,a,b); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","44",0x00010000,\
"function regread(x,y) { return System.regread(x,y); }"
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","45",0x00010000,\
"write('JS Registry Init Complete. Welcome to ReactOS kernel scripting');"
; EOF

View File

@@ -29,6 +29,7 @@ Signature = "$ReactOS$"
drivers\bus\acpi\acpi.sys 2
drivers\bus\isapnp\isapnp.sys 2
drivers\bus\pci\pci.sys 2
drivers\bus\serenum\serenum.sys 2
drivers\dd\beep\beep.sys 2
drivers\dd\bootvid\bootvid.sys 2
drivers\dd\null\null.sys 2
@@ -87,7 +88,9 @@ lib\kbddv\kbddv.dll 1
lib\kbdes\kbdes.dll 1
lib\kbdfr\kbdfr.dll 1
lib\kbdgr\kbdgr.dll 1
lib\kbdru\kbdru.dll 1
lib\kbdse\kbdse.dll 1
lib\kbdsg\kbdsg.dll 1
lib\kbduk\kbduk.dll 1
lib\kbdus\kbdus.dll 1
lib\kernel32\kernel32.dll 1
@@ -114,6 +117,7 @@ lib\richedit\riched32.dll 1
lib\rpcrt4\rpcrt4.dll 1
lib\samlib\samlib.dll 1
lib\secur32\secur32.dll 1
lib\serialui\serialui.dll 1
lib\setupapi\setupapi.dll 1
lib\shdocvw\shdocvw.dll 1
lib\shell32\shell32.dll 1
@@ -163,6 +167,7 @@ subsys\system\userinit\userinit.exe 1
subsys\system\vmwinst\vmwinst.exe 1
subsys\system\winlogon\winlogon.exe 1
subsys\system\winefile\winefile.exe 1
subsys\system\dhcp\dhcp.exe 1
services\eventlog\eventlog.exe 1
services\rpcss\rpcss.exe 1
services\umpnpmgr\umpnpmgr.exe 1

View File

@@ -35,7 +35,7 @@ Cabinet=reactos.cab
[SetupData]
DefaultPath = \ReactOS
OsLoadOptions = "/NOGUIBOOT /NODEBUG"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /BAUDRATE=19200 /IRQ=4"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=SCREEN"
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
@@ -77,18 +77,22 @@ Default = "XT-, AT- or extended keyboard (83-105 keys)"
00010409 = "English (USA-Dvorak)"
0000040C = "French (France)"
00000407 = "German (Germany)"
00000419 = "Russian"
0000040A = "Spanish (traditional short)"
0000041D = "Swedish (Sweden)"
00000807 = "German (Swiss)"
[Files.KeyboardLayout]
00000406 = kbdda.dll
00000407 = kbdgr.dll
00000409 = kbdus.dll
00010409 = kbddv.dll
0000040C = kbdfr.dll
0000041D = kbdse.dll
00000809 = kgbgb.dll
0000040A = kbdes.dll
0000040C = kbdfr.dll
00000419 = kbdru.dll
0000041D = kbdse.dll
00000809 = kbduk.dll
00000807 = kbdsg.dll
[Mouse]
;<id> = <user friendly name>,<spare>,<service key name>

View File

@@ -6,7 +6,7 @@ PATH_TO_TOP = ../..
include $(PATH_TO_TOP)/rules.mak
DRIVERS = acpi isapnp pci
DRIVERS = acpi isapnp pci serenum
all: $(DRIVERS)

View File

@@ -4,6 +4,7 @@
* FILE: acpi/ospm/fdo.c
* PURPOSE: ACPI device object dispatch routines
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Herv<72> Poussineau (hpoussin@reactos.com)
* UPDATE HISTORY:
* 08-08-2001 CSH Created
*/
@@ -115,6 +116,149 @@ AcpiCreateInstanceIDString(PUNICODE_STRING InstanceID,
}
static BOOLEAN
AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
PULONG ResourceListSize,
RESOURCE* resources)
{
BOOLEAN Done;
ULONG NumberOfResources = 0;
PCM_RESOURCE_LIST ResourceList;
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
RESOURCE* resource;
ULONG i;
KIRQL Dirql;
/* Count number of resources */
Done = FALSE;
resource = resources;
while (!Done)
{
switch (resource->id)
{
case irq:
{
IRQ_RESOURCE *irq_data = (IRQ_RESOURCE*) &resource->data;
NumberOfResources += irq_data->number_of_interrupts;
break;
}
case dma:
{
DMA_RESOURCE *dma_data = (DMA_RESOURCE*) &resource->data;
NumberOfResources += dma_data->number_of_channels;
break;
}
case io:
{
NumberOfResources++;
break;
}
case end_tag:
{
Done = TRUE;
break;
}
}
resource = (RESOURCE *) ((NATIVE_UINT) resource + (NATIVE_UINT) resource->length);
}
/* Allocate memory */
*ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePool(PagedPool, *ResourceListSize);
*pResourceList = ResourceList;
if (!ResourceList)
return FALSE;
ResourceList->Count = 1;
ResourceList->List[0].InterfaceType = Internal; /* FIXME */
ResourceList->List[0].BusNumber = 0; /* We're the only ACPI bus device in the system */
ResourceList->List[0].PartialResourceList.Version = 1;
ResourceList->List[0].PartialResourceList.Revision = 1;
ResourceList->List[0].PartialResourceList.Count = NumberOfResources;
ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
/* Fill resources list structure */
Done = FALSE;
resource = resources;
while (!Done)
{
switch (resource->id)
{
case irq:
{
IRQ_RESOURCE *irq_data = (IRQ_RESOURCE*) &resource->data;
for (i = 0; i < irq_data->number_of_interrupts; i++)
{
ResourceDescriptor->Type = CmResourceTypeInterrupt;
ResourceDescriptor->ShareDisposition =
(irq_data->shared_exclusive == SHARED ? CmResourceShareShared : CmResourceShareDeviceExclusive);
ResourceDescriptor->Flags =
(irq_data->edge_level == LEVEL_SENSITIVE ? CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE : CM_RESOURCE_INTERRUPT_LATCHED);
ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector(
Internal, 0, 0, irq_data->interrupts[i],
&Dirql,
&ResourceDescriptor->u.Interrupt.Affinity);
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
ResourceDescriptor++;
}
break;
}
case dma:
{
DMA_RESOURCE *dma_data = (DMA_RESOURCE*) &resource->data;
for (i = 0; i < dma_data->number_of_channels; i++)
{
ResourceDescriptor->Type = CmResourceTypeDma;
ResourceDescriptor->Flags = 0;
switch (dma_data->type)
{
case TYPE_A: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
case TYPE_B: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
case TYPE_F: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
}
if (dma_data->bus_master == BUS_MASTER)
ResourceDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
switch (dma_data->transfer)
{
case TRANSFER_8: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
case TRANSFER_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
case TRANSFER_8_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
}
ResourceDescriptor->u.Dma.Channel = dma_data->channels[i];
ResourceDescriptor++;
}
break;
}
case io:
{
IO_RESOURCE *io_data = (IO_RESOURCE*) &resource->data;
ResourceDescriptor->Type = CmResourceTypePort;
ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
if (io_data->io_decode == DECODE_16)
ResourceDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE;
else
ResourceDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
ResourceDescriptor->u.Port.Start.u.LowPart = io_data->min_base_address;
ResourceDescriptor->u.Port.Length = io_data->range_length;
ResourceDescriptor++;
break;
}
case end_tag:
{
Done = TRUE;
break;
}
}
resource = (RESOURCE *) ((NATIVE_UINT) resource + (NATIVE_UINT) resource->length);
}
acpi_rs_dump_resource_list(resource);
return TRUE;
}
static NTSTATUS
FdoQueryBusRelations(
IN PDEVICE_OBJECT DeviceObject,
@@ -149,6 +293,7 @@ FdoQueryBusRelations(
CurrentEntry = DeviceExtension->DeviceListHead.Flink;
while (CurrentEntry != &DeviceExtension->DeviceListHead)
{
ACPI_BUFFER Buffer;
Device = CONTAINING_RECORD(CurrentEntry, ACPI_DEVICE, DeviceListEntry);
/* FIXME: For ACPI namespace devices on the motherboard create filter DOs
@@ -200,6 +345,34 @@ FdoQueryBusRelations(
AcpiStatus = bm_get_node(Device->BmHandle, 0, &Node);
if (ACPI_SUCCESS(AcpiStatus))
{
/* Get current resources */
Buffer.length = 0;
Status = acpi_get_current_resources(Node->device.acpi_handle, &Buffer);
if ((Status & ACPI_OK) == 0)
{
ASSERT(FALSE);
}
if (Buffer.length > 0)
{
Buffer.pointer = ExAllocatePool(PagedPool, Buffer.length);
if (!Buffer.pointer)
{
ASSERT(FALSE);
}
Status = acpi_get_current_resources(Node->device.acpi_handle, &Buffer);
if (ACPI_FAILURE(Status))
{
ASSERT(FALSE);
}
if (!AcpiCreateResourceList(&PdoDeviceExtension->ResourceList,
&PdoDeviceExtension->ResourceListSize,
(RESOURCE*)Buffer.pointer))
{
ASSERT(FALSE);
}
ExFreePool(Buffer.pointer);
}
/* Add Device ID string */
if (!AcpiCreateDeviceIDString(&PdoDeviceExtension->DeviceID,
Node))

View File

@@ -47,6 +47,9 @@ typedef struct _PDO_DEVICE_EXTENSION
UNICODE_STRING InstanceID;
// Hardware IDs
UNICODE_STRING HardwareIDs;
// Resource list
PCM_RESOURCE_LIST ResourceList;
ULONG ResourceListSize;
} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;

View File

@@ -107,6 +107,35 @@ PdoQueryId(
}
static NTSTATUS
PdoQueryResources(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
PIO_STACK_LOCATION IrpSp)
{
PPDO_DEVICE_EXTENSION DeviceExtension;
PCM_RESOURCE_LIST ResourceList;
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
if (DeviceExtension->ResourceListSize == 0)
{
return Irp->IoStatus.Status;
}
ResourceList = ExAllocatePool(PagedPool, DeviceExtension->ResourceListSize);
if (!ResourceList)
{
Irp->IoStatus.Information = 0;
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlCopyMemory(ResourceList, DeviceExtension->ResourceList, DeviceExtension->ResourceListSize);
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
return STATUS_SUCCESS;
}
static NTSTATUS
PdoSetPower(
IN PDEVICE_OBJECT DeviceObject,
@@ -201,6 +230,9 @@ PdoPnpControl(
break;
case IRP_MN_QUERY_RESOURCES:
Status = PdoQueryResources(DeviceObject,
Irp,
IrpSp);
break;
case IRP_MN_QUERY_STOP_DEVICE:
@@ -213,6 +245,7 @@ PdoPnpControl(
break;
case IRP_MN_START_DEVICE:
Status = STATUS_SUCCESS;
break;
case IRP_MN_STOP_DEVICE:

View File

@@ -0,0 +1,541 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Serial enumerator driver
* FILE: drivers/bus/serenum/detect.c
* PURPOSE: Detection of serial devices
*
* PROGRAMMERS: Jason Filby (jasonfilby@yahoo.com)
* Filip Navara (xnavara@volny.cz)
* Herv<72> Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "serenum.h"
static NTSTATUS
SerenumDeviceIoControl(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG CtlCode,
IN PVOID InputBuffer OPTIONAL,
IN ULONG InputBufferSize,
IN OUT PVOID OutputBuffer OPTIONAL,
IN OUT PULONG OutputBufferSize)
{
KEVENT Event;
PIRP Irp;
IO_STATUS_BLOCK IoStatus;
NTSTATUS Status;
KeInitializeEvent (&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(CtlCode,
DeviceObject,
InputBuffer,
InputBufferSize,
OutputBuffer,
(OutputBufferSize) ? *OutputBufferSize : 0,
FALSE,
&Event,
&IoStatus);
if (Irp == NULL)
{
DPRINT("Serenum: IoBuildDeviceIoControlRequest() failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
DPRINT("Serenum: Operation pending\n");
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
Status = IoStatus.Status;
}
if (OutputBufferSize)
{
*OutputBufferSize = IoStatus.Information;
}
return Status;
}
static NTSTATUS
ReadBytes(
IN PDEVICE_OBJECT LowerDevice,
OUT PUCHAR Buffer,
IN ULONG BufferSize,
OUT PULONG FilledBytes)
{
PIRP Irp;
IO_STATUS_BLOCK ioStatus;
KEVENT event;
NTSTATUS Status;
KeInitializeEvent(&event, NotificationEvent, FALSE);
Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_READ,
LowerDevice,
Buffer, BufferSize,
0,
&event,
&ioStatus);
if (!Irp)
return FALSE;
Status = IoCallDriver(LowerDevice, Irp);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL);
Status = ioStatus.Status;
}
DPRINT("Serenum: bytes received: %lu/%lu\n",
ioStatus.Information, BufferSize);
*FilledBytes = ioStatus.Information;
return Status;
}
static NTSTATUS
ReportDetectedDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PUNICODE_STRING DeviceDescription,
IN PUNICODE_STRING DeviceId,
IN PUNICODE_STRING HardwareIds,
IN PUNICODE_STRING CompatibleIds)
{
PDEVICE_OBJECT Pdo = NULL;
PPDO_DEVICE_EXTENSION PdoDeviceExtension = NULL;
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
NTSTATUS Status;
DPRINT("Serenum: SerenumReportDetectedDevice() called with %wZ (%wZ) detected\n", DeviceId, DeviceDescription);
Status = IoCreateDevice(
DeviceObject->DriverObject,
sizeof(PDO_DEVICE_EXTENSION),
NULL,
FILE_DEVICE_CONTROLLER,
FILE_AUTOGENERATED_DEVICE_NAME,
FALSE,
&Pdo);
if (!NT_SUCCESS(Status)) goto ByeBye;
Pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;
Pdo->Flags |= DO_POWER_PAGABLE;
PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
PdoDeviceExtension->Common.IsFDO = FALSE;
Status = SerenumDuplicateUnicodeString(&PdoDeviceExtension->DeviceDescription, DeviceDescription, PagedPool);
if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDuplicateUnicodeString(&PdoDeviceExtension->DeviceId, DeviceId, PagedPool);
if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDuplicateUnicodeString(&PdoDeviceExtension->HardwareIds, HardwareIds, PagedPool);
if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDuplicateUnicodeString(&PdoDeviceExtension->CompatibleIds, CompatibleIds, PagedPool);
if (!NT_SUCCESS(Status)) goto ByeBye;
/* Device attached to serial port (Pdo) may delegate work to
* serial port stack (Fdo = DeviceObject variable) */
Pdo->StackSize = DeviceObject->StackSize + 1;
FdoDeviceExtension->AttachedPdo = Pdo;
PdoDeviceExtension->AttachedFdo = DeviceObject;
Pdo->Flags |= DO_BUFFERED_IO;
Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
return STATUS_SUCCESS;
ByeBye:
if (Pdo)
{
if (PdoDeviceExtension->DeviceDescription.Buffer)
RtlFreeUnicodeString(&PdoDeviceExtension->DeviceDescription);
if (PdoDeviceExtension->DeviceId.Buffer)
RtlFreeUnicodeString(&PdoDeviceExtension->DeviceId);
if (PdoDeviceExtension->HardwareIds.Buffer)
RtlFreeUnicodeString(&PdoDeviceExtension->HardwareIds);
if (PdoDeviceExtension->CompatibleIds.Buffer)
RtlFreeUnicodeString(&PdoDeviceExtension->CompatibleIds);
IoDeleteDevice(Pdo);
}
return Status;
}
static BOOLEAN
SerenumIsValidPnpIdString(
IN PUCHAR Buffer,
IN ULONG BufferLength)
{
/* FIXME: SerenumIsValidPnpIdString not implemented */
DPRINT1("Serenum: SerenumIsValidPnpIdString() unimplemented\n");
return STATUS_SUCCESS;
}
static NTSTATUS
ReportDetectedPnpDevice(
IN PUCHAR Buffer,
IN ULONG BufferLength)
{
ULONG i;
/* FIXME: ReportDetectedPnpDevice not implemented */
DPRINT1("Serenum: ReportDetectedPnpDevice() unimplemented\n");
DPRINT1("");
for (i = 0; i < BufferLength; i++)
DbgPrint("%c", Buffer[i]);
DbgPrint("\n");
/* Call ReportDetectedDevice */
return STATUS_SUCCESS;
}
#define BEGIN_ID '('
#define END_ID ')'
static NTSTATUS
SerenumWait(ULONG milliseconds)
{
KTIMER Timer;
LARGE_INTEGER DueTime;
DueTime.QuadPart = milliseconds * -10;
KeInitializeTimer(&Timer);
KeSetTimer(&Timer, DueTime, NULL);
return KeWaitForSingleObject(&Timer, Executive, KernelMode, FALSE, NULL);
}
NTSTATUS
SerenumDetectPnpDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PDEVICE_OBJECT LowerDevice)
{
UCHAR Buffer[256];
ULONG BaudRate;
ULONG TotalBytesReceived = 0;
ULONG Size;
ULONG Msr, Purge;
ULONG i;
BOOLEAN BufferContainsBeginId = FALSE;
BOOLEAN BufferContainsEndId = FALSE;
SERIAL_LINE_CONTROL Lcr;
SERIAL_TIMEOUTS Timeouts;
SERIALPERF_STATS PerfStats;
NTSTATUS Status;
/* 1. COM port initialization, check for device enumerate */
CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
SerenumWait(200);
Size = sizeof(Msr);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
NULL, 0, &Msr, &Size);
if (!NT_SUCCESS(Status)) return Status;
if ((Msr & SR_MSR_DSR) == 0) goto SerenumDisconnectIdle;
/* 2. COM port setup, 1st phase */
CHECKPOINT;
BaudRate = SERIAL_BAUD_1200;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&BaudRate, sizeof(BaudRate), NULL, 0);
if (!NT_SUCCESS(Status)) return Status;
Lcr.WordLength = 7;
Lcr.Parity = NO_PARITY;
Lcr.StopBits = STOP_BIT_1;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&Lcr, sizeof(Lcr), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
SerenumWait(200);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
SerenumWait(200);
/* 3. Wait for response, 1st phase */
CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Timeouts.ReadIntervalTimeout = 0;
Timeouts.ReadTotalTimeoutMultiplier = 0;
Timeouts.ReadTotalTimeoutConstant = 200;
Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
&Timeouts, sizeof(Timeouts), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer), &Size);
if (!NT_SUCCESS(Status)) return Status;
if (Size != 0) goto SerenumCollectPnpComDeviceId;
/* 4. COM port setup, 2nd phase */
CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Purge = SERIAL_PURGE_RXABORT | SERIAL_PURGE_RXCLEAR;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_PURGE,
&Purge, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
SerenumWait(200);
/* 5. Wait for response, 2nd phase */
CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = ReadBytes(LowerDevice, Buffer, 1, &TotalBytesReceived);
if (!NT_SUCCESS(Status)) return Status;
if (TotalBytesReceived != 0) goto SerenumCollectPnpComDeviceId;
Size = sizeof(Msr);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
NULL, 0, &Msr, &Size);
if (!NT_SUCCESS(Status)) return Status;
if ((Msr & SR_MSR_DSR) == 0) goto SerenumVerifyDisconnect; else goto SerenumConnectIdle;
/* 6. Collect PnP COM device ID */
SerenumCollectPnpComDeviceId:
CHECKPOINT;
Timeouts.ReadIntervalTimeout = 200;
Timeouts.ReadTotalTimeoutMultiplier = 0;
Timeouts.ReadTotalTimeoutConstant = 2200;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
&Timeouts, sizeof(Timeouts), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = ReadBytes(LowerDevice, &Buffer[TotalBytesReceived], sizeof(Buffer) - TotalBytesReceived, &Size);
if (!NT_SUCCESS(Status)) return Status;
TotalBytesReceived += Size;
Size = sizeof(PerfStats);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_STATS,
NULL, 0, &PerfStats, &Size);
if (!NT_SUCCESS(Status)) return Status;
if (PerfStats.FrameErrorCount + PerfStats.ParityErrorCount != 0) goto SerenumConnectIdle;
for (i = 0; i < TotalBytesReceived; i++)
{
if (Buffer[i] == BEGIN_ID) BufferContainsBeginId = TRUE;
if (Buffer[i] == END_ID) BufferContainsEndId = TRUE;
}
if (TotalBytesReceived == 1 || BufferContainsEndId)
{
if (SerenumIsValidPnpIdString(Buffer, TotalBytesReceived))
return ReportDetectedPnpDevice(Buffer, TotalBytesReceived);
goto SerenumConnectIdle;
}
if (!BufferContainsBeginId) goto SerenumConnectIdle;
if (!BufferContainsEndId) goto SerenumConnectIdle;
Size = sizeof(Msr);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
NULL, 0, &Msr, &Size);
if (!NT_SUCCESS(Status)) return Status;
if ((Msr & SR_MSR_DSR) == 0) goto SerenumVerifyDisconnect;
/* 7. Verify disconnect */
SerenumVerifyDisconnect:
CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
SerenumWait(5000);
goto SerenumDisconnectIdle;
/* 8. Connect idle */
SerenumConnectIdle:
CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
BaudRate = SERIAL_BAUD_300;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&BaudRate, sizeof(BaudRate), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Lcr.WordLength = 7;
Lcr.Parity = NO_PARITY;
Lcr.StopBits = STOP_BIT_1;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&Lcr, sizeof(Lcr), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
if (TotalBytesReceived == 0)
return STATUS_DEVICE_NOT_CONNECTED;
else
return STATUS_SUCCESS;
/* 9. Disconnect idle */
SerenumDisconnectIdle:
CHECKPOINT;
/* FIXME: report to OS device removal, if it was present */
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
BaudRate = SERIAL_BAUD_300;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&BaudRate, sizeof(BaudRate), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Lcr.WordLength = 7;
Lcr.Parity = NO_PARITY;
Lcr.StopBits = STOP_BIT_1;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&Lcr, sizeof(Lcr), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
return STATUS_DEVICE_NOT_CONNECTED;
}
NTSTATUS
SerenumDetectLegacyDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PDEVICE_OBJECT LowerDevice)
{
ULONG Fcr, Mcr;
ULONG BaudRate;
ULONG Command;
SERIAL_TIMEOUTS Timeouts;
SERIAL_LINE_CONTROL LCR;
ULONG i, Count;
UCHAR Buffer[16];
UNICODE_STRING DeviceDescription;
UNICODE_STRING DeviceId;
UNICODE_STRING HardwareIds;
UNICODE_STRING CompatibleIds;
NTSTATUS Status;
RtlZeroMemory(Buffer, sizeof(Buffer));
/* Reset UART */
CHECKPOINT;
Mcr = 0; /* MCR: DTR/RTS/OUT2 off */
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
&Mcr, sizeof(Mcr), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
/* Set communications parameters */
CHECKPOINT;
/* DLAB off */
Fcr = 0;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
&Fcr, sizeof(Fcr), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
/* Set serial port speed */
BaudRate = SERIAL_BAUD_1200;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&BaudRate, sizeof(BaudRate), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
/* Set LCR */
LCR.WordLength = 7;
LCR.Parity = NO_PARITY;
LCR.StopBits = STOP_BITS_2;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&LCR, sizeof(LCR), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
/* Flush receive buffer */
CHECKPOINT;
Command = SERIAL_PURGE_RXCLEAR;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
&Command, sizeof(Command), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
/* Wait 100 ms */
SerenumWait(100);
/* Enable DTR/RTS */
CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
/* Set timeout to 500 microseconds */
CHECKPOINT;
Timeouts.ReadIntervalTimeout = 100;
Timeouts.ReadTotalTimeoutMultiplier = 0;
Timeouts.ReadTotalTimeoutConstant = 500;
Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
&Timeouts, sizeof(Timeouts), NULL, NULL);
if (!NT_SUCCESS(Status)) return Status;
/* Fill the read buffer */
CHECKPOINT;
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), &Count);
if (!NT_SUCCESS(Status)) return Status;
for (i = 0; i < Count; i++)
{
if (Buffer[i] == 'B')
{
/* Sign for Microsoft Ballpoint */
/* Hardware id: *PNP0F09
* Compatible id: *PNP0F0F, SERIAL_MOUSE
*/
RtlInitUnicodeString(&DeviceDescription, L"Microsoft Ballpoint device");
RtlInitUnicodeString(&DeviceId, L"*PNP0F09");
SerenumInitMultiSzString(&HardwareIds, "*PNP0F09", NULL);
SerenumInitMultiSzString(&CompatibleIds, "*PNP0F0F", "SERIAL_MOUSE", NULL);
Status = ReportDetectedDevice(DeviceObject,
&DeviceDescription, &DeviceId, &HardwareIds, &CompatibleIds);
RtlFreeUnicodeString(&HardwareIds);
RtlFreeUnicodeString(&CompatibleIds);
return Status;
}
else if (Buffer[i] == 'M')
{
/* Sign for Microsoft Mouse protocol followed by button specifier */
if (i == sizeof(Buffer) - 1)
{
/* Overflow Error */
return STATUS_DEVICE_NOT_CONNECTED;
}
switch (Buffer[i + 1])
{
case '3':
/* Hardware id: *PNP0F08
* Compatible id: SERIAL_MOUSE
*/
RtlInitUnicodeString(&DeviceDescription, L"Microsoft Mouse with 3-buttons");
RtlInitUnicodeString(&DeviceId, L"*PNP0F08");
SerenumInitMultiSzString(&HardwareIds, "*PNP0F08", NULL);
SerenumInitMultiSzString(&CompatibleIds, "SERIAL_MOUSE", NULL);
default:
/* Hardware id: *PNP0F01
* Compatible id: SERIAL_MOUSE
*/
RtlInitUnicodeString(&DeviceDescription, L"Microsoft Mouse with 2-buttons or Microsoft Wheel Mouse");
RtlInitUnicodeString(&DeviceId, L"*PNP0F01");
SerenumInitMultiSzString(&HardwareIds, "*PNP0F01", NULL);
SerenumInitMultiSzString(&CompatibleIds, "SERIAL_MOUSE", NULL);
}
Status = ReportDetectedDevice(DeviceObject,
&DeviceDescription, &DeviceId, &HardwareIds, &CompatibleIds);
RtlFreeUnicodeString(&HardwareIds);
RtlFreeUnicodeString(&CompatibleIds);
return Status;
}
}
return STATUS_DEVICE_NOT_CONNECTED;
}

View File

@@ -0,0 +1,213 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Serial enumerator driver
* FILE: drivers/bus/serenum/fdo.c
* PURPOSE: IRP_MJ_PNP operations for FDOs
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "serenum.h"
NTSTATUS STDCALL
SerenumAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT Pdo)
{
PDEVICE_OBJECT Fdo;
PFDO_DEVICE_EXTENSION DeviceExtension;
//UNICODE_STRING SymbolicLinkName;
NTSTATUS Status;
DPRINT("Serenum: SerenumAddDevice called. Pdo = %p\n", Pdo);
/* Create new device object */
Status = IoCreateDevice(DriverObject,
sizeof(FDO_DEVICE_EXTENSION),
NULL,
FILE_DEVICE_BUS_EXTENDER,
FILE_DEVICE_SECURE_OPEN,
FALSE,
&Fdo);
if (!NT_SUCCESS(Status))
{
DPRINT("Serenum: IoCreateDevice() failed with status 0x%08lx\n", Status);
return Status;
}
/* Register device interface */
#if 0 /* FIXME: activate */
Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, NULL, &SymbolicLinkName);
if (!NT_SUCCESS(Status))
{
DPRINT("Serenum: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
goto ByeBye;
}
DPRINT1("Serenum: IoRegisterDeviceInterface() returned '%wZ'\n", &SymbolicLinkName);
Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
if (!NT_SUCCESS(Status))
{
DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
goto ByeBye;
}
RtlFreeUnicodeString(&SymbolicLinkName);
#endif
DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
DeviceExtension->Common.IsFDO = TRUE;
DeviceExtension->Common.PnpState = dsStopped;
DeviceExtension->Pdo = Pdo;
IoInitializeRemoveLock(&DeviceExtension->RemoveLock, SERENUM_TAG, 0, 0);
Fdo->Flags |= DO_POWER_PAGABLE;
Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
if (!NT_SUCCESS(Status))
{
DPRINT("Serenum: IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status);
IoDeleteDevice(Fdo);
return Status;
}
Fdo->Flags |= DO_BUFFERED_IO;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
SerenumFdoStartDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PCOMMON_DEVICE_EXTENSION DeviceExtension;
DPRINT("Serenum: SerenumFdoStartDevice() called\n");
DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(DeviceExtension->PnpState == dsStopped);
DeviceExtension->PnpState = dsStarted;
return STATUS_SUCCESS;
}
NTSTATUS
SerenumFdoQueryBusRelations(
IN PDEVICE_OBJECT DeviceObject,
OUT PDEVICE_RELATIONS* pDeviceRelations)
{
PFDO_DEVICE_EXTENSION DeviceExtension;
PDEVICE_RELATIONS DeviceRelations;
ULONG NumPDO;
ULONG i;
NTSTATUS Status = STATUS_SUCCESS;
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(DeviceExtension->Common.IsFDO);
/* Do enumeration if needed */
if (!(DeviceExtension->Flags & FLAG_ENUMERATION_DONE))
{
ASSERT(DeviceExtension->AttachedPdo == NULL);
/* Detect plug-and-play devices */
Status = SerenumDetectPnpDevice(DeviceObject, DeviceExtension->LowerDevice);
if (Status == STATUS_DEVICE_NOT_CONNECTED)
{
/* Detect legacy devices */
Status = SerenumDetectLegacyDevice(DeviceObject, DeviceExtension->LowerDevice);
if (Status == STATUS_DEVICE_NOT_CONNECTED)
Status = STATUS_SUCCESS;
}
DeviceExtension->Flags |= FLAG_ENUMERATION_DONE;
}
NumPDO = (DeviceExtension->AttachedPdo != NULL ? 1 : 0);
DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(
PagedPool,
sizeof(DEVICE_RELATIONS) + sizeof(PDEVICE_OBJECT) * (NumPDO - 1),
SERENUM_TAG);
if (!DeviceRelations)
return STATUS_INSUFFICIENT_RESOURCES;
/* Fill returned structure */
DeviceRelations->Count = NumPDO;
for (i = 0; i < NumPDO; i++)
{
ObReferenceObject(DeviceExtension->AttachedPdo);
DeviceRelations->Objects[i] = DeviceExtension->AttachedPdo;
}
*pDeviceRelations = DeviceRelations;
return Status;
}
NTSTATUS
SerenumFdoPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
ULONG MinorFunction;
PIO_STACK_LOCATION Stack;
ULONG_PTR Information = 0;
NTSTATUS Status;
Stack = IoGetCurrentIrpStackLocation(Irp);
MinorFunction = Stack->MinorFunction;
switch (MinorFunction)
{
/* FIXME: do all these minor functions
IRP_MN_QUERY_REMOVE_DEVICE 0x1
IRP_MN_REMOVE_DEVICE 0x2
IRP_MN_CANCEL_REMOVE_DEVICE 0x3
IRP_MN_STOP_DEVICE 0x4
IRP_MN_QUERY_STOP_DEVICE 0x5
IRP_MN_CANCEL_STOP_DEVICE 0x6
IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations (optional) 0x7
IRP_MN_QUERY_INTERFACE (optional) 0x8
IRP_MN_QUERY_CAPABILITIES (optional) 0x9
IRP_MN_FILTER_RESOURCE_REQUIREMENTS (optional or required) 0xb
IRP_MN_QUERY_PNP_DEVICE_STATE (optional) 0x14
IRP_MN_DEVICE_USAGE_NOTIFICATION (required or optional) 0x16
IRP_MN_SURPRISE_REMOVAL 0x17
*/
case IRP_MN_START_DEVICE: /* 0x0 */
{
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
/* Call lower driver */
Status = ForwardIrpAndWait(DeviceObject, Irp);
if (NT_SUCCESS(Status))
Status = SerenumFdoStartDevice(DeviceObject, Irp);
break;
}
case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x7 */
{
switch (Stack->Parameters.QueryDeviceRelations.Type)
{
case BusRelations:
{
PDEVICE_RELATIONS DeviceRelations;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
Status = SerenumFdoQueryBusRelations(DeviceObject, &DeviceRelations);
Information = (ULONG_PTR)DeviceRelations;
break;
}
default:
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
Stack->Parameters.QueryDeviceRelations.Type);
return ForwardIrpAndForget(DeviceObject, Irp);
}
break;
}
default:
{
DPRINT1("Serenum: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction);
return ForwardIrpAndForget(DeviceObject, Irp);
}
}
Irp->IoStatus.Information = Information;
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}

View File

@@ -0,0 +1,20 @@
# $Id: makefile 12852 2005-01-06 13:58:04Z mf $
PATH_TO_TOP = ../../..
TARGET_TYPE = driver
TARGET_NAME = serenum
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
TARGET_OBJECTS = \
detect.o \
fdo.o \
misc.o \
pdo.o \
serenum.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk

View File

@@ -0,0 +1,210 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Serial enumerator driver
* FILE: drivers/dd/serenum/misc.c
* PURPOSE: Misceallenous operations
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "serenum.h"
#include <stdarg.h>
NTSTATUS
SerenumDuplicateUnicodeString(
OUT PUNICODE_STRING Destination,
IN PUNICODE_STRING Source,
IN POOL_TYPE PoolType)
{
ASSERT(Destination);
if (Source == NULL)
{
RtlInitUnicodeString(Destination, NULL);
return STATUS_SUCCESS;
}
Destination->Buffer = ExAllocatePool(PoolType, Source->MaximumLength);
if (Destination->Buffer == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
Destination->MaximumLength = Source->MaximumLength;
Destination->Length = Source->Length;
RtlCopyMemory(Destination->Buffer, Source->Buffer, Source->MaximumLength);
return STATUS_SUCCESS;
}
/* I really want ANSI strings as last arguments because
* PnP ids are ANSI-encoded in PnP device string
* identification */
NTSTATUS
SerenumInitMultiSzString(
OUT PUNICODE_STRING Destination,
... /* list of PCSZ */)
{
va_list args;
PCSZ Source;
ANSI_STRING AnsiString;
UNICODE_STRING UnicodeString;
ULONG DestinationSize = 0;
NTSTATUS Status = STATUS_SUCCESS;
ASSERT(Destination);
/* Calculate length needed for destination unicode string */
va_start(args, Destination);
Source = va_arg(args, PCSZ);
while (Source != NULL)
{
RtlInitAnsiString(&AnsiString, Source);
DestinationSize += RtlAnsiStringToUnicodeSize(&AnsiString)
+ sizeof(WCHAR) /* final NULL */;
Source = va_arg(args, PCSZ);
}
va_end(args);
if (DestinationSize == 0)
{
RtlInitUnicodeString(Destination, NULL);
return STATUS_SUCCESS;
}
/* Initialize destination string */
DestinationSize += sizeof(WCHAR); // final NULL
Destination->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, DestinationSize, SERENUM_TAG);
if (!Destination->Buffer)
return STATUS_INSUFFICIENT_RESOURCES;
Destination->Length = 0;
Destination->MaximumLength = (USHORT)DestinationSize;
/* Copy arguments to destination string */
/* Use a temporary unicode string, which buffer is shared with
* destination string, to copy arguments */
UnicodeString.Length = Destination->Length;
UnicodeString.MaximumLength = Destination->MaximumLength;
UnicodeString.Buffer = Destination->Buffer;
va_start(args, Destination);
Source = va_arg(args, PCSZ);
while (Source != NULL)
{
RtlInitAnsiString(&AnsiString, Source);
Status = RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE);
if (!NT_SUCCESS(Status))
{
ExFreePoolWithTag(Destination->Buffer, SERENUM_TAG);
break;
}
Destination->Length += UnicodeString.Length + sizeof(WCHAR);
UnicodeString.MaximumLength -= UnicodeString.Length + sizeof(WCHAR);
UnicodeString.Buffer += UnicodeString.Length / sizeof(WCHAR) + 1;
UnicodeString.Length = 0;
Source = va_arg(args, PCSZ);
}
va_end(args);
if (NT_SUCCESS(Status))
{
/* Finish multi-sz string */
Destination->Buffer[Destination->Length / sizeof(WCHAR)] = L'\0';
Destination->Length += sizeof(WCHAR);
}
return Status;
}
NTSTATUS STDCALL
ForwardIrpAndWaitCompletion(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context)
{
if (Irp->PendingReturned)
KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE);
return STATUS_MORE_PROCESSING_REQUIRED;
}
NTSTATUS
ForwardIrpAndWait(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PDEVICE_OBJECT LowerDevice;
KEVENT Event;
NTSTATUS Status;
ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
ASSERT(LowerDevice);
KeInitializeEvent(&Event, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(Irp);
DPRINT("Serenum: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
Status = IoCallDriver(LowerDevice, Irp);
if (Status == STATUS_PENDING)
{
Status = KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
if (NT_SUCCESS(Status))
Status = Irp->IoStatus.Status;
}
return Status;
}
NTSTATUS STDCALL
ForwardIrpToLowerDeviceAndForget(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PFDO_DEVICE_EXTENSION DeviceExtension;
PDEVICE_OBJECT LowerDevice;
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(DeviceExtension->Common.IsFDO);
LowerDevice = DeviceExtension->LowerDevice;
ASSERT(LowerDevice);
DPRINT("Serenum: calling lower device 0x%p [%wZ]\n",
LowerDevice, &LowerDevice->DriverObject->DriverName);
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(LowerDevice, Irp);
}
NTSTATUS STDCALL
ForwardIrpToAttachedFdoAndForget(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PPDO_DEVICE_EXTENSION DeviceExtension;
PDEVICE_OBJECT Fdo;
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(!DeviceExtension->Common.IsFDO);
Fdo = DeviceExtension->AttachedFdo;
ASSERT(Fdo);
DPRINT("Serenum: calling attached Fdo 0x%p [%wZ]\n",
Fdo, &Fdo->DriverObject->DriverName);
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(Fdo, Irp);
}
NTSTATUS STDCALL
ForwardIrpAndForget(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PDEVICE_OBJECT LowerDevice;
ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
ASSERT(LowerDevice);
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(LowerDevice, Irp);
}

View File

@@ -0,0 +1,314 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Serial enumerator driver
* FILE: drivers/bus/serenum/pdo.c
* PURPOSE: IRP_MJ_PNP operations for PDOs
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "serenum.h"
static NTSTATUS
SerenumPdoStartDevice(
IN PDEVICE_OBJECT DeviceObject)
{
PPDO_DEVICE_EXTENSION DeviceExtension;
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(DeviceExtension->Common.PnpState == dsStopped);
DeviceExtension->Common.PnpState = dsStarted;
return STATUS_SUCCESS;
}
static NTSTATUS
SerenumPdoQueryId(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
OUT ULONG_PTR* Information)
{
PPDO_DEVICE_EXTENSION DeviceExtension;
ULONG IdType;
PUNICODE_STRING SourceString;
UNICODE_STRING String;
NTSTATUS Status;
IdType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryId.IdType;
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
RtlInitUnicodeString(&String, NULL);
switch (IdType)
{
case BusQueryDeviceID:
{
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
SourceString = &DeviceExtension->DeviceId;
break;
}
case BusQueryHardwareIDs:
{
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
SourceString = &DeviceExtension->HardwareIds;
break;
}
case BusQueryCompatibleIDs:
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
SourceString = &DeviceExtension->CompatibleIds;
break;
case BusQueryInstanceID:
{
/* We don't have any instance id to report, and
* this query is optional, so ignore it.
*/
*Information = Irp->IoStatus.Information;
return Irp->IoStatus.Status;
}
default:
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType);
return STATUS_NOT_SUPPORTED;
}
Status = SerenumDuplicateUnicodeString(
&String,
SourceString,
PagedPool);
*Information = (ULONG_PTR)String.Buffer;
return Status;
}
static NTSTATUS
SerenumPdoQueryDeviceRelations(
IN PDEVICE_OBJECT DeviceObject,
OUT PDEVICE_RELATIONS* pDeviceRelations)
{
PFDO_DEVICE_EXTENSION DeviceExtension;
PDEVICE_RELATIONS DeviceRelations;
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(DeviceExtension->Common.IsFDO);
DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(
PagedPool,
sizeof(DEVICE_RELATIONS),
SERENUM_TAG);
if (!DeviceRelations)
return STATUS_INSUFFICIENT_RESOURCES;
ObReferenceObject(DeviceObject);
DeviceRelations->Count = 1;
DeviceRelations->Objects[0] = DeviceObject;
*pDeviceRelations = DeviceRelations;
return STATUS_SUCCESS;
}
NTSTATUS
SerenumPdoPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
ULONG MinorFunction;
PIO_STACK_LOCATION Stack;
ULONG_PTR Information = 0;
NTSTATUS Status;
Stack = IoGetCurrentIrpStackLocation(Irp);
MinorFunction = Stack->MinorFunction;
switch (MinorFunction)
{
/* FIXME: do all these minor functions
IRP_MN_QUERY_REMOVE_DEVICE 0x1
IRP_MN_REMOVE_DEVICE 0x2
IRP_MN_CANCEL_REMOVE_DEVICE 0x3
IRP_MN_STOP_DEVICE 0x4
IRP_MN_QUERY_STOP_DEVICE 0x5
IRP_MN_CANCEL_STOP_DEVICE 0x6
IRP_MN_QUERY_DEVICE_RELATIONS / EjectionRelations (optional) 0x7
IRP_MN_QUERY_INTERFACE (required or optional) 0x8
IRP_MN_READ_CONFIG (required or optional) 0xf
IRP_MN_WRITE_CONFIG (required or optional) 0x10
IRP_MN_EJECT (required or optional) 0x11
IRP_MN_SET_LOCK (required or optional) 0x12
IRP_MN_QUERY_ID / BusQueryDeviceID 0x13
IRP_MN_QUERY_ID / BusQueryCompatibleIDs (optional) 0x13
IRP_MN_QUERY_ID / BusQueryInstanceID (optional) 0x13
IRP_MN_QUERY_PNP_DEVICE_STATE (optional) 0x14
IRP_MN_DEVICE_USAGE_NOTIFICATION (required or optional) 0x16
IRP_MN_SURPRISE_REMOVAL 0x17
*/
case IRP_MN_START_DEVICE: /* 0x0 */
{
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
Status = SerenumPdoStartDevice(DeviceObject);
break;
}
case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x7 */
{
switch (Stack->Parameters.QueryDeviceRelations.Type)
{
case RemovalRelations:
{
return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
}
case TargetDeviceRelation:
{
PDEVICE_RELATIONS DeviceRelations;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n");
Status = SerenumPdoQueryDeviceRelations(DeviceObject, &DeviceRelations);
Information = (ULONG_PTR)DeviceRelations;
break;
}
default:
{
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
Stack->Parameters.QueryDeviceRelations.Type);
Status = STATUS_NOT_IMPLEMENTED;
break;
}
}
break;
}
case IRP_MN_QUERY_CAPABILITIES: /* 0x9 */
{
PDEVICE_CAPABILITIES DeviceCapabilities;
ULONG i;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities;
/* FIXME: capabilities can change with connected device */
DeviceCapabilities->LockSupported = FALSE;
DeviceCapabilities->EjectSupported = FALSE;
DeviceCapabilities->Removable = TRUE;
DeviceCapabilities->DockDevice = FALSE;
DeviceCapabilities->UniqueID = FALSE;
DeviceCapabilities->SilentInstall = FALSE;
DeviceCapabilities->RawDeviceOK = TRUE;
DeviceCapabilities->SurpriseRemovalOK = TRUE;
DeviceCapabilities->HardwareDisabled = FALSE; /* FIXME */
//DeviceCapabilities->NoDisplayInUI = FALSE; /* FIXME */
DeviceCapabilities->DeviceState[0] = PowerDeviceD0; /* FIXME */
for (i = 0; i < PowerSystemMaximum; i++)
DeviceCapabilities->DeviceState[i] = PowerDeviceD3; /* FIXME */
//DeviceCapabilities->DeviceWake = PowerDeviceUndefined; /* FIXME */
DeviceCapabilities->D1Latency = 0; /* FIXME */
DeviceCapabilities->D2Latency = 0; /* FIXME */
DeviceCapabilities->D3Latency = 0; /* FIXME */
Status = STATUS_SUCCESS;
break;
}
case IRP_MN_QUERY_RESOURCES: /* 0xa */
{
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
/* Serial devices don't need resources, except the ones of
* the serial port. This PDO is the serial device PDO, so
* report no resource by not changing Information and
* Status
*/
Information = Irp->IoStatus.Information;
Status = Irp->IoStatus.Status;
break;
}
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: /* 0xb */
{
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
/* Serial devices don't need resources, except the ones of
* the serial port. This PDO is the serial device PDO, so
* report no resource by not changing Information and
* Status
*/
Information = Irp->IoStatus.Information;
Status = Irp->IoStatus.Status;
break;
}
case IRP_MN_QUERY_DEVICE_TEXT: /* 0xc */
{
switch (Stack->Parameters.QueryDeviceText.DeviceTextType)
{
case DeviceTextDescription:
{
PUNICODE_STRING Source;
PWSTR Description;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
Source = &((PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->DeviceDescription;
Description = ExAllocatePool(PagedPool, Source->Length + sizeof(WCHAR));
if (!Description)
Status = STATUS_INSUFFICIENT_RESOURCES;
else
{
RtlCopyMemory(Description, Source->Buffer, Source->Length);
Description[Source->Length / sizeof(WCHAR)] = L'\0';
Information = (ULONG_PTR)Description;
Status = STATUS_SUCCESS;
}
break;
}
case DeviceTextLocationInformation:
{
/* We don't have any text location to report,
* and this query is optional, so ignore it.
*/
Information = Irp->IoStatus.Information;
Status = Irp->IoStatus.Status;
break;
}
default:
{
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown type 0x%lx\n",
Stack->Parameters.QueryDeviceText.DeviceTextType);
Status = STATUS_NOT_SUPPORTED;
}
}
break;
}
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* 0xd */
{
return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
}
case IRP_MN_QUERY_ID: /* 0x13 */
{
Status = SerenumPdoQueryId(DeviceObject, Irp, &Information);
break;
}
case IRP_MN_QUERY_BUS_INFORMATION: /* 0x15 */
{
PPNP_BUS_INFORMATION BusInfo;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_BUS_INFORMATION\n");
BusInfo = (PPNP_BUS_INFORMATION)ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION));
if (!BusInfo)
Status = STATUS_INSUFFICIENT_RESOURCES;
else
{
BusInfo->BusTypeGuid = GUID_BUS_TYPE_SERENUM;
/* FIXME: real value should be PNPBus, but PNPBus seems to be
* the only value in INTERFACE_TYPE enum that doesn't work...
*/
BusInfo->LegacyBusType = PNPISABus;
/* We're the only serial bus enumerator on the computer */
BusInfo->BusNumber = 0;
Information = (ULONG_PTR)BusInfo;
Status = STATUS_SUCCESS;
}
break;
}
default:
{
/* We can't forward request to the lower driver, because
* we are a Pdo, so we don't have lower driver... */
DPRINT1("Serenum: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction);
Information = Irp->IoStatus.Information;
Status = Irp->IoStatus.Status;
}
}
Irp->IoStatus.Information = Information;
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}

View File

@@ -0,0 +1,112 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Serial enumerator driver
* FILE: drivers/bus/serenum/serenum.c
* PURPOSE: Serial enumeration driver entry point
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
//#define NDEBUG
#define INITGUID
#include "serenum.h"
NTSTATUS STDCALL
SerenumPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
return SerenumFdoPnp(DeviceObject, Irp);
else
return SerenumPdoPnp(DeviceObject, Irp);
}
VOID STDCALL
DriverUnload(IN PDRIVER_OBJECT DriverObject)
{
// nothing to do here yet
}
NTSTATUS STDCALL
IrpStub(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
NTSTATUS Status = STATUS_NOT_SUPPORTED;
if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
{
/* Forward some IRPs to lower device */
switch (IoGetCurrentIrpStackLocation(Irp)->MajorFunction)
{
case IRP_MJ_CREATE:
case IRP_MJ_CLOSE:
case IRP_MJ_CLEANUP:
case IRP_MJ_READ:
case IRP_MJ_WRITE:
case IRP_MJ_DEVICE_CONTROL:
return ForwardIrpToLowerDeviceAndForget(DeviceObject, Irp);
default:
{
DPRINT1("Serenum: FDO stub for major function 0x%lx\n",
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
#ifndef NDEBUG
DbgBreakPoint();
#endif
Status = Irp->IoStatus.Status;
}
}
}
else
{
/* Forward some IRPs to attached FDO */
switch (IoGetCurrentIrpStackLocation(Irp)->MajorFunction)
{
case IRP_MJ_CREATE:
case IRP_MJ_CLOSE:
case IRP_MJ_CLEANUP:
case IRP_MJ_READ:
case IRP_MJ_WRITE:
case IRP_MJ_DEVICE_CONTROL:
return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
default:
{
DPRINT1("Serenum: PDO stub for major function 0x%lx\n",
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
#ifndef NDEBUG
DbgBreakPoint();
#endif
Status = Irp->IoStatus.Status;
}
}
}
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
/*
* Standard DriverEntry method.
*/
NTSTATUS STDCALL
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegPath)
{
ULONG i;
DriverObject->DriverUnload = DriverUnload;
DriverObject->DriverExtension->AddDevice = SerenumAddDevice;
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
DriverObject->MajorFunction[i] = IrpStub;
//DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SerialQueryInformation;
DriverObject->MajorFunction[IRP_MJ_PNP] = SerenumPnp;
//DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower;
return STATUS_SUCCESS;
}

View File

@@ -0,0 +1,152 @@
#if defined(__GNUC__)
#include <ddk/ntddk.h>
#include <ddk/ntddser.h>
#include <ddk/wdmguid.h>
#include <stdio.h>
#include <debug.h>
#define SR_MSR_DSR 0x20
#define ExFreePoolWithTag(p, tag) ExFreePool(p)
/* FIXME: these prototypes MUST NOT be here! */
NTSTATUS STDCALL
IoAttachDeviceToDeviceStackSafe(
IN PDEVICE_OBJECT SourceDevice,
IN PDEVICE_OBJECT TargetDevice,
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
#elif defined(_MSC_VER)
#include <ntddk.h>
#include <ntddser.h>
#include <c:/progra~1/winddk/inc/ddk/wdm/wxp/wdmguid.h>
#include <stdio.h>
#define STDCALL
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
#define CHECKPOINT1 DbgPrint("(%s:%d)\n")
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
NTSTATUS STDCALL
IoAttachDeviceToDeviceStackSafe(
IN PDEVICE_OBJECT SourceDevice,
IN PDEVICE_OBJECT TargetDevice,
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
#define DPRINT DPRINT1
#define CHECKPOINT CHECKPOINT1
#define SR_MSR_DSR 0x20
#else
#error Unknown compiler!
#endif
typedef enum
{
dsStopped,
dsStarted,
dsPaused,
dsRemoved,
dsSurpriseRemoved
} SERENUM_DEVICE_STATE;
typedef struct _COMMON_DEVICE_EXTENSION
{
BOOLEAN IsFDO;
SERENUM_DEVICE_STATE PnpState;
} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
typedef struct _FDO_DEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT LowerDevice;
PDEVICE_OBJECT Pdo;
IO_REMOVE_LOCK RemoveLock;
PDEVICE_OBJECT AttachedPdo;
ULONG Flags;
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
typedef struct _PDO_DEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT AttachedFdo;
UNICODE_STRING DeviceDescription; // REG_SZ
UNICODE_STRING DeviceId; // REG_SZ
UNICODE_STRING HardwareIds; // REG_MULTI_SZ
UNICODE_STRING CompatibleIds; // REG_MULTI_SZ
} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
#define SERENUM_TAG TAG('S', 'e', 'r', 'e')
/* Flags */
#define FLAG_ENUMERATION_DONE 0x01
/************************************ detect.c */
NTSTATUS
SerenumDetectPnpDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PDEVICE_OBJECT LowerDevice);
NTSTATUS
SerenumDetectLegacyDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PDEVICE_OBJECT LowerDevice);
/************************************ fdo.c */
NTSTATUS STDCALL
SerenumAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT Pdo);
NTSTATUS
SerenumFdoPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/************************************ misc.c */
NTSTATUS
SerenumDuplicateUnicodeString(
OUT PUNICODE_STRING Destination,
IN PUNICODE_STRING Source,
IN POOL_TYPE PoolType);
NTSTATUS
SerenumInitMultiSzString(
OUT PUNICODE_STRING Destination,
... /* list of ANSI_STRINGs */);
NTSTATUS
ForwardIrpAndWait(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS STDCALL
ForwardIrpToLowerDeviceAndForget(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS STDCALL
ForwardIrpToAttachedFdoAndForget(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS STDCALL
ForwardIrpAndForget(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/************************************ pdo.c */
NTSTATUS
SerenumPdoPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);

View File

@@ -0,0 +1,7 @@
/* $Id$ */
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "Serial port enumerator\0"
#define REACTOS_STR_INTERNAL_NAME "serenum\0"
#define REACTOS_STR_ORIGINAL_FILENAME "serenum.sys\0"
#include <reactos/version.rc>

View File

@@ -0,0 +1,38 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/createclose.c
* PURPOSE: IRP_MJ_CREATE, IRP_MJ_CLOSE and IRP_MJ_CLEANUP operations
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
//#define NDEBUG
#include "green.h"
NTSTATUS STDCALL
GreenCreate(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
DPRINT("Green: IRP_MJ_CREATE\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
GreenClose(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
DPRINT("Green: IRP_MJ_CLOSE\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}

View File

@@ -0,0 +1,65 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/dispatch.c
* PURPOSE: Dispatch routines
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "green.h"
NTSTATUS STDCALL
GreenDispatch(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
ULONG MajorFunction;
GREEN_DEVICE_TYPE DeviceType;
ULONG_PTR Information;
NTSTATUS Status;
MajorFunction = IoGetCurrentIrpStackLocation(Irp)->MajorFunction;
DeviceType = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type;
Information = Irp->IoStatus.Information;
Status = Irp->IoStatus.Status;
DPRINT("Green: Dispatching major function 0x%lx, DeviceType %d\n",
MajorFunction, DeviceType);
if (MajorFunction == IRP_MJ_CREATE && DeviceType == Green)
return GreenCreate(DeviceObject, Irp);
else if (MajorFunction == IRP_MJ_CLOSE && DeviceType == Green)
return GreenClose(DeviceObject, Irp);
else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == Green)
{
return KeyboardInternalDeviceControl(
((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Keyboard,
Irp);
}
else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == Keyboard)
return KeyboardInternalDeviceControl(DeviceObject, Irp);
else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == Green)
{
return ScreenDeviceControl(
((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Screen,
Irp);
}
else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == Screen)
return ScreenDeviceControl(DeviceObject, Irp);
else if (MajorFunction == IRP_MJ_WRITE && DeviceType == Screen)
return ScreenWrite(DeviceObject, Irp);
else
{
DPRINT1("Green: unknown combination: MajorFunction 0x%lx, DeviceType %d\n",
MajorFunction, DeviceType);
}
Irp->IoStatus.Information = Information;
Irp->IoStatus.Status = Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return Status;
}

View File

@@ -0,0 +1,44 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/green.c
* PURPOSE: Driver entry point
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
//#define NDEBUG
#include "green.h"
VOID STDCALL
DriverUnload(IN PDRIVER_OBJECT DriverObject)
{
// nothing to do here yet
}
/*
* Standard DriverEntry method.
*/
NTSTATUS STDCALL
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegPath)
{
ULONG i;
DriverObject->DriverUnload = DriverUnload;
DriverObject->DriverExtension->AddDevice = GreenAddDevice;
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
DriverObject->MajorFunction[i] = GreenDispatch;
/* keyboard only */
//DriverObject->DriverStartIo = GreenStartIo;
/* keyboard and screen */
DriverObject->MajorFunction[IRP_MJ_CREATE] = GreenCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = GreenClose;
return STATUS_SUCCESS;
}

View File

@@ -0,0 +1,179 @@
#if defined(__GNUC__)
#include <ddk/ntddk.h>
#include <ddk/ntddser.h>
#include <ntos/halfuncs.h>
#include <ddk/ntddblue.h>
#include <ddk/ntddkbd.h> /* should be in kbdmou.h */
#include <debug.h>
/* FIXME: should be in kbdmou.h */
typedef struct _CONNECT_DATA {
PDEVICE_OBJECT ClassDeviceObject;
PVOID ClassService;
} CONNECT_DATA, *PCONNECT_DATA;
/* FIXME: should be in kbdmou.h */
#define IOCTL_INTERNAL_KEYBOARD_CONNECT \
CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS)
NTSTATUS STDCALL
ObReferenceObjectByName(PUNICODE_STRING ObjectPath,
ULONG Attributes,
PACCESS_STATE PassedAccessState,
ACCESS_MASK DesiredAccess,
POBJECT_TYPE ObjectType,
KPROCESSOR_MODE AccessMode,
PVOID ParseContext,
PVOID* ObjectPtr);
/* FIXME: should be in kbdmou.h */
typedef VOID (*PSERVICE_CALLBACK_ROUTINE)(PDEVICE_OBJECT, PKEYBOARD_INPUT_DATA, PKEYBOARD_INPUT_DATA, PULONG);
typedef struct _CLASS_INFORMATION
{
PDEVICE_OBJECT DeviceObject;
PVOID CallBack;
} CLASS_INFORMATION, *PCLASS_INFORMATION;
#define KEYBOARD_BUFFER_SIZE 100
#elif defined(_MSC_VER)
#include <ntddk.h>
#include <ntddser.h>
#include <kbdmou.h>
#define STDCALL
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
#define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
#define DPRINT DPRINT1
#define CHECKPOINT CHECKPOINT1
#else
#error Unknown compiler!
#endif
typedef enum
{
Green,
Screen,
Keyboard
} GREEN_DEVICE_TYPE;
typedef struct _COMMON_DEVICE_EXTENSION
{
GREEN_DEVICE_TYPE Type;
} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
typedef struct _KEYBOARD_DEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT Green;
CLASS_INFORMATION ClassInformation;
HANDLE WorkerThreadHandle;
KDPC KeyboardDpc;
ULONG ActiveQueue;
ULONG InputDataCount[2];
KEYBOARD_INPUT_DATA KeyboardInputData[2][KEYBOARD_BUFFER_SIZE];
} KEYBOARD_DEVICE_EXTENSION, *PKEYBOARD_DEVICE_EXTENSION;
typedef struct _SCREEN_DEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT Green;
PUCHAR VideoMemory; /* Pointer to video memory */
USHORT CharAttribute; /* Current color attribute */
ULONG Mode;
UCHAR ScanLines; /* Height of a text line */
UCHAR Rows; /* Number of rows */
UCHAR Columns; /* Number of columns */
UCHAR TabWidth;
ULONG LogicalOffset; /* Position of the cursor */
UCHAR SendBuffer[1024];
ULONG SendBufferPosition;
} SCREEN_DEVICE_EXTENSION, *PSCREEN_DEVICE_EXTENSION;
typedef struct _GREEN_DEVICE_EXTENSION
{
COMMON_DEVICE_EXTENSION Common;
PDEVICE_OBJECT Serial;
PDEVICE_OBJECT LowerDevice;
ULONG BaudRate;
SERIAL_LINE_CONTROL LineControl;
SERIAL_TIMEOUTS Timeouts;
PDEVICE_OBJECT Keyboard;
PDEVICE_OBJECT Screen;
} GREEN_DEVICE_EXTENSION, *PGREEN_DEVICE_EXTENSION;
/************************************ createclose.c */
NTSTATUS STDCALL
GreenCreate(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS STDCALL
GreenClose(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/************************************ dispatch.c */
NTSTATUS STDCALL
GreenDispatch(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/************************************ keyboard.c */
NTSTATUS
KeyboardInitialize(
IN PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT* KeyboardFdo);
NTSTATUS
KeyboardInternalDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/************************************ misc.c */
NTSTATUS
GreenDeviceIoControl(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG CtlCode,
IN PVOID InputBuffer OPTIONAL,
IN ULONG InputBufferSize,
IN OUT PVOID OutputBuffer OPTIONAL,
IN OUT PULONG OutputBufferSize);
/************************************ pnp.c */
NTSTATUS STDCALL
GreenAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT Pdo);
/************************************ screen.c */
NTSTATUS
ScreenInitialize(
IN PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT* ScreenFdo);
NTSTATUS
ScreenWrite(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS
ScreenDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);

View File

@@ -0,0 +1,5 @@
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "VT100 Server Driver\0"
#define REACTOS_STR_INTERNAL_NAME "green\0"
#define REACTOS_STR_ORIGINAL_FILENAME "green.sys\0"
#include <reactos/version.rc>

View File

@@ -0,0 +1,346 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/keyboard.c
* PURPOSE: Keyboard part of green management
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "green.h"
static BOOLEAN
TranslateCharToScanCodes(
IN PUCHAR InputBuffer,
IN ULONG InputBufferSize,
OUT KEYBOARD_INPUT_DATA* OutputBuffer,
OUT PULONG OutputBufferSize,
OUT PULONG BytesConsumed)
{
BOOLEAN NormalKey = FALSE;
USHORT MakeCode;
if (InputBufferSize == 0)
return FALSE;
switch (*InputBuffer)
{
case 0x1b: MakeCode = 0x01; NormalKey = TRUE; break; /* ESC */
case '1': MakeCode = 0x02; NormalKey = TRUE; break;
case '2': MakeCode = 0x03; NormalKey = TRUE; break;
case '3': MakeCode = 0x04; NormalKey = TRUE; break;
case '4': MakeCode = 0x05; NormalKey = TRUE; break;
case '5': MakeCode = 0x06; NormalKey = TRUE; break;
case '6': MakeCode = 0x07; NormalKey = TRUE; break;
case '7': MakeCode = 0x08; NormalKey = TRUE; break;
case '8': MakeCode = 0x09; NormalKey = TRUE; break;
case '9': MakeCode = 0x0a; NormalKey = TRUE; break;
case '0': MakeCode = 0x0b; NormalKey = TRUE; break;
case '-': MakeCode = 0x0c; NormalKey = TRUE; break;
case '=': MakeCode = 0x0d; NormalKey = TRUE; break;
case '\b': MakeCode = 0x0e; NormalKey = TRUE; break;
case '\t': MakeCode = 0x0f; NormalKey = TRUE; break;
case 'q': MakeCode = 0x10; NormalKey = TRUE; break;
case 'w': MakeCode = 0x11; NormalKey = TRUE; break;
case 'e': MakeCode = 0x12; NormalKey = TRUE; break;
case 'r': MakeCode = 0x13; NormalKey = TRUE; break;
case 't': MakeCode = 0x14; NormalKey = TRUE; break;
case 'y': MakeCode = 0x15; NormalKey = TRUE; break;
case 'u': MakeCode = 0x16; NormalKey = TRUE; break;
case 'i': MakeCode = 0x17; NormalKey = TRUE; break;
case 'o': MakeCode = 0x18; NormalKey = TRUE; break;
case 'p': MakeCode = 0x19; NormalKey = TRUE; break;
case '[': MakeCode = 0x1a; NormalKey = TRUE; break;
case ']': MakeCode = 0x1b; NormalKey = TRUE; break;
case '\r': MakeCode = 0x1c; NormalKey = TRUE; break;
case 'a': MakeCode = 0x1e; NormalKey = TRUE; break;
case 's': MakeCode = 0x1f; NormalKey = TRUE; break;
case 'd': MakeCode = 0x20; NormalKey = TRUE; break;
case 'f': MakeCode = 0x21; NormalKey = TRUE; break;
case 'g': MakeCode = 0x22; NormalKey = TRUE; break;
case 'h': MakeCode = 0x23; NormalKey = TRUE; break;
case 'j': MakeCode = 0x24; NormalKey = TRUE; break;
case 'k': MakeCode = 0x25; NormalKey = TRUE; break;
case 'l': MakeCode = 0x26; NormalKey = TRUE; break;
case ';': MakeCode = 0x27; NormalKey = TRUE; break;
case '\'': MakeCode = 0x28; NormalKey = TRUE; break;
case '`': MakeCode = 0x29; NormalKey = TRUE; break;
case '\\': MakeCode = 0x2b; NormalKey = TRUE; break;
case 'z': MakeCode = 0x2c; NormalKey = TRUE; break;
case 'x': MakeCode = 0x2d; NormalKey = TRUE; break;
case 'c': MakeCode = 0x2e; NormalKey = TRUE; break;
case 'v': MakeCode = 0x2f; NormalKey = TRUE; break;
case 'b': MakeCode = 0x30; NormalKey = TRUE; break;
case 'n': MakeCode = 0x31; NormalKey = TRUE; break;
case 'm': MakeCode = 0x32; NormalKey = TRUE; break;
case ',': MakeCode = 0x33; NormalKey = TRUE; break;
case '.': MakeCode = 0x34; NormalKey = TRUE; break;
case '/': MakeCode = 0x35; NormalKey = TRUE; break;
case ' ': MakeCode = 0x39; NormalKey = TRUE; break;
}
if (NormalKey && *OutputBufferSize >= 2)
{
OutputBuffer[0].MakeCode = MakeCode;
OutputBuffer[0].Flags = KEY_MAKE;
OutputBuffer[1].MakeCode = MakeCode;
OutputBuffer[1].Flags = KEY_BREAK;
*BytesConsumed = 2;
return TRUE;
}
/* Consume strange character by ignoring it */
DPRINT1("Green: strange byte received 0x%02x ('%c')\n",
*InputBuffer, *InputBuffer >= 32 ? *InputBuffer : '.');
*BytesConsumed = 1;
return TRUE;
}
NTSTATUS
KeyboardInitialize(
IN PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT* KeyboardFdo)
{
PDEVICE_OBJECT Fdo;
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass1");
NTSTATUS Status;
DPRINT("Green: KeyboardInitialize() called\n");
Status = IoCreateDevice(DriverObject,
sizeof(KEYBOARD_DEVICE_EXTENSION),
&DeviceName, /* FIXME: don't hardcode string */
FILE_DEVICE_KEYBOARD,
FILE_DEVICE_SECURE_OPEN,
TRUE,
&Fdo);
if (!NT_SUCCESS(Status))
return Status;
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)Fdo->DeviceExtension;
RtlZeroMemory(DeviceExtension, sizeof(KEYBOARD_DEVICE_EXTENSION));
DeviceExtension->Common.Type = Keyboard;
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
*KeyboardFdo = Fdo;
return STATUS_SUCCESS;
}
static VOID STDCALL
KeyboardDpcSendData(
IN PKDPC Dpc,
IN PVOID pDeviceExtension, /* real type PKEYBOARD_DEVICE_EXTENSION */
IN PVOID Unused1,
IN PVOID Unused2)
{
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
ULONG Queue;
ULONG InputDataConsumed;
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)pDeviceExtension;
Queue = DeviceExtension->ActiveQueue % 2;
InterlockedIncrement((PLONG)&DeviceExtension->ActiveQueue);
(*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassInformation.CallBack)(
DeviceExtension->ClassInformation.DeviceObject,
DeviceExtension->KeyboardInputData[Queue],
&DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]],
&InputDataConsumed);
DeviceExtension->InputDataCount[Queue] = 0;
}
static VOID STDCALL
KeyboardDeviceWorker(
PVOID Context)
{
PDEVICE_OBJECT DeviceObject;
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
PGREEN_DEVICE_EXTENSION GreenDeviceExtension;
PDEVICE_OBJECT LowerDevice;
UCHAR Buffer[16]; /* Arbitrary size */
ULONG BufferSize;
PIRP Irp;
IO_STATUS_BLOCK ioStatus;
KEVENT event;
KIRQL OldIrql;
ULONG i, Queue;
ULONG SpaceInQueue;
ULONG BytesConsumed;
PKEYBOARD_INPUT_DATA Input;
NTSTATUS Status;
DPRINT("Green: KeyboardDeviceWorker() called\n");
DeviceObject = (PDEVICE_OBJECT)Context;
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension;
LowerDevice = GreenDeviceExtension->Serial;
BufferSize = sizeof(Buffer);
/* Initialize device extension */
DeviceExtension->ActiveQueue = 0;
DeviceExtension->InputDataCount[0] = 0;
DeviceExtension->InputDataCount[1] = 0;
KeInitializeDpc(&DeviceExtension->KeyboardDpc, KeyboardDpcSendData, DeviceExtension);
RtlZeroMemory(&DeviceExtension->KeyboardInputData, sizeof(DeviceExtension->KeyboardInputData));
/* main read loop */
while (TRUE)
{
KeInitializeEvent(&event, NotificationEvent, FALSE);
Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_READ,
LowerDevice,
Buffer, BufferSize,
0,
&event,
&ioStatus);
if (!Irp)
{
/* no memory actually, try later */
CHECKPOINT;
KeStallExecutionProcessor(10);
continue;
}
Status = IoCallDriver(LowerDevice, Irp);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL);
Status = ioStatus.Status;
}
if (!NT_SUCCESS(Status))
continue;
/* Read all available data and process */
i = 0;
while (i < ioStatus.Information)
{
Queue = DeviceExtension->ActiveQueue % 2;
Input = &DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]];
/* Translate current chars to scan codes */
SpaceInQueue = KEYBOARD_BUFFER_SIZE - DeviceExtension->InputDataCount[Queue];
if (TranslateCharToScanCodes(
&Buffer[i], /* input buffer */
ioStatus.Information - i, /* input buffer size */
Input, /* output buffer */
&SpaceInQueue, /* output buffer size */
&BytesConsumed)) /* bytes consumed in input buffer */
{
DPRINT1("Green: got char 0x%02x (%c)\n", Buffer[i], Buffer[i] >= 32 ? Buffer[i] : ' ');
DeviceExtension->InputDataCount[Queue] += BytesConsumed;
/* Send the data to the keyboard class driver */
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
KeInsertQueueDpc(&DeviceExtension->KeyboardDpc, NULL, NULL);
KeLowerIrql(OldIrql);
i += BytesConsumed;
}
else
{
/* TranslateCharToScanCodes failed. Possible reasons:
* - not enough bytes in input buffer (escape control code; wait next received bytes)
* - not enough room in output buffer (wait for the Dpc to empty it)
*
* The best way to resolve this is to try later.
*/
i++;
}
}
}
PsTerminateSystemThread(STATUS_SUCCESS);
}
NTSTATUS
KeyboardInternalDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
PGREEN_DEVICE_EXTENSION GreenDeviceExtension;
OBJECT_ATTRIBUTES objectAttributes;
PDEVICE_OBJECT LowerDevice;
NTSTATUS Status;
Stack = IoGetCurrentIrpStackLocation(Irp);
Irp->IoStatus.Information = 0;
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension;
LowerDevice = GreenDeviceExtension->Serial;
DPRINT1("Green: LowerDevice %p\n", LowerDevice);
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_INTERNAL_KEYBOARD_CONNECT:
{
ULONG Fcr;
DPRINT("Green: IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_KEYBOARD_CONNECT\n");
if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA))
{
Status = STATUS_INVALID_PARAMETER;
break;
}
DeviceExtension->ClassInformation =
*((PCLASS_INFORMATION)Stack->Parameters.DeviceIoControl.Type3InputBuffer);
/* Initialize serial port */
Fcr = 0;
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
&Fcr, sizeof(Fcr), NULL, NULL);
if (!NT_SUCCESS(Status)) break;
/* Set serial port speed */
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&GreenDeviceExtension->BaudRate, sizeof(GreenDeviceExtension->BaudRate), NULL, NULL);
if (!NT_SUCCESS(Status)) break;
/* Set LCR */
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&GreenDeviceExtension->LineControl, sizeof(GreenDeviceExtension->LineControl), NULL, NULL);
if (!NT_SUCCESS(Status)) break;
/* Set timeouts */
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
&GreenDeviceExtension->Timeouts, sizeof(GreenDeviceExtension->Timeouts), NULL, NULL);
if (!NT_SUCCESS(Status)) break;
/* Start read loop */
InitializeObjectAttributes(&objectAttributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
Status = PsCreateSystemThread(
&DeviceExtension->WorkerThreadHandle,
(ACCESS_MASK)0L,
&objectAttributes,
NULL,
NULL,
KeyboardDeviceWorker,
DeviceObject);
break;
}
default:
{
DPRINT("Green: IRP_MJ_INTERNAL_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
Stack->Parameters.DeviceIoControl.IoControlCode);
Status = STATUS_INVALID_DEVICE_REQUEST;
}
}
Irp->IoStatus.Status = Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return Status;
}

View File

@@ -0,0 +1,24 @@
# $Id:
PATH_TO_TOP = ../../..
TARGET_BOOTSTRAP = yes
TARGET_TYPE = driver
TARGET_NAME = green
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
TARGET_OBJECTS = \
$(TARGET_NAME).o \
createclose.o \
dispatch.o \
keyboard.o \
misc.o \
pnp.o \
screen.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk

View File

@@ -0,0 +1,60 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/misc.c
* PURPOSE: Misceallenous operations
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
//#define NDEBUG
#include "green.h"
NTSTATUS
GreenDeviceIoControl(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG CtlCode,
IN PVOID InputBuffer OPTIONAL,
IN ULONG InputBufferSize,
IN OUT PVOID OutputBuffer OPTIONAL,
IN OUT PULONG OutputBufferSize)
{
KEVENT Event;
PIRP Irp;
IO_STATUS_BLOCK IoStatus;
NTSTATUS Status;
KeInitializeEvent (&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(CtlCode,
DeviceObject,
InputBuffer,
InputBufferSize,
OutputBuffer,
(OutputBufferSize) ? *OutputBufferSize : 0,
FALSE,
&Event,
&IoStatus);
if (Irp == NULL)
{
DPRINT("Green: IoBuildDeviceIoControlRequest() failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
DPRINT("Green: Operation pending\n");
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
Status = IoStatus.Status;
}
if (OutputBufferSize)
{
*OutputBufferSize = IoStatus.Information;
}
return Status;
}

View File

@@ -0,0 +1,87 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/pnp.c
* PURPOSE: IRP_MJ_PNP operations
*
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "green.h"
NTSTATUS STDCALL
GreenAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT Pdo)
{
PDEVICE_OBJECT Fdo = NULL;
PGREEN_DEVICE_EXTENSION DeviceExtension;
UNICODE_STRING serialPortName;
NTSTATUS Status;
DPRINT("Green: AddDevice(DriverObject %p, Pdo %p)\n", DriverObject, Pdo);
/* Create green FDO */
Status = IoCreateDevice(DriverObject,
sizeof(GREEN_DEVICE_EXTENSION),
NULL,
FILE_DEVICE_UNKNOWN,
FILE_DEVICE_SECURE_OPEN,
TRUE,
&Fdo);
if (!NT_SUCCESS(Status))
return Status;
DeviceExtension = (PGREEN_DEVICE_EXTENSION)Fdo->DeviceExtension;
RtlZeroMemory(DeviceExtension, sizeof(GREEN_DEVICE_EXTENSION));
DeviceExtension->Common.Type = Green;
Status = KeyboardInitialize(DriverObject, &DeviceExtension->Keyboard);
if (!NT_SUCCESS(Status))
{
IoDeleteDevice(Fdo);
return Status;
}
((PKEYBOARD_DEVICE_EXTENSION)DeviceExtension->Keyboard->DeviceExtension)->Green = Fdo;
Status = ScreenInitialize(DriverObject, &DeviceExtension->Screen);
if (!NT_SUCCESS(Status))
{
IoDeleteDevice(DeviceExtension->Keyboard);
IoDeleteDevice(Fdo);
return Status;
}
((PSCREEN_DEVICE_EXTENSION)DeviceExtension->Screen->DeviceExtension)->Green = Fdo;
/* initialize green Fdo */
DeviceExtension->LowerDevice = IoAttachDeviceToDeviceStack(Fdo, Pdo);
DeviceExtension->LineControl.WordLength = 8;
DeviceExtension->LineControl.Parity = NO_PARITY;
DeviceExtension->LineControl.StopBits = STOP_BIT_1;
DeviceExtension->BaudRate = SERIAL_BAUD_38400;
DeviceExtension->Timeouts.ReadTotalTimeoutConstant = 1; /* not null */
DeviceExtension->Timeouts.ReadIntervalTimeout = INFINITE;
DeviceExtension->Timeouts.ReadTotalTimeoutMultiplier = INFINITE;
DeviceExtension->Timeouts.WriteTotalTimeoutMultiplier = 0; /* FIXME */
DeviceExtension->Timeouts.WriteTotalTimeoutConstant = 0; /* FIXME */
/* open associated serial port */
RtlInitUnicodeString(&serialPortName, L"\\Device\\Serial1"); /* FIXME: don't hardcode string */
Status = ObReferenceObjectByName(
&serialPortName,
OBJ_EXCLUSIVE | OBJ_KERNEL_HANDLE,
NULL,
(ACCESS_MASK)0,
IoDeviceObjectType,
KernelMode,
NULL,
(PVOID*)&DeviceExtension->Serial);
/* FIXME: we never ObDereferenceObject */
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
return Status;
}

View File

@@ -0,0 +1,544 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS VT100 emulator
* FILE: drivers/dd/green/screen.c
* PURPOSE: Screen part of green management
*
* PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de)
* Art Yerkes
* Herv<72> Poussineau (hpoussin@reactos.com)
*/
#define NDEBUG
#include "green.h"
#include <stdarg.h>
#define ESC ((UCHAR)0x1b)
/* Force a move of the cursor on each printer char.
* Very useful for debug, but it is very slow...
*/
//#define FORCE_POSITION
/* UCHAR is promoted to int when passed through '...',
* so we get int with va_arg and cast them back to UCHAR.
*/
static VOID
AddToSendBuffer(
IN PSCREEN_DEVICE_EXTENSION DeviceExtension,
IN ULONG NumberOfChars,
... /* IN int */)
{
PIRP Irp;
IO_STATUS_BLOCK ioStatus;
va_list args;
PDEVICE_OBJECT SerialDevice;
ULONG SizeLeft;
int CurrentInt;
UCHAR CurrentChar;
NTSTATUS Status;
SizeLeft = sizeof(DeviceExtension->SendBuffer) - DeviceExtension->SendBufferPosition;
if (SizeLeft < NumberOfChars * 2 || NumberOfChars == 0)
{
SerialDevice = ((PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension)->Serial;
Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_WRITE,
SerialDevice,
DeviceExtension->SendBuffer, DeviceExtension->SendBufferPosition,
NULL, /* StartingOffset */
NULL, /* Event */
&ioStatus);
if (!Irp)
{
DPRINT1("Green: IoBuildSynchronousFsdRequest() failed. Unable to flush output buffer\n");
return;
}
Status = IoCallDriver(SerialDevice, Irp);
if (!NT_SUCCESS(Status) && Status != STATUS_PENDING)
{
DPRINT1("Green: IoCallDriver() failed. Status = 0x%08lx\n", Status);
return;
}
DeviceExtension->SendBufferPosition = 0;
SizeLeft = sizeof(DeviceExtension->SendBuffer);
}
va_start(args, NumberOfChars);
while (NumberOfChars-- > 0)
{
CurrentInt = va_arg(args, int);
if (CurrentInt > 0)
{
CurrentChar = (UCHAR)CurrentInt;
/* Why 0xff chars are printed on a 'dir' ? */
if (CurrentChar == 0xff) CurrentChar = ' ';
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = CurrentChar;
SizeLeft--;
}
else if (CurrentInt == 0)
{
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = '0';
SizeLeft--;
}
else
{
CurrentInt = -CurrentInt;
ASSERT(CurrentInt < 100);
if (CurrentInt >= 10)
{
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] =
(CurrentInt / 10) % 10 + '0';
SizeLeft--;
}
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] =
CurrentInt % 10 + '0';
SizeLeft--;
}
}
va_end(args);
}
NTSTATUS
ScreenInitialize(
IN PDRIVER_OBJECT DriverObject,
OUT PDEVICE_OBJECT* ScreenFdo)
{
PDEVICE_OBJECT Fdo;
PSCREEN_DEVICE_EXTENSION DeviceExtension;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\BlueScreen");
NTSTATUS Status;
DPRINT("Green: ScreenInitialize() called\n");
Status = IoCreateDevice(DriverObject,
sizeof(SCREEN_DEVICE_EXTENSION),
&DeviceName, /* FIXME: don't hardcode string */
FILE_DEVICE_SCREEN,
FILE_DEVICE_SECURE_OPEN,
TRUE,
&Fdo);
if (!NT_SUCCESS(Status))
return Status;
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)Fdo->DeviceExtension;
RtlZeroMemory(DeviceExtension, sizeof(SCREEN_DEVICE_EXTENSION));
DeviceExtension->Common.Type = Screen;
/* initialize screen */
DeviceExtension->Columns = 80;
DeviceExtension->Rows = 25;
DeviceExtension->ScanLines = 16;
DeviceExtension->VideoMemory = (PUCHAR)ExAllocatePool(
PagedPool,
2 * DeviceExtension->Columns * DeviceExtension->Rows * sizeof(UCHAR));
if (!DeviceExtension->VideoMemory)
{
IoDeleteDevice(Fdo);
return STATUS_INSUFFICIENT_RESOURCES;
}
DeviceExtension->TabWidth = 8;
/* more initialization */
DeviceExtension->Mode = ENABLE_PROCESSED_OUTPUT |
ENABLE_WRAP_AT_EOL_OUTPUT;
/* initialize screen at next write */
AddToSendBuffer(DeviceExtension, 2, ESC, 'c'); /* reset device */
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '7', 'l'); /* disable line wrap */
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '3', 'g'); /* clear all tabs */
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
*ScreenFdo = Fdo;
return STATUS_SUCCESS;
}
NTSTATUS
ScreenWrite(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
PUCHAR Buffer;
PSCREEN_DEVICE_EXTENSION DeviceExtension;
PUCHAR VideoMemory; /* FIXME: is it useful? */
ULONG VideoMemorySize; /* FIXME: is it useful? */
ULONG Columns, Rows;
ULONG CursorX, CursorY;
ULONG i, j;
NTSTATUS Status;
DPRINT("Green: IRP_MJ_WRITE\n");
Stack = IoGetCurrentIrpStackLocation (Irp);
Buffer = Irp->UserBuffer;
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
VideoMemory = DeviceExtension->VideoMemory;
Columns = DeviceExtension->Columns;
Rows = DeviceExtension->Rows;
CursorX = (DeviceExtension->LogicalOffset / 2) % Columns + 1;
CursorY = (DeviceExtension->LogicalOffset / 2) / Columns + 1;
VideoMemorySize = Columns * Rows * 2 * sizeof(UCHAR);
DPRINT1("Y: %lu\n", CursorY);
DPRINT1("Buffer =");
for (i = 0; i < Stack->Parameters.Write.Length; i++)
DbgPrint(" 0x%02x", Buffer[i]);
DbgPrint("\n");
if (!(DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT))
{
/* raw output mode */
CHECKPOINT;
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return STATUS_NOT_SUPPORTED;
}
else
{
for (i = 0; i < Stack->Parameters.Write.Length; i++, Buffer++)
{
switch (*Buffer)
{
case '\b':
{
if (CursorX > 1)
{
CursorX--;
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
AddToSendBuffer(DeviceExtension, 1, ' ');
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
}
else if (CursorY > 1)
{
CursorX = Columns;
CursorY--;
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
}
break;
}
case '\n':
{
CursorY++;
CursorX = 1;
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H');
break;
}
case '\r':
{
if (CursorX > 1)
{
AddToSendBuffer(DeviceExtension, 4, ESC, '[', -(int)(CursorX-1), 'D');
CursorX = 1;
}
break;
}
case '\t':
{
ULONG Offset = DeviceExtension->TabWidth - (CursorX % DeviceExtension->TabWidth);
for (j = 0; j < Offset; j++)
{
#ifdef FORCE_POSITION
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
#endif
AddToSendBuffer(DeviceExtension, 1, ' ');
CursorX++;
if (CursorX > Columns)
{
CursorX = 1;
CursorY++;
}
}
break;
}
default:
{
#ifdef FORCE_POSITION
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
#endif
AddToSendBuffer(DeviceExtension, 1, *Buffer);
CursorX++;
if (CursorX > Columns)
{
CursorX = 1;
DPRINT1("Y: %lu -> %lu\n", CursorY, CursorY + 1);
CursorY++;
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H');
}
}
}
if (CursorY > Rows)
{
DPRINT1("Y: %lu -> %lu\n", CursorY, CursorY - 1);
CursorY--;
AddToSendBuffer(DeviceExtension, 2, ESC, 'D');
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
}
}
}
DeviceExtension->LogicalOffset = ((CursorX-1) + (CursorY-1) * Columns) * 2;
/* flush output buffer */
AddToSendBuffer(DeviceExtension, 0);
Status = STATUS_SUCCESS;
Irp->IoStatus.Status = Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return Status;
}
NTSTATUS
ScreenDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
PSCREEN_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status;
Stack = IoGetCurrentIrpStackLocation(Irp);
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO:
{
PCONSOLE_SCREEN_BUFFER_INFO pcsbi;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO\n");
pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
pcsbi->dwSize.X = DeviceExtension->Columns;
pcsbi->dwSize.Y = DeviceExtension->Rows;
pcsbi->dwCursorPosition.X = (SHORT)(DeviceExtension->LogicalOffset % DeviceExtension->Columns);
pcsbi->dwCursorPosition.Y = (SHORT)(DeviceExtension->LogicalOffset / DeviceExtension->Columns);
pcsbi->wAttributes = DeviceExtension->CharAttribute;
pcsbi->srWindow.Left = 1;
pcsbi->srWindow.Right = DeviceExtension->Columns;
pcsbi->srWindow.Top = 1;
pcsbi->srWindow.Bottom = DeviceExtension->Rows;
pcsbi->dwMaximumWindowSize.X = DeviceExtension->Columns;
pcsbi->dwMaximumWindowSize.Y = DeviceExtension->Rows;
Irp->IoStatus.Information = sizeof(CONSOLE_SCREEN_BUFFER_INFO);
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO:
{
PCONSOLE_SCREEN_BUFFER_INFO pcsbi;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO\n");
pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
/* FIXME: remove */ { pcsbi->dwCursorPosition.X++; }
/* FIXME: remove */ { pcsbi->dwCursorPosition.Y++; }
ASSERT(pcsbi->dwCursorPosition.X >= 1);
ASSERT(pcsbi->dwCursorPosition.Y >= 1);
ASSERT(pcsbi->dwCursorPosition.X <= DeviceExtension->Columns);
ASSERT(pcsbi->dwCursorPosition.Y <= DeviceExtension->Rows);
DeviceExtension->LogicalOffset = (
(pcsbi->dwCursorPosition.Y-1) * DeviceExtension->Columns +
(pcsbi->dwCursorPosition.X-1)) * 2;
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
-(int)pcsbi->dwCursorPosition.Y, ';',
-(int)pcsbi->dwCursorPosition.X, 'H');
/* flush buffer */
AddToSendBuffer(DeviceExtension, 0);
DeviceExtension->CharAttribute = pcsbi->wAttributes;
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_GET_CURSOR_INFO:
{
PCONSOLE_CURSOR_INFO pcci = (PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_CURSOR_INFO\n");
pcci->dwSize = 1;
pcci->bVisible = TRUE;
Irp->IoStatus.Information = sizeof (CONSOLE_CURSOR_INFO);
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_GET_MODE:
{
PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_MODE\n");
pcm->dwMode = DeviceExtension->Mode;
Irp->IoStatus.Information = sizeof(CONSOLE_MODE);
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_SET_MODE:
{
PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_MODE\n");
DeviceExtension->Mode = pcm->dwMode;
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE */
break;
}
case IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE */
break;
}
case IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE */
break;
}
case IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE:
{
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE\n");
DeviceExtension->CharAttribute = (WORD)*(PWORD)Irp->AssociatedIrp.SystemBuffer;
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
break;
}
case IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME:IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER */
break;
}
case IOCTL_CONSOLE_READ_OUTPUT_CHARACTER:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_CHARACTER\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_CHARACTER */
break;
}
case IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER:
{
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER\n");
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER */
break;
}
case IOCTL_CONSOLE_DRAW:
{
PCONSOLE_DRAW ConsoleDraw;
PUCHAR Video;
ULONG x, y;
BOOLEAN DoOptimization = FALSE;
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_DRAW\n");
ConsoleDraw = (PCONSOLE_DRAW)MmGetSystemAddressForMdl(Irp->MdlAddress);
/* FIXME: remove */ { ConsoleDraw->X++; ConsoleDraw->CursorX++; }
/* FIXME: remove */ { ConsoleDraw->Y++; ConsoleDraw->CursorY++; }
DPRINT1("%lu %lu %lu %lu\n",
ConsoleDraw->X, ConsoleDraw->Y,
ConsoleDraw->SizeX, ConsoleDraw->SizeY);
ASSERT(ConsoleDraw->X >= 1);
ASSERT(ConsoleDraw->Y >= 1);
ASSERT(ConsoleDraw->X <= DeviceExtension->Columns);
ASSERT(ConsoleDraw->Y <= DeviceExtension->Rows);
ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX >= 1);
ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY >= 1);
ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX - 1 <= DeviceExtension->Columns);
ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY - 1 <= DeviceExtension->Rows);
ASSERT(ConsoleDraw->CursorX >= 1);
ASSERT(ConsoleDraw->CursorY >= 1);
ASSERT(ConsoleDraw->CursorX <= DeviceExtension->Columns);
ASSERT(ConsoleDraw->CursorY <= DeviceExtension->Rows);
#if 0
if (ConsoleDraw->X == 1
&& ConsoleDraw->Y == 1
&& ConsoleDraw->SizeX == DeviceExtension->Columns
&& ConsoleDraw->SizeY == DeviceExtension->Rows)
{
CHECKPOINT1;
/* search if we need to clear all screen */
DoOptimization = TRUE;
Video = (PUCHAR)(ConsoleDraw + 1);
x = 0;
while (DoOptimization && x < DeviceExtension->Columns * DeviceExtension->Rows)
{
if (Video[x++] != ' ')
{
CHECKPOINT1;
DoOptimization = FALSE;
}
/*if (Video[x++] != DeviceExtension->CharAttribute) DoOptimization = FALSE; */
}
if (DoOptimization)
{
CHECKPOINT1;
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '2', 'J');
}
}
#endif
/* add here more optimizations if needed */
if (!DoOptimization)
{
for (y = 0; y < ConsoleDraw->SizeY; y++)
{
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
-(int)(ConsoleDraw->Y + y), ';',
-(int)(ConsoleDraw->X), 'H');
Video = (PUCHAR)(ConsoleDraw + 1);
Video = &Video[((ConsoleDraw->Y + y) * DeviceExtension->Columns + ConsoleDraw->X) * 2];
for (x = 0; x < ConsoleDraw->SizeX; x++)
{
AddToSendBuffer(DeviceExtension, 1, Video[x * 2]);
}
}
}
DeviceExtension->LogicalOffset = (
(ConsoleDraw->CursorY-1) * DeviceExtension->Columns +
(ConsoleDraw->CursorX-1)) * 2;
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
-(int)(ConsoleDraw->CursorY), ';',
-(int)(ConsoleDraw->CursorX), 'H');
/* flush buffer */
AddToSendBuffer(DeviceExtension, 0);
Irp->IoStatus.Information = 0;
Status = STATUS_SUCCESS;
break;
}
default:
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
Stack->Parameters.DeviceIoControl.IoControlCode);
Status = STATUS_NOT_IMPLEMENTED;
}
Irp->IoStatus.Status = Status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
return Status;
}

View File

@@ -1,96 +1,103 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/dd/serial/circularbuffer.c
* PURPOSE: Operations on a circular buffer
*
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
*/
#define NDEBUG
#include "serial.h"
NTSTATUS
InitializeCircularBuffer(
IN PCIRCULAR_BUFFER pBuffer,
IN ULONG BufferSize)
{
DPRINT("Serial: InitializeCircularBuffer(pBuffer %p, BufferSize %lu)\n", pBuffer, BufferSize);
pBuffer->Buffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, BufferSize * sizeof(UCHAR), SERIAL_TAG);
if (!pBuffer->Buffer)
return STATUS_INSUFFICIENT_RESOURCES;
pBuffer->Length = BufferSize;
pBuffer->ReadPosition = pBuffer->WritePosition = 0;
return STATUS_SUCCESS;
}
NTSTATUS
FreeCircularBuffer(
IN PCIRCULAR_BUFFER pBuffer)
{
DPRINT("Serial: FreeCircularBuffer(pBuffer %p)\n", pBuffer);
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
return STATUS_SUCCESS;
}
BOOLEAN
IsCircularBufferEmpty(
IN PCIRCULAR_BUFFER pBuffer)
{
DPRINT("Serial: IsCircularBufferEmpty(pBuffer %p)\n", pBuffer);
return (pBuffer->ReadPosition == pBuffer->WritePosition);
}
NTSTATUS
PushCircularBufferEntry(
IN PCIRCULAR_BUFFER pBuffer,
IN UCHAR Entry)
{
DPRINT("Serial: PushCircularBufferEntry(pBuffer %p, Entry 0x%x)\n", pBuffer, Entry);
ASSERT(pBuffer->Length);
ULONG NextPosition = (pBuffer->WritePosition + 1) % pBuffer->Length;
if (NextPosition == pBuffer->ReadPosition)
return STATUS_BUFFER_TOO_SMALL;
pBuffer->Buffer[pBuffer->WritePosition] = Entry;
pBuffer->WritePosition = NextPosition;
return STATUS_SUCCESS;
}
NTSTATUS
PopCircularBufferEntry(
IN PCIRCULAR_BUFFER pBuffer,
OUT PUCHAR Entry)
{
DPRINT("Serial: PopCircularBufferEntry(pBuffer %p)\n", pBuffer);
ASSERT(pBuffer->Length);
if (IsCircularBufferEmpty(pBuffer))
return STATUS_ARRAY_BOUNDS_EXCEEDED;
*Entry = pBuffer->Buffer[pBuffer->ReadPosition];
pBuffer->ReadPosition = (pBuffer->ReadPosition + 1) % pBuffer->Length;
return STATUS_SUCCESS;
}
NTSTATUS
IncreaseCircularBufferSize(
IN PCIRCULAR_BUFFER pBuffer,
IN ULONG NewBufferSize)
{
PUCHAR NewBuffer;
DPRINT("Serial: IncreaseCircularBufferSize(pBuffer %p, NewBufferSize %lu)\n", pBuffer, NewBufferSize);
ASSERT(pBuffer->Length);
if (pBuffer->Length > NewBufferSize)
return STATUS_INVALID_PARAMETER;
else if (pBuffer->Length == NewBufferSize)
return STATUS_SUCCESS;
NewBuffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, NewBufferSize * sizeof(UCHAR), SERIAL_TAG);
if (!NewBuffer)
return STATUS_INSUFFICIENT_RESOURCES;
RtlCopyMemory(NewBuffer, pBuffer->Buffer, pBuffer->Length * sizeof(UCHAR));
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
pBuffer->Buffer = NewBuffer;
pBuffer->Length = NewBufferSize;
return STATUS_SUCCESS;
}
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/dd/serial/circularbuffer.c
* PURPOSE: Operations on a circular buffer
*
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
*/
#define NDEBUG
#include "serial.h"
NTSTATUS
InitializeCircularBuffer(
IN PCIRCULAR_BUFFER pBuffer,
IN ULONG BufferSize)
{
DPRINT("Serial: InitializeCircularBuffer(pBuffer %p, BufferSize %lu)\n", pBuffer, BufferSize);
ASSERT(pBuffer);
pBuffer->Buffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, BufferSize * sizeof(UCHAR), SERIAL_TAG);
if (!pBuffer->Buffer)
return STATUS_INSUFFICIENT_RESOURCES;
pBuffer->Length = BufferSize;
pBuffer->ReadPosition = pBuffer->WritePosition = 0;
return STATUS_SUCCESS;
}
NTSTATUS
FreeCircularBuffer(
IN PCIRCULAR_BUFFER pBuffer)
{
DPRINT("Serial: FreeCircularBuffer(pBuffer %p)\n", pBuffer);
ASSERT(pBuffer);
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
return STATUS_SUCCESS;
}
BOOLEAN
IsCircularBufferEmpty(
IN PCIRCULAR_BUFFER pBuffer)
{
DPRINT("Serial: IsCircularBufferEmpty(pBuffer %p)\n", pBuffer);
ASSERT(pBuffer);
return (pBuffer->ReadPosition == pBuffer->WritePosition);
}
NTSTATUS
PushCircularBufferEntry(
IN PCIRCULAR_BUFFER pBuffer,
IN UCHAR Entry)
{
ULONG NextPosition;
DPRINT("Serial: PushCircularBufferEntry(pBuffer %p, Entry 0x%x)\n", pBuffer, Entry);
ASSERT(pBuffer);
ASSERT(pBuffer->Length);
NextPosition = (pBuffer->WritePosition + 1) % pBuffer->Length;
if (NextPosition == pBuffer->ReadPosition)
return STATUS_BUFFER_TOO_SMALL;
pBuffer->Buffer[pBuffer->WritePosition] = Entry;
pBuffer->WritePosition = NextPosition;
return STATUS_SUCCESS;
}
NTSTATUS
PopCircularBufferEntry(
IN PCIRCULAR_BUFFER pBuffer,
OUT PUCHAR Entry)
{
DPRINT("Serial: PopCircularBufferEntry(pBuffer %p)\n", pBuffer);
ASSERT(pBuffer);
ASSERT(pBuffer->Length);
if (IsCircularBufferEmpty(pBuffer))
return STATUS_ARRAY_BOUNDS_EXCEEDED;
*Entry = pBuffer->Buffer[pBuffer->ReadPosition];
pBuffer->ReadPosition = (pBuffer->ReadPosition + 1) % pBuffer->Length;
return STATUS_SUCCESS;
}
NTSTATUS
IncreaseCircularBufferSize(
IN PCIRCULAR_BUFFER pBuffer,
IN ULONG NewBufferSize)
{
PUCHAR NewBuffer;
DPRINT("Serial: IncreaseCircularBufferSize(pBuffer %p, NewBufferSize %lu)\n", pBuffer, NewBufferSize);
ASSERT(pBuffer);
ASSERT(pBuffer->Length);
if (pBuffer->Length > NewBufferSize)
return STATUS_INVALID_PARAMETER;
else if (pBuffer->Length == NewBufferSize)
return STATUS_SUCCESS;
NewBuffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, NewBufferSize * sizeof(UCHAR), SERIAL_TAG);
if (!NewBuffer)
return STATUS_INSUFFICIENT_RESOURCES;
RtlCopyMemory(NewBuffer, pBuffer->Buffer, pBuffer->Length * sizeof(UCHAR));
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
pBuffer->Buffer = NewBuffer;
pBuffer->Length = NewBufferSize;
return STATUS_SUCCESS;
}

View File

@@ -26,6 +26,8 @@ SerialCreate(
FileObject = Stack->FileObject;
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FileObject);
if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
{
CHECKPOINT;

View File

@@ -7,11 +7,42 @@
*
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
*/
/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
#define NDEBUG
#include "serial.h"
#define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
static VOID
SerialGetUserBuffers(
IN PIRP Irp,
IN ULONG IoControlCode,
OUT PVOID* BufferIn,
OUT PVOID* BufferOut)
{
ASSERT(Irp);
ASSERT(BufferIn);
ASSERT(BufferOut);
switch (IO_METHOD_FROM_CTL_CODE(IoControlCode))
{
case METHOD_BUFFERED:
*BufferIn = *BufferOut = Irp->AssociatedIrp.SystemBuffer;
return;
case METHOD_IN_DIRECT:
case METHOD_OUT_DIRECT:
*BufferIn = Irp->AssociatedIrp.SystemBuffer;
*BufferOut = MmGetSystemAddressForMdl(Irp->MdlAddress);
return;
case METHOD_NEITHER:
*BufferIn = IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.Type3InputBuffer;
*BufferOut = Irp->UserBuffer;
return;
}
/* Should never happen */
}
NTSTATUS STDCALL
SerialSetBaudRate(
IN PSERIAL_DEVICE_EXTENSION DeviceExtension,
@@ -87,6 +118,9 @@ SerialSetLineControl(
UCHAR Lcr = 0;
NTSTATUS Status;
ASSERT(DeviceExtension);
ASSERT(NewSettings);
DPRINT("Serial: SerialSetLineControl(COM%lu, Settings { %lu %lu %lu })\n",
DeviceExtension->ComPort, NewSettings->StopBits, NewSettings->Parity, NewSettings->WordLength);
@@ -151,9 +185,12 @@ SerialSetLineControl(
BOOLEAN
SerialClearPerfStats(
IN PSERIALPERF_STATS pSerialPerfStats)
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
{
RtlZeroMemory(pSerialPerfStats, sizeof(SERIALPERF_STATS));
ASSERT(DeviceExtension);
RtlZeroMemory(&DeviceExtension->SerialPerfStats, sizeof(SERIALPERF_STATS));
DeviceExtension->BreakInterruptErrorCount = 0;
return TRUE;
}
@@ -163,6 +200,7 @@ SerialGetPerfStats(IN PIRP pIrp)
PSERIAL_DEVICE_EXTENSION pDeviceExtension;
pDeviceExtension = (PSERIAL_DEVICE_EXTENSION)
IoGetCurrentIrpStackLocation(pIrp)->DeviceObject->DeviceExtension;
ASSERT(DeviceExtension);
/*
* we assume buffer is big enough to hold SerialPerfStats structure
* caller must verify this
@@ -180,6 +218,8 @@ SerialGetCommProp(
OUT PSERIAL_COMMPROP pCommProp,
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
{
ASSERT(pCommProp);
RtlZeroMemory(pCommProp, sizeof(SERIAL_COMMPROP));
pCommProp->PacketLength = sizeof(SERIAL_COMMPROP);
@@ -187,22 +227,30 @@ SerialGetCommProp(
pCommProp->ServiceMask = SERIAL_SP_SERIALCOMM;
pCommProp->MaxTxQueue = pCommProp->CurrentTxQueue = DeviceExtension->OutputBuffer.Length - 1;
pCommProp->MaxRxQueue = pCommProp->CurrentRxQueue = DeviceExtension->InputBuffer.Length - 1;
pCommProp->MaxBaud = SERIAL_BAUD_115200;
pCommProp->ProvSubType = 1; // PST_RS232;
/* FIXME: ProvCapabilities may be related to Uart type */
pCommProp->ProvCapabilities = SERIAL_PCF_DTRDSR | SERIAL_PCF_INTTIMEOUTS | SERIAL_PCF_PARITY_CHECK
| SERIAL_PCF_RTSCTS | SERIAL_PCF_SETXCHAR | SERIAL_PCF_SPECIALCHARS | SERIAL_PCF_TOTALTIMEOUTS
| SERIAL_PCF_XONXOFF;
/* FIXME: SettableParams may be related to Uart type */
pCommProp->SettableParams = SERIAL_SP_BAUD | SERIAL_SP_DATABITS | SERIAL_SP_HANDSHAKING
| SERIAL_SP_PARITY | SERIAL_SP_PARITY_CHECK | SERIAL_SP_STOPBITS;
/* FIXME: SettableBaud may be related to Uart type */
/* SettableBaud is related to Uart type */
pCommProp->SettableBaud = SERIAL_BAUD_075 | SERIAL_BAUD_110 | SERIAL_BAUD_134_5
| SERIAL_BAUD_150 | SERIAL_BAUD_300 | SERIAL_BAUD_600 | SERIAL_BAUD_1200
| SERIAL_BAUD_1800 | SERIAL_BAUD_2400 | SERIAL_BAUD_4800 | SERIAL_BAUD_7200
| SERIAL_BAUD_9600 | SERIAL_BAUD_14400 | SERIAL_BAUD_19200 | SERIAL_BAUD_38400
| SERIAL_BAUD_56K | SERIAL_BAUD_57600 | SERIAL_BAUD_115200 | SERIAL_BAUD_128K
| SERIAL_BAUD_USER;
| SERIAL_BAUD_9600 | SERIAL_BAUD_USER;
pCommProp->MaxBaud = SERIAL_BAUD_9600;
if (DeviceExtension->UartType >= Uart16450)
{
pCommProp->SettableBaud |= SERIAL_BAUD_14400 | SERIAL_BAUD_19200 | SERIAL_BAUD_38400;
pCommProp->MaxBaud = SERIAL_BAUD_38400;
}
if (DeviceExtension->UartType >= Uart16550)
{
pCommProp->SettableBaud |= SERIAL_BAUD_56K | SERIAL_BAUD_57600 | SERIAL_BAUD_115200 | SERIAL_BAUD_128K;
pCommProp->MaxBaud = SERIAL_BAUD_115200;
}
pCommProp->SettableData = SERIAL_DATABITS_5 | SERIAL_DATABITS_6 | SERIAL_DATABITS_7 | SERIAL_DATABITS_8;
pCommProp->SettableStopParity = SERIAL_STOPBITS_10 | SERIAL_STOPBITS_15 | SERIAL_STOPBITS_20
| SERIAL_PARITY_NONE | SERIAL_PARITY_ODD | SERIAL_PARITY_EVEN | SERIAL_PARITY_MARK | SERIAL_PARITY_SPACE;
@@ -217,9 +265,21 @@ SerialGetCommStatus(
{
KIRQL Irql;
ASSERT(pSerialStatus);
RtlZeroMemory(pSerialStatus, sizeof(SERIAL_STATUS));
pSerialStatus->Errors = 0; /* FIXME */
pSerialStatus->Errors = 0;
if (DeviceExtension->BreakInterruptErrorCount)
pSerialStatus->Errors |= SERIAL_ERROR_BREAK;
if (DeviceExtension->SerialPerfStats.FrameErrorCount)
pSerialStatus->Errors |= SERIAL_ERROR_FRAMING;
if (DeviceExtension->SerialPerfStats.SerialOverrunErrorCount)
pSerialStatus->Errors |= SERIAL_ERROR_OVERRUN;
if (DeviceExtension->SerialPerfStats.BufferOverrunErrorCount)
pSerialStatus->Errors |= SERIAL_ERROR_QUEUEOVERRUN;
if (DeviceExtension->SerialPerfStats.ParityErrorCount)
pSerialStatus->Errors |= SERIAL_ERROR_PARITY;
pSerialStatus->HoldReasons = 0; /* FIXME */
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
@@ -232,8 +292,8 @@ SerialGetCommStatus(
- DeviceExtension->OutputBuffer.ReadPosition) % DeviceExtension->OutputBuffer.Length;
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
pSerialStatus->EofReceived = FALSE; /* FIXME */
pSerialStatus->WaitForImmediate = FALSE; /* FIXME */
pSerialStatus->EofReceived = FALSE; /* always FALSE */
pSerialStatus->WaitForImmediate = FALSE; /* always FALSE */
return STATUS_SUCCESS;
}
@@ -244,27 +304,27 @@ SerialDeviceControl(
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
ULONG IoControlCode;
PSERIAL_DEVICE_EXTENSION DeviceExtension;
ULONG LengthIn, LengthOut;
ULONG Information = 0;
PUCHAR Buffer;
ULONG_PTR Information = 0;
PVOID BufferIn, BufferOut;
PUCHAR ComPortBase;
NTSTATUS Status;
DPRINT("Serial: IRP_MJ_DEVICE_CONTROL dispatch\n");
/* FIXME: pend operation if possible */
Stack = IoGetCurrentIrpStackLocation(Irp);
LengthIn = Stack->Parameters.DeviceIoControl.InputBufferLength;
LengthOut = Stack->Parameters.DeviceIoControl.OutputBufferLength;
Buffer = Irp->AssociatedIrp.SystemBuffer;
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
IoControlCode = Stack->Parameters.DeviceIoControl.IoControlCode;
SerialGetUserBuffers(Irp, IoControlCode, &BufferIn, &BufferOut);
/* FIXME: need to probe buffers */
/* FIXME: see http://www.osronline.com/ddkx/serial/serref_61bm.htm */
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
switch (IoControlCode)
{
case IOCTL_SERIAL_CLEAR_STATS:
{
@@ -272,7 +332,7 @@ SerialDeviceControl(
KeSynchronizeExecution(
DeviceExtension->Interrupt,
(PKSYNCHRONIZE_ROUTINE)SerialClearPerfStats,
&DeviceExtension->SerialPerfStats);
DeviceExtension);
Status = STATUS_SUCCESS;
break;
}
@@ -281,9 +341,13 @@ SerialDeviceControl(
DPRINT("Serial: IOCTL_SERIAL_CLR_DTR\n");
/* FIXME: If the handshake flow control of the device is configured to
* automatically use DTR, return STATUS_INVALID_PARAMETER */
DeviceExtension->MCR &= ~SR_MCR_DTR;
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
Status = STATUS_SUCCESS;
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
if (NT_SUCCESS(Status))
{
DeviceExtension->MCR &= ~SR_MCR_DTR;
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
}
break;
}
case IOCTL_SERIAL_CLR_RTS:
@@ -291,9 +355,13 @@ SerialDeviceControl(
DPRINT("Serial: IOCTL_SERIAL_CLR_RTS\n");
/* FIXME: If the handshake flow control of the device is configured to
* automatically use RTS, return STATUS_INVALID_PARAMETER */
DeviceExtension->MCR &= ~SR_MCR_RTS;
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
Status = STATUS_SUCCESS;
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
if (NT_SUCCESS(Status))
{
DeviceExtension->MCR &= ~SR_MCR_RTS;
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
}
break;
}
case IOCTL_SERIAL_CONFIG_SIZE:
@@ -301,11 +369,11 @@ SerialDeviceControl(
/* Obsolete on Microsoft Windows 2000+ */
PULONG pConfigSize;
DPRINT("Serial: IOCTL_SERIAL_CONFIG_SIZE\n");
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
pConfigSize = (PULONG)Buffer;
pConfigSize = (PULONG)BufferOut;
*pConfigSize = 0;
Status = STATUS_SUCCESS;
}
@@ -314,18 +382,17 @@ SerialDeviceControl(
case IOCTL_SERIAL_GET_BAUD_RATE:
{
DPRINT("Serial: IOCTL_SERIAL_GET_BAUD_RATE\n");
/* FIXME: HACK!!! following line MUST NOT be here! */
Buffer = Irp->UserBuffer;
if (LengthOut < sizeof(SERIAL_BAUD_RATE))
Status = STATUS_BUFFER_TOO_SMALL;
else if (Buffer == NULL)
else if (BufferOut == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
((PSERIAL_BAUD_RATE)Buffer)->BaudRate = DeviceExtension->BaudRate;
((PSERIAL_BAUD_RATE)BufferOut)->BaudRate = DeviceExtension->BaudRate;
Information = sizeof(SERIAL_BAUD_RATE);
Status = STATUS_SUCCESS;
}
break;
}
case IOCTL_SERIAL_GET_CHARS:
{
@@ -342,14 +409,14 @@ SerialDeviceControl(
DPRINT("Serial: return STATUS_BUFFER_TOO_SMALL\n");
Status = STATUS_BUFFER_TOO_SMALL;
}
else if (Buffer == NULL)
else if (BufferOut == NULL)
{
DPRINT("Serial: return STATUS_INVALID_PARAMETER\n");
Status = STATUS_INVALID_PARAMETER;
}
else
{
Status = SerialGetCommStatus((PSERIAL_STATUS)Buffer, DeviceExtension);
Status = SerialGetCommStatus((PSERIAL_STATUS)BufferOut, DeviceExtension);
Information = sizeof(SERIAL_STATUS);
}
break;
@@ -358,11 +425,11 @@ SerialDeviceControl(
{
PULONG pDtrRts;
DPRINT("Serial: IOCTL_SERIAL_GET_DTRRTS\n");
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
pDtrRts = (PULONG)Buffer;
pDtrRts = (PULONG)BufferOut;
*pDtrRts = 0;
if (DeviceExtension->MCR & SR_MCR_DTR)
*pDtrRts |= SERIAL_DTR_STATE;
@@ -384,11 +451,11 @@ SerialDeviceControl(
DPRINT("Serial: IOCTL_SERIAL_GET_LINE_CONTROL\n");
if (LengthOut < sizeof(SERIAL_LINE_CONTROL))
Status = STATUS_BUFFER_TOO_SMALL;
else if (Buffer == NULL)
else if (BufferOut == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
*((PSERIAL_LINE_CONTROL)Buffer) = DeviceExtension->SerialLineControl;
*((PSERIAL_LINE_CONTROL)BufferOut) = DeviceExtension->SerialLineControl;
Information = sizeof(SERIAL_LINE_CONTROL);
Status = STATUS_SUCCESS;
}
@@ -398,11 +465,11 @@ SerialDeviceControl(
{
PULONG pMCR;
DPRINT("Serial: IOCTL_SERIAL_GET_MODEM_CONTROL\n");
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
pMCR = (PULONG)Buffer;
pMCR = (PULONG)BufferOut;
*pMCR = DeviceExtension->MCR;
Status = STATUS_SUCCESS;
}
@@ -412,11 +479,11 @@ SerialDeviceControl(
{
PULONG pMSR;
DPRINT("Serial: IOCTL_SERIAL_GET_MODEMSTATUS\n");
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
pMSR = (PULONG)Buffer;
pMSR = (PULONG)BufferOut;
*pMSR = DeviceExtension->MSR;
Status = STATUS_SUCCESS;
}
@@ -430,14 +497,14 @@ SerialDeviceControl(
DPRINT("Serial: return STATUS_BUFFER_TOO_SMALL\n");
Status = STATUS_BUFFER_TOO_SMALL;
}
else if (Buffer == NULL)
else if (BufferOut == NULL)
{
DPRINT("Serial: return STATUS_INVALID_PARAMETER\n");
Status = STATUS_INVALID_PARAMETER;
}
else
{
Status = SerialGetCommProp((PSERIAL_COMMPROP)Buffer, DeviceExtension);
Status = SerialGetCommProp((PSERIAL_COMMPROP)BufferOut, DeviceExtension);
Information = sizeof(SERIAL_COMMPROP);
}
break;
@@ -450,7 +517,7 @@ SerialDeviceControl(
DPRINT("Serial: return STATUS_BUFFER_TOO_SMALL\n");
Status = STATUS_BUFFER_TOO_SMALL;
}
else if (Buffer == NULL)
else if (BufferOut == NULL)
{
DPRINT("Serial: return STATUS_INVALID_PARAMETER\n");
Status = STATUS_INVALID_PARAMETER;
@@ -467,11 +534,11 @@ SerialDeviceControl(
case IOCTL_SERIAL_GET_TIMEOUTS:
{
DPRINT("Serial: IOCTL_SERIAL_GET_TIMEOUTS\n");
if (LengthOut != sizeof(SERIAL_TIMEOUTS) || Buffer == NULL)
if (LengthOut != sizeof(SERIAL_TIMEOUTS) || BufferOut == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
*(PSERIAL_TIMEOUTS)Buffer = DeviceExtension->SerialTimeOuts;
*(PSERIAL_TIMEOUTS)BufferOut = DeviceExtension->SerialTimeOuts;
Status = STATUS_SUCCESS;
}
break;
@@ -480,11 +547,11 @@ SerialDeviceControl(
{
PULONG pWaitMask;
DPRINT("Serial: IOCTL_SERIAL_GET_WAIT_MASK\n");
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
pWaitMask = (PULONG)Buffer;
pWaitMask = (PULONG)BufferOut;
*pWaitMask = DeviceExtension->WaitMask;
Status = STATUS_SUCCESS;
}
@@ -506,21 +573,52 @@ SerialDeviceControl(
}
case IOCTL_SERIAL_PURGE:
{
KIRQL Irql1, Irql2;
KIRQL Irql;
DPRINT("Serial: IOCTL_SERIAL_PURGE\n");
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql1);
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql2);
DeviceExtension->InputBuffer.ReadPosition = DeviceExtension->InputBuffer.WritePosition = 0;
DeviceExtension->OutputBuffer.ReadPosition = DeviceExtension->OutputBuffer.WritePosition = 0;
/* Clear receive/transmit buffers */
if (DeviceExtension->UartType >= Uart16550)
/* FIXME: SERIAL_PURGE_RXABORT and SERIAL_PURGE_TXABORT
* should stop current request */
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
WRITE_PORT_UCHAR(SER_FCR(ComPortBase),
SR_FCR_CLEAR_RCVR | SR_FCR_CLEAR_XMIT);
ULONG PurgeMask = *(PULONG)BufferIn;
Status = STATUS_SUCCESS;
/* FIXME: use SERIAL_PURGE_RXABORT and SERIAL_PURGE_TXABORT flags */
if (PurgeMask & SERIAL_PURGE_RXCLEAR)
{
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
DeviceExtension->InputBuffer.ReadPosition = DeviceExtension->InputBuffer.WritePosition = 0;
if (DeviceExtension->UartType >= Uart16550A)
{
/* Clear also Uart FIFO */
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
if (NT_SUCCESS(Status))
{
WRITE_PORT_UCHAR(SER_FCR(ComPortBase), SR_FCR_CLEAR_RCVR);
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
}
}
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
}
if (PurgeMask & SERIAL_PURGE_TXCLEAR)
{
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
DeviceExtension->OutputBuffer.ReadPosition = DeviceExtension->OutputBuffer.WritePosition = 0;
if (DeviceExtension->UartType >= Uart16550A)
{
/* Clear also Uart FIFO */
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
if (NT_SUCCESS(Status))
{
WRITE_PORT_UCHAR(SER_FCR(ComPortBase), SR_FCR_CLEAR_XMIT);
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
}
}
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
}
}
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql2);
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql1);
Status = STATUS_SUCCESS;
break;
}
case IOCTL_SERIAL_RESET_DEVICE:
@@ -534,11 +632,11 @@ SerialDeviceControl(
{
PULONG pNewBaudRate;
DPRINT("Serial: IOCTL_SERIAL_SET_BAUD_RATE\n");
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
pNewBaudRate = (PULONG)Buffer;
pNewBaudRate = (PULONG)BufferIn;
Status = SerialSetBaudRate(DeviceExtension, *pNewBaudRate);
}
break;
@@ -571,21 +669,31 @@ SerialDeviceControl(
DPRINT("Serial: IOCTL_SERIAL_SET_DTR\n");
if (!(DeviceExtension->MCR & SR_MCR_DTR))
{
DeviceExtension->MCR |= SR_MCR_DTR;
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
if (NT_SUCCESS(Status))
{
DeviceExtension->MCR |= SR_MCR_DTR;
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
}
}
Status = STATUS_SUCCESS;
else
Status = STATUS_SUCCESS;
break;
}
case IOCTL_SERIAL_SET_FIFO_CONTROL:
{
DPRINT("Serial: IOCTL_SERIAL_SET_FIFO_CONTROL\n");
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
WRITE_PORT_UCHAR(SER_FCR(ComPortBase), (UCHAR)((*(PULONG)Buffer) & 0xff));
Status = STATUS_SUCCESS;
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
if (NT_SUCCESS(Status))
{
WRITE_PORT_UCHAR(SER_FCR(ComPortBase), (UCHAR)((*(PULONG)BufferIn) & 0xff));
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
}
}
break;
}
@@ -601,24 +709,28 @@ SerialDeviceControl(
DPRINT("Serial: IOCTL_SERIAL_SET_LINE_CONTROL\n");
if (LengthIn < sizeof(SERIAL_LINE_CONTROL))
Status = STATUS_BUFFER_TOO_SMALL;
else if (Buffer == NULL)
else if (BufferIn == NULL)
Status = STATUS_INVALID_PARAMETER;
else
Status = SerialSetLineControl(DeviceExtension, (PSERIAL_LINE_CONTROL)Buffer);
Status = SerialSetLineControl(DeviceExtension, (PSERIAL_LINE_CONTROL)BufferIn);
break;
}
case IOCTL_SERIAL_SET_MODEM_CONTROL:
{
PULONG pMCR;
DPRINT("Serial: IOCTL_SERIAL_SET_MODEM_CONTROL\n");
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
pMCR = (PULONG)Buffer;
DeviceExtension->MCR = (UCHAR)(*pMCR & 0xff);
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
Status = STATUS_SUCCESS;
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
if (NT_SUCCESS(Status))
{
pMCR = (PULONG)BufferIn;
DeviceExtension->MCR = (UCHAR)(*pMCR & 0xff);
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
}
}
break;
}
@@ -626,22 +738,23 @@ SerialDeviceControl(
{
if (LengthIn < sizeof(SERIAL_QUEUE_SIZE ))
return STATUS_BUFFER_TOO_SMALL;
else if (Buffer == NULL)
else if (BufferIn == NULL)
return STATUS_INVALID_PARAMETER;
else
{
KIRQL Irql;
PSERIAL_QUEUE_SIZE NewQueueSize = (PSERIAL_QUEUE_SIZE)BufferIn;
Status = STATUS_SUCCESS;
if (((PSERIAL_QUEUE_SIZE)Buffer)->InSize > DeviceExtension->InputBuffer.Length)
if (NewQueueSize->InSize > DeviceExtension->InputBuffer.Length)
{
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
Status = IncreaseCircularBufferSize(&DeviceExtension->InputBuffer, ((PSERIAL_QUEUE_SIZE)Buffer)->InSize);
Status = IncreaseCircularBufferSize(&DeviceExtension->InputBuffer, NewQueueSize->InSize);
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
}
if (NT_SUCCESS(Status) && ((PSERIAL_QUEUE_SIZE)Buffer)->OutSize > DeviceExtension->OutputBuffer.Length)
if (NT_SUCCESS(Status) && NewQueueSize->OutSize > DeviceExtension->OutputBuffer.Length)
{
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
Status = IncreaseCircularBufferSize(&DeviceExtension->OutputBuffer, ((PSERIAL_QUEUE_SIZE)Buffer)->OutSize);
Status = IncreaseCircularBufferSize(&DeviceExtension->OutputBuffer, NewQueueSize->OutSize);
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
}
}
@@ -654,20 +767,26 @@ SerialDeviceControl(
DPRINT("Serial: IOCTL_SERIAL_SET_RTS\n");
if (!(DeviceExtension->MCR & SR_MCR_RTS))
{
DeviceExtension->MCR |= SR_MCR_RTS;
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
if (NT_SUCCESS(Status))
{
DeviceExtension->MCR |= SR_MCR_RTS;
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
}
}
Status = STATUS_SUCCESS;
else
Status = STATUS_SUCCESS;
break;
}
case IOCTL_SERIAL_SET_TIMEOUTS:
{
DPRINT("Serial: IOCTL_SERIAL_SET_TIMEOUTS\n");
if (LengthIn != sizeof(SERIAL_TIMEOUTS) || Buffer == NULL)
if (LengthIn != sizeof(SERIAL_TIMEOUTS) || BufferIn == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
DeviceExtension->SerialTimeOuts = *(PSERIAL_TIMEOUTS)Buffer;
DeviceExtension->SerialTimeOuts = *(PSERIAL_TIMEOUTS)BufferIn;
Status = STATUS_SUCCESS;
}
break;
@@ -676,11 +795,11 @@ SerialDeviceControl(
{
PULONG pWaitMask;
DPRINT("Serial: IOCTL_SERIAL_SET_WAIT_MASK\n");
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
Status = STATUS_INVALID_PARAMETER;
else
{
pWaitMask = (PULONG)Buffer;
pWaitMask = (PULONG)BufferIn;
DeviceExtension->WaitMask = *pWaitMask;
Status = STATUS_SUCCESS;
}

View File

@@ -20,7 +20,7 @@ SerialQueryInformation(
PIO_STACK_LOCATION Stack;
PVOID SystemBuffer;
ULONG BufferLength;
ULONG Information = 0;
ULONG_PTR Information = 0;
NTSTATUS Status;
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
@@ -37,12 +37,13 @@ SerialQueryInformation(
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FileStandardInformation\n");
if (BufferLength < sizeof(FILE_STANDARD_INFORMATION))
Status = STATUS_BUFFER_OVERFLOW;
else
else if (!StandardInfo)
Status = STATUS_INVALID_PARAMETER;
{
StandardInfo->AllocationSize.QuadPart = 0;
StandardInfo->EndOfFile.QuadPart = 0;
StandardInfo->Directory = FALSE;
StandardInfo->NumberOfLinks = 0;
StandardInfo->Directory = FALSE;
StandardInfo->NumberOfLinks = 0;
StandardInfo->DeletePending = FALSE; /* FIXME: should be TRUE sometimes */
Status = STATUS_SUCCESS;
}
@@ -52,9 +53,13 @@ SerialQueryInformation(
{
PFILE_POSITION_INFORMATION PositionInfo = (PFILE_POSITION_INFORMATION)SystemBuffer;
ASSERT(PositionInfo);
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FilePositionInformation\n");
if (BufferLength < sizeof(PFILE_POSITION_INFORMATION))
Status = STATUS_BUFFER_OVERFLOW;
else if (!PositionInfo)
Status = STATUS_INVALID_PARAMETER;
else
{
PositionInfo->CurrentByteOffset.QuadPart = 0;

View File

@@ -1,180 +1,194 @@
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/bus/serial/legacy.c
* PURPOSE: Legacy serial port enumeration
*
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
* Mark Junker (mjscod@gmx.de)
*/
#define NDEBUG
#include "serial.h"
UART_TYPE
SerialDetectUartType(
IN PUCHAR BaseAddress)
{
UCHAR Lcr, TestLcr;
UCHAR OldScr, Scr5A, ScrA5;
BOOLEAN FifoEnabled;
UCHAR NewFifoStatus;
Lcr = READ_PORT_UCHAR(SER_LCR(BaseAddress));
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr ^ 0xFF);
TestLcr = READ_PORT_UCHAR(SER_LCR(BaseAddress)) ^ 0xFF;
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr);
/* Accessing the LCR must work for a usable serial port */
if (TestLcr != Lcr)
return UartUnknown;
/* Ensure that all following accesses are done as required */
READ_PORT_UCHAR(SER_RBR(BaseAddress));
READ_PORT_UCHAR(SER_IER(BaseAddress));
READ_PORT_UCHAR(SER_IIR(BaseAddress));
READ_PORT_UCHAR(SER_LCR(BaseAddress));
READ_PORT_UCHAR(SER_MCR(BaseAddress));
READ_PORT_UCHAR(SER_LSR(BaseAddress));
READ_PORT_UCHAR(SER_MSR(BaseAddress));
READ_PORT_UCHAR(SER_SCR(BaseAddress));
/* Test scratch pad */
OldScr = READ_PORT_UCHAR(SER_SCR(BaseAddress));
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0x5A);
Scr5A = READ_PORT_UCHAR(SER_SCR(BaseAddress));
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0xA5);
ScrA5 = READ_PORT_UCHAR(SER_SCR(BaseAddress));
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), OldScr);
/* When non-functional, we have a 8250 */
if (Scr5A != 0x5A || ScrA5 != 0xA5)
return Uart8250;
/* Test FIFO type */
FifoEnabled = (READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0x80) != 0;
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), SR_FCR_ENABLE_FIFO);
NewFifoStatus = READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0xC0;
if (!FifoEnabled)
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), 0);
switch (NewFifoStatus)
{
case 0x00:
return Uart16450;
case 0x80:
return Uart16550;
}
/* FIFO is only functional for 16550A+ */
return Uart16550A;
}
NTSTATUS
DetectLegacyDevice(
IN PDRIVER_OBJECT DriverObject,
IN ULONG ComPortBase,
IN ULONG Irq)
{
ULONG ResourceListSize;
PCM_RESOURCE_LIST ResourceList;
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
BOOLEAN ConflictDetected;
UART_TYPE UartType;
PDEVICE_OBJECT Pdo = NULL;
PDEVICE_OBJECT Fdo;
KIRQL Dirql;
NTSTATUS Status;
/* Create resource list */
ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
if (!ResourceList)
return STATUS_INSUFFICIENT_RESOURCES;
ResourceList->Count = 1;
ResourceList->List[0].InterfaceType = Isa;
ResourceList->List[0].BusNumber = -1; /* FIXME */
ResourceList->List[0].PartialResourceList.Version = 1;
ResourceList->List[0].PartialResourceList.Revision = 1;
ResourceList->List[0].PartialResourceList.Count = 2;
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
ResourceDescriptor->Type = CmResourceTypePort;
ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
ResourceDescriptor->u.Port.Start.u.LowPart = ComPortBase;
ResourceDescriptor->u.Port.Length = 8;
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[1];
ResourceDescriptor->Type = CmResourceTypeInterrupt;
ResourceDescriptor->ShareDisposition = CmResourceShareShared;
ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector(
Internal, 0, 0, Irq,
&Dirql,
&ResourceDescriptor->u.Interrupt.Affinity);
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
/* Report resource list */
Status = IoReportResourceForDetection(
DriverObject, ResourceList, ResourceListSize,
NULL, NULL, 0,
&ConflictDetected);
if (Status == STATUS_CONFLICTING_ADDRESSES)
return STATUS_DEVICE_NOT_CONNECTED;
if (!NT_SUCCESS(Status))
return Status;
/* Test if port exists */
UartType = SerialDetectUartType((PUCHAR)ComPortBase);
/* Report device if detected... */
if (UartType != UartUnknown)
{
Status = IoReportDetectedDevice(
DriverObject,
ResourceList->List[0].InterfaceType, ResourceList->List[0].BusNumber, -1/*FIXME*/,
ResourceList, NULL,
TRUE,
&Pdo);
if (NT_SUCCESS(Status))
{
Status = SerialAddDeviceInternal(DriverObject, Pdo, UartType, &Fdo);
if (NT_SUCCESS(Status))
{
Status = SerialPnpStartDevice(Fdo, ResourceList);
}
}
}
else
{
/* Release resources */
Status = IoReportResourceForDetection(
DriverObject, NULL, 0,
NULL, NULL, 0,
&ConflictDetected);
Status = STATUS_DEVICE_NOT_CONNECTED;
}
return Status;
}
NTSTATUS
DetectLegacyDevices(
IN PDRIVER_OBJECT DriverObject)
{
ULONG ComPortBase[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
ULONG Irq[] = { 4, 3, 4, 3 };
ULONG i;
NTSTATUS Status;
NTSTATUS ReturnedStatus = STATUS_SUCCESS;
for (i = 0; i < sizeof(ComPortBase)/sizeof(ComPortBase[0]); i++)
{
Status = DetectLegacyDevice(DriverObject, ComPortBase[i], Irq[i]);
if (!NT_SUCCESS(Status) && Status != STATUS_DEVICE_NOT_CONNECTED)
ReturnedStatus = Status;
DPRINT("Serial: Legacy device at 0x%x (IRQ %lu): status = 0x%08lx\n", ComPortBase[i], Irq[i], Status);
}
return ReturnedStatus;
}
/* $Id:
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/bus/serial/legacy.c
* PURPOSE: Legacy serial port enumeration
*
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
* Mark Junker (mjscod@gmx.de)
*/
#define NDEBUG
#include "serial.h"
UART_TYPE
SerialDetectUartType(
IN PUCHAR BaseAddress)
{
UCHAR Lcr, TestLcr;
UCHAR OldScr, Scr5A, ScrA5;
BOOLEAN FifoEnabled;
UCHAR NewFifoStatus;
Lcr = READ_PORT_UCHAR(SER_LCR(BaseAddress));
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr ^ 0xFF);
TestLcr = READ_PORT_UCHAR(SER_LCR(BaseAddress)) ^ 0xFF;
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr);
/* Accessing the LCR must work for a usable serial port */
if (TestLcr != Lcr)
return UartUnknown;
/* Ensure that all following accesses are done as required */
READ_PORT_UCHAR(SER_RBR(BaseAddress));
READ_PORT_UCHAR(SER_IER(BaseAddress));
READ_PORT_UCHAR(SER_IIR(BaseAddress));
READ_PORT_UCHAR(SER_LCR(BaseAddress));
READ_PORT_UCHAR(SER_MCR(BaseAddress));
READ_PORT_UCHAR(SER_LSR(BaseAddress));
READ_PORT_UCHAR(SER_MSR(BaseAddress));
READ_PORT_UCHAR(SER_SCR(BaseAddress));
/* Test scratch pad */
OldScr = READ_PORT_UCHAR(SER_SCR(BaseAddress));
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0x5A);
Scr5A = READ_PORT_UCHAR(SER_SCR(BaseAddress));
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0xA5);
ScrA5 = READ_PORT_UCHAR(SER_SCR(BaseAddress));
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), OldScr);
/* When non-functional, we have a 8250 */
if (Scr5A != 0x5A || ScrA5 != 0xA5)
return Uart8250;
/* Test FIFO type */
FifoEnabled = (READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0x80) != 0;
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), SR_FCR_ENABLE_FIFO);
NewFifoStatus = READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0xC0;
if (!FifoEnabled)
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), 0);
switch (NewFifoStatus)
{
case 0x00:
return Uart16450;
case 0x40:
case 0x80:
/* Not sure about this but the documentation says that 0x40
* indicates an unusable FIFO but my tests only worked
* with 0x80 */
return Uart16550;
}
/* FIFO is only functional for 16550A+ */
return Uart16550A;
}
static NTSTATUS
DetectLegacyDevice(
IN PDRIVER_OBJECT DriverObject,
IN ULONG ComPortBase,
IN ULONG Irq,
IN PULONG pComPortNumber OPTIONAL)
{
ULONG ResourceListSize;
PCM_RESOURCE_LIST ResourceList;
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
BOOLEAN ConflictDetected;
UART_TYPE UartType;
PDEVICE_OBJECT Pdo = NULL;
PDEVICE_OBJECT Fdo;
KIRQL Dirql;
NTSTATUS Status;
/* Create resource list */
ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
if (!ResourceList)
return STATUS_INSUFFICIENT_RESOURCES;
ResourceList->Count = 1;
ResourceList->List[0].InterfaceType = InterfaceTypeUndefined;
ResourceList->List[0].BusNumber = -1; /* unknown */
ResourceList->List[0].PartialResourceList.Version = 1;
ResourceList->List[0].PartialResourceList.Revision = 1;
ResourceList->List[0].PartialResourceList.Count = 2;
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
ResourceDescriptor->Type = CmResourceTypePort;
ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
ResourceDescriptor->u.Port.Start.u.LowPart = ComPortBase;
ResourceDescriptor->u.Port.Length = 8;
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[1];
ResourceDescriptor->Type = CmResourceTypeInterrupt;
ResourceDescriptor->ShareDisposition = CmResourceShareShared;
ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector(
Internal, 0, 0, Irq,
&Dirql,
&ResourceDescriptor->u.Interrupt.Affinity);
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
/* Report resource list */
Status = IoReportResourceForDetection(
DriverObject, ResourceList, ResourceListSize,
NULL, NULL, 0,
&ConflictDetected);
if (Status == STATUS_CONFLICTING_ADDRESSES)
{
DPRINT("Serial: conflict detected for serial port at 0x%lx (Irq %lu)\n", ComPortBase, Irq);
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
return STATUS_DEVICE_NOT_CONNECTED;
}
if (!NT_SUCCESS(Status))
{
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
return Status;
}
/* Test if port exists */
UartType = SerialDetectUartType((PUCHAR)ComPortBase);
/* Report device if detected... */
if (UartType != UartUnknown)
{
Status = IoReportDetectedDevice(
DriverObject,
ResourceList->List[0].InterfaceType, ResourceList->List[0].BusNumber, -1 /* unknown */,
ResourceList, NULL,
TRUE,
&Pdo);
if (NT_SUCCESS(Status))
{
Status = SerialAddDeviceInternal(DriverObject, Pdo, UartType, pComPortNumber, &Fdo);
if (NT_SUCCESS(Status))
{
Status = SerialPnpStartDevice(Fdo, ResourceList);
}
}
}
else
{
/* Release resources */
Status = IoReportResourceForDetection(
DriverObject, NULL, 0,
NULL, NULL, 0,
&ConflictDetected);
Status = STATUS_DEVICE_NOT_CONNECTED;
}
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
return Status;
}
NTSTATUS
DetectLegacyDevices(
IN PDRIVER_OBJECT DriverObject)
{
ULONG ComPortBase[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
ULONG Irq[] = { 4, 3, 4, 3 };
ULONG ComPortNumber[] = { 1, 2, 3, 4 };
ULONG i;
NTSTATUS Status;
NTSTATUS ReturnedStatus = STATUS_SUCCESS;
for (i = 0; i < sizeof(ComPortBase)/sizeof(ComPortBase[0]); i++)
{
Status = DetectLegacyDevice(DriverObject, ComPortBase[i], Irq[i], &ComPortNumber[i]);
if (!NT_SUCCESS(Status) && Status != STATUS_DEVICE_NOT_CONNECTED)
ReturnedStatus = Status;
DPRINT("Serial: Legacy device at 0x%x (IRQ %lu): status = 0x%08lx\n", ComPortBase[i], Irq[i], Status);
}
return ReturnedStatus;
}

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