mirror of
https://github.com/reactos/reactos
synced 2025-10-07 08:52:45 +02:00
Compare commits
1 Commits
backups/pn
...
ReactOS-0.
Author | SHA1 | Date | |
---|---|---|---|
|
b83808650b |
9
reactos/.cvsignore
Normal file
9
reactos/.cvsignore
Normal file
@@ -0,0 +1,9 @@
|
||||
dist
|
||||
reactos
|
||||
*.sys
|
||||
*.exe
|
||||
*.dll
|
||||
*.a
|
||||
*.o
|
||||
*.d
|
||||
*.coff
|
4
reactos/.gdbinit
Normal file
4
reactos/.gdbinit
Normal file
@@ -0,0 +1,4 @@
|
||||
directory /mnt/windows/CvsHome/reactos/ntoskrnl
|
||||
symbol-file ntoskrnl/ntoskrnl.nostrip.exe -mapped
|
||||
set remotebaud 115200
|
||||
target remote com2
|
@@ -1,62 +1,24 @@
|
||||
ReactOS is available thanks to the work of
|
||||
In no particular order
|
||||
|
||||
Emanuele Aliberti <ea@iol.it>
|
||||
Robert Bergkvist <fragdance@hotmail.com>
|
||||
Hartmut Birr <hartmut.birr@gmx.de>
|
||||
Aleksey Bragin <aleksey@studiocerebral.com>
|
||||
Richard Campbell <eek2121@comcast.net>
|
||||
Gunnar Andre' Dalsnes <hardon@online.no>
|
||||
Arindam Das
|
||||
Boudewijn Dekker <ariadne@xs4all.nl>
|
||||
Robert Dickenson <robd@reactos.org>
|
||||
Marty Dill <mdill@uvic.ca>
|
||||
Jason Eager
|
||||
Steven Edwards <steven_ed4153@yahoo.com>
|
||||
Iwan Fatahi <i_fatahi@hotmail.com>
|
||||
Jason Filby <jasonfilby@yahoo.com>
|
||||
Martin Fuchs <martin-fuchs@gmx.net>
|
||||
Jurgen van Gael <jurgen.vangael@student.kuleuven.ac.be>
|
||||
Ge van Geldorp <ge@gse.nl>
|
||||
Andrew Greenwood <lists@silverblade.co.uk>
|
||||
Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
KJK::Hyperion <noog@libero.it>
|
||||
Eugene Ingerman <geneing@myrealbox.com>
|
||||
Rex Jolliff <rex@lvcablemodem.com>
|
||||
Guido de Jong
|
||||
Victor Kirhenshtein <sauros@iname.com>
|
||||
Eric Kohl <ekohl@rz-online.de>
|
||||
Hans Kremer
|
||||
Frederik Leemans
|
||||
Jean Michault
|
||||
Royce Mitchell III <royce3@ev1.net>
|
||||
Filip Navara <xnavara@volny.cz>
|
||||
Jim Noeth
|
||||
Mike Nordell ("tamlin")
|
||||
Hernan Ochoa
|
||||
Brian Palmer <brianp@sginet.com>
|
||||
Paolo Pantaleo <paolopan@freemail.it>
|
||||
Matt Pyne
|
||||
Phillip Susi <phreak@iag.net>
|
||||
James B. Tabor <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
|
||||
Mark Tempel <mtempel@visi.com>
|
||||
Vizzini <vizzini@plasmic.com>
|
||||
Mark Weaver <mark@npsl.co.uk>
|
||||
Thomas Weidenmueller <w3seek@users.sourceforge.net>
|
||||
Jason Weiler
|
||||
David Welch <welch@cwcom.net>
|
||||
Jonathan Wilson <jonwil@tpgi.com.au>
|
||||
Art Yerkes <ayerkes@speakeasy.net>
|
||||
|
||||
Graphic Design from
|
||||
|
||||
Everaldo (http://everaldo.com) for Explorer icons
|
||||
Rex Jolliff (rex@lvcablemodem.com)
|
||||
Boudewijn Dekker (ariadne@xs4all.nl)
|
||||
Eric Kohl (ekohl@rz-online.de)
|
||||
Emanuele Aliberti (ea@iol.it)
|
||||
David Welch (welch@cwcom.net)
|
||||
Iwan Fatahi (i_fatahi@hotmail.com)
|
||||
Robert Bergkvist (fragdance@hotmail.com)
|
||||
Victor Kirhenshtein (sauros@iname.com)
|
||||
Jason Filby (jasonfilby@yahoo.com)
|
||||
Brian Palmer (brianp@sginet.com)
|
||||
Phillip Susi (phreak@iag.net)
|
||||
Paolo Pantaleo (paolopan@freemail.it)
|
||||
Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
|
||||
Source and inspiration from
|
||||
|
||||
WINE (http://www.winehq.com)
|
||||
WinFree (http://www.stack.nl/~onno/win32/)
|
||||
Linux (http://www.kernel.org)
|
||||
XFree86 (http://www.xfree86.org/)
|
||||
|
||||
References (Rex's at least)
|
||||
|
||||
@@ -76,3 +38,4 @@ Richter, Jeffery. Advanced Windows, 3rd ed. Microsoft, 1997.
|
||||
Simon, Richard J. Windows NT Win32 API Superbible. Waite Group, 1996.
|
||||
Solomon, David A. Inside Windows NT, 2nd Ed. Microsoft, 1998.
|
||||
"The NT Insider." Open Systems Resources, 1999-2000.
|
||||
|
||||
|
530
reactos/ChangeLog
Normal file
530
reactos/ChangeLog
Normal file
@@ -0,0 +1,530 @@
|
||||
2002-07-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* rules.mak (RSYM): Define.
|
||||
* include/ddk/zwtypes.h (DebugDbgLoadSymbols): Add to enum
|
||||
_DEBUG_CONTROL_CODE.
|
||||
* include/ntdll/ldr.h (LDR_SYMBOL_INFO, LdrpLoadUserModuleSymbols): Add.
|
||||
(LdrLoadModuleSymbols): Remove.
|
||||
* include/ntos/kdbgsyms.h (ST_FILENAME, ST_FUNCTION,
|
||||
ST_LINENUMBER): Add.
|
||||
(SYMBOL). Make Name an ANSI_STRING.
|
||||
(IMAGE_SYMBOL_INFO, AreSymbolsParsed): Add.
|
||||
* lib/ntdll/ldr/startup.c (LdrInitializeThunk): Call
|
||||
LdrpLoadUserModuleSymbols() not LdrLoadModuleSymbols().
|
||||
* lib/ntdll/ldr/utils.c (LdrLoadModuleSymbols): Rename to
|
||||
LdrpLoadUserModuleSymbols.
|
||||
(LdrpLoadUserModuleSymbols): Use DebugDbgLoadSymbols debug control code.
|
||||
(LdrLoadDll): assert if out of memory.
|
||||
(LdrLoadDll): Call
|
||||
LdrpLoadUserModuleSymbols(), not LdrLoadModuleSymbols().
|
||||
* lib/ntdll/string/ctype.c (_pctype): #undef.
|
||||
* ntoskrnl/dbg/dbgctrl.c (NtSystemDebugControl): Call
|
||||
LdrLoadUserModuleSymbols on DebugDbgLoadSymbols.
|
||||
* ntoskrnl/include/internal/ldr.h (LdrGetAddressInformation): Add.
|
||||
* ntoskrnl/include/internal/module.h (MODULE_TEXT_SECTION): Make SymbolInfo
|
||||
an IMAGE_SYMBOL_INFO.
|
||||
* ntoskrnl/ke/i386/exp.c (LdrGetAddressInformation): Add prototype.
|
||||
(print_address): Change #ifdef KDBG to #ifdef DBG.
|
||||
(KiDoubleFaultHandler, KiDumpTrapFrame, KeDumpStackFrames): Dump
|
||||
one stack frame per line.
|
||||
* ntoskrnl/ke/i386/multiboot.S: Create pagetables for more kernel
|
||||
address space so larger modules can be passed from the boot loader.
|
||||
* ntoskrnl/ke/i386/usertrap.c (LdrGetAddressInformation): Add prototype.
|
||||
(print_user_address): Print symbols using LdrGetAddressInformation().
|
||||
* ntoskrnl/ldr/loader.c (SYMBOLFILE_HEADER, IMAGE_SYMBOL_INFO_CACHE,
|
||||
STAB_ENTRY, N_FUN, N_SLINE, N_SO, SymbolListHead): Add.
|
||||
(TAG_SYM_BUF): Remove.
|
||||
(LdrInitDebug): Remove unneeded code.
|
||||
(LdrInit1): Prepare for loading symbols.
|
||||
(LdrpReadLine, HexL, LdrpParseLine, LdrpLoadModuleSymbolsFromBuffer,
|
||||
LdrpLoadUserModuleSymbolsFromBuffer): Remove.
|
||||
(LdrpParseImageSymbols, LdrpGetFileName, LdrpGetFunctionName,
|
||||
LdrpGetLineNumber, LdrGetAddressInformation, LdrpLookupUserSymbolInfo): Add.
|
||||
(LdrpLoadModuleSymbols, LdrInitializeBootStartDriver): Change to use new
|
||||
symbol structures.
|
||||
(LdrLoadUserModuleSymbols): Cache symbol buffers.
|
||||
(LdrUnloadModuleSymbols): Implement.
|
||||
(LdrLoadModule, LdrUnloadModule): Change #ifdef KDBG to #ifdef DBG.
|
||||
(LdrPEProcessModule): Split a line into two lines.
|
||||
(LdrPEProcessModule): Setup for loading symbols.
|
||||
* ntoskrnl/ldr/sysdll.c (LdrpMapSystemDll): Open with FILE_SHARE_READ.
|
||||
* ntoskrnl/ps/process.c (PiFreeSymbols): Call LdrUnloadModuleSymbols() to
|
||||
free symbols.
|
||||
(PiDeleteProcess): Change #ifdef KDBG to #ifdef DBG.
|
||||
* ntoskrnl/rtl/ctype.c (_pctype): #undef.
|
||||
* ntoskrnl/rtl/string.c (strncpy): Terminate destination string.
|
||||
* tools/Makefile (rsym): Add target.
|
||||
* tools/helper.mk: Include config and use -g if DBG = 1.
|
||||
|
||||
2002-07-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* Makefile (install_before): Install system.hiv to correct location.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* subsys/win32k/include/callback.h: Fixed callback argument
|
||||
definitions.
|
||||
* subsys/win32k/ntuser/winpos.c: Implemented some more of the windows
|
||||
sizing/moving code.
|
||||
* subsys/win32k/ntuser/painting.c: Implemented some more of the
|
||||
window painting code.
|
||||
* subsys/win32k/objects/coord.c: Implemented LPtoDP and DPtoLP.
|
||||
* subsys/win32k/objects/region.c: Added stubs for some more
|
||||
region functions.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* ntoskrnl/ps/process.c (NtCreateProcess): Duplicate the
|
||||
process desktop handle as well.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* ntoskrnl/se/token.c: Don't call the ZwXXX variant of
|
||||
system calls when in system context.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* ntoskrnl/Makefile: Added file with MDA output code.
|
||||
* ntoskrnl/kd/kdebug.c: Recognize MDA as a destination for
|
||||
debug output.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* lib/user32/windows/defwnd.c: Implemented some more of the
|
||||
default window handler.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* lib/user32/misc/stubs.c: Removed some stubs to seperate files.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* lib/user32/user32.def: Export ScreenToClient otherwise we
|
||||
get problems when code in user32 tries to call it.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* include/win32k/region.h: Added prototypes for some missing
|
||||
region functions.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* include/win32k/ntuser.h: Added prototypes for some missing
|
||||
NtUserXXX functions.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* include/user32/wininternal.h: Added some constants for
|
||||
private GetDCEx styles that WINE needs.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* include/user32/callback.h: Fixed callbacks for messages with
|
||||
parameters.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* include/napi/win32.h (W32THREAD): Added pointer to the
|
||||
thread's desktop.
|
||||
* include/napi/win32.h (W32PROCESS): Removed handle table,
|
||||
added a pointer to the process's window station.
|
||||
* subsys/win32k/ntuser/guicheck.c (W32kGuiCheck): Reference
|
||||
a process's window station on the first win32k system call. Reference
|
||||
a thread's desktop on the first win32k system call.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* include/messages.h: Added some missing WM_XXX constants.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* drivers/dd/ide/makefile: Compiling with debugging messages
|
||||
needs libgcc to be linked in.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* iface/addsys/genw32k.c: Generate a variable with the
|
||||
number of system calls.
|
||||
* iface/native/genntdll.c: Generate a proper stack frame for
|
||||
the user system call stubs.
|
||||
* ntoskrnl/ke/i386/syscall.S: Generate a proper stack frame for
|
||||
the handler for system calls.
|
||||
|
||||
2002-07-04 David Welch <welch@computer2.darkstar.org>
|
||||
|
||||
* Makefile: Build the GUI startup application.
|
||||
* subsys/system/gstart/gstart.c: Application to start up
|
||||
the GUI.
|
||||
|
||||
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* tools/helper.mk: Make an import library a proper target
|
||||
depending on the .def file.
|
||||
|
||||
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* subsys/win32k/ntuser/window.c (NtUserGetWindowLong): Began
|
||||
implementation.
|
||||
|
||||
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* subsys/win32k/misc/object.c (ObmCreateHandle): Return the
|
||||
correct handle value.
|
||||
|
||||
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* subsys/win32k/makefile: Make win32k depend on the file containing
|
||||
the service table.
|
||||
|
||||
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/ke/i386/stkswitch.S (KeSwitchStackAndRet,
|
||||
KePushAndStackSwitchAndSysRet): Push one value only.
|
||||
* ntoskrnl/ps/w32call.c (NtCallbackReturn, NtW32Call): Moved
|
||||
these functions to a new file. Restore the old trap frame after
|
||||
returning from a callback.
|
||||
|
||||
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* lib/user32/windows/message.c (CallWindowProcA, CallWindowProcW):
|
||||
Convert message to Unicode or ASCII if necessary.
|
||||
|
||||
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* include/user32/callback.h: Added WM_CREATE and WM_NCCALCSIZE
|
||||
callbacks.
|
||||
* lib/user32/windows/window.c (User32SendCREATEMessageForKernel,
|
||||
User32SendNCCREATEMessageForKernel): Implemented.
|
||||
* subsys/win32k/ntuser/callback.c (W32kSendCREATEMessage):
|
||||
Implemented.
|
||||
|
||||
2002-06-18 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* include/structs.h: Added Unicode and ASCII versions of
|
||||
CREATESTRUCT.
|
||||
|
||||
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* tools/helper.mk: Make the install target depend on all the
|
||||
files to be installed.
|
||||
|
||||
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/ps/thread.c (NtCallbackReturn): Set TSS.Esp0 to the
|
||||
top of the old stack.
|
||||
* ntoskrnl/ps/thread.c (NtW32Call): Set TSS.Esp0 to the top of
|
||||
the new stack. Free the callback stack correctly. Don't copy
|
||||
portion of the trap frame that doesn't exist in non-v86-mode
|
||||
interrupts.
|
||||
* ntoskrnl/ps/thread.c (PsFreeCallbackStack): New function to
|
||||
free a stack allocated with PsAllocateCallbackStack.
|
||||
|
||||
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* drivers/dd/null/makefile: Commented out local LDFLAGS as
|
||||
these cause bad relocations in the stripped image.
|
||||
|
||||
2002-06-16 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* config: Corrected spelling error.
|
||||
|
||||
2002-06-11 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* subsys/system/winlogon/winlogon.c (WinMain): Check for
|
||||
failure when creating a window system.
|
||||
|
||||
2002-06-11 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/ob/handle.c (ObDuplicateObject): Added this internal
|
||||
function for duplicating objects.
|
||||
* ntoskrnl/ps/process.c (NtCreateProcess): Duplicate the parent
|
||||
process's window station to the child process.
|
||||
* ntoskrnl/ps/process.c (PsInitProcessManagement): Initialize the
|
||||
first process's window station.
|
||||
|
||||
2002-06-11 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/mm/marea.c (MmCreateMemoryArea): Initialise
|
||||
page operation structure members.
|
||||
* ntoskrnl/mm/pageop.c (MmReleasePageOp, MmGetPageOp): Increment
|
||||
or decrement the page operation count in the memory area.
|
||||
* ntoskrnl/mm/virtual.c (MmNotPresentFaultVirtualMemory,
|
||||
MmPageOutVirtualMemory): Check for a deleted memory area before
|
||||
handling the fault.
|
||||
* ntoskrnl/mm/virtual.c (MmFreeVirtualMemory): Wait for all
|
||||
page operations to finish before freeing the memory area.
|
||||
|
||||
2002-06-11 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/ke/i386/syscall.S (interrupt_handler2e): Corrected
|
||||
test for previous mode, upper 16-bit of CS on the stack after an
|
||||
interrupt are arbitary.
|
||||
|
||||
2002-06-11 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* lib/user32/misc/winsta.c: Cleaned up indentation.
|
||||
|
||||
2002-06-11 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* apps/tests/winhello/winhello.c (WinMain, MainWndProc):
|
||||
Cleaned up formatting, some more error checks.
|
||||
|
||||
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/mm/virtual.c (MmSecureVirtualMemory,
|
||||
MmUnsecureVirtualMemory, NtQueryVirtualMemory): Corrected indentation.
|
||||
|
||||
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/ke/i386/exp.c (KiDoubleFaultHandler): Print CR3
|
||||
correctly.
|
||||
|
||||
2002-06-04 David Welch <welch@whitehall1-5.seh.ox.ac.uk>
|
||||
|
||||
* ntoskrnl/include/internal/ps.h: Added KTHREAD_STACK_LIMIT definition.
|
||||
* ntoskrnl/ke/i386/tskswitch.S (Ki386ContextSwitch): Force all the
|
||||
pages of the kernel stack to be accessible from this process.
|
||||
|
||||
2002-06-04 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/cc/view.c (ReadCacheSegmentChain): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/cc/copy.c (CcRosCreateCacheSegment): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/cc/copy.c (CcFreeCachePage): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/include/internal/mm.h: Changed prototypes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/include/internal/ps.h (KPROCESS): Changed type of
|
||||
page directory base to PHYSICAL_ADDRESS.
|
||||
* ntoskrnl/include/internal/i386/mm.h: Changed prototypes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/ke/kthread.c (KeFreeStackPage): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/ke/kthread.c (KeInitializeThread): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/ke/process.c (KeAttachProcess, KeDetachProcess): Changes
|
||||
to use PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/ke/kernel.c (PcrPages, KeApplicationProcessorInit): Changes
|
||||
to use PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/balance.c (MM_ALLOCATION_REQUEST): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/balance.c (MmReleasePageMemoryConsumer): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/balance.c (MmRequestPageMemoryConsumer): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/cont.c (MmFreeContinuousPage): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/cont.c (MmAllocateContinuousAlignedMemory): Changes to
|
||||
use PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/freelist.c (MmTransferOwnershipPage,
|
||||
MmGetLRUFirstUserPage, MmGetLRUNextUserPage, MmGetContinuousPages,
|
||||
MmInitializePageList, MmSetFlagsPage, MmSetRmapListHeadPage,
|
||||
MmGetRmapListHeadPage, MmMarkPageMapped, MmMarkPageUnmapped,
|
||||
MmGetFlagsPage, MmSetSavedSwapEntryPage, MmGetSavedSwapEntryPage,
|
||||
MmReferencePage, MmGetReferenceCountPage, MmIsUsablePage,
|
||||
MmDereferencePage, MmGetLockCountPage, MmLockPage, MmUnlockPage,
|
||||
MmAllocPage): Changes to use PHYSICAL_ADDRESS type for physical
|
||||
addresses.
|
||||
* ntoskrnl/mm/iospace.c (MmMapIoSpace): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/kmap.c (ExAllocatePage, MiZeroPage, MiCopyFromUserPage,
|
||||
ExAllocatePageWithPhysPage): Changes to use PHYSICAL_ADDRESS type for
|
||||
physical addresses.
|
||||
* ntoskrnl/mm/marea.c (MmFreeMemoryArea): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/mdl.c (MmUnlockPages, MmMapLockedPages,
|
||||
MmProbeAndLockPages): Changes to use PHYSICAL_ADDRESS type for
|
||||
physical addresses.
|
||||
* ntoskrnl/mm/mm.c (MmSharedDataPagePhysicalAddress,
|
||||
MmCommitPagedPoolAddress, MmNotPresentFault): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/mminit.c (MmInitVirtualMemory): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/ncache.c (MmAllocateNonCachedMemory,
|
||||
MmFreeNonCachedPage): Changes to use PHYSICAL_ADDRESS type for
|
||||
physical addresses.
|
||||
* ntoskrnl/mm/npool.c (grow_kernel_pool): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/rmap.c (MmPageOutPhysicalAddress, MmInsertRmap,
|
||||
MmDeleteAllRmaps, MmDeleteRmap): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/section.c (MiReadPage, MmNotPresentFaultSectionView,
|
||||
MmAccessFaultSectionView, MmPageOutDeleteMapping,
|
||||
MmPageOutSectionView, MmFreeSectionPage): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical addresses.
|
||||
* ntoskrnl/mm/slab.c (ExGrowSlabCache): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical address.
|
||||
* ntoskrnl/mm/virtual.c (MmPageOutVirtualMemory,
|
||||
MmNotPresentFaultVirtualMemory, MmFreeVirtualMemoryPage): Changes to
|
||||
use PHYSICAL_ADDRESS type for physical address.
|
||||
* ntoskrnl/mm/wset.c (MmTrimUserMemory): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical address.
|
||||
* ntoskrnl/mm/page.c (Mmi386ReleaseMmInfo, MmCopyMmInfo,
|
||||
MmGetPhysicalAddressForProcess, MmCreateVirtualMapping,
|
||||
MmCreateVirtualMappingUnsafe, MmCreateVirtualMappingForProcess,
|
||||
MmDeleteVirtualMapping): Changes to use PHYSICAL_ADDRESS type for
|
||||
physical address.
|
||||
* ntoskrnl/ps/process (PsInitProcessManagment): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical address.
|
||||
* ntoskrnl/ps/thread.c (PsAllocateCallbackStack): Changes to use
|
||||
PHYSICAL_ADDRESS type for physical address.
|
||||
|
||||
2002-06-04 David Welch <welch@cwcom.net>
|
||||
|
||||
* Lots of change since the ChangeLog was last updated.
|
||||
|
||||
2001-03-18 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/ke/apc.c (KiDeliverApc): Bug fix.
|
||||
* ntoskrnl/ke/apc.c (KeInsertQueueApc): More comments.
|
||||
* ntoskrnl/ke/catch.c (KiDispatchException): Bug fix.
|
||||
* ntoskrnl/ke/timer.c (KeDelayExecutionThread): Don't use removed
|
||||
function KeAddTimeoutThread.
|
||||
* ntoskrnl/ke/timer.c (KeAddTimeoutThread): Removed.
|
||||
* ntoskrnl/ke/wait.c (KeWaitForSingleObject, KeWaitForMultipleObjects):
|
||||
Don't use KeAddTimeoutThread.
|
||||
* ntoskrnl/mm/freelist.c (MmAllocateContiguousAlignedMemory): Bug fix
|
||||
* ntoskrnl/mm/freelist.c (MmAllocatePage): Allocate from the top
|
||||
memory.
|
||||
|
||||
2001-03-17 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/ke/catch.c (KiDispatchException): Implementation of
|
||||
exception handling, user-mode only.
|
||||
|
||||
2001-03-16 David Welch <welch@cwcom.net>
|
||||
|
||||
* include/ddk/zw.h: Corrected declarations of NtCreateProfile,
|
||||
NtQueryIntervalProfile, NtSetIntervalProfile.
|
||||
* include/ddk/zwtypes.h: Added definitions of KPROFILE_SOURCE.
|
||||
* ntoskrnl/include/internal/ke.h: Added the interrupted EIP as a
|
||||
parameter to KiUpdateSystemTime for profiling purposes.
|
||||
* ntoskrnl/include/internal/nt: Added declaration for profiling
|
||||
support initialization.
|
||||
* ntoskrnl/ke/timer.c (KiUpdateSystemTime, KeExpireTimers): Call
|
||||
the profiling code on a timer interrupt with the interrupt EIP.
|
||||
* ntoskrnl/ke/i386/irq.c (KiDispatchInterrupt): Pass the interrupted
|
||||
EIP to KiUpdateSystemTime.
|
||||
* ntoskrnl/mm/virtual.c (NtReadVirtualMemory, NtWriteVirtualMemory):
|
||||
Release the MDLs used properly.
|
||||
* ntoskrnl/nt/nt.c: Call the profiling support initialization.
|
||||
* ntoskrnl/nt/ntevent.c (NtCreateEvent): Don't try copying the
|
||||
ObjectAttributes parameter if it is NULL.
|
||||
* ntoskrnl/nt/profile.c: Implemented profiling.
|
||||
|
||||
2001-03-16 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/include/internal/safe.h: Corrected typo.
|
||||
* ntoskrnl/nt/ntevent.c (NtCreateEvent, NtOpenEvent, NtQueryEvent):
|
||||
Corrected typos.
|
||||
* ntoskrnl/rtl/mem.c: Missing header file.
|
||||
|
||||
2001-03-16 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/include/internal/safe.h: Add definitions for handling
|
||||
potentially unsafe pointers.
|
||||
|
||||
2001-03-16 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/include/internal/mm.h: Removed MmSafeCopyToUser and
|
||||
MmSafeCopyFromUser as source files need these but don't want internal
|
||||
mm definitions.
|
||||
* ntoskrnl/nt/ntevent.c (NtCreateEvent, NtOpenEvent, NtPulseEvent,
|
||||
NtQueryEvent, NtResetEvent, NtSetEvent): Copy data to and from
|
||||
user mode safely.
|
||||
* ntoskrnl/rtl/mem.c (MmCopyToCaller, MmCopyFromCaller): Helper
|
||||
functions for copying data to and from potentially unsafe pointers.
|
||||
|
||||
2000-12-23 David Welch <welch@cwcom.net>
|
||||
|
||||
* All task switching is done in software.
|
||||
* Beginnings of v86 mode support.
|
||||
|
||||
2000-12-22 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/ps/kill.c (PiTerminateProcessThreads): Drop
|
||||
PiThreadListLock before calling PsTerminateOtherThread
|
||||
|
||||
2000-12-16 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/ex/fmutex.c (ExReleaseFastMutexUnsafe): Only set the
|
||||
fast mutex's owner back to NULL if it is being released
|
||||
|
||||
2000-12-10 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/ke/i386/vm86_sup.S (Ki386RetToV86Mode): Added function
|
||||
to do the raw switch to v86 mode.
|
||||
* ntoskrnl/include/internal/vm86.h: Definitions for the v86 mode
|
||||
support.
|
||||
|
||||
2000-12-10 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/ke/i386/trap.s (PsBeginThreadWithContextInternal): Moved
|
||||
to ntoskrnl/ke/i386/bswitch.S.
|
||||
* ntoskrnl/ke/i386/trap.s (interrupt_handler2e): Moved to
|
||||
ntoskrnl/ke/i386/syscall.S.
|
||||
* ntoskrnl/ke/i386/trap.s (old_interrupt_handler2e): Removed.
|
||||
|
||||
2000-12-04 David Welch <welch@cwcom.net>
|
||||
|
||||
* ntoskrnl/ke/i386/irq.c (KiInterruptDispatch): Record the last PC
|
||||
value for a rescheduled thread.
|
||||
* ntoskrnl/ke/i386/irqhand.s: Construct a primitive trap frame
|
||||
in interrupt handlers.
|
||||
|
||||
2000-08-30 David Welch <welch@cwcom.net>
|
||||
|
||||
* Added calibration of KeStallExecutionProcessor timing
|
||||
(code from linux 2.2.16).
|
||||
|
||||
* Corrected compilation bugs in user32 library.
|
||||
|
||||
* Corrected compilation bugs related to anonymous structs
|
||||
in ndis code.
|
||||
|
||||
* Pass command line to kernel from loadros.
|
||||
|
||||
* Corrected PIC mask calculation.
|
||||
|
||||
2000-05-27 David Welch <welch@cwcom.net>
|
||||
|
||||
* Fixed issue with closing non-existent or already closed
|
||||
handle.
|
||||
|
||||
2000-01-26 David Welch <welch@cwcom.net>
|
||||
|
||||
* ZwCreateProcess now maps ntdll rather than the user-mode
|
||||
code.
|
||||
|
||||
1999-09-06 David Welch <welch@cwcom.net>
|
||||
|
||||
* Implemented ZwOpenProcess.
|
||||
|
||||
* Partially implemented killing other threads (possible memory
|
||||
leaks).
|
||||
|
||||
* Made a start on a proper implemention of APCs (based on
|
||||
article in NT insider).
|
||||
|
||||
1998-12-08 David Welch <welch@cwcom.net>
|
||||
|
||||
* Corrected bug in shell (Read two keypresses and assumed they
|
||||
where the key going up and down respectively).
|
||||
|
||||
* Corrected race in dpc handling.
|
||||
|
||||
* Took out cleanup sections in ZwReadFile (now handled by the
|
||||
APC).
|
||||
|
||||
* Disabled broken code in kernel32.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
211
reactos/Doxyfile
211
reactos/Doxyfile
@@ -1,211 +0,0 @@
|
||||
# Doxyfile 1.3.5
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = ReactOS
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = doxy-doc
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = .
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = YES
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = hal \
|
||||
subsys \
|
||||
services \
|
||||
regtests \
|
||||
iface
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE = subsys/win32k \
|
||||
subsys/system/explorer
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = YES
|
||||
RTF_HYPERLINKS = YES
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = NO
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = include
|
||||
INCLUDE_FILE_PATTERNS = *.h
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
@@ -1,17 +1,14 @@
|
||||
1. Build environment
|
||||
|
||||
To build the system you need either mingw32 installed on Windows or a mingw32
|
||||
cross compiler running on unix. You may obtain MinGW binaries that build
|
||||
ReactOS from http://www.reactos.com.
|
||||
cross compiler running on unix.
|
||||
|
||||
|
||||
2. Building ReactOS
|
||||
|
||||
To build from Windows run 'make' (wihout the quotes) from the top directory.
|
||||
To build from unix, edit rules.mak and change the PREFIX variable to the
|
||||
correct value for your cross-compiler. Run 'export HOST=mingw32-linux' to
|
||||
tell the ReactOS build system that it is building ReactOS on a linux machine.
|
||||
Now run 'make'.
|
||||
correct value for your cross-compiler, then run 'make'.
|
||||
|
||||
|
||||
3. Installation
|
||||
@@ -46,9 +43,7 @@ If you are on linux this could be:
|
||||
INSTALL_DIR = /mnt/windows/reactos
|
||||
|
||||
Save the changes to rules.mak and run 'make install' to install the files to
|
||||
the new location. If you don't want to change rules.mak, you can specify the
|
||||
installtion directory when invoking make. Run
|
||||
'make INSTALL_DIR=c:\reactos install' to install to c:\reactos.
|
||||
the new location.
|
||||
|
||||
|
||||
3.2 Installation from binany distribution
|
||||
@@ -60,7 +55,13 @@ to c:\reactos. Remember to extract the files with full paths.
|
||||
4. Booting ReactOS
|
||||
|
||||
Startup in DOS mode. 'cd' to c:\reactos and type 'boot' and press <enter>.
|
||||
A simple shell is started where you can use simple commands like 'cd' and 'dir'.
|
||||
ReactOS will now boot and when it has booted, you are asked for a username and
|
||||
password. Just press <enter> twice as ReactOS does not currently have user
|
||||
validation. A simple shell is started where you can use simple commands like
|
||||
'cd' and 'dir'.
|
||||
|
||||
You may also want to try running the enhanced shell, cmd.exe, found in
|
||||
the rosapps CVS module.
|
||||
|
||||
|
||||
5. Help
|
||||
|
@@ -1,5 +0,0 @@
|
||||
# Main jamfile for ReactOS
|
||||
|
||||
SubDir ROS_TOP ;
|
||||
|
||||
SubInclude ROS_TOP Lib ;
|
@@ -1,54 +0,0 @@
|
||||
# customization for ReactOS goes here
|
||||
|
||||
# The SharedLibrary and SharedLibraryFromObjects rules were
|
||||
# borrowed from here:
|
||||
# http://www.differentpla.net/~roger/devel/jam/tutorial/shared_lib/index.html
|
||||
|
||||
SUFSHR = .dll ;
|
||||
RM = rm ; # rm comes with MinGW, and the default del doesn't work in some cases
|
||||
|
||||
rule SharedLibrary
|
||||
{
|
||||
SharedLibraryFromObjects $(<) : $(>:S=$(SUFOBJ)) ;
|
||||
Objects $(>) ;
|
||||
}
|
||||
|
||||
rule SharedLibraryFromObjects
|
||||
{
|
||||
local _s _t ;
|
||||
|
||||
# Add grist to file names
|
||||
# Add suffix to dll
|
||||
|
||||
_s = [ FGristFiles $(>) ] ;
|
||||
_t = [ FAppendSuffix $(<) : $(SUFSHR) ] ;
|
||||
|
||||
if $(_t) != $(<)
|
||||
{
|
||||
DEPENDS $(<) : $(_t) ;
|
||||
NOTFILE $(<) ;
|
||||
}
|
||||
|
||||
# make compiled sources a dependency of target
|
||||
|
||||
DEPENDS exe : $(_t) ;
|
||||
DEPENDS $(_t) : $(_s) ;
|
||||
MakeLocate $(_t) : $(LOCATE_TARGET) ;
|
||||
|
||||
Clean clean : $(_t) ;
|
||||
|
||||
Link $(_t) : $(_s) ;
|
||||
}
|
||||
|
||||
# nasm needs to know the output file first, or it doesn't
|
||||
# recognize -I :(
|
||||
actions As
|
||||
{
|
||||
$(AS) -o $(<) $(ASFLAGS) -I$(HDRS) $(>)
|
||||
}
|
||||
|
||||
AS = nasm ;
|
||||
|
||||
# why isn't DEFINES working? :(
|
||||
#DEFINES += _M_IX86 ;
|
||||
CCFLAGS += -D_M_IX86 ;
|
504
reactos/LGPL.txt
504
reactos/LGPL.txt
@@ -1,504 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
1211
reactos/Makefile
1211
reactos/Makefile
File diff suppressed because it is too large
Load Diff
15
reactos/NEWS
Normal file
15
reactos/NEWS
Normal file
@@ -0,0 +1,15 @@
|
||||
0.0.14: Converted to PE format
|
||||
All system libraries are now dlls
|
||||
|
||||
0.0.13: Mostly bugfixes (I think)
|
||||
|
||||
0.0.12: Added support for multiple processes (not really tested)
|
||||
System calls
|
||||
kernel32 now compiles (only as a static library)
|
||||
Fixed invalid tss bug (hopefully)
|
||||
Added section support
|
||||
Added some of the ZwxxxVirtual calls
|
||||
Added prototype caching functions (only the Minix fsd actually
|
||||
uses them)
|
||||
Added handle access and type checking
|
||||
Prototype APC implementation (no support for user APCs)
|
@@ -1,21 +1,13 @@
|
||||
========================
|
||||
ReactOS Version 0.2.x
|
||||
Updated June 23rd, 2004
|
||||
========================
|
||||
About Reactos
|
||||
|
||||
1. What is ReactOS?
|
||||
1. What is Reactos
|
||||
|
||||
ReactOS is an Open Source effort to develop a quality operating system
|
||||
that is compatible with Windows NT applications and drivers.
|
||||
A project aiming to make an approximate clone of Windows NT, compatible
|
||||
with most Windows applications.
|
||||
|
||||
The ReactOS project, although currently focused on Windows NT 4.0
|
||||
compatibility, is always keeping an eye towards compatibility with
|
||||
future Windows NT releases, that is, Windows 2000 (NT 5.0) and
|
||||
Windows XP (NT 5.1).
|
||||
The project has a website at http://www.reactos.com/
|
||||
|
||||
More information is available at http://www.reactos.com.
|
||||
|
||||
2. Building ReactOS
|
||||
2. Building Reactos
|
||||
|
||||
See the INSTALL file for more details.
|
||||
|
||||
@@ -25,4 +17,8 @@ See the doc subdirectory for some sparse notes
|
||||
|
||||
4. Who is responsible
|
||||
|
||||
See the CREDITS file
|
||||
See the CREDITS file
|
||||
|
||||
5. Recent developments
|
||||
|
||||
See the NEWS file
|
||||
|
3
reactos/aboot.bat
Normal file
3
reactos/aboot.bat
Normal file
@@ -0,0 +1,3 @@
|
||||
loadros system32\ntoskrnl.exe system32\hal.dll system32\drivers\acpi.sys /DEBUGPORT=SCREEN bootc.lst
|
||||
rem comment added and changed for no reason
|
||||
|
@@ -1,33 +0,0 @@
|
||||
; Format:
|
||||
; COMPONENT_NAME PATH_TO_COMPONENT_SOURCES
|
||||
; COMPONENT_NAME - Name of the component. Eg. kernel32.dll.
|
||||
; PATH_TO_COMPONENT_SOURCES - Relative path to sources (relative to
|
||||
; where rgenstat is run from).
|
||||
advapi32.dll reactos/lib/advapi32
|
||||
crtdll.dll reactos/lib/crtdll
|
||||
gdi32.dll reactos/lib/gdi32
|
||||
gdiplus.dll reactos/lib/gdiplus
|
||||
iphlpapi.dll reactos/lib/iphlpapi
|
||||
kernel32.dll reactos/lib/kernel32
|
||||
lz32.dll reactos/lib/lzexpand
|
||||
msvcrt.dll reactos/lib/msvcrt
|
||||
ole32.dll reactos/lib/ole32
|
||||
oleaut32.dll reactos/lib/oleaut32
|
||||
rpcrt4.dll reactos/lib/rpcrt4
|
||||
secur32.dll reactos/lib/secur32
|
||||
shell32.dll reactos/lib/shell32
|
||||
snmpapi.dll reactos/lib/snmpapi
|
||||
user32.dll reactos/lib/user32
|
||||
version.dll reactos/lib/version
|
||||
winmm.dll reactos/lib/winmm
|
||||
winspool.dll reactos/lib/winspool
|
||||
ws2_32.dll reactos/lib/ws2_32
|
||||
wsock32.dll reactos/lib/wsock32
|
||||
videoprt.dll reactos/drivers/video/videoprt
|
||||
ndis.sys reactos/drivers/net/ndis
|
||||
tdi.sys reactos/drivers/net/tdi
|
||||
class2.sys reactos/drivers/storage/class2
|
||||
scsiport.sys reactos/drivers/storage/scsiport
|
||||
ntoskrnl.exe reactos/ntoskrnl
|
||||
ntoskrnl.exe reactos/lib/rtl
|
||||
win32k.sys reactos/subsys/win32k
|
@@ -1,207 +0,0 @@
|
||||
# Doxyfile 1.3.5
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "ReactOS Apps & Tools"
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = doxy-doc
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = ..
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = YES
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = . \
|
||||
../tools
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = YES
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 200
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = YES
|
||||
RTF_HYPERLINKS = YES
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = NO
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = ../include
|
||||
INCLUDE_FILE_PATTERNS = *.h
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
@@ -1,13 +0,0 @@
|
||||
# $Id$
|
||||
#
|
||||
# ReactOS apps and tools makefile to generate Doxygen documentation
|
||||
#
|
||||
|
||||
|
||||
docu:
|
||||
doxygen Doxyfile
|
||||
|
||||
.PHONY: docu
|
||||
|
||||
|
||||
# EOF
|
21
reactos/apps/tests/alive/Makefile
Normal file
21
reactos/apps/tests/alive/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: Makefile,v 1.6 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = alive
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a user32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
48
reactos/apps/tests/alive/alive.c
Normal file
48
reactos/apps/tests/alive/alive.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* $Id: alive.c,v 1.2 2001/03/26 21:30:20 ea Exp $
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
HANDLE StandardOutput = INVALID_HANDLE_VALUE;
|
||||
CHAR Message [80];
|
||||
DWORD CharactersToWrite = 0;
|
||||
DWORD WrittenCharacters = 0;
|
||||
INT d = 0, h = 0, m = 0, s = 0;
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{
|
||||
StandardOutput = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||
if (INVALID_HANDLE_VALUE == StandardOutput)
|
||||
{
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
while (TRUE)
|
||||
{
|
||||
/* Prepare the message and update it */
|
||||
CharactersToWrite =
|
||||
wsprintf (
|
||||
Message,
|
||||
"Alive for %dd %dh %d' %d\" \r",
|
||||
d, h, m, s
|
||||
);
|
||||
WriteConsole (
|
||||
StandardOutput,
|
||||
Message,
|
||||
CharactersToWrite,
|
||||
& WrittenCharacters,
|
||||
NULL
|
||||
);
|
||||
/* suspend the execution for 1s */
|
||||
Sleep (1000);
|
||||
/* increment seconds */
|
||||
++ s;
|
||||
if (60 == s) { s = 0; ++ m; }
|
||||
if (60 == m) { m = 0; ++ h; }
|
||||
if (24 == h) { h = 0; ++ d; }
|
||||
}
|
||||
return (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* EOF */
|
87
reactos/apps/tests/apc/apc.c
Normal file
87
reactos/apps/tests/apc/apc.c
Normal file
@@ -0,0 +1,87 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
VOID STDCALL
|
||||
ApcRoutine(PVOID Context,
|
||||
PIO_STATUS_BLOCK IoStatus,
|
||||
ULONG Reserved)
|
||||
{
|
||||
printf("(apc.exe) ApcRoutine(Context %p)\n", Context);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
NTSTATUS Status;
|
||||
HANDLE FileHandle;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING FileName;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
CHAR Buffer[256];
|
||||
HANDLE EventHandle;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
printf("APC test program\n");
|
||||
|
||||
EventHandle = CreateEventW(NULL,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL);
|
||||
if (EventHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Failed to create event\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("Opening file\n");
|
||||
RtlInitUnicodeString(&FileName,
|
||||
L"\\C:\\a.txt");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&FileName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
printf("Creating file\n");
|
||||
FileHandle = CreateFileW(L"C:\\a.txt",
|
||||
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,
|
||||
NULL);
|
||||
if (FileHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Open failed\n");
|
||||
return 0;
|
||||
}
|
||||
printf("Reading file\n");
|
||||
Status = ZwReadFile(FileHandle,
|
||||
NULL,
|
||||
(PIO_APC_ROUTINE)ApcRoutine,
|
||||
(PVOID)0xdeadbeef,
|
||||
&IoStatus,
|
||||
Buffer,
|
||||
256,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("Read failed\n");
|
||||
}
|
||||
printf("Waiting\n");
|
||||
WaitForSingleObjectEx(EventHandle, INFINITE, TRUE);
|
||||
printf("Returned from wait\n");
|
||||
ZwClose(FileHandle);
|
||||
printf("Program finished\n");
|
||||
return 0;
|
||||
}
|
||||
|
21
reactos/apps/tests/apc/makefile
Normal file
21
reactos/apps/tests/apc/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.9 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = apc
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
39
reactos/apps/tests/args/args.c
Normal file
39
reactos/apps/tests/args/args.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
printf("GetCommandLineA() %s\n",GetCommandLineA());
|
||||
debug_printf("GetCommandLineA() %s\n",GetCommandLineA());
|
||||
debug_printf("argc %d\n", argc);
|
||||
for (i=0; i<argc; i++)
|
||||
{
|
||||
debug_printf("Argv[%d]: %x\n",i,argv[i]);
|
||||
debug_printf("Argv[%d]: '%s'\n",i,argv[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
19
reactos/apps/tests/args/makefile
Normal file
19
reactos/apps/tests/args/makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: makefile,v 1.15 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = args
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
114
reactos/apps/tests/atomtest/atomtest.c
Normal file
114
reactos/apps/tests/atomtest/atomtest.c
Normal file
@@ -0,0 +1,114 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#define BUFFER_SIZE 256
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
PRTL_ATOM_TABLE AtomTable = NULL;
|
||||
RTL_ATOM AtomA = -1, AtomB = -1, AtomC = -1;
|
||||
NTSTATUS Status;
|
||||
WCHAR Buffer[BUFFER_SIZE];
|
||||
ULONG NameLength, Data1, Data2;
|
||||
|
||||
printf("Atom table test app\n\n");
|
||||
|
||||
printf("RtlCreateAtomTable()\n");
|
||||
Status = RtlCreateAtomTable(37,
|
||||
&AtomTable);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" AtomTable %p\n", AtomTable);
|
||||
|
||||
printf("RtlAddAtomToAtomTable()\n");
|
||||
Status = RtlAddAtomToAtomTable(AtomTable,
|
||||
L"TestAtomA",
|
||||
&AtomA);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" AtomA 0x%x\n", AtomA);
|
||||
}
|
||||
|
||||
printf("RtlAddAtomToAtomTable()\n");
|
||||
Status = RtlAddAtomToAtomTable(AtomTable,
|
||||
L"TestAtomB",
|
||||
&AtomB);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" AtomB 0x%x\n", AtomB);
|
||||
}
|
||||
|
||||
|
||||
printf("RtlLookupAtomInAtomTable()\n");
|
||||
Status = RtlLookupAtomInAtomTable(AtomTable,
|
||||
L"TestAtomA",
|
||||
&AtomC);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" AtomC 0x%x\n", AtomC);
|
||||
}
|
||||
|
||||
|
||||
printf("RtlPinAtomInAtomTable()\n");
|
||||
Status = RtlPinAtomInAtomTable(AtomTable,
|
||||
AtomC);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
printf("RtlPinAtomInAtomTable()\n");
|
||||
Status = RtlPinAtomInAtomTable(AtomTable,
|
||||
AtomC);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
|
||||
// printf("RtlDeleteAtomFromAtomTable()\n");
|
||||
// Status = RtlDeleteAtomFromAtomTable(AtomTable,
|
||||
// AtomC);
|
||||
// printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
|
||||
// printf("RtlEmptyAtomTable()\n");
|
||||
// Status = RtlEmptyAtomTable(AtomTable,
|
||||
// TRUE);
|
||||
// printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
|
||||
// printf("RtlLookupAtomInAtomTable()\n");
|
||||
// Status = RtlLookupAtomInAtomTable(AtomTable,
|
||||
// L"TestAtomA",
|
||||
// &AtomC);
|
||||
// printf(" Status 0x%08lx\n", Status);
|
||||
|
||||
|
||||
printf("RtlQueryAtomInAtomTable()\n");
|
||||
NameLength = sizeof(WCHAR) * BUFFER_SIZE;
|
||||
Status = RtlQueryAtomInAtomTable(AtomTable,
|
||||
AtomC,
|
||||
&Data1,
|
||||
&Data2,
|
||||
Buffer,
|
||||
&NameLength);
|
||||
printf(" Status 0x%08lx\n", Status);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
printf(" RefCount %ld\n", Data1);
|
||||
printf(" PinCount %ld\n", Data2);
|
||||
printf(" NameLength %lu\n", NameLength);
|
||||
printf(" AtomName: %S\n", Buffer);
|
||||
}
|
||||
|
||||
printf("RtlDestroyAtomTable()\n");
|
||||
RtlDestroyAtomTable(AtomTable);
|
||||
|
||||
|
||||
printf("Atom table test app finished\n");
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
21
reactos/apps/tests/atomtest/makefile
Normal file
21
reactos/apps/tests/atomtest/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.5 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = atomtest
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
8
reactos/apps/tests/bench/bench-syscall.c
Normal file
8
reactos/apps/tests/bench/bench-syscall.c
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
}
|
82
reactos/apps/tests/bench/bench-thread.c
Normal file
82
reactos/apps/tests/bench/bench-thread.c
Normal file
@@ -0,0 +1,82 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define NR_THREADS (30)
|
||||
|
||||
|
||||
DWORD WINAPI
|
||||
thread_main1(LPVOID param)
|
||||
{
|
||||
printf("Thread 1 running (Counter %lu)\n", (DWORD)param);
|
||||
SleepEx(INFINITE, TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
DWORD WINAPI
|
||||
thread_main2(LPVOID param)
|
||||
{
|
||||
printf("Thread 2 running (Counter %lu)\n", (DWORD)param);
|
||||
Sleep(INFINITE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
HANDLE hThread;
|
||||
DWORD i=0;
|
||||
DWORD id;
|
||||
|
||||
#if 1
|
||||
printf("Creating %d threads...\n",NR_THREADS*2);
|
||||
for (i=0;i<NR_THREADS;i++)
|
||||
{
|
||||
CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
/* CreateThread(NULL,
|
||||
0,
|
||||
thread_main2,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);*/
|
||||
}
|
||||
|
||||
printf("All threads created...\n");
|
||||
|
||||
/*
|
||||
* Waiting for threads is not implemented yet.
|
||||
* If you want to see all threads running, uncomment the
|
||||
* call to SuspendThread(). The test application will
|
||||
* freeze after all threads are created.
|
||||
*/
|
||||
/* SuspendThread (GetCurrentThread()); */
|
||||
|
||||
#else
|
||||
|
||||
printf("Creating thread...\n");
|
||||
|
||||
hThread = CreateThread(NULL,
|
||||
0,
|
||||
thread_main1,
|
||||
(LPVOID)i,
|
||||
0,
|
||||
&id);
|
||||
|
||||
printf("Thread created. Waiting for termination...\n");
|
||||
|
||||
WaitForSingleObject (hThread,
|
||||
-1);
|
||||
|
||||
CloseHandle (hThread);
|
||||
|
||||
printf("Thread terminated...\n");
|
||||
#endif
|
||||
printf("Exiting\n");
|
||||
return 0;
|
||||
}
|
21
reactos/apps/tests/bench/makefile
Normal file
21
reactos/apps/tests/bench/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.10 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = bench-thread
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
19
reactos/apps/tests/consume/Makefile
Normal file
19
reactos/apps/tests/consume/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: Makefile,v 1.7 2002/06/02 19:24:57 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = consume
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
31
reactos/apps/tests/consume/consume.c
Normal file
31
reactos/apps/tests/consume/consume.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define SIZE (65*1024*1024)
|
||||
|
||||
ULONG x[SIZE / 4096];
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
PUCHAR BaseAddress;
|
||||
|
||||
BaseAddress = VirtualAlloc(NULL,
|
||||
SIZE,
|
||||
MEM_COMMIT,
|
||||
PAGE_READONLY);
|
||||
if (BaseAddress == NULL)
|
||||
{
|
||||
printf("Failed to allocate virtual memory");
|
||||
return(1);
|
||||
}
|
||||
printf("BaseAddress %p\n", BaseAddress);
|
||||
for (i = 0; i < (SIZE / 4096); i++)
|
||||
{
|
||||
printf("%.8x ", i*4096);
|
||||
x[i] = BaseAddress[i*4096];
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
21
reactos/apps/tests/count/Makefile
Normal file
21
reactos/apps/tests/count/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: Makefile,v 1.6 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = count
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a user32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
15
reactos/apps/tests/count/count.c
Normal file
15
reactos/apps/tests/count/count.c
Normal file
@@ -0,0 +1,15 @@
|
||||
/* $Id: count.c,v 1.1 2001/03/26 21:30:20 ea Exp $
|
||||
*
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
int n = 0;
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{
|
||||
while (1) printf ("%d ", n ++ );
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* EOF */
|
51
reactos/apps/tests/dump_shared_data/dump_shared_data.c
Normal file
51
reactos/apps/tests/dump_shared_data/dump_shared_data.c
Normal file
@@ -0,0 +1,51 @@
|
||||
#include <stdio.h>
|
||||
#include <ntddk.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("TickCountLow: %x\n",
|
||||
SharedUserData->TickCountLow);
|
||||
printf("Drives: ");
|
||||
for (i = 0; i < 26; i++)
|
||||
{
|
||||
printf("%c", (SharedUserData->DosDeviceMap & (1 << i))?'1':'0');
|
||||
}
|
||||
printf("\n");
|
||||
for (i = 0; i < 26; i++)
|
||||
{
|
||||
if (SharedUserData->DosDeviceMap & (1 << i))
|
||||
{
|
||||
printf("%c: ", 'A'+i);
|
||||
switch(SharedUserData->DosDeviceDriveType[i])
|
||||
{
|
||||
case DOSDEVICE_DRIVE_UNKNOWN:
|
||||
printf("Unknown\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_CALCULATE:
|
||||
printf("No root\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_REMOVABLE:
|
||||
printf("Removable\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_FIXED:
|
||||
printf("Fixed\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_REMOTE:
|
||||
printf("Remote\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_CDROM:
|
||||
printf("CD-ROM\n");
|
||||
break;
|
||||
case DOSDEVICE_DRIVE_RAMDISK:
|
||||
printf("Ram disk\n");
|
||||
break;
|
||||
default:
|
||||
printf("undefined type\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n\n");
|
||||
}
|
20
reactos/apps/tests/dump_shared_data/makefile
Normal file
20
reactos/apps/tests/dump_shared_data/makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# $Id: makefile,v 1.6 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = dump_shared_data
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
||||
|
33
reactos/apps/tests/event/event.c
Normal file
33
reactos/apps/tests/event/event.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE events[2];
|
||||
|
||||
DWORD WINAPI thread( LPVOID crap )
|
||||
{
|
||||
SetEvent( events[0] );
|
||||
if( crap )
|
||||
SetEvent( events[1] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main( void )
|
||||
{
|
||||
DWORD id, Status;
|
||||
printf( "Creating events\n" );
|
||||
events[0] = CreateEvent( 0, TRUE, FALSE, 0 );
|
||||
events[1] = CreateEvent( 0, TRUE, FALSE, 0 );
|
||||
printf( "Created events\n" );
|
||||
CreateThread( 0, 0, thread, 0, 0, &id );
|
||||
printf( "WaitForSingleObject %s\n", ( WaitForSingleObject( events[0], INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
CreateThread( 0, 0, thread, 0, 0, &id );
|
||||
printf( "WaitForMultipleObjects with waitall = FALSE %s\n", ( WaitForMultipleObjects( 2, events, FALSE, INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
CreateThread( 0, 0, thread, (void *)1, 0, &id );
|
||||
Status = WaitForMultipleObjects( 2, events, TRUE, INFINITE );
|
||||
printf( "WaitForMultipleObjects with waitall = TRUE %s\n", ( Status == WAIT_OBJECT_0 || Status == WAIT_OBJECT_0 + 1 ? "worked" : "failed" ) );
|
||||
ResetEvent( events[0] );
|
||||
printf( "WaitForSingleObject with timeout %s\n", ( WaitForSingleObject( events[0], 100 ) == WAIT_TIMEOUT ? "worked" : "failed" ) );
|
||||
return 0;
|
||||
}
|
21
reactos/apps/tests/event/makefile
Normal file
21
reactos/apps/tests/event/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.7 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = event
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
19
reactos/apps/tests/file/Makefile
Normal file
19
reactos/apps/tests/file/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: Makefile,v 1.8 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = file
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
54
reactos/apps/tests/file/file.c
Normal file
54
reactos/apps/tests/file/file.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/***********************************************************
|
||||
* File read/write test utility *
|
||||
**********************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main( void )
|
||||
{
|
||||
HANDLE file;
|
||||
char buffer[4096];
|
||||
DWORD wrote;
|
||||
int c;
|
||||
|
||||
file = CreateFile("test.dat",
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
CREATE_ALWAYS,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (file == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Error opening file (Status %x)\n", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
for( c = 0; c < sizeof( buffer ); c++ )
|
||||
buffer[c] = (char)c;
|
||||
printf("Writing file\n");
|
||||
if (WriteFile( file, buffer, 4096, &wrote, NULL) == FALSE)
|
||||
{
|
||||
printf("Error writing file (Status %x)\n", GetLastError());
|
||||
exit(2);
|
||||
}
|
||||
printf("Reading file\n");
|
||||
SetFilePointer( file, 0, 0, FILE_BEGIN );
|
||||
if (ReadFile( file, buffer, 4096, &wrote, NULL) == FALSE)
|
||||
{
|
||||
printf("Error reading file (Status %x)\n", GetLastError());
|
||||
exit(3);
|
||||
}
|
||||
for( c = 0; c < sizeof( buffer ); c++ )
|
||||
if( buffer[c] != (char)c )
|
||||
{
|
||||
printf( "Error: data read back is not what was written\n" );
|
||||
CloseHandle( file );
|
||||
return 0;
|
||||
}
|
||||
printf("Finished, works fine\n");
|
||||
CloseHandle( file );
|
||||
return 0;
|
||||
}
|
328
reactos/apps/tests/gditest/gditest.c
Normal file
328
reactos/apps/tests/gditest/gditest.c
Normal file
@@ -0,0 +1,328 @@
|
||||
/*
|
||||
* gditest
|
||||
dec 26, 2001 -- gditest bug fix by Richard Campbell
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
extern BOOL STDCALL GdiDllInitialize(HANDLE hInstance, DWORD Event, LPVOID Reserved);
|
||||
|
||||
void __stdcall Background (HDC Desktop)
|
||||
{
|
||||
HPEN Pen;
|
||||
int x, y;
|
||||
|
||||
Pen = CreatePen(PS_SOLID, 1, RGB(64, 64, 128));
|
||||
|
||||
SelectObject (Desktop, Pen);
|
||||
|
||||
MoveToEx (Desktop, 0, 0, NULL);
|
||||
LineTo (Desktop, 640, 480);
|
||||
for (y = 479, x = 0; x < 640; x+=2)
|
||||
{
|
||||
MoveToEx (Desktop, 0, 0, NULL);
|
||||
LineTo (Desktop, x, y);
|
||||
}
|
||||
for (y = 0, x = 639; y < 480; y+=2)
|
||||
{
|
||||
MoveToEx (Desktop, 0, 0, NULL);
|
||||
LineTo (Desktop, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void gditest( void ){
|
||||
HDC Desktop, MyDC, DC24;
|
||||
HPEN RedPen, GreenPen, BluePen, WhitePen;
|
||||
HBITMAP MyBitmap, DIB24;
|
||||
HFONT hf, tf;
|
||||
BITMAPINFOHEADER BitInf;
|
||||
BITMAPINFO BitPalInf;
|
||||
|
||||
// Set up a DC called Desktop that accesses DISPLAY
|
||||
Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
|
||||
if (Desktop == NULL){
|
||||
printf("Can't create desktop\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Background
|
||||
Background (Desktop);
|
||||
|
||||
// Create a blue pen and select it into the DC
|
||||
BluePen = CreatePen(PS_SOLID, 8, RGB(0, 0, 0xff));
|
||||
SelectObject(Desktop, BluePen);
|
||||
|
||||
// Draw a shape on the DC
|
||||
MoveToEx(Desktop, 50, 50, NULL);
|
||||
LineTo(Desktop, 200, 60);
|
||||
LineTo(Desktop, 200, 300);
|
||||
LineTo(Desktop, 50, 50);
|
||||
MoveToEx(Desktop, 50, 50, NULL);
|
||||
LineTo(Desktop, 200, 50);
|
||||
|
||||
WhitePen = CreatePen(PS_SOLID, 3, RGB(0xff, 0xff, 0xff));
|
||||
SelectObject(Desktop, WhitePen);
|
||||
|
||||
MoveToEx(Desktop, 20, 70, NULL);
|
||||
LineTo(Desktop, 500, 70);
|
||||
MoveToEx(Desktop, 70, 20, NULL);
|
||||
LineTo(Desktop, 70, 150);
|
||||
|
||||
// Test font support
|
||||
GreenPen = CreatePen(PS_SOLID, 3, RGB(0, 0xff, 0));
|
||||
RedPen = CreatePen(PS_SOLID, 3, RGB(0xff, 0, 0));
|
||||
|
||||
hf = CreateFontA(24, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Helmet");
|
||||
SelectObject(Desktop, hf);
|
||||
SetTextColor(Desktop, RGB(0xff, 0, 0));
|
||||
TextOutA(Desktop, 70, 70, "React", 5);
|
||||
SetTextColor(Desktop, RGB(0, 0xff, 0));
|
||||
TextOutA(Desktop, 140, 70, "OS", 2);
|
||||
|
||||
tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons");
|
||||
SelectObject(Desktop, tf);
|
||||
SetTextColor(Desktop, RGB(0xff, 0xff, 0xff));
|
||||
TextOutA(Desktop, 70, 90, "This is a test of ReactOS text, using the FreeType 2 library!", 61);
|
||||
|
||||
// TEST 1: Copy from the VGA into a device compatible DC, draw on it, then blt it to the VGA again
|
||||
MyDC = CreateCompatibleDC(Desktop);
|
||||
MyBitmap = CreateCompatibleBitmap(Desktop, 151, 251);
|
||||
SelectObject(MyDC, MyBitmap);
|
||||
BitBlt(MyDC, 0, 0, 151, 251, Desktop, 50, 50, SRCCOPY); // can we say 151, 251 since bottom corner is not inclusive?
|
||||
|
||||
SelectObject(MyDC, GreenPen);
|
||||
Rectangle(MyDC, 10, 10, 50, 50);
|
||||
|
||||
// TEST 2: Copy from the device compatible DC into a 24BPP bitmap, draw on it, then blt to the VGA again
|
||||
BitInf.biSize = sizeof(BITMAPINFOHEADER);
|
||||
BitInf.biWidth = 152;
|
||||
BitInf.biHeight = -252; // it's top down (since BI_RGB is used, the sign is operative of direction)
|
||||
BitInf.biPlanes = 1;
|
||||
BitInf.biBitCount = 24;
|
||||
BitInf.biCompression = BI_RGB;
|
||||
BitInf.biSizeImage = 0;
|
||||
BitInf.biXPelsPerMeter = 0;
|
||||
BitInf.biYPelsPerMeter = 0;
|
||||
BitInf.biClrUsed = 0;
|
||||
BitInf.biClrImportant = 0;
|
||||
BitPalInf.bmiHeader = BitInf;
|
||||
DIB24 = (HBITMAP) CreateDIBSection(NULL, &BitPalInf, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
DC24 = CreateCompatibleDC(NULL);
|
||||
SelectObject(DC24, DIB24);
|
||||
|
||||
BitBlt(DC24, 0, 0, 101, 201, MyDC, 0, 0, SRCCOPY);
|
||||
SelectObject(DC24, RedPen);
|
||||
Rectangle(DC24, 80, 90, 100, 110);
|
||||
MoveToEx(DC24, 80, 90, NULL);
|
||||
LineTo(DC24, 100, 110);
|
||||
BitBlt(Desktop, 200, 200, 110, 120, DC24, 0, 0, SRCCOPY);
|
||||
|
||||
Sleep( 10000 ); // fixme delay only 10000 (for 10 seconds)
|
||||
// Free up everything
|
||||
DeleteDC(Desktop);
|
||||
DeleteDC(MyDC);
|
||||
}
|
||||
|
||||
void DumpRgnData( HRGN hRgn )
|
||||
{
|
||||
int size, ret, i;
|
||||
LPRGNDATA rgnData;
|
||||
|
||||
size = GetRegionData( hRgn, 0, NULL );
|
||||
if( size == 0 ){
|
||||
printf("GetRegionData returned 0\n");
|
||||
return;
|
||||
}
|
||||
rgnData = (LPRGNDATA) malloc( size );
|
||||
ret = GetRegionData( hRgn, size, rgnData );
|
||||
if( ret == 0 ){
|
||||
printf("GetRegionData( hRgn, size, rgnData ) returned 0\n");
|
||||
return;
|
||||
}
|
||||
printf("Bounds: left=%d top=%d right=%d bottom=%d, count: %d, type: %i\n\n",
|
||||
rgnData->rdh.rcBound.left, rgnData->rdh.rcBound.top, rgnData->rdh.rcBound.right, rgnData->rdh.rcBound.bottom,
|
||||
rgnData->rdh.nCount, rgnData->rdh.iType);
|
||||
printf("Rects:\t i \t left \t top \t right \t bottom\n");
|
||||
for ( i = 0; i < rgnData->rdh.nCount; i++ ) {
|
||||
PRECT pr = (PRECT) rgnData->Buffer + i;
|
||||
printf("\t %d \t %d \t %d \t %d \t %d\n", i, pr->left, pr->top, pr->right, pr->bottom );
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void rgntest( void )
|
||||
{
|
||||
HRGN hRgn1, hRgn2, hRgn3;
|
||||
RECT Rect;
|
||||
int i;
|
||||
|
||||
hRgn1 = CreateRectRgn( 1, 2, 100, 101 );
|
||||
if( hRgn1 == NULL ) {
|
||||
printf("Failed at hRgn1 = CreateRectRgn( 1, 2, 100, 101 )\n");
|
||||
return;
|
||||
}
|
||||
i = GetRgnBox( hRgn1, &Rect );
|
||||
if( i==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("GetRgnBox( hRgn1, &Rect ): i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
|
||||
DumpRgnData( hRgn1 );
|
||||
|
||||
hRgn2 = CreateRectRgn( 51, 53, 150, 152 );
|
||||
if( hRgn2 == NULL ) {
|
||||
printf("Failed at hRgn2 = CreateRectRgn( 51, 53, 150, 152 )\n");
|
||||
return;
|
||||
}
|
||||
i = GetRgnBox( hRgn2, &Rect );
|
||||
if( i==0 ){
|
||||
printf("Failed GetRgnBox( hRgn2, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("GetRgnBox( hRgn2, &Rect ): i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
|
||||
DumpRgnData( hRgn2 );
|
||||
|
||||
if( EqualRgn( hRgn1, hRgn2 ) == TRUE ){
|
||||
printf("\t hRgn1, hRgn2 are equal\n");
|
||||
}
|
||||
else{
|
||||
printf("\t hRgn1, hRgn2 are NOT equal\n\n");
|
||||
}
|
||||
|
||||
i = OffsetRgn(hRgn1,50,51);
|
||||
if( i==ERROR ){
|
||||
printf("Failed OffsetRgn(hRgn1,50,51)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
i = GetRgnBox( hRgn1, &Rect );
|
||||
if( i==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After offset\nGetRgnBox( hRgn1, &Rect ): i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
|
||||
if( EqualRgn( hRgn1, hRgn2 ) == TRUE ){
|
||||
printf("\t hRgn1, hRgn2 are equal after offset\n");
|
||||
}
|
||||
else{
|
||||
printf("\t hRgn1, hRgn2 are NOT equal after offset!\n\n");
|
||||
}
|
||||
|
||||
i = SetRectRgn(hRgn1, 10, 11, 110, 111 );
|
||||
if( i==0 ){
|
||||
printf("Failed SetRectRgn(hRgn1... )\n");
|
||||
return;
|
||||
}
|
||||
i = GetRgnBox( hRgn1, &Rect );
|
||||
if( i==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("after SetRectRgn(hRgn1, 10, 11, 110, 111 ):\n i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
|
||||
hRgn3 = CreateRectRgn( 1, 1, 1, 1);
|
||||
i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_AND );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_AND ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn3, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_AND ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn3 );
|
||||
|
||||
i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_OR );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_OR ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn3, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_OR ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn3 );
|
||||
|
||||
i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_DIFF );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_DIFF ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn3, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_DIFF ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn3 );
|
||||
|
||||
i = CombineRgn( hRgn3, hRgn1, hRgn2, RGN_XOR );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn3, hRgn1, hRgn2, RGN_XOR ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn3, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn3, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn3, hRgn1, hRgn2, RGN_XOR ): \nGetRgnBox( hRgn3, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn3 );
|
||||
|
||||
i = CombineRgn( hRgn1, hRgn3, hRgn2, RGN_COPY );
|
||||
if( i==ERROR ){
|
||||
printf("Fail: CombineRgn( hRgn1, hRgn3, hRgn2, RGN_COPY ). LastError: %d\n", GetLastError);
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetRgnBox( hRgn1, &Rect )==0 ){
|
||||
printf("Failed GetRgnBox( hRgn1, &Rect )\n");
|
||||
return;
|
||||
}
|
||||
printf("After CombineRgn( hRgn1, hRgn3, hRgn2, RGN_COPY ): \nGetRgnBox( hRgn1, &Rect ): CR_i=%d, left=%d top=%d right=%d bottom=%d\n\n",
|
||||
i, Rect.left, Rect.top, Rect.right, Rect.bottom );
|
||||
DumpRgnData( hRgn1 );
|
||||
|
||||
|
||||
DeleteObject( hRgn1 );
|
||||
DeleteObject( hRgn2 );
|
||||
DeleteObject( hRgn3 );
|
||||
printf("region test finished\n");
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
printf("Entering GDITest..\n");
|
||||
printf("use gditest for older tests\n");
|
||||
printf("use gditest 1 for region test\n");
|
||||
|
||||
GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
|
||||
if( argc < 2 )
|
||||
gditest();
|
||||
else {
|
||||
if( !strncmp( argv[1], "1", 1 ) ) {
|
||||
rgntest();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
21
reactos/apps/tests/gditest/makefile
Normal file
21
reactos/apps/tests/gditest/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.8 2002/06/02 19:24:58 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = gditest
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a gdi32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
8
reactos/apps/tests/hello/hello.c
Normal file
8
reactos/apps/tests/hello/hello.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("Hello world\n");
|
||||
return(0);
|
||||
}
|
19
reactos/apps/tests/hello/makefile
Normal file
19
reactos/apps/tests/hello/makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: makefile,v 1.16 2002/06/02 19:24:59 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = hello
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
229
reactos/apps/tests/isotest/isotest.c
Normal file
229
reactos/apps/tests/isotest/isotest.c
Normal file
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* isotest - display cdrom information
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
//#include <winioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
void HexDump(char *buffer, ULONG size)
|
||||
{
|
||||
ULONG offset = 0;
|
||||
unsigned char *ptr;
|
||||
|
||||
while (offset < (size & ~15))
|
||||
{
|
||||
ptr = (unsigned char*)((ULONG)buffer + offset);
|
||||
printf("%08lx %02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx-%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx",
|
||||
offset,
|
||||
ptr[0],
|
||||
ptr[1],
|
||||
ptr[2],
|
||||
ptr[3],
|
||||
ptr[4],
|
||||
ptr[5],
|
||||
ptr[6],
|
||||
ptr[7],
|
||||
ptr[8],
|
||||
ptr[9],
|
||||
ptr[10],
|
||||
ptr[11],
|
||||
ptr[12],
|
||||
ptr[13],
|
||||
ptr[14],
|
||||
ptr[15]);
|
||||
|
||||
printf(" %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
|
||||
isprint(ptr[0])?ptr[0]:'.',
|
||||
isprint(ptr[1])?ptr[1]:'.',
|
||||
isprint(ptr[2])?ptr[2]:'.',
|
||||
isprint(ptr[3])?ptr[3]:'.',
|
||||
isprint(ptr[4])?ptr[4]:'.',
|
||||
isprint(ptr[5])?ptr[5]:'.',
|
||||
isprint(ptr[6])?ptr[6]:'.',
|
||||
isprint(ptr[7])?ptr[7]:'.',
|
||||
isprint(ptr[8])?ptr[8]:'.',
|
||||
isprint(ptr[9])?ptr[9]:'.',
|
||||
isprint(ptr[10])?ptr[10]:'.',
|
||||
isprint(ptr[11])?ptr[11]:'.',
|
||||
isprint(ptr[12])?ptr[12]:'.',
|
||||
isprint(ptr[13])?ptr[13]:'.',
|
||||
isprint(ptr[14])?ptr[14]:'.',
|
||||
isprint(ptr[15])?ptr[15]:'.');
|
||||
|
||||
offset += 16;
|
||||
}
|
||||
|
||||
ptr = (unsigned char*)((ULONG)buffer + offset);
|
||||
if (offset < size)
|
||||
{
|
||||
printf("%08lx ", offset);
|
||||
while (offset < size)
|
||||
{
|
||||
printf(" %02hx", *ptr);
|
||||
offset++;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
|
||||
#ifndef EVENT_ALL_ACCESS
|
||||
#define EVENT_ALL_ACCESS (0x1f0003L)
|
||||
#endif
|
||||
|
||||
BOOL
|
||||
ReadBlock(HANDLE FileHandle,
|
||||
PVOID Buffer,
|
||||
PLARGE_INTEGER Offset,
|
||||
ULONG Length,
|
||||
PULONG BytesRead)
|
||||
{
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
NTSTATUS Status;
|
||||
HANDLE EventHandle;
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
NULL, 0, NULL, NULL);
|
||||
|
||||
Status = NtCreateEvent(&EventHandle,
|
||||
EVENT_ALL_ACCESS,
|
||||
&ObjectAttributes,
|
||||
TRUE,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("NtCreateEvent() failed\n");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
Status = NtReadFile(FileHandle,
|
||||
EventHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
&IoStatusBlock,
|
||||
Buffer,
|
||||
Length,
|
||||
Offset,
|
||||
NULL);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
NtWaitForSingleObject(EventHandle, FALSE, NULL);
|
||||
Status = IoStatusBlock.Status;
|
||||
}
|
||||
|
||||
NtClose(EventHandle);
|
||||
|
||||
if (Status != STATUS_PENDING && BytesRead != NULL)
|
||||
{
|
||||
*BytesRead = IoStatusBlock.Information;
|
||||
}
|
||||
if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
|
||||
{
|
||||
printf("ReadBlock() failed (Status: %lx)\n", Status);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
HANDLE hDisk;
|
||||
DWORD dwRead;
|
||||
DWORD i;
|
||||
char *Buffer;
|
||||
CHAR Filename[80];
|
||||
LARGE_INTEGER FilePosition;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Usage: isotest [Drive:]\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
strcpy(Filename, "\\\\.\\");
|
||||
strcat(Filename, argv[1]);
|
||||
|
||||
hDisk = CreateFile(Filename,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0,
|
||||
NULL);
|
||||
if (hDisk == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("CreateFile(): Invalid disk handle!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Buffer = (char*)malloc(2048);
|
||||
if (Buffer == NULL)
|
||||
{
|
||||
CloseHandle(hDisk);
|
||||
printf("Out of memory!\n");
|
||||
return 0;
|
||||
}
|
||||
memset(Buffer, 0, 2048);
|
||||
|
||||
|
||||
FilePosition.QuadPart = 16 * 2048;
|
||||
#if 0
|
||||
SetLastError(NO_ERROR);
|
||||
SetFilePointer(hDisk,
|
||||
FilePosition.u.LowPart,
|
||||
&FilePosition.u.HighPart,
|
||||
FILE_BEGIN);
|
||||
if (GetLastError() != NO_ERROR)
|
||||
{
|
||||
CloseHandle(hDisk);
|
||||
free(Buffer);
|
||||
printf("SetFilePointer() failed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ReadFile(hDisk,
|
||||
Buffer,
|
||||
2048,
|
||||
&dwRead,
|
||||
NULL) == FALSE)
|
||||
{
|
||||
CloseHandle(hDisk);
|
||||
free(Buffer);
|
||||
printf("ReadFile() failed!\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ReadBlock(hDisk,
|
||||
Buffer,
|
||||
&FilePosition,
|
||||
2048,
|
||||
&dwRead) == FALSE)
|
||||
{
|
||||
CloseHandle(hDisk);
|
||||
free(Buffer);
|
||||
#if 0
|
||||
printf("ReadBlock() failed!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
HexDump(Buffer, 128);
|
||||
|
||||
CloseHandle(hDisk);
|
||||
|
||||
free(Buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
23
reactos/apps/tests/isotest/makefile
Normal file
23
reactos/apps/tests/isotest/makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
# $Id: makefile,v 1.2 2002/06/02 19:24:59 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = isotest
|
||||
|
||||
#TARGET_CFLAGS = -fnative_struct
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
205
reactos/apps/tests/lpc/conport.c
Normal file
205
reactos/apps/tests/lpc/conport.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/* $Id: conport.c,v 1.6 2000/04/25 23:22:46 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/conport.c
|
||||
*
|
||||
* To be run in a real WNT 4.0 system with
|
||||
* "\SmApiPort" as argument. Do not try to
|
||||
* connect to "\Windows\ApiPort" since that
|
||||
* reboots immeditely.
|
||||
*
|
||||
* Use Russinovich' HandleEx to verify
|
||||
* conport.exe owns two unnamed LPC ports:
|
||||
* the one created by kernel32.dll connecting
|
||||
* to csrss.exe, and one connected to here.
|
||||
*
|
||||
* 19990627 (Emanuele Aliberti)
|
||||
* Initial implementation.
|
||||
* 19990704 (EA)
|
||||
* Dump object's attributes moved in dumpinfo.c.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define PROTO_LPC
|
||||
#include <ddk/ntddk.h>
|
||||
#include "dumpinfo.h"
|
||||
|
||||
#define LPC_CONNECT_FLAG1 0x00000001
|
||||
#define LPC_CONNECT_FLAG2 0x00000010
|
||||
#define LPC_CONNECT_FLAG3 0x00000100
|
||||
#define LPC_CONNECT_FLAG4 0x00001000
|
||||
#define LPC_CONNECT_FLAG5 0x00010000
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * ConnectPort)(
|
||||
OUT PHANDLE PortHandle,
|
||||
IN PUNICODE_STRING PortName,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN DWORD Unknown3,
|
||||
IN DWORD Unknown4,
|
||||
IN DWORD Unknown5,
|
||||
IN DWORD Unknown6,
|
||||
IN ULONG Flags
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * YieldExecution)(VOID);
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAXARG 1000000
|
||||
|
||||
|
||||
VOID
|
||||
TryConnectPort(char *port_name)
|
||||
{
|
||||
DWORD Status = 0;
|
||||
HANDLE Port = 0;
|
||||
int i;
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
WORD Name [BUF_SIZE] = {0};
|
||||
int dwx = 0;
|
||||
char * port_name_save = port_name;
|
||||
|
||||
/*
|
||||
* Convert the port's name to Unicode.
|
||||
*/
|
||||
for (
|
||||
PortName.Length = 0;
|
||||
( *port_name
|
||||
&& (PortName.Length < BUF_SIZE)
|
||||
);
|
||||
)
|
||||
{
|
||||
Name[PortName.Length++] = (WORD) *port_name++;
|
||||
}
|
||||
Name[PortName.Length] = 0;
|
||||
|
||||
PortName.Length = PortName.Length * sizeof (WORD);
|
||||
PortName.MaximumLength = PortName.Length + sizeof (WORD);
|
||||
PortName.Buffer = (PWSTR) Name;
|
||||
/*
|
||||
* Prepare the port object attributes.
|
||||
*/
|
||||
ObjectAttributes.Length =
|
||||
sizeof (OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory =
|
||||
NULL;
|
||||
ObjectAttributes.ObjectName =
|
||||
NULL /*& PortName */;
|
||||
ObjectAttributes.Attributes =
|
||||
OBJ_CASE_INSENSITIVE;
|
||||
ObjectAttributes.SecurityDescriptor =
|
||||
NULL;
|
||||
ObjectAttributes.SecurityQualityOfService =
|
||||
NULL;
|
||||
/*
|
||||
* Try to issue a connection request.
|
||||
*/
|
||||
Port = 0;
|
||||
Status = ConnectPort(
|
||||
& Port, /* & PortHandle */
|
||||
& PortName, /* & PortName */
|
||||
& ObjectAttributes, /* & PortAttributes */
|
||||
NULL, /* & SecurityQos */
|
||||
NULL, /* & SectionInfo */
|
||||
NULL, /* & MapInfo */
|
||||
NULL, /* & MaxMessageSize */
|
||||
LPC_CONNECT_FLAG5 /* & ConnectInfoLength */
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DumpInfo(
|
||||
Name,
|
||||
Status,
|
||||
"connected",
|
||||
Port
|
||||
);
|
||||
/* Hot waiting */
|
||||
for (dwx=0; dwx<MAXARG; ++dwx)
|
||||
{
|
||||
YieldExecution();
|
||||
}
|
||||
if (FALSE == CloseHandle(Port))
|
||||
{
|
||||
printf(
|
||||
"Could not close the port handle %08X.\n",
|
||||
Port
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
printf(
|
||||
"Connection to port \"%s\" failed (Status = %08X).\n",
|
||||
port_name_save,
|
||||
Status
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
main( int argc, char * argv[] )
|
||||
{
|
||||
HINSTANCE ntdll;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("WNT LPC Port Connector\n");
|
||||
printf("Usage: %s [port_name]\n",argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("LoadLibrary(NTDLL)\n");
|
||||
ntdll = LoadLibrary("NTDLL");
|
||||
if (ntdll == NULL)
|
||||
{
|
||||
printf("Could not load NTDLL\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtConnectPort)\n");
|
||||
ConnectPort = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtConnectPort"
|
||||
);
|
||||
if (ConnectPort == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtConnectPort\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
|
||||
QueryObject = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtQueryObject"
|
||||
);
|
||||
if (QueryObject == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtQueryObject\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
|
||||
YieldExecution = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtYieldExecution"
|
||||
);
|
||||
if (YieldExecution == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtYieldExecution\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("TryConnectPort(%s)\n",argv[1]);
|
||||
TryConnectPort(argv[1]);
|
||||
printf("Done\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
192
reactos/apps/tests/lpc/creport.c
Normal file
192
reactos/apps/tests/lpc/creport.c
Normal file
@@ -0,0 +1,192 @@
|
||||
/* $Id: creport.c,v 1.2 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/creport.c
|
||||
*
|
||||
* To be run in a real WNT 4.0 system to
|
||||
* create an LPC named port.
|
||||
*
|
||||
* Use Russinovich' HandleEx to verify
|
||||
* creport.exe owns the named LPC port
|
||||
* you asked to create.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define PROTO_LPC
|
||||
#include <ddk/ntddk.h>
|
||||
#include "dumpinfo.h"
|
||||
|
||||
#define LPC_CONNECT_FLAG1 0x00000001
|
||||
#define LPC_CONNECT_FLAG2 0x00000010
|
||||
#define LPC_CONNECT_FLAG3 0x00000100
|
||||
#define LPC_CONNECT_FLAG4 0x00001000
|
||||
#define LPC_CONNECT_FLAG5 0x00010000
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * CreatePort)(
|
||||
/*OUT PHANDLE PortHandle,*/
|
||||
PVOID Buffer,
|
||||
IN POBJECT_ATTRIBUTES PortAttributes OPTIONAL,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN DWORD Unknown3,
|
||||
IN ULONG Flags
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
(STDCALL * YieldExecution)(VOID);
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAXARG 5000000
|
||||
|
||||
|
||||
VOID
|
||||
TryCreatePort(char *port_name)
|
||||
{
|
||||
DWORD Status = 0;
|
||||
HANDLE Port = 0;
|
||||
int i;
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
WORD Name [BUF_SIZE] = {0};
|
||||
int dwx = 0;
|
||||
char * port_name_save = port_name;
|
||||
|
||||
/*
|
||||
* Convert the port's name to Unicode.
|
||||
*/
|
||||
for (
|
||||
PortName.Length = 0;
|
||||
( *port_name
|
||||
&& (PortName.Length < BUF_SIZE)
|
||||
);
|
||||
)
|
||||
{
|
||||
Name[PortName.Length++] = (WORD) *port_name++;
|
||||
}
|
||||
Name[PortName.Length] = 0;
|
||||
|
||||
PortName.Length = PortName.Length * sizeof (WORD);
|
||||
PortName.MaximumLength = PortName.Length + sizeof (WORD);
|
||||
PortName.Buffer = (PWSTR) Name;
|
||||
/*
|
||||
* Prepare the port object attributes.
|
||||
*/
|
||||
ObjectAttributes.Length =
|
||||
sizeof (OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory =
|
||||
NULL;
|
||||
ObjectAttributes.ObjectName =
|
||||
& PortName;
|
||||
ObjectAttributes.Attributes =
|
||||
0; //OBJ_CASE_INSENSITIVE --> STATUS_INVALID_PARAMETER ==> case sensitive!;
|
||||
ObjectAttributes.SecurityDescriptor =
|
||||
NULL;
|
||||
ObjectAttributes.SecurityQualityOfService =
|
||||
NULL;
|
||||
/*
|
||||
* Try to issue a connection request.
|
||||
*/
|
||||
Port = 0;
|
||||
Status = CreatePort(
|
||||
& Port,
|
||||
& ObjectAttributes,
|
||||
0, /* ACCESS_MASK? */
|
||||
0, /* Unknown3 */
|
||||
LPC_CONNECT_FLAG5
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DumpInfo(
|
||||
Name,
|
||||
Status,
|
||||
"created",
|
||||
Port
|
||||
);
|
||||
/* Hot waiting */
|
||||
for (dwx=0; dwx<MAXARG; ++dwx)
|
||||
{
|
||||
YieldExecution();
|
||||
}
|
||||
if (FALSE == CloseHandle(Port))
|
||||
{
|
||||
printf(
|
||||
"Could not close the port handle %08X.\n",
|
||||
Port
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
printf(
|
||||
"Creating port \"%s\" failed (Status = %08X).\n",
|
||||
port_name_save,
|
||||
Status
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
main( int argc, char * argv[] )
|
||||
{
|
||||
HINSTANCE ntdll;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("WNT LPC Port Creator\n");
|
||||
printf("Usage: %s [port_name]\n",argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("LoadLibrary(NTDLL)\n");
|
||||
ntdll = LoadLibrary("NTDLL");
|
||||
if (ntdll == NULL)
|
||||
{
|
||||
printf("Could not load NTDLL\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtCreatePort)\n");
|
||||
CreatePort = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtCreatePort"
|
||||
);
|
||||
if (CreatePort == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtCreatePort\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtQueryObject)\n");
|
||||
QueryObject = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtQueryObject"
|
||||
);
|
||||
if (QueryObject == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtQueryObject\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("GetProcAddress(NTDLL.NtYieldExecution)\n");
|
||||
YieldExecution = (VOID*) GetProcAddress(
|
||||
ntdll,
|
||||
"NtYieldExecution"
|
||||
);
|
||||
if (YieldExecution == NULL)
|
||||
{
|
||||
FreeLibrary(ntdll);
|
||||
printf("Could not find NTDLL.NtYieldExecution\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("TryCreatePort(%s)\n",argv[1]);
|
||||
TryCreatePort(argv[1]);
|
||||
printf("Done\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
239
reactos/apps/tests/lpc/dumpinfo.c
Normal file
239
reactos/apps/tests/lpc/dumpinfo.c
Normal file
@@ -0,0 +1,239 @@
|
||||
/* $Id: dumpinfo.c,v 1.2 1999/07/17 23:10:12 ea Exp $
|
||||
*
|
||||
* reactos/apps/lpc/dumpinfo.c
|
||||
*
|
||||
* ReactOS Operating System
|
||||
*
|
||||
* Dump a kernel object's attributes by its handle.
|
||||
*
|
||||
* 19990627 (Emanuele Aliberti)
|
||||
* Initial implementation.
|
||||
* 19990704 (EA)
|
||||
* Added code to find the basic information buffer size
|
||||
* for the LPC port object.
|
||||
* 19990710 (EA)
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MAX_BASIC_INFO_SIZE 512
|
||||
|
||||
|
||||
extern
|
||||
NTSTATUS
|
||||
(STDCALL * QueryObject)(
|
||||
IN HANDLE ObjectHandle,
|
||||
IN CINT ObjectInformationClass,
|
||||
OUT PVOID ObjectInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
);
|
||||
|
||||
extern
|
||||
NTSTATUS
|
||||
(STDCALL * QueryInformationPort)(
|
||||
IN HANDLE PortHandle,
|
||||
IN CINT PortInformationClass, /* guess */
|
||||
OUT PVOID PortInformation, /* guess */
|
||||
IN ULONG PortInformationLength, /* guess */
|
||||
OUT PULONG ReturnLength /* guess */
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
static
|
||||
VOID
|
||||
DumpBuffer(
|
||||
char *Name,
|
||||
BYTE *buffer,
|
||||
ULONG size
|
||||
)
|
||||
{
|
||||
register ULONG i = 0;
|
||||
|
||||
printf("%s [%d] = ",Name,size);
|
||||
for ( i = 0;
|
||||
i != size;
|
||||
++i
|
||||
)
|
||||
{
|
||||
printf("%02X",buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
*/
|
||||
|
||||
VOID
|
||||
DumpInfo (
|
||||
LPCWSTR Name,
|
||||
NTSTATUS Status,
|
||||
LPCWSTR Comment,
|
||||
HANDLE Port
|
||||
)
|
||||
{
|
||||
BYTE ObjectInformation [BUF_SIZE] = {0};
|
||||
ULONG ResultLength;
|
||||
|
||||
wprintf(
|
||||
L"Port \"%s\" %s:\n",
|
||||
Name,
|
||||
Comment
|
||||
);
|
||||
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
printf("\tPort = %08X\n\n",Port);
|
||||
/*
|
||||
* Query object information.
|
||||
*/
|
||||
printf("Basic Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectBasicInformation,
|
||||
ObjectInformation,
|
||||
sizeof (LPC_PORT_BASIC_INFORMATION),
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
PLPC_PORT_BASIC_INFORMATION i;
|
||||
|
||||
i = (PLPC_PORT_BASIC_INFORMATION) ObjectInformation;
|
||||
|
||||
printf( "\tUnknown01 = 0x%08X\n", i->Unknown0 );
|
||||
printf( "\tUnknown02 = 0x%08X\n", i->Unknown1 );
|
||||
printf( "\tUnknown03 = 0x%08X\n", i->Unknown2 );
|
||||
printf( "\tUnknown04 = 0x%08X\n", i->Unknown3 );
|
||||
printf( "\tUnknown05 = 0x%08X\n", i->Unknown4 );
|
||||
printf( "\tUnknown06 = 0x%08X\n", i->Unknown5 );
|
||||
printf( "\tUnknown07 = 0x%08X\n", i->Unknown6 );
|
||||
printf( "\tUnknown08 = 0x%08X\n", i->Unknown7 );
|
||||
printf( "\tUnknown09 = 0x%08X\n", i->Unknown8 );
|
||||
printf( "\tUnknown10 = 0x%08X\n", i->Unknown9 );
|
||||
printf( "\tUnknown11 = 0x%08X\n", i->Unknown10 );
|
||||
printf( "\tUnknown12 = 0x%08X\n", i->Unknown11 );
|
||||
printf( "\tUnknown13 = 0x%08X\n", i->Unknown12 );
|
||||
printf( "\tUnknown14 = 0x%08X\n", i->Unknown13 );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Type Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectTypeInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_TYPE_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_TYPE_INFORMATION *) ObjectInformation;
|
||||
|
||||
wprintf(
|
||||
L"\tName: \"%s\"\n",
|
||||
(i->Name.Length ? i->Name.Buffer : L"")
|
||||
);
|
||||
/*
|
||||
FIXME: why this always raise an access violation exception?
|
||||
wprintf(
|
||||
L"\tType: \"%s\"\n",
|
||||
(i->Type.Length ? i->Type.Buffer : L"")
|
||||
);
|
||||
/**/
|
||||
printf(
|
||||
"\tTotal Handles: %d\n",
|
||||
i->TotalHandles
|
||||
);
|
||||
printf(
|
||||
"\tReference Count: %d\n",
|
||||
i->ReferenceCount
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Name Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectNameInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_NAME_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_NAME_INFORMATION *) ObjectInformation;
|
||||
wprintf(
|
||||
L"\tName: \"%s\"\n",
|
||||
(i->Name.Length ? i->Name.Buffer : L"")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
printf("Data Information:\n");
|
||||
Status = QueryObject(
|
||||
Port,
|
||||
ObjectDataInformation,
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
OBJECT_DATA_INFORMATION * i;
|
||||
|
||||
i = (OBJECT_DATA_INFORMATION *) ObjectInformation;
|
||||
printf(
|
||||
"\tInherit Handle: %s\n",
|
||||
(i->bInheritHandle ? "TRUE" : "FALSE")
|
||||
);
|
||||
printf(
|
||||
"\tProtect from Close: %s\n",
|
||||
(i->bProtectFromClose ? "TRUE" : "FALSE")
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
//---
|
||||
printf("Port Information:\n");
|
||||
/* Status = QueryInformationPort(
|
||||
Port,
|
||||
1, /* info class * /
|
||||
ObjectInformation,
|
||||
sizeof ObjectInformation,
|
||||
& ResultLength
|
||||
);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
DWORD * i = ObjectInformation;
|
||||
int j = 0;
|
||||
|
||||
while (j < ResultLength / sizeof (DWORD))
|
||||
{
|
||||
printf("\t%08X\n",i[j]);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tStatus = %08X\n",Status);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
8
reactos/apps/tests/lpc/dumpinfo.h
Normal file
8
reactos/apps/tests/lpc/dumpinfo.h
Normal file
@@ -0,0 +1,8 @@
|
||||
VOID
|
||||
DumpInfo (
|
||||
LPCWSTR Name,
|
||||
NTSTATUS Status,
|
||||
LPCWSTR Comment,
|
||||
HANDLE Port
|
||||
);
|
||||
|
94
reactos/apps/tests/lpc/lpcclt.c
Normal file
94
reactos/apps/tests/lpc/lpcclt.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* $Id: lpcclt.c,v 1.8 2002/02/24 17:44:22 ea Exp $
|
||||
*
|
||||
* DESCRIPTION: Simple LPC Client
|
||||
* PROGRAMMER: David Welch
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <napi/lpc.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lpctest.h"
|
||||
|
||||
const char * MyName = "LPC-CLI";
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName;
|
||||
NTSTATUS Status;
|
||||
HANDLE PortHandle;
|
||||
LPC_MAX_MESSAGE Request;
|
||||
ULONG ConnectInfo;
|
||||
ULONG ConnectInfoLength = 0;
|
||||
SECURITY_QUALITY_OF_SERVICE Sqos;
|
||||
|
||||
printf("%s: Lpc test client\n", MyName);
|
||||
|
||||
RtlInitUnicodeString(&PortName, TEST_PORT_NAME_U);
|
||||
|
||||
printf("%s: Connecting to port \"%s\"...\n", MyName, TEST_PORT_NAME);
|
||||
ConnectInfoLength = 0;
|
||||
ZeroMemory (& Sqos, sizeof Sqos);
|
||||
Status = NtConnectPort(&PortHandle,
|
||||
&PortName,
|
||||
& Sqos,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
&ConnectInfoLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtConnectPort() failed with status = 0x%08X.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%s: Connected to \"%s\" with anonymous port 0x%x.\n", MyName, TEST_PORT_NAME, PortHandle);
|
||||
|
||||
ZeroMemory(& Request, sizeof Request);
|
||||
strcpy(Request.Data, GetCommandLineA());
|
||||
Request.Header.DataSize = strlen(Request.Data);
|
||||
Request.Header.MessageSize = sizeof(LPC_MESSAGE_HEADER) +
|
||||
Request.Header.DataSize;
|
||||
|
||||
printf("%s: Sending to port 0x%x message \"%s\"...\n",
|
||||
MyName,
|
||||
PortHandle,
|
||||
(char *) Request.Data);
|
||||
Status = NtRequestPort(PortHandle,
|
||||
&Request.Header);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtRequestPort(0x%x) failed with status = 0x%8X.\n",
|
||||
MyName,
|
||||
PortHandle,
|
||||
Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%s: Sending datagram to port 0x%x succeeded.\n", MyName, PortHandle);
|
||||
|
||||
Sleep(2000);
|
||||
|
||||
printf("%s: Disconnecting...", MyName);
|
||||
NtClose (PortHandle);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
140
reactos/apps/tests/lpc/lpcsrv.c
Normal file
140
reactos/apps/tests/lpc/lpcsrv.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/* $Id: lpcsrv.c,v 1.8 2002/02/24 17:44:22 ea Exp $
|
||||
*
|
||||
* DESCRIPTION: Simple LPC Server
|
||||
* PROGRAMMER: David Welch
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <napi/lpc.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lpctest.h"
|
||||
|
||||
static const char * MyName = "LPC-SRV";
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
UNICODE_STRING PortName;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
NTSTATUS Status;
|
||||
HANDLE NamedPortHandle;
|
||||
HANDLE PortHandle;
|
||||
LPC_MAX_MESSAGE ConnectMsg;
|
||||
|
||||
printf("%s: Lpc test server\n", MyName);
|
||||
|
||||
RtlInitUnicodeString(&PortName, TEST_PORT_NAME_U);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&PortName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
printf("%s: Creating port \"%s\"...\n", MyName, TEST_PORT_NAME);
|
||||
Status = NtCreatePort(&NamedPortHandle,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtCreatePort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("%s: Port \"%s\" created (0x%x).\n\n", MyName, TEST_PORT_NAME, NamedPortHandle);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
printf("%s: Listening for connections requests on port 0x%x...\n", MyName, NamedPortHandle);
|
||||
Status = NtListenPort(NamedPortHandle,
|
||||
&ConnectMsg.Header);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtListenPort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%s: Received connection request 0x%08x on port 0x%x.\n", MyName,
|
||||
ConnectMsg.Header.MessageId, NamedPortHandle);
|
||||
printf("%s: Request from: PID=%x, TID=%x.\n", MyName,
|
||||
ConnectMsg.Header.Cid.UniqueProcess, ConnectMsg.Header.Cid.UniqueThread);
|
||||
|
||||
printf("%s: Accepting connection request 0x%08x...\n", MyName,
|
||||
ConnectMsg.Header.MessageId);
|
||||
Status = NtAcceptConnectPort(&PortHandle,
|
||||
NamedPortHandle,
|
||||
& ConnectMsg.Header,
|
||||
TRUE,
|
||||
0,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtAcceptConnectPort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("%s: Connection request 0x%08x accepted as port 0x%x.\n", MyName,
|
||||
ConnectMsg.Header.MessageId, PortHandle);
|
||||
|
||||
printf("%s: Completing connection for port 0x%x (0x%08x).\n", MyName,
|
||||
PortHandle, ConnectMsg.Header.MessageId);
|
||||
Status = NtCompleteConnectPort(PortHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtCompleteConnectPort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%s: Entering server loop for port 0x%x...\n", MyName, PortHandle);
|
||||
for(;;)
|
||||
{
|
||||
LPC_MAX_MESSAGE Request;
|
||||
|
||||
Status = NtReplyWaitReceivePort(PortHandle,
|
||||
0,
|
||||
NULL,
|
||||
&Request.Header);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
printf("%s: NtReplyWaitReceivePort() failed with status = 0x%08lX.\n", MyName, Status);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (LPC_DATAGRAM == PORT_MESSAGE_TYPE(Request))
|
||||
{
|
||||
printf("%s: Datagram message contents are <%s>.\n",
|
||||
MyName,
|
||||
Request.Data);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s: Message with type %d received on port 0x%x.\n", MyName,
|
||||
PORT_MESSAGE_TYPE(Request), PortHandle);
|
||||
NtClose(PortHandle);
|
||||
printf("%s: Connected port 0x%x closed.\n\n", MyName, PortHandle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
5
reactos/apps/tests/lpc/lpctest.h
Normal file
5
reactos/apps/tests/lpc/lpctest.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifndef _LPCTEST_H
|
||||
#define _LPCTEST_H
|
||||
#define TEST_PORT_NAME "\\TestPort"
|
||||
#define TEST_PORT_NAME_U L"\\TestPort"
|
||||
#endif
|
45
reactos/apps/tests/lpc/makefile
Normal file
45
reactos/apps/tests/lpc/makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
SRV_OBJECTS= lpcsrv.o
|
||||
CLT_OBJECTS= lpcclt.o
|
||||
|
||||
PROGS= lpcsrv.exe lpcclt.exe
|
||||
|
||||
BASE_CFLAGS = -I$(PATH_TO_TOP)/include
|
||||
|
||||
LIBS = $(SDK_PATH_LIB)/kernel32.a \
|
||||
$(SDK_PATH_LIB)/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
implib:
|
||||
|
||||
clean:
|
||||
- $(RM) lpcsrv.o lpcsrv.exe lpcsrv.sym lpcclt.o lpcclt.exe lpcsrv.sym
|
||||
|
||||
.phony: implib clean
|
||||
|
||||
install: $(PROGS:%=$(INSTALL_DIR)/bin/%)
|
||||
|
||||
$(PROGS:%=$(INSTALL_DIR)/bin/%): $(INSTALL_DIR)/bin/%: %
|
||||
$(CP) $* $(INSTALL_DIR)/bin/$*
|
||||
|
||||
dist: $(PROGS:%=$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(DIST_DIR)/apps/%): $(DIST_DIR)/apps/%: %
|
||||
$(CP) $* $(DIST_DIR)/apps/$*
|
||||
|
||||
lpcsrv.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(CC) $(SRV_OBJECTS) $(LIBS) -o lpcsrv.exe
|
||||
$(NM) --numeric-sort lpcsrv.exe > lpcsrv.sym
|
||||
|
||||
lpcclt.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(CC) $(CLT_OBJECTS) $(LIBS) -o lpcclt.exe
|
||||
$(NM) --numeric-sort lpcclt.exe > lpcclt.sym
|
45
reactos/apps/tests/mstest/Makefile
Normal file
45
reactos/apps/tests/mstest/Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
SRV_OBJECTS = msserver.o
|
||||
CLT_OBJECTS = msclient.o
|
||||
|
||||
PROGS = msserver.exe msclient.exe
|
||||
|
||||
BASE_CFLAGS = -I$(PATH_TO_TOP)/include
|
||||
|
||||
LIBS = $(SDK_PATH_LIB)/kernel32.a \
|
||||
$(SDK_PATH_LIB)/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
implib:
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: implib clean
|
||||
|
||||
install: $(PROGS:%=$(INSTALL_DIR)/bin/%)
|
||||
|
||||
$(PROGS:%=$(INSTALL_DIR)/bin/%): $(INSTALL_DIR)/bin/%: %
|
||||
$(CP) $* $(INSTALL_DIR)/bin/$*
|
||||
|
||||
dist: $(PROGS:%=$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(DIST_DIR)/apps/%): $(DIST_DIR)/apps/%: %
|
||||
$(CP) $* $(DIST_DIR)/apps/$*
|
||||
|
||||
msserver.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(CC) $(SRV_OBJECTS) $(LIBS) -o msserver.exe
|
||||
$(NM) --numeric-sort msserver.exe > msserver.sym
|
||||
|
||||
msclient.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(CC) $(CLT_OBJECTS) $(LIBS) -o msclient.exe
|
||||
$(NM) --numeric-sort msclient.exe > msclient.sym
|
46
reactos/apps/tests/mstest/msclient.c
Normal file
46
reactos/apps/tests/mstest/msclient.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define BUFSIZE 1024
|
||||
#define MAILSLOT_TIMEOUT 1000
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
HANDLE hMailslot;
|
||||
LPSTR lpszMailslotName = "\\\\.\\MAILSLOT\\mymailslot";
|
||||
LPSTR lpszTestMessage = "Mailslot test message!";
|
||||
DWORD cbLength, cbWritten;
|
||||
|
||||
hMailslot = CreateFile(lpszMailslotName,
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_READ,
|
||||
(LPSECURITY_ATTRIBUTES)NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
(HANDLE)NULL);
|
||||
printf("hMailslot %x\n", (DWORD)hMailslot);
|
||||
if (hMailslot == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("CreateFile() failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cbLength = (ULONG)strlen(lpszTestMessage)+1;
|
||||
|
||||
WriteFile(hMailslot,
|
||||
lpszTestMessage,
|
||||
cbLength,
|
||||
&cbWritten,
|
||||
NULL);
|
||||
|
||||
CloseHandle(hMailslot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
40
reactos/apps/tests/mstest/msserver.c
Normal file
40
reactos/apps/tests/mstest/msserver.c
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
HANDLE hMailslot;
|
||||
CHAR chBuf[512];
|
||||
BOOL fResult;
|
||||
DWORD cbRead;
|
||||
LPTSTR lpszMailslotName = "\\\\.\\mailslot\\mymailslot";
|
||||
|
||||
hMailslot = CreateMailslot(lpszMailslotName,
|
||||
512,
|
||||
MAILSLOT_WAIT_FOREVER,
|
||||
NULL);
|
||||
for (;;)
|
||||
{
|
||||
fResult = ReadFile(hMailslot,
|
||||
chBuf,
|
||||
512,
|
||||
&cbRead,
|
||||
NULL);
|
||||
if (fResult == FALSE)
|
||||
{
|
||||
printf("ReadFile() failed!\n");
|
||||
CloseHandle(hMailslot);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("Data read: %s\n", chBuf);
|
||||
}
|
||||
|
||||
CloseHandle(hMailslot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
22
reactos/apps/tests/mutex/makefile
Normal file
22
reactos/apps/tests/mutex/makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# $Id: makefile,v 1.2 2002/06/02 19:24:59 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = mutex
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
116
reactos/apps/tests/mutex/mutex.c
Normal file
116
reactos/apps/tests/mutex/mutex.c
Normal file
@@ -0,0 +1,116 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
HANDLE hThread[2];
|
||||
DWORD dwCounter = 0;
|
||||
HANDLE hMutex;
|
||||
|
||||
|
||||
void dprintf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
DWORD WINAPI thread1(LPVOID crap)
|
||||
{
|
||||
DWORD dwError = 0;
|
||||
DWORD i;
|
||||
|
||||
dprintf("Thread 1 running!\n");
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
dwError = WaitForSingleObject(hMutex, INFINITE);
|
||||
if (dwError == WAIT_FAILED)
|
||||
{
|
||||
dprintf("Thread2: WaitForSingleObject failed!\n");
|
||||
return 1;
|
||||
}
|
||||
else if (dwError == WAIT_ABANDONED_0)
|
||||
{
|
||||
dprintf("Thread2: WaitForSingleObject returned WAIT_ABANDONED_0\n");
|
||||
}
|
||||
|
||||
dprintf("Thread1: dwCounter : %lu -->", dwCounter);
|
||||
dwCounter++;
|
||||
dprintf(" %lu\n", dwCounter);
|
||||
ReleaseMutex(hMutex);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DWORD WINAPI thread2(LPVOID crap)
|
||||
{
|
||||
DWORD dwError = 0;
|
||||
DWORD i;
|
||||
dprintf("Thread 2 running!\n");
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
dwError = WaitForSingleObject(hMutex, INFINITE);
|
||||
if (dwError == WAIT_FAILED)
|
||||
{
|
||||
dprintf("Thread2: WaitForSingleObject failed!\n");
|
||||
return 1;
|
||||
}
|
||||
else if (dwError == WAIT_ABANDONED_0)
|
||||
{
|
||||
dprintf("Thread2: WaitForSingleObject returned WAIT_ABANDONED_0\n");
|
||||
}
|
||||
|
||||
dprintf("Thread2: dwCounter : %lu -->", dwCounter);
|
||||
dwCounter++;
|
||||
dprintf(" %lu\n", dwCounter);
|
||||
ReleaseMutex(hMutex);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
DWORD dwError;
|
||||
DWORD id1,id2;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
dprintf("Calling CreateMutex()\n");
|
||||
hMutex = CreateMutexW(NULL, FALSE, L"TestMutex");
|
||||
if (hMutex == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
dprintf("CreateMutex() failed! Error: %lu\n", GetLastError);
|
||||
return 0;
|
||||
}
|
||||
dprintf("CreateMutex() succeeded!\n");
|
||||
|
||||
hThread[0] = CreateThread(0, 0, thread1, 0, 0, &id1);
|
||||
hThread[1] = CreateThread(0, 0, thread2, 0, 0, &id2);
|
||||
|
||||
dprintf("Calling WaitForMultipleObject()\n");
|
||||
dwError = WaitForMultipleObjects(2, hThread, TRUE, INFINITE);
|
||||
dprintf("WaitForMultipleObject() Error: %lu\n", dwError);
|
||||
|
||||
CloseHandle(hThread[0]);
|
||||
CloseHandle(hThread[1]);
|
||||
|
||||
CloseHandle(hMutex);
|
||||
|
||||
return 0;
|
||||
}
|
44
reactos/apps/tests/nptest/Makefile
Normal file
44
reactos/apps/tests/nptest/Makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
SRV_OBJECTS = npserver.o
|
||||
CLT_OBJECTS = npclient.o
|
||||
|
||||
PROGS = npserver.exe npclient.exe
|
||||
|
||||
BASE_CFLAGS = -I$(PATH_TO_TOP)/include
|
||||
|
||||
LIBS = $(SDK_PATH_LIB)/kernel32.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
implib:
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: implib clean
|
||||
|
||||
install: $(PROGS:%=$(INSTALL_DIR)/bin/%)
|
||||
|
||||
$(PROGS:%=$(INSTALL_DIR)/bin/%): $(INSTALL_DIR)/bin/%: %
|
||||
$(CP) $* $(INSTALL_DIR)/bin/$*
|
||||
|
||||
dist: $(PROGS:%=$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(DIST_DIR)/apps/%): $(DIST_DIR)/apps/%: %
|
||||
$(CP) $* $(DIST_DIR)/apps/$*
|
||||
|
||||
npserver.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(CC) $(SRV_OBJECTS) $(LIBS) -o npserver.exe
|
||||
$(NM) --numeric-sort npserver.exe > npserver.sym
|
||||
|
||||
npclient.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(CC) $(CLT_OBJECTS) $(LIBS) -o npclient.exe
|
||||
$(NM) --numeric-sort npclient.exe > npclient.sym
|
100
reactos/apps/tests/nptest/npclient.c
Normal file
100
reactos/apps/tests/nptest/npclient.c
Normal file
@@ -0,0 +1,100 @@
|
||||
#include <windows.h>
|
||||
|
||||
VOID MyErrExit(LPTSTR Message)
|
||||
{
|
||||
// MessageBox(NULL, Message, NULL, MB_OK);
|
||||
puts(Message);
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
HANDLE hPipe;
|
||||
LPVOID lpvMessage;
|
||||
CHAR chBuf[512];
|
||||
BOOL fSuccess;
|
||||
DWORD cbRead, cbWritten, dwMode;
|
||||
LPTSTR lpszPipename = "\\\\.\\pipe\\mynamedpipe";
|
||||
|
||||
// Try to open a named pipe; wait for it, if necessary.
|
||||
|
||||
while (1)
|
||||
{
|
||||
hPipe = CreateFile(
|
||||
lpszPipename, // pipe name
|
||||
GENERIC_READ | // read and write access
|
||||
GENERIC_WRITE,
|
||||
0, // no sharing
|
||||
NULL, // no security attributes
|
||||
OPEN_EXISTING, // opens existing pipe
|
||||
0, // default attributes
|
||||
NULL); // no template file
|
||||
|
||||
// Break if the pipe handle is valid.
|
||||
|
||||
if (hPipe != INVALID_HANDLE_VALUE)
|
||||
break;
|
||||
|
||||
// Exit if an error other than ERROR_PIPE_BUSY occurs.
|
||||
|
||||
if (GetLastError() != ERROR_PIPE_BUSY)
|
||||
MyErrExit("Could not open pipe");
|
||||
|
||||
// All pipe instances are busy, so wait for 20 seconds.
|
||||
|
||||
if (! WaitNamedPipe(lpszPipename, 20000) )
|
||||
MyErrExit("Could not open pipe");
|
||||
}
|
||||
|
||||
// The pipe connected; change to message-read mode.
|
||||
|
||||
dwMode = PIPE_READMODE_MESSAGE;
|
||||
fSuccess = SetNamedPipeHandleState(
|
||||
hPipe, // pipe handle
|
||||
&dwMode, // new pipe mode
|
||||
NULL, // don't set maximum bytes
|
||||
NULL); // don't set maximum time
|
||||
if (!fSuccess)
|
||||
MyErrExit("SetNamedPipeHandleState");
|
||||
|
||||
// Send a message to the pipe server.
|
||||
|
||||
lpvMessage = (argc > 1) ? argv[1] : "default message";
|
||||
|
||||
fSuccess = WriteFile(
|
||||
hPipe, // pipe handle
|
||||
lpvMessage, // message
|
||||
strlen(lpvMessage) + 1, // message length
|
||||
&cbWritten, // bytes written
|
||||
NULL); // not overlapped
|
||||
if (! fSuccess)
|
||||
MyErrExit("WriteFile");
|
||||
|
||||
do
|
||||
{
|
||||
// Read from the pipe.
|
||||
|
||||
fSuccess = ReadFile(
|
||||
hPipe, // pipe handle
|
||||
chBuf, // buffer to receive reply
|
||||
512, // size of buffer
|
||||
&cbRead, // number of bytes read
|
||||
NULL); // not overlapped
|
||||
|
||||
if (! fSuccess && GetLastError() != ERROR_MORE_DATA)
|
||||
break;
|
||||
|
||||
// Reply from the pipe is written to STDOUT.
|
||||
|
||||
if (! WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
chBuf, cbRead, &cbWritten, NULL))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
} while (! fSuccess); // repeat loop if ERROR_MORE_DATA
|
||||
|
||||
CloseHandle(hPipe);
|
||||
|
||||
return 0;
|
||||
}
|
120
reactos/apps/tests/nptest/npserver.c
Normal file
120
reactos/apps/tests/nptest/npserver.c
Normal file
@@ -0,0 +1,120 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define BUFSIZE 1024
|
||||
#define PIPE_TIMEOUT 1000
|
||||
|
||||
VOID InstanceThread (LPVOID);
|
||||
|
||||
VOID
|
||||
GetAnswerToRequest(LPTSTR lpRequest,
|
||||
LPTSTR lpReply,
|
||||
LPDWORD lpcbReplyBytes)
|
||||
{
|
||||
}
|
||||
|
||||
VOID MyErrExit(LPTSTR Message)
|
||||
{
|
||||
// MessageBox(NULL, Message, NULL, MB_OK);
|
||||
puts(Message);
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int xx = 0;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BOOL fConnected;
|
||||
DWORD dwThreadId;
|
||||
HANDLE hPipe, hThread;
|
||||
LPTSTR lpszPipename = TEXT("\\\\.\\pipe\\mynamedpipe");
|
||||
|
||||
// for (;;)
|
||||
// {
|
||||
hPipe = CreateNamedPipe(lpszPipename,
|
||||
PIPE_ACCESS_DUPLEX,
|
||||
PIPE_TYPE_MESSAGE |
|
||||
PIPE_READMODE_MESSAGE |
|
||||
PIPE_WAIT,
|
||||
PIPE_UNLIMITED_INSTANCES,
|
||||
BUFSIZE,
|
||||
BUFSIZE,
|
||||
PIPE_TIMEOUT,
|
||||
NULL);
|
||||
if (hPipe == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("CreateNamedPipe() failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
fConnected = ConnectNamedPipe(hPipe,
|
||||
NULL) ? TRUE : (GetLastError () ==
|
||||
ERROR_PIPE_CONNECTED);
|
||||
if (fConnected)
|
||||
{
|
||||
printf("Pipe connected!\n");
|
||||
|
||||
DisconnectNamedPipe(hPipe);
|
||||
|
||||
#if 0
|
||||
hThread = CreateThread(NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE) InstanceThread,
|
||||
(LPVOID) hPipe,
|
||||
0,
|
||||
&dwThreadId);
|
||||
if (hThread == NULL)
|
||||
MyErrExit("CreateThread");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// CloseHandle(hPipe);
|
||||
}
|
||||
// }
|
||||
|
||||
CloseHandle(hPipe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID InstanceThread (LPVOID lpvParam)
|
||||
{
|
||||
CHAR chRequest[BUFSIZE];
|
||||
CHAR chReply[BUFSIZE];
|
||||
DWORD cbBytesRead, cbReplyBytes, cbWritten;
|
||||
BOOL fSuccess;
|
||||
HANDLE hPipe;
|
||||
|
||||
hPipe = (HANDLE)lpvParam;
|
||||
while (1)
|
||||
{
|
||||
fSuccess = ReadFile(hPipe,
|
||||
chRequest,
|
||||
BUFSIZE,
|
||||
&cbBytesRead,
|
||||
NULL);
|
||||
if (!fSuccess || cbBytesRead == 0)
|
||||
break;
|
||||
|
||||
GetAnswerToRequest(chRequest, chReply, &cbReplyBytes);
|
||||
|
||||
fSuccess = WriteFile(hPipe,
|
||||
chReply,
|
||||
cbReplyBytes,
|
||||
&cbWritten,
|
||||
NULL);
|
||||
if (!fSuccess || cbReplyBytes != cbWritten)
|
||||
break;
|
||||
}
|
||||
|
||||
FlushFileBuffers(hPipe);
|
||||
DisconnectNamedPipe(hPipe);
|
||||
CloseHandle(hPipe);
|
||||
}
|
21
reactos/apps/tests/pteb/Makefile
Normal file
21
reactos/apps/tests/pteb/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: Makefile,v 1.8 2002/06/02 19:25:00 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = pteb
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
23
reactos/apps/tests/pteb/pteb.c
Normal file
23
reactos/apps/tests/pteb/pteb.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <ntos.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int x;
|
||||
PTEB Teb;
|
||||
|
||||
printf("TEB dumpper\n");
|
||||
__asm__("movl %%fs:0x18, %0\n\t"
|
||||
: "=a" (x)
|
||||
: /* no inputs */);
|
||||
printf("fs[0x18] %x\n", x);
|
||||
|
||||
Teb = (PTEB)x;
|
||||
|
||||
printf("StackBase: 0x%08lX\n", Teb->Tib.StackBase);
|
||||
printf("StackLimit: 0x%08lX\n", Teb->Tib.StackLimit);
|
||||
printf("DeallocationStack: 0x%08lX\n", Teb->DeallocationStack);
|
||||
|
||||
return(0);
|
||||
}
|
22
reactos/apps/tests/regtest/makefile
Normal file
22
reactos/apps/tests/regtest/makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# $Id: makefile,v 1.7 2002/06/02 19:25:00 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = regtest
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
882
reactos/apps/tests/regtest/regtest.c
Normal file
882
reactos/apps/tests/regtest/regtest.c
Normal file
@@ -0,0 +1,882 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void dprintf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void do_enumeratekey(PWSTR Name)
|
||||
{
|
||||
ULONG Index,Length,i;
|
||||
KEY_BASIC_INFORMATION KeyInformation[5];
|
||||
NTSTATUS Status;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE hKey1;
|
||||
UNICODE_STRING KeyName;
|
||||
|
||||
RtlInitUnicodeString(&KeyName, Name);
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, NULL, NULL);
|
||||
Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes);
|
||||
dprintf("NtEnumerateKey : \n");
|
||||
Index=0;
|
||||
while(Status == STATUS_SUCCESS)
|
||||
{
|
||||
Status=NtEnumerateKey(hKey1,Index++,KeyBasicInformation
|
||||
,&KeyInformation[0], sizeof(KeyInformation)
|
||||
,&Length);
|
||||
if(Status== STATUS_SUCCESS)
|
||||
{
|
||||
dprintf("\tSubKey Name = ");
|
||||
for (i=0;i<KeyInformation[0].NameLength/2;i++)
|
||||
dprintf("%C",KeyInformation[0].Name[i]);
|
||||
dprintf("\n");
|
||||
}
|
||||
}
|
||||
NtClose(hKey1);
|
||||
}
|
||||
|
||||
void test1(void)
|
||||
{
|
||||
HKEY hKey = NULL,hKey1;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING KeyName;
|
||||
ULONG Index,Length,i;
|
||||
KEY_BASIC_INFORMATION KeyInformation[5];
|
||||
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
|
||||
|
||||
dprintf("NtOpenKey \\Registry : ");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
if(Status==0)
|
||||
{
|
||||
dprintf("NtQueryKey : ");
|
||||
Status=NtQueryKey(hKey1,KeyBasicInformation
|
||||
,&KeyInformation[0], sizeof(KeyInformation)
|
||||
,&Length);
|
||||
dprintf("\t\t\t\t\tStatus =%x\n",Status);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
dprintf("\tKey Name = ");
|
||||
for (i=0;i<KeyInformation[0].NameLength/2;i++)
|
||||
dprintf("%C",KeyInformation[0].Name[i]);
|
||||
dprintf("\n");
|
||||
}
|
||||
dprintf("NtEnumerateKey : \n");
|
||||
Index=0;
|
||||
while(Status == STATUS_SUCCESS)
|
||||
{
|
||||
Status=NtEnumerateKey(hKey1,Index++,KeyBasicInformation
|
||||
,&KeyInformation[0], sizeof(KeyInformation)
|
||||
,&Length);
|
||||
if(Status== STATUS_SUCCESS)
|
||||
{
|
||||
dprintf("\tSubKey Name = ");
|
||||
for (i=0;i<KeyInformation[0].NameLength/2;i++)
|
||||
dprintf("%C",KeyInformation[0].Name[i]);
|
||||
dprintf("\n");
|
||||
}
|
||||
}
|
||||
dprintf("NtClose : ");
|
||||
Status = NtClose( hKey1 );
|
||||
dprintf("\t\t\t\t\tStatus =%x\n",Status);
|
||||
}
|
||||
NtClose(hKey);
|
||||
|
||||
dprintf("NtOpenKey \\Registry\\Machine : ");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes);
|
||||
dprintf("\t\t\tStatus =%x\n",Status);
|
||||
|
||||
dprintf("NtOpenKey System\\Setup : ");
|
||||
RtlInitUnicodeString(&KeyName, L"System\\Setup");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, hKey1 , NULL);
|
||||
Status = NtOpenKey ( &hKey, KEY_READ , &ObjectAttributes);
|
||||
dprintf("\t\t\tStatus =%x\n",Status);
|
||||
if(Status==0)
|
||||
{
|
||||
dprintf("NtQueryValueKey : ");
|
||||
RtlInitUnicodeString(&KeyName, L"CmdLine");
|
||||
Status=NtQueryValueKey(hKey,&KeyName,KeyValueFullInformation
|
||||
,&KeyValueInformation[0], sizeof(KeyValueInformation)
|
||||
,&Length);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
|
||||
,KeyValueInformation[0].DataOffset
|
||||
,KeyValueInformation[0].DataLength
|
||||
,KeyValueInformation[0].NameLength);
|
||||
for (i=0;i<10 && i<KeyValueInformation[0].NameLength/2;i++)
|
||||
dprintf("%C",KeyValueInformation[0].Name[i]);
|
||||
dprintf("\n");
|
||||
dprintf("\t\tType = %d\n",KeyValueInformation[0].Type);
|
||||
if (KeyValueInformation[0].Type == REG_SZ)
|
||||
dprintf("\t\tValue = %S\n",KeyValueInformation[0].Name+1
|
||||
+KeyValueInformation[0].NameLength/2);
|
||||
}
|
||||
dprintf("NtEnumerateValueKey : \n");
|
||||
Index=0;
|
||||
while(Status == STATUS_SUCCESS)
|
||||
{
|
||||
Status=NtEnumerateValueKey(hKey,Index++,KeyValueFullInformation
|
||||
,&KeyValueInformation[0], sizeof(KeyValueInformation)
|
||||
,&Length);
|
||||
if(Status== STATUS_SUCCESS)
|
||||
{
|
||||
dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
|
||||
,KeyValueInformation[0].DataOffset
|
||||
,KeyValueInformation[0].DataLength
|
||||
,KeyValueInformation[0].NameLength);
|
||||
for (i=0;i<KeyValueInformation[0].NameLength/2;i++)
|
||||
dprintf("%C",KeyValueInformation[0].Name[i]);
|
||||
dprintf(", Type = %d\n",KeyValueInformation[0].Type);
|
||||
if (KeyValueInformation[0].Type == REG_SZ)
|
||||
dprintf("\t\tValue = %S\n",((char*)&KeyValueInformation[0]
|
||||
+KeyValueInformation[0].DataOffset));
|
||||
}
|
||||
}
|
||||
dprintf("NtClose : ");
|
||||
Status = NtClose( hKey );
|
||||
dprintf("\t\t\t\t\tStatus =%x\n",Status);
|
||||
}
|
||||
NtClose( hKey1 );
|
||||
}
|
||||
|
||||
void test2(void)
|
||||
{
|
||||
HKEY hKey,hKey1;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING KeyName,ValueName;
|
||||
NTSTATUS Status;
|
||||
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
|
||||
ULONG Index,Length,i;
|
||||
char Buffer[10];
|
||||
DWORD Result;
|
||||
dprintf("NtCreateKey volatile: \n");
|
||||
dprintf(" \\Registry\\Machine\\Software\\test2reactos: ");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, NULL, NULL);
|
||||
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
|
||||
,0,NULL,REG_OPTION_VOLATILE,NULL);
|
||||
dprintf("\t\tStatus=%x\n",Status);
|
||||
NtClose(hKey);
|
||||
do_enumeratekey(L"\\Registry\\Machine\\Software");
|
||||
dprintf(" ...\\test2 :");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, NULL, NULL);
|
||||
Status = NtCreateKey ( &hKey1, KEY_ALL_ACCESS , &ObjectAttributes
|
||||
,0,NULL,REG_OPTION_VOLATILE,NULL);
|
||||
dprintf("\t\t\t\t\tStatus=%x\n",Status);
|
||||
dprintf(" ...\\TestVolatile :");
|
||||
RtlInitUnicodeString(&KeyName, L"TestVolatile");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, hKey1, NULL);
|
||||
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
|
||||
,0,NULL,REG_OPTION_VOLATILE,NULL);
|
||||
dprintf("\t\t\t\tStatus=%x\n",Status);
|
||||
NtClose(hKey1);
|
||||
RtlInitUnicodeString(&ValueName, L"TestREG_SZ");
|
||||
dprintf("NtSetValueKey reg_sz: ");
|
||||
Status=NtSetValueKey(hKey,&ValueName,0,REG_SZ,(PVOID)L"Test Reg_sz",24);
|
||||
dprintf("\t\t\t\tStatus=%x\n",Status);
|
||||
RtlInitUnicodeString(&ValueName, L"TestDWORD");
|
||||
dprintf("NtSetValueKey reg_dword: ");
|
||||
Status=NtSetValueKey(hKey,&ValueName,0,REG_DWORD,(PVOID)"reac",4);
|
||||
dprintf("\t\t\tStatus=%x\n",Status);
|
||||
NtClose(hKey);
|
||||
dprintf("NtOpenKey \\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile : ");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
Status=NtOpenKey( &hKey, MAXIMUM_ALLOWED, &ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
if(Status==0)
|
||||
{
|
||||
dprintf("NtEnumerateValueKey : \n");
|
||||
Index=0;
|
||||
while(Status == STATUS_SUCCESS)
|
||||
{
|
||||
Status=NtEnumerateValueKey(hKey,Index++,KeyValueFullInformation
|
||||
,&KeyValueInformation[0], sizeof(KeyValueInformation)
|
||||
,&Length);
|
||||
if(Status== STATUS_SUCCESS)
|
||||
{
|
||||
dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
|
||||
,KeyValueInformation[0].DataOffset
|
||||
,KeyValueInformation[0].DataLength
|
||||
,KeyValueInformation[0].NameLength);
|
||||
for (i=0;i<KeyValueInformation[0].NameLength/2;i++)
|
||||
dprintf("%C",KeyValueInformation[0].Name[i]);
|
||||
dprintf(", Type = %d\n",KeyValueInformation[0].Type);
|
||||
if (KeyValueInformation[0].Type == REG_SZ)
|
||||
dprintf("\t\tValue = %S\n",((char*)&KeyValueInformation[0]
|
||||
+KeyValueInformation[0].DataOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
NtClose(hKey);
|
||||
dprintf("delete \\Registry\\Machine\\software\\test2reactos ?");
|
||||
ReadConsoleA(InputHandle, Buffer, 3, &Result, NULL) ;
|
||||
if (Buffer[0] != 'y' && Buffer[0] != 'Y') return;
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2\\TestVolatile");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
dprintf("NtOpenKey : ");
|
||||
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
dprintf("NtDeleteKey : ");
|
||||
Status=NtDeleteKey(hKey);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
NtClose(hKey);
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos\\test2");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
dprintf("NtOpenKey : ");
|
||||
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
dprintf("NtDeleteKey : ");
|
||||
Status=NtDeleteKey(hKey);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
NtClose(hKey);
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test2reactos");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
dprintf("NtOpenKey : ");
|
||||
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
dprintf("NtDeleteKey : ");
|
||||
Status=NtDeleteKey(hKey);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
NtClose(hKey);
|
||||
}
|
||||
|
||||
void test3(void)
|
||||
{
|
||||
HKEY hKey,hKey1;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING KeyName,ValueName;
|
||||
NTSTATUS Status;
|
||||
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
|
||||
ULONG Index,Length,i;
|
||||
char Buffer[10];
|
||||
DWORD Result;
|
||||
dprintf("NtCreateKey non volatile: \n");
|
||||
dprintf(" \\Registry\\Machine\\Software\\test3reactos: ");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, NULL, NULL);
|
||||
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
|
||||
,0,NULL,REG_OPTION_NON_VOLATILE,NULL);
|
||||
dprintf("\t\tStatus=%x\n",Status);
|
||||
NtClose(hKey);
|
||||
do_enumeratekey(L"\\Registry\\Machine\\Software");
|
||||
dprintf("NtOpenKey: ");
|
||||
Status=NtOpenKey( &hKey, MAXIMUM_ALLOWED, &ObjectAttributes);
|
||||
dprintf("\t\tStatus=%x\n",Status);
|
||||
NtClose(hKey);
|
||||
dprintf(" ...\\test3 :");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, NULL, NULL);
|
||||
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
|
||||
,0,NULL,REG_OPTION_NON_VOLATILE,NULL);
|
||||
dprintf("\t\t\t\t\tStatus=%x\n",Status);
|
||||
dprintf("NtOpenKey: ");
|
||||
Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes);
|
||||
dprintf("\t\tStatus=%x\n",Status);
|
||||
NtClose(hKey);
|
||||
dprintf(" ...\\testNonVolatile :");
|
||||
RtlInitUnicodeString(&KeyName, L"TestNonVolatile");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, hKey1, NULL);
|
||||
Status = NtCreateKey ( &hKey, KEY_ALL_ACCESS , &ObjectAttributes
|
||||
,0,NULL,REG_OPTION_NON_VOLATILE,NULL);
|
||||
dprintf("\t\t\t\tStatus=%x\n",Status);
|
||||
NtClose(hKey1);
|
||||
RtlInitUnicodeString(&ValueName, L"TestREG_SZ");
|
||||
dprintf("NtSetValueKey reg_sz: ");
|
||||
Status=NtSetValueKey(hKey,&ValueName,0,REG_SZ,(PVOID)L"Test Reg_sz",24);
|
||||
dprintf("\t\t\t\tStatus=%x\n",Status);
|
||||
RtlInitUnicodeString(&ValueName, L"TestDWORD");
|
||||
dprintf("NtSetValueKey reg_dword: ");
|
||||
Status=NtSetValueKey(hKey,&ValueName,0,REG_DWORD,(PVOID)"reac",4);
|
||||
dprintf("\t\t\tStatus=%x\n",Status);
|
||||
NtClose(hKey);
|
||||
dprintf("NtOpenKey \\Registry\\Machine\\Software\\test3reactos\\test3\\testNonVolatile : ");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3\\testNonVolatile");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
Status=NtOpenKey( &hKey, MAXIMUM_ALLOWED, &ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
if(Status==0)
|
||||
{
|
||||
dprintf("NtEnumerateValueKey : \n");
|
||||
Index=0;
|
||||
while(Status == STATUS_SUCCESS)
|
||||
{
|
||||
Status=NtEnumerateValueKey(hKey,Index++,KeyValueFullInformation
|
||||
,&KeyValueInformation[0], sizeof(KeyValueInformation)
|
||||
,&Length);
|
||||
if(Status== STATUS_SUCCESS)
|
||||
{
|
||||
dprintf("\tValue:DO=%d, DL=%d, NL=%d, Name = "
|
||||
,KeyValueInformation[0].DataOffset
|
||||
,KeyValueInformation[0].DataLength
|
||||
,KeyValueInformation[0].NameLength);
|
||||
for (i=0;i<KeyValueInformation[0].NameLength/2;i++)
|
||||
dprintf("%C",KeyValueInformation[0].Name[i]);
|
||||
dprintf(", Type = %d\n",KeyValueInformation[0].Type);
|
||||
if (KeyValueInformation[0].Type == REG_SZ)
|
||||
dprintf("\t\tValue = %S\n",((char*)&KeyValueInformation[0]
|
||||
+KeyValueInformation[0].DataOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
NtClose(hKey);
|
||||
dprintf("delete \\Registry\\Machine\\software\\test3reactos ?");
|
||||
ReadConsoleA(InputHandle, Buffer, 3, &Result, NULL) ;
|
||||
if (Buffer[0] != 'y' && Buffer[0] != 'Y') return;
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3\\testNonvolatile");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
dprintf("NtOpenKey : ");
|
||||
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
dprintf("NtDeleteKey : ");
|
||||
Status=NtDeleteKey(hKey);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos\\test3");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
dprintf("NtOpenKey : ");
|
||||
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
dprintf("NtDeleteKey : ");
|
||||
Status=NtDeleteKey(hKey);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
NtClose(hKey);
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\Software\\test3reactos");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
dprintf("NtOpenKey : ");
|
||||
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
dprintf("NtDeleteKey : ");
|
||||
Status=NtDeleteKey(hKey);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
NtClose(hKey);
|
||||
}
|
||||
|
||||
void test4(void)
|
||||
{
|
||||
HKEY hKey = NULL,hKey1;
|
||||
DWORD dwDisposition;
|
||||
DWORD dwError;
|
||||
DWORD RegDataType, RegDataSize;
|
||||
BOOL GlobalFifoEnable;
|
||||
HKEY hPortKey;
|
||||
DWORD RegDisposition;
|
||||
WCHAR szClass[260];
|
||||
DWORD cchClass;
|
||||
DWORD cSubKeys;
|
||||
DWORD cchMaxSubkey;
|
||||
DWORD cchMaxClass;
|
||||
DWORD cValues;
|
||||
DWORD cchMaxValueName;
|
||||
DWORD cbMaxValueData;
|
||||
DWORD cbSecurityDescriptor;
|
||||
FILETIME ftLastWriteTime;
|
||||
SYSTEMTIME LastWriteTime;
|
||||
|
||||
dprintf ("RegOpenKeyExW HKLM\\System\\Setup: ");
|
||||
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"System\\Setup",
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
&hKey1);
|
||||
dprintf("\t\tdwError =%x\n",dwError);
|
||||
if (dwError == ERROR_SUCCESS)
|
||||
{
|
||||
dprintf("RegQueryInfoKeyW: ");
|
||||
cchClass=260;
|
||||
dwError = RegQueryInfoKeyW(hKey1
|
||||
, szClass, &cchClass, NULL, &cSubKeys
|
||||
, &cchMaxSubkey, &cchMaxClass, &cValues, &cchMaxValueName
|
||||
, &cbMaxValueData, &cbSecurityDescriptor, &ftLastWriteTime);
|
||||
dprintf ("\t\t\t\tdwError %x\n", dwError);
|
||||
FileTimeToSystemTime(&ftLastWriteTime,&LastWriteTime);
|
||||
dprintf ("\tnb of subkeys=%d,last write : %d/%d/%d %d:%02.2d'%02.2d''%03.3d\n",cSubKeys
|
||||
,LastWriteTime.wMonth
|
||||
,LastWriteTime.wDay
|
||||
,LastWriteTime.wYear
|
||||
,LastWriteTime.wHour
|
||||
,LastWriteTime.wMinute
|
||||
,LastWriteTime.wSecond
|
||||
,LastWriteTime.wMilliseconds
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
dprintf ("RegOpenKeyExW: ");
|
||||
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"System\\ControlSet001\\Services\\Serial",
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
&hKey);
|
||||
dprintf ("\t\t\t\t\tdwError %x\n", dwError);
|
||||
RegDataSize = sizeof(GlobalFifoEnable);
|
||||
if (dwError == ERROR_SUCCESS)
|
||||
{
|
||||
dprintf ("RegQueryValueExW: ");
|
||||
dwError = RegQueryValueExW(hKey,
|
||||
L"ForceFifoEnable",
|
||||
NULL,
|
||||
&RegDataType,
|
||||
(PBYTE)&GlobalFifoEnable,
|
||||
&RegDataSize);
|
||||
dprintf("\t\t\t\tdwError =%x\n",dwError);
|
||||
if (dwError == 0)
|
||||
{
|
||||
dprintf("\tValue:DT=%d, DS=%d, Value=%d\n"
|
||||
,RegDataType
|
||||
,RegDataSize
|
||||
,GlobalFifoEnable);
|
||||
}
|
||||
}
|
||||
dprintf ("RegCreateKeyExW: ");
|
||||
dwError = RegCreateKeyExW(hKey,
|
||||
L"Parameters\\Serial001",
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
NULL,
|
||||
&hPortKey,
|
||||
&RegDisposition
|
||||
);
|
||||
dprintf ("\t\t\t\tdwError %x\n", dwError);
|
||||
|
||||
dprintf ("RegCreateKeyExW: ");
|
||||
dwError = RegCreateKeyExW (HKEY_LOCAL_MACHINE,
|
||||
L"Software\\test4reactos\\test",
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,
|
||||
NULL,
|
||||
&hKey,
|
||||
&dwDisposition);
|
||||
|
||||
dprintf ("\t\t\t\tdwError %x ", dwError);
|
||||
dprintf ("dwDisposition %x\n", dwDisposition);
|
||||
if (dwError == ERROR_SUCCESS)
|
||||
{
|
||||
dprintf ("RegSetValueExW: ");
|
||||
dwError = RegSetValueExW (hKey,
|
||||
L"TestValue",
|
||||
0,
|
||||
REG_SZ,
|
||||
(BYTE*)L"TestString",
|
||||
20);
|
||||
|
||||
dprintf ("\t\t\t\tdwError %x\n", dwError);
|
||||
dprintf ("RegCloseKey: ");
|
||||
dwError = RegCloseKey (hKey);
|
||||
dprintf ("\t\t\t\t\tdwError %x\n", dwError);
|
||||
}
|
||||
dprintf ("\n\n");
|
||||
|
||||
hKey = NULL;
|
||||
|
||||
dprintf ("RegCreateKeyExW: ");
|
||||
dwError = RegCreateKeyExW (HKEY_LOCAL_MACHINE,
|
||||
L"software\\Test",
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_VOLATILE,
|
||||
KEY_ALL_ACCESS,
|
||||
NULL,
|
||||
&hKey,
|
||||
&dwDisposition);
|
||||
|
||||
dprintf ("\t\t\t\tdwError %x ", dwError);
|
||||
dprintf ("dwDisposition %x\n", dwDisposition);
|
||||
|
||||
|
||||
if (dwError == ERROR_SUCCESS)
|
||||
{
|
||||
dprintf("RegQueryInfoKeyW: ");
|
||||
cchClass=260;
|
||||
dwError = RegQueryInfoKeyW(hKey
|
||||
, szClass, &cchClass, NULL, &cSubKeys
|
||||
, &cchMaxSubkey, &cchMaxClass, &cValues, &cchMaxValueName
|
||||
, &cbMaxValueData, &cbSecurityDescriptor, &ftLastWriteTime);
|
||||
dprintf ("\t\t\t\tdwError %x\n", dwError);
|
||||
FileTimeToSystemTime(&ftLastWriteTime,&LastWriteTime);
|
||||
dprintf ("\tnb of subkeys=%d,last write : %d/%d/%d %d:%02.2d'%02.2d''%03.3d\n",cSubKeys
|
||||
,LastWriteTime.wMonth
|
||||
,LastWriteTime.wDay
|
||||
,LastWriteTime.wYear
|
||||
,LastWriteTime.wHour
|
||||
,LastWriteTime.wMinute
|
||||
,LastWriteTime.wSecond
|
||||
,LastWriteTime.wMilliseconds
|
||||
);
|
||||
dprintf ("RegCloseKey: ");
|
||||
dwError = RegCloseKey (hKey);
|
||||
dprintf ("\t\t\t\t\tdwError %x\n", dwError);
|
||||
}
|
||||
dprintf ("\nTests done...\n");
|
||||
}
|
||||
|
||||
void test5(void)
|
||||
{
|
||||
HKEY hKey,hKey1;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING KeyName,ValueName;
|
||||
NTSTATUS Status;
|
||||
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
|
||||
ULONG Index,Length,i;
|
||||
char Buffer[10];
|
||||
DWORD Result;
|
||||
|
||||
dprintf("NtOpenKey : \n");
|
||||
dprintf(" \\Registry\\Machine\\Software\\reactos : ");
|
||||
RtlInitUnicodeString(&KeyName,L"\\Registry\\Machine\\Software\\reactos");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, NULL, NULL);
|
||||
Status=NtOpenKey( &hKey, KEY_ALL_ACCESS, &ObjectAttributes);
|
||||
dprintf("\t\tStatus=%x\n",Status);
|
||||
dprintf("NtFlushKey : \n");
|
||||
Status = NtFlushKey(hKey);
|
||||
dprintf("\t\tStatus=%x\n",Status);
|
||||
dprintf("NtCloseKey : \n");
|
||||
Status=NtClose(hKey);
|
||||
dprintf("\t\tStatus=%x\n",Status);
|
||||
}
|
||||
|
||||
/* registry link create test */
|
||||
void test6(void)
|
||||
{
|
||||
HKEY hKey;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING KeyName,ValueName;
|
||||
NTSTATUS Status;
|
||||
KEY_VALUE_FULL_INFORMATION KeyValueInformation[5];
|
||||
ULONG Index,Length,i;
|
||||
char Buffer[10];
|
||||
DWORD Result;
|
||||
|
||||
dprintf("Create target key\n");
|
||||
dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Reactos\n");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Reactos");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, NULL, NULL);
|
||||
Status = NtCreateKey(&hKey, KEY_ALL_ACCESS , &ObjectAttributes
|
||||
,0,NULL, REG_OPTION_VOLATILE,NULL);
|
||||
dprintf(" NtCreateKey() called (Status %lx)\n",Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return;
|
||||
|
||||
dprintf("Create target value\n");
|
||||
dprintf(" Value: TestValue = 'Test String'\n");
|
||||
RtlInitUnicodeString(&ValueName, L"TestValue");
|
||||
Status=NtSetValueKey(hKey,&ValueName,0,REG_SZ,(PVOID)L"TestString",22);
|
||||
dprintf(" NtSetValueKey() called (Status %lx)\n",Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return;
|
||||
|
||||
dprintf("Close target key\n");
|
||||
NtClose(hKey);
|
||||
|
||||
|
||||
dprintf("Create link key\n");
|
||||
dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Test");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE | OBJ_OPENLINK,
|
||||
NULL,
|
||||
NULL);
|
||||
Status = NtCreateKey(&hKey,
|
||||
KEY_ALL_ACCESS | KEY_CREATE_LINK,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK,
|
||||
NULL);
|
||||
dprintf(" NtCreateKey() called (Status %lx)\n",Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return;
|
||||
|
||||
dprintf("Create link value\n");
|
||||
dprintf(" Value: SymbolicLinkValue = '\\Registry\\Machine\\SOFTWARE\\Reactos'\n");
|
||||
RtlInitUnicodeString(&ValueName, L"SymbolicLinkValue");
|
||||
Status=NtSetValueKey(hKey,&ValueName,0,REG_LINK,(PVOID)L"\\Registry\\Machine\\SOFTWARE\\Reactos",68);
|
||||
dprintf(" NtSetValueKey() called (Status %lx)\n",Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
dprintf("Creating link value failed! Test failed!\n");
|
||||
NtClose(hKey);
|
||||
return;
|
||||
}
|
||||
|
||||
dprintf("Close link key\n");
|
||||
NtClose(hKey);
|
||||
|
||||
dprintf("Open link key\n");
|
||||
dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Test");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE | OBJ_OPENIF
|
||||
, NULL, NULL);
|
||||
Status = NtCreateKey(&hKey, KEY_ALL_ACCESS , &ObjectAttributes
|
||||
,0,NULL, REG_OPTION_VOLATILE, NULL);
|
||||
dprintf(" NtCreateKey() called (Status %lx)\n",Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return;
|
||||
|
||||
dprintf("Query value\n");
|
||||
dprintf(" Value: TestValue\n");
|
||||
RtlInitUnicodeString(&ValueName, L"TestValue");
|
||||
Status=NtQueryValueKey(hKey,
|
||||
&ValueName,
|
||||
KeyValueFullInformation,
|
||||
&KeyValueInformation[0],
|
||||
sizeof(KeyValueInformation),
|
||||
&Length);
|
||||
dprintf(" NtQueryValueKey() called (Status %lx)\n",Status);
|
||||
if (Status == STATUS_SUCCESS)
|
||||
{
|
||||
dprintf(" Value: Type %d DataLength %d NameLength %d Name '",
|
||||
KeyValueInformation[0].Type,
|
||||
KeyValueInformation[0].DataLength,
|
||||
KeyValueInformation[0].NameLength);
|
||||
for (i=0; i < KeyValueInformation[0].NameLength / sizeof(WCHAR); i++)
|
||||
dprintf("%C",KeyValueInformation[0].Name[i]);
|
||||
dprintf("'\n");
|
||||
if (KeyValueInformation[0].Type == REG_SZ)
|
||||
dprintf(" Value '%S'\n",
|
||||
KeyValueInformation[0].Name+1
|
||||
+KeyValueInformation[0].NameLength/2);
|
||||
}
|
||||
|
||||
dprintf("Close link key\n");
|
||||
NtClose(hKey);
|
||||
|
||||
dprintf("Test successful!\n");
|
||||
}
|
||||
|
||||
/* registry link delete test */
|
||||
void test7(void)
|
||||
{
|
||||
HKEY hKey;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING KeyName,ValueName;
|
||||
NTSTATUS Status;
|
||||
|
||||
dprintf("Open link key\n");
|
||||
dprintf(" Key: \\Registry\\Machine\\SOFTWARE\\Test\n");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\SOFTWARE\\Test");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_OPENLINK,
|
||||
NULL,
|
||||
NULL);
|
||||
Status = NtCreateKey(&hKey,
|
||||
KEY_ALL_ACCESS,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_VOLATILE | REG_OPTION_OPEN_LINK,
|
||||
NULL);
|
||||
dprintf(" NtCreateKey() called (Status %lx)\n",Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
dprintf("Could not open the link key. Please run the link create test first!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
dprintf("Delete link value\n");
|
||||
RtlInitUnicodeString(&ValueName, L"SymbolicLinkValue");
|
||||
Status = NtDeleteValueKey(hKey,
|
||||
&ValueName);
|
||||
dprintf(" NtDeleteValueKey() called (Status %lx)\n",Status);
|
||||
|
||||
dprintf("Delete link key\n");
|
||||
Status=NtDeleteKey(hKey);
|
||||
dprintf(" NtDeleteKey() called (Status %lx)\n",Status);
|
||||
|
||||
dprintf("Close link key\n");
|
||||
NtClose(hKey);
|
||||
}
|
||||
|
||||
|
||||
void test8(void)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING KeyName;
|
||||
NTSTATUS Status;
|
||||
LONG dwError;
|
||||
TOKEN_PRIVILEGES NewPrivileges;
|
||||
HANDLE Token,hKey;
|
||||
LUID Luid;
|
||||
BOOLEAN bRes;
|
||||
Status=NtOpenProcessToken(GetCurrentProcess()
|
||||
,TOKEN_ADJUST_PRIVILEGES,&Token);
|
||||
// ,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&Token);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
// bRes=LookupPrivilegeValueA(NULL,SE_RESTORE_NAME,&Luid);
|
||||
// dprintf("\t\t\t\tbRes =%x\n",bRes);
|
||||
NewPrivileges.PrivilegeCount = 1;
|
||||
NewPrivileges.Privileges[0].Luid = Luid;
|
||||
// NewPrivileges.Privileges[0].Luid.u.LowPart=18;
|
||||
// NewPrivileges.Privileges[0].Luid.u.HighPart=0;
|
||||
NewPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||
|
||||
// Status = NtAdjustPrivilegesToken(
|
||||
bRes = AdjustTokenPrivileges(
|
||||
Token,
|
||||
FALSE,
|
||||
&NewPrivileges,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
dprintf("\t\t\t\tbRes =%x\n",bRes);
|
||||
|
||||
// Status=NtClose(Token);
|
||||
// dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
|
||||
|
||||
RtlInitUnicodeString(&KeyName,L"test5");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, NULL, NULL);
|
||||
Status = NtLoadKey(HKEY_LOCAL_MACHINE,&ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
dwError=RegLoadKey(HKEY_LOCAL_MACHINE,"def"
|
||||
,"test5");
|
||||
dprintf("\t\t\t\tdwError =%x\n",dwError);
|
||||
|
||||
dprintf("NtOpenKey \\Registry\\Machine : ");
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
Status=NtOpenKey( &hKey, MAXIMUM_ALLOWED, &ObjectAttributes);
|
||||
dprintf("\t\t\tStatus =%x\n",Status);
|
||||
RtlInitUnicodeString(&KeyName,L"test5");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE
|
||||
, NULL, NULL);
|
||||
Status = NtLoadKey(hKey,&ObjectAttributes);
|
||||
dprintf("\t\t\t\tStatus =%x\n",Status);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char Buffer[10];
|
||||
DWORD Result;
|
||||
|
||||
AllocConsole();
|
||||
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
while(1)
|
||||
{
|
||||
dprintf("choose test :\n");
|
||||
dprintf(" 0=Exit\n");
|
||||
dprintf(" 1=Ntxxx read functions\n");
|
||||
dprintf(" 2=Ntxxx write functions : volatile keys\n");
|
||||
dprintf(" 3=Ntxxx write functions : non volatile keys\n");
|
||||
dprintf(" 4=Regxxx functions\n");
|
||||
dprintf(" 5=FlushKey \n");
|
||||
dprintf(" 6=Registry link create test\n");
|
||||
dprintf(" 7=Registry link delete test\n");
|
||||
ReadConsoleA(InputHandle, Buffer, 3, &Result, NULL) ;
|
||||
switch (Buffer[0])
|
||||
{
|
||||
case '0':
|
||||
return(0);
|
||||
case '1':
|
||||
test1();
|
||||
break;
|
||||
case '2':
|
||||
test2();
|
||||
break;
|
||||
case '3':
|
||||
test3();
|
||||
break;
|
||||
case '4':
|
||||
test4();
|
||||
break;
|
||||
case '5':
|
||||
test5();
|
||||
break;
|
||||
case '6':
|
||||
test6();
|
||||
break;
|
||||
case '7':
|
||||
test7();
|
||||
break;
|
||||
#if 0
|
||||
case '8':
|
||||
test8();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
19
reactos/apps/tests/sectest/Makefile
Normal file
19
reactos/apps/tests/sectest/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
# $Id: Makefile,v 1.3 2002/06/02 19:25:00 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = sectest
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
72
reactos/apps/tests/sectest/sectest.c
Normal file
72
reactos/apps/tests/sectest/sectest.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/* $Id: sectest.c,v 1.1 2002/05/13 20:15:33 chorns Exp $ */
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
#include <windows.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
HANDLE hFile;
|
||||
HANDLE Section;
|
||||
PVOID BaseAddress;
|
||||
|
||||
printf("Section Test\n");
|
||||
|
||||
hFile = CreateFile(_T("sectest.txt"),
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
CREATE_ALWAYS,
|
||||
0,
|
||||
0);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("Failed to create file (err=%d)", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
Section = CreateFileMapping(
|
||||
hFile,
|
||||
NULL,
|
||||
PAGE_READWRITE,
|
||||
0,
|
||||
4096,
|
||||
NULL);
|
||||
if (Section == NULL)
|
||||
{
|
||||
printf("Failed to create section (err=%d)", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Mapping view of section\n");
|
||||
BaseAddress = MapViewOfFile(Section,
|
||||
FILE_MAP_ALL_ACCESS,
|
||||
0,
|
||||
0,
|
||||
4096);
|
||||
printf("BaseAddress %x\n", (UINT) BaseAddress);
|
||||
if (BaseAddress == NULL)
|
||||
{
|
||||
printf("Failed to map section (%d)\n", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Clearing section\n");
|
||||
FillMemory(BaseAddress, 4096, ' ');
|
||||
printf("Copying test data to section\n");
|
||||
strcpy(BaseAddress, "test data");
|
||||
|
||||
if (!UnmapViewOfFile(BaseAddress))
|
||||
{
|
||||
printf("Failed to unmap view of file (%d)\n", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!CloseHandle(hFile))
|
||||
{
|
||||
printf("Failed to close file (%d)\n", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
47
reactos/apps/tests/shm/makefile
Normal file
47
reactos/apps/tests/shm/makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
SRV_OBJECTS= shmsrv.o
|
||||
CLT_OBJECTS= shmclt.o
|
||||
|
||||
PROGS= shmsrv.exe shmclt.exe
|
||||
|
||||
BASE_CFLAGS = -I$(PATH_TO_TOP)/include
|
||||
|
||||
LIBS = $(SDK_PATH_LIB)/kernel32.a \
|
||||
$(SDK_PATH_LIB)/ntdll.a
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
.phony: all
|
||||
|
||||
implib:
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: implib clean
|
||||
|
||||
install: $(PROGS:%=$(INSTALL_DIR)/bin/%)
|
||||
|
||||
$(PROGS:%=$(INSTALL_DIR)/bin/%): $(INSTALL_DIR)/bin/%: %
|
||||
$(CP) $* $(INSTALL_DIR)/bin/$*
|
||||
|
||||
dist: $(PROGS:%=$(DIST_DIR)/apps/%)
|
||||
|
||||
$(PROGS:%=$(DIST_DIR)/apps/%): $(DIST_DIR)/apps/%: %
|
||||
$(CP) $* $(DIST_DIR)/apps/$*
|
||||
|
||||
shmsrv.exe: $(SRV_OBJECTS) $(LIBS)
|
||||
$(CC) $(SRV_OBJECTS) $(LIBS) -o shmsrv.exe
|
||||
$(NM) --numeric-sort shmsrv.exe > shmsrv.sym
|
||||
|
||||
shmclt.exe: $(CLT_OBJECTS) $(LIBS)
|
||||
$(CC) $(CLT_OBJECTS) $(LIBS) -o shmclt.exe
|
||||
$(NM) --numeric-sort shmsrv.exe > shmclt.sym
|
||||
|
||||
# EOF
|
61
reactos/apps/tests/shm/shmclt.c
Normal file
61
reactos/apps/tests/shm/shmclt.c
Normal file
@@ -0,0 +1,61 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
HANDLE OutputHandle;
|
||||
HANDLE InputHandle;
|
||||
|
||||
void debug_printf(char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[255];
|
||||
|
||||
va_start(args,fmt);
|
||||
vsprintf(buffer,fmt,args);
|
||||
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
HANDLE Section;
|
||||
PVOID BaseAddress;
|
||||
char buffer[256];
|
||||
|
||||
printf("Shm test server\n");
|
||||
|
||||
Section = OpenFileMappingW (
|
||||
// PAGE_EXECUTE_READWRITE, invalid parameter
|
||||
FILE_MAP_WRITE,
|
||||
FALSE,
|
||||
L"TestSection"
|
||||
);
|
||||
if (Section == NULL)
|
||||
{
|
||||
printf("Failed to open section (err=%d)", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
BaseAddress = MapViewOfFile(Section,
|
||||
FILE_MAP_ALL_ACCESS,
|
||||
0,
|
||||
0,
|
||||
8192);
|
||||
if (BaseAddress == NULL)
|
||||
{
|
||||
printf("Failed to map section (err=%d)\n", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
printf("BaseAddress %x\n", (UINT) BaseAddress);
|
||||
printf("Copying from section\n");
|
||||
strcpy(buffer, BaseAddress);
|
||||
printf("Copyed <%s>\n", buffer);
|
||||
|
||||
// for(;;);
|
||||
return 0;
|
||||
}
|
||||
|
53
reactos/apps/tests/shm/shmsrv.c
Normal file
53
reactos/apps/tests/shm/shmsrv.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* $Id: shmsrv.c,v 1.5 2000/06/29 23:35:10 dwelch Exp $
|
||||
*
|
||||
* FILE : reactos/apps/shm/shmsrv.c
|
||||
* AUTHOR: David Welch
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
HANDLE Section;
|
||||
PVOID BaseAddress;
|
||||
|
||||
printf("Shm test server\n");
|
||||
|
||||
Section = CreateFileMappingW (
|
||||
(HANDLE) 0xFFFFFFFF,
|
||||
NULL,
|
||||
PAGE_READWRITE,
|
||||
0,
|
||||
8192,
|
||||
L"TestSection"
|
||||
);
|
||||
if (Section == NULL)
|
||||
{
|
||||
printf("Failed to create section (err=%d)", GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Mapping view of section\n");
|
||||
BaseAddress = MapViewOfFile(Section,
|
||||
FILE_MAP_ALL_ACCESS,
|
||||
0,
|
||||
0,
|
||||
8192);
|
||||
printf("BaseAddress %x\n", (UINT) BaseAddress);
|
||||
if (BaseAddress == NULL)
|
||||
{
|
||||
printf("Failed to map section\n");
|
||||
}
|
||||
|
||||
printf("Copying to section\n");
|
||||
printf("Copying %s\n", GetCommandLineA());
|
||||
strcpy(BaseAddress, GetCommandLineA());
|
||||
|
||||
Sleep(INFINITE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
20
reactos/apps/tests/simple/makefile
Normal file
20
reactos/apps/tests/simple/makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = windows
|
||||
|
||||
TARGET_NAME = simple
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a gdi32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
15
reactos/apps/tests/simple/simple.c
Normal file
15
reactos/apps/tests/simple/simple.c
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* The simplest Windows program you will ever write.
|
||||
*
|
||||
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
|
||||
*
|
||||
* Colin Peters <colinp at ma.kcom.ne.jp>, July 1, 2001.
|
||||
*/
|
||||
#include <windows.h>
|
||||
|
||||
int STDCALL
|
||||
WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
|
||||
{
|
||||
MessageBox (NULL, "Hello, Windows!", "Hello", MB_OK);
|
||||
return 0;
|
||||
}
|
21
reactos/apps/tests/tcpsvr/makefile
Normal file
21
reactos/apps/tests/tcpsvr/makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# $Id: makefile,v 1.1 2002/06/17 06:01:17 sedwards Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = tcpsvr
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a ws2_32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
173
reactos/apps/tests/tcpsvr/tcpsvr.c
Normal file
173
reactos/apps/tests/tcpsvr/tcpsvr.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/* tcpServer.c
|
||||
*
|
||||
* Simple Winsock TCP server test.
|
||||
* Later will be used as base for ReactOS telnetd
|
||||
*
|
||||
* HISTORY:
|
||||
* 6-15-02 - Added Winsock support to UNIX tcp test
|
||||
* 6-16-02 - Removed Unix support
|
||||
* 6-17-02 - Added extra comments to code
|
||||
*
|
||||
*/
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#undef ERROR
|
||||
#define SUCCESS 0
|
||||
#define ERROR 1
|
||||
|
||||
#define END_LINE 0x0A
|
||||
#define SERVER_PORT 23
|
||||
#define MAX_MSG 100
|
||||
|
||||
/* function readline */
|
||||
int read_line();
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
|
||||
WORD wVersionRequested;
|
||||
WSADATA WsaData;
|
||||
INT Status;
|
||||
int sd, newSd, cliLen;
|
||||
|
||||
struct sockaddr_in cliAddr, servAddr;
|
||||
char line[MAX_MSG];
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 2);
|
||||
|
||||
Status = WSAStartup(wVersionRequested, &WsaData);
|
||||
if (Status != 0) {
|
||||
printf("Could not initialize winsock dll.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* create socket */
|
||||
sd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(sd<0) {
|
||||
perror("cannot open socket ");
|
||||
WSACleanup();
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* bind server port */
|
||||
servAddr.sin_family = AF_INET;
|
||||
servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
servAddr.sin_port = htons(SERVER_PORT);
|
||||
|
||||
if(bind(sd, (struct sockaddr *) &servAddr, sizeof(servAddr))<0) {
|
||||
perror("cannot bind port ");
|
||||
WSACleanup();
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
listen(sd,5);
|
||||
|
||||
while(1) {
|
||||
|
||||
printf("%s: \n
|
||||
To start test, Please telnet to localhost (127.0.0.1) port 23 \n
|
||||
When connected input raw data followed by End of Line\n
|
||||
Test is now running on TCP port %u\n",argv[0],SERVER_PORT);
|
||||
|
||||
cliLen = sizeof(cliAddr);
|
||||
newSd = accept(sd, (struct sockaddr *) &cliAddr, &cliLen);
|
||||
if(newSd<0) {
|
||||
perror("cannot accept connection ");
|
||||
WSACleanup();
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* init line */
|
||||
memset(line,0x0,MAX_MSG);
|
||||
|
||||
/* receive segments */
|
||||
while(read_line(newSd,line)!=ERROR) {
|
||||
|
||||
printf("%s: received from %s:TCP%d : %s\n", argv[0],
|
||||
inet_ntoa(cliAddr.sin_addr),
|
||||
ntohs(cliAddr.sin_port), line);
|
||||
/* init line */
|
||||
memset(line,0x0,MAX_MSG);
|
||||
|
||||
} /* while(read_line) */
|
||||
|
||||
} /* while (1) */
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
|
||||
/* this function is experimental.. I don't know yet if it works */
|
||||
/* correctly or not. Use Steven's readline() function to have */
|
||||
/* something robust. */
|
||||
/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING */
|
||||
|
||||
/* rcv_line is my function readline(). Data is read from the socket when */
|
||||
/* needed, but not byte after bytes. All the received data is read. */
|
||||
/* This means only one call to recv(), instead of one call for */
|
||||
/* each received byte. */
|
||||
/* You can set END_CHAR to whatever means endofline for you. (0x0A is \n)*/
|
||||
/* read_lin returns the number of bytes returned in line_to_return */
|
||||
int read_line(int newSd, char *line_to_return) {
|
||||
|
||||
static int rcv_ptr=0;
|
||||
static char rcv_msg[MAX_MSG];
|
||||
static int n;
|
||||
int offset;
|
||||
|
||||
offset=0;
|
||||
|
||||
while(1) {
|
||||
if(rcv_ptr==0) {
|
||||
/* read data from socket */
|
||||
memset(rcv_msg,0x0,MAX_MSG); /* init buffer */
|
||||
n = recv(newSd, rcv_msg, MAX_MSG, 0); /* wait for data */
|
||||
if (n<0) {
|
||||
perror(" cannot receive data ");
|
||||
return ERROR;
|
||||
} else if (n==0) {
|
||||
printf(" connection closed by client\n");
|
||||
close(newSd);
|
||||
WSACleanup();
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* if new data read on socket */
|
||||
/* OR */
|
||||
/* if another line is still in buffer */
|
||||
|
||||
/* copy line into 'line_to_return' */
|
||||
while(*(rcv_msg+rcv_ptr)!=END_LINE && rcv_ptr<n) {
|
||||
memcpy(line_to_return+offset,rcv_msg+rcv_ptr,1);
|
||||
offset++;
|
||||
rcv_ptr++;
|
||||
}
|
||||
|
||||
/* end of line + end of buffer => return line */
|
||||
if(rcv_ptr==n-1) {
|
||||
/* set last byte to END_LINE */
|
||||
*(line_to_return+offset)=END_LINE;
|
||||
rcv_ptr=0;
|
||||
return ++offset;
|
||||
}
|
||||
|
||||
/* end of line but still some data in buffer => return line */
|
||||
if(rcv_ptr <n-1) {
|
||||
/* set last byte to END_LINE */
|
||||
*(line_to_return+offset)=END_LINE;
|
||||
rcv_ptr++;
|
||||
return ++offset;
|
||||
}
|
||||
|
||||
/* end of buffer but line is not ended => */
|
||||
/* wait for more data to arrive on socket */
|
||||
if(rcv_ptr == n) {
|
||||
rcv_ptr = 0;
|
||||
}
|
||||
|
||||
} /* while */
|
||||
}
|
||||
|
||||
|
11
reactos/apps/tests/test_old/bug2.c
Normal file
11
reactos/apps/tests/test_old/bug2.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int i;
|
||||
puts ("This should print \"wow = I\" for I from 0 to 39 inclusive.");
|
||||
for (i = 0; i < 40; i++)
|
||||
printf ("%s = %d\n", "wow", i);
|
||||
return 0;
|
||||
}
|
53
reactos/apps/tests/test_old/bug3.c
Normal file
53
reactos/apps/tests/test_old/bug3.c
Normal file
@@ -0,0 +1,53 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
const char filename[] = "/tmp/bug3.test";
|
||||
|
||||
f = fopen(filename, "w+");
|
||||
for (i=0; i<9000; i++)
|
||||
putc ('x', f);
|
||||
fseek (f, 8180L, 0);
|
||||
fwrite ("Where does this text go?", 1, 24, f);
|
||||
fflush (f);
|
||||
|
||||
rewind (f);
|
||||
for (i=0; i<9000; i++)
|
||||
{
|
||||
int j;
|
||||
|
||||
if ((j = getc(f)) != 'x')
|
||||
{
|
||||
if (i != 8180)
|
||||
{
|
||||
printf ("Test FAILED!");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[25];
|
||||
|
||||
buf[0] = j;
|
||||
fread (buf + 1, 1, 23, f);
|
||||
buf[24] = '\0';
|
||||
if (strcmp (buf, "Where does this text go?") != 0)
|
||||
{
|
||||
printf ("%s\nTest FAILED!\n", buf);
|
||||
return 1;
|
||||
}
|
||||
i += 23;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
remove(filename);
|
||||
|
||||
puts ("Test succeeded.");
|
||||
|
||||
return 0;
|
||||
}
|
73
reactos/apps/tests/test_old/makefile
Normal file
73
reactos/apps/tests/test_old/makefile
Normal file
@@ -0,0 +1,73 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
PROGS= test-stdio tst-printf tstdiomisc bug2 bug3 \
|
||||
temptest test-fseek test_rdwr testfsd time_t
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
implib:
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: implib clean
|
||||
|
||||
install: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe
|
||||
|
||||
dist: $(PROGS:%=$(DIST_DIR)/apps/%.exe)
|
||||
|
||||
$(PROGS:%=$(DIST_DIR)/apps/%.exe): $(DIST_DIR)/apps/%.exe: %.exe
|
||||
$(CP) $*.exe $(DIST_DIR)/apps/$*.exe
|
||||
|
||||
bug2.exe: bug2.c
|
||||
$(CC) bug2.c -lkernel32 -o bug2.exe
|
||||
$(NM) --numeric-sort bug2.exe > bug2.sym
|
||||
|
||||
bug3.exe: bug3.c
|
||||
$(CC) bug3.c -lkernel32 -o bug3.exe
|
||||
$(NM) --numeric-sort bug3.exe > bug3.sym
|
||||
|
||||
temptest.exe: temptest.c
|
||||
$(CC) temptest.c -lkernel32 -o temptest.exe
|
||||
$(NM) --numeric-sort temptest.exe > temptest.sym
|
||||
|
||||
test-fseek.exe: test-fseek.c
|
||||
$(CC) test-fseek.c -lkernel32 -o test-fseek.exe
|
||||
$(NM) --numeric-sort test-fseek.exe > test-fseek.sym
|
||||
|
||||
test-fwrite.exe: test-fwrite.c
|
||||
$(CC) test-fwrite.c -lkernel32 -o test-fwrite.exe
|
||||
$(NM) --numeric-sort test-fwrite.exe > test-fwrite.sym
|
||||
|
||||
test_rdwr.exe: test_rdwr.c
|
||||
$(CC) test_rdwr.c -lkernel32 -o test_rdwr.exe
|
||||
$(NM) --numeric-sort test_rdwr.exe > test_rdwr.sym
|
||||
|
||||
test-stdio.exe: test-stdio.c
|
||||
$(CC) test-stdio.c -lkernel32 -o test-stdio.exe
|
||||
$(NM) --numeric-sort test-stdio.exe > test-stdio.sym
|
||||
|
||||
tst-printf.exe: tst-printf.c
|
||||
$(CC) tst-printf.c -lkernel32 -o tst-printf.exe
|
||||
$(NM) --numeric-sort tst-printf.exe > tst-printf.sym
|
||||
|
||||
tstdiomisc.exe: tstdiomisc.c
|
||||
$(CC) tstdiomisc.c -lkernel32 -o tstdiomisc.exe
|
||||
$(NM) --numeric-sort tstdiomisc.exe > tstdiomisc.sym
|
||||
|
||||
testfsd.exe: testfsd.c testsuite.c
|
||||
$(CC) testfsd.c testsuite.c -lkernel32 -o testfsd.exe
|
||||
$(NM) --numeric-sort testfsd.exe > testfsd.sym
|
||||
|
||||
time_t.exe: time_t.c
|
||||
$(CC) time_t.c -lkernel32 -o time_t.exe
|
||||
$(NM) --numeric-sort time_t.exe > time_t.sym
|
||||
|
||||
include ../../rules.mak
|
27
reactos/apps/tests/test_old/temptest.c
Normal file
27
reactos/apps/tests/test_old/temptest.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char *files[500];
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 500; i++) {
|
||||
files[i] = tempnam (NULL, "file");
|
||||
if (files[i] == NULL) {
|
||||
printf ("tempnam failed\n");
|
||||
exit (1);
|
||||
}
|
||||
printf ("file: %s\n", files[i]);
|
||||
fp = fopen (files[i], "w");
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
for (i = 0; i < 500; i++)
|
||||
remove (files[i]);
|
||||
|
||||
exit (0);
|
||||
}
|
85
reactos/apps/tests/test_old/test-fseek.c
Normal file
85
reactos/apps/tests/test_old/test-fseek.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define TESTFILE "/tmp/test.dat"
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
FILE *fp;
|
||||
int i, j;
|
||||
|
||||
puts ("\nFile seek test");
|
||||
fp = fopen (TESTFILE, "w");
|
||||
if (fp == NULL)
|
||||
{
|
||||
perror (TESTFILE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
putc (i, fp);
|
||||
if (freopen (TESTFILE, "r", fp) != fp)
|
||||
{
|
||||
perror ("Cannot open file for reading");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 1; i <= 255; i++)
|
||||
{
|
||||
printf ("%3d\n", i);
|
||||
fseek (fp, (long) -i, SEEK_END);
|
||||
if ((j = getc (fp)) != 256 - i)
|
||||
{
|
||||
printf ("SEEK_END failed %d\n", j);
|
||||
break;
|
||||
}
|
||||
if (fseek (fp, (long) i, SEEK_SET))
|
||||
{
|
||||
puts ("Cannot SEEK_SET");
|
||||
break;
|
||||
}
|
||||
if ((j = getc (fp)) != i)
|
||||
{
|
||||
printf ("SEEK_SET failed %d\n", j);
|
||||
break;
|
||||
}
|
||||
if (fseek (fp, (long) i, SEEK_SET))
|
||||
{
|
||||
puts ("Cannot SEEK_SET");
|
||||
break;
|
||||
}
|
||||
if (fseek (fp, (long) (i >= 128 ? -128 : 128), SEEK_CUR))
|
||||
{
|
||||
puts ("Cannot SEEK_CUR");
|
||||
break;
|
||||
}
|
||||
if ((j = getc (fp)) != (i >= 128 ? i - 128 : i + 128))
|
||||
{
|
||||
printf ("SEEK_CUR failed %d\n", j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose (fp);
|
||||
remove (TESTFILE);
|
||||
|
||||
puts ((i > 255) ? "Test succeeded." : "Test FAILED!");
|
||||
return (i > 255) ? 0 : 1;
|
||||
}
|
68
reactos/apps/tests/test_old/test-fwrite.c
Normal file
68
reactos/apps/tests/test_old/test-fwrite.c
Normal file
@@ -0,0 +1,68 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
FILE *f = tmpfile ();
|
||||
char obuf[99999], ibuf[sizeof obuf];
|
||||
char *line;
|
||||
size_t linesz;
|
||||
|
||||
if (! f)
|
||||
{
|
||||
perror ("tmpfile");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fputs ("line\n", f) == EOF)
|
||||
{
|
||||
perror ("fputs");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset (obuf, 'z', sizeof obuf);
|
||||
memset (ibuf, 'y', sizeof ibuf);
|
||||
|
||||
if (fwrite (obuf, sizeof obuf, 1, f) != 1)
|
||||
{
|
||||
perror ("fwrite");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rewind (f);
|
||||
|
||||
line = NULL;
|
||||
linesz = 0;
|
||||
if (getline (&line, &linesz, f) != 5)
|
||||
{
|
||||
perror ("getline");
|
||||
return 1;
|
||||
}
|
||||
if (strcmp (line, "line\n"))
|
||||
{
|
||||
puts ("Lines differ. Test FAILED!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fread (ibuf, sizeof ibuf, 1, f) != 1)
|
||||
{
|
||||
perror ("fread");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (memcmp (ibuf, obuf, sizeof ibuf))
|
||||
{
|
||||
puts ("Buffers differ. Test FAILED!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
asprintf (&line, "\
|
||||
GDB is free software and you are welcome to distribute copies of it\n\
|
||||
under certain conditions; type \"show copying\" to see the conditions.\n\
|
||||
There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\
|
||||
");
|
||||
|
||||
puts ("Test succeeded.");
|
||||
return 0;
|
||||
}
|
55
reactos/apps/tests/test_old/test-stdio.c
Normal file
55
reactos/apps/tests/test_old/test-stdio.c
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char msg1[] = "testing _write\n";
|
||||
char msg2[] = "testing putchar.";
|
||||
char msg3[] = "testing printf.";
|
||||
char tmpbuf[255];
|
||||
FILE* f1;
|
||||
|
||||
write(1, msg1, strlen(msg1));
|
||||
|
||||
write(1, msg2, strlen(msg2));
|
||||
putchar('o'); putchar('k'); putchar('\n');
|
||||
|
||||
write(1, msg3, strlen(msg3));
|
||||
printf("ok\n");
|
||||
|
||||
printf("Testing fopen\n");
|
||||
f1 = fopen("tmp.txt","w+b");
|
||||
if (f1 == NULL)
|
||||
{
|
||||
printf("fopen failed\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
printf("Testing fwrite\n");
|
||||
if (fwrite(msg1, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
|
||||
{
|
||||
printf("fwrite failed\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
printf("Testing fread\n");
|
||||
fseek(f1, 0, SEEK_SET);
|
||||
if (fread(tmpbuf, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1))
|
||||
{
|
||||
printf("fread failed\n");
|
||||
return(1);
|
||||
}
|
||||
if (strcmp(tmpbuf,msg1) != 0)
|
||||
{
|
||||
printf("fread failed, data corrupt\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
printf("Testing fclose\n");
|
||||
if (fclose(f1) != 0)
|
||||
{
|
||||
printf("fclose failed\n");
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
129
reactos/apps/tests/test_old/test_rdwr.c
Normal file
129
reactos/apps/tests/test_old/test_rdwr.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
static const char hello[] = "Hello, world.\n";
|
||||
static const char replace[] = "Hewwo, world.\n";
|
||||
static const size_t replace_from = 2, replace_to = 4;
|
||||
char filename[FILENAME_MAX];
|
||||
char *name = strrchr (*argv, '/');
|
||||
char buf[BUFSIZ];
|
||||
FILE *f;
|
||||
int lose = 0;
|
||||
|
||||
if (name != NULL)
|
||||
++name;
|
||||
else
|
||||
name = *argv;
|
||||
|
||||
(void) sprintf (filename, "/tmp/%s.test", name);
|
||||
|
||||
f = fopen (filename, "w+");
|
||||
if (f == NULL)
|
||||
{
|
||||
perror (filename);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
(void) fputs (hello, f);
|
||||
rewind (f);
|
||||
(void) fgets (buf, sizeof (buf), f);
|
||||
rewind (f);
|
||||
(void) fputs (buf, f);
|
||||
rewind (f);
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < replace_from; ++i)
|
||||
{
|
||||
int c = getc (f);
|
||||
if (c == EOF)
|
||||
{
|
||||
printf ("EOF at %Zu.\n", i);
|
||||
lose = 1;
|
||||
break;
|
||||
}
|
||||
else if (c != hello[i])
|
||||
{
|
||||
printf ("Got '%c' instead of '%c' at %Zu.\n",
|
||||
(unsigned char) c, hello[i], i);
|
||||
lose = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
long int where = ftell (f);
|
||||
if (where == (long int) replace_from)
|
||||
{
|
||||
register size_t i;
|
||||
for (i = replace_from; i < replace_to; ++i)
|
||||
if (putc(replace[i], f) == EOF)
|
||||
{
|
||||
printf ("putc('%c') got %s at %Zu.\n",
|
||||
replace[i], strerror (errno), i);
|
||||
lose = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (where == -1L)
|
||||
{
|
||||
printf ("ftell got %s (should be at %Zu).\n",
|
||||
strerror (errno), replace_from);
|
||||
lose = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("ftell returns %lu; should be %Zu.\n", where, replace_from);
|
||||
lose = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!lose)
|
||||
{
|
||||
rewind (f);
|
||||
if (fgets (buf, sizeof (buf), f) == NULL)
|
||||
{
|
||||
printf ("fgets got %s.\n", strerror(errno));
|
||||
lose = 1;
|
||||
}
|
||||
else if (strcmp (buf, replace))
|
||||
{
|
||||
printf ("Read \"%s\" instead of \"%s\".\n", buf, replace);
|
||||
lose = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (lose)
|
||||
printf ("Test FAILED! Losing file is \"%s\".\n", filename);
|
||||
else
|
||||
{
|
||||
(void) remove (filename);
|
||||
puts ("Test succeeded.");
|
||||
}
|
||||
|
||||
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
315
reactos/apps/tests/test_old/testfsd.c
Normal file
315
reactos/apps/tests/test_old/testfsd.c
Normal file
@@ -0,0 +1,315 @@
|
||||
/* $Id: testfsd.c,v 1.4 2001/07/04 03:07:54 rex Exp $
|
||||
*
|
||||
* FILE: testFSD.c
|
||||
* PURPOSE: A test set for the File System Driver
|
||||
* PROJECT: ReactOS kernel
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "testsuite.h"
|
||||
|
||||
const char *rootDir = "c:\\";
|
||||
const char *systemRootDir = "c:\\ReactOS";
|
||||
const char *systemDllDir = "c:\\ReactOS\\System32";
|
||||
const char *bogusRootFile = "c:\\bogus";
|
||||
const char *bogusDirAndFile = "c:\\bogus\\bogus";
|
||||
const char *bogusSystemRootFile = "c:\\ReactOS\\bogus";
|
||||
const char *bogusSystemDllFile = "c:\\ReactOS\\System32\\bogus";
|
||||
const char *shortFile = "c:\\ReactOS\\boot.bat";
|
||||
const char *longFile = "c:\\ReactOS\\loadros.com";
|
||||
|
||||
void testOpenExistant (void)
|
||||
{
|
||||
HANDLE fileHandle;
|
||||
|
||||
fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile (systemRootDir, GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile (systemDllDir, GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
}
|
||||
|
||||
void testOpenNonExistant (void)
|
||||
{
|
||||
DWORD status;
|
||||
HANDLE fileHandle;
|
||||
|
||||
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||
status = GetLastError ();
|
||||
ASSERT (status == ERROR_FILE_NOT_FOUND);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile (bogusDirAndFile, GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||
status = GetLastError ();
|
||||
ASSERT (status == ERROR_PATH_NOT_FOUND);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile (bogusSystemRootFile, GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||
status = GetLastError ();
|
||||
ASSERT (status == ERROR_FILE_NOT_FOUND);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile (bogusSystemDllFile, GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||
status = GetLastError ();
|
||||
ASSERT (status == ERROR_FILE_NOT_FOUND);
|
||||
CloseHandle (fileHandle);
|
||||
}
|
||||
|
||||
void testCreateExistant (void)
|
||||
{
|
||||
DWORD status;
|
||||
HANDLE fileHandle;
|
||||
|
||||
fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0,
|
||||
CREATE_NEW, 0, 0);
|
||||
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||
status = GetLastError ();
|
||||
ASSERT (status == ERROR_ALREADY_EXISTS);
|
||||
fileHandle = CreateFile (systemRootDir, GENERIC_READ, 0, 0,
|
||||
CREATE_NEW, 0, 0);
|
||||
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||
status = GetLastError ();
|
||||
ASSERT (status == ERROR_ALREADY_EXISTS);
|
||||
fileHandle = CreateFile (systemDllDir, GENERIC_READ, 0, 0,
|
||||
CREATE_NEW, 0, 0);
|
||||
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||
status = GetLastError ();
|
||||
ASSERT (status == ERROR_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
void testCreateNonExistant (void)
|
||||
{
|
||||
DWORD status;
|
||||
HANDLE fileHandle;
|
||||
|
||||
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0,
|
||||
CREATE_NEW, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile (bogusSystemRootFile, GENERIC_READ, 0, 0,
|
||||
CREATE_NEW, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile (bogusSystemDllFile, GENERIC_READ, 0, 0,
|
||||
CREATE_NEW, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
#if 0
|
||||
fileHandle = CreateFile (bogusDirAndFile, GENERIC_READ, 0, 0,
|
||||
CREATE_NEW, 0, 0);
|
||||
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||
status = GetLastError ();
|
||||
ASSERT (status == ERROR_PATH_NOT_FOUND);
|
||||
CloseHandle (fileHandle);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testDeleteFiles (void)
|
||||
{
|
||||
BOOL returnValue;
|
||||
HANDLE fileHandle;
|
||||
|
||||
fileHandle = CreateFile ("bogus", GENERIC_READ, 0, 0,
|
||||
CREATE_NEW, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
returnValue = DeleteFile ("bogus");
|
||||
ASSERT_MSG (returnValue,
|
||||
"Delete of bogus failed, error:%d",
|
||||
GetLastError ());
|
||||
|
||||
#if 0
|
||||
returnValue = DeleteFile (bogusRootFile);
|
||||
ASSERT_MSG (returnValue,
|
||||
"Delete of %s failed, error:%d",
|
||||
bogusRootFile,
|
||||
GetLastError ());
|
||||
returnValue = DeleteFile (bogusRootFile);
|
||||
ASSERT_MSG (!returnValue,
|
||||
"2nd Delete of %s succeeded but should fail",
|
||||
bogusRootFile);
|
||||
returnValue = DeleteFile (bogusSystemRootFile);
|
||||
ASSERT_MSG (returnValue,
|
||||
"Delete of %s failed, error:%d",
|
||||
bogusSystemRootFile,
|
||||
GetLastError ());
|
||||
returnValue = DeleteFile (bogusSystemRootFile);
|
||||
ASSERT_MSG (!returnValue,
|
||||
"2nd Delete of %s succeeded but should fail",
|
||||
bogusSystemRootFile);
|
||||
returnValue = DeleteFile (bogusSystemDllFile);
|
||||
ASSERT_MSG (returnValue,
|
||||
"Delete of %s failed, error:%d",
|
||||
bogusSystemDllFile,
|
||||
GetLastError ());
|
||||
returnValue = DeleteFile (bogusSystemDllFile);
|
||||
ASSERT_MSG (!returnValue,
|
||||
"2nd Delete of %s succeeded but should fail",
|
||||
bogusSystemDllFile);
|
||||
returnValue = DeleteFile (bogusDirAndFile);
|
||||
ASSERT_MSG (!returnValue,
|
||||
"Delete of %s succeded but should fail",
|
||||
bogusDirAndFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
void testOpenWithBlankPathElements (void)
|
||||
{
|
||||
HANDLE fileHandle;
|
||||
|
||||
fileHandle = CreateFile ("c:", GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile ("c:\\\\", GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile ("c:\\\\reactos\\", GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile ("c:\\reactos\\\\", GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile ("c:\\reactos\\\\system32\\", GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile ("c:\\reactos\\system32\\\\", GENERIC_READ, 0, 0,
|
||||
OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
}
|
||||
|
||||
void testReadOnInvalidHandle (void)
|
||||
{
|
||||
BOOL returnValue;
|
||||
char buffer [256];
|
||||
DWORD bytesRead;
|
||||
|
||||
returnValue = ReadFile (INVALID_HANDLE_VALUE,
|
||||
buffer,
|
||||
256,
|
||||
&bytesRead,
|
||||
NULL);
|
||||
ASSERT_MSG (!returnValue,
|
||||
"Read from invalid handle succeeded but should fail",0);
|
||||
ASSERT (GetLastError () != ENOFILE);
|
||||
}
|
||||
|
||||
void testReadOnZeroLengthFile (void)
|
||||
{
|
||||
BOOL returnValue;
|
||||
HANDLE fileHandle;
|
||||
char buffer [256];
|
||||
DWORD bytesRead;
|
||||
|
||||
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0,
|
||||
CREATE_NEW, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
CloseHandle (fileHandle);
|
||||
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
returnValue = ReadFile (fileHandle, buffer, 256, &bytesRead, NULL);
|
||||
ASSERT_MSG (!returnValue,
|
||||
"Read from zero length file succeeded but should fail",0);
|
||||
ASSERT (GetLastError () != ERROR_HANDLE_EOF);
|
||||
CloseHandle (fileHandle);
|
||||
returnValue = DeleteFile (bogusRootFile);
|
||||
ASSERT_MSG (returnValue,
|
||||
"Delete of %s failed, error:%d",
|
||||
bogusRootFile,
|
||||
GetLastError ());
|
||||
}
|
||||
|
||||
void testReadOnShortFile (void)
|
||||
{
|
||||
BOOL returnValue;
|
||||
HANDLE fileHandle;
|
||||
char buffer [256];
|
||||
DWORD bytesRead;
|
||||
|
||||
fileHandle = CreateFile (shortFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
returnValue = ReadFile (fileHandle,
|
||||
buffer,
|
||||
256,
|
||||
&bytesRead,
|
||||
NULL);
|
||||
ASSERT_MSG (returnValue,
|
||||
"Read from short length file failed, error:%d",
|
||||
GetLastError ());
|
||||
ASSERT (bytesRead > 0 && bytesRead < 256);
|
||||
CloseHandle (fileHandle);
|
||||
}
|
||||
|
||||
void testReadOnLongFile (void)
|
||||
{
|
||||
BOOL returnValue;
|
||||
HANDLE fileHandle;
|
||||
char buffer [256];
|
||||
DWORD bytesRead;
|
||||
int count;
|
||||
|
||||
fileHandle = CreateFile (longFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||
for (count = 0; count < 20; count++)
|
||||
{
|
||||
returnValue = ReadFile (fileHandle,
|
||||
buffer,
|
||||
256,
|
||||
&bytesRead,
|
||||
NULL);
|
||||
ASSERT_MSG (returnValue,
|
||||
"Read from short length file failed, error:%d",
|
||||
GetLastError ());
|
||||
ASSERT (bytesRead == 256);
|
||||
}
|
||||
CloseHandle (fileHandle);
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
TEST_RUNNER testRunner;
|
||||
TEST_SUITE testsToRun [] =
|
||||
{
|
||||
ADD_TEST (testOpenExistant),
|
||||
ADD_TEST (testOpenNonExistant),
|
||||
ADD_TEST (testCreateExistant),
|
||||
ADD_TEST (testCreateNonExistant),
|
||||
ADD_TEST (testDeleteFiles),
|
||||
/* ADD_TEST (testOverwriteExistant),*/
|
||||
/* ADD_TEST (testOverwriteNonExistant),*/
|
||||
ADD_TEST (testOpenWithBlankPathElements),
|
||||
ADD_TEST (testReadOnInvalidHandle),
|
||||
ADD_TEST (testReadOnZeroLengthFile),
|
||||
ADD_TEST (testReadOnShortFile),
|
||||
ADD_TEST (testReadOnLongFile),
|
||||
/* ADD_TEST (test), */
|
||||
END_TESTS
|
||||
};
|
||||
|
||||
memset (&testRunner, 0, sizeof (TEST_RUNNER));
|
||||
tsRunTests (&testRunner, testsToRun);
|
||||
tsReportResults (&testRunner);
|
||||
}
|
||||
|
||||
|
65
reactos/apps/tests/test_old/testsuite.c
Normal file
65
reactos/apps/tests/test_old/testsuite.c
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "testsuite.h"
|
||||
|
||||
static PTEST_RUNNER iTestRunner = 0;
|
||||
|
||||
void tsRunTests (PTEST_RUNNER pTestRunner, PTEST_SUITE pTests)
|
||||
{
|
||||
int testIndex;
|
||||
|
||||
iTestRunner = pTestRunner;
|
||||
for (testIndex = 0; pTests [testIndex].testFunc != 0; testIndex++)
|
||||
{
|
||||
pTests [testIndex].testFunc ();
|
||||
pTestRunner->tests++;
|
||||
}
|
||||
}
|
||||
|
||||
void tsReportResults (PTEST_RUNNER pTestRunner)
|
||||
{
|
||||
printf ("\nTotal of %d tests.\n"
|
||||
"Assertions: %d\n"
|
||||
" Assertions which passed: %d\n"
|
||||
" Assertions which failed: %d\n",
|
||||
pTestRunner->tests,
|
||||
pTestRunner->assertions,
|
||||
pTestRunner->successes,
|
||||
pTestRunner->failures);
|
||||
if (pTestRunner->failures == 0)
|
||||
{
|
||||
printf ("\n*** OK ***\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("\n*** FAIL ***\n");
|
||||
}
|
||||
}
|
||||
|
||||
void tsDoAssertion (BOOL pTest,
|
||||
PCHAR pTestText,
|
||||
PCHAR pFunction,
|
||||
int pLine,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
iTestRunner->assertions++;
|
||||
if (!pTest)
|
||||
{
|
||||
va_start (ap, pLine);
|
||||
printf ("%s(%d): ", pFunction, pLine);
|
||||
vprintf (pTestText, ap);
|
||||
printf ("\n");
|
||||
va_end(ap);
|
||||
iTestRunner->failures++;
|
||||
}
|
||||
else
|
||||
{
|
||||
iTestRunner->successes++;
|
||||
}
|
||||
}
|
||||
|
||||
|
44
reactos/apps/tests/test_old/testsuite.h
Normal file
44
reactos/apps/tests/test_old/testsuite.h
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
#ifndef H_TESTSUITE_H
|
||||
#define H_TESTSUITE_H
|
||||
|
||||
struct TestSuite
|
||||
{
|
||||
char *name;
|
||||
void (*testFunc)(void);
|
||||
};
|
||||
|
||||
typedef struct TestSuite TEST_SUITE, *PTEST_SUITE;
|
||||
|
||||
#define ADD_TEST(x) {#x, x}
|
||||
#define END_TESTS {0, 0}
|
||||
#define COUNT_TESTS(x) (sizeof x/sizeof (struct TestSuite))
|
||||
|
||||
struct TestRunner
|
||||
{
|
||||
int tests;
|
||||
int assertions;
|
||||
int failures;
|
||||
int successes;
|
||||
};
|
||||
|
||||
typedef struct TestRunner TEST_RUNNER, *PTEST_RUNNER;
|
||||
|
||||
void tsDoAssertion (BOOL pTest,
|
||||
PCHAR pTestText,
|
||||
PCHAR pFunction,
|
||||
int pLine,
|
||||
...);
|
||||
|
||||
#ifdef ASSERT
|
||||
#undef ASSERT
|
||||
#endif
|
||||
#define ASSERT(x) tsDoAssertion (x, "assertion \"" ## #x ## "\" failed", __FUNCTION__, __LINE__)
|
||||
#define ASSERT_MSG(x,y,a...) tsDoAssertion (x, y, __FUNCTION__, __LINE__,a)
|
||||
|
||||
void tsRunTests (PTEST_RUNNER pTestRunner, PTEST_SUITE pTests);
|
||||
void tsReportResults (PTEST_RUNNER pTestRunner);
|
||||
|
||||
#endif
|
||||
|
||||
|
12
reactos/apps/tests/test_old/time_t.c
Normal file
12
reactos/apps/tests/test_old/time_t.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct tm *ptr;
|
||||
time_t lt;
|
||||
|
||||
lt = time(NULL);
|
||||
ptr = localtime(<);
|
||||
printf(asctime(ptr));
|
||||
}
|
311
reactos/apps/tests/test_old/tst-printf.c
Normal file
311
reactos/apps/tests/test_old/tst-printf.c
Normal file
@@ -0,0 +1,311 @@
|
||||
/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef BSD
|
||||
#include </usr/include/stdio.h>
|
||||
#define EXIT_SUCCESS 0
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <float.h>
|
||||
|
||||
void rfg1 (void);
|
||||
void rfg2 (void);
|
||||
|
||||
|
||||
void
|
||||
fmtchk (const char *fmt)
|
||||
{
|
||||
(void) fputs(fmt, stdout);
|
||||
(void) printf(":\t`");
|
||||
(void) printf(fmt, 0x12);
|
||||
(void) printf("'\n");
|
||||
}
|
||||
|
||||
void
|
||||
fmtst1chk (const char *fmt)
|
||||
{
|
||||
(void) fputs(fmt, stdout);
|
||||
(void) printf(":\t`");
|
||||
(void) printf(fmt, 4, 0x12);
|
||||
(void) printf("'\n");
|
||||
}
|
||||
|
||||
void
|
||||
fmtst2chk (const char *fmt)
|
||||
{
|
||||
(void) fputs(fmt, stdout);
|
||||
(void) printf(":\t`");
|
||||
(void) printf(fmt, 4, 4, 0x12);
|
||||
(void) printf("'\n");
|
||||
}
|
||||
|
||||
/* This page is covered by the following copyright: */
|
||||
|
||||
/* (C) Copyright C E Chew
|
||||
*
|
||||
* Feel free to copy, use and distribute this software provided:
|
||||
*
|
||||
* 1. you do not pretend that you wrote it
|
||||
* 2. you leave this copyright notice intact.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Extracted from exercise.c for glibc-1.05 bug report by Bruce Evans.
|
||||
*/
|
||||
|
||||
#define DEC -123
|
||||
#define INT 255
|
||||
#define UNS (~0)
|
||||
|
||||
/* Formatted Output Test
|
||||
*
|
||||
* This exercises the output formatting code.
|
||||
*/
|
||||
|
||||
void
|
||||
fp_test (void)
|
||||
{
|
||||
int i, j, k, l;
|
||||
char buf[7];
|
||||
char *prefix = buf;
|
||||
char tp[20];
|
||||
|
||||
puts("\nFormatted output test");
|
||||
printf("prefix 6d 6o 6x 6X 6u\n");
|
||||
strcpy(prefix, "%");
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
for (k = 0; k < 2; k++) {
|
||||
for (l = 0; l < 2; l++) {
|
||||
strcpy(prefix, "%");
|
||||
if (i == 0) strcat(prefix, "-");
|
||||
if (j == 0) strcat(prefix, "+");
|
||||
if (k == 0) strcat(prefix, "#");
|
||||
if (l == 0) strcat(prefix, "0");
|
||||
printf("%5s |", prefix);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6d |");
|
||||
printf(tp, DEC);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6o |");
|
||||
printf(tp, INT);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6x |");
|
||||
printf(tp, INT);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6X |");
|
||||
printf(tp, INT);
|
||||
strcpy(tp, prefix);
|
||||
strcat(tp, "6u |");
|
||||
printf(tp, UNS);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("%10s\n", (char *) NULL);
|
||||
printf("%-10s\n", (char *) NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
static char shortstr[] = "Hi, Z.";
|
||||
static char longstr[] = "Good morning, Doctor Chandra. This is Hal. \
|
||||
I am ready for my first lesson today.";
|
||||
|
||||
fmtchk("%.4x");
|
||||
fmtchk("%04x");
|
||||
fmtchk("%4.4x");
|
||||
fmtchk("%04.4x");
|
||||
fmtchk("%4.3x");
|
||||
fmtchk("%04.3x");
|
||||
|
||||
fmtst1chk("%.*x");
|
||||
fmtst1chk("%0*x");
|
||||
fmtst2chk("%*.*x");
|
||||
fmtst2chk("%0*.*x");
|
||||
|
||||
#ifndef BSD
|
||||
printf("bad format:\t\"%b\"\n");
|
||||
printf("nil pointer (padded):\t\"%10p\"\n", (void *) NULL);
|
||||
#endif
|
||||
|
||||
printf("decimal negative:\t\"%d\"\n", -2345);
|
||||
printf("octal negative:\t\"%o\"\n", -2345);
|
||||
printf("hex negative:\t\"%x\"\n", -2345);
|
||||
printf("long decimal number:\t\"%ld\"\n", -123456L);
|
||||
printf("long octal negative:\t\"%lo\"\n", -2345L);
|
||||
printf("long unsigned decimal number:\t\"%lu\"\n", -123456L);
|
||||
printf("zero-padded LDN:\t\"%010ld\"\n", -123456L);
|
||||
printf("left-adjusted ZLDN:\t\"%-010ld\"\n", -123456);
|
||||
printf("space-padded LDN:\t\"%10ld\"\n", -123456L);
|
||||
printf("left-adjusted SLDN:\t\"%-10ld\"\n", -123456L);
|
||||
|
||||
printf("zero-padded string:\t\"%010s\"\n", shortstr);
|
||||
printf("left-adjusted Z string:\t\"%-010s\"\n", shortstr);
|
||||
printf("space-padded string:\t\"%10s\"\n", shortstr);
|
||||
printf("left-adjusted S string:\t\"%-10s\"\n", shortstr);
|
||||
printf("null string:\t\"%s\"\n", (char *)NULL);
|
||||
printf("limited string:\t\"%.22s\"\n", longstr);
|
||||
|
||||
printf("e-style >= 1:\t\"%e\"\n", 12.34);
|
||||
printf("e-style >= .1:\t\"%e\"\n", 0.1234);
|
||||
printf("e-style < .1:\t\"%e\"\n", 0.001234);
|
||||
printf("e-style big:\t\"%.60e\"\n", 1e20);
|
||||
printf ("e-style == .1:\t\"%e\"\n", 0.1);
|
||||
printf("f-style >= 1:\t\"%f\"\n", 12.34);
|
||||
printf("f-style >= .1:\t\"%f\"\n", 0.1234);
|
||||
printf("f-style < .1:\t\"%f\"\n", 0.001234);
|
||||
printf("g-style >= 1:\t\"%g\"\n", 12.34);
|
||||
printf("g-style >= .1:\t\"%g\"\n", 0.1234);
|
||||
printf("g-style < .1:\t\"%g\"\n", 0.001234);
|
||||
printf("g-style big:\t\"%.60g\"\n", 1e20);
|
||||
|
||||
printf (" %6.5f\n", .099999999860301614);
|
||||
printf (" %6.5f\n", .1);
|
||||
printf ("x%5.4fx\n", .5);
|
||||
|
||||
printf ("%#03x\n", 1);
|
||||
|
||||
{
|
||||
double d = FLT_MIN;
|
||||
int niter = 17;
|
||||
|
||||
while (niter-- != 0)
|
||||
printf ("%.17e\n", d / 2);
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
printf ("%15.5e\n", 4.9406564584124654e-324);
|
||||
|
||||
#define FORMAT "|%12.4f|%12.4e|%12.4g|\n"
|
||||
printf (FORMAT, 0.0, 0.0, 0.0);
|
||||
printf (FORMAT, 1.0, 1.0, 1.0);
|
||||
printf (FORMAT, -1.0, -1.0, -1.0);
|
||||
printf (FORMAT, 100.0, 100.0, 100.0);
|
||||
printf (FORMAT, 1000.0, 1000.0, 1000.0);
|
||||
printf (FORMAT, 10000.0, 10000.0, 10000.0);
|
||||
printf (FORMAT, 12345.0, 12345.0, 12345.0);
|
||||
printf (FORMAT, 100000.0, 100000.0, 100000.0);
|
||||
printf (FORMAT, 123456.0, 123456.0, 123456.0);
|
||||
#undef FORMAT
|
||||
|
||||
{
|
||||
char buf[20];
|
||||
printf ("sprintf (\"%%30s\", \"foo\") == %d, \"%.*s\"\n",
|
||||
sprintf (buf, "%30s", "foo"), sizeof (buf), buf);
|
||||
}
|
||||
|
||||
fp_test ();
|
||||
|
||||
printf ("%e should be 1.234568e+06\n", 1234567.8);
|
||||
printf ("%f should be 1234567.800000\n", 1234567.8);
|
||||
printf ("%g should be 1.23457e+06\n", 1234567.8);
|
||||
printf ("%g should be 123.456\n", 123.456);
|
||||
printf ("%g should be 1e+06\n", 1000000.0);
|
||||
printf ("%g should be 10\n", 10.0);
|
||||
printf ("%g should be 0.02\n", 0.02);
|
||||
|
||||
{
|
||||
double x=1.0;
|
||||
printf("%.17f\n",(1.0/x/10.0+1.0)*x-x);
|
||||
}
|
||||
|
||||
puts ("--- Should be no further output. ---");
|
||||
rfg1 ();
|
||||
rfg2 ();
|
||||
|
||||
{
|
||||
char buf[200];
|
||||
int result;
|
||||
|
||||
sprintf(buf,"%*s%*s%*s",-1,"one",-20,"two",-30,"three");
|
||||
|
||||
result = strcmp (buf,
|
||||
"onetwo three ");
|
||||
|
||||
puts (result != 0 ? "Test failed!" : "Test ok.");
|
||||
return result != 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
rfg1 (void)
|
||||
{
|
||||
char buf[100];
|
||||
|
||||
sprintf (buf, "%5.s", "xyz");
|
||||
if (strcmp (buf, " ") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " ");
|
||||
sprintf (buf, "%5.f", 33.3);
|
||||
if (strcmp (buf, " 33") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 33");
|
||||
sprintf (buf, "%8.e", 33.3e7);
|
||||
if (strcmp (buf, " 3e+08") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 3e+08");
|
||||
sprintf (buf, "%8.E", 33.3e7);
|
||||
if (strcmp (buf, " 3E+08") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 3E+08");
|
||||
sprintf (buf, "%.g", 33.3);
|
||||
if (strcmp (buf, "3e+01") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3e+01");
|
||||
sprintf (buf, "%.G", 33.3);
|
||||
if (strcmp (buf, "3E+01") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3E+01");
|
||||
}
|
||||
|
||||
void
|
||||
rfg2 (void)
|
||||
{
|
||||
int prec;
|
||||
char buf[100];
|
||||
|
||||
prec = 0;
|
||||
sprintf (buf, "%.*g", prec, 3.3);
|
||||
if (strcmp (buf, "3") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3");
|
||||
prec = 0;
|
||||
sprintf (buf, "%.*G", prec, 3.3);
|
||||
if (strcmp (buf, "3") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, "3");
|
||||
prec = 0;
|
||||
sprintf (buf, "%7.*G", prec, 3.33);
|
||||
if (strcmp (buf, " 3") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 3");
|
||||
prec = 3;
|
||||
sprintf (buf, "%04.*o", prec, 33);
|
||||
if (strcmp (buf, " 041") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 041");
|
||||
prec = 7;
|
||||
sprintf (buf, "%09.*u", prec, 33);
|
||||
if (strcmp (buf, " 0000033") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 0000033");
|
||||
prec = 3;
|
||||
sprintf (buf, "%04.*x", prec, 33);
|
||||
if (strcmp (buf, " 021") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 021");
|
||||
prec = 3;
|
||||
sprintf (buf, "%04.*X", prec, 33);
|
||||
if (strcmp (buf, " 021") != 0)
|
||||
printf ("got: '%s', expected: '%s'\n", buf, " 021");
|
||||
}
|
56
reactos/apps/tests/test_old/tstdiomisc.c
Normal file
56
reactos/apps/tests/test_old/tstdiomisc.c
Normal file
@@ -0,0 +1,56 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
t1 (void)
|
||||
{
|
||||
int n = -1;
|
||||
sscanf ("abc ", "abc %n", &n);
|
||||
printf ("t1: count=%d\n", n);
|
||||
|
||||
return n != 5;
|
||||
}
|
||||
|
||||
int
|
||||
t2 (void)
|
||||
{
|
||||
int result = 0;
|
||||
int n;
|
||||
long N;
|
||||
int retval;
|
||||
#define SCAN(INPUT, FORMAT, VAR, EXP_RES, EXP_VAL) \
|
||||
VAR = -1; \
|
||||
retval = sscanf (INPUT, FORMAT, &VAR); \
|
||||
printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \
|
||||
INPUT, FORMAT, retval, (long int) VAR); \
|
||||
result |= retval != EXP_RES || VAR != EXP_VAL
|
||||
|
||||
SCAN ("12345", "%ld", N, 1, 12345);
|
||||
SCAN ("12345", "%llllld", N, 0, -1);
|
||||
SCAN ("12345", "%LLLLLd", N, 0, -1);
|
||||
SCAN ("test ", "%*s%n", n, 0, 4);
|
||||
SCAN ("test ", "%2*s%n", n, 0, -1);
|
||||
SCAN ("12 ", "%l2d", n, 0, -1);
|
||||
SCAN ("12 ", "%2ld", N, 1, 12);
|
||||
|
||||
n = -1;
|
||||
N = -1;
|
||||
retval = sscanf ("1 1", "%d %Z", &n, &N);
|
||||
printf ("sscanf (\"1 1\", \"%%d %%Z\", &n, &N) => %d, n = %d, N = %ld\n", \
|
||||
retval, n, N); \
|
||||
result |= retval != 1 || n != 1 || N != -1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
result |= t1 ();
|
||||
result |= t2 ();
|
||||
|
||||
result |= fflush (stdout) == EOF;
|
||||
|
||||
return result;
|
||||
}
|
102
reactos/apps/tests/tests/GetSysMetrics/GetSysMetrics.c
Normal file
102
reactos/apps/tests/tests/GetSysMetrics/GetSysMetrics.c
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Simple program to display the Windows System Metrics.
|
||||
*
|
||||
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
|
||||
*
|
||||
* Robert Dickenson <robd@reactos.org>, July 11, 2002.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
fprintf(stderr,"Windows System Metric:\t Value\n");
|
||||
|
||||
fprintf(stderr," SM_ARRANGE:\t\t %d\n", GetSystemMetrics(SM_ARRANGE));
|
||||
fprintf(stderr," SM_CLEANBOOT:\t %d\n", GetSystemMetrics(SM_CLEANBOOT));
|
||||
// fprintf(stderr," SM_CMONITORS:\t %d\n", GetSystemMetrics(SM_CMONITORS));
|
||||
fprintf(stderr," SM_CMOUSEBUTTONS:\t %d\n", GetSystemMetrics(SM_CMOUSEBUTTONS));
|
||||
fprintf(stderr," SM_CXBORDER:\t %d\n", GetSystemMetrics(SM_CXBORDER));
|
||||
fprintf(stderr," SM_CYBORDER:\t %d\n", GetSystemMetrics(SM_CYBORDER));
|
||||
fprintf(stderr," SM_CXCURSOR:\t %d\n", GetSystemMetrics(SM_CXCURSOR));
|
||||
fprintf(stderr," SM_CYCURSOR:\t %d\n", GetSystemMetrics(SM_CYCURSOR));
|
||||
fprintf(stderr," SM_CXDLGFRAME:\t %d\n", GetSystemMetrics(SM_CXDLGFRAME));
|
||||
fprintf(stderr," SM_CYDLGFRAME:\t %d\n", GetSystemMetrics(SM_CYDLGFRAME));
|
||||
fprintf(stderr," SM_CXDOUBLECLK:\t %d\n", GetSystemMetrics(SM_CXDOUBLECLK));
|
||||
fprintf(stderr," SM_CYDOUBLECLK:\t %d\n", GetSystemMetrics(SM_CYDOUBLECLK));
|
||||
fprintf(stderr," SM_CXDRAG:\t\t %d\n", GetSystemMetrics(SM_CXDRAG));
|
||||
fprintf(stderr," SM_CYDRAG:\t\t %d\n", GetSystemMetrics(SM_CYDRAG));
|
||||
fprintf(stderr," SM_CXEDGE:\t\t %d\n", GetSystemMetrics(SM_CXEDGE));
|
||||
fprintf(stderr," SM_CYEDGE:\t\t %d\n", GetSystemMetrics(SM_CYEDGE));
|
||||
fprintf(stderr," SM_CXFIXEDFRAME:\t %d\n", GetSystemMetrics(SM_CXFIXEDFRAME));
|
||||
fprintf(stderr," SM_CYFIXEDFRAME:\t %d\n", GetSystemMetrics(SM_CYFIXEDFRAME));
|
||||
fprintf(stderr," SM_CXFRAME:\t\t %d\n", GetSystemMetrics(SM_CXFRAME));
|
||||
fprintf(stderr," SM_CYFRAME:\t\t %d\n", GetSystemMetrics(SM_CYFRAME));
|
||||
fprintf(stderr," SM_CXFULLSCREEN:\t %d\n", GetSystemMetrics(SM_CXFULLSCREEN));
|
||||
fprintf(stderr," SM_CYFULLSCREEN:\t %d\n", GetSystemMetrics(SM_CYFULLSCREEN));
|
||||
fprintf(stderr," SM_CXHSCROLL:\t %d\n", GetSystemMetrics(SM_CXHSCROLL));
|
||||
fprintf(stderr," SM_CYHSCROLL:\t %d\n", GetSystemMetrics(SM_CYHSCROLL));
|
||||
fprintf(stderr," SM_CXHTHUMB:\t %d\n", GetSystemMetrics(SM_CXHTHUMB));
|
||||
fprintf(stderr," SM_CXICON:\t\t %d\n", GetSystemMetrics(SM_CXICON));
|
||||
fprintf(stderr," SM_CYICON:\t\t %d\n", GetSystemMetrics(SM_CYICON));
|
||||
fprintf(stderr," SM_CXICONSPACING:\t %d\n", GetSystemMetrics(SM_CXICONSPACING));
|
||||
fprintf(stderr," SM_CYICONSPACING:\t %d\n", GetSystemMetrics(SM_CYICONSPACING));
|
||||
fprintf(stderr," SM_CXMAXIMIZED:\t %d\n", GetSystemMetrics(SM_CXMAXIMIZED));
|
||||
fprintf(stderr," SM_CYMAXIMIZED:\t %d\n", GetSystemMetrics(SM_CYMAXIMIZED));
|
||||
fprintf(stderr," SM_CXMAXTRACK:\t %d\n", GetSystemMetrics(SM_CXMAXTRACK));
|
||||
fprintf(stderr," SM_CYMAXTRACK:\t %d\n", GetSystemMetrics(SM_CYMAXTRACK));
|
||||
fprintf(stderr," SM_CXMENUCHECK:\t %d\n", GetSystemMetrics(SM_CXMENUCHECK));
|
||||
fprintf(stderr," SM_CYMENUCHECK:\t %d\n", GetSystemMetrics(SM_CYMENUCHECK));
|
||||
fprintf(stderr," SM_CXMENUSIZE:\t %d\n", GetSystemMetrics(SM_CXMENUSIZE));
|
||||
fprintf(stderr," SM_CYMENUSIZE:\t %d\n", GetSystemMetrics(SM_CYMENUSIZE));
|
||||
fprintf(stderr," SM_CXMIN:\t\t %d\n", GetSystemMetrics(SM_CXMIN));
|
||||
fprintf(stderr," SM_CYMIN:\t\t %d\n", GetSystemMetrics(SM_CYMIN));
|
||||
fprintf(stderr," SM_CXMINIMIZED:\t %d\n", GetSystemMetrics(SM_CXMINIMIZED));
|
||||
fprintf(stderr," SM_CYMINIMIZED:\t %d\n", GetSystemMetrics(SM_CYMINIMIZED));
|
||||
fprintf(stderr," SM_CXMINSPACING:\t %d\n", GetSystemMetrics(SM_CXMINSPACING));
|
||||
fprintf(stderr," SM_CYMINSPACING:\t %d\n", GetSystemMetrics(SM_CYMINSPACING));
|
||||
fprintf(stderr," SM_CXMINTRACK:\t %d\n", GetSystemMetrics(SM_CXMINTRACK));
|
||||
fprintf(stderr," SM_CYMINTRACK:\t %d\n", GetSystemMetrics(SM_CYMINTRACK));
|
||||
fprintf(stderr," SM_CXSCREEN:\t %d\n", GetSystemMetrics(SM_CXSCREEN));
|
||||
fprintf(stderr," SM_CYSCREEN:\t %d\n", GetSystemMetrics(SM_CYSCREEN));
|
||||
fprintf(stderr," SM_CXSIZE:\t\t %d\n", GetSystemMetrics(SM_CXSIZE));
|
||||
fprintf(stderr," SM_CYSIZE:\t\t %d\n", GetSystemMetrics(SM_CYSIZE));
|
||||
fprintf(stderr," SM_CXSIZEFRAME:\t %d\n", GetSystemMetrics(SM_CXSIZEFRAME));
|
||||
fprintf(stderr," SM_CYSIZEFRAME:\t %d\n", GetSystemMetrics(SM_CYSIZEFRAME));
|
||||
|
||||
fprintf(stderr," SM_CXSMICON:\t %d\n", GetSystemMetrics(SM_CXSMICON));
|
||||
fprintf(stderr," SM_CYSMICON:\t %d\n", GetSystemMetrics(SM_CYSMICON));
|
||||
fprintf(stderr," SM_CXSMSIZE:\t %d\n", GetSystemMetrics(SM_CXSMSIZE));
|
||||
fprintf(stderr," SM_CYSMSIZE:\t %d\n", GetSystemMetrics(SM_CYSMSIZE));
|
||||
// fprintf(stderr," SM_CXVIRTUALSCREEN:\t %d\n", GetSystemMetrics(SM_CXVIRTUALSCREEN));
|
||||
// fprintf(stderr," SM_CYVIRTUALSCREEN:\t %d\n", GetSystemMetrics(SM_CYVIRTUALSCREEN));
|
||||
fprintf(stderr," SM_CXVSCROLL:\t %d\n", GetSystemMetrics(SM_CXVSCROLL));
|
||||
fprintf(stderr," SM_CYVSCROLL:\t %d\n", GetSystemMetrics(SM_CYVSCROLL));
|
||||
fprintf(stderr," SM_CYCAPTION:\t %d\n", GetSystemMetrics(SM_CYCAPTION));
|
||||
fprintf(stderr," SM_CYKANJIWINDOW:\t %d\n", GetSystemMetrics(SM_CYKANJIWINDOW));
|
||||
fprintf(stderr," SM_CYMENU:\t\t %d\n", GetSystemMetrics(SM_CYMENU));
|
||||
fprintf(stderr," SM_CYSMCAPTION:\t %d\n", GetSystemMetrics(SM_CYSMCAPTION));
|
||||
fprintf(stderr," SM_CYVTHUMB:\t %d\n", GetSystemMetrics(SM_CYVTHUMB));
|
||||
fprintf(stderr," SM_DBCSENABLED:\t %d\n", GetSystemMetrics(SM_DBCSENABLED));
|
||||
fprintf(stderr," SM_DEBUG:\t\t %d\n", GetSystemMetrics(SM_DEBUG));
|
||||
// fprintf(stderr," SM_IMMENABLED:\t %d\n", GetSystemMetrics(SM_IMMENABLED));
|
||||
|
||||
fprintf(stderr," SM_MENUDROPALIGNMENT: %d\n", GetSystemMetrics(SM_MENUDROPALIGNMENT));
|
||||
fprintf(stderr," SM_MIDEASTENABLED:\t %d\n", GetSystemMetrics(SM_MIDEASTENABLED));
|
||||
fprintf(stderr," SM_MOUSEPRESENT:\t %d\n", GetSystemMetrics(SM_MOUSEPRESENT));
|
||||
#ifndef _MSC_VER
|
||||
fprintf(stderr," SM_MOUSEWHEELPRESENT: %d\n", GetSystemMetrics(SM_MOUSEWHEELPRESENT));
|
||||
#endif
|
||||
fprintf(stderr," SM_NETWORK:\t\t %d\n", GetSystemMetrics(SM_NETWORK));
|
||||
fprintf(stderr," SM_PENWINDOWS:\t %d\n", GetSystemMetrics(SM_PENWINDOWS));
|
||||
// fprintf(stderr," SM_REMOTESESSION:\t %d\n", GetSystemMetrics(SM_REMOTESESSION));
|
||||
fprintf(stderr," SM_SECURE:\t\t %d\n", GetSystemMetrics(SM_SECURE));
|
||||
// fprintf(stderr," SM_SAMEDISPLAYFORMAT: %d\n", GetSystemMetrics(SM_SAMEDISPLAYFORMAT));
|
||||
fprintf(stderr," SM_SHOWSOUNDS:\t %d\n", GetSystemMetrics(SM_SHOWSOUNDS));
|
||||
fprintf(stderr," SM_SLOWMACHINE:\t %d\n", GetSystemMetrics(SM_SLOWMACHINE));
|
||||
fprintf(stderr," SM_SWAPBUTTON:\t %d\n", GetSystemMetrics(SM_SWAPBUTTON));
|
||||
// fprintf(stderr," SM_XVIRTUALSCREEN: %d\n", GetSystemMetrics(SM_XVIRTUALSCREEN));
|
||||
// fprintf(stderr," SM_YVIRTUALSCREEN: %d\n", GetSystemMetrics(SM_YVIRTUALSCREEN));
|
||||
return 0;
|
||||
}
|
20
reactos/apps/tests/tests/GetSysMetrics/Makefile
Normal file
20
reactos/apps/tests/tests/GetSysMetrics/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = GetSysMetrics
|
||||
|
||||
TARGET_SDKLIBS = user32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
37
reactos/apps/tests/tests/GetSystemInfo/GetSystemInfo.c
Normal file
37
reactos/apps/tests/tests/GetSystemInfo/GetSystemInfo.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This example demonstrates dynamical loading of (internal) Win32 DLLS.
|
||||
* I dont know why this was called hello5 in the wine tree - sedwards
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
void CALLBACK (*fnGetSystemInfo)(LPSYSTEM_INFO si);
|
||||
HMODULE kernel32;
|
||||
|
||||
kernel32 = LoadLibrary("KERNEL32");
|
||||
if (kernel32<32) {
|
||||
fprintf(stderr,"FATAL: could not load KERNEL32!\n");
|
||||
return 0;
|
||||
}
|
||||
fnGetSystemInfo = (void*)GetProcAddress(kernel32,"GetSystemInfo");
|
||||
if (!fnGetSystemInfo) {
|
||||
fprintf(stderr,"FATAL: could not find GetSystemInfo!\n");
|
||||
return 0;
|
||||
}
|
||||
fnGetSystemInfo(&si);
|
||||
fprintf(stderr,"QuerySystemInfo returns:\n");
|
||||
fprintf(stderr," wProcessorArchitecture: %d\n",si.u.s.wProcessorArchitecture);
|
||||
fprintf(stderr," dwPageSize: %ld\n",si.dwPageSize);
|
||||
fprintf(stderr," lpMinimumApplicationAddress: %p\n",si.lpMinimumApplicationAddress);
|
||||
fprintf(stderr," lpMaximumApplicationAddress: %p\n",si.lpMaximumApplicationAddress);
|
||||
fprintf(stderr," dwActiveProcessorMask: %ld\n",si.dwActiveProcessorMask);
|
||||
fprintf(stderr," dwNumberOfProcessors: %ld\n",si.dwNumberOfProcessors);
|
||||
fprintf(stderr," dwProcessorType: %ld\n",si.dwProcessorType);
|
||||
fprintf(stderr," dwAllocationGranularity: %ld\n",si.dwAllocationGranularity);
|
||||
fprintf(stderr," wProcessorLevel: %d\n",si.wProcessorLevel);
|
||||
fprintf(stderr," wProcessorRevision: %d\n",si.wProcessorRevision);
|
||||
return 0;
|
||||
}
|
26
reactos/apps/tests/tests/GetSystemInfo/Makefile
Normal file
26
reactos/apps/tests/tests/GetSystemInfo/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
PROGS = GetSystemInfo
|
||||
|
||||
OBJECTS = GetSystemInfo.o
|
||||
|
||||
LIBS =
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.coff *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
GetSystemInfo.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o GetSystemInfo.exe
|
||||
$(NM) --numeric-sort GetSystemInfo.exe > GetSystemInfo.sym
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
26
reactos/apps/tests/tests/Mutex/Makefile
Normal file
26
reactos/apps/tests/tests/Mutex/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
# 10-11-01 Steven Edwards <Steven.Edwards@KnowledgeSentry.net>
|
||||
# Mutex Benchmarks from the Wineserver Linux Kernel Module
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
PROGS = fivemutex rapidmutex
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
fivemutex.exe: fivemutex.c
|
||||
$(CC) fivemutex.c -lkernel32 -o fivemutex.exe
|
||||
$(NM) --numeric-sort fivemutex.exe > fivemutex.sym
|
||||
|
||||
rapidmutex.exe: rapidmutex.c
|
||||
$(CC) rapidmutex.c -lkernel32 -o rapidmutex.exe
|
||||
$(NM) --numeric-sort rapidmutex.exe > rapidmutex.sym
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
124
reactos/apps/tests/tests/Mutex/fivemutex.c
Normal file
124
reactos/apps/tests/tests/Mutex/fivemutex.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* fivemutex.c: hungry philosophers problem
|
||||
*
|
||||
* (c) Copyright D.W.Howells 2000.
|
||||
* All rights reserved
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ERR(X,Y) do { if (X) { perror(""Y""); return 1; } } while(0)
|
||||
#define RUNLENGTH 4
|
||||
|
||||
int count[5];
|
||||
|
||||
const char *names[] = {
|
||||
"five/1", "five/2", "five/3", "five/4", "five/5"
|
||||
};
|
||||
|
||||
DWORD WINAPI child(LPVOID tparam)
|
||||
{
|
||||
HANDLE left, right, first, second;
|
||||
const char *lname, *rname;
|
||||
int pid = (int) tparam;
|
||||
int wt;
|
||||
|
||||
lname = names[pid%5];
|
||||
rname = names[(pid+1)%5];
|
||||
|
||||
/* create a mutex */
|
||||
left = CreateMutex(NULL,0,lname); ERR(!left,"create left");
|
||||
right = CreateMutex(NULL,0,rname); ERR(!left,"create right");
|
||||
|
||||
printf("[%d] left: %p [%s]\n",pid,left,lname);
|
||||
printf("[%d] right: %p [%s]\n",pid,right,rname);
|
||||
|
||||
/* pick the forks up in numerical order, else risk starvation */
|
||||
if (pid%5 < (pid+1)%5) {
|
||||
first = left;
|
||||
second = right;
|
||||
}
|
||||
else {
|
||||
first = right;
|
||||
second = left;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
/* grab the left mutex */
|
||||
wt = WaitForMultipleObjects(1,&first,0,INFINITE);
|
||||
if (wt!=WAIT_OBJECT_0)
|
||||
goto wait_failed;
|
||||
|
||||
/* grab the right mutex */
|
||||
wt = WaitForMultipleObjects(1,&second,0,INFINITE);
|
||||
if (wt!=WAIT_OBJECT_0)
|
||||
goto wait_failed;
|
||||
|
||||
/* got it */
|
||||
count[pid]++;
|
||||
|
||||
/* pass the mutexes */
|
||||
ERR(!ReleaseMutex(left),"release left");
|
||||
ERR(!ReleaseMutex(right),"release right");
|
||||
continue;
|
||||
|
||||
wait_failed:
|
||||
switch (wt) {
|
||||
case WAIT_OBJECT_0+1:
|
||||
printf("[%d] obtained mutex __1__\n",pid);
|
||||
exit(1);
|
||||
case WAIT_ABANDONED_0:
|
||||
case WAIT_ABANDONED_0+1:
|
||||
printf("[%d] abandoned wait\n",pid);
|
||||
continue;
|
||||
case WAIT_TIMEOUT:
|
||||
printf("[%d] wait timed out\n",pid);
|
||||
exit(1);
|
||||
default:
|
||||
ERR(1,"WaitForMultipleObjects");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* close the handles */
|
||||
ERR(!CloseHandle(left),"close left");
|
||||
ERR(!CloseHandle(right),"close right");
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
HANDLE hThread[5];
|
||||
DWORD tid;
|
||||
int loop;
|
||||
|
||||
for (loop=0; loop<5; loop++) {
|
||||
|
||||
hThread[loop] = CreateThread(NULL, /* thread attributes */
|
||||
0, /* stack size */
|
||||
child, /* start address */
|
||||
(void*)loop, /* parameter */
|
||||
0, /* creation flags */
|
||||
&tid /* thread ID */
|
||||
);
|
||||
if (!hThread[loop])
|
||||
{
|
||||
ERR(1,"CreateThread");
|
||||
}
|
||||
}
|
||||
|
||||
WaitForMultipleObjects(5,hThread,0,RUNLENGTH*1000);
|
||||
|
||||
for (loop=0; loop<5; loop++)
|
||||
TerminateThread(hThread[loop],0);
|
||||
|
||||
for (loop=0; loop<5; loop++)
|
||||
printf("[%d] ate %d times (%d times per second)\n",
|
||||
loop,count[loop],count[loop]/RUNLENGTH
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
89
reactos/apps/tests/tests/Mutex/rapidmutex.c
Normal file
89
reactos/apps/tests/tests/Mutex/rapidmutex.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/* rapidmutex.c: rapid mutex passing test client [Win32 threaded]
|
||||
*
|
||||
* (c) Copyright D.W.Howells 2000.
|
||||
* All rights reserved
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ERR(X,Y) do { if (X) { perror(Y); return 1; } } while(0)
|
||||
#define RUNLENGTH 4
|
||||
|
||||
int count[5];
|
||||
|
||||
DWORD WINAPI child(LPVOID tparam)
|
||||
{
|
||||
HANDLE mymutex;
|
||||
int pid = (int) tparam;
|
||||
|
||||
/* create a mutex */
|
||||
mymutex = CreateMutex(NULL,0,"wibble");
|
||||
ERR(!mymutex,"create mutex");
|
||||
printf("[%d] Handle: %p\n",pid,mymutex);
|
||||
|
||||
for (;;) {
|
||||
/* grab the mutex */
|
||||
switch (WaitForMultipleObjects(1,&mymutex,0,INFINITE))
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
/* got it */
|
||||
count[pid]++;
|
||||
|
||||
/* pass the mutex */
|
||||
ERR(!ReleaseMutex(mymutex),"release mutex");
|
||||
break;
|
||||
|
||||
case WAIT_OBJECT_0+1:
|
||||
printf("[%d] obtained mutex __1__\n",pid);
|
||||
exit(0);
|
||||
case WAIT_ABANDONED_0:
|
||||
case WAIT_ABANDONED_0+1:
|
||||
printf("[%d] abandoned wait\n",pid);
|
||||
exit(0);
|
||||
case WAIT_TIMEOUT:
|
||||
printf("[%d] wait timed out\n",pid);
|
||||
exit(0);
|
||||
default:
|
||||
ERR(1,"WaitForMultipleObjects");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
HANDLE hThread[5];
|
||||
DWORD tid;
|
||||
int loop;
|
||||
|
||||
for (loop=0; loop<5; loop++) {
|
||||
|
||||
hThread[loop] =
|
||||
CreateThread(NULL, /* thread attributes */
|
||||
0, /* stack size */
|
||||
child, /* start address */
|
||||
(void*)loop, /* parameter */
|
||||
0, /* creation flags */
|
||||
&tid /* thread ID */
|
||||
);
|
||||
if (!hThread[loop])
|
||||
{
|
||||
ERR(1,"CreateThread");
|
||||
}
|
||||
}
|
||||
|
||||
WaitForMultipleObjects(5,hThread,0,RUNLENGTH*1000);
|
||||
|
||||
for (loop=0; loop<5; loop++)
|
||||
TerminateThread(hThread[loop],0);
|
||||
|
||||
for (loop=0; loop<5; loop++)
|
||||
printf("[%d] obtained the mutex %d times"
|
||||
" (%d times per second)\n",
|
||||
loop,count[loop],count[loop]/RUNLENGTH
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
26
reactos/apps/tests/tests/Parent_Child/Makefile
Normal file
26
reactos/apps/tests/tests/Parent_Child/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
PROGS = Parent_Child
|
||||
|
||||
OBJECTS = Parent_Child.o
|
||||
|
||||
LIBS = $(PATH_TO_TOP)/dk/w32/lib/gdi32.a
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.coff *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
Parent_Child.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o Parent_Child.exe
|
||||
$(NM) --numeric-sort Parent_Child.exe > Parent_Child.sym
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
151
reactos/apps/tests/tests/Parent_Child/Parent_Child.c
Normal file
151
reactos/apps/tests/tests/Parent_Child/Parent_Child.c
Normal file
@@ -0,0 +1,151 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
/* Win32 counterpart for CalcChildScroll16 is not implemented */
|
||||
/* even in MS Visual C++ */
|
||||
// #include "windef.h"
|
||||
// #include "wingdi.h"
|
||||
/*#include <wine/winuser16.h>*/
|
||||
|
||||
void Write (HDC dc, int x, int y, char *s)
|
||||
{
|
||||
SetBkMode(dc, TRANSPARENT);
|
||||
TextOut (dc, x, y, s, strlen (s));
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
|
||||
{
|
||||
static short xChar, yChar;
|
||||
static RECT rectHola;
|
||||
static char* strHola = "Hola";
|
||||
HDC dc;
|
||||
PAINTSTRUCT ps;
|
||||
TEXTMETRIC tm;
|
||||
|
||||
switch (msg){
|
||||
case WM_CREATE:
|
||||
dc = GetDC (wnd);
|
||||
GetTextMetrics (dc, &tm);
|
||||
xChar = tm.tmAveCharWidth;
|
||||
yChar = tm.tmHeight;
|
||||
GetTextExtentPoint32( dc, strHola, strlen(strHola), ((LPSIZE)&rectHola) + 1 );
|
||||
OffsetRect( &rectHola, xChar, yChar );
|
||||
ReleaseDC (wnd, dc);
|
||||
break;
|
||||
|
||||
case WM_HSCROLL:
|
||||
case WM_VSCROLL:
|
||||
InvalidateRect(wnd, &rectHola, TRUE );
|
||||
// ScrollChildren(wnd, msg, w, l);
|
||||
return 0;
|
||||
|
||||
case WM_PAINT:
|
||||
dc = BeginPaint (wnd, &ps);
|
||||
Write (dc, xChar, yChar, strHola);
|
||||
EndPaint (wnd, &ps);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage (0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc (wnd, msg, w, l);
|
||||
}
|
||||
return 0l;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc2 (HWND wnd, UINT msg, WPARAM w, LPARAM l)
|
||||
{
|
||||
static short xChar, yChar;
|
||||
static RECT rectInfo;
|
||||
char buf[128];
|
||||
HDC dc;
|
||||
PAINTSTRUCT ps;
|
||||
TEXTMETRIC tm;
|
||||
|
||||
switch (msg){
|
||||
case WM_CREATE:
|
||||
dc = GetDC (wnd);
|
||||
GetTextMetrics (dc, &tm);
|
||||
xChar = tm.tmAveCharWidth;
|
||||
yChar = tm.tmHeight;
|
||||
ReleaseDC (wnd, dc);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
dc = BeginPaint (wnd, &ps);
|
||||
sprintf(buf,"ps.rcPaint = {left = %d, top = %d, right = %d, bottom = %d}",
|
||||
ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom);
|
||||
rectInfo.left = rectInfo.top = 0;
|
||||
GetTextExtentPoint32 (dc, buf, strlen(buf), ((LPSIZE)&rectInfo) + 1 );
|
||||
OffsetRect (&rectInfo, xChar, yChar );
|
||||
Write (dc, xChar, yChar, buf);
|
||||
EndPaint (wnd, &ps);
|
||||
break;
|
||||
|
||||
case WM_MOVE:
|
||||
case WM_SIZE:
|
||||
InvalidateRect( wnd, &rectInfo, TRUE );
|
||||
/*CalcChildScroll16( (UINT16)GetParent(wnd), SB_BOTH );*/
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage (0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc (wnd, msg, w, l);
|
||||
}
|
||||
return 0l;
|
||||
}
|
||||
|
||||
int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
HWND wnd,wnd2;
|
||||
MSG msg;
|
||||
WNDCLASS class;
|
||||
char className[] = "class"; /* To make sure className >= 0x10000 */
|
||||
char class2Name[] = "class2";
|
||||
char winName[] = "Test app";
|
||||
|
||||
if (!prev){
|
||||
class.style = CS_HREDRAW | CS_VREDRAW;
|
||||
class.lpfnWndProc = WndProc;
|
||||
class.cbClsExtra = 0;
|
||||
class.cbWndExtra = 0;
|
||||
class.hInstance = inst;
|
||||
class.hIcon = LoadIcon (0, IDI_APPLICATION);
|
||||
class.hCursor = LoadCursor (0, IDC_ARROW);
|
||||
class.hbrBackground = GetStockObject (WHITE_BRUSH);
|
||||
class.lpszMenuName = NULL;
|
||||
class.lpszClassName = className;
|
||||
if (!RegisterClass (&class))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
|
||||
0, inst, 0);
|
||||
|
||||
if (!prev){
|
||||
class.lpfnWndProc = WndProc2;
|
||||
class.lpszClassName = class2Name;
|
||||
class.hbrBackground = GetStockObject(GRAY_BRUSH);
|
||||
if (!RegisterClass (&class))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wnd2= CreateWindow (class2Name,"Child window", WS_CAPTION | WS_CHILD | WS_THICKFRAME,
|
||||
50, 50, 350, 100, wnd, 0, inst, 0);
|
||||
|
||||
ShowWindow (wnd, show);
|
||||
UpdateWindow (wnd);
|
||||
ShowWindow (wnd2, show);
|
||||
UpdateWindow (wnd2);
|
||||
|
||||
while (GetMessage (&msg, 0, 0, 0)){
|
||||
TranslateMessage (&msg);
|
||||
DispatchMessage (&msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
36
reactos/apps/tests/tests/guitest/Makefile
Normal file
36
reactos/apps/tests/tests/guitest/Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
PROGS = guitest
|
||||
|
||||
OBJECTS = guitest.o
|
||||
|
||||
LIBS = $(PATH_TO_TOP)/dk/w32/lib/gdi32.a
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
install: $(PROGS:%=$(FLOPPY_DIR)/apps/tests/%.exe)
|
||||
|
||||
$(PROGS:%=$(FLOPPY_DIR)/apps/tests/%.exe): $(FLOPPY_DIR)/apps/tests/%.exe: %.exe
|
||||
$(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe
|
||||
|
||||
dist: $(PROGS:%=../../$(DIST_DIR)/apps/tests/%.exe)
|
||||
|
||||
$(PROGS:%=../../$(DIST_DIR)/apps/tests/%.exe): ../../$(DIST_DIR)/apps/tests/%.exe: %.exe
|
||||
$(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe
|
||||
|
||||
guitest.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o guitest.exe
|
||||
$(NM) --numeric-sort guitest.exe > guitest.sym
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
751
reactos/apps/tests/tests/guitest/guitest.c
Normal file
751
reactos/apps/tests/tests/guitest/guitest.c
Normal file
@@ -0,0 +1,751 @@
|
||||
/* Windows GUI Behaviour Tester */
|
||||
/* by Ove K<>ven */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "guitest.rc"
|
||||
|
||||
/* checks to include */
|
||||
#define LOGGING /* can be undefined under Wine and use -debugmsg +message instead */
|
||||
#define MAIN_STYLE WS_OVERLAPPEDWINDOW|WS_HSCROLL
|
||||
#define MAIN_EXSTYLE 0
|
||||
#undef TEST_DESTROY_MAIN
|
||||
#define SHOW_SUB
|
||||
#undef TEST_DIALOG
|
||||
#define RESIZE_DIALOG
|
||||
#undef TEST_SUBDIALOG
|
||||
#undef TEST_COMMCTL
|
||||
|
||||
/************************/
|
||||
/*** GLOBAL VARIABLES ***/
|
||||
/************************/
|
||||
|
||||
HINSTANCE hInst;
|
||||
DWORD StartTime;
|
||||
HWND hListBox,hMainWnd,hSubWnd;
|
||||
HWND hButton[4]={0,0,0,0};
|
||||
HWND hDialog=0,hGroup=0,hSubDlg=0;
|
||||
WNDPROC wndButton[4],wndDialog,wndGroup,wndSubDlg;
|
||||
BOOL Clicked=0,Ready=0;
|
||||
int State=0,Rec=0;
|
||||
#define STATE_CREATE 0
|
||||
#define STATE_DESTROY 1
|
||||
#define STATE_SHOW 2
|
||||
#define STATE_UPDATE 3
|
||||
#define STATE_DIALOG 4
|
||||
#define STATE_TEST 5
|
||||
#define STATE_DIRECT 6
|
||||
#define STATE_DISPATCH 7
|
||||
#define STATE_RECURS 8
|
||||
char*StateName[]={
|
||||
"Creat",
|
||||
"Destr",
|
||||
"Show ",
|
||||
"Updat",
|
||||
"Dialg",
|
||||
"Test ",
|
||||
"Call ",
|
||||
"Disp ",
|
||||
"RCall"
|
||||
};
|
||||
|
||||
static char wclassname[] = "GUITestClass";
|
||||
static char wcclassname[] = "GUITestChildClass";
|
||||
static char winname[] = "GUITest";
|
||||
|
||||
/**************************/
|
||||
/*** LOGGING FACILITIES ***/
|
||||
/**************************/
|
||||
|
||||
struct MSGNAMES {
|
||||
int msg;
|
||||
char*name;
|
||||
} MsgNames[]={
|
||||
#define MSG(x) {x,#x},
|
||||
#define MSG2(x,y) {y,#x},
|
||||
#define ENDMSG {0}
|
||||
|
||||
/* we get these in CreateWindow */
|
||||
MSG(WM_GETMINMAXINFO)
|
||||
MSG(WM_NCCREATE)
|
||||
MSG(WM_NCCALCSIZE)
|
||||
MSG(WM_CREATE)
|
||||
MSG(WM_PARENTNOTIFY)
|
||||
|
||||
/* we get these in ShowWindow */
|
||||
MSG(WM_SHOWWINDOW)
|
||||
MSG(WM_WINDOWPOSCHANGING)
|
||||
MSG(WM_QUERYNEWPALETTE)
|
||||
MSG(WM_ACTIVATEAPP)
|
||||
MSG(WM_NCACTIVATE)
|
||||
MSG(WM_GETTEXT)
|
||||
MSG(WM_ACTIVATE)
|
||||
MSG(WM_SETFOCUS)
|
||||
MSG(WM_NCPAINT)
|
||||
MSG(WM_ERASEBKGND)
|
||||
MSG(WM_WINDOWPOSCHANGED)
|
||||
MSG(WM_SIZE)
|
||||
MSG(WM_MOVE)
|
||||
|
||||
/* we get these in DestroyWindow */
|
||||
MSG(WM_KILLFOCUS)
|
||||
MSG(WM_DESTROY)
|
||||
MSG(WM_NCDESTROY)
|
||||
|
||||
/* we get these directly sent */
|
||||
MSG(WM_NCHITTEST)
|
||||
MSG(WM_SETCURSOR)
|
||||
MSG(WM_MOUSEACTIVATE)
|
||||
MSG(WM_CHILDACTIVATE)
|
||||
MSG(WM_COMMAND)
|
||||
MSG(WM_SYSCOMMAND)
|
||||
|
||||
/* posted events */
|
||||
MSG(WM_MOUSEMOVE)
|
||||
MSG(WM_NCMOUSEMOVE)
|
||||
MSG(WM_PAINT)
|
||||
MSG(WM_LBUTTONDOWN)
|
||||
MSG(WM_LBUTTONUP)
|
||||
MSG(WM_LBUTTONDBLCLK)
|
||||
MSG(WM_NCLBUTTONDOWN)
|
||||
MSG(WM_NCLBUTTONUP)
|
||||
MSG(WM_NCLBUTTONDBLCLK)
|
||||
|
||||
MSG(WM_KEYDOWN)
|
||||
MSG(WM_KEYUP)
|
||||
MSG(WM_CHAR)
|
||||
|
||||
#ifdef WIN32
|
||||
MSG(WM_CTLCOLORBTN)
|
||||
MSG(WM_CTLCOLORDLG)
|
||||
MSG(WM_CTLCOLORSTATIC)
|
||||
#else
|
||||
MSG(WM_CTLCOLOR)
|
||||
#endif
|
||||
|
||||
/* moving and sizing */
|
||||
MSG2(WM_ENTERSIZEMOVE,0x0231)
|
||||
MSG2(WM_EXITSIZEMOVE,0x0232)
|
||||
#ifdef WIN32
|
||||
MSG(WM_SIZING)
|
||||
#endif
|
||||
|
||||
/* menus/dialog boxes */
|
||||
MSG(WM_CANCELMODE)
|
||||
MSG(WM_ENABLE)
|
||||
MSG(WM_SETFONT)
|
||||
MSG(WM_INITDIALOG)
|
||||
MSG(WM_GETDLGCODE)
|
||||
MSG(WM_ENTERIDLE)
|
||||
|
||||
/* scroll bars */
|
||||
MSG(WM_HSCROLL)
|
||||
MSG(WM_VSCROLL)
|
||||
|
||||
/* getting these from Wine but not from Windows */
|
||||
MSG2(WM_SETVISIBLE,0x0009) /* unheard of in BC++ 4.52 */
|
||||
#ifdef WIN32
|
||||
MSG(WM_CAPTURECHANGED)
|
||||
#endif
|
||||
|
||||
ENDMSG};
|
||||
|
||||
struct MSGNAMES ButMsgs[]={
|
||||
MSG(BM_SETSTATE)
|
||||
MSG(BM_SETSTYLE)
|
||||
|
||||
ENDMSG};
|
||||
|
||||
char*MsgName(UINT msg,HWND hWnd)
|
||||
{
|
||||
int i;
|
||||
static char buffer[64],wclass[64];
|
||||
GetClassName(hWnd,wclass,sizeof(wclass));
|
||||
|
||||
#define MSGSEARCH(msgs) { \
|
||||
for (i=0; msgs[i].name&&msgs[i].msg!=msg; i++); \
|
||||
if (msgs[i].name) return msgs[i].name; \
|
||||
}
|
||||
|
||||
if (!stricmp(wclass,"Button")) MSGSEARCH(ButMsgs);
|
||||
MSGSEARCH(MsgNames);
|
||||
/* WM_USER */
|
||||
if (msg>=WM_USER) {
|
||||
sprintf(buffer,"WM_USER+%04x{%s}",msg-WM_USER,wclass);
|
||||
return buffer;
|
||||
}
|
||||
/* message not found */
|
||||
sprintf(buffer,"%04x{%s}",msg,wclass);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
char*WndName(HWND hWnd,int state)
|
||||
{
|
||||
static char buffer[16];
|
||||
if (!hWnd) return "0000";
|
||||
if (hWnd==hMainWnd || (state==STATE_CREATE && !hMainWnd)) return "main";
|
||||
if (hWnd==hSubWnd || (state==STATE_CREATE && !hSubWnd)) return "chld";
|
||||
if (hWnd==hDialog || (state==STATE_DIALOG && !hDialog)) return "tdlg";
|
||||
if (hWnd==hGroup) return "tgrp";
|
||||
if (hWnd==hButton[0]) return "but1";
|
||||
if (hWnd==hButton[1]) return "but2";
|
||||
if (hWnd==hButton[2]) return "but3";
|
||||
if (hWnd==hButton[3]) return "but4";
|
||||
if (hWnd==hSubDlg || (state==STATE_CREATE && !hSubDlg)) return "sdlg";
|
||||
if (hDialog) {
|
||||
int id=GetDlgCtrlID(hWnd);
|
||||
if (id) {
|
||||
sprintf(buffer,"dlgitem(%d)",id);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
sprintf(buffer,"%04x",hWnd);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void Log(const char*fmt)
|
||||
{
|
||||
#ifdef LOGGING
|
||||
if (!Clicked) SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)fmt);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logf(const char*fmt,...)
|
||||
{
|
||||
va_list par;
|
||||
static char buffer[256];
|
||||
|
||||
va_start(par,fmt);
|
||||
vsprintf(buffer,fmt,par);
|
||||
va_end(par);
|
||||
Log(buffer);
|
||||
}
|
||||
|
||||
void LogChildOrder(HWND hWnd)
|
||||
{
|
||||
HWND hWndChild = GetWindow(hWnd,GW_CHILD);
|
||||
static char buffer[256];
|
||||
|
||||
strcpy(buffer,"child list:");
|
||||
while (hWndChild) {
|
||||
strcat(strcat(buffer," "),WndName(hWndChild,State));
|
||||
hWndChild=GetWindow(hWndChild,GW_HWNDNEXT);
|
||||
}
|
||||
Log(buffer);
|
||||
}
|
||||
|
||||
void LogMessage(int state,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam,char*name)
|
||||
{
|
||||
static char buffer[256];
|
||||
DWORD tick=GetTickCount()-StartTime;
|
||||
char*msgname=MsgName(msg,hWnd);
|
||||
if (!name) name=WndName(hWnd,state);
|
||||
switch (msg) {
|
||||
case WM_SETFOCUS:
|
||||
case WM_KILLFOCUS:
|
||||
case WM_SETCURSOR:
|
||||
Logf("%04d[%s(%d):%s]%s(%s,%08x)",tick,StateName[state],Rec,
|
||||
name,msgname,WndName((HWND)wParam,State),lParam);
|
||||
break;
|
||||
#ifdef WIN32
|
||||
case WM_ENTERIDLE:
|
||||
case WM_CTLCOLORBTN:
|
||||
case WM_CTLCOLORDLG:
|
||||
Logf("%04d[%s(%d):%s]%s(%08x,%s)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,WndName((HWND)lParam,State));
|
||||
break;
|
||||
#else
|
||||
case WM_ENTERIDLE:
|
||||
case WM_CTLCOLOR:
|
||||
Logf("%04d[%s(%d):%s]%s(%08x,%04x:%s)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,HIWORD(lParam),WndName((HWND)LOWORD(lParam),State));
|
||||
break;
|
||||
#endif
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
{
|
||||
WINDOWPOS*pos=(WINDOWPOS*)lParam;
|
||||
#ifdef WIN32
|
||||
Logf("%04d[%s(%d):%s]%s(%08x,%p)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,pos);
|
||||
#else
|
||||
Logf("%04d[%s(%d):%s]%s(%04x,%p)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,pos);
|
||||
#endif
|
||||
strcpy(buffer,"FLAGS:");
|
||||
if (pos->flags&SWP_DRAWFRAME) strcat(buffer," DRAWFRAME");
|
||||
if (pos->flags&SWP_HIDEWINDOW) strcat(buffer," HIDEWINDOW");
|
||||
if (pos->flags&SWP_NOACTIVATE) strcat(buffer," NOACTIVATE");
|
||||
if (pos->flags&SWP_NOCOPYBITS) strcat(buffer," NOCOPYBITS");
|
||||
if (pos->flags&SWP_NOMOVE) strcat(buffer," NOMOVE");
|
||||
if (pos->flags&SWP_NOOWNERZORDER) strcat(buffer," NOOWNERZORDER");
|
||||
if (pos->flags&SWP_NOSIZE) strcat(buffer," NOSIZE");
|
||||
if (pos->flags&SWP_NOREDRAW) strcat(buffer," NOREDRAW");
|
||||
if (pos->flags&SWP_NOZORDER) strcat(buffer," NOZORDER");
|
||||
if (pos->flags&SWP_SHOWWINDOW) strcat(buffer," SHOWWINDOW");
|
||||
Log(buffer);
|
||||
}
|
||||
break;
|
||||
case WM_SYSCOMMAND:
|
||||
{
|
||||
char*cmd=NULL;
|
||||
switch (wParam&0xFFF0) {
|
||||
#define CASE(x) case SC_##x: cmd=#x; break;
|
||||
CASE(CLOSE)
|
||||
CASE(DEFAULT)
|
||||
CASE(HOTKEY)
|
||||
CASE(HSCROLL)
|
||||
CASE(KEYMENU)
|
||||
CASE(MAXIMIZE)
|
||||
CASE(MINIMIZE)
|
||||
CASE(MOUSEMENU)
|
||||
CASE(MOVE)
|
||||
CASE(NEXTWINDOW)
|
||||
CASE(PREVWINDOW)
|
||||
CASE(RESTORE)
|
||||
CASE(SCREENSAVE)
|
||||
CASE(SIZE)
|
||||
CASE(TASKLIST)
|
||||
CASE(VSCROLL)
|
||||
#undef CASE
|
||||
}
|
||||
if (cmd) {
|
||||
Logf("%04d[%s(%d):%s]%s(%s+%x,%08x)",tick,StateName[state],Rec,
|
||||
name,msgname,cmd,wParam&0xF,lParam);
|
||||
} else goto GENERIC_MSG;
|
||||
}
|
||||
break;
|
||||
case WM_HSCROLL:
|
||||
case WM_VSCROLL:
|
||||
{
|
||||
char*cmd=NULL;
|
||||
switch (LOWORD(wParam)) {
|
||||
#define CASE(x) case SB_##x: cmd=#x; break;
|
||||
#define CASE2(h,v) case SB_##h: if (msg==WM_HSCROLL) cmd=#h; else cmd=#v; break;
|
||||
CASE(BOTTOM)
|
||||
CASE(ENDSCROLL)
|
||||
CASE2(LINELEFT,LINEUP)
|
||||
CASE2(LINERIGHT,LINEDOWN)
|
||||
CASE2(PAGELEFT,PAGEUP)
|
||||
CASE2(PAGERIGHT,PAGEDOWN)
|
||||
CASE(THUMBPOSITION)
|
||||
CASE(THUMBTRACK)
|
||||
CASE(TOP)
|
||||
#undef CASE
|
||||
}
|
||||
if (cmd) {
|
||||
#ifdef WIN32
|
||||
Logf("%04d[%s(%d):%s]%s(%s,%04x,%s)",tick,StateName[state],Rec,
|
||||
name,msgname,cmd,HIWORD(wParam),WndName((HWND)lParam,State));
|
||||
#else
|
||||
Logf("%04d[%s(%d):%s]%s(%04x,%04x,%s)",tick,StateName[state],Rec,
|
||||
name,msgname,cmd,LOWORD(lParam),WndName((HWND)HIWORD(lParam),State));
|
||||
#endif
|
||||
} else goto GENERIC_MSG;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
GENERIC_MSG:
|
||||
#ifdef WIN32
|
||||
Logf("%04d[%s(%d):%s]%s(%08x,%08x)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,lParam);
|
||||
#else
|
||||
Logf("%04d[%s(%d):%s]%s(%04x,%08x)",tick,StateName[state],Rec,
|
||||
name,msgname,wParam,lParam);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/***************************/
|
||||
/*** GRAPHICS FACILITIES ***/
|
||||
/***************************/
|
||||
|
||||
void Paint(HWND hWnd)
|
||||
{
|
||||
HDC dc;
|
||||
PAINTSTRUCT ps;
|
||||
dc=BeginPaint(hWnd,&ps);
|
||||
EndPaint(hWnd,&ps);
|
||||
}
|
||||
|
||||
void FillPattern(HWND hWnd,HDC pdc)
|
||||
{
|
||||
HDC dc=pdc?pdc:GetDC(hWnd);
|
||||
HBRUSH oldbrush;
|
||||
RECT rect;
|
||||
if (!dc) {
|
||||
Logf("failed to acquire DC for window %s",WndName(hWnd,State));
|
||||
return;
|
||||
} else {
|
||||
Logf("acquired DC for %s window %s, painting",
|
||||
IsWindowVisible(hWnd)?"visible":"invisible",WndName(hWnd,State));
|
||||
}
|
||||
GetClientRect(hWnd,&rect);
|
||||
oldbrush=SelectObject(dc,GetStockObject(LTGRAY_BRUSH));
|
||||
PatBlt(dc,0,0,rect.right,rect.bottom,PATCOPY);
|
||||
SelectObject(dc,oldbrush);
|
||||
if (!pdc) ReleaseDC(hWnd,dc);
|
||||
}
|
||||
|
||||
void PaintPattern(HWND hWnd)
|
||||
{
|
||||
HDC dc;
|
||||
PAINTSTRUCT ps;
|
||||
dc=BeginPaint(hWnd,&ps);
|
||||
FillPattern(hWnd,dc);
|
||||
EndPaint(hWnd,&ps);
|
||||
}
|
||||
|
||||
/*************************/
|
||||
/*** WINDOW PROCEDURES ***/
|
||||
/*************************/
|
||||
|
||||
/* MAIN WINDOW */
|
||||
LRESULT FAR CALLBACK _export MainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT lResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) LogMessage(OldState,hWnd,msg,wParam,lParam,NULL);
|
||||
switch (msg) {
|
||||
case WM_NCHITTEST:
|
||||
lResult=DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
break;
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_CHAR:
|
||||
if (!Clicked) {
|
||||
SetParent(hListBox,hWnd);
|
||||
GetClientRect(hWnd,&rect);
|
||||
MoveWindow(hListBox,0,0,rect.right,rect.bottom,TRUE);
|
||||
ShowWindow(hListBox,SW_SHOW);
|
||||
SetFocus(hListBox);
|
||||
Clicked=TRUE;
|
||||
}
|
||||
break;
|
||||
case WM_SIZE:
|
||||
GetClientRect(hWnd,&rect);
|
||||
if (Clicked) {
|
||||
MoveWindow(hListBox,0,0,rect.right,rect.bottom,TRUE);
|
||||
}
|
||||
MoveWindow(hSubWnd,0,rect.bottom/2,rect.right,rect.bottom-(rect.bottom/2),TRUE);
|
||||
break;
|
||||
case WM_PAINT:
|
||||
Paint(hWnd);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
default:
|
||||
lResult=DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return lResult;
|
||||
}
|
||||
|
||||
/* CHILD WINDOW */
|
||||
LRESULT FAR CALLBACK _export SubWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT lResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) LogMessage(OldState,hWnd,msg,wParam,lParam,NULL);
|
||||
switch (msg) {
|
||||
case WM_PAINT:
|
||||
Paint(hWnd);
|
||||
break;
|
||||
default:
|
||||
lResult=DefWindowProc(hWnd,msg,wParam,lParam);
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return lResult;
|
||||
}
|
||||
|
||||
BOOL FAR CALLBACK _export SubDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
/* SUBCLASSED CONTROLS */
|
||||
LRESULT FAR CALLBACK _export SubClassWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT lResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
int But=-1;
|
||||
|
||||
if (hWnd==hButton[0]) But=0; else
|
||||
if (hWnd==hButton[1]) But=1; else
|
||||
if (hWnd==hButton[2]) But=2; else
|
||||
if (hWnd==hButton[3]) But=3;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) {
|
||||
LogMessage(OldState,hWnd,msg,wParam,lParam,NULL);
|
||||
if (But!=-1) {
|
||||
lResult=CallWindowProc((FARPROC)wndButton[But],hWnd,msg,wParam,lParam);
|
||||
if (msg==WM_LBUTTONUP) {
|
||||
LogChildOrder(GetParent(hWnd));
|
||||
}
|
||||
}
|
||||
else if (hWnd==hDialog) {
|
||||
lResult=CallWindowProc((FARPROC)wndDialog,hWnd,msg,wParam,lParam);
|
||||
}
|
||||
else if (hWnd==hSubDlg) {
|
||||
lResult=CallWindowProc((FARPROC)wndSubDlg,hWnd,msg,wParam,lParam);
|
||||
}
|
||||
else if (hWnd==hGroup) {
|
||||
lResult=CallWindowProc((FARPROC)wndGroup,hWnd,msg,wParam,lParam);
|
||||
if (msg==WM_SETFOCUS) {
|
||||
/* create subdialog */
|
||||
if (hSubDlg) {
|
||||
#if 0
|
||||
SetRect(&rect,0,0,1,1);
|
||||
InvalidateRect(hWnd,&rect,FALSE);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef TEST_SUBDIALOG
|
||||
State=STATE_CREATE;
|
||||
hSubDlg=CreateDialog(hInst,MAKEINTRESOURCE(2),hWnd,(FARPROC)SubDialogProc);
|
||||
State=STATE_RECURS;
|
||||
#else
|
||||
#ifdef RESIZE_DIALOG
|
||||
GetWindowRect(GetParent(hWnd),&rect);
|
||||
rect.right++;
|
||||
SetWindowPos(GetParent(hWnd),0,0,0,
|
||||
rect.right-rect.left,rect.bottom-rect.top,
|
||||
SWP_NOMOVE|SWP_NOZORDER);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return lResult;
|
||||
}
|
||||
|
||||
/* MAIN DIALOG PROCEDURE */
|
||||
BOOL FAR CALLBACK _export TestDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
BOOL bResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
int But=-1;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) LogMessage(OldState,hWndDlg,msg,wParam,lParam,"dlgp");
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
hDialog = hWndDlg;
|
||||
/* subclass dialog window proc */
|
||||
wndDialog = (WNDPROC)SetWindowLong(hDialog,GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
Logf("dialog visible=%s",IsWindowVisible(hWndDlg)?"TRUE":"FALSE");
|
||||
/* subclass OK button */
|
||||
hButton[3] = GetDlgItem(hWndDlg,IDOK);
|
||||
wndButton[3] = (WNDPROC)SetWindowLong(hButton[3],GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
/* subclass group box */
|
||||
hGroup = GetDlgItem(hWndDlg,IDC_GROUPBOX1);
|
||||
wndGroup = (WNDPROC)SetWindowLong(hGroup,GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
|
||||
#ifdef RESIZE_DIALOG
|
||||
GetWindowRect(hWndDlg,&rect);
|
||||
rect.right--;
|
||||
SetWindowPos(hWndDlg,0,0,0,
|
||||
rect.right-rect.left,rect.bottom-rect.top,
|
||||
SWP_NOMOVE|SWP_NOZORDER);
|
||||
// ShowWindow(GetDlgItem(hWndDlg,IDCANCEL),SW_HIDE);
|
||||
#endif
|
||||
|
||||
bResult=TRUE; /* we don't do SetFocus */
|
||||
break;
|
||||
case WM_PAINT:
|
||||
PaintPattern(hWndDlg);
|
||||
bResult=TRUE;
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
EndDialog(hWndDlg,LOWORD(wParam));
|
||||
bResult=TRUE;
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
EndDialog(hWndDlg,IDCANCEL);
|
||||
bResult=TRUE;
|
||||
break;
|
||||
case WM_NCDESTROY:
|
||||
hDialog = 0;
|
||||
break;
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/* SUBDIALOG PROCEDURE */
|
||||
BOOL FAR CALLBACK _export SubDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
BOOL bResult=0;
|
||||
RECT rect;
|
||||
int OldState=State;
|
||||
int But=-1;
|
||||
|
||||
State=STATE_RECURS; Rec++;
|
||||
if (!Clicked) LogMessage(OldState,hWndDlg,msg,wParam,lParam,NULL);
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
hSubDlg = hWndDlg;
|
||||
/* subclass dialog window proc */
|
||||
wndSubDlg = (WNDPROC)SetWindowLong(hDialog,GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
|
||||
bResult=TRUE; /* we don't do SetFocus */
|
||||
break;
|
||||
case WM_NCDESTROY:
|
||||
hSubDlg = 0;
|
||||
break;
|
||||
}
|
||||
State=OldState; Rec--;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/********************/
|
||||
/*** MAIN PROGRAM ***/
|
||||
/********************/
|
||||
|
||||
BOOL AppInit(void)
|
||||
{
|
||||
WNDCLASS wclass;
|
||||
|
||||
wclass.style = CS_HREDRAW|CS_VREDRAW;
|
||||
wclass.lpfnWndProc = MainWindowProc;
|
||||
wclass.cbClsExtra = 0;
|
||||
wclass.cbWndExtra = 0;
|
||||
wclass.hInstance = hInst;
|
||||
wclass.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(1));
|
||||
wclass.hCursor = LoadCursor(0,IDC_ARROW);
|
||||
wclass.hbrBackground = GetStockObject(WHITE_BRUSH);
|
||||
wclass.lpszMenuName = NULL;
|
||||
wclass.lpszClassName = wclassname;
|
||||
if (!RegisterClass(&wclass)) return FALSE;
|
||||
wclass.lpfnWndProc = SubWindowProc;
|
||||
wclass.lpszClassName = wcclassname;
|
||||
if (!RegisterClass(&wclass)) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
RECT rect;
|
||||
|
||||
hInst = hInstance;
|
||||
if (!hPrevInstance)
|
||||
if (!AppInit())
|
||||
return 0;
|
||||
|
||||
StartTime=GetTickCount();
|
||||
hListBox = CreateWindow("LISTBOX","Messages",WS_BORDER|WS_VSCROLL|WS_CHILD|
|
||||
LBS_HASSTRINGS|LBS_NOTIFY|LBS_WANTKEYBOARDINPUT,
|
||||
0,0,0,0,GetDesktopWindow(),0,hInst,0);
|
||||
if (!hListBox) {
|
||||
MessageBox(0,"Could not create list box","Error",MB_OK);
|
||||
}
|
||||
|
||||
State=STATE_CREATE;
|
||||
hMainWnd = CreateWindowEx(MAIN_EXSTYLE,wclassname,winname,MAIN_STYLE,
|
||||
CW_USEDEFAULT,0,400,300,0,0,hInst,0);
|
||||
if (!hMainWnd) return 0;
|
||||
State=STATE_SHOW;
|
||||
ShowWindow(hMainWnd,nCmdShow);
|
||||
#ifdef TEST_DESTROY_MAIN
|
||||
State=STATE_DESTROY;
|
||||
DestroyWindow(hMainWnd);
|
||||
State=STATE_DIRECT;
|
||||
while (GetMessage(&msg,0,0,0)) {
|
||||
TranslateMessage(&msg);
|
||||
State=STATE_DISPATCH;
|
||||
DispatchMessage(&msg);
|
||||
State=STATE_DIRECT;
|
||||
}
|
||||
State=STATE_CREATE;
|
||||
hMainWnd = CreateWindowEx(MAIN_EXSTYLE,wclassname,winname,MAIN_STYLE,
|
||||
CW_USEDEFAULT,0,400,300,0,0,hInst,0);
|
||||
if (!hMainWnd) return 0;
|
||||
State=STATE_SHOW;
|
||||
ShowWindow(hMainWnd,nCmdShow);
|
||||
#endif
|
||||
/* update, so no WM_PAINTs are pending */
|
||||
State=STATE_UPDATE;
|
||||
// UpdateWindow(hMainWnd);
|
||||
Ready=TRUE;
|
||||
/* fill client area with a pattern */
|
||||
FillPattern(hMainWnd,0);
|
||||
/* create subwindow */
|
||||
State=STATE_CREATE;
|
||||
GetClientRect(hMainWnd,&rect);
|
||||
hSubWnd = CreateWindow(wcclassname,winname,WS_CHILD|WS_BORDER|WS_CLIPSIBLINGS,
|
||||
0,rect.bottom/2,rect.right,rect.bottom-(rect.bottom/2),hMainWnd,0,hInst,0);
|
||||
if (!hSubWnd) return 0;
|
||||
/* create buttons */
|
||||
hButton[0] = CreateWindow("BUTTON","1",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE,
|
||||
8,8,48,20,hMainWnd,0,hInst,0);
|
||||
hButton[1] = CreateWindow("BUTTON","2",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE,
|
||||
32,12,48,20,hMainWnd,0,hInst,0);
|
||||
hButton[2] = CreateWindow("BUTTON","3",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE,
|
||||
56,16,48,20,hMainWnd,0,hInst,0);
|
||||
/* subclass them */
|
||||
wndButton[0] = (WNDPROC)SetWindowLong(hButton[0],GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
wndButton[1] = (WNDPROC)SetWindowLong(hButton[1],GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
wndButton[2] = (WNDPROC)SetWindowLong(hButton[2],GWL_WNDPROC,(LONG)SubClassWindowProc);
|
||||
/* show them */
|
||||
State=STATE_UPDATE;
|
||||
UpdateWindow(hButton[0]);
|
||||
LogChildOrder(hMainWnd);
|
||||
Logf("but1 visible=%d",IsWindowVisible(hButton[0]));
|
||||
|
||||
/* now reparent the button to our (invisible) subwindow */
|
||||
State=STATE_TEST;
|
||||
/* in different order, seeing who gets topmost */
|
||||
SetParent(hButton[0],hSubWnd);
|
||||
SetParent(hButton[2],hSubWnd);
|
||||
SetParent(hButton[1],hSubWnd);
|
||||
LogChildOrder(hSubWnd);
|
||||
/* the button should now be invisible */
|
||||
Logf("but1 visible=%d",IsWindowVisible(hButton[0]));
|
||||
/* see if we can draw on them */
|
||||
FillPattern(hButton[0],0);
|
||||
|
||||
#ifdef SHOW_SUB
|
||||
State=STATE_SHOW;
|
||||
ShowWindow(hSubWnd,SW_SHOWNORMAL);
|
||||
State=STATE_UPDATE;
|
||||
UpdateWindow(hSubWnd);
|
||||
FillPattern(hSubWnd,0);
|
||||
// InvalidateRect(hMainWnd,NULL,TRUE);
|
||||
Logf("but1 visible=%d",IsWindowVisible(hButton[0]));
|
||||
#endif
|
||||
|
||||
#ifdef TEST_DIALOG
|
||||
State=STATE_DIALOG;
|
||||
DialogBox(hInst,MAKEINTRESOURCE(1),hMainWnd,(FARPROC)TestDialogProc);
|
||||
#endif
|
||||
#ifdef TEST_COMMCTL
|
||||
{
|
||||
DWORD arr[16];
|
||||
CHOOSECOLOR cc={sizeof(cc),0,hInst,0,arr,0};
|
||||
ChooseColor(&cc);
|
||||
}
|
||||
#endif
|
||||
|
||||
State=STATE_DIRECT;
|
||||
while (GetMessage(&msg,0,0,0)) {
|
||||
TranslateMessage(&msg);
|
||||
State=STATE_DISPATCH;
|
||||
DispatchMessage(&msg);
|
||||
State=STATE_DIRECT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
17
reactos/apps/tests/tests/guitest/guitest.rc
Normal file
17
reactos/apps/tests/tests/guitest/guitest.rc
Normal file
@@ -0,0 +1,17 @@
|
||||
/****************************************************************************
|
||||
|
||||
|
||||
guitest.rh
|
||||
|
||||
produced by Borland Resource Workshop
|
||||
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#define IDC_CHECKBOX1 104
|
||||
#define IDC_CHECKBOX2 105
|
||||
#define IDC_CHECKBOX3 106
|
||||
#define DIALOG_2 2
|
||||
#define IDC_GROUPBOX1 10
|
||||
#define DIALOG_1 1
|
||||
#define ICON_1 1
|
26
reactos/apps/tests/tests/hello/Makefile
Normal file
26
reactos/apps/tests/tests/hello/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../../..
|
||||
|
||||
PROGS = hello
|
||||
|
||||
OBJECTS = hello.o
|
||||
|
||||
LIBS = $(PATH_TO_TOP)/dk/w32/lib/gdi32.a
|
||||
CFLAGS =
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
||||
.phony: all
|
||||
|
||||
clean:
|
||||
- $(RM) *.o *.coff *.exe *.sym
|
||||
|
||||
.phony: clean
|
||||
|
||||
hello.exe: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o hello.exe
|
||||
$(NM) --numeric-sort hello.exe > hello.sym
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
83
reactos/apps/tests/tests/hello/hello.c
Normal file
83
reactos/apps/tests/tests/hello/hello.c
Normal file
@@ -0,0 +1,83 @@
|
||||
#include <windows.h>
|
||||
|
||||
char szAppName[] = "Hello";
|
||||
|
||||
long FAR PASCAL WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpszCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
HWND hwnd;
|
||||
MSG msg;
|
||||
WNDCLASS wndclass;
|
||||
|
||||
if(!hPrevInst) {
|
||||
|
||||
wndclass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wndclass.lpfnWndProc = WndProc;
|
||||
wndclass.cbClsExtra = 0;
|
||||
wndclass.cbWndExtra = 0;
|
||||
wndclass.hInstance = hInstance;
|
||||
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
|
||||
wndclass.lpszMenuName = NULL;
|
||||
wndclass.lpszClassName = szAppName;
|
||||
|
||||
RegisterClass(&wndclass);
|
||||
|
||||
|
||||
}
|
||||
|
||||
hwnd = CreateWindow(szAppName, szAppName,
|
||||
WS_HSCROLL | WS_VSCROLL | WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 600,
|
||||
400, NULL, NULL, hInstance, NULL);
|
||||
|
||||
ShowWindow(hwnd, nCmdShow);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
|
||||
while(GetMessage(&msg, NULL, 0, 0)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
|
||||
|
||||
long FAR PASCAL WndProc(HWND hwnd, UINT message, WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
HDC hdc;
|
||||
RECT rect;
|
||||
SIZE size;
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
switch(message) {
|
||||
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
GetClientRect(hwnd, &rect);
|
||||
InflateRect(&rect, -10, -10);
|
||||
if( !IsRectEmpty( &rect ) )
|
||||
{
|
||||
GetTextExtentPoint32(hdc, szAppName, strlen(szAppName), &size);
|
||||
SelectObject(hdc, GetStockObject(LTGRAY_BRUSH));
|
||||
Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
|
||||
rect.left = (rect.right + rect.left - size.cx) / 2;
|
||||
rect.top = (rect.bottom + rect.top - size.cy) / 2;
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
TextOut(hdc, rect.left, rect.top, szAppName, strlen(szAppName) );
|
||||
}
|
||||
EndPaint(hwnd, &ps);
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user