Compare commits

..

12 Commits

Author SHA1 Message Date
nj
3a5a7572a9 Updated to version 0.1.5
svn path=/branches/ros-branch-0_1_5/; revision=6688
2003-11-18 19:19:47 +00:00
Martin Fuchs
20c7f87c94 take over main branch patch "make windres work again" into 0.1.5 branch
svn path=/branches/ros-branch-0_1_5/; revision=6584
2003-11-08 16:50:55 +00:00
Vizzini
ea55b7bf72 merged a missing macro from head
svn path=/branches/ros-branch-0_1_5/; revision=6572
2003-11-08 05:52:45 +00:00
Eric Kohl
4eb59b536b Disabled buggy capability detection code.
svn path=/branches/ros-branch-0_1_5/; revision=6557
2003-11-07 13:00:39 +00:00
Eric Kohl
19c2f9e135 Issue SPECIFY command upon initialization.
svn path=/branches/ros-branch-0_1_5/; revision=6538
2003-11-05 23:54:26 +00:00
The ReactOS Team
37428df5ef This commit was manufactured by cvs2svn to create branch
'ros-branch-0_1_5'.

svn path=/branches/ros-branch-0_1_5/; revision=6506
2003-11-02 03:09:06 +00:00
The ReactOS Team
abc01da30c This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2401
2001-11-28 01:38:00 +00:00
The ReactOS Team
7aeca22fed This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2398
2001-11-27 14:24:15 +00:00
The ReactOS Team
36e1bb60e8 This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2320
2001-10-25 23:22:09 +00:00
The ReactOS Team
74e77bb16f This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=2316
2001-10-23 21:15:45 +00:00
Casper Hornstrup
e3a75fb4da no message
svn path=/branches/avendor/; revision=1279
2000-08-01 18:43:38 +00:00
The ReactOS Team
ce122bcdea This commit was manufactured by cvs2svn to create branch 'avendor'.
svn path=/branches/avendor/; revision=1278
2000-08-01 18:43:38 +00:00
9053 changed files with 577325 additions and 2032776 deletions

21
reactos/.cvsignore Normal file
View File

@@ -0,0 +1,21 @@
dist
reactos
*.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.zip
*.iso
*.cab

4
reactos/.gdbinit Normal file
View File

@@ -0,0 +1,4 @@
directory /mnt/windows/CvsHome/reactos/ntoskrnl
symbol-file ntoskrnl/ntoskrnl.nostrip.exe -mapped
set remotebaud 115200
target remote com2

View File

@@ -1,55 +1,19 @@
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)
James B. Tabor (jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net)
Source and inspiration from
@@ -76,3 +40,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.

2834
reactos/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
========================
ReactOS Version 0.2.x
Updated June 23rd, 2004
ReactOS Version 0.1.x
Updated March 19th, 2003
========================
1. What is ReactOS?

3
reactos/aboot.bat Normal file
View 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

View File

@@ -6,7 +6,6 @@
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
@@ -23,11 +22,10 @@ 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
videoprt.dll reactos/drivers/dd/videoprt
ndis.dll reactos/drivers/net/ndis
tdi.dll 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

View File

@@ -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

View File

@@ -1,13 +0,0 @@
# $Id$
#
# ReactOS apps and tools makefile to generate Doxygen documentation
#
docu:
doxygen Doxyfile
.PHONY: docu
# EOF

View File

@@ -0,0 +1,87 @@
#
# ReactOS test applications makefile
#
PATH_TO_TOP = ../..
include $(PATH_TO_TOP)/rules.mak
# test_old tests
TEST_APPS = SampleWindow alive apc args atomtest bench bitblt button \
button2 capclock carets cliarea combo consume copymove count dibtest \
dump_shared_data edit enumwnd event file gditest global_mem hello \
hivetest icontest isotest lineclip linetest lock lpc messagebox mktime \
mstest multiwin mutex nptest patblt pipe primitives pteb regtest \
sectest sertest shaptest shm statst statst2 stretchblt suspend \
tcpsvr terminate txtscale thread thread_msg tokentest vmtest \
winhello winhello2 wm_erasebkgnd wm_paint eventpair threadwait \
map_dup_inherit p_dup_handle
TEST_MISC =
all: $(TEST_APPS) $(TEST_MISC)
depends:
implib: $(TEST_APPS:%=%_implib) \
$(TEST_MISC:%=%_implib)
clean: $(TEST_APPS:%=%_clean) \
$(TEST_MISC:%=%_clean)
install: $(TEST_APPS:%=%_install) \
$(TEST_MISC:%=%_install)
dist: $(TEST_APPS:%=%_dist) \
$(TEST_MISC:%=%_dist)
.PHONY: all depends implib clean install dist
#
# Test Applications
#
$(TEST_APPS): %:
$(MAKE) -C $*
$(TEST_APPS:%=%_implib): %_implib:
$(MAKE) -C $* implib
$(TEST_APPS:%=%_clean): %_clean:
$(MAKE) -C $* clean
$(TEST_APPS:%=%_dist): %_dist:
$(MAKE) -C $* dist
$(TEST_APPS:%=%_install): %_install:
$(MAKE) -C $* install
.PHONY: $(TEST_APPS) $(TEST_APPS:%=%_implib) $(TEST_APPS:%=%_clean) $(TEST_APPS:%=%_install) $(TEST_APPS:%=%_dist)
#
# Misc Test Applications
#
$(TEST_MISC): %:
$(MAKE) -C tests/$*
$(TEST_MISC:%=%_implib): %_implib:
$(MAKE) -C tests/$* implib
$(TEST_MISC:%=%_clean): %_clean:
$(MAKE) -C tests/$* clean
$(TEST_MISC:%=%_dist): %_dist:
$(MAKE) -C tests/$* dist
$(TEST_MISC:%=%_install): %_install:
$(MAKE) -C tests/$* install
.PHONY: $(TEST_MISC) $(TEST_MISC:%=%_implib) $(TEST_MISC:%=%_clean) $(TEST_MISC:%=%_install) $(TEST_MISC:%=%_dist)
etags:
find . -name "*.[ch]" -print | etags --language=c -
# EOF

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,21 @@
# $Id: makefile,v 1.1 2003/07/24 15:51:58 rcampbell Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = window
TARGET_SDKLIBS = kernel32.a gdi32.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,212 @@
/*
* A basic example of Win32 programming in C.
*
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
*
* Colin Peters <colinp at ma.kcom.ne.jp>
*/
#include <windows.h>
#include <string.h>
/*
* This is the window function for the main window. Whenever a message is
* dispatched using DispatchMessage (or sent with SendMessage) this function
* gets called with the contents of the message.
*/
LRESULT CALLBACK
MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
/* The window handle for the "Click Me" button. */
static HWND hwndButton = 0;
static int cx, cy; /* Height and width of our button. */
HDC hdc; /* A device context used for drawing */
PAINTSTRUCT ps; /* Also used during window drawing */
RECT rc; /* A rectangle used during drawing */
/*
* Perform processing based on what kind of message we got.
*/
switch (nMsg)
{
case WM_CREATE:
{
/* The window is being created. Create our button
* window now. */
TEXTMETRIC tm;
/* First we use the system fixed font size to choose
* a nice button size. */
hdc = GetDC (hwnd);
SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT));
GetTextMetrics (hdc, &tm);
cx = tm.tmAveCharWidth * 30;
cy = (tm.tmHeight + tm.tmExternalLeading) * 2;
ReleaseDC (hwnd, hdc);
/* Now create the button */
hwndButton = CreateWindow (
"button", /* Builtin button class */
"Click Here",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, cx, cy,
hwnd, /* Parent is this window. */
(HMENU) 1, /* Control ID: 1 */
((LPCREATESTRUCT) lParam)->hInstance,
NULL
);
return 0;
break;
}
case WM_DESTROY:
/* The window is being destroyed, close the application
* (the child button gets destroyed automatically). */
PostQuitMessage (0);
return 0;
break;
case WM_PAINT:
/* The window needs to be painted (redrawn). */
hdc = BeginPaint (hwnd, &ps);
GetClientRect (hwnd, &rc);
/* Draw "Hello, World" in the middle of the upper
* half of the window. */
rc.bottom = rc.bottom / 2;
DrawText (hdc, "Hello, World", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
EndPaint (hwnd, &ps);
return 0;
break;
case WM_SIZE:
/* The window size is changing. If the button exists
* then place it in the center of the bottom half of
* the window. */
if (hwndButton &&
(wParam == SIZEFULLSCREEN ||
wParam == SIZENORMAL)
)
{
rc.left = (LOWORD(lParam) - cx) / 2;
rc.top = HIWORD(lParam) * 3 / 4 - cy / 2;
MoveWindow (
hwndButton,
rc.left, rc.top, cx, cy, TRUE);
}
break;
case WM_COMMAND:
/* Check the control ID, notification code and
* control handle to see if this is a button click
* message from our child button. */
if (LOWORD(wParam) == 1 &&
HIWORD(wParam) == BN_CLICKED &&
(HWND) lParam == hwndButton)
{
/* Our button was clicked. Close the window. */
DestroyWindow (hwnd);
}
return 0;
break;
}
/* If we don't handle a message completely we hand it to the system
* provided default window function. */
return DefWindowProc (hwnd, nMsg, wParam, lParam);
}
int STDCALL
WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
{
HWND hwndMain; /* Handle for the main window. */
MSG msg; /* A Win32 message structure. */
WNDCLASSEX wndclass; /* A window class structure. */
char* szMainWndClass = "WinTestWin";
/* The name of the main window class */
/*
* First we create a window class for our main window.
*/
/* Initialize the entire structure to zero. */
memset (&wndclass, 0, sizeof(WNDCLASSEX));
/* This class is called WinTestWin */
wndclass.lpszClassName = szMainWndClass;
/* cbSize gives the size of the structure for extensibility. */
wndclass.cbSize = sizeof(WNDCLASSEX);
/* All windows of this class redraw when resized. */
wndclass.style = CS_HREDRAW | CS_VREDRAW;
/* All windows of this class use the MainWndProc window function. */
wndclass.lpfnWndProc = MainWndProc;
/* This class is used with the current program instance. */
wndclass.hInstance = hInst;
/* Use standard application icon and arrow cursor provided by the OS */
wndclass.hIcon = LoadIcon (NULL, (LPCTSTR)IDI_APPLICATION);
wndclass.hIconSm = LoadIcon (NULL, (LPCTSTR)IDI_APPLICATION);
wndclass.hCursor = LoadCursor (NULL, (LPCTSTR)IDC_ARROW);
/* Color the background white */
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
/*
* Now register the window class for use.
*/
RegisterClassEx (&wndclass);
/*
* Create our main window using that window class.
*/
hwndMain = CreateWindow (
szMainWndClass, /* Class name */
"Hello", /* Caption */
WS_OVERLAPPEDWINDOW, /* Style */
CW_USEDEFAULT, /* Initial x (use default) */
CW_USEDEFAULT, /* Initial y (use default) */
CW_USEDEFAULT, /* Initial x size (use default) */
CW_USEDEFAULT, /* Initial y size (use default) */
NULL, /* No parent window */
NULL, /* No menu */
hInst, /* This program instance */
NULL /* Creation parameters */
);
/*
* Display the window which we just created (using the nShow
* passed by the OS, which allows for start minimized and that
* sort of thing).
*/
ShowWindow (hwndMain, nShow);
UpdateWindow (hwndMain);
/*
* The main message loop. All messages being sent to the windows
* of the application (or at least the primary thread) are retrieved
* by the GetMessage call, then translated (mainly for keyboard
* messages) and dispatched to the appropriate window procedure.
* This is the simplest kind of message loop. More complex loops
* are required for idle processing or handling modeless dialog
* boxes. When one of the windows calls PostQuitMessage GetMessage
* will return zero and the wParam of the message will be filled
* with the argument to PostQuitMessage. The loop will end and
* the application will close.
*/
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}
/* EOF */

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View 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

View 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 */

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,85 @@
#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 = UNICODE_STRING_INITIALIZER(L"\\C:\\a.txt");
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");
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;
}

View 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

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View 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;
}

View 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

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View 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);
}

View 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

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

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

View 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;
}

View 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

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,138 @@
/*
* Windows 2000 Graphics API Black Book
* (BitBlt Bitmap Rendering Demo)
*
* Created by Damon Chandler <dmc27@ee.cornell.edu>
* Updates can be downloaded at: <www.coriolis.com>
*
* Please do not hesistate to e-mail me at dmc27@ee.cornell.edu
* if you have any questions about this code.
*/
#include <windows.h>
HINSTANCE HInst;
const char* WndClassName = "GMainWnd";
LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
LPARAM LParam);
int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE HPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wc;
MSG msg;
HInst = HInstance;
memset(&wc, 0, sizeof(WNDCLASS));
wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
wc.lpfnWndProc = MainWndProc;
wc.hInstance = HInstance;
wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
/* wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BTNFACE + 1); */
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.lpszClassName = WndClassName;
if (RegisterClass(&wc))
{
HWND HWnd =
CreateWindow(
WndClassName, TEXT("BitBlt Bitmap Rendering Demo"),
WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION |
WS_VISIBLE | WS_CLIPSIBLINGS,
0, 0, 220, 230,
NULL, NULL, HInst, NULL
);
if (HWnd)
{
ShowWindow(HWnd, nCmdShow);
UpdateWindow(HWnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
return 0;
}
/* image related */
BITMAP bmp;
LPCSTR filename = TEXT("lena.bmp");
HDC HMemDC = NULL;
HBITMAP HOldBmp = NULL;
LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
LPARAM LParam)
{
switch (Msg)
{
case WM_CREATE:
{
/* create a memory DC */
HMemDC = CreateCompatibleDC(NULL);
if (HMemDC)
{
/* load a bitmap from file */
HBITMAP HBmp =
/* static_cast<HBITMAP> */(
LoadImage(HInst, filename, IMAGE_BITMAP,
0, 0, LR_LOADFROMFILE)
);
if (HBmp)
{
/* extract dimensions of the bitmap */
GetObject(HBmp, sizeof(BITMAP), &bmp);
/* associate the bitmap with the memory DC */
/* HOldBmp = static_cast<HBITMAP> */
(SelectObject(HMemDC, HBmp)
);
}
}
}
case WM_PAINT:
{
PAINTSTRUCT ps;
const HDC Hdc = BeginPaint(HWnd, &ps);
#if 0
try
#endif
{
/* TODO: add palette support (see Chapter 9)... */
BitBlt(Hdc, 20, 15,
bmp.bmWidth, bmp.bmHeight,
HMemDC, 0, 0,
SRCCOPY);
}
#if 0
catch (...)
#endif
{
EndPaint(HWnd, &ps);
}
EndPaint(HWnd, &ps);
break;
}
case WM_DESTROY:
{
/* clean up */
DeleteObject(SelectObject(HMemDC, HOldBmp));
DeleteDC(HMemDC);
PostQuitMessage(0);
return 0;
}
}
return DefWindowProc(HWnd, Msg, WParam, LParam);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

View File

@@ -0,0 +1,20 @@
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = bitblt
TARGET_SDKLIBS = kernel32.a gdi32.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,20 @@
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = btntest
TARGET_SDKLIBS = kernel32.a gdi32.a
TARGET_OBJECTS = buttontst.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,108 @@
/* Based on Radoslaw Sokol's static control test. */
#include <windows.h>
static LPSTR BUTTON_CLASS = "BUTTON";
static LPSTR TEST_WND_CLASS = "TESTWND";
#ifdef NDEBUG
#define DPRINT(s) (void)0
#else
#define DPRINT(s) OutputDebugStringA("BUTTONTEST: " s "\n")
#endif
HINSTANCE AppInstance = NULL;
LRESULT WmCreate(
HWND Wnd)
{
UCHAR i;
DPRINT("WM_CREATE (enter).");
DPRINT("test 1");
CreateWindowEx(0, BUTTON_CLASS, "PushButton", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE,
10, 10, 150, 30, Wnd, NULL, AppInstance, NULL);
DPRINT("test 2");
CreateWindowEx(0, BUTTON_CLASS, "DefPushButton", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE,
10, 40, 150, 30, Wnd, NULL, AppInstance, NULL);
DPRINT("test 3");
CreateWindowEx(0, BUTTON_CLASS, "AutoRadioButton", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE,
10, 70, 150, 30, Wnd, NULL, AppInstance, NULL);
DPRINT("test 4");
CreateWindowEx(0, BUTTON_CLASS, "AutoCheckBox", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE,
10, 100, 150, 30, Wnd, NULL, AppInstance, NULL);
DPRINT("WM_CREATE (leave).");
return 0;
}
LRESULT CALLBACK TestWndProc(
HWND Wnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
{
switch (Msg) {
case WM_CREATE:
return WmCreate(Wnd);
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(Wnd, Msg, wParam, lParam);
}
}
int STDCALL WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
ATOM Result;
MSG Msg;
HWND MainWindow;
WNDCLASSEX TestWndClass = {0};
DPRINT("Application starting up.");
// Remember instance handle.
AppInstance = GetModuleHandle(NULL);
// Register test window class.
TestWndClass.cbSize = sizeof(WNDCLASSEX);
TestWndClass.lpfnWndProc = &TestWndProc;
TestWndClass.hInstance = AppInstance;
TestWndClass.hCursor = LoadCursor(0, (LPCTSTR)IDC_ARROW);
TestWndClass.hbrBackground = CreateSolidBrush(RGB(255,255,230));
TestWndClass.lpszClassName = TEST_WND_CLASS;
Result = RegisterClassEx(&TestWndClass);
if (Result == 0) {
DPRINT("Error registering class.");
MessageBox(0, "Error registering test window class.",
"Button control test", MB_ICONSTOP | MB_OK);
ExitProcess(0);
}
// Create main window.
DPRINT("Creating main window.");
MainWindow = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_CLIENTEDGE,
TEST_WND_CLASS, "Button test",
WS_OVERLAPPEDWINDOW, 50, 50, 180, 365,
NULL, NULL, AppInstance, NULL);
if (MainWindow == 0) {
DPRINT("Error creating main window.");
UnregisterClass(TEST_WND_CLASS, AppInstance);
MessageBox(0, "Error creating test window.",
"Static control test", MB_ICONSTOP | MB_OK);
ExitProcess(0);
}
DPRINT("Showing main window.");
ShowWindow(MainWindow, SW_SHOWNORMAL);
UpdateWindow(MainWindow);
// Run message loop.
DPRINT("Entering message loop.");
while (GetMessage(&Msg, NULL, 0, 0) > 0) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
// Unregister window class.
UnregisterClass(TEST_WND_CLASS, AppInstance);
DPRINT("Exiting.");
return Msg.wParam;
}

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,20 @@
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = btntest2
TARGET_SDKLIBS = kernel32.a gdi32.a
TARGET_OBJECTS = buttontst2.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,219 @@
#include <windows.h>
#include <stdio.h>
HFONT tf;
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
WNDCLASS wc;
MSG msg;
HWND hWnd;
HWND hbtn[26];
wc.lpszClassName = "ButtonTest";
wc.lpfnWndProc = MainWndProc;
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (RegisterClass(&wc) == 0)
{
fprintf(stderr, "RegisterClass failed (last error 0x%X)\n",
GetLastError());
return(1);
}
hWnd = CreateWindow("ButtonTest",
"Button Test",
WS_OVERLAPPEDWINDOW,
0,
0,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
if (hWnd == NULL)
{
fprintf(stderr, "CreateWindow failed (last error 0x%X)\n",
GetLastError());
return(1);
}
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");
ShowWindow(hWnd, nCmdShow);
hbtn[0] = CreateWindow(
"BUTTON","BS_DEFPUSHBUTTON",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
10, 10, 200, 40, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[1] = CreateWindow(
"BUTTON","BS_3STATE",WS_VISIBLE | WS_CHILD | BS_3STATE,
10, 60, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[2] = CreateWindow(
"BUTTON","BS_AUTO3STATE",WS_VISIBLE | WS_CHILD | BS_AUTO3STATE,
10, 90, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[3] = CreateWindow(
"BUTTON","BS_AUTOCHECKBOX",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
10, 120, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[4] = CreateWindow(
"BUTTON","BS_AUTORADIOBUTTON",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
10, 150, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[5] = CreateWindow(
"BUTTON","BS_CHECKBOX",WS_VISIBLE | WS_CHILD | BS_CHECKBOX,
10, 180, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[6] = CreateWindow(
"BUTTON","BS_GROUPBOX",WS_VISIBLE | WS_CHILD | BS_GROUPBOX,
10, 210, 200, 80, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[7] = CreateWindow(
"BUTTON","BS_PUSHBUTTON",WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
20, 230, 180, 30, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[8] = CreateWindow(
"BUTTON","BS_RADIOBUTTON",WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON,
10, 300, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[9] = CreateWindow(
"BUTTON","BS_AUTORADIOBUTTON",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
220, 160, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[10] = CreateWindow(
"BUTTON","BS_DEFPUSHBUTTON|BS_BOTTOM",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_BOTTOM,
220, 10, 250, 40, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[11] = CreateWindow(
"BUTTON","BS_DEFPUSHBUTTON|BS_LEFT",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_LEFT,
480, 10, 250, 40, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[12] = CreateWindow(
"BUTTON","BS_DEFPUSHBUTTON|BS_RIGHT|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_RIGHT |BS_MULTILINE,
740, 10, 150, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[13] = CreateWindow(
"BUTTON","BS_AUTORADIOBUTTON|BS_TOP",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_TOP,
220, 60, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
// Other Combinations
hbtn[14] = CreateWindow(
"BUTTON","BS_AUTORADIOBUTTON|BS_BOTTOM|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_BOTTOM | BS_MULTILINE,
480, 60, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[15] = CreateWindow(
"BUTTON","BS_AUTORADIOBUTTON|BS_LEFT",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_LEFT,
740, 80, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[16] = CreateWindow(
"BUTTON","BS_AUTORADIOBUTTON|BS_RIGHT|BS_TOP",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_RIGHT | BS_TOP,
220, 130, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[17] = CreateWindow(
"BUTTON","BS_AUTORADIOBUTTON|BS_TOP|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_TOP| BS_MULTILINE,
480, 130, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[18] = CreateWindow(
"BUTTON","BS_AUTOCHECKBOX|BS_BOTTOM|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_BOTTOM | BS_MULTILINE,
740, 130, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[19] = CreateWindow(
"BUTTON","BS_AUTOCHECKBOX|BS_TOP|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE,
480, 190, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[20] = CreateWindow(
"BUTTON","BS_AUTOCHECKBOX|BS_LEFT|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_LEFT | BS_MULTILINE,
220, 230, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[21] = CreateWindow(
"BUTTON","BS_AUTOCHECKBOX|BS_RIGHT|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_RIGHT | BS_MULTILINE,
480, 240, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[22] = CreateWindow(
"BUTTON","BS_GROUPBOX|BS_TOP",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_TOP,
10, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[23] = CreateWindow(
"BUTTON","BS_GROUPBOX|BS_BOTTOM",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_BOTTOM,
10, 410, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[24] = CreateWindow(
"BUTTON","BS_GROUPBOXBOX|BS_LEFT",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_LEFT,
520, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
hbtn[25] = CreateWindow(
"BUTTON","BS_GROUPBOX|BS_RIGHT|BS_BOTTOM",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_BOTTOM | BS_RIGHT,
300, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
DeleteObject(tf);
return msg.wParam;
}
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hDC;
switch(msg)
{
case WM_PAINT:
hDC = BeginPaint(hWnd, &ps);
SelectObject(hDC, tf);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_COMMAND:
switch(HIWORD(wParam))
{
case BN_CLICKED:
printf("BUTTON CLICKED !\n");
break;
case BN_DBLCLK:
printf("BUTTON DOUBLE-CLICKED !\n");
break;
case BN_PUSHED:
printf("BUTTON PUSHED !\n");
break;
case BN_PAINT:
printf("BUTTON PAINTED !\n");
break;
case BN_UNPUSHED:
printf("BUTTON UNPUSHED !\n");
break;
}
break;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,18 @@
PATH_TO_TOP = ../../..
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = capclock
TARGET_SDKLIBS = kernel32.a
TARGET_OBJECTS = capclock.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,69 @@
/* $Id: capclock.c,v 1.2 2003/09/24 20:05:29 weiden Exp $
*
* DESCRIPTION: Simple Win32 Caption Clock
* PROJECT : ReactOS (test applications)
* AUTHOR : Emanuele Aliberti
* DATE : 2003-09-03
* LICENSE : GNU GPL v2.0
*/
#include <windows.h>
UINT Timer = 1;
static BOOL CALLBACK DialogFunc(HWND,UINT,WPARAM,LPARAM);
static VOID CALLBACK TimerProc(HWND,UINT,UINT,DWORD);
INT STDCALL WinMain (HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, INT nCmdShow)
{
WNDCLASS wc;
ZeroMemory (& wc, sizeof wc);
wc.lpfnWndProc = DefDlgProc;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hinst;
wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
wc.lpszClassName = "CapClock";
RegisterClass (& wc);
return DialogBox(hinst, MAKEINTRESOURCE(2), NULL, (DLGPROC) DialogFunc);
}
static int InitializeApp (HWND hDlg,WPARAM wParam, LPARAM lParam)
{
Timer = SetTimer (hDlg,Timer,1000,TimerProc);
TimerProc (hDlg,0,0,0);
return 1;
}
static BOOL CALLBACK DialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_INITDIALOG:
InitializeApp(hwndDlg,wParam,lParam);
return TRUE;
case WM_CLOSE:
KillTimer (hwndDlg,Timer);
EndDialog(hwndDlg,0);
return TRUE;
}
return FALSE;
}
static VOID CALLBACK TimerProc (HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
{
CHAR text [20];
SYSTEMTIME lt;
GetLocalTime (& lt);
wsprintf (
text,
"%d-%02d-%02d %02d:%02d:%02d",
lt.wYear,
lt.wMonth,
lt.wDay,
lt.wHour,
lt.wMinute,
lt.wSecond);
SetWindowText (hwnd, text);
}
/* EOF */

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,52 @@
#include <windows.h>
#include "../../../include/reactos/resource.h"
/* Icons */
1 ICON "capclock.ico"
/* Dialogs */
2 DIALOG 6, 18, 132, 0
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
FONT 8, "Microsoft Sans Serif"
BEGIN
END
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
/* Version information. */
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "ReactOS W32 Caption Clock\0"
VALUE "FileVersion", RES_STR_PRODUCT_VERSION
VALUE "InternalName", "capclock\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "capclock.exe\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

View File

@@ -0,0 +1,150 @@
#include <windows.h>
#include <stdio.h>
#include "resource.h"
static int CaretWidth = 2;
static int CaretHeight = 16;
static int CharWidth = 10;
static int CharHeight = 16;
static HBITMAP CaretBitmap;
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
WNDCLASS wc;
MSG msg;
HWND hWnd;
CaretBitmap = LoadBitmap(hInstance, (LPCTSTR)IDB_CARET);
wc.lpszClassName = "CaretTestClass";
wc.lpfnWndProc = MainWndProc;
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (RegisterClass(&wc) == 0)
{
fprintf(stderr, "RegisterClass failed (last error 0x%X)\n",
GetLastError());
return(1);
}
hWnd = CreateWindow(wc.lpszClassName,
"Caret Test",
WS_OVERLAPPEDWINDOW,
0,
0,
200,
250,
NULL,
NULL,
hInstance,
NULL);
if (hWnd == NULL)
{
fprintf(stderr, "CreateWindow failed (last error 0x%X)\n",
GetLastError());
return(1);
}
ShowWindow(hWnd, nCmdShow);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
POINT pt;
switch(msg)
{
case WM_ACTIVATE:
switch(LOWORD(wParam))
{
case WA_ACTIVE:
case WA_CLICKACTIVE:
if(!ShowCaret(hWnd))
DbgPrint("ShowCaret(0x%x)\n", hWnd);
break;
case WA_INACTIVE:
if(!HideCaret(hWnd))
DbgPrint("HideCaret(0x%x)\n", hWnd);
break;
}
break;
case WM_KEYDOWN:
if(!GetCaretPos(&pt))
{
DbgPrint("GetCaretPos() failed!\n");
break;
}
switch(wParam)
{
case VK_LEFT:
pt.x -= CharWidth;
break;
case VK_UP:
pt.y -= CharHeight;
break;
case VK_RIGHT:
pt.x += CharWidth;
break;
case VK_DOWN:
pt.y += CharHeight;
break;
}
if(!SetCaretPos(pt.x, pt.y))
DbgPrint("SetCaretPos() failed!\n");
break;
case WM_RBUTTONDOWN:
if(!CreateCaret(hWnd, CaretBitmap, 0, 0))
DbgPrint("CreateCaret() for window 0x%x failed!\n", hWnd);
else
if(!ShowCaret(hWnd))
DbgPrint("ShowCaret(0x%x)\n", hWnd);
break;
case WM_LBUTTONDOWN:
if(!CreateCaret(hWnd, (HBITMAP)0, CaretWidth, CaretHeight))
DbgPrint("CreateCaret() for window 0x%x failed!\n", hWnd);
else
if(!ShowCaret(hWnd))
DbgPrint("ShowCaret(0x%x)\n", hWnd);
break;
case WM_CREATE:
if(!CreateCaret(hWnd, (HBITMAP)0, CaretWidth, CaretHeight))
DbgPrint("CreateCaret() for window 0x%x failed!\n", hWnd);
else
if(!SetCaretPos(1, 1))
DbgPrint("SetCaretPos(%i, %i) failed!\n", 1, 1);
break;
case WM_DESTROY:
if(!DestroyCaret())
DbgPrint("DestroyCaret() failed!\n");
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}

View File

@@ -0,0 +1,5 @@
#include <defines.h>
#include <reactos/resource.h>
#include "resource.h"
IDB_CARET BITMAP DISCARDABLE "caret.bmp"

View File

@@ -0,0 +1,21 @@
# $Id: makefile,v 1.1 2003/10/15 18:28:54 weiden Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = no
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = carets
TARGET_SDKLIBS = kernel32.a gdi32.a ntdll.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1 @@
#define IDB_CARET 101

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,100 @@
#include <windows.h>
#include <stdio.h>
//HFONT tf;
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
WNDCLASS wc;
MSG msg;
HWND hWnd;
wc.lpszClassName = "CliAreaClass";
wc.lpfnWndProc = MainWndProc;
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (RegisterClass(&wc) == 0)
{
fprintf(stderr, "RegisterClass failed (last error 0x%X)\n",
GetLastError());
return(1);
}
hWnd = CreateWindow("CliAreaClass",
"ClientArea Test",
WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
0,
0,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
if (hWnd == NULL)
{
fprintf(stderr, "CreateWindow failed (last error 0x%X)\n",
GetLastError());
return(1);
}
//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");
ShowWindow(hWnd, nCmdShow);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//DeleteObject(tf);
return msg.wParam;
}
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hDC;
RECT clr, wir;
char txt[100];
switch(msg)
{
case WM_LBUTTONUP:
{
ULONG x, y;
RECT Rect;
GetWindowRect(hWnd, &Rect);
SendMessage(hWnd, WM_NCCALCSIZE, 0, (LPARAM)(&Rect));
hDC = GetWindowDC(0);
Rectangle(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom);
sprintf(txt, "Client coordinates: %d, %d, %d, %d\0", Rect.left, Rect.top, Rect.right, Rect.bottom);
TextOut(hDC, Rect.left + 1, Rect.top + 1, (LPCTSTR)txt, strlen(txt));
ReleaseDC(0, hDC);
break;
}
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}

View File

@@ -0,0 +1,21 @@
# $Id: makefile,v 1.1 2003/10/04 12:14:37 weiden Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = cliarea
TARGET_SDKLIBS = kernel32.a gdi32.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,687 @@
/* ComboBox Control Test for ReactOS.
* This is a test program. Not made to be fast, small
* easy to mantain, or portable.
* I'm not erasing text because I don't want to use other functions from the API
* or make this more complex. Also Fonts are not heavily used.
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
* by Waldo Alvarez Ca<43>izares <wac at ghost.matcom.uh.cu>, started July 11, 2003. */
//#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "utils.h"
#define CONTROLCLASS "COMBOBOX" /* the class name */
#define CONTROLCLASSW L"COMBOBOX" /* the class name in unicode*/
#define WINDOWWIDTH 560
#define WINDOWHEIGHT 350
/* --- Command IDs of some buttons --- */
#define CREATEWINDOW_ID 106
#define CREATEWINDOWEX_ID 107
#define CREATEWINDOWW_ID 108
#define INITPAGE_ID 400
#define SECONDPAGE_ID 401
#define BACKFIRSTPAGE_ID 402
/* --- Position where the result text goes --- */
#define ResultX 0
#define ResultY 305
/* --- Position where the notify text goes --- */
#define NOTIFYX 390
#define NOTIFYY 285
/* --- The width of most buttons --- */
#define CHECKBUTWIDTH 190
#define SCROLLAMOUNT -15
/* Size of buffer to hold resulting strings from conversion
and returned by messages */
#define BUFFERLEN 80
char TextBuffer[BUFFERLEN]={'R','e','s','u','l','t',':',' '};
HWND g_hwnd = NULL;
HINSTANCE g_hInst = NULL;
int pos = 10;
int n = 0;
int yButPos = 10;
int xButPos = 0;
DWORD ComboStyle = 0;
/* --- Control coordinates --- */
#define CONTROLPOSX 390
#define CONTROLPOSY 10
DWORD ControlWidth = 160;
DWORD ControlHeight = 150;
static RECT srect = {CONTROLPOSX,CONTROLPOSY,WINDOWWIDTH,WINDOWHEIGHT};
HWND hwndEdit = NULL;
RECT rect;
DWORD StartP,EndP;
HWND hwnd; /* main window handle */
char AddString[] = "string added";
typedef void FunctionHandler(HWND,DWORD,WPARAM,LPARAM);
typedef FunctionHandler* LPFUNCTIONHANDLER;
PrintTextXY(char* Text,int x,int y,int len, RECT rect)
{
HDC hdc;
hdc = GetDC (g_hwnd);
SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT));
TextOut (hdc, x,y,Text,len);
ReleaseDC (g_hwnd, hdc);
ValidateRect (g_hwnd, &rect);
}
static
VOID
HandlePrintReturnHex(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
{
LRESULT ret;
RECT rect;
ret = SendMessage(handle,Msg,wParam,lParam);
htoa((unsigned int)ret,&TextBuffer[8]);
GetWindowRect(g_hwnd,&rect);
PrintTextXY(TextBuffer,ResultX,ResultY,16,rect);
}
static
VOID
HandlePrintReturnStr(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
{
LRESULT ret;
RECT rect;
TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */
ret = SendMessage(handle,Msg,wParam,lParam);
GetWindowRect(g_hwnd,&rect);
PrintTextXY(TextBuffer,ResultX,ResultY,8+(int)ret,rect);
}
static
VOID
HandlePrintRect(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
{
RECT rect;
TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */
SendMessage(handle,Msg,wParam,lParam);
htoa(rect.top,&TextBuffer[8]);
TextBuffer[8+8] = ' ';
htoa(rect.bottom,&TextBuffer[8+8+1]);
TextBuffer[8+8+8+1] = ' ';
htoa(rect.left,&TextBuffer[8+8+8+1+1]);
TextBuffer[8+8+8+8+1+1] = ' ';
htoa(rect.right,&TextBuffer[8+8+8+8+1+1+1]);
GetWindowRect(g_hwnd,&rect);
PrintTextXY(TextBuffer,ResultX,ResultY,8+4*9-1,rect);
}
struct
{
char* Text; /* Text for the button */
DWORD MsgCode; /* Message Code */
WPARAM wParam; /* Well hope you can understand this */
LPARAM lParam; /* ditto */
LPFUNCTIONHANDLER Handler; /* Funtion called to handle the result of each message */
}
Msg[] =
{
"CB_ADDSTRING",CB_ADDSTRING,0,(LPARAM)&AddString,&HandlePrintReturnHex,
"CB_ADDSTRING - long",CB_ADDSTRING,0,(LPARAM)"very loooooooooong striiinnnnnnnnnggg",&HandlePrintReturnHex,
"CB_DELETESTRING",CB_DELETESTRING,2,0,&HandlePrintReturnHex, /* remember to catch WM_DELETEITEM*/
/* What a message, why M$ decided to implement his thing ? */
"CB_DIR - drives",CB_DIR,DDL_DRIVES,
/* Hoping that most machines have this */
(LPARAM)"C:\\",
&HandlePrintReturnHex,
"CB_DIR - dirs",CB_DIR,DDL_DIRECTORY,(LPARAM)"C:\\*",&HandlePrintReturnHex,
"CB_DIR - files",CB_DIR,
DDL_ARCHIVE | DDL_EXCLUSIVE | DDL_HIDDEN | DDL_READONLY | DDL_READWRITE | DDL_SYSTEM,
(LPARAM)"C:\\*",&HandlePrintReturnHex,
/* Do not forget WM_COMPAREITEM */
"CB_FINDSTRING",CB_FINDSTRING,1,(LPARAM)"str",&HandlePrintReturnHex,
"CB_FINDSTRINGEXACT(-1)",CB_FINDSTRINGEXACT,-1,(LPARAM)&AddString,&HandlePrintReturnHex,
"CB_FINDSTRINGEXACT(2)",CB_FINDSTRINGEXACT,2,(LPARAM)&AddString,&HandlePrintReturnHex,
/* "CB_GETCOMBOBOXINFO",CB_GETCOMBOBOXINFO,0,0,&HandlePrintReturnHex, winXP & .net server remember to handle the struct */
"CB_GETCOUNT",CB_GETCOUNT,0,0,&HandlePrintReturnHex,
"CB_GETCURSEL",CB_GETCURSEL,0,0,&HandlePrintReturnHex,
/* To implement "CB_GETEDITSEL - vars",CB_GETEDITSEL,,,&HandlePrintReturnHex, */
"CB_GETEXTENDEDUI",CB_GETEXTENDEDUI,0,0,&HandlePrintReturnHex,
"CB_GETHORIZONTALEXTENT",CB_GETHORIZONTALEXTENT,0,0,&HandlePrintReturnHex,
"CB_GETLBTEXT",CB_GETLBTEXT,1,(LPARAM)&TextBuffer[8],&HandlePrintReturnStr,
"CB_GETLBTEXTLEN",CB_GETLBTEXTLEN,1,0,&HandlePrintReturnHex,
"CB_GETLOCALE",CB_GETLOCALE,0,0,&HandlePrintReturnHex,
/* "CB_GETMINVISIBLE",CB_GETMINVISIBLE,0,0,&HandlePrintReturnHex, Included in Windows XP and Windows .NET Server. */
"CB_GETTOPINDEX",CB_GETTOPINDEX,0,0,&HandlePrintReturnHex,
"CB_INITSTORAGE",CB_INITSTORAGE,10,200,&HandlePrintReturnHex,
"CB_INSERTSTRING",CB_INSERTSTRING,2,(LPARAM)"inserted string",&HandlePrintReturnHex,
"CB_LIMITTEXT",CB_LIMITTEXT,10,0,&HandlePrintReturnHex,
"CB_RESETCONTENT",CB_RESETCONTENT ,0,0,&HandlePrintReturnHex,
"CB_SELECTSTRING",CB_SELECTSTRING,2,(LPARAM)"str",&HandlePrintReturnHex,
"CB_SETCURSEL",CB_SETCURSEL,1,0,&HandlePrintReturnHex,
"CB_SETDROPPEDWIDTH",CB_SETDROPPEDWIDTH,250,0,&HandlePrintReturnHex,
"CB_SETEXTENDEDUI - set",CB_SETEXTENDEDUI,TRUE,0,&HandlePrintReturnHex,
"CB_SETEXTENDEDUI - clear",CB_SETEXTENDEDUI,FALSE,0,&HandlePrintReturnHex,
/*
* win2k have a small bug with this ^ , if you press F4 while it is cleared,
* the combobox is using style cbs_dropdown
* and the pointer is over the edit box then the mouse pointer is not changed
* to an arrow
*/
"CB_SETHORIZONTALEXTENT",CB_SETHORIZONTALEXTENT,500,0,&HandlePrintReturnHex,
"CB_GETITEMDATA",CB_GETITEMDATA,1,0,&HandlePrintReturnHex,
"CB_SETITEMDATA",CB_SETITEMDATA,1,0x791031,&HandlePrintReturnHex,
"CB_SETITEMHEIGHT",CB_SETITEMHEIGHT,-1,30,&HandlePrintReturnHex,
"CB_GETITEMHEIGHT",CB_GETITEMHEIGHT,2,0,&HandlePrintReturnHex,
/* "CB_SETMINVISIBLE",CB_SETMINVISIBLE,4,0,&HandlePrintReturnHex, Included in Windows XP and Windows .NET Server */
"CB_GETEDITSEL",CB_GETEDITSEL,(WPARAM)NULL,(LPARAM)NULL,&HandlePrintReturnHex,
"CB_SETEDITSEL",CB_SETEDITSEL,0,0x00020005,&HandlePrintReturnHex,
"CB_SETEDITSEL - clear",CB_SETEDITSEL,0,0xFFFFFFFF,&HandlePrintReturnHex,
"CB_SETTOPINDEX",CB_SETTOPINDEX,3,0,&HandlePrintReturnHex,
"CB_SHOWDROPDOWN - true",CB_SHOWDROPDOWN,TRUE,0,&HandlePrintReturnHex,
"CB_SHOWDROPDOWN - false",CB_SHOWDROPDOWN,FALSE,0,&HandlePrintReturnHex,
"CB_GETDROPPEDCONTROLRECT",CB_GETDROPPEDCONTROLRECT,0,(LPARAM)&rect,&HandlePrintRect,
"CB_GETDROPPEDSTATE",CB_GETDROPPEDSTATE,0,0,&HandlePrintReturnHex,
"CB_GETDROPPEDWIDTH",CB_GETDROPPEDWIDTH,0,0,&HandlePrintReturnHex,
"WM_PASTE",WM_PASTE,0,0,&HandlePrintReturnHex,
};
#define MAXMESSAGEBUTTONS 40
struct
{
char* Name; /* Text for the button */
DWORD Code; /* Style Code */
}
Styles[] = {
"WS_DISABLED",WS_DISABLED,
"CBS_AUTOHSCROLL",CBS_AUTOHSCROLL,
"CBS_DISABLENOSCROLL",CBS_DISABLENOSCROLL,
"CBS_DROPDOWN",CBS_DROPDOWN,
"CBS_DROPDOWNLIST",CBS_DROPDOWNLIST,
"CBS_HASSTRINGS",CBS_HASSTRINGS,
"CBS_LOWERCASE",CBS_LOWERCASE,
"CBS_NOINTEGRALHEIGHT",CBS_NOINTEGRALHEIGHT,
"CBS_OEMCONVERT",CBS_OEMCONVERT,
"CBS_OWNERDRAWFIXED",CBS_OWNERDRAWFIXED,
"CBS_OWNERDRAWVARIABLE",CBS_OWNERDRAWVARIABLE,
"CBS_SIMPLE",CBS_SIMPLE,
"CBS_SORT",CBS_SORT,
"CBS_UPPERCASE",CBS_UPPERCASE,
"CBS_DISABLENOSCROLL",CBS_DISABLENOSCROLL,
"WS_HSCROLL",WS_HSCROLL,
"WS_VSCROLL",WS_VSCROLL
};
/* The number of check buttons we have.
* Maybe some calculations at compile time would be better
*/
#define NUMBERCHECKS 17
#define NUMBERBUTTONS NUMBERCHECKS + 7
HWND Buttons[NUMBERBUTTONS];
HWND MessageButtons[MAXMESSAGEBUTTONS];
HWND Back1But,Back2But;
HWND NextBut;
HWND
CreateCheckButton(const char* lpWindowName, DWORD xSize, DWORD id)
{
HWND h;
h = CreateWindowEx(0,
"BUTTON",
lpWindowName,
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
xButPos, /* x */
yButPos, /* y */
xSize, /* nWidth */
20, /* nHeight */
g_hwnd,
(HMENU) id,
g_hInst,
NULL
);
yButPos += 21;
return h;
}
HWND
CreatePushButton(const char* lpWindowName, DWORD xSize, DWORD id,DWORD Style)
{
HWND h = CreateWindow("BUTTON",
lpWindowName,
WS_CHILD | BS_PUSHBUTTON | Style,
xButPos, /* x */
yButPos, /* y */
xSize, /* nWidth */
20, /* nHeight */
g_hwnd,
(HMENU) id,
g_hInst,
NULL
);
yButPos += 21;
return h;
}
VOID
ReadNHide()
{
int i;
ComboStyle = 0;
for (i=0 ; i< NUMBERCHECKS ; i++)
{
if(BST_CHECKED == SendMessage(Buttons[i],BM_GETCHECK,0,0))
ComboStyle |= Styles[i].Code;
ShowWindow(Buttons[i],SW_HIDE);
}
for (; i< NUMBERBUTTONS ; i++)ShowWindow(Buttons[i],SW_HIDE);
for (i=0 ; i< 26 ; i++) ShowWindow(MessageButtons[i],SW_SHOW);
ShowWindow(Back1But,SW_SHOW);
ShowWindow(NextBut,SW_SHOW);
}
VOID
ForwardToSecondPage()
{
int i;
for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_HIDE);
for(;i<MAXMESSAGEBUTTONS;i++)ShowWindow(MessageButtons[i],SW_SHOW);
ShowWindow(Back2But,SW_SHOW);
ShowWindow(Back1But,SW_HIDE);
ShowWindow(NextBut,SW_HIDE);
}
VOID
BackToFirstPage()
{
int i;
for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_SHOW);
for(;i<MAXMESSAGEBUTTONS;i++)ShowWindow(MessageButtons[i],SW_HIDE);
ShowWindow(Back2But,SW_HIDE);
ShowWindow(Back1But,SW_SHOW);
ShowWindow(NextBut,SW_SHOW);
}
VOID
BackToInitialPage()
{
int i;
DestroyWindow(hwndEdit);
for (i=0 ; i< NUMBERBUTTONS ; i++) {ShowWindow(Buttons[i],SW_SHOW);}
for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_HIDE);
ShowWindow(Back1But,SW_HIDE);
ShowWindow(NextBut,SW_HIDE);
}
LRESULT
CALLBACK
WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
int i;
switch ( msg )
{
case WM_CREATE:
g_hwnd = hwnd;
/* ---- Initial page ---- */
for (i = 0 ; i < 14 ; i++)
Buttons[i] = CreateCheckButton(Styles[i].Name,CHECKBUTWIDTH,500+i);
xButPos += CHECKBUTWIDTH + 10;
yButPos = 10;
for (; i < NUMBERCHECKS ; i++)
Buttons[i] = CreateCheckButton(Styles[i].Name,CHECKBUTWIDTH,500+i);
Buttons[i++] = CreatePushButton("Width +",70,100,WS_VISIBLE);
Buttons[i++] = CreatePushButton("Width -",70,101,WS_VISIBLE);
Buttons[i++] = CreatePushButton("Heigth +",70,102,WS_VISIBLE);
Buttons[i++] = CreatePushButton("Heigth -",70,103,WS_VISIBLE);
Buttons[i++] = CreatePushButton("CreateWindowA",CHECKBUTWIDTH,CREATEWINDOW_ID,WS_VISIBLE);
Buttons[i++] = CreatePushButton("CreateWindowExA",CHECKBUTWIDTH,CREATEWINDOWEX_ID,WS_VISIBLE);
Buttons[i++] = CreatePushButton("CreateWindowExW",CHECKBUTWIDTH,CREATEWINDOWW_ID,WS_VISIBLE);
/* ---- The 1st page of buttons ---- */
xButPos = 0;
yButPos = 10;
for (i = 0 ; i < 14 ; i++)
MessageButtons[i] = CreatePushButton(Msg[i].Text,CHECKBUTWIDTH,600+i,0);
xButPos += CHECKBUTWIDTH + 10;
yButPos = 10;
for (; i < 26 ; i++)
MessageButtons[i] = CreatePushButton(Msg[i].Text,CHECKBUTWIDTH,600+i,0);
Back1But = CreatePushButton("Back - destroys ComboBox",CHECKBUTWIDTH,INITPAGE_ID,0);
NextBut = CreatePushButton("Next",CHECKBUTWIDTH,SECONDPAGE_ID,0);
/* ---- The 2nd page of buttons ------*/
xButPos = 0;
yButPos = 10;
for (; i<40; i++)
MessageButtons[i] = CreatePushButton(Msg[i].Text,CHECKBUTWIDTH,600+i,0);
xButPos += CHECKBUTWIDTH + 10;
yButPos = 10;
for (; i < MAXMESSAGEBUTTONS ; i++)
MessageButtons[i] = CreatePushButton(Msg[i].Text,CHECKBUTWIDTH,600+i,0);
Back2But = CreatePushButton("Back",CHECKBUTWIDTH,BACKFIRSTPAGE_ID,0);
break;
case WM_COMMAND:
if (LOWORD(wParam) >= 600)
{
Msg[LOWORD(wParam)-600].Handler(hwndEdit,
Msg[LOWORD(wParam)-600].MsgCode,
Msg[LOWORD(wParam)-600].wParam,
Msg[LOWORD(wParam)-600].lParam);
break;
}
switch(LOWORD(wParam)){
case 100:
ControlWidth += 10;
break;
case 101:
ControlWidth -= 10;
break;
case 102:
ControlHeight += 10;
break;
case 103:
ControlHeight -= 10;
break;
case INITPAGE_ID:
BackToInitialPage();
break;
case SECONDPAGE_ID:
ForwardToSecondPage();
break;
case BACKFIRSTPAGE_ID:
BackToFirstPage();
break;
case CREATEWINDOW_ID:
ReadNHide();
srect.top = CONTROLPOSY + ControlHeight;
hwndEdit = CreateWindow(CONTROLCLASS,
NULL,
ComboStyle | WS_CHILD | WS_VISIBLE,
CONTROLPOSX,
CONTROLPOSY,
ControlWidth,
ControlHeight,
g_hwnd,
NULL,
g_hInst,
NULL);
break;
case CREATEWINDOWEX_ID:
ReadNHide();
srect.top = CONTROLPOSY + ControlHeight;
hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
CONTROLCLASS,
NULL,
ComboStyle | WS_CHILD | WS_VISIBLE ,
CONTROLPOSX,
CONTROLPOSY,
ControlWidth,
ControlHeight,
g_hwnd,
NULL,
g_hInst,
NULL);
break;
case CREATEWINDOWW_ID:
ReadNHide();
srect.top = CONTROLPOSY + ControlHeight;
hwndEdit = CreateWindowExW(WS_EX_CLIENTEDGE,
CONTROLCLASSW,
NULL,
ComboStyle | WS_CHILD | WS_VISIBLE ,
CONTROLPOSX,
CONTROLPOSY,
ControlWidth,
ControlHeight,
g_hwnd,
NULL,
g_hInst,
NULL);
break;
}
if (lParam == (LPARAM)hwndEdit)
switch(HIWORD(wParam))
{
case CBN_DROPDOWN:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_DROPDOWN notification",NOTIFYX,NOTIFYY,25,srect);
break;
case CBN_CLOSEUP:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_CLOSEUP notification",NOTIFYX,NOTIFYY,24,srect);
break;
case CBN_DBLCLK:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_DBLCLK notification",NOTIFYX,NOTIFYY,23,srect);
break;
case CBN_EDITCHANGE:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_EDITCHANGE notification",NOTIFYX,NOTIFYY,27,srect);
break;
case CBN_ERRSPACE:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_ERRSPACE notification",NOTIFYX,NOTIFYY,25,srect);
break;
case CBN_KILLFOCUS:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_KILLFOCUS notification",NOTIFYX,NOTIFYY,26,srect);
break;
case CBN_EDITUPDATE:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_EDITUPDATE notification",NOTIFYX,NOTIFYY,27,srect);
break;
case CBN_SELCHANGE:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_SELCHANGE notification",NOTIFYX,NOTIFYY,26,srect);
break;
case CBN_SELENDCANCEL:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_SELENDCANCEL notification",NOTIFYX,NOTIFYY,29,srect);
break;
case CBN_SETFOCUS:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_SETFOCUS notification",NOTIFYX,NOTIFYY,25,srect);
break;
case CBN_SELENDOK:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("CBN_SELENDOK notification",NOTIFYX,NOTIFYY,25,srect);
break;
}
return DefWindowProc ( hwnd, msg, wParam, lParam );
case WM_MEASUREITEM:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("WM_MEASUREITEM called",NOTIFYX,NOTIFYY,21,srect);
break;
case WM_COMPAREITEM:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("WM_COMPAREITEM called",NOTIFYX,NOTIFYY,21,srect);
break;
case WM_DRAWITEM:
ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect);
PrintTextXY("WM_DRAWITEM called",NOTIFYX,NOTIFYY,18,srect);
break;
case WM_SIZE :
return 0;
case WM_CLOSE:
DestroyWindow (g_hwnd);
return 0;
case WM_QUERYENDSESSION:
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc ( hwnd, msg, wParam, lParam );
}
HWND
RegisterAndCreateWindow (HINSTANCE hInst,
const char* className,
const char* title)
{
WNDCLASSEX wc;
g_hInst = hInst;
wc.cbSize = sizeof (WNDCLASSEX);
wc.lpfnWndProc = WndProc; /* window procedure */
wc.hInstance = hInst; /* owner of the class */
wc.lpszClassName = className;
wc.hCursor = LoadCursor ( 0, (LPCTSTR)IDC_ARROW );
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hIcon = 0;
wc.hIconSm = 0;
wc.lpszMenuName = 0;
if ( !RegisterClassEx ( &wc ) )
return NULL;
hwnd = CreateWindowEx (
0, /* dwStyleEx */
className, /* class name */
title, /* window title */
WS_OVERLAPPEDWINDOW, /* dwStyle */
1, /* x */
1, /* y */
WINDOWWIDTH, /* width */
WINDOWHEIGHT, /* height */
NULL, /* hwndParent */
NULL, /* hMenu */
hInst,
0
);
if (!hwnd) return NULL;
ShowWindow (hwnd, SW_SHOW);
UpdateWindow (hwnd);
return hwnd;
}
int
WINAPI
WinMain ( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow )
{
char className [] = "ComboBox Control Test";
MSG msg;
RegisterAndCreateWindow ( hInst, className, "ComboBox Control Test" );
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return (int)msg.wParam;
}

View File

@@ -0,0 +1,22 @@
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = combotst
TARGET_SDKLIBS = kernel32.a gdi32.a
TARGET_OBJECTS = \
combotst.o \
utils.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,33 @@
/*
* Edit Control Test for ReactOS, quick n' dirty. There you go
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
* by Waldo Alvarez Ca<43>izares <wac at ghost.matcom.uh.cu>, June 22, 2003.
*/
#include <windows.h>
static const char hexvals[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
VOID htoa (unsigned int val, char *buf)
{
int i;
buf += 7;
for (i=0;i<8;i++)
{
*buf-- = hexvals[val & 0x0000000F];
val = val >> 4;
}
}
VOID strcpy_(char *dst, const char *src)
{
const char* p = src;
while ((*dst++ = *p++)) {}
}
VOID strcpyw_(wchar_t* dst,wchar_t* src)
{
const wchar_t* p = src;
while ((*dst++ = *p++)) {}
}

View File

@@ -0,0 +1,9 @@
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
VOID htoa (unsigned int, char *);
VOID strcpy_(char *, const char *);
VOID strcpyw_(wchar_t*,wchar_t*);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View 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

View 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);
}

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,19 @@
# $Id: Makefile,v 1.1 2002/12/27 23:54:33 gvg Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = copymove
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,302 @@
/*
* CopyFile, MoveFile and related routines test
*/
#include <ctype.h>
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
static TCHAR
FindOtherDrive()
{
DWORD drives = GetLogicalDrives();
BOOL found = FALSE;
TCHAR drive;
TCHAR rootdir[] = _T( "?:\\" );
TCHAR currentdir[MAX_PATH + 1];
if (0 != GetCurrentDirectory(MAX_PATH + 1, currentdir)) {
for (drive = _T('A'); ! found && drive <= _T('Z'); drive++) {
if (0 != (drives & (1 << (drive - _T('A'))))&&
drive != _totupper(currentdir[0])) {
rootdir[0] = drive;
found = (DRIVE_FIXED == GetDriveType(rootdir));
}
}
}
return found ? drive - 1 : _T( ' ' );
}
static void
DeleteTestFile(LPCTSTR filename)
{
SetFileAttributes(filename, FILE_ATTRIBUTE_NORMAL);
DeleteFile(filename);
}
static void
CreateTestFile(LPCTSTR filename, DWORD attributes)
{
HANDLE file;
char buffer[4096];
DWORD wrote;
int c;
DeleteTestFile(filename);
file = CreateFile(filename,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
0,
0);
if (INVALID_HANDLE_VALUE == file) {
fprintf(stderr, "CreateFile failed with code %d\n", GetLastError());
exit(1);
}
for(c = 0; c < sizeof(buffer); c++) {
buffer[c] = (char) c;
}
if (! WriteFile(file, buffer, sizeof(buffer), &wrote, NULL)) {
fprintf(stderr, "WriteFile failed with code %d\n", GetLastError());
exit(1);
}
CloseHandle(file);
if (! SetFileAttributes(filename, attributes)) {
fprintf(stderr, "SetFileAttributes failed with code %d\n", GetLastError());
exit(1);
}
}
static void
DeleteTestDir(LPCTSTR dirname)
{
RemoveDirectory(dirname);
}
static void
CreateTestDir(LPCTSTR dirname)
{
if (! CreateDirectory(dirname, NULL)) {
fprintf(stderr, "CreateDirectory failed with code %d\n", GetLastError());
exit(1);
}
}
static void
CheckTestFile(LPCTSTR filename, DWORD attributes)
{
HANDLE file;
char buffer[4096];
DWORD read;
int c;
DWORD diskattr;
file = CreateFile(filename,
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
0,
0);
if (INVALID_HANDLE_VALUE == file) {
fprintf(stderr, "CreateFile failed with code %d\n", GetLastError());
exit(1);
}
if (! ReadFile(file, buffer, sizeof(buffer), &read, NULL)) {
fprintf(stderr, "ReadFile failed with code %d\n", GetLastError());
exit(1);
}
if (read != sizeof(buffer)) {
fprintf(stderr, "Trying to read %d bytes but got %d bytes\n", sizeof(buffer), read);
exit(1);
}
for(c = 0; c < sizeof(buffer); c++) {
if (buffer[c] != (char) c) {
fprintf(stderr, "File contents changed at position %d\n", c);
exit(1);
}
}
CloseHandle(file);
diskattr = GetFileAttributes(filename);
if (INVALID_FILE_ATTRIBUTES == diskattr) {
fprintf(stderr, "GetFileAttributes failed with code %d\n", GetLastError());
exit(1);
}
if (diskattr != attributes) {
fprintf(stderr, "Attribute mismatch, expected 0x%08x found 0x%08x\n", attributes, diskattr);
exit(1);
}
}
int
main(int argc, char *argv[])
{
TCHAR otherdrive;
TCHAR otherfile[ ] = _T("?:\\other.dat");
otherdrive = FindOtherDrive();
printf("Testing simple move\n");
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
DeleteTestFile(_T("end.dat"));
if (! MoveFile(_T("begin.dat"), _T("end.dat"))) {
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
exit(1);
}
CheckTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE);
DeleteTestFile(_T("end.dat"));
printf("Testing move of non-existing file\n");
DeleteTestFile(_T("begin.dat"));
DeleteTestFile(_T("end.dat"));
if (MoveFile(_T("begin.dat"), _T("end.dat"))) {
fprintf(stderr, "MoveFile succeeded but shouldn't have\n");
exit(1);
} else if (ERROR_FILE_NOT_FOUND != GetLastError()) {
fprintf(stderr, "MoveFile failed with unexpected code %d\n", GetLastError());
exit(1);
}
DeleteTestFile(_T("end.dat"));
/* Not correctly implemented in ros, destination file is kept open after this */
#if 0
printf("Testing move to existing file\n");
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
CreateTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE);
if (MoveFile(_T("begin.dat"), _T("end.dat"))) {
fprintf(stderr, "MoveFile succeeded but shouldn't have\n");
exit(1);
} else if (ERROR_ALREADY_EXISTS != GetLastError()) {
fprintf(stderr, "MoveFile failed with unexpected code %d\n", GetLastError());
exit(1);
}
DeleteTestFile(_T("begin.dat"));
DeleteTestFile(_T("end.dat"));
#endif
/* Not implemented yet in ros */
#if 0
printf("Testing directory move\n");
CreateTestDir(_T("begin"));
CreateTestFile(_T("begin\\file.dat"), FILE_ATTRIBUTE_NORMAL);
DeleteTestDir(_T("end"));
if (! MoveFile(_T("begin"), _T("end"))) {
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
exit(1);
}
CheckTestFile(_T("end\\file.dat"), FILE_ATTRIBUTE_NORMAL);
DeleteTestFile(_T("end\\file.dat"));
DeleteTestDir(_T("end"));
#endif
printf("Testing file move to different directory\n");
CreateTestFile(_T("file.dat"), FILE_ATTRIBUTE_NORMAL);
CreateTestDir(_T("end"));
if (! MoveFile(_T("file.dat"), _T("end\\file.dat"))) {
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
exit(1);
}
CheckTestFile(_T("end\\file.dat"), FILE_ATTRIBUTE_ARCHIVE);
DeleteTestFile(_T("end\\file.dat"));
DeleteTestDir(_T("end"));
printf("Testing move of read-only file\n");
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_READONLY);
DeleteTestFile(_T("end.dat"));
if (! MoveFile(_T("begin.dat"), _T("end.dat"))) {
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
exit(1);
}
CheckTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY);
DeleteTestFile(_T("end.dat"));
printf("Testing move to different drive\n");
if (_T(' ') != otherdrive) {
otherfile[0] = otherdrive;
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
DeleteTestFile(otherfile);
if (! MoveFile(_T("begin.dat"), otherfile)) {
fprintf(stderr, "MoveFile failed with code %d\n", GetLastError());
exit(1);
}
CheckTestFile(otherfile, FILE_ATTRIBUTE_ARCHIVE);
DeleteTestFile(otherfile);
} else {
printf(" Test skipped, no other drive available\n");
}
printf("Testing move/overwrite of existing file\n");
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
CreateTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE);
if (! MoveFileEx(_T("begin.dat"), _T("end.dat"), MOVEFILE_REPLACE_EXISTING)) {
fprintf(stderr, "MoveFileEx failed with code %d\n", GetLastError());
exit(1);
}
DeleteTestFile(_T("begin.dat"));
DeleteTestFile(_T("end.dat"));
/* Not (correctly) implemented in ros yet */
#if 0
printf("Testing move/overwrite of existing readonly file\n");
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
CreateTestFile(_T("end.dat"), FILE_ATTRIBUTE_READONLY);
if (MoveFileEx(_T("begin.dat"), _T("end.dat"), MOVEFILE_REPLACE_EXISTING)) {
fprintf(stderr, "MoveFileEx succeeded but shouldn't have\n");
exit(1);
} else if (ERROR_ALREADY_EXISTS != GetLastError() &&
ERROR_ACCESS_DENIED != GetLastError()) {
fprintf(stderr, "MoveFileEx failed with unexpected code %d\n", GetLastError());
exit(1);
}
DeleteTestFile(_T("begin.dat"));
DeleteTestFile(_T("end.dat"));
#endif
/* Not implemented in ros yet */
#if 0
printf("Testing move to different drive without COPY_ALLOWED\n");
if (_T(' ') != otherdrive) {
otherfile[0] = otherdrive;
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
DeleteTestFile(otherfile);
if (MoveFileEx(_T("begin.dat"), otherfile, 0)) {
fprintf(stderr, "MoveFileEx succeeded but shouldn't have\n");
exit(1);
} else if (ERROR_NOT_SAME_DEVICE != GetLastError()) {
fprintf(stderr, "MoveFileEx failed with unexpected code %d\n", GetLastError());
exit(1);
}
DeleteTestFile(otherfile);
} else {
printf(" Test skipped, no other drive available\n");
}
#endif
printf("Testing move to different drive with COPY_ALLOWED\n");
if (_T(' ') != otherdrive) {
otherfile[0] = otherdrive;
CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE);
DeleteTestFile(otherfile);
if (! MoveFileEx(_T("begin.dat"), otherfile, MOVEFILE_COPY_ALLOWED)) {
fprintf(stderr, "MoveFileEx failed with code %d\n", GetLastError());
exit(1);
}
CheckTestFile(otherfile, FILE_ATTRIBUTE_ARCHIVE);
DeleteTestFile(otherfile);
} else {
printf(" Test skipped, no other drive available\n");
}
printf("All tests successfully completed\n");
return 0;
}

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View 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

View 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 */

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,196 @@
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#define CELL_SIZE 10
static RGBQUAD Colors[] =
{
{ 0x00, 0x00, 0x00, 0x00 }, // black
{ 0x00, 0x00, 0x80, 0x00 }, // red
{ 0x00, 0x80, 0x00, 0x00 }, // green
{ 0x00, 0x80, 0x80, 0x00 }, // brown
{ 0x80, 0x00, 0x00, 0x00 }, // blue
{ 0x80, 0x00, 0x80, 0x00 }, // magenta
{ 0x80, 0x80, 0x00, 0x00 }, // cyan
{ 0x80, 0x80, 0x80, 0x00 }, // dark gray
{ 0xc0, 0xc0, 0xc0, 0x00 }, // light gray
{ 0x00, 0x00, 0xFF, 0x00 }, // bright red
{ 0x00, 0xFF, 0x00, 0x00 }, // bright green
{ 0x00, 0xFF, 0xFF, 0x00 }, // bright yellow
{ 0xFF, 0x00, 0x00, 0x00 }, // bright blue
{ 0xFF, 0x00, 0xFF, 0x00 }, // bright magenta
{ 0xFF, 0xFF, 0x00, 0x00 }, // bright cyan
{ 0xFF, 0xFF, 0xFF, 0x00 } // bright white
};
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
WNDCLASS wc;
MSG msg;
HWND hWnd;
wc.lpszClassName = "DibTestClass";
wc.lpfnWndProc = MainWndProc;
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (RegisterClass(&wc) == 0)
{
fprintf(stderr, "RegisterClass failed (last error 0x%X)\n",
GetLastError());
return(1);
}
hWnd = CreateWindow("DibTestClass",
"DIB Test",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
25 * CELL_SIZE + 5,
25 * CELL_SIZE + 20,
NULL,
NULL,
hInstance,
NULL);
if (hWnd == NULL)
{
fprintf(stderr, "CreateWindow failed (last error 0x%X)\n",
GetLastError());
return(1);
}
ShowWindow(hWnd, nCmdShow);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
static void PaintCells(HDC WindowDC, WORD BitCount1, WORD BitCount2,
int XDest, int YDest)
{
HBRUSH Brush;
RECT Rect;
UINT row, col;
BITMAPINFO *BitmapInfo;
HBITMAP DIB1, DIB2;
HDC DC1, DC2;
BitmapInfo = malloc(sizeof(BITMAPINFO) + 15 * sizeof(RGBQUAD));
BitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
BitmapInfo->bmiHeader.biWidth = 4 * CELL_SIZE + 9;
BitmapInfo->bmiHeader.biHeight = -(4 * CELL_SIZE + 9); // it's top down (since BI_RGB is used, the sign is operative of direction)
BitmapInfo->bmiHeader.biPlanes = 1;
BitmapInfo->bmiHeader.biBitCount = BitCount1;
BitmapInfo->bmiHeader.biCompression = BI_RGB;
BitmapInfo->bmiHeader.biSizeImage = 0;
BitmapInfo->bmiHeader.biXPelsPerMeter = 0;
BitmapInfo->bmiHeader.biYPelsPerMeter = 0;
BitmapInfo->bmiHeader.biClrUsed = 16;
BitmapInfo->bmiHeader.biClrImportant = 16;
for (col = 0; col < 16; col++) {
BitmapInfo->bmiColors[col] = Colors[col];
}
DIB1 = CreateDIBSection(NULL, BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
DC1 = CreateCompatibleDC(NULL);
SelectObject(DC1, DIB1);
BitmapInfo->bmiHeader.biBitCount = BitCount2;
DIB2 = CreateDIBSection(NULL, BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
DC2 = CreateCompatibleDC(NULL);
SelectObject(DC2, DIB2);
free(BitmapInfo);
/* Now paint on the first bitmap */
for (row = 0; row < 4; row++)
{
for (col = 0; col < 4; col++)
{
Brush = CreateSolidBrush(RGB(Colors[4 * row + col].rgbRed,
Colors[4 * row + col].rgbGreen,
Colors[4 * row + col].rgbBlue));
Rect.left = CELL_SIZE * col + 5;
Rect.top = CELL_SIZE * row + 5;
Rect.right = Rect.left + CELL_SIZE;
Rect.bottom = Rect.top + CELL_SIZE;
FillRect(DC1, &Rect, Brush);
DeleteObject(Brush);
}
}
/* Copy the first bitmap to the second */
BitBlt(DC2, 4, 4, 4 * CELL_SIZE, 4 * CELL_SIZE, DC1, 5, 5, SRCCOPY);
/* Show results on screen */
BitBlt(WindowDC, XDest, YDest, 4 * CELL_SIZE, 4 * CELL_SIZE, DC2, 4, 4, SRCCOPY);
}
LRESULT CALLBACK MainWndProc(HWND Wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC WindowDC;
switch(msg)
{
case WM_PAINT:
WindowDC = BeginPaint(Wnd, &ps);
PaintCells(WindowDC, 4, 4, 0, 0);
PaintCells(WindowDC, 4, 8, 5 * CELL_SIZE, 0);
PaintCells(WindowDC, 4, 16, 10 * CELL_SIZE, 0);
PaintCells(WindowDC, 4, 24, 15 * CELL_SIZE, 0);
PaintCells(WindowDC, 4, 32, 20 * CELL_SIZE, 0);
PaintCells(WindowDC, 8, 4, 0, 5 * CELL_SIZE);
PaintCells(WindowDC, 8, 8, 5 * CELL_SIZE, 5 * CELL_SIZE);
PaintCells(WindowDC, 8, 16, 10 * CELL_SIZE, 5 * CELL_SIZE);
PaintCells(WindowDC, 8, 24, 15 * CELL_SIZE, 5 * CELL_SIZE);
PaintCells(WindowDC, 8, 32, 20 * CELL_SIZE, 5 * CELL_SIZE);
PaintCells(WindowDC, 16, 4, 0, 10 * CELL_SIZE);
PaintCells(WindowDC, 16, 8, 5 * CELL_SIZE, 10 * CELL_SIZE);
PaintCells(WindowDC, 16, 16, 10 * CELL_SIZE, 10 * CELL_SIZE);
PaintCells(WindowDC, 16, 24, 15 * CELL_SIZE, 10 * CELL_SIZE);
PaintCells(WindowDC, 16, 32, 20 * CELL_SIZE, 10 * CELL_SIZE);
PaintCells(WindowDC, 24, 4, 0, 15 * CELL_SIZE);
PaintCells(WindowDC, 24, 8, 5 * CELL_SIZE, 15 * CELL_SIZE);
PaintCells(WindowDC, 24, 16, 10 * CELL_SIZE, 15 * CELL_SIZE);
PaintCells(WindowDC, 24, 24, 15 * CELL_SIZE, 15 * CELL_SIZE);
PaintCells(WindowDC, 24, 32, 20 * CELL_SIZE, 15 * CELL_SIZE);
PaintCells(WindowDC, 32, 4, 0, 20 * CELL_SIZE);
PaintCells(WindowDC, 32, 8, 5 * CELL_SIZE, 20 * CELL_SIZE);
PaintCells(WindowDC, 32, 16, 10 * CELL_SIZE, 20 * CELL_SIZE);
PaintCells(WindowDC, 32, 24, 15 * CELL_SIZE, 20 * CELL_SIZE);
PaintCells(WindowDC, 32, 32, 20 * CELL_SIZE, 20 * CELL_SIZE);
EndPaint(Wnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(Wnd, msg, wParam, lParam);
}
return 0;
}

View File

@@ -0,0 +1,21 @@
# $Id: makefile,v 1.2 2003/03/04 10:09:00 gvg Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = dibtest
TARGET_SDKLIBS = kernel32.a gdi32.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View 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");
}

View 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

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,649 @@
/* Edit Control Test for ReactOS, quick n' dirty. Very rigid too.
* There you go, is only a test program. Not made to be fast, small
* easy to mantain, or portable. Lots of duplicated code too.
* I'm not erasing text because I don't want to use other functions from th API
* or make this more complex.
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
* by Waldo Alvarez Ca<43>izares <wac at ghost.matcom.uh.cu>, June 22, 2003. */
//#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "utils.h"
#define CREATEWINDOW 106
#define CREATEWINDOWEX 107
#define CREATEWINDOWW 108
#define ResultX 0
#define ResultY 305
#define NOTIFYX 350
#define NOTIFYY 285
#define BUFFERLEN 80 /* Size of buffer to hold result strings */
/* Edit is created with this text */
#define TestStr "The quick brown fox jumps over the lazy dog"
#define TestStrW L"This is a WCHAR string" /* Wide to support unicode edits */
#define MAXMESSAGEBUTTONS 42
HWND g_hwnd = NULL;
HINSTANCE g_hInst = NULL;
int pos = 10;
int n = 0;
int yButPos = 10;
int xButPos = 10;
DWORD EditStyle = 0;
DWORD EditWidth = 240;
DWORD EditHeight = 250;
BOOL UnicodeUsed = FALSE;
HWND hwndEdit = NULL;
POINTL point={10,3};
RECT rect = {0,0,20,20},rect2;
DWORD StartP,EndP;
#define ReplaceTextStr "->> Replaced!! <<-"
char* AllocatedText; /* Buffer in the heap to feed it to the edit control */
char* NewText = "New text for the edit control";
wchar_t* NewTextW = L"New text for the edit control in UNICODE"; // Wide
char TextBuffer[BUFFERLEN]={'R','e','s','u','l','t',':',' '};
typedef void FunctionHandler(HWND,DWORD,WPARAM,LPARAM);
typedef FunctionHandler* LPFUNCTIONHANDLER;
PrintTextXY(char* Text,int x,int y,int len)
{
HDC hdc;
hdc = GetDC (g_hwnd);
SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT));
TextOut (hdc, x,y,Text,len);
ReleaseDC (g_hwnd, hdc);
ValidateRect (g_hwnd, &rect);
}
static
VOID
HandlePrintReturnHex(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
{
int ret;
ret = SendMessage(handle,Msg,wParam,lParam);
htoa(ret,&TextBuffer[8]);
PrintTextXY(TextBuffer,ResultX,ResultY,16);
}
static
VOID
HandleSetHandlePrintHex(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
{
LPVOID pMem;
HANDLE hNewBuffer;
int ret;
LocalFree((HLOCAL)SendMessage(handle, EM_GETHANDLE, 0, 0L));
if (UnicodeUsed)
{
hNewBuffer = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, 100);
pMem = LocalLock(hNewBuffer);
strcpyw_((wchar_t*)pMem,NewTextW);
}
else
{
hNewBuffer = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT,50);
pMem = LocalLock(hNewBuffer);
strcpy_((char*)pMem,NewText);
}
LocalUnlock(pMem);
hNewBuffer = LocalHandle(pMem);
/* Updates the buffer and displays new buffer */
ret = SendMessage(handle, EM_SETHANDLE, (WPARAM)hNewBuffer, 0L);
htoa(ret,&TextBuffer[8]);
PrintTextXY(TextBuffer,ResultX,ResultY,16);
}
static
VOID
HandlePrintReturnStr(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
{
int ret;
TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */
ret = SendMessage(handle,Msg,wParam,lParam);
PrintTextXY(TextBuffer,ResultX,ResultY,8+ret);
}
static
VOID
HandlePrintRect(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
{
TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */
SendMessage(handle,Msg,wParam,lParam);
htoa(rect.top,&TextBuffer[8]);
TextBuffer[8+8] = ' ';
htoa(rect.bottom,&TextBuffer[8+8+1]);
TextBuffer[8+8+8+1] = ' ';
htoa(rect.left,&TextBuffer[8+8+8+1+1]);
TextBuffer[8+8+8+8+1+1] = ' ';
htoa(rect.right,&TextBuffer[8+8+8+8+1+1+1]);
PrintTextXY(TextBuffer,ResultX,ResultY,8+4*9-1);
}
static
VOID
HandlePrintPasswdChar(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
int ret = SendMessage(handle,Msg,wParam,lParam);
int s;
if (ret)
{
s = 1;
TextBuffer[8] = (char)(ret);
}
else
{
TextBuffer[8] = 'N';
TextBuffer[9] = 'U';
TextBuffer[10] = 'L';
TextBuffer[11] = 'L';
s = 4;
}
hdc = GetDC (g_hwnd);
SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT));
TextOut (hdc,ResultX ,ResultY,TextBuffer,8+s);
ReleaseDC (g_hwnd, hdc);
ValidateRect (g_hwnd, &rect);
}
struct
{
char* Text; /* Text for the button */
DWORD MsgCode; /* Message Code */
WPARAM wParam; /* Well hope you can understand this */
LPARAM lParam; /* ditto */
LPFUNCTIONHANDLER Handler; /* Funtion called to handle the result of each message */
}
Msg[] =
{
"EM_CANUNDO",EM_CANUNDO,0,0,&HandlePrintReturnHex,
"EM_CHARFROMPOS",EM_CHARFROMPOS,(WPARAM)&point,0,&HandlePrintReturnHex,
"EM_EMPTYUNDOBUFFER",EM_EMPTYUNDOBUFFER,0,0,&HandlePrintReturnHex,
"EM_FMTLINES",EM_FMTLINES,TRUE,0,&HandlePrintReturnHex,
"EM_GETFIRSTVISIBLELINE",EM_GETFIRSTVISIBLELINE,0,0,&HandlePrintReturnHex,
"EM_GETLIMITTEXT",EM_GETLIMITTEXT,0,0,&HandlePrintReturnHex,
"EM_GETLINE",EM_GETLINE,2,(WPARAM)&TextBuffer[8],&HandlePrintReturnStr,
"EM_GETLINECOUNT",EM_GETLINECOUNT,0,0,&HandlePrintReturnHex,
"EM_GETMARGINS",EM_GETMARGINS,0,0,&HandlePrintReturnHex,
"EM_SETMARGINS",EM_SETMARGINS,EC_LEFTMARGIN,10,&HandlePrintReturnHex,
"EM_GETMODIFY",EM_GETMODIFY,0,0,&HandlePrintReturnHex,
"EM_SETMODIFY",EM_SETMODIFY,TRUE,0,&HandlePrintReturnHex,
"EM_GETSEL",EM_GETSEL,(WPARAM)&StartP,(LPARAM)&EndP,&HandlePrintReturnHex,
"EM_GETTHUMB",EM_GETTHUMB,0,0,&HandlePrintReturnHex,
"EM_LIMITTEXT",EM_LIMITTEXT,10,0,&HandlePrintReturnHex,
"EM_LINEFROMCHAR",EM_LINEFROMCHAR,-1,0,&HandlePrintReturnHex,
"EM_POSFROMCHAR",EM_POSFROMCHAR,10,0,&HandlePrintReturnHex,
"EM_LINEINDEX",EM_LINEINDEX,2,0,&HandlePrintReturnHex,
"EM_LINELENGTH",EM_LINELENGTH,-1,0,&HandlePrintReturnHex,
"EM_GETWORDBREAKPROC",EM_GETWORDBREAKPROC,0,0,&HandlePrintReturnHex,
"EM_REPLACESEL",EM_REPLACESEL,TRUE,(LPARAM)&ReplaceTextStr,&HandlePrintReturnHex,
"EM_LINESCROLL",EM_LINESCROLL,5,1,&HandlePrintReturnHex,
"EM_SCROLL",EM_SCROLL,SB_LINEDOWN,0,&HandlePrintReturnHex,
"EM_SCROLLCARET",EM_SCROLLCARET,0,0,&HandlePrintReturnHex,
"EM_SETHANDLE",EM_SETHANDLE,0,0,&HandleSetHandlePrintHex,
"EM_GETHANDLE",EM_GETHANDLE,0,0,&HandlePrintReturnHex,
"EM_GETPASSWORDCHAR",EM_GETPASSWORDCHAR,0,0,&HandlePrintPasswdChar,
"EM_SETPASSWORDCHAR - clear",EM_SETPASSWORDCHAR,0,0,&HandlePrintReturnHex,
"EM_SETPASSWORDCHAR - x",EM_SETPASSWORDCHAR,'x',0,&HandlePrintReturnHex,
"EM_SETREADONLY - set",EM_SETREADONLY,TRUE,0,&HandlePrintReturnHex,
"EM_SETREADONLY - clear",EM_SETREADONLY,FALSE,0,&HandlePrintReturnHex,
"EM_GETRECT",EM_GETRECT,0,(LPARAM)&rect2,&HandlePrintRect,
"EM_SETRECT",EM_SETRECT,0,(LPARAM)&rect,&HandlePrintReturnHex,
"EM_SETRECTNP",EM_SETRECTNP,0,(LPARAM)&rect,&HandlePrintReturnHex,
"EM_SETSEL",EM_SETSEL,1,3,&HandlePrintReturnHex,
"EM_SETSEL - all",EM_SETSEL,0,-1,&HandlePrintReturnHex,
"EM_SETSEL - remove",EM_SETSEL,-1,0,&HandlePrintReturnHex,
"EM_UNDO",EM_UNDO,0,0,&HandlePrintReturnHex,
"WM_UNDO",WM_UNDO,0,0,&HandlePrintReturnHex,
"WM_PASTE",WM_PASTE,0,0,&HandlePrintReturnHex,
"WM_CUT",WM_CUT,0,0,&HandlePrintReturnHex,
"WM_COPY",WM_COPY,0,0,&HandlePrintReturnHex
};
DWORD EditStyles[] = {
WS_THICKFRAME,WS_DISABLED,WS_BORDER,ES_LOWERCASE,ES_UPPERCASE,ES_NUMBER,ES_AUTOVSCROLL,
ES_AUTOHSCROLL,ES_LEFT,ES_CENTER,ES_RIGHT,ES_MULTILINE,
ES_NOHIDESEL,ES_OEMCONVERT,ES_PASSWORD,ES_READONLY,ES_WANTRETURN,
WS_HSCROLL,WS_VSCROLL
};
char* StyleNames[] = {
"WS_THICKFRAME","WS_DISABLED","WS_BORDER","ES_LOWERCASE","ES_UPPERCASE","ES_NUMBER","ES_AUTOVSCROLL",
"ES_AUTOHSCROLL","ES_LEFT","ES_CENTER","ES_RIGHT","ES_MULTILINE",
"ES_NOHIDESEL","ES_OEMCONVERT","ES_PASSWORD","ES_READONLY","ES_WANTRETURN",
"WS_HSCROLL","WS_VSCROLL"
};
#define NUMBERBUTTONS 26
HWND Buttons[NUMBERBUTTONS];
HWND MessageButtons[MAXMESSAGEBUTTONS];
HWND Back1But,Back2But;
HWND NextBut;
HWND
CreateCheckButton(const char* lpWindowName, DWORD xSize, DWORD id)
{
HWND h;
h = CreateWindowEx(0,
"BUTTON",
lpWindowName,
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
xButPos, /* x */
yButPos, /* y */
xSize, /* nWidth */
20, /* nHeight */
g_hwnd,
(HMENU) id,
g_hInst,
NULL
);
yButPos += 21;
return h;
}
HWND
CreatePushButton(const char* lpWindowName, DWORD xSize, DWORD id,DWORD Style)
{
HWND h = CreateWindow("BUTTON",
lpWindowName,
WS_CHILD | BS_PUSHBUTTON | Style,
xButPos, // x
yButPos, // y
xSize, // nWidth
20, // nHeight
g_hwnd,
(HMENU) id,
g_hInst,
NULL
);
yButPos += 21;
return h;
}
VOID
ReadNHide()
{
int i;
EditStyle = 0;
for (i=0 ; i< 19 ; i++)
{
if(BST_CHECKED == SendMessage(Buttons[i],BM_GETCHECK,0,0))
EditStyle |= EditStyles[i];
ShowWindow(Buttons[i],SW_HIDE);
}
for (; i< NUMBERBUTTONS ; i++)ShowWindow(Buttons[i],SW_HIDE);
for (i=0 ; i< 26 ; i++) ShowWindow(MessageButtons[i],SW_SHOW);
ShowWindow(Back1But,SW_SHOW);
ShowWindow(NextBut,SW_SHOW);
}
VOID
ForwardToSecondPage()
{
int i;
for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_HIDE);
for(;i<MAXMESSAGEBUTTONS;i++)ShowWindow(MessageButtons[i],SW_SHOW);
ShowWindow(Back2But,SW_SHOW);
ShowWindow(Back1But,SW_HIDE);
ShowWindow(NextBut,SW_HIDE);
}
VOID
BackToFirstPage()
{
int i;
for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_SHOW);
for(;i<MAXMESSAGEBUTTONS;i++)ShowWindow(MessageButtons[i],SW_HIDE);
ShowWindow(Back2But,SW_HIDE);
ShowWindow(Back1But,SW_SHOW);
ShowWindow(NextBut,SW_SHOW);
}
VOID
BackToInitialPage()
{
int i;
DestroyWindow(hwndEdit);
for (i=0 ; i< NUMBERBUTTONS ; i++) {ShowWindow(Buttons[i],SW_SHOW);}
for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_HIDE);
ShowWindow(Back1But,SW_HIDE);
ShowWindow(NextBut,SW_HIDE);
}
LRESULT
CALLBACK
WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
int i;
switch ( msg )
{
case WM_CREATE:
g_hwnd = hwnd;
/* ---- Initial page ---- */
for (i = 0 ; i < 14 ; i++)
Buttons[i] = CreateCheckButton(StyleNames[i],150,500+i);
xButPos += 160;
yButPos = 10;
for (; i < 19 ; i++)
Buttons[i] = CreateCheckButton(StyleNames[i],140,500+i);
Buttons[i++] = CreatePushButton("Width +",70,100,WS_VISIBLE);
Buttons[i++] = CreatePushButton("Width -",70,101,WS_VISIBLE);
Buttons[i++] = CreatePushButton("Heigth +",70,102,WS_VISIBLE);
Buttons[i++] = CreatePushButton("Heigth -",70,103,WS_VISIBLE);
Buttons[i++] = CreatePushButton("CreateWindowA",140,CREATEWINDOW,WS_VISIBLE);
Buttons[i++] = CreatePushButton("CreateWindowExA",140,CREATEWINDOWEX,WS_VISIBLE);
Buttons[i++] = CreatePushButton("CreateWindowExW",140,CREATEWINDOWW,WS_VISIBLE);
/* ---- The 1st page of buttons ---- */
xButPos = 0;
yButPos = 10;
for (i = 0 ; i < 14 ; i++)
MessageButtons[i] = CreatePushButton(Msg[i].Text,170,600+i,0);
xButPos += 180;
yButPos = 10;
for (; i < 26 ; i++)
MessageButtons[i] = CreatePushButton(Msg[i].Text,170,600+i,0);
Back1But = CreatePushButton("Back - destroys edit",170,400,0);
NextBut = CreatePushButton("Next",170,401,0);
/* ---- The 2nd page of buttons ------*/
xButPos = 0;
yButPos = 10;
for (; i<40; i++)
MessageButtons[i] = CreatePushButton(Msg[i].Text,170,600+i,0);
xButPos += 180;
yButPos = 10;
for (; i < MAXMESSAGEBUTTONS ; i++)
MessageButtons[i] = CreatePushButton(Msg[i].Text,170,600+i,0);
Back2But = CreatePushButton("Back",170,402,0);
break;
case WM_COMMAND:
if (LOWORD(wParam) >= 600)
{
Msg[LOWORD(wParam)-600].Handler(hwndEdit,
Msg[LOWORD(wParam)-600].MsgCode,
Msg[LOWORD(wParam)-600].wParam,
Msg[LOWORD(wParam)-600].lParam);
break;
}
switch(LOWORD(wParam)){
case 100:
EditWidth += 10;
break;
case 101:
EditWidth -= 10;
break;
case 102:
EditHeight += 10;
break;
case 103:
EditHeight -= 10;
break;
case 400:
BackToInitialPage();
break;
case 401:
ForwardToSecondPage();
break;
case 402:
BackToFirstPage();
break;
case CREATEWINDOW:
UnicodeUsed = FALSE;
ReadNHide();
hwndEdit = CreateWindow("EDIT",
TestStr,
EditStyle | WS_CHILD | WS_VISIBLE,
350,
10,
EditWidth,
EditHeight,
g_hwnd,
NULL,
g_hInst,
NULL);
break;
case CREATEWINDOWEX:
UnicodeUsed = FALSE;
ReadNHide();
hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
"EDIT",
TestStr,
EditStyle | WS_CHILD | WS_VISIBLE ,
350,
10,
EditWidth,
EditHeight,
g_hwnd,
NULL,
g_hInst,
NULL);
break;
case CREATEWINDOWW:
UnicodeUsed = TRUE;
ReadNHide();
hwndEdit = CreateWindowExW(WS_EX_CLIENTEDGE,
L"EDIT",
TestStrW,
EditStyle | WS_CHILD | WS_VISIBLE ,
350,
10,
EditWidth,
EditHeight,
g_hwnd,
NULL,
g_hInst,
NULL);
break;
}
if (lParam == (LPARAM)hwndEdit)
switch(HIWORD(wParam))
{
case EN_CHANGE:
PrintTextXY("EN_CHANGE notification",NOTIFYX,NOTIFYY,22);
break;
case EN_ERRSPACE:
PrintTextXY("EN_ERRSPACE notification",NOTIFYX,NOTIFYY,24);
break;
/* --- FIXME not defined in w32api-2.3 headers
case H_SCROLL:
PrintTextXY("H_SCROLL notification",NOTIFYX,NOTIFYY,21);
break; */
/* --- FIXME not defined in w32api-2.3 headers
case KILL_FOCUS:
PrintTextXY("KILL_FOCUS notification",NOTIFYX,NOTIFYY,23);
break; */
/* --- FIXME not defined in w32api-2.3 headers
case EN_MAXTEST:
PrintTextXY("EN_MAXTEXT notification",NOTIFYX,NOTIFYY,23);
break; */
case EN_SETFOCUS:
PrintTextXY("EN_SETFOCUS notification",NOTIFYX,NOTIFYY,24);
break;
case EN_UPDATE:
PrintTextXY("EN_UPDATE notification",NOTIFYX,NOTIFYY + 20,22);
break;
case EN_VSCROLL:
PrintTextXY("EN_VSCROLL notification",NOTIFYX,NOTIFYY,23);
break;
}
break;
case WM_SIZE :
return 0;
case WM_CLOSE:
DestroyWindow (g_hwnd);
return 0;
case WM_QUERYENDSESSION:
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc ( hwnd, msg, wParam, lParam );
}
HWND
RegisterAndCreateWindow (HINSTANCE hInst,
const char* className,
const char* title)
{
WNDCLASSEX wc;
HWND hwnd;
g_hInst = hInst;
wc.cbSize = sizeof (WNDCLASSEX);
wc.lpfnWndProc = WndProc; /* window procedure */
wc.hInstance = hInst; /* owner of the class */
wc.lpszClassName = className;
wc.hCursor = LoadCursor ( 0, (LPCTSTR)IDC_ARROW );
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hIcon = 0;
wc.hIconSm = 0;
wc.lpszMenuName = 0;
if ( !RegisterClassEx ( &wc ) )
return NULL;
hwnd = CreateWindowEx (
0, /* dwStyleEx */
className, /* class name */
title, /* window title */
WS_OVERLAPPEDWINDOW, /* dwStyle */
1, /* x */
1, /* y */
560, /* width */
350, /* height */
NULL, /* hwndParent */
NULL, /* hMenu */
hInst,
0
);
if (!hwnd) return NULL;
ShowWindow (hwnd, SW_SHOW);
UpdateWindow (hwnd);
return hwnd;
}
int
WINAPI
WinMain ( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow )
{
char className [] = "Edit Control Test";
MSG msg;
RegisterAndCreateWindow ( hInst, className, "Edit Control Styles Test" );
// Message loop
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}

View File

@@ -0,0 +1,22 @@
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = edittest
TARGET_SDKLIBS = kernel32.a gdi32.a
TARGET_OBJECTS = \
edittest.o \
utils.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,33 @@
/*
* Edit Control Test for ReactOS, quick n' dirty. There you go
* This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
* by Waldo Alvarez Ca<43>izares <wac at ghost.matcom.uh.cu>, June 22, 2003.
*/
#include <windows.h>
static const char hexvals[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
VOID htoa (unsigned int val, char *buf)
{
int i;
buf += 7;
for (i=0;i<8;i++)
{
*buf-- = hexvals[val & 0x0000000F];
val = val >> 4;
}
}
VOID strcpy_(char *dst, const char *src)
{
const char* p = src;
while ((*dst++ = *p++)) {}
}
VOID strcpyw_(wchar_t* dst,wchar_t* src)
{
const wchar_t* p = src;
while ((*dst++ = *p++)) {}
}

View File

@@ -0,0 +1,9 @@
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
VOID htoa (unsigned int, char *);
VOID strcpy_(char *, const char *);
VOID strcpyw_(wchar_t*,wchar_t*);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,187 @@
/*
* enumwnd.c
*
* application to test the various Window Enumeration functions
*/
//#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
HBRUSH hbrBackground;
HFONT tf;
int test = 0;
const TCHAR* APP_NAME = "EnumWnd Test";
const TCHAR* CLASS_NAME = "EnumWndTestClass";
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
WNDCLASS wc;
MSG msg;
HWND hWnd;
wc.lpszClassName = CLASS_NAME;
wc.lpfnWndProc = MainWndProc;
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
if (RegisterClass(&wc) == 0)
{
_ftprintf ( stderr, _T("RegisterClass failed (last error 0x%X)\n"),
GetLastError());
return(1);
}
hWnd = CreateWindow(CLASS_NAME,
APP_NAME,
WS_OVERLAPPEDWINDOW,
0,
0,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
if (hWnd == NULL)
{
_ftprintf ( stderr, _T("CreateWindow failed (last error 0x%X)\n"),
GetLastError());
return(1);
}
tf = CreateFont (14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, _T("Timmons"));
hbrBackground = CreateSolidBrush ( RGB(192,192,192) );
ShowWindow ( hWnd, nCmdShow );
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
DeleteObject(hbrBackground);
DeleteObject(tf);
return msg.wParam;
}
void MyTextOut ( HDC hdc, int x, int y, const TCHAR* text )
{
TextOut ( hdc, x, y, text, _tcslen(text) );
}
typedef struct _EnumData
{
HDC hdc;
int x;
int y;
} EnumData;
BOOL CALLBACK MyWindowEnumProc ( HWND hwnd, LPARAM lParam )
{
TCHAR wndcaption[1024], buf[1024];
EnumData* ped = (EnumData*)lParam;
GetWindowText ( hwnd, wndcaption, sizeof(wndcaption)/sizeof(*wndcaption) );
_sntprintf ( buf, sizeof(buf)/sizeof(*buf), _T("%x - %s"), hwnd, wndcaption );
MyTextOut ( ped->hdc, ped->x, ped->y, buf );
ped->y += 13;
return TRUE;
}
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hDC;
RECT rect;
TCHAR buf[100];
EnumData ed;
switch(msg)
{
case WM_PAINT:
hDC = BeginPaint(hWnd, &ps);
SelectObject(hDC, tf);
GetClientRect ( hWnd, &rect );
FillRect ( hDC, &rect, hbrBackground );
MyTextOut ( hDC, 10, 10, "EnumWnd Test" );
_sntprintf ( buf, sizeof(buf)/sizeof(*buf), _T("My HWND: %x"), hWnd );
MyTextOut ( hDC, 10, 30, buf );
ed.hdc = hDC;
ed.x = 10;
ed.y = 70;
switch ( test )
{
case 1:
MyTextOut ( hDC, 10, 50, _T("Test #1: EnumWindows()") );
EnumWindows ( MyWindowEnumProc, (LPARAM)&ed );
break;
case 2:
MyTextOut ( hDC, 10, 50, _T("Test #2: EnumChildWindows()") );
EnumChildWindows ( hWnd, MyWindowEnumProc, (LPARAM)&ed );
break;
case 3:
MyTextOut ( hDC, 10, 50, _T("Test #3: EnumDesktopWindows") );
EnumDesktopWindows ( NULL, MyWindowEnumProc, (LPARAM)&ed );
break;
case 4:
MyTextOut ( hDC, 10, 50, _T("Test #4: EnumThreadWindows") );
EnumThreadWindows ( GetCurrentThreadId(), MyWindowEnumProc, (LPARAM)&ed );
break;
default:
MyTextOut ( hDC, 10, 50, _T("Press any of the number keys from 1 to 4 to run a test") );
MyTextOut ( hDC, 10, 70, _T("Press the left and right mouse buttons to cycle through the tests") );
break;
}
EndPaint(hWnd, &ps);
break;
case WM_CHAR:
test = (TCHAR)wParam - '1' + 1;
RedrawWindow ( hWnd, NULL, NULL, RDW_INVALIDATE );
break;
case WM_LBUTTONDOWN:
if ( ++test > 4 )
test = 1;
RedrawWindow ( hWnd, NULL, NULL, RDW_INVALIDATE );
break;
case WM_RBUTTONDOWN:
if ( !--test )
test = 4;
RedrawWindow ( hWnd, NULL, NULL, RDW_INVALIDATE );
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}

View File

@@ -0,0 +1,90 @@
# Microsoft Developer Studio Project File - Name="enumwnd" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=enumwnd - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "enumwnd.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "enumwnd.mak" CFG="enumwnd - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "enumwnd - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "enumwnd - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "enumwnd - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "enumwnd - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "enumwnd - Win32 Release"
# Name "enumwnd - Win32 Debug"
# Begin Source File
SOURCE=.\enumwnd.c
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,21 @@
# $Id: makefile,v 1.1 2003/07/25 19:13:14 royce Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = enumwnd
TARGET_SDKLIBS = kernel32.a gdi32.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,33 @@
#include <windows.h>
#include <stdio.h>
HANDLE events[2];
DWORD WINAPI thread( LPVOID crap )
{
SetEvent( events[0] );
if( crap )
SetEvent( events[1] );
return 1;
}
int main( 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;
}

View 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

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,65 @@
/*
* Author: Skywing (skywing@valhallalegends.com)
* Date: 09/09/2003
* Purpose: Test Thread-EventPair functionality.
*/
#include <windows.h>
#include <stdio.h>
#include <ddk/ntddk.h>
#ifndef NTAPI
#define NTAPI WINAPI
#endif
HANDLE MakeEventPair()
{
NTSTATUS Status;
HANDLE EventPair;
OBJECT_ATTRIBUTES Attributes;
InitializeObjectAttributes(&Attributes, NULL, 0, NULL, NULL);
Status = NtCreateEventPair(&EventPair, STANDARD_RIGHTS_ALL, &Attributes);
printf("Status %08x creating eventpair\n", Status);
return EventPair;
}
DWORD __stdcall threadfunc(void* eventpair)
{
printf("Thread: Set eventpair status %08x\n", NtSetInformationThread(NtCurrentThread(), ThreadEventPair, &eventpair, sizeof(HANDLE)));
Sleep(2500);
printf("Thread: Setting low and waiting high...\n");
printf("Thread: status = %08x\n", NtSetLowWaitHighThread());
printf("Thread: status = %08x\n", NtSetHighWaitLowThread());
printf("Thread: Terminating...\n");
return 0;
}
int main(int ac, char **av)
{
DWORD id;
HANDLE EventPair, Thread;
printf("Main: NtSetLowWaitHighThread is at %08x\n", NtSetLowWaitHighThread);
EventPair = MakeEventPair();
if(!EventPair) {
printf("Main: Could not create event pair.\n");
return 0;
}
printf("Main: EventPair = %08x\n", EventPair);
Thread = CreateThread(0, 0, threadfunc, EventPair, 0, &id);
printf("Main: ThreadId for new thread is %08x\n", id);
printf("Main: Setting high and waiting low\n");
printf("Main: status = %08x\n", NtSetHighWaitLowEventPair(EventPair));
Sleep(2500);
printf("Main: status = %08x\n", NtSetLowWaitHighEventPair(EventPair));
NtClose(EventPair);
/* WaitForSingleObject(Thread, INFINITE); FIXME: Waiting on thread handle causes double spinlock acquisition (and subsequent crash) in PsUnblockThread - ntoskrnl/ps/thread.c */
NtClose(Thread);
printf("Main: Terminating...\n");
return 0;
}

View File

@@ -0,0 +1,21 @@
# $Id: makefile,v 1.1 2003/09/10 06:12:21 vizzini Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = eventpair
TARGET_SDKLIBS = ntdll.a
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View 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

View 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;
}

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,344 @@
/*
* 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+=42)
{
MoveToEx (Desktop, 0, 0, NULL);
LineTo (Desktop, x, y);
}
for (y = 0, x = 639; y < 480; y+=42)
{
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;
HRGN hRgn1, hRgn2, hRgn3;
HBRUSH BlueBrush, DefBrush;
// 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);
//ei
BlueBrush = CreateSolidBrush( RGB(0, 0, 0xff) );
DefBrush = SelectObject( Desktop, BlueBrush );
hRgn1 = CreateRectRgn( 1, 2, 100, 101 );
hRgn2 = CreateRectRgn( 10, 20, 150, 151 );
hRgn3 = CreateRectRgn( 1, 1, 1, 1);
CombineRgn( hRgn3, hRgn1, hRgn2, RGN_XOR );
PaintRgn( Desktop, hRgn3 );
SelectObject( Desktop, DefBrush );
DeleteObject( BlueBrush );
// 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;
}

View 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

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

View File

@@ -0,0 +1,19 @@
# $Id: Makefile,v 1.1 2003/10/13 15:05:59 weiden Exp $
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = global_mem
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
*.o
*.d
*.exe
*.coff
*.sym
*.map

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